All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregory.clement@bootlin.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] net: mvneta: fix rx_offset_correction set and usage
Date: Wed, 29 Aug 2018 11:05:45 +0200	[thread overview]
Message-ID: <87efehk0eu.fsf@bootlin.com> (raw)
In-Reply-To: <20180829162706.24111f9c@xhacker.debian> (Jisheng Zhang's message of "Wed, 29 Aug 2018 16:27:06 +0800")

Hi Jisheng,
 
 On mer., ao?t 29 2018, Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote:

> The rx_offset_correction is RX packet offset correction for platforms,
> it's not related with SW BM, instead, it's only related with the
> platform's NET_SKB_PAD.
>

But if I undrestood well, the value of rx_offset_correction has an
influence only when we use HW BM.

However since d93277b9839b ("Revert "arm64: Increase the max granular
size""), NET_SKB_PAD is 64 for arm64, so in the end rx_offset_correction
is always 0 for recent kernels.

Gregory


> Fix the issue by reverting to the original behavior.
>
> Fixes: 562e2f467e71 ("net: mvneta: Improve the buffer allocation method for SWBM")
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 24 ++++++++++--------------
>  1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index bc80a678abc3..0ce94f6587a5 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -2899,21 +2899,18 @@ static void mvneta_rxq_hw_init(struct mvneta_port *pp,
>  	mvreg_write(pp, MVNETA_RXQ_BASE_ADDR_REG(rxq->id), rxq->descs_phys);
>  	mvreg_write(pp, MVNETA_RXQ_SIZE_REG(rxq->id), rxq->size);
>  
> +	/* Set Offset */
> +	mvneta_rxq_offset_set(pp, rxq, NET_SKB_PAD - pp->rx_offset_correction);
> +
>  	/* Set coalescing pkts and time */
>  	mvneta_rx_pkts_coal_set(pp, rxq, rxq->pkts_coal);
>  	mvneta_rx_time_coal_set(pp, rxq, rxq->time_coal);
>  
>  	if (!pp->bm_priv) {
> -		/* Set Offset */
> -		mvneta_rxq_offset_set(pp, rxq, 0);
>  		mvneta_rxq_buf_size_set(pp, rxq, pp->frag_size);
>  		mvneta_rxq_bm_disable(pp, rxq);
>  		mvneta_rxq_fill(pp, rxq, rxq->size);
>  	} else {
> -		/* Set Offset */
> -		mvneta_rxq_offset_set(pp, rxq,
> -				      NET_SKB_PAD - pp->rx_offset_correction);
> -
>  		mvneta_rxq_bm_enable(pp, rxq);
>  		/* Fill RXQ with buffers from RX pool */
>  		mvneta_rxq_long_pool_set(pp, rxq);
> @@ -4547,7 +4544,13 @@ static int mvneta_probe(struct platform_device *pdev)
>  	SET_NETDEV_DEV(dev, &pdev->dev);
>  
>  	pp->id = global_port_id++;
> -	pp->rx_offset_correction = 0; /* not relevant for SW BM */
> +
> +	/* Set RX packet offset correction for platforms, whose
> +	 * NET_SKB_PAD, exceeds 64B. It should be 64B for 64-bit
> +	 * platforms and 0B for 32-bit ones.
> +	 */
> +	pp->rx_offset_correction =
> +		max(0, NET_SKB_PAD - MVNETA_RX_PKT_OFFSET_CORRECTION);
>  
>  	/* Obtain access to BM resources if enabled and already initialized */
>  	bm_node = of_parse_phandle(dn, "buffer-manager", 0);
> @@ -4562,13 +4565,6 @@ static int mvneta_probe(struct platform_device *pdev)
>  				pp->bm_priv = NULL;
>  			}
>  		}
> -		/* Set RX packet offset correction for platforms, whose
> -		 * NET_SKB_PAD, exceeds 64B. It should be 64B for 64-bit
> -		 * platforms and 0B for 32-bit ones.
> -		 */
> -		pp->rx_offset_correction = max(0,
> -					       NET_SKB_PAD -
> -					       MVNETA_RX_PKT_OFFSET_CORRECTION);
>  	}
>  	of_node_put(bm_node);
>  
> -- 
> 2.18.0
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Cc: <thomas.petazzoni@bootlin.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Lunn <andrew@lunn.ch>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/5] net: mvneta: fix rx_offset_correction set and usage
Date: Wed, 29 Aug 2018 11:05:45 +0200	[thread overview]
Message-ID: <87efehk0eu.fsf@bootlin.com> (raw)
In-Reply-To: <20180829162706.24111f9c@xhacker.debian> (Jisheng Zhang's message of "Wed, 29 Aug 2018 16:27:06 +0800")

Hi Jisheng,
 
 On mer., août 29 2018, Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote:

> The rx_offset_correction is RX packet offset correction for platforms,
> it's not related with SW BM, instead, it's only related with the
> platform's NET_SKB_PAD.
>

But if I undrestood well, the value of rx_offset_correction has an
influence only when we use HW BM.

However since d93277b9839b ("Revert "arm64: Increase the max granular
size""), NET_SKB_PAD is 64 for arm64, so in the end rx_offset_correction
is always 0 for recent kernels.

Gregory


> Fix the issue by reverting to the original behavior.
>
> Fixes: 562e2f467e71 ("net: mvneta: Improve the buffer allocation method for SWBM")
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 24 ++++++++++--------------
>  1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index bc80a678abc3..0ce94f6587a5 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -2899,21 +2899,18 @@ static void mvneta_rxq_hw_init(struct mvneta_port *pp,
>  	mvreg_write(pp, MVNETA_RXQ_BASE_ADDR_REG(rxq->id), rxq->descs_phys);
>  	mvreg_write(pp, MVNETA_RXQ_SIZE_REG(rxq->id), rxq->size);
>  
> +	/* Set Offset */
> +	mvneta_rxq_offset_set(pp, rxq, NET_SKB_PAD - pp->rx_offset_correction);
> +
>  	/* Set coalescing pkts and time */
>  	mvneta_rx_pkts_coal_set(pp, rxq, rxq->pkts_coal);
>  	mvneta_rx_time_coal_set(pp, rxq, rxq->time_coal);
>  
>  	if (!pp->bm_priv) {
> -		/* Set Offset */
> -		mvneta_rxq_offset_set(pp, rxq, 0);
>  		mvneta_rxq_buf_size_set(pp, rxq, pp->frag_size);
>  		mvneta_rxq_bm_disable(pp, rxq);
>  		mvneta_rxq_fill(pp, rxq, rxq->size);
>  	} else {
> -		/* Set Offset */
> -		mvneta_rxq_offset_set(pp, rxq,
> -				      NET_SKB_PAD - pp->rx_offset_correction);
> -
>  		mvneta_rxq_bm_enable(pp, rxq);
>  		/* Fill RXQ with buffers from RX pool */
>  		mvneta_rxq_long_pool_set(pp, rxq);
> @@ -4547,7 +4544,13 @@ static int mvneta_probe(struct platform_device *pdev)
>  	SET_NETDEV_DEV(dev, &pdev->dev);
>  
>  	pp->id = global_port_id++;
> -	pp->rx_offset_correction = 0; /* not relevant for SW BM */
> +
> +	/* Set RX packet offset correction for platforms, whose
> +	 * NET_SKB_PAD, exceeds 64B. It should be 64B for 64-bit
> +	 * platforms and 0B for 32-bit ones.
> +	 */
> +	pp->rx_offset_correction =
> +		max(0, NET_SKB_PAD - MVNETA_RX_PKT_OFFSET_CORRECTION);
>  
>  	/* Obtain access to BM resources if enabled and already initialized */
>  	bm_node = of_parse_phandle(dn, "buffer-manager", 0);
> @@ -4562,13 +4565,6 @@ static int mvneta_probe(struct platform_device *pdev)
>  				pp->bm_priv = NULL;
>  			}
>  		}
> -		/* Set RX packet offset correction for platforms, whose
> -		 * NET_SKB_PAD, exceeds 64B. It should be 64B for 64-bit
> -		 * platforms and 0B for 32-bit ones.
> -		 */
> -		pp->rx_offset_correction = max(0,
> -					       NET_SKB_PAD -
> -					       MVNETA_RX_PKT_OFFSET_CORRECTION);
>  	}
>  	of_node_put(bm_node);
>  
> -- 
> 2.18.0
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

  reply	other threads:[~2018-08-29  9:05 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29  8:25 [PATCH 0/5] net: mvneta: some bug fix and trivial improvement Jisheng Zhang
2018-08-29  8:25 ` Jisheng Zhang
2018-08-29  8:27 ` [PATCH 1/5] net: mvneta: fix rx_offset_correction set and usage Jisheng Zhang
2018-08-29  8:27   ` Jisheng Zhang
2018-08-29  9:05   ` Gregory CLEMENT [this message]
2018-08-29  9:05     ` Gregory CLEMENT
2018-08-29  9:16     ` Jisheng Zhang
2018-08-29  9:16       ` Jisheng Zhang
2018-08-29  9:16       ` Jisheng Zhang
2018-08-29  8:27 ` [PATCH 2/5] net: mvneta: fix the wrong function to unmap rx buf Jisheng Zhang
2018-08-29  8:27   ` Jisheng Zhang
2018-08-29  9:21   ` Gregory CLEMENT
2018-08-29  9:21     ` Gregory CLEMENT
2018-08-30  3:40     ` Jisheng Zhang
2018-08-30  3:40       ` Jisheng Zhang
2018-08-29  8:28 ` [PATCH 3/5] net: mvneta: Don't check NETIF_F_GRO ourself Jisheng Zhang
2018-08-29  8:28   ` Jisheng Zhang
2018-08-29  9:37   ` Gregory CLEMENT
2018-08-29  9:37     ` Gregory CLEMENT
2018-08-29  8:29 ` [PATCH 4/5] net: mvneta: enable NETIF_F_RXCSUM by default Jisheng Zhang
2018-08-29  8:29   ` Jisheng Zhang
2018-08-29  9:38   ` Gregory CLEMENT
2018-08-29  9:38     ` Gregory CLEMENT
2018-08-29 13:08   ` Andrew Lunn
2018-08-29 13:08     ` Andrew Lunn
2018-08-30  3:27     ` Jisheng Zhang
2018-08-30  3:27       ` Jisheng Zhang
2018-08-30  3:44       ` Andrew Lunn
2018-08-30  3:44         ` Andrew Lunn
2018-08-29  8:30 ` [PATCH 5/5] net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe Jisheng Zhang
2018-08-29  8:30   ` Jisheng Zhang
2018-08-29  9:44   ` Gregory CLEMENT
2018-08-29  9:44     ` Gregory CLEMENT
2018-08-29  8:40 ` [PATCH 0/5] net: mvneta: some bug fix and trivial improvement Jisheng Zhang
2018-08-29  8:40   ` Jisheng Zhang
2018-08-29  8:51   ` Jisheng Zhang
2018-08-29  8:51     ` Jisheng Zhang
2018-08-30  3:53     ` Jisheng Zhang
2018-08-30  3:53       ` Jisheng Zhang
2018-08-29 13:12 ` Andrew Lunn
2018-08-29 13:12   ` Andrew Lunn
2018-08-30  3:42   ` Jisheng Zhang
2018-08-30  3:42     ` Jisheng Zhang

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=87efehk0eu.fsf@bootlin.com \
    --to=gregory.clement@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.