All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: Antoine Tenart <antoine.tenart@bootlin.com>
Cc: davem@davemloft.net, Stefan Chulski <stefanc@marvell.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	maxime.chevallier@bootlin.com, gregory.clement@bootlin.com,
	miquel.raynal@bootlin.com, nadavh@marvell.com,
	ymarkman@marvell.com, mw@semihalf.com
Subject: Re: [PATCH net-next 5/5] net: mvpp2: jumbo frames support
Date: Fri, 2 Mar 2018 17:17:13 +0100	[thread overview]
Message-ID: <20180302171713.54beaad0@windsurf.lan> (raw)
In-Reply-To: <20180302154044.25204-6-antoine.tenart@bootlin.com>

Hello,

On Fri,  2 Mar 2018 16:40:44 +0100, Antoine Tenart wrote:

>  /* Attach long pool to rxq */
> @@ -4551,7 +4559,7 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, int pkt_size)
>  	struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool];
>  	int num;
>  
> -	if (pool < MVPP2_BM_SHORT || pool > MVPP2_BM_LONG) {
> +	if (pool < MVPP2_BM_SHORT || pool > MVPP2_BM_JUMBO) {

pool could be an unsigned, which would avoid the need for
MVPP2_BM_SHORT.

And for the upper limit, you have a convenient MVPP2_BM_POOLS_NUM in
your mvpp2_bm_pool_log_num enum, so why not use if ?



>  		netdev_err(port->dev, "Invalid pool %d\n", pool);
>  		return NULL;
>  	}
> @@ -4596,11 +4604,24 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, int pkt_size)
>  static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)
>  {
>  	int rxq;
> +	enum mvpp2_bm_pool_log_num long_log_pool, short_log_pool;
> +
> +	/* If port pkt_size is higher than 1518B:
> +	 * HW Long pool - SW Jumbo pool, HW Short pool - SW Short pool

The comment is wrong. In this case, the HW short pool is the SW long
pool.

> +	 * else: HW Long pool - SW Long pool, HW Short pool - SW Short pool
> +	 */
> +	if (port->pkt_size > MVPP2_BM_LONG_PKT_SIZE) {
> +		long_log_pool = MVPP2_BM_JUMBO;
> +		short_log_pool = MVPP2_BM_LONG;

See here.

> +	} else {
> +		long_log_pool = MVPP2_BM_LONG;
> +		short_log_pool = MVPP2_BM_SHORT;
> +	}


> +	/* If port MTU is higher than 1518B:
> +	 * HW Long pool - SW Jumbo pool, HW Short pool - SW Short pool

And the comment is wrong here as well :)

> +	 * else: HW Long pool - SW Long pool, HW Short pool - SW Short pool
> +	 */
> +	if (pkt_size > MVPP2_BM_LONG_PKT_SIZE)
> +		new_long_pool = MVPP2_BM_JUMBO;
> +	else
> +		new_long_pool = MVPP2_BM_LONG;
> +
> +	if (new_long_pool != port->pool_long->id) {
> +		/* Remove port from old short & long pool */
> +		port->pool_long = mvpp2_bm_pool_use(port, port->pool_long->id,
> +						    port->pool_long->pkt_size);
> +		port->pool_long->port_map &= ~(1 << port->id);

BIT(port->id) ?

> +		port->pool_long = NULL;
> +
> +		port->pool_short = mvpp2_bm_pool_use(port, port->pool_short->id,
> +						     port->pool_short->pkt_size);
> +		port->pool_short->port_map &= ~(1 << port->id);

Ditto.

> +	if (port->pool_long->id == MVPP2_BM_JUMBO && port->id != 0) {

Again, all over the place we hardcode the fact that Jumbo frames can
only be used on port 0. I know port 0 is the only one that can do 10G,
but are there possibly some use cases where you may want Jumbo frame on
another port ?

This all really feels very hardcoded to me.

> +		dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
> +		dev->hw_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
> +	}
> +
>  	dev->vlan_features |= features;
>  	dev->gso_max_segs = MVPP2_MAX_TSO_SEGS;
>  
> -	/* MTU range: 68 - 9676 */
> +	/* MTU range: 68 - 9704 */
>  	dev->min_mtu = ETH_MIN_MTU;
> -	/* 9676 == 9700 - 20 and rounding to 8 */
> -	dev->max_mtu = 9676;

How come we already had a max_mtu of 9676 without Jumbo frame support ?

> +	/* 9704 == 9728 - 20 and rounding to 8 */
> +	dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;

Is this correct for all ports ? Shouldn't the maximum MTU be different
between port 0 (that supports Jumbo frames) and the other ports ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

  reply	other threads:[~2018-03-02 16:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-02 15:40 [PATCH net-next 0/5] net: mvpp2: jumbo frames support Antoine Tenart
2018-03-02 15:40 ` [PATCH net-next 1/5] net: mvpp2: use the same buffer pool for all ports Antoine Tenart
2018-03-02 16:01   ` Thomas Petazzoni
2018-03-04  6:59     ` Stefan Chulski
2018-03-05 10:48     ` Antoine Tenart
2018-03-05 12:41       ` Thomas Petazzoni
2018-03-05 12:56         ` Antoine Tenart
2018-03-02 15:40 ` [PATCH net-next 2/5] net: mvpp2: update the BM buffer free/destroy logic Antoine Tenart
2018-03-02 15:40 ` [PATCH net-next 3/5] net: mvpp2: use a data size of 10kB for Tx FIFO on port 0 Antoine Tenart
2018-03-02 16:11   ` Thomas Petazzoni
2018-03-04  6:29     ` Stefan Chulski
2018-03-04  9:25       ` Thomas Petazzoni
2018-03-04  9:33         ` Stefan Chulski
2018-03-02 15:40 ` [PATCH net-next 4/5] net: mvpp2: enable UDP/TCP checksum over IPv6 Antoine Tenart
2018-03-02 15:40 ` [PATCH net-next 5/5] net: mvpp2: jumbo frames support Antoine Tenart
2018-03-02 16:17   ` Thomas Petazzoni [this message]
2018-03-04  6:56     ` Stefan Chulski
2018-03-04  9:28       ` Thomas Petazzoni
2018-03-04  9:42         ` Stefan Chulski

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=20180302171713.54beaad0@windsurf.lan \
    --to=thomas.petazzoni@bootlin.com \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanc@marvell.com \
    --cc=ymarkman@marvell.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.