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 EC11EA0C47; Sun, 18 Jul 2021 09:52:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73C1C4116C; Sun, 18 Jul 2021 09:52:13 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 59E9E40683 for ; Sun, 18 Jul 2021 09:52:12 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10048"; a="210656379" X-IronPort-AV: E=Sophos;i="5.84,249,1620716400"; d="scan'208";a="210656379" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2021 00:52:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,249,1620716400"; d="scan'208";a="508823895" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga002.fm.intel.com with ESMTP; 18 Jul 2021 00:52:10 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Sun, 18 Jul 2021 00:52:10 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Sun, 18 Jul 2021 00:52:09 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Sun, 18 Jul 2021 00:52:09 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.102) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Sun, 18 Jul 2021 00:52:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V4VHF3AY50/HNMkXnkrZt1xY7b35T+8cm6TCbDSYYcZRtlPyF6/fUaRUfvmGeZbMcbRvijWay6yPtLQdDyMCeyI3RaZfWozSJmLD/sGzw8sJdtWcRgOAPH+vkCvqjjMVTWo3tVD8kNmaiVCOSCPTtAK4kRvNTHLZkDtQvzio2fwFetxe2nTa3BQvJCQAHJIuH9MwVYxnvSC1vpMjmJDYv38GBKw2yV9qscoc4N4shjqOjK9R6N/GhEoZGjpIptRzpFQyqn0vRE5g2mdjXNCG43hc1Tzfxs2qyXb+I4+00cUwvP6QricADq2z8VCyn6EemFgfhR4NRXjFGueEvi+t9g== 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-SenderADCheck; bh=AyNpX/6uhaK+HNGIWSO6H2WCywU60Oofh2tDgKkPS8s=; b=WH+9y7B7BngRrMDlhNypAW1YwC1HvzzjgpbXjhmFWwtN1FbrbGKcS5ylf1CAn4oKjnaCfjmLCEWgWF8NOxPbH7mt3Mm6dsKmpxXdVBV2zC42iMLHlg4mvWpCtD+1YKABWrMRyGdM1RmuyzP8OaR+aSBGLzp5LIu3iKuQsY/3TNl+/E20cG2VC4IwSjgbkuBVYzSRBwXNNRsKHcv9mQU4Daz1BsHQXzL+hljOPB/T3d4AGxYtBjt4NhMf/DTpyAr0zCZ6QezgPWXzUOf8+NqdgAOQ9W7ly3FIhXoqEr+dW7juRaxBWlS/0qEcDVNfR+Dc4syUGF5kv37h7mONeaIT7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AyNpX/6uhaK+HNGIWSO6H2WCywU60Oofh2tDgKkPS8s=; b=mGPLvi9vzin/p40BPCfn9dBPXDb0+34D6dxq+xLDDK5N8MwLA7PL6itZ5XNW/jFAHnoZQpOyLtvGyt7pYNOVBheFAAd1yAyrrxfOLjL3QCAAUBrt0nA2facFbCEwPi9zijlX2JVbP+P4cPpswpd8ighS23Hw48uyAE9FKUYBiAc= Received: from BYAPR11MB2901.namprd11.prod.outlook.com (2603:10b6:a03:91::23) by BY5PR11MB4273.namprd11.prod.outlook.com (2603:10b6:a03:1c9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Sun, 18 Jul 2021 07:52:03 +0000 Received: from BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::ed38:9f6c:5670:83fe]) by BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::ed38:9f6c:5670:83fe%7]) with mapi id 15.20.4331.031; Sun, 18 Jul 2021 07:52:02 +0000 From: "Xu, Rosen" To: "Yigit, Ferruh" , Somalapuram Amaranath , Ajit Khaparde , Somnath Kotur , Rahul Lakkireddy , Hemant Agrawal , Sachin Saxena , "Wang, Haiyue" , Gagandeep Singh , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , "Xing, Beilei" , "Wu, Jingjing" , "Yang, Qiming" , "Zhang, Qi Z" , Shijith Thotton , Srisivasubramanian Srinivasan , Heinrich Kuhn , "Harman Kalra" , Jerin Jacob , "Nithin Dabilpuram" , Kiran Kumar K , Rasesh Mody , "Devendra Singh Rawat" , Igor Russkikh , Maciej Czekaj , Jiawen Wu , Jian Wang , Thomas Monjalon , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [PATCH 3/4] ethdev: move check to library for MTU set Thread-Index: AQHXdOgmMi8k2ybwUU+RfUCUv9ST1atIaRpA Date: Sun, 18 Jul 2021 07:52:02 +0000 Message-ID: References: <20210709172923.3369846-1-ferruh.yigit@intel.com> <20210709172923.3369846-3-ferruh.yigit@intel.com> In-Reply-To: <20210709172923.3369846-3-ferruh.yigit@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.5.1.3 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzM2NjQxNDAtMmMwMi00NjE3LTk1MWQtZWEyMmVjZWQyMmQwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicXhxd2xidTNzd0N4NDJOTmJIQnIyY3ZKMnJQOG54UFhBdk1pSndFKzN4bno1b0JGbXcyTEVCbDZQTDliSXZ6ZyJ9 x-ctpclassification: CTP_NT authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 996c0789-d08f-4f33-6cd8-08d949c0ee41 x-ms-traffictypediagnostic: BY5PR11MB4273: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TYVrf5jMs52qM/K+sZnJKAH8HpvWMYqUxnP+cpLUaN9Puh5AzJ8hZe4/T5g0gbhDUNKHtvlpiJ00GyltoYu3G2SIdltkiT04FgEWP5Y5E5voE+yzcNISPYE4PQoIKFFZ8mX/04uAuV49l0rfQ5xMhbXfRa76DkekTl+rZRZh1z9hqr3D37Vts/mMHSjdpCA1BSd4g/WwhWLYvA7DbjTETCag03mot7MwkUH0clpJCebIkXYnM/XIA5kj85slNx8gZlmXU/2gKP2xu4FTtHcm4jnPntM1Ev3tWmy/koV08fz47ytH2eYfDsVUvb9kRDbeFFjgEevfgSaP7AUGmU5RQIMijQD3GHsfe9ZcMedq3AMINEQls+RPkr/Ehwq/nDGOTaNf5O3jmzhvPqRlMmn3TntnONqF7WPUSqtlNACMxPKmc/fd8G4GcCAZDVz4O1qKlkKRLT/BPUavh2pxMJWtYBPrzxop0/AU6TMlDx43s+uSfh8ia+sYMv5e8YyxQ53MyOYMkMTSO31Ncv/KF9WKg7NY8iYxMf6sUssb7tbjncHQMRudgK0d+jYllSOnkZOVmd0idtz3H3q5IYQOmZejoY8ouT+R8U+4EemiSJsKERGd5E+JlzullD77J5d3+E/kpBkaTyOE1OaCfFeRPHEx3L360m4l/66j7z6sPeTwVLxMpNyQ4QSaTMbtFLn8GaaZeI5UIgV8RuRLMFKXZSVa8Vk3hI8VPAQ+VEAAaXmZ9iM= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB2901.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(366004)(376002)(396003)(346002)(8676002)(2906002)(6506007)(38100700002)(5660300002)(9686003)(122000001)(55016002)(76116006)(64756008)(83380400001)(86362001)(66946007)(30864003)(7416002)(186003)(4326008)(66476007)(52536014)(26005)(7696005)(66446008)(53546011)(8936002)(71200400001)(478600001)(316002)(33656002)(66556008)(110136005)(921005)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?P2/YCMNZwoR5QbC3LKkRfPREZFHx+v1rA0ZdeUjkLnXxL6ID92M7q27m2IZh?= =?us-ascii?Q?Lz/PBGkfMcWFdOFD9yDUxwkJNNDQK40/dcnqZrUV4TN2gTHwYJo1RQehSkQR?= =?us-ascii?Q?tB30D3ReYiQVFC8nAVI+W/OhYtTmhAD4VP1cAkiXZqOVOA1Hwuh6MbZaattO?= =?us-ascii?Q?1rG7KAcGX+5zaVKCzpqaxV9cNlD7s785WkMRBOLQHRFrvxx0UeLh/LvYdnLv?= =?us-ascii?Q?+FMTE/+YkI4d0k574tEqTNNM3/9GVWAoB1AOLWnBH6nw8jDCTTWi9787GKcL?= =?us-ascii?Q?z9EODV6tHWumVoz7nd5sTp2sZx4uX+esUA+sh3KeS6Wm4uiMKv/9QwE27UFf?= =?us-ascii?Q?5524xXti75ulKlrokO/g04p1V1GOFnm9JMjP9eYj/ZmLX3srrmY7CPiwQStL?= =?us-ascii?Q?TRBryqj4fw94wiEo3IkHj3oIM0cedcRSbf1vinjz0k7MJNcuOLVTgICdXC6Z?= =?us-ascii?Q?QwRY04aeE3iQ99byrBxj1A1d8tZPaf3zizohlxOyXwut6Rwl+hfOlupGl2be?= =?us-ascii?Q?S/HexddrfoQZ6f4j00PcV6CTRvTag1CYDELp/AlvReLM6UjGTqEbEwh/18Rl?= =?us-ascii?Q?5CQYhnVq9YefG8ZjMLL6mMomcI0e2+rAYdZiAvl4QMCwI7wwCbplQcBU4FUp?= =?us-ascii?Q?zvhYyTY/gpRN9uQn575+c0mjBVlAlKMLoF5jK3nkj4kxF6npMkkcba5PKZbD?= =?us-ascii?Q?riAy5c2q0pYGCwRJpkL1+d8MKlcHRqjAiqBO7X3ZESprXUdloU+8tHS4N8fc?= =?us-ascii?Q?Txr+HkjSt6nv8dmapQD9YcCVzpMpsC5Ml6owxSQAZidwerXTZxW1yQW8pPFr?= =?us-ascii?Q?JmVCq/uKP7QXM+lV5g+T75P4nTZJUAxwClMkY9xwn9oVycfu3BG/DKOX0AY8?= =?us-ascii?Q?0xau9TcrSvziE+AfEMrFuvoR2N9f7BY7bZI9Eul0MDNKqeAtygqtuQgNlhRu?= =?us-ascii?Q?cj5JoHwnwhJJcJSAL/hJLtHJk+C7LJlicLV6JxVEVEahaYeYE1p4E6xyr4vX?= =?us-ascii?Q?tSsbqrPNU9Gs6AJjzM0ncBEdumZGki24gRynwxHiHktBB5dUkiUEvLDnDjMa?= =?us-ascii?Q?n97CFwEqUlgbeumWtfvBb1ZBB1QEkX4Zbi4gqzxo6UkOdKBVVhn2vHKVfDbb?= =?us-ascii?Q?qSLO1WmzhNRAjiKdFrT25rqchmUmfmKt+5lcaxoSypYdgJO5ID0/22Sts2Kz?= =?us-ascii?Q?Zs4zBkuhjJKMrhhMEk6ysHav+DxlvDfPtfEEXyyg1Pk07lu2Fn0A7FO7MpVH?= =?us-ascii?Q?23B47ilRC/gcGT9gwMG8EEQ7XvfoXw67tlnwfzwOQSPEYxwv40mPfq+A3coM?= =?us-ascii?Q?/dEpExjl5LdJu35GbSoYzxCi?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB2901.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 996c0789-d08f-4f33-6cd8-08d949c0ee41 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jul 2021 07:52:02.7790 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Oem04srgLnShPbE4yr4AYH4kWfmnMO14RaqaVy58CODtVt2TRXUwksxnEwWEeycLVfiepA8lzfEzElBGWWFXxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4273 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 3/4] ethdev: move check to library for MTU set 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 Sender: "dev" Hi, > -----Original Message----- > From: Yigit, Ferruh > Sent: Saturday, July 10, 2021 1:29 > To: Somalapuram Amaranath ; Ajit Khaparde > ; Somnath Kotur > ; Rahul Lakkireddy > ; Hemant Agrawal > ; Sachin Saxena ; > Wang, Haiyue ; Gagandeep Singh > ; Ziyang Xuan ; Xiaoyun > Wang ; Guoyang Zhou > ; Xing, Beilei ; Wu, > Jingjing ; Yang, Qiming ; > Zhang, Qi Z ; Xu, Rosen ; > Shijith Thotton ; Srisivasubramanian Srinivasan > ; Heinrich Kuhn > ; Harman Kalra ; > Jerin Jacob ; Nithin Dabilpuram > ; Kiran Kumar K ; > Rasesh Mody ; Devendra Singh Rawat > ; Igor Russkikh ; > Maciej Czekaj ; Jiawen Wu > ; Jian Wang ; > Thomas Monjalon ; Andrew Rybchenko > > Cc: Yigit, Ferruh ; dev@dpdk.org > Subject: [PATCH 3/4] ethdev: move check to library for MTU set >=20 > Move requested MTU value check to the API to prevent the duplicated code. >=20 > Signed-off-by: Ferruh Yigit > --- > drivers/net/axgbe/axgbe_ethdev.c | 15 ++++----------- > drivers/net/bnxt/bnxt_ethdev.c | 2 +- > drivers/net/cxgbe/cxgbe_ethdev.c | 13 +------------ > drivers/net/dpaa/dpaa_ethdev.c | 2 -- > drivers/net/dpaa2/dpaa2_ethdev.c | 4 ---- > drivers/net/e1000/em_ethdev.c | 10 ---------- > drivers/net/e1000/igb_ethdev.c | 11 ----------- > drivers/net/enetc/enetc_ethdev.c | 4 ---- > drivers/net/hinic/hinic_pmd_ethdev.c | 8 +------- > drivers/net/i40e/i40e_ethdev.c | 17 ++++------------- > drivers/net/i40e/i40e_ethdev_vf.c | 17 ++++------------- > drivers/net/iavf/iavf_ethdev.c | 10 ++-------- > drivers/net/ice/ice_ethdev.c | 14 +++----------- > drivers/net/igc/igc_ethdev.c | 5 ----- > drivers/net/ipn3ke/ipn3ke_representor.c | 6 ------ > drivers/net/liquidio/lio_ethdev.c | 10 ---------- > drivers/net/nfp/nfp_net.c | 4 ---- > drivers/net/octeontx/octeontx_ethdev.c | 4 ---- > drivers/net/octeontx2/otx2_ethdev_ops.c | 5 ----- > drivers/net/qede/qede_ethdev.c | 12 ------------ > drivers/net/thunderx/nicvf_ethdev.c | 6 ------ > drivers/net/txgbe/txgbe_ethdev.c | 10 ---------- > lib/ethdev/rte_ethdev.c | 9 +++++++++ > 23 files changed, 29 insertions(+), 169 deletions(-) >=20 > diff --git a/drivers/net/axgbe/axgbe_ethdev.c > b/drivers/net/axgbe/axgbe_ethdev.c > index 2960834b4539..c36cd7b1d2f0 100644 > --- a/drivers/net/axgbe/axgbe_ethdev.c > +++ b/drivers/net/axgbe/axgbe_ethdev.c > @@ -1478,25 +1478,18 @@ axgbe_dev_supported_ptypes_get(struct > rte_eth_dev *dev) >=20 > static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { > - struct rte_eth_dev_info dev_info; > struct axgbe_port *pdata =3D dev->data->dev_private; > - uint32_t frame_size =3D mtu + RTE_ETHER_HDR_LEN + > RTE_ETHER_CRC_LEN; > - unsigned int val =3D 0; > - axgbe_dev_info_get(dev, &dev_info); > - /* check that mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || frame_size > > dev_info.max_rx_pktlen) > - return -EINVAL; > + unsigned int val; > + > /* mtu setting is forbidden if port is start */ > if (dev->data->dev_started) { > PMD_DRV_LOG(ERR, "port %d must be stopped before > configuration", > dev->data->port_id); > return -EBUSY; > } > - if (mtu > RTE_ETHER_MTU) > - val =3D 1; > - else > - val =3D 0; > + val =3D mtu > RTE_ETHER_MTU ? 1 : 0; > AXGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val); > + > return 0; > } >=20 > diff --git a/drivers/net/bnxt/bnxt_ethdev.c > b/drivers/net/bnxt/bnxt_ethdev.c index 4344a012f06e..1e7da8ba61a6 > 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -2991,7 +2991,7 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, > uint16_t new_mtu) > uint32_t overhead =3D BNXT_MAX_PKT_LEN - BNXT_MAX_MTU; > struct bnxt *bp =3D eth_dev->data->dev_private; > uint32_t new_pkt_size; > - uint32_t rc =3D 0; > + uint32_t rc; > uint32_t i; >=20 > rc =3D is_bnxt_in_error(bp); > diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c > b/drivers/net/cxgbe/cxgbe_ethdev.c > index 0c9cc2f5bb3f..70b879fed100 100644 > --- a/drivers/net/cxgbe/cxgbe_ethdev.c > +++ b/drivers/net/cxgbe/cxgbe_ethdev.c > @@ -301,21 +301,10 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev > *eth_dev, uint16_t mtu) { > struct port_info *pi =3D eth_dev->data->dev_private; > struct adapter *adapter =3D pi->adapter; > - struct rte_eth_dev_info dev_info; > - int err; > uint16_t new_mtu =3D mtu + RTE_ETHER_HDR_LEN + > RTE_ETHER_CRC_LEN; >=20 > - err =3D cxgbe_dev_info_get(eth_dev, &dev_info); > - if (err !=3D 0) > - return err; > - > - /* Must accommodate at least RTE_ETHER_MIN_MTU */ > - if (mtu < RTE_ETHER_MIN_MTU || new_mtu > > dev_info.max_rx_pktlen) > - return -EINVAL; > - > - err =3D t4_set_rxmode(adapter, adapter->mbox, pi->viid, new_mtu, -1, > -1, > + return t4_set_rxmode(adapter, adapter->mbox, pi->viid, new_mtu, > -1, > +-1, > -1, -1, true); > - return err; > } >=20 > /* > diff --git a/drivers/net/dpaa/dpaa_ethdev.c > b/drivers/net/dpaa/dpaa_ethdev.c index a444f749bb96..60dd4f67fc26 > 100644 > --- a/drivers/net/dpaa/dpaa_ethdev.c > +++ b/drivers/net/dpaa/dpaa_ethdev.c > @@ -167,8 +167,6 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t > mtu) >=20 > PMD_INIT_FUNC_TRACE(); >=20 > - if (mtu < RTE_ETHER_MIN_MTU || frame_size > > DPAA_MAX_RX_PKT_LEN) > - return -EINVAL; > /* > * Refuse mtu that requires the support of scattered packets > * when this feature has not been enabled before. > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c > b/drivers/net/dpaa2/dpaa2_ethdev.c > index be2858b3adac..6b44b0557e6a 100644 > --- a/drivers/net/dpaa2/dpaa2_ethdev.c > +++ b/drivers/net/dpaa2/dpaa2_ethdev.c > @@ -1466,10 +1466,6 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, > uint16_t mtu) > return -EINVAL; > } >=20 > - /* check that mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || frame_size > > DPAA2_MAX_RX_PKT_LEN) > - return -EINVAL; > - > /* Set the Max Rx frame length as 'mtu' + > * Maximum Ethernet header length > */ > diff --git a/drivers/net/e1000/em_ethdev.c > b/drivers/net/e1000/em_ethdev.c index 1b41dd04df5a..6ebef55588bc > 100644 > --- a/drivers/net/e1000/em_ethdev.c > +++ b/drivers/net/e1000/em_ethdev.c > @@ -1788,22 +1788,12 @@ eth_em_default_mac_addr_set(struct > rte_eth_dev *dev, static int eth_em_mtu_set(struct rte_eth_dev *dev, > uint16_t mtu) { > - struct rte_eth_dev_info dev_info; > struct e1000_hw *hw; > uint32_t frame_size; > uint32_t rctl; > - int ret; > - > - ret =3D eth_em_infos_get(dev, &dev_info); > - if (ret !=3D 0) > - return ret; >=20 > frame_size =3D mtu + E1000_ETH_OVERHEAD; >=20 > - /* check that mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || frame_size > > dev_info.max_rx_pktlen) > - return -EINVAL; > - > /* > * If device is started, refuse mtu that requires the support of > * scattered packets when this feature has not been enabled before. > diff --git a/drivers/net/e1000/igb_ethdev.c > b/drivers/net/e1000/igb_ethdev.c index f15774eae20d..fb69210ba9f4 > 100644 > --- a/drivers/net/e1000/igb_ethdev.c > +++ b/drivers/net/e1000/igb_ethdev.c > @@ -4368,9 +4368,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, > uint16_t mtu) { > uint32_t rctl; > struct e1000_hw *hw; > - struct rte_eth_dev_info dev_info; > uint32_t frame_size =3D mtu + E1000_ETH_OVERHEAD; > - int ret; >=20 > hw =3D E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); >=20 > @@ -4379,15 +4377,6 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, > uint16_t mtu) > if (hw->mac.type =3D=3D e1000_82571) > return -ENOTSUP; > #endif > - ret =3D eth_igb_infos_get(dev, &dev_info); > - if (ret !=3D 0) > - return ret; > - > - /* check that mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || > - frame_size > dev_info.max_rx_pktlen) > - return -EINVAL; > - > /* > * If device is started, refuse mtu that requires the support of > * scattered packets when this feature has not been enabled before. > diff --git a/drivers/net/enetc/enetc_ethdev.c > b/drivers/net/enetc/enetc_ethdev.c > index fbcbbb6c0533..a7372c1787c7 100644 > --- a/drivers/net/enetc/enetc_ethdev.c > +++ b/drivers/net/enetc/enetc_ethdev.c > @@ -662,10 +662,6 @@ enetc_mtu_set(struct rte_eth_dev *dev, uint16_t > mtu) > struct enetc_hw *enetc_hw =3D &hw->hw; > uint32_t frame_size =3D mtu + RTE_ETHER_HDR_LEN + > RTE_ETHER_CRC_LEN; >=20 > - /* check that mtu is within the allowed range */ > - if (mtu < ENETC_MAC_MINFRM_SIZE || frame_size > > ENETC_MAC_MAXFRM_SIZE) > - return -EINVAL; > - > /* > * Refuse mtu that requires the support of scattered packets > * when this feature has not been enabled before. > diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c > b/drivers/net/hinic/hinic_pmd_ethdev.c > index c1cde811a252..ce0b52c718ab 100644 > --- a/drivers/net/hinic/hinic_pmd_ethdev.c > +++ b/drivers/net/hinic/hinic_pmd_ethdev.c > @@ -1539,17 +1539,11 @@ static void hinic_deinit_mac_addr(struct > rte_eth_dev *eth_dev) static int hinic_dev_set_mtu(struct rte_eth_dev > *dev, uint16_t mtu) { > struct hinic_nic_dev *nic_dev =3D > HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); > - int ret =3D 0; > + int ret; >=20 > PMD_DRV_LOG(INFO, "Set port mtu, port_id: %d, mtu: %d, > max_pkt_len: %d", > dev->data->port_id, mtu, > HINIC_MTU_TO_PKTLEN(mtu)); >=20 > - if (mtu < HINIC_MIN_MTU_SIZE || mtu > HINIC_MAX_MTU_SIZE) { > - PMD_DRV_LOG(ERR, "Invalid mtu: %d, must between %d > and %d", > - mtu, HINIC_MIN_MTU_SIZE, > HINIC_MAX_MTU_SIZE); > - return -EINVAL; > - } > - > ret =3D hinic_set_port_mtu(nic_dev->hwdev, mtu); > if (ret) { > PMD_DRV_LOG(ERR, "Set port mtu failed, ret: %d", ret); diff > --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index c5058f26dff2..dad151eac5f1 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -11754,25 +11754,16 @@ static int i40e_set_default_mac_addr(struct > rte_eth_dev *dev, } >=20 > static int > -i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) > +i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused) > { > - struct i40e_pf *pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data- > >dev_private); > - struct rte_eth_dev_data *dev_data =3D pf->dev_data; > - uint32_t frame_size =3D mtu + I40E_ETH_OVERHEAD; > - int ret =3D 0; > - > - /* check if mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || frame_size > > I40E_FRAME_SIZE_MAX) > - return -EINVAL; > - > /* mtu setting is forbidden if port is start */ > - if (dev_data->dev_started) { > + if (dev->data->dev_started) { > PMD_DRV_LOG(ERR, "port %d must be stopped before > configuration", > - dev_data->port_id); > + dev->data->port_id); > return -EBUSY; > } >=20 > - return ret; > + return 0; > } >=20 > /* Restore ethertype filter */ > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index 2015a86ba5ca..f7f9d44ef181 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -2866,25 +2866,16 @@ i40evf_dev_rss_hash_conf_get(struct > rte_eth_dev *dev, } >=20 > static int > -i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) > +i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused) > { > - struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > >dev_private); > - struct rte_eth_dev_data *dev_data =3D vf->dev_data; > - uint32_t frame_size =3D mtu + I40E_ETH_OVERHEAD; > - int ret =3D 0; > - > - /* check if mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || frame_size > > I40E_FRAME_SIZE_MAX) > - return -EINVAL; > - > /* mtu setting is forbidden if port is start */ > - if (dev_data->dev_started) { > + if (dev->data->dev_started) { > PMD_DRV_LOG(ERR, "port %d must be stopped before > configuration", > - dev_data->port_id); > + dev->data->port_id); > return -EBUSY; > } >=20 > - return ret; > + return 0; > } >=20 > static int > diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethde= v.c > index ba5be45e8c5e..049671ef3da9 100644 > --- a/drivers/net/iavf/iavf_ethdev.c > +++ b/drivers/net/iavf/iavf_ethdev.c > @@ -1432,21 +1432,15 @@ iavf_dev_rss_hash_conf_get(struct rte_eth_dev > *dev, } >=20 > static int > -iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) > +iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused) > { > - uint32_t frame_size =3D mtu + IAVF_ETH_OVERHEAD; > - int ret =3D 0; > - > - if (mtu < RTE_ETHER_MIN_MTU || frame_size > > IAVF_FRAME_SIZE_MAX) > - return -EINVAL; > - > /* mtu setting is forbidden if port is start */ > if (dev->data->dev_started) { > PMD_DRV_LOG(ERR, "port must be stopped before > configuration"); > return -EBUSY; > } >=20 > - return ret; > + return 0; > } >=20 > static int > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c > index 502e410b5641..c1a96d3de183 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -3788,21 +3788,13 @@ ice_dev_set_link_down(struct rte_eth_dev > *dev) } >=20 > static int > -ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) > +ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused) > { > - struct ice_pf *pf =3D ICE_DEV_PRIVATE_TO_PF(dev->data- > >dev_private); > - struct rte_eth_dev_data *dev_data =3D pf->dev_data; > - uint32_t frame_size =3D mtu + ICE_ETH_OVERHEAD; > - > - /* check if mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || frame_size > > ICE_FRAME_SIZE_MAX) > - return -EINVAL; > - > /* mtu setting is forbidden if port is start */ > - if (dev_data->dev_started) { > + if (dev->data->dev_started) { > PMD_DRV_LOG(ERR, > "port %d must be stopped before configuration", > - dev_data->port_id); > + dev->data->port_id); > return -EBUSY; > } >=20 > diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c = index > dcbc26b8186e..e279ae1fff1d 100644 > --- a/drivers/net/igc/igc_ethdev.c > +++ b/drivers/net/igc/igc_ethdev.c > @@ -1576,11 +1576,6 @@ eth_igc_mtu_set(struct rte_eth_dev *dev, > uint16_t mtu) > if (IGC_READ_REG(hw, IGC_CTRL_EXT) & IGC_CTRL_EXT_EXT_VLAN) > frame_size +=3D VLAN_TAG_SIZE; >=20 > - /* check that mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || > - frame_size > MAX_RX_JUMBO_FRAME_SIZE) > - return -EINVAL; > - > /* > * If device is started, refuse mtu that requires the support of > * scattered packets when this feature has not been enabled before. > diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c > b/drivers/net/ipn3ke/ipn3ke_representor.c > index e8a33f04bd69..377b96c0236a 100644 > --- a/drivers/net/ipn3ke/ipn3ke_representor.c > +++ b/drivers/net/ipn3ke/ipn3ke_representor.c > @@ -2778,12 +2778,6 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev > *ethdev, uint16_t mtu) > int ret =3D 0; > struct ipn3ke_rpst *rpst =3D IPN3KE_DEV_PRIVATE_TO_RPST(ethdev); > struct rte_eth_dev_data *dev_data =3D ethdev->data; > - uint32_t frame_size =3D mtu + IPN3KE_ETH_OVERHEAD; > - > - /* check if mtu is within the allowed range */ > - if (mtu < RTE_ETHER_MIN_MTU || > - frame_size > IPN3KE_MAC_FRAME_SIZE_MAX) > - return -EINVAL; >=20 > /* mtu setting is forbidden if port is start */ > /* make sure NIC port is stopped */ Reviewed-by: Rosen Xu