[v3,1/3] testpmd: add ability to set tx IP and UDP parameters

Message ID 20180618213557.15209-2-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series use RFC addresses for testing |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Stephen Hemminger June 18, 2018, 9:35 p.m. UTC
  Use RFC standard values for Tx only test as defaults.
But let the user override those values on command line.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 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(-)
  

Comments

Iremonger, Bernard June 22, 2018, 9:12 a.m. UTC | #1
Hi Stephen,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Monday, June 18, 2018 10:36 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP
> parameters
> 
> Use RFC standard values for Tx only test as defaults.
> But let the user override those values on command line.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

<snip>

>  app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
> 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 <= N < ``CONFIG_RTE_MAX_ETHPORTS`` from the configuration file.
> 
> +
> +*   ``--tx-ip=SRC,DST``

A newline should be inserted after the above line to maintain the existing format of the output HTML file.

> +    Set the source and destination IP address used when doing transmit only test.
> +    The defaults are source 192.18.0.1 and destination 192.18.0.2.
> +
> +*   ``--tx-udp=SRC[,DST]``

A newline should be inserted after the above line to maintain the existing format of the output HTML file.

> +    Set the source and destination UDP port number for transmit test only test.
> +    The default port is the 9 (discard).
> +
>  *   ``--pkt-filter-mode=mode``
> 
>      Set Flow Director mode where mode is either ``none`` (the default),
> ``signature`` or ``perfect``.
> --
> 2.17.1

dpdk/devtools/check-git-log.sh -1
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

The headline label should be "app/testpmd:"
"tx" should "Tx"

I commented on this previously.

Regards,

Bernard.
  
Shahaf Shuler June 26, 2018, 11:47 a.m. UTC | #2
Tuesday, June 19, 2018 12:36 AM 

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Tuesday, June 19, 2018 12:36 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP
> parameters
> 
> Use RFC standard values for Tx only test as defaults.
> But let the user override those values on command line.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  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(-)
> 
> 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 <stdint.h>
>  #include <unistd.h>
>  #include <inttypes.h>
> +#include <arpa/inet.h>
> 
>  #include <rte_common.h>
>  #include <rte_byteorder.h>
> @@ -65,6 +66,7 @@ usage(char* progname)
>  #ifdef RTE_LIBRTE_CMDLINE
>  	       "--eth-peers-configfile= | "
>  	       "--eth-peer=X,M:M:M:M:M:M | "
> +	       "--tx-ip=SRC,DST | --tx-udp=PORT | "
>  #endif
>  	       "--pkt-filter-mode= |"
>  	       "--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 },
>  	};
> 
> @@ -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 = strchr(optarg, ',');
> +				if (end == optarg || !end)
> +					rte_exit(EXIT_FAILURE,
> +						 "Invalid tx-ip: %s", optarg);
> +
> +				*end++ = 0;
> +				if (inet_aton(optarg, &in) == 0)
> +					rte_exit(EXIT_FAILURE,
> +						 "Invalid source IP address:
> %s\n", optarg);
> +				tx_ip_src_addr =
> rte_be_to_cpu_32(in.s_addr);
> +
> +				if (inet_aton(end, &in) == 0)
> +					rte_exit(EXIT_FAILURE,
> +						 "Invalid destination IP
> address: %s\n", optarg);
> +				tx_ip_dst_addr =
> rte_be_to_cpu_32(in.s_addr);
> +			}
> +			if (!strcmp(lgopts[opt_idx].name, "tx-udp")) {
> +				char *end = NULL;
> +
> +				errno = 0;
> +				n = strtoul(optarg, &end, 10);
> +				if (errno != 0 || end == optarg || n >
> UINT16_MAX ||
> +				    !(*end == '\0' || *end == ','))
> +					rte_exit(EXIT_FAILURE,
> +						 "Invalid UDP port: %s\n",
> optarg);
> +				tx_udp_src_port = n;
> +				if (*end == ',') {
> +					char *dst = end + 1;
> +
> +					n = strtoul(dst, &end, 10);
> +					if (errno != 0 || end == dst ||
> +					    n > UINT16_MAX || *end)
> +						rte_exit(EXIT_FAILURE,
> +							 "Invalid destination
> UDP port: %s\n",
> +							 dst);
> +					tx_udp_dst_port = n;
> +				} else {
> +					tx_udp_dst_port = n;
> +				}
> +
> +			}
>  			if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
>  				n = atoi(optarg);
>  				if (n > 0 && n <= 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;
> 
> +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 @@
> 
>  #include "testpmd.h"
> 
> -#define UDP_SRC_PORT 1024
> -#define UDP_DST_PORT 1024
> +/* use RFC863 Discard Protocol */
> +uint16_t tx_udp_src_port = 9;
> +uint16_t tx_udp_dst_port = 9;
> 
> -#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 = (192U << 24) | (18 << 16) | (0 << 8) | 1; uint32_t
> +tx_ip_dst_addr = (192U << 24) | (18 << 16) | (0 << 8) | 2;
> 
>  #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 = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr));
> -	udp_hdr->src_port = rte_cpu_to_be_16(UDP_SRC_PORT);
> -	udp_hdr->dst_port = rte_cpu_to_be_16(UDP_DST_PORT);
> +	udp_hdr->src_port = rte_cpu_to_be_16(tx_udp_src_port);
> +	udp_hdr->dst_port = rte_cpu_to_be_16(tx_udp_dst_port);
>  	udp_hdr->dgram_len      = RTE_CPU_TO_BE_16(pkt_len);
>  	udp_hdr->dgram_cksum    = 0; /* No UDP checksum. */
> 
> @@ -120,8 +122,8 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr,
>  	ip_hdr->next_proto_id = IPPROTO_UDP;
>  	ip_hdr->packet_id = 0;
>  	ip_hdr->total_length   = RTE_CPU_TO_BE_16(pkt_len);
> -	ip_hdr->src_addr = rte_cpu_to_be_32(IP_SRC_ADDR);
> -	ip_hdr->dst_addr = rte_cpu_to_be_32(IP_DST_ADDR);
> +	ip_hdr->src_addr = rte_cpu_to_be_32(tx_ip_src_addr);
> +	ip_hdr->dst_addr = rte_cpu_to_be_32(tx_ip_dst_addr);
> 
>  	/*
>  	 * 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 <= N < ``CONFIG_RTE_MAX_ETHPORTS`` from the configuration
> file.
> 
> +
> +*   ``--tx-ip=SRC,DST``
> +    Set the source and destination IP address used when doing transmit only
> test.
> +    The defaults are source 192.18.0.1 and destination 192.18.0.2.
> +
> +*   ``--tx-udp=SRC[,DST]``
> +    Set the source and destination UDP port number for transmit test only
> test.
> +    The default port is the 9 (discard).
> +
>  *   ``--pkt-filter-mode=mode``
> 
>      Set Flow Director mode where mode is either ``none`` (the default),
> ``signature`` or ``perfect``.
> --
> 2.17.1
  
Shahaf Shuler June 26, 2018, 11:51 a.m. UTC | #3
Hi Stephan, 

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
> 
> 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. 

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 in a round robin fashion by the application. 
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. 

> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  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(-)
> 
> 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 <stdint.h>
>  #include <unistd.h>
>  #include <inttypes.h>
> +#include <arpa/inet.h>
> 
>  #include <rte_common.h>
>  #include <rte_byteorder.h>
> @@ -65,6 +66,7 @@ usage(char* progname)
>  #ifdef RTE_LIBRTE_CMDLINE
>  	       "--eth-peers-configfile= | "
>  	       "--eth-peer=X,M:M:M:M:M:M | "
> +	       "--tx-ip=SRC,DST | --tx-udp=PORT | "
>  #endif
>  	       "--pkt-filter-mode= |"
>  	       "--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 },
>  	};
> 
> @@ -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 = strchr(optarg, ',');
> +				if (end == optarg || !end)
> +					rte_exit(EXIT_FAILURE,
> +						 "Invalid tx-ip: %s", optarg);
> +
> +				*end++ = 0;
> +				if (inet_aton(optarg, &in) == 0)
> +					rte_exit(EXIT_FAILURE,
> +						 "Invalid source IP address:
> %s\n", optarg);
> +				tx_ip_src_addr =
> rte_be_to_cpu_32(in.s_addr);
> +
> +				if (inet_aton(end, &in) == 0)
> +					rte_exit(EXIT_FAILURE,
> +						 "Invalid destination IP
> address: %s\n", optarg);
> +				tx_ip_dst_addr =
> rte_be_to_cpu_32(in.s_addr);
> +			}
> +			if (!strcmp(lgopts[opt_idx].name, "tx-udp")) {
> +				char *end = NULL;
> +
> +				errno = 0;
> +				n = strtoul(optarg, &end, 10);
> +				if (errno != 0 || end == optarg || n >
> UINT16_MAX ||
> +				    !(*end == '\0' || *end == ','))
> +					rte_exit(EXIT_FAILURE,
> +						 "Invalid UDP port: %s\n",
> optarg);
> +				tx_udp_src_port = n;
> +				if (*end == ',') {
> +					char *dst = end + 1;
> +
> +					n = strtoul(dst, &end, 10);
> +					if (errno != 0 || end == dst ||
> +					    n > UINT16_MAX || *end)
> +						rte_exit(EXIT_FAILURE,
> +							 "Invalid destination
> UDP port: %s\n",
> +							 dst);
> +					tx_udp_dst_port = n;
> +				} else {
> +					tx_udp_dst_port = n;
> +				}
> +
> +			}
>  			if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
>  				n = atoi(optarg);
>  				if (n > 0 && n <= 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;
> 
> +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 @@
> 
>  #include "testpmd.h"
> 
> -#define UDP_SRC_PORT 1024
> -#define UDP_DST_PORT 1024
> +/* use RFC863 Discard Protocol */
> +uint16_t tx_udp_src_port = 9;
> +uint16_t tx_udp_dst_port = 9;
> 
> -#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 = (192U << 24) | (18 << 16) | (0 << 8) | 1; uint32_t
> +tx_ip_dst_addr = (192U << 24) | (18 << 16) | (0 << 8) | 2;
> 
>  #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 = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr));
> -	udp_hdr->src_port = rte_cpu_to_be_16(UDP_SRC_PORT);
> -	udp_hdr->dst_port = rte_cpu_to_be_16(UDP_DST_PORT);
> +	udp_hdr->src_port = rte_cpu_to_be_16(tx_udp_src_port);
> +	udp_hdr->dst_port = rte_cpu_to_be_16(tx_udp_dst_port);
>  	udp_hdr->dgram_len      = RTE_CPU_TO_BE_16(pkt_len);
>  	udp_hdr->dgram_cksum    = 0; /* No UDP checksum. */
> 
> @@ -120,8 +122,8 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr,
>  	ip_hdr->next_proto_id = IPPROTO_UDP;
>  	ip_hdr->packet_id = 0;
>  	ip_hdr->total_length   = RTE_CPU_TO_BE_16(pkt_len);
> -	ip_hdr->src_addr = rte_cpu_to_be_32(IP_SRC_ADDR);
> -	ip_hdr->dst_addr = rte_cpu_to_be_32(IP_DST_ADDR);
> +	ip_hdr->src_addr = rte_cpu_to_be_32(tx_ip_src_addr);
> +	ip_hdr->dst_addr = rte_cpu_to_be_32(tx_ip_dst_addr);
> 
>  	/*
>  	 * 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 <= N < ``CONFIG_RTE_MAX_ETHPORTS`` from the configuration
> file.
> 
> +
> +*   ``--tx-ip=SRC,DST``
> +    Set the source and destination IP address used when doing transmit only
> test.
> +    The defaults are source 192.18.0.1 and destination 192.18.0.2.
> +
> +*   ``--tx-udp=SRC[,DST]``
> +    Set the source and destination UDP port number for transmit test only
> test.
> +    The default port is the 9 (discard).
> +
>  *   ``--pkt-filter-mode=mode``
> 
>      Set Flow Director mode where mode is either ``none`` (the default),
> ``signature`` or ``perfect``.
> --
> 2.17.1
  
Thomas Monjalon Oct. 29, 2018, 2:25 a.m. UTC | #4
Hi Stephen,

Please would you like to send a v4?


22/06/2018 11:12, Iremonger, Bernard:
> Hi Stephen,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> > Sent: Monday, June 18, 2018 10:36 PM
> > To: dev@dpdk.org
> > Cc: Stephen Hemminger <stephen@networkplumber.org>
> > Subject: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP
> > parameters
> > 
> > Use RFC standard values for Tx only test as defaults.
> > But let the user override those values on command line.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> 
> <snip>
> 
> >  app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
> > 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 <= N < ``CONFIG_RTE_MAX_ETHPORTS`` from the configuration file.
> > 
> > +
> > +*   ``--tx-ip=SRC,DST``
> 
> A newline should be inserted after the above line to maintain the existing format of the output HTML file.
> 
> > +    Set the source and destination IP address used when doing transmit only test.
> > +    The defaults are source 192.18.0.1 and destination 192.18.0.2.
> > +
> > +*   ``--tx-udp=SRC[,DST]``
> 
> A newline should be inserted after the above line to maintain the existing format of the output HTML file.
> 
> > +    Set the source and destination UDP port number for transmit test only test.
> > +    The default port is the 9 (discard).
> > +
> >  *   ``--pkt-filter-mode=mode``
> > 
> >      Set Flow Director mode where mode is either ``none`` (the default),
> > ``signature`` or ``perfect``.
> > --
> > 2.17.1
> 
> dpdk/devtools/check-git-log.sh -1
> 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
> 
> The headline label should be "app/testpmd:"
> "tx" should "Tx"
> 
> I commented on this previously.
> 
> Regards,
> 
> Bernard.
> 
>
  

Patch

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 <stdint.h>
 #include <unistd.h>
 #include <inttypes.h>
+#include <arpa/inet.h>
 
 #include <rte_common.h>
 #include <rte_byteorder.h>
@@ -65,6 +66,7 @@  usage(char* progname)
 #ifdef RTE_LIBRTE_CMDLINE
 	       "--eth-peers-configfile= | "
 	       "--eth-peer=X,M:M:M:M:M:M | "
+	       "--tx-ip=SRC,DST | --tx-udp=PORT | "
 #endif
 	       "--pkt-filter-mode= |"
 	       "--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 },
 	};
 
@@ -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 = strchr(optarg, ',');
+				if (end == optarg || !end)
+					rte_exit(EXIT_FAILURE,
+						 "Invalid tx-ip: %s", optarg);
+
+				*end++ = 0;
+				if (inet_aton(optarg, &in) == 0)
+					rte_exit(EXIT_FAILURE,
+						 "Invalid source IP address: %s\n", optarg);
+				tx_ip_src_addr = rte_be_to_cpu_32(in.s_addr);
+
+				if (inet_aton(end, &in) == 0)
+					rte_exit(EXIT_FAILURE,
+						 "Invalid destination IP address: %s\n", optarg);
+				tx_ip_dst_addr = rte_be_to_cpu_32(in.s_addr);
+			}
+			if (!strcmp(lgopts[opt_idx].name, "tx-udp")) {
+				char *end = NULL;
+
+				errno = 0;
+				n = strtoul(optarg, &end, 10);
+				if (errno != 0 || end == optarg || n > UINT16_MAX ||
+				    !(*end == '\0' || *end == ','))
+					rte_exit(EXIT_FAILURE,
+						 "Invalid UDP port: %s\n", optarg);
+				tx_udp_src_port = n;
+				if (*end == ',') {
+					char *dst = end + 1;
+
+					n = strtoul(dst, &end, 10);
+					if (errno != 0 || end == dst ||
+					    n > UINT16_MAX || *end)
+						rte_exit(EXIT_FAILURE,
+							 "Invalid destination UDP port: %s\n",
+							 dst);
+					tx_udp_dst_port = n;
+				} else {
+					tx_udp_dst_port = n;
+				}
+
+			}
 			if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
 				n = atoi(optarg);
 				if (n > 0 && n <= 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;
 
+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 @@ 
 
 #include "testpmd.h"
 
-#define UDP_SRC_PORT 1024
-#define UDP_DST_PORT 1024
+/* use RFC863 Discard Protocol */
+uint16_t tx_udp_src_port = 9;
+uint16_t tx_udp_dst_port = 9;
 
-#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 = (192U << 24) | (18 << 16) | (0 << 8) | 1;
+uint32_t tx_ip_dst_addr = (192U << 24) | (18 << 16) | (0 << 8) | 2;
 
 #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 = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr));
-	udp_hdr->src_port = rte_cpu_to_be_16(UDP_SRC_PORT);
-	udp_hdr->dst_port = rte_cpu_to_be_16(UDP_DST_PORT);
+	udp_hdr->src_port = rte_cpu_to_be_16(tx_udp_src_port);
+	udp_hdr->dst_port = rte_cpu_to_be_16(tx_udp_dst_port);
 	udp_hdr->dgram_len      = RTE_CPU_TO_BE_16(pkt_len);
 	udp_hdr->dgram_cksum    = 0; /* No UDP checksum. */
 
@@ -120,8 +122,8 @@  setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr,
 	ip_hdr->next_proto_id = IPPROTO_UDP;
 	ip_hdr->packet_id = 0;
 	ip_hdr->total_length   = RTE_CPU_TO_BE_16(pkt_len);
-	ip_hdr->src_addr = rte_cpu_to_be_32(IP_SRC_ADDR);
-	ip_hdr->dst_addr = rte_cpu_to_be_32(IP_DST_ADDR);
+	ip_hdr->src_addr = rte_cpu_to_be_32(tx_ip_src_addr);
+	ip_hdr->dst_addr = rte_cpu_to_be_32(tx_ip_dst_addr);
 
 	/*
 	 * 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 <= N < ``CONFIG_RTE_MAX_ETHPORTS`` from the configuration file.
 
+
+*   ``--tx-ip=SRC,DST``
+    Set the source and destination IP address used when doing transmit only test.
+    The defaults are source 192.18.0.1 and destination 192.18.0.2.
+
+*   ``--tx-udp=SRC[,DST]``
+    Set the source and destination UDP port number for transmit test only test.
+    The default port is the 9 (discard).
+
 *   ``--pkt-filter-mode=mode``
 
     Set Flow Director mode where mode is either ``none`` (the default), ``signature`` or ``perfect``.