From patchwork Wed Apr 10 17:41:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52616 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CB36F1B399; Wed, 10 Apr 2019 19:41:44 +0200 (CEST) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id D22A21B184 for ; Wed, 10 Apr 2019 19:41:37 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id b3so1848575plr.7 for ; Wed, 10 Apr 2019 10:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q0j+XL4ZZy9Nf7Q4yVLCZ+DpoSzsAi9uKtvFjbtVHX4=; b=sW72R+LS4abR4ivqm12ohSkWqcD0EB6tYnTT09Tq2fD5pPbkkgSswMpQlniC7D9kpA Rf1oHdCI/eT0SHls66t+fIQrMIszA1lgEk1QuxOoNia/Va4ec71bzHGXUDDGblA526Tp 4x2co0KfVUKyz2hj2+l/HsfngL0hEzwGG8KpGMkpeg/pADIkrGS0iQ/zn/+ifZUbgFv+ sSWnI7nN2YlZq1ALzLGyX086nM+8e7MNm0Q2ciboPdtMJRmY2m+Wb9hTFH2IAV59bt2L 03uTkrlCG0DKbc2Qu2Uknapjj/P/yN2P6R7H/51i7q2fJhJOkhU6YDtdLhZlobgQdCgW H0Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q0j+XL4ZZy9Nf7Q4yVLCZ+DpoSzsAi9uKtvFjbtVHX4=; b=hqpam0Cr4RqhnW5b0eUvYjT+emohkHXdTzArSALwSNRw7i4uVzPLnDikULzsNnkmFQ Xn/myfKntd8Fzrkv7nFFF5NmipujQW5dwWKdz/V2htUoh2CgcTUzIq0MkCr+5hRq8B99 6FYs4DPx+NfH4iN8tNjNZFR0PjI16vaX3cgATXcE9aPMRAAtU9+SBt/alqO1uX8xKYtR M3Bx6JLegIeEy3S+Zfbxi9bEdQfAMtLooL7sjOZeqIoUy6er5iLtMGCILT/xWjCnoyTI 9snM3+TXMvPIOSNZd0NVdMVW4TmTHxAvbrLJxFm+h21kRI+L8U7g9Xz6Y2xHS/W/T6i3 SY1A== X-Gm-Message-State: APjAAAXWRUMcyAiAwt3XMKZ0+XLtH2R3iJ0MoaMDkDH1PDIfHYTtAfII v30w/ovWrW9BiWvmfwK/40LPoAz75CVbXA== X-Google-Smtp-Source: APXvYqwc+S2anPrAzT/Fh3harcZUDPTZv2yl7Nvr8ktMMc5fG3shokGa91vmgddVFcm1XUUk5vaLvg== X-Received: by 2002:a17:902:f81:: with SMTP id 1mr45799584plz.216.1554918096268; Wed, 10 Apr 2019 10:41:36 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l69sm50229696pga.73.2019.04.10.10.41.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:41:35 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:41:30 -0700 Message-Id: <20190410174132.8349-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410174132.8349-1-stephen@networkplumber.org> References: <20190409182006.12944-1-stephen@networkplumber.org> <20190410174132.8349-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Bernard Iremonger --- 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 #include #include +#include #include #include @@ -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``. From patchwork Wed Apr 10 17:41:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52617 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3B7A81B3A4; Wed, 10 Apr 2019 19:41:48 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 1E7BE1B2AF for ; Wed, 10 Apr 2019 19:41:38 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id w23so1854791ply.4 for ; Wed, 10 Apr 2019 10:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EPVXjhJ083pVs32eU5ZyTvr7yCTBLlBJlHfovYTUCAo=; b=Zn0CZuPm/w5WAo7tfOlJNm8TBkWFviJc/zFDGKFFUK+1Iz10WP+ma3Q+0A0n/UXRXU RBdxr4GgGQTA7oMxwTR/E5CFl32Lc8ZS7A3w9XSWBO2RMoMHkIW+ZEaqyEcJZERDcxHm tnBhaLBL23XDqyukxIBxNWVXeZXa/n8GITvirZXDB+flIFSdODzbDnGeZFa/WEKm8YK+ d2LsOJfyEp23OrVOXlVj0rVVMsD35Id5AThoysXih5RirzCbtXmpS00aJm3x61m/zTMK QtVXtJLG6g/ginioU6swtDYnHjvwWWNokGbaadVm+8AvTtVNctUkrcixylPIXGNRTyaa aZ6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EPVXjhJ083pVs32eU5ZyTvr7yCTBLlBJlHfovYTUCAo=; b=HlU1ZmYnDQYg6uOgwW3RMe3tzSjcNpV/hcKHI41OuJxo75Ge04MlcLupNCAlTjB16I XDfKiknFGo2BqSQoWLB4y5hXM6+Ji14Kc5DhbacaIW2q/R7gLbNoFgYYSZ9V7io2ME2G dPaXjaOphaUF5ug52/AmgQvt7ehR8W6Y1f1AdhuXvYiSgobkl8MUatG4IfU/GCGUasEq TlEigik/06t2zRzOZI1jPAF/o75RDZBbogykwBEIdbVv/LA7kthcRNQs1rfM43l0ShHN MH3eV8vkPtoKrM2adpiSvk8L37GTVkp9h/2q3ZEJqZ7kYFbNmkxB4hIDYCzT69Xjd9ee jonA== X-Gm-Message-State: APjAAAUt+hG0mv3ZUWQwQ4xIK5o/g2iBLiZ0rq6KHQ5aXX3eApl0ogkr kOq/hXMqRaDXeDs+jnNOfZaztBl6crduiA== X-Google-Smtp-Source: APXvYqw8Q/UgaN95A7cSdWzhFMGEG/SzTzbtUQx/G46Pgr6vXHNh9eOWTVHDJmVjMJC87kNmk//Nlg== X-Received: by 2002:a17:902:9341:: with SMTP id g1mr7322276plp.81.1554918097443; Wed, 10 Apr 2019 10:41:37 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l69sm50229696pga.73.2019.04.10.10.41.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:41:36 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:41:31 -0700 Message-Id: <20190410174132.8349-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410174132.8349-1-stephen@networkplumber.org> References: <20190409182006.12944-1-stephen@networkplumber.org> <20190410174132.8349-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Bernard Iremonger --- 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 \ From patchwork Wed Apr 10 17:41:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52618 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 801C21B3AD; Wed, 10 Apr 2019 19:41:52 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id D009F1B2AF for ; Wed, 10 Apr 2019 19:41:39 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id k3so1979447pga.6 for ; Wed, 10 Apr 2019 10:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fvVS2PTMQybajiNqWI7kV2Jfe++BSoZj8m6EefsOUZQ=; b=REmmL1SYKJXH9ikuQBvXc/7nsGKeuk+mYNdfrtEV4z1IrC8na2/nxOvlRnQaa2JzFC xZlNLG/sirCZXdtLpSECefNolrwYOhrEMKUj9StKEMmw3PS0ndUNMDnXvIGI4zMevxVh 0DaXT+R+UKu8IrWsnKt2z2uNE4Vsn1d8di6ezAjQoGu2MiWDoWF6Zlhb/9p1mzkCMjXg grmkk2PfOTW8aunHheVBgpi7NgYEqpUQS05PUZcZRIgTP2Yo7TmSTuV/+CUmIDn9PpIs Xj2/ZHDZl24/H+NIRfbFdB7MZ1WUM5XQ6Dam8jfFa7swj7tysXGsEca+KXgtjEXkFnJo 0s3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fvVS2PTMQybajiNqWI7kV2Jfe++BSoZj8m6EefsOUZQ=; b=FgaeEJwkSxgWBeEk24wzej2OgS9VK/AlxVwCxIl9SAjkkFNVurDvS+qhNkAOwVwKMN jTmaz9eDdYuItIo00Wndae2QXZo5/gNAoXziEd0ck/KPr8Wc7+VPp33fU6slMMsx2xuG TtMIVy7/w/dxNsG1Fm9KdgSCDZdkvsb4VgpRga/rsOAg0LeV01p/IBDn47qf6dVK56UX vmd70NIAzUkXE8t0q2t9qzqwI9e14Z6SJljC4WAUuodMo4+QOn0Qbj6dJen+Aom3qZY0 WpJJzNFtinFGmbDEOoN6ijHOvGOL08URak6rEqbWo09BTXKVkXA6SBlCJHapB5OmMZPF DZMA== X-Gm-Message-State: APjAAAUxPuAhF326aNYN82g1AkP0CFAqw8U7sIxYMnYs7oVBnmCfG7Hn Jn6lYy6gky9aOE+3YywFqGAbEuLEKKV7YA== X-Google-Smtp-Source: APXvYqzVtoFOOvSoN2y/TMqaXIxHu4LL6zepSZ/kzcqEDN1rA3RUWFo1RM2P1D/cdoe/6EXhbgjzGw== X-Received: by 2002:a63:3d85:: with SMTP id k127mr42314481pga.152.1554918098557; Wed, 10 Apr 2019 10:41:38 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l69sm50229696pga.73.2019.04.10.10.41.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:41:37 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:41:32 -0700 Message-Id: <20190410174132.8349-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410174132.8349-1-stephen@networkplumber.org> References: <20190409182006.12944-1-stephen@networkplumber.org> <20190410174132.8349-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The IP addresses should be formatted using standard routines rather than outputing in raw hex. Signed-off-by: Stephen Hemminger Acked-by: Bernard Iremonger --- 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 #include #include +#include #include #include @@ -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); } }