From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id E1B7C1DA08 for ; Thu, 14 Jun 2018 12:30:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2018 03:30:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,222,1526367600"; d="scan'208";a="47057593" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by fmsmga007.fm.intel.com with ESMTP; 14 Jun 2018 03:30:22 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.139]) by IRSMSX153.ger.corp.intel.com ([169.254.9.60]) with mapi id 14.03.0319.002; Thu, 14 Jun 2018 11:30:22 +0100 From: "Iremonger, Bernard" To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 2/2] testpmd: add ability to set tx IP and UDP parameters Thread-Index: AQHUAbG06LHUzYtfzEeCsO8rg0RL1KRfjwEw Date: Thu, 14 Jun 2018 10:30:21 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C260CB34E5@IRSMSX108.ger.corp.intel.com> References: <20180611182526.32327-1-stephen@networkplumber.org> <20180611182526.32327-3-stephen@networkplumber.org> In-Reply-To: <20180611182526.32327-3-stephen@networkplumber.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWFiODczNzktODIwMy00ZmEwLWFjNTctOTcyZTkzODI4ZmViIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVWxQR0t2WXZaZ0ZjREhjdVRqZXprWHVReFY3K1NnMThlQ1FKaTIwSnlKanBxWHVocnhKUHByNHZIbDhyRU5KciJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 2/2] 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: Thu, 14 Jun 2018 10:30:25 -0000 Hi Stephen, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen > Hemminger > Sent: Monday, June 11, 2018 7:25 PM > To: dev@dpdk.org > Cc: Stephen Hemminger > Subject: [dpdk-dev] [PATCH v2 2/2] testpmd: add ability to set tx IP and = UDP > parameters >=20 > Allow user to override the hard coded IP address and UDP port values in T= x > only test. >=20 > Signed-off-by: Stephen Hemminger > --- > app/test-pmd/parameters.c | 49 +++++++++++++++++++++++++++ > app/test-pmd/testpmd.h | 6 ++++ > app/test-pmd/txonly.c | 16 ++++----- > doc/guides/testpmd_app_ug/run_app.rst | 9 +++++ > 4 files changed, 72 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); Line over 80 characters should be fixed. > + 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); Line over 80 characters should be fixed. > + 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 || Line over 80 characters should be fixed. > + !(*end =3D=3D '\0' || *end =3D=3D ',')) > + rte_exit(EXIT_FAILURE, > + "Invalid UDP port: %s\n", > optarg); Line over 80 characters should be fixed. > + 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 a24000e3af44..6d7ddf99d639 > 100644 > --- a/app/test-pmd/txonly.c > +++ b/app/test-pmd/txonly.c > @@ -41,12 +41,12 @@ > #include "testpmd.h" >=20 > /* RFC863 discard port */ > -#define UDP_SRC_PORT 9 > -#define UDP_DST_PORT 9 > +uint16_t tx_udp_src_port =3D 9; > +uint16_t tx_udp_dst_port =3D 9; >=20 > /* RFC2544 reserved test subnet 192.18.0.0 */ -#define IP_SRC_ADDR > ((192U << 24) | (18 << 16) | (0 << 8) | 1) -#define IP_DST_ADDR ((192U <<= 24) > | (18 << 16) | (0 << 8) | 2) > +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 > @@ -106,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 > @@ -122,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`` Newline should be added to give correct formatting in output. > + 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]`` Newline should be added to give correct formatting in output. > + 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 dpdk/devtools/check-git-log.sh is showing the following errors Wrong headline label: testpmd: add ability to set tx IP and UDP parameters Wrong headline lowercase: testpmd: add ability to set tx IP and UDP parameters label should be app/testpmd tx should be Tx Regards, Bernard.