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 D45B44280D for ; Wed, 22 Mar 2023 16:50:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDF2D40E09; Wed, 22 Mar 2023 16:50:34 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2095.outbound.protection.outlook.com [40.107.96.95]) by mails.dpdk.org (Postfix) with ESMTP id 49AAE40A84 for ; Wed, 22 Mar 2023 16:50:33 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gry1d9ULCar+N9Z81YpBaFV2n05mWIExehNQLd6gJ25rZ22UHXfcNqLOe7CPm4FjUNncxi7BiKaeypipjJ+Mrbj+RKhntKhIfRJtpD/R92rVi91YtOAg8w5D3Hg4CEPXSymgTeVF29AUzlxn2oF89WOi26VFvi8HTZdH8wxAQBg1nAWopE8lA2PXz3+nPTAOCA5m4SzQky+yNRkd/D5pwbx9+Nxt/0e6NuY5Xkwln9rDX/owryp5VHnu4Bs4fYuKt3aCjVGr2BlYRH4UUOb9sZdA6xyc2W5JkEUUJRK8+Kge7pU8FR0kHpk+m4IW6dQH2rEQAVLgF25yJtaQBJrh3w== 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=phFGezwkE8LbgwZwamfrv4sNkAsCObcop2HDaSf6in0=; b=Y5ytUNEyhLlVLN6vn4M2mcqfb3WSPqmAIrNrR4cdHB2KY1sZXkQ9+quE03WqcAWMCsU2EULdw95VOriQXMNCJCNHiWV/VB78oVSGNU0MHd+MDSKkVB+Z2CRduJprubJmUjMpZamd2xiwZJY54ZQlOgmAyBnUxuwOO8hKccMAJOMVhdsgLpH1c3l+bfqQ5UYulD4f5R0Htk9/JnJSwmN7ZbFOud+eY7BxpnZ1bUIcLfYIC3oTO+nF2i9f9KzzIPhlg7fgcZzInDbR0SJD9X4ZUIkIrGFjuPtkzbhnUmXmEeQRX+mYoMj8BcsVu92MX5p/ZxjGrSogwrxbC0LfzfINFg== 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=phFGezwkE8LbgwZwamfrv4sNkAsCObcop2HDaSf6in0=; b=lN1Pj7SbRhaev6Yquf0ifxODSoTkxxsCy/FvmCgN4vtTvOwHQ4uwHBa/m/zRnHjKBBFU+oCNbFsGwrxbqUvucujiXMJBVIQ3NEoIbVMPsgrouwoPG1HUvZRseekfC47XhglDdSzUEIfkwfpxL4FOeBKuDzgIXYoQTI2640Xoe+g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB6037.namprd13.prod.outlook.com (2603:10b6:a03:3e2::9) by MW5PR13MB5533.namprd13.prod.outlook.com (2603:10b6:303:190::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 15:50:29 +0000 Received: from SJ0PR13MB6037.namprd13.prod.outlook.com ([fe80::3de9:ee63:e093:7866]) by SJ0PR13MB6037.namprd13.prod.outlook.com ([fe80::3de9:ee63:e093:7866%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 15:50:28 +0000 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: stable@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH 21.11] net/nfp: fix MTU configuration order Date: Wed, 22 Mar 2023 16:48:24 +0100 Message-Id: <20230322154824.948054-1-niklas.soderlund@corigine.com> X-Mailer: git-send-email 2.40.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BE1P281CA0185.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:8d::8) To SJ0PR13MB6037.namprd13.prod.outlook.com (2603:10b6:a03:3e2::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB6037:EE_|MW5PR13MB5533:EE_ X-MS-Office365-Filtering-Correlation-Id: af4af852-8cf4-4fe3-e05c-08db2aed28c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LY8MaFsRN9f0mkJwOwCArXzHoLl5cGDm1VAZtsYgPApQEYSKj645M8Adom88ars0ZGPUUFozhq8FE1NSWWeqYmYJdeYxnXycDKvhXSaVX/+OovTAlzAgC2zOfETgeg92wPyJJxUM8Qpm/DE9ABslp294ARc7SQ8uS4mwIT9MKcEN5AH+lpYiTsFUtXfPlYmB0mEfN470gPRP3Kf4bMU8HeFhVZpSl9dCJ2V/WU2Jf6kZGfbJxgFNYQP5BtYT+Nh+gL+TRN5euHhEpK0v08HGuAXzSEaOT/S4ptmAaul9SC14K+NuOY0lvES+we3+n1YBBEhF7vdxcnG6d1+yIkKCrwb57hn6m5cDAOnfm5U8kxYjITgGfRvGYvrYHws6GLr+iHceJ0mAZnC+pG1lRenii4d0lA9Taz5ZgjpqTHJTDy/Euv5azvHdSXCrNVEGrdjzrLl/hhmEVFXFEIcH8XjoafdTl2yixujnJVX4TWFmkRPp7i3KpNyOEWYiMB/P75/FcuJPjR6jQ3w480L7TSe53P6qnS4p/KFZx+PW+W0yPw72AAsG4tvbbvSEtR7E15c9ZlOrHxxifEN1IvvMh1lSnMlIJ4PGLBOGnkcofRdA3Uo9yrGQou6tw3d48FXDkZwKXBaWFYy1NNvUBDS+Au6r8faC330if1ToE6BB4jCf2ktilhCAQzTaLsr4uJTGrk06oa1s+y5CX4nHdyjvMqHZEg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB6037.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(39840400004)(136003)(396003)(376002)(366004)(451199018)(4326008)(36756003)(5660300002)(6916009)(38350700002)(8936002)(41300700001)(2906002)(86362001)(38100700002)(478600001)(6666004)(66476007)(66946007)(6486002)(107886003)(66556008)(52116002)(2616005)(8676002)(66574015)(6512007)(54906003)(83380400001)(26005)(316002)(6506007)(186003)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MFE0VjJPdloyUnJ6UHdnQllZL05kdW16WFlzUnhtU2tSQ0JwUXB3L05UcHox?= =?utf-8?B?Tlp0Vm96TkN1VXl4UTR5Z29PVTJ1cEQxWis1Ny93YlFKQ3lSRmJONkxkZ3Fv?= =?utf-8?B?SitVQUYrcGF0MkF0NjVXbnFMWklJdm9USG9ZQjM2QjJBdlZ1WVZCQWU0TDJa?= =?utf-8?B?Y1ExbDI1Ky93Y1BMWHE2QzFqZlZPaWIyTHZuRFlzUHlTMEJrbEtaSDhPb2l2?= =?utf-8?B?WmZ0WXJjaEp4MXZHa3h4bUY0bFJwTVp4Mk9za0xKajRsV1VXa3F4Wm9rRWg5?= =?utf-8?B?TGZHU1dKQmR3TkpMbFcrVTVQOG96ODlWbVYxanorK2lNY0p2SUJkL1htNE9E?= =?utf-8?B?ckJYOTNwbEx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ZP?= =?utf-8?Q?xARl2DVth7BK1VRpjt2oFuY=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: af4af852-8cf4-4fe3-e05c-08db2aed28c9 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB6037.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 15:50:28.6286 (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: P+5Ds1Di76v0eFyGN4hzTkqqdvrpi/C5KBnR/kmOaNfXdwI3abAinCTNTm/lGMxwbjPn0vEMjNozRq5WkRMHJ2RmBxvkVHEO7P9zI76FB0g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR13MB5533 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Peng Zhang [ upstream commit 4352a3bcee3a4cc20c8accb71d683d5add3c6f80 ] 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/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 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index ae087d0153d8..279c3446669c 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -969,9 +969,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 8db5ec23f8fd..466e5a79322d 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -100,6 +100,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 8f922e446540..748bacff0796 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -509,6 +509,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 0034d68ea63f..14d4864c1eb8 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -369,6 +369,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.40.0