[PATCH v2 1/6] net/iavf: fix compilation with VLAN insertion disabled
Stephen Hemminger
stephen at networkplumber.org
Wed Nov 5 20:31:01 CET 2025
On Wed, 5 Nov 2025 15:26:37 +0000
Ciara Loftus <ciara.loftus at intel.com> wrote:
> static __rte_always_inline void
> iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
> - uint64_t *txd_hi, uint8_t vlan_flag)
> + uint64_t *txd_hi,
> +#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
> + uint8_t vlan_flag)
> +#else
> + __rte_unused uint8_t vlan_flag)
> +#endif
This is not the best way to do this. Adding #ifdef there can confuse
static parsers etc. You can use RTE_SET_USED() macro instead.
The ifdef could be rearranged for clarity as well.
diff --git a/drivers/net/intel/iavf/iavf_rxtx_vec_common.h b/drivers/net/intel/iavf/iavf_rxtx_vec_common.h
index f513777663..dbe7d2b2da 100644
--- a/drivers/net/intel/iavf/iavf_rxtx_vec_common.h
+++ b/drivers/net/intel/iavf/iavf_rxtx_vec_common.h
@@ -166,15 +166,14 @@ static __rte_always_inline void
iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
uint64_t *txd_hi, uint8_t vlan_flag)
{
+ uint32_t td_cmd = 0;
#if defined(IAVF_TX_CSUM_OFFLOAD) || defined(IAVF_TX_VLAN_QINQ_OFFLOAD)
uint64_t ol_flags = tx_pkt->ol_flags;
#endif
- uint32_t td_cmd = 0;
+
#ifdef IAVF_TX_CSUM_OFFLOAD
uint32_t td_offset = 0;
-#endif
-#ifdef IAVF_TX_CSUM_OFFLOAD
/* Set MACLEN */
if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
td_offset |= (tx_pkt->outer_l2_len >> 1)
@@ -240,6 +239,8 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
*txd_hi |= ((uint64_t)tx_pkt->vlan_tci_outer <<
IAVF_TXD_QW1_L2TAG1_SHIFT);
}
+#else
+ RTE_SET_USED(vlan_flag);
#endif
*txd_hi |= ((uint64_t)td_cmd) << IAVF_TXD_QW1_CMD_SHIFT;
More information about the dev
mailing list