>On Fri, 29 May 2015 09:15:08 -0400 >Liang-Min Larry Wang <liang-min.wang at intel.com> wrote: > >> } > > >> int >> +rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr >> +*addr) { >> + struct rte_eth_dev *dev; >> + const int index = 0; >> + const uint32_t pool = 0; >> + >> + if (!rte_eth_dev_is_valid_port(port_id)) { >> + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); >> + return -ENODEV; >> + } >> + >> + dev = &rte_eth_devices[port_id]; >> + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP); >> + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP); >> + >> + /* Update NIC default MAC address*/ >> + (*dev->dev_ops->mac_addr_remove)(dev, index); >> + (*dev->dev_ops->mac_addr_add)(dev, addr, index, pool); >> + >> + /* Update default address in NIC data structure */ >> + ether_addr_copy(addr, &dev->data->mac_addrs[index]); >> + >> + return 0; >> +} >> + > >No. this won't work. for some devices. > >Please use mac_addr_set hook added in recent DPDK
I tested over ixgbe and igb, and both work. As for your concern, it's legit. I will take your suggestion and make modification.