net/iavf: support qinq insertion offload for scalar path
PATCH 1/3 net/iavf: support qinq insertion offload for scalar path
Enable Tx QINQ offload if the VF reports support for inserting both an outer and inner VLAN tag. The VF capabilities report the locations for placing each of the tags - either L2TAG1 in the tx descriptor or L2TAG2 in the context descriptor. Use this information to configure the descriptors correctly.
This offload was previously incorrectly reported as always supported in the device configuration, so this is corrected.
--- doc/guides/nics/features/iavf.ini | 1 + drivers/net/intel/iavf/iavf_ethdev.c | 8 +++- drivers/net/intel/iavf/iavf_rxtx.c | 55 +++++++++++++++++++++------- 3 files changed, 48 insertions(+), 16 deletions(-)
doc/guides/nics/features/iavf.ini +1 -0
@@ -29,6 +29,7 @@ Traffic manager = Y Inline crypto = Y CRC offload = Y VLAN offload = P +QinQ offload = P L3 checksum offload = Y L4 checksum offload = Y Timestamp offload = Y
drivers/net/intel/iavf/iavf_ethdev.c +6 -2
@@ -622,7 +622,7 @@ iavf_dev_vlan_insert_set(struct rte_eth_dev *dev)return 0 ; enable = !!(dev->data->dev_conf.txmode.offloads & -RTE_ETH_TX_OFFLOAD_VLAN_INSERT ); + (RTE_ETH_TX_OFFLOAD_VLAN_INSERT |RTE_ETH_TX_OFFLOAD_QINQ_INSERT ));iavf_config_vlan_insert_v2 (adapter, enable);return 0 ;
@@ -1158,7 +1158,6 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_offload_capa =RTE_ETH_TX_OFFLOAD_VLAN_INSERT | -RTE_ETH_TX_OFFLOAD_QINQ_INSERT |RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |RTE_ETH_TX_OFFLOAD_UDP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
@@ -1182,6 +1181,11 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_CAP_PTP ) dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TIMESTAMP ; +if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_VLAN_V2 && + vf->vlan_v2_caps.offloads.insertion_support.inner && + vf->vlan_v2_caps.offloads.insertion_support.outer) + dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_QINQ_INSERT ; +if (iavf_ipsec_crypto_supported (adapter)) { dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_SECURITY ; dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_SECURITY ;
drivers/net/intel/iavf/iavf_rxtx.c +41 -14
85 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/3 net/iavf: fix tx vector path selection logic
Prior to this change, it was possible the scalar path would be selected even if the avx-512 path was available. This was due to the ordering of the logic in the iavf_set_tx_function function. Support for all three vector paths (sse, avx2 and avx-512) was first established and then in that order, the tx_burst_type was set to the appropriate type. If all three paths were supported, then the burst type would be first set to sse, then avx2 then avx-512. However, in the avx2 logic, if an error was encountered then the burst type was set to a fallback option of the scalar path. This is not desired behaviour because the avx-512 path should be selected over the scalar path when it is available.
This commit fixes this issue by only checking for avx2 support after deeming that avx512 is not supported.
--- drivers/net/intel/iavf/iavf_rxtx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +4 -4
@@ -4230,16 +4230,16 @@ iavf_set_tx_function(struct rte_eth_dev *dev)if (check_ret ==IAVF_VECTOR_PATH ) { use_sse = true; } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) - use_avx2 = true;#ifdef CC_AVX512_SUPPORT if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 &&rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512BW ) ==1 &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_512 ) use_avx512 = true;#endif +if (!use_avx512 && (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) + use_avx2 = true;if (!use_sse && !use_avx2 && !use_avx512) goto normal;
Signature · 1 line
2.34.1
PATCH 3/3 net/iavf: support vlan insertion offload for the avx-512 path
In reply to Ciara LoftusRe-enable support for VLAN insertion and implement support for QinQ insertion on the iavf avx-512 transmit path.
--- drivers/net/intel/iavf/iavf_rxtx.h | 6 +- drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 24 +++---- drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 62 ++++++++++++++----- drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 17 ++++- 4 files changed, 76 insertions(+), 33 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.h +3 -3
@@ -30,8 +30,6 @@#define IAVF_VPMD_TX_MAX_FREE_BUF 64#define IAVF_TX_NO_VECTOR_FLAGS ( \ - RTE_ETH_TX_OFFLOAD_VLAN_INSERT | \ - RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_TCP_TSO | \ RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | \
@@ -48,7 +46,9 @@#define IAVF_TX_VECTOR_OFFLOAD_CTX ( \ RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM | \ - RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM) + RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM | \ + RTE_ETH_TX_OFFLOAD_VLAN_INSERT | \ + RTE_ETH_TX_OFFLOAD_QINQ_INSERT)#define IAVF_RX_VECTOR_OFFLOAD ( \ RTE_ETH_RX_OFFLOAD_CHECKSUM | \
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +12 -12
@@ -1649,14 +1649,14 @@ iavf_recv_scattered_pkts_vec_avx2_flex_rxd_offload(void *rx_queue, static __rte_always_inline voidiavf_vtx1 (volatile struct iavf_tx_desc *txdp, -struct rte_mbuf *pkt,uint64_t flags,bool offload) +struct rte_mbuf *pkt,uint64_t flags,bool offload,uint8_t vlan_flag) {uint64_t high_qw = (IAVF_TX_DESC_DTYPE_DATA | ((uint64_t )flags <<IAVF_TXD_QW1_CMD_SHIFT ) | ((uint64_t )pkt->data_len <<IAVF_TXD_QW1_TX_BUF_SZ_SHIFT ));if (offload) -iavf_txd_enable_offload (pkt, &high_qw); +iavf_txd_enable_offload (pkt, &high_qw, vlan_flag);__m128i descriptor =_mm_set_epi64x (high_qw, pkt->buf_iova + pkt->data_off);
@@ -1665,14 +1665,14 @@ iavf_vtx1(volatile struct iavf_tx_desc *txdp, static __rte_always_inline voidiavf_vtx (volatile struct iavf_tx_desc *txdp, -struct rte_mbuf **pkt,uint16_t nb_pkts,uint64_t flags,bool offload) +struct rte_mbuf **pkt,uint16_t nb_pkts,uint64_t flags,bool offload,uint8_t vlan_flag) {const uint64_t hi_qw_tmpl = (IAVF_TX_DESC_DTYPE_DATA | ((uint64_t )flags <<IAVF_TXD_QW1_CMD_SHIFT ));/* if unaligned on 32-bit boundary, do one to align */ if (((uintptr_t )txdp &0x1F ) !=0 && nb_pkts !=0 ) { -iavf_vtx1 (txdp, *pkt, flags, offload); +iavf_vtx1 (txdp, *pkt, flags, offload, vlan_flag); nb_pkts--, txdp++, pkt++; }
@@ -1683,25 +1683,25 @@ iavf_vtx(volatile struct iavf_tx_desc *txdp, ((uint64_t )pkt[3 ]->data_len <<IAVF_TXD_QW1_TX_BUF_SZ_SHIFT );if (offload) -iavf_txd_enable_offload (pkt[3 ], &hi_qw3); +iavf_txd_enable_offload (pkt[3 ], &hi_qw3, vlan_flag);uint64_t hi_qw2 = hi_qw_tmpl | ((uint64_t )pkt[2 ]->data_len <<IAVF_TXD_QW1_TX_BUF_SZ_SHIFT );if (offload) -iavf_txd_enable_offload (pkt[2 ], &hi_qw2); +iavf_txd_enable_offload (pkt[2 ], &hi_qw2, vlan_flag);uint64_t hi_qw1 = hi_qw_tmpl | ((uint64_t )pkt[1 ]->data_len <<IAVF_TXD_QW1_TX_BUF_SZ_SHIFT );if (offload) -iavf_txd_enable_offload (pkt[1 ], &hi_qw1); +iavf_txd_enable_offload (pkt[1 ], &hi_qw1, vlan_flag);uint64_t hi_qw0 = hi_qw_tmpl | ((uint64_t )pkt[0 ]->data_len <<IAVF_TXD_QW1_TX_BUF_SZ_SHIFT );if (offload) -iavf_txd_enable_offload (pkt[0 ], &hi_qw0); +iavf_txd_enable_offload (pkt[0 ], &hi_qw0, vlan_flag);__m256i desc2_3 = _mm256_set_epi64x
@@ -1721,7 +1721,7 @@ iavf_vtx(volatile struct iavf_tx_desc *txdp,/* do any last ones */ while (nb_pkts) { -iavf_vtx1 (txdp, *pkt, flags, offload); +iavf_vtx1 (txdp, *pkt, flags, offload, vlan_flag); txdp++, pkt++, nb_pkts--; } }
@@ -1756,11 +1756,11 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,if (nb_commit >= n) {ci_tx_backlog_entry_vec (txep, tx_pkts, n); -iavf_vtx (txdp, tx_pkts, n -1 , flags, offload); +iavf_vtx (txdp, tx_pkts, n -1 , flags, offload, txq->vlan_flag); tx_pkts += (n -1 ); txdp += (n -1 ); -iavf_vtx1 (txdp, *tx_pkts++, rs, offload); +iavf_vtx1 (txdp, *tx_pkts++, rs, offload, txq->vlan_flag); nb_commit = (uint16_t )(nb_commit - n);
@@ -1774,7 +1774,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,ci_tx_backlog_entry_vec (txep, tx_pkts, nb_commit); -iavf_vtx (txdp, tx_pkts, nb_commit, flags, offload); +iavf_vtx (txdp, tx_pkts, nb_commit, flags, offload, txq->vlan_flag); tx_id = (uint16_t )(tx_id + nb_commit);if (tx_id > txq->tx_next_rs) {
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +47 -15
136 lines not on this page · raw message
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +14 -3
@@ -99,7 +99,8 @@ iavf_tx_vec_queue_default(struct ci_tx_queue *txq)*/ if (txq->offloads & (IAVF_TX_VECTOR_OFFLOAD |IAVF_TX_VECTOR_OFFLOAD_CTX )) {if (txq->offloads &IAVF_TX_VECTOR_OFFLOAD_CTX ) { -if (txq->vlan_flag ==IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ) { +if (txq->vlan_flag ==IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 || + txq->offloads &RTE_ETH_TX_OFFLOAD_QINQ_INSERT ) { txq->use_ctx =1 ;return IAVF_VECTOR_CTX_OFFLOAD_PATH ; }else {
@@ -167,7 +168,7 @@ iavf_tx_vec_dev_check_default(struct rte_eth_dev *dev) static __rte_always_inline void iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt, -uint64_t *txd_hi) +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;
@@ -228,11 +229,21 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,#endif #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD -if (ol_flags & (RTE_MBUF_F_TX_VLAN |RTE_MBUF_F_TX_QINQ )) { +if (ol_flags &RTE_MBUF_F_TX_VLAN && vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) { td_cmd |=IAVF_TX_DESC_CMD_IL2TAG1 ; *txd_hi |= ((uint64_t )tx_pkt->vlan_tci <<IAVF_TXD_QW1_L2TAG1_SHIFT ); } + +if (ol_flags &RTE_MBUF_F_TX_QINQ ) { + td_cmd |=IAVF_TX_DESC_CMD_IL2TAG1 ; +if (vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) + *txd_hi |= ((uint64_t )tx_pkt->vlan_tci << +IAVF_TXD_QW1_L2TAG1_SHIFT ); +else + *txd_hi |= ((uint64_t )tx_pkt->vlan_tci_outer << +IAVF_TXD_QW1_L2TAG1_SHIFT ); + }#endif *txd_hi |= ((uint64_t )td_cmd) <<IAVF_TXD_QW1_CMD_SHIFT ;
Signature · 1 line
2.34.1
Quoted 83 lines · Ciara Loftus
Enable Tx QINQ offload if the VF reports support for inserting both an outer and inner VLAN tag. The VF capabilities report the locations for placing each of the tags - either L2TAG1 in the tx descriptor or L2TAG2 in the context descriptor. Use this information to configure the descriptors correctly.
This offload was previously incorrectly reported as always supported in the device configuration, so this is corrected.Signed-off-by Ciara Loftus <[email protected]>--- doc/guides/nics/features/iavf.ini | 1 + drivers/net/intel/iavf/iavf_ethdev.c | 8 +++- drivers/net/intel/iavf/iavf_rxtx.c | 55 +++++++++++++++++++++------- 3 files changed, 48 insertions(+), 16 deletions(-)doc/guides/nics/features/iavf.ini +1
-0@@ -29,6 +29,7 @@ Traffic manager = Y Inline crypto = Y CRC offload = Y VLAN offload = P +QinQ offload = P L3 checksum offload = Y L4 checksum offload = Y Timestamp offload = Ydrivers/net/intel/iavf/iavf_ethdev.c +6
-2@@ -622,7 +622,7 @@ iavf_dev_vlan_insert_set(struct rte_eth_dev *dev)return 0 ; enable = !!(dev->data->dev_conf.txmode.offloads & -RTE_ETH_TX_OFFLOAD_VLAN_INSERT ); + (RTE_ETH_TX_OFFLOAD_VLAN_INSERT |RTE_ETH_TX_OFFLOAD_QINQ_INSERT ));iavf_config_vlan_insert_v2 (adapter, enable);return 0 ;@@ -1158,7 +1158,6 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_offload_capa =RTE_ETH_TX_OFFLOAD_VLAN_INSERT | -RTE_ETH_TX_OFFLOAD_QINQ_INSERT |RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |RTE_ETH_TX_OFFLOAD_UDP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_CKSUM |@@ -1182,6 +1181,11 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_CAP_PTP ) dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TIMESTAMP ; +if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_VLAN_V2 && + vf->vlan_v2_caps.offloads.insertion_support.inner && + vf->vlan_v2_caps.offloads.insertion_support.outer) + dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_QINQ_INSERT ; +if (iavf_ipsec_crypto_supported (adapter)) { dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_SECURITY ; dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_SECURITY ;drivers/net/intel/iavf/iavf_rxtx.c +4
-11@@ -797,17 +797,32 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev, &adapter->vf.vlan_v2_caps.offloads.insertion_support;uint32_t insertion_cap; -if (insertion_support->outer) - insertion_cap = insertion_support->outer; -else - insertion_cap = insertion_support->inner; - -if (insertion_cap &VIRTCHNL_VLAN_TAG_LOCATION_L2TAG1 ) { - txq->vlan_flag =IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ; -PMD_INIT_LOG (DEBUG ,"VLAN insertion_cap: L2TAG1" ); - }else if (insertion_cap &VIRTCHNL_VLAN_TAG_LOCATION_L2TAG2 ) { - txq->vlan_flag =IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ; -PMD_INIT_LOG (DEBUG ,"VLAN insertion_cap: L2TAG2" ); +if (insertion_support->outer ==VIRTCHNL_VLAN_UNSUPPORTED || + insertion_support->inner ==VIRTCHNL_VLAN_UNSUPPORTED ) { +/* Only one insertion is supported. */ +if (insertion_support->outer)
drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev *dev, · line 813
Quoted 10 lines
drivers/net/intel/iavf/iavf_rxtx.c +10
-0+ insertion_cap = insertion_support->outer; + else + insertion_cap = insertion_support->inner; + +if (insertion_cap &VIRTCHNL_VLAN_TAG_LOCATION_L2TAG1 ) { + txq->vlan_flag =IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ; +PMD_INIT_LOG (DEBUG ,"VLAN insertion_cap: L2TAG1" ); + }else if (insertion_cap &VIRTCHNL_VLAN_TAG_LOCATION_L2TAG2 ) { + txq->vlan_flag =IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ; +PMD_INIT_LOG (DEBUG ,"VLAN insertion_cap: L2TAG2" );
Is this scenario possible - we only support insertion of a single vlan tag, and it's to go in the context descriptor. In this case, do we not need to add in the VLAN offload flag to the list of offloads needing a context descriptor below?
Quoted 16 lines
drivers/net/intel/iavf/iavf_rxtx.c +12
-0+ } + }else { +/* Both outer and inner insertion supported. */ +if (insertion_support->inner &VIRTCHNL_VLAN_TAG_LOCATION_L2TAG1 ) { + txq->vlan_flag =IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ; +PMD_INIT_LOG (DEBUG ,"Inner VLAN insertion_cap: L2TAG1" ); +PMD_INIT_LOG (DEBUG ,"Outer VLAN insertion_cap: L2TAG2" ); + }else { + txq->vlan_flag =IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ; +PMD_INIT_LOG (DEBUG ,"Inner VLAN insertion_cap: L2TAG2" ); +PMD_INIT_LOG (DEBUG ,"Outer VLAN insertion_cap: L2TAG1" ); + } } }else { txq->vlan_flag =IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ;
drivers/net/intel/iavf/iavf_rxtx.c iavf_calc_context_desc(struct rte_mbuf *mb, uint8_t vlan_flag) · line 2410
Quoted 6 lines
drivers/net/intel/iavf/iavf_rxtx.c +1
-1@@ -2391,7 +2406,7 @@ iavf_calc_context_desc(struct rte_mbuf *mb, uint8_t vlan_flag)uint64_t flags = mb->ol_flags;if (flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG |RTE_MBUF_F_TX_TUNNEL_MASK |RTE_MBUF_F_TX_OUTER_IP_CKSUM | -RTE_MBUF_F_TX_OUTER_UDP_CKSUM )) +RTE_MBUF_F_TX_OUTER_UDP_CKSUM |RTE_MBUF_F_TX_QINQ ))return 1 ;
In this check, do we need to take into account possible case for only a single vlan offload, and requiring an L2TAG2 field for it?
/Bruce
Quoted 120 lines · Ciara Loftus
Quoted 8 lines
Enable Tx QINQ offload if the VF reports support for inserting both an outer and inner VLAN tag. The VF capabilities report the locations for placing each of the tags - either L2TAG1 in the tx descriptor or L2TAG2 in the context descriptor. Use this information to configure the descriptors correctly.
This offload was previously incorrectly reported as always supported in the device configuration, so this is corrected.Review
Quoted 8 lines
Signed-off-by Ciara Loftus <[email protected]>--- doc/guides/nics/features/iavf.ini | 1 + drivers/net/intel/iavf/iavf_ethdev.c | 8 +++- drivers/net/intel/iavf/iavf_rxtx.c | 55 +++++++++++++++++++++------- 3 files changed, 48 insertions(+), 16 deletions(-)(quoted diff) +0
-0b/doc/guides/nics/features/iavf.ini
Review
Quoted 12 lines
index
ce9860e963..61c4742197100644doc/guides/nics/features/iavf.ini +1
-0@@ -29,6 +29,7 @@ Traffic manager = Y Inline crypto = Y CRC offload = Y VLAN offload = P +QinQ offload = P L3 checksum offload = Y L4 checksum offload = Y Timestamp offload = Y(quoted diff) +0
-0
b/drivers/net/intel/iavf/iavf_ethdev.cdrivers/net/intel/iavf/iavf_ethdev.c iavf_dev_vlan_insert_set(struct rte_eth_dev *dev) · line 625
Quoted 9 lines
index
b3dacbef84..d058b87d54100644drivers/net/intel/iavf/iavf_ethdev.c +1
-1@@ -622,7 +622,7 @@ iavf_dev_vlan_insert_set(struct rte_eth_dev *dev)return 0 ; enable = !!(dev->data->dev_conf.txmode.offloads & -RTE_ETH_TX_OFFLOAD_VLAN_INSERT ); + (RTE_ETH_TX_OFFLOAD_VLAN_INSERT |
RTE_ETH_TX_OFFLOAD_QINQ_INSERT));drivers/net/intel/iavf/iavf_ethdev.c iavf_dev_info_get(struct rte_eth_dev *dev, struct
Quoted 4 lines
drivers/net/intel/iavf/iavf_ethdev.c +0
-0iavf_config_vlan_insert_v2 (adapter, enable);return 0 ;@@ -1158,7 +1158,6 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct
rte_eth_dev_info*dev_info)drivers/net/intel/iavf/iavf_ethdev.c iavf_dev_info_get(struct rte_eth_dev *dev,
Quoted 8 lines
drivers/net/intel/iavf/iavf_ethdev.c +0
-1dev_info->tx_offload_capa =RTE_ETH_TX_OFFLOAD_VLAN_INSERT | -RTE_ETH_TX_OFFLOAD_QINQ_INSERT |RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |RTE_ETH_TX_OFFLOAD_UDP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_CKSUM |@@ -1182,6 +1181,11 @@ iavf_dev_info_get(struct rte_eth_dev *dev,struct
rte_eth_dev_info*dev_info)drivers/net/intel/iavf/iavf_ethdev.c iavf_dev_info_get(struct rte_eth_dev *dev, · line 1182
Quoted 2 lines
drivers/net/intel/iavf/iavf_ethdev.c +0
-0if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_CAP_PTP ) dev_info->rx_offload_capa |=
RTE_ETH_RX_OFFLOAD_TIMESTAMP;drivers/net/intel/iavf/iavf_ethdev.c iavf_dev_info_get(struct rte_eth_dev *dev, · line 1184
Quoted 3 lines
drivers/net/intel/iavf/iavf_ethdev.c +2
-0+if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_VLAN_V2 && + vf->vlan_v2_caps.offloads.insertion_support.inner&&
drivers/net/intel/iavf/iavf_ethdev.c iavf_dev_info_get(struct rte_eth_dev *dev, · line 1186
Quoted 2 lines
drivers/net/intel/iavf/iavf_ethdev.c +2
-0+ vf->vlan_v2_caps.offloads.insertion_support.outer) + dev_info->tx_offload_capa |=
RTE_ETH_TX_OFFLOAD_QINQ_INSERT;drivers/net/intel/iavf/iavf_ethdev.c iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
Quoted 3 lines
drivers/net/intel/iavf/iavf_ethdev.c +1
-0+if (iavf_ipsec_crypto_supported (adapter)) { dev_info->rx_offload_capa |=
RTE_ETH_RX_OFFLOAD_SECURITY;drivers/net/intel/iavf/iavf_ethdev.c iavf_dev_info_get(struct rte_eth_dev *dev, · line 1190
Quoted 1 line
drivers/net/intel/iavf/iavf_ethdev.c +0
-0dev_info->tx_offload_capa |=
RTE_ETH_TX_OFFLOAD_SECURITY;Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/net/intel/iavf/iavf_rxtx.cdrivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev
Quoted 4 lines
index
5411eb6897..1ce9de0699100644drivers/net/intel/iavf/iavf_rxtx.c +0
-0@@ -797,17 +797,32 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev*dev,
drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
Quoted 10 lines
drivers/net/intel/iavf/iavf_rxtx.c +0
-6&adapter- vf.vlan_v2_caps.offloads.insertion_support;uint32_t insertion_cap; -if (insertion_support->outer) - insertion_cap = insertion_support->outer; -else - insertion_cap = insertion_support->inner; - -if (insertion_cap &VIRTCHNL_VLAN_TAG_LOCATION_L2TAG1 ){
drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 807
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +0
-1- txq->vlan_flag =
IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1;drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 808
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +0
-1- PMD_INIT_LOG(DEBUG, "VLAN insertion_cap:L2TAG1");
drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 809
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +0
-1- } else if (insertion_cap &
VIRTCHNL_VLAN_TAG_LOCATION_L2TAG2) {drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 810
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +0
-1- txq->vlan_flag =
IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2;drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 811
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +0
-1- PMD_INIT_LOG(DEBUG, "VLAN insertion_cap:L2TAG2");
drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 801
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ if (insertion_support->outer ==
VIRTCHNL_VLAN_UNSUPPORTED||drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 802
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ insertion_support->inner ==
VIRTCHNL_VLAN_UNSUPPORTED) {drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
Quoted 7 lines
drivers/net/intel/iavf/iavf_rxtx.c +7
-0+/* Only one insertion is supported. */ +if (insertion_support->outer) + insertion_cap = insertion_support->outer; +else + insertion_cap = insertion_support->inner; + + if (insertion_cap &
VIRTCHNL_VLAN_TAG_LOCATION_L2TAG1) {drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 810
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ txq->vlan_flag =
IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1;drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 811
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ PMD_INIT_LOG(DEBUG, "VLAN insertion_cap:L2TAG1");
drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 812
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ } else if (insertion_cap &
VIRTCHNL_VLAN_TAG_LOCATION_L2TAG2) {drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 813
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ txq->vlan_flag =
IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2;
Quoted 7 lines
drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 814
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ PMD_INIT_LOG(DEBUG, "VLAN insertion_cap:L2TAG2");
Is this scenario possible - we only support insertion of a single vlan tag, and it's to go in the context descriptor. In this case, do we not need to add in the VLAN offload flag to the list of offloads needing a context descriptor below?
This scenario is possible. It's the case I hit when I test with a VF from my Fortville card.
This code block is the same as what's in the existing code, it's wrapped around a new if condition checking if only one insertion capability is supported (inner or outer). The new code is in the else {}. No update is needed to iavf_calc_context_desc because what you are describing is already in place.
Quoted 28 lines
drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
Quoted 5 lines
drivers/net/intel/iavf/iavf_rxtx.c +4
-0+ } + }else { +/* Both outer and inner insertion supported. */ + if (insertion_support->inner &
VIRTCHNL_VLAN_TAG_LOCATION_L2TAG1) {drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 819
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ txq->vlan_flag =
IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1;drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 820
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ PMD_INIT_LOG(DEBUG, "Inner VLAN
insertion_cap: L2TAG1");drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 821
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ PMD_INIT_LOG(DEBUG, "Outer VLAN
insertion_cap: L2TAG2");drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 823
Quoted 2 lines
drivers/net/intel/iavf/iavf_rxtx.c +2
-0+ }else { + txq->vlan_flag =
IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2;drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 824
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ PMD_INIT_LOG(DEBUG, "Inner VLAN
insertion_cap: L2TAG2");drivers/net/intel/iavf/iavf_rxtx.c iavf_dev_tx_queue_setup(struct rte_eth_dev · line 825
Quoted 1 line
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ PMD_INIT_LOG(DEBUG, "Outer VLAN
insertion_cap: L2TAG1");drivers/net/intel/iavf/iavf_rxtx.c iavf_calc_context_desc(struct rte_mbuf *mb,
Quoted 5 lines
drivers/net/intel/iavf/iavf_rxtx.c +1
-0+ } } }else {drivers/net/intel/iavf/iavf_rxtx.c +0
-0txq->vlan_flag =IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ;@@ -2391,7 +2406,7 @@ iavf_calc_context_desc(struct rte_mbuf *mb,
uint8_tvlan_flag)drivers/net/intel/iavf/iavf_rxtx.c iavf_calc_context_desc(struct rte_mbuf *mb, uint8_t vlan_flag)
Quoted 3 lines
drivers/net/intel/iavf/iavf_rxtx.c +0
-0uint64_t flags = mb->ol_flags; if (flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG | RTE_MBUF_F_TX_TUNNEL_MASK |
Quoted 7 lines
RTE_MBUF_F_TX_OUTER_IP_CKSUM|drivers/net/intel/iavf/iavf_rxtx.c iavf_calc_context_desc(struct rte_mbuf *mb, uint8_t vlan_flag) · line 2410
Quoted 3 lines
drivers/net/intel/iavf/iavf_rxtx.c +1
-1- RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) + RTE_MBUF_F_TX_OUTER_UDP_CKSUM | RTE_MBUF_F_TX_QINQ))return 1 ;In this check, do we need to take into account possible case for only a single vlan offload, and requiring an L2TAG2 field for it?
This already exists. Here's what's already there:
if (flags & RTE_MBUF_F_TX_VLAN && vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2) return 1;
Thanks,
Ciara
Quoted 2 lines
/Bruce
Bruce Richardson
AppliedQuoted 8 lines · Ciara Loftus
Enable Tx QINQ offload if the VF reports support for inserting both an outer and inner VLAN tag. The VF capabilities report the locations for placing each of the tags - either L2TAG1 in the tx descriptor or L2TAG2 in the context descriptor. Use this information to configure the descriptors correctly.
This offload was previously incorrectly reported as always supported in the device configuration, so this is corrected.
Quoted 7 lines
Signed-off-by Ciara Loftus <[email protected]>--- doc/guides/nics/features/iavf.ini | 1 + drivers/net/intel/iavf/iavf_ethdev.c | 8 +++- drivers/net/intel/iavf/iavf_rxtx.c | 55 +++++++++++++++++++++------- 3 files changed, 48 insertions(+), 16 deletions(-)
Applied to dpdk-next-net-intel.
Thanks,
/Bruce