DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v5 0/2] Use macro to print MAC address
@ 2021-08-23  9:31 Aman Singh
  2021-08-23  9:31 ` [dpdk-dev] [PATCH v5 1/2] net: added macro for MAC address print Aman Singh
  2021-08-23  9:31 ` [dpdk-dev] [PATCH v5 2/2] net: added macro to extract MAC address bytes Aman Singh
  0 siblings, 2 replies; 3+ messages in thread
From: Aman Singh @ 2021-08-23  9:31 UTC (permalink / raw)
  To: dev

Added macros to simplyfy print of MAC address.
The six bytes of mac address is extracted using
a macro to improve code readability.

Aman Singh (2):
  net: added macro for MAC address print
  net: added macro to extract MAC address bytes

 app/pdump/main.c                              |  5 +---
 app/test-pmd/cmdline.c                        |  6 ++--
 app/test-pmd/config.c                         |  6 ++--
 app/test-pmd/testpmd.c                        |  9 ++----
 app/test/test_event_eth_rx_adapter.c          |  5 +---
 app/test/test_event_eth_tx_adapter.c          |  5 +---
 drivers/bus/dpaa/base/fman/netcfg_layer.c     |  9 ++----
 drivers/common/mlx5/linux/mlx5_nl.c           |  6 ++--
 drivers/net/bnx2x/bnx2x.c                     |  4 +--
 drivers/net/bnx2x/bnx2x_vfpf.c                | 10 ++-----
 drivers/net/bnx2x/ecore_sp.c                  | 14 ++++-----
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bonding/rte_eth_bond_8023ad.c     |  4 +--
 drivers/net/bonding/rte_eth_bond_pmd.c        | 12 +++-----
 drivers/net/dpaa/dpaa_ethdev.c                | 10 ++-----
 drivers/net/e1000/igb_ethdev.c                |  9 ++----
 drivers/net/enic/base/vnic_dev.c              |  4 +--
 drivers/net/enic/enic_res.c                   |  2 +-
 drivers/net/failsafe/failsafe.c               |  6 ++--
 drivers/net/hinic/hinic_pmd_ethdev.c          |  6 ++--
 drivers/net/i40e/i40e_ethdev_vf.c             | 21 ++++----------
 drivers/net/iavf/iavf_ethdev.c                | 18 +++---------
 drivers/net/iavf/iavf_vchnl.c                 | 15 +++-------
 drivers/net/ice/ice_dcf.c                     |  6 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c              | 29 ++++---------------
 drivers/net/mlx4/mlx4.c                       |  7 ++---
 drivers/net/mlx5/linux/mlx5_os.c              |  7 ++---
 drivers/net/mlx5/windows/mlx5_os.c            |  7 ++---
 drivers/net/mvpp2/mrvl_flow.c                 |  4 +--
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/nfp/nfp_net.c                     |  2 +-
 drivers/net/qede/base/ecore_mcp.c             |  2 +-
 drivers/net/qede/base/ecore_sriov.c           |  2 +-
 drivers/net/qede/qede_ethdev.c                |  9 ++----
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/txgbe/txgbe_ethdev_vf.c           | 29 ++++---------------
 drivers/net/virtio/virtio_ethdev.c            |  4 +--
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  4 +--
 examples/bbdev_app/main.c                     |  9 ++----
 examples/bond/main.c                          |  3 +-
 examples/distributor/main.c                   |  5 +---
 examples/ethtool/ethtool-app/ethapp.c         | 10 ++-----
 .../pipeline_worker_generic.c                 |  5 +---
 .../eventdev_pipeline/pipeline_worker_tx.c    |  5 +---
 examples/flow_classify/flow_classify.c        |  5 +---
 examples/ioat/ioatfwd.c                       |  9 ++----
 examples/ip_pipeline/cli.c                    | 11 ++-----
 examples/l2fwd-cat/l2fwd-cat.c                |  5 +---
 examples/l2fwd-crypto/main.c                  | 11 ++-----
 examples/l2fwd-event/l2fwd_common.c           |  9 ++----
 examples/l2fwd-jobstats/main.c                | 11 ++-----
 examples/l2fwd-keepalive/main.c               |  9 ++----
 examples/l2fwd/main.c                         | 11 ++-----
 examples/link_status_interrupt/main.c         |  9 ++----
 examples/packet_ordering/main.c               |  5 +---
 examples/pipeline/cli.c                       |  6 ++--
 examples/rxtx_callbacks/main.c                |  4 +--
 examples/server_node_efd/server/main.c        |  6 ++--
 examples/skeleton/basicfwd.c                  |  5 +---
 examples/vhost/main.c                         | 17 +++--------
 examples/vm_power_manager/channel_monitor.c   |  4 +--
 .../guest_cli/vm_power_cli_guest.c            |  5 +---
 examples/vm_power_manager/main.c              |  5 +---
 examples/vmdq/main.c                          | 14 ++-------
 examples/vmdq_dcb/main.c                      | 14 ++-------
 lib/net/rte_ether.c                           |  2 +-
 lib/net/rte_ether.h                           | 14 +++++++++
 lib/vhost/vhost_user.c                        |  2 +-
 68 files changed, 156 insertions(+), 378 deletions(-)

-- 
2.17.1


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

* [dpdk-dev] [PATCH v5 1/2] net: added macro for MAC address print
  2021-08-23  9:31 [dpdk-dev] [PATCH v5 0/2] Use macro to print MAC address Aman Singh
@ 2021-08-23  9:31 ` Aman Singh
  2021-08-23  9:31 ` [dpdk-dev] [PATCH v5 2/2] net: added macro to extract MAC address bytes Aman Singh
  1 sibling, 0 replies; 3+ messages in thread
From: Aman Singh @ 2021-08-23  9:31 UTC (permalink / raw)
  To: dev

Added macro to print six bytes of MAC address.
The MAC addresses will be printed in upper case
hexadecimal format.
In case there is a specific check for lower case
MAC address, the user may need to make a change in
such test case after this patch.

Signed-off-by: Aman Singh <aman.deep.singh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---

V5: Print format aligned with rte_ether_format_addr API
    Both using upper case hexadecimal format.
---
 app/test-pmd/cmdline.c                    |  2 +-
 app/test-pmd/config.c                     |  2 +-
 app/test-pmd/testpmd.c                    |  2 +-
 drivers/bus/dpaa/base/fman/netcfg_layer.c |  2 +-
 drivers/common/mlx5/linux/mlx5_nl.c       |  2 +-
 drivers/net/bnx2x/bnx2x.c                 |  4 ++--
 drivers/net/bnx2x/bnx2x_vfpf.c            |  3 ++-
 drivers/net/bnx2x/ecore_sp.c              | 14 +++++++-------
 drivers/net/bnxt/bnxt_ethdev.c            |  2 +-
 drivers/net/bonding/rte_eth_bond_8023ad.c |  4 ++--
 drivers/net/bonding/rte_eth_bond_pmd.c    |  4 ++--
 drivers/net/dpaa/dpaa_ethdev.c            |  2 +-
 drivers/net/e1000/igb_ethdev.c            |  2 +-
 drivers/net/enic/base/vnic_dev.c          |  4 ++--
 drivers/net/enic/enic_res.c               |  2 +-
 drivers/net/failsafe/failsafe.c           |  2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c      |  2 +-
 drivers/net/i40e/i40e_ethdev_vf.c         |  6 +++---
 drivers/net/iavf/iavf_ethdev.c            |  4 ++--
 drivers/net/iavf/iavf_vchnl.c             |  4 ++--
 drivers/net/ice/ice_dcf.c                 |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c          |  6 +++---
 drivers/net/mlx4/mlx4.c                   |  2 +-
 drivers/net/mlx5/linux/mlx5_os.c          |  2 +-
 drivers/net/mlx5/windows/mlx5_os.c        |  2 +-
 drivers/net/mvpp2/mrvl_flow.c             |  4 ++--
 drivers/net/netvsc/hn_rndis.c             |  2 +-
 drivers/net/nfp/nfp_net.c                 |  2 +-
 drivers/net/qede/base/ecore_mcp.c         |  2 +-
 drivers/net/qede/base/ecore_sriov.c       |  2 +-
 drivers/net/qede/qede_ethdev.c            |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c       |  2 +-
 drivers/net/txgbe/txgbe_ethdev_vf.c       |  6 +++---
 drivers/net/virtio/virtio_ethdev.c        |  4 ++--
 drivers/net/vmxnet3/vmxnet3_ethdev.c      |  4 ++--
 examples/bbdev_app/main.c                 |  2 +-
 examples/ethtool/ethtool-app/ethapp.c     |  2 +-
 examples/ioat/ioatfwd.c                   |  2 +-
 examples/ip_pipeline/cli.c                |  4 ++--
 examples/l2fwd-crypto/main.c              |  2 +-
 examples/l2fwd-event/l2fwd_common.c       |  2 +-
 examples/l2fwd-jobstats/main.c            |  2 +-
 examples/l2fwd-keepalive/main.c           |  2 +-
 examples/l2fwd/main.c                     |  2 +-
 examples/link_status_interrupt/main.c     |  2 +-
 examples/pipeline/cli.c                   |  2 +-
 examples/server_node_efd/server/main.c    |  2 +-
 examples/vhost/main.c                     |  2 +-
 examples/vmdq/main.c                      |  2 +-
 examples/vmdq_dcb/main.c                  |  2 +-
 lib/net/rte_ether.c                       |  2 +-
 lib/net/rte_ether.h                       |  5 +++++
 lib/vhost/vhost_user.c                    |  2 +-
 53 files changed, 80 insertions(+), 74 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 82253bc751..d4186eb9b2 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10899,7 +10899,7 @@ static void cmd_mcast_addr_parsed(void *parsed_result,
 
 	if (!rte_is_multicast_ether_addr(&res->mc_addr)) {
 		fprintf(stderr,
-			"Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n",
+			"Invalid multicast addr " RTE_ETHER_ADDR_PRT_FMT "\n",
 			res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1],
 			res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3],
 			res->mc_addr.addr_bytes[4], res->mc_addr.addr_bytes[5]);
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 31d8ba1b91..21d5db5297 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -782,7 +782,7 @@ port_summary_display(portid_t port_id)
 	if (ret != 0)
 		return;
 
-	printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %s\n",
+	printf("%-4d " RTE_ETHER_ADDR_PRT_FMT " %-12s %-14s %-8s %s\n",
 		port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
 		mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
 		mac_addr.addr_bytes[4], mac_addr.addr_bytes[5], name,
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6cbe9ba3c8..d0ede963ea 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2622,7 +2622,7 @@ start_port(portid_t pid)
 				pi);
 
 		if (eth_macaddr_get_print_err(pi, &port->eth_addr) == 0)
-			printf("Port %d: %02X:%02X:%02X:%02X:%02X:%02X\n", pi,
+			printf("Port %d: " RTE_ETHER_ADDR_PRT_FMT "\n", pi,
 				port->eth_addr.addr_bytes[0],
 				port->eth_addr.addr_bytes[1],
 				port->eth_addr.addr_bytes[2],
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index 120deb0bb6..556d631faa 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -47,7 +47,7 @@ dump_netcfg(struct netcfg_info *cfg_ptr)
 		       (__if->mac_type == fman_mac_1g) ? "1G" :
 		       (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G");
 
-		printf("\tmac_addr: %02x:%02x:%02x:%02x:%02x:%02x\n",
+		printf("\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n",
 		       (&__if->mac_addr)->addr_bytes[0],
 		       (&__if->mac_addr)->addr_bytes[1],
 		       (&__if->mac_addr)->addr_bytes[2],
diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index dc8dafd0a8..efd92976b5 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -693,7 +693,7 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 error:
 	DRV_LOG(ERR,
 		"representor %u cannot set VF MAC address "
-		"%02X:%02X:%02X:%02X:%02X:%02X : %s",
+		RTE_ETHER_ADDR_PRT_FMT " : %s",
 		vf_index,
 		mac->addr_bytes[0], mac->addr_bytes[1],
 		mac->addr_bytes[2], mac->addr_bytes[3],
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 7ee805bd0d..9163b8b1fd 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -8176,7 +8176,7 @@ static int bnx2x_get_shmem_info(struct bnx2x_softc *sc)
 		sc->link_params.mac_addr[4] = (uint8_t) (mac_lo >> 8);
 		sc->link_params.mac_addr[5] = (uint8_t) (mac_lo);
 		snprintf(sc->mac_addr_str, sizeof(sc->mac_addr_str),
-			 "%02x:%02x:%02x:%02x:%02x:%02x",
+			 RTE_ETHER_ADDR_PRT_FMT,
 			 sc->link_params.mac_addr[0],
 			 sc->link_params.mac_addr[1],
 			 sc->link_params.mac_addr[2],
@@ -11894,7 +11894,7 @@ void bnx2x_print_device_info(struct bnx2x_softc *sc)
 	PMD_DRV_LOG(INFO, sc, "%12s : %u", "MTU", sc->mtu);
 	PMD_DRV_LOG(INFO, sc,
 		    "%12s : %s", "PHY Type", get_ext_phy_type(ext_phy_type));
-	PMD_DRV_LOG(INFO, sc, "%12s : %x:%x:%x:%x:%x:%x", "MAC Addr",
+	PMD_DRV_LOG(INFO, sc, "%12s : " RTE_ETHER_ADDR_PRT_FMT, "MAC Addr",
 			sc->link_params.mac_addr[0],
 			sc->link_params.mac_addr[1],
 			sc->link_params.mac_addr[2],
diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c
index 097ccfee19..03ba0d811f 100644
--- a/drivers/net/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/bnx2x/bnx2x_vfpf.c
@@ -728,7 +728,8 @@ bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc,
 	}
 
 	for (i = 0; i < mc_addrs_num; i++) {
-		PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:%x:%x:%x:%x:%x:%x",
+		PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:"
+				RTE_ETHER_ADDR_PRT_FMT,
 				mc_addrs[i].addr_bytes[0],
 				mc_addrs[i].addr_bytes[1],
 				mc_addrs[i].addr_bytes[2],
diff --git a/drivers/net/bnx2x/ecore_sp.c b/drivers/net/bnx2x/ecore_sp.c
index 61f99c6408..0075422eee 100644
--- a/drivers/net/bnx2x/ecore_sp.c
+++ b/drivers/net/bnx2x/ecore_sp.c
@@ -618,7 +618,7 @@ static int ecore_check_mac_add(struct bnx2x_softc *sc __rte_unused,
 {
 	struct ecore_vlan_mac_registry_elem *pos;
 
-	ECORE_MSG(sc, "Checking MAC %02x:%02x:%02x:%02x:%02x:%02x for ADD command",
+	ECORE_MSG(sc, "Checking MAC " RTE_ETHER_ADDR_PRT_FMT " for ADD command",
 		  data->mac.mac[0], data->mac.mac[1], data->mac.mac[2],
 		  data->mac.mac[3], data->mac.mac[4], data->mac.mac[5]);
 
@@ -647,7 +647,7 @@ static struct ecore_vlan_mac_registry_elem *ecore_check_mac_del(struct bnx2x_sof
 {
 	struct ecore_vlan_mac_registry_elem *pos;
 
-	ECORE_MSG(sc, "Checking MAC %02x:%02x:%02x:%02x:%02x:%02x for DEL command",
+	ECORE_MSG(sc, "Checking MAC " RTE_ETHER_ADDR_PRT_FMT " for DEL command",
 		  data->mac.mac[0], data->mac.mac[1], data->mac.mac[2],
 		  data->mac.mac[3], data->mac.mac[4], data->mac.mac[5]);
 
@@ -841,7 +841,7 @@ static void ecore_set_one_mac_e2(struct bnx2x_softc *sc,
 	ecore_vlan_mac_set_cmd_hdr_e2(o, add, CLASSIFY_RULE_OPCODE_MAC,
 				      &rule_entry->mac.header);
 
-	ECORE_MSG(sc, "About to %s MAC %02x:%02x:%02x:%02x:%02x:%02x for Queue %d",
+	ECORE_MSG(sc, "About to %s MAC " RTE_ETHER_ADDR_PRT_FMT " for Queue %d",
 		  (add ? "add" : "delete"), mac[0], mac[1], mac[2], mac[3],
 		  mac[4], mac[5], raw->cl_id);
 
@@ -946,7 +946,7 @@ static void ecore_vlan_mac_set_rdata_e1x(struct bnx2x_softc *sc
 	ecore_vlan_mac_set_cfg_entry_e1x(o, add, opcode, mac, vlan_id,
 					 cfg_entry);
 
-	ECORE_MSG(sc, "%s MAC %02x:%02x:%02x:%02x:%02x:%02x CLID %d CAM offset %d",
+	ECORE_MSG(sc, "%s  MAC " RTE_ETHER_ADDR_PRT_FMT " CLID %d CAM offset %d",
 		  (add ? "setting" : "clearing"),
 		  mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
 		  o->raw.cl_id, cam_offset);
@@ -2511,7 +2511,7 @@ static void ecore_mcast_hdl_pending_add_e2(struct bnx2x_softc *sc,
 		cnt++;
 
 		    ECORE_MSG
-		    (sc, "About to configure %02x:%02x:%02x:%02x:%02x:%02x mcast MAC",
+		    (sc, "About to configure " RTE_ETHER_ADDR_PRT_FMT " mcast MAC",
 		     pmac_pos->mac[0], pmac_pos->mac[1], pmac_pos->mac[2],
 		     pmac_pos->mac[3], pmac_pos->mac[4], pmac_pos->mac[5]);
 
@@ -2644,7 +2644,7 @@ static void ecore_mcast_hdl_add(struct bnx2x_softc *sc,
 		cnt++;
 
 		    ECORE_MSG
-		    (sc, "About to configure %02x:%02x:%02x:%02x:%02x:%02x mcast MAC",
+		    (sc, "About to configure " RTE_ETHER_ADDR_PRT_FMT " mcast MAC",
 		     mlist_pos->mac[0], mlist_pos->mac[1], mlist_pos->mac[2],
 		     mlist_pos->mac[3], mlist_pos->mac[4], mlist_pos->mac[5]);
 	}
@@ -2944,7 +2944,7 @@ static void ecore_mcast_hdl_add_e1h(struct bnx2x_softc *sc __rte_unused,
 		ECORE_57711_SET_MC_FILTER(mc_filter, bit);
 
 		    ECORE_MSG
-		    (sc, "About to configure %02x:%02x:%02x:%02x:%02x:%02x mcast MAC, bin %d",
+		    (sc, "About to configure " RTE_ETHER_ADDR_PRT_FMT " mcast MAC, bin %d",
 		     mlist_pos->mac[0], mlist_pos->mac[1], mlist_pos->mac[2],
 		     mlist_pos->mac[3], mlist_pos->mac[4], mlist_pos->mac[5],
 		     bit);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index de34a2f0bb..09faaf0c2e 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4992,7 +4992,7 @@ static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)
 		PMD_DRV_LOG(INFO, "VF MAC address not assigned by Host PF\n");
 		bnxt_eth_hw_addr_random(bp->mac_addr);
 		PMD_DRV_LOG(INFO,
-			    "Assign random MAC:%02X:%02X:%02X:%02X:%02X:%02X\n",
+			    "Assign random MAC:" RTE_ETHER_ADDR_PRT_FMT "\n",
 			    bp->mac_addr[0], bp->mac_addr[1], bp->mac_addr[2],
 			    bp->mac_addr[3], bp->mac_addr[4], bp->mac_addr[5]);
 
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 128754f459..8b5b32fcaf 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -55,11 +55,11 @@ bond_print_lacp(struct lacpdu *l)
 	uint8_t *addr;
 
 	addr = l->actor.port_params.system.addr_bytes;
-	snprintf(a_address, sizeof(a_address), "%02X:%02X:%02X:%02X:%02X:%02X",
+	snprintf(a_address, sizeof(a_address), RTE_ETHER_ADDR_PRT_FMT,
 		addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
 
 	addr = l->partner.port_params.system.addr_bytes;
-	snprintf(p_address, sizeof(p_address), "%02X:%02X:%02X:%02X:%02X:%02X",
+	snprintf(p_address, sizeof(p_address), RTE_ETHER_ADDR_PRT_FMT,
 		addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
 
 	for (i = 0; i < 8; i++) {
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index a6755661c4..d3cbd753cf 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -473,8 +473,8 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator)
 #ifdef RTE_LIBRTE_BOND_DEBUG_ALB
 #define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_op, port, burstnumber) \
 	rte_log(RTE_LOG_DEBUG, bond_logtype,				\
-		"%s port:%d SrcMAC:%02X:%02X:%02X:%02X:%02X:%02X SrcIP:%s " \
-		"DstMAC:%02X:%02X:%02X:%02X:%02X:%02X DstIP:%s %s %d\n", \
+		"%s port:%d SrcMAC:" RTE_ETHER_ADDR_PRT_FMT " SrcIP:%s " \
+		"DstMAC:" RTE_ETHER_ADDR_PRT_FMT " DstIP:%s %s %d\n", \
 		info,							\
 		port,							\
 		eth_h->s_addr.addr_bytes[0], eth_h->s_addr.addr_bytes[1], \
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 27d670f843..c5739a3a80 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -2094,7 +2094,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	/* copy the primary mac address */
 	rte_ether_addr_copy(&fman_intf->mac_addr, &eth_dev->data->mac_addrs[0]);
 
-	RTE_LOG(INFO, PMD, "net: dpaa: %s: %02x:%02x:%02x:%02x:%02x:%02x\n",
+	RTE_LOG(INFO, PMD, "net: dpaa: %s: " RTE_ETHER_ADDR_PRT_FMT "\n",
 		dpaa_device->name,
 		fman_intf->mac_addr.addr_bytes[0],
 		fman_intf->mac_addr.addr_bytes[1],
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 10ee0f3341..91db3032f5 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -977,7 +977,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
 		rte_eth_random_addr(perm_addr->addr_bytes);
 		PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF");
 		PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address "
-			     "%02x:%02x:%02x:%02x:%02x:%02x",
+			     RTE_ETHER_ADDR_PRT_FMT,
 			     perm_addr->addr_bytes[0],
 			     perm_addr->addr_bytes[1],
 			     perm_addr->addr_bytes[2],
diff --git a/drivers/net/enic/base/vnic_dev.c b/drivers/net/enic/base/vnic_dev.c
index 55c08eb3dc..ab6e05739b 100644
--- a/drivers/net/enic/base/vnic_dev.c
+++ b/drivers/net/enic/base/vnic_dev.c
@@ -889,7 +889,7 @@ int vnic_dev_add_addr(struct vnic_dev *vdev, uint8_t *addr)
 
 	err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
 	if (err)
-		pr_err("Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
+		pr_err("Can't add addr [" RTE_ETHER_ADDR_PRT_FMT "], %d\n",
 			addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
 			err);
 
@@ -908,7 +908,7 @@ int vnic_dev_del_addr(struct vnic_dev *vdev, uint8_t *addr)
 
 	err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait);
 	if (err)
-		pr_err("Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
+		pr_err("Can't del addr [" RTE_ETHER_ADDR_PRT_FMT "], %d\n",
 			addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
 			err);
 
diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c
index a8f5332a40..0493e096d0 100644
--- a/drivers/net/enic/enic_res.c
+++ b/drivers/net/enic/enic_res.c
@@ -113,7 +113,7 @@ int enic_get_vnic_config(struct enic *enic)
 				  vnic_dev_get_intr_coal_timer_max(enic->vdev));
 
 	dev_info(enic_get_dev(enic),
-		"vNIC MAC addr %02x:%02x:%02x:%02x:%02x:%02x "
+		"vNIC MAC addr " RTE_ETHER_ADDR_PRT_FMT
 		"wq/rq %d/%d mtu %d, max mtu:%d\n",
 		enic->mac_addr[0], enic->mac_addr[1], enic->mac_addr[2],
 		enic->mac_addr[3], enic->mac_addr[4], enic->mac_addr[5],
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 8216063a3d..919d287f88 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -260,7 +260,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
 		if (i == priv->subs_tail)
 			rte_eth_random_addr(&mac->addr_bytes[0]);
 	}
-	INFO("MAC address is %02x:%02x:%02x:%02x:%02x:%02x",
+	INFO("MAC address is " RTE_ETHER_ADDR_PRT_FMT,
 		mac->addr_bytes[0], mac->addr_bytes[1],
 		mac->addr_bytes[2], mac->addr_bytes[3],
 		mac->addr_bytes[4], mac->addr_bytes[5]);
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 1a72401546..3ffad21d1a 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -2359,7 +2359,7 @@ static int hinic_set_mac_addr(struct rte_eth_dev *dev,
 
 	rte_ether_addr_copy(addr, &nic_dev->default_addr);
 
-	PMD_DRV_LOG(INFO, "Set new mac address %02x:%02x:%02x:%02x:%02x:%02x",
+	PMD_DRV_LOG(INFO, "Set new mac address " RTE_ETHER_ADDR_PRT_FMT,
 		    addr->addr_bytes[0], addr->addr_bytes[1],
 		    addr->addr_bytes[2], addr->addr_bytes[3],
 		    addr->addr_bytes[4], addr->addr_bytes[5]);
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 0cfe13b7b2..dcc2b64e17 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -867,7 +867,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
 	int err;
 
 	if (rte_is_zero_ether_addr(addr)) {
-		PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x",
+		PMD_DRV_LOG(ERR, "Invalid mac:" RTE_ETHER_ADDR_PRT_FMT,
 			    addr->addr_bytes[0], addr->addr_bytes[1],
 			    addr->addr_bytes[2], addr->addr_bytes[3],
 			    addr->addr_bytes[4], addr->addr_bytes[5]);
@@ -2130,7 +2130,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add)
 			list->list[j].type = (j == 0 ?
 					      VIRTCHNL_ETHER_ADDR_PRIMARY :
 					      VIRTCHNL_ETHER_ADDR_EXTRA);
-			PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x",
+			PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT,
 				    addr->addr_bytes[0], addr->addr_bytes[1],
 				    addr->addr_bytes[2], addr->addr_bytes[3],
 				    addr->addr_bytes[4], addr->addr_bytes[5]);
@@ -2949,7 +2949,7 @@ i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev,
 
 	for (i = 0; i < mc_addrs_num; i++) {
 		if (!I40E_IS_MULTICAST(mc_addrs[i].addr_bytes)) {
-			PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x",
+			PMD_DRV_LOG(ERR, "Invalid mac:" RTE_ETHER_ADDR_PRT_FMT,
 				    mc_addrs[i].addr_bytes[0],
 				    mc_addrs[i].addr_bytes[1],
 				    mc_addrs[i].addr_bytes[2],
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 574cfe055e..676120be2c 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1485,7 +1485,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev,
 	ret = iavf_add_del_eth_addr(adapter, old_addr, false, VIRTCHNL_ETHER_ADDR_PRIMARY);
 	if (ret)
 		PMD_DRV_LOG(ERR, "Fail to delete old MAC:"
-			    " %02X:%02X:%02X:%02X:%02X:%02X",
+			    RTE_ETHER_ADDR_PRT_FMT,
 			    old_addr->addr_bytes[0],
 			    old_addr->addr_bytes[1],
 			    old_addr->addr_bytes[2],
@@ -1496,7 +1496,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev,
 	ret = iavf_add_del_eth_addr(adapter, mac_addr, true, VIRTCHNL_ETHER_ADDR_PRIMARY);
 	if (ret)
 		PMD_DRV_LOG(ERR, "Fail to add new MAC:"
-			    " %02X:%02X:%02X:%02X:%02X:%02X",
+			    RTE_ETHER_ADDR_PRT_FMT,
 			    mac_addr->addr_bytes[0],
 			    mac_addr->addr_bytes[1],
 			    mac_addr->addr_bytes[2],
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 06dc663947..62fb91ec75 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -1176,7 +1176,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
 			list->list[j].type = (j == 0 ?
 					      VIRTCHNL_ETHER_ADDR_PRIMARY :
 					      VIRTCHNL_ETHER_ADDR_EXTRA);
-			PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x",
+			PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT,
 				    addr->addr_bytes[0], addr->addr_bytes[1],
 				    addr->addr_bytes[2], addr->addr_bytes[3],
 				    addr->addr_bytes[4], addr->addr_bytes[5]);
@@ -1626,7 +1626,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
 
 	for (i = 0; i < mc_addrs_num; i++) {
 		if (!IAVF_IS_MULTICAST(mc_addrs[i].addr_bytes)) {
-			PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x",
+			PMD_DRV_LOG(ERR, "Invalid mac:" RTE_ETHER_ADDR_PRT_FMT,
 				    mc_addrs[i].addr_bytes[0],
 				    mc_addrs[i].addr_bytes[1],
 				    mc_addrs[i].addr_bytes[2],
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 4c2e0c7216..9ca3c755b8 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -1075,7 +1075,7 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
 
 	rte_memcpy(list->list[0].addr, addr->addr_bytes,
 			sizeof(addr->addr_bytes));
-	PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x",
+	PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT,
 			    addr->addr_bytes[0], addr->addr_bytes[1],
 			    addr->addr_bytes[2], addr->addr_bytes[3],
 			    addr->addr_bytes[4], addr->addr_bytes[5]);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b5371568b5..b4af930906 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1650,7 +1650,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 		}
 		PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF");
 		PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address "
-			     "%02x:%02x:%02x:%02x:%02x:%02x",
+			     RTE_ETHER_ADDR_PRT_FMT,
 			     perm_addr->addr_bytes[0],
 			     perm_addr->addr_bytes[1],
 			     perm_addr->addr_bytes[2],
@@ -6301,7 +6301,7 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes);
 	if (diag != 0)
 		PMD_DRV_LOG(ERR, "Unable to add MAC address "
-			    "%02x:%02x:%02x:%02x:%02x:%02x - diag=%d",
+			    RTE_ETHER_ADDR_PRT_FMT " - diag=%d",
 			    mac_addr->addr_bytes[0],
 			    mac_addr->addr_bytes[1],
 			    mac_addr->addr_bytes[2],
@@ -6350,7 +6350,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 		if (diag != 0)
 			PMD_DRV_LOG(ERR,
 				    "Adding again MAC address "
-				    "%02x:%02x:%02x:%02x:%02x:%02x failed "
+				     RTE_ETHER_ADDR_PRT_FMT " failed "
 				    "diag=%d",
 				    mac_addr->addr_bytes[0],
 				    mac_addr->addr_bytes[1],
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index c522157a0a..2b17bfac0b 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -1014,7 +1014,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 			      " (error: %s)", strerror(err));
 			goto port_error;
 		}
-		INFO("port %u MAC address is %02x:%02x:%02x:%02x:%02x:%02x",
+		INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
 		     priv->port,
 		     mac.addr_bytes[0], mac.addr_bytes[1],
 		     mac.addr_bytes[2], mac.addr_bytes[3],
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 8f98cf1716..244865792c 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1665,7 +1665,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		goto error;
 	}
 	DRV_LOG(INFO,
-		"port %u MAC address is %02x:%02x:%02x:%02x:%02x:%02x",
+		"port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
 		eth_dev->data->port_id,
 		mac.addr_bytes[0], mac.addr_bytes[1],
 		mac.addr_bytes[2], mac.addr_bytes[3],
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index 5a18f538bc..6a109db8e8 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -566,7 +566,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		goto error;
 	}
 	DRV_LOG(INFO,
-		"port %u MAC address is %02x:%02x:%02x:%02x:%02x:%02x",
+		"port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
 		eth_dev->data->port_id,
 		mac.addr_bytes[0], mac.addr_bytes[1],
 		mac.addr_bytes[2], mac.addr_bytes[3],
diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c
index 3c8052f069..99695b91c4 100644
--- a/drivers/net/mvpp2/mrvl_flow.c
+++ b/drivers/net/mvpp2/mrvl_flow.c
@@ -207,11 +207,11 @@ mrvl_parse_mac(const struct rte_flow_item_eth *spec,
 	key_field->size = 6;
 
 	snprintf((char *)key_field->key, MRVL_CLS_STR_SIZE_MAX,
-		 "%02x:%02x:%02x:%02x:%02x:%02x",
+		 RTE_ETHER_ADDR_PRT_FMT,
 		 k[0], k[1], k[2], k[3], k[4], k[5]);
 
 	snprintf((char *)key_field->mask, MRVL_CLS_STR_SIZE_MAX,
-		 "%02x:%02x:%02x:%02x:%02x:%02x",
+		 RTE_ETHER_ADDR_PRT_FMT,
 		 m[0], m[1], m[2], m[3], m[4], m[5]);
 
 	flow->table_key.proto_field[flow->rule.num_fields].proto =
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index e3f7e636d7..62ba39636c 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -1104,7 +1104,7 @@ hn_rndis_get_eaddr(struct hn_data *hv, uint8_t *eaddr)
 	if (error)
 		return error;
 
-	PMD_DRV_LOG(INFO, "MAC address %02x:%02x:%02x:%02x:%02x:%02x",
+	PMD_DRV_LOG(INFO, "MAC address " RTE_ETHER_ADDR_PRT_FMT,
 		    eaddr[0], eaddr[1], eaddr[2],
 		    eaddr[3], eaddr[4], eaddr[5]);
 	return 0;
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index a30e78db16..5004a16709 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2990,7 +2990,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
 	PMD_INIT_LOG(INFO, "port %d VendorID=0x%x DeviceID=0x%x "
-		     "mac=%02x:%02x:%02x:%02x:%02x:%02x",
+		     "mac=" RTE_ETHER_ADDR_PRT_FMT,
 		     eth_dev->data->port_id, pci_dev->id.vendor_id,
 		     pci_dev->id.device_id,
 		     hw->mac_addr[0], hw->mac_addr[1], hw->mac_addr[2],
diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c
index cab089d816..ec83b244e6 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -2611,7 +2611,7 @@ enum _ecore_status_t ecore_mcp_fill_shmem_func_info(struct ecore_hwfn *p_hwfn,
 	DP_VERBOSE(p_hwfn, (ECORE_MSG_SP | ECORE_MSG_IFUP),
 		   "Read configuration from shmem: pause_on_host %02x"
 		    " protocol %02x BW [%02x - %02x]"
-		    " MAC %02x:%02x:%02x:%02x:%02x:%02x wwn port %lx"
+		    " MAC " RTE_ETHER_ADDR_PRT_FMT " wwn port %lx"
 		    " node %lx ovlan %04x\n",
 		   info->pause_on_host, info->protocol,
 		   info->bandwidth_min, info->bandwidth_max,
diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c
index ed8cc695fe..e12e998179 100644
--- a/drivers/net/qede/base/ecore_sriov.c
+++ b/drivers/net/qede/base/ecore_sriov.c
@@ -3539,7 +3539,7 @@ static void ecore_iov_vf_mbx_ucast_filter(struct ecore_hwfn *p_hwfn,
 
 	DP_VERBOSE(p_hwfn, ECORE_MSG_IOV,
 		   "VF[%d]: opcode 0x%02x type 0x%02x [%s %s] [vport 0x%02x]"
-		   " MAC %02x:%02x:%02x:%02x:%02x:%02x, vlan 0x%04x\n",
+		   " MAC " RTE_ETHER_ADDR_PRT_FMT ", vlan 0x%04x\n",
 		   vf->abs_vf_id, params.opcode, params.type,
 		   params.is_rx_filter ? "RX" : "",
 		   params.is_tx_filter ? "TX" : "",
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 323d46e6eb..ca6cae3606 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2750,7 +2750,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 		qed_ops->sriov_configure(edev, pci_dev->max_vfs);
 	}
 
-	DP_INFO(edev, "MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n",
+	DP_INFO(edev, "MAC address : " RTE_ETHER_ADDR_PRT_FMT "\n",
 		adapter->primary_mac.addr_bytes[0],
 		adapter->primary_mac.addr_bytes[1],
 		adapter->primary_mac.addr_bytes[2],
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index fc1844ddfc..561a98fc81 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -2245,7 +2245,7 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
 		PMD_INIT_LOG(ERR, "Failed to configure first skip");
 		goto malloc_fail;
 	}
-	PMD_INIT_LOG(INFO, "Port %d (%x:%x) mac=%02x:%02x:%02x:%02x:%02x:%02x",
+	PMD_INIT_LOG(INFO, "Port %d (%x:%x) mac=" RTE_ETHER_ADDR_PRT_FMT,
 		eth_dev->data->port_id, nic->vendor_id, nic->device_id,
 		nic->mac_addr[0], nic->mac_addr[1], nic->mac_addr[2],
 		nic->mac_addr[3], nic->mac_addr[4], nic->mac_addr[5]);
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 0bae6ffd1f..07b7751241 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -282,7 +282,7 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev)
 		}
 		PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF");
 		PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address "
-			     "%02x:%02x:%02x:%02x:%02x:%02x",
+			     RTE_ETHER_ADDR_PRT_FMT,
 			     perm_addr->addr_bytes[0],
 			     perm_addr->addr_bytes[1],
 			     perm_addr->addr_bytes[2],
@@ -1039,7 +1039,7 @@ txgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	err = txgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes);
 	if (err != 0)
 		PMD_DRV_LOG(ERR, "Unable to add MAC address "
-			    "%02x:%02x:%02x:%02x:%02x:%02x - err=%d",
+			    RTE_ETHER_ADDR_PRT_FMT " - err=%d",
 			    mac_addr->addr_bytes[0],
 			    mac_addr->addr_bytes[1],
 			    mac_addr->addr_bytes[2],
@@ -1088,7 +1088,7 @@ txgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 		if (err != 0)
 			PMD_DRV_LOG(ERR,
 				    "Adding again MAC address "
-				    "%02x:%02x:%02x:%02x:%02x:%02x failed "
+				    RTE_ETHER_ADDR_PRT_FMT " failed "
 				    "err=%d",
 				    mac_addr->addr_bytes[0],
 				    mac_addr->addr_bytes[1],
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e58085a2c9..9ca8bae0fe 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1759,7 +1759,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr,
 			&eth_dev->data->mac_addrs[0]);
 	PMD_INIT_LOG(DEBUG,
-		     "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X",
+		     "PORT MAC: " RTE_ETHER_ADDR_PRT_FMT,
 		     hw->mac_addr[0], hw->mac_addr[1], hw->mac_addr[2],
 		     hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]);
 
@@ -1840,7 +1840,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 				config->max_virtqueue_pairs);
 		PMD_INIT_LOG(DEBUG, "config->status=%d", config->status);
 		PMD_INIT_LOG(DEBUG,
-				"PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X",
+				"PORT MAC: " RTE_ETHER_ADDR_PRT_FMT,
 				config->mac[0], config->mac[1],
 				config->mac[2], config->mac[3],
 				config->mac[4], config->mac[5]);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 1a3291273a..2f40ae907d 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -371,7 +371,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->perm_addr,
 			&eth_dev->data->mac_addrs[0]);
 
-	PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x",
+	PMD_INIT_LOG(DEBUG, "MAC Address : " RTE_ETHER_ADDR_PRT_FMT,
 		     hw->perm_addr[0], hw->perm_addr[1], hw->perm_addr[2],
 		     hw->perm_addr[3], hw->perm_addr[4], hw->perm_addr[5]);
 
@@ -575,7 +575,7 @@ vmxnet3_write_mac(struct vmxnet3_hw *hw, const uint8_t *addr)
 	uint32_t val;
 
 	PMD_INIT_LOG(DEBUG,
-		     "Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x",
+		     "Writing MAC Address : " RTE_ETHER_ADDR_PRT_FMT,
 		     addr[0], addr[1], addr[2],
 		     addr[3], addr[4], addr[5]);
 
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 5251db0b16..eeb851e8e6 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -285,7 +285,7 @@ signal_handler(int signum)
 static void
 print_mac(unsigned int portid, struct rte_ether_addr *bbdev_ports_eth_address)
 {
-	printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
+	printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 			(unsigned int) portid,
 			bbdev_ports_eth_address->addr_bytes[0],
 			bbdev_ports_eth_address->addr_bytes[1],
diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 36a1c374f4..5ff0060c08 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -498,7 +498,7 @@ pcmd_macaddr_callback(void *ptr_params,
 		stat = rte_ethtool_net_get_mac_addr(params->port, &mac_addr);
 		if (stat == 0) {
 			printf(
-				"Port %i MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n",
+				"Port %i MAC Address: " RTE_ETHER_ADDR_PRT_FMT "\n",
 				params->port,
 				mac_addr.addr_bytes[0],
 				mac_addr.addr_bytes[1],
diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 0c413180f8..6ac9ca429f 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -925,7 +925,7 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 	rte_eth_promiscuous_enable(portid);
 	/* >8 End of RX port is set in promiscuous mode. */
 
-	printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
+	printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 			portid,
 			ioat_ports_eth_addr[portid].addr_bytes[0],
 			ioat_ports_eth_addr[portid].addr_bytes[1],
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index ec4acf0aca..f4b208b256 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -272,7 +272,7 @@ print_link_info(struct link *link, char *out, size_t out_size)
 	snprintf(out, out_size,
 		"\n"
 		"%s: flags=<%s> mtu %u\n"
-		"\tether %02X:%02X:%02X:%02X:%02X:%02X rxqueues %u txqueues %u\n"
+		"\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n"
 		"\tport# %u  speed %s\n"
 		"\tRX packets %" PRIu64"  bytes %" PRIu64"\n"
 		"\tRX errors %" PRIu64"  missed %" PRIu64"  no-mbuf %" PRIu64"\n"
@@ -4776,7 +4776,7 @@ cmd_pipeline_table_rule_delete_default(char **tokens,
 static void
 ether_addr_show(FILE *f, struct rte_ether_addr *addr)
 {
-	fprintf(f, "%02x:%02x:%02x:%02x:%02x:%02x",
+	fprintf(f, RTE_ETHER_ADDR_PRT_FMT,
 		(uint32_t)addr->addr_bytes[0], (uint32_t)addr->addr_bytes[1],
 		(uint32_t)addr->addr_bytes[2], (uint32_t)addr->addr_bytes[3],
 		(uint32_t)addr->addr_bytes[4], (uint32_t)addr->addr_bytes[5]);
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 5f539c458c..f128e64a4c 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2701,7 +2701,7 @@ initialize_ports(struct l2fwd_crypto_options *options)
 			return -1;
 		}
 
-		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
+		printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 				portid,
 				l2fwd_ports_eth_addr[portid].addr_bytes[0],
 				l2fwd_ports_eth_addr[portid].addr_bytes[1],
diff --git a/examples/l2fwd-event/l2fwd_common.c b/examples/l2fwd-event/l2fwd_common.c
index b8c1e02d75..7f6a0cc5fb 100644
--- a/examples/l2fwd-event/l2fwd_common.c
+++ b/examples/l2fwd-event/l2fwd_common.c
@@ -108,7 +108,7 @@ l2fwd_event_init_ports(struct l2fwd_resources *rsrc)
 
 		rte_eth_promiscuous_enable(port_id);
 
-		printf("Port %u,MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
+		printf("Port %u,MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 			port_id,
 			rsrc->eth_addr[port_id].addr_bytes[0],
 			rsrc->eth_addr[port_id].addr_bytes[1],
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index bbb4a27a6d..640609543a 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -955,7 +955,7 @@ main(int argc, char **argv)
 
 		}
 
-		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
+		printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 				portid,
 				l2fwd_ports_eth_addr[portid].addr_bytes[0],
 				l2fwd_ports_eth_addr[portid].addr_bytes[1],
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index 4e1a17cfe4..bc160c64e8 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -730,7 +730,7 @@ main(int argc, char **argv)
 				 rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: "
-			"%02X:%02X:%02X:%02X:%02X:%02X\n\n",
+			RTE_ETHER_ADDR_PRT_FMT "\n\n",
 			portid,
 			l2fwd_ports_eth_addr[portid].addr_bytes[0],
 			l2fwd_ports_eth_addr[portid].addr_bytes[1],
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 911e40c66e..272d817bd4 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -879,7 +879,7 @@ main(int argc, char **argv)
 				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
 				 rte_strerror(-ret), portid);
 
-		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
+		printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 				portid,
 				l2fwd_ports_eth_addr[portid].addr_bytes[0],
 				l2fwd_ports_eth_addr[portid].addr_bytes[1],
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index 7470aa539a..467f3397c1 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -725,7 +725,7 @@ main(int argc, char **argv)
 				"rte_eth_promiscuous_enable: err=%s, port=%u\n",
 				rte_strerror(-ret), portid);
 
-		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
+		printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 				(unsigned) portid,
 				lsi_ports_eth_addr[portid].addr_bytes[0],
 				lsi_ports_eth_addr[portid].addr_bytes[1],
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 1e2dd9d704..5ee9567bb0 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -376,7 +376,7 @@ print_link_info(struct link *link, char *out, size_t out_size)
 	snprintf(out, out_size,
 		"\n"
 		"%s: flags=<%s> mtu %u\n"
-		"\tether %02X:%02X:%02X:%02X:%02X:%02X rxqueues %u txqueues %u\n"
+		"\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n"
 		"\tport# %u  speed %s\n"
 		"\tRX packets %" PRIu64"  bytes %" PRIu64"\n"
 		"\tRX errors %" PRIu64"  missed %" PRIu64"  no-mbuf %" PRIu64"\n"
diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c
index 7d07131dbf..81a942560b 100644
--- a/examples/server_node_efd/server/main.c
+++ b/examples/server_node_efd/server/main.c
@@ -84,7 +84,7 @@ get_printable_mac_addr(uint16_t port)
 		}
 
 		snprintf(addresses[port], sizeof(addresses[port]),
-				"%02x:%02x:%02x:%02x:%02x:%02x\n",
+				RTE_ETHER_ADDR_PRT_FMT "\n",
 				mac.addr_bytes[0], mac.addr_bytes[1],
 				mac.addr_bytes[2], mac.addr_bytes[3],
 				mac.addr_bytes[4], mac.addr_bytes[5]);
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index bc3d71c898..a27bc957d0 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -778,7 +778,7 @@ link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m)
 
 	/* Print out VMDQ registration info. */
 	RTE_LOG(INFO, VHOST_DATA,
-		"(%d) mac %02x:%02x:%02x:%02x:%02x:%02x and vlan %d registered\n",
+		"(%d) mac " RTE_ETHER_ADDR_PRT_FMT " and vlan %d registered\n",
 		vdev->vid,
 		vdev->mac_address.addr_bytes[0], vdev->mac_address.addr_bytes[1],
 		vdev->mac_address.addr_bytes[2], vdev->mac_address.addr_bytes[3],
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index d3bc19f78e..4b646b9263 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -334,7 +334,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 		mac = pool_addr_template;
 		mac.addr_bytes[4] = port;
 		mac.addr_bytes[5] = q;
-		printf("Port %u vmdq pool %u set mac %02x:%02x:%02x:%02x:%02x:%02x\n",
+		printf("Port %u vmdq pool %u set mac " RTE_ETHER_ADDR_PRT_FMT "\n",
 			port, q,
 			mac.addr_bytes[0], mac.addr_bytes[1],
 			mac.addr_bytes[2], mac.addr_bytes[3],
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 685a03bdd1..f6532387f1 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -359,7 +359,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 		mac = pool_addr_template;
 		mac.addr_bytes[4] = port;
 		mac.addr_bytes[5] = q;
-		printf("Port %u vmdq pool %u set mac %02x:%02x:%02x:%02x:%02x:%02x\n",
+		printf("Port %u vmdq pool %u set mac " RTE_ETHER_ADDR_PRT_FMT "\n",
 			port, q,
 			mac.addr_bytes[0], mac.addr_bytes[1],
 			mac.addr_bytes[2], mac.addr_bytes[3],
diff --git a/lib/net/rte_ether.c b/lib/net/rte_ether.c
index 34605838b5..9603a52d66 100644
--- a/lib/net/rte_ether.c
+++ b/lib/net/rte_ether.c
@@ -26,7 +26,7 @@ void
 rte_ether_format_addr(char *buf, uint16_t size,
 		      const struct rte_ether_addr *eth_addr)
 {
-	snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X",
+	snprintf(buf, size, RTE_ETHER_ADDR_PRT_FMT,
 		 eth_addr->addr_bytes[0],
 		 eth_addr->addr_bytes[1],
 		 eth_addr->addr_bytes[2],
diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h
index 7ee5e9a292..8d126d4c81 100644
--- a/lib/net/rte_ether.h
+++ b/lib/net/rte_ether.h
@@ -221,6 +221,11 @@ rte_ether_addr_copy(const struct rte_ether_addr *__restrict ea_from,
 	*ea_to = *ea_from;
 }
 
+/**
+ * Macro to print six-bytes of MAC address in hex format
+ */
+#define RTE_ETHER_ADDR_PRT_FMT     "%02X:%02X:%02X:%02X:%02X:%02X"
+
 #define RTE_ETHER_ADDR_FMT_SIZE         18
 /**
  * Format 48bits Ethernet address in pattern xx:xx:xx:xx:xx:xx.
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 29a4c9af60..7b9f26b656 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -2327,7 +2327,7 @@ vhost_user_send_rarp(struct virtio_net **pdev, struct VhostUserMsg *msg,
 		return RTE_VHOST_MSG_RESULT_ERR;
 
 	VHOST_LOG_CONFIG(DEBUG,
-		":: mac: %02x:%02x:%02x:%02x:%02x:%02x\n",
+		":: mac: " RTE_ETHER_ADDR_PRT_FMT "\n",
 		mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 	memcpy(dev->mac.addr_bytes, mac, 6);
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH v5 2/2] net: added macro to extract MAC address bytes
  2021-08-23  9:31 [dpdk-dev] [PATCH v5 0/2] Use macro to print MAC address Aman Singh
  2021-08-23  9:31 ` [dpdk-dev] [PATCH v5 1/2] net: added macro for MAC address print Aman Singh
@ 2021-08-23  9:31 ` Aman Singh
  1 sibling, 0 replies; 3+ messages in thread
From: Aman Singh @ 2021-08-23  9:31 UTC (permalink / raw)
  To: dev

Added macros to simplify print of MAC address.
The six bytes of a MAC address are extracted in
a macro here, to improve code readablity.

Signed-off-by: Aman Singh <aman.deep.singh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
The change in the document will be done in seperate patch.
To ensure document has direct reference of the code as shown in
commit 413c75c33c40 ("doc: show how to include code in guides").

V5: Print format aligned with rte_ether_format_addr API
    Both using upper case hexadecimal format.
---
 app/pdump/main.c                              |  5 +---
 app/test-pmd/cmdline.c                        |  4 +---
 app/test-pmd/config.c                         |  4 +---
 app/test-pmd/testpmd.c                        |  7 +-----
 app/test/test_event_eth_rx_adapter.c          |  5 +---
 app/test/test_event_eth_tx_adapter.c          |  5 +---
 drivers/bus/dpaa/base/fman/netcfg_layer.c     |  7 +-----
 drivers/common/mlx5/linux/mlx5_nl.c           |  4 +---
 drivers/net/bnx2x/bnx2x_vfpf.c                |  7 +-----
 drivers/net/bonding/rte_eth_bond_pmd.c        |  8 ++-----
 drivers/net/dpaa/dpaa_ethdev.c                |  8 +------
 drivers/net/e1000/igb_ethdev.c                |  7 +-----
 drivers/net/failsafe/failsafe.c               |  4 +---
 drivers/net/hinic/hinic_pmd_ethdev.c          |  4 +---
 drivers/net/i40e/i40e_ethdev_vf.c             | 15 +++---------
 drivers/net/iavf/iavf_ethdev.c                | 14 ++---------
 drivers/net/iavf/iavf_vchnl.c                 | 11 ++-------
 drivers/net/ice/ice_dcf.c                     |  4 +---
 drivers/net/ixgbe/ixgbe_ethdev.c              | 23 +++----------------
 drivers/net/mlx4/mlx4.c                       |  5 +---
 drivers/net/mlx5/linux/mlx5_os.c              |  5 +---
 drivers/net/mlx5/windows/mlx5_os.c            |  5 +---
 drivers/net/qede/qede_ethdev.c                |  7 +-----
 drivers/net/txgbe/txgbe_ethdev_vf.c           | 23 +++----------------
 examples/bbdev_app/main.c                     |  7 +-----
 examples/bond/main.c                          |  3 +--
 examples/distributor/main.c                   |  5 +---
 examples/ethtool/ethtool-app/ethapp.c         |  8 +------
 .../pipeline_worker_generic.c                 |  5 +---
 .../eventdev_pipeline/pipeline_worker_tx.c    |  5 +---
 examples/flow_classify/flow_classify.c        |  5 +---
 examples/ioat/ioatfwd.c                       |  7 +-----
 examples/ip_pipeline/cli.c                    |  9 ++------
 examples/l2fwd-cat/l2fwd-cat.c                |  5 +---
 examples/l2fwd-crypto/main.c                  |  9 ++------
 examples/l2fwd-event/l2fwd_common.c           |  7 +-----
 examples/l2fwd-jobstats/main.c                |  9 ++------
 examples/l2fwd-keepalive/main.c               |  7 +-----
 examples/l2fwd/main.c                         |  9 ++------
 examples/link_status_interrupt/main.c         |  7 +-----
 examples/packet_ordering/main.c               |  5 +---
 examples/pipeline/cli.c                       |  4 +---
 examples/rxtx_callbacks/main.c                |  4 +---
 examples/server_node_efd/server/main.c        |  4 +---
 examples/skeleton/basicfwd.c                  |  5 +---
 examples/vhost/main.c                         | 15 +++---------
 examples/vm_power_manager/channel_monitor.c   |  4 +---
 .../guest_cli/vm_power_cli_guest.c            |  5 +---
 examples/vm_power_manager/main.c              |  5 +---
 examples/vmdq/main.c                          | 12 ++--------
 examples/vmdq_dcb/main.c                      | 12 ++--------
 lib/net/rte_ether.h                           |  9 ++++++++
 52 files changed, 77 insertions(+), 305 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 63bbe65cd8..46f9d25db0 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -612,10 +612,7 @@ configure_vdev(uint16_t port_id)
 
 	printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
 			" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
-			port_id,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			port_id, RTE_ETHER_ADDR_BYTES(&addr));
 
 	ret = rte_eth_promiscuous_enable(port_id);
 	if (ret != 0) {
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d4186eb9b2..a5d6c20be1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10900,9 +10900,7 @@ static void cmd_mcast_addr_parsed(void *parsed_result,
 	if (!rte_is_multicast_ether_addr(&res->mc_addr)) {
 		fprintf(stderr,
 			"Invalid multicast addr " RTE_ETHER_ADDR_PRT_FMT "\n",
-			res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1],
-			res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3],
-			res->mc_addr.addr_bytes[4], res->mc_addr.addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&res->mc_addr));
 		return;
 	}
 	if (strcmp(res->what, "add") == 0)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 21d5db5297..f37cb3f83e 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -783,9 +783,7 @@ port_summary_display(portid_t port_id)
 		return;
 
 	printf("%-4d " RTE_ETHER_ADDR_PRT_FMT " %-12s %-14s %-8s %s\n",
-		port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
-		mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
-		mac_addr.addr_bytes[4], mac_addr.addr_bytes[5], name,
+		port_id, RTE_ETHER_ADDR_BYTES(&mac_addr), name,
 		dev_info.driver_name, (link.link_status) ? ("up") : ("down"),
 		rte_eth_link_speed_to_str(link.link_speed));
 }
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d0ede963ea..bc79402dd3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2623,12 +2623,7 @@ start_port(portid_t pid)
 
 		if (eth_macaddr_get_print_err(pi, &port->eth_addr) == 0)
 			printf("Port %d: " RTE_ETHER_ADDR_PRT_FMT "\n", pi,
-				port->eth_addr.addr_bytes[0],
-				port->eth_addr.addr_bytes[1],
-				port->eth_addr.addr_bytes[2],
-				port->eth_addr.addr_bytes[3],
-				port->eth_addr.addr_bytes[4],
-				port->eth_addr.addr_bytes[5]);
+					RTE_ETHER_ADDR_BYTES(&port->eth_addr));
 
 		/* at least one port started, need checking link status */
 		need_check_link_status = 1;
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 9198767b41..add4d8a678 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -88,10 +88,7 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
 		return retval;
 	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
 			   " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-			(unsigned int)port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			(unsigned int)port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
 	retval = rte_eth_promiscuous_enable(port);
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index 7073030902..cfcc784351 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -90,10 +90,7 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
 		return retval;
 	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
 			   " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-			(unsigned int)port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			(unsigned int)port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
 	retval = rte_eth_promiscuous_enable(port);
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index 556d631faa..6a405c984d 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -48,12 +48,7 @@ dump_netcfg(struct netcfg_info *cfg_ptr)
 		       (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G");
 
 		printf("\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n",
-		       (&__if->mac_addr)->addr_bytes[0],
-		       (&__if->mac_addr)->addr_bytes[1],
-		       (&__if->mac_addr)->addr_bytes[2],
-		       (&__if->mac_addr)->addr_bytes[3],
-		       (&__if->mac_addr)->addr_bytes[4],
-		       (&__if->mac_addr)->addr_bytes[5]);
+		       RTE_ETHER_ADDR_BYTES(&__if->mac_addr));
 
 		printf("\ttx_channel_id: 0x%02x\n",
 		       __if->tx_channel_id);
diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index efd92976b5..9120a697fd 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -695,9 +695,7 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		"representor %u cannot set VF MAC address "
 		RTE_ETHER_ADDR_PRT_FMT " : %s",
 		vf_index,
-		mac->addr_bytes[0], mac->addr_bytes[1],
-		mac->addr_bytes[2], mac->addr_bytes[3],
-		mac->addr_bytes[4], mac->addr_bytes[5],
+		RTE_ETHER_ADDR_BYTES(mac),
 		strerror(rte_errno));
 	return -rte_errno;
 }
diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c
index 03ba0d811f..0e8a92cd33 100644
--- a/drivers/net/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/bnx2x/bnx2x_vfpf.c
@@ -730,12 +730,7 @@ bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc,
 	for (i = 0; i < mc_addrs_num; i++) {
 		PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:"
 				RTE_ETHER_ADDR_PRT_FMT,
-				mc_addrs[i].addr_bytes[0],
-				mc_addrs[i].addr_bytes[1],
-				mc_addrs[i].addr_bytes[2],
-				mc_addrs[i].addr_bytes[3],
-				mc_addrs[i].addr_bytes[4],
-				mc_addrs[i].addr_bytes[5]);
+				RTE_ETHER_ADDR_BYTES(&mc_addrs[i]));
 		memcpy(query->multicast[i], mc_addrs[i].addr_bytes, ETH_ALEN);
 	}
 
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index d3cbd753cf..8ed9e036f4 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -477,13 +477,9 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator)
 		"DstMAC:" RTE_ETHER_ADDR_PRT_FMT " DstIP:%s %s %d\n", \
 		info,							\
 		port,							\
-		eth_h->s_addr.addr_bytes[0], eth_h->s_addr.addr_bytes[1], \
-		eth_h->s_addr.addr_bytes[2], eth_h->s_addr.addr_bytes[3], \
-		eth_h->s_addr.addr_bytes[4], eth_h->s_addr.addr_bytes[5], \
+		RTE_ETHER_ADDR_BYTES(&eth_h->s_addr),                  \
 		src_ip,							\
-		eth_h->d_addr.addr_bytes[0], eth_h->d_addr.addr_bytes[1], \
-		eth_h->d_addr.addr_bytes[2], eth_h->d_addr.addr_bytes[3], \
-		eth_h->d_addr.addr_bytes[4], eth_h->d_addr.addr_bytes[5], \
+		RTE_ETHER_ADDR_BYTES(&eth_h->d_addr),                  \
 		dst_ip,							\
 		arp_op, ++burstnumber)
 #endif
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index c5739a3a80..36d8f9249d 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -2095,13 +2095,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	rte_ether_addr_copy(&fman_intf->mac_addr, &eth_dev->data->mac_addrs[0]);
 
 	RTE_LOG(INFO, PMD, "net: dpaa: %s: " RTE_ETHER_ADDR_PRT_FMT "\n",
-		dpaa_device->name,
-		fman_intf->mac_addr.addr_bytes[0],
-		fman_intf->mac_addr.addr_bytes[1],
-		fman_intf->mac_addr.addr_bytes[2],
-		fman_intf->mac_addr.addr_bytes[3],
-		fman_intf->mac_addr.addr_bytes[4],
-		fman_intf->mac_addr.addr_bytes[5]);
+		dpaa_device->name, RTE_ETHER_ADDR_BYTES(&fman_intf->mac_addr));
 
 	if (!fman_intf->is_shared_mac) {
 		/* Configure error packet handling */
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 91db3032f5..d80fad01e3 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -978,12 +978,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
 		PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF");
 		PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address "
 			     RTE_ETHER_ADDR_PRT_FMT,
-			     perm_addr->addr_bytes[0],
-			     perm_addr->addr_bytes[1],
-			     perm_addr->addr_bytes[2],
-			     perm_addr->addr_bytes[3],
-			     perm_addr->addr_bytes[4],
-			     perm_addr->addr_bytes[5]);
+			     RTE_ETHER_ADDR_BYTES(perm_addr));
 	}
 
 	diag = e1000_rar_set(hw, perm_addr->addr_bytes, 0);
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 919d287f88..b87c036e60 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -261,9 +261,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
 			rte_eth_random_addr(&mac->addr_bytes[0]);
 	}
 	INFO("MAC address is " RTE_ETHER_ADDR_PRT_FMT,
-		mac->addr_bytes[0], mac->addr_bytes[1],
-		mac->addr_bytes[2], mac->addr_bytes[3],
-		mac->addr_bytes[4], mac->addr_bytes[5]);
+		RTE_ETHER_ADDR_BYTES(mac));
 	dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC |
 				RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 	PRIV(dev)->intr_handle = (struct rte_intr_handle){
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 3ffad21d1a..c01e2ec1d4 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -2360,9 +2360,7 @@ static int hinic_set_mac_addr(struct rte_eth_dev *dev,
 	rte_ether_addr_copy(addr, &nic_dev->default_addr);
 
 	PMD_DRV_LOG(INFO, "Set new mac address " RTE_ETHER_ADDR_PRT_FMT,
-		    addr->addr_bytes[0], addr->addr_bytes[1],
-		    addr->addr_bytes[2], addr->addr_bytes[3],
-		    addr->addr_bytes[4], addr->addr_bytes[5]);
+		    RTE_ETHER_ADDR_BYTES(addr));
 
 	return 0;
 }
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index dcc2b64e17..e8dd6d1dab 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -868,9 +868,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
 
 	if (rte_is_zero_ether_addr(addr)) {
 		PMD_DRV_LOG(ERR, "Invalid mac:" RTE_ETHER_ADDR_PRT_FMT,
-			    addr->addr_bytes[0], addr->addr_bytes[1],
-			    addr->addr_bytes[2], addr->addr_bytes[3],
-			    addr->addr_bytes[4], addr->addr_bytes[5]);
+			    RTE_ETHER_ADDR_BYTES(addr));
 		return I40E_ERR_INVALID_MAC_ADDR;
 	}
 
@@ -2131,9 +2129,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add)
 					      VIRTCHNL_ETHER_ADDR_PRIMARY :
 					      VIRTCHNL_ETHER_ADDR_EXTRA);
 			PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT,
-				    addr->addr_bytes[0], addr->addr_bytes[1],
-				    addr->addr_bytes[2], addr->addr_bytes[3],
-				    addr->addr_bytes[4], addr->addr_bytes[5]);
+				    RTE_ETHER_ADDR_BYTES(addr));
 			j++;
 		}
 		list->vsi_id = vf->vsi_res->vsi_id;
@@ -2950,12 +2946,7 @@ i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev,
 	for (i = 0; i < mc_addrs_num; i++) {
 		if (!I40E_IS_MULTICAST(mc_addrs[i].addr_bytes)) {
 			PMD_DRV_LOG(ERR, "Invalid mac:" RTE_ETHER_ADDR_PRT_FMT,
-				    mc_addrs[i].addr_bytes[0],
-				    mc_addrs[i].addr_bytes[1],
-				    mc_addrs[i].addr_bytes[2],
-				    mc_addrs[i].addr_bytes[3],
-				    mc_addrs[i].addr_bytes[4],
-				    mc_addrs[i].addr_bytes[5]);
+				    RTE_ETHER_ADDR_BYTES(&mc_addrs[i]));
 			return -EINVAL;
 		}
 
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 676120be2c..7ce0769d8a 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1486,23 +1486,13 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev,
 	if (ret)
 		PMD_DRV_LOG(ERR, "Fail to delete old MAC:"
 			    RTE_ETHER_ADDR_PRT_FMT,
-			    old_addr->addr_bytes[0],
-			    old_addr->addr_bytes[1],
-			    old_addr->addr_bytes[2],
-			    old_addr->addr_bytes[3],
-			    old_addr->addr_bytes[4],
-			    old_addr->addr_bytes[5]);
+				RTE_ETHER_ADDR_BYTES(old_addr));
 
 	ret = iavf_add_del_eth_addr(adapter, mac_addr, true, VIRTCHNL_ETHER_ADDR_PRIMARY);
 	if (ret)
 		PMD_DRV_LOG(ERR, "Fail to add new MAC:"
 			    RTE_ETHER_ADDR_PRT_FMT,
-			    mac_addr->addr_bytes[0],
-			    mac_addr->addr_bytes[1],
-			    mac_addr->addr_bytes[2],
-			    mac_addr->addr_bytes[3],
-			    mac_addr->addr_bytes[4],
-			    mac_addr->addr_bytes[5]);
+				RTE_ETHER_ADDR_BYTES(mac_addr));
 
 	if (ret)
 		return -EIO;
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 62fb91ec75..7f86050df3 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -1177,9 +1177,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
 					      VIRTCHNL_ETHER_ADDR_PRIMARY :
 					      VIRTCHNL_ETHER_ADDR_EXTRA);
 			PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT,
-				    addr->addr_bytes[0], addr->addr_bytes[1],
-				    addr->addr_bytes[2], addr->addr_bytes[3],
-				    addr->addr_bytes[4], addr->addr_bytes[5]);
+				    RTE_ETHER_ADDR_BYTES(addr));
 			j++;
 		}
 		list->vsi_id = vf->vsi_res->vsi_id;
@@ -1627,12 +1625,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
 	for (i = 0; i < mc_addrs_num; i++) {
 		if (!IAVF_IS_MULTICAST(mc_addrs[i].addr_bytes)) {
 			PMD_DRV_LOG(ERR, "Invalid mac:" RTE_ETHER_ADDR_PRT_FMT,
-				    mc_addrs[i].addr_bytes[0],
-				    mc_addrs[i].addr_bytes[1],
-				    mc_addrs[i].addr_bytes[2],
-				    mc_addrs[i].addr_bytes[3],
-				    mc_addrs[i].addr_bytes[4],
-				    mc_addrs[i].addr_bytes[5]);
+				    RTE_ETHER_ADDR_BYTES(&mc_addrs[i]));
 			return -EINVAL;
 		}
 
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 9ca3c755b8..068be668ba 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -1076,9 +1076,7 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
 	rte_memcpy(list->list[0].addr, addr->addr_bytes,
 			sizeof(addr->addr_bytes));
 	PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT,
-			    addr->addr_bytes[0], addr->addr_bytes[1],
-			    addr->addr_bytes[2], addr->addr_bytes[3],
-			    addr->addr_bytes[4], addr->addr_bytes[5]);
+			    RTE_ETHER_ADDR_BYTES(addr));
 
 	list->vsi_id = hw->vsi_res->vsi_id;
 	list->num_elements = 1;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b4af930906..8932b84d9b 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1651,12 +1651,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 		PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF");
 		PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address "
 			     RTE_ETHER_ADDR_PRT_FMT,
-			     perm_addr->addr_bytes[0],
-			     perm_addr->addr_bytes[1],
-			     perm_addr->addr_bytes[2],
-			     perm_addr->addr_bytes[3],
-			     perm_addr->addr_bytes[4],
-			     perm_addr->addr_bytes[5]);
+				 RTE_ETHER_ADDR_BYTES(perm_addr));
 	}
 
 	/* Copy the permanent MAC address */
@@ -6302,13 +6297,7 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	if (diag != 0)
 		PMD_DRV_LOG(ERR, "Unable to add MAC address "
 			    RTE_ETHER_ADDR_PRT_FMT " - diag=%d",
-			    mac_addr->addr_bytes[0],
-			    mac_addr->addr_bytes[1],
-			    mac_addr->addr_bytes[2],
-			    mac_addr->addr_bytes[3],
-			    mac_addr->addr_bytes[4],
-			    mac_addr->addr_bytes[5],
-			    diag);
+			    RTE_ETHER_ADDR_BYTES(mac_addr), diag);
 	return diag;
 }
 
@@ -6351,13 +6340,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 			PMD_DRV_LOG(ERR,
 				    "Adding again MAC address "
 				     RTE_ETHER_ADDR_PRT_FMT " failed "
-				    "diag=%d",
-				    mac_addr->addr_bytes[0],
-				    mac_addr->addr_bytes[1],
-				    mac_addr->addr_bytes[2],
-				    mac_addr->addr_bytes[3],
-				    mac_addr->addr_bytes[4],
-				    mac_addr->addr_bytes[5],
+				    "diag=%d", RTE_ETHER_ADDR_BYTES(mac_addr),
 				    diag);
 	}
 }
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 2b17bfac0b..7f9f300c6c 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -1015,10 +1015,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 			goto port_error;
 		}
 		INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
-		     priv->port,
-		     mac.addr_bytes[0], mac.addr_bytes[1],
-		     mac.addr_bytes[2], mac.addr_bytes[3],
-		     mac.addr_bytes[4], mac.addr_bytes[5]);
+		     priv->port, RTE_ETHER_ADDR_BYTES(&mac));
 		/* Register MAC address. */
 		priv->mac[0] = mac;
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 244865792c..46a431b93e 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1666,10 +1666,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	}
 	DRV_LOG(INFO,
 		"port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
-		eth_dev->data->port_id,
-		mac.addr_bytes[0], mac.addr_bytes[1],
-		mac.addr_bytes[2], mac.addr_bytes[3],
-		mac.addr_bytes[4], mac.addr_bytes[5]);
+		eth_dev->data->port_id, RTE_ETHER_ADDR_BYTES(&mac));
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 	{
 		char ifname[MLX5_NAMESIZE];
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index 6a109db8e8..d9b88b0ef6 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -567,10 +567,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	}
 	DRV_LOG(INFO,
 		"port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
-		eth_dev->data->port_id,
-		mac.addr_bytes[0], mac.addr_bytes[1],
-		mac.addr_bytes[2], mac.addr_bytes[3],
-		mac.addr_bytes[4], mac.addr_bytes[5]);
+		eth_dev->data->port_id, RTE_ETHER_ADDR_BYTES(&mac));
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 	{
 		char ifname[MLX5_NAMESIZE];
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index ca6cae3606..a4304e0eff 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2751,12 +2751,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 	}
 
 	DP_INFO(edev, "MAC address : " RTE_ETHER_ADDR_PRT_FMT "\n",
-		adapter->primary_mac.addr_bytes[0],
-		adapter->primary_mac.addr_bytes[1],
-		adapter->primary_mac.addr_bytes[2],
-		adapter->primary_mac.addr_bytes[3],
-		adapter->primary_mac.addr_bytes[4],
-		adapter->primary_mac.addr_bytes[5]);
+		RTE_ETHER_ADDR_BYTES(&adapter->primary_mac));
 
 	DP_INFO(edev, "Device initialized\n");
 
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 07b7751241..304ca376c4 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -283,12 +283,7 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev)
 		PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF");
 		PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address "
 			     RTE_ETHER_ADDR_PRT_FMT,
-			     perm_addr->addr_bytes[0],
-			     perm_addr->addr_bytes[1],
-			     perm_addr->addr_bytes[2],
-			     perm_addr->addr_bytes[3],
-			     perm_addr->addr_bytes[4],
-			     perm_addr->addr_bytes[5]);
+				 RTE_ETHER_ADDR_BYTES(perm_addr));
 	}
 
 	/* Copy the permanent MAC address */
@@ -1040,13 +1035,7 @@ txgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	if (err != 0)
 		PMD_DRV_LOG(ERR, "Unable to add MAC address "
 			    RTE_ETHER_ADDR_PRT_FMT " - err=%d",
-			    mac_addr->addr_bytes[0],
-			    mac_addr->addr_bytes[1],
-			    mac_addr->addr_bytes[2],
-			    mac_addr->addr_bytes[3],
-			    mac_addr->addr_bytes[4],
-			    mac_addr->addr_bytes[5],
-			    err);
+			    RTE_ETHER_ADDR_BYTES(mac_addr), err);
 	return err;
 }
 
@@ -1090,13 +1079,7 @@ txgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 				    "Adding again MAC address "
 				    RTE_ETHER_ADDR_PRT_FMT " failed "
 				    "err=%d",
-				    mac_addr->addr_bytes[0],
-				    mac_addr->addr_bytes[1],
-				    mac_addr->addr_bytes[2],
-				    mac_addr->addr_bytes[3],
-				    mac_addr->addr_bytes[4],
-				    mac_addr->addr_bytes[5],
-				    err);
+				    RTE_ETHER_ADDR_BYTES(mac_addr), err);
 	}
 }
 
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index eeb851e8e6..adbd408083 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -287,12 +287,7 @@ print_mac(unsigned int portid, struct rte_ether_addr *bbdev_ports_eth_address)
 {
 	printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 			(unsigned int) portid,
-			bbdev_ports_eth_address->addr_bytes[0],
-			bbdev_ports_eth_address->addr_bytes[1],
-			bbdev_ports_eth_address->addr_bytes[2],
-			bbdev_ports_eth_address->addr_bytes[3],
-			bbdev_ports_eth_address->addr_bytes[4],
-			bbdev_ports_eth_address->addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(bbdev_ports_eth_address));
 }
 
 static inline void
diff --git a/examples/bond/main.c b/examples/bond/main.c
index f48400e211..a63ca70a7f 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -104,8 +104,7 @@
 #define MAX_PORTS	4
 #define PRINT_MAC(addr)		printf("%02"PRIx8":%02"PRIx8":%02"PRIx8 \
 		":%02"PRIx8":%02"PRIx8":%02"PRIx8,	\
-		addr.addr_bytes[0], addr.addr_bytes[1], addr.addr_bytes[2], \
-		addr.addr_bytes[3], addr.addr_bytes[4], addr.addr_bytes[5])
+		RTE_ETHER_ADDR_BYTES(&addr))
 
 uint16_t slaves[RTE_MAX_ETHPORTS];
 uint16_t slaves_count;
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 1b1029660e..d0f40a1fb4 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -201,10 +201,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 
 	printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
 			" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
-			port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	retval = rte_eth_promiscuous_enable(port);
 	if (retval != 0)
diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 5ff0060c08..78e86534e8 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -499,13 +499,7 @@ pcmd_macaddr_callback(void *ptr_params,
 		if (stat == 0) {
 			printf(
 				"Port %i MAC Address: " RTE_ETHER_ADDR_PRT_FMT "\n",
-				params->port,
-				mac_addr.addr_bytes[0],
-				mac_addr.addr_bytes[1],
-				mac_addr.addr_bytes[2],
-				mac_addr.addr_bytes[3],
-				mac_addr.addr_bytes[4],
-				mac_addr.addr_bytes[5]);
+				params->port, RTE_ETHER_ADDR_BYTES(&mac_addr));
 			return;
 		}
 	}
diff --git a/examples/eventdev_pipeline/pipeline_worker_generic.c b/examples/eventdev_pipeline/pipeline_worker_generic.c
index f70ab0cc9e..5ed0dc73ec 100644
--- a/examples/eventdev_pipeline/pipeline_worker_generic.c
+++ b/examples/eventdev_pipeline/pipeline_worker_generic.c
@@ -368,10 +368,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 
 	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
 			" %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-			(unsigned int)port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			(unsigned int)port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
 	retval = rte_eth_promiscuous_enable(port);
diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c
index ca6cd200ca..ab8c6d6a0d 100644
--- a/examples/eventdev_pipeline/pipeline_worker_tx.c
+++ b/examples/eventdev_pipeline/pipeline_worker_tx.c
@@ -695,10 +695,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 
 	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
 			" %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-			(unsigned int)port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			(unsigned int)port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
 	retval = rte_eth_promiscuous_enable(port);
diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c
index db71f5aa04..65c1d85cf2 100644
--- a/examples/flow_classify/flow_classify.c
+++ b/examples/flow_classify/flow_classify.c
@@ -258,10 +258,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 
 	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
 			   " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-			port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
 	retval = rte_eth_promiscuous_enable(port);
diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 6ac9ca429f..b3977a8be5 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -927,12 +927,7 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 
 	printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 			portid,
-			ioat_ports_eth_addr[portid].addr_bytes[0],
-			ioat_ports_eth_addr[portid].addr_bytes[1],
-			ioat_ports_eth_addr[portid].addr_bytes[2],
-			ioat_ports_eth_addr[portid].addr_bytes[3],
-			ioat_ports_eth_addr[portid].addr_bytes[4],
-			ioat_ports_eth_addr[portid].addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&ioat_ports_eth_addr[portid]));
 
 	cfg.ports[cfg.nb_ports].rxtx_port = portid;
 	cfg.ports[cfg.nb_ports++].nb_queues = nb_queues;
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index f4b208b256..0c372675a9 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -281,9 +281,7 @@ print_link_info(struct link *link, char *out, size_t out_size)
 		link->name,
 		eth_link.link_status == 0 ? "DOWN" : "UP",
 		mtu,
-		mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
-		mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
-		mac_addr.addr_bytes[4], mac_addr.addr_bytes[5],
+		RTE_ETHER_ADDR_BYTES(&mac_addr),
 		link->n_rxq,
 		link->n_txq,
 		link->port_id,
@@ -4776,10 +4774,7 @@ cmd_pipeline_table_rule_delete_default(char **tokens,
 static void
 ether_addr_show(FILE *f, struct rte_ether_addr *addr)
 {
-	fprintf(f, RTE_ETHER_ADDR_PRT_FMT,
-		(uint32_t)addr->addr_bytes[0], (uint32_t)addr->addr_bytes[1],
-		(uint32_t)addr->addr_bytes[2], (uint32_t)addr->addr_bytes[3],
-		(uint32_t)addr->addr_bytes[4], (uint32_t)addr->addr_bytes[5]);
+	fprintf(f, RTE_ETHER_ADDR_PRT_FMT, RTE_ETHER_ADDR_BYTES(addr));
 }
 
 static void
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index 95de29b868..9b3e324efb 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -80,10 +80,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 
 	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
 			   " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-			port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
 	retval = rte_eth_promiscuous_enable(port);
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index f128e64a4c..66d1491bf7 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2702,13 +2702,8 @@ initialize_ports(struct l2fwd_crypto_options *options)
 		}
 
 		printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
-				portid,
-				l2fwd_ports_eth_addr[portid].addr_bytes[0],
-				l2fwd_ports_eth_addr[portid].addr_bytes[1],
-				l2fwd_ports_eth_addr[portid].addr_bytes[2],
-				l2fwd_ports_eth_addr[portid].addr_bytes[3],
-				l2fwd_ports_eth_addr[portid].addr_bytes[4],
-				l2fwd_ports_eth_addr[portid].addr_bytes[5]);
+			portid,
+			RTE_ETHER_ADDR_BYTES(&l2fwd_ports_eth_addr[portid]));
 
 		/* initialize port stats */
 		memset(&port_statistics, 0, sizeof(port_statistics));
diff --git a/examples/l2fwd-event/l2fwd_common.c b/examples/l2fwd-event/l2fwd_common.c
index 7f6a0cc5fb..19f32809aa 100644
--- a/examples/l2fwd-event/l2fwd_common.c
+++ b/examples/l2fwd-event/l2fwd_common.c
@@ -110,12 +110,7 @@ l2fwd_event_init_ports(struct l2fwd_resources *rsrc)
 
 		printf("Port %u,MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 			port_id,
-			rsrc->eth_addr[port_id].addr_bytes[0],
-			rsrc->eth_addr[port_id].addr_bytes[1],
-			rsrc->eth_addr[port_id].addr_bytes[2],
-			rsrc->eth_addr[port_id].addr_bytes[3],
-			rsrc->eth_addr[port_id].addr_bytes[4],
-			rsrc->eth_addr[port_id].addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&rsrc->eth_addr[port_id]));
 	}
 
 	return nb_ports_available;
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 640609543a..afe7fe6ead 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -956,13 +956,8 @@ main(int argc, char **argv)
 		}
 
 		printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
-				portid,
-				l2fwd_ports_eth_addr[portid].addr_bytes[0],
-				l2fwd_ports_eth_addr[portid].addr_bytes[1],
-				l2fwd_ports_eth_addr[portid].addr_bytes[2],
-				l2fwd_ports_eth_addr[portid].addr_bytes[3],
-				l2fwd_ports_eth_addr[portid].addr_bytes[4],
-				l2fwd_ports_eth_addr[portid].addr_bytes[5]);
+			portid,
+			RTE_ETHER_ADDR_BYTES(&l2fwd_ports_eth_addr[portid]));
 
 		/* initialize port stats */
 		memset(&port_statistics, 0, sizeof(port_statistics));
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index bc160c64e8..d0d979f5ba 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -732,12 +732,7 @@ main(int argc, char **argv)
 		printf("Port %u, MAC address: "
 			RTE_ETHER_ADDR_PRT_FMT "\n\n",
 			portid,
-			l2fwd_ports_eth_addr[portid].addr_bytes[0],
-			l2fwd_ports_eth_addr[portid].addr_bytes[1],
-			l2fwd_ports_eth_addr[portid].addr_bytes[2],
-			l2fwd_ports_eth_addr[portid].addr_bytes[3],
-			l2fwd_ports_eth_addr[portid].addr_bytes[4],
-			l2fwd_ports_eth_addr[portid].addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&l2fwd_ports_eth_addr[portid]));
 
 		/* initialize port stats */
 		memset(&port_statistics, 0, sizeof(port_statistics));
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 272d817bd4..05532551a5 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -880,13 +880,8 @@ main(int argc, char **argv)
 				 rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
-				portid,
-				l2fwd_ports_eth_addr[portid].addr_bytes[0],
-				l2fwd_ports_eth_addr[portid].addr_bytes[1],
-				l2fwd_ports_eth_addr[portid].addr_bytes[2],
-				l2fwd_ports_eth_addr[portid].addr_bytes[3],
-				l2fwd_ports_eth_addr[portid].addr_bytes[4],
-				l2fwd_ports_eth_addr[portid].addr_bytes[5]);
+			portid,
+			RTE_ETHER_ADDR_BYTES(&l2fwd_ports_eth_addr[portid]));
 
 		/* initialize port stats */
 		memset(&port_statistics, 0, sizeof(port_statistics));
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index 467f3397c1..a0bc1e56d0 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -727,12 +727,7 @@ main(int argc, char **argv)
 
 		printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
 				(unsigned) portid,
-				lsi_ports_eth_addr[portid].addr_bytes[0],
-				lsi_ports_eth_addr[portid].addr_bytes[1],
-				lsi_ports_eth_addr[portid].addr_bytes[2],
-				lsi_ports_eth_addr[portid].addr_bytes[3],
-				lsi_ports_eth_addr[portid].addr_bytes[4],
-				lsi_ports_eth_addr[portid].addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&lsi_ports_eth_addr[portid]));
 
 		/* initialize port stats */
 		memset(&port_statistics, 0, sizeof(port_statistics));
diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index d2fe9f6b50..4f6982bc12 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -335,10 +335,7 @@ configure_eth_port(uint16_t port_id)
 
 	printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
 			" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
-			port_id,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			port_id, RTE_ETHER_ADDR_BYTES(&addr));
 
 	ret = rte_eth_promiscuous_enable(port_id);
 	if (ret != 0)
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 5ee9567bb0..1ba9b8c52c 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -385,9 +385,7 @@ print_link_info(struct link *link, char *out, size_t out_size)
 		link->name,
 		eth_link.link_status == 0 ? "DOWN" : "UP",
 		mtu,
-		mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
-		mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
-		mac_addr.addr_bytes[4], mac_addr.addr_bytes[5],
+		RTE_ETHER_ADDR_BYTES(&mac_addr),
 		link->n_rxq,
 		link->n_txq,
 		link->port_id,
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 6f20f98b2b..ab6fa7d56c 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -227,9 +227,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
 			" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
 			(unsigned)port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&addr));
 
 	retval = rte_eth_promiscuous_enable(port);
 	if (retval != 0)
diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c
index 81a942560b..0d0d5679e4 100644
--- a/examples/server_node_efd/server/main.c
+++ b/examples/server_node_efd/server/main.c
@@ -85,9 +85,7 @@ get_printable_mac_addr(uint16_t port)
 
 		snprintf(addresses[port], sizeof(addresses[port]),
 				RTE_ETHER_ADDR_PRT_FMT "\n",
-				mac.addr_bytes[0], mac.addr_bytes[1],
-				mac.addr_bytes[2], mac.addr_bytes[3],
-				mac.addr_bytes[4], mac.addr_bytes[5]);
+				RTE_ETHER_ADDR_BYTES(&mac));
 	}
 	return addresses[port];
 }
diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
index ae08261bef..ae9bbee8d8 100644
--- a/examples/skeleton/basicfwd.c
+++ b/examples/skeleton/basicfwd.c
@@ -100,10 +100,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 
 	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
 			   " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-			port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
 	retval = rte_eth_promiscuous_enable(port);
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index a27bc957d0..91a61595d1 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -369,14 +369,8 @@ port_init(uint16_t port)
 
 	RTE_LOG(INFO, VHOST_PORT, "Max virtio devices supported: %u\n", num_devices);
 	RTE_LOG(INFO, VHOST_PORT, "Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
-			" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
-			port,
-			vmdq_ports_eth_addr[port].addr_bytes[0],
-			vmdq_ports_eth_addr[port].addr_bytes[1],
-			vmdq_ports_eth_addr[port].addr_bytes[2],
-			vmdq_ports_eth_addr[port].addr_bytes[3],
-			vmdq_ports_eth_addr[port].addr_bytes[4],
-			vmdq_ports_eth_addr[port].addr_bytes[5]);
+		" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
+		port, RTE_ETHER_ADDR_BYTES(&vmdq_ports_eth_addr[port]));
 
 	return 0;
 }
@@ -779,10 +773,7 @@ link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m)
 	/* Print out VMDQ registration info. */
 	RTE_LOG(INFO, VHOST_DATA,
 		"(%d) mac " RTE_ETHER_ADDR_PRT_FMT " and vlan %d registered\n",
-		vdev->vid,
-		vdev->mac_address.addr_bytes[0], vdev->mac_address.addr_bytes[1],
-		vdev->mac_address.addr_bytes[2], vdev->mac_address.addr_bytes[3],
-		vdev->mac_address.addr_bytes[4], vdev->mac_address.addr_bytes[5],
+		vdev->vid, RTE_ETHER_ADDR_BYTES(&vdev->mac_address),
 		vdev->vlan_tag);
 
 	/* Register the MAC address. */
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 99f81544d7..f03102eb1b 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -124,9 +124,7 @@ set_policy_mac(struct rte_power_channel_packet *pkt, int idx, char *mac)
 
 	printf("Received MAC Address: %02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 ":"
 			"%02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 "\n",
-			pfid.addr.addr_bytes[0], pfid.addr.addr_bytes[1],
-			pfid.addr.addr_bytes[2], pfid.addr.addr_bytes[3],
-			pfid.addr.addr_bytes[4], pfid.addr.addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&pfid.addr));
 
 	pkt->vfid[idx] = pfid.pfid;
 	return 0;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index 0bf5774ffc..94bfbbaf78 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -62,10 +62,7 @@ set_policy_mac(int port, int idx)
 
 	printf("Port %u MAC: %02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 ":"
 			"%02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 "\n",
-			port,
-			pfid.addr.addr_bytes[0], pfid.addr.addr_bytes[1],
-			pfid.addr.addr_bytes[2], pfid.addr.addr_bytes[3],
-			pfid.addr.addr_bytes[4], pfid.addr.addr_bytes[5]);
+			port, RTE_ETHER_ADDR_BYTES(&pfid.addr));
 	policy = get_policy();
 	policy->vfid[idx] = pfid.pfid;
 	return 0;
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 7d5bf68554..e59fb7d347 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -121,10 +121,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 
 	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
 			   " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-			(unsigned int)port,
-			addr.addr_bytes[0], addr.addr_bytes[1],
-			addr.addr_bytes[2], addr.addr_bytes[3],
-			addr.addr_bytes[4], addr.addr_bytes[5]);
+			(unsigned int)port, RTE_ETHER_ADDR_BYTES(&addr));
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
 	retval = rte_eth_promiscuous_enable(port);
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index 4b646b9263..755dcafa2f 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -317,12 +317,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
 			" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
 			(unsigned)port,
-			vmdq_ports_eth_addr[port].addr_bytes[0],
-			vmdq_ports_eth_addr[port].addr_bytes[1],
-			vmdq_ports_eth_addr[port].addr_bytes[2],
-			vmdq_ports_eth_addr[port].addr_bytes[3],
-			vmdq_ports_eth_addr[port].addr_bytes[4],
-			vmdq_ports_eth_addr[port].addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&vmdq_ports_eth_addr[port]));
 
 	/*
 	 * Set mac for each pool.
@@ -335,10 +330,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 		mac.addr_bytes[4] = port;
 		mac.addr_bytes[5] = q;
 		printf("Port %u vmdq pool %u set mac " RTE_ETHER_ADDR_PRT_FMT "\n",
-			port, q,
-			mac.addr_bytes[0], mac.addr_bytes[1],
-			mac.addr_bytes[2], mac.addr_bytes[3],
-			mac.addr_bytes[4], mac.addr_bytes[5]);
+			port, q, RTE_ETHER_ADDR_BYTES(&mac));
 		retval = rte_eth_dev_mac_addr_add(port, &mac,
 				q + vmdq_pool_base);
 		if (retval) {
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index f6532387f1..6d3c918d6d 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -345,12 +345,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
 			" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
 			(unsigned)port,
-			vmdq_ports_eth_addr[port].addr_bytes[0],
-			vmdq_ports_eth_addr[port].addr_bytes[1],
-			vmdq_ports_eth_addr[port].addr_bytes[2],
-			vmdq_ports_eth_addr[port].addr_bytes[3],
-			vmdq_ports_eth_addr[port].addr_bytes[4],
-			vmdq_ports_eth_addr[port].addr_bytes[5]);
+			RTE_ETHER_ADDR_BYTES(&vmdq_ports_eth_addr[port]));
 
 	/* Set mac for each pool. 8< */
 	for (q = 0; q < num_pools; q++) {
@@ -360,10 +355,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 		mac.addr_bytes[4] = port;
 		mac.addr_bytes[5] = q;
 		printf("Port %u vmdq pool %u set mac " RTE_ETHER_ADDR_PRT_FMT "\n",
-			port, q,
-			mac.addr_bytes[0], mac.addr_bytes[1],
-			mac.addr_bytes[2], mac.addr_bytes[3],
-			mac.addr_bytes[4], mac.addr_bytes[5]);
+			port, q, RTE_ETHER_ADDR_BYTES(&mac));
 		retval = rte_eth_dev_mac_addr_add(port, &mac,
 				q + vmdq_pool_base);
 		if (retval) {
diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h
index 8d126d4c81..d0eeb6f996 100644
--- a/lib/net/rte_ether.h
+++ b/lib/net/rte_ether.h
@@ -225,6 +225,15 @@ rte_ether_addr_copy(const struct rte_ether_addr *__restrict ea_from,
  * Macro to print six-bytes of MAC address in hex format
  */
 #define RTE_ETHER_ADDR_PRT_FMT     "%02X:%02X:%02X:%02X:%02X:%02X"
+/**
+ * Macro to extract the MAC address bytes from rte_ether_addr struct
+ */
+#define RTE_ETHER_ADDR_BYTES(mac_addrs) ((mac_addrs)->addr_bytes[0]), \
+					 ((mac_addrs)->addr_bytes[1]), \
+					 ((mac_addrs)->addr_bytes[2]), \
+					 ((mac_addrs)->addr_bytes[3]), \
+					 ((mac_addrs)->addr_bytes[4]), \
+					 ((mac_addrs)->addr_bytes[5])
 
 #define RTE_ETHER_ADDR_FMT_SIZE         18
 /**
-- 
2.17.1


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

end of thread, other threads:[~2021-08-23  9:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23  9:31 [dpdk-dev] [PATCH v5 0/2] Use macro to print MAC address Aman Singh
2021-08-23  9:31 ` [dpdk-dev] [PATCH v5 1/2] net: added macro for MAC address print Aman Singh
2021-08-23  9:31 ` [dpdk-dev] [PATCH v5 2/2] net: added macro to extract MAC address bytes Aman Singh

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