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 5025FA0032; Fri, 21 Oct 2022 08:28:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 354F042836; Fri, 21 Oct 2022 08:28:24 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2117.outbound.protection.outlook.com [40.107.92.117]) by mails.dpdk.org (Postfix) with ESMTP id CF41D4282D; Fri, 21 Oct 2022 08:28:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XNzeikt7+zmU+7VHVxXXRh2JA4LqMkMGZAhiXTBDpK7ZHz3jk6xnaMhPjkdt36NDYyGZhPnbqluzHZPEnEx7B4WizcQGTd0GF2q8y5tADBM9v19NrYr902DytuBi9YwHwu7XCSDNMli5bgL3xypSNbOMIh2AFK/hpQdMgHVnG10ZCQujLa+348tPyHPjahPYGwzupOtOjGGCON7tZNTQ1fGtTKq44B9NfzefXBuNFNH4MI9ujvWERBAmJa2TQ78pwlqtqOmFXf9zyWE43yycMWxrUv1TEUVXGTpxuKz2T3yyGDKwHvptxC3XOJkRNaGkO1HDKIk7ca96e+8rZ6hZyg== 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=/GM8CIzo+6uzJYNcDsYfkMd3PRJap0V4S86zfPdG4mY=; b=BZ4ob32FIOO2t11/lKBssv3VCuW4x+n0rJlkAfYnnzxYG1K0MCuMhxQm7b+ZbOo6C2dA+HNHT/7b0xYb3faImVZX3TJCC8/3SrWKtXNip7DriYNGac4hyIgmPp5/E0DY3SC3U7cEjep0NdTa9ZlK5BpsfdbbxAwiT/9Umpya206we+4sSn0I0jvxvtFVu+CNKvaZKeUrAimEx0V8g8m6RIInRXxbjm6CvDKjDprE0U58MND0dtwQ7JEK8yQcb/EDRGK3ejvJ+l7eg605dehkTlfHIQI1f5+42R7Mt920zHcnSKSSuNwezCq7urbhOCY1hPt4F2it9ZJfQNkMDe5ORw== 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=/GM8CIzo+6uzJYNcDsYfkMd3PRJap0V4S86zfPdG4mY=; b=bzxvf0XR1gyDdztXiHje79YoLVydk0Mvd5vTsQ2Z6iMe+neMg+H9qPhtE3A7CZXZZFtwCL8OK05lNZkV1WF9/jjeo9BRu/jizDYm3HrXQw0NvRPbXHih2H3a42Dl1KvPfwkya4QwfhPN+zGKiSPDtbDkXBpr5mdG72JJfQzvwW8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by DM6PR13MB4477.namprd13.prod.outlook.com (2603:10b6:5:20d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.17; Fri, 21 Oct 2022 06:28:19 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Fri, 21 Oct 2022 06:28:18 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Peng Zhang , stable@dpdk.org Subject: [PATCH v2] net/nfp: ensure the MTU can work Date: Fri, 21 Oct 2022 14:27:46 +0800 Message-Id: <1666333666-38183-1-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1665384495-24990-1-git-send-email-chaoyong.he@corigine.com> References: <1665384495-24990-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0026.apcprd01.prod.exchangelabs.com (2603:1096:4:192::16) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM6PR13MB4477:EE_ X-MS-Office365-Filtering-Correlation-Id: ce069aa4-8358-409e-1479-08dab32d7184 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8jwY0gNQKmYfxRgBtD1sfxbFwfNwMPHpRSt2qIUxGuMTRa6QhPrwoJNaaAaDtZ9bUCQMpPbdhFj0o7/6zNcIR1Vz2Ft5qsckscVnbahHnSNxQ/wD2A1qM0PiafYI2o7qUjF5R9+DepGGC3BFQotYhn6JauCznr2HpcS8L8GL3DOn4wFPl2uQKdvG9jum1zwRa9kSsq8qp1n6xZznM1yd6rJDQVMA5FCF09OLl/d2KWWLPL6faunmMtO/mhn5bPF0fNsZ5m9rLCQOW7THlj0sZhaBT522pwctdhzbiBIZNSdTXRNAOE6yzHQZuV+DhKx8/l56OWIdwvGwd/CWF47n4dJt4uSUlo6Ip0xEEuiJWR/juc/oF6A8h2KQz7DRyu/xT5IBiNlE1tBwwcM833EZNwsiovbMyIdb8/VRjDXJsxFzV/gux/XTYQvfU3uyoU9hZ9dBxBIIt1g7y2Khhps9d05xTSVVEFJRIgq2VJLrQOTu0cCqmn3BHtwKmJHztJIfKGjdkR9PNZufNl8XTM4TsU5f28Vanz+LomyhW+RKQbqfw6vsUYOIJWUmAz7H+Hs8y7Avr9hXtJV1hy/EazsbbmOMvjMj+kZ2S+l9r9qKpE0GZ3XmBJf6Oo/lMAhy3Uo1s1BqG2lAexJMfAKaNA/V5AiC3SpDnmr7HEIBMbVrOLHNOoYDzxYz3KESMr7BYngxFBZZdQuQB1zorw8cFBOvLqT9kgAwORKyWh/ZsnyeAn2YOoP6YHwOHmiPx67ny2IYFk93ez+1QtEaDz0CeP7BIiZ1vi4mBuAaRNaodVYjDOh3eF4TQ4T3gQnfhV2XE/7Z X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(366004)(136003)(346002)(396003)(39830400003)(451199015)(36756003)(86362001)(66476007)(38350700002)(41300700001)(66556008)(38100700002)(66574015)(66946007)(83380400001)(2616005)(450100002)(6506007)(186003)(5660300002)(6666004)(478600001)(2906002)(52116002)(316002)(6916009)(8936002)(8676002)(4326008)(44832011)(6486002)(26005)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?KzRHd3hrSndYVnRtM0lzTk45ZkIrWGNUbFdkSGdTOTVQWDlyYjU1OCtpQmFC?= =?utf-8?B?UTFZK0p0bVl0bkRnVDFxNHA0WS9QTjBUUGU1TWFZdTMrT25QT2VUV3IzejZ1?= =?utf-8?B?UUYvQVNJRjE1SlFtN0xHZENKRG1BZHZucDRFbXpabVpSbDlYYk1GQkZORnNK?= =?utf-8?B?TWExNnhPQ1FPQUgwN1diM3BadDlabmpZYk9GUmlmbUMySm9OL09NT1ZUOFRY?= =?utf-8?B?djdscTJreHNkck84VlUvYU1aMk5q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-8?B?R05vQ2dyeVdGbWdBRndmM2E0Z2t0MkduQkdaQ1VnU1pRQzcyMkJQQklKV2w0?= =?utf-8?B?K05IVkxrQ053TlVMcVkyZk4zeGFOMnc1ZlV4MjRtYmVZd0tYd2FNTmFLbzly?= =?utf-8?B?ZHc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce069aa4-8358-409e-1479-08dab32d7184 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 06:28:18.8396 (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: O9A08a655w4eUaswpMDrWy8O7Vzxn903vdSG6GM6GbMs0eVBX5YXIwLCHz4IXf2NBtIp9tNUMEQTKshf8WTLtRCUmtWGOCQ4HR03L4Qwo6w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB4477 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 From: Peng Zhang When MTU is bigger than hw->flbufsz, it can't work. hw->flbufsz is set in the nfp_net_rx_queue_setup(). At first, in the nfp_net_configure(), the hw->flbufsz isn't set the value, it just judge the initialized value and MTU, it is unreasonable. Now, it just check the MTU can't be more than the NFP_FRAME_SIZE_MAX in the nfp_net_configure(), when hw->flbufsz is set the value, in the nfp_net_start(), judge the hw->flbufsz and MTU. Fixes: 5c305e218f15 ("net/nfp: fix initialization") Cc: stable@dpdk.org Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Niklas Söderlund * Changes since v1 - Remove the assignment in init() and move the check to nfp_net_start(). --- drivers/net/nfp/nfp_common.c | 6 +++--- drivers/net/nfp/nfp_ethdev.c | 8 +++++++- drivers/net/nfp/nfp_ethdev_vf.c | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 0e55f0c..289c70f 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -177,9 +177,9 @@ } /* Checking MTU set */ - if (rxmode->mtu > hw->flbufsz) { - PMD_INIT_LOG(INFO, "MTU (%u) larger then current mbufsize (%u) not supported", - rxmode->mtu, hw->flbufsz); + if (rxmode->mtu > NFP_FRAME_SIZE_MAX) { + PMD_INIT_LOG(ERR, "MTU (%u) larger than NFP_FRAME_SIZE_MAX (%u) not supported", + rxmode->mtu, NFP_FRAME_SIZE_MAX); return -ERANGE; } diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 5cdd34e..3b952fa 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -110,6 +110,13 @@ update = NFP_NET_CFG_UPDATE_MSIX; } + /* Checking MTU set */ + if (dev->data->mtu > hw->flbufsz) { + PMD_INIT_LOG(ERR, "MTU (%u) can't be larger than the current NFP_FRAME_SIZE (%u)", + dev->data->mtu, hw->flbufsz); + return -ERANGE; + } + rte_intr_enable(intr_handle); new_ctrl = nfp_check_offloads(dev); @@ -517,7 +524,6 @@ hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->mtu = RTE_ETHER_MTU; - hw->flbufsz = RTE_ETHER_MTU; /* VLAN insertion is incompatible with LSOv2 */ if (hw->cap & NFP_NET_CFG_CTRL_LSO2) diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index d304d78..3f4ad3e 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -396,7 +396,6 @@ hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->mtu = RTE_ETHER_MTU; - hw->flbufsz = RTE_ETHER_MTU; /* VLAN insertion is incompatible with LSOv2 */ if (hw->cap & NFP_NET_CFG_CTRL_LSO2) -- 1.8.3.1