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 ABB99A0C4D for ; Mon, 6 Sep 2021 10:58:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E68341137; Mon, 6 Sep 2021 10:58:47 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 21D0F40E32; Mon, 6 Sep 2021 10:58:44 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10098"; a="219612927" X-IronPort-AV: E=Sophos;i="5.85,271,1624345200"; d="scan'208";a="219612927" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2021 01:58:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,271,1624345200"; d="scan'208";a="523074391" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga004.fm.intel.com with ESMTP; 06 Sep 2021 01:58:42 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX606.amr.corp.intel.com (10.22.229.19) 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 01:58:42 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) 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.12; Mon, 6 Sep 2021 01:58:41 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx606.amr.corp.intel.com (10.22.229.19) 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 01:58:41 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.171) by edgegateway.intel.com (134.134.137.100) 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 01:58:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k7v9CJtDGTm1KlCgbIRjwfGgmnwdfkglTB0GB+xu0TmYAkLHQd2YBqfVpS/LmbRvIYGp9zsNIGr/3Nb+2Xrb/SDDrbO8fAOvfFBsPEmvjHzcY8VqM8iFMexrYnh/7YFgpkfmVQSmlfUsJQca5+XwqMHwpOhhKzHqJyZYr2DK1SKwuco4WcPzIEBRItvbSW72ruz3OFv803/KYE+k33iEyVYIGUXwfs0GloFBjM6SZZX7HpzQ6zSa89deJzVzP3KEVXaELTrCLob5WdbWY7SRN111qJG7UKiaQncxPFIodffgPVpFDKpoyDuxfvbSYO+0TNWspWnqA6HkKyC+XP3YOg== 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=uF9zJcuMxJowdb3qWMt3Wr575QdG5BVyZvxx8cMprX8=; b=EG9kIzUtLx7zBeqgUCflvSyxkxLZfAK3c+bEqPidBFjX3YbQT6ixXjPBTc9f7okG2h9z2J3ljQ2rdMiL/Xib6zE1UmZ3lTAJx77PnXbT0qblECCd3UR71tOf0RAFvqzzbT0qqrze+7ZxNkG+pt8tnTggpaPs7DUAcFeYjAhFXMZjdRUeYefqfdOj5GnJrAWkjutu0E0yOti8tnVTpZ4MYz3V5SaOxvV1u8bxP9NoAJLpGd/RW6JlDydGchsHDDCwcCoRNW8JxP0kkxNuekbYAnWNXTPYPn1356+lNcwnMiUK895G/aB/DOPKpITkxyMkBkQQ7bChhWZUlBKHR7WwGA== 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=uF9zJcuMxJowdb3qWMt3Wr575QdG5BVyZvxx8cMprX8=; b=xrzbwupAn1XS6LZxPJVMFxNcZnkODz3Zx00hbsoy0z5Tp6aYSJYHwj1aWfh86qpswr/WzvjC4t3b6+iZYnDsaPEmy6C56VGKr1JJSgWwQoi3HnaTFndaksnr2MiAsmrBmRKoOB7PVxrbup/l/fJGi3WXKHouYCP8iYoiXmpbSGk= Received: from CH0PR11MB5523.namprd11.prod.outlook.com (2603:10b6:610:d6::15) by CH0PR11MB5412.namprd11.prod.outlook.com (2603:10b6:610:d3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Mon, 6 Sep 2021 08:58:40 +0000 Received: from CH0PR11MB5523.namprd11.prod.outlook.com ([fe80::e4cc:67fd:7ff3:c46a]) by CH0PR11MB5523.namprd11.prod.outlook.com ([fe80::e4cc:67fd:7ff3:c46a%9]) with mapi id 15.20.4457.023; Mon, 6 Sep 2021 08:58:40 +0000 From: "Li, Xiaoyun" To: "Zhang, AlvinX" , "Ananyev, Konstantin" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] app/testpmd: fix random number of Tx segments Thread-Index: AQHXn9N1MfLApFeubU+ZRVMRy/2QC6uWofqg Date: Mon, 6 Sep 2021 08:58:40 +0000 Message-ID: References: <20210902082013.7704-1-alvinx.zhang@intel.com> In-Reply-To: <20210902082013.7704-1-alvinx.zhang@intel.com> 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: 5c0707df-a48b-4ffc-03c6-08d9711485bc x-ms-traffictypediagnostic: CH0PR11MB5412: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1051; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WawVoHKAuZmneNgLqmfMlAGmnKreFEDNZVqSvmWOtw/ufjfapp3B1jb/8Iw/P3whze5p2Mok/uIXjPTYB5ciBJDlIn5e8ATQgvlIZce4PEsBH3DWGJ9BaKz9o6mYz3+8qvXYrMCCWIg+WkrnC+TocVTM2l6k4BrBFD4ezVW3qL5hw+UqFiDk2W54c9nMBLonI3tu+tVMOdKJj4Ya6xXKIrXOn1+FE3Py/xLklZGb60G3tv3v6HR63N9DiWoZCFyGRM0Y8/GbPlCztTqC5+4s1JjIjSDs3kvwxx+lZNlUCsUqu5QAEn66NAuiT5/IgXROlDokdt8+qBKf2dpwcF3x3RjzUS80iybUnQJOSa2tz1Ao39rNz15y8MCpx2GvLbPnyjln9iAtxyCU0zmnOoZ5VQ5RdabSZJ6eXXvxhFKDc/fO17q3AHG3cJSyREUTrowOhMv0c9n7Wqrpy8Y886WIrqfbaCbgyivYicjCLKm7mlCext3oeE5m27ppNn/2RwQ0THEUq9D5fwXGO4viRAka/RTJ+G2OA3lGdqu+nV8EL7cy6pdCsSOLOt9fdh9Y9fRCBiefeYz1/I9gQexSbPJEO+TKSI36PAAT8ONdqcE3XHPrg8wmUyX+BO8MSYA5gZ0YwCwuvyFJRqL72uPHUlVyFgE4kVt3A1CfPitNqSz360Uh02W+JRg3nNJAEh2X+oz5F1Qye9X1zhCHx/9P0+przw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR11MB5523.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(54906003)(33656002)(26005)(122000001)(55016002)(9686003)(508600001)(66946007)(76116006)(66446008)(66556008)(64756008)(66476007)(2906002)(6636002)(186003)(71200400001)(7696005)(110136005)(53546011)(5660300002)(316002)(6506007)(8676002)(52536014)(83380400001)(450100002)(86362001)(38070700005)(8936002)(4326008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?PyrYIUUrR3QVceOVHMg+0qsSXNJ4YvAktt7waUrb/qdUgW9kO4c+JuQ5FfB0?= =?us-ascii?Q?6iR8ztQPStjx79D0CSwMb1KIO0lTRLT4mLaYF8rSSsUlNiAcFHmEGd1okuWT?= =?us-ascii?Q?YqkYcKWnJA+loVgc4JKn2mK9Oc0yOzvvxt7YSoTxt3cbSdTmsXFX5T6ycs6k?= =?us-ascii?Q?PX44wgDDhVD8FoP+a25yXJQ8iwDGw6iXSKxSgIfbf/k+cDCPqcKgk18q+myJ?= =?us-ascii?Q?qPtEtDaZCF2JF7DYekXmIk6r7B240BaGCkBAAQs7t3YjDrObsvPE0An6i9sk?= =?us-ascii?Q?v/wgHJPsS1itlT/jsfps3CyjsTG2scPjouqRgKUFdQp0LFx9OMj+o7bt9U1X?= =?us-ascii?Q?zF85ydtM/dA740g9E/iPQRBeySI1lzMQC1mvVwnm7DjG9r2Zr14F/NV/W5yI?= =?us-ascii?Q?2tmTGcFnLcM6NWk9xqfvEA1husaa5dUQYaMJF3Aq17jCre7Cax2wm82CfTuX?= =?us-ascii?Q?o6pu+L4SLr0rnLILG/yFmeU/KxPeySWJoHFcn4F6EJjOF6fxCUdRJcJYewv7?= =?us-ascii?Q?Y5q8C6lZRSmnRdC82TQoaazJDvyiZIzGuJ6qaL13Km57FRTfpsJ6v2sXqeMQ?= =?us-ascii?Q?+a+AV21nOPzMTLQYLyGu2kdt3GDaKtlWmKRxifa3//PTVfgY0SAA+r4DJqBE?= =?us-ascii?Q?aKPYli6HrLAnSsMc/ih5XjxKPYPl/kdW1IRwcyMwvQ3Y5vK2NQij1hst9QqM?= =?us-ascii?Q?UihbPWnzN1+yOt0nG83H7liILyhG9QItTkCN1q83QHzKuOS3s+yp9wNHZdbh?= =?us-ascii?Q?tIWHpLwzWLQ5nSyuqkOPlXx98nuBTgzZNnVLGrrvfK7dWeykW4P7AmqBaRqA?= =?us-ascii?Q?Bos6UTlxAE1FkZJmzA35l3xMgQxKhyTlKeXqFuktp3BPKsID64ul2AgYxjQ0?= =?us-ascii?Q?1u+nfsTNb5lTbRUrwxs7PXZdT2z0RbwAOmWkCRFMpzTmbIs3bEa6pM3LcuGG?= =?us-ascii?Q?fFnTpIALT0l+kRAsNd3FL693A2Lu0P/uc7JGlbDt67QwRdqi9vYT0getoZ9m?= =?us-ascii?Q?ZlKDOmGM6ZtTI+VXOusezHHdIaFR03pvewYfF6T6gQh20MoPdc4H5n0+KSpy?= =?us-ascii?Q?JzdBWHp0xqWn+9WecuHjKkL/ou4Xm5evcrthpZffSRZ3E+I4DfQQXPcD4+yI?= =?us-ascii?Q?u1/repm4lOX4JQ3JxQ5VOxmVgGxlmeTFT5s+bl1t1+QsK5yb9rsoEMVIWYwM?= =?us-ascii?Q?KhnwvlrtqcquiLOvMpXoWxemgI8u7wKsSVtHPyi26yWMXDPn8f+3rZxlVZUy?= =?us-ascii?Q?T/K28lSulAGYPRmFoBDXrO8OYgQGlPftDeADW7/5HXkaAEsX44gWopmit4D6?= =?us-ascii?Q?YS6hgPm3OWUsLOf60RtdHxIv?= 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: CH0PR11MB5523.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c0707df-a48b-4ffc-03c6-08d9711485bc X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2021 08:58:40.5815 (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: YCkxIhABVEIGUl4s1MyrO0I2cd09g4KhBSnyu8mNGqFccTvbAjeJueZTaNv7cNLLhtiVAOEvs13y22pKNPo1dg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR11MB5412 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix random number of Tx segments X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi > -----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 >=20 > When random number of segments in Tx packets is enabled, the total data s= pace > 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. Otherwi= se the > Tx engine may cause the application to crash. >=20 > Bugzilla ID: 797 > Fixes: 79bec05b32b7 ("app/testpmd: add ability to split outgoing packets"= ) > Cc: stable@dpdk.org >=20 > 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(-) >=20 > 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 the > - * 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). I don't really agree on this. Most of the time, txonly generate packets wit= h 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". It'= 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. But if you read txonly carefully, if "TX_PKT_SPLIT_RND", the first segment = length should be equal or greater than 42 (14+20+8). Because when "TX_PKT_S= PLIT_RND", update_pkt_header() should be called. And that function doesn't = deal with header in multi-segments. I think there's bug here. 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); 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= with this issue better. > */ > 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; > } >=20 > 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 */ >=20 > +/**< 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 policy = for > packets to TX. */ >=20 > 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; >=20 > 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; >=20 > - 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; >=20 > -- > 1.8.3.1