[dpdk-dev] [PATCH v2 3/8] drivers: Use ETH_DEV_PCI_DEV() helper

Shreyansh Jain shreyansh.jain at nxp.com
Tue Nov 22 12:21:52 CET 2016


On Monday 21 November 2016 10:25 PM, Jan Blunck wrote:
> The drivers should not directly access the rte_eth_dev->pci_dev but use
> a macro instead. This is a preparation for replacing the pci_dev with
> a struct rte_device member in the future.
>
> Signed-off-by: Jan Blunck <jblunck at infradead.org>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c       | 19 ++++++-----
>  drivers/net/bnxt/bnxt_ring.c         | 11 +++---
>  drivers/net/cxgbe/cxgbe_ethdev.c     |  2 +-
>  drivers/net/e1000/em_ethdev.c        | 20 ++++++-----
>  drivers/net/e1000/igb_ethdev.c       | 50 +++++++++++++++------------
>  drivers/net/e1000/igb_pf.c           |  3 +-
>  drivers/net/ena/ena_ethdev.c         |  2 +-
>  drivers/net/enic/enic_ethdev.c       |  2 +-
>  drivers/net/fm10k/fm10k_ethdev.c     | 49 ++++++++++++++-------------

I found a couple of placed in the fm10k_ethdev file where pci_dev usage 
can be replaced with ETH_DEV_PCI_DEV() macro. For example,
  - fm10k_dev_tx_init() +681,
  - fm10k_set_tx_function +2774

Can you please check once again?

>  drivers/net/i40e/i40e_ethdev.c       | 44 ++++++++++++------------
>  drivers/net/i40e/i40e_ethdev.h       |  4 +++
>  drivers/net/i40e/i40e_ethdev_vf.c    | 38 ++++++++++-----------
>  drivers/net/ixgbe/ixgbe_ethdev.c     | 65 +++++++++++++++++++++---------------
>  drivers/net/ixgbe/ixgbe_pf.c         |  2 +-
>  drivers/net/qede/qede_ethdev.c       | 17 +++++-----
>  drivers/net/vmxnet3/vmxnet3_ethdev.c |  4 +--
>  16 files changed, 185 insertions(+), 147 deletions(-)

Some changes in szedata2 are also on similar lines:
  - rte_szedata2_eth_dev_init +1419, +1420, ... <More>
  - rte_szedata2_eth_dev_uninit

Some changes in nicvf_ethdev.c also are missing, I think:
  - nicvf_eth_dev_init +1980
  - nicvf_dev_info_get +1350

and nfp/nfp_net.c
  - nfp_net_init(), +2333, +2403
  - nfp_net_close, +718, +737
  - nfp_net_dev_link_status_print
  - nfp_net_irq_unmask, +1161

and bnx2x_ethdev.c
  - bnx2x_common_dev_init
  - and access to intr_handle which can replaced with
    ETH_DEV_TO_INTR_HANDLE

Is there any specific reason these changes are not part of your patch?

[...]
> diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
> index 298cef4..9d4bea7 100644
> --- a/drivers/net/i40e/i40e_ethdev.h
> +++ b/drivers/net/i40e/i40e_ethdev.h
> @@ -671,6 +671,10 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter)
>  #define I40E_VF_TO_HW(vf) \
>  	(&(((struct i40e_vf *)vf)->adapter->hw))
>
> +/* ETH_DEV_TO_INTR_HANDLE */
> +#define ETH_DEV_TO_INTR_HANDLE(ptr) \
> +	(&(ETH_DEV_PCI_DEV(ptr)->intr_handle))
> +

Can this be in rte_ethdev.h just like ETH_DEV_PCI_DEV?
Or, as this is specific to rte_pci_device, probably in rte_pci.h?
Many drivers can be replaced this for accessing intr_handle.

-
Shreyansh


More information about the dev mailing list