net/ice: fix vlan offload
PATCH v5 1/2 net/ice: fix vlan offload
The vlan tag and flag in Rx descriptor are not processed on vector path, then the upper application can't fetch the tci from mbuf.
This patch is to add handling of vlan RX offloading.
Fixes c68a52b8b38c ("net/ice: support vector SSE in Rx")
Fixes ece1f8a8f1c8 ("net/ice: switch to flexible descriptor in SSE path")
Fixes 12443386a0b0 ("net/ice: support flex Rx descriptor RxDID22")
Fixes 214f452f7d5f ("net/ice: add AVX2 offload Rx")
Fixes 7f85d5ebcfe1 ("net/ice: add AVX512 vector path")
Fixes 295968d17407 ("ethdev: add namespace")
Fixes 808a17b3c1e6 ("net/ice: add Rx AVX512 offload path")
Signed-off-by Mingjin Ye <[email protected]>
v3:
* Fix macros in ice_rxtx_vec_sse.c source file.
v4:
* Fix ice_rx_desc_to_olflags_v define in ice_rxtx_vec_sse.c source file.
--- drivers/net/ice/ice_rxtx_vec_avx2.c | 135 +++++++++++++++++----- drivers/net/ice/ice_rxtx_vec_avx512.c | 154 +++++++++++++++++++++----- drivers/net/ice/ice_rxtx_vec_sse.c | 132 ++++++++++++++++------ 3 files changed, 332 insertions(+), 89 deletions(-)
drivers/net/ice/ice_rxtx_vec_avx2.c +107 -28
@@ -474,7 +474,7 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,* will cause performance drop to get into this context. */ if (rxq->vsi->adapter->pf.dev_data->dev_conf.rxmode.offloads & -RTE_ETH_RX_OFFLOAD_RSS_HASH ) { + (RTE_ETH_RX_OFFLOAD_RSS_HASH |RTE_ETH_RX_OFFLOAD_VLAN )) {/* load bottom half of every 32B desc */ const __m128i raw_desc_bh7 = _mm_load_si128
@@ -529,33 +529,112 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,* to shift the 32b RSS hash value to the * highest 32b of each 128b before mask */ -__m256i rss_hash6_7 = -_mm256_slli_epi64 (raw_desc_bh6_7,32 ); -__m256i rss_hash4_5 = -_mm256_slli_epi64 (raw_desc_bh4_5,32 ); -__m256i rss_hash2_3 = -_mm256_slli_epi64 (raw_desc_bh2_3,32 ); -__m256i rss_hash0_1 = -_mm256_slli_epi64 (raw_desc_bh0_1,32 ); - -__m256i rss_hash_msk = -_mm256_set_epi32 (0xFFFFFFFF ,0 ,0 ,0 , -0xFFFFFFFF ,0 ,0 ,0 ); - - rss_hash6_7 =_mm256_and_si256 - (rss_hash6_7, rss_hash_msk); - rss_hash4_5 =_mm256_and_si256 - (rss_hash4_5, rss_hash_msk); - rss_hash2_3 =_mm256_and_si256 - (rss_hash2_3, rss_hash_msk); - rss_hash0_1 =_mm256_and_si256 - (rss_hash0_1, rss_hash_msk); - - mb6_7 =_mm256_or_si256 (mb6_7, rss_hash6_7); - mb4_5 =_mm256_or_si256 (mb4_5, rss_hash4_5); - mb2_3 =_mm256_or_si256 (mb2_3, rss_hash2_3); - mb0_1 = _mm256_or_si256(mb0_1, rss_hash0_1); - }/* if() on RSS hash parsing */ +if (rxq->vsi->adapter->pf.dev_data->dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_RSS_HASH ) { +__m256i rss_hash6_7 = +_mm256_slli_epi64 (raw_desc_bh6_7,32 ); +__m256i rss_hash4_5 = +_mm256_slli_epi64 (raw_desc_bh4_5,32 ); +__m256i rss_hash2_3 = +_mm256_slli_epi64 (raw_desc_bh2_3,32 ); +__m256i rss_hash0_1 = +_mm256_slli_epi64 (raw_desc_bh0_1,32 ); + +__m256i rss_hash_msk = +_mm256_set_epi32 (0xFFFFFFFF ,0 ,0 ,0 , +0xFFFFFFFF ,0 ,0 ,0 ); + + rss_hash6_7 =_mm256_and_si256 + (rss_hash6_7, rss_hash_msk); + rss_hash4_5 =_mm256_and_si256 + (rss_hash4_5, rss_hash_msk); + rss_hash2_3 =_mm256_and_si256 + (rss_hash2_3, rss_hash_msk); + rss_hash0_1 =_mm256_and_si256 + (rss_hash0_1, rss_hash_msk); + + mb6_7 =_mm256_or_si256 (mb6_7, rss_hash6_7); + mb4_5 =_mm256_or_si256 (mb4_5, rss_hash4_5); + mb2_3 =_mm256_or_si256 (mb2_3, rss_hash2_3); + mb0_1 =_mm256_or_si256 (mb0_1, rss_hash0_1); + }/* if() on RSS hash parsing */ + +if (rxq->vsi->adapter->pf.dev_data->dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_VLAN ) { +/* merge the status/error-1 bits into one register */ +const __m256i status1_4_7 = +_mm256_unpacklo_epi32 (raw_desc_bh6_7, + raw_desc_bh4_5); +const __m256i status1_0_3 = +_mm256_unpacklo_epi32 (raw_desc_bh2_3, + raw_desc_bh0_1); + +const __m256i status1_0_7 = +_mm256_unpacklo_epi64 (status1_4_7, + status1_0_3); + +const __m256i l2tag2p_flag_mask = +_mm256_set1_epi32 (1 <<11 ); + +__m256i l2tag2p_flag_bits = +_mm256_and_si256 + (status1_0_7, l2tag2p_flag_mask); + + l2tag2p_flag_bits = +_mm256_srli_epi32 (l2tag2p_flag_bits, +11 ); + +__m256i vlan_flags =_mm256_setzero_si256 (); +const __m256i l2tag2_flags_shuf = +_mm256_set_epi8 (0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , +/* end up 128-bits */ +0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , +0 ,0 , +RTE_MBUF_F_RX_VLAN | +RTE_MBUF_F_RX_VLAN_STRIPPED , +0 ); + vlan_flags = +_mm256_shuffle_epi8 (l2tag2_flags_shuf, + l2tag2p_flag_bits); + +/* merge with vlan_flags */ + mbuf_flags =_mm256_or_si256 + (mbuf_flags, vlan_flags); + +/* L2TAG2_2 */ +__m256i vlan_tci6_7 = +_mm256_slli_si256 (raw_desc_bh6_7,4 ); +__m256i vlan_tci4_5 = +_mm256_slli_si256 (raw_desc_bh4_5,4 ); +__m256i vlan_tci2_3 = +_mm256_slli_si256 (raw_desc_bh2_3,4 ); +__m256i vlan_tci0_1 = +_mm256_slli_si256 (raw_desc_bh0_1,4 ); + +const __m256i vlan_tci_msk = +_mm256_set_epi32 (0 ,0xFFFF0000 ,0 ,0 , +0 ,0xFFFF0000 ,0 ,0 ); + + vlan_tci6_7 =_mm256_and_si256 + (vlan_tci6_7, vlan_tci_msk); + vlan_tci4_5 =_mm256_and_si256 + (vlan_tci4_5, vlan_tci_msk); + vlan_tci2_3 =_mm256_and_si256 + (vlan_tci2_3, vlan_tci_msk); + vlan_tci0_1 =_mm256_and_si256 + (vlan_tci0_1, vlan_tci_msk); + + mb6_7 =_mm256_or_si256 (mb6_7, vlan_tci6_7); + mb4_5 =_mm256_or_si256 (mb4_5, vlan_tci4_5); + mb2_3 =_mm256_or_si256 (mb2_3, vlan_tci2_3); + mb0_1 =_mm256_or_si256 (mb0_1, vlan_tci0_1); + } + }#endif }
drivers/net/ice/ice_rxtx_vec_avx512.c +126 -28
166 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_sse.c +99 -33
181 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v5 2/2 net/ice: fix vlan offload of rxq
After setting "vlan offload" in pmd, the configuration of rxq is not updated.
This patch is to sync the rxmode offload config with rxq.
Fixes e0dcf94a0d7f ("net/ice: support VLAN ops")
Signed-off-by Mingjin Ye <[email protected]>
--- drivers/net/ice/ice_dcf_ethdev.c | 15 +++++++++++++++ drivers/net/ice/ice_ethdev.c | 7 +++++++ 2 files changed, 22 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +15 -0
@@ -1227,6 +1227,8 @@ dcf_dev_vlan_offload_set_v2(struct rte_eth_dev *dev, int mask)struct ice_dcf_hw *hw = &adapter->real_hw;bool enable;int err; +size_t queue_idx; +struct ice_rx_queue *rxq;if (mask &RTE_ETH_VLAN_FILTER_MASK ) { enable = !!(rxmode->offloads &RTE_ETH_RX_OFFLOAD_VLAN_FILTER );
@@ -1245,6 +1247,11 @@ dcf_dev_vlan_offload_set_v2(struct rte_eth_dev *dev, int mask)return -EIO ; } +for (queue_idx =0 ; queue_idx < dev->data->nb_rx_queues; queue_idx++) { + rxq = dev->data->rx_queues[queue_idx]; + rxq->offloads = rxmode->offloads; + } +return 0 ; }
@@ -1287,6 +1294,8 @@ dcf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)struct ice_dcf_adapter *adapter = dev->data->dev_private;struct ice_dcf_hw *hw = &adapter->real_hw;int err; +size_t queue_idx; +struct ice_rx_queue *rxq;if (hw->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_VLAN_V2 )return dcf_dev_vlan_offload_set_v2 (dev, mask);
@@ -1305,6 +1314,12 @@ dcf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)if (err)return -EIO ; } + +for (queue_idx =0 ; queue_idx < dev->data->nb_rx_queues; queue_idx++) { + rxq = dev->data->rx_queues[queue_idx]; + rxq->offloads = dev_conf->rxmode.offloads; + } +return 0 ; }
drivers/net/ice/ice_ethdev.c +7 -0
@@ -4501,6 +4501,8 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)struct ice_pf *pf =ICE_DEV_PRIVATE_TO_PF (dev->data->dev_private);struct ice_vsi *vsi = pf->main_vsi;struct rte_eth_rxmode *rxmode; +size_t queue_idx; +struct ice_rx_queue *rxq; rxmode = &dev->data->dev_conf.rxmode;if (mask &RTE_ETH_VLAN_FILTER_MASK ) {
@@ -4517,6 +4519,11 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)ice_vsi_config_vlan_stripping (vsi, false); } +for (queue_idx =0 ; queue_idx < dev->data->nb_rx_queues; queue_idx++) { + rxq = dev->data->rx_queues[queue_idx]; + rxq->offloads = rxmode->offloads; + } +return 0 ; }
Signature · 1 line
2.34.1