net/mvpp2: consider packet type in checksum info
[dpdk.git] / drivers / net / bnxt / bnxt_rxtx_vec_sse.c
index ce92629..7ae6f5c 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
-/* Copyright(c) 2019-2020 Broadcom All rights reserved. */
+/* Copyright(c) 2019-2021 Broadcom All rights reserved. */
 
 #include <inttypes.h>
 #include <stdbool.h>
        uint32_t tmp, of;                                                      \
                                                                               \
        of = _mm_extract_epi32((rss_flags), (pi)) |                            \
-               bnxt_ol_flags_table[_mm_extract_epi32((ol_index), (pi))];      \
+               rxr->ol_flags_table[_mm_extract_epi32((ol_index), (pi))];      \
                                                                               \
        tmp = _mm_extract_epi32((errors), (pi));                               \
        if (tmp)                                                               \
-               of |= bnxt_ol_flags_err_table[tmp];                            \
+               of |= rxr->ol_flags_err_table[tmp];                            \
        (ol_flags) = of;                                                       \
 }
 
@@ -54,7 +54,8 @@
 
 static inline void
 descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4],
-              __m128i mbuf_init, struct rte_mbuf **mbuf)
+              __m128i mbuf_init, struct rte_mbuf **mbuf,
+              struct bnxt_rx_ring_info *rxr)
 {
        const __m128i shuf_msk =
                _mm_set_epi8(15, 14, 13, 12,          /* rss */
@@ -72,7 +73,7 @@ descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4],
        const __m128i rss_mask =
                _mm_set1_epi32(RX_PKT_CMPL_FLAGS_RSS_VALID);
        __m128i t0, t1, flags_type, flags2, index, errors, rss_flags;
-       __m128i ptype_idx;
+       __m128i ptype_idx, is_tunnel;
        uint32_t ol_flags;
 
        /* Compute packet type table indexes for four packets */
@@ -99,6 +100,8 @@ descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4],
        t1 = _mm_unpackhi_epi32(mm_rxcmp1[2], mm_rxcmp1[3]);
 
        /* Compute ol_flags and checksum error indexes for four packets. */
+       is_tunnel = _mm_and_si128(flags2, _mm_set1_epi32(4));
+       is_tunnel = _mm_slli_epi32(is_tunnel, 3);
        flags2 = _mm_and_si128(flags2, _mm_set1_epi32(0x1F));
 
        errors = _mm_srli_epi32(_mm_unpacklo_epi64(t0, t1), 4);
@@ -106,6 +109,8 @@ descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4],
        errors = _mm_and_si128(errors, flags2);
 
        index = _mm_andnot_si128(errors, flags2);
+       errors = _mm_or_si128(errors, _mm_srli_epi32(is_tunnel, 1));
+       index = _mm_or_si128(index, is_tunnel);
 
        /* Update mbuf rearm_data for four packets. */
        GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
@@ -268,7 +273,8 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
                        goto out;
                }
 
-               descs_to_mbufs(rxcmp, rxcmp1, mbuf_init, &rx_pkts[nb_rx_pkts]);
+               descs_to_mbufs(rxcmp, rxcmp1, mbuf_init, &rx_pkts[nb_rx_pkts],
+                              rxr);
                nb_rx_pkts += num_valid;
 
                if (num_valid < RTE_BNXT_DESCS_PER_LOOP)