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 3BB64A00BE for ; Fri, 18 Mar 2022 12:38:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29B24410EC; Fri, 18 Mar 2022 12:38:56 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2095.outbound.protection.outlook.com [40.107.96.95]) by mails.dpdk.org (Postfix) with ESMTP id CE6E040041; Fri, 18 Mar 2022 12:38:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gZtNdgQmXZpckWCaijt7cNPpb5nGLqd6y/e2oFUC8gB4ySh1HwU1q7zB4YAhwBz7Sz495A0NGT0en3d/+a+Xck2Ryq5nb+5ZZSlTkhc3Gutg67GgAKu8dJF/7wGaIw0ZvQnJuGUROT86kN6/XnO0vsNWZllh0OPhWVrJAH5HI8qAOHyg3PaTF3F5F9eRUGApkaOfQl8feKvWXiqyNM/3xMFOm12mPqRmmiUn19TCwGTEzgVARwbnvgSvMrq0gRdaSiOCz3/43zKWJBsvnpp25Y/9Y1x5BLlhU/wq+vLw588MomVntLH3GEM9+wLJK0UyMvziQWP3u/6iUt+eubnv2g== 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=tMuholQR6yeabPwAHfvLIhSsH2x7e5ttnGy2S48XMl8=; b=KoIFinZWz93fTiNxEn5zo2fUvj7wLHLrReUXRUpE0HRK2aevozXpIb8MwllcMHe22BXR/76IEKAgDOSXk7e35Xx93JSmRjJQAudTMD9HSaZuiBJemaCAm5jyBoT3HFN5Qmu/wB2a0Zn4hUEA13Ixu0IzXAC8VS/qP6IdMOKFrcVKFFpklXefTNan5ifhNMs0yZ2VI1DGMEoZ7qS40g0v/aKJOZCs3Y3kKLa77m8/ytVL/PqoI8q5n5qzla//jPxHe6pr3akOu4OqGNbVPQxdc1HvcwndFiEUUDv3TXBH/hTUUaJw6p/gXQg5v8lHZw8cjDISFRmBc5Nb5vnUFfpT8w== 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=tMuholQR6yeabPwAHfvLIhSsH2x7e5ttnGy2S48XMl8=; b=fUuOEZ0n1dHx0bHekdhpo+YGdTNhFCT8xB2KxcMrDS82aqsHCZQXF1a/98M/A8SPdqiHeIBezvC6ahcEUbOZoBY176hyR0V0DcoVPHlRIpADe04un+7HFzf2AFZMY6A5mUwuD3EMQu1csysCHn9nm/+E9FGp2Kq9BnFnulVUE28= 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 BY5PR13MB3828.namprd13.prod.outlook.com (2603:10b6:a03:224::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.7; Fri, 18 Mar 2022 11:38:51 +0000 Received: from DM5PR1301MB1994.namprd13.prod.outlook.com ([fe80::58e4:77a8:b8c8:7e2c]) by DM5PR1301MB1994.namprd13.prod.outlook.com ([fe80::58e4:77a8:b8c8:7e2c%2]) with mapi id 15.20.5102.008; Fri, 18 Mar 2022 11:38:51 +0000 From: Peng Zhang To: dev@dpdk.org Cc: heinrich.kuhn@corigine.com, Peng Zhang , stable@dpdk.org, Chaoyong He , Louis Peens Subject: [PATCH v2] net/nfp: fix mtu settings Date: Fri, 18 Mar 2022 13:38:19 +0200 Message-Id: <20220318113819.885476-1-peng.zhang@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220317143917.499138-1-peng.zhang@corigine.com> References: <20220317143917.499138-1-peng.zhang@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LO2P265CA0375.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::27) 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: d62ace97-1193-4725-d115-08da08d3dfe3 X-MS-TrafficTypeDiagnostic: BY5PR13MB3828: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: 6+2Hthfnjh+7MweNCO2hCZOwtA2l39vs3HWWo9sNtXJhx7T6jmuLwhfbHOxCJS5ZFbQaQZD7K76qxmon0U814x8fYHNVqqOsg6IMsVBbpnlXtdW4vmmm7p6ZU9vbLepU6KZqBOnUJSJAt3XeFMdNo5UAF3JCNSuEamJLdLh9l+CiYoFwZ8Ne6QIMt/Sl+ZH/+GHSLO04YGrjdOEa5lYxuKyrP6x790XzjZdpivp6LFRUvWiABlshkpQQM7hTR0/tyLemKWHg05zSX1sbm66PNE1nxJqtCwzHyF7bQL5Ucya4I1+3R99lbFPi8D7wy08iGy59R52iONhkTYIeX/lBm9CeYQBebDsatwg/Pn+m1OcfkdaU5HxEm+c6qhNt3fo6SkuWs/38UMmCfThsZ0fd/k0OltDrvIxBMHUblzuNTYYTDPdpvUM4EIcNts+zGthuXkJIyEjgTmx/fw1+3nz8De0nSnUwzhiO5EZKMIQc5M2ekDMUgZUp4D5AZgOK3UEZXo8hiLJYSeqYsND/YoBXzadTm2iDXRYVuboXXtiNzFfI95CxJLhkMJRXIwnTfl0x1f6iH7yf4hQEbCa+2BOfcMLofA8kfrg9SYsr5pQJDh29RO6UTDQmm6FZbS/zLYQ8c5AbKd8x1KYu/WObftH4TFBG4pZNQZc6BDbKLyLQqk5hRbE8BgGFNgM9l9bXwiTBm+2sCrZPf2dgRPx+RV/6E0hhGkoStP4Zomk1UYrrEUGykpnNNLw2Fi0PQ1IsyAgB 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)(396003)(366004)(39830400003)(376002)(346002)(136003)(6486002)(2906002)(186003)(2616005)(107886003)(1076003)(36756003)(8936002)(44832011)(5660300002)(8676002)(66556008)(66476007)(66946007)(4326008)(508600001)(6666004)(6512007)(6506007)(52116002)(83380400001)(26005)(38350700002)(38100700002)(86362001)(450100002)(54906003)(6916009)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Hwi+zGVWbHszkIUc0xdS6wqTotUt+e8s/r70wNHO97bcdACk9U0OJJLBfpHo?= =?us-ascii?Q?f0RcPWXcSeA8GA9M5YdcTknmbfbdHzbkh7/N69jHWdXSyx93HjulN7EAaeHq?= =?us-ascii?Q?bf+H0l05oBaF+7M+SYEE70Z6PH1++aMj6pu0eEP2XLjVaA3e2G+VKOsQ3GHk?= =?us-ascii?Q?n6BtDevU3H1PFlB+QQpykpVC/8UAfSYx4h5mLe1by+w1PuyUj2l88l02iEMx?= =?us-ascii?Q?W6mKAUx2UHAXtwNHAaTvDxel7smWMrTQvo9zfd7jdYwQzOmQEXJkQM46B5xf?= =?us-ascii?Q?vgF1eHsOf3sfszFYZYIeWp/Nryl7QpRraedIZKsfjYM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A6/gjE2D8k6Jey1VZU59Zd7pAtCbRubJ5lFwuM?= =?us-ascii?Q?QfNusADDpnI/NP8nfBUGyTCpCdjCqxXob8K/C3OccDmLrhEPVe8pHuTD2Rqx?= =?us-ascii?Q?wcGhmol4CQYON0KXBzPeaZXg6+h9VJFxuFHhDaukmcdhVt/Ig4ViwWc9uHx4?= =?us-ascii?Q?krEvHXA7InZNtiyB3LOczNZ/8Of7AK0oOnWEX1aI9R0/Y7rJXy80sCFyENHA?= =?us-ascii?Q?UB826YW6wKXyBPnSTRooBq2Gus8UpnRmpJyMxJYLj9kuKnnaFpaQxw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d62ace97-1193-4725-d115-08da08d3dfe3 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1301MB1994.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2022 11:38:51.6998 (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: IrS8nMBaUKgO5ZjDqam/OhslWEg6n6oghrf+gtr4RWGGWtgSsHgBNdgzm4fXLWLcItOP5ih1+n6UGFBZ8HIk1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR13MB3828 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 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: d4a27a3 ("nfp: add basic features") Cc: stable@dpdk.org Signed-off-by: Peng Zhang Signed-off-by: Chaoyong He Signed-off-by: Louis Peens --- 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