1 From fb7c10892b057533931553f9367acd5541a0537c Mon Sep 17 00:00:00 2001
2 From: Steve Shin <jonshin@cisco.com>
3 Date: Mon, 30 Jan 2017 09:12:25 -0800
4 Subject: [PATCH] This patch fixes a bug in replaying MAC address to the
5 hardware in rte_eth_dev_config_restore() routine. Added default MAC replay as
8 Fixes: 4bdefaade6d1 ("ethdev: VMDQ enhancements")
10 Signed-off-by: Steve Shin <jonshin@cisco.com>
12 lib/librte_ether/rte_ethdev.c | 48 ++++++++++++++++++++++++-------------------
13 1 file changed, 27 insertions(+), 21 deletions(-)
15 diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
16 index fde8112..2c07dfe 100644
17 --- a/lib/librte_ether/rte_ethdev.c
18 +++ b/lib/librte_ether/rte_ethdev.c
19 @@ -857,34 +857,40 @@ struct rte_eth_dev *
21 struct rte_eth_dev *dev;
22 struct rte_eth_dev_info dev_info;
23 - struct ether_addr addr;
24 + struct ether_addr *addr;
29 dev = &rte_eth_devices[port_id];
31 rte_eth_dev_info_get(port_id, &dev_info);
33 - if (RTE_ETH_DEV_SRIOV(dev).active)
34 - pool = RTE_ETH_DEV_SRIOV(dev).def_vmdq_idx;
36 - /* replay MAC address configuration */
37 - for (i = 0; i < dev_info.max_mac_addrs; i++) {
38 - addr = dev->data->mac_addrs[i];
40 - /* skip zero address */
41 - if (is_zero_ether_addr(&addr))
44 - /* add address to the hardware */
45 - if (*dev->dev_ops->mac_addr_add &&
46 - (dev->data->mac_pool_sel[i] & (1ULL << pool)))
47 - (*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
49 - RTE_PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
51 - /* exit the loop but not return an error */
53 + /* replay MAC address configuration including default MAC */
54 + addr = &dev->data->mac_addrs[0];
55 + if (*dev->dev_ops->mac_addr_set != NULL)
56 + (*dev->dev_ops->mac_addr_set)(dev, addr);
57 + else if (*dev->dev_ops->mac_addr_add != NULL)
58 + (*dev->dev_ops->mac_addr_add)(dev, addr, 0, pool);
60 + if (*dev->dev_ops->mac_addr_add != NULL) {
61 + for (i = 1; i < dev_info.max_mac_addrs; i++) {
62 + addr = &dev->data->mac_addrs[i];
64 + /* skip zero address */
65 + if (is_zero_ether_addr(addr))
69 + pool_mask = dev->data->mac_pool_sel[i];
72 + if (pool_mask & 1ULL)
73 + (*dev->dev_ops->mac_addr_add)(dev,
77 + } while (pool_mask);