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 D10B3A0C41; Tue, 7 Sep 2021 10:06:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB3074111D; Tue, 7 Sep 2021 10:05:10 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 3442C4113A; Tue, 7 Sep 2021 10:05:09 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10099"; a="242413542" X-IronPort-AV: E=Sophos;i="5.85,274,1624345200"; d="scan'208";a="242413542" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2021 01:05:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,274,1624345200"; d="scan'208";a="537822271" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 07 Sep 2021 01:05:07 -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; Tue, 7 Sep 2021 01:05:07 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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 via Frontend Transport; Tue, 7 Sep 2021 01:05:07 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.177) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Tue, 7 Sep 2021 01:05:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dL96/1xypmu+N4PvcZrvpT2WZDw651F2HrJJT33BmXmxKP1YbptlFdu1uRMWD8io/Crfzt7UfZx7PzUMpCyMtQQ0ZxNsbp6k0PAQVZYfBxO89b2V+pthWV3iTkdGmz4NcbeESjyNYdbY7XHsk/0CS0iTfeTlpvagZ6hpQfm7kMYXq0jQZqDZ8VJgUJvX9EAPtkspzlviKevOWtxQPbbiz+b8vrt+uHKvpn1HbH1ujAQ64fZbaxkqDrLGLwtih7X42KQmA/QGp3sUCqJHB91FoTRflKKqG02l3StiWOT165JitdqbH3m0oLTB2La30cJXvwmiNU+cKVxwH3qXnzpsFQ== 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=ALaT+o1bIwHHMJpKKvkcbmR517PWlFSNSCPWjq+/zOI=; b=Bryuuj9ayT90wtoEgLb6rFfN07s8EF4cMCmcGhx65TDc/XxNbVvobYsiTZJ9al1nCIBbj9mt41vR97tfEt0A/UHJYHSel4aFnyD7kINp4vT3lcyjKD7c0+sWWASVtz09Dqc24yKC7xoaesydM0SKjIpY68xmMRaZQKKWkz5rrQ99xs6LPM5GW8rrSqh3Iw/lERtlMvr2edgwYjnVGyIr2yUb2t95Q4Wz9rDzQAmyNw0urUYauHIxMMelEdN2c02+oHoyadZY/tXAq1yONJp669W4rerSbfeHa969Vr0jyLZYSSxcKo2RY6BgKicORUqNN0OvMoHZD88ZGp4I5cLBCQ== 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=ALaT+o1bIwHHMJpKKvkcbmR517PWlFSNSCPWjq+/zOI=; b=bymoYwS6J7enJA6I3V2DbCI4R+gAKuDzMmGvRUb3GKZzU/QipWCLs93glHyXzZXjf8a6Lcro+cIQ/S5/L3zLbEVDJDImUPJIzidSH0kWbXg11GgqL2ootQOQGU+23b/+U/Ulc8VdYtFGs/NuHLVjXpoP57JyLPmE/+nORPQPlR8= Received: from DM4PR11MB5534.namprd11.prod.outlook.com (2603:10b6:5:391::22) by DM6PR11MB3897.namprd11.prod.outlook.com (2603:10b6:5:4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.22; Tue, 7 Sep 2021 08:05:01 +0000 Received: from DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::a005:8ddd:725d:b6c2]) by DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::a005:8ddd:725d:b6c2%7]) with mapi id 15.20.4500.014; Tue, 7 Sep 2021 08:05:01 +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/2QC6uWofqggAArSICAAAungIABBo0AgAAOKrA= Date: Tue, 7 Sep 2021 08:05:01 +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: b6cc553a-6374-4212-dba2-08d971d63142 x-ms-traffictypediagnostic: DM6PR11MB3897: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tQKn1q32+o38f4CzCdxz05FkSEpWtWXYr9BX4iiV96gPm+i09tvWCpe3vf1/fdiRKNAJnEeFRMQXgP+CpVJLRkuOHOVo6g/qAmQgMyLHmEUuRaxnhm6gfTCPuohTZYwcvhuYTMRGKwTlAtLwbGGqnvCHy+FtF7nLm60HJrMXHnxHrfdzhip+wT64qiU7+/IAKRJZ73TmSaJiVisw7xE0xo0ImPQUIuuc9R8I6Ho9aBc9al88ujSuiEDUeVBo2GInxtuHJuXKyRnGwNplOnzeaZdZofQIJMdB2NioMeyl67cDEbgOLE0XdOam+Tobm3vPK/aI5zfIkL5h9XXBZbzZhTpstmhtwW0/55n0lb0JT12lJ6JqigLkZI1PQk1hevGWSQIqqTABd9xQ7/6e+kuAFElijTjEBxQ3zBJzVadxPNHsd8jdIlJ3F8/RpR6QoD8Wkk+bbjUjIEFEFVSaUW/Bv/L5pLEzojrlToJDqI/hPFKhnHRCicQYnV8untmwF1bmYMkKAyBT4D+7ZObkV9n3OgC78Vc7P587u3a/RWCUY7HcMhBBqFw93U4zP3tIiiuR5H/R7boubiDJIbkjdojyyGvbaD+unR9nu1fR/a+s4MeFXoS1TL9uXEboEHoKDrWCBAn7apHR3ZDwpJor/eRmtWCcJGfN8T7c2fwREST04PCFvyQA00N4xvgIQ3pBxew/oM004bP54nX0e1t4jYA9lQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5534.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(39860400002)(136003)(346002)(366004)(122000001)(8676002)(450100002)(76116006)(66556008)(38100700002)(8936002)(4326008)(55016002)(5660300002)(38070700005)(52536014)(64756008)(66446008)(83380400001)(2906002)(30864003)(316002)(66946007)(71200400001)(186003)(7696005)(54906003)(110136005)(478600001)(6636002)(26005)(33656002)(86362001)(6506007)(9686003)(53546011)(66476007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?r55PiBfsumr+zT3uS2PX8g+1WucDxIkQq/RGLWvmVmqOZwHdWJU1e50g8PMN?= =?us-ascii?Q?meSNmq3Qp8NEUZdeHxn9IrZH9JvGPtopjlCQrNeOHBVk+BIoEWvUhHhLIyKW?= =?us-ascii?Q?TNA0M3pQTCJFTw2414I7DD/horVjiySkYJsi/C/K4b4IQYRN+UCE7ZWdsO3N?= =?us-ascii?Q?cvrX4uSRUEfsxME2gjv/tAsom/eCcxotuWGms/mKSB/zzb6KGLPPi4rBvQzF?= =?us-ascii?Q?XUV++1Xc873/7pqxlpWDz2UXTkWjPWj1OBO4QxGl97mmsptPNDioIGmc4QHM?= =?us-ascii?Q?fyD0usNI2+qi7hMRVm9mMOtUSAKC6sB4p7VKDs7oUgpxK2ZaJGWd+QETTSns?= =?us-ascii?Q?oAKkEGcJ5hG6EnA4k/FGZC3pzCL6xbb6+SM7WeFrUQvI1BCvHHDMd2sV4CV6?= =?us-ascii?Q?qyi3uTw/ZKY968loi/xrdniSLEQ1nmBS6lhiVt0gY7DAUDi2jzSHynIa2xXu?= =?us-ascii?Q?xxoBxq/9tmI3YINNw5pmWHDRarE4Mg8QwWuULuHnnLeJ5fD2qaQopT6MYOrF?= =?us-ascii?Q?jDqGmOJ5dk9i8CpWgMBCVf7ZSdUlGv8XZp487ux6BPP3LvLOxRkfse6kdZTy?= =?us-ascii?Q?tWTgDJwRu88xWbLkdVq+B9ts70gpP3+BCBYXyeyzGCLHU+NOLKjX49wRwiCZ?= =?us-ascii?Q?WOR7gxkSwFJoLBvtc83UQ2OxuUmEPIGLeI+m0YiFOgEKeH6YR80nq4IJCRVV?= =?us-ascii?Q?BOGjWHkZC0sn2lOQv3dYvY2LyaUvAcmjZtJSoVIlUccIh92I+qG0+ZzE7YEZ?= =?us-ascii?Q?BE+Z2KjlamPh5dGXCkMQ6HK/XkAG0KoVJD7y1DDoMmnEyOqoYkmp2PjewSzT?= =?us-ascii?Q?mSta4QgoBqqiDX1v3II1yHmmOflHuiHmXBoyjC3k3nBlwBg8IyI6EYb27Qpl?= =?us-ascii?Q?Q/VfiIHSndYcuDa7KRennH+cLJK4ujSz90slhQ/Zrk+cDysyfKiRnZAhFo8N?= =?us-ascii?Q?8g4ojA8ZcvS4v7S9eyrkyF+tOkYYv3dPlwpSxaUoyL3+/nSojuivnd4Gvxo5?= =?us-ascii?Q?wv6KxiDgdpkIGP07zres4KEdoRnglO+xNybe7Doq7HbDcDYuADHk4bNHQRy2?= =?us-ascii?Q?RKXJXy5xGPkD/g2bGvq1JnJdTqj6m9swGVe/dSgCkMmWpeK+V6MNvaG5nLP4?= =?us-ascii?Q?HpW9cll1H4tNDAcE9/gdH9bp09lN1bSHgRn7KzEk6MR2ZSO9FuEhn9nizq/r?= =?us-ascii?Q?u2jt+QleInAgiUw5ZTmgy1AWQY7MfFtQJp71kYZMAEZfZuDHP4/H9Vq68fr5?= =?us-ascii?Q?d+gM/INgTl7pysoW4mTD0AtM3AZ8TS03ydVBB4UVB9oDQ0XUdHLCjtMjSdIC?= =?us-ascii?Q?W0k=3D?= 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: DM4PR11MB5534.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6cc553a-6374-4212-dba2-08d971d63142 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Sep 2021 08:05:01.1328 (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: q3g06p+w553ry8NfmX8FqKebXpRSakzm+9d1E6amlsuq8TMAWua2TwElbll35CEN3kqOky/bOx40btPDb+XqAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3897 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: Zhang, AlvinX > Sent: Tuesday, September 7, 2021 10:25 > To: Li, Xiaoyun ; Ananyev, Konstantin > > Cc: dev@dpdk.org; stable@dpdk.org > Subject: RE: [PATCH] app/testpmd: fix random number of Tx segments >=20 > > -----Original Message----- > > From: Li, Xiaoyun > > Sent: Monday, September 6, 2021 6:55 PM > > To: Zhang, AlvinX ; Ananyev, Konstantin > > > > Cc: dev@dpdk.org; stable@dpdk.org > > Subject: RE: [PATCH] app/testpmd: fix random number of Tx segments > > > > > > > > > -----Original Message----- > > > From: Zhang, AlvinX > > > Sent: Monday, September 6, 2021 18:04 > > > To: Li, Xiaoyun ; Ananyev, Konstantin > > > > > > Cc: dev@dpdk.org; stable@dpdk.org > > > Subject: RE: [PATCH] app/testpmd: fix random number of Tx segments > > > > > > > -----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 > > > > > > > > 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 > > > > > > > > > > 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 cr= ash. > > > > > > > > > > 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 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 > > > > 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 when > > > > "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_SPLIT_RND", update_pkt_header() should be > > > > called. And that function doesn't deal with header in multi-segment= s. > > > > I think there's bug here. > > > > > > > > So I think you should only add a check in pkt_burst_prepare() in tx= only(). > > > > 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); >=20 >=20 > As above, If user have below configuration, there will no one packet be s= ent out > and have lots and lots of repeated annoying logs. > testpmd> set fwd txonly > Set txonly packet forwarding mode > testpmd> set txpkts 40,64 > testpmd> set txsplit rand > testpmd> start > txonly packet forwarding - ports=3D1 - cores=3D1 - streams=3D4 - NUMA sup= port > enabled, MP allocation mode: native Logical Core 2 (socket 0) forwards pa= ckets > on 4 streams: > RX P=3D0/Q=3D0 (socket 0) -> TX P=3D0/Q=3D0 (socket 0) peer=3D02:00:00:= 00:00:00 > RX P=3D0/Q=3D1 (socket 0) -> TX P=3D0/Q=3D1 (socket 0) peer=3D02:00:00:= 00:00:00 > RX P=3D0/Q=3D2 (socket 0) -> TX P=3D0/Q=3D2 (socket 0) peer=3D02:00:00:= 00:00:00 > RX P=3D0/Q=3D3 (socket 0) -> TX P=3D0/Q=3D3 (socket 0) peer=3D02:00:00:= 00:00:00 >=20 > txonly packet forwarding packets/burst=3D32 > packet len=3D104 - nb packet segments=3D2 > nb forwarding cores=3D1 - nb forwarding ports=3D1 > port 0: RX queue number: 4 Tx queue number: 4 > Rx offloads=3D0x0 Tx offloads=3D0x10000 > RX queue: 0 > RX desc=3D1024 - RX free threshold=3D32 > RX threshold registers: pthresh=3D0 hthresh=3D0 wthresh=3D0 > RX Offloads=3D0x0 > TX queue: 0 > TX desc=3D1024 - TX free threshold=3D32 > TX threshold registers: pthresh=3D32 hthresh=3D0 wthresh=3D0 > TX offloads=3D0x10000 - TX RS bit threshold=3D32 tx_pkt_seg_lengths= [0] must > bigger than 41 bytes tetx_pkt_seg_lengths[0] must bigger than 41 bytes > stpmd> tx_pkt_seg_lengths[0] must bigger than 41 bytes > tx_pkt_seg_lengths[0] must bigger than 41 bytes tx_pkt_seg_lengths[0] mus= t > bigger than 41 bytes tx_pkt_seg_lengths[0] must bigger than 41 bytes > tx_pkt_seg_lengths[0] must bigger than 41 bytes tx_pkt_seg_lengths[0] mus= t > bigger than 41 bytes tx_pkt_seg_lengths[0] must bigger than 41 bytes > tx_pkt_seg_lengths[0] must bigger than 41 bytes tx_pkt_seg_lengths[0] mus= t > bigger than 41 bytes tx_pkt_seg_lengths[0] must bigger than 41 bytes > tx_pkt_seg_lengths[0] must bigger than 41 bytes tx_pkt_seg_lengths[0] mus= t > bigger than 41 bytes tx_pkt_seg_lengths[0] must bigger than 41 bytes > tx_pkt_seg_lengths[0] must bigger than 41 bytes tx_pkt_seg_lengths[0] mus= t > bigger than 41 bytes tx_pkt_seg_lengths[0] must bigger than 41 bytes > tx_pkt_seg_lengths[0] must bigger than 41 bytes tx_pkt_seg_lengths[0] mus= t > bigger than 41 bytes tx_pkt_seg_lengths[0] must bigger than 41 bytes > tx_pkt_seg_lengths[0] must bigger than 41 bytes tx_pkt_seg_lengths[0] mus= t > bigger than 41 bytes tx_pkt_seg_lengths[0] must bigger than 41 bytes > tx_pkt_seg_lengths[0] must bigger than 41 bytes ... > ... > testpmd> stop > Telling cores to stop... > Waiting for lcores to finish... >=20 > ---------------------- Forward statistics for port 0 -----------------= ----- > RX-packets: 0 RX-dropped: 0 RX-total: 0 > TX-packets: 0 TX-dropped: 0 TX-total: 0 > -----------------------------------------------------------------------= ----- >=20 > +++++++++++++++ Accumulated forward statistics for all > ports+++++++++++++++ > RX-packets: 0 RX-dropped: 0 RX-total: 0 > TX-packets: 0 TX-dropped: 0 TX-total: 0 >=20 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++++++++ >=20 > By the way, if multi flow was enabled, the ip header also will be updated= , so we > should put the check before below codes. >=20 > if (txonly_multi_flow) { > uint8_t ip_var =3D RTE_PER_LCORE(_ip_var); > struct rte_ipv4_hdr *ip_hdr; > uint32_t addr; >=20 > ip_hdr =3D rte_pktmbuf_mtod_offset(pkt, > struct rte_ipv4_hdr *, > sizeof(struct rte_ether_hdr)); > /* > * Generate multiple flows by varying IP src addr. This > * enables packets are well distributed by RSS in > * receiver side if any and txonly mode can be a decent > * packet generator for developer's quick performance > * regression test. > */ > addr =3D (tx_ip_dst_addr | (ip_var++ << 8)) + rte_lcore_id(); > ip_hdr->src_addr =3D rte_cpu_to_be_32(addr); > RTE_PER_LCORE(_ip_var) =3D ip_var; > } >=20 Yes. No matter where you put the check in txonly, there'll be annoying prin= t. Tricky. I can only think of 2 solutions: 1. If needs to update hdr (ip or udp) and first seg len < 42, copy pkt_ip_h= dr and pkt_udp_hdr to a temp value, update the temp value and use copy_buf_= to_pkt() to copy the tmp hdr to segs. And other cases keep the original code in case perf drop. Also, This one ne= eds to keep your min_segs design. The shortcoming is it's quite complicated change. 2. Force the first segment length is over 42 bytes in set_tx_pkt_segments() This way is very simple but the shortcoming is the limit usage and you prob= ably need to add a notice in doc to tell users this change. > > > > > > Yes, I didn't notice the updating for the UDP header, but the bug > > > first occurs 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. > > > > > > 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 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() > > already 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 before update_pkt_header(). > > > > In this way, when it's NOT "TX_PKT_SPLIT_RND", it will maintain the > > old behavior that hdrs may cross several segs which makes more sense. > > > > > > > > > > > > > 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