- uint32_t l3, pkt_type = 0;
- uint32_t t_ipcs = 0, ip6 = 0, vlan = 0;
- uint32_t flags_type;
-
- vlan = !!(rxcmp1->flags2 &
- rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN));
- pkt_type |= vlan ? RTE_PTYPE_L2_ETHER_VLAN : RTE_PTYPE_L2_ETHER;
-
- t_ipcs = !!(rxcmp1->flags2 &
- rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC));
- ip6 = !!(rxcmp1->flags2 &
- rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_TYPE));
-
- flags_type = rxcmp->flags_type &
- rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS_ITYPE_MASK);
-
- if (!t_ipcs && !ip6)
- l3 = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
- else if (!t_ipcs && ip6)
- l3 = RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
- else if (t_ipcs && !ip6)
- l3 = RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN;
- else
- l3 = RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN;
-
- switch (flags_type) {
- case RTE_LE32(RX_PKT_CMPL_FLAGS_ITYPE_ICMP):
- if (!t_ipcs)
- pkt_type |= l3 | RTE_PTYPE_L4_ICMP;
- else
- pkt_type |= l3 | RTE_PTYPE_INNER_L4_ICMP;
- break;
-
- case RTE_LE32(RX_PKT_CMPL_FLAGS_ITYPE_TCP):
- if (!t_ipcs)
- pkt_type |= l3 | RTE_PTYPE_L4_TCP;
- else
- pkt_type |= l3 | RTE_PTYPE_INNER_L4_TCP;
- break;
-
- case RTE_LE32(RX_PKT_CMPL_FLAGS_ITYPE_UDP):
- if (!t_ipcs)
- pkt_type |= l3 | RTE_PTYPE_L4_UDP;
- else
- pkt_type |= l3 | RTE_PTYPE_INNER_L4_UDP;
- break;
-
- case RTE_LE32(RX_PKT_CMPL_FLAGS_ITYPE_IP):
- pkt_type |= l3;
- break;
- }
-
- return pkt_type;
+ const __m128i shuf_msk =
+ _mm_set_epi8(15, 14, 13, 12, /* rss */
+ 0xFF, 0xFF, /* vlan_tci (zeroes) */
+ 3, 2, /* data_len */
+ 0xFF, 0xFF, 3, 2, /* pkt_len */
+ 0xFF, 0xFF, 0xFF, 0xFF); /* pkt_type (zeroes) */
+ const __m128i flags_type_mask =
+ _mm_set1_epi32(RX_PKT_CMPL_FLAGS_ITYPE_MASK);
+ const __m128i flags2_mask1 =
+ _mm_set1_epi32(CMPL_FLAGS2_VLAN_TUN_MSK);
+ const __m128i flags2_mask2 =
+ _mm_set1_epi32(RX_PKT_CMPL_FLAGS2_IP_TYPE);
+ 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, is_tunnel;
+ uint32_t ol_flags;
+
+ /* Validate ptype table indexing at build time. */
+ bnxt_check_ptype_constants();
+
+ /* Compute packet type table indexes for four packets */
+ t0 = _mm_unpacklo_epi32(mm_rxcmp[0], mm_rxcmp[1]);
+ t1 = _mm_unpacklo_epi32(mm_rxcmp[2], mm_rxcmp[3]);
+ flags_type = _mm_unpacklo_epi64(t0, t1);
+ ptype_idx = _mm_srli_epi32(_mm_and_si128(flags_type, flags_type_mask),
+ RX_PKT_CMPL_FLAGS_ITYPE_SFT - BNXT_PTYPE_TBL_TYPE_SFT);
+
+ t0 = _mm_unpacklo_epi32(mm_rxcmp1[0], mm_rxcmp1[1]);
+ t1 = _mm_unpacklo_epi32(mm_rxcmp1[2], mm_rxcmp1[3]);
+ flags2 = _mm_unpacklo_epi64(t0, t1);
+
+ ptype_idx = _mm_or_si128(ptype_idx,
+ _mm_srli_epi32(_mm_and_si128(flags2, flags2_mask1),
+ RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT -
+ BNXT_PTYPE_TBL_VLAN_SFT));
+ ptype_idx = _mm_or_si128(ptype_idx,
+ _mm_srli_epi32(_mm_and_si128(flags2, flags2_mask2),
+ RX_PKT_CMPL_FLAGS2_IP_TYPE_SFT -
+ BNXT_PTYPE_TBL_IP_VER_SFT));
+
+ /* Extract RSS valid flags for four packets. */
+ rss_flags = _mm_srli_epi32(_mm_and_si128(flags_type, rss_mask), 9);
+
+ /* Extract errors_v2 fields for four packets. */
+ t0 = _mm_unpackhi_epi32(mm_rxcmp1[0], mm_rxcmp1[1]);
+ 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);
+ errors = _mm_and_si128(errors, _mm_set1_epi32(0xF));
+ 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);
+ _mm_store_si128((void *)&mbuf[0]->rearm_data,
+ _mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
+
+ GET_OL_FLAGS(rss_flags, index, errors, 1, ol_flags);
+ _mm_store_si128((void *)&mbuf[1]->rearm_data,
+ _mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
+
+ GET_OL_FLAGS(rss_flags, index, errors, 2, ol_flags);
+ _mm_store_si128((void *)&mbuf[2]->rearm_data,
+ _mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
+
+ GET_OL_FLAGS(rss_flags, index, errors, 3, ol_flags);
+ _mm_store_si128((void *)&mbuf[3]->rearm_data,
+ _mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
+
+ /* Update mbuf rx_descriptor_fields1 for four packes. */
+ GET_DESC_FIELDS(mm_rxcmp[0], mm_rxcmp1[0], shuf_msk, ptype_idx, 0, t0);
+ _mm_store_si128((void *)&mbuf[0]->rx_descriptor_fields1, t0);
+
+ GET_DESC_FIELDS(mm_rxcmp[1], mm_rxcmp1[1], shuf_msk, ptype_idx, 1, t0);
+ _mm_store_si128((void *)&mbuf[1]->rx_descriptor_fields1, t0);
+
+ GET_DESC_FIELDS(mm_rxcmp[2], mm_rxcmp1[2], shuf_msk, ptype_idx, 2, t0);
+ _mm_store_si128((void *)&mbuf[2]->rx_descriptor_fields1, t0);
+
+ GET_DESC_FIELDS(mm_rxcmp[3], mm_rxcmp1[3], shuf_msk, ptype_idx, 3, t0);
+ _mm_store_si128((void *)&mbuf[3]->rx_descriptor_fields1, t0);