Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp373288imm; Wed, 29 Aug 2018 02:07:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZZ7LWyvoAR/UxbIuzHPv1/bS3EfBvMS9j2Cfh7pdQ0WSOUxG2MnTaf+fIr/BAwMcQKBmno X-Received: by 2002:a17:902:24e1:: with SMTP id l30-v6mr5117819plg.315.1535533630538; Wed, 29 Aug 2018 02:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535533630; cv=none; d=google.com; s=arc-20160816; b=UOhM3YgqTa1NA0xGBTbO6KSs9C2CucGjjpbBxzK6dRlzRjAQDs/RIpFKHRQmHKWrDO zm78idu42hreC8GobUXXlKTrb4JDT0sYJGSCeaEysYWZU+5qoZCeOlyGXHUMQjxFdePP hg1NrP41V900oFtwuKdlVPvKglDBBXhO/zylApkcD+4fzYmXUqtiqVv3em5vY+9ZYRt/ Sdl/3awD64jh1OCDYTktAF0QxZ1A/5kRQbReZOUblq2izQdi9DSqk0feHdKFKWqVH0+U uJJ29QS064Xm/Nk94Ru9gazsuQCzKflBpFJgDyVnnZDffxg+9qctUQM0tCUWUV2uhv7c b+4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:arc-authentication-results; bh=pIpEPL5UWhkb7JkphYo20ky4Ru/Wt9g5vPoSrpXm3Zo=; b=sN71oL89mksK2r6Md8QCkrRMDxqywa3bcaO1H8Gfo4Pk9vbMqrmEBsi1E5tPeFkfbW gcipH+8gMUmZihXYNXl6aFPRLan99BkH3ioLd95yEEuLrRz7dqpqt4QYJlTIeKY9Vj0B VDN8582ZAv3514PR/VaZjOQzXaOxjvpe1nYp+yMWpHoFoqgNScQbr/ML/nimXCL9B9y+ ofQ0Rgh1AcNCYR1ftdNeBmLL+T65AM7zjZ01VDXVR2HYU45ZOYM91H/gQRB5sWQZAQ4/ ZScrRpjQYVmxVrhWg7Ha9M3cMPKUtEW1BR0w6KfKWtQqs5jgzOwfNNVu8Ra0lTg7lNhm bjPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m32-v6si3231436pld.404.2018.08.29.02.06.55; Wed, 29 Aug 2018 02:07:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727952AbeH2NBm convert rfc822-to-8bit (ORCPT + 99 others); Wed, 29 Aug 2018 09:01:42 -0400 Received: from mail.bootlin.com ([62.4.15.54]:44888 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727172AbeH2NBm (ORCPT ); Wed, 29 Aug 2018 09:01:42 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id EB336206F6; Wed, 29 Aug 2018 11:05:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id BD691207B1; Wed, 29 Aug 2018 11:05:45 +0200 (CEST) From: Gregory CLEMENT To: Jisheng Zhang Cc: , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/5] net: mvneta: fix rx_offset_correction set and usage References: <20180829162456.2bd69796@xhacker.debian> <20180829162706.24111f9c@xhacker.debian> Date: Wed, 29 Aug 2018 11:05:45 +0200 In-Reply-To: <20180829162706.24111f9c@xhacker.debian> (Jisheng Zhang's message of "Wed, 29 Aug 2018 16:27:06 +0800") Message-ID: <87efehk0eu.fsf@bootlin.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jisheng, On mer., août 29 2018, Jisheng Zhang 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 > --- > 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