dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Cunming Liang <cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH v7 5/7] examples: cleanup eth_addr print
Date: Wed, 12 Nov 2014 14:24:34 +0800	[thread overview]
Message-ID: <1415773476-31004-6-git-send-email-cunming.liang@intel.com> (raw)
In-Reply-To: <1415773476-31004-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Signed-off-by: Cunming Liang <cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 examples/dpdk_qat/main.c         |   10 +++-------
 examples/ip_fragmentation/main.c |   10 +++-------
 examples/ip_reassembly/main.c    |   10 +++-------
 examples/ipv4_multicast/main.c   |   10 +++-------
 examples/l3fwd-acl/main.c        |   10 +++-------
 examples/l3fwd-power/main.c      |   10 +++-------
 examples/l3fwd-vf/main.c         |   10 +++-------
 examples/l3fwd/main.c            |   10 +++-------
 8 files changed, 24 insertions(+), 56 deletions(-)

diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c
index 59a97bc..127ee40 100644
--- a/examples/dpdk_qat/main.c
+++ b/examples/dpdk_qat/main.c
@@ -592,13 +592,9 @@ parse_args(int argc, char **argv)
 static void
 print_ethaddr(const char *name, const struct ether_addr *eth_addr)
 {
-	printf ("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
-		eth_addr->addr_bytes[0],
-		eth_addr->addr_bytes[1],
-		eth_addr->addr_bytes[2],
-		eth_addr->addr_bytes[3],
-		eth_addr->addr_bytes[4],
-		eth_addr->addr_bytes[5]);
+	char buf[ETHER_ADDR_FMT_SIZE];
+	ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+	printf("%s%s", name, buf);
 }
 
 static int
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 65c4cf6..0ad8fca 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -600,13 +600,9 @@ parse_args(int argc, char **argv)
 static void
 print_ethaddr(const char *name, struct ether_addr *eth_addr)
 {
-	printf("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
-	       eth_addr->addr_bytes[0],
-	       eth_addr->addr_bytes[1],
-	       eth_addr->addr_bytes[2],
-	       eth_addr->addr_bytes[3],
-	       eth_addr->addr_bytes[4],
-	       eth_addr->addr_bytes[5]);
+	char buf[ETHER_ADDR_FMT_SIZE];
+	ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+	printf("%s%s", name, buf);
 }
 
 /* Check the link status of all ports in up to 9s, and print them finally */
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 0d92b3c..39d60ec 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -729,13 +729,9 @@ parse_args(int argc, char **argv)
 static void
 print_ethaddr(const char *name, const struct ether_addr *eth_addr)
 {
-	printf ("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
-		eth_addr->addr_bytes[0],
-		eth_addr->addr_bytes[1],
-		eth_addr->addr_bytes[2],
-		eth_addr->addr_bytes[3],
-		eth_addr->addr_bytes[4],
-		eth_addr->addr_bytes[5]);
+	char buf[ETHER_ADDR_FMT_SIZE];
+	ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+	printf("%s%s", name, buf);
 }
 
 /* Check the link status of all ports in up to 9s, and print them finally */
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index de5e6be..590d11a 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -586,13 +586,9 @@ parse_args(int argc, char **argv)
 static void
 print_ethaddr(const char *name, struct ether_addr *eth_addr)
 {
-	printf("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
-	       eth_addr->addr_bytes[0],
-	       eth_addr->addr_bytes[1],
-	       eth_addr->addr_bytes[2],
-	       eth_addr->addr_bytes[3],
-	       eth_addr->addr_bytes[4],
-	       eth_addr->addr_bytes[5]);
+	char buf[ETHER_ADDR_FMT_SIZE];
+	ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+	printf("%s%s", name, buf);
 }
 
 static int
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index e31a7d7..f12e5bb 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -1820,13 +1820,9 @@ parse_args(int argc, char **argv)
 static void
 print_ethaddr(const char *name, const struct ether_addr *eth_addr)
 {
-	printf("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
-		eth_addr->addr_bytes[0],
-		eth_addr->addr_bytes[1],
-		eth_addr->addr_bytes[2],
-		eth_addr->addr_bytes[3],
-		eth_addr->addr_bytes[4],
-		eth_addr->addr_bytes[5]);
+	char buf[ETHER_ADDR_FMT_SIZE];
+	ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+	printf("%s%s", name, buf);
 }
 
 static int
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 12e4fd6..76a512b 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1240,13 +1240,9 @@ parse_args(int argc, char **argv)
 static void
 print_ethaddr(const char *name, const struct ether_addr *eth_addr)
 {
-	printf ("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
-		eth_addr->addr_bytes[0],
-		eth_addr->addr_bytes[1],
-		eth_addr->addr_bytes[2],
-		eth_addr->addr_bytes[3],
-		eth_addr->addr_bytes[4],
-		eth_addr->addr_bytes[5]);
+	char buf[ETHER_ADDR_FMT_SIZE];
+	ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+	printf("%s%s", name, buf);
 }
 
 #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH)
diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c
index 0288d99..b560b7d 100644
--- a/examples/l3fwd-vf/main.c
+++ b/examples/l3fwd-vf/main.c
@@ -826,13 +826,9 @@ parse_args(int argc, char **argv)
 static void
 print_ethaddr(const char *name, const struct ether_addr *eth_addr)
 {
-	printf ("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
-		eth_addr->addr_bytes[0],
-		eth_addr->addr_bytes[1],
-		eth_addr->addr_bytes[2],
-		eth_addr->addr_bytes[3],
-		eth_addr->addr_bytes[4],
-		eth_addr->addr_bytes[5]);
+	char buf[ETHER_ADDR_FMT_SIZE];
+	ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+	printf("%s%s", name, buf);
 }
 
 #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH)
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 181d682..46ac68e 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1976,13 +1976,9 @@ parse_args(int argc, char **argv)
 static void
 print_ethaddr(const char *name, const struct ether_addr *eth_addr)
 {
-	printf ("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
-		eth_addr->addr_bytes[0],
-		eth_addr->addr_bytes[1],
-		eth_addr->addr_bytes[2],
-		eth_addr->addr_bytes[3],
-		eth_addr->addr_bytes[4],
-		eth_addr->addr_bytes[5]);
+	char buf[ETHER_ADDR_FMT_SIZE];
+	ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+	printf("%s%s", name, buf);
 }
 
 #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH)
-- 
1.7.4.1

  parent reply	other threads:[~2014-11-12  6:24 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25  6:12 [PATCH 0/5] app/test: unit test to measure cycles per packet Cunming Liang
     [not found] ` <1408947174-11323-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-25  6:12   ` [PATCH 1/5] app/test: unit test for rx and tx cycles/packet Cunming Liang
2014-08-25  6:12   ` [PATCH 2/5] app/test: measure standalone rx or " Cunming Liang
2014-08-25  6:12   ` [PATCH 3/5] ixgbe/vpmd: add fix to store unaligned mbuf point array Cunming Liang
2014-08-25  6:12   ` [PATCH 4/5] app/test: add unit test to measure RX burst cycles Cunming Liang
2014-08-25  6:12   ` [PATCH 5/5] app/test: allow to create packets in different sizes Cunming Liang
2014-09-03  1:46   ` [PATCH 0/5] app/test: unit test to measure cycles per packet Zhan, Zhaochen
2014-10-10 12:29   ` [PATCH v2 0/4] " Cunming Liang
     [not found]     ` <1412944201-30703-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-10 12:29       ` [PATCH v2 1/4] app/test: unit test for rx and tx cycles/packet Cunming Liang
     [not found]         ` <1412944201-30703-2-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-10 17:52           ` Neil Horman
     [not found]             ` <20141010175226.GG19499-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-10-12 11:10               ` Liang, Cunming
     [not found]                 ` <D0158A423229094DA7ABF71CF2FA0DA31183E8F0-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-13 12:56                   ` De Lara Guarch, Pablo
     [not found]                     ` <E115CCD9D858EF4F90C690B0DCB4D8972262B720-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-14  0:54                       ` Liang, Cunming
2014-10-21 10:33                   ` Neil Horman
     [not found]                     ` <20141021103315.GB12795-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-10-21 10:43                       ` Richardson, Bruce
     [not found]                         ` <59AF69C657FD0841A61C55336867B5B0344212BF-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-21 13:37                           ` Neil Horman
     [not found]                             ` <20141021133738.GC12795-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-10-21 22:43                               ` Ananyev, Konstantin
2014-10-21 13:17                       ` Liang, Cunming
     [not found]                         ` <D0158A423229094DA7ABF71CF2FA0DA3118501DD-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-22 14:03                           ` Neil Horman
     [not found]                             ` <20141022140316.GA13913-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-10-22 14:48                               ` Liang, Cunming
2014-10-22 14:53                               ` Ananyev, Konstantin
     [not found]                                 ` <2601191342CEEE43887BDE71AB977258213955A6-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-22 15:09                                   ` Richardson, Bruce
     [not found]                                     ` <59AF69C657FD0841A61C55336867B5B034421C3A-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-24  3:06                                       ` Liang, Cunming
2014-10-10 12:29       ` [PATCH v2 2/4] app/test: measure standalone rx or " Cunming Liang
2014-10-10 12:30       ` [PATCH v2 3/4] app/test: add unit test to measure RX burst cycles Cunming Liang
2014-10-10 12:30       ` [PATCH v2 4/4] app/test: allow to create packets in different sizes Cunming Liang
2014-10-20  8:13       ` [PATCH v3 0/2] app/test: unit test to measure cycles per packet Cunming Liang
     [not found]         ` <1413792832-32338-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-20  8:13           ` [PATCH v3 1/2] app/test: allow to create packets in different sizes Cunming Liang
2014-10-20  8:13           ` [PATCH v3 2/2] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-10-21  2:40           ` [PATCH v3 0/2] app/test: unit test to measure cycles per packet Liu, Yong
2014-10-24  5:39           ` [PATCH v4 0/3] " Cunming Liang
     [not found]             ` <1414129180-17669-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-24  5:39               ` [PATCH v4 1/3] app/test: allow to create packets in different sizes Cunming Liang
2014-10-24  5:39               ` [PATCH v4 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-10-24  5:39               ` [PATCH v4 3/3] ethdev: fix wrong error return refer to API definition Cunming Liang
2014-10-24  5:57               ` [PATCH v5 0/3] app/test: unit test to measure cycles per packet Cunming Liang
     [not found]                 ` <1414130282-17981-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-24  5:58                   ` [PATCH v5 1/3] app/test: allow to create packets in different sizes Cunming Liang
2014-10-24  5:58                   ` [PATCH v5 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-10-24  5:58                   ` [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition Cunming Liang
2014-10-27  1:20                   ` [PATCH v6 0/3] app/test: unit test to measure cycles per packet Cunming Liang
     [not found]                     ` <1414372809-14044-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-27  1:20                       ` [PATCH v6 1/3] app/test: allow to create packets in different sizes Cunming Liang
2014-10-27  1:20                       ` [PATCH v6 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
     [not found]                         ` <1414372809-14044-3-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-11 23:28                           ` Thomas Monjalon
2014-11-12  6:32                             ` Liang, Cunming
2014-10-27  1:20                       ` [PATCH v6 3/3] ethdev: fix wrong error return refere to API definition Cunming Liang
     [not found]                         ` <1414372809-14044-4-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-27 16:03                           ` Ananyev, Konstantin
2014-10-27  1:45                       ` [PATCH v6 0/3] app/test: unit test to measure cycles per packet Liu, Yong
2014-10-29  5:06                       ` Liang, Cunming
2014-11-12  6:24                       ` [PATCH v7 0/7] " Cunming Liang
     [not found]                         ` <1415773476-31004-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-12  6:24                           ` [PATCH v7 1/7] app/test: allow to create packets in different sizes Cunming Liang
2014-11-12  6:24                           ` [PATCH v7 2/7] ixgbe:clean scattered_rx configure in dev_stop Cunming Liang
     [not found]                             ` <1415773476-31004-3-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-12  7:53                               ` Thomas Monjalon
2014-11-12  8:21                                 ` Liang, Cunming
     [not found]                                   ` <D0158A423229094DA7ABF71CF2FA0DA31186C1AC-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-11-12  9:24                                     ` Thomas Monjalon
2014-11-12 10:29                                       ` Liang, Cunming
     [not found]                                         ` <D0158A423229094DA7ABF71CF2FA0DA31186C343-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-11-12 10:32                                           ` Thomas Monjalon
2014-11-12 10:42                                             ` Liang, Cunming
2014-11-12  6:24                           ` [PATCH v7 3/7] ether: new API to format eth_addr in string Cunming Liang
2014-11-12  6:24                           ` [PATCH v7 4/7] app/testpmd: cleanup eth_addr print Cunming Liang
2014-11-12  6:24                           ` Cunming Liang [this message]
2014-11-12  6:24                           ` [PATCH v7 6/7] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-11-12  6:24                           ` [PATCH v7 7/7] ethdev: fix wrong error return refere to API definition Cunming Liang
2014-11-12 23:50                           ` [PATCH v7 0/7] app/test: unit test to measure cycles per packet Thomas Monjalon
2014-10-24  5:59               ` [PATCH v4 0/3] " Liang, Cunming
     [not found]             ` <1414130090-17910-1-git-send-email-y>
     [not found]               ` <1414130090-17910-4-git-send-email-y>
2014-10-24 11:04                 ` [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition Ananyev, Konstantin
     [not found]                   ` <2601191342CEEE43887BDE71AB9772582139EBDC-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-27  0:58                     ` Liang, Cunming
2014-10-28 12:21       ` [PATCH v2 0/4] app/test: unit test to measure cycles per packet Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415773476-31004-6-git-send-email-cunming.liang@intel.com \
    --to=cunming.liang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).