From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 55C12A0C4D
	for <public@inbox.dpdk.org>; Mon,  6 Sep 2021 12:54:57 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 36AD140C35;
	Mon,  6 Sep 2021 12:54:57 +0200 (CEST)
Received: from mga07.intel.com (mga07.intel.com [134.134.136.100])
 by mails.dpdk.org (Postfix) with ESMTP id 03C1340C35;
 Mon,  6 Sep 2021 12:54:54 +0200 (CEST)
X-IronPort-AV: E=McAfee;i="6200,9189,10098"; a="283651677"
X-IronPort-AV: E=Sophos;i="5.85,272,1624345200"; d="scan'208";a="283651677"
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 06 Sep 2021 03:54:54 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.85,272,1624345200"; d="scan'208";a="502216849"
Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84])
 by fmsmga008.fm.intel.com with ESMTP; 06 Sep 2021 03:54:53 -0700
Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by
 fmsmsx604.amr.corp.intel.com (10.18.126.84) 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:54:52 -0700
Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by
 fmsmsx609.amr.corp.intel.com (10.18.126.89) 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:54:52 -0700
Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by
 fmsmsx604.amr.corp.intel.com (10.18.126.84) 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:54:52 -0700
Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) 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.10; Mon, 6 Sep 2021 03:54:52 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=kN6Y/9QASWyNlNiErzunzrRGgbKdmE5Mld4I5NqfqKMsWDSHGTmLqL2wDm0x0EhK+L+rKeLQ8YWdtkxel07VDFVvKAZWWmTQJUcDohqc//+YwwvB/Fv3e4tkpZiOxjS5iybHMbrVE07vP8AOVJRcvRSu9x5lviDIFBDU76JVqLgcO4itgQ3oE6QKn0zxVLRHJlKA6bVctt83CZBUr3lp/yvKBAaPOyDkNWv/8lWk3poQGB/ancw22pdg5f/XrAM8DcOqV9FsH20/puwb8Dl8bsNKs7DFo9qQMkUP9y6BBUu6/BgxGNLu5EpIaNsmdIpsq10rvUlKA1AkIkUvZ9HyZQ==
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=rhIaO5wOJStOb5qD514971f0fQ/Z9bQ/W+whElsfYFw=;
 b=Gb24KKqlAcTVLkX2nTiPKBnJs7d3SrgjSHINBNTrF/lxr4bEGomx9mIw1mHUvRmf7Y6z+Cr5lE9ibwDSGDigv5QceTFfHQf5lMCIQ1J/WTtZgntXC2TGetHnb/s5E0EL5C2DwQJKlT/3kWuvFDN1yJVNxLELBYeGzZhKpbQ86KadU8btkz2J8rx8+QyD1+eKstl2Zj35ksB5jw0itL0kZZ0FuurhH0HeSCrqXW0PPYBAUwyVmYWiO0GjvPyEQmFqZHcX1OPGCkDMxPF9BpT/o6Sg8fOVsnkRweMiqkRXXAAcp5QV/HNQwqLIoK4+1ds+wihftQh3YN8fa8isRYpnHg==
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=rhIaO5wOJStOb5qD514971f0fQ/Z9bQ/W+whElsfYFw=;
 b=G84f35aN0VY15AGB8KVSTzHAXFWoQM2b83eHDUI1A3PELYtvyW38sf7xXBtUhu8egke9AmEGGS1x++aHZf9KrmFjL4YFX/V1of83MjmJrkulyUA55CYMOxk529Hi94F9JORnblOIjlBeZMslqcrmHOryDg0p6hcPvCnUOf5TXic=
Received: from CH0PR11MB5523.namprd11.prod.outlook.com (2603:10b6:610:d6::15)
 by CH2PR11MB4408.namprd11.prod.outlook.com (2603:10b6:610:4a::11)
 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 10:54:50 +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
 10:54:50 +0000
From: "Li, Xiaoyun" <xiaoyun.li@intel.com>
To: "Zhang, AlvinX" <alvinx.zhang@intel.com>, "Ananyev, Konstantin"
 <konstantin.ananyev@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Thread-Topic: [PATCH] app/testpmd: fix random number of Tx segments
Thread-Index: AQHXn9N1MfLApFeubU+ZRVMRy/2QC6uWofqggAArSICAAAungA==
Date: Mon, 6 Sep 2021 10:54:50 +0000
Message-ID: <CH0PR11MB5523E433BD10176CD3ADB9B399D29@CH0PR11MB5523.namprd11.prod.outlook.com>
References: <20210902082013.7704-1-alvinx.zhang@intel.com>
 <CH0PR11MB55230221510FD465B942B02E99D29@CH0PR11MB5523.namprd11.prod.outlook.com>
 <DM6PR11MB3898678452592146FA0563AA9FD29@DM6PR11MB3898.namprd11.prod.outlook.com>
In-Reply-To: <DM6PR11MB3898678452592146FA0563AA9FD29@DM6PR11MB3898.namprd11.prod.outlook.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: df98d65e-1533-44f6-8e4f-08d97124c043
x-ms-traffictypediagnostic: CH2PR11MB4408:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <CH2PR11MB440885F5877751417CD7283099D29@CH2PR11MB4408.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:4125;
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: ZSfci5PcSuAlqyi9Xy5T9c5hSabO8YRTfC0B3x0GaLIpzU2I7aj+OV67JGVYv6lNynwZd7sJsYYGefcMZ+0zkfWBYXF2LIqVxPprdTo51x6w3yp1mPze9loO7tiFCMmGZu8eeXxQALXwzbgFUmq00gVhyB80QU1yc3Lp88M8HP158wpomkrvYqJaHxbHdV215n4IXTNZ6Gf7nstr2RUwwc+iAb4GMKZksyPjksV2+kz4WCrIaVUECFE/6tlZ7Yvybm61eQPolESuG0vZgRYpec1WzisSzJz38dpc/x141pYmLGqsFr/owlCQQsuPoa3VosADchqPqLeWofjFIuLyfQRdKrTRvbzX3uupuvwo/PkZUP4p4TTR3ZcN+JhC/dB2HOvz5YZoOQfYznXTwQe9MZv0V5Hni6fvQBq8HZvq3kNZKtPVn5PRcwk2mKY8VLV9a7yVqX8zQB1rDfF089/sXdhZ3GcZhoHFiwhpkoLb95pfwjAQ1lRIXqXUZuPx9lruXOx7CiqS49DPhu+7hngLNQbsXXWQpS8L14sJNAweqaAO+N5qAVGmBILCE6twek1UNB+Mc/QLfyU5Sj2NxPGRD3qEpm7SCOlPtIE6NQyS4GJXLvSpz581IrLaypQzIPR23x2WNea1Aj97Zff6zxmgbEsiI2Dj35XihdW6pfL6EE5cN+gI44D7qbxsp6JxNbuGhIUtMEJrRBk6jBidd7roqA==
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)(346002)(366004)(376002)(39860400002)(396003)(136003)(110136005)(8676002)(53546011)(33656002)(66476007)(66946007)(83380400001)(5660300002)(54906003)(8936002)(316002)(76116006)(86362001)(9686003)(52536014)(64756008)(2906002)(55016002)(66556008)(4326008)(478600001)(7696005)(38070700005)(66446008)(71200400001)(6636002)(26005)(186003)(122000001)(38100700002)(6506007)(450100002);
 DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ByCmIYte+qXmmWjTnUYMGW7mToF5grUHzVy2vsFjqLEOhJ2SZxuJV9Sji8CD?=
 =?us-ascii?Q?pZ8wMlC+tUWW2zisAEAi8noVz95hZ0IdCN6eruenR0Mh87mBLLaIKlVEUPeX?=
 =?us-ascii?Q?IeFWnlwcQtDuCBe3xnUn36Fz7eQuuAG/Ltr4IZiJ8DMKhh3HiBghnR7TWMpj?=
 =?us-ascii?Q?+Rb3vqRE82o2vB1iTQNjrVC0Wj5zHYbzgKm0dGRa+JCaJUGSHKVDe45vm7cG?=
 =?us-ascii?Q?VnppP1DjFwI++QoJ83GwjTymdUAIAVA/gUQm39AtByAyduxWreX0ntYCv5XI?=
 =?us-ascii?Q?xh7tGZ+LNhiP7VOTo7Zmwy4Rb353JMEO5nr58XgiID2sKscBQDqvzq//XGCc?=
 =?us-ascii?Q?YrLnMXQeidcVuqsU3lPSjL2rZGCtVMCIrVbdnrXmt7UNYDbYMsCiYjGzQVIS?=
 =?us-ascii?Q?FljT1UBM0pVTpZb4vWDoQFRTcMhDEsSJcGF5RB4mWDbCc0rxFSA+m4HZT8MS?=
 =?us-ascii?Q?ISSseT/vlm7e4cnsvBmJE4K9bzDLuBFjG5N7329VmYxv/q8p0ziuszGaT4Zt?=
 =?us-ascii?Q?D2M0z4H+ttZ/p2QKPuAxTUWYhbi7SO93Z7iRhODyAZwVHPGqYP4uXfYMAxX7?=
 =?us-ascii?Q?QK/zSPUngjg2kOKDhjea3wvlF+NaeHsWpiVNV+ttYa6WoAFmyvPLKNrHtwgI?=
 =?us-ascii?Q?FCy2jWdUIxQV0wPITD66/qdySJek4f9eeLDXQoWL92wgwCPhotl6ruBU+7Ot?=
 =?us-ascii?Q?omH3GUUDKPzEiY2+DTo3/Ue8rvHkYIwS4oAXKyYSCp83I9+oWXk3hy/ENRgG?=
 =?us-ascii?Q?nbafbclpfOyqAFl9ODKYSecnrDyg1F7kFSjc+uICTf/4ZT0cYkVWWxbwOK8I?=
 =?us-ascii?Q?J1pr8AKafqXSU+HgJQIX/YqGcD4LKsCeAq+OM5gysdwms5VtikcUQ0Tur/gx?=
 =?us-ascii?Q?9WmGPrWvcEIR070j9M3CStVArQVOAx8j/JOUwnpDQct3NDrBy3n5YHiTlB6I?=
 =?us-ascii?Q?jCcQktwfo6Sz2A5Emx3S0VKkQCAhYM14MDBC3FQXsQ6d7aTZWsXkynSEmlHH?=
 =?us-ascii?Q?norRz3lRyKXHl/CtyuxOusGEuKEfTaAGL0UbWovPmlZuD4+ZT44GfYvm+WAO?=
 =?us-ascii?Q?3ATr3fXBMDgOhwCEEd1FVssUZtz1jYkNQB5ges/W58PkiWbJxdEwLCeBQ+mM?=
 =?us-ascii?Q?UU0wbXTpLXEooh3rKZcgV8+9qKtG1f9t0h+tJw3Smv36y42jonRWgKcA9bUE?=
 =?us-ascii?Q?oVm/cb8IbjWe/uM7W0kLdTWII/wGafsxEKacjq/e75CuDKpbSz65CcmhwkLe?=
 =?us-ascii?Q?JeFS8NjgDoHXfobl6/ElUneqDpSO8OZZx8UyK8BpNXZWUqtgfAKRLeDnDdLt?=
 =?us-ascii?Q?NzKgtzyJjmAXTxiqsU1YGL+B?=
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: df98d65e-1533-44f6-8e4f-08d97124c043
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2021 10:54:50.6437 (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: UzpbUJ34SiGhYzNWanrjQJve5Kdp/R9swf+lDeFYyt2mDjxESc1PRTaTiD6+RjIkCoPkco6gAYucPZ2hSVAeOw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR11MB4408
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 <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>



> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Monday, September 6, 2021 18:04
> To: Li, Xiaoyun <xiaoyun.li@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH] app/testpmd: fix random number of Tx segments
>=20
> > -----Original Message-----
> > From: Li, Xiaoyun <xiaoyun.li@intel.com>
> > Sent: Monday, September 6, 2021 4:59 PM
> > To: Zhang, AlvinX <alvinx.zhang@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: RE: [PATCH] app/testpmd: fix random number of Tx segments
> >
> > Hi
> >
> > > -----Original Message-----
> > > From: Zhang, AlvinX <alvinx.zhang@intel.com>
> > > Sent: Thursday, September 2, 2021 16:20
> > > To: Li, Xiaoyun <xiaoyun.li@intel.com>; Ananyev, Konstantin
> > > <konstantin.ananyev@intel.com>
> > > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> > > 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 <alvinx.zhang@intel.com>
> > > ---
> > >  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=
 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 with Eth/IP/UDP. It's not fair to limit the hdr length to inclu=
de
> 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 when "TX_PKT_SPLIT_RND", t=
he
> 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_SPLIT_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_flo=
w)
> > +                           if (tx_pkt_seg_lengths[0] < 42) {
> > +			err_log;
> > +			return false;
> > +		}
> > 		update_pkt_header(pkt, pkt_len);
>=20
> Yes, I didn't notice the updating for the UDP header, but the bug first o=
ccurs in
> this function 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.
>=20
> Here we expecting users should set minimum 42 byte for first segment seem=
s ok,
> But I think we putting the check in configuring the data space length of =
first
> segment is more graceful.

No. You didn't get my point. It's not graceful at all.
The segment fault will only happen when "TX_PKT_SPLIT_RND". Because the hdr=
 may take 2 segs while random nb_segs is only 1.
But if it's not "TX_PKT_SPLIT_RND", the current set_tx_pkt_segments() alrea=
dy make sure pkt_len is enough for 42.

So the only case you need to deal with is "TX_PKT_SPLIT_RND". And since "TX=
_PKT_SPLIT_RND" actually needs the first segment to be enough to contain 42=
 bytes.
And in cmd_set_txpkts_parsed, you may not get the configuration to know if =
it will be configured as "TX_PKT_SPLIT_RND". That's why you should check be=
fore update_pkt_header().

In this way, when it's NOT "TX_PKT_SPLIT_RND", it will maintain the old beh=
avior that hdrs may cross several segs which makes more sense.

>=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 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;
> > >  	}
> > >
> > > 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
> > > policy 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