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.

Fixes: 4f8259df563a ("net/iavf: enable Tx outer checksum offload on AVX512")
Fixes: 70baceadabf2 ("net/iavf: fix AVX512 Tx")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
---
 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(-)

diff --git a/drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c 
b/drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c
index 715805c65a..d05e6101ad 100644
--- a/drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c
+++ b/drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c
@@ -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 =
diff --git a/drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c 
b/drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c
index dfbbea80f7..bae9b2af9c 100644
--- a/drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c
+++ b/drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c
@@ -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

Reply via email to