All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Dario Binacchi <dariobin@libero.it>
Cc: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>,
	linux-kernel@vger.kernel.org,
	Federico Vaga <federico.vaga@gmail.com>,
	Alexander Stein <alexander.stein@systec-electronic.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Oliver Hartkopp <socketcan@hartkopp.net>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	Wolfgang Grandegger <wg@grandegger.com>,
	YueHaibing <yuehaibing@huawei.com>,
	Zhang Qilong <zhangqilong3@huawei.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v3 5/6] can: c_can: prepare to up the message objects number
Date: Wed, 3 Mar 2021 10:00:36 +0100	[thread overview]
Message-ID: <20210303090036.aocqk6gp3vqnzaku@pengutronix.de> (raw)
In-Reply-To: <91394876.26757.1614759793793@mail1.libero.it>

[-- Attachment #1: Type: text/plain, Size: 2136 bytes --]

On 03.03.2021 09:23:13, Dario Binacchi wrote:
[...]
> > > @@ -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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-03-04  0:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28 10:38 [PATCH v3 0/6] can: c_can: add support to 64 message objects Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 1/6] can: c_can: remove unused code Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 2/6] can: c_can: fix indentation Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 3/6] can: c_can: fix control interface used by c_can_do_tx Dario Binacchi
2021-03-02 18:44   ` Kurt Van Dijck
2021-03-03  7:22     ` Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 4/6] can: c_can: use 32-bit write to set arbitration register Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 5/6] can: c_can: prepare to up the message objects number Dario Binacchi
2021-03-01 11:38   ` Marc Kleine-Budde
2021-03-01 13:08     ` Marc Kleine-Budde
2021-03-01 16:54       ` Marc Kleine-Budde
2021-03-01 17:24       ` Dario Binacchi
2021-03-01 19:46         ` Marc Kleine-Budde
2021-03-01 17:21     ` Dario Binacchi
2021-03-01 19:45       ` Marc Kleine-Budde
2021-03-02 10:50         ` Dario Binacchi
2021-03-02 10:56           ` Marc Kleine-Budde
2021-03-02 18:49   ` Kurt Van Dijck
2021-03-03  8:23     ` Dario Binacchi
2021-03-03  9:00       ` Marc Kleine-Budde [this message]
2021-03-03 10:31         ` Dario Binacchi
2021-03-03 10:36           ` Marc Kleine-Budde
2021-02-28 10:38 ` [PATCH v3 6/6] can: c_can: add support to 64 message objects Dario Binacchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210303090036.aocqk6gp3vqnzaku@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=alexander.stein@systec-electronic.com \
    --cc=dariobin@libero.it \
    --cc=davem@davemloft.net \
    --cc=dev.kurt@vandijck-laurijssen.be \
    --cc=federico.vaga@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=netdev@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    --cc=wg@grandegger.com \
    --cc=yuehaibing@huawei.com \
    --cc=zhangqilong3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.