From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0078.outbound.protection.outlook.com [104.47.2.78]) by dpdk.org (Postfix) with ESMTP id 6901B1B4FA for ; Tue, 26 Jun 2018 13:51:20 +0200 (CEST) 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=dWo0oqagvxSOD0P7wFiRUyL0y7e1J+QTi5XDtzvZ0c0=; b=pJBD2aj1BGt18WZ7Z51HWsp5wrHNOiFeGp6C888YpL5WTF9JDrxMtdl10DAJcU8vZhrEg8YZdgnOP8jtV7wwwqPWs6nHZLz3sx/WSTJEid9nppWaTjUcddwawX+EmzccxskfR56Bu5xTOf8lm7mJYQEPQZnpU1hMqJtX54UBz+4= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4827.eurprd05.prod.outlook.com (20.176.235.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.21; Tue, 26 Jun 2018 11:51:07 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::4c94:2db9:b8c5:cc6b]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::4c94:2db9:b8c5:cc6b%5]) with mapi id 15.20.0884.025; Tue, 26 Jun 2018 11:51:07 +0000 From: Shahaf Shuler To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Thread-Index: AQHUB0xhtSTyjIjkuUSKRiIatsd69qRyeD6A Date: Tue, 26 Jun 2018 11:51:07 +0000 Message-ID: References: <20180618213557.15209-1-stephen@networkplumber.org> <20180618213557.15209-2-stephen@networkplumber.org> In-Reply-To: <20180618213557.15209-2-stephen@networkplumber.org> 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=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4827; 7:sEE75sdU5Ym/SXDru01lG7Rwykwk3AyPfg3lToyXHyMWZwjkUjr45PTfCo55Avi1DEXN2tjqkTi0k0uTbKiyvKPOyo1nzs9yIIOXwnf5eotJ4YBvzJR8GTRu+BSxWRUX2iKKMS217FrcPfE0P6ngYKfR/lIfRTOZwdtEwMaG9NTFDIhjdunuxDxQvqII7sno1c6Ampcpb0u2lv0XuzVBanrXvcN/KN422Zp1TB8T2x1Ob8wFLr5+uzaouZMs/DvC x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 81dcb38c-efdf-417a-a7e0-08d5db5b1a94 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4827; x-ms-traffictypediagnostic: DB7PR05MB4827: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4827; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4827; x-forefront-prvs: 071518EF63 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(136003)(39860400002)(396003)(199004)(189003)(2900100001)(66066001)(74316002)(6116002)(186003)(106356001)(305945005)(7736002)(110136005)(86362001)(486006)(97736004)(105586002)(53936002)(81156014)(316002)(3846002)(25786009)(99286004)(26005)(81166006)(5250100002)(2501003)(6506007)(478600001)(9686003)(102836004)(7696005)(11346002)(76176011)(6246003)(33656002)(8936002)(476003)(5660300001)(6436002)(229853002)(446003)(2906002)(55016002)(68736007)(14454004)(14444005)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4827; H:DB7PR05MB4426.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-microsoft-antispam-message-info: nS/WwQ0ncXl3NvszPN3nasF2Av0g8fDlJ733WPuNAkRzZ8do4hN0QI91+tRzgarMIB6TpIx/JICgnt4rlQuyMqqOXyG7szy0+QzNJTzGUFJEMf6RRK6LsPP6QlnluCTSKmeIO5VWznfU5CnvpE3USaIXQ5THYHdWp+Zyh/En9gcaTdgFF1jbgpHtRyPMp/A4pa0iqcG71ksC3TnzuMZJyz7bFut3lBd6CTcOWKHi+YM4+Lduq1a/K6klLttdQHktNTPwNeQ/nruwsuGvLMzltfAUvj5KrIuIFtpDq9NJTyx/lGHu2FEyRk6gQxUEdQL/wI00QNwqg52Q9i6yyeJyZ1NH6r7YrCIZs0Woei3JCSQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81dcb38c-efdf-417a-a7e0-08d5db5b1a94 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jun 2018 11:51:07.6239 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4827 Subject: Re: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2018 11:51:20 -0000 Hi Stephan,=20 Tuesday, June 19, 2018 12:36 AM, Stephen Hemminger: > Subject: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and = UDP > parameters >=20 > Use RFC standard values for Tx only test as defaults. > But let the user override those values on command line. I think it is a good flexibility to add to testpmd for testing purposes.=20 Wondering if we can expend this one a bit more for the user to configure a = range of udp/tcp ports and ip src/dst addresses which will be transmitted i= n a round robin fashion by the application.=20 We don't need testpmd to be full blown packet generator, but sending range = of 5 tuple can much help when testing RSS/single core performance.=20 >=20 > Signed-off-by: Stephen Hemminger > --- > app/test-pmd/parameters.c | 49 +++++++++++++++++++++++++++ > app/test-pmd/testpmd.h | 6 ++++ > app/test-pmd/txonly.c | 18 +++++----- > doc/guides/testpmd_app_ug/run_app.rst | 9 +++++ > 4 files changed, 74 insertions(+), 8 deletions(-) >=20 > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index > 75807623c719..6d666e088fd9 100644 > --- a/app/test-pmd/parameters.c > +++ b/app/test-pmd/parameters.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include >=20 > #include > #include > @@ -65,6 +66,7 @@ usage(char* progname) > #ifdef RTE_LIBRTE_CMDLINE > "--eth-peers-configfile=3D | " > "--eth-peer=3DX,M:M:M:M:M:M | " > + "--tx-ip=3DSRC,DST | --tx-udp=3DPORT | " > #endif > "--pkt-filter-mode=3D |" > "--rss-ip | --rss-udp | " > @@ -625,6 +627,8 @@ launch_args_parse(int argc, char** argv) > { "vxlan-gpe-port", 1, 0, 0 }, > { "mlockall", 0, 0, 0 }, > { "no-mlockall", 0, 0, 0 }, > + { "tx-ip", 1, 0, 0 }, > + { "tx-udp", 1, 0, 0 }, > { 0, 0, 0, 0 }, > }; >=20 > @@ -717,6 +721,51 @@ launch_args_parse(int argc, char** argv) > nb_peer_eth_addrs++; > } > #endif > + if (!strcmp(lgopts[opt_idx].name, "tx-ip")) { > + struct in_addr in; > + char *end; > + > + end =3D strchr(optarg, ','); > + if (end =3D=3D optarg || !end) > + rte_exit(EXIT_FAILURE, > + "Invalid tx-ip: %s", optarg); > + > + *end++ =3D 0; > + if (inet_aton(optarg, &in) =3D=3D 0) > + rte_exit(EXIT_FAILURE, > + "Invalid source IP address: > %s\n", optarg); > + tx_ip_src_addr =3D > rte_be_to_cpu_32(in.s_addr); > + > + if (inet_aton(end, &in) =3D=3D 0) > + rte_exit(EXIT_FAILURE, > + "Invalid destination IP > address: %s\n", optarg); > + tx_ip_dst_addr =3D > rte_be_to_cpu_32(in.s_addr); > + } > + if (!strcmp(lgopts[opt_idx].name, "tx-udp")) { > + char *end =3D NULL; > + > + errno =3D 0; > + n =3D strtoul(optarg, &end, 10); > + if (errno !=3D 0 || end =3D=3D optarg || n > > UINT16_MAX || > + !(*end =3D=3D '\0' || *end =3D=3D ',')) > + rte_exit(EXIT_FAILURE, > + "Invalid UDP port: %s\n", > optarg); > + tx_udp_src_port =3D n; > + if (*end =3D=3D ',') { > + char *dst =3D end + 1; > + > + n =3D strtoul(dst, &end, 10); > + if (errno !=3D 0 || end =3D=3D dst || > + n > UINT16_MAX || *end) > + rte_exit(EXIT_FAILURE, > + "Invalid destination > UDP port: %s\n", > + dst); > + tx_udp_dst_port =3D n; > + } else { > + tx_udp_dst_port =3D n; > + } > + > + } > if (!strcmp(lgopts[opt_idx].name, "nb-ports")) { > n =3D atoi(optarg); > if (n > 0 && n <=3D nb_ports) > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index > f51cd9dd9bbd..48f7b364e9b3 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -444,6 +444,12 @@ extern int8_t tx_pthresh; extern int8_t tx_hthresh; > extern int8_t tx_wthresh; >=20 > +extern uint16_t tx_udp_src_port; > +extern uint16_t tx_udp_dst_port; > + > +extern uint32_t tx_ip_src_addr; > +extern uint32_t tx_ip_dst_addr; > + > extern struct fwd_config cur_fwd_config; extern struct fwd_engine > *cur_fwd_eng; extern uint32_t retry_enabled; diff --git a/app/test- > pmd/txonly.c b/app/test-pmd/txonly.c index 1f08b6ed37a2..689c53eb73f8 > 100644 > --- a/app/test-pmd/txonly.c > +++ b/app/test-pmd/txonly.c > @@ -40,11 +40,13 @@ >=20 > #include "testpmd.h" >=20 > -#define UDP_SRC_PORT 1024 > -#define UDP_DST_PORT 1024 > +/* use RFC863 Discard Protocol */ > +uint16_t tx_udp_src_port =3D 9; > +uint16_t tx_udp_dst_port =3D 9; >=20 > -#define IP_SRC_ADDR ((192U << 24) | (168 << 16) | (0 << 8) | 1) -#define > IP_DST_ADDR ((192U << 24) | (168 << 16) | (0 << 8) | 2) > +/* use RFC5735 / RFC2544 reserved network test addresses */ uint32_t > +tx_ip_src_addr =3D (192U << 24) | (18 << 16) | (0 << 8) | 1; uint32_t > +tx_ip_dst_addr =3D (192U << 24) | (18 << 16) | (0 << 8) | 2; >=20 > #define IP_DEFTTL 64 /* from RFC 1340. */ > #define IP_VERSION 0x40 > @@ -104,8 +106,8 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, > * Initialize UDP header. > */ > pkt_len =3D (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); > - udp_hdr->src_port =3D rte_cpu_to_be_16(UDP_SRC_PORT); > - udp_hdr->dst_port =3D rte_cpu_to_be_16(UDP_DST_PORT); > + udp_hdr->src_port =3D rte_cpu_to_be_16(tx_udp_src_port); > + udp_hdr->dst_port =3D rte_cpu_to_be_16(tx_udp_dst_port); > udp_hdr->dgram_len =3D RTE_CPU_TO_BE_16(pkt_len); > udp_hdr->dgram_cksum =3D 0; /* No UDP checksum. */ >=20 > @@ -120,8 +122,8 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, > ip_hdr->next_proto_id =3D IPPROTO_UDP; > ip_hdr->packet_id =3D 0; > ip_hdr->total_length =3D RTE_CPU_TO_BE_16(pkt_len); > - ip_hdr->src_addr =3D rte_cpu_to_be_32(IP_SRC_ADDR); > - ip_hdr->dst_addr =3D rte_cpu_to_be_32(IP_DST_ADDR); > + ip_hdr->src_addr =3D rte_cpu_to_be_32(tx_ip_src_addr); > + ip_hdr->dst_addr =3D rte_cpu_to_be_32(tx_ip_dst_addr); >=20 > /* > * Compute IP header checksum. > diff --git a/doc/guides/testpmd_app_ug/run_app.rst > b/doc/guides/testpmd_app_ug/run_app.rst > index f301c2b6f709..ae9eb712e209 100644 > --- a/doc/guides/testpmd_app_ug/run_app.rst > +++ b/doc/guides/testpmd_app_ug/run_app.rst > @@ -249,6 +249,15 @@ The commandline options are: > Set the MAC address ``XX:XX:XX:XX:XX:XX`` of the peer port N, > where 0 <=3D N < ``CONFIG_RTE_MAX_ETHPORTS`` from the configuration > file. >=20 > + > +* ``--tx-ip=3DSRC,DST`` > + Set the source and destination IP address used when doing transmit o= nly > test. > + The defaults are source 192.18.0.1 and destination 192.18.0.2. > + > +* ``--tx-udp=3DSRC[,DST]`` > + Set the source and destination UDP port number for transmit test onl= y > test. > + The default port is the 9 (discard). > + > * ``--pkt-filter-mode=3Dmode`` >=20 > Set Flow Director mode where mode is either ``none`` (the default), > ``signature`` or ``perfect``. > -- > 2.17.1