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 92515A04FF; Tue, 22 Mar 2022 10:26:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30CF0427ED; Tue, 22 Mar 2022 10:26:15 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2102.outbound.protection.outlook.com [40.107.243.102]) by mails.dpdk.org (Postfix) with ESMTP id 02C734067B for ; Thu, 17 Mar 2022 13:53:05 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IMJPXuV1aEnJnAilJNU52IPSir8ZyxiRnQwNE3Jtq4pBHsjOEHveBGdspXZkWu/72SAYwcRQX61oEBBx/ONM/bTTXuG4Td2b9W0jyvNEDeYc3+Hxnk89AMnx83uUUtmbw0r0VUCZLa35wwmmJVY7Pcr0yef7Qf2LxYjieX+6QcIy/kzR+JSTfkzSTzUeyGKO4yMF4j+yUPgNDjWwBZ1PKR3aJ0l/6D7ij4w3/92DLeyhIYQXozHynwS07KSxqHdsR9IIEj0XD8qEVM720Wa7Xvg+Kku4oW0vV7RnVyDUFgzCm0wjBb0eDTZiUSUD2tyLHePt3Ks4NhJbpRB+noDl6Q== 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=xx8+2LT6HoVv8u5b+66npSbu3n89M9JTKeoxCEgJgyU=; b=kpUZVIg6ufAQyaR1yMee2jNudtYecv611vtOgZs7oPzshB9Nr3pwA9QRhTsADqLyNRwGnDC9VRBprky9ajKfDwm9UMJxW4hHFRPMYq8OU5h9vOkhvzcvuSd6Q3Z0F5/Hd50iSPGfEu7s9FnPLDXfn1bVaOaNMfWtvhLdlNe44nfriCRQY3gC7Xb52Npyqwm6U30+MBfKr2NYPVtl9cJ6sgsh3DtGCjbSqWMvrCpiRgtlwdGOPM+aWd5VrgKI/Hww7Ca/PEKxYk37HtEf8iP9FXADWql40Wv2uKLs/4Epx9KTCVm3mQwW8yYTx5RZbHVhYHoH5PtWd6UchosaBh8GUw== 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=xx8+2LT6HoVv8u5b+66npSbu3n89M9JTKeoxCEgJgyU=; b=QZJhp0idTmUJzsoOm70D6mgpMVOx+Zia9h7r7ndI5iaE8RdvbQGzVXl2qY8YFLFHS4WDDPRZIFeAbnkM1xI4t3daXpDWz7PrgREtRwOYTuj1F9I2lgkv4LMxnLpY99zs25p2qKdOSUmeMl2wKDF72D4OFkkVmoo9keseDzxeIqg= 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 BYAPR13MB2616.namprd13.prod.outlook.com (2603:10b6:a03:b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.7; Thu, 17 Mar 2022 12:53:02 +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.5081.016; Thu, 17 Mar 2022 12:53:02 +0000 From: Peng Zhang To: dev@dpdk.org Cc: heinrich.kuhn@corigine.com, Peng Zhang , Chaoyong He , Louis Peens Subject: [PATCH] net/nfp: add the restrict of setting the mtu Date: Thu, 17 Mar 2022 14:52:30 +0200 Message-Id: <20220317125230.498284-1-peng.zhang@corigine.com> X-Mailer: git-send-email 2.27.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LO4P123CA0168.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::11) 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: 852b0784-4b2f-42d6-0e14-08da0815124b X-MS-TrafficTypeDiagnostic: BYAPR13MB2616: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: YuViPIgwg35QvodRamx11451UP70IW5MsiNsYsFVmaVdCP7g7RmWiIbLQMkHswKVvhgYT31+eQ91QhDl6w7UwYzehuu8IlZjv+5YyZGEHWB5GZEk5p2dyos7627aYH6JHCq1U9JVm5jt/fM6hSNd7lkceuD0kKIjBSRFz32fE2I10nhjDndoPsTvIdYLbAU7vIQbeEyE58fs/KTG+XDLjW2yZ85lWP9ZN2uAiN0366yuL8YbRvrAnR8NoI2NTUoVIfcSEE09whBLxSAVTzEDhQAB1DkU12efZ6DOHIhQWP0HI/ow0QhNs7ifXPdh6lGC2f415cHjTLFqKyDyqKs01J+6b7fbToq60W5Sp2zAnqLiRa0NXO9KAZsEhP9tBF+D5DBDL9hM0zaog88iUy3iJs+7ty8l1Xh/ptId2jKmT7JEAko03dIM3B04a2NTSTSH7fkklgEQe4rJJk/w1fk8tsm2mWm/005aMLA/ZdhnCiv52kvnksMYtgn2/kY6IKs+Uznfwf8f1j2/CUNju++7cm+g0CFzoaW3/GxiZUhYPtF4WscZnh6IIoiKupe4ghyAmxKaXfv92H5vx5cUMPAFJYu0lw+YVsdIxM7H8UqPz14PSM9SJirWQtrlOjnkW8dRbMPl2xzTW2YYPscS+wuSket6tAvk19uzPEhh0irKLV+VpKOgaAqp4HNywU9kfuJcd6w67aTQOV6zuWkKlbRnMg== 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)(346002)(136003)(396003)(39840400004)(366004)(376002)(508600001)(186003)(36756003)(6506007)(2906002)(5660300002)(44832011)(26005)(6486002)(66476007)(66556008)(86362001)(107886003)(2616005)(66946007)(316002)(83380400001)(8936002)(6512007)(4326008)(52116002)(38100700002)(38350700002)(1076003)(8676002)(54906003)(6916009)(6666004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?23dkcjdKeCVtNE8x/kcGAklLmGiVvwcsmQNrFiJ41xgodCaCbC106tUPe27B?= =?us-ascii?Q?HEBn69tXMbKb51WYo3GXYGZQQV/P0eO3N+tbMT1YfF4jCTcvXNIIqAPlSR44?= =?us-ascii?Q?9bmu8dwUinyHr3h2A8Pe1y1WjGo5zO8LpEZudRqAfGsQ4l9KUzk0ULXPZuTS?= =?us-ascii?Q?+mycItE3cV2bJeznVsdkf/MZ+izU7l00cWsZWE4biwo+qf/grbJRmmfFndM/?= =?us-ascii?Q?AbnSTZ5Hekn/HN7NPbtIprExAXz1NIKdnif5P2+KUZYRJ1USriOCCiwCb/HF?= =?us-ascii?Q?dRQCa1XQLLJd0rRJsxkytb/5lYKP5cc/S/rYGwcc3KZjT6MqXCu/dG/n+Pft?= =?us-ascii?Q?kfEVq5v9dsPye0z2s9PE65mib51+RqhpLatZV1owUwt227WomKoIZonbb2re?= =?us-ascii?Q?Mf/c1oHvX7w7M4+yl7zSiE7LejNU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?sqLmUfklNohKKtoCcII7xtC3takciY5qhT3LTMkT8DUOMMBmJjYNMmpqxrBL?= =?us-ascii?Q?r/grsXPCjd0yl3hMdmjzdGeEjMxDGzt+uV8OYlj54mc7nL7O5x7L5gFNGvnQ?= =?us-ascii?Q?eTbvFCl3g9r/CMA+huAjQC30DlkkuuDz/PnAyDGZhD8SC5t1axhvow=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 852b0784-4b2f-42d6-0e14-08da0815124b X-MS-Exchange-CrossTenant-AuthSource: DM5PR1301MB1994.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 12:53:02.3246 (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: ID1o4P8MR8Ak74wU46Xug4ZAS1KN6RpmCKqZ+xUyLbdG4hBFUkBXCyexoK9bjEwsnZwxiAONYuDyR9VerM0JrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR13MB2616 X-Mailman-Approved-At: Tue, 22 Mar 2022 10:26:13 +0100 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.when the setting mtu isn't in the range, it doesn't have any notice. This patch will add the notice about these restrict. Signed-off-by: Peng Zhang Signed-off-by: Chaoyong He Signed-off-by: Louis Peens --- drivers/net/nfp/nfp_common.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index f8978e803a..2ea9853548 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -956,6 +956,20 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } + /* the setting mtu is in the range */ + if (mtu < 68 || mtu > hw->max_mtu) { + PMD_DRV_LOG(ERR, "the setting mtu cannot be less than 68 or more than %d", + hw->max_mtu); + return -ERANGE; + } + + /* 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