From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id BD40CA0096 for ; Mon, 8 Apr 2019 14:51:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18E882BD8; Mon, 8 Apr 2019 14:51:55 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 19E1C2BD8 for ; Mon, 8 Apr 2019 14:51:52 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Apr 2019 05:51:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,325,1549958400"; d="scan'208";a="129546743" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga007.jf.intel.com with ESMTP; 08 Apr 2019 05:51:50 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.82]) by IRSMSX154.ger.corp.intel.com ([169.254.12.101]) with mapi id 14.03.0415.000; Mon, 8 Apr 2019 13:51:50 +0100 From: "Iremonger, Bernard" To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Thread-Index: AQHU6ZQyK9In/aWO6U2/idQE+kjdg6YyQCDQ Date: Mon, 8 Apr 2019 12:51:49 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C260D8553F@IRSMSX108.ger.corp.intel.com> References: <20180618213557.15209-2-stephen@networkplumber.org> <20190402203907.28679-1-stephen@networkplumber.org> <20190402203907.28679-2-stephen@networkplumber.org> In-Reply-To: <20190402203907.28679-2-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGNiNjEyNzItYjg2OS00YjIzLWJjOTItYjI4Yzk4N2Y3NTk2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiYUxXUTQxekp6T1p5T2FMcTFBZmtMaDU2Sm5tb3ZpNkgwRzRWWmJnYWh4azN4UWkwTytZV24wYUs0MmNScXJjUiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 1/3] app/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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190408125149.v_-q926qWQEIId1KKy2jydHOugefsIdffTpD-MVbvm4@z> Hi Stephen, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger > Sent: Tuesday, April 2, 2019 9:39 PM > To: dev@dpdk.org > Cc: Stephen Hemminger > Subject: [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP = and > UDP parameters >=20 > Use RFC 2544 standard values for Tx only test as default IP address and p= ort. > But let the user override those values on command line. >=20 > Signed-off-by: Stephen Hemminger > --- > v4 - update documentation to be more precise > support new tx-multi-flow addresses >=20 > app/test-pmd/parameters.c | 49 +++++++++++++++++++++++++++ > app/test-pmd/testpmd.h | 6 ++++ > app/test-pmd/txonly.c | 22 +++++++----- > doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++- > 4 files changed, 79 insertions(+), 10 deletions(-) >=20 > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index > 7b6b60905dce..8b523a5c66ed 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 | " > @@ -645,6 +647,8 @@ launch_args_parse(int argc, char** argv) > { "mlockall", 0, 0, 0 }, > { "no-mlockall", 0, 0, 0 }, > { "mp-alloc", 1, 0, 0 }, > + { "tx-ip", 1, 0, 0 }, > + { "tx-udp", 1, 0, 0 }, > { "noisy-tx-sw-buffer-size", 1, 0, 0 }, > { "noisy-tx-sw-buffer-flushtime", 1, 0, 0 }, > { "noisy-lkup-memory", 1, 0, 0 }, > @@ -743,6 +747,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 > a45988ebc524..18d2c1ef1eaf 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -443,6 +443,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 def52a0487ea..ed5e715ea648 > 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 > @@ -105,8 +107,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 > @@ -121,8 +123,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. > @@ -253,7 +255,9 @@ pkt_burst_transmit(struct fwd_stream *fs) > * packet generator for developer's quick performance > * regression test. > */ > - addr =3D (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id(); > + addr =3D (tx_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, diff - > -git a/doc/guides/testpmd_app_ug/run_app.rst > b/doc/guides/testpmd_app_ug/run_app.rst > index b717b8c7b742..a72f94923210 100644 > --- a/doc/guides/testpmd_app_ug/run_app.rst > +++ b/doc/guides/testpmd_app_ug/run_app.rst > @@ -121,12 +121,22 @@ The commandline options are: > XX:XX:XX:XX:XX:02 > ... >=20 > - > * ``--eth-peer=3DN,XX:XX:XX:XX:XX:XX`` >=20 > 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 address values are source 192.18.0.1 and > + destination 192.18.0.2. These are special purpose addresses > + reserved for benchmakring (RFC 2544). > + > +* ``--tx-udp=3DSRC[,DST]`` > + Set the source and destination UDP port number for transmit test onl= y test. > + The default port is the port 9 which is defined for the discard prot= ocol > + (RFC 863). > + > * ``--pkt-filter-mode=3Dmode`` >=20 > Set Flow Director mode where mode is either ``none`` (the default), > ``signature`` or ``perfect``. > -- > 2.17.1 This patch fails to apply to DPDK 19.05.rc1. It probably needs to be rebased. Regards, Bernard.