[dpdk-dev] [PATCH v14 1/4] ethdev: add apis to support access device info
Thomas Monjalon
thomas.monjalon at 6wind.com
Tue Jul 14 00:26:38 CEST 2015
2015-07-12 17:22, Liang-Min Larry Wang:
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -2542,6 +2542,30 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)
> }
>
> 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);
> +
> + return 0;
> +}
It would be cleaner/clearer in a separate patch.
Why not using VALID_PORTID_OR_ERR_RET instead of rte_eth_dev_is_valid_port?
> +int
> +rte_eth_dev_reg_length(uint8_t port_id)
[...]
> + return (*dev->dev_ops->get_reg_length)(dev);
> +}
[...]
> +int
> +rte_eth_dev_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
[...]
> + return (*dev->dev_ops->get_reg)(dev, info);
> +}
[...]
> +int
> +rte_eth_dev_eeprom_length(uint8_t port_id)
[...]
> + return (*dev->dev_ops->get_eeprom_length)(dev);
> +}
These functions should have the "get" word in their names.
> --- a/lib/librte_ether/rte_ether_version.map
> +++ b/lib/librte_ether/rte_ether_version.map
> @@ -102,6 +102,12 @@ DPDK_2.0 {
> rte_eth_tx_queue_setup;
> rte_eth_xstats_get;
> rte_eth_xstats_reset;
> + rte_eth_dev_default_mac_addr_set;
> + rte_eth_dev_reg_length;
> + rte_eth_dev_reg_info;
> + rte_eth_dev_eeprom_length;
> + rte_eth_dev_get_eeprom;
> + rte_eth_dev_set_eeprom;
The new symbols should be in a new node for DPDK 2.1.
More information about the dev
mailing list