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 8E9B1A0C4D; Mon, 6 Sep 2021 12:04:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73ED340E32; Mon, 6 Sep 2021 12:04:04 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 3098040C35; Mon, 6 Sep 2021 12:04:01 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10098"; a="216778692" X-IronPort-AV: E=Sophos;i="5.85,272,1624345200"; d="scan'208";a="216778692" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2021 03:04:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,272,1624345200"; d="scan'208";a="502202780" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga008.fm.intel.com with ESMTP; 06 Sep 2021 03:04:00 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) 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; Mon, 6 Sep 2021 03:03:59 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2242.12 via Frontend Transport; Mon, 6 Sep 2021 03:03:59 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.49) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Mon, 6 Sep 2021 03:03:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KT7Tv950VxMUi9/AlM7mHIxFyYsncXYNr/YusG0n1aCwIkwfyAXWnKTgvCfv+2LBB0DoyK2Gik0Pqa8Gwx96d6n5U7kaGT43e2o0FBoQ1efacYT7eSh4dvjcEfYRx1tHKrBnFxz9VcYMOM+g3Rhj3l4mUpZIon0QgoVtos8mI8hRPMsLmBiNJHAFHRiVPodGL3/DGfiWLKeW2R3fnyCLOm1melHkPU84v8shGwrchp5w3jdmlTrjBfOObOQAJvJz82UJ9bTHHkUoDseQQqjvkmM6O8B2K7WA1+Y6kR8z25BfxwNlJ88Bzr+ljh9NOILUtn2mVoq05L6Bj4Y3lPAP2Q== 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; bh=DNMDidq3p3txjdjTTXxKmIyWH4aoFoeTM5WEG6jnfuA=; b=dbrkaXh0M//H3eg4vhdK/TGihfFUovgF+N2SX1FTVWXZ4adOcLvkRsvjraSNLPZjz5JAgVi1gnpi2HH/k4sYNBG9TfbvrKmGDj8cN7TeVhplkyJdBsRih0nzdDv+y80KTeLw2Z5ucEHjX7CgqVF05SA/HwN6SJ2Hm71I36d0hIYq2dfTuxdPzkE31nTRzqEzsf6wvHRYD7JOkZTNWhuIhZ+HTPhb512yS6JQcfRdYOIuubJEQOXfUy8PFn6b1sx/V494auAwV6eq/7I8bAi7As+ds9W5uVA2qh5F43VDaV0dC2fFaIvNJ3pg3bPDk4+LFgW3K04oXV3rVbCRUzxslw== 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=DNMDidq3p3txjdjTTXxKmIyWH4aoFoeTM5WEG6jnfuA=; b=SDt+/6xEM6ga6/idG18KC2gbxRl2S7O/pG8Ugm8KkZD9FIJVuCSvE6qi6erkhX1R+6A21KkBeu1pdApW73z8/CI+kKxi9+FbpVZj25oMtdRVCb7OyCyYTsJblRD/rzzxUsBIzhsfGwT/ay3Jn2LI9YCYjuDoCOksjCk00mlm89w= Received: from DM6PR11MB3898.namprd11.prod.outlook.com (2603:10b6:5:19f::12) by DM6PR11MB2764.namprd11.prod.outlook.com (2603:10b6:5:bf::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.21; Mon, 6 Sep 2021 10:03:35 +0000 Received: from DM6PR11MB3898.namprd11.prod.outlook.com ([fe80::4ca9:17cf:64c4:ca73]) by DM6PR11MB3898.namprd11.prod.outlook.com ([fe80::4ca9:17cf:64c4:ca73%4]) with mapi id 15.20.4478.025; Mon, 6 Sep 2021 10:03:35 +0000 From: "Zhang, AlvinX" To: "Li, Xiaoyun" , "Ananyev, Konstantin" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] app/testpmd: fix random number of Tx segments Thread-Index: AQHXn9N1WoSG2Nbwd0+eSRHQlQjSUauWux4AgAALwoA= Date: Mon, 6 Sep 2021 10:03:35 +0000 Message-ID: References: <20210902082013.7704-1-alvinx.zhang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: 5693c926-116c-4b11-b66f-08d9711d974f x-ms-traffictypediagnostic: DM6PR11MB2764: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ykr/b+Sm1GHXgyBaOsErUNFy+c3R5+bJ87bxZP2gn2VB0R2W73Ymkzqg4v1ebuIUNxKp6o8n+DYOAP6KxUn1gpwADRPk3EgM6BLq+V1JhuuKAf9NTBHEDtQrCiCC8j824ZdSVYVJlE3ZaxRh57You4FjhDNxPSfHKJzGUNskwBAWobYTWwlBVQGpUTM2XxdLogXN6aku6z912HcNsQ5/eX2J9nfg5G7FahmqhQ+J+O4wqBS1P1KstUL5sG+AuLFAVeMKUTGiZjRPJxJyb4et/7/At0xeqdHaTP+HyZ6s+We7v4USvDO82H7+LtmQafU7EWFIZyrtnXXAf9YPM31AWP+IBEof1COb3c8U5tR0LHh3YgZ6ZoFTCcwu3RMU9hMf8pycdh/8cBR5NgzmAiDp/tmbeC0LGjz6ltUTuRXwPSPXb8Hs2BM9dYwgwHCzAA5hoZlSfERefO1YiLM9DwrRUDE258dlpZUG07iz41EgXhQCrbm4hCf0bVQhGDXqRgXENK4YQlMuy5jPbj61NfDLyAv63l1mwq98CUR/v+MfQ8EBhXKPoLnnWDPR6cMzqf9CVEUtUYi4A18yx3ZolzaElDmnwkoIx/EwoH5Vun95PoWNqf9WIxqGCCqz8Px49N+JcPrXbhM3mpAJ8ysqncVOCXWvM2ClHkUDbxgn5GEB+6y7mW6e+lq4aplJko3r5wx/CuaCWan5nMNMODoacoGnxg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3898.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(376002)(346002)(136003)(396003)(39860400002)(7696005)(52536014)(66476007)(38070700005)(66446008)(33656002)(66556008)(110136005)(316002)(71200400001)(478600001)(5660300002)(2906002)(9686003)(8936002)(54906003)(66946007)(64756008)(76116006)(8676002)(83380400001)(450100002)(38100700002)(86362001)(53546011)(4326008)(186003)(122000001)(6636002)(55016002)(26005)(6506007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DFApfn5akkmJsEqwQf/2tVxAP2v+0SdH/6i0pIYag0LALgL3u8KOH0D6il2p?= =?us-ascii?Q?p9jRfB358ERQn+OsRlUd7hzSOQKBeCYGIjOxRs1LxngdTb6ne1GDn/fYXDdp?= =?us-ascii?Q?XpTSFPDnXM4+k43c5TINN6uOa7Z2UOIRE+Tk05jPJi7wvLutwNxB9SYqLU0P?= =?us-ascii?Q?UPgG3jUWJqtrXGYfreW/7Yzfs5L/v3TuqRwDeOYoZ4koUwAodV4D4Be9tOT+?= =?us-ascii?Q?/uLQ5+yWP/lNnVM6cIQxtAGV+VrGwor8MG/kXelKWxUvXT1tO50Ax6de/42V?= =?us-ascii?Q?LuRBcH12KgGktdeKsgTtbD2usGvvL/DqAKIRiseeA5ClXpZYt+a08qJJ1JaR?= =?us-ascii?Q?wKYrd76iyg2Zzs9oo4gm1hYeK+3R2AtHQE4RHYC69rmFjdV1hrQiyrZqIdwQ?= =?us-ascii?Q?pwvZz2vaKg8yK+BYxjNS0uuWdOS/ZCV8tO6wBs/8g2KLYguOZA2iEJwkGdVp?= =?us-ascii?Q?oLrr1q27wK/RTd3V5C/sowntX46O3gqNlRIL9Dvsu2KVCE1VmXVok8rNPB9K?= =?us-ascii?Q?lUfVhdQOURX1Na+Qq5eT7Ahf8M14gzM3Lju1bzkF+zcOTYBdQcnFUD0+LGrF?= =?us-ascii?Q?wnDcSLoX253G7wxiJhpC48vXVtgRCyc1hjdvyMENPmmqmO3ocYwTf74CrZp/?= =?us-ascii?Q?spB5dbCoS1HNCuB8M8aNJPoai+3tsmDvf24fS5U8CkwbJHDJaE+i9DZQ09+T?= =?us-ascii?Q?TRxFilCc4ByqUYdi1PlUwS9t7pvTB+StLBKFebAGfbaSuUuKP3hdf6WwH6QN?= =?us-ascii?Q?uklHnadF5jPL5aO999VSnH0m5L3cWbSMV+xAmpHnsvSJbTS/bS0bjVAZPufw?= =?us-ascii?Q?KL7gXO/awbEMAT1+uPse/kT4lVq0F8FFiLdflV2hKO8CvO7cjiNlJWa7EdJr?= =?us-ascii?Q?BP5thunmt5e9LuJZFFhqvDx3Y8JroEe3DnNCILm5bWCAkW1ZfS5v3lQ4zeT3?= =?us-ascii?Q?FtT5M0Nt3s9eNLn7YS3XHjnBEocLeCoCSP8DGB+A0dwA0eVmX9xTDOdY7dqC?= =?us-ascii?Q?MebE2LSG4IiuPuk26sKQiZH6b0boiqz39T5kRu6LAGP7In9IA9wM9weqIA0t?= =?us-ascii?Q?GVvFDHsqJmfs2R+wDqAa0DllGkDSLEUZlphM7yTLs/Xbxyo/7lord8CGyqtx?= =?us-ascii?Q?8Nc0q/7ZxR4z6MJhgCFCGEU2BUmDsSeMVTvumO92qkqOmWZpYMFq4VTAHKZd?= =?us-ascii?Q?ooza782Tmmj+1ZTQwtpS6PYc/0fEJ4qVjY5quU7X8MA0ICDKHmoy/7lks2N4?= =?us-ascii?Q?R8fIUQBqJI5+FTqea4OeV5gZJN+1hJ5gZcVac4MhoXdND+gokZHEXZEaFgzp?= =?us-ascii?Q?c4shGOBZZI/JoWGVUgG+cR8H?= 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: DM6PR11MB3898.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5693c926-116c-4b11-b66f-08d9711d974f X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2021 10:03:35.3291 (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: cVXf+BUahHEsU2gMRlgtb7omBgmnFytndv8Imx3vDLUCM5ACXcXetgZ2Vw3vC7zayIiPD+RaV16rLwlxEeptfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2764 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix random number of Tx segments 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" > -----Original Message----- > From: Li, Xiaoyun > Sent: Monday, September 6, 2021 4:59 PM > To: Zhang, AlvinX ; Ananyev, Konstantin > > Cc: dev@dpdk.org; stable@dpdk.org > Subject: RE: [PATCH] app/testpmd: fix random number of Tx segments >=20 > Hi >=20 > > -----Original Message----- > > From: Zhang, AlvinX > > Sent: Thursday, September 2, 2021 16:20 > > To: Li, Xiaoyun ; Ananyev, Konstantin > > > > Cc: dev@dpdk.org; Zhang, AlvinX ; > > stable@dpdk.org > > Subject: [PATCH] app/testpmd: fix random number of Tx segments > > > > When random number of segments in Tx packets is enabled, the total > > data space length of all segments must be greater or equal than the > > size of an Eth/IP/UDP/timestamp packet, that's total 14 + 20 + 8 + 16 > > bytes. Otherwise the Tx engine may cause the application to crash. > > > > Bugzilla ID: 797 > > Fixes: 79bec05b32b7 ("app/testpmd: add ability to split outgoing > > packets") > > Cc: stable@dpdk.org > > > > Signed-off-by: Alvin Zhang > > --- > > app/test-pmd/config.c | 16 +++++++++++----- app/test-pmd/testpmd.c > > | 5 > > +++++ app/test-pmd/testpmd.h | 5 +++++ app/test-pmd/txonly.c | 7 > > +++++ +++++-- > > 4 files changed, 26 insertions(+), 7 deletions(-) > > > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > > 31d8ba1..5105b3b 100644 > > --- a/app/test-pmd/config.c > > +++ b/app/test-pmd/config.c > > @@ -3837,10 +3837,11 @@ struct igb_ring_desc_16_bytes { > > * Check that each segment length is greater or equal than > > * the mbuf data size. > > * Check also that the total packet length is greater or equal than t= he > > - * size of an empty UDP/IP packet (sizeof(struct rte_ether_hdr) + > > - * 20 + 8). > > + * size of an Eth/IP/UDP + timestamp packet > > + * (sizeof(struct rte_ether_hdr) + 20 + 8 + 16). >=20 > I don't really agree on this. Most of the time, txonly generate packets w= ith > Eth/IP/UDP. It's not fair to limit the hdr length to include timestamp in= all cases. > And to be honest, I don't see why you need to add "tx_pkt_nb_min_segs". I= t's > only used in txonly when "TX_PKT_SPLIT_RND". So this issue is because whe= n > "TX_PKT_SPLIT_RND", the random nb_segs is not enough for the hdr. >=20 > But if you read txonly carefully, if "TX_PKT_SPLIT_RND", the first segmen= t length > should be equal or greater than 42 (14+20+8). Because when > "TX_PKT_SPLIT_RND", update_pkt_header() should be called. And that functi= on > doesn't deal with header in multi-segments. > I think there's bug here. >=20 > So I think you should only add a check in pkt_burst_prepare() in txonly()= . > if (unlikely(tx_pkt_split =3D=3D TX_PKT_SPLIT_RND) || txonly_multi_flow) > + if (tx_pkt_seg_lengths[0] < 42) { > + err_log; > + return false; > + } > update_pkt_header(pkt, pkt_len); Yes, I didn't notice the updating for the UDP header, but the bug first occ= urs in this function=20 copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr)); not in update_pkt_header. Here we expecting users should set minimum 42 byte for first segment seems = ok, But I think we putting the check in configuring the data space length of fi= rst segment is more graceful. >=20 > As for timestamp, maybe refer to "pkt_copy_split" in csumonly.c is better= ? Copy > the extra to the last segment if it's not enough. Not sure how to deal wi= th this > issue better. >=20 > > */ > > tx_pkt_len =3D 0; > > + tx_pkt_nb_min_segs =3D 0; > > for (i =3D 0; i < nb_segs; i++) { > > if (seg_lengths[i] > mbuf_data_size[0]) { > > fprintf(stderr, > > @@ -3849,11 +3850,16 @@ struct igb_ring_desc_16_bytes { > > return; > > } > > tx_pkt_len =3D (uint16_t)(tx_pkt_len + seg_lengths[i]); > > + > > + if (!tx_pkt_nb_min_segs && > > + tx_pkt_len >=3D (sizeof(struct rte_ether_hdr) + 20 + 8 + 16)) > > + tx_pkt_nb_min_segs =3D i + 1; > > } > > - if (tx_pkt_len < (sizeof(struct rte_ether_hdr) + 20 + 8)) { > > + > > + if (!tx_pkt_nb_min_segs) { > > fprintf(stderr, "total packet length=3D%u < %d - give up\n", > > - (unsigned) tx_pkt_len, > > - (int)(sizeof(struct rte_ether_hdr) + 20 + 8)); > > + (unsigned int) tx_pkt_len, > > + (int)(sizeof(struct rte_ether_hdr) + 20 + 8 + 16)); > > return; > > } > > > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > 6cbe9ba..c496e59 100644 > > --- a/app/test-pmd/testpmd.c > > +++ b/app/test-pmd/testpmd.c > > @@ -232,6 +232,11 @@ struct fwd_engine * fwd_engines[] =3D { }; > > uint8_t tx_pkt_nb_segs =3D 1; /**< Number of segments in TXONLY packets > > */ > > > > +/**< Minimum number of segments in TXONLY packets to accommodate all > > +packet > > + * headers. > > + */ > > +uint8_t tx_pkt_nb_min_segs =3D 1; > > + > > enum tx_pkt_split tx_pkt_split =3D TX_PKT_SPLIT_OFF; /**< Split polic= y > > for packets to TX. */ > > > > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index > > 16a3598..f5bc427 100644 > > --- a/app/test-pmd/testpmd.h > > +++ b/app/test-pmd/testpmd.h > > @@ -464,6 +464,11 @@ enum dcb_mode_enable extern uint16_t > > tx_pkt_length; /**< Length of TXONLY packet */ extern uint16_t > > tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT]; /**< Seg. lengths */ extern > > uint8_t tx_pkt_nb_segs; /**< Number of segments in TX packets */ > > + > > +/**< Minimum number of segments in TXONLY packets to accommodate all > > +packet > > + * headers. > > + */ > > +extern uint8_t tx_pkt_nb_min_segs; > > extern uint32_t tx_pkt_times_intra; > > extern uint32_t tx_pkt_times_inter; > > > > diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index > > aed820f..27e4458 100644 > > --- a/app/test-pmd/txonly.c > > +++ b/app/test-pmd/txonly.c > > @@ -195,8 +195,11 @@ > > uint32_t nb_segs, pkt_len; > > uint8_t i; > > > > - if (unlikely(tx_pkt_split =3D=3D TX_PKT_SPLIT_RND)) > > - nb_segs =3D rte_rand() % tx_pkt_nb_segs + 1; > > + if (unlikely(tx_pkt_split =3D=3D TX_PKT_SPLIT_RND) && > > + tx_pkt_nb_segs > tx_pkt_nb_min_segs) > > + nb_segs =3D rte_rand() % > > + (tx_pkt_nb_segs - tx_pkt_nb_min_segs + 1) + > > + tx_pkt_nb_min_segs; > > else > > nb_segs =3D tx_pkt_nb_segs; > > > > -- > > 1.8.3.1