VLAN and QinQ fixes for iavf
cover VLAN and QinQ fixes for iavf
This patchset contains a number of small fixes for iavf VLAN tag handling. Most issues were discovered by AI code review rather than being found in testing.
Bruce Richardson (7):
net/iavf: disable broken QinQ strip on Rx net/iavf: fix VLAN tag placement logic
net/iavf: fix VLAN outer TPID setting on Tx net/intel: fix unclear enum names
net/intel: fix VLAN and QinQ tag position logic net/iavf: fix missing outer QinQ tag for tunnelled packets net/iavf: remove undocumented conditional macros
drivers/net/intel/common/tx.h | 14 ++--- drivers/net/intel/common/tx_scalar.h | 16 ++++-- drivers/net/intel/i40e/i40e_rxtx.c | 6 +- drivers/net/intel/iavf/iavf_ethdev.c | 12 ++-- drivers/net/intel/iavf/iavf_rxtx.c | 56 +++++++++---------- drivers/net/intel/iavf/iavf_rxtx.h | 4 +- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 12 ++-- drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 12 ++-- drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------ drivers/net/intel/ice/ice_rxtx.c | 6 +- drivers/net/intel/idpf/idpf_common_rxtx.c | 3 +- 11 files changed, 74 insertions(+), 85 deletions(-)
--
2.53.0
PATCH 1/7 net/iavf: disable broken QinQ strip on Rx
When 2 VLANs are stripped from a packet, the iavf driver vector path fails to handle them properly as it 'or's the two values together on the assumption that only one is valid. Explicitly list the VLAN related features supported by the vector path, rather than using the "OFFLOAD_VLAN" group, thereby disabling advertising of QinQ stripping so that a scalar path is used.
--- drivers/net/intel/iavf/iavf_rxtx.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/intel/iavf/iavf_rxtx.h +3 -1
@@ -105,7 +105,9 @@IAVF_RX_VECTOR_OFFLOADS | \RTE_ETH_RX_OFFLOAD_CHECKSUM | \RTE_ETH_RX_OFFLOAD_SCTP_CKSUM | \ - RTE_ETH_RX_OFFLOAD_VLAN | \ +RTE_ETH_RX_OFFLOAD_VLAN_STRIP | \ +RTE_ETH_RX_OFFLOAD_VLAN_FILTER | \ +RTE_ETH_RX_OFFLOAD_VLAN_EXTEND | \ RTE_ETH_RX_OFFLOAD_RSS_HASH) /* vector offload paths that use the flex rx desc */ #define IAVF_RX_VECTOR_OFFLOAD_FLEX_OFFLOADS ( \
--
2.53.0
RE: [PATCH 1/7] net/iavf: disable broken QinQ strip on Rx
Quoted 9 lines
Subject: [PATCH 1/7] net/iavf: disable broken QinQ strip on Rx
When 2 VLANs are stripped from a packet, the iavf driver vector path fails to handle them properly as it 'or's the two values together on the assumption that only one is valid. Explicitly list the VLAN related features supported by the vector path, rather than using the "
OFFLOAD_VLAN" group, thereby disabling advertising of QinQ stripping so that a scalar path is used.
Quoted 4 lines
Fixes 1e728b01120c ("net/iavf: rework Tx path")Signed-off-by Bruce Richardson <[email protected]>
Quoted 22 lines
--- drivers/net/intel/iavf/iavf_rxtx.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/intel/iavf/iavf_rxtx.h +3
-2@@ -105,7 +105,9 @@IAVF_RX_VECTOR_OFFLOADS | \RTE_ETH_RX_OFFLOAD_CHECKSUM | \RTE_ETH_RX_OFFLOAD_SCTP_CKSUM | \ - RTE_ETH_RX_OFFLOAD_VLAN | \ +RTE_ETH_RX_OFFLOAD_VLAN_STRIP | \ +RTE_ETH_RX_OFFLOAD_VLAN_FILTER | \ +RTE_ETH_RX_OFFLOAD_VLAN_EXTEND | \ RTE_ETH_RX_OFFLOAD_RSS_HASH) /* vector offload paths that use the flex rx desc */ #define IAVF_RX_VECTOR_OFFLOAD_FLEX_OFFLOADS ( \ --2.53.0
PATCH 2/7 net/iavf: fix VLAN tag placement logic
In reply to Bruce RichardsonDepending on what is reported by the PF to the VF the VLAN tag or VLAN + QinQ tags can be in either the L2Tag1 or the L2Tag2 fields. This needs to be taken into account when reading the vlan tags from the flex descriptors, rather than assuming that the tag is always present in a fixed location.
--- drivers/net/intel/iavf/iavf_rxtx.c | 49 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +24 -25
@@ -1151,33 +1151,32 @@ iavf_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ci_rx_desc *rxdp)static inline void iavf_flex_rxd_to_vlan_tci (struct rte_mbuf *mb, -volatile union ci_rx_flex_desc *rxdp) +volatile union ci_rx_flex_desc *rxdp, +uint8_t rx_flags) { -if (rte_le_to_cpu_64 (rxdp->wb.status_error0) & - (1 <<IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S )) { - mb->ol_flags |=RTE_MBUF_F_RX_VLAN | -RTE_MBUF_F_RX_VLAN_STRIPPED ; - mb->vlan_tci = -rte_le_to_cpu_16 (rxdp->wb.l2tag1); - }else { - mb->vlan_tci =0 ; - } - -if (rte_le_to_cpu_16 (rxdp->wb.status_error1) & - (1 <<IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S )) { -if ((mb->ol_flags &RTE_MBUF_F_RX_VLAN_STRIPPED ) ==0 ) { - mb->ol_flags |=RTE_MBUF_F_RX_VLAN |RTE_MBUF_F_RX_VLAN_STRIPPED ; +bool l2tag1_valid =rte_le_to_cpu_16 (rxdp->wb.status_error0) & + (1 <<IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S ); +bool l2tag2_valid =rte_le_to_cpu_16 (rxdp->wb.status_error1) & + (1 <<IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S ); +if (l2tag1_valid && l2tag2_valid) { + mb->ol_flags |=RTE_MBUF_F_RX_VLAN |RTE_MBUF_F_RX_VLAN_STRIPPED | +RTE_MBUF_F_RX_QINQ |RTE_MBUF_F_RX_QINQ_STRIPPED ; +/* with both tags, the rx_flags say which is outer vs inner */ +if (rx_flags &IAVF_RX_FLAGS_VLAN_TAG_LOC_L2TAG2_2 ) { + mb->vlan_tci_outer =rte_le_to_cpu_16 (rxdp->wb.l2tag2_2nd); + mb->vlan_tci =rte_le_to_cpu_16 (rxdp->wb.l2tag1); }else { -/* if two tags, move Tag1 to outer tag field */ - mb->ol_flags |=RTE_MBUF_F_RX_QINQ_STRIPPED |RTE_MBUF_F_RX_QINQ ; - mb->vlan_tci_outer = mb->vlan_tci; + mb->vlan_tci_outer =rte_le_to_cpu_16 (rxdp->wb.l2tag1); + mb->vlan_tci =rte_le_to_cpu_16 (rxdp->wb.l2tag2_2nd); } - mb->vlan_tci =rte_le_to_cpu_16 (rxdp->wb.l2tag2_2nd); -PMD_RX_LOG (DEBUG ,"Descriptor l2tag2_1: %u, l2tag2_2: %u" , -rte_le_to_cpu_16 (rxdp->wb.l2tag2_1st), -rte_le_to_cpu_16 (rxdp->wb.l2tag2_2nd)); + }else if (l2tag1_valid || l2tag2_valid) { + mb->ol_flags |=RTE_MBUF_F_RX_VLAN |RTE_MBUF_F_RX_VLAN_STRIPPED ; + mb->vlan_tci_outer =0 ; + mb->vlan_tci =rte_le_to_cpu_16 ( + l2tag1_valid ? rxdp->wb.l2tag1 : rxdp->wb.l2tag2_2nd); }else { mb->vlan_tci_outer =0 ; + mb->vlan_tci =0 ; } }
@@ -1564,7 +1563,7 @@ iavf_recv_pkts_flex_rxd(void *rx_queue, rxm->ol_flags =0 ; rxm->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)]; -iavf_flex_rxd_to_vlan_tci (rxm, &rxd); +iavf_flex_rxd_to_vlan_tci (rxm, &rxd, rxq->rx_flags);iavf_flex_rxd_to_ipsec_crypto_status (rxm, &rxd, &rxq->stats->ipsec_crypto); rxd_to_pkt_fields_ops[rxq->rxdid](rxq, rxm, &rxd);
@@ -1731,7 +1730,7 @@ iavf_recv_scattered_pkts_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts, first_seg->ol_flags =0 ; first_seg->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)]; -iavf_flex_rxd_to_vlan_tci (first_seg, &rxd); +iavf_flex_rxd_to_vlan_tci (first_seg, &rxd, rxq->rx_flags);iavf_flex_rxd_to_ipsec_crypto_status (first_seg, &rxd, &rxq->stats->ipsec_crypto); rxd_to_pkt_fields_ops[rxq->rxdid](rxq, first_seg, &rxd);
@@ -2013,7 +2012,7 @@ iavf_rx_scan_hw_ring_flex_rxd(struct ci_rx_queue *rxq, mb->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxdp[j].wb.ptype_flex_flags0)]; -iavf_flex_rxd_to_vlan_tci (mb, &rxdp[j]); +iavf_flex_rxd_to_vlan_tci (mb, &rxdp[j], rxq->rx_flags);iavf_flex_rxd_to_ipsec_crypto_status (mb, &rxdp[j], &rxq->stats->ipsec_crypto); rxd_to_pkt_fields_ops[rxq->rxdid](rxq, mb, &rxdp[j]);
--
2.53.0
RE: [PATCH 2/7] net/iavf: fix VLAN tag placement logic
Quoted 8 lines
Subject: [PATCH 2/7] net/iavf: fix VLAN tag placement logic
Depending on what is reported by the PF to the VF the VLAN tag or VLAN + QinQ tags can be in either the L2Tag1 or the L2Tag2 fields. This needs to be taken into account when reading the vlan tags from the flex descriptors, rather than assuming that the tag is always present in a fixed location.
Quoted 4 lines
Fixes 1e728b01120c ("net/iavf: rework Tx path")Signed-off-by Bruce Richardson <[email protected]>
Quoted 12 lines
--- drivers/net/intel/iavf/iavf_rxtx.c | 49 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 25 deletions(-)drivers/net/intel/iavf/iavf_rxtx.c +0
-0@@ -1151,33 +1151,32 @@ iavf_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ci_rx_desc *rxdp)
PATCH 3/7 net/iavf: fix VLAN outer TPID setting on Tx
In reply to Bruce RichardsonThe outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.
--- drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +8 -4
@@ -1461,13 +1461,17 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type, uint16return -ENOTSUP ; } -/* This API only fills internal iavf_adapter structure -* and does not send any signal to hardware. -* Inner VLAN always 0x8100, so not set explicitly. -*/ +/* Inner VLAN always 0x8100, so not set explicitly. */ if (qinq && vlan_type ==RTE_ETH_VLAN_TYPE_OUTER ) adapter->tpid = tpid;/* Outer VLAN can be 0x88a8 or 0x8100 */ +/* Re-push insertion, and stripping if already enabled, so the new +* outer TPID reaches the PF instead of only being cached here. +*/ +iavf_dev_vlan_insert_set (dev); +if (dev_conf->rxmode.offloads &RTE_ETH_RX_OFFLOAD_QINQ_STRIP ) +iavf_dev_vlan_offload_set (dev,RTE_ETH_QINQ_STRIP_MASK ); +return 0 ; }
Signature · 1 line
2.53.0
RE: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx
Quoted 41 lines
Subject: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx
The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.
Fixes 8599d7604e0a ("net/iavf: support QinQ strip")Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/net/intel/iavf/iavf_ethdev.c +0
-0@@ -1461,13 +1461,17 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev,enum
rte_vlan_typevlan_type, uint16drivers/net/intel/iavf/iavf_ethdev.c +1
-4return -ENOTSUP ; } -/* This API only fills internal iavf_adapter structure -* and does not send any signal to hardware. -* Inner VLAN always 0x8100, so not set explicitly. -*/ +/* Inner VLAN always 0x8100, so not set explicitly. */ if (qinq && vlan_type ==RTE_ETH_VLAN_TYPE_OUTER ) adapter->tpid = tpid;/* Outer VLAN can be 0x88a8 or 0x8100 */
drivers/net/intel/iavf/iavf_ethdev.c +5
-0+/* Re-push insertion, and stripping if already enabled, so the new +* outer TPID reaches the PF instead of only being cached here. +*/ +iavf_dev_vlan_insert_set (dev); + if (dev_conf->rxmode.offloads &
RTE_ETH_RX_OFFLOAD_QINQ_STRIP)drivers/net/intel/iavf/iavf_ethdev.c +1
-0+ iavf_dev_vlan_offload_set(dev,
Quoted 1 line
RTE_ETH_QINQ_STRIP_MASK);
Should we check the return value of this call and fail if an error is reported?
Quoted 6 lines
drivers/net/intel/iavf/iavf_ethdev.c +1
-1+return 0 ; } --2.53.0
Re: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx
Quoted 34 lines · Ciara
Quoted 34 lines
Subject: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx
The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.
Fixes 8599d7604e0a ("net/iavf: support QinQ strip")Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/net/intel/iavf/iavf_ethdev.c +0
-0@@ -1461,13 +1461,17 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev,enum
rte_vlan_typevlan_type, uint16drivers/net/intel/iavf/iavf_ethdev.c +1
-4return -ENOTSUP ; } -/* This API only fills internal iavf_adapter structure -* and does not send any signal to hardware. -* Inner VLAN always 0x8100, so not set explicitly. -*/ +/* Inner VLAN always 0x8100, so not set explicitly. */ if (qinq && vlan_type ==RTE_ETH_VLAN_TYPE_OUTER ) adapter->tpid = tpid;/* Outer VLAN can be 0x88a8 or 0x8100 */
Quoted 11 lines
Quoted 8 lines
drivers/net/intel/iavf/iavf_ethdev.c +5
-0+/* Re-push insertion, and stripping if already enabled, so the new +* outer TPID reaches the PF instead of only being cached here. +*/ +iavf_dev_vlan_insert_set (dev); + if (dev_conf->rxmode.offloads &
RTE_ETH_RX_OFFLOAD_QINQ_STRIP)drivers/net/intel/iavf/iavf_ethdev.c +1
-0+ iavf_dev_vlan_offload_set(dev,
RTE_ETH_QINQ_STRIP_MASK);Should we check the return value of this call and fail if an error is reported?
Probably yes, will do in next revision.
/Bruce
Loftus, Ciara
Acked-byRE: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx
Quoted 48 lines
Subject: Re: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx
Quoted 34 lines · Ciara
Quoted 34 lines
Subject: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx
The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.
Fixes 8599d7604e0a ("net/iavf: support QinQ strip")Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/net/intel/iavf/iavf_ethdev.c +0
-0@@ -1461,13 +1461,17 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev,enum
rte_vlan_typevlan_type, uint16drivers/net/intel/iavf/iavf_ethdev.c +1
-4return -ENOTSUP ; } -/* This API only fills internal iavf_adapter structure -* and does not send any signal to hardware. -* Inner VLAN always 0x8100, so not set explicitly. -*/ +/* Inner VLAN always 0x8100, so not set explicitly. */ if (qinq && vlan_type ==RTE_ETH_VLAN_TYPE_OUTER ) adapter->tpid = tpid;/* Outer VLAN can be 0x88a8 or 0x8100 */
Quoted 11 lines
Quoted 8 lines
drivers/net/intel/iavf/iavf_ethdev.c +5
-0+/* Re-push insertion, and stripping if already enabled, so the new +* outer TPID reaches the PF instead of only being cached here. +*/ +iavf_dev_vlan_insert_set (dev); + if (dev_conf->rxmode.offloads &
RTE_ETH_RX_OFFLOAD_QINQ_STRIP)drivers/net/intel/iavf/iavf_ethdev.c +1
-0+ iavf_dev_vlan_offload_set(dev,
RTE_ETH_QINQ_STRIP_MASK);Should we check the return value of this call and fail if an error is reported?
Quoted 1 line
Probably yes, will do in next revision.
For some reason this patch in the v2 series didn't land in my inbox. I reviewed it on patchwork and it looks good to me. Consider this my Ack for that patch:
Quoted 2 lines
/Bruce
PATCH 4/7 net/intel: fix unclear enum names
In reply to Bruce RichardsonThe enum for VLAN tag placement was badly named, and it's purpose as described in the comments was unclear. Update the names to be clearer, and more general for future uses and remove the incorrect comments.
--- drivers/net/intel/common/tx.h | 14 ++++++-------- drivers/net/intel/common/tx_scalar.h | 6 +++--- drivers/net/intel/i40e/i40e_rxtx.c | 2 +- drivers/net/intel/iavf/iavf_rxtx.c | 2 +- drivers/net/intel/ice/ice_rxtx.c | 5 +++-- drivers/net/intel/idpf/idpf_common_rxtx.c | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-)
drivers/net/intel/common/tx.h +6 -8
@@ -46,20 +46,18 @@#define CI_TX_CTX_DESC_IL2TAG2 0x04/** -* L2TAG1 Field Source Selection -* Specifies which mbuf VLAN field to use for the L2TAG1 field in data descriptors. -* Context descriptor VLAN handling (L2TAG2) is managed by driver-specific callbacks. +* Enum to specify where a VLAN tag is to be placed for packet Tx. */ -enum ci_tx_l2tag1_field { -/** For VLAN (not QinQ), use L2Tag1 field in data desc */ -CI_VLAN_IN_L2TAG1 , +enum ci_l2tag_pos { +/** Insert via the data descriptor's L2Tag1 field. */ +CI_TAG_IN_DATA_DESC , -/** For VLAN (not QinQ), use L2Tag2 field in ctx desc. +/** Insert via the context descriptor's L2Tag2 field. * NOTE: When set, drivers must set the VLAN tag in the context * descriptor callback function, rather than relying on the * common Tx code to insert it. */ -CI_VLAN_IN_L2TAG2 , +CI_TAG_IN_CTX_DESC , };/* Common TX Descriptor Length Field Shifts */
drivers/net/intel/common/tx_scalar.h +3 -3
@@ -372,7 +372,7 @@ static inline uint16_t ci_xmit_pkts(struct ci_tx_queue *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts, - enum ci_tx_l2tag1_field l2tag1_field, + enum ci_l2tag_pos l2tag_pos, ci_get_ctx_desc_fn get_ctx_desc, const struct ci_ipsec_ops *ipsec_ops, const struct ci_timestamp_queue_fns *ts_fns)
@@ -480,10 +480,10 @@ ci_xmit_pkts(struct ci_tx_queue *txq, }/* Descriptor based VLAN/QinQ insertion */ -/* for single vlan offload, only insert in data desc with VLAN_IN_L2TAG1 is set +/* for single vlan offload, only insert in data desc when CI_TAG_IN_DATA_DESC is set * for qinq offload, we always put inner tag in L2Tag1 */ -if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && l2tag1_field ==CI_VLAN_IN_L2TAG1 ) || +if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && l2tag_pos ==CI_TAG_IN_DATA_DESC ) || (ol_flags &RTE_MBUF_F_TX_QINQ )) { td_cmd |=CI_TX_DESC_CMD_IL2TAG1 ; td_tag = tx_pkt->vlan_tci;
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
@@ -1007,7 +1007,7 @@ uint16_t i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {/* i40e does not support IPsec or timestamp queues, so pass NULL for both */ -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , get_context_desc,NULL ,NULL ); }
drivers/net/intel/iavf/iavf_rxtx.c +1 -1
@@ -2605,7 +2605,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)/* IAVF does not support timestamp queues, so pass NULL for ts_fns */ return ci_xmit_pkts (txq, tx_pkts, nb_pkts, (txq->vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) ? -CI_VLAN_IN_L2TAG1 :CI_VLAN_IN_L2TAG2 , +CI_TAG_IN_DATA_DESC :CI_TAG_IN_CTX_DESC , iavf_get_context_desc, &ipsec_ops,NULL ); }
drivers/net/intel/ice/ice_rxtx.c +3 -2
@@ -3125,10 +3125,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;if (txq->tsq !=NULL && txq->tsq->ts_flag >0 ) -return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , get_context_desc,NULL , &ts_fns); -return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , get_context_desc,NULL ,NULL ); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , + get_context_desc,NULL ,NULL ); } static int
drivers/net/intel/idpf/idpf_common_rxtx.c +1 -1
@@ -1415,7 +1415,7 @@ uint16_t idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , idpf_get_context_desc,NULL ,NULL ); }
--
2.53.0
RE: [PATCH 4/7] net/intel: fix unclear enum names
Quoted 10 lines
Subject: [PATCH 4/7] net/intel: fix unclear enum names
The enum for VLAN tag placement was badly named, and it's purpose as described in the comments was unclear. Update the names to be clearer, and more general for future uses and remove the incorrect comments.
Fixes 6ea6d67bebfe ("net/intel: support configurable VLAN insertion on Tx")Signed-off-by Bruce Richardson <[email protected]>
Quoted 9 lines
--- drivers/net/intel/common/tx.h | 14 ++++++-------- drivers/net/intel/common/tx_scalar.h | 6 +++--- drivers/net/intel/i40e/i40e_rxtx.c | 2 +- drivers/net/intel/iavf/iavf_rxtx.c | 2 +- drivers/net/intel/ice/ice_rxtx.c | 5 +++-- drivers/net/intel/idpf/idpf_common_rxtx.c | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-)
PATCH 5/7 net/intel: fix VLAN and QinQ tag position logic
In reply to Bruce RichardsonThe position of a single vlan tag on a Tx packet (data desc or ctx desc) is independent across drivers from that of where the outer QinQ tag gets put. Therefore, these should be passed as separate values to the common scalar Tx function. For i40e, ice and idpf, the single tag can be put in the data descriptor, and for QinQ, the context descriptor contains the outer tag. For iavf, the tag positions depend on the capabilities reported by the PF to the VF, but the position for the single vlan tag and the outer QinQ tags are the same.
--- drivers/net/intel/common/tx_scalar.h | 16 +++++++++++----- drivers/net/intel/i40e/i40e_rxtx.c | 6 ++++-- drivers/net/intel/iavf/iavf_rxtx.c | 7 ++++--- drivers/net/intel/ice/ice_rxtx.c | 5 +++-- drivers/net/intel/idpf/idpf_common_rxtx.c | 3 ++- 5 files changed, 24 insertions(+), 13 deletions(-)
drivers/net/intel/common/tx_scalar.h +11 -5
@@ -372,7 +372,8 @@ static inline uint16_t ci_xmit_pkts(struct ci_tx_queue *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts, - enum ci_l2tag_pos l2tag_pos, + enum ci_l2tag_pos single_vlan_pos, + enum ci_l2tag_pos qinq_outer_pos, ci_get_ctx_desc_fn get_ctx_desc, const struct ci_ipsec_ops *ipsec_ops, const struct ci_timestamp_queue_fns *ts_fns)
@@ -480,13 +481,18 @@ ci_xmit_pkts(struct ci_tx_queue *txq, }/* Descriptor based VLAN/QinQ insertion */ -/* for single vlan offload, only insert in data desc when CI_TAG_IN_DATA_DESC is set -* for qinq offload, we always put inner tag in L2Tag1 +/* for single vlan offload, only insert in data desc when single_vlan_pos is +* CI_TAG_IN_DATA_DESC; for qinq offload, L2Tag1 always carries a tag, either +* the outer (qinq_outer_pos == CI_TAG_IN_DATA_DESC) or otherwise the inner */ -if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && l2tag_pos ==CI_TAG_IN_DATA_DESC ) || +if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && single_vlan_pos ==CI_TAG_IN_DATA_DESC ) || (ol_flags &RTE_MBUF_F_TX_QINQ )) { td_cmd |=CI_TX_DESC_CMD_IL2TAG1 ; - td_tag = tx_pkt->vlan_tci; +if ((ol_flags &RTE_MBUF_F_TX_QINQ ) && + qinq_outer_pos ==CI_TAG_IN_DATA_DESC ) + td_tag = tx_pkt->vlan_tci_outer; +else + td_tag = tx_pkt->vlan_tci; }/* Enable checksum offloading */
drivers/net/intel/i40e/i40e_rxtx.c +4 -2
@@ -1006,8 +1006,10 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,uint16_t i40e_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) { -/* i40e does not support IPsec or timestamp queues, so pass NULL for both */ -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , +/* i40e does not support IPsec or timestamp queues, so pass NULL for both. +* QinQ always places the outer tag in the ctx desc, inner in the data desc. +*/ +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC ,CI_TAG_IN_CTX_DESC , get_context_desc,NULL ,NULL ); }
drivers/net/intel/iavf/iavf_rxtx.c +4 -3
@@ -2596,6 +2596,9 @@ uint16_t iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {struct ci_tx_queue *txq = tx_queue; +/* vlan_flag gives both the single-VLAN and the QinQ outer tag position */ +enum ci_l2tag_pos vlan_pos = (txq->vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) ? +CI_TAG_IN_DATA_DESC :CI_TAG_IN_CTX_DESC ;const struct ci_ipsec_ops ipsec_ops = { .get_ipsec_desc = iavf_get_ipsec_desc,
@@ -2603,9 +2606,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) };/* IAVF does not support timestamp queues, so pass NULL for ts_fns */ -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, - (txq->vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) ? -CI_TAG_IN_DATA_DESC :CI_TAG_IN_CTX_DESC , +return ci_xmit_pkts (txq, tx_pkts, nb_pkts, vlan_pos, vlan_pos, iavf_get_context_desc, &ipsec_ops,NULL ); }
drivers/net/intel/ice/ice_rxtx.c +3 -2
@@ -3125,10 +3125,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;if (txq->tsq !=NULL && txq->tsq->ts_flag >0 ) -return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC ,CI_TAG_IN_CTX_DESC , get_context_desc,NULL , &ts_fns); -return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , +/* QinQ always places the outer tag in the ctx desc, inner in the data desc. */ +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC ,CI_TAG_IN_CTX_DESC , get_context_desc,NULL ,NULL ); }
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -1
@@ -1415,7 +1415,8 @@ uint16_t idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , +/* QinQ always places the outer tag in the ctx desc, inner in the data desc. */ +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC ,CI_TAG_IN_CTX_DESC , idpf_get_context_desc,NULL ,NULL ); }
--
2.53.0
RE: [PATCH 5/7] net/intel: fix VLAN and QinQ tag position logic
Quoted 11 lines
Subject: [PATCH 5/7] net/intel: fix VLAN and QinQ tag position logic
The position of a single vlan tag on a Tx packet (data desc or ctx desc) is independent across drivers from that of where the outer QinQ tag gets put. Therefore, these should be passed as separate values to the common scalar Tx function. For i40e, ice and idpf, the single tag can be put in the data descriptor, and for QinQ, the context descriptor contains the outer tag. For iavf, the tag positions depend on the capabilities reported by the PF to the VF, but the position for the single vlan tag and the outer QinQ tags are the same.
Quoted 4 lines
Fixes 6ea6d67bebfe ("net/intel: support configurable VLAN insertion on Tx")Signed-off-by Bruce Richardson <[email protected]>
Quoted 8 lines
--- drivers/net/intel/common/tx_scalar.h | 16 +++++++++++----- drivers/net/intel/i40e/i40e_rxtx.c | 6 ++++-- drivers/net/intel/iavf/iavf_rxtx.c | 7 ++++--- drivers/net/intel/ice/ice_rxtx.c | 5 +++-- drivers/net/intel/idpf/idpf_common_rxtx.c | 3 ++- 5 files changed, 24 insertions(+), 13 deletions(-)
PATCH 6/7 net/iavf: fix missing outer QinQ tag for tunnelled packets
In reply to Bruce RichardsonWhen the QinQ feature was enabled along with tunnelling support, the tunnel options were written directly to the context descriptor quad-word rather than being merged in. This leads to any QinQ tag in the context descriptor getting overwritten.
Change order of operations so that the tunnel options go first and the QinQ tags are merged into that.
--- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 6 ++++-- drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +4 -2
@@ -1969,6 +1969,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) { +/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */ +iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw1, pkt[1 ]);if (pkt[1 ]->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt[1]->vlan_tci_outer :
@@ -1990,6 +1992,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) { +/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */ +iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw0, pkt[0 ]);if (pkt[0 ]->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt[0]->vlan_tci_outer :
@@ -2012,8 +2016,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,if (offload) {iavf_txd_enable_offload (pkt[1 ], &hi_data_qw1, vlan_flag);iavf_txd_enable_offload (pkt[0 ], &hi_data_qw0, vlan_flag); -iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw1, pkt[1 ]); -iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw0, pkt[0 ]); } __m256i desc2_3 =
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +4 -2
@@ -2111,6 +2111,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) { +/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */ +iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw1, pkt[1 ]);if (pkt[1 ]->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt[1]->vlan_tci_outer :
@@ -2131,6 +2133,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) { +/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */ +iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw0, pkt[0 ]);if (pkt[0 ]->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt[0]->vlan_tci_outer :
@@ -2151,8 +2155,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,if (offload) {iavf_txd_enable_offload (pkt[1 ], &hi_data_qw1, vlan_flag);iavf_txd_enable_offload (pkt[0 ], &hi_data_qw0, vlan_flag); -iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw1, pkt[1 ]); -iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw0, pkt[0 ]); } __m512i desc0_3 =
--
2.53.0
RE: [PATCH 6/7] net/iavf: fix missing outer QinQ tag for tunnelled packets
Quoted 10 lines
Subject: [PATCH 6/7] net/iavf: fix missing outer QinQ tag for tunnelled packets
When the QinQ feature was enabled along with tunnelling support, the tunnel options were written directly to the context descriptor quad-word rather than being merged in. This leads to any QinQ tag in the context descriptor getting overwritten.
Change order of operations so that the tunnel options go first and the QinQ tags are merged into that.
Quoted 6 lines
Fixes 4f8259df563a ("net/iavf: enable Tx outer checksum offload onAVX512")
Fixes 70baceadabf2 ("net/iavf: fix AVX512 Tx")Signed-off-by Bruce Richardson <[email protected]>
Quoted 5 lines
--- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 6 ++++-- drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
PATCH 7/7 net/iavf: remove undocumented conditional macros
In reply to Bruce RichardsonThe iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.
--- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 6 ------ drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ------ drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------------------ 3 files changed, 30 deletions(-)
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -6
@@ -1910,7 +1910,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,if (offload) {iavf_fill_ctx_desc_tunneling_avx2 (&low_ctx_qw, pkt); -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (pkt->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt->vlan_tci_outer :
@@ -1922,7 +1921,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, high_ctx_qw |=IAVF_TX_CTX_DESC_IL2TAG2 <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; low_ctx_qw |= (uint64_t )pkt->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } -#endif }if (IAVF_CHECK_TX_LLDP (pkt, ptype_lldp_enabled)) high_ctx_qw |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<IAVF_TXD_CTX_QW1_CMD_SHIFT ;
@@ -1967,7 +1965,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, ((uint64_t )pkt[0 ]->data_len <<IAVF_TXD_QW1_TX_BUF_SZ_SHIFT ); -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) {/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */ iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw1, pkt[1 ]);
@@ -1986,11 +1983,9 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, (uint64_t )pkt[1 ]->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } } -#endif if (IAVF_CHECK_TX_LLDP (pkt[1 ], ptype_lldp_enabled)) hi_ctx_qw1 |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) {/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */ iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw0, pkt[0 ]);
@@ -2009,7 +2004,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, (uint64_t )pkt[0 ]->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } } -#endif if (IAVF_CHECK_TX_LLDP (pkt[0 ], ptype_lldp_enabled)) hi_ctx_qw0 |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<IAVF_TXD_CTX_QW1_CMD_SHIFT ;
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -6
@@ -2054,7 +2054,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,if (offload) {iavf_fill_ctx_desc_tunneling_avx512 (&low_ctx_qw, pkt); -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (pkt->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt->vlan_tci_outer :
@@ -2066,7 +2065,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, high_ctx_qw |=IAVF_TX_CTX_DESC_IL2TAG2 <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; low_ctx_qw |= (uint64_t )pkt->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } -#endif }if (IAVF_CHECK_TX_LLDP (pkt, lldp_enabled)) high_ctx_qw |=IAVF_TX_CTX_DESC_SWTCH_UPLINK
@@ -2109,7 +2107,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, hi_data_qw0 = hi_data_qw_tmpl | ((uint64_t )pkt[0 ]->data_len <<CI_TXD_QW1_TX_BUF_SZ_S ); -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) {/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */ iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw1, pkt[1 ]);
@@ -2126,12 +2123,10 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, (uint64_t )pkt[1 ]->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } } -#endif if (IAVF_CHECK_TX_LLDP (pkt[1 ], lldp_enabled)) hi_ctx_qw1 |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<CI_TXD_QW1_CMD_S ; -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) {/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */ iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw0, pkt[0 ]);
@@ -2148,7 +2143,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, (uint64_t )pkt[0 ]->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } } -#endif if (IAVF_CHECK_TX_LLDP (pkt[0 ], lldp_enabled)) hi_ctx_qw0 |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<CI_TXD_QW1_CMD_S ;
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +0 -18
@@ -119,31 +119,16 @@ iavf_tx_vec_dev_check_default(struct rte_eth_dev *dev)return ret; } -/****************************************************************************** -* If user knows a specific offload is not enabled by APP, -* the macro can be commented to save the effort of fast path. -* Currently below 2 features are supported in TX path, -* 1, checksum offload -* 2, VLAN/QINQ insertion -******************************************************************************/ -#define IAVF_TX_CSUM_OFFLOAD -#define IAVF_TX_VLAN_QINQ_OFFLOAD - static __rte_always_inline void iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,uint64_t *txd_hi,uint8_t vlan_flag) { -#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 RTE_SET_USED (vlan_flag); -#ifdef IAVF_TX_CSUM_OFFLOAD /* Set MACLEN */ if (ol_flags &RTE_MBUF_F_TX_TUNNEL_MASK ) td_offset |= (tx_pkt->outer_l2_len >>1 )
@@ -191,9 +176,7 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt, } *txd_hi |= ((uint64_t )td_offset) <<CI_TXD_QW1_OFFSET_S ; -#endif -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (ol_flags &RTE_MBUF_F_TX_QINQ ) { td_cmd |=IAVF_TX_DESC_CMD_IL2TAG1 ;/* vlan_flag specifies outer tag location for QinQ. */
@@ -205,7 +188,6 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt, td_cmd |=CI_TX_DESC_CMD_IL2TAG1 ; *txd_hi |= ((uint64_t )tx_pkt->vlan_tci <<CI_TXD_QW1_L2TAG1_S ); } -#endif *txd_hi |= ((uint64_t )td_cmd) <<CI_TXD_QW1_CMD_S ; }
--
2.53.0
Re: [PATCH 7/7] net/iavf: remove undocumented conditional macros
Quoted 10 lines · Bruce Richardson
The iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.
Signed-off-by Bruce Richardson <[email protected]>
Though unrelated to current series, were the AVX512 knobs tested?
#define IAVF_RX_CSUM_OFFLOAD
#define IAVF_RX_VLAN_OFFLOAD
#define IAVF_RX_RSS_OFFLOAD
#define IAVF_RX_PTYPE_OFFLOAD
#define IAVF_RX_FDIR_OFFLOAD
#define IAVF_RX_TS_OFFLOAD
Signature · 1 line
David Marchand
Re: [PATCH 7/7] net/iavf: remove undocumented conditional macros
Quoted 13 lines · David Marchand
Quoted 10 lines · Bruce Richardson
The iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.
Signed-off-by Bruce Richardson <[email protected]>
Quoted 9 lines
Though unrelated to current series, were the AVX512 knobs tested?
#define
IAVF_RX_CSUM_OFFLOAD
#defineIAVF_RX_VLAN_OFFLOAD
#defineIAVF_RX_RSS_OFFLOAD
#defineIAVF_RX_PTYPE_OFFLOAD
#defineIAVF_RX_FDIR_OFFLOAD
#defineIAVF_RX_TS_OFFLOAD
I don't know, I didn't look at those. I came across the other two when looking at the Tx side (mainly AVX2)
/Bruce
RE: [PATCH 7/7] net/iavf: remove undocumented conditional macros
In reply to Bruce RichardsonQuoted 11 lines
Subject: [PATCH 7/7] net/iavf: remove undocumented conditional macros
The iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.
Signed-off-by Bruce Richardson <[email protected]>
Quoted 6 lines
--- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 6 ------ drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ------ drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------------------ 3 files changed, 30 deletions(-)
v2 cover VLAN and QinQ fixes for iavf
In reply to Bruce RichardsonThis patchset contains a number of small fixes for iavf VLAN tag handling. Most issues were discovered by AI code review rather than being found in testing.
v2:
* add error checking to patch 3
Bruce Richardson (7):
net/iavf: disable broken QinQ strip on Rx net/iavf: fix VLAN tag placement logic
net/iavf: fix VLAN outer TPID setting on Tx net/intel: fix unclear enum names
net/intel: fix VLAN and QinQ tag position logic net/iavf: fix missing outer QinQ tag for tunnelled packets net/iavf: remove undocumented conditional macros
drivers/net/intel/common/tx.h | 14 ++--- drivers/net/intel/common/tx_scalar.h | 16 ++++-- drivers/net/intel/i40e/i40e_rxtx.c | 6 +- drivers/net/intel/iavf/iavf_ethdev.c | 15 +++-- drivers/net/intel/iavf/iavf_rxtx.c | 56 +++++++++---------- drivers/net/intel/iavf/iavf_rxtx.h | 4 +- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 12 ++-- drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 12 ++-- drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------ drivers/net/intel/ice/ice_rxtx.c | 6 +- drivers/net/intel/idpf/idpf_common_rxtx.c | 3 +- 11 files changed, 77 insertions(+), 85 deletions(-)
Signature · 1 line
2.53.0
PATCH v2 1/7 net/iavf: disable broken QinQ strip on Rx
When 2 VLANs are stripped from a packet, the iavf driver vector path fails to handle them properly as it 'or's the two values together on the assumption that only one is valid. Explicitly list the VLAN related features supported by the vector path, rather than using the "OFFLOAD_VLAN" group, thereby disabling advertising of QinQ stripping so that a scalar path is used.
--- drivers/net/intel/iavf/iavf_rxtx.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/intel/iavf/iavf_rxtx.h +3 -1
@@ -105,7 +105,9 @@IAVF_RX_VECTOR_OFFLOADS | \RTE_ETH_RX_OFFLOAD_CHECKSUM | \RTE_ETH_RX_OFFLOAD_SCTP_CKSUM | \ - RTE_ETH_RX_OFFLOAD_VLAN | \ +RTE_ETH_RX_OFFLOAD_VLAN_STRIP | \ +RTE_ETH_RX_OFFLOAD_VLAN_FILTER | \ +RTE_ETH_RX_OFFLOAD_VLAN_EXTEND | \ RTE_ETH_RX_OFFLOAD_RSS_HASH) /* vector offload paths that use the flex rx desc */ #define IAVF_RX_VECTOR_OFFLOAD_FLEX_OFFLOADS ( \
Signature · 1 line
2.53.0
PATCH v2 2/7 net/iavf: fix VLAN tag placement logic
In reply to Bruce RichardsonDepending on what is reported by the PF to the VF the VLAN tag or VLAN + QinQ tags can be in either the L2Tag1 or the L2Tag2 fields. This needs to be taken into account when reading the vlan tags from the flex descriptors, rather than assuming that the tag is always present in a fixed location.
--- drivers/net/intel/iavf/iavf_rxtx.c | 49 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +24 -25
@@ -1151,33 +1151,32 @@ iavf_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ci_rx_desc *rxdp)static inline void iavf_flex_rxd_to_vlan_tci (struct rte_mbuf *mb, -volatile union ci_rx_flex_desc *rxdp) +volatile union ci_rx_flex_desc *rxdp, +uint8_t rx_flags) { -if (rte_le_to_cpu_64 (rxdp->wb.status_error0) & - (1 <<IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S )) { - mb->ol_flags |=RTE_MBUF_F_RX_VLAN | -RTE_MBUF_F_RX_VLAN_STRIPPED ; - mb->vlan_tci = -rte_le_to_cpu_16 (rxdp->wb.l2tag1); - }else { - mb->vlan_tci =0 ; - } - -if (rte_le_to_cpu_16 (rxdp->wb.status_error1) & - (1 <<IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S )) { -if ((mb->ol_flags &RTE_MBUF_F_RX_VLAN_STRIPPED ) ==0 ) { - mb->ol_flags |=RTE_MBUF_F_RX_VLAN |RTE_MBUF_F_RX_VLAN_STRIPPED ; +bool l2tag1_valid =rte_le_to_cpu_16 (rxdp->wb.status_error0) & + (1 <<IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S ); +bool l2tag2_valid =rte_le_to_cpu_16 (rxdp->wb.status_error1) & + (1 <<IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S ); +if (l2tag1_valid && l2tag2_valid) { + mb->ol_flags |=RTE_MBUF_F_RX_VLAN |RTE_MBUF_F_RX_VLAN_STRIPPED | +RTE_MBUF_F_RX_QINQ |RTE_MBUF_F_RX_QINQ_STRIPPED ; +/* with both tags, the rx_flags say which is outer vs inner */ +if (rx_flags &IAVF_RX_FLAGS_VLAN_TAG_LOC_L2TAG2_2 ) { + mb->vlan_tci_outer =rte_le_to_cpu_16 (rxdp->wb.l2tag2_2nd); + mb->vlan_tci =rte_le_to_cpu_16 (rxdp->wb.l2tag1); }else { -/* if two tags, move Tag1 to outer tag field */ - mb->ol_flags |=RTE_MBUF_F_RX_QINQ_STRIPPED |RTE_MBUF_F_RX_QINQ ; - mb->vlan_tci_outer = mb->vlan_tci; + mb->vlan_tci_outer =rte_le_to_cpu_16 (rxdp->wb.l2tag1); + mb->vlan_tci =rte_le_to_cpu_16 (rxdp->wb.l2tag2_2nd); } - mb->vlan_tci =rte_le_to_cpu_16 (rxdp->wb.l2tag2_2nd); -PMD_RX_LOG (DEBUG ,"Descriptor l2tag2_1: %u, l2tag2_2: %u" , -rte_le_to_cpu_16 (rxdp->wb.l2tag2_1st), -rte_le_to_cpu_16 (rxdp->wb.l2tag2_2nd)); + }else if (l2tag1_valid || l2tag2_valid) { + mb->ol_flags |=RTE_MBUF_F_RX_VLAN |RTE_MBUF_F_RX_VLAN_STRIPPED ; + mb->vlan_tci_outer =0 ; + mb->vlan_tci =rte_le_to_cpu_16 ( + l2tag1_valid ? rxdp->wb.l2tag1 : rxdp->wb.l2tag2_2nd); }else { mb->vlan_tci_outer =0 ; + mb->vlan_tci =0 ; } }
@@ -1564,7 +1563,7 @@ iavf_recv_pkts_flex_rxd(void *rx_queue, rxm->ol_flags =0 ; rxm->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)]; -iavf_flex_rxd_to_vlan_tci (rxm, &rxd); +iavf_flex_rxd_to_vlan_tci (rxm, &rxd, rxq->rx_flags);iavf_flex_rxd_to_ipsec_crypto_status (rxm, &rxd, &rxq->stats->ipsec_crypto); rxd_to_pkt_fields_ops[rxq->rxdid](rxq, rxm, &rxd);
@@ -1731,7 +1730,7 @@ iavf_recv_scattered_pkts_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts, first_seg->ol_flags =0 ; first_seg->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)]; -iavf_flex_rxd_to_vlan_tci (first_seg, &rxd); +iavf_flex_rxd_to_vlan_tci (first_seg, &rxd, rxq->rx_flags);iavf_flex_rxd_to_ipsec_crypto_status (first_seg, &rxd, &rxq->stats->ipsec_crypto); rxd_to_pkt_fields_ops[rxq->rxdid](rxq, first_seg, &rxd);
@@ -2013,7 +2012,7 @@ iavf_rx_scan_hw_ring_flex_rxd(struct ci_rx_queue *rxq, mb->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxdp[j].wb.ptype_flex_flags0)]; -iavf_flex_rxd_to_vlan_tci (mb, &rxdp[j]); +iavf_flex_rxd_to_vlan_tci (mb, &rxdp[j], rxq->rx_flags);iavf_flex_rxd_to_ipsec_crypto_status (mb, &rxdp[j], &rxq->stats->ipsec_crypto); rxd_to_pkt_fields_ops[rxq->rxdid](rxq, mb, &rxdp[j]);
Signature · 1 line
2.53.0
PATCH v2 3/7 net/iavf: fix VLAN outer TPID setting on Tx
In reply to Bruce RichardsonThe outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.
--- drivers/net/intel/iavf/iavf_ethdev.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +11 -4
@@ -1461,13 +1461,20 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type, uint16return -ENOTSUP ; } -/* This API only fills internal iavf_adapter structure -* and does not send any signal to hardware. -* Inner VLAN always 0x8100, so not set explicitly. -*/ +/* Inner VLAN always 0x8100, so not set explicitly. */ if (qinq && vlan_type ==RTE_ETH_VLAN_TYPE_OUTER ) adapter->tpid = tpid;/* Outer VLAN can be 0x88a8 or 0x8100 */ +/* Re-push insertion, and stripping if already enabled, so the new +* outer TPID reaches the PF instead of only being cached here. +*/ +iavf_dev_vlan_insert_set (dev); +if (dev_conf->rxmode.offloads &RTE_ETH_RX_OFFLOAD_QINQ_STRIP ) { +int ret =iavf_dev_vlan_offload_set (dev,RTE_ETH_QINQ_STRIP_MASK ); +if (ret !=0 ) +return ret; + } +return 0 ; }
Signature · 1 line
2.53.0
Re: [PATCH v2 3/7] net/iavf: fix VLAN outer TPID setting on Tx
Quoted 4 lines · Bruce Richardson
The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.
Quoted 9 lines
Fixes 8599d7604e0a ("net/iavf: support QinQ strip")Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/iavf/iavf_ethdev.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
Adding ack from v1:
Quoted 32 lines
drivers/net/intel/iavf/iavf_ethdev.c +11
-4@@ -1461,13 +1461,20 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type, uint16return -ENOTSUP ; } -/* This API only fills internal iavf_adapter structure -* and does not send any signal to hardware. -* Inner VLAN always 0x8100, so not set explicitly. -*/ +/* Inner VLAN always 0x8100, so not set explicitly. */ if (qinq && vlan_type ==RTE_ETH_VLAN_TYPE_OUTER ) adapter->tpid = tpid;/* Outer VLAN can be 0x88a8 or 0x8100 */ +/* Re-push insertion, and stripping if already enabled, so the new +* outer TPID reaches the PF instead of only being cached here. +*/ +iavf_dev_vlan_insert_set (dev); +if (dev_conf->rxmode.offloads &RTE_ETH_RX_OFFLOAD_QINQ_STRIP ) { +int ret =iavf_dev_vlan_offload_set (dev,RTE_ETH_QINQ_STRIP_MASK ); +if (ret !=0 ) +return ret; + } +return 0 ; }Signature · 1 line
2.53.0
PATCH v2 4/7 net/intel: fix unclear enum names
In reply to Bruce RichardsonThe enum for VLAN tag placement was badly named, and it's purpose as described in the comments was unclear. Update the names to be clearer, and more general for future uses and remove the incorrect comments.
--- drivers/net/intel/common/tx.h | 14 ++++++-------- drivers/net/intel/common/tx_scalar.h | 6 +++--- drivers/net/intel/i40e/i40e_rxtx.c | 2 +- drivers/net/intel/iavf/iavf_rxtx.c | 2 +- drivers/net/intel/ice/ice_rxtx.c | 5 +++-- drivers/net/intel/idpf/idpf_common_rxtx.c | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-)
drivers/net/intel/common/tx.h +6 -8
@@ -46,20 +46,18 @@#define CI_TX_CTX_DESC_IL2TAG2 0x04/** -* L2TAG1 Field Source Selection -* Specifies which mbuf VLAN field to use for the L2TAG1 field in data descriptors. -* Context descriptor VLAN handling (L2TAG2) is managed by driver-specific callbacks. +* Enum to specify where a VLAN tag is to be placed for packet Tx. */ -enum ci_tx_l2tag1_field { -/** For VLAN (not QinQ), use L2Tag1 field in data desc */ -CI_VLAN_IN_L2TAG1 , +enum ci_l2tag_pos { +/** Insert via the data descriptor's L2Tag1 field. */ +CI_TAG_IN_DATA_DESC , -/** For VLAN (not QinQ), use L2Tag2 field in ctx desc. +/** Insert via the context descriptor's L2Tag2 field. * NOTE: When set, drivers must set the VLAN tag in the context * descriptor callback function, rather than relying on the * common Tx code to insert it. */ -CI_VLAN_IN_L2TAG2 , +CI_TAG_IN_CTX_DESC , };/* Common TX Descriptor Length Field Shifts */
drivers/net/intel/common/tx_scalar.h +3 -3
@@ -372,7 +372,7 @@ static inline uint16_t ci_xmit_pkts(struct ci_tx_queue *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts, - enum ci_tx_l2tag1_field l2tag1_field, + enum ci_l2tag_pos l2tag_pos, ci_get_ctx_desc_fn get_ctx_desc, const struct ci_ipsec_ops *ipsec_ops, const struct ci_timestamp_queue_fns *ts_fns)
@@ -480,10 +480,10 @@ ci_xmit_pkts(struct ci_tx_queue *txq, }/* Descriptor based VLAN/QinQ insertion */ -/* for single vlan offload, only insert in data desc with VLAN_IN_L2TAG1 is set +/* for single vlan offload, only insert in data desc when CI_TAG_IN_DATA_DESC is set * for qinq offload, we always put inner tag in L2Tag1 */ -if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && l2tag1_field ==CI_VLAN_IN_L2TAG1 ) || +if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && l2tag_pos ==CI_TAG_IN_DATA_DESC ) || (ol_flags &RTE_MBUF_F_TX_QINQ )) { td_cmd |=CI_TX_DESC_CMD_IL2TAG1 ; td_tag = tx_pkt->vlan_tci;
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
@@ -1007,7 +1007,7 @@ uint16_t i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {/* i40e does not support IPsec or timestamp queues, so pass NULL for both */ -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , get_context_desc,NULL ,NULL ); }
drivers/net/intel/iavf/iavf_rxtx.c +1 -1
@@ -2605,7 +2605,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)/* IAVF does not support timestamp queues, so pass NULL for ts_fns */ return ci_xmit_pkts (txq, tx_pkts, nb_pkts, (txq->vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) ? -CI_VLAN_IN_L2TAG1 :CI_VLAN_IN_L2TAG2 , +CI_TAG_IN_DATA_DESC :CI_TAG_IN_CTX_DESC , iavf_get_context_desc, &ipsec_ops,NULL ); }
drivers/net/intel/ice/ice_rxtx.c +3 -2
@@ -3125,10 +3125,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;if (txq->tsq !=NULL && txq->tsq->ts_flag >0 ) -return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , get_context_desc,NULL , &ts_fns); -return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , get_context_desc,NULL ,NULL ); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , + get_context_desc,NULL ,NULL ); } static int
drivers/net/intel/idpf/idpf_common_rxtx.c +1 -1
@@ -1415,7 +1415,7 @@ uint16_t idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , idpf_get_context_desc,NULL ,NULL ); }
Signature · 1 line
2.53.0
PATCH v2 5/7 net/intel: fix VLAN and QinQ tag position logic
In reply to Bruce RichardsonThe position of a single vlan tag on a Tx packet (data desc or ctx desc) is independent across drivers from that of where the outer QinQ tag gets put. Therefore, these should be passed as separate values to the common scalar Tx function. For i40e, ice and idpf, the single tag can be put in the data descriptor, and for QinQ, the context descriptor contains the outer tag. For iavf, the tag positions depend on the capabilities reported by the PF to the VF, but the position for the single vlan tag and the outer QinQ tags are the same.
--- drivers/net/intel/common/tx_scalar.h | 16 +++++++++++----- drivers/net/intel/i40e/i40e_rxtx.c | 6 ++++-- drivers/net/intel/iavf/iavf_rxtx.c | 7 ++++--- drivers/net/intel/ice/ice_rxtx.c | 5 +++-- drivers/net/intel/idpf/idpf_common_rxtx.c | 3 ++- 5 files changed, 24 insertions(+), 13 deletions(-)
drivers/net/intel/common/tx_scalar.h +11 -5
@@ -372,7 +372,8 @@ static inline uint16_t ci_xmit_pkts(struct ci_tx_queue *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts, - enum ci_l2tag_pos l2tag_pos, + enum ci_l2tag_pos single_vlan_pos, + enum ci_l2tag_pos qinq_outer_pos, ci_get_ctx_desc_fn get_ctx_desc, const struct ci_ipsec_ops *ipsec_ops, const struct ci_timestamp_queue_fns *ts_fns)
@@ -480,13 +481,18 @@ ci_xmit_pkts(struct ci_tx_queue *txq, }/* Descriptor based VLAN/QinQ insertion */ -/* for single vlan offload, only insert in data desc when CI_TAG_IN_DATA_DESC is set -* for qinq offload, we always put inner tag in L2Tag1 +/* for single vlan offload, only insert in data desc when single_vlan_pos is +* CI_TAG_IN_DATA_DESC; for qinq offload, L2Tag1 always carries a tag, either +* the outer (qinq_outer_pos == CI_TAG_IN_DATA_DESC) or otherwise the inner */ -if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && l2tag_pos ==CI_TAG_IN_DATA_DESC ) || +if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && single_vlan_pos ==CI_TAG_IN_DATA_DESC ) || (ol_flags &RTE_MBUF_F_TX_QINQ )) { td_cmd |=CI_TX_DESC_CMD_IL2TAG1 ; - td_tag = tx_pkt->vlan_tci; +if ((ol_flags &RTE_MBUF_F_TX_QINQ ) && + qinq_outer_pos ==CI_TAG_IN_DATA_DESC ) + td_tag = tx_pkt->vlan_tci_outer; +else + td_tag = tx_pkt->vlan_tci; }/* Enable checksum offloading */
drivers/net/intel/i40e/i40e_rxtx.c +4 -2
@@ -1006,8 +1006,10 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,uint16_t i40e_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) { -/* i40e does not support IPsec or timestamp queues, so pass NULL for both */ -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , +/* i40e does not support IPsec or timestamp queues, so pass NULL for both. +* QinQ always places the outer tag in the ctx desc, inner in the data desc. +*/ +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC ,CI_TAG_IN_CTX_DESC , get_context_desc,NULL ,NULL ); }
drivers/net/intel/iavf/iavf_rxtx.c +4 -3
@@ -2596,6 +2596,9 @@ uint16_t iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {struct ci_tx_queue *txq = tx_queue; +/* vlan_flag gives both the single-VLAN and the QinQ outer tag position */ +enum ci_l2tag_pos vlan_pos = (txq->vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) ? +CI_TAG_IN_DATA_DESC :CI_TAG_IN_CTX_DESC ;const struct ci_ipsec_ops ipsec_ops = { .get_ipsec_desc = iavf_get_ipsec_desc,
@@ -2603,9 +2606,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) };/* IAVF does not support timestamp queues, so pass NULL for ts_fns */ -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, - (txq->vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) ? -CI_TAG_IN_DATA_DESC :CI_TAG_IN_CTX_DESC , +return ci_xmit_pkts (txq, tx_pkts, nb_pkts, vlan_pos, vlan_pos, iavf_get_context_desc, &ipsec_ops,NULL ); }
drivers/net/intel/ice/ice_rxtx.c +3 -2
@@ -3125,10 +3125,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;if (txq->tsq !=NULL && txq->tsq->ts_flag >0 ) -return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC ,CI_TAG_IN_CTX_DESC , get_context_desc,NULL , &ts_fns); -return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , +/* QinQ always places the outer tag in the ctx desc, inner in the data desc. */ +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC ,CI_TAG_IN_CTX_DESC , get_context_desc,NULL ,NULL ); }
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -1
@@ -1415,7 +1415,8 @@ uint16_t idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC , +/* QinQ always places the outer tag in the ctx desc, inner in the data desc. */ +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_TAG_IN_DATA_DESC ,CI_TAG_IN_CTX_DESC , idpf_get_context_desc,NULL ,NULL ); }
Signature · 1 line
2.53.0
PATCH v2 6/7 net/iavf: fix missing outer QinQ tag for tunnelled packets
In reply to Bruce RichardsonWhen the QinQ feature was enabled along with tunnelling support, the tunnel options were written directly to the context descriptor quad-word rather than being merged in. This leads to any QinQ tag in the context descriptor getting overwritten.
Change order of operations so that the tunnel options go first and the QinQ tags are merged into that.
--- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 6 ++++-- drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +4 -2
@@ -1969,6 +1969,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) { +/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */ +iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw1, pkt[1 ]);if (pkt[1 ]->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt[1]->vlan_tci_outer :
@@ -1990,6 +1992,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) { +/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */ +iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw0, pkt[0 ]);if (pkt[0 ]->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt[0]->vlan_tci_outer :
@@ -2012,8 +2016,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,if (offload) {iavf_txd_enable_offload (pkt[1 ], &hi_data_qw1, vlan_flag);iavf_txd_enable_offload (pkt[0 ], &hi_data_qw0, vlan_flag); -iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw1, pkt[1 ]); -iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw0, pkt[0 ]); } __m256i desc2_3 =
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +4 -2
@@ -2111,6 +2111,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) { +/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */ +iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw1, pkt[1 ]);if (pkt[1 ]->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt[1]->vlan_tci_outer :
@@ -2131,6 +2133,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) { +/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */ +iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw0, pkt[0 ]);if (pkt[0 ]->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt[0]->vlan_tci_outer :
@@ -2151,8 +2155,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,if (offload) {iavf_txd_enable_offload (pkt[1 ], &hi_data_qw1, vlan_flag);iavf_txd_enable_offload (pkt[0 ], &hi_data_qw0, vlan_flag); -iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw1, pkt[1 ]); -iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw0, pkt[0 ]); } __m512i desc0_3 =
Signature · 1 line
2.53.0
PATCH v2 7/7 net/iavf: remove undocumented conditional macros
In reply to Bruce RichardsonThe iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.
--- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 6 ------ drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ------ drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------------------ 3 files changed, 30 deletions(-)
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -6
@@ -1910,7 +1910,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,if (offload) {iavf_fill_ctx_desc_tunneling_avx2 (&low_ctx_qw, pkt); -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (pkt->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt->vlan_tci_outer :
@@ -1922,7 +1921,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, high_ctx_qw |=IAVF_TX_CTX_DESC_IL2TAG2 <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; low_ctx_qw |= (uint64_t )pkt->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } -#endif }if (IAVF_CHECK_TX_LLDP (pkt, ptype_lldp_enabled)) high_ctx_qw |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<IAVF_TXD_CTX_QW1_CMD_SHIFT ;
@@ -1967,7 +1965,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, ((uint64_t )pkt[0 ]->data_len <<IAVF_TXD_QW1_TX_BUF_SZ_SHIFT ); -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) {/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */ iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw1, pkt[1 ]);
@@ -1986,11 +1983,9 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, (uint64_t )pkt[1 ]->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } } -#endif if (IAVF_CHECK_TX_LLDP (pkt[1 ], ptype_lldp_enabled)) hi_ctx_qw1 |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) {/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */ iavf_fill_ctx_desc_tunneling_field (&low_ctx_qw0, pkt[0 ]);
@@ -2009,7 +2004,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, (uint64_t )pkt[0 ]->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } } -#endif if (IAVF_CHECK_TX_LLDP (pkt[0 ], ptype_lldp_enabled)) hi_ctx_qw0 |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<IAVF_TXD_CTX_QW1_CMD_SHIFT ;
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -6
@@ -2054,7 +2054,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,if (offload) {iavf_fill_ctx_desc_tunneling_avx512 (&low_ctx_qw, pkt); -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (pkt->ol_flags &RTE_MBUF_F_TX_QINQ ) {uint64_t qinq_tag = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? (uint64_t)pkt->vlan_tci_outer :
@@ -2066,7 +2065,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, high_ctx_qw |=IAVF_TX_CTX_DESC_IL2TAG2 <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; low_ctx_qw |= (uint64_t )pkt->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } -#endif }if (IAVF_CHECK_TX_LLDP (pkt, lldp_enabled)) high_ctx_qw |=IAVF_TX_CTX_DESC_SWTCH_UPLINK
@@ -2109,7 +2107,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, hi_data_qw0 = hi_data_qw_tmpl | ((uint64_t )pkt[0 ]->data_len <<CI_TXD_QW1_TX_BUF_SZ_S ); -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) {/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */ iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw1, pkt[1 ]);
@@ -2126,12 +2123,10 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, (uint64_t )pkt[1 ]->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } } -#endif if (IAVF_CHECK_TX_LLDP (pkt[1 ], lldp_enabled)) hi_ctx_qw1 |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<CI_TXD_QW1_CMD_S ; -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (offload) {/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */ iavf_fill_ctx_desc_tunnelling_field (&low_ctx_qw0, pkt[0 ]);
@@ -2148,7 +2143,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp, (uint64_t )pkt[0 ]->vlan_tci <<IAVF_TXD_CTX_QW0_L2TAG2_PARAM ; } } -#endif if (IAVF_CHECK_TX_LLDP (pkt[0 ], lldp_enabled)) hi_ctx_qw0 |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<CI_TXD_QW1_CMD_S ;
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +0 -18
@@ -119,31 +119,16 @@ iavf_tx_vec_dev_check_default(struct rte_eth_dev *dev)return ret; } -/****************************************************************************** -* If user knows a specific offload is not enabled by APP, -* the macro can be commented to save the effort of fast path. -* Currently below 2 features are supported in TX path, -* 1, checksum offload -* 2, VLAN/QINQ insertion -******************************************************************************/ -#define IAVF_TX_CSUM_OFFLOAD -#define IAVF_TX_VLAN_QINQ_OFFLOAD - static __rte_always_inline void iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,uint64_t *txd_hi,uint8_t vlan_flag) { -#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 RTE_SET_USED (vlan_flag); -#ifdef IAVF_TX_CSUM_OFFLOAD /* Set MACLEN */ if (ol_flags &RTE_MBUF_F_TX_TUNNEL_MASK ) td_offset |= (tx_pkt->outer_l2_len >>1 )
@@ -191,9 +176,7 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt, } *txd_hi |= ((uint64_t )td_offset) <<CI_TXD_QW1_OFFSET_S ; -#endif -#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD if (ol_flags &RTE_MBUF_F_TX_QINQ ) { td_cmd |=IAVF_TX_DESC_CMD_IL2TAG1 ;/* vlan_flag specifies outer tag location for QinQ. */
@@ -205,7 +188,6 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt, td_cmd |=CI_TX_DESC_CMD_IL2TAG1 ; *txd_hi |= ((uint64_t )tx_pkt->vlan_tci <<CI_TXD_QW1_L2TAG1_S ); } -#endif *txd_hi |= ((uint64_t )td_cmd) <<CI_TXD_QW1_CMD_S ; }
Signature · 1 line
2.53.0
Quoted 7 lines · Bruce Richardson
This patchset contains a number of small fixes for iavf VLAN tag handling. Most issues were discovered by AI code review rather than being found in testing.
v2:
* add error checking to patch 3
Quoted 9 lines
Bruce Richardson (7):
net/iavf: disable broken QinQ strip on Rx net/iavf: fix VLAN tag placement logic
net/iavf: fix VLAN outer TPID setting on Tx net/intel: fix unclear enum names
net/intel: fix VLAN and QinQ tag position logic net/iavf: fix missing outer QinQ tag for tunnelled packets net/iavf: remove undocumented conditional macros
Series applied to dpdk-next-net-intel
/Bruce