net/mlx5: fix metadata for compressed Rx CQEs
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>
Tue, 24 Mar 2020 12:15:18 +0000 (12:15 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Apr 2020 11:57:05 +0000 (13:57 +0200)
If packets with the same metadata are received with compressed CQE
the metadata value is not copied from the title packet in vectorized
rx_burst routines, it causes wrong metadata values seeing by
applications.

Fixes: a18ac6113331 ("net/mlx5: add metadata support to Rx datapath")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
drivers/net/mlx5/mlx5_rxtx_vec_neon.h
drivers/net/mlx5/mlx5_rxtx_vec_sse.h

index 8e8d59a..d55642e 100644 (file)
@@ -263,6 +263,19 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq,
                        elts[pos + 2]->hash.fdir.hi = flow_tag;
                        elts[pos + 3]->hash.fdir.hi = flow_tag;
                }
+               if (rte_flow_dynf_metadata_avail()) {
+                       const uint32_t meta = *RTE_FLOW_DYNF_METADATA(t_pkt);
+
+                       /* Check if title packet has valid metadata. */
+                       if (meta) {
+                               MLX5_ASSERT(t_pkt->ol_flags &
+                                           PKT_RX_DYNF_METADATA);
+                               *RTE_FLOW_DYNF_METADATA(elts[pos]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 1]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 2]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 3]) = meta;
+                       }
+               }
 
                pos += MLX5_VPMD_DESCS_PER_LOOP;
                /* Move to next CQE and invalidate consumed CQEs. */
index 6d952df..701e5e0 100644 (file)
@@ -205,6 +205,19 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq,
                        elts[pos + 2]->hash.fdir.hi = flow_tag;
                        elts[pos + 3]->hash.fdir.hi = flow_tag;
                }
+               if (rte_flow_dynf_metadata_avail()) {
+                       const uint32_t meta = *RTE_FLOW_DYNF_METADATA(t_pkt);
+
+                       /* Check if title packet has valid metadata. */
+                       if (meta) {
+                               MLX5_ASSERT(t_pkt->ol_flags &
+                                           PKT_RX_DYNF_METADATA);
+                               *RTE_FLOW_DYNF_METADATA(elts[pos]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 1]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 2]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 3]) = meta;
+                       }
+               }
                pos += MLX5_VPMD_DESCS_PER_LOOP;
                /* Move to next CQE and invalidate consumed CQEs. */
                if (!(pos & 0x7) && pos < mcqe_n) {
index 406f23f..a4086df 100644 (file)
@@ -118,7 +118,6 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq,
                             14, 15,  6,  7,
                             10, 11,  2,  3);
 #endif
-
        /*
         * A. load mCQEs into a 128bit register.
         * B. store rearm data to mbuf.
@@ -191,6 +190,19 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq,
                        elts[pos + 2]->hash.fdir.hi = flow_tag;
                        elts[pos + 3]->hash.fdir.hi = flow_tag;
                }
+               if (rte_flow_dynf_metadata_avail()) {
+                       const uint32_t meta = *RTE_FLOW_DYNF_METADATA(t_pkt);
+
+                       /* Check if title packet has valid metadata. */
+                       if (meta) {
+                               MLX5_ASSERT(t_pkt->ol_flags &
+                                           PKT_RX_DYNF_METADATA);
+                               *RTE_FLOW_DYNF_METADATA(elts[pos]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 1]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 2]) = meta;
+                               *RTE_FLOW_DYNF_METADATA(elts[pos + 3]) = meta;
+                       }
+               }
                pos += MLX5_VPMD_DESCS_PER_LOOP;
                /* Move to next CQE and invalidate consumed CQEs. */
                if (!(pos & 0x7) && pos < mcqe_n) {