[v6,00/39] use C11 alignas

Message ID 1708971946-18231-1-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
Headers
Series use C11 alignas |

Message

Tyler Retzlaff Feb. 26, 2024, 6:25 p.m. UTC
  The current location used for __rte_aligned(a) for alignment of types
and variables is not compatible with MSVC. There is only a single
location accepted by both toolchains.

For variables standard C11 offers alignas(a) supported by conformant
compilers i.e. both MSVC and GCC.

For types the standard offers no alignment facility that compatibly
interoperates with C and C++ but may be achieved by relocating the
placement of __rte_aligned(a) to the aforementioned location accepted
by all currently supported toolchains.

** NOTE **

Finally, In the interest of not creating more API (internal or not) the
series does not introduce a wrapper for C11 alignas. If we don't introduce
a macro an application can't take a dependency.

v6:
  * update static_assert to use XMM_SIZE instead of literal integer 16
  * update 2 explicit alignments of ring struct fields to use
  * alignas(sizeof(uint64_t)) instead of alignas(8)

v5:
  * rebase series.
  * reword all commit messages with why the change is necessary.
  * document guidance for the usage of __rte_aligned macro indicating
    that it should be used for type alignment only and advising that for
    variable alignment standard C11 alignas(a) should be preferred.

v4:
  * restore explicit alignment of 8-byte integers in mbuf and
    ring patches, natural alignment may be 4-bytes on 32-bit
    targets.
v3:
  * add missing patches for __rte_cache_aligned and
    __rte_cache_min_aligned
v2:
  * add missing #include <stdalign.h> for alignas macro.

Tyler Retzlaff (39):
  eal: use C11 alignas
  eal: redefine macro to be integer literal for MSVC
  stack: use C11 alignas
  sched: use C11 alignas
  ring: use C11 alignas
  pipeline: use C11 alignas
  net: use C11 alignas
  mbuf: use C11 alignas
  hash: use C11 alignas
  eventdev: use C11 alignas
  ethdev: use C11 alignas
  dmadev: use C11 alignas
  distributor: use C11 alignas
  acl: use C11 alignas
  vhost: use C11 alignas
  timer: use C11 alignas
  table: use C11 alignas
  reorder: use C11 alignas
  regexdev: use C11 alignas
  rcu: use C11 alignas
  power: use C11 alignas
  rawdev: use C11 alignas
  port: use C11 alignas
  pdcp: use C11 alignas
  node: use C11 alignas
  mldev: use C11 alignas
  mempool: use C11 alignas
  member: use C11 alignas
  lpm: use C11 alignas
  ipsec: use C11 alignas
  jobstats: use C11 alignas
  bpf: use C11 alignas
  compressdev: use C11 alignas
  cryptodev: use C11 alignas
  dispatcher: use C11 alignas
  fib: use C11 alignas
  gpudev: use C11 alignas
  graph: use C11 alignas
  ip_frag: use C11 alignas

 lib/acl/acl_run.h                          |  4 ++--
 lib/acl/acl_run_altivec.h                  |  6 ++++--
 lib/acl/acl_run_neon.h                     |  6 ++++--
 lib/bpf/bpf_pkt.c                          |  4 ++--
 lib/compressdev/rte_comp.h                 |  4 ++--
 lib/compressdev/rte_compressdev_internal.h |  8 +++----
 lib/cryptodev/cryptodev_pmd.h              |  8 +++----
 lib/cryptodev/rte_cryptodev_core.h         |  4 ++--
 lib/dispatcher/rte_dispatcher.c            |  4 ++--
 lib/distributor/distributor_private.h      | 34 ++++++++++++++++--------------
 lib/distributor/rte_distributor.c          |  5 +++--
 lib/dmadev/rte_dmadev_core.h               |  4 ++--
 lib/dmadev/rte_dmadev_pmd.h                |  8 +++----
 lib/eal/arm/include/rte_vect.h             |  4 ++--
 lib/eal/common/malloc_elem.h               |  4 ++--
 lib/eal/common/malloc_heap.h               |  4 ++--
 lib/eal/common/rte_keepalive.c             |  3 ++-
 lib/eal/common/rte_random.c                |  4 ++--
 lib/eal/common/rte_service.c               |  8 +++----
 lib/eal/include/generic/rte_atomic.h       |  4 ++--
 lib/eal/include/rte_common.h               | 23 +++++++++++++-------
 lib/eal/loongarch/include/rte_vect.h       |  8 +++----
 lib/eal/ppc/include/rte_vect.h             |  4 ++--
 lib/eal/riscv/include/rte_vect.h           |  4 ++--
 lib/eal/x86/include/rte_vect.h             |  9 +++++---
 lib/eal/x86/rte_power_intrinsics.c         | 10 +++++----
 lib/ethdev/ethdev_driver.h                 |  8 +++----
 lib/ethdev/rte_ethdev.h                    | 16 +++++++-------
 lib/ethdev/rte_ethdev_core.h               |  4 ++--
 lib/ethdev/rte_flow_driver.h               |  4 ++--
 lib/eventdev/event_timer_adapter_pmd.h     |  4 ++--
 lib/eventdev/eventdev_pmd.h                |  8 +++----
 lib/eventdev/rte_event_crypto_adapter.c    | 16 +++++++-------
 lib/eventdev/rte_event_dma_adapter.c       | 16 +++++++-------
 lib/eventdev/rte_event_eth_rx_adapter.c    |  8 +++----
 lib/eventdev/rte_event_eth_tx_adapter.c    |  4 ++--
 lib/eventdev/rte_event_timer_adapter.c     |  9 ++++----
 lib/eventdev/rte_event_timer_adapter.h     |  8 +++----
 lib/eventdev/rte_eventdev.h                |  8 +++----
 lib/eventdev/rte_eventdev_core.h           |  4 ++--
 lib/fib/dir24_8.h                          |  4 +++-
 lib/fib/trie.h                             |  4 +++-
 lib/gpudev/gpudev_driver.h                 |  4 ++--
 lib/graph/graph_private.h                  |  4 ++--
 lib/graph/graph_stats.c                    |  4 ++--
 lib/graph/rte_graph.h                      |  4 ++--
 lib/graph/rte_graph_worker_common.h        | 17 +++++++++------
 lib/hash/rte_cuckoo_hash.h                 | 16 ++++++++------
 lib/hash/rte_thash.c                       |  4 +++-
 lib/hash/rte_thash.h                       |  8 +++----
 lib/ip_frag/ip_reassembly.h                |  8 +++----
 lib/ipsec/rte_ipsec.h                      |  4 ++--
 lib/ipsec/sa.h                             |  4 ++--
 lib/jobstats/rte_jobstats.h                |  8 +++----
 lib/lpm/rte_lpm.h                          |  5 +++--
 lib/lpm/rte_lpm6.c                         |  8 +++----
 lib/mbuf/rte_mbuf_core.h                   |  6 +++---
 lib/member/rte_member.h                    |  8 +++----
 lib/member/rte_member_ht.h                 |  4 ++--
 lib/member/rte_member_sketch.c             |  4 ++--
 lib/mempool/rte_mempool.h                  | 27 ++++++++++++------------
 lib/mldev/rte_mldev.h                      |  4 ++--
 lib/mldev/rte_mldev_core.h                 |  4 ++--
 lib/net/net_crc_avx512.c                   | 14 ++++++------
 lib/net/net_crc_neon.c                     | 11 +++++-----
 lib/net/net_crc_sse.c                      | 17 ++++++++-------
 lib/net/rte_arp.h                          |  8 +++----
 lib/net/rte_ether.h                        |  8 +++----
 lib/node/node_private.h                    |  4 ++--
 lib/node/pkt_cls.c                         |  4 +++-
 lib/pdcp/rte_pdcp.h                        |  4 ++--
 lib/pipeline/rte_pipeline.c                |  4 ++--
 lib/pipeline/rte_port_in_action.c          |  3 ++-
 lib/pipeline/rte_swx_ipsec.c               |  4 +++-
 lib/pipeline/rte_table_action.c            | 24 ++++++++++-----------
 lib/port/rte_port_frag.c                   |  4 ++--
 lib/power/power_acpi_cpufreq.c             |  4 ++--
 lib/power/power_amd_pstate_cpufreq.c       |  4 ++--
 lib/power/power_cppc_cpufreq.c             |  4 ++--
 lib/power/power_intel_uncore.c             |  4 ++--
 lib/power/power_pstate_cpufreq.c           |  4 ++--
 lib/power/rte_power_pmd_mgmt.c             |  4 ++--
 lib/rawdev/rte_rawdev.h                    |  4 ++--
 lib/rcu/rte_rcu_qsbr.h                     | 16 ++++++++------
 lib/regexdev/rte_regexdev_core.h           |  8 +++----
 lib/reorder/rte_reorder.c                  |  8 +++----
 lib/ring/rte_ring_core.h                   | 16 ++++++++------
 lib/ring/rte_ring_peek_zc.h                |  4 ++--
 lib/sched/rte_sched.c                      | 21 +++++++++---------
 lib/sched/rte_sched_common.h               |  2 --
 lib/stack/rte_stack.h                      | 16 ++++++++------
 lib/table/rte_swx_table_learner.c          |  4 ++--
 lib/table/rte_table_acl.c                  |  3 ++-
 lib/table/rte_table_array.c                |  7 +++---
 lib/table/rte_table_hash_cuckoo.c          |  4 +++-
 lib/table/rte_table_hash_ext.c             |  3 ++-
 lib/table/rte_table_hash_key16.c           |  4 +++-
 lib/table/rte_table_hash_key32.c           |  4 +++-
 lib/table/rte_table_hash_key8.c            |  4 +++-
 lib/table/rte_table_hash_lru.c             |  3 ++-
 lib/table/rte_table_lpm.c                  |  3 ++-
 lib/table/rte_table_lpm_ipv6.c             |  3 ++-
 lib/timer/rte_timer.c                      |  4 ++--
 lib/vhost/vhost.h                          |  8 +++----
 lib/vhost/vhost_crypto.c                   |  4 ++--
 105 files changed, 408 insertions(+), 346 deletions(-)