[dpdk-dev] [PATCH] ethdev: return diagnostic when setting MAC address

Ferruh Yigit ferruh.yigit at intel.com
Mon Mar 26 20:39:00 CEST 2018


On 2/27/2018 3:11 PM, Olivier Matz wrote:
> Change the prototype and the behavior of dev_ops->eth_mac_addr_set(): a
> return code is added to notify the caller (librte_ether) if an error
> occurred in the PMD.
> 
> The new default MAC address is now copied in dev->data->mac_addrs[0]
> only if the operation is successful.
> 
> The patch also updates all the PMDs accordingly.
> 
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> ---
> 
> Hi,
> 
> This patch is the following of the discussion we had in this thread:
> https://dpdk.org/dev/patchwork/patch/32284/
> 
> I did my best to keep the consistency inside the PMDs. The behavior
> of eth_mac_addr_set() is inspired from other fonctions in the same
> PMD, usually eth_mac_addr_add(). For instance:
> - dpaa and dpaa2 return 0 on error.
> - some PMDs (bnxt, mlx5, ...?) do not return a -errno code (-1 or
>   positive values).
> - some PMDs (avf, tap) check if the address is the same and return 0
>   in that case. This could go in generic code?
> 
> I tried to use the following errors when relevant:
> - -EPERM when a VF is not allowed to do a change
> - -ENOTSUP if the function is not supported
> - -EIO if this is an unknown error from lower layer (hw or sdk)
> - -EINVAL for other unknown errors
> 
> Please, PMD maintainers, feel free to comment if you ahve specific
> needs for your driver.
> 
> Thanks
> Olivier
> 
> 
>  doc/guides/rel_notes/deprecation.rst    |  8 --------
>  drivers/net/ark/ark_ethdev.c            |  9 ++++++---
>  drivers/net/avf/avf_ethdev.c            | 12 ++++++++----
>  drivers/net/bnxt/bnxt_ethdev.c          | 10 ++++++----
>  drivers/net/bonding/rte_eth_bond_pmd.c  |  8 ++++++--
>  drivers/net/dpaa/dpaa_ethdev.c          |  4 +++-
>  drivers/net/dpaa2/dpaa2_ethdev.c        |  6 ++++--
>  drivers/net/e1000/igb_ethdev.c          | 12 +++++++-----
>  drivers/net/failsafe/failsafe_ops.c     | 16 +++++++++++++---
>  drivers/net/i40e/i40e_ethdev.c          | 24 ++++++++++++++---------
>  drivers/net/i40e/i40e_ethdev_vf.c       | 12 +++++++-----
>  drivers/net/ixgbe/ixgbe_ethdev.c        | 13 ++++++++-----
>  drivers/net/mlx4/mlx4.h                 |  2 +-
>  drivers/net/mlx4/mlx4_ethdev.c          |  7 +++++--
>  drivers/net/mlx5/mlx5.h                 |  2 +-
>  drivers/net/mlx5/mlx5_mac.c             |  7 +++++--
>  drivers/net/mrvl/mrvl_ethdev.c          |  7 ++++++-
>  drivers/net/null/rte_eth_null.c         |  3 ++-
>  drivers/net/octeontx/octeontx_ethdev.c  |  4 +++-
>  drivers/net/qede/qede_ethdev.c          |  7 +++----
>  drivers/net/sfc/sfc_ethdev.c            | 14 +++++---------
>  drivers/net/szedata2/rte_eth_szedata2.c |  3 ++-
>  drivers/net/tap/rte_eth_tap.c           | 34 +++++++++++++++++++++------------
>  drivers/net/virtio/virtio_ethdev.c      | 15 ++++++++++-----
>  drivers/net/vmxnet3/vmxnet3_ethdev.c    |  5 +++--
>  lib/librte_ether/rte_ethdev.c           |  7 +++++--
>  lib/librte_ether/rte_ethdev_core.h      |  2 +-
>  test/test/virtual_pmd.c                 |  3 ++-
>  28 files changed, 159 insertions(+), 97 deletions(-)

ethdev part looks good to me.
Are you planning to have another version for mrvl and sfc comments?

PMD maintainers, please check and provide feedback for your PMD, otherwise the
patch will go in as it is.

Thanks,
ferruh


More information about the dev mailing list