Skip to content

Commit

Permalink
netdev-dpdk: Fix build failure due to new struct eth_addr.
Browse files Browse the repository at this point in the history
The netdev-dpdk uses the struct ether_addr rather than struct eth_addr
internal ovs datatype.

To facilitate using either the .ea OR the struct ether_addr.addr_bytes
argument for printing/logging, add a new ETH_ADDR_BYTES_ARG() define.

Signed-off-by: Aaron Conole <[email protected]>
[[email protected] made stylistic changes]
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
apconole authored and blp committed Sep 6, 2015
1 parent eac0dc8 commit ca92d17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,9 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex)
memset(&eth_addr, 0x0, sizeof(eth_addr));
rte_eth_macaddr_get(dev->port_id, &eth_addr);
VLOG_INFO_RL(&rl, "Port %d: "ETH_ADDR_FMT"",
dev->port_id, ETH_ADDR_ARGS(eth_addr.addr_bytes));
dev->port_id, ETH_ADDR_BYTES_ARGS(eth_addr.addr_bytes));

memcpy(dev->hwaddr, eth_addr.addr_bytes, ETH_ADDR_LEN);
memcpy(dev->hwaddr.ea, eth_addr.addr_bytes, ETH_ADDR_LEN);
rte_eth_link_get_nowait(dev->port_id, &dev->link);

mbp_priv = rte_mempool_get_priv(dev->dpdk_mp->mp);
Expand Down
5 changes: 3 additions & 2 deletions lib/packets.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,9 @@ ovs_be32 set_mpls_lse_values(uint8_t ttl, uint8_t tc, uint8_t bos,
*/
#define ETH_ADDR_FMT \
"%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8
#define ETH_ADDR_ARGS(EA) \
(EA).ea[0], (EA).ea[1], (EA).ea[2], (EA).ea[3], (EA).ea[4], (EA).ea[5]
#define ETH_ADDR_ARGS(EA) ETH_ADDR_BYTES_ARGS((EA).ea)
#define ETH_ADDR_BYTES_ARGS(EAB) \
(EAB)[0], (EAB)[1], (EAB)[2], (EAB)[3], (EAB)[4], (EAB)[5]

/* Example:
*
Expand Down

0 comments on commit ca92d17

Please sign in to comment.