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 3230BA0093; Fri, 18 Mar 2022 12:32:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BAC5F4068A; Fri, 18 Mar 2022 12:32:39 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2116.outbound.protection.outlook.com [40.107.223.116]) by mails.dpdk.org (Postfix) with ESMTP id 02B7B40041; Fri, 18 Mar 2022 12:32:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MNStqKtMAnSkDqcsO2N+C9X7twTR6bF3MmWU1923a8iYW8FGbkO/CTETXQ0gZGyJpDLlsPFYBUGdtZKQ5NfV3eradtzSi992RamlvSKByi6h67eNkMVb+TFwQfTuInb3/DxubV/OPtu8pOlo9GIdPmm4789aopqSTINVQBMmWcZhuoVFAoktQKvbW2EdyEpnrqway4nV6VrqekR/G3351X3XA5cY8EujP+D4e2slIwwpxOjq2iVS4JmepdLyObO8kacvx76q1q+mVFUI79ATz1wy5WQYEmtvoHdNslO59PtT+iujTsMDsgMgGBuEj3WOkcgufYO8uwho5GSJKWJKXg== 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=ErnxctjPAZ8VDMul5a9zUJjO+QtBlZdP+Hs4t6AHcxEEPIMmebE2qUGGGDP2hG/hrdcBEwkt2Y9q9Nn6GUA1fL1ouDmmBhfrHwZ7R2tXr20oqnT8UMPi3W//Xm1uZZcQaUpt5itcF8hag8aY/6TriPu0ONxFTcMVXfNP/yLZsafnZTb7shtKYGfPiLizT+/M6EztpAf5pGizMeIjKgnE41/rdhxSHuPsMJkKY0HfYS1R3EdfidGmPWZuXPQxL0FvxCvo/0ubZkJxJFdd30Gu5LGQ8dRUau2ccretLTCqHf82mLB2wEJ624S6ExRfYQVPnETtV5/9P6cFG4lTl02uwQ== 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=V2be3S/4qy4j+6XQOQLM180cqTZT8IV14lJqhIoDLteFdVT0QcC1tQrKR4/bWAetyZy50zn+1Gp0eJWJoUKKTa6isvonlk+7HIIDUuunNzbrHaap06eCZXABkb1XBvNJ8dRvaNMqbcwzgyFhzg93JOXUl3R/1THt05ddal9IBzM= 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 CY4PR13MB1510.namprd13.prod.outlook.com (2603:10b6:903:12e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.8; Fri, 18 Mar 2022 11:32:35 +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:32:35 +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:21:42 +0200 Message-Id: <20220318112142.879009-1-peng.zhang@corigine.com> X-Mailer: git-send-email 2.27.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LNXP123CA0012.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:d2::24) 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: 5415f473-db23-4b5a-0087-08da08d2ffbf X-MS-TrafficTypeDiagnostic: CY4PR13MB1510: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: nm2Pk1URl3/rPLQt5pyhd2z+LzrS1kDRPitagKIkBJCzu/tGJ/sGYJkKI1xKKw5DbVoRnsClGh/QfYj/mACEi7xbU8wzDrAGsipQSShtUKwOw1nVZ1HrZvAZ66mwwiqSZpA4pnYU+dwMKmQdTqwKtGbxY+35kTOW31+faa95+SgXg9STU8GtXd6UfTlwCmmt9WUvAacDES6i+Vi8E00i53zOkrPnSXURl/+ACjsUFqBPdRg2Qn6YYUFzVi+MMs0s0SaovwX46PGDz28qnCavpsjPpuANdzcfohtQuLMMK+DH39WhvQisqnw6Uxvd7UEw/d14FSFnz6tBVy6ydbYxguE0zpQvDj6T3YtEZKmiSXn6z6eCBHvKvgXmR2QnET/vh/NNkrno+Vt8ODE7rAncXD1t8Brce2UaYn1u4wmN37Eig1ly5bi001eGRRDuQaApu0JdIrIoy5tJJ8oTH4oGcE6UO9lPFA22hcgi+8QFx3CeklGzDHArCkTxaPiAPjAQVYLwefahWAbtd10VsTKT0RVE5qa8WIGwNfpulpgOgSDXYQhuxY9FJkKgOopFJx+4YPuL1McmjGqVpc2cZyGFXoh13DKL7ik4SxrXHql7CKmtfBl6ZWtDZFtzg9wvZH5vZ+mqkccRwKVx38HxZTEylGVIKCr2VAkzzVh8mt98jomsUkeNWaWrHw4AvQa0CrKl/+sqfGfB76uyrxD0POuh0+kBROJ1/0N1G05n+eeQ4R5VcNIrJitZJTdQcjrWuk3f 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)(366004)(136003)(346002)(376002)(396003)(39840400004)(6506007)(52116002)(508600001)(26005)(1076003)(107886003)(8676002)(450100002)(4326008)(66946007)(66556008)(66476007)(6512007)(316002)(2616005)(186003)(38350700002)(38100700002)(8936002)(2906002)(5660300002)(44832011)(6486002)(83380400001)(54906003)(6916009)(6666004)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KybLPm2kbQc6vUJgkNSGz6a2ROJihW7n0dmviIZsa6mWovXLZJijKahOBcQ3?= =?us-ascii?Q?pAMHf2Hoxqhh3jhjzSVpbzOh0L9KkWD5d7c7yuB1iKFKPVziPDRIMQxGZ5y1?= =?us-ascii?Q?eMSC/OygduOBbs1VZrl9XHJ+zhpzIYjGqsRG5s695evfN9KH7Uh/cvZLDTH4?= =?us-ascii?Q?IeTb21zjnqCVIQox6h/YZqi3zncLC/Y44GGVjEaEwnyIMmGXXfuArY+bSZ35?= =?us-ascii?Q?ojOZIOJBIfwmE6Tsg9WiF0D32OmZxPvThrqwMuUcb9DyhDQFdyavsmb2Jngz?= =?us-ascii?Q?rbyRtT6PT6Gk1QaZ6+wEZeIsqFBMKB9lMm8h7br49vLkWV40L2KRPYBVHZzL?= =?us-ascii?Q?StWVkPOxqqa9LheOFPgghdFfVhJK7GoIRl+dLlyQveDDtLJLi/pLbdwenrEi?= =?us-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93NQ0+HSdiosvL4Ew9p9IOYFiYQl?= =?us-ascii?Q?iryGWkAIPYlpfsO1Tj95r+VV1+1/pYah1hR1OHaiX23TKUgg3K0TW9sZvamN?= =?us-ascii?Q?PKUb5ADuyaF9KpUMGDmZu0v7Ov2U+bktGhL0po4wTEBEUhyFg88g2ICr9VYG?= =?us-ascii?Q?+nWOihCenyqI/HdZJSq5FbcW/NNjRf4wP0EEuO4gNMI00mT+iKfzpA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5415f473-db23-4b5a-0087-08da08d2ffbf 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:32:35.6645 (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: r/W+d573xoG7HK7YJNtXBoZJqf0VCu7ASYnZdOQftqXvUXkECYnd4BukdWNfufo/QMsOqr6JWZfxLG88ILfn9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR13MB1510 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: 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