Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1375947imu; Tue, 11 Dec 2018 18:50:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wm5lbMN1gEj+r/ll/qt+kfD++iemHbMuGI1NqfAofEbuaqm6gsR8W8BHH12RT65sMwWsPX X-Received: by 2002:a63:f30d:: with SMTP id l13mr16994065pgh.399.1544583007693; Tue, 11 Dec 2018 18:50:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544583007; cv=none; d=google.com; s=arc-20160816; b=xRyiPxI112okO9vafSH0xjW5vu1q1Tkaxz8kwa4r4YvaRmObvsSrH5unfqCxWATLK1 6SN+quqpcQAaSrg6hKBE/zmXer4SyV+aGfJVHardk8aNhQeplGluKXfIzd+t2l+YoMiv efL5kE4Ppq3FyVbC0xt/AbiiFP/vH5HnOO67aFlAqUQk5fwsjZT3fis2WBQ0Fku1wTcX RKHIWvwDkwHWvyBh/y06N4sXwNFb6BZIX1804eK7d5BPWr+4QETpNv+9s3bteTXaW/Mc +cuNCgpPyCX+kTuto7+H9z+OuAlaXWMb42ahJ/qM/8qzQXSBWWaW1iPoBr4pH2YlhEmY DcJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:spamdiagnosticmetadata:spamdiagnosticoutput :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=EMxnIn8KH7KVuKBpVETHOUOLbZINNYKFfY4rMkX7p44=; b=s1AoCW4culTOZDnYiQkLiRglTXRb44W9drE425eX+Ws/8egdopAQUUxjVw9oTEQelQ /H2zW5wU4bYiiC3ASxoh8npZ33ihpSs4t75pCU0Cx4WVOwP+btzUqrjlXXkfjaIatGNt MgDJMJWmSem9lEhqvSeKcZmW5O5uYtsv3MGBHHsT8xu5Y7z+jWmNwMX3uf+f8bAgCnkh +V008rIyV1Smru1gixSd+BF3UAcYeZ/mxjvH60RNylAp4qa9i+ZTig/svo2jaZNHx9Zo Lf4r3VVCk+jIWKShL45dXNtTA1AlrQ9F0E/ZydKqQozHbPF1BV4JGjAvgACBFLANqWQi tj5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=ObSrFuyP; 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 9si14018851plc.40.2018.12.11.18.49.30; Tue, 11 Dec 2018 18:50:07 -0800 (PST) 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; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=ObSrFuyP; 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 S1726357AbeLLCsa (ORCPT + 99 others); Tue, 11 Dec 2018 21:48:30 -0500 Received: from mail-eopbgr810088.outbound.protection.outlook.com ([40.107.81.88]:17952 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726237AbeLLCs3 (ORCPT ); Tue, 11 Dec 2018 21:48:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EMxnIn8KH7KVuKBpVETHOUOLbZINNYKFfY4rMkX7p44=; b=ObSrFuyPmDTowj6JuX1eSgoFMYjy7D6PiQtJPCOC4qqBwNzWBpZixDFbTdfSo2wsGQEZxj1i0slDKHuj2a0wAeKxI2JL2IpTc0XVCe1cs4JZo5D54CM6fpvDaNyW783gzJjKgAYykheIpn7GaV7vHHI7jOlCmbcA2TxQVj7eJq8= Received: from SN6PR03MB4398.namprd03.prod.outlook.com (20.177.255.219) by SN6PR03MB4336.namprd03.prod.outlook.com (20.177.254.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.23; Wed, 12 Dec 2018 02:48:22 +0000 Received: from SN6PR03MB4398.namprd03.prod.outlook.com ([fe80::7c2a:de77:a4ce:5ccc]) by SN6PR03MB4398.namprd03.prod.outlook.com ([fe80::7c2a:de77:a4ce:5ccc%3]) with mapi id 15.20.1404.026; Wed, 12 Dec 2018 02:48:22 +0000 From: Jisheng Zhang To: Marcin Wojtas CC: "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "netdev@vger.kernel.org" , "antoine.tenart@bootlin.com" , "jaz@semihalf.com" , "gregory.clement@bootlin.com" , "linux@armlinux.org.uk" , "maxime.chevallier@bootlin.com" , "nadavh@marvell.com" , "thomas.petazzoni@bootlin.com" , "stefanc@marvell.com" , "davem@davemloft.net" Subject: Re: [PATCH net] net: mvneta: fix operation for 64K PAGE_SIZE Thread-Topic: [PATCH net] net: mvneta: fix operation for 64K PAGE_SIZE Thread-Index: AQHUkVET6MmkkP0I6kWJw6RDslXtBqV6Zi0A Date: Wed, 12 Dec 2018 02:48:22 +0000 Message-ID: <20181212104304.49026ed2@xhacker.debian> References: <1544533009-12425-1-git-send-email-mw@semihalf.com> In-Reply-To: <1544533009-12425-1-git-send-email-mw@semihalf.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [124.74.246.114] x-clientproxiedby: KAWPR01CA0059.jpnprd01.prod.outlook.com (2603:1096:402:b::19) To SN6PR03MB4398.namprd03.prod.outlook.com (2603:10b6:805:fd::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SN6PR03MB4336;6:cu9t1Zh+At5bli/B7dmHCY/X50lCmdaT9KGZpzQ99tLeIdSqGqE8nmnmR8z+gGT2/V/iDyYssiBvKC0v2bwvSclx1cbSkPpmZe5Fo/W0r5kVl2JO5EUY7raE//Hporv74ONW9ZfLPHGg7GHgamvOWskr6KsS8nCo4D1YiTjypgC4ILT+7EJicTZqn4t8IZfLTd9hhlgpsE8My3hYtqw6mVTeyHsWzX7HeRmO4ERJCCl5tX4c3X2LiTOqUQFiWk5K83IZ06rcOGhhFiZ5gYGDZv/wIZzboPHvX6X+7ho2A070xikOshkDIaCPonbXJ5NBl6pvA4fqTYi8vd6YRu4JMyAir3ezSqHarGSxg8cZ5nNSqX9SfNfcnZZp2BkN2oMPKRPNgihwiVmUZINKMyFbOWGfpgLGeSTvCfQp7wHeMZG1A+9fb8+SsxIynlzJfsaHuWsuBNQ0Kee2h0MkUiRJnw==;5:8wXv45sahAwS78B5D3g6FDXwhNYer7zT2cpN2wG3TkesLu1xmkT2bLorRLRF0P/eAp2qxBI+ymdWIAHxyh+6EZyeJlecY4hc0y2AaD7k0vnBdbTIMJeImNI9+8bIvRie3F5T1k3wZDsGMBNf2rN8sFcAzMd9aVdii1fBKEmqXP4=;7:wXEV9lapt+Ed1SNgOviEIYHhfMdQM9gnv2KMbitRlPP8WDMWqVfpU0T8pZUFz8BRckwv6gmKSbs+q5tzQqNLkBeXC7MO9wh70wgGymGRLAlSbbGVQXkzOD391N0E5BAH41dSCbxal14ELhzG6HgeTQ== x-ms-office365-filtering-correlation-id: fe6e460e-f0fe-47ec-e0ed-08d65fdc47b2 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:SN6PR03MB4336; x-ms-traffictypediagnostic: SN6PR03MB4336: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230017)(999002)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231472)(944501520)(52105112)(10201501046)(3002001)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:SN6PR03MB4336;BCL:0;PCL:0;RULEID:;SRVR:SN6PR03MB4336; x-forefront-prvs: 0884AAA693 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(366004)(376002)(396003)(136003)(39860400002)(189003)(199004)(11346002)(446003)(476003)(71200400001)(71190400001)(86362001)(99286004)(66066001)(26005)(4326008)(33896004)(256004)(186003)(486006)(52116002)(6512007)(76176011)(53936002)(68736007)(9686003)(8936002)(6246003)(81166006)(81156014)(8676002)(7416002)(5660300001)(7736002)(305945005)(97736004)(14454004)(6916009)(6116002)(2906002)(478600001)(3846002)(72206003)(1076002)(229853002)(106356001)(105586002)(6506007)(54906003)(386003)(102836004)(316002)(6486002)(6436002)(25786009)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR03MB4336;H:SN6PR03MB4398.namprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: rcIPp4kqrmx0bDxDIFzvvZq40SpVwrsvUq/KSjUVgNkzwUCwvL5FFJ0dZtWtM8x5UDsdCilbReCsGeuT7zUipQa/y9UCsij/QU4aGJTwxuZYYGom8Xq2uYC0EPNCl7I7fyYIVilfbPqVakn9DYuYjo5ADjQEWQ4yosI4z61yi1IJIgFoO139OblD6pG93/aZkl+2LmbokjHh5lp+7JI92Q8LYsXLcviDMAGu9msViSXd8jJP6VkLlncOBce1JPsTCxefW06REcRvLWxCbyaAlactXHrOUMbhUDUuRY7bCV4cqVGgr/C+fE5uVjkWkVtH spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <9B60FC7B2DAC884DB451D82CB1599FCA@namprd03.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe6e460e-f0fe-47ec-e0ed-08d65fdc47b2 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2018 02:48:22.2665 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB4336 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, 11 Dec 2018 13:56:49 +0100 Marcin Wojtas wrote: > Recent changes in the mvneta driver reworked allocation > and handling of the ingress buffers to use entire pages. > Apart from that in SW BM scenario the HW must be informed > via PRXDQS about the biggest possible incoming buffer > that can be propagated by RX descriptors. >=20 > The BufferSize field was filled according to the MTU-dependent > pkt_size value. Later change to PAGE_SIZE broke RX operation > when usin 64K pages, as the field is simply too small. >=20 > This patch conditionally limits the value passed to the BufferSize > of the PRXDQS register, depending on the PAGE_SIZE used. > On the occasion remove now unused frag_size field of the mvneta_port > structure. >=20 > Fixes: 562e2f467e71 ("net: mvneta: Improve the buffer allocation > method for SWBM") IMHO, we'd better revert 562e2f467e71 and 7e47fd84b56bb The issue commit 562e2f467e71 wants to solve is due to commit 7e47fd84b56bb It looks a bit wired, to introduce regression then submit another commit(in the same patch set) solve it Per my test, after reverting 562e2f467e71 and 7e47fd84b56bb, I can't reprod= uce what's claimed in commit 562e2f467e71 -- "With system having a small memory (around 256MB), the state "cannot allocate memory to refill with new buffer= " is reach pretty quickly." >=20 > Signed-off-by: Marcin Wojtas > --- > drivers/net/ethernet/marvell/mvneta.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet= /marvell/mvneta.c > index e5397c8..61b2349 100644 > --- a/drivers/net/ethernet/marvell/mvneta.c > +++ b/drivers/net/ethernet/marvell/mvneta.c > @@ -408,7 +408,6 @@ struct mvneta_port { > struct mvneta_pcpu_stats __percpu *stats; > =20 > int pkt_size; > - unsigned int frag_size; > void __iomem *base; > struct mvneta_rx_queue *rxqs; > struct mvneta_tx_queue *txqs; > @@ -2905,7 +2904,9 @@ static void mvneta_rxq_hw_init(struct mvneta_port *= pp, > 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_buf_size_set(pp, rxq, PAGE_SIZE < SZ_64K ? > + PAGE_SIZE : > + MVNETA_RX_BUF_SIZE(pp->pkt_size)); > mvneta_rxq_bm_disable(pp, rxq); > mvneta_rxq_fill(pp, rxq, rxq->size); > } else { > @@ -3760,7 +3761,6 @@ static int mvneta_open(struct net_device *dev) > int ret; > =20 > pp->pkt_size =3D MVNETA_RX_PKT_SIZE(pp->dev->mtu); > - pp->frag_size =3D PAGE_SIZE; > =20 > ret =3D mvneta_setup_rxqs(pp); > if (ret)