DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v3 0/3] use RFC addresses for testing
@ 2018-06-18 21:35 Stephen Hemminger
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 53+ messages in thread
From: Stephen Hemminger @ 2018-06-18 21:35 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

These patches get rid of the custom addresses used in testpmd
and l3fwd, and instead uses values that are in the existing
RFC's.

Stephen Hemminger (3):
  testpmd: add ability to set tx IP and UDP parameters
  examples/l3fwd: use reserved IPv4/IPv6 addresses
  examples/l3fwd: format the IP addresses for printing

 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 +++++
 examples/l3fwd/l3fwd_lpm.c            | 49 +++++++++++++++------------
 5 files changed, 102 insertions(+), 29 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters
  2018-06-18 21:35 [dpdk-dev] [PATCH v3 0/3] use RFC addresses for testing Stephen Hemminger
@ 2018-06-18 21:35 ` Stephen Hemminger
  2018-06-22  9:12   ` Iremonger, Bernard
                     ` (3 more replies)
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
  2 siblings, 4 replies; 53+ messages in thread
From: Stephen Hemminger @ 2018-06-18 21:35 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v3 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2018-06-18 21:35 [dpdk-dev] [PATCH v3 0/3] use RFC addresses for testing Stephen Hemminger
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
@ 2018-06-18 21:35 ` Stephen Hemminger
  2018-06-22  9:19   ` Iremonger, Bernard
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
  2 siblings, 1 reply; 53+ messages in thread
From: Stephen Hemminger @ 2018-06-18 21:35 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The example should use the IPv4 addresses defined in RFC5735 and
the IPv6 addresses defined in RFC5180 for the L3 forwarding example
Longest Prefix Match table.

Fixes: 268888b5b020 ("examples/l3fwd: modularize")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index a747126a2404..3724f79c1924 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -40,26 +40,28 @@ struct ipv6_l3fwd_lpm_route {
 	uint8_t  if_out;
 };
 
+/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
 static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
-	{IPv4(1, 1, 1, 0), 24, 0},
-	{IPv4(2, 1, 1, 0), 24, 1},
-	{IPv4(3, 1, 1, 0), 24, 2},
-	{IPv4(4, 1, 1, 0), 24, 3},
-	{IPv4(5, 1, 1, 0), 24, 4},
-	{IPv4(6, 1, 1, 0), 24, 5},
-	{IPv4(7, 1, 1, 0), 24, 6},
-	{IPv4(8, 1, 1, 0), 24, 7},
+	{IPv4(192, 18, 0, 0), 24, 0},
+	{IPv4(192, 18, 1, 0), 24, 1},
+	{IPv4(192, 18, 2, 0), 24, 2},
+	{IPv4(192, 18, 3, 0), 24, 3},
+	{IPv4(192, 18, 4, 0), 24, 4},
+	{IPv4(192, 18, 5, 0), 24, 5},
+	{IPv4(192, 18, 6, 0), 24, 6},
+	{IPv4(192, 18, 7, 0), 24, 7},
 };
 
+/* 2001:0200::/48 is IANA reserved address range for IPv6 benchmarking (RFC5180) */
 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
-	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
-	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
-	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
-	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
-	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
-	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
-	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
-	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 64, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 64, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 64, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 64, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 64, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 64, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 0},
 };
 
 #define IPV4_L3FWD_LPM_NUM_ROUTES \
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: format the IP addresses for printing
  2018-06-18 21:35 [dpdk-dev] [PATCH v3 0/3] use RFC addresses for testing Stephen Hemminger
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
@ 2018-06-18 21:35 ` Stephen Hemminger
  2018-06-22 10:23   ` Iremonger, Bernard
  2 siblings, 1 reply; 53+ messages in thread
From: Stephen Hemminger @ 2018-06-18 21:35 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

It is better user experience to print standard format for addresses
rather than raw hex.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3724f79c1924..3edc82aa2c62 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <stdbool.h>
+#include <arpa/inet.h>
 
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -261,6 +262,7 @@ setup_lpm(const int socketid)
 	unsigned i;
 	int ret;
 	char s[64];
+	char abuf[INET6_ADDRSTRLEN];
 
 	/* create the LPM table */
 	config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
@@ -276,6 +278,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct in_addr in;
 
 		/* skip unused ports */
 		if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &
@@ -293,8 +296,9 @@ setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route 0x%08x / %d (%d)\n",
-			(unsigned)ipv4_l3fwd_lpm_route_array[i].ip,
+		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
+		printf("LPM: Adding route %s / %d (%d)\n",
+		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
 			ipv4_l3fwd_lpm_route_array[i].if_out);
 	}
@@ -332,9 +336,10 @@ setup_lpm(const int socketid)
 		}
 
 		printf("LPM: Adding route %s / %d (%d)\n",
-			"IPV6",
-			ipv6_l3fwd_lpm_route_array[i].depth,
-			ipv6_l3fwd_lpm_route_array[i].if_out);
+		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
+				 abuf, sizeof(abuf)),
+		       ipv6_l3fwd_lpm_route_array[i].depth,
+		       ipv6_l3fwd_lpm_route_array[i].if_out);
 	}
 }
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
@ 2018-06-22  9:12   ` Iremonger, Bernard
  2018-10-29  2:25     ` Thomas Monjalon
  2018-06-26 11:47   ` Shahaf Shuler
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 53+ messages in thread
From: Iremonger, Bernard @ 2018-06-22  9:12 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
@ 2018-06-22  9:19   ` Iremonger, Bernard
  0 siblings, 0 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2018-06-22  9:19 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 2/3] examples/l3fwd: use reserved IPv4/IPv6
> addresses
> 
> The example should use the IPv4 addresses defined in RFC5735 and the IPv6
> addresses defined in RFC5180 for the L3 forwarding example Longest Prefix
> Match table.
> 
> Fixes: 268888b5b020 ("examples/l3fwd: modularize")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

<snip>

>  examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
> 
> +/* 2001:0200::/48 is IANA reserved address range for IPv6 benchmarking
> +(RFC5180) */
>  static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
> -	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
> -	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
> -	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
> -	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
> -	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
> -	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
> -	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
> -	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 64, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 64, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 64, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 64, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 64, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 64, 0},

Should the depth value of 48 be used instead of 64 in the lines above?

> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 0},

Should 20 be used instead of 32 in the lines above ?

>  };
> 
>  #define IPV4_L3FWD_LPM_NUM_ROUTES \
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: format the IP addresses for printing
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
@ 2018-06-22 10:23   ` Iremonger, Bernard
  2018-06-22 13:44     ` Thomas Monjalon
  0 siblings, 1 reply; 53+ messages in thread
From: Iremonger, Bernard @ 2018-06-22 10:23 UTC (permalink / raw)
  To: Stephen Hemminger, dev, Thomas Monjalon

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 3/3] examples/l3fwd: format the IP addresses for
> printing
> 
> It is better user experience to print standard format for addresses rather than
> raw hex.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----

<snip>

dpdk/devtools/check-git-log.sh -1
Wrong beginning of commit message:
        It is better user experience to print standard format for addresses

It is complaining about "It" in the commit message, not sure why.

Hi Thomas,

Could this be a bug in the check-git-log script. 

Regards,

Bernard.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: format the IP addresses for printing
  2018-06-22 10:23   ` Iremonger, Bernard
@ 2018-06-22 13:44     ` Thomas Monjalon
  0 siblings, 0 replies; 53+ messages in thread
From: Thomas Monjalon @ 2018-06-22 13:44 UTC (permalink / raw)
  To: Iremonger, Bernard; +Cc: Stephen Hemminger, dev

22/06/2018 12:23, 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 3/3] examples/l3fwd: format the IP addresses for
> > printing
> > 
> > It is better user experience to print standard format for addresses rather than
> > raw hex.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
> 
> <snip>
> 
> dpdk/devtools/check-git-log.sh -1
> Wrong beginning of commit message:
>         It is better user experience to print standard format for addresses
> 
> It is complaining about "It" in the commit message, not sure why.
> 
> Hi Thomas,
> 
> Could this be a bug in the check-git-log script. 

No it is not a bug, just a pedantic warning :)
Look at this commit for the explanation:
	http://git.dpdk.org/dpdk/commit/?id=9c24780f0d5efd

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
  2018-06-22  9:12   ` Iremonger, Bernard
@ 2018-06-26 11:47   ` Shahaf Shuler
  2018-06-26 11:51   ` Shahaf Shuler
  2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
  3 siblings, 0 replies; 53+ messages in thread
From: Shahaf Shuler @ 2018-06-26 11:47 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
  2018-06-22  9:12   ` Iremonger, Bernard
  2018-06-26 11:47   ` Shahaf Shuler
@ 2018-06-26 11:51   ` Shahaf Shuler
  2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
  3 siblings, 0 replies; 53+ messages in thread
From: Shahaf Shuler @ 2018-06-26 11:51 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters
  2018-06-22  9:12   ` Iremonger, Bernard
@ 2018-10-29  2:25     ` Thomas Monjalon
  0 siblings, 0 replies; 53+ messages in thread
From: Thomas Monjalon @ 2018-10-29  2:25 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Iremonger, Bernard

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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications
  2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
                     ` (2 preceding siblings ...)
  2018-06-26 11:51   ` Shahaf Shuler
@ 2019-04-02 20:39   ` Stephen Hemminger
  2019-04-02 20:39     ` Stephen Hemminger
                       ` (4 more replies)
  3 siblings, 5 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-02 20:39 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

These patches get rid of the custom addresses used in testpmd
and l3fwd, and instead uses values that are in the existing
RFC's.

Stephen Hemminger (3):
  app/testpmd: add ability to set Tx IP and UDP parameters
  examples/l3fwd: use reserved IPv4/IPv6 addresses
  examples/l3fwd: format the IP addresses for printing

 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 ++++++-
 examples/l3fwd/l3fwd_lpm.c            | 49 +++++++++++++++------------
 5 files changed, 107 insertions(+), 31 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications
  2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
@ 2019-04-02 20:39     ` Stephen Hemminger
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-02 20:39 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

These patches get rid of the custom addresses used in testpmd
and l3fwd, and instead uses values that are in the existing
RFC's.

Stephen Hemminger (3):
  app/testpmd: add ability to set Tx IP and UDP parameters
  examples/l3fwd: use reserved IPv4/IPv6 addresses
  examples/l3fwd: format the IP addresses for printing

 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 ++++++-
 examples/l3fwd/l3fwd_lpm.c            | 49 +++++++++++++++------------
 5 files changed, 107 insertions(+), 31 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
  2019-04-02 20:39     ` Stephen Hemminger
@ 2019-04-02 20:39     ` Stephen Hemminger
  2019-04-02 20:39       ` Stephen Hemminger
  2019-04-08 12:51       ` Iremonger, Bernard
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
                       ` (2 subsequent siblings)
  4 siblings, 2 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-02 20:39 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Use RFC 2544 standard values for Tx only test as default IP
address and port.  But let the user override those values on command line.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v4 - update documentation to be more precise
     support new tx-multi-flow addresses

 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(-)

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 <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 | "
@@ -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 = 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 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;
 
+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 @@
 
 #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
@@ -105,8 +107,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. */
 
@@ -121,8 +123,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.
@@ -253,7 +255,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
 			 * packet generator for developer's quick performance
 			 * regression test.
 			 */
-			addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
+			addr = (tx_ip_dst_addr | (ip_var++ << 8))
+				+ rte_lcore_id();
+
 			ip_hdr->src_addr = 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
        ...
 
-
 *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
 
     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 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=SRC[,DST]``
+    Set the source and destination UDP port number for transmit test only test.
+    The default port is the port 9 which is defined for the discard protocol
+    (RFC 863).
+
 *   ``--pkt-filter-mode=mode``
 
     Set Flow Director mode where mode is either ``none`` (the default), ``signature`` or ``perfect``.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
@ 2019-04-02 20:39       ` Stephen Hemminger
  2019-04-08 12:51       ` Iremonger, Bernard
  1 sibling, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-02 20:39 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Use RFC 2544 standard values for Tx only test as default IP
address and port.  But let the user override those values on command line.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v4 - update documentation to be more precise
     support new tx-multi-flow addresses

 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(-)

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 <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 | "
@@ -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 = 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 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;
 
+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 @@
 
 #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
@@ -105,8 +107,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. */
 
@@ -121,8 +123,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.
@@ -253,7 +255,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
 			 * packet generator for developer's quick performance
 			 * regression test.
 			 */
-			addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
+			addr = (tx_ip_dst_addr | (ip_var++ << 8))
+				+ rte_lcore_id();
+
 			ip_hdr->src_addr = 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
        ...
 
-
 *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
 
     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 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=SRC[,DST]``
+    Set the source and destination UDP port number for transmit test only test.
+    The default port is the port 9 which is defined for the discard protocol
+    (RFC 863).
+
 *   ``--pkt-filter-mode=mode``
 
     Set Flow Director mode where mode is either ``none`` (the default), ``signature`` or ``perfect``.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
  2019-04-02 20:39     ` Stephen Hemminger
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
@ 2019-04-02 20:39     ` Stephen Hemminger
  2019-04-02 20:39       ` Stephen Hemminger
  2019-04-08 13:07       ` Iremonger, Bernard
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
  2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
  4 siblings, 2 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-02 20:39 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The l3fwd example should use the IPv4 addresses defined in RFC5735 and
the IPv6 addresses defined in RFC5180 for the L3 forwarding example
Longest Prefix Match table.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v4 - fix IPv6 /48 entries

 examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index b1dc195ad8cb..3191fc4c2639 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
 	uint8_t  if_out;
 };
 
+/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
 static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
-	{IPv4(1, 1, 1, 0), 24, 0},
-	{IPv4(2, 1, 1, 0), 24, 1},
-	{IPv4(3, 1, 1, 0), 24, 2},
-	{IPv4(4, 1, 1, 0), 24, 3},
-	{IPv4(5, 1, 1, 0), 24, 4},
-	{IPv4(6, 1, 1, 0), 24, 5},
-	{IPv4(7, 1, 1, 0), 24, 6},
-	{IPv4(8, 1, 1, 0), 24, 7},
+	{IPv4(192, 18, 0, 0), 24, 0},
+	{IPv4(192, 18, 1, 0), 24, 1},
+	{IPv4(192, 18, 2, 0), 24, 2},
+	{IPv4(192, 18, 3, 0), 24, 3},
+	{IPv4(192, 18, 4, 0), 24, 4},
+	{IPv4(192, 18, 5, 0), 24, 5},
+	{IPv4(192, 18, 6, 0), 24, 6},
+	{IPv4(192, 18, 7, 0), 24, 7},
 };
 
+/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
-	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
-	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
-	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
-	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
-	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
-	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
-	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
-	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
 };
 
 #define IPV4_L3FWD_LPM_NUM_ROUTES \
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
@ 2019-04-02 20:39       ` Stephen Hemminger
  2019-04-08 13:07       ` Iremonger, Bernard
  1 sibling, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-02 20:39 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The l3fwd example should use the IPv4 addresses defined in RFC5735 and
the IPv6 addresses defined in RFC5180 for the L3 forwarding example
Longest Prefix Match table.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v4 - fix IPv6 /48 entries

 examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index b1dc195ad8cb..3191fc4c2639 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
 	uint8_t  if_out;
 };
 
+/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
 static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
-	{IPv4(1, 1, 1, 0), 24, 0},
-	{IPv4(2, 1, 1, 0), 24, 1},
-	{IPv4(3, 1, 1, 0), 24, 2},
-	{IPv4(4, 1, 1, 0), 24, 3},
-	{IPv4(5, 1, 1, 0), 24, 4},
-	{IPv4(6, 1, 1, 0), 24, 5},
-	{IPv4(7, 1, 1, 0), 24, 6},
-	{IPv4(8, 1, 1, 0), 24, 7},
+	{IPv4(192, 18, 0, 0), 24, 0},
+	{IPv4(192, 18, 1, 0), 24, 1},
+	{IPv4(192, 18, 2, 0), 24, 2},
+	{IPv4(192, 18, 3, 0), 24, 3},
+	{IPv4(192, 18, 4, 0), 24, 4},
+	{IPv4(192, 18, 5, 0), 24, 5},
+	{IPv4(192, 18, 6, 0), 24, 6},
+	{IPv4(192, 18, 7, 0), 24, 7},
 };
 
+/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
-	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
-	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
-	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
-	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
-	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
-	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
-	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
-	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
 };
 
 #define IPV4_L3FWD_LPM_NUM_ROUTES \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing
  2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
                       ` (2 preceding siblings ...)
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
@ 2019-04-02 20:39     ` Stephen Hemminger
  2019-04-02 20:39       ` Stephen Hemminger
  2019-04-08 13:14       ` Iremonger, Bernard
  2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
  4 siblings, 2 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-02 20:39 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The IP addresses should be formatted using standard routines
rather than dumpin in raw hex.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v4 - remove fixes, the original output was raw but not a bug

 examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3191fc4c2639..172a036b2707 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <stdbool.h>
+#include <arpa/inet.h>
 
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -260,6 +261,7 @@ setup_lpm(const int socketid)
 	unsigned i;
 	int ret;
 	char s[64];
+	char abuf[INET6_ADDRSTRLEN];
 
 	/* create the LPM table */
 	config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
@@ -275,6 +277,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct in_addr in;
 
 		/* skip unused ports */
 		if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &
@@ -292,8 +295,9 @@ setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route 0x%08x / %d (%d)\n",
-			(unsigned)ipv4_l3fwd_lpm_route_array[i].ip,
+		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
+		printf("LPM: Adding route %s / %d (%d)\n",
+		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
 			ipv4_l3fwd_lpm_route_array[i].if_out);
 	}
@@ -331,9 +335,10 @@ setup_lpm(const int socketid)
 		}
 
 		printf("LPM: Adding route %s / %d (%d)\n",
-			"IPV6",
-			ipv6_l3fwd_lpm_route_array[i].depth,
-			ipv6_l3fwd_lpm_route_array[i].if_out);
+		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
+				 abuf, sizeof(abuf)),
+		       ipv6_l3fwd_lpm_route_array[i].depth,
+		       ipv6_l3fwd_lpm_route_array[i].if_out);
 	}
 }
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
@ 2019-04-02 20:39       ` Stephen Hemminger
  2019-04-08 13:14       ` Iremonger, Bernard
  1 sibling, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-02 20:39 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The IP addresses should be formatted using standard routines
rather than dumpin in raw hex.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v4 - remove fixes, the original output was raw but not a bug

 examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3191fc4c2639..172a036b2707 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <stdbool.h>
+#include <arpa/inet.h>
 
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -260,6 +261,7 @@ setup_lpm(const int socketid)
 	unsigned i;
 	int ret;
 	char s[64];
+	char abuf[INET6_ADDRSTRLEN];
 
 	/* create the LPM table */
 	config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
@@ -275,6 +277,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct in_addr in;
 
 		/* skip unused ports */
 		if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &
@@ -292,8 +295,9 @@ setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route 0x%08x / %d (%d)\n",
-			(unsigned)ipv4_l3fwd_lpm_route_array[i].ip,
+		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
+		printf("LPM: Adding route %s / %d (%d)\n",
+		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
 			ipv4_l3fwd_lpm_route_array[i].if_out);
 	}
@@ -331,9 +335,10 @@ setup_lpm(const int socketid)
 		}
 
 		printf("LPM: Adding route %s / %d (%d)\n",
-			"IPV6",
-			ipv6_l3fwd_lpm_route_array[i].depth,
-			ipv6_l3fwd_lpm_route_array[i].if_out);
+		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
+				 abuf, sizeof(abuf)),
+		       ipv6_l3fwd_lpm_route_array[i].depth,
+		       ipv6_l3fwd_lpm_route_array[i].if_out);
 	}
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
  2019-04-02 20:39       ` Stephen Hemminger
@ 2019-04-08 12:51       ` Iremonger, Bernard
  2019-04-08 12:51         ` Iremonger, Bernard
  1 sibling, 1 reply; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-08 12:51 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and
> UDP parameters
> 
> Use RFC 2544 standard values for Tx only test as default IP address and port.
> But let the user override those values on command line.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v4 - update documentation to be more precise
>      support new tx-multi-flow addresses
> 
>  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(-)
> 
> 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 <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 | "
> @@ -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 = 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
> 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;
> 
> +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 @@
> 
>  #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
> @@ -105,8 +107,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. */
> 
> @@ -121,8 +123,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.
> @@ -253,7 +255,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
>  			 * packet generator for developer's quick performance
>  			 * regression test.
>  			 */
> -			addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
> +			addr = (tx_ip_dst_addr | (ip_var++ << 8))
> +				+ rte_lcore_id();
> +
>  			ip_hdr->src_addr = 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
>         ...
> 
> -
>  *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
> 
>      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 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=SRC[,DST]``
> +    Set the source and destination UDP port number for transmit test only test.
> +    The default port is the port 9 which is defined for the discard protocol
> +    (RFC 863).
> +
>  *   ``--pkt-filter-mode=mode``
> 
>      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.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-08 12:51       ` Iremonger, Bernard
@ 2019-04-08 12:51         ` Iremonger, Bernard
  0 siblings, 0 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-08 12:51 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and
> UDP parameters
> 
> Use RFC 2544 standard values for Tx only test as default IP address and port.
> But let the user override those values on command line.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v4 - update documentation to be more precise
>      support new tx-multi-flow addresses
> 
>  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(-)
> 
> 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 <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 | "
> @@ -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 = 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
> 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;
> 
> +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 @@
> 
>  #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
> @@ -105,8 +107,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. */
> 
> @@ -121,8 +123,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.
> @@ -253,7 +255,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
>  			 * packet generator for developer's quick performance
>  			 * regression test.
>  			 */
> -			addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
> +			addr = (tx_ip_dst_addr | (ip_var++ << 8))
> +				+ rte_lcore_id();
> +
>  			ip_hdr->src_addr = 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
>         ...
> 
> -
>  *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
> 
>      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 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=SRC[,DST]``
> +    Set the source and destination UDP port number for transmit test only test.
> +    The default port is the port 9 which is defined for the discard protocol
> +    (RFC 863).
> +
>  *   ``--pkt-filter-mode=mode``
> 
>      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.


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
  2019-04-02 20:39       ` Stephen Hemminger
@ 2019-04-08 13:07       ` Iremonger, Bernard
  2019-04-08 13:07         ` Iremonger, Bernard
  2019-04-09 17:14         ` Stephen Hemminger
  1 sibling, 2 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-08 13:07 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6
> addresses
> 
> The l3fwd example should use the IPv4 addresses defined in RFC5735 and the
> IPv6 addresses defined in RFC5180 for the L3 forwarding example Longest Prefix
> Match table.

There should probably be a fixes line.
Also the commit line should have the "fix" keyword. 
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v4 - fix IPv6 /48 entries
> 
>  examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index
> b1dc195ad8cb..3191fc4c2639 100644
> --- a/examples/l3fwd/l3fwd_lpm.c
> +++ b/examples/l3fwd/l3fwd_lpm.c
> @@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
>  	uint8_t  if_out;
>  };
> 
> +/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
>  static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
> -	{IPv4(1, 1, 1, 0), 24, 0},
> -	{IPv4(2, 1, 1, 0), 24, 1},
> -	{IPv4(3, 1, 1, 0), 24, 2},
> -	{IPv4(4, 1, 1, 0), 24, 3},
> -	{IPv4(5, 1, 1, 0), 24, 4},
> -	{IPv4(6, 1, 1, 0), 24, 5},
> -	{IPv4(7, 1, 1, 0), 24, 6},
> -	{IPv4(8, 1, 1, 0), 24, 7},
> +	{IPv4(192, 18, 0, 0), 24, 0},
> +	{IPv4(192, 18, 1, 0), 24, 1},
> +	{IPv4(192, 18, 2, 0), 24, 2},
> +	{IPv4(192, 18, 3, 0), 24, 3},
> +	{IPv4(192, 18, 4, 0), 24, 4},
> +	{IPv4(192, 18, 5, 0), 24, 5},
> +	{IPv4(192, 18, 6, 0), 24, 6},
> +	{IPv4(192, 18, 7, 0), 24, 7},
>  };
> 
> +/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking
> +(RFC5180) */
>  static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
> -	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
> -	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
> -	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
> -	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
> -	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
> -	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
> -	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
> -	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
>  };
> 
>  #define IPV4_L3FWD_LPM_NUM_ROUTES \
> --
> 2.17.1

Regards,

Bernard.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-08 13:07       ` Iremonger, Bernard
@ 2019-04-08 13:07         ` Iremonger, Bernard
  2019-04-09 17:14         ` Stephen Hemminger
  1 sibling, 0 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-08 13:07 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6
> addresses
> 
> The l3fwd example should use the IPv4 addresses defined in RFC5735 and the
> IPv6 addresses defined in RFC5180 for the L3 forwarding example Longest Prefix
> Match table.

There should probably be a fixes line.
Also the commit line should have the "fix" keyword. 
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v4 - fix IPv6 /48 entries
> 
>  examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index
> b1dc195ad8cb..3191fc4c2639 100644
> --- a/examples/l3fwd/l3fwd_lpm.c
> +++ b/examples/l3fwd/l3fwd_lpm.c
> @@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
>  	uint8_t  if_out;
>  };
> 
> +/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
>  static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
> -	{IPv4(1, 1, 1, 0), 24, 0},
> -	{IPv4(2, 1, 1, 0), 24, 1},
> -	{IPv4(3, 1, 1, 0), 24, 2},
> -	{IPv4(4, 1, 1, 0), 24, 3},
> -	{IPv4(5, 1, 1, 0), 24, 4},
> -	{IPv4(6, 1, 1, 0), 24, 5},
> -	{IPv4(7, 1, 1, 0), 24, 6},
> -	{IPv4(8, 1, 1, 0), 24, 7},
> +	{IPv4(192, 18, 0, 0), 24, 0},
> +	{IPv4(192, 18, 1, 0), 24, 1},
> +	{IPv4(192, 18, 2, 0), 24, 2},
> +	{IPv4(192, 18, 3, 0), 24, 3},
> +	{IPv4(192, 18, 4, 0), 24, 4},
> +	{IPv4(192, 18, 5, 0), 24, 5},
> +	{IPv4(192, 18, 6, 0), 24, 6},
> +	{IPv4(192, 18, 7, 0), 24, 7},
>  };
> 
> +/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking
> +(RFC5180) */
>  static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
> -	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
> -	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
> -	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
> -	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
> -	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
> -	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
> -	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
> -	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
>  };
> 
>  #define IPV4_L3FWD_LPM_NUM_ROUTES \
> --
> 2.17.1

Regards,

Bernard.


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
  2019-04-02 20:39       ` Stephen Hemminger
@ 2019-04-08 13:14       ` Iremonger, Bernard
  2019-04-08 13:14         ` Iremonger, Bernard
  1 sibling, 1 reply; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-08 13:14 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for
> printing
> 
> The IP addresses should be formatted using standard routines rather than
> dumpin in raw hex.

Typo: "dumpin" should be "dumping"
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Otherwise

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing
  2019-04-08 13:14       ` Iremonger, Bernard
@ 2019-04-08 13:14         ` Iremonger, Bernard
  0 siblings, 0 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-08 13:14 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for
> printing
> 
> The IP addresses should be formatted using standard routines rather than
> dumpin in raw hex.

Typo: "dumpin" should be "dumping"
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Otherwise

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-08 13:07       ` Iremonger, Bernard
  2019-04-08 13:07         ` Iremonger, Bernard
@ 2019-04-09 17:14         ` Stephen Hemminger
  2019-04-09 17:14           ` Stephen Hemminger
  1 sibling, 1 reply; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 17:14 UTC (permalink / raw)
  To: Iremonger, Bernard; +Cc: dev

On Mon, 8 Apr 2019 13:07:33 +0000
"Iremonger, Bernard" <bernard.iremonger@intel.com> wrote:

> 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 <stephen@networkplumber.org>
> > Subject: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6
> > addresses
> > 
> > The l3fwd example should use the IPv4 addresses defined in RFC5735 and the
> > IPv6 addresses defined in RFC5180 for the L3 forwarding example Longest Prefix
> > Match table.  
> 
> There should probably be a fixes line.
> Also the commit line should have the "fix" keyword. 

The original behavior was not a bug. It was just a poor design choice.
Therefore the lack of fixes tag is intentional.
Also didn't want this patch to make it into stable release and risk breaking
some existing test bed.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-09 17:14         ` Stephen Hemminger
@ 2019-04-09 17:14           ` Stephen Hemminger
  0 siblings, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 17:14 UTC (permalink / raw)
  To: Iremonger, Bernard; +Cc: dev

On Mon, 8 Apr 2019 13:07:33 +0000
"Iremonger, Bernard" <bernard.iremonger@intel.com> wrote:

> 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 <stephen@networkplumber.org>
> > Subject: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6
> > addresses
> > 
> > The l3fwd example should use the IPv4 addresses defined in RFC5735 and the
> > IPv6 addresses defined in RFC5180 for the L3 forwarding example Longest Prefix
> > Match table.  
> 
> There should probably be a fixes line.
> Also the commit line should have the "fix" keyword. 

The original behavior was not a bug. It was just a poor design choice.
Therefore the lack of fixes tag is intentional.
Also didn't want this patch to make it into stable release and risk breaking
some existing test bed.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications
  2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
                       ` (3 preceding siblings ...)
  2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
@ 2019-04-09 18:20     ` Stephen Hemminger
  2019-04-09 18:20       ` Stephen Hemminger
                         ` (4 more replies)
  4 siblings, 5 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 18:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

These patches get rid of the custom addresses used in testpmd
and l3fwd, and instead uses values that are in the existing
RFC's.

v5 -- rebase to 19.05-rc1 and fix reword commit message

Stephen Hemminger (3):
  app/testpmd: add ability to set Tx IP and UDP parameters
  examples/l3fwd: use reserved IPv4/IPv6 addresses
  examples/l3fwd: format the IP addresses for printing

 app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  6 ++++
 app/test-pmd/txonly.c                 | 20 ++++++-----
 doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++-
 examples/l3fwd/l3fwd_lpm.c            | 49 +++++++++++++++------------
 5 files changed, 105 insertions(+), 31 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications
  2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
@ 2019-04-09 18:20       ` Stephen Hemminger
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
                         ` (3 subsequent siblings)
  4 siblings, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 18:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

These patches get rid of the custom addresses used in testpmd
and l3fwd, and instead uses values that are in the existing
RFC's.

v5 -- rebase to 19.05-rc1 and fix reword commit message

Stephen Hemminger (3):
  app/testpmd: add ability to set Tx IP and UDP parameters
  examples/l3fwd: use reserved IPv4/IPv6 addresses
  examples/l3fwd: format the IP addresses for printing

 app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  6 ++++
 app/test-pmd/txonly.c                 | 20 ++++++-----
 doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++-
 examples/l3fwd/l3fwd_lpm.c            | 49 +++++++++++++++------------
 5 files changed, 105 insertions(+), 31 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
  2019-04-09 18:20       ` Stephen Hemminger
@ 2019-04-09 18:20       ` Stephen Hemminger
  2019-04-09 18:20         ` Stephen Hemminger
  2019-04-10 10:07         ` Iremonger, Bernard
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
                         ` (2 subsequent siblings)
  4 siblings, 2 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 18:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This patch changes what testpmd uses as IP addresses when
run in transmit only mode. The old code was using
192.168.0.1 -> 192.168.0.2
but these addresses are reserved for private Internet by RFC 1918.

The new code uses 192.18.0.1 and 192.18.0.2 which are on the
subnet reserved for performance testing by RFC 2544.

New command line option allows the user to pick any other src/dst
address desired.

Notice: this changes the default IP address for transmit only.
It may cause some user who has hardcoded network addresses to report
a regression.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v5 -- rebase to 19.05-rc1 and fix reword commit message

 app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  6 ++++
 app/test-pmd/txonly.c                 | 20 ++++++-----
 doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++-
 4 files changed, 77 insertions(+), 10 deletions(-)

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 <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 | "
@@ -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 = 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 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;
 
+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 66e63788a25e..632d655235f0 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
@@ -105,8 +107,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. */
 
@@ -121,8 +123,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.
@@ -206,7 +208,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp,
 		 * packet generator for developer's quick performance
 		 * regression test.
 		 */
-		addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
+		addr = (tx_ip_dst_addr | (ip_var++ << 8)) + rte_lcore_id();
 		ip_hdr->src_addr = 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
        ...
 
-
 *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
 
     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 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=SRC[,DST]``
+    Set the source and destination UDP port number for transmit test only test.
+    The default port is the port 9 which is defined for the discard protocol
+    (RFC 863).
+
 *   ``--pkt-filter-mode=mode``
 
     Set Flow Director mode where mode is either ``none`` (the default), ``signature`` or ``perfect``.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
@ 2019-04-09 18:20         ` Stephen Hemminger
  2019-04-10 10:07         ` Iremonger, Bernard
  1 sibling, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 18:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This patch changes what testpmd uses as IP addresses when
run in transmit only mode. The old code was using
192.168.0.1 -> 192.168.0.2
but these addresses are reserved for private Internet by RFC 1918.

The new code uses 192.18.0.1 and 192.18.0.2 which are on the
subnet reserved for performance testing by RFC 2544.

New command line option allows the user to pick any other src/dst
address desired.

Notice: this changes the default IP address for transmit only.
It may cause some user who has hardcoded network addresses to report
a regression.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v5 -- rebase to 19.05-rc1 and fix reword commit message

 app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  6 ++++
 app/test-pmd/txonly.c                 | 20 ++++++-----
 doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++-
 4 files changed, 77 insertions(+), 10 deletions(-)

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 <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 | "
@@ -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 = 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 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;
 
+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 66e63788a25e..632d655235f0 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
@@ -105,8 +107,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. */
 
@@ -121,8 +123,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.
@@ -206,7 +208,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp,
 		 * packet generator for developer's quick performance
 		 * regression test.
 		 */
-		addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
+		addr = (tx_ip_dst_addr | (ip_var++ << 8)) + rte_lcore_id();
 		ip_hdr->src_addr = 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
        ...
 
-
 *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
 
     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 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=SRC[,DST]``
+    Set the source and destination UDP port number for transmit test only test.
+    The default port is the port 9 which is defined for the discard protocol
+    (RFC 863).
+
 *   ``--pkt-filter-mode=mode``
 
     Set Flow Director mode where mode is either ``none`` (the default), ``signature`` or ``perfect``.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
  2019-04-09 18:20       ` Stephen Hemminger
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
@ 2019-04-09 18:20       ` Stephen Hemminger
  2019-04-09 18:20         ` Stephen Hemminger
  2019-04-10  8:56         ` Iremonger, Bernard
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
  2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
  4 siblings, 2 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 18:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The l3fwd example should use the IPv4 addresses defined in RFC5735 and
the IPv6 addresses defined in RFC5180 for the L3 forwarding example
Longest Prefix Match table.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index b1dc195ad8cb..3191fc4c2639 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
 	uint8_t  if_out;
 };
 
+/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
 static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
-	{IPv4(1, 1, 1, 0), 24, 0},
-	{IPv4(2, 1, 1, 0), 24, 1},
-	{IPv4(3, 1, 1, 0), 24, 2},
-	{IPv4(4, 1, 1, 0), 24, 3},
-	{IPv4(5, 1, 1, 0), 24, 4},
-	{IPv4(6, 1, 1, 0), 24, 5},
-	{IPv4(7, 1, 1, 0), 24, 6},
-	{IPv4(8, 1, 1, 0), 24, 7},
+	{IPv4(192, 18, 0, 0), 24, 0},
+	{IPv4(192, 18, 1, 0), 24, 1},
+	{IPv4(192, 18, 2, 0), 24, 2},
+	{IPv4(192, 18, 3, 0), 24, 3},
+	{IPv4(192, 18, 4, 0), 24, 4},
+	{IPv4(192, 18, 5, 0), 24, 5},
+	{IPv4(192, 18, 6, 0), 24, 6},
+	{IPv4(192, 18, 7, 0), 24, 7},
 };
 
+/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
-	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
-	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
-	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
-	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
-	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
-	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
-	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
-	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
 };
 
 #define IPV4_L3FWD_LPM_NUM_ROUTES \
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
@ 2019-04-09 18:20         ` Stephen Hemminger
  2019-04-10  8:56         ` Iremonger, Bernard
  1 sibling, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 18:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The l3fwd example should use the IPv4 addresses defined in RFC5735 and
the IPv6 addresses defined in RFC5180 for the L3 forwarding example
Longest Prefix Match table.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index b1dc195ad8cb..3191fc4c2639 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
 	uint8_t  if_out;
 };
 
+/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
 static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
-	{IPv4(1, 1, 1, 0), 24, 0},
-	{IPv4(2, 1, 1, 0), 24, 1},
-	{IPv4(3, 1, 1, 0), 24, 2},
-	{IPv4(4, 1, 1, 0), 24, 3},
-	{IPv4(5, 1, 1, 0), 24, 4},
-	{IPv4(6, 1, 1, 0), 24, 5},
-	{IPv4(7, 1, 1, 0), 24, 6},
-	{IPv4(8, 1, 1, 0), 24, 7},
+	{IPv4(192, 18, 0, 0), 24, 0},
+	{IPv4(192, 18, 1, 0), 24, 1},
+	{IPv4(192, 18, 2, 0), 24, 2},
+	{IPv4(192, 18, 3, 0), 24, 3},
+	{IPv4(192, 18, 4, 0), 24, 4},
+	{IPv4(192, 18, 5, 0), 24, 5},
+	{IPv4(192, 18, 6, 0), 24, 6},
+	{IPv4(192, 18, 7, 0), 24, 7},
 };
 
+/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
-	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
-	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
-	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
-	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
-	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
-	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
-	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
-	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
 };
 
 #define IPV4_L3FWD_LPM_NUM_ROUTES \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v5 3/3] examples/l3fwd: format the IP addresses for printing
  2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
                         ` (2 preceding siblings ...)
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
@ 2019-04-09 18:20       ` Stephen Hemminger
  2019-04-09 18:20         ` Stephen Hemminger
  2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
  4 siblings, 1 reply; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 18:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The IP addresses should be formatted using standard routines
rather than outputing in raw hex.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---

 examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3191fc4c2639..172a036b2707 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <stdbool.h>
+#include <arpa/inet.h>
 
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -260,6 +261,7 @@ setup_lpm(const int socketid)
 	unsigned i;
 	int ret;
 	char s[64];
+	char abuf[INET6_ADDRSTRLEN];
 
 	/* create the LPM table */
 	config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
@@ -275,6 +277,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct in_addr in;
 
 		/* skip unused ports */
 		if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &
@@ -292,8 +295,9 @@ setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route 0x%08x / %d (%d)\n",
-			(unsigned)ipv4_l3fwd_lpm_route_array[i].ip,
+		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
+		printf("LPM: Adding route %s / %d (%d)\n",
+		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
 			ipv4_l3fwd_lpm_route_array[i].if_out);
 	}
@@ -331,9 +335,10 @@ setup_lpm(const int socketid)
 		}
 
 		printf("LPM: Adding route %s / %d (%d)\n",
-			"IPV6",
-			ipv6_l3fwd_lpm_route_array[i].depth,
-			ipv6_l3fwd_lpm_route_array[i].if_out);
+		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
+				 abuf, sizeof(abuf)),
+		       ipv6_l3fwd_lpm_route_array[i].depth,
+		       ipv6_l3fwd_lpm_route_array[i].if_out);
 	}
 }
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v5 3/3] examples/l3fwd: format the IP addresses for printing
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
@ 2019-04-09 18:20         ` Stephen Hemminger
  0 siblings, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-09 18:20 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The IP addresses should be formatted using standard routines
rather than outputing in raw hex.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---

 examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3191fc4c2639..172a036b2707 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <stdbool.h>
+#include <arpa/inet.h>
 
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -260,6 +261,7 @@ setup_lpm(const int socketid)
 	unsigned i;
 	int ret;
 	char s[64];
+	char abuf[INET6_ADDRSTRLEN];
 
 	/* create the LPM table */
 	config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
@@ -275,6 +277,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct in_addr in;
 
 		/* skip unused ports */
 		if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &
@@ -292,8 +295,9 @@ setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route 0x%08x / %d (%d)\n",
-			(unsigned)ipv4_l3fwd_lpm_route_array[i].ip,
+		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
+		printf("LPM: Adding route %s / %d (%d)\n",
+		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
 			ipv4_l3fwd_lpm_route_array[i].if_out);
 	}
@@ -331,9 +335,10 @@ setup_lpm(const int socketid)
 		}
 
 		printf("LPM: Adding route %s / %d (%d)\n",
-			"IPV6",
-			ipv6_l3fwd_lpm_route_array[i].depth,
-			ipv6_l3fwd_lpm_route_array[i].if_out);
+		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
+				 abuf, sizeof(abuf)),
+		       ipv6_l3fwd_lpm_route_array[i].depth,
+		       ipv6_l3fwd_lpm_route_array[i].if_out);
 	}
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
  2019-04-09 18:20         ` Stephen Hemminger
@ 2019-04-10  8:56         ` Iremonger, Bernard
  2019-04-10  8:56           ` Iremonger, Bernard
  1 sibling, 1 reply; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-10  8:56 UTC (permalink / raw)
  To: Stephen Hemminger, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Tuesday, April 9, 2019 7:20 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6
> addresses
> 
> The l3fwd example should use the IPv4 addresses defined in RFC5735 and
> the IPv6 addresses defined in RFC5180 for the L3 forwarding example
> Longest Prefix Match table.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-10  8:56         ` Iremonger, Bernard
@ 2019-04-10  8:56           ` Iremonger, Bernard
  0 siblings, 0 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-10  8:56 UTC (permalink / raw)
  To: Stephen Hemminger, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Tuesday, April 9, 2019 7:20 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6
> addresses
> 
> The l3fwd example should use the IPv4 addresses defined in RFC5735 and
> the IPv6 addresses defined in RFC5180 for the L3 forwarding example
> Longest Prefix Match table.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
  2019-04-09 18:20         ` Stephen Hemminger
@ 2019-04-10 10:07         ` Iremonger, Bernard
  2019-04-10 10:07           ` Iremonger, Bernard
  1 sibling, 1 reply; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-10 10:07 UTC (permalink / raw)
  To: Stephen Hemminger, dev

Hi Stephen,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Tuesday, April 9, 2019 7:20 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and
> UDP parameters
> 
> This patch changes what testpmd uses as IP addresses when run in transmit
> only mode. The old code was using
> 192.168.0.1 -> 192.168.0.2
> but these addresses are reserved for private Internet by RFC 1918.
> 
> The new code uses 192.18.0.1 and 192.18.0.2 which are on the subnet
> reserved for performance testing by RFC 2544.
> 
> New command line option allows the user to pick any other src/dst address
> desired.
> 
> Notice: this changes the default IP address for transmit only.
> It may cause some user who has hardcoded network addresses to report a
> regression.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v5 -- rebase to 19.05-rc1 and fix reword commit message
> 
>  app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
>  app/test-pmd/testpmd.h                |  6 ++++
>  app/test-pmd/txonly.c                 | 20 ++++++-----
>  doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++-
>  4 files changed, 77 insertions(+), 10 deletions(-)
> 
> 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 <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 | "
> @@ -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 = 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
> 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;
> 
> +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 66e63788a25e..632d655235f0
> 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
> @@ -105,8 +107,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. */
> 
> @@ -121,8 +123,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.
> @@ -206,7 +208,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct
> rte_mempool *mbp,
>  		 * packet generator for developer's quick performance
>  		 * regression test.
>  		 */
> -		addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
> +		addr = (tx_ip_dst_addr | (ip_var++ << 8)) + rte_lcore_id();
>  		ip_hdr->src_addr = 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
>         ...
> 
> -
>  *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
> 
>      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``

An extra blank line is needed here for correct formatting in the output HTML

> +    Set the source and destination IP address used when doing transmit only
> 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=SRC[,DST]``

An extra blank line is needed here for correct formatting in the output HTML

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

./dpdk/devtools/checkpatches.sh is showing some lines over 80 characters in parameters.c

### [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters

WARNING:LONG_LINE: line over 80 characters
#88: FILE: app/test-pmd/parameters.c:762:
+                                                "Invalid source IP address: %s\n", optarg);

WARNING:LONG_LINE: line over 80 characters
#93: FILE: app/test-pmd/parameters.c:767:
+                                                "Invalid destination IP address: %s\n", optarg);

WARNING:LONG_LINE: line over 80 characters
#101: FILE: app/test-pmd/parameters.c:775:
+                               if (errno != 0 || end == optarg || n > UINT16_MAX ||

WARNING:LONG_LINE: line over 80 characters
#104: FILE: app/test-pmd/parameters.c:778:
+                                                "Invalid UDP port: %s\n", optarg);

total: 0 errors, 4 warnings, 153 lines checked

Regards,

Bernard.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-10 10:07         ` Iremonger, Bernard
@ 2019-04-10 10:07           ` Iremonger, Bernard
  0 siblings, 0 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-10 10:07 UTC (permalink / raw)
  To: Stephen Hemminger, dev

Hi Stephen,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Tuesday, April 9, 2019 7:20 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and
> UDP parameters
> 
> This patch changes what testpmd uses as IP addresses when run in transmit
> only mode. The old code was using
> 192.168.0.1 -> 192.168.0.2
> but these addresses are reserved for private Internet by RFC 1918.
> 
> The new code uses 192.18.0.1 and 192.18.0.2 which are on the subnet
> reserved for performance testing by RFC 2544.
> 
> New command line option allows the user to pick any other src/dst address
> desired.
> 
> Notice: this changes the default IP address for transmit only.
> It may cause some user who has hardcoded network addresses to report a
> regression.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v5 -- rebase to 19.05-rc1 and fix reword commit message
> 
>  app/test-pmd/parameters.c             | 49 +++++++++++++++++++++++++++
>  app/test-pmd/testpmd.h                |  6 ++++
>  app/test-pmd/txonly.c                 | 20 ++++++-----
>  doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++-
>  4 files changed, 77 insertions(+), 10 deletions(-)
> 
> 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 <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 | "
> @@ -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 = 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
> 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;
> 
> +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 66e63788a25e..632d655235f0
> 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
> @@ -105,8 +107,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. */
> 
> @@ -121,8 +123,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.
> @@ -206,7 +208,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct
> rte_mempool *mbp,
>  		 * packet generator for developer's quick performance
>  		 * regression test.
>  		 */
> -		addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
> +		addr = (tx_ip_dst_addr | (ip_var++ << 8)) + rte_lcore_id();
>  		ip_hdr->src_addr = 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
>         ...
> 
> -
>  *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
> 
>      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``

An extra blank line is needed here for correct formatting in the output HTML

> +    Set the source and destination IP address used when doing transmit only
> 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=SRC[,DST]``

An extra blank line is needed here for correct formatting in the output HTML

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

./dpdk/devtools/checkpatches.sh is showing some lines over 80 characters in parameters.c

### [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters

WARNING:LONG_LINE: line over 80 characters
#88: FILE: app/test-pmd/parameters.c:762:
+                                                "Invalid source IP address: %s\n", optarg);

WARNING:LONG_LINE: line over 80 characters
#93: FILE: app/test-pmd/parameters.c:767:
+                                                "Invalid destination IP address: %s\n", optarg);

WARNING:LONG_LINE: line over 80 characters
#101: FILE: app/test-pmd/parameters.c:775:
+                               if (errno != 0 || end == optarg || n > UINT16_MAX ||

WARNING:LONG_LINE: line over 80 characters
#104: FILE: app/test-pmd/parameters.c:778:
+                                                "Invalid UDP port: %s\n", optarg);

total: 0 errors, 4 warnings, 153 lines checked

Regards,

Bernard.


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing
  2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
                         ` (3 preceding siblings ...)
  2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
@ 2019-04-10 17:41       ` Stephen Hemminger
  2019-04-10 17:41         ` Stephen Hemminger
                           ` (4 more replies)
  4 siblings, 5 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-10 17:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

These patches get rid of the custom addresses used in testpmd
and l3fwd, and instead uses values that are reserved for testing
in the relevant RFC 2544.

This version fixes some formatting and long lines.

Stephen Hemminger (3):
  app/testpmd: add ability to set Tx IP and UDP parameters
  examples/l3fwd: use reserved IPv4/IPv6 addresses
  examples/l3fwd: format the IP addresses for printing

 app/test-pmd/parameters.c             | 53 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  6 +++
 app/test-pmd/txonly.c                 | 20 +++++-----
 doc/guides/testpmd_app_ug/run_app.rst | 14 ++++++-
 examples/l3fwd/l3fwd_lpm.c            | 49 ++++++++++++++-----------
 5 files changed, 111 insertions(+), 31 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing
  2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
@ 2019-04-10 17:41         ` Stephen Hemminger
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
                           ` (3 subsequent siblings)
  4 siblings, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-10 17:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

These patches get rid of the custom addresses used in testpmd
and l3fwd, and instead uses values that are reserved for testing
in the relevant RFC 2544.

This version fixes some formatting and long lines.

Stephen Hemminger (3):
  app/testpmd: add ability to set Tx IP and UDP parameters
  examples/l3fwd: use reserved IPv4/IPv6 addresses
  examples/l3fwd: format the IP addresses for printing

 app/test-pmd/parameters.c             | 53 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  6 +++
 app/test-pmd/txonly.c                 | 20 +++++-----
 doc/guides/testpmd_app_ug/run_app.rst | 14 ++++++-
 examples/l3fwd/l3fwd_lpm.c            | 49 ++++++++++++++-----------
 5 files changed, 111 insertions(+), 31 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
  2019-04-10 17:41         ` Stephen Hemminger
@ 2019-04-10 17:41         ` Stephen Hemminger
  2019-04-10 17:41           ` Stephen Hemminger
  2019-04-11  9:02           ` Iremonger, Bernard
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
                           ` (2 subsequent siblings)
  4 siblings, 2 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-10 17:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This patch changes what testpmd uses as IP addresses when
run in transmit only mode. The old code was using
192.168.0.1 -> 192.168.0.2
but these addresses are reserved for private Internet by RFC 1918.

The new code uses 192.18.0.1 and 192.18.0.2 which are on the
subnet reserved for performance testing by RFC 2544.

New command line option allows the user to pick any other src/dst
address desired.

Notice: this changes the default IP address for transmit only.
It may cause some user who has hardcoded network addresses to report
a regression.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v6 - fix formatting of document and break long lines

 app/test-pmd/parameters.c             | 53 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  6 +++
 app/test-pmd/txonly.c                 | 20 +++++-----
 doc/guides/testpmd_app_ug/run_app.rst | 14 ++++++-
 4 files changed, 83 insertions(+), 10 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 7b6b60905dce..d358cda2451f 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 | "
@@ -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,55 @@ 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 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;
 
+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 66e63788a25e..632d655235f0 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
@@ -105,8 +107,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. */
 
@@ -121,8 +123,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.
@@ -206,7 +208,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp,
 		 * packet generator for developer's quick performance
 		 * regression test.
 		 */
-		addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
+		addr = (tx_ip_dst_addr | (ip_var++ << 8)) + rte_lcore_id();
 		ip_hdr->src_addr = 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..a3e8e9bf2de2 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -121,12 +121,24 @@ The commandline options are:
        XX:XX:XX:XX:XX:02
        ...
 
-
 *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
 
     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 address values are source 192.18.0.1 and
+    destination 192.18.0.2. These are special purpose addresses
+    reserved for benchmarking (RFC 2544).
+
+*   ``--tx-udp=SRC[,DST]``
+
+    Set the source and destination UDP port number for transmit test only test.
+    The default port is the port 9 which is defined for the discard protocol
+    (RFC 863).
+
 *   ``--pkt-filter-mode=mode``
 
     Set Flow Director mode where mode is either ``none`` (the default), ``signature`` or ``perfect``.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
@ 2019-04-10 17:41           ` Stephen Hemminger
  2019-04-11  9:02           ` Iremonger, Bernard
  1 sibling, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-10 17:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This patch changes what testpmd uses as IP addresses when
run in transmit only mode. The old code was using
192.168.0.1 -> 192.168.0.2
but these addresses are reserved for private Internet by RFC 1918.

The new code uses 192.18.0.1 and 192.18.0.2 which are on the
subnet reserved for performance testing by RFC 2544.

New command line option allows the user to pick any other src/dst
address desired.

Notice: this changes the default IP address for transmit only.
It may cause some user who has hardcoded network addresses to report
a regression.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v6 - fix formatting of document and break long lines

 app/test-pmd/parameters.c             | 53 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  6 +++
 app/test-pmd/txonly.c                 | 20 +++++-----
 doc/guides/testpmd_app_ug/run_app.rst | 14 ++++++-
 4 files changed, 83 insertions(+), 10 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 7b6b60905dce..d358cda2451f 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 | "
@@ -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,55 @@ 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 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;
 
+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 66e63788a25e..632d655235f0 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
@@ -105,8 +107,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. */
 
@@ -121,8 +123,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.
@@ -206,7 +208,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp,
 		 * packet generator for developer's quick performance
 		 * regression test.
 		 */
-		addr = (IP_DST_ADDR | (ip_var++ << 8)) + rte_lcore_id();
+		addr = (tx_ip_dst_addr | (ip_var++ << 8)) + rte_lcore_id();
 		ip_hdr->src_addr = 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..a3e8e9bf2de2 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -121,12 +121,24 @@ The commandline options are:
        XX:XX:XX:XX:XX:02
        ...
 
-
 *   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
 
     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 address values are source 192.18.0.1 and
+    destination 192.18.0.2. These are special purpose addresses
+    reserved for benchmarking (RFC 2544).
+
+*   ``--tx-udp=SRC[,DST]``
+
+    Set the source and destination UDP port number for transmit test only test.
+    The default port is the port 9 which is defined for the discard protocol
+    (RFC 863).
+
 *   ``--pkt-filter-mode=mode``
 
     Set Flow Director mode where mode is either ``none`` (the default), ``signature`` or ``perfect``.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
  2019-04-10 17:41         ` Stephen Hemminger
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
@ 2019-04-10 17:41         ` Stephen Hemminger
  2019-04-10 17:41           ` Stephen Hemminger
  2019-04-11  9:08           ` Iremonger, Bernard
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
  2019-04-21 21:55         ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Thomas Monjalon
  4 siblings, 2 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-10 17:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The l3fwd example should use the IPv4 addresses defined in RFC5735 and
the IPv6 addresses defined in RFC5180 for the L3 forwarding example
Longest Prefix Match table.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index b1dc195ad8cb..3191fc4c2639 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
 	uint8_t  if_out;
 };
 
+/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
 static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
-	{IPv4(1, 1, 1, 0), 24, 0},
-	{IPv4(2, 1, 1, 0), 24, 1},
-	{IPv4(3, 1, 1, 0), 24, 2},
-	{IPv4(4, 1, 1, 0), 24, 3},
-	{IPv4(5, 1, 1, 0), 24, 4},
-	{IPv4(6, 1, 1, 0), 24, 5},
-	{IPv4(7, 1, 1, 0), 24, 6},
-	{IPv4(8, 1, 1, 0), 24, 7},
+	{IPv4(192, 18, 0, 0), 24, 0},
+	{IPv4(192, 18, 1, 0), 24, 1},
+	{IPv4(192, 18, 2, 0), 24, 2},
+	{IPv4(192, 18, 3, 0), 24, 3},
+	{IPv4(192, 18, 4, 0), 24, 4},
+	{IPv4(192, 18, 5, 0), 24, 5},
+	{IPv4(192, 18, 6, 0), 24, 6},
+	{IPv4(192, 18, 7, 0), 24, 7},
 };
 
+/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
-	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
-	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
-	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
-	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
-	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
-	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
-	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
-	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
 };
 
 #define IPV4_L3FWD_LPM_NUM_ROUTES \
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
@ 2019-04-10 17:41           ` Stephen Hemminger
  2019-04-11  9:08           ` Iremonger, Bernard
  1 sibling, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-10 17:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The l3fwd example should use the IPv4 addresses defined in RFC5735 and
the IPv6 addresses defined in RFC5180 for the L3 forwarding example
Longest Prefix Match table.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index b1dc195ad8cb..3191fc4c2639 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
 	uint8_t  if_out;
 };
 
+/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
 static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
-	{IPv4(1, 1, 1, 0), 24, 0},
-	{IPv4(2, 1, 1, 0), 24, 1},
-	{IPv4(3, 1, 1, 0), 24, 2},
-	{IPv4(4, 1, 1, 0), 24, 3},
-	{IPv4(5, 1, 1, 0), 24, 4},
-	{IPv4(6, 1, 1, 0), 24, 5},
-	{IPv4(7, 1, 1, 0), 24, 6},
-	{IPv4(8, 1, 1, 0), 24, 7},
+	{IPv4(192, 18, 0, 0), 24, 0},
+	{IPv4(192, 18, 1, 0), 24, 1},
+	{IPv4(192, 18, 2, 0), 24, 2},
+	{IPv4(192, 18, 3, 0), 24, 3},
+	{IPv4(192, 18, 4, 0), 24, 4},
+	{IPv4(192, 18, 5, 0), 24, 5},
+	{IPv4(192, 18, 6, 0), 24, 6},
+	{IPv4(192, 18, 7, 0), 24, 7},
 };
 
+/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
-	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
-	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
-	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
-	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
-	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
-	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
-	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
-	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
+	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
 };
 
 #define IPV4_L3FWD_LPM_NUM_ROUTES \
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing
  2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
                           ` (2 preceding siblings ...)
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
@ 2019-04-10 17:41         ` Stephen Hemminger
  2019-04-10 17:41           ` Stephen Hemminger
  2019-04-21 21:55         ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Thomas Monjalon
  4 siblings, 1 reply; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-10 17:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The IP addresses should be formatted using standard routines
rather than outputing in raw hex.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3191fc4c2639..172a036b2707 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <stdbool.h>
+#include <arpa/inet.h>
 
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -260,6 +261,7 @@ setup_lpm(const int socketid)
 	unsigned i;
 	int ret;
 	char s[64];
+	char abuf[INET6_ADDRSTRLEN];
 
 	/* create the LPM table */
 	config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
@@ -275,6 +277,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct in_addr in;
 
 		/* skip unused ports */
 		if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &
@@ -292,8 +295,9 @@ setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route 0x%08x / %d (%d)\n",
-			(unsigned)ipv4_l3fwd_lpm_route_array[i].ip,
+		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
+		printf("LPM: Adding route %s / %d (%d)\n",
+		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
 			ipv4_l3fwd_lpm_route_array[i].if_out);
 	}
@@ -331,9 +335,10 @@ setup_lpm(const int socketid)
 		}
 
 		printf("LPM: Adding route %s / %d (%d)\n",
-			"IPV6",
-			ipv6_l3fwd_lpm_route_array[i].depth,
-			ipv6_l3fwd_lpm_route_array[i].if_out);
+		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
+				 abuf, sizeof(abuf)),
+		       ipv6_l3fwd_lpm_route_array[i].depth,
+		       ipv6_l3fwd_lpm_route_array[i].if_out);
 	}
 }
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
@ 2019-04-10 17:41           ` Stephen Hemminger
  0 siblings, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2019-04-10 17:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The IP addresses should be formatted using standard routines
rather than outputing in raw hex.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3191fc4c2639..172a036b2707 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <stdbool.h>
+#include <arpa/inet.h>
 
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -260,6 +261,7 @@ setup_lpm(const int socketid)
 	unsigned i;
 	int ret;
 	char s[64];
+	char abuf[INET6_ADDRSTRLEN];
 
 	/* create the LPM table */
 	config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
@@ -275,6 +277,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct in_addr in;
 
 		/* skip unused ports */
 		if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &
@@ -292,8 +295,9 @@ setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route 0x%08x / %d (%d)\n",
-			(unsigned)ipv4_l3fwd_lpm_route_array[i].ip,
+		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
+		printf("LPM: Adding route %s / %d (%d)\n",
+		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
 			ipv4_l3fwd_lpm_route_array[i].if_out);
 	}
@@ -331,9 +335,10 @@ setup_lpm(const int socketid)
 		}
 
 		printf("LPM: Adding route %s / %d (%d)\n",
-			"IPV6",
-			ipv6_l3fwd_lpm_route_array[i].depth,
-			ipv6_l3fwd_lpm_route_array[i].if_out);
+		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
+				 abuf, sizeof(abuf)),
+		       ipv6_l3fwd_lpm_route_array[i].depth,
+		       ipv6_l3fwd_lpm_route_array[i].if_out);
 	}
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
  2019-04-10 17:41           ` Stephen Hemminger
@ 2019-04-11  9:02           ` Iremonger, Bernard
  2019-04-11  9:02             ` Iremonger, Bernard
  1 sibling, 1 reply; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-11  9:02 UTC (permalink / raw)
  To: Stephen Hemminger, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Wednesday, April 10, 2019 6:42 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and
> UDP parameters
> 
> This patch changes what testpmd uses as IP addresses when run in transmit
> only mode. The old code was using
> 192.168.0.1 -> 192.168.0.2
> but these addresses are reserved for private Internet by RFC 1918.
> 
> The new code uses 192.18.0.1 and 192.18.0.2 which are on the subnet
> reserved for performance testing by RFC 2544.
> 
> New command line option allows the user to pick any other src/dst address
> desired.
> 
> Notice: this changes the default IP address for transmit only.
> It may cause some user who has hardcoded network addresses to report a
> regression.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters
  2019-04-11  9:02           ` Iremonger, Bernard
@ 2019-04-11  9:02             ` Iremonger, Bernard
  0 siblings, 0 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-11  9:02 UTC (permalink / raw)
  To: Stephen Hemminger, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Wednesday, April 10, 2019 6:42 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and
> UDP parameters
> 
> This patch changes what testpmd uses as IP addresses when run in transmit
> only mode. The old code was using
> 192.168.0.1 -> 192.168.0.2
> but these addresses are reserved for private Internet by RFC 1918.
> 
> The new code uses 192.18.0.1 and 192.18.0.2 which are on the subnet
> reserved for performance testing by RFC 2544.
> 
> New command line option allows the user to pick any other src/dst address
> desired.
> 
> Notice: this changes the default IP address for transmit only.
> It may cause some user who has hardcoded network addresses to report a
> regression.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
  2019-04-10 17:41           ` Stephen Hemminger
@ 2019-04-11  9:08           ` Iremonger, Bernard
  2019-04-11  9:08             ` Iremonger, Bernard
  1 sibling, 1 reply; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-11  9:08 UTC (permalink / raw)
  To: Stephen Hemminger, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Wednesday, April 10, 2019 6:42 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6
> addresses
> 
> The l3fwd example should use the IPv4 addresses defined in RFC5735 and
> the IPv6 addresses defined in RFC5180 for the L3 forwarding example
> Longest Prefix Match table.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com> 

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses
  2019-04-11  9:08           ` Iremonger, Bernard
@ 2019-04-11  9:08             ` Iremonger, Bernard
  0 siblings, 0 replies; 53+ messages in thread
From: Iremonger, Bernard @ 2019-04-11  9:08 UTC (permalink / raw)
  To: Stephen Hemminger, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Wednesday, April 10, 2019 6:42 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6
> addresses
> 
> The l3fwd example should use the IPv4 addresses defined in RFC5735 and
> the IPv6 addresses defined in RFC5180 for the L3 forwarding example
> Longest Prefix Match table.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com> 

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing
  2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
                           ` (3 preceding siblings ...)
  2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
@ 2019-04-21 21:55         ` Thomas Monjalon
  2019-04-21 21:55           ` Thomas Monjalon
  4 siblings, 1 reply; 53+ messages in thread
From: Thomas Monjalon @ 2019-04-21 21:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

10/04/2019 19:41, Stephen Hemminger:
> Stephen Hemminger (3):
>   app/testpmd: add ability to set Tx IP and UDP parameters
>   examples/l3fwd: use reserved IPv4/IPv6 addresses
>   examples/l3fwd: format the IP addresses for printing

Applied, thanks

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing
  2019-04-21 21:55         ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Thomas Monjalon
@ 2019-04-21 21:55           ` Thomas Monjalon
  0 siblings, 0 replies; 53+ messages in thread
From: Thomas Monjalon @ 2019-04-21 21:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

10/04/2019 19:41, Stephen Hemminger:
> Stephen Hemminger (3):
>   app/testpmd: add ability to set Tx IP and UDP parameters
>   examples/l3fwd: use reserved IPv4/IPv6 addresses
>   examples/l3fwd: format the IP addresses for printing

Applied, thanks




^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2019-04-21 21:55 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 21:35 [dpdk-dev] [PATCH v3 0/3] use RFC addresses for testing Stephen Hemminger
2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
2018-06-22  9:12   ` Iremonger, Bernard
2018-10-29  2:25     ` Thomas Monjalon
2018-06-26 11:47   ` Shahaf Shuler
2018-06-26 11:51   ` Shahaf Shuler
2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
2019-04-02 20:39     ` Stephen Hemminger
2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
2019-04-02 20:39       ` Stephen Hemminger
2019-04-08 12:51       ` Iremonger, Bernard
2019-04-08 12:51         ` Iremonger, Bernard
2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
2019-04-02 20:39       ` Stephen Hemminger
2019-04-08 13:07       ` Iremonger, Bernard
2019-04-08 13:07         ` Iremonger, Bernard
2019-04-09 17:14         ` Stephen Hemminger
2019-04-09 17:14           ` Stephen Hemminger
2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
2019-04-02 20:39       ` Stephen Hemminger
2019-04-08 13:14       ` Iremonger, Bernard
2019-04-08 13:14         ` Iremonger, Bernard
2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
2019-04-09 18:20       ` Stephen Hemminger
2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
2019-04-09 18:20         ` Stephen Hemminger
2019-04-10 10:07         ` Iremonger, Bernard
2019-04-10 10:07           ` Iremonger, Bernard
2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
2019-04-09 18:20         ` Stephen Hemminger
2019-04-10  8:56         ` Iremonger, Bernard
2019-04-10  8:56           ` Iremonger, Bernard
2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
2019-04-09 18:20         ` Stephen Hemminger
2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
2019-04-10 17:41         ` Stephen Hemminger
2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
2019-04-10 17:41           ` Stephen Hemminger
2019-04-11  9:02           ` Iremonger, Bernard
2019-04-11  9:02             ` Iremonger, Bernard
2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
2019-04-10 17:41           ` Stephen Hemminger
2019-04-11  9:08           ` Iremonger, Bernard
2019-04-11  9:08             ` Iremonger, Bernard
2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
2019-04-10 17:41           ` Stephen Hemminger
2019-04-21 21:55         ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Thomas Monjalon
2019-04-21 21:55           ` Thomas Monjalon
2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
2018-06-22  9:19   ` Iremonger, Bernard
2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
2018-06-22 10:23   ` Iremonger, Bernard
2018-06-22 13:44     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).