From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 29EC5A04DD; Thu, 22 Oct 2020 18:52:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7D13E8D9A; Thu, 22 Oct 2020 18:52:26 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A03387DF8 for ; Thu, 22 Oct 2020 18:52:24 +0200 (CEST) IronPort-SDR: Kfjmiad8YV6J5qQ6Ng96ZqwqW2W3sxQexV05dtks6wOcB9owXnlS55DBQkPNrYpomx0pZpvxLe 7nU3XRJQhpqQ== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="166776875" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="166776875" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 09:52:22 -0700 IronPort-SDR: cN4XRK/RTs5NiGanHHPh8Gt0GRsWlyP20bYFTjwuqKINbWSvdxAl2pLTwJ4Mbc62KzzG0SdcsU izQuEztHKCgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="466757146" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga004.jf.intel.com with ESMTP; 22 Oct 2020 09:52:22 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 22 Oct 2020 09:52:21 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 22 Oct 2020 09:52:21 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.175) 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.1713.5; Thu, 22 Oct 2020 09:52:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gKRhvSPWIy4uKVHFoFi8DT5n2a9h/shhu0s5MfBSETeVoG8G6kKUEJbQ+OeyZArNfe7hQQBUmWwYgXlWQ+TtUz/be/jl34Zn4YGm5F5kqox3C7IphzFdIIYSwNqN4eBMu2IpN6UrYTWSO6LWgbLN4YqDzbL+Go7aAXA9wfNWEkCKl7e7GEdGAMzAzHWLNYZR8LkWVLSZxB03PcpDfuL/JTkjwBnTAPoWpPCetFsHiXJtPC1+izNJ+Sd5PtbhUagV82Shvcpaz7LwOb17YPK50AMcGeIrP03QMvmrlhFo2EmglEp0wl3aXn8HrtBFVhZMkohVVgnzIkuV1wFvfYheDA== 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=tO4UvLyh7b4df+SBE/3+sE1yL9NPFDU8M9WwZCZkI1U=; b=L5QoxqYBNgn2v+FpL0Y5HaEeCAHSG2K/S9Rw8smZkvtNLGR+MXFpFIForToGBL8UZTluzOWzsr5dzy6YynSdvx7jxgUxaHF21hrvNWWMMvIusdcE6d5R9J5tXW9d/a3Yvdjz2Wv9ZroT4ouawNOXPS0K6m1u7NeKy+3++TpjU6SWO2d+id6mSXIOvylHfcVwQ79UQGMijtNKYU6stUwWHx86B99OAHo2i/Praf57mNP5ZiUs/2zQCS5M9lJujQvutZvpRG8q6rq8J54Cvb88vLC0XJe5M06m+WhqqcSYg2PAnWYtA87+4DpuMmOTiKdLLQmFPb+JmPm/25glF4Gv4Q== 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=tO4UvLyh7b4df+SBE/3+sE1yL9NPFDU8M9WwZCZkI1U=; b=RgJvWclYHFcpuAt7PcoGFROamys+8AK0ZbpaHE98KoOwpffJ4PIV5q5Npta0n2M7/2Afcyo2j/6uolm6xZdppRQSLcr7tqHFsAYZlw9j49EelYTmdOkpn0XDo+cq87a0YBjq2d4vyuMgwwC+KtK60q9DWa4OvDCCyji7NGkXeOo= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BY5PR11MB4484.namprd11.prod.outlook.com (2603:10b6:a03:1c3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.27; Thu, 22 Oct 2020 16:52:09 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f5a4:3f6b:ade3:296b]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f5a4:3f6b:ade3:296b%3]) with mapi id 15.20.3499.018; Thu, 22 Oct 2020 16:52:09 +0000 From: "Ananyev, Konstantin" To: "Yang, SteveX" , "dev@dpdk.org" CC: "Yigit, Ferruh" , "Xing, Beilei" , "Lu, Wenzhuo" , "Iremonger, Bernard" , "thomas@monjalon.net" , "andrew.rybchenko@oktetlabs.ru" , "Yang, Qiming" , "Zhang, Qi Z" , "Yang, SteveX" Thread-Topic: [PATCH v6 2/2] librte_ethdev: fix MTU size exceeds max rx packet length Thread-Index: AQHWqFByxZM9FSdqsEufjouwzmOdHKmj1o6g Date: Thu, 22 Oct 2020 16:52:09 +0000 Message-ID: References: <20201014091945.1934-1-stevex.yang@intel.com> <20201022084851.35134-1-stevex.yang@intel.com> <20201022084851.35134-3-stevex.yang@intel.com> In-Reply-To: <20201022084851.35134-3-stevex.yang@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.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [46.7.39.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8155e097-2496-4d74-8abb-08d876aad0c7 x-ms-traffictypediagnostic: BY5PR11MB4484: 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:2657; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7U1D9JALJRNYBrSzWT924q0UUwLuqF9R8uytf6OJ7ouBuUeFEIPuQSFHuM3CMcO0DsdClU9g/A+WDSTjoPqFMLzhoCnxiPfkAoo6NNXf56foNv6f/V+nxeNfDJ7BJv9aOA4LBlKMCQQ5N/bFWm+7oGGeM4BN6ZcnEuB788VyFT3owZuTWo+vA4tiurXmWEWTwH57+dgwKm8CtJBAGVP9Cvzz0b5QbYm5NLQEYDf/VhjVlcMSWwn+omV0EAfm2j2AImz2dxH9rGgfkuN//QJUmt4co/sesK/yTanpVIZV7qMI9IIjKIHHJ126+M9LlQ5F x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(366004)(376002)(346002)(396003)(8936002)(316002)(54906003)(6506007)(8676002)(55016002)(33656002)(83380400001)(110136005)(26005)(7696005)(186003)(86362001)(71200400001)(76116006)(9686003)(2906002)(107886003)(66476007)(66946007)(5660300002)(478600001)(52536014)(64756008)(66556008)(4326008)(66446008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: scmFp+IGT5gjaVBTr630+y1P+hibzmy5krFqSulqvBbFaDp67qv3EdD7tiYRbGzEU1pYrGhj4jAP8rNrZT3oKmlVrx6+XqIV54Gwb5/xhYQBw1GCqX33Xg0+3SKXygEZnt9UMVozykU8lfGQeySJyWzKPSOKFzY8fFQLfGAnhkxyJXNnNWojPr/tpyP4qTwF8oZfQPaSVWcNhNq9OHDBr7A+/ljMsB4PnER9H2rMjqw3oEea5Scb6dr5v0IfiIWMJLZ55kXGD7UzAgZgXiVtlexQWdjTTAs30/ciZHD7Bu5h7zE/Uk19ZKCeB04im4kuYWR3iFbQR1IIV1HhnKud9+uP/69hC81LrYhtU7rs91x38DZLYrp2AvCza9isKm0+n7pRLLMtRvK74pvpDEQE0nb6zjc8/M293U7P38dGJP3+7hhMxGl6sVMab63TXBrGag6NotWUoysihRJMP+n5PpRO44u0Mr8kU7HoaR/aXwzL65tZU/xaGJTkPtFN7EPPxX7MioIfQ5VzKO1Gl0k2j4TO88Db3Gf+7oXEox/VI/fIJpY2rvMlNZK5VBxkmCxKGFoUG9WtnU0hQO82aBt5LMzzamdh3nGeIdOBh4Np2aPxDyg88upGkRuB/FctKv3SJPcyiLXb18xvnwZZetCa0w== 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: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8155e097-2496-4d74-8abb-08d876aad0c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2020 16:52:09.0352 (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: vwcDBpjzLXYcrXxFOnH9VAOCcjU1KzNERRzQoXBcP0xjifvMvCp2rad73B5v57KOuiHd65QqzuXqlEgcTWG3GuBCmIXvH+zYsRcWlZXWlf4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4484 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v6 2/2] librte_ethdev: fix MTU size exceeds max rx packet length X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" >=20 > Update the MTU size according to the max rx packet and Ether overhead. >=20 > Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors") >=20 > Signed-off-by: SteveX Yang > --- > lib/librte_ethdev/rte_ethdev.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index b12bb3854..17f1c33ac 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1290,6 +1290,8 @@ 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; > + uint16_t overhead_len; > + uint16_t max_rx_pktlen; > int diag; > int ret; >=20 > @@ -1415,6 +1417,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t n= b_rx_q, uint16_t nb_tx_q, > RTE_ETHER_MAX_LEN; > } >=20 > + /* > + * Update MTU value if MTU + OVERHEAD exceeds the max_rx_pkt_len > + */ > + max_rx_pktlen =3D dev->data->dev_conf.rxmode.max_rx_pkt_len; > + if (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; > + > + if (max_rx_pktlen < dev->data->mtu + overhead_len) Do we need that if() here? Might be do assignment unconditionally? > + dev->data->mtu =3D max_rx_pktlen - overhead_len; > + > /* > * If LRO is enabled, check that the maximum aggregated packet > * size is supported by the configured device. > -- > 2.17.1