mbox series

[v7,0/6] implement common rte bit operation APIs in PMDs

Message ID 20200309095410.28983-1-joyce.kong@arm.com (mailing list archive)
Headers
Series implement common rte bit operation APIs in PMDs |

Message

Joyce Kong March 9, 2020, 9:54 a.m. UTC
  Bitwise operation APIs are defined and used in a lot of PMDs,
which caused a huge code duplication. To reduce duplication,
this patch consolidates them into a common API family and use
it for all the PMDs(we started with a few selectively).

v7:
  1. Change the API's head file to 'rte_pmd_bitops.h' as a common-
     but-not-public file.
  2. Replace C11 atomic operations with 'volatile'. As the use cases
     are limited to PMDs, a 'volatile' is sufficient.

v5,v6:
  Trim 'unsigned long' in PMDs down to 'uint32_t', as on mainstream
  64-bit OS, 'unsigned long' is 64-bit in size, but the 32-bit OS
  expects 32-bit 'unsigned long' argument.

v4:
  Introduce uint32_t/uint64_t *addr when definiting bit operation
  APIs.

v3:
  1. Change the API's head file back to rte_bitops.h, then implement
     both 32-bit and 64-bit operations with and without C11 atomic
     memory ordering.
  2. Add multi-core test case for bit operations which implemented
     with memory ordering.
  3. Modify the doc of both APIs and test cases.

v2:
  1. Add doxygen comments for the rte bit operation API.
  2. Add test cases for common rte bit operation API.
  3. Change the header file to rte_io_bitops.h and the operation to
     rte_io_set_bit() etc., as the API uses barriers inside and the
     barriers are only needed for IO operations.
  4. Use an well defined uint_NN_t type.

Joyce Kong (6):
  lib/eal: implement the family of PMD bit operation APIs
  test/pmdbitops: add PMD bit operation test case
  net/axgbe: use common rte bit operation APIs instead
  net/bnx2x: use common rte bit operation APIs instead
  net/qede: use common rte bit operation APIs instead
  net/hinic: use common rte bit operation APIs instead

 MAINTAINERS                                   |   5 +
 app/test/Makefile                             |   1 +
 app/test/autotest_data.py                     |   6 +
 app/test/meson.build                          |   2 +
 app/test/test_pmd_bitops.c                    | 137 ++++++++++
 doc/api/doxy-api-index.md                     |   5 +-
 drivers/net/Makefile                          |   1 +
 drivers/net/axgbe/axgbe_common.h              |  29 +-
 drivers/net/axgbe/axgbe_ethdev.c              |  14 +-
 drivers/net/axgbe/axgbe_ethdev.h              |   2 +-
 drivers/net/axgbe/axgbe_mdio.c                |  15 +-
 drivers/net/bnx2x/bnx2x.c                     | 253 +++++++++--------
 drivers/net/bnx2x/bnx2x.h                     |  10 +-
 drivers/net/bnx2x/ecore_sp.h                  |  48 ++--
 drivers/net/hinic/Makefile                    |   1 +
 drivers/net/hinic/base/hinic_compat.h         |  33 +--
 drivers/net/hinic/hinic_pmd_ethdev.c          |  18 +-
 drivers/net/hinic/hinic_pmd_ethdev.h          |   2 +-
 drivers/net/hinic/meson.build                 |   2 +
 drivers/net/qede/base/bcm_osal.c              |  22 +-
 drivers/net/qede/base/bcm_osal.h              |  14 +-
 drivers/net/qede/base/ecore.h                 |   6 +-
 drivers/net/qede/base/ecore_cxt.c             |   6 +-
 drivers/net/qede/base/ecore_dcbx.c            |   8 +-
 drivers/net/qede/base/ecore_dev.c             |  38 +--
 drivers/net/qede/base/ecore_dev_api.h         |   2 +-
 drivers/net/qede/base/ecore_l2.c              |   6 +-
 drivers/net/qede/base/ecore_mcp.c             |   4 +-
 drivers/net/qede/base/ecore_sp_commands.c     |  12 +-
 drivers/net/qede/base/ecore_spq.c             |   2 +-
 drivers/net/qede/base/ecore_spq.h             |  10 +-
 drivers/net/qede/qede_main.c                  |   4 +-
 lib/librte_eal/common/Makefile                |   1 +
 .../common/include/rte_pmd_bitops.h           | 257 ++++++++++++++++++
 lib/librte_eal/common/meson.build             |   3 +-
 35 files changed, 653 insertions(+), 326 deletions(-)
 create mode 100644 app/test/test_pmd_bitops.c
 create mode 100644 lib/librte_eal/common/include/rte_pmd_bitops.h