From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 417AD41E16; Wed, 8 Mar 2023 03:33:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2186940ED6; Wed, 8 Mar 2023 03:33:59 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2135.outbound.protection.outlook.com [40.107.243.135]) by mails.dpdk.org (Postfix) with ESMTP id 0B17E40E03; Wed, 8 Mar 2023 03:33:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HqhGOAFq75mWr1cX6aSLXa0j3EdynAzqwrMBWZ8n6Sfwl4ibAjILyQzUNdIHXFtTxcAoKhCMyKLcy4hByKbyh4FwehyJBcnvlEcJE/mbUrh930Qq8H8ol7GoUlU6Dd7zHzOskh2e+WJY+DpZMJXxzeYZ9/N8YddL1GuAERjjt4WpjvVQFkD0z34tN1FgWsTtXjD0izigWyc7+253sAl9MyxY3P+Lu3apUnzKjFSuyWq26kQSyujS6fIRI1Sm2MOixzPpzBB0MVZG3skgfMigyTFg+PkZtC2pqoOxUS6aVc+mkcURb+70levMoPdUP25m/MqKbewWMbNEc1YQm+I7Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GaH4b0zDqbSAEjMKkQdcfQHL4GHMy4Z1ybauY8UyArw=; b=MYmp54sCrP1f4KxGZCWHwLjACSmumJTj5su3QxNzbE+yOdBaPzXze/YYAM9PQ7CBpjro5O25FVzyFaDmXFpCp15nIR+6UMyoi82MPgXpbBF0gXvOtff6c8X3ji0258O0tHhvjZBohkS0wxQb5xPiRp4AnSf+1Gm6lrzjJtJwQMbx47IwEhr37i5A+Fz/V4CM8zl1YRbGVsd5aRM0u/+/uZjD2AWFRZJC1ogiflF35JJ8iMAtegUTbDBh3Lrh3nSRpkJgRClmItl3n5IgNcrd8ttjdnOHmV00DZ9buRos3RXxz13DzJjqgcmwnoDEC7zXK0OPzv27Ptl1Ugw/J1UNZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GaH4b0zDqbSAEjMKkQdcfQHL4GHMy4Z1ybauY8UyArw=; b=jMctA962SjEkctNZwozCq6nhEoZoXGkSEk6+DoXdzynQUZigPh8rWPuzxA8rgXTqzMjUlkDglGOTXYxfawdSyIqC2tnK54ozXMNoXGoe6uDbE7Z6aXMnAWUcBsycByopomYl3+R5R47TTXIFZSpXVld1mDP9DEKfIoGz8vBEujU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by DM8PR13MB5125.namprd13.prod.outlook.com (2603:10b6:8:30::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.17; Wed, 8 Mar 2023 02:33:54 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d%7]) with mapi id 15.20.6156.029; Wed, 8 Mar 2023 02:33:53 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Peng Zhang , stable@dpdk.org, Chaoyong He Subject: [PATCH] net/nfp: fix MTU configuration order Date: Wed, 8 Mar 2023 10:33:18 +0800 Message-Id: <20230308023318.3041151-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR03CA0121.apcprd03.prod.outlook.com (2603:1096:4:91::25) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM8PR13MB5125:EE_ X-MS-Office365-Filtering-Correlation-Id: 80a71596-fd0c-4bfb-7cee-08db1f7d8efe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zQcseqKmhGtkxnwnOlk8ih1BRMMmjgE9/R5jL4ktqwLINAcge3qdmHYjd29cQqubqSsMWXhNfGdLTbOSSwHg8lh/H0JPenmkE2ZXe/Htt0f8lYKajOYlp9TQK7GLzQ/4McnHDRv62s6UUQp33inuGEA/n7lj5RN/TyMeokLP306Sgh2THJzRevQ5B7zaGyM8ADIjwWyf6EZvSYMqoAPgkmUP99KlTJCpx/3wdyrdxEIUNi5/jAV3sLCenjrW0MQ12Q1qDDbvYS8rOcK5M1AKnH81t2v3cE9wvs2OtNvAZY8yqIexEEvxDgapHa6R4OLkSQC9nVpT+gm4Q8+9QRywGlZogLM9T0vsyqYN2Hi3eSyI+sYuQswrmmUYIdXQGX99IPG6KMZXnuJbQJ2p+Q5z9FgIgZMKsNWzvZd/u321SlHi57NaMmcKaA+n7lzhg5c+plL3xuNE6nLVrQFUrn2ukPY0+fNiT+rSo5nujstmslV2Ft73zHjihKRzLm5pqSBGlBSOmGM83CISt+u5N+b8g9SixBzUZkb/Hufo+lhWfs2PUozVmSyCWNu5viY0o56NBEvD1sxGaGc2mfZgtAstxR7FVqi4ofa/qrwhx8fCrCsaam547AVbpcw4L6mWMKVVe54tin4oEcpYG2oCzplwz4rLi3DCyycihiO+t3z+NBVZM8009XhKd4OxlxcoTREasNEj+516mypRulmfyck7zw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(366004)(396003)(136003)(39840400004)(376002)(451199018)(8936002)(107886003)(6666004)(5660300002)(450100002)(4326008)(6916009)(8676002)(66476007)(66946007)(66556008)(86362001)(36756003)(83380400001)(54906003)(478600001)(52116002)(316002)(66574015)(41300700001)(6486002)(2906002)(186003)(38350700002)(38100700002)(6506007)(44832011)(1076003)(6512007)(2616005)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aWRsVzZ6NFRKbHRpV2FsMFBrTGF4UVF0VC85bWlFdVhNYnBONDlWWTlWYmE4?= =?utf-8?B?NHJiamxUU1NWeURQTTBScXFDN29jTjZYaGxLL1BRcGt4bWV2MHN3dkNYNmlC?= =?utf-8?B?ZTFaa25rTUdtOGZReEplbUI2VWRhUEI4TmZvTXNnRHVPbm12a3ZVVW53OG8v?= =?utf-8?B?WUM1TUxtamVFWnA0Q1loNGxtOUpDcmpiTHJXZVdDaHpIekU1YTNrMFJ1ajg5?= =?utf-8?B?TGIyTmtyZU1Pam9kTGNrZHNpOVVaUlZkaVl2bGdjTDlCa2xScE1aRDJwS041?= =?utf-8?B?Qkg4eVVEWEJuNS9PWnl5NFdqSzMwdzQwSkJSVFFNeUZHMU8yVUFFbnZaVGZI?= =?utf-8?B?ekJRajhIYVI2MGNiMklQcnBLdHNnRTkwdmxpalR2aWpEdENpVWZ6Mi9pV2ZX?= =?utf-8?B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a71596-fd0c-4bfb-7cee-08db1f7d8efe X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2023 02:33:53.6454 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QYSLjgqh+7eqAayw5wKxJirbWkEkxIR2t6o6dTE3Fbam8y5G3FRAFOYJ8HodOsBf8Bot8MrWqXBfWpi1u3HPC5bwTHSLcIaliO7cKDgU83U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR13MB5125 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Peng Zhang If rte_eth_dev_set_mtu() is called before rte_eth_rx_queue_setup() the NFP driver setup fails. This is because the default values evaluated when setting the MTU are initialized in the rte_eth_rx_queue_setup() code path. Fix this by instead initializing the MTU default values in the device initialization, in nfp_net_init() and the check also is conducted in nfp_net_start(), so it doesn't influence the result. This was found by using DPDK with OVS. Fixes: dbad6f64f921 ("net/nfp: fix internal buffer size and MTU check") Cc: stable@dpdk.org Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/flower/nfp_flower.c | 1 - drivers/net/nfp/nfp_common.c | 4 ++-- drivers/net/nfp/nfp_common.h | 1 + drivers/net/nfp/nfp_ethdev.c | 1 + drivers/net/nfp/nfp_ethdev_vf.c | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 2c797ae751..6f197396a4 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -24,7 +24,6 @@ #include "nfp_flower_cmsg.h" #define CTRL_VNIC_NB_DESC 512 -#define DEFAULT_FLBUF_SIZE 9216 static void nfp_pf_repr_enable_queues(struct rte_eth_dev *dev) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 5922bfea8e..5d92b476e2 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -1126,9 +1126,9 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - /* MTU larger then current mbufsize not supported */ + /* MTU larger than current mbufsize not supported */ if (mtu > hw->flbufsz) { - PMD_DRV_LOG(ERR, "MTU (%u) larger then current mbufsize (%u) not supported", + PMD_DRV_LOG(ERR, "MTU (%u) larger than current mbufsize (%u) not supported", mtu, hw->flbufsz); return -ERANGE; } diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index 49c89ac327..4486ffa72c 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -111,6 +111,7 @@ struct nfp_net_adapter; /* Maximum supported NFP frame size (MTU + layer 2 headers) */ #define NFP_FRAME_SIZE_MAX 10048 +#define DEFAULT_FLBUF_SIZE 9216 #include #include diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 47d5dff16c..56fb8e8c73 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -603,6 +603,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->mtu = RTE_ETHER_MTU; + hw->flbufsz = DEFAULT_FLBUF_SIZE; /* VLAN insertion is incompatible with LSOv2 */ if (hw->cap & NFP_NET_CFG_CTRL_LSO2) diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 7834b2ee0c..d69ac8cd37 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -365,6 +365,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->mtu = RTE_ETHER_MTU; + hw->flbufsz = DEFAULT_FLBUF_SIZE; /* VLAN insertion is incompatible with LSOv2 */ if (hw->cap & NFP_NET_CFG_CTRL_LSO2) -- 2.39.1