From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yskoh@mellanox.com>
Received: from EUR04-DB3-obe.outbound.protection.outlook.com
 (mail-eopbgr60057.outbound.protection.outlook.com [40.107.6.57])
 by dpdk.org (Postfix) with ESMTP id 0F55E3256
 for <dev@dpdk.org>; Thu, 28 Mar 2019 18:33:09 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=ohLKMGMZ1fESKa5SSKrgVRKmxlvJxhHx92oAquMRlvY=;
 b=XGvJR61FoBpbANr0tNuV84fXjtXr2LigBVwmO6+fLjDiGUFW/LPSzzeJ9kY77LcBGXHYJFxeW6UfxdhOmbUJIw7oamyhYbh34sW4Jptnw9iXkgXkQuUT5+6APuSnMu7/qN6nQlf5G1oyf3mVFgoGds3q9vXuaNUNda/3w3uXVis=
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by
 DB3PR0502MB3948.eurprd05.prod.outlook.com (52.134.72.19) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1750.17; Thu, 28 Mar 2019 17:33:06 +0000
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::6072:43be:7c2d:103a]) by DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::6072:43be:7c2d:103a%3]) with mapi id 15.20.1750.014; Thu, 28 Mar 2019
 17:33:06 +0000
From: Yongseok Koh <yskoh@mellanox.com>
To: "Iremonger, Bernard" <bernard.iremonger@intel.com>
CC: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, "Wu, Jingjing"
 <jingjing.wu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>, "jerinj@marvell.com"
 <jerinj@marvell.com>, "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Thread-Topic: [dpdk-dev] [PATCH v3] app/testpmd: make txonly mode generate
 multiple flows
Thread-Index: AQHU5VB9l5IQbcyqW0WiW4bQbvJDvaYhTfcA
Date: Thu, 28 Mar 2019 17:33:05 +0000
Message-ID: <9F463721-2837-4B4B-B098-34E58BDE3421@mellanox.com>
References: <20171215211125.39177-1-yskoh@mellanox.com>
 <20190328015102.21920-1-yskoh@mellanox.com>
 <8CEF83825BEC744B83065625E567D7C260D775EF@IRSMSX108.ger.corp.intel.com>
In-Reply-To: <8CEF83825BEC744B83065625E567D7C260D775EF@IRSMSX108.ger.corp.intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=yskoh@mellanox.com; 
x-originating-ip: [69.181.245.183]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: fc5f4199-76e5-4aca-93b6-08d6b3a37025
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);
 SRVR:DB3PR0502MB3948; 
x-ms-traffictypediagnostic: DB3PR0502MB3948:
x-microsoft-antispam-prvs: <DB3PR0502MB3948FFB8671FE81212882935C3590@DB3PR0502MB3948.eurprd05.prod.outlook.com>
x-forefront-prvs: 0990C54589
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(346002)(136003)(39860400002)(396003)(376002)(366004)(13464003)(199004)(189003)(97736004)(316002)(8936002)(6512007)(36756003)(229853002)(7736002)(86362001)(4326008)(14454004)(99286004)(256004)(14444005)(54906003)(81166006)(81156014)(6246003)(53936002)(68736007)(71190400001)(83716004)(105586002)(66066001)(33656002)(478600001)(11346002)(305945005)(446003)(2616005)(106356001)(486006)(25786009)(476003)(5660300002)(2906002)(53546011)(186003)(102836004)(6506007)(6436002)(6916009)(76176011)(82746002)(6486002)(3846002)(26005)(6116002)(71200400001);
 DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3948;
 H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: mellanox.com does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: qaH6JbnG61F0i1zydCF2xojm0Qr711Iw5ZzneJMDUQ64pWRAbC0xXWWWFxKyMdKDSphQFF71KHTvyT29PwRvxWlYLq315c7oKNDqOPDghPhkNiWZ9oM8iiEpOXZUoZgXSYzMI/Br4yGQDNc9+OjVo5D8Feh13WSsz6K4Kwbzd4PoPLPOho51scVfA9Haap1wqFq7hxrhi+vYojnYFZWVqYTJPEBDchf7BETZje457ZQawsCsuTHiZZPKsbWi95cpOF126+7ru9JVGWzA6vURGi90G27zYXsMNZSVHIQPztHh8Cc0Hp1USUJ9+WS4kvyXOujz4FoylIfiWce5YZO4IROlZtnc1SBmhmmTuRiME+/nzT9Lk1mpfjRuO3Rk+VkbnGvCSeQOFShofZA+F822OIqwdoxoCEIi5G/vCcmj654=
Content-Type: text/plain; charset="us-ascii"
Content-ID: <2D7C1092AE53FA4BAE131A29D5AE249C@eurprd05.prod.outlook.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: Mellanox.com
X-MS-Exchange-CrossTenant-Network-Message-Id: fc5f4199-76e5-4aca-93b6-08d6b3a37025
X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Mar 2019 17:33:06.0084 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3948
Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: make txonly mode
	generate	multiple flows
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Mar 2019 17:33:09 -0000


> On Mar 28, 2019, at 3:24 AM, Iremonger, Bernard <bernard.iremonger@intel.=
com> wrote:
>=20
> Hi Yongseok,
>=20
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yongseok Koh
>> Sent: Thursday, March 28, 2019 1:51 AM
>> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
>> <jingjing.wu@intel.com>
>> Cc: dev@dpdk.org; jerinj@marvell.com; Ananyev, Konstantin
>> <konstantin.ananyev@intel.com>
>> Subject: [dpdk-dev] [PATCH v3] app/testpmd: make txonly mode generate
>> multiple flows
>>=20
>> Testpmd can generate multiple flows without taking much cost and this co=
uld
>> be a simple traffic generator for developer's quick tests. If "--txonly-=
multi-
>> flow" is specified in the command line, IP source address is varied to g=
nerate
>> multiple flows.
>>=20
>> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
>> ---
>>=20
>> v3:
>> * Add "--txonly-multi-flow" param to enable the feature.
>> * Replace __thread with RTE_PER_LCORE.
>>=20
>> v2:
>> * Add detailed explanation in a comment.
>>=20
>> app/test-pmd/parameters.c             |  4 ++++
>> app/test-pmd/testpmd.c                |  3 +++
>> app/test-pmd/testpmd.h                |  2 ++
>> app/test-pmd/txonly.c                 | 22 ++++++++++++++++++++++
>> doc/guides/testpmd_app_ug/run_app.rst |  4 ++++
>> 5 files changed, 35 insertions(+)
>>=20
>> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index
>> 38b419767b..7b6b60905d 100644
>> --- a/app/test-pmd/parameters.c
>> +++ b/app/test-pmd/parameters.c
>> @@ -173,6 +173,7 @@ usage(char* progname)
>> 	       " Used mainly with PCAP drivers.\n");
>> 	printf("  --txpkts=3DX[,Y]*: set TX segment sizes"
>> 		" or total packet length.\n");
>> +	printf("  --txonly-multi-flow: generate multiple flows in txonly
>> +mode\n");
>> 	printf("  --disable-link-check: disable check on link status when "
>> 	       "starting/stopping ports.\n");
>> 	printf("  --no-lsc-interrupt: disable link status change interrupt.\n")=
;
>> @@ -632,6 +633,7 @@ launch_args_parse(int argc, char** argv)
>> 		{ "no-flush-rx",	0, 0, 0 },
>> 		{ "flow-isolate-all",	        0, 0, 0 },
>> 		{ "txpkts",			1, 0, 0 },
>> +		{ "txonly-multi-flow",		0, 0, 0 },
>> 		{ "disable-link-check",		0, 0, 0 },
>> 		{ "no-lsc-interrupt",		0, 0, 0 },
>> 		{ "no-rmv-interrupt",		0, 0, 0 },
>> @@ -1141,6 +1143,8 @@ launch_args_parse(int argc, char** argv)
>> 				else
>> 					rte_exit(EXIT_FAILURE, "bad
>> txpkts\n");
>> 			}
>> +			if (!strcmp(lgopts[opt_idx].name, "txonly-multi-
>> flow"))
>> +				txonly_multi_flow =3D 1;
>> 			if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
>> 				no_flush_rx =3D 1;
>> 			if (!strcmp(lgopts[opt_idx].name, "disable-link-
>> check")) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>> index 216be47f92..b950e8cc55 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -217,6 +217,9 @@ uint8_t  tx_pkt_nb_segs =3D 1; /**< Number of
>> segments in TXONLY packets */  enum tx_pkt_split tx_pkt_split =3D
>> TX_PKT_SPLIT_OFF;  /**< Split policy for packets to TX. */
>>=20
>> +int txonly_multi_flow;
>=20
> This should be "uint8_t  txonly_multi_flow;" similar to other variables i=
n use,
> for example "uint8_t no_flush_rx =3D 0;"
>=20
>> +/**< Whether multiple flows are generated in TXONLY mode. */
>> +
>> uint16_t nb_pkt_per_burst =3D DEF_PKT_BURST; /**< Number of packets per
>> burst. */  uint16_t mb_mempool_cache =3D DEF_MBUF_CACHE; /**< Size of
>> mbuf mempool cache. */
>>=20
>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index
>> 85b791b6bb..668227bc55 100644
>> --- a/app/test-pmd/testpmd.h
>> +++ b/app/test-pmd/testpmd.h
>> @@ -439,6 +439,8 @@ enum tx_pkt_split {
>>=20
>> extern enum tx_pkt_split tx_pkt_split;
>>=20
>> +extern int txonly_multi_flow;
>=20
> This should be "extern uint8_t txonly_multi_flow;" in line with the simil=
ar variables in use,
> For example  "extern uint8_t no_flush_rx;"

Okay, will change it to uint8_t but what about the error by checkpatches.sh=
?

	+ ./devtools/checkpatches.sh -n1

	### app/testpmd: make txonly mode generate multiple flows

	ERROR:GLOBAL_INITIALISERS: do not initialise globals to 0
	#50: FILE: app/test-pmd/testpmd.c:220:
	+uint8_t txonly_multi_flow =3D 0;

	total: 1 errors, 0 warnings, 95 lines checked

	0/1 valid patch

I'll submit without the init but if you still insist that way for consisten=
cy,
let me know then I'll submit another version.

Thanks,
Yongseok

>=20
>> +
>> extern uint16_t nb_pkt_per_burst;
>> extern uint16_t mb_mempool_cache;
>> extern int8_t rx_pthresh;
>> diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index
>> 1f08b6ed37..def52a0487 100644
>> --- a/app/test-pmd/txonly.c
>> +++ b/app/test-pmd/txonly.c
>> @@ -52,6 +52,7 @@
>> #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
>>=20
>> static struct ipv4_hdr  pkt_ip_hdr;  /**< IP header of transmitted packe=
ts. */
>> +RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */
>> static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted
>> packets. */
>>=20
>> static void
>> @@ -164,6 +165,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
>> 	uint16_t vlan_tci, vlan_tci_outer;
>> 	uint32_t retry;
>> 	uint64_t ol_flags =3D 0;
>> +	uint8_t  ip_var =3D RTE_PER_LCORE(_ip_var);
>> 	uint8_t  i;
>> 	uint64_t tx_offloads;
>> #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
>> @@ -237,6 +239,23 @@ pkt_burst_transmit(struct fwd_stream *fs)
>> 		copy_buf_to_pkt(&eth_hdr, sizeof(eth_hdr), pkt, 0);
>> 		copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt,
>> 				sizeof(struct ether_hdr));
>> +		if (txonly_multi_flow) {
>> +			struct ipv4_hdr *ip_hdr;
>> +			uint32_t addr;
>> +
>> +			ip_hdr =3D rte_pktmbuf_mtod_offset(pkt,
>> +					struct ipv4_hdr *,
>> +					sizeof(struct 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 (IP_DST_ADDR | (ip_var++ << 8)) +
>> rte_lcore_id();
>> +			ip_hdr->src_addr =3D rte_cpu_to_be_32(addr);
>> +		}
>> 		copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt,
>> 				sizeof(struct ether_hdr) +
>> 				sizeof(struct ipv4_hdr));
>> @@ -268,6 +287,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
>> 	}
>> 	fs->tx_packets +=3D nb_tx;
>>=20
>> +	if (txonly_multi_flow)
>> +		RTE_PER_LCORE(_ip_var) +=3D nb_tx;
>> +
>> #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
>> 	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
>> #endif
>> diff --git a/doc/guides/testpmd_app_ug/run_app.rst
>> b/doc/guides/testpmd_app_ug/run_app.rst
>> index 4495ed0382..b717b8c7b7 100644
>> --- a/doc/guides/testpmd_app_ug/run_app.rst
>> +++ b/doc/guides/testpmd_app_ug/run_app.rst
>> @@ -324,6 +324,10 @@ The commandline options are:
>>     Set TX segment sizes or total packet length. Valid for ``tx-only``
>>     and ``flowgen`` forwarding modes.
>>=20
>> +*   ``--txonly-multi-flow``
>> +
>> +    Generate multiple flows in txonly mode.
>> +
>> *   ``--disable-link-check``
>>=20
>>     Disable check on link status when starting/stopping ports.
>> --
>> 2.11.0

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 229D9A0679
	for <public@inbox.dpdk.org>; Thu, 28 Mar 2019 18:33:12 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id B92FF1B3B6;
	Thu, 28 Mar 2019 18:33:10 +0100 (CET)
Received: from EUR04-DB3-obe.outbound.protection.outlook.com
 (mail-eopbgr60057.outbound.protection.outlook.com [40.107.6.57])
 by dpdk.org (Postfix) with ESMTP id 0F55E3256
 for <dev@dpdk.org>; Thu, 28 Mar 2019 18:33:09 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=ohLKMGMZ1fESKa5SSKrgVRKmxlvJxhHx92oAquMRlvY=;
 b=XGvJR61FoBpbANr0tNuV84fXjtXr2LigBVwmO6+fLjDiGUFW/LPSzzeJ9kY77LcBGXHYJFxeW6UfxdhOmbUJIw7oamyhYbh34sW4Jptnw9iXkgXkQuUT5+6APuSnMu7/qN6nQlf5G1oyf3mVFgoGds3q9vXuaNUNda/3w3uXVis=
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by
 DB3PR0502MB3948.eurprd05.prod.outlook.com (52.134.72.19) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1750.17; Thu, 28 Mar 2019 17:33:06 +0000
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::6072:43be:7c2d:103a]) by DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::6072:43be:7c2d:103a%3]) with mapi id 15.20.1750.014; Thu, 28 Mar 2019
 17:33:06 +0000
From: Yongseok Koh <yskoh@mellanox.com>
To: "Iremonger, Bernard" <bernard.iremonger@intel.com>
CC: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, "Wu, Jingjing"
 <jingjing.wu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>, "jerinj@marvell.com"
 <jerinj@marvell.com>, "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Thread-Topic: [dpdk-dev] [PATCH v3] app/testpmd: make txonly mode generate
 multiple flows
Thread-Index: AQHU5VB9l5IQbcyqW0WiW4bQbvJDvaYhTfcA
Date: Thu, 28 Mar 2019 17:33:05 +0000
Message-ID: <9F463721-2837-4B4B-B098-34E58BDE3421@mellanox.com>
References: <20171215211125.39177-1-yskoh@mellanox.com>
 <20190328015102.21920-1-yskoh@mellanox.com>
 <8CEF83825BEC744B83065625E567D7C260D775EF@IRSMSX108.ger.corp.intel.com>
In-Reply-To: <8CEF83825BEC744B83065625E567D7C260D775EF@IRSMSX108.ger.corp.intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=yskoh@mellanox.com; 
x-originating-ip: [69.181.245.183]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: fc5f4199-76e5-4aca-93b6-08d6b3a37025
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);
 SRVR:DB3PR0502MB3948; 
x-ms-traffictypediagnostic: DB3PR0502MB3948:
x-microsoft-antispam-prvs: <DB3PR0502MB3948FFB8671FE81212882935C3590@DB3PR0502MB3948.eurprd05.prod.outlook.com>
x-forefront-prvs: 0990C54589
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(346002)(136003)(39860400002)(396003)(376002)(366004)(13464003)(199004)(189003)(97736004)(316002)(8936002)(6512007)(36756003)(229853002)(7736002)(86362001)(4326008)(14454004)(99286004)(256004)(14444005)(54906003)(81166006)(81156014)(6246003)(53936002)(68736007)(71190400001)(83716004)(105586002)(66066001)(33656002)(478600001)(11346002)(305945005)(446003)(2616005)(106356001)(486006)(25786009)(476003)(5660300002)(2906002)(53546011)(186003)(102836004)(6506007)(6436002)(6916009)(76176011)(82746002)(6486002)(3846002)(26005)(6116002)(71200400001);
 DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3948;
 H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: mellanox.com does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: qaH6JbnG61F0i1zydCF2xojm0Qr711Iw5ZzneJMDUQ64pWRAbC0xXWWWFxKyMdKDSphQFF71KHTvyT29PwRvxWlYLq315c7oKNDqOPDghPhkNiWZ9oM8iiEpOXZUoZgXSYzMI/Br4yGQDNc9+OjVo5D8Feh13WSsz6K4Kwbzd4PoPLPOho51scVfA9Haap1wqFq7hxrhi+vYojnYFZWVqYTJPEBDchf7BETZje457ZQawsCsuTHiZZPKsbWi95cpOF126+7ru9JVGWzA6vURGi90G27zYXsMNZSVHIQPztHh8Cc0Hp1USUJ9+WS4kvyXOujz4FoylIfiWce5YZO4IROlZtnc1SBmhmmTuRiME+/nzT9Lk1mpfjRuO3Rk+VkbnGvCSeQOFShofZA+F822OIqwdoxoCEIi5G/vCcmj654=
Content-Type: text/plain; charset="UTF-8"
Content-ID: <2D7C1092AE53FA4BAE131A29D5AE249C@eurprd05.prod.outlook.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: Mellanox.com
X-MS-Exchange-CrossTenant-Network-Message-Id: fc5f4199-76e5-4aca-93b6-08d6b3a37025
X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Mar 2019 17:33:06.0084 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3948
Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: make txonly mode
	generate	multiple flows
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190328173305.QfQBD40AKVLVtDHYKb_8pfCpy6C_v9S_fLIiSi8wiLY@z>


> On Mar 28, 2019, at 3:24 AM, Iremonger, Bernard <bernard.iremonger@intel.=
com> wrote:
>=20
> Hi Yongseok,
>=20
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yongseok Koh
>> Sent: Thursday, March 28, 2019 1:51 AM
>> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
>> <jingjing.wu@intel.com>
>> Cc: dev@dpdk.org; jerinj@marvell.com; Ananyev, Konstantin
>> <konstantin.ananyev@intel.com>
>> Subject: [dpdk-dev] [PATCH v3] app/testpmd: make txonly mode generate
>> multiple flows
>>=20
>> Testpmd can generate multiple flows without taking much cost and this co=
uld
>> be a simple traffic generator for developer's quick tests. If "--txonly-=
multi-
>> flow" is specified in the command line, IP source address is varied to g=
nerate
>> multiple flows.
>>=20
>> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
>> ---
>>=20
>> v3:
>> * Add "--txonly-multi-flow" param to enable the feature.
>> * Replace __thread with RTE_PER_LCORE.
>>=20
>> v2:
>> * Add detailed explanation in a comment.
>>=20
>> app/test-pmd/parameters.c             |  4 ++++
>> app/test-pmd/testpmd.c                |  3 +++
>> app/test-pmd/testpmd.h                |  2 ++
>> app/test-pmd/txonly.c                 | 22 ++++++++++++++++++++++
>> doc/guides/testpmd_app_ug/run_app.rst |  4 ++++
>> 5 files changed, 35 insertions(+)
>>=20
>> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index
>> 38b419767b..7b6b60905d 100644
>> --- a/app/test-pmd/parameters.c
>> +++ b/app/test-pmd/parameters.c
>> @@ -173,6 +173,7 @@ usage(char* progname)
>> 	       " Used mainly with PCAP drivers.\n");
>> 	printf("  --txpkts=3DX[,Y]*: set TX segment sizes"
>> 		" or total packet length.\n");
>> +	printf("  --txonly-multi-flow: generate multiple flows in txonly
>> +mode\n");
>> 	printf("  --disable-link-check: disable check on link status when "
>> 	       "starting/stopping ports.\n");
>> 	printf("  --no-lsc-interrupt: disable link status change interrupt.\n")=
;
>> @@ -632,6 +633,7 @@ launch_args_parse(int argc, char** argv)
>> 		{ "no-flush-rx",	0, 0, 0 },
>> 		{ "flow-isolate-all",	        0, 0, 0 },
>> 		{ "txpkts",			1, 0, 0 },
>> +		{ "txonly-multi-flow",		0, 0, 0 },
>> 		{ "disable-link-check",		0, 0, 0 },
>> 		{ "no-lsc-interrupt",		0, 0, 0 },
>> 		{ "no-rmv-interrupt",		0, 0, 0 },
>> @@ -1141,6 +1143,8 @@ launch_args_parse(int argc, char** argv)
>> 				else
>> 					rte_exit(EXIT_FAILURE, "bad
>> txpkts\n");
>> 			}
>> +			if (!strcmp(lgopts[opt_idx].name, "txonly-multi-
>> flow"))
>> +				txonly_multi_flow =3D 1;
>> 			if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
>> 				no_flush_rx =3D 1;
>> 			if (!strcmp(lgopts[opt_idx].name, "disable-link-
>> check")) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>> index 216be47f92..b950e8cc55 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -217,6 +217,9 @@ uint8_t  tx_pkt_nb_segs =3D 1; /**< Number of
>> segments in TXONLY packets */  enum tx_pkt_split tx_pkt_split =3D
>> TX_PKT_SPLIT_OFF;  /**< Split policy for packets to TX. */
>>=20
>> +int txonly_multi_flow;
>=20
> This should be "uint8_t  txonly_multi_flow;" similar to other variables i=
n use,
> for example "uint8_t no_flush_rx =3D 0;"
>=20
>> +/**< Whether multiple flows are generated in TXONLY mode. */
>> +
>> uint16_t nb_pkt_per_burst =3D DEF_PKT_BURST; /**< Number of packets per
>> burst. */  uint16_t mb_mempool_cache =3D DEF_MBUF_CACHE; /**< Size of
>> mbuf mempool cache. */
>>=20
>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index
>> 85b791b6bb..668227bc55 100644
>> --- a/app/test-pmd/testpmd.h
>> +++ b/app/test-pmd/testpmd.h
>> @@ -439,6 +439,8 @@ enum tx_pkt_split {
>>=20
>> extern enum tx_pkt_split tx_pkt_split;
>>=20
>> +extern int txonly_multi_flow;
>=20
> This should be "extern uint8_t txonly_multi_flow;" in line with the simil=
ar variables in use,
> For example  "extern uint8_t no_flush_rx;"

Okay, will change it to uint8_t but what about the error by checkpatches.sh=
?

	+ ./devtools/checkpatches.sh -n1

	### app/testpmd: make txonly mode generate multiple flows

	ERROR:GLOBAL_INITIALISERS: do not initialise globals to 0
	#50: FILE: app/test-pmd/testpmd.c:220:
	+uint8_t txonly_multi_flow =3D 0;

	total: 1 errors, 0 warnings, 95 lines checked

	0/1 valid patch

I'll submit without the init but if you still insist that way for consisten=
cy,
let me know then I'll submit another version.

Thanks,
Yongseok

>=20
>> +
>> extern uint16_t nb_pkt_per_burst;
>> extern uint16_t mb_mempool_cache;
>> extern int8_t rx_pthresh;
>> diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index
>> 1f08b6ed37..def52a0487 100644
>> --- a/app/test-pmd/txonly.c
>> +++ b/app/test-pmd/txonly.c
>> @@ -52,6 +52,7 @@
>> #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
>>=20
>> static struct ipv4_hdr  pkt_ip_hdr;  /**< IP header of transmitted packe=
ts. */
>> +RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */
>> static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted
>> packets. */
>>=20
>> static void
>> @@ -164,6 +165,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
>> 	uint16_t vlan_tci, vlan_tci_outer;
>> 	uint32_t retry;
>> 	uint64_t ol_flags =3D 0;
>> +	uint8_t  ip_var =3D RTE_PER_LCORE(_ip_var);
>> 	uint8_t  i;
>> 	uint64_t tx_offloads;
>> #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
>> @@ -237,6 +239,23 @@ pkt_burst_transmit(struct fwd_stream *fs)
>> 		copy_buf_to_pkt(&eth_hdr, sizeof(eth_hdr), pkt, 0);
>> 		copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt,
>> 				sizeof(struct ether_hdr));
>> +		if (txonly_multi_flow) {
>> +			struct ipv4_hdr *ip_hdr;
>> +			uint32_t addr;
>> +
>> +			ip_hdr =3D rte_pktmbuf_mtod_offset(pkt,
>> +					struct ipv4_hdr *,
>> +					sizeof(struct 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 (IP_DST_ADDR | (ip_var++ << 8)) +
>> rte_lcore_id();
>> +			ip_hdr->src_addr =3D rte_cpu_to_be_32(addr);
>> +		}
>> 		copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt,
>> 				sizeof(struct ether_hdr) +
>> 				sizeof(struct ipv4_hdr));
>> @@ -268,6 +287,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
>> 	}
>> 	fs->tx_packets +=3D nb_tx;
>>=20
>> +	if (txonly_multi_flow)
>> +		RTE_PER_LCORE(_ip_var) +=3D nb_tx;
>> +
>> #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
>> 	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
>> #endif
>> diff --git a/doc/guides/testpmd_app_ug/run_app.rst
>> b/doc/guides/testpmd_app_ug/run_app.rst
>> index 4495ed0382..b717b8c7b7 100644
>> --- a/doc/guides/testpmd_app_ug/run_app.rst
>> +++ b/doc/guides/testpmd_app_ug/run_app.rst
>> @@ -324,6 +324,10 @@ The commandline options are:
>>     Set TX segment sizes or total packet length. Valid for ``tx-only``
>>     and ``flowgen`` forwarding modes.
>>=20
>> +*   ``--txonly-multi-flow``
>> +
>> +    Generate multiple flows in txonly mode.
>> +
>> *   ``--disable-link-check``
>>=20
>>     Disable check on link status when starting/stopping ports.
>> --
>> 2.11.0