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 B40B2A0505; Wed, 30 Mar 2022 05:19:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D4D6406B4; Wed, 30 Mar 2022 05:18:57 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2105.outbound.protection.outlook.com [40.107.236.105]) by mails.dpdk.org (Postfix) with ESMTP id EC43B40696; Wed, 30 Mar 2022 05:18:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MyXJqMODHsjGR4sHjY3Slwzb7MHWo0T8xK/8wKkQNDrKhmjGp9tShgZEUZFAb+wM2+rO4/jbQqLnag7wB2MBvoakR7qSUg3ZL5zImbdp4UBvgZyurJFyoJjWDzGIQ2mWyVffkLgJZGNALTxmVAKF3rUQNYARVivAYGHSd8M4OdmZkUELudlLvxbxj8n2tzgkm5apxjCj2umkI9jAFlCiufRDR1OI30LY7HJY8Gomz4MlIfURbgs8qAt5vAtXnbK3/4mtVao+6EAg8nDN1r23s+2ARZT9GBGT2jQpRHaA1ID/79VwoGV9Ddbg3LvO67MECsvTvGd96PXCG6fuUZe/xw== 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=tJx9caQ51dqm9ov3tB0BvOdmyLO+bxq13BhMI/LiIXY=; b=cXkJ0lrX1pzeHPBd3lIKUXYMqvIAM+Wob5bXavimRxXFHVJqeJk1ENoBHIAqv/5/2p0BMKiKAqFRIaZVb3/itHX2gfavoYTXzOFYxH6ZMHA+//HfTlDJRQChwF/WSnUSrum88cVICFJsK9mtvuP+ypbCsUa+bxK4eGY6XoYxbfKuJAgFPX/zFSpROvrK155lNBsxkpeeqKLDtpx+2UI06EUh+1kN1Z/cIf36JqvRBo8TjEYzGOMI2GfIIFE2E1LFbzUKMyCPVYslo/cEakSWfGnpILSGy4pvXTRUzrMFOcYO5mwxtN57vElYg4H2lost876rBmob+OZt3Z1x0HKt0g== 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=tJx9caQ51dqm9ov3tB0BvOdmyLO+bxq13BhMI/LiIXY=; b=wjy0O+PD+Hv3kno3XB41noTlCKTsuaqJl/287DllMouyO/G9urrcWxmBZPG0qY0bl/U4ulnLlUjIDdoLywer4+xsZ7oo0x/ohsEgRR3IdZtUX2Cwzas/xZlrJhPJVQrsZzyluUzrBcAzpkz3nORLv18FXcgH0u9XGrJ9JvZn07Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from DM5PR1301MB1994.namprd13.prod.outlook.com (2603:10b6:4:2d::36) by MWHPR13MB1053.namprd13.prod.outlook.com (2603:10b6:300:14::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.16; Wed, 30 Mar 2022 03:18:53 +0000 Received: from DM5PR1301MB1994.namprd13.prod.outlook.com ([fe80::5142:1f0c:5d36:8d70]) by DM5PR1301MB1994.namprd13.prod.outlook.com ([fe80::5142:1f0c:5d36:8d70%7]) with mapi id 15.20.5123.015; Wed, 30 Mar 2022 03:18:53 +0000 From: Peng Zhang To: dev@dpdk.org Cc: heinrich.kuhn@corigine.com, Peng Zhang , stable@dpdk.org, Chaoyong He , Louis Peens Subject: [PATCH v3] net/nfp: fix mtu settings Date: Wed, 30 Mar 2022 05:17:51 +0200 Message-Id: <20220330031751.119830-1-peng.zhang@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220318113819.885476-1-peng.zhang@corigine.com> References: <20220318113819.885476-1-peng.zhang@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LO2P265CA0179.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::23) To DM5PR1301MB1994.namprd13.prod.outlook.com (2603:10b6:4:2d::36) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 26847196-11fe-4ab9-d4f6-08da11fc0434 X-MS-TrafficTypeDiagnostic: MWHPR13MB1053:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T8Y3N69UppytGP1SJNyPOCWzUFvmJapGnPD/IazSXmtHvfMiGUt6/5zgvymhiXbwdFnWxIgVRwt2R+BqDVvdY8yBOldsRn5a4lU3LFOWyFHW9CSpmzuN+HTOtsbYjbgpQCEg4tWSbJ18DZFeEsAw67N00qBEZtRRjeyfajYIcMKfKdSkgvfprmntMZbvra/YlgISZK7J7NYVtB1XHqA/Rt2wHfqo7F5D4V/gFCekWo0z//M35WRihOo6xKIQ3SDmg2/o7UqZ5SD16y6KtWq4zETRWFQgBFEi+aBUY1gJLhUuAcibsXaqO8IBfLRqUeHTVwF05Flr+U1iftItUASyxwOl9knRMMdAw+1tkI6tfDB8jj9PfCaeUCaKRdwM2nzdHa/RGWT2aMwdg7BBz/QOhwBPfmfS9qKdWlAuC3OD5VRvKTuGlZVldtKCTd3YsPqDaW9r0Crh0EqcV/n6nTlWdVxo6HHJlGnwH8rH+ICAhg3bDASQtqPbzzxAMVZxUClWmxaAglQgyXagR1jaOuZ8N7GE7VpKc1fLQMF6X8gK6jOpBWLBDd+GbMZqigIsWU0lJH+qrjhIKm0ux+9z7JuGqH6UJnCHcranSJbEnAUVUS4dRy4/AcptAEjCU4c3sH5MXVNoY7s2EXbrW5rw4Ucp/uib9fNCtBMrZ9HuBNm17LKItWxtik482iAAPvs2MhO/JJ/YyjnzPr7WWDtierO0+A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR1301MB1994.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(136003)(396003)(376002)(39840400004)(366004)(346002)(186003)(26005)(1076003)(66946007)(36756003)(316002)(450100002)(4326008)(6916009)(8676002)(54906003)(66556008)(66476007)(83380400001)(2906002)(508600001)(86362001)(6512007)(8936002)(5660300002)(107886003)(2616005)(38100700002)(38350700002)(6486002)(44832011)(6506007)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uIrwvhoeidnTnPpb0BuONuZfn5ZAeuOTFPPFVqkBibTskTr7NFB4BihisEkk?= =?us-ascii?Q?ProjNDYzE4gS/pyOAy5UX6Yfxgzm4PSe14jSP0/F7XAXPbF83OQd0KRvuGLM?= =?us-ascii?Q?1uEuenC9Bhw1lThG3VR1Jiyd0w0BFmA8zl/uZT9VD2FT/9NaylBbeckv7ysk?= =?us-ascii?Q?nQMQPMCV3uCfInPh0M/d++ZomWYPCeh/YgcqHmjQ7ek/QxO1nsLn3lBPxgG3?= =?us-ascii?Q?MgRXqqqcjock7YcJ/NtI3vKTYu4m11hVQ7DYmj83Xg7OSaPQX2lMam3YIpos?= =?us-ascii?Q?ech8xWFCV3RlevuZUZQyRR3BfnU3MNGzCILKkh0baLuizYZJu+iAAnHNkPT5?= =?us-ascii?Q?1QFBuvBAqpTHPt9nj9hInWjePRj/e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?LIdDIO5VkVPeIwM9klxQeMRZXmf2VQEmnYthVCND6YqOeNWYvIDfxawXhQHj?= =?us-ascii?Q?ZEZfVSM4VaTdVOq+FrevCCbTMFoH6ZhnaHR/o75/NocQRL/1r70vS/Ffa/fN?= =?us-ascii?Q?4KO2Wr7tl9okyutfBs2pc0yfcYQ9G3uoFtc+v+P6eIHhu+Q99Nl7VSh+NB87?= =?us-ascii?Q?FzXHn3mgOc389gLdslW3DKLXjQdiW750QtveZHs9qyp5v7ROc+FrIvirWgo2?= =?us-ascii?Q?smFnX9zCR/j520xuhcjEVO5efmhj1o+za7GOzTHyRQekdBvck1hFEihxalrr?= =?us-ascii?Q?RsmrBdW4SOfx7r4HZQ6TCqSVOxiHLOXCUchmVUQFn2G23/DMos79sVv6e6SC?= =?us-ascii?Q?kqT+KWiUoAbM1V0ozVoSlELL7aUDhhtp0/EfqBA5o3GgAzeeu8oaY3gvfCsw?= =?us-ascii?Q?gt5Ql6neztvLuOU39wQeuuu6L+RQOiNB7tGh+gd1Sg0b6XHfRp8BIkMWfAcU?= =?us-ascii?Q?Uyi7F62N3MkWH6DI9qiSww3eL4dsqOo=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26847196-11fe-4ab9-d4f6-08da11fc0434 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1301MB1994.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 03:18:52.9473 (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: /b0KrH4i1D4yuLyUDwmnWZzZoosXB8gZCGtSaZL0aN+WqeQbpsKISwnuPodm//YehZ9S3+Qz0eWUElbnSkHmYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR13MB1053 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 1.When the setting mtu is higher than flbufsz, the mtu doesn't work. But it doesn't have any notice about this restrict. 2.add the min_mtu and max_mtu in the nfp_net_infos_get() to avoid the setting mtu isn't in the range This patch will add these restrict of nfp mtu. Fixes: d4a27a3b092a ("nfp: add basic features") Cc: stable@dpdk.org Signed-off-by: Peng Zhang Signed-off-by: Chaoyong He Signed-off-by: Louis Peens --- v3: * git summary v2: * add the min_mtu and max_mtu in the nfp_net_infos_get() --- drivers/net/nfp/nfp_common.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index f8978e803a..4e48e33a63 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -693,6 +693,8 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + dev_info->max_mtu = (uint16_t)hw->max_mtu; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues; dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues; dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU; @@ -956,6 +958,13 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } + /* the setting mtu is lower than flbufsz */ + if (mtu > hw->flbufsz) { + PMD_DRV_LOG(ERR, "the setting mtu must be lower than current mbufsize of %d", + hw->flbufsz); + return -ERANGE; + } + /* writing to configuration space */ nn_cfg_writel(hw, NFP_NET_CFG_MTU, mtu); -- 2.27.0