[00/14] net/sfc: factor out common driver library
mbox series

Message ID 1599556475-27820-1-git-send-email-arybchenko@solarflare.com
Headers show
Series
  • net/sfc: factor out common driver library
Related show

Message

Andrew Rybchenko Sept. 8, 2020, 9:14 a.m. UTC
Network and vDPA drivers share libefx. So, libefx should be moved
to common drivers.

DPDK adaptation of the MCDI interface may be shared as well.

The new common driver name is sfc_efx since it a new home of
libefx base driver. sfc_ prefix is used to make it clear that
it is related to net/sfc (and vdpa/sfc in the future).

In theory, right now all exported libefx functions should be marked
as internal, but it requires corresponding markup in base driver
which sources should have no DPDK specifics since shared by many
drivers. So, it is unclear what to do and how to solve it.

The patch series makes these functions a part of DPDK_21 ABI to
pass build checks. checkpatches.sh does not like it.

Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: David Marchand <david.marchand@redhat.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>

Andrew Rybchenko (14):
  net/sfc: include header with debug helpers directly
  net/sfc: introduce common driver library
  net/sfc: add dedicated header file with MCDI interface
  net/sfc: move MCDI helper interface to dedicated namespace
  net/sfc: make MCDI logging helper macros local
  net/sfc: start to make MCDI helpers interface shareable
  net/sfc: use own logging helper macros
  net/sfc: avoid usage of NIC pointer from adapter context
  net/sfc: avoid panic in the case of MCDI timeout
  net/sfc: add MCDI callbacks to allocate/free DMA memory
  net/sfc: add MCDI callback to schedule restart
  net/sfc: add MCDI callback to poll management event queue
  net/sfc: use MCDI control structure as libefx ops context
  net/sfc: move MCDI helpers to common driver

 MAINTAINERS                                   |   1 +
 drivers/common/Makefile                       |   4 +
 drivers/common/meson.build                    |   2 +-
 drivers/common/sfc_efx/Makefile               | 112 ++++++
 .../{net/sfc => common/sfc_efx}/base/README   |   0
 .../sfc => common/sfc_efx}/base/ef10_ev.c     |   0
 .../sfc => common/sfc_efx}/base/ef10_evb.c    |   0
 .../sfc => common/sfc_efx}/base/ef10_filter.c |   0
 .../sfc_efx}/base/ef10_firmware_ids.h         |   0
 .../sfc => common/sfc_efx}/base/ef10_image.c  |   0
 .../sfc => common/sfc_efx}/base/ef10_impl.h   |   0
 .../sfc => common/sfc_efx}/base/ef10_intr.c   |   0
 .../sfc => common/sfc_efx}/base/ef10_mac.c    |   0
 .../sfc => common/sfc_efx}/base/ef10_mcdi.c   |   0
 .../sfc => common/sfc_efx}/base/ef10_nic.c    |   0
 .../sfc => common/sfc_efx}/base/ef10_nvram.c  |   0
 .../sfc => common/sfc_efx}/base/ef10_phy.c    |   0
 .../sfc => common/sfc_efx}/base/ef10_proxy.c  |   0
 .../sfc => common/sfc_efx}/base/ef10_rx.c     |   0
 .../sfc_efx}/base/ef10_signed_image_layout.h  |   0
 .../sfc_efx}/base/ef10_tlv_layout.h           |   0
 .../sfc => common/sfc_efx}/base/ef10_tx.c     |   0
 .../sfc => common/sfc_efx}/base/ef10_vpd.c    |   0
 .../{net/sfc => common/sfc_efx}/base/efx.h    |   0
 .../sfc => common/sfc_efx}/base/efx_annote.h  |   0
 .../sfc => common/sfc_efx}/base/efx_bootcfg.c |   0
 .../sfc => common/sfc_efx}/base/efx_check.h   |   0
 .../sfc => common/sfc_efx}/base/efx_crc32.c   |   0
 .../{net/sfc => common/sfc_efx}/base/efx_ev.c |   0
 .../sfc => common/sfc_efx}/base/efx_evb.c     |   0
 .../sfc => common/sfc_efx}/base/efx_filter.c  |   0
 .../sfc => common/sfc_efx}/base/efx_hash.c    |   0
 .../sfc => common/sfc_efx}/base/efx_impl.h    |   0
 .../sfc => common/sfc_efx}/base/efx_intr.c    |   0
 .../sfc => common/sfc_efx}/base/efx_lic.c     |   0
 .../sfc => common/sfc_efx}/base/efx_mac.c     |   0
 .../sfc => common/sfc_efx}/base/efx_mcdi.c    |   0
 .../sfc => common/sfc_efx}/base/efx_mcdi.h    |   0
 .../sfc => common/sfc_efx}/base/efx_mon.c     |   0
 .../sfc => common/sfc_efx}/base/efx_nic.c     |   0
 .../sfc => common/sfc_efx}/base/efx_nvram.c   |   0
 .../sfc => common/sfc_efx}/base/efx_phy.c     |   0
 .../sfc => common/sfc_efx}/base/efx_phy_ids.h |   0
 .../sfc => common/sfc_efx}/base/efx_port.c    |   0
 .../sfc => common/sfc_efx}/base/efx_proxy.c   |   0
 .../sfc => common/sfc_efx}/base/efx_regs.h    |   0
 .../sfc_efx}/base/efx_regs_ef10.h             |   0
 .../sfc_efx}/base/efx_regs_mcdi.h             |   0
 .../sfc_efx}/base/efx_regs_mcdi_aoe.h         |   0
 .../sfc_efx}/base/efx_regs_mcdi_strs.h        |   0
 .../sfc_efx}/base/efx_regs_pci.h              |   0
 .../{net/sfc => common/sfc_efx}/base/efx_rx.c |   0
 .../sfc => common/sfc_efx}/base/efx_sram.c    |   0
 .../sfc => common/sfc_efx}/base/efx_tunnel.c  |   0
 .../{net/sfc => common/sfc_efx}/base/efx_tx.c |   0
 .../sfc => common/sfc_efx}/base/efx_types.h   |   0
 .../sfc => common/sfc_efx}/base/efx_vpd.c     |   0
 .../sfc => common/sfc_efx}/base/hunt_impl.h   |   0
 .../sfc => common/sfc_efx}/base/hunt_nic.c    |   0
 .../sfc => common/sfc_efx}/base/mcdi_mon.c    |   0
 .../sfc => common/sfc_efx}/base/mcdi_mon.h    |   0
 .../sfc_efx}/base/medford2_impl.h             |   0
 .../sfc_efx}/base/medford2_nic.c              |   0
 .../sfc_efx}/base/medford_impl.h              |   0
 .../sfc => common/sfc_efx}/base/medford_nic.c |   0
 .../sfc => common/sfc_efx}/base/meson.build   |   0
 .../sfc => common/sfc_efx}/base/siena_flash.h |   0
 .../sfc => common/sfc_efx}/base/siena_impl.h  |   0
 .../sfc => common/sfc_efx}/base/siena_mac.c   |   0
 .../sfc => common/sfc_efx}/base/siena_mcdi.c  |   0
 .../sfc => common/sfc_efx}/base/siena_nic.c   |   0
 .../sfc => common/sfc_efx}/base/siena_nvram.c |   0
 .../sfc => common/sfc_efx}/base/siena_phy.c   |   0
 .../sfc => common/sfc_efx}/base/siena_sram.c  |   0
 .../sfc => common/sfc_efx}/base/siena_vpd.c   |   0
 drivers/{net/sfc => common/sfc_efx}/efsys.h   |  58 +--
 drivers/common/sfc_efx/meson.build            |  40 ++
 .../sfc_efx/rte_common_sfc_efx_version.map    | 119 ++++++
 drivers/common/sfc_efx/sfc_efx.c              |  23 ++
 drivers/common/sfc_efx/sfc_efx_debug.h        |  29 ++
 drivers/common/sfc_efx/sfc_efx_log.h          |  22 ++
 drivers/common/sfc_efx/sfc_efx_mcdi.c         | 343 ++++++++++++++++++
 drivers/common/sfc_efx/sfc_efx_mcdi.h         |  75 ++++
 drivers/net/sfc/Makefile                      |  70 +---
 drivers/net/sfc/meson.build                   |   6 +-
 drivers/net/sfc/sfc.c                         |   1 +
 drivers/net/sfc/sfc.h                         |  26 +-
 drivers/net/sfc/sfc_dp_tx.h                   |   1 +
 drivers/net/sfc/sfc_ef10.h                    |   2 +
 drivers/net/sfc/sfc_ef10_essb_rx.c            |   1 +
 drivers/net/sfc/sfc_ef10_rx.c                 |   1 +
 drivers/net/sfc/sfc_ef10_rx_ev.h              |   2 +
 drivers/net/sfc/sfc_ef10_tx.c                 |   1 +
 drivers/net/sfc/sfc_ethdev.c                  |  13 +
 drivers/net/sfc/sfc_filter.c                  |   1 +
 drivers/net/sfc/sfc_flow.c                    |   1 +
 drivers/net/sfc/sfc_log.h                     |  21 +-
 drivers/net/sfc/sfc_mcdi.c                    | 295 ++-------------
 drivers/net/sfc/sfc_port.c                    |   1 +
 mk/rte.app.mk                                 |   1 +
 100 files changed, 870 insertions(+), 402 deletions(-)
 create mode 100644 drivers/common/sfc_efx/Makefile
 rename drivers/{net/sfc => common/sfc_efx}/base/README (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_ev.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_evb.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_filter.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_firmware_ids.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_image.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_impl.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_intr.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_mac.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_mcdi.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_nic.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_nvram.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_phy.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_proxy.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_rx.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_signed_image_layout.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_tlv_layout.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_tx.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/ef10_vpd.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_annote.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_bootcfg.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_check.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_crc32.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_ev.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_evb.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_filter.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_hash.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_impl.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_intr.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_lic.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_mac.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_mcdi.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_mcdi.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_mon.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_nic.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_nvram.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_phy.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_phy_ids.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_port.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_proxy.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_regs.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_regs_ef10.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_regs_mcdi.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_regs_mcdi_aoe.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_regs_mcdi_strs.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_regs_pci.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_rx.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_sram.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_tunnel.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_tx.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_types.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/efx_vpd.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/hunt_impl.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/hunt_nic.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/mcdi_mon.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/mcdi_mon.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/medford2_impl.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/medford2_nic.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/medford_impl.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/medford_nic.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/meson.build (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_flash.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_impl.h (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_mac.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_mcdi.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_nic.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_nvram.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_phy.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_sram.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/base/siena_vpd.c (100%)
 rename drivers/{net/sfc => common/sfc_efx}/efsys.h (93%)
 create mode 100644 drivers/common/sfc_efx/meson.build
 create mode 100644 drivers/common/sfc_efx/rte_common_sfc_efx_version.map
 create mode 100644 drivers/common/sfc_efx/sfc_efx.c
 create mode 100644 drivers/common/sfc_efx/sfc_efx_debug.h
 create mode 100644 drivers/common/sfc_efx/sfc_efx_log.h
 create mode 100644 drivers/common/sfc_efx/sfc_efx_mcdi.c
 create mode 100644 drivers/common/sfc_efx/sfc_efx_mcdi.h

Comments

Ferruh Yigit Sept. 9, 2020, 2:32 p.m. UTC | #1
On 9/8/2020 10:14 AM, Andrew Rybchenko wrote:
> Network and vDPA drivers share libefx. So, libefx should be moved
> to common drivers.
> 
> DPDK adaptation of the MCDI interface may be shared as well.
> 
> The new common driver name is sfc_efx since it a new home of
> libefx base driver. sfc_ prefix is used to make it clear that
> it is related to net/sfc (and vdpa/sfc in the future).
> 
> In theory, right now all exported libefx functions should be marked
> as internal, but it requires corresponding markup in base driver
> which sources should have no DPDK specifics since shared by many
> drivers. So, it is unclear what to do and how to solve it.
>

Can a osdep.h can be added, like some other drivers do?
In that header a macro can be expanded to '__rte_internal' for DPDK, and empty
for others...

> 
> The patch series makes these functions a part of DPDK_21 ABI to
> pass build checks. checkpatches.sh does not like it.
> 
> Cc: Thomas Monjalon <thomas@monjalon.net>
> Cc: David Marchand <david.marchand@redhat.com>
> Cc: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> Andrew Rybchenko (14):
>   net/sfc: include header with debug helpers directly
>   net/sfc: introduce common driver library
>   net/sfc: add dedicated header file with MCDI interface
>   net/sfc: move MCDI helper interface to dedicated namespace
>   net/sfc: make MCDI logging helper macros local
>   net/sfc: start to make MCDI helpers interface shareable
>   net/sfc: use own logging helper macros
>   net/sfc: avoid usage of NIC pointer from adapter context
>   net/sfc: avoid panic in the case of MCDI timeout
>   net/sfc: add MCDI callbacks to allocate/free DMA memory
>   net/sfc: add MCDI callback to schedule restart
>   net/sfc: add MCDI callback to poll management event queue
>   net/sfc: use MCDI control structure as libefx ops context
>   net/sfc: move MCDI helpers to common driver
> 
<...>
Andrew Rybchenko Sept. 17, 2020, 6:21 a.m. UTC | #2
On 9/9/20 5:32 PM, Ferruh Yigit wrote:
> On 9/8/2020 10:14 AM, Andrew Rybchenko wrote:
>> Network and vDPA drivers share libefx. So, libefx should be moved
>> to common drivers.
>>
>> DPDK adaptation of the MCDI interface may be shared as well.
>>
>> The new common driver name is sfc_efx since it a new home of
>> libefx base driver. sfc_ prefix is used to make it clear that
>> it is related to net/sfc (and vdpa/sfc in the future).
>>
>> In theory, right now all exported libefx functions should be marked
>> as internal, but it requires corresponding markup in base driver
>> which sources should have no DPDK specifics since shared by many
>> drivers. So, it is unclear what to do and how to solve it.
>>
> Can a osdep.h can be added, like some other drivers do?
> In that header a macro can be expanded to '__rte_internal' for DPDK, and empty
> for others...

Thanks Ferruh, we have discussed the idea and will go this way.
I'll send v2 patches today.