[dpdk-dev] [PATCH v7 1/4] ethdev: add apis to support access device info
Stephen Hemminger
stephen at networkplumber.org
Thu Jun 25 15:39:45 CEST 2015
On Wed, 17 Jun 2015 18:22:12 -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;
> +
> + if (!rte_eth_dev_is_valid_port(port_id)) {
> + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> + return -ENODEV;
> + }
> +
> + if (!is_valid_assigned_ether_addr(addr))
> + return -EINVAL;
> +
> + dev = &rte_eth_devices[port_id];
> + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
> +
> + /* Update default address in NIC data structure */
> + ether_addr_copy(addr, &dev->data->mac_addrs[0]);
> +
> + (*dev->dev_ops->mac_addr_set)(dev, addr);
Would it be possible to directly set mac_addr[0] if device does not
provide a device driver specific override?
More information about the dev
mailing list