[dpdk-dev] replay MAC address in rte_eth_dev_config_restore()

Steve Shin (jonshin) jonshin at cisco.com
Wed Jan 18 05:12:33 CET 2017


I have a question on MAC address replay logic in rte_eth_dev_config_restore():

code snippet of rte_eth_dev_config_restore()
        /* replay MAC address configuration */
        for (i = 0; i < dev_info.max_mac_addrs; i++) {
                addr = dev->data->mac_addrs[i];

                /* skip zero address */
                if (is_zero_ether_addr(&addr))

                /* add address to the hardware */
                if  (*dev->dev_ops->mac_addr_add &&
                        (dev->data->mac_pool_sel[i] & (1ULL << pool)))
                        (*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
                else {
                        RTE_PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
                        /* exit the loop but not return an error */

dev->data->mac_addrs[0] is filled with a HW MAC address (by default) when a device is initialized. But there’s no flag setting for dev->data->mac_pool_sel[0].
As the value of “(dev->data->mac_pool_sel[i] & (1ULL << pool)) “ becomes 0 for i=0, the replay logic will be stopped without processing the rest of MAC addresses in dev->data->mac_addrs[] list.
Shouldn’t ‘break’ statement be replaced with ‘continue’ to process other MACs in the list?

Any feedback would be appreciated.


More information about the dev mailing list