net: add macro to extract MAC address bytes

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 Deep Singh <aman.deep.singh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Aman Deep Singh 2021-08-25 22:57:34 +05:30 committed by Ferruh Yigit
parent c2c4f87b12
commit a7db3afce7
53 changed files with 78 additions and 311 deletions

View File

@ -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) {

View File

@ -10906,9 +10906,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)

View File

@ -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));
}

View File

@ -2693,12 +2693,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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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);
}

View File

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

View File

@ -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 */

View File

@ -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);

View File

@ -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){

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1487,23 +1487,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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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 */
@ -6303,13 +6298,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;
}
@ -6352,13 +6341,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);
}
}

View File

@ -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;

View File

@ -1703,10 +1703,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];

View File

@ -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];

View File

@ -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");

View File

@ -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 */
@ -1042,13 +1037,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;
}
@ -1092,13 +1081,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);
}
}

View File

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

View File

@ -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;

View File

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

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

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

View File

@ -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);

View File

@ -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));

View File

@ -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;

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

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

View File

@ -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,

View File

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

View File

@ -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];
}

View File

@ -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);

View File

@ -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. */

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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) {

View File

@ -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) {

View File

@ -27,12 +27,7 @@ rte_ether_format_addr(char *buf, uint16_t size,
const struct rte_ether_addr *eth_addr)
{
snprintf(buf, size, RTE_ETHER_ADDR_PRT_FMT,
eth_addr->addr_bytes[0],
eth_addr->addr_bytes[1],
eth_addr->addr_bytes[2],
eth_addr->addr_bytes[3],
eth_addr->addr_bytes[4],
eth_addr->addr_bytes[5]);
RTE_ETHER_ADDR_BYTES(eth_addr));
}
static int8_t get_xdigit(char ch)

View File

@ -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
/**