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 DC1CBA034F; Fri, 8 Oct 2021 17:57:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A444940143; Fri, 8 Oct 2021 17:57:25 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 8270640140 for ; Fri, 8 Oct 2021 17:57:24 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10131"; a="213676410" X-IronPort-AV: E=Sophos;i="5.85,358,1624345200"; d="scan'208";a="213676410" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2021 08:57:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,358,1624345200"; d="scan'208";a="561357331" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 08 Oct 2021 08:57:22 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 8 Oct 2021 08:57:22 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 8 Oct 2021 08:57:21 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 8 Oct 2021 08:57:21 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.107) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Fri, 8 Oct 2021 08:57:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G5IjgQEFbPTrnuonHux8ETaJPdmEMDe10cU4KQ6tsE8t0EOeV9Ptl7Konfn8Oa3d5batuFBPF87sbVCD8J8ErHI0wEPrJpk4nSg7ngzBRkH3G8IlGvpl6Q5UFIbmMuFcpSZnekqxbruhdvjhgK/L6FnylZRF9sIkk19AV2lFwUgBI/yU8pxefqx3OxsZEmKTn/XpXM3IBc7lKpz4NjhRIPAcXK/kcl+Rzt9Lwp1cETcHrSx5/p7REw0HIUwynlqWsHn/iTcoVjNcKwCjRykVerLNU0HvE2mocOKEO0Ts1F7BPTndm0aDnMiCP3+QQU4BPMSm2MGz6yRmZIfWV7Kthw== 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=aezreDOw7PoqZg9kJla0QAD28RhnGtvDnSbCkoUoQZQ=; b=KySvHN7OvzbFuEXy68bH4iTKOnm4N/4eEmlq3Mjj9nxL/79RaK28eGWRPJslwuu6FExKeEuHOWCFrqbUJTV3Mw6dtrydmkIEvuZfdNSFcvDzaWfMvqJ5z7LPztncV4X6K2bG+qJvtBQljZeFsADKuBLutBhFLY+Gj5eMtkfGbBcOpfEumC0tRJVq8gLP/e1aUZWwZJ60sTvx4WWaP6/eT9hozgYC/b8AR2TKsCjqqe6Idkv7ci9FzXdH4iXLL1qEhKTesnlw0OskpJPF1KOdUVTb2ninRCidaJ9x7+EqDHBZ3NkJ27rwTvnpp3BlWfYetwgIbh7/K422kxiQZLWMxw== 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=aezreDOw7PoqZg9kJla0QAD28RhnGtvDnSbCkoUoQZQ=; b=G09XSWqBQnS1SGRasjeb6aIjRMu9yNUFYwWLh6xFL/p+eqmqVK8h6FJ/+BouMimyWM+pVvHpTeVRVnDIjFM5KKkhbZS8dRvxDK3GtfCA1qIZsKKEB1gVhic4rZXzFWm2t14E7w/QUbjbjnnD4NpM/1Wkl119GvRiaqWUG7zfuyg= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB3132.namprd11.prod.outlook.com (2603:10b6:5:69::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.19; Fri, 8 Oct 2021 15:57:14 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd%4]) with mapi id 15.20.4587.019; Fri, 8 Oct 2021 15:57:14 +0000 From: "Ananyev, Konstantin" To: "Yigit, Ferruh" , Jerin Jacob , "Li, Xiaoyun" , Chas Williams , "Min Hu (Connor)" , Hemant Agrawal , Sachin Saxena , "Zhang, Qi Z" , "Wang, Xiao W" , "Matan Azrad" , Viacheslav Ovsiienko , Harman Kalra , Maciej Czekaj , "Ray Kinsella" , "Iremonger, Bernard" , Kiran Kumar K , Nithin Dabilpuram , "Hunt, David" , "Mcnamara, John" , "Richardson, Bruce" , Igor Russkikh , Steven Webster , "Peters, Matt" , Somalapuram Amaranath , Rasesh Mody , Shahed Shaikh , Ajit Khaparde , "Somnath Kotur" , Sunil Kumar Kori , Satha Rao , Rahul Lakkireddy , "Wang, Haiyue" , Marcin Wojtas , Michal Krawczyk , "Shai Brandes" , Evgeny Schemeilin , "Igor Chauskin" , Gagandeep Singh , "Daley, John" , Hyong Youb Kim , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , Yisen Zhuang , Lijun Ou , "Xing, Beilei" , "Wu, Jingjing" , "Yang, Qiming" , Andrew Boyer , "Xu, Rosen" , Shijith Thotton , Srisivasubramanian Srinivasan , Zyta Szpak , Liron Himi , Heinrich Kuhn , Devendra Singh Rawat , Andrew Rybchenko , "Wiles, Keith" , Jiawen Wu , Jian Wang , Maxime Coquelin , "Xia, Chenbo" , "Chautru, Nicolas" , "Van Haaren, Harry" , "Dumitrescu, Cristian" , "Nicolau, Radu" , Akhil Goyal , "Kantecki, Tomasz" , "Doherty, Declan" , Pavan Nikhilesh , "Rybalchenko, Kirill" , "Singh, Jasvinder" , Thomas Monjalon CC: "dev@dpdk.org" Thread-Topic: [PATCH v5 1/6] ethdev: fix max Rx packet length Thread-Index: AQHXu5xW7IGIqoyn8UGC/B4Nmn7a4qvJQeZQ Date: Fri, 8 Oct 2021 15:57:14 +0000 Message-ID: References: <20211001143624.3744505-1-ferruh.yigit@intel.com> <20211007165626.2941995-1-ferruh.yigit@intel.com> In-Reply-To: <20211007165626.2941995-1-ferruh.yigit@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 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: 0a4c7e36-469d-4a58-3ae9-08d98a744c20 x-ms-traffictypediagnostic: DM6PR11MB3132: 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:5516; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OAHkpk7r1LbHcv9tHYGEVz7o2DhZ8M/+xI9LbpoQR5y0OO+F/zEdwv0KrMnSR/SILIPuQtEqUteLJbpTPBijoXBKuGx1hz4IP4+66ed40XNuc7xd6M+JC94GjUXlXGAlrt+T0fyFlQPlD4vvd+b0qI/uCHZwmZJepHEoNRE/mhSOFP175B1/HXwxHpJjCTXGVyVeS7NCJP7Bi8fogrfsW2Gbr+jHninLadWeCFYSFWBvSSmrUwyNkrL0MJBEFwOf7gv7tuvYrezPYscGP5QDGOm/yklJlJC9/spfefBJvdirtg4qFETb0hzNopDsOglK1zhI9eNcl09jRhC0cWMH5A7TVeqywGSD7Y9pjE6doVVgtOuY7xg4uJurb476PeObidIZc/In8Q06KSABd8rrLEbU7gEXuExB651uCFnwvrafm7lTLHMIdIqAZjKs0u3MVWjY3ELckJK02TdDhwD81QJEi01wv3HqzVbh7D63uzbuFgvNC50Uct+0b+hz3zrty9y13AVPkXhK8Qdv44vTzj08/p4kjz8MHTSbw4/CZIzJ7jKSKGvsnCAtXMDgd3vdLf8x8TuVLz00JRRGvOBJnFo9E9IDxr8/7DvWS7O00IWzucwVCFW6SoQWACJm/XaEQRjzdrzNtzx6ikP9Vd70zSnkzr1voL2svh8hLFYZ/HoMzMD/08+E2DyG8XaLpSAKu2j9dAu4jcUXNWUIw2WRpQGy3f/Wn18EZZQKUYxAHq4= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(83380400001)(921005)(55016002)(8676002)(4326008)(71200400001)(38070700005)(110136005)(7366002)(7406005)(7416002)(2906002)(52536014)(9686003)(5660300002)(1191002)(55236004)(66446008)(186003)(64756008)(26005)(8936002)(7696005)(6506007)(508600001)(33656002)(316002)(86362001)(66946007)(66476007)(122000001)(38100700002)(66556008)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Wiv8XADqMfiWL5+ny7qZDhr4PUAT1f8hUIjNTLJ2wOaFRahK5SGgs5HEAkVx?= =?us-ascii?Q?TNozNOzUMXKxikSTK5hxQZOjEc4tdIW0a74cX+n3+XBNG3CjNIDj66epoGOL?= =?us-ascii?Q?QqyYS7CW6dRaYDgKb1QLxksf7syL/fEQ98ppsSUU++CG4BSgulvyiX8XnkZG?= =?us-ascii?Q?0E9MjgFAllyh4rv1HizaM4bc7hqcb5a898zIWzs1HvlW3UOGk56fhYmq1XnD?= =?us-ascii?Q?zSAmS79VOaCaNTl98L2kDZBjHPhVG0G50Ns/DV3KfWwsYLe/Z00xEUHQ5TH/?= =?us-ascii?Q?Pq247psPkSO3KE4yxCM/76BW3h9EkUAGC/j6WkEhMzqX6qzQ7DRHMram7eTB?= =?us-ascii?Q?ErjBuBXuzR/mX5r57y7ODs2sKVSTFxWaDIpM2h3w8fMIasRhkgu2ReoELlus?= =?us-ascii?Q?m1kIk8g67yEnlZZr2WkzayYd6eR2FzCMIHaVb55/MhiTQ9csfOvlZAb7Y4jl?= =?us-ascii?Q?b8hoJEUAyiOwAaBaWNH6CK3DA1+eJT2tWbP3iJ6uHeGFWA3X80zbzWZ3AH/j?= =?us-ascii?Q?sJCxe+3cQbHMqrV4//+OKgzoifIJQd9Y5BGFHy1Xc8BVQqyBrhpfZLkrY2tz?= =?us-ascii?Q?zmPOvRoCsH0fbUfy4RTSz0+60XAV+Sc0yBemJ8x48fnpYYx5SDgjAMCVB2O2?= =?us-ascii?Q?VHrDcPmlgScC31/ulACPEBClS5fUUPDb8lUlj5YvvTDI2HkxRFyR2viOm+tN?= =?us-ascii?Q?QHHfy44TBpfjCrE2cv8UXm9rLSMStM1vTnaImqJlBIJI04CeJ2Aj1lnUEdT/?= =?us-ascii?Q?XzoUg8qp1s6rC93dXkFV0j8L3ZFnJhk/pATaOtASSHqcTjvq62xch4o+AO/v?= =?us-ascii?Q?h+HXHJFfICwwmTPIFglvA4Kh7kSwIGpDm0CMIYJ5nTBdRBsDIsZloKXIr1Rg?= =?us-ascii?Q?OEK4RQQ5XBFgw0leYuVyCKwE4WpkwE7LLwAHbwFGHF2rFYXoal4m5gcfPupH?= =?us-ascii?Q?9WNvmrUJ5C8/J4m/d0bH0HZQ6j8VDQ09PjxtboARD39CxmJlM52/Dz8zwB5D?= =?us-ascii?Q?1urpDXJyYapuCrn0DTQ5ATc8vCgLWDeXk4EAo8Mb6FtvGddDZUBn9Wbr+gv8?= =?us-ascii?Q?jwBRmB1EufX/+jHS5eyu2htPi0FJ3TAbpYZo00kz9JlPDY7V/rm8rqQ7ZOsC?= =?us-ascii?Q?GJIVyWz8zxBFWQURgrQMrcdG35LtzF8Pnrnbma8wX9nyGfBf8MSG+0t5JIs6?= =?us-ascii?Q?76fLO/lndyfA9+/s0Qle2gvMs0GIZNTBIRObLNhdUqk1AWHPtPVYITpOOq0t?= =?us-ascii?Q?5z1QO7+0T6GhmnqASS//hcd39G4PfK4rE4fUfXfo26/EuUMqfSSsIst54oxW?= =?us-ascii?Q?OaUZDEWUcEl5Xm/ORhWC6QGQ?= 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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a4c7e36-469d-4a58-3ae9-08d98a744c20 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2021 15:57:14.3848 (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: lhB6skXy4iEx2bbufBOtI9C7Dr8L/tvCaHDnq9wjdXKn/E6uMs6ImQM1mkOKFkNAw12jKac0iu0Pum6bkiEk1OuU1UkW6wGdihHVnC4/ork= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3132 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v5 1/6] ethdev: fix max Rx packet length 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" > There is a confusion on setting max Rx packet length, this patch aims to > clarify it. >=20 > 'rte_eth_dev_configure()' API accepts max Rx packet size via > 'uint32_t max_rx_pkt_len' field of the config struct 'struct > rte_eth_conf'. >=20 > Also 'rte_eth_dev_set_mtu()' API can be used to set the MTU, and result > stored into '(struct rte_eth_dev)->data->mtu'. >=20 > These two APIs are related but they work in a disconnected way, they > store the set values in different variables which makes hard to figure > out which one to use, also having two different method for a related > functionality is confusing for the users. >=20 > Other issues causing confusion is: > * maximum transmission unit (MTU) is payload of the Ethernet frame. And > 'max_rx_pkt_len' is the size of the Ethernet frame. Difference is > Ethernet frame overhead, and this overhead may be different from > device to device based on what device supports, like VLAN and QinQ. > * 'max_rx_pkt_len' is only valid when application requested jumbo frame, > which adds additional confusion and some APIs and PMDs already > discards this documented behavior. > * For the jumbo frame enabled case, 'max_rx_pkt_len' is an mandatory > field, this adds configuration complexity for application. >=20 > As solution, both APIs gets MTU as parameter, and both saves the result > in same variable '(struct rte_eth_dev)->data->mtu'. For this > 'max_rx_pkt_len' updated as 'mtu', and it is always valid independent > from jumbo frame. >=20 > For 'rte_eth_dev_configure()', 'dev->data->dev_conf.rxmode.mtu' is user > request and it should be used only within configure function and result > should be stored to '(struct rte_eth_dev)->data->mtu'. After that point > both application and PMD uses MTU from this variable. >=20 > When application doesn't provide an MTU during 'rte_eth_dev_configure()' > default 'RTE_ETHER_MTU' value is used. >=20 > Additional clarification done on scattered Rx configuration, in > relation to MTU and Rx buffer size. > MTU is used to configure the device for physical Rx/Tx size limitation, > Rx buffer is where to store Rx packets, many PMDs use mbuf data buffer > size as Rx buffer size. > PMDs compare MTU against Rx buffer size to decide enabling scattered Rx > or not. If scattered Rx is not supported by device, MTU bigger than Rx > buffer size should fail. LGTM in general, one question below. ... > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index daf5ca924221..4d0584af52e3 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -1324,6 +1324,19 @@ eth_dev_validate_offloads(uint16_t port_id, uint64= _t req_offloads, > return ret; > } >=20 > +static uint16_t > +eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu) > +{ > + uint16_t overhead_len; > + > + if (max_mtu !=3D UINT16_MAX && max_rx_pktlen > max_mtu) > + overhead_len =3D max_rx_pktlen - max_mtu; In theory it could be overflow here, though I do realize that in practise i= t is unlikely situation. Anyway why uint16_t, why not uint32_t for all variables here? Just no to worry about such things. > + else > + overhead_len =3D RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; > + > + return overhead_len; > +} > + > int > rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx= _q, > const struct rte_eth_conf *dev_conf) > @@ -1331,6 +1344,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb= _rx_q, uint16_t nb_tx_q, > struct rte_eth_dev *dev; > struct rte_eth_dev_info dev_info; > struct rte_eth_conf orig_conf; > + uint32_t max_rx_pktlen; > uint16_t overhead_len; > int diag; > int ret; > @@ -1381,11 +1395,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t n= b_rx_q, uint16_t nb_tx_q, > goto rollback; >=20 > /* Get the real Ethernet overhead length */ > - if (dev_info.max_mtu !=3D UINT16_MAX && > - dev_info.max_rx_pktlen > dev_info.max_mtu) > - overhead_len =3D dev_info.max_rx_pktlen - dev_info.max_mtu; > - else > - overhead_len =3D RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; > + overhead_len =3D eth_dev_get_overhead_len(dev_info.max_rx_pktlen, > + dev_info.max_mtu); >=20 > /* If number of queues specified by application for both Rx and Tx is > * zero, use driver preferred values. This cannot be done individually > @@ -1454,49 +1465,45 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t = nb_rx_q, uint16_t nb_tx_q, > } >=20 > /* > - * If jumbo frames are enabled, check that the maximum RX packet > - * length is supported by the configured device. > + * Check that the maximum RX packet length is supported by the > + * configured device. > */ > - if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { > - if (dev_conf->rxmode.max_rx_pkt_len > dev_info.max_rx_pktlen) { > - RTE_ETHDEV_LOG(ERR, > - "Ethdev port_id=3D%u max_rx_pkt_len %u > max valid value %u\n", > - port_id, dev_conf->rxmode.max_rx_pkt_len, > - dev_info.max_rx_pktlen); > - ret =3D -EINVAL; > - goto rollback; > - } else if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN) { > - RTE_ETHDEV_LOG(ERR, > - "Ethdev port_id=3D%u max_rx_pkt_len %u < min valid value %u\n", > - port_id, dev_conf->rxmode.max_rx_pkt_len, > - (unsigned int)RTE_ETHER_MIN_LEN); > - ret =3D -EINVAL; > - goto rollback; > - } > + if (dev_conf->rxmode.mtu =3D=3D 0) > + dev->data->dev_conf.rxmode.mtu =3D RTE_ETHER_MTU; > + max_rx_pktlen =3D dev->data->dev_conf.rxmode.mtu + overhead_len; > + if (max_rx_pktlen > dev_info.max_rx_pktlen) { > + RTE_ETHDEV_LOG(ERR, > + "Ethdev port_id=3D%u max_rx_pktlen %u > max valid value %u\n", > + port_id, max_rx_pktlen, dev_info.max_rx_pktlen); > + ret =3D -EINVAL; > + goto rollback; > + } else if (max_rx_pktlen < RTE_ETHER_MIN_LEN) { > + RTE_ETHDEV_LOG(ERR, > + "Ethdev port_id=3D%u max_rx_pktlen %u < min valid value %u\n", > + port_id, max_rx_pktlen, RTE_ETHER_MIN_LEN); > + ret =3D -EINVAL; > + goto rollback; > + } >=20 > - /* Scale the MTU size to adapt max_rx_pkt_len */ > - dev->data->mtu =3D dev->data->dev_conf.rxmode.max_rx_pkt_len - > - overhead_len; > - } else { > - uint16_t pktlen =3D dev_conf->rxmode.max_rx_pkt_len; > - if (pktlen < RTE_ETHER_MIN_MTU + overhead_len || > - pktlen > RTE_ETHER_MTU + overhead_len) > + if ((dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) =3D=3D 0) = { > + if (dev->data->dev_conf.rxmode.mtu < RTE_ETHER_MIN_MTU || > + dev->data->dev_conf.rxmode.mtu > RTE_ETHER_MTU) > /* Use default value */ > - dev->data->dev_conf.rxmode.max_rx_pkt_len =3D > - RTE_ETHER_MTU + overhead_len; > + dev->data->dev_conf.rxmode.mtu =3D RTE_ETHER_MTU; > } >=20 > + dev->data->mtu =3D dev->data->dev_conf.rxmode.mtu; > + > /* > * If LRO is enabled, check that the maximum aggregated packet > * size is supported by the configured device. > */ > if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO) { > if (dev_conf->rxmode.max_lro_pkt_size =3D=3D 0) > - dev->data->dev_conf.rxmode.max_lro_pkt_size =3D > - dev->data->dev_conf.rxmode.max_rx_pkt_len; > + dev->data->dev_conf.rxmode.max_lro_pkt_size =3D max_rx_pktlen; > ret =3D eth_dev_check_lro_pkt_size(port_id, > dev->data->dev_conf.rxmode.max_lro_pkt_size, > - dev->data->dev_conf.rxmode.max_rx_pkt_len, > + max_rx_pktlen, > dev_info.max_lro_pkt_size); > if (ret !=3D 0) > goto rollback; > @@ -2156,13 +2163,20 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t= rx_queue_id, > * If LRO is enabled, check that the maximum aggregated packet > * size is supported by the configured device. > */ > + /* Get the real Ethernet overhead length */ > if (local_conf.offloads & DEV_RX_OFFLOAD_TCP_LRO) { > + uint16_t overhead_len; > + uint32_t max_rx_pktlen; > + int ret; > + > + overhead_len =3D eth_dev_get_overhead_len(dev_info.max_rx_pktlen, > + dev_info.max_mtu); > + max_rx_pktlen =3D dev->data->mtu + overhead_len; > if (dev->data->dev_conf.rxmode.max_lro_pkt_size =3D=3D 0) > - dev->data->dev_conf.rxmode.max_lro_pkt_size =3D > - dev->data->dev_conf.rxmode.max_rx_pkt_len; > - int ret =3D eth_dev_check_lro_pkt_size(port_id, > + dev->data->dev_conf.rxmode.max_lro_pkt_size =3D max_rx_pktlen; > + ret =3D eth_dev_check_lro_pkt_size(port_id, > dev->data->dev_conf.rxmode.max_lro_pkt_size, > - dev->data->dev_conf.rxmode.max_rx_pkt_len, > + max_rx_pktlen, > dev_info.max_lro_pkt_size); > if (ret !=3D 0) > return ret; > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index afdc53b674cc..9fba2bd73c84 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -416,7 +416,7 @@ enum rte_eth_tx_mq_mode { > struct rte_eth_rxmode { > /** The multi-queue packet distribution mode to be used, e.g. RSS. */ > enum rte_eth_rx_mq_mode mq_mode; > - uint32_t max_rx_pkt_len; /**< Only used if JUMBO_FRAME enabled. */ > + uint32_t mtu; /**< Requested MTU. */ > /** Maximum allowed size of LRO aggregated packet. */ > uint32_t max_lro_pkt_size; > uint16_t split_hdr_size; /**< hdr buf size (header_split enabled).*/ > diff --git a/lib/ethdev/rte_ethdev_trace.h b/lib/ethdev/rte_ethdev_trace.= h > index 0036bda7465c..1491c815c312 100644 > --- a/lib/ethdev/rte_ethdev_trace.h > +++ b/lib/ethdev/rte_ethdev_trace.h > @@ -28,7 +28,7 @@ RTE_TRACE_POINT( > rte_trace_point_emit_u16(nb_tx_q); > rte_trace_point_emit_u32(dev_conf->link_speeds); > rte_trace_point_emit_u32(dev_conf->rxmode.mq_mode); > - rte_trace_point_emit_u32(dev_conf->rxmode.max_rx_pkt_len); > + rte_trace_point_emit_u32(dev_conf->rxmode.mtu); > rte_trace_point_emit_u64(dev_conf->rxmode.offloads); > rte_trace_point_emit_u32(dev_conf->txmode.mq_mode); > rte_trace_point_emit_u64(dev_conf->txmode.offloads); > -- > 2.31.1