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 446FEA0093; Thu, 17 Mar 2022 15:40:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4222407FF; Thu, 17 Mar 2022 15:40:24 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2113.outbound.protection.outlook.com [40.107.94.113]) by mails.dpdk.org (Postfix) with ESMTP id 148D24067B for ; Thu, 17 Mar 2022 15:40:23 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ktxzyYNMB//Nu/Q8VOfFOmsExeLuLVAgGN3MlCFcmbAM58Kyun0bNHLdryyJyXAVWHOY6EqlU1rnkmKu0PSszoIxuq/iBza/x36ohRLdbz7+co5JSscH9af8cIRE54uE5I9gbqrstdIr3qoPuuTGwd8J489TNuJxYvjg3XRXuYVB+WfvT7Fe3T/s3G/wiex2k0CjJFiU/4YU9lmfYMlUsH+EIfxyQvij0pxlV9O5vH7jDUTQLyWqAonXuCEhngn0JnpRXyDzEt1zpkrz5//9Po3yPclMFAiUCgKnieudOtMod3NvJvo6l9Ws6ackrtCTLs3/oZPP1L2x/o9fRSshiw== 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=ZzsLr11bGLkbOb3vKochf3iQD9to0cFGWuR0gF0JEkoXNs7jWjYvUovd3NhVDDjAm17d3T+LmSNKArwvSv+/z8CT6SCW1IhVpP0JeH0cimrzxsp2cl4z+4GU3s0vGW3q/bBu5IgLSd5twVo7DnkUAdwYssRBL0QT6GZ2MPczPwyzGY7Vlf2rpwq/AFwi5KThBXLfZC3SbgTGzQicqWAr8L7nqSL/H0ckXS4bgq5JtYwxtESUPsknek8bLKpzP8uq4co4yEK2tfiJVAp+i0I1Qtlm4WYtx/arC+8bc6mlmK449uIdZ+xIVvUgXRA7dJKgHfOIAkLYhEKl4a159xBsmA== 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=NKZ2wXHrZ5NU46nN6bN1DppE328V5fJMZ3LdnY7t79giQNCLWtRVSP+IkahC+Bo9F6JN9pi3Jhs5S0T2AhIPC0EIzPqyuUyYvtBSM+5hnUMBdH0dI8z6Ph1Qg0pPRfI5GZdOCGmVE/wJkBwfMbTCV1qmTIJJ3fbW6l2PHO56htY= 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 BN6PR1301MB1875.namprd13.prod.outlook.com (2603:10b6:405:2d::37) 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 14:40:21 +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 14:40:20 +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 16:39:17 +0200 Message-Id: <20220317143917.499138-1-peng.zhang@corigine.com> X-Mailer: git-send-email 2.27.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LO2P265CA0249.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::21) 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: 7d193cce-d17c-416e-5684-08da08240ffe X-MS-TrafficTypeDiagnostic: BN6PR1301MB1875: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: L+1i3A9o+NgATulP1RhomQ15zqNBpq2naZPv61pPdlfbvPyAfpIl1ScvEQ8BUQsmfJzBy/z818QeHqMMVuxtVsB+xB0sj6hJvn8Tjy11EWQYlbn+saGuikwrVlliZMXzhV7cWGdNVzTp6QTVBGoWMBbwoTm+QNX/Q4BnN3Q/CVzElKjVi4c7i25odv2kjQ4tliE3Bo5tWR6t+1hKpsyb8pJ3npkd4QkIMkhy2F7KBuYIGQvz58/uz2e3thGqb9TmR+TOFuWexrUVD2xdc2W4iyJYLw+WI7HuB3Ywh92o4ReMuuTwwM2doPEAZwBkzrpErjJTRK+qqduyt5PxVM0Vt1FB26ELRir5pIk65H1BQg2e/EPyS/x35BVBUXNnMIcPkApN1PogkxmaKfnzyHI1fDKCuX11iSZs76IzByfNVwZziObR/WmYdhwp+64M8K7yyYuw/qJdQcerc+AM0bMdfhHJVhIaN5V5Q6xV62Mg+F5XindfpaUx0VHEP3VTJI4qj4jgTy6q3NzqQkwWuuOwRk1udNwY2PsUKKJE8glgzKKyy/MGAHC0OcXk/RCd5CuBnecaNnK66/6sbx8vgO/hCDPeRBqbujx35KZ24xUFD8JWJA+7xZp9X8iOwj0Tmjs83jYm7Cps7cIlPvap5jajQg3LgNjzU65W/b1IYBIkTJo+yn7cXL3/Vdo2+wlFTV73L6SkJjDC1pfrvDHBoVafmg== 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)(396003)(376002)(366004)(136003)(39830400003)(6486002)(2616005)(107886003)(36756003)(1076003)(508600001)(26005)(52116002)(8936002)(54906003)(186003)(83380400001)(316002)(6916009)(6512007)(6506007)(6666004)(66946007)(66556008)(4326008)(8676002)(2906002)(66476007)(44832011)(38350700002)(86362001)(38100700002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?J4yF0RzUFT0zo93nfKXntUkQbVYB1/gjipQmuNoLRzNk7gItlkJDZGTwk5dl?= =?us-ascii?Q?F31RkCImsTi2ZuQTm0ZMASedwb7wEqdSFsbOLb6+B3XTB75W5pDnD7KONh+P?= =?us-ascii?Q?QZX6zqjygbTPM69mn16REwES79FtBUvd5TTM2N7pDlWSTfeygToe1TUmmSPq?= =?us-ascii?Q?8QgDXakbHOCXHp2xaEhJxLvRLLX92P949P4Qle7qcrmY6Y/xxsLFrZxjmJNJ?= =?us-ascii?Q?Cw2cb6WswZ0so+6Lcc+xmMNqc2/fXO8k7mgbZPJu3cogAmD2gADL20wLeAsx?= =?us-ascii?Q?nSH6DxZeto0sdEyQIHpVjOF5q7JLYdB49BK+YGD9MBVEaJUSh0zCr1vt3eQx?= =?us-ascii?Q?osjFY4EBBRo6FGlGRNqGH+58ILFxl3PwlofgajVmHZpA3L0L5C7b+RXqsgTJ?= =?us-ascii?Q?i2z6/Z8jpIBLmYZjGpEO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i7/76+MAWAmgaAG4Du7aysZLzp44Kag0ysxN7wU1a5d2aA2ISwTXkdfesu?= =?us-ascii?Q?5jND1aedo46kFe11H0jyGjBNZtC4b2WRyEsFvHnQIX8eFQXamudcScEgFUcX?= =?us-ascii?Q?TxKH7Ls6Tnga6A0r6qGV430pPgD6gT4MBw6FjdBrpdkBKAEOAjLlrA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d193cce-d17c-416e-5684-08da08240ffe X-MS-Exchange-CrossTenant-AuthSource: DM5PR1301MB1994.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 14:40:20.9330 (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: M5ZS/R+lXM6XDiJO0Q7Li2Ms1IG5XCpK67aunxw6QlRJwRkD8hi4CZFkrnpi1AaxzC1DhjK1RsbmFVg5/spCqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1301MB1875 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