add __extension__ keyword to statement expressions
Subsystems (3)
cover add __extension__ keyword to statement expressions
As requested from previous rejected series this series applies the __extension__ keyword to all statement expressionsin DPDK.
Tyler Retzlaff (4):
lib: add extension keyword to statement expressions
app: add extension keyword to statement expressions
drivers: add extension keyword to statement expressions
examples: add extension keyword to statement expressions
app/graph/utils.c | 2 +- app/test-eventdev/parser.h | 2 +- app/test-mldev/parser.h | 2 +- app/test-pmd/cmdline_tm.c | 2 +- drivers/bus/fslmc/mc/fsl_mc_sys.h | 6 ++--- drivers/common/cnxk/roc_io.h | 6 ++--- drivers/common/cnxk/roc_platform.h | 2 +- drivers/common/dpaax/dpaa_list.h | 2 +- drivers/common/qat/qat_adf/icp_qat_hw.h | 2 +- drivers/crypto/armv8/rte_armv8_pmd.c | 4 ++-- drivers/crypto/caam_jr/caam_jr_desc.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.c | 2 +- drivers/event/octeontx/ssovf_evdev.h | 4 ++-- drivers/mempool/octeontx/octeontx_fpavf.h | 4 ++-- drivers/ml/cnxk/cn10k_ml_dev.h | 4 ++-- drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- drivers/net/cxgbe/cxgbe_compat.h | 2 +- drivers/net/ena/base/ena_plat_dpdk.h | 14 +++++------ drivers/net/ena/ena_ethdev.c | 30 ++++++++++++------------ drivers/net/enetfec/enet_ethdev.h | 2 +- drivers/net/fm10k/base/fm10k_osdep.h | 2 +- drivers/net/i40e/i40e_rxtx.h | 2 +- drivers/net/octeontx/base/octeontx_io.h | 6 ++--- drivers/net/pfe/base/cbus.h | 2 +- drivers/net/pfe/base/pfe.h | 12 +++++----- drivers/net/tap/bpf/bpf_api.h | 2 +- drivers/net/thunderx/base/nicvf_plat.h | 4 ++-- drivers/net/txgbe/base/txgbe_osdep.h | 2 +- drivers/raw/ifpga/afu_pmd_core.h | 2 +- drivers/raw/ifpga/base/ifpga_compat.h | 4 ++-- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- drivers/raw/ifpga/base/opae_spi_transaction.c | 2 +- drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 4 ++-- examples/fips_validation/fips_validation.c | 2 +- examples/ip_pipeline/parser.h | 2 +- examples/pipeline/cli.c | 2 +- examples/qos_meter/main.h | 2 +- lib/ethdev/rte_mtr.c | 10 ++++---- lib/ethdev/rte_tm.c | 6 ++--- lib/pipeline/rte_pipeline.c | 8 +++---- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- lib/port/rte_port_source_sink.c | 4 ++-- 42 files changed, 92 insertions(+), 92 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/4 lib: add extension keyword to statement expressions
Add __extension__ keyword to gcc statement expression extensions.
--- lib/ethdev/rte_mtr.c | 10 +++++----- lib/ethdev/rte_tm.c | 6 +++--- lib/pipeline/rte_pipeline.c | 8 ++++---- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- lib/port/rte_port_source_sink.c | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-)
lib/ethdev/rte_mtr.c +5 -5
@@ -41,14 +41,14 @@ }#define RTE_MTR_FUNC (port_id, func) \ -({ \ +__extension__ ({ \ const struct rte_mtr_ops *ops = \ - rte_mtr_ops_get(port_id, error); \ - if (ops == NULL) \ + rte_mtr_ops_get(port_id, error); \ + if (ops == NULL) \ return -rte_errno; \ \ if (ops->func == NULL) \ - return -rte_mtr_error_set(error, \ + return -rte_mtr_error_set(error, \ ENOSYS, \ RTE_MTR_ERROR_TYPE_UNSPECIFIED, \ NULL, \
@@ -58,7 +58,7 @@ })#define RTE_MTR_HNDL_FUNC (port_id, func) \ -({ \ +__extension__ ({ \ const struct rte_mtr_ops *ops = \ rte_mtr_ops_get(port_id, error); \ if (ops == NULL) \
lib/ethdev/rte_tm.c +3 -3
@@ -40,11 +40,11 @@return ops; } -#define RTE_TM_FUNC (port_id, func) \ -({ \ +#define RTE_TM_FUNC (port_id, func) \ +__extension__ ({ \ const struct rte_tm_ops *ops = \ rte_tm_ops_get(port_id, error); \ - if (ops == NULL) \ + if (ops == NULL) \ return -rte_errno; \ \ if (ops->func == NULL) \
lib/pipeline/rte_pipeline.c +4 -4
@@ -17,16 +17,16 @@#ifdef RTE_PIPELINE_STATS_COLLECT #define RTE_PIPELINE_STATS_AH_DROP_WRITE (p, mask) \ - ({ (p)->n_pkts_ah_drop = rte_popcount64(mask); }) + __extension__ ({ (p)->n_pkts_ah_drop = rte_popcount64(mask); })#define RTE_PIPELINE_STATS_AH_DROP_READ (p, counter) \ - ({ (counter) += (p)->n_pkts_ah_drop; (p)->n_pkts_ah_drop = 0; }) + __extension__ ({ (counter) += (p)->n_pkts_ah_drop; (p)->n_pkts_ah_drop = 0; })#define RTE_PIPELINE_STATS_TABLE_DROP0 (p) \ - ({ (p)->pkts_drop_mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; }) + __extension__ ({ (p)->pkts_drop_mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; })#define RTE_PIPELINE_STATS_TABLE_DROP1 (p, counter) \ -({ \ +__extension__ ({ \ uint64_t mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; \ mask ^= (p)->pkts_drop_mask; \ (counter) += rte_popcount64(mask); \
lib/pipeline/rte_swx_pipeline_internal.h +1 -1
@@ -1485,7 +1485,7 @@ struct thread {#endif #define METADATA_READ (thread, offset, n_bits) \ -({ \ +__extension__ ({ \ uint64_t *m64_ptr = (uint64_t *)&(thread)->metadata[offset]; \ uint64_t m64 = *m64_ptr; \ uint64_t m64_mask = UINT64_MAX >> (64 - (n_bits)); \
lib/port/rte_port_source_sink.c +2 -2
@@ -176,7 +176,7 @@ struct rte_port_source {#else /* RTE_PORT_PCAP */ #define PCAP_SOURCE_LOAD (port, file_name, n_bytes, socket_id) \ -({ \ +__extension__ ({ \ int _ret = 0; \ \ if (file_name) { \
@@ -429,7 +429,7 @@ struct rte_port_sink {#else #define PCAP_SINK_OPEN (port, file_name, max_n_pkts) \ -({ \ +__extension__ ({ \ int _ret = 0; \ \ if (file_name) { \
Signature · 1 line
1.8.3.1
PATCH 2/4 app: add extension keyword to statement expressions
In reply to Tyler RetzlaffAdd __extension__ keyword to gcc statement expression extensions.
--- app/graph/utils.c | 2 +- app/test-eventdev/parser.h | 2 +- app/test-mldev/parser.h | 2 +- app/test-pmd/cmdline_tm.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
app/graph/utils.c +1 -1
@@ -13,7 +13,7 @@#include "module_api.h" #define white_spaces_skip (pos) \ -({ \ +__extension__ ({ \ __typeof__(pos) _p = (pos); \ for ( ; isspace(*_p); _p++) \ ; \
app/test-eventdev/parser.h +1 -1
@@ -11,7 +11,7 @@#define PARSE_DELIMITER " \f\n\r\t\v"#define skip_white_spaces (pos) \ -({ \ +__extension__ ({ \ __typeof__(pos) _p = (pos); \ for ( ; isspace(*_p); _p++) \ ; \
app/test-mldev/parser.h +1 -1
@@ -13,7 +13,7 @@#define PARSE_DELIMITER " \f\n\r\t\v"#define skip_white_spaces (pos) \ - ({ \ + __extension__ ({ \ __typeof__(pos) _p = (pos); \ for (; isspace(*_p); _p++) \ ; \
app/test-pmd/cmdline_tm.c +1 -1
@@ -20,7 +20,7 @@#define MAX_NUM_SHARED_SHAPERS 256#define skip_white_spaces (pos) \ -({ \ +__extension__ ({ \ __typeof__(pos) _p = (pos); \ for ( ; isspace(*_p); _p++) \ ; \
Signature · 1 line
1.8.3.1
PATCH 3/4 drivers: add extension keyword to statement expressions
In reply to Tyler RetzlaffAdd __extension__ keyword to gcc statement expression extensions.
--- drivers/bus/fslmc/mc/fsl_mc_sys.h | 6 ++--- drivers/common/cnxk/roc_io.h | 6 ++--- drivers/common/cnxk/roc_platform.h | 2 +- drivers/common/dpaax/dpaa_list.h | 2 +- drivers/common/qat/qat_adf/icp_qat_hw.h | 2 +- drivers/crypto/armv8/rte_armv8_pmd.c | 4 ++-- drivers/crypto/caam_jr/caam_jr_desc.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.c | 2 +- drivers/event/octeontx/ssovf_evdev.h | 4 ++-- drivers/mempool/octeontx/octeontx_fpavf.h | 4 ++-- drivers/ml/cnxk/cn10k_ml_dev.h | 4 ++-- drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- drivers/net/cxgbe/cxgbe_compat.h | 2 +- drivers/net/ena/base/ena_plat_dpdk.h | 14 +++++------ drivers/net/ena/ena_ethdev.c | 30 ++++++++++++------------ drivers/net/enetfec/enet_ethdev.h | 2 +- drivers/net/fm10k/base/fm10k_osdep.h | 2 +- drivers/net/i40e/i40e_rxtx.h | 2 +- drivers/net/octeontx/base/octeontx_io.h | 6 ++--- drivers/net/pfe/base/cbus.h | 2 +- drivers/net/pfe/base/pfe.h | 12 +++++----- drivers/net/tap/bpf/bpf_api.h | 2 +- drivers/net/thunderx/base/nicvf_plat.h | 4 ++-- drivers/net/txgbe/base/txgbe_osdep.h | 2 +- drivers/raw/ifpga/afu_pmd_core.h | 2 +- drivers/raw/ifpga/base/ifpga_compat.h | 4 ++-- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- drivers/raw/ifpga/base/opae_spi_transaction.c | 2 +- drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 4 ++-- 29 files changed, 69 insertions(+), 69 deletions(-)
drivers/bus/fslmc/mc/fsl_mc_sys.h +3 -3
@@ -40,11 +40,11 @@ struct fsl_mc_io {#define __arch_putq (v, a) (*(volatile uint64_t *)(a) = (v))#define __arch_putq32 (v, a) (*(volatile uint32_t *)(a) = (v))#define readq (c) \ - ({ uint64_t __v = __arch_getq(c); __iormb(); __v; }) + __extension__ ({ uint64_t __v = __arch_getq(c); __iormb(); __v; })#define writeq (v, c) \ - ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; }) + __extension__ ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })#define writeq32 (v, c) \ - ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; }) + __extension__ ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })#define ioread64 (_p) readq(_p)#define iowrite64 (_v, _p) writeq(_v, _p)#define iowrite32 (_v, _p) writeq32(_v, _p)
drivers/common/cnxk/roc_io.h +3 -3
@@ -30,21 +30,21 @@#endif #define roc_load_pair (val0, val1, addr) \ - ({ \ + __extension__ ({ \ asm volatile("ldp %x[x0], %x[x1], [%x[p1]]" \ : [x0] "=r"(val0), [x1] "=r"(val1) \ : [p1] "r"(addr)); \ })#define roc_store_pair (val0, val1, addr) \ - ({ \ + __extension__ ({ \ asm volatile( \ "stp %x[x0], %x[x1], [%x[p1], #0]!" ::[x0] "r"(val0), \ [x1] "r"(val1), [p1] "r"(addr)); \ })#define roc_prefetch_store_keep (ptr) \ - ({ asm volatile("prfm pstl1keep, [%x0]\n" : : "r"(ptr)); }) + __extension__ ({ asm volatile("prfm pstl1keep, [%x0]\n" : : "r"(ptr)); })#if defined(__clang__)static __plt_always_inline void
drivers/common/cnxk/roc_platform.h +1 -1
@@ -82,7 +82,7 @@/** Divide ceil */ #define PLT_DIV_CEIL (x, y) \ - ({ \ + __extension__ ({ \ __typeof(x) __x = x; \ __typeof(y) __y = y; \ (__x + __y - 1) / __y; \
drivers/common/dpaax/dpaa_list.h +1 -1
@@ -31,7 +31,7 @@ struct list_head n = { \#define list_entry (node, type, member) \ (type *)((void *)node - offsetof(type, member))#define list_empty (p) \ -({ \ +__extension__ ({ \ const struct list_head *__p298 = (p); \ ((__p298->next == __p298) && (__p298->prev == __p298)); \ })
drivers/common/qat/qat_adf/icp_qat_hw.h +1 -1
@@ -292,7 +292,7 @@ enum icp_qat_hw_cipher_convert {#define QAT_CIPHER_AEAD_AAD_SIZE_BITPOS 16#define QAT_CIPHER_AEAD_AAD_SIZE_LE_BITPOS 0#define ICP_QAT_HW_CIPHER_CONFIG_BUILD_UPPER (aad_size) \ - ({ \ + __extension__ ({ \ typeof(aad_size) aad_size1 = aad_size; \ (((((aad_size1) >> QAT_CIPHER_AEAD_AAD_UPPER_SHIFT) & \ QAT_CIPHER_AEAD_AAD_SIZE_UPPER_MASK) << \
drivers/crypto/armv8/rte_armv8_pmd.c +2 -2
@@ -139,7 +139,7 @@* Extract particular combined mode crypto function from the 3D array. */ #define CRYPTO_GET_ALGO (order, cop, calg, aalg, keyl) \ -({ \ +__extension__ ({ \ crypto_func_tbl_t *func_tbl = \ (crypto_chain_order[(order)])[(cop)]; \ \
@@ -186,7 +186,7 @@* Extract particular combined mode crypto function from the 3D array. */ #define CRYPTO_GET_KEY_SCHED (cop, calg, keyl) \ -({ \ +__extension__ ({ \ crypto_key_sched_tbl_t *ks_tbl = crypto_key_sched_dir[(cop)]; \ \ (calg >= CRYPTO_CIPHER_MAX) ? \
drivers/crypto/caam_jr/caam_jr_desc.h +1 -1
@@ -32,7 +32,7 @@/* Macro for setting up a JD. The structure of the JD is common across all * supported protocols, thus its structure is identical. */ -#define SEC_JD_INIT (descriptor) ({ \ +#define SEC_JD_INIT (descriptor) __extension__ ({ \/* CTYPE = job descriptor \ * RSMS, DNR = 0 * ONE = 1
drivers/dma/hisilicon/hisi_dmadev.c +1 -1
@@ -124,7 +124,7 @@hisi_dma_write_queue (hw, qoff, tmp); } -#define hisi_dma_poll_hw_state (hw, val, cond, sleep_us, timeout_us) ({ \ +#define hisi_dma_poll_hw_state (hw, val, cond, sleep_us, timeout_us) __extension__ ({ \ uint32_t timeout = 0; \ while (timeout++ <= (timeout_us)) { \ (val) = hisi_dma_read_queue(hw, HISI_DMA_QUEUE_FSM_REG); \
drivers/event/octeontx/ssovf_evdev.h +2 -2
@@ -96,14 +96,14 @@/* ARM64 specific functions */ #if defined(RTE_ARCH_ARM64 ) -#define ssovf_load_pair (val0, val1, addr) ({ \ +#define ssovf_load_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "ldp %x[x0], %x[x1], [%x[p1]]" \ :[x0]"=r"(val0), [x1]"=r"(val1) \ :[p1]"r"(addr) \ ); }) -#define ssovf_store_pair (val0, val1, addr) ({ \ +#define ssovf_store_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "stp %x[x0], %x[x1], [%x[p1]]" \ ::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
drivers/mempool/octeontx/octeontx_fpavf.h +2 -2
@@ -59,14 +59,14 @@/* ARM64 specific functions */ #if defined(RTE_ARCH_ARM64 ) -#define fpavf_load_pair (val0, val1, addr) ({ \ +#define fpavf_load_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "ldp %x[x0], %x[x1], [%x[p1]]" \ :[x0]"=r"(val0), [x1]"=r"(val1) \ :[p1]"r"(addr) \ ); }) -#define fpavf_store_pair (val0, val1, addr) ({ \ +#define fpavf_store_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "stp %x[x0], %x[x1], [%x[p1]]" \ ::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
drivers/ml/cnxk/cn10k_ml_dev.h +2 -2
@@ -44,8 +44,8 @@/* Memory barrier macros */ #if defined(RTE_ARCH_ARM ) -#define dmb_st ({ asm volatile("dmb st" : : : "memory"); }) -#define dsb_st ({ asm volatile("dsb st" : : : "memory"); }) +#define dmb_st __extension__ ({ asm volatile("dmb st" : : : "memory"); }) +#define dsb_st __extension__ ({ asm volatile("dsb st" : : : "memory"); })#else #define dmb_st#define dsb_st
drivers/net/bnxt/bnxt_ethdev.c +2 -2
@@ -4866,12 +4866,12 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)#define bnxt_roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) -#define min_t (type, x, y) ({ \ +#define min_t (type, x, y) __extension__ ({ \ type __min1 = (x); \ type __min2 = (y); \ __min1 < __min2 ? __min1 : __min2; }) -#define max_t (type, x, y) ({ \ +#define max_t (type, x, y) __extension__ ({ \ type __max1 = (x); \ type __max2 = (y); \ __max1 > __max2 ? __max1 : __max2; })
drivers/net/cxgbe/cxgbe_compat.h +1 -1
@@ -136,7 +136,7 @@#define cxgbe_roundup (_p, _s) (((unsigned long)(_p) + (_s - 1)) & ~(_s - 1))#ifndef container_of -#define container_of (ptr, type, member) ({ \ +#define container_of (ptr, type, member) __extension__ ({ \ typeof(((type *)0)->member)(*__mptr) = (ptr); \ (type *)((char *)__mptr - offsetof(type, member)); })#endif
drivers/net/ena/base/ena_plat_dpdk.h +7 -7
@@ -141,9 +141,9 @@#define ena_spinlock_t rte_spinlock_t#define ENA_SPINLOCK_INIT (spinlock) rte_spinlock_init(&(spinlock))#define ENA_SPINLOCK_LOCK (spinlock, flags) \ - ({(void)(flags); rte_spinlock_lock(&(spinlock)); }) + __extension__ ({(void)(flags); rte_spinlock_lock(&(spinlock)); })#define ENA_SPINLOCK_UNLOCK (spinlock, flags) \ - ({(void)(flags); rte_spinlock_unlock(&(spinlock)); }) + __extension__ ({(void)(flags); rte_spinlock_unlock(&(spinlock)); })#define ENA_SPINLOCK_DESTROY (spinlock) ((void)(spinlock)) typedef struct {
@@ -237,7 +237,7 @@ENA_MEM_ALLOC_COHERENT_ALIGNED (dmadev, size, virt, phys, \ mem_handle, RTE_CACHE_LINE_SIZE)#define ENA_MEM_FREE_COHERENT (dmadev, size, virt, phys, mem_handle) \ - ({ ENA_TOUCH(size); ENA_TOUCH(phys); ENA_TOUCH(dmadev); \ + __extension__ ({ ENA_TOUCH(size); ENA_TOUCH(phys); ENA_TOUCH(dmadev); \ rte_memzone_free(mem_handle); }) #define ENA_MEM_ALLOC_COHERENT_NODE_ALIGNED( \
@@ -263,16 +263,16 @@#define ENA_MEM_ALLOC (dmadev, size) rte_zmalloc(NULL, size, 1)#define ENA_MEM_FREE (dmadev, ptr, size) \ - ({ ENA_TOUCH(dmadev); ENA_TOUCH(size); rte_free(ptr); }) + __extension__ ({ ENA_TOUCH(dmadev); ENA_TOUCH(size); rte_free(ptr); })#define ENA_DB_SYNC (mem_handle) ((void)mem_handle)#define ENA_REG_WRITE32 (bus, value, reg) \ - ({ (void)(bus); rte_write32((value), (reg)); }) + __extension__ ({ (void)(bus); rte_write32((value), (reg)); })#define ENA_REG_WRITE32_RELAXED (bus, value, reg) \ - ({ (void)(bus); rte_write32_relaxed((value), (reg)); }) + __extension__ ({ (void)(bus); rte_write32_relaxed((value), (reg)); })#define ENA_REG_READ32 (bus, reg) \ - ({ (void)(bus); rte_read32_relaxed((reg)); }) + __extension__ ({ (void)(bus); rte_read32_relaxed((reg)); })#define ATOMIC32_INC (i32_ptr) rte_atomic32_inc(i32_ptr)#define ATOMIC32_DEC (i32_ptr) rte_atomic32_dec(i32_ptr)
drivers/net/ena/ena_ethdev.c +15 -15
@@ -459,7 +459,7 @@ struct ena_mp_body {* calls to the same proxied function under the same lock. */ #define ENA_PROXY (a, f, ...) \ -({ \ +__extension__ ({ \ struct ena_adapter *_a = (a); \ struct timespec ts = { .tv_sec = ENA_MP_REQ_TMO }; \ struct ena_mp_body *req, *rsp; \
@@ -507,13 +507,13 @@ struct ena_mp_body {*********************************************************************/ ENA_PROXY_DESC(ena_com_get_dev_basic_stats, ENA_MP_DEV_STATS_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(stats); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); if (stats != &adapter->basic_stats)
@@ -522,13 +522,13 @@ struct ena_mp_body { struct ena_com_dev *ena_dev, struct ena_admin_basic_stats *stats); ENA_PROXY_DESC(ena_com_get_eni_stats, ENA_MP_ENI_STATS_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(stats); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); if (stats != (struct ena_admin_eni_stats *)&adapter->metrics_stats)
@@ -537,12 +537,12 @@ struct ena_mp_body { struct ena_com_dev *ena_dev, struct ena_admin_eni_stats *stats); ENA_PROXY_DESC(ena_com_set_dev_mtu, ENA_MP_MTU_SET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(ena_dev); req->args.mtu = mtu; }), -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(rsp); ENA_TOUCH(ena_dev);
@@ -551,12 +551,12 @@ struct ena_mp_body { struct ena_com_dev *ena_dev, int mtu); ENA_PROXY_DESC(ena_com_indirect_table_set, ENA_MP_IND_TBL_SET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); }), -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(rsp); ENA_TOUCH(ena_dev);
@@ -564,13 +564,13 @@ struct ena_mp_body { struct ena_com_dev *ena_dev); ENA_PROXY_DESC(ena_com_indirect_table_get, ENA_MP_IND_TBL_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(ind_tbl); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); if (ind_tbl != adapter->indirect_table)
@@ -580,14 +580,14 @@ struct ena_mp_body { struct ena_com_dev *ena_dev, u32 *ind_tbl); ENA_PROXY_DESC(ena_com_get_customer_metrics, ENA_MP_CUSTOMER_METRICS_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(buf); ENA_TOUCH(buf_size); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); ENA_TOUCH(buf_size);
@@ -597,13 +597,13 @@ struct ena_mp_body { struct ena_com_dev *ena_dev, char *buf, size_t buf_size); ENA_PROXY_DESC(ena_com_get_ena_srd_info, ENA_MP_SRD_STATS_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(info); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); if ((struct ena_stats_srd *)info != &adapter->srd_stats)
drivers/net/enetfec/enet_ethdev.h +1 -1
@@ -42,7 +42,7 @@#define ENETFEC_MAX_Q 1 -#define writel (v, p) ({*(volatile unsigned int *)(p) = (v); }) +#define writel (v, p) __extension__ ({*(volatile unsigned int *)(p) = (v); })#define readl (p) rte_read32(p)struct bufdesc {
drivers/net/fm10k/base/fm10k_osdep.h +1 -1
@@ -102,7 +102,7 @@#endif #ifndef do_div -#define do_div (n, base) ({\ +#define do_div (n, base) __extension__ ({\ (n) = (n) / (base);\ })#endif /* do_div */
drivers/net/i40e/i40e_rxtx.h +1 -1
@@ -46,7 +46,7 @@#define I40E_RX_DESC_EXT_STATUS_FLEXBL_FLEX 0x01#undef container_of -#define container_of (ptr, type, member) ({ \ +#define container_of (ptr, type, member) __extension__ ({ \ typeof(((type *)0)->member)(*__mptr) = (ptr); \ (type *)((char *)__mptr - offsetof(type, member)); })
drivers/net/octeontx/base/octeontx_io.h +3 -3
@@ -19,17 +19,17 @@/* ARM64 specific functions */ #if defined(RTE_ARCH_ARM64 ) -#define octeontx_prefetch_store_keep (_ptr) ({\ +#define octeontx_prefetch_store_keep (_ptr) __extension__ ({\ asm volatile("prfm pstl1keep, %a0\n" : : "p" (_ptr)); }) -#define octeontx_load_pair (val0, val1, addr) ({ \ +#define octeontx_load_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "ldp %x[x0], %x[x1], [%x[p1]]" \ :[x0]"=r"(val0), [x1]"=r"(val1) \ :[p1]"r"(addr) \ ); }) -#define octeontx_store_pair (val0, val1, addr) ({ \ +#define octeontx_store_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "stp %x[x0], %x[x1], [%x[p1]]" \ ::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
drivers/net/pfe/base/cbus.h +1 -1
@@ -36,7 +36,7 @@/* Byte Enables of the Internal memory access. These are interpred in BE */ #define PE_MEM_ACCESS_BYTE_ENABLE (offset, size) \ - ({ typeof(size) size_ = (size); \ + __extension__ ({ typeof(size) size_ = (size); \ (((BIT(size_) - 1) << (4 - (offset) - (size_))) & 0xf) << 24; })#include "cbus/emac_mtip.h"
drivers/net/pfe/base/pfe.h +6 -6
@@ -95,36 +95,36 @@#define PMEM_SIZE 0x8000/* TMU has less... */ #define PMEM_END (PMEM_BASE_ADDR + PMEM_SIZE) -#define writel (v, p) ({*(volatile unsigned int *)(p) = (v); }) +#define writel (v, p) __extension__ ({*(volatile unsigned int *)(p) = (v); })#define readl (p) (*(const volatile unsigned int *)(p))/* These check memory ranges from PE point of view/memory map */ #define IS_DMEM (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= DMEM_BASE_ADDR) && \ (((unsigned long)(addr_) + (len)) <= DMEM_END); })#define IS_PMEM (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= PMEM_BASE_ADDR) && \ (((unsigned long)(addr_) + (len)) <= PMEM_END); })#define IS_PE_LMEM (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= \ PE_LMEM_BASE_ADDR) && \ (((unsigned long)(addr_) + \ (len)) <= PE_LMEM_END); })#define IS_PFE_LMEM (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= \ CBUS_VIRT_TO_PFE(LMEM_BASE_ADDR)) && \ (((unsigned long)(addr_) + (len)) <= \ CBUS_VIRT_TO_PFE(LMEM_END)); })#define __IS_PHYS_DDR (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= \ DDR_PHYS_BASE_ADDR) && \ (((unsigned long)(addr_) + (len)) <= \
drivers/net/tap/bpf/bpf_api.h +1 -1
@@ -162,7 +162,7 @@ static int BPF_FUNC(map_update_elem, void *map, const void *key,#ifndef printt# define printt (fmt, ...) \ - ({ \ + __extension__ ({ \ char ____fmt[] = fmt; \ trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \ })
drivers/net/thunderx/base/nicvf_plat.h +2 -2
@@ -55,11 +55,11 @@/* ARM64 specific functions */ #if defined(RTE_ARCH_ARM64 ) -#define nicvf_prefetch_store_keep (_ptr) ({\ +#define nicvf_prefetch_store_keep (_ptr) __extension__ ({\ asm volatile("prfm pstl1keep, [%x0]\n" : : "r" (_ptr)); }) -#define NICVF_LOAD_PAIR (reg1, reg2, addr) ({ \ +#define NICVF_LOAD_PAIR (reg1, reg2, addr) __extension__ ({ \ asm volatile( \ "ldp %x[x1], %x[x0], [%x[p1]]" \ : [x1]"=r"(reg1), [x0]"=r"(reg2)\
drivers/net/txgbe/base/txgbe_osdep.h +1 -1
@@ -172,7 +172,7 @@ static inline u64 REVERT_BIT_MASK64(u64 mask)/* Check whether an address is broadcast. */ #define TXGBE_IS_BROADCAST (address) \ - ({typeof(address)addr = (address); \ + __extension__ ({typeof(address)addr = (address); \ (((u8 *)(addr))[0] == ((u8)0xff)) && \ (((u8 *)(addr))[1] == ((u8)0xff)); })
drivers/raw/ifpga/afu_pmd_core.h +1 -1
@@ -66,7 +66,7 @@ struct afu_rawdev {#define MHZ (f) ((f) * 1000000)#define dsm_poll_timeout (addr, val, cond, invl, timeout) \ -({ \ +__extension__ ({ \ uint64_t __wait = 0; \ uint64_t __invl = (invl); \ uint64_t __timeout = (timeout); \
drivers/raw/ifpga/base/ifpga_compat.h +2 -2
@@ -8,7 +8,7 @@#include "opae_osdep.h" #undef container_of -#define container_of (ptr, type, member) ({ \ +#define container_of (ptr, type, member) __extension__ ({ \ typeof(((type *)0)->member)(*__mptr) = (ptr); \ (type *)((char *)__mptr - offsetof(type, member)); })
@@ -36,7 +36,7 @@* by polling with given interval and timeout. */ #define fpga_wait_register_field (_field, _expect, _reg_addr, _timeout, _invl)\ -({ \ +__extension__ ({ \ int wait = 0; \ int ret = -ETIMEDOUT; \ typeof(_expect) value; \
drivers/raw/ifpga/base/opae_osdep.h +2 -2
@@ -81,7 +81,7 @@ struct uuid {#define opae_memset (a, b, c) memset((a), (b), (c)) #define readx_poll_timeout(op, val, cond, invl, timeout, args...) \ -({ \ +__extension__ ({ \ unsigned long __wait = 0; \ unsigned long __invl = (invl); \ unsigned long __timeout = (timeout); \
@@ -107,7 +107,7 @@ struct uuid { readx_poll_timeout(opae_readb, val, cond, invl, timeout, addr)#define opae_max10_read_poll_timeout (dev, addr, value, cond, invl, timeout) \ -({ \ +__extension__ ({ \ int __ret, __tmp; \ __tmp = readx_poll_timeout(max10_sys_read, __ret, __ret || (cond), \ invl, timeout, (dev), (addr), &(value)); \
drivers/raw/ifpga/base/opae_spi_transaction.c +1 -1
@@ -24,7 +24,7 @@#define SPI_REG_BYTES 4#define INIT_SPI_TRAN_HEADER (trans_type, size, address) \ -({ \ +__extension__ ({ \ header.trans_type = trans_type; \ header.reserve = 0; \ header.size = cpu_to_be16(size); \
drivers/raw/ifpga/base/osdep_rte/osdep_generic.h +2 -2
@@ -41,12 +41,12 @@#define min (a, b) RTE_MIN(a, b)#define max (a, b) RTE_MAX(a, b) -#define min_t (type, x, y) ({ \ +#define min_t (type, x, y) __extension__ ({ \ type __min1 = (x); \ type __min2 = (y); \ __min1 < __min2 ? __min1 : __min2; }) -#define max_t (type, x, y) ({ \ +#define max_t (type, x, y) __extension__ ({ \ type __max1 = (x); \ type __max2 = (y); \ __max1 > __max2 ? __max1 : __max2; })
Signature · 1 line
1.8.3.1
Re: [PATCH 3/4] drivers: add extension keyword to statement expressions
Quoted 35 lines · Tyler Retzlaff
Add
__extension__keyword to gcc statement expression extensions.Signed-off-by Tyler Retzlaff <[email protected]>--- drivers/bus/fslmc/mc/fsl_mc_sys.h | 6 ++--- drivers/common/cnxk/roc_io.h | 6 ++--- drivers/common/cnxk/roc_platform.h | 2 +- drivers/common/dpaax/dpaa_list.h | 2 +- drivers/common/qat/qat_adf/icp_qat_hw.h | 2 +- drivers/crypto/armv8/rte_armv8_pmd.c | 4 ++-- drivers/crypto/caam_jr/caam_jr_desc.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.c | 2 +- drivers/event/octeontx/ssovf_evdev.h | 4 ++-- drivers/mempool/octeontx/octeontx_fpavf.h | 4 ++-- drivers/ml/cnxk/cn10k_ml_dev.h | 4 ++-- drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- drivers/net/cxgbe/cxgbe_compat.h | 2 +- drivers/net/ena/base/ena_plat_dpdk.h | 14 +++++------ drivers/net/ena/ena_ethdev.c | 30 ++++++++++++------------ drivers/net/enetfec/enet_ethdev.h | 2 +- drivers/net/fm10k/base/fm10k_osdep.h | 2 +- drivers/net/i40e/i40e_rxtx.h | 2 +- drivers/net/octeontx/base/octeontx_io.h | 6 ++--- drivers/net/pfe/base/cbus.h | 2 +- drivers/net/pfe/base/pfe.h | 12 +++++----- drivers/net/tap/bpf/bpf_api.h | 2 +- drivers/net/thunderx/base/nicvf_plat.h | 4 ++-- drivers/net/txgbe/base/txgbe_osdep.h | 2 +- drivers/raw/ifpga/afu_pmd_core.h | 2 +- drivers/raw/ifpga/base/ifpga_compat.h | 4 ++-- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- drivers/raw/ifpga/base/opae_spi_transaction.c | 2 +- drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 4 ++-- 29 files changed, 69 insertions(+), 69 deletions(-)
<snip>
Quoted 14 lines
drivers/crypto/armv8/rte_armv8_pmd.c +1
-1@@ -139,7 +139,7 @@* Extract particular combined mode crypto function from the 3D array. */ #define CRYPTO_GET_ALGO (order, cop, calg, aalg, keyl) \ -({ \ +__extension__ ({ \ crypto_func_tbl_t *func_tbl = \ (crypto_chain_order[(order)])[(cop)]; \ \
drivers/crypto/armv8/rte_armv8_pmd.c line 192
Quoted 8 lines
drivers/crypto/armv8/rte_armv8_pmd.c +1
-1@@ -186,7 +186,7 @@* Extract particular combined mode crypto function from the 3D array. */ #define CRYPTO_GET_KEY_SCHED (cop, calg, keyl) \ -({ \ +__extension__ ({ \ crypto_key_sched_tbl_t *ks_tbl = crypto_key_sched_dir[(cop)]; \ \ (calg >= CRYPTO_CIPHER_MAX) ? \
PATCH 4/4 examples: add extension keyword to statement expressions
In reply to Tyler RetzlaffAdd __extension__ keyword to gcc statement expression extensions.
--- examples/fips_validation/fips_validation.c | 2 +- examples/ip_pipeline/parser.h | 2 +- examples/pipeline/cli.c | 2 +- examples/qos_meter/main.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
examples/fips_validation/fips_validation.c +1 -1
@@ -14,7 +14,7 @@#include "fips_validation.h" #define skip_white_spaces (pos) \ -({ \ +__extension__ ({ \ __typeof__(pos) _p = (pos); \ for ( ; isspace(*_p); _p++) \ ; \
examples/ip_pipeline/parser.h +1 -1
@@ -14,7 +14,7 @@#define PARSE_DELIMITER " \f\n\r\t\v"#define skip_white_spaces (pos) \ -({ \ +__extension__ ({ \ __typeof__(pos) _p = (pos); \ for ( ; isspace(*_p); _p++) \ ; \
examples/pipeline/cli.c +1 -1
@@ -46,7 +46,7 @@#define MSG_CMD_FAIL "Command \"%s\" failed.\n"#define skip_white_spaces (pos) \ -({ \ +__extension__ ({ \ __typeof__(pos) _p = (pos); \ for ( ; isspace(*_p); _p++) \ ; \
examples/qos_meter/main.h +1 -1
@@ -24,7 +24,7 @@ enum policer_action policer_table[RTE_COLORS][RTE_COLORS] =#if APP_MODE ==APP_MODE_FWD #define FUNC_METER (m, p, time, pkt_len, pkt_color) \ -({ \ +__extension__ ({ \ void *mp = m; \ void *pp = p; \ mp = mp; \
Signature · 1 line
1.8.3.1
v2 cover add __extension__ keyword to statement expressions
In reply to Tyler RetzlaffTyler explained in v1:
"""
As requested from previous rejected series this series applies the __extension__ keyword to all statement expressionsin DPDK. """
Changes since v1:
- rebased,
- added two cleanups before Tyler patch,
Signature · 60 lines
David Marchand David Marchand (2): eal: add helper to skip whitespaces drivers: use common min/max macros Tyler Retzlaff (1): add extension keyword to GCC statement expressions app/graph/utils.c | 13 ++----- app/test-eventdev/parser.c | 14 ++++---- app/test-eventdev/parser.h | 8 ----- app/test-mldev/parser.c | 17 ++++----- app/test-mldev/parser.h | 8 ----- app/test-pmd/cmdline_tm.c | 13 ++----- app/test/test_string_fns.c | 35 +++++++++++++++++++ drivers/bus/fslmc/mc/fsl_mc_sys.h | 6 ++-- drivers/common/cnxk/roc_io.h | 6 ++-- drivers/common/cnxk/roc_platform.h | 2 +- drivers/common/dpaax/dpaa_list.h | 2 +- drivers/common/qat/qat_adf/icp_qat_hw.h | 2 +- drivers/crypto/armv8/rte_armv8_pmd.c | 4 +-- drivers/crypto/caam_jr/caam_jr_desc.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.c | 2 +- drivers/event/octeontx/ssovf_evdev.h | 4 +-- drivers/mempool/octeontx/octeontx_fpavf.h | 4 +-- drivers/ml/cnxk/cn10k_ml_dev.h | 4 +-- drivers/net/bnxt/bnxt_ethdev.c | 12 +------ drivers/net/ena/base/ena_plat_dpdk.h | 14 ++++---- drivers/net/ena/ena_ethdev.c | 30 ++++++++-------- drivers/net/enetfec/enet_ethdev.h | 2 +- drivers/net/fm10k/base/fm10k_osdep.h | 2 +- drivers/net/octeontx/base/octeontx_io.h | 6 ++-- drivers/net/pfe/base/cbus.h | 2 +- drivers/net/pfe/base/pfe.h | 12 +++---- drivers/net/qede/base/bcm_osal.h | 6 ++-- drivers/net/tap/bpf/bpf_api.h | 2 +- drivers/net/thunderx/base/nicvf_plat.h | 4 +-- drivers/net/txgbe/base/txgbe_osdep.h | 2 +- drivers/raw/ifpga/afu_pmd_core.h | 2 +- drivers/raw/ifpga/base/ifpga_compat.h | 2 +- drivers/raw/ifpga/base/opae_osdep.h | 4 +-- drivers/raw/ifpga/base/opae_spi_transaction.c | 2 +- .../raw/ifpga/base/osdep_rte/osdep_generic.h | 11 ++---- examples/fips_validation/fips_validation.c | 16 +++------ examples/ip_pipeline/parser.c | 14 ++++---- examples/ip_pipeline/parser.h | 8 ----- examples/pipeline/cli.c | 13 ++----- examples/qos_meter/main.h | 2 +- lib/eal/include/rte_string_fns.h | 27 ++++++++++++++ lib/ethdev/rte_mtr.c | 10 +++--- lib/ethdev/rte_tm.c | 6 ++-- lib/pipeline/rte_pipeline.c | 8 ++--- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- lib/port/rte_port_source_sink.c | 4 +-- 46 files changed, 181 insertions(+), 190 deletions(-) -- 2.43.0
PATCH v2 1/3 eal: add helper to skip whitespaces
Reduce code duplication by providing a simple inline helper.
--- app/graph/utils.c | 13 ++------ app/test-eventdev/parser.c | 14 ++++----- app/test-eventdev/parser.h | 8 ----- app/test-mldev/parser.c | 17 ++++++----- app/test-mldev/parser.h | 8 ----- app/test-pmd/cmdline_tm.c | 13 ++------ app/test/test_string_fns.c | 35 ++++++++++++++++++++++ examples/fips_validation/fips_validation.c | 16 +++------- examples/ip_pipeline/parser.c | 14 ++++----- examples/ip_pipeline/parser.h | 8 ----- examples/pipeline/cli.c | 13 ++------ lib/eal/include/rte_string_fns.h | 27 +++++++++++++++++ 12 files changed, 98 insertions(+), 88 deletions(-)
app/graph/utils.c +3 -10
@@ -9,17 +9,10 @@#include <string.h> #include <rte_common.h> +#include <rte_string_fns.h> #include "module_api.h" -#define white_spaces_skip (pos) \ -({ \ - __typeof__(pos) _p = (pos); \ - for ( ; isspace(*_p); _p++) \ - ; \ - _p; \ -}) -static void hex_string_to_uint64 (uint64_t *dst,const char *hexs) {
@@ -47,7 +40,7 @@ parser_uint64_read(uint64_t *value, const char *p)char *next;uint64_t val; - p =white_spaces_skip (p); + p =rte_str_skip_leading_spaces (p);if (!isdigit (*p))return -EINVAL ;
@@ -73,7 +66,7 @@ parser_uint64_read(uint64_t *value, const char *p)break ; } - p =white_spaces_skip (p); + p =rte_str_skip_leading_spaces (p);if (*p !='\0' )return -EINVAL ;
app/test-eventdev/parser.c +7 -7
@@ -40,7 +40,7 @@ get_hex_val(char c)int parser_read_arg_bool (const char *p) { - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);int result = -EINVAL ; if (((p[0] == 'y') && (p[1] == 'e') && (p[2] == 's')) ||
@@ -67,7 +67,7 @@ parser_read_arg_bool(const char *p) result =0 ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (p[0 ] !='\0' )return -EINVAL ;
@@ -81,7 +81,7 @@ parser_read_uint64(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (!isdigit (*p))return -EINVAL ;
@@ -107,7 +107,7 @@ parser_read_uint64(uint64_t *value, const char *p)break ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (*p !='\0' )return -EINVAL ;
@@ -121,7 +121,7 @@ parser_read_int32(int32_t *value, const char *p)char *next;int32_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (!isdigit (*p))return -EINVAL ;
@@ -139,13 +139,13 @@ parser_read_uint64_hex(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p); val =strtoul (p, &next,16 );if (p == next)return -EINVAL ; - p =skip_white_spaces (next); + p =rte_str_skip_leading_spaces (next);if (*p !='\0' )return -EINVAL ;
app/test-eventdev/parser.h +0 -8
@@ -10,14 +10,6 @@#define PARSE_DELIMITER " \f\n\r\t\v" -#define skip_white_spaces (pos) \ -({ \ - __typeof__(pos) _p = (pos); \ - for ( ; isspace(*_p); _p++) \ - ; \ - _p; \ -}) -static inline size_t skip_digits (const char *src) {
app/test-mldev/parser.c +9 -8
@@ -12,6 +12,7 @@#include <string.h> #include <rte_common.h> +#include <rte_string_fns.h> #include "parser.h"
@@ -52,7 +53,7 @@ get_hex_val(char c)int parser_read_arg_bool (const char *p) { - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);int result = -EINVAL ; if (((p[0] == 'y') && (p[1] == 'e') && (p[2] == 's')) ||
@@ -77,7 +78,7 @@ parser_read_arg_bool(const char *p) result =0 ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (p[0 ] !='\0' )return -EINVAL ;
@@ -91,7 +92,7 @@ parser_read_uint64(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (!isdigit (*p))return -EINVAL ;
@@ -117,7 +118,7 @@ parser_read_uint64(uint64_t *value, const char *p)break ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (*p !='\0' )return -EINVAL ;
@@ -131,7 +132,7 @@ parser_read_int32(int32_t *value, const char *p)char *next;int32_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if ((*p !='-' ) && (!isdigit (*p)))return -EINVAL ;
@@ -149,7 +150,7 @@ parser_read_int16(int16_t *value, const char *p)char *next;int16_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if ((*p !='-' ) && (!isdigit (*p)))return -EINVAL ;
@@ -167,13 +168,13 @@ parser_read_uint64_hex(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p); val =strtoul (p, &next,16 );if (p == next)return -EINVAL ; - p =skip_white_spaces (next); + p =rte_str_skip_leading_spaces (next);if (*p !='\0' )return -EINVAL ;
app/test-mldev/parser.h +0 -8
@@ -12,14 +12,6 @@#define PARSE_DELIMITER " \f\n\r\t\v" -#define skip_white_spaces (pos) \ - ({ \ - __typeof__(pos) _p = (pos); \ - for (; isspace(*_p); _p++) \ - ; \ - _p; \ - }) -static inline size_t skip_digits (const char *src) {
app/test-pmd/cmdline_tm.c +3 -10
@@ -11,6 +11,7 @@#include <rte_ethdev.h> #include <rte_flow.h> +#include <rte_string_fns.h> #include <rte_tm.h> #include "testpmd.h"
@@ -19,14 +20,6 @@#define PARSE_DELIMITER " \f\n\r\t\v"#define MAX_NUM_SHARED_SHAPERS 256 -#define skip_white_spaces (pos) \ -({ \ - __typeof__(pos) _p = (pos); \ - for ( ; isspace(*_p); _p++) \ - ; \ - _p; \ -}) -/** Display TM Error Message */ static void print_err_msg (struct rte_tm_error *error)
@@ -112,7 +105,7 @@ read_uint64(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (!isdigit (*p))return -EINVAL ;
@@ -138,7 +131,7 @@ read_uint64(uint64_t *value, const char *p)break ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (*p !='\0' )return -EINVAL ;
app/test/test_string_fns.c +35 -0
@@ -172,6 +172,39 @@ test_rte_strlcat(void)return 0 ; } +static int +test_rte_str_skip_leading_spaces (void ) +{ +static const char empty[] ="" ; +static const char nowhitespace[] ="Thereisreallynowhitespace" ; +static const char somewhitespaces[] =" \f\n\r\t\vThere are some whitespaces" ; +const char *p; + +LOG ("Checking '%s'\n" , empty); + p =rte_str_skip_leading_spaces (empty); +if (p != empty) { +LOG ("Returned address '%s' does not match expected result\n" , p); +return -1 ; + } +LOG ("Got expected '%s'\n" , p); +LOG ("Checking '%s'\n" , nowhitespace); + p =rte_str_skip_leading_spaces (nowhitespace); +if (p != nowhitespace) { +LOG ("Returned address '%s' does not match expected result\n" , p); +return -1 ; + } +LOG ("Got expected '%s'\n" , p); +LOG ("Checking '%s'\n" , somewhitespaces); + p =rte_str_skip_leading_spaces (somewhitespaces); +if (p !=strchr (somewhitespaces,'T' )) { +LOG ("Returned address '%s' does not match expected result\n" , p); +return -1 ; + } +LOG ("Got expected '%s'\n" , p); + +return 0 ; +} +static int test_string_fns (void ) {
@@ -179,6 +212,8 @@ test_string_fns(void)return -1 ;if (test_rte_strlcat () <0 )return -1 ; +if (test_rte_str_skip_leading_spaces () <0 ) +return -1 ;return 0 ; }
examples/fips_validation/fips_validation.c +4 -12
@@ -13,14 +13,6 @@#include "fips_validation.h" -#define skip_white_spaces (pos) \ -({ \ - __typeof__(pos) _p = (pos); \ - for ( ; isspace(*_p); _p++) \ - ; \ - _p; \ -}) -static int get_file_line (void ) {
@@ -579,13 +571,13 @@ parser_read_uint64_hex(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p); val =strtoul (p, &next,16 );if (p == next)return -EINVAL ; - p =skip_white_spaces (next); + p =rte_str_skip_leading_spaces (next);if (*p !='\0' )return -EINVAL ;
@@ -759,7 +751,7 @@ parser_read_uint64(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (!isdigit (*p))return -EINVAL ;
@@ -785,7 +777,7 @@ parser_read_uint64(uint64_t *value, const char *p)break ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (*p !='\0' )return -EINVAL ;
examples/ip_pipeline/parser.c +7 -7
@@ -42,7 +42,7 @@ get_hex_val(char c)int parser_read_arg_bool (const char *p) { - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);int result = -EINVAL ; if (((p[0] == 'y') && (p[1] == 'e') && (p[2] == 's')) ||
@@ -69,7 +69,7 @@ parser_read_arg_bool(const char *p) result =0 ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (p[0 ] !='\0' )return -EINVAL ;
@@ -83,7 +83,7 @@ parser_read_uint64(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (!isdigit (*p))return -EINVAL ;
@@ -109,7 +109,7 @@ parser_read_uint64(uint64_t *value, const char *p)break ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (*p !='\0' )return -EINVAL ;
@@ -123,13 +123,13 @@ parser_read_uint64_hex(uint64_t *value, const char *p)char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p); val =strtoul (p, &next,16 );if (p == next)return -EINVAL ; - p =skip_white_spaces (next); + p =rte_str_skip_leading_spaces (next);if (*p !='\0' )return -EINVAL ;
@@ -420,7 +420,7 @@ parse_cpu_core(const char *entry,uint32_t s =0 , c =0 , h =0 , val;uint8_t s_parsed =0 , c_parsed =0 , h_parsed =0 ; -const char *next =skip_white_spaces (entry); +const char *next =rte_str_skip_leading_spaces (entry);char type;if (p ==NULL )
examples/ip_pipeline/parser.h +0 -8
@@ -13,14 +13,6 @@#define PARSE_DELIMITER " \f\n\r\t\v" -#define skip_white_spaces (pos) \ -({ \ - __typeof__(pos) _p = (pos); \ - for ( ; isspace(*_p); _p++) \ - ; \ - _p; \ -}) -static inline size_t skip_digits (const char *src) {
examples/pipeline/cli.c +3 -10
@@ -19,6 +19,7 @@#include <rte_swx_pipeline.h> #include <rte_swx_ctl.h> #include <rte_swx_ipsec.h> +#include <rte_string_fns.h> #include "cli.h"
@@ -45,21 +46,13 @@#define MSG_FILE_NOT_ENOUGH "Not enough rules in file \"%s\".\n"#define MSG_CMD_FAIL "Command \"%s\" failed.\n" -#define skip_white_spaces (pos) \ -({ \ - __typeof__(pos) _p = (pos); \ - for ( ; isspace(*_p); _p++) \ - ; \ - _p; \ -}) -static int parser_read_uint64 (uint64_t *value,const char *p) {char *next;uint64_t val; - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (!isdigit (*p))return -EINVAL ;
@@ -85,7 +78,7 @@ parser_read_uint64(uint64_t *value, const char *p)break ; } - p =skip_white_spaces (p); + p =rte_str_skip_leading_spaces (p);if (*p !='\0' )return -EINVAL ;
lib/eal/include/rte_string_fns.h +27 -0
@@ -15,10 +15,12 @@extern "C" {#endif +#include <ctype.h> #include <stdio.h> #include <string.h> #include <rte_common.h> +#include <rte_compat.h> /** * Takes string "string" parameter and splits it at character "delim"
@@ -115,6 +117,31 @@ rte_strlcat(char *dst, const char *src, size_t size)ssize_t rte_strscpy (char *dst,const char *src,size_t dsize); +/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice. +* +* Search for the first non whitespace character. +* +* @param src +* The input string to be analysed. +* +* @return +* The address of the first non whitespace character. +*/ +__rte_experimental +static inline const char * +rte_str_skip_leading_spaces (const char *src) +{ +const char *p = src; + +while (isspace (*p)) + p++; + +return p; +} + + #ifdef __cplusplus }#endif
Signature · 1 line
2.43.0
Re: [PATCH v2 1/3] eal: add helper to skip whitespaces
Quoted 5 lines · David Marchand
Reduce code duplication by providing a simple inline helper.
Signed-off-by David Marchand <[email protected]>Acked-by Tyler Retzlaff <[email protected]>
I forgot to mention:
Changes since v1:
- renamed helper as per Bruce suggestion,
Signature · 1 line
David Marchand
Bruce Richardson
Acked-byRe: [PATCH v2 1/3] eal: add helper to skip whitespaces
Quoted 5 lines · David Marchand
Quoted 3 lines · David Marchand
Reduce code duplication by providing a simple inline helper.
Quoted 8 lines
Quoted 2 lines
Signed-off-by David Marchand <[email protected]>Acked-by Tyler Retzlaff <[email protected]>I forgot to mention:
Changes since v1:
- renamed helper as per Bruce suggestion,
With that done, how can I fail to ack this! :-)
PATCH v2 2/3 drivers: use common min/max macros
In reply to David MarchandUse newly introduced macro.
--- drivers/net/bnxt/bnxt_ethdev.c | 12 +----------- drivers/net/qede/base/bcm_osal.h | 6 ++---- drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 11 ++--------- 3 files changed, 5 insertions(+), 24 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -11
@@ -4867,17 +4867,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)#define bnxt_roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) -#define min_t (type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t (type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) - -#define clamp_t (type, _x, min, max) min_t(type, max_t(type, _x, min), max) +#define clamp_t (type, _x, min, max) RTE_MIN_T(RTE_MAX_T(_x, min, type), max, type)int bnxt_alloc_ctx_mem (struct bnxt *bp) {
drivers/net/qede/base/bcm_osal.h +2 -4
@@ -443,10 +443,8 @@ u32 qede_osal_log2(u32);#define OSAL_IOMEM volatile#define OSAL_UNUSED __rte_unused#define OSAL_UNLIKELY (x) __builtin_expect(!!(x), 0) -#define OSAL_MIN_T (type, __min1, __min2) \ - ((type)(__min1) < (type)(__min2) ? (type)(__min1) : (type)(__min2)) -#define OSAL_MAX_T (type, __max1, __max2) \ - ((type)(__max1) > (type)(__max2) ? (type)(__max1) : (type)(__max2)) +#define OSAL_MIN_T (type, __min1, __min2) RTE_MIN_T(__min1, __min2, type) +#define OSAL_MAX_T (type, __max1, __max2) RTE_MAX_T(__max1, __max2, type)void qede_get_mcp_proto_stats (struct ecore_dev *,enum ecore_mcp_protocol_type ,union ecore_mcp_protocol_stats *);
drivers/raw/ifpga/base/osdep_rte/osdep_generic.h +2 -9
@@ -44,15 +44,8 @@ extern int ifpga_rawdev_logtype;#define min (a, b) RTE_MIN(a, b)#define max (a, b) RTE_MAX(a, b) -#define min_t (type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t (type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) +#define min_t (type, x, y) RTE_MIN_T(x, y, type) +#define max_t (type, x, y) RTE_MAX_T(x, y, type)#define spinlock_t rte_spinlock_t#define spinlock_init (x) rte_spinlock_init(x)
Signature · 1 line
2.43.0
RE: [PATCH v2 2/3] drivers: use common min/max macros
Hi,
Quoted 87 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Friday, February 16, 2024 6:25 PM
To: [email protected]
Cc: Ajit Khaparde <[email protected]>; Somnath Kotur <[email protected]>; Devendra Singh Rawat <[email protected]>; Alok Prasad <[email protected]>; Xu, Rosen <[email protected]>
Subject: [PATCH v2 2/3] drivers: use common min/max macrosUse newly introduced macro.
Signed-off-by David Marchand <[email protected]>--- drivers/net/bnxt/bnxt_ethdev.c | 12 +----------- drivers/net/qede/base/bcm_osal.h | 6 ++---- drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 11 ++--------- 3 files changed, 5 insertions(+), 24 deletions(-)(quoted diff) +0
-0
b/drivers/net/bnxt/bnxt_ethdev.cindex45d840d7af..8cc012206a100644drivers/net/bnxt/bnxt_ethdev.c +2
-11@@ -4867,17 +4867,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)#define bnxt_roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) -#define min_t (type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t (type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) - -#define clamp_t (type, _x, min, max) min_t(type, max_t(type, _x, min), max) +#define clamp_t (type, _x, min, max) RTE_MIN_T(RTE_MAX_T(_x, min, type), +max, type) int bnxt_alloc_ctx_mem(struct bnxt *bp) { diff --git
a/drivers/net/qede/base/bcm_osal.hb/drivers/net/qede/base/bcm_osal.hindex11019b5623..7869103c63100644drivers/net/qede/base/bcm_osal.h +0
-0@@ -443,10 +443,8 @@ u32 qede_osal_log2(u32); #define OSAL_IOMEMvolatile
#defineOSAL_UNUSED__rte_unused
#defineOSAL_UNLIKELY(x)__builtin_expect(!!(x), 0)drivers/net/qede/base/bcm_osal.h +0
-4-#define OSAL_MIN_T (type, __min1, __min2) \ - ((type)(__min1) < (type)(__min2) ? (type)(__min1) : (type)(__min2)) -#define OSAL_MAX_T (type, __max1, __max2) \ - ((type)(__max1) > (type)(__max2) ? (type)(__max1) :(type)(__max2))
drivers/net/qede/base/bcm_osal.h +3
-0+#define OSAL_MIN_T (type, __min1, __min2) RTE_MIN_T(__min1, __min2, +type) #define OSAL_MAX_T(type, __max1, __max2) RTE_MAX_T(__max1, +__max2, type) void qede_get_mcp_proto_stats(struct ecore_dev *, enum
ecore_mcp_protocol_type,
unionecore_mcp_protocol_stats*); diff --gita/drivers/raw/ifpga/base/osdep_rte/osdep_generic.hb/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
index62c5666ca9..427793a578100644drivers/raw/ifpga/base/osdep_rte/osdep_generic.h +2
-10@@ -44,15 +44,8 @@ extern int ifpga_rawdev_logtype; #define min(a, b) RTE_MIN(a, b) #define max(a, b) RTE_MAX(a, b) -#define min_t (type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t (type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) +#define min_t (type, x, y) RTE_MIN_T(x, y, type) #define max_t(type, x, +y) RTE_MAX_T(x, y, type)#define spinlock_t rte_spinlock_t#define spinlock_init (x) rte_spinlock_init(x) --
Quoted 1 line
2.43.0
Re: [PATCH v2 2/3] drivers: use common min/max macros
In reply to David MarchandQuoted 4 lines · David Marchand
Use newly introduced macro.
Signed-off-by David Marchand <[email protected]>
Quoted 71 lines
--- drivers/net/bnxt/bnxt_ethdev.c | 12 +----------- drivers/net/qede/base/bcm_osal.h | 6 ++---- drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 11 ++--------- 3 files changed, 5 insertions(+), 24 deletions(-)drivers/net/bnxt/bnxt_ethdev.c +1
-11@@ -4867,17 +4867,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)#define bnxt_roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) -#define min_t (type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t (type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) - -#define clamp_t (type, _x, min, max) min_t(type, max_t(type, _x, min), max) +#define clamp_t (type, _x, min, max) RTE_MIN_T(RTE_MAX_T(_x, min, type), max, type)int bnxt_alloc_ctx_mem (struct bnxt *bp) {drivers/net/qede/base/bcm_osal.h +2
-4@@ -443,10 +443,8 @@ u32 qede_osal_log2(u32);#define OSAL_IOMEM volatile#define OSAL_UNUSED __rte_unused#define OSAL_UNLIKELY (x) __builtin_expect(!!(x), 0) -#define OSAL_MIN_T (type, __min1, __min2) \ - ((type)(__min1) < (type)(__min2) ? (type)(__min1) : (type)(__min2)) -#define OSAL_MAX_T (type, __max1, __max2) \ - ((type)(__max1) > (type)(__max2) ? (type)(__max1) : (type)(__max2)) +#define OSAL_MIN_T (type, __min1, __min2) RTE_MIN_T(__min1, __min2, type) +#define OSAL_MAX_T (type, __max1, __max2) RTE_MAX_T(__max1, __max2, type)void qede_get_mcp_proto_stats (struct ecore_dev *,enum ecore_mcp_protocol_type ,union ecore_mcp_protocol_stats *);drivers/raw/ifpga/base/osdep_rte/osdep_generic.h +2
-10@@ -44,15 +44,8 @@ extern int ifpga_rawdev_logtype;#define min (a, b) RTE_MIN(a, b)#define max (a, b) RTE_MAX(a, b) -#define min_t (type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t (type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) +#define min_t (type, x, y) RTE_MIN_T(x, y, type) +#define max_t (type, x, y) RTE_MAX_T(x, y, type)#define spinlock_t rte_spinlock_t#define spinlock_init (x) rte_spinlock_init(x) --2.43.0
PATCH v2 3/3 add extension keyword to GCC statement expressions
In reply to David MarchandFrom: Tyler Retzlaff <[email protected]>
Add __extension__ keyword to gcc statement expression extensions.
--- drivers/bus/fslmc/mc/fsl_mc_sys.h | 6 ++-- drivers/common/cnxk/roc_io.h | 6 ++-- drivers/common/cnxk/roc_platform.h | 2 +- drivers/common/dpaax/dpaa_list.h | 2 +- drivers/common/qat/qat_adf/icp_qat_hw.h | 2 +- drivers/crypto/armv8/rte_armv8_pmd.c | 4 +-- drivers/crypto/caam_jr/caam_jr_desc.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.c | 2 +- drivers/event/octeontx/ssovf_evdev.h | 4 +-- drivers/mempool/octeontx/octeontx_fpavf.h | 4 +-- drivers/ml/cnxk/cn10k_ml_dev.h | 4 +-- drivers/net/ena/base/ena_plat_dpdk.h | 14 ++++----- drivers/net/ena/ena_ethdev.c | 30 +++++++++---------- drivers/net/enetfec/enet_ethdev.h | 2 +- drivers/net/fm10k/base/fm10k_osdep.h | 2 +- drivers/net/octeontx/base/octeontx_io.h | 6 ++-- drivers/net/pfe/base/cbus.h | 2 +- drivers/net/pfe/base/pfe.h | 12 ++++---- drivers/net/tap/bpf/bpf_api.h | 2 +- drivers/net/thunderx/base/nicvf_plat.h | 4 +-- drivers/net/txgbe/base/txgbe_osdep.h | 2 +- drivers/raw/ifpga/afu_pmd_core.h | 2 +- drivers/raw/ifpga/base/ifpga_compat.h | 2 +- drivers/raw/ifpga/base/opae_osdep.h | 4 +-- drivers/raw/ifpga/base/opae_spi_transaction.c | 2 +- examples/qos_meter/main.h | 2 +- lib/ethdev/rte_mtr.c | 10 +++---- lib/ethdev/rte_tm.c | 6 ++-- lib/pipeline/rte_pipeline.c | 8 ++--- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- lib/port/rte_port_source_sink.c | 4 +-- 31 files changed, 78 insertions(+), 78 deletions(-)
drivers/bus/fslmc/mc/fsl_mc_sys.h +3 -3
@@ -40,11 +40,11 @@ struct fsl_mc_io {#define __arch_putq (v, a) (*(volatile uint64_t *)(a) = (v))#define __arch_putq32 (v, a) (*(volatile uint32_t *)(a) = (v))#define readq (c) \ - ({ uint64_t __v = __arch_getq(c); __iormb(); __v; }) + __extension__ ({ uint64_t __v = __arch_getq(c); __iormb(); __v; })#define writeq (v, c) \ - ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; }) + __extension__ ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })#define writeq32 (v, c) \ - ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; }) + __extension__ ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })#define ioread64 (_p) readq(_p)#define iowrite64 (_v, _p) writeq(_v, _p)#define iowrite32 (_v, _p) writeq32(_v, _p)
drivers/common/cnxk/roc_io.h +3 -3
@@ -30,21 +30,21 @@#endif #define roc_load_pair (val0, val1, addr) \ - ({ \ + __extension__ ({ \ asm volatile("ldp %x[x0], %x[x1], [%x[p1]]" \ : [x0] "=r"(val0), [x1] "=r"(val1) \ : [p1] "r"(addr)); \ })#define roc_store_pair (val0, val1, addr) \ - ({ \ + __extension__ ({ \ asm volatile( \ "stp %x[x0], %x[x1], [%x[p1], #0]!" ::[x0] "r"(val0), \ [x1] "r"(val1), [p1] "r"(addr)); \ })#define roc_prefetch_store_keep (ptr) \ - ({ asm volatile("prfm pstl1keep, [%x0]\n" : : "r"(ptr)); }) + __extension__ ({ asm volatile("prfm pstl1keep, [%x0]\n" : : "r"(ptr)); })#if defined(__clang__)static __plt_always_inline void
drivers/common/cnxk/roc_platform.h +1 -1
@@ -82,7 +82,7 @@/** Divide ceil */ #define PLT_DIV_CEIL (x, y) \ - ({ \ + __extension__ ({ \ __typeof(x) __x = x; \ __typeof(y) __y = y; \ (__x + __y - 1) / __y; \
drivers/common/dpaax/dpaa_list.h +1 -1
@@ -31,7 +31,7 @@ do { \#define list_entry (node, type, member) \ (type *)((void *)node - offsetof(type, member))#define list_empty (p) \ -({ \ +__extension__ ({ \ const struct list_head *__p298 = (p); \ ((__p298->next == __p298) && (__p298->prev == __p298)); \ })
drivers/common/qat/qat_adf/icp_qat_hw.h +1 -1
@@ -292,7 +292,7 @@ enum icp_qat_hw_cipher_convert {#define QAT_CIPHER_AEAD_AAD_SIZE_BITPOS 16#define QAT_CIPHER_AEAD_AAD_SIZE_LE_BITPOS 0#define ICP_QAT_HW_CIPHER_CONFIG_BUILD_UPPER (aad_size) \ - ({ \ + __extension__ ({ \ typeof(aad_size) aad_size1 = aad_size; \ (((((aad_size1) >> QAT_CIPHER_AEAD_AAD_UPPER_SHIFT) & \ QAT_CIPHER_AEAD_AAD_SIZE_UPPER_MASK) << \
drivers/crypto/armv8/rte_armv8_pmd.c +2 -2
@@ -139,7 +139,7 @@ crypto_chain_order[] = {* Extract particular combined mode crypto function from the 3D array. */ #define CRYPTO_GET_ALGO (order, cop, calg, aalg, keyl) \ -({ \ +__extension__ ({ \ crypto_func_tbl_t *func_tbl = \ (crypto_chain_order[(order)])[(cop)]; \ \
@@ -186,7 +186,7 @@ crypto_key_sched_dir[] = {* Extract particular combined mode crypto function from the 3D array. */ #define CRYPTO_GET_KEY_SCHED (cop, calg, keyl) \ -({ \ +__extension__ ({ \ crypto_key_sched_tbl_t *ks_tbl = crypto_key_sched_dir[(cop)]; \ \ (calg >= CRYPTO_CIPHER_MAX) ? \
drivers/crypto/caam_jr/caam_jr_desc.h +1 -1
@@ -32,7 +32,7 @@/* Macro for setting up a JD. The structure of the JD is common across all * supported protocols, thus its structure is identical. */ -#define SEC_JD_INIT (descriptor) ({ \ +#define SEC_JD_INIT (descriptor) __extension__ ({ \/* CTYPE = job descriptor \ * RSMS, DNR = 0 * ONE = 1
drivers/dma/hisilicon/hisi_dmadev.c +1 -1
@@ -124,7 +124,7 @@ hisi_dma_update_queue_mbit(struct hisi_dma_dev *hw, uint32_t qoff,hisi_dma_write_queue (hw, qoff, tmp); } -#define hisi_dma_poll_hw_state (hw, val, cond, sleep_us, timeout_us) ({ \ +#define hisi_dma_poll_hw_state (hw, val, cond, sleep_us, timeout_us) __extension__ ({ \ uint32_t timeout = 0; \ while (timeout++ <= (timeout_us)) { \ (val) = hisi_dma_read_queue(hw, HISI_DMA_QUEUE_FSM_REG); \
drivers/event/octeontx/ssovf_evdev.h +2 -2
@@ -96,14 +96,14 @@/* ARM64 specific functions */ #if defined(RTE_ARCH_ARM64 ) -#define ssovf_load_pair (val0, val1, addr) ({ \ +#define ssovf_load_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "ldp %x[x0], %x[x1], [%x[p1]]" \ :[x0]"=r"(val0), [x1]"=r"(val1) \ :[p1]"r"(addr) \ ); }) -#define ssovf_store_pair (val0, val1, addr) ({ \ +#define ssovf_store_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "stp %x[x0], %x[x1], [%x[p1]]" \ ::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
drivers/mempool/octeontx/octeontx_fpavf.h +2 -2
@@ -59,14 +59,14 @@/* ARM64 specific functions */ #if defined(RTE_ARCH_ARM64 ) -#define fpavf_load_pair (val0, val1, addr) ({ \ +#define fpavf_load_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "ldp %x[x0], %x[x1], [%x[p1]]" \ :[x0]"=r"(val0), [x1]"=r"(val1) \ :[p1]"r"(addr) \ ); }) -#define fpavf_store_pair (val0, val1, addr) ({ \ +#define fpavf_store_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "stp %x[x0], %x[x1], [%x[p1]]" \ ::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
drivers/ml/cnxk/cn10k_ml_dev.h +2 -2
@@ -44,8 +44,8 @@ extern struct rte_ml_dev_ops ml_dev_dummy_ops;/* Memory barrier macros */ #if defined(RTE_ARCH_ARM ) -#define dmb_st ({ asm volatile("dmb st" : : : "memory"); }) -#define dsb_st ({ asm volatile("dsb st" : : : "memory"); }) +#define dmb_st __extension__ ({ asm volatile("dmb st" : : : "memory"); }) +#define dsb_st __extension__ ({ asm volatile("dsb st" : : : "memory"); })#else #define dmb_st#define dsb_st
drivers/net/ena/base/ena_plat_dpdk.h +7 -7
@@ -141,9 +141,9 @@ extern int ena_logtype_com;#define ena_spinlock_t rte_spinlock_t#define ENA_SPINLOCK_INIT (spinlock) rte_spinlock_init(&(spinlock))#define ENA_SPINLOCK_LOCK (spinlock, flags) \ - ({(void)(flags); rte_spinlock_lock(&(spinlock)); }) + __extension__ ({(void)(flags); rte_spinlock_lock(&(spinlock)); })#define ENA_SPINLOCK_UNLOCK (spinlock, flags) \ - ({(void)(flags); rte_spinlock_unlock(&(spinlock)); }) + __extension__ ({(void)(flags); rte_spinlock_unlock(&(spinlock)); })#define ENA_SPINLOCK_DESTROY (spinlock) ((void)(spinlock)) typedef struct {
@@ -237,7 +237,7 @@ ena_mem_alloc_coherent(struct rte_eth_dev_data *data, size_t size,ENA_MEM_ALLOC_COHERENT_ALIGNED (dmadev, size, virt, phys, \ mem_handle, RTE_CACHE_LINE_SIZE)#define ENA_MEM_FREE_COHERENT (dmadev, size, virt, phys, mem_handle) \ - ({ ENA_TOUCH(size); ENA_TOUCH(phys); ENA_TOUCH(dmadev); \ + __extension__ ({ ENA_TOUCH(size); ENA_TOUCH(phys); ENA_TOUCH(dmadev); \ rte_memzone_free(mem_handle); }) #define ENA_MEM_ALLOC_COHERENT_NODE_ALIGNED( \
@@ -263,16 +263,16 @@ ena_mem_alloc_coherent(struct rte_eth_dev_data *data, size_t size,#define ENA_MEM_ALLOC (dmadev, size) rte_zmalloc(NULL, size, 1)#define ENA_MEM_FREE (dmadev, ptr, size) \ - ({ ENA_TOUCH(dmadev); ENA_TOUCH(size); rte_free(ptr); }) + __extension__ ({ ENA_TOUCH(dmadev); ENA_TOUCH(size); rte_free(ptr); })#define ENA_DB_SYNC (mem_handle) ((void)mem_handle)#define ENA_REG_WRITE32 (bus, value, reg) \ - ({ (void)(bus); rte_write32((value), (reg)); }) + __extension__ ({ (void)(bus); rte_write32((value), (reg)); })#define ENA_REG_WRITE32_RELAXED (bus, value, reg) \ - ({ (void)(bus); rte_write32_relaxed((value), (reg)); }) + __extension__ ({ (void)(bus); rte_write32_relaxed((value), (reg)); })#define ENA_REG_READ32 (bus, reg) \ - ({ (void)(bus); rte_read32_relaxed((reg)); }) + __extension__ ({ (void)(bus); rte_read32_relaxed((reg)); })#define ATOMIC32_INC (i32_ptr) rte_atomic32_inc(i32_ptr)#define ATOMIC32_DEC (i32_ptr) rte_atomic32_dec(i32_ptr)
drivers/net/ena/ena_ethdev.c +15 -15
@@ -459,7 +459,7 @@ mp_msg_init(struct rte_mp_msg *msg, enum ena_mp_req type, int port_id)* calls to the same proxied function under the same lock. */ #define ENA_PROXY (a, f, ...) \ -({ \ +__extension__ ({ \ struct ena_adapter *_a = (a); \ struct timespec ts = { .tv_sec = ENA_MP_REQ_TMO }; \ struct ena_mp_body *req, *rsp; \
@@ -507,13 +507,13 @@ mp_msg_init(struct rte_mp_msg *msg, enum ena_mp_req type, int port_id)*********************************************************************/ ENA_PROXY_DESC(ena_com_get_dev_basic_stats, ENA_MP_DEV_STATS_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(stats); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); if (stats != &adapter->basic_stats)
@@ -522,13 +522,13 @@ ENA_PROXY_DESC(ena_com_get_dev_basic_stats, ENA_MP_DEV_STATS_GET, struct ena_com_dev *ena_dev, struct ena_admin_basic_stats *stats); ENA_PROXY_DESC(ena_com_get_eni_stats, ENA_MP_ENI_STATS_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(stats); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); if (stats != (struct ena_admin_eni_stats *)&adapter->metrics_stats)
@@ -537,12 +537,12 @@ ENA_PROXY_DESC(ena_com_get_eni_stats, ENA_MP_ENI_STATS_GET, struct ena_com_dev *ena_dev, struct ena_admin_eni_stats *stats); ENA_PROXY_DESC(ena_com_set_dev_mtu, ENA_MP_MTU_SET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(ena_dev); req->args.mtu = mtu; }), -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(rsp); ENA_TOUCH(ena_dev);
@@ -551,12 +551,12 @@ ENA_PROXY_DESC(ena_com_set_dev_mtu, ENA_MP_MTU_SET, struct ena_com_dev *ena_dev, int mtu); ENA_PROXY_DESC(ena_com_indirect_table_set, ENA_MP_IND_TBL_SET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); }), -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(rsp); ENA_TOUCH(ena_dev);
@@ -564,13 +564,13 @@ ENA_PROXY_DESC(ena_com_indirect_table_set, ENA_MP_IND_TBL_SET, struct ena_com_dev *ena_dev); ENA_PROXY_DESC(ena_com_indirect_table_get, ENA_MP_IND_TBL_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(ind_tbl); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); if (ind_tbl != adapter->indirect_table)
@@ -580,14 +580,14 @@ ENA_PROXY_DESC(ena_com_indirect_table_get, ENA_MP_IND_TBL_GET, struct ena_com_dev *ena_dev, u32 *ind_tbl); ENA_PROXY_DESC(ena_com_get_customer_metrics, ENA_MP_CUSTOMER_METRICS_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(buf); ENA_TOUCH(buf_size); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); ENA_TOUCH(buf_size);
@@ -597,13 +597,13 @@ ENA_PROXY_DESC(ena_com_get_customer_metrics, ENA_MP_CUSTOMER_METRICS_GET, struct ena_com_dev *ena_dev, char *buf, size_t buf_size); ENA_PROXY_DESC(ena_com_get_ena_srd_info, ENA_MP_SRD_STATS_GET, -({ +__extension__ ({ ENA_TOUCH(adapter); ENA_TOUCH(req); ENA_TOUCH(ena_dev); ENA_TOUCH(info); }), -({ +__extension__ ({ ENA_TOUCH(rsp); ENA_TOUCH(ena_dev); if ((struct ena_stats_srd *)info != &adapter->srd_stats)
drivers/net/enetfec/enet_ethdev.h +1 -1
@@ -42,7 +42,7 @@#define ENETFEC_MAX_Q 1 -#define writel (v, p) ({*(volatile unsigned int *)(p) = (v); }) +#define writel (v, p) __extension__ ({*(volatile unsigned int *)(p) = (v); })#define readl (p) rte_read32(p)struct bufdesc {
drivers/net/fm10k/base/fm10k_osdep.h +1 -1
@@ -102,7 +102,7 @@ typedef uint64_t u64;#endif #ifndef do_div -#define do_div (n, base) ({\ +#define do_div (n, base) __extension__ ({\ (n) = (n) / (base);\ })#endif /* do_div */
drivers/net/octeontx/base/octeontx_io.h +3 -3
@@ -19,17 +19,17 @@/* ARM64 specific functions */ #if defined(RTE_ARCH_ARM64 ) -#define octeontx_prefetch_store_keep (_ptr) ({\ +#define octeontx_prefetch_store_keep (_ptr) __extension__ ({\ asm volatile("prfm pstl1keep, %a0\n" : : "p" (_ptr)); }) -#define octeontx_load_pair (val0, val1, addr) ({ \ +#define octeontx_load_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "ldp %x[x0], %x[x1], [%x[p1]]" \ :[x0]"=r"(val0), [x1]"=r"(val1) \ :[p1]"r"(addr) \ ); }) -#define octeontx_store_pair (val0, val1, addr) ({ \ +#define octeontx_store_pair (val0, val1, addr) __extension__ ({ \ asm volatile( \ "stp %x[x0], %x[x1], [%x[p1]]" \ ::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
drivers/net/pfe/base/cbus.h +1 -1
@@ -36,7 +36,7 @@/* Byte Enables of the Internal memory access. These are interpred in BE */ #define PE_MEM_ACCESS_BYTE_ENABLE (offset, size) \ - ({ typeof(size) size_ = (size); \ + __extension__ ({ typeof(size) size_ = (size); \ (((BIT(size_) - 1) << (4 - (offset) - (size_))) & 0xf) << 24; })#include "cbus/emac_mtip.h"
drivers/net/pfe/base/pfe.h +6 -6
@@ -95,36 +95,36 @@ test_and_set_bit(unsigned long nr, void *addr)#define PMEM_SIZE 0x8000/* TMU has less... */ #define PMEM_END (PMEM_BASE_ADDR + PMEM_SIZE) -#define writel (v, p) ({*(volatile unsigned int *)(p) = (v); }) +#define writel (v, p) __extension__ ({*(volatile unsigned int *)(p) = (v); })#define readl (p) (*(const volatile unsigned int *)(p))/* These check memory ranges from PE point of view/memory map */ #define IS_DMEM (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= DMEM_BASE_ADDR) && \ (((unsigned long)(addr_) + (len)) <= DMEM_END); })#define IS_PMEM (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= PMEM_BASE_ADDR) && \ (((unsigned long)(addr_) + (len)) <= PMEM_END); })#define IS_PE_LMEM (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= \ PE_LMEM_BASE_ADDR) && \ (((unsigned long)(addr_) + \ (len)) <= PE_LMEM_END); })#define IS_PFE_LMEM (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= \ CBUS_VIRT_TO_PFE(LMEM_BASE_ADDR)) && \ (((unsigned long)(addr_) + (len)) <= \ CBUS_VIRT_TO_PFE(LMEM_END)); })#define __IS_PHYS_DDR (addr, len) \ - ({ typeof(addr) addr_ = (addr); \ + __extension__ ({ typeof(addr) addr_ = (addr); \ ((unsigned long)(addr_) >= \ DDR_PHYS_BASE_ADDR) && \ (((unsigned long)(addr_) + (len)) <= \
drivers/net/tap/bpf/bpf_api.h +1 -1
@@ -162,7 +162,7 @@ static void BPF_FUNC(trace_printk, const char *fmt, int fmt_size, ...);#ifndef printt# define printt (fmt, ...) \ - ({ \ + __extension__ ({ \ char ____fmt[] = fmt; \ trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \ })
drivers/net/thunderx/base/nicvf_plat.h +2 -2
@@ -55,11 +55,11 @@/* ARM64 specific functions */ #if defined(RTE_ARCH_ARM64 ) -#define nicvf_prefetch_store_keep (_ptr) ({\ +#define nicvf_prefetch_store_keep (_ptr) __extension__ ({\ asm volatile("prfm pstl1keep, [%x0]\n" : : "r" (_ptr)); }) -#define NICVF_LOAD_PAIR (reg1, reg2, addr) ({ \ +#define NICVF_LOAD_PAIR (reg1, reg2, addr) __extension__ ({ \ asm volatile( \ "ldp %x[x1], %x[x0], [%x[p1]]" \ : [x1]"=r"(reg1), [x0]"=r"(reg2)\
drivers/net/txgbe/base/txgbe_osdep.h +1 -1
@@ -172,7 +172,7 @@ static inline u64 REVERT_BIT_MASK64(u64 mask)/* Check whether an address is broadcast. */ #define TXGBE_IS_BROADCAST (address) \ - ({typeof(address)addr = (address); \ + __extension__ ({typeof(address)addr = (address); \ (((u8 *)(addr))[0] == ((u8)0xff)) && \ (((u8 *)(addr))[1] == ((u8)0xff)); })
drivers/raw/ifpga/afu_pmd_core.h +1 -1
@@ -66,7 +66,7 @@ afu_rawdev_get_priv(const struct rte_rawdev *rawdev)#define MHZ (f) ((f) * 1000000)#define dsm_poll_timeout (addr, val, cond, invl, timeout) \ -({ \ +__extension__ ({ \ uint64_t __wait = 0; \ uint64_t __invl = (invl); \ uint64_t __timeout = (timeout); \
drivers/raw/ifpga/base/ifpga_compat.h +1 -1
@@ -31,7 +31,7 @@* by polling with given interval and timeout. */ #define fpga_wait_register_field (_field, _expect, _reg_addr, _timeout, _invl)\ -({ \ +__extension__ ({ \ int wait = 0; \ int ret = -ETIMEDOUT; \ typeof(_expect) value; \
drivers/raw/ifpga/base/opae_osdep.h +2 -2
@@ -81,7 +81,7 @@ struct uuid {#define opae_memset (a, b, c) memset((a), (b), (c)) #define readx_poll_timeout(op, val, cond, invl, timeout, args...) \ -({ \ +__extension__ ({ \ unsigned long __wait = 0; \ unsigned long __invl = (invl); \ unsigned long __timeout = (timeout); \
@@ -107,7 +107,7 @@ struct uuid { readx_poll_timeout(opae_readb, val, cond, invl, timeout, addr)#define opae_max10_read_poll_timeout (dev, addr, value, cond, invl, timeout) \ -({ \ +__extension__ ({ \ int __ret, __tmp; \ __tmp = readx_poll_timeout(max10_sys_read, __ret, __ret || (cond), \ invl, timeout, (dev), (addr), &(value)); \
drivers/raw/ifpga/base/opae_spi_transaction.c +1 -1
@@ -24,7 +24,7 @@#define SPI_REG_BYTES 4#define INIT_SPI_TRAN_HEADER (trans_type, size, address) \ -({ \ +__extension__ ({ \ header.trans_type = trans_type; \ header.reserve = 0; \ header.size = cpu_to_be16(size); \
examples/qos_meter/main.h +1 -1
@@ -24,7 +24,7 @@ enum policer_action policer_table[RTE_COLORS][RTE_COLORS] =#if APP_MODE ==APP_MODE_FWD #define FUNC_METER (m, p, time, pkt_len, pkt_color) \ -({ \ +__extension__ ({ \ void *mp = m; \ void *pp = p; \ mp = mp; \
lib/ethdev/rte_mtr.c +5 -5
@@ -41,14 +41,14 @@ rte_mtr_ops_get(uint16_t port_id, struct rte_mtr_error *error) }#define RTE_MTR_FUNC (port_id, func) \ -({ \ +__extension__ ({ \ const struct rte_mtr_ops *ops = \ - rte_mtr_ops_get(port_id, error); \ - if (ops == NULL) \ + rte_mtr_ops_get(port_id, error); \ + if (ops == NULL) \ return -rte_errno; \ \ if (ops->func == NULL) \ - return -rte_mtr_error_set(error, \ + return -rte_mtr_error_set(error, \ ENOSYS, \ RTE_MTR_ERROR_TYPE_UNSPECIFIED, \ NULL, \
@@ -58,7 +58,7 @@ rte_mtr_ops_get(uint16_t port_id, struct rte_mtr_error *error) })#define RTE_MTR_HNDL_FUNC (port_id, func) \ -({ \ +__extension__ ({ \ const struct rte_mtr_ops *ops = \ rte_mtr_ops_get(port_id, error); \ if (ops == NULL) \
lib/ethdev/rte_tm.c +3 -3
@@ -40,11 +40,11 @@ rte_tm_ops_get(uint16_t port_id, struct rte_tm_error *error)return ops; } -#define RTE_TM_FUNC (port_id, func) \ -({ \ +#define RTE_TM_FUNC (port_id, func) \ +__extension__ ({ \ const struct rte_tm_ops *ops = \ rte_tm_ops_get(port_id, error); \ - if (ops == NULL) \ + if (ops == NULL) \ return -rte_errno; \ \ if (ops->func == NULL) \
lib/pipeline/rte_pipeline.c +4 -4
@@ -23,16 +23,16 @@ RTE_LOG_REGISTER_DEFAULT(pipeline_logtype, INFO);#ifdef RTE_PIPELINE_STATS_COLLECT #define RTE_PIPELINE_STATS_AH_DROP_WRITE (p, mask) \ - ({ (p)->n_pkts_ah_drop = rte_popcount64(mask); }) + __extension__ ({ (p)->n_pkts_ah_drop = rte_popcount64(mask); })#define RTE_PIPELINE_STATS_AH_DROP_READ (p, counter) \ - ({ (counter) += (p)->n_pkts_ah_drop; (p)->n_pkts_ah_drop = 0; }) + __extension__ ({ (counter) += (p)->n_pkts_ah_drop; (p)->n_pkts_ah_drop = 0; })#define RTE_PIPELINE_STATS_TABLE_DROP0 (p) \ - ({ (p)->pkts_drop_mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; }) + __extension__ ({ (p)->pkts_drop_mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; })#define RTE_PIPELINE_STATS_TABLE_DROP1 (p, counter) \ -({ \ +__extension__ ({ \ uint64_t mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; \ mask ^= (p)->pkts_drop_mask; \ (counter) += rte_popcount64(mask); \
lib/pipeline/rte_swx_pipeline_internal.h +1 -1
@@ -1485,7 +1485,7 @@ instr_operand_nbo(struct thread *t, const struct instr_operand *x)#endif #define METADATA_READ (thread, offset, n_bits) \ -({ \ +__extension__ ({ \ uint64_t *m64_ptr = (uint64_t *)&(thread)->metadata[offset]; \ uint64_t m64 = *m64_ptr; \ uint64_t m64_mask = UINT64_MAX >> (64 - (n_bits)); \
lib/port/rte_port_source_sink.c +2 -2
@@ -178,7 +178,7 @@ pcap_source_load(struct rte_port_source *port,#else /* RTE_PORT_PCAP */ #define PCAP_SOURCE_LOAD (port, file_name, n_bytes, socket_id) \ -({ \ +__extension__ ({ \ int _ret = 0; \ \ if (file_name) { \
@@ -431,7 +431,7 @@ do { \#else #define PCAP_SINK_OPEN (port, file_name, max_n_pkts) \ -({ \ +__extension__ ({ \ int _ret = 0; \ \ if (file_name) { \
Signature · 1 line
2.43.0
Re: [PATCH v2 3/3] add extension keyword to GCC statement expressions
For drivers/dma/hisilicon/hisi_dmadev.c part,
Quoted 40 lines · David Marchand
From: Tyler Retzlaff <[email protected]>
Add
__extension__keyword to gcc statement expression extensions.Signed-off-by Tyler Retzlaff <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- drivers/bus/fslmc/mc/fsl_mc_sys.h | 6 ++-- drivers/common/cnxk/roc_io.h | 6 ++-- drivers/common/cnxk/roc_platform.h | 2 +- drivers/common/dpaax/dpaa_list.h | 2 +- drivers/common/qat/qat_adf/icp_qat_hw.h | 2 +- drivers/crypto/armv8/rte_armv8_pmd.c | 4 +-- drivers/crypto/caam_jr/caam_jr_desc.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.c | 2 +- drivers/event/octeontx/ssovf_evdev.h | 4 +-- drivers/mempool/octeontx/octeontx_fpavf.h | 4 +-- drivers/ml/cnxk/cn10k_ml_dev.h | 4 +-- drivers/net/ena/base/ena_plat_dpdk.h | 14 ++++----- drivers/net/ena/ena_ethdev.c | 30 +++++++++---------- drivers/net/enetfec/enet_ethdev.h | 2 +- drivers/net/fm10k/base/fm10k_osdep.h | 2 +- drivers/net/octeontx/base/octeontx_io.h | 6 ++-- drivers/net/pfe/base/cbus.h | 2 +- drivers/net/pfe/base/pfe.h | 12 ++++---- drivers/net/tap/bpf/bpf_api.h | 2 +- drivers/net/thunderx/base/nicvf_plat.h | 4 +-- drivers/net/txgbe/base/txgbe_osdep.h | 2 +- drivers/raw/ifpga/afu_pmd_core.h | 2 +- drivers/raw/ifpga/base/ifpga_compat.h | 2 +- drivers/raw/ifpga/base/opae_osdep.h | 4 +-- drivers/raw/ifpga/base/opae_spi_transaction.c | 2 +- examples/qos_meter/main.h | 2 +- lib/ethdev/rte_mtr.c | 10 +++---- lib/ethdev/rte_tm.c | 6 ++-- lib/pipeline/rte_pipeline.c | 8 ++--- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- lib/port/rte_port_source_sink.c | 4 +-- 31 files changed, 78 insertions(+), 78 deletions(-)
...
Quoted 10 lines · David Marchand
Tyler explained in v1:
"""
As requested from previous rejected series this series applies the__extension__keyword to all statement expressionsin DPDK. """Changes since v1:
- rebased,
- added two cleanups before Tyler patch,
Series applied, thanks.
Signature · 1 line
David Marchand