Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp353695imm; Wed, 29 Aug 2018 01:31:37 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYywp6hL8+7+i27B+ODFxfx7AFxVP5FLDI4z+8IwpWp22HGlG622D5WkZo2Z+rT/EQyXkr6 X-Received: by 2002:a63:7b4b:: with SMTP id k11-v6mr4931514pgn.64.1535531497934; Wed, 29 Aug 2018 01:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535531497; cv=none; d=google.com; s=arc-20160816; b=VkCicJLAEhfeqSgwKm+VRGgTgzHxxRXv7AN/ZXc535kcg2j0R3z481+QygUqqo/gDH pc5iaQZpY0il4WLTptRykAue//5Z9OWEhS52cSHJej4R+oeKhukJv8V1iRysg+0oHYWH O7Auz1EFF1skoo4XurEd4WiNamrNaEVHUBFmdTvtSwGt4DC64pe83b0YYBJomZqTZFLA FLHnX0P/XFBoV482XMgQ+LpVn1wDsY5VExVvHt3gL93HOSaxqs1cCL1eykn+kufQTPvl QxivMz8VDiHZTTetMi6wDYkCW7Kprp0ZwNmifQCAQQpTLWHsHYsdg9jlsHhLBQSimMKh XANQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=EpvJCTsq5QMMRNn+jWnajjQQLCmK9HG+EYZwyG3RlXk=; b=ts4MusATIJ9lfBTqy+CU/H6F2UqaJ+FyJrBNxQduUYGCs0wLoufX11gZum5H6VmiMc Oo//ESoyAlMNXaKqvklpggI1/Ai9ortAFKol2CMg7urCCMGpJECgbmRpdsZCLWO1GB0N fjzChOi4VDMBj5Ni6yAM4frRi/nRhcMyZnht9+3U8nPSep3Cjyc7ceFde86AO62K0Shq 8RY9JD0ErsO8rf8PJxwHCbaFRIElB4LKdoRu8Xwlk/i59ywTlY5HF88Siy7abv6LzzH2 Z7UfVcOVKMKMDR+0rBRECRq4BXEus5fZUZuwiR8Np3w+pytswyNg08JSLUvYkh6KJCeH H9yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=Dm1z1wBo; 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 t13-v6si3297651pfc.194.2018.08.29.01.31.22; Wed, 29 Aug 2018 01:31:37 -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; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=Dm1z1wBo; 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 S1728033AbeH2MZ7 (ORCPT + 99 others); Wed, 29 Aug 2018 08:25:59 -0400 Received: from mail-eopbgr700073.outbound.protection.outlook.com ([40.107.70.73]:62679 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727133AbeH2MZ7 (ORCPT ); Wed, 29 Aug 2018 08:25:59 -0400 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=EpvJCTsq5QMMRNn+jWnajjQQLCmK9HG+EYZwyG3RlXk=; b=Dm1z1wBo014Sq/B3UIlc+EeurzYoM+53+JUPpsne8pCq/c0+e3xqsiA6nJO9pDT9x+lzzKivUs3Ou0a8rbh4t8EGemRu6L2GlHC50PMFBhC7oPWKK2fDb5er22wB0DwmEz6Ubd3/XBpG9KcNDEZm80gGfptg2d/So8XWr3v2ULc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by CY1PR0301MB1578.namprd03.prod.outlook.com (2a01:111:e400:529c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.14; Wed, 29 Aug 2018 08:30:08 +0000 Date: Wed, 29 Aug 2018 16:27:06 +0800 From: Jisheng Zhang To: , "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Gregory CLEMENT , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/5] net: mvneta: fix rx_offset_correction set and usage Message-ID: <20180829162706.24111f9c@xhacker.debian> In-Reply-To: <20180829162456.2bd69796@xhacker.debian> References: <20180829162456.2bd69796@xhacker.debian> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: TYAPR01CA0149.jpnprd01.prod.outlook.com (2603:1096:404:7e::17) To CY1PR0301MB1578.namprd03.prod.outlook.com (2a01:111:e400:529c::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff24efc4-36b5-45d9-2f69-08d60d89a24b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:CY1PR0301MB1578; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1578;3:Y5rr7JqScCJz+Z5Bk78sXqP1UYSOAWEORd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fGZJL46YHtyXz/Au+g7lkSCylw81Q9TuhbRkwMK+8E6qOso0X4J8WonyYXqRaflZQaie3NvMURE0EO87o2IHjXBrCyMTl5dk+mh7lfPadiyyrL/SVYgf17PqTzc3JHqfOOBXqOBaZxXdI1NmkkgEmE0kjuyn9c3aI0/Sr4PnAvW6xlun0UO8wPCM9ePPCr2pEl0/K46xJy4+YtSIV9bMI19aN4VerHq3/l6wLSgzJvjYfaTsUki8asz3hSrcMuaIZ2v9T9Ka1mAW+ntlkVpK9pV3nMoaqUnbwI8JjAhV3tEHPGOovhR3S2s4E;4:lDZmkQU8d2vKzc0bT2BXT3SmYsX+aumm+dWnU7oy2JmZAYrRVXQdAkXX8pXiV73ZPhvCKASxH14hP8kKv9hu5rVYa1+f6VqRJZsuENdET7cBdHNof5g+cj/pFkGbS7NdFJbtq+CuWIfK9MfKxqAh96V7l78RqOF2dgD+Lla94e/c4OtUpJ8ZcvJ7yc+Tubsa/yOOsxviARwYejSFR8cOEGaZ1O5FTgKVOkXNX9XItbwqxaDOHoFVQAVJ5vddk76LpOVxE74E+0R2N/aAStLy5A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699016);SRVR:CY1PR0301MB1578;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1578; X-Forefront-PRVS: 077929D941 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(396003)(366004)(39860400002)(376002)(346002)(136003)(189003)(199004)(11346002)(446003)(50466002)(81166006)(26005)(305945005)(68736007)(478600001)(3846002)(81156014)(8936002)(86362001)(76176011)(386003)(6506007)(97736004)(52116002)(7696005)(72206003)(50226002)(1076002)(23726003)(956004)(14444005)(6116002)(316002)(33896004)(54906003)(110136005)(16526019)(186003)(2906002)(8676002)(7736002)(230700001)(55016002)(9686003)(106356001)(476003)(105586002)(5660300001)(486006)(25786009)(4326008)(53936002)(66066001)(47776003)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0301MB1578;H:xhacker.debian;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-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0301MB1578;23:vaGkosicxCeEepDUTVOCWEILHMkNmZUHXzrOFjP?= =?us-ascii?Q?tdQHqXmrwq2LFOI/RmOY4rhof+ChYyW7x5FTlsyi8h8JYeaEfk+3W5o8sD/s?= =?us-ascii?Q?KvHTRdGKSgAg4SINUm3Kt1WffymJINaM21JtGr9ArDDRd8ADUy54VwCdezte?= =?us-ascii?Q?LwAoKVkW6S1u6/QUrN8u84yucjpJ2/GQI5XA31uozqft1YY0Qij2w9k18YX4?= =?us-ascii?Q?VIhRaw56Mlyg94DurgfTd46EGFmrfUeCHETwqydQp7W1gHVNsRiU9cU7P4ot?= =?us-ascii?Q?IbKFsBg3W2Qw4r7A16pFC/Fyislh45OF+pyrVOi4ienrUX1KtdXLTjs/nRr1?= =?us-ascii?Q?RbaGqvxU1vSKHz4rLvreiCHnaLJeIEI2uZAY+0zqf7IcLz3pkgVava42PGEO?= =?us-ascii?Q?DhbWyQypKA5YzUdE+bJIsEyB5RZ1DrL9wVPIVphwgCwIga2HEf8KkpaN+ftU?= =?us-ascii?Q?xojwnq0sEb1XAL8mR4F9+IQ4/uPeMvyeJkdrj5uVkbrZTsGTulPaTqRJmIlj?= =?us-ascii?Q?lp46WObiW5iENvbZeAVnGD5Tylf5dNcmnDxen43VkJl9TdavWWHBE1RLiWRv?= =?us-ascii?Q?G6pitxI/Qtj6AKutL/vCib/MX7le5012OEJYUsahrsdy4M5F4BcLpDGsIJE2?= =?us-ascii?Q?XQI5e/bD+s4FN0fUOkkYwGUclxRob4ZQHF/tv4zVme83+uhKhDfXpXL3a/p2?= =?us-ascii?Q?7BTo1ooVVio3S+hNP5Xf0K7SJM0dO40WrBH86eoUs18gXVa36oA/Ocz5myg/?= =?us-ascii?Q?nFy7y3oKrueZqgZf+XlI0T4FhyZ0yzz48GOd4gZg9j4KJXsF9wGvBwegcEpg?= =?us-ascii?Q?p53kZWqeCeQj3x4aUHOLW8AH7j7NVCOGndLibOWA0OhPvrd/tXW54zSuFzJO?= =?us-ascii?Q?pYv52zjmBwYMydhoLh37a2YKiMtypqoX7F41Dqb8Fpt51cQsOaWAtucaRfNi?= =?us-ascii?Q?Uye+Uj5mxzmqvA5PoXPiea/JQppL+hSVayD9FgfsvE0YsEAjebFGo0srvn9v?= =?us-ascii?Q?LB9nmQl7E5eYM55wV/IVKnrw7626v97UF99uvR2dYHh5SE/kR5p+5b0oA/0J?= =?us-ascii?Q?RhWt2HUZpk+p+wxJyO2ZX8yChfAOg79jWTob+o7kufAjbMoMDz303gzZpILx?= =?us-ascii?Q?Ee0tbXfYaFS+yw3u3idPk6jT82kFhMz6l23lQCeg273aPBaQQD8bc2o8QaJ4?= =?us-ascii?Q?e+RNXU+G1NyqErh0y+lmTWfqk9u2wq9i32bcy5NmrfNG2sUoseZWyCzR0PEs?= =?us-ascii?Q?x3ZuZzKDAOQxn80mXzfc=3D?= X-Microsoft-Antispam-Message-Info: ZvDc0SivJLQGg4kcthX+BI2ST1i42PK4UnHAMPm1/S0R7p5eVlwIhNMfgRmgiLkZXZM2jtiuGOFMT8e4Y1o59G9SxKQ6kFNKM9vZwV6T6r8YWgaK1taPhp/oqodCNhnUAhUe1+P8dQtbAwqiip38D0EHKWM8xDv0XaY3vCAQ4jShag5epPPkqTKrwF3Mo2SKORL8EzdyjGJqfN6mAovzKbv1Uj0YVanYWlX3YVVjyPhg24W0psvzyK6ocQuk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adata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2018 08:30:08.5113 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff24efc4-36b5-45d9-2f69-08d60d89a24b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1578 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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