Thread (23 messages) flat view 23 messages, 3 authors, 2021-03-03

Re: [PATCH v3 5/6] can: c_can: prepare to up the message objects number

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-03-03 14:41:37
Also in: linux-can, lkml

On 03.03.2021 09:23:13, Dario Binacchi wrote:
[...]
quoted
quoted
@@ -1205,17 +1203,31 @@ static int c_can_close(struct net_device *dev)
 	return 0;
 }
 
-struct net_device *alloc_c_can_dev(void)
+struct net_device *alloc_c_can_dev(int msg_obj_num)
 {
 	struct net_device *dev;
 	struct c_can_priv *priv;
+	int msg_obj_tx_num = msg_obj_num / 2;
IMO, a bigger tx queue is not usefull.
A bigger rx queue however is.
This would not be good for my application. I think it really depends
on the type of application. We can probably say that being able to
size rx/tx queue would be a useful feature.
Ok. There is an ethtool interface to configure the size of the RX and TX
queues. In ethtool it's called the RX/TX "ring" size and you can get it
via the -g parameter, e.g. here for by Ethernet interface:

| $ ethtool -g enp0s25
| Ring parameters for enp0s25:
| Pre-set maximums:
| RX:		4096
| RX Mini:	n/a
| RX Jumbo:	n/a
| TX:		4096
| Current hardware settings:
| RX:		256
| RX Mini:	n/a
| RX Jumbo:	n/a
| TX:		256

If I understand correctly patch 6 has some assumptions that RX and TX
are max 32. To support up to 64 RX objects, you have to convert:
- u32 -> u64
- BIT() -> BIT_ULL()
- GENMASK() -> GENMASK_ULL()

The register access has to be converted, too. For performance reasons
you want to do as least as possible. Which is probably the most
complicated.

In the flexcan driver I have a similar problem. The driver keeps masks,
which mailboxes are RX and which TX and I added wrapper functions to
minimize IO access:

https://elixir.bootlin.com/linux/v5.11/source/drivers/net/can/flexcan.c#L904

This should to IMHO into patch 6.

Adding the ethtool support and making the rings configurable would be a
separate patch.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help