From: Lance Richardson <lance.richardson@broadcom.com>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>,
Somnath Kotur <somnath.kotur@broadcom.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 09/12] net/bnxt: table-based handling for ol flags
Date: Wed, 9 Sep 2020 11:53:02 -0400 [thread overview]
Message-ID: <20200909155302.28656-10-lance.richardson@broadcom.com> (raw)
In-Reply-To: <20200909155302.28656-1-lance.richardson@broadcom.com>
Use table to translate receive descriptor status flags to
rte_mbuf ol_flags values.
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
drivers/net/bnxt/bnxt_rxr.c | 166 ++++++++++++++++----------
drivers/net/bnxt/bnxt_rxr.h | 6 +
drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 99 ++++++---------
drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 96 ++++++---------
4 files changed, 181 insertions(+), 186 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index a882dd20be..33bd006530 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -406,6 +406,95 @@ bnxt_parse_pkt_type(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1)
return bnxt_ptype_table[index];
}
+uint32_t
+bnxt_ol_flags_table[BNXT_OL_FLAGS_TBL_DIM] __rte_cache_aligned;
+
+uint32_t
+bnxt_ol_flags_err_table[BNXT_OL_FLAGS_ERR_TBL_DIM] __rte_cache_aligned;
+
+static void __rte_cold
+bnxt_init_ol_flags_tables(void)
+{
+ static bool initialized;
+ uint32_t *pt;
+ int i;
+
+ if (initialized)
+ return;
+
+ /* Initialize ol_flags table. */
+ pt = bnxt_ol_flags_table;
+ for (i = 0; i < BNXT_OL_FLAGS_TBL_DIM; i++) {
+ pt[i] = 0;
+ if (i & RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN)
+ pt[i] |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
+
+ if (i & RX_PKT_CMPL_FLAGS2_IP_CS_CALC)
+ pt[i] |= PKT_RX_IP_CKSUM_GOOD;
+
+ if (i & RX_PKT_CMPL_FLAGS2_L4_CS_CALC)
+ pt[i] |= PKT_RX_L4_CKSUM_GOOD;
+
+ if (i & RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC)
+ pt[i] |= PKT_RX_OUTER_L4_CKSUM_GOOD;
+ }
+
+ /* Initialize checksum error table. */
+ pt = bnxt_ol_flags_err_table;
+ for (i = 0; i < BNXT_OL_FLAGS_ERR_TBL_DIM; i++) {
+ pt[i] = 0;
+ if (i & (RX_PKT_CMPL_ERRORS_IP_CS_ERROR >> 4))
+ pt[i] |= PKT_RX_IP_CKSUM_BAD;
+
+ if (i & (RX_PKT_CMPL_ERRORS_L4_CS_ERROR >> 4))
+ pt[i] |= PKT_RX_L4_CKSUM_BAD;
+
+ if (i & (RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR >> 4))
+ pt[i] |= PKT_RX_EIP_CKSUM_BAD;
+
+ if (i & (RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR >> 4))
+ pt[i] |= PKT_RX_OUTER_L4_CKSUM_BAD;
+ }
+
+ initialized = true;
+}
+
+static void
+bnxt_set_ol_flags(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1,
+ struct rte_mbuf *mbuf)
+{
+ uint16_t flags_type, errors, flags;
+ uint64_t ol_flags;
+
+ flags_type = rte_le_to_cpu_16(rxcmp->flags_type);
+
+ flags = rte_le_to_cpu_32(rxcmp1->flags2) &
+ (RX_PKT_CMPL_FLAGS2_IP_CS_CALC |
+ RX_PKT_CMPL_FLAGS2_L4_CS_CALC |
+ RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC |
+ RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC |
+ RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN);
+
+ errors = rte_le_to_cpu_16(rxcmp1->errors_v2) &
+ (RX_PKT_CMPL_ERRORS_IP_CS_ERROR |
+ RX_PKT_CMPL_ERRORS_L4_CS_ERROR |
+ RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR |
+ RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR);
+ errors = (errors >> 4) & flags;
+
+ ol_flags = bnxt_ol_flags_table[flags & ~errors];
+
+ if (errors)
+ ol_flags |= bnxt_ol_flags_err_table[errors];
+
+ if (flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID) {
+ mbuf->hash.rss = rte_le_to_cpu_32(rxcmp->rss_hash);
+ ol_flags |= PKT_RX_RSS_HASH;
+ }
+
+ mbuf->ol_flags = ol_flags;
+}
+
#ifdef RTE_LIBRTE_IEEE1588
static void
bnxt_get_rx_ts_thor(struct bnxt *bp, uint32_t rx_ts_cmpl)
@@ -583,8 +672,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
int rc = 0;
uint8_t agg_buf = 0;
uint16_t cmp_type;
- uint32_t flags2_f = 0, vfr_flag = 0, mark_id = 0;
- uint16_t flags_type;
+ uint32_t vfr_flag = 0, mark_id = 0;
struct bnxt *bp = rxq->bp;
rxcmp = (struct rx_pkt_cmpl *)
@@ -653,13 +741,17 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
mbuf->pkt_len = rxcmp->len;
mbuf->data_len = mbuf->pkt_len;
mbuf->port = rxq->port_id;
- mbuf->ol_flags = 0;
- flags_type = rte_le_to_cpu_16(rxcmp->flags_type);
- if (flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID) {
- mbuf->hash.rss = rxcmp->rss_hash;
- mbuf->ol_flags |= PKT_RX_RSS_HASH;
+ bnxt_set_ol_flags(rxcmp, rxcmp1, mbuf);
+
+#ifdef RTE_LIBRTE_IEEE1588
+ if (unlikely((rte_le_to_cpu_16(rxcmp->flags_type) &
+ RX_PKT_CMPL_FLAGS_MASK) ==
+ RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP)) {
+ mbuf->ol_flags |= PKT_RX_IEEE1588_PTP | PKT_RX_IEEE1588_TMST;
+ bnxt_get_rx_ts_thor(rxq->bp, rxcmp1->reorder);
}
+#endif
if (BNXT_TRUFLOW_EN(bp))
mark_id = bnxt_ulp_set_mark_in_mbuf(rxq->bp, rxcmp1, mbuf,
@@ -667,66 +759,9 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
else
bnxt_set_mark_in_mbuf(rxq->bp, rxcmp1, mbuf);
-#ifdef RTE_LIBRTE_IEEE1588
- if (unlikely((flags_type & RX_PKT_CMPL_FLAGS_MASK) ==
- RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP)) {
- mbuf->ol_flags |= PKT_RX_IEEE1588_PTP | PKT_RX_IEEE1588_TMST;
- bnxt_get_rx_ts_thor(rxq->bp, rxcmp1->reorder);
- }
-#endif
if (agg_buf)
bnxt_rx_pages(rxq, mbuf, &tmp_raw_cons, agg_buf, NULL);
- if (rxcmp1->flags2 & RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN) {
- mbuf->vlan_tci = rxcmp1->metadata &
- (RX_PKT_CMPL_METADATA_VID_MASK |
- RX_PKT_CMPL_METADATA_DE |
- RX_PKT_CMPL_METADATA_PRI_MASK);
- mbuf->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
- }
-
- flags2_f = flags2_0xf(rxcmp1);
- /* IP Checksum */
- if (likely(IS_IP_NONTUNNEL_PKT(flags2_f))) {
- if (unlikely(RX_CMP_IP_CS_ERROR(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
- else if (unlikely(RX_CMP_IP_CS_UNKNOWN(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
- else
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
- } else if (IS_IP_TUNNEL_PKT(flags2_f)) {
- if (unlikely(RX_CMP_IP_OUTER_CS_ERROR(rxcmp1) ||
- RX_CMP_IP_CS_ERROR(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
- else if (unlikely(RX_CMP_IP_CS_UNKNOWN(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
- else
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
- }
-
- /* L4 Checksum */
- if (likely(IS_L4_NONTUNNEL_PKT(flags2_f))) {
- if (unlikely(RX_CMP_L4_INNER_CS_ERR2(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
- } else if (IS_L4_TUNNEL_PKT(flags2_f)) {
- if (unlikely(RX_CMP_L4_INNER_CS_ERR2(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
- if (unlikely(RX_CMP_L4_OUTER_CS_ERR2(rxcmp1))) {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
- } else if (unlikely(IS_L4_TUNNEL_PKT_ONLY_INNER_L4_CS
- (flags2_f))) {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_UNKNOWN;
- } else {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
- }
- } else if (unlikely(RX_CMP_L4_CS_UNKNOWN(rxcmp1))) {
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
- }
-
mbuf->packet_type = bnxt_parse_pkt_type(rxcmp, rxcmp1);
#ifdef BNXT_DEBUG
@@ -1075,6 +1110,9 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
/* Initialize packet type table. */
bnxt_init_ptype_table();
+ /* Initialize offload flags parsing table. */
+ bnxt_init_ol_flags_tables();
+
size = rte_pktmbuf_data_room_size(rxq->mb_pool) - RTE_PKTMBUF_HEADROOM;
size = RTE_MIN(BNXT_MAX_PKT_LEN, size);
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index 0e21c8f900..4f5e23b855 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -240,4 +240,10 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
#define BNXT_PTYPE_TBL_DIM 128
extern uint32_t bnxt_ptype_table[BNXT_PTYPE_TBL_DIM];
+
+#define BNXT_OL_FLAGS_TBL_DIM 32
+extern uint32_t bnxt_ol_flags_table[BNXT_OL_FLAGS_TBL_DIM];
+
+#define BNXT_OL_FLAGS_ERR_TBL_DIM 16
+extern uint32_t bnxt_ol_flags_err_table[BNXT_OL_FLAGS_ERR_TBL_DIM];
#endif
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index fade67ec8e..37b8c83656 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -116,50 +116,28 @@ bnxt_parse_pkt_type(uint32x4_t mm_rxcmp, uint32x4_t mm_rxcmp1)
return bnxt_ptype_table[index];
}
-static void
-bnxt_parse_csum(struct rte_mbuf *mbuf, struct rx_pkt_cmpl_hi *rxcmp1)
+static uint32_t
+bnxt_set_ol_flags(uint32x4_t mm_rxcmp, uint32x4_t mm_rxcmp1)
{
- uint32_t flags;
+ uint16_t flags_type, errors, flags;
+ uint32_t ol_flags;
- flags = flags2_0xf(rxcmp1);
- /* IP Checksum */
- if (likely(IS_IP_NONTUNNEL_PKT(flags))) {
- if (unlikely(RX_CMP_IP_CS_ERROR(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
- } else if (IS_IP_TUNNEL_PKT(flags)) {
- if (unlikely(RX_CMP_IP_OUTER_CS_ERROR(rxcmp1) ||
- RX_CMP_IP_CS_ERROR(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
- } else if (unlikely(RX_CMP_IP_CS_UNKNOWN(rxcmp1))) {
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
- }
+ /* Extract rxcmp1->flags2. */
+ flags = vgetq_lane_u32(mm_rxcmp1, 0) & 0x1F;
+ /* Extract rxcmp->flags_type. */
+ flags_type = vgetq_lane_u32(mm_rxcmp, 0);
+ /* Extract rxcmp1->errors_v2. */
+ errors = (vgetq_lane_u32(mm_rxcmp1, 2) >> 4) & flags & 0xF;
- /* L4 Checksum */
- if (likely(IS_L4_NONTUNNEL_PKT(flags))) {
- if (unlikely(RX_CMP_L4_INNER_CS_ERR2(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
- } else if (IS_L4_TUNNEL_PKT(flags)) {
- if (unlikely(RX_CMP_L4_INNER_CS_ERR2(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
- if (unlikely(RX_CMP_L4_OUTER_CS_ERR2(rxcmp1))) {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
- } else if (unlikely(IS_L4_TUNNEL_PKT_ONLY_INNER_L4_CS
- (flags))) {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_UNKNOWN;
- } else {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
- }
- } else if (unlikely(RX_CMP_L4_CS_UNKNOWN(rxcmp1))) {
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
- }
+ ol_flags = bnxt_ol_flags_table[flags & ~errors];
+
+ if (flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID)
+ ol_flags |= PKT_RX_RSS_HASH;
+
+ if (errors)
+ ol_flags |= bnxt_ol_flags_err_table[errors];
+
+ return ol_flags;
}
uint16_t
@@ -202,10 +180,12 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
for (i = 0; i < nb_pkts; i++) {
uint32x4_t mm_rxcmp, mm_rxcmp1;
struct rx_pkt_cmpl_hi *rxcmp1;
+ uint32x4_t pkt_mb, rearm;
+ uint32_t ptype, ol_flags;
struct rte_mbuf *mbuf;
- uint32x4_t pkt_mb;
+ uint16_t vlan_tci;
+ uint16x8_t tmp16;
uint8x16_t tmp;
- uint32_t ptype;
cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
@@ -224,33 +204,30 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
rte_prefetch0(mbuf);
rxr->rx_buf_ring[cons] = NULL;
- /* Set constant fields from mbuf initializer. */
- vst1q_u64((uint64_t *)&mbuf->rearm_data, mbuf_init);
+ /* Set fields from mbuf initializer and ol_flags. */
+ ol_flags = bnxt_set_ol_flags(mm_rxcmp, mm_rxcmp1);
+ rearm = vsetq_lane_u32(ol_flags,
+ vreinterpretq_u32_u64(mbuf_init), 2);
+ vst1q_u32((uint32_t *)&mbuf->rearm_data, rearm);
/* Set mbuf pkt_len, data_len, and rss_hash fields. */
tmp = vqtbl1q_u8(vreinterpretq_u8_u32(mm_rxcmp), shuf_msk);
pkt_mb = vreinterpretq_u32_u8(tmp);
+
+ /* Set packet type. */
ptype = bnxt_parse_pkt_type(mm_rxcmp, mm_rxcmp1);
pkt_mb = vsetq_lane_u32(ptype, pkt_mb, 0);
- vst1q_u32((uint32_t *)&mbuf->rx_descriptor_fields1, pkt_mb);
+ /* Set vlan_tci. */
+ vlan_tci = vgetq_lane_u32(mm_rxcmp1, 1);
+ tmp16 = vsetq_lane_u16(vlan_tci,
+ vreinterpretq_u16_u32(pkt_mb),
+ 5);
+ pkt_mb = vreinterpretq_u32_u16(tmp16);
- rte_compiler_barrier();
-
- if (rxcmp->flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID)
- mbuf->ol_flags |= PKT_RX_RSS_HASH;
-
- if (rxcmp1->flags2 &
- RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN) {
- mbuf->vlan_tci = rxcmp1->metadata &
- (RX_PKT_CMPL_METADATA_VID_MASK |
- RX_PKT_CMPL_METADATA_DE |
- RX_PKT_CMPL_METADATA_PRI_MASK);
- mbuf->ol_flags |=
- PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
- }
+ /* Store descriptor fields. */
+ vst1q_u32((uint32_t *)&mbuf->rx_descriptor_fields1, pkt_mb);
- bnxt_parse_csum(mbuf, rxcmp1);
rx_pkts[nb_rx_pkts++] = mbuf;
}
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 69ffbe4cc9..761d835963 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -120,50 +120,28 @@ bnxt_parse_pkt_type(__m128i mm_rxcmp, __m128i mm_rxcmp1)
return _mm_set_epi32(0, 0, 0, bnxt_ptype_table[index]);
}
-static void
-bnxt_parse_csum(struct rte_mbuf *mbuf, struct rx_pkt_cmpl_hi *rxcmp1)
+static __m128i
+bnxt_set_ol_flags(__m128i mm_rxcmp, __m128i mm_rxcmp1)
{
- uint32_t flags;
+ uint16_t flags_type, errors, flags;
+ uint32_t ol_flags;
- flags = flags2_0xf(rxcmp1);
- /* IP Checksum */
- if (likely(IS_IP_NONTUNNEL_PKT(flags))) {
- if (unlikely(RX_CMP_IP_CS_ERROR(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
- } else if (IS_IP_TUNNEL_PKT(flags)) {
- if (unlikely(RX_CMP_IP_OUTER_CS_ERROR(rxcmp1) ||
- RX_CMP_IP_CS_ERROR(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
- } else if (unlikely(RX_CMP_IP_CS_UNKNOWN(rxcmp1))) {
- mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
- }
+ /* Extract rxcmp1->flags2. */
+ flags = _mm_extract_epi32(mm_rxcmp1, 0) & 0x1F;
+ /* Extract rxcmp->flags_type. */
+ flags_type = _mm_extract_epi16(mm_rxcmp, 0);
+ /* Extract rxcmp1->errors_v2. */
+ errors = (_mm_extract_epi16(mm_rxcmp1, 4) >> 4) & flags & 0xF;
- /* L4 Checksum */
- if (likely(IS_L4_NONTUNNEL_PKT(flags))) {
- if (unlikely(RX_CMP_L4_INNER_CS_ERR2(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
- } else if (IS_L4_TUNNEL_PKT(flags)) {
- if (unlikely(RX_CMP_L4_INNER_CS_ERR2(rxcmp1)))
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
- else
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
- if (unlikely(RX_CMP_L4_OUTER_CS_ERR2(rxcmp1))) {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_BAD;
- } else if (unlikely(IS_L4_TUNNEL_PKT_ONLY_INNER_L4_CS
- (flags))) {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_UNKNOWN;
- } else {
- mbuf->ol_flags |= PKT_RX_OUTER_L4_CKSUM_GOOD;
- }
- } else if (unlikely(RX_CMP_L4_CS_UNKNOWN(rxcmp1))) {
- mbuf->ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
- }
+ ol_flags = bnxt_ol_flags_table[flags & ~errors];
+
+ if (flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID)
+ ol_flags |= PKT_RX_RSS_HASH;
+
+ if (errors)
+ ol_flags |= bnxt_ol_flags_err_table[errors];
+
+ return _mm_set_epi64x(ol_flags, 0);
}
uint16_t
@@ -208,7 +186,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
for (i = 0; i < nb_pkts; i++) {
struct rx_pkt_cmpl_hi *rxcmp1;
struct rte_mbuf *mbuf;
- __m128i mm_rxcmp, mm_rxcmp1, pkt_mb, ptype;
+ __m128i mm_rxcmp, mm_rxcmp1, pkt_mb, ptype, rearm;
cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
@@ -225,35 +203,31 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
cons = rxcmp->opaque;
mbuf = rxr->rx_buf_ring[cons];
- rte_prefetch0(mbuf);
rxr->rx_buf_ring[cons] = NULL;
- /* Set constant fields from mbuf initializer. */
- _mm_store_si128((__m128i *)&mbuf->rearm_data, mbuf_init);
+ /* Set fields from mbuf initializer and ol_flags. */
+ rearm = _mm_or_si128(mbuf_init,
+ bnxt_set_ol_flags(mm_rxcmp, mm_rxcmp1));
+ _mm_store_si128((__m128i *)&mbuf->rearm_data, rearm);
/* Set mbuf pkt_len, data_len, and rss_hash fields. */
pkt_mb = _mm_shuffle_epi8(mm_rxcmp, shuf_msk);
+
+ /* Set packet type. */
ptype = bnxt_parse_pkt_type(mm_rxcmp, mm_rxcmp1);
pkt_mb = _mm_blend_epi16(pkt_mb, ptype, 0x3);
- _mm_storeu_si128((void *)&mbuf->rx_descriptor_fields1, pkt_mb);
+ /*
+ * Shift vlan_tci from completion metadata field left six
+ * bytes and blend into mbuf->rx_descriptor_fields1 to set
+ * mbuf->vlan_tci.
+ */
+ pkt_mb = _mm_blend_epi16(pkt_mb,
+ _mm_slli_si128(mm_rxcmp1, 6), 0x20);
- rte_compiler_barrier();
-
- if (rxcmp->flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID)
- mbuf->ol_flags |= PKT_RX_RSS_HASH;
-
- if (rxcmp1->flags2 &
- RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN) {
- mbuf->vlan_tci = rxcmp1->metadata &
- (RX_PKT_CMPL_METADATA_VID_MASK |
- RX_PKT_CMPL_METADATA_DE |
- RX_PKT_CMPL_METADATA_PRI_MASK);
- mbuf->ol_flags |=
- PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
- }
+ /* Store descriptor fields. */
+ _mm_storeu_si128((void *)&mbuf->rx_descriptor_fields1, pkt_mb);
- bnxt_parse_csum(mbuf, rxcmp1);
rx_pkts[nb_rx_pkts++] = mbuf;
}
--
2.25.1
next prev parent reply other threads:[~2020-09-09 15:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 15:52 [dpdk-dev] [PATCH 00/12] net/bnxt: vector PMD improvements Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 01/12] net/bnxt: fix burst mode get for Arm Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 02/12] net/bnxt: fix rxq/txq get information Lance Richardson
2020-09-11 14:41 ` Ferruh Yigit
2020-09-18 18:41 ` Lance Richardson
2020-09-21 11:05 ` Ferruh Yigit
2020-09-09 15:52 ` [dpdk-dev] [PATCH 03/12] net/bnxt: use appropriate type for Rx mbuf ring Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 04/12] net/bnxt: require async cq for vector mode Lance Richardson
2020-09-11 15:02 ` Ferruh Yigit
2020-09-11 15:07 ` Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 05/12] net/bnxt: improve support for small ring sizes Lance Richardson
2020-09-14 22:03 ` Ferruh Yigit
2020-09-15 14:12 ` Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 06/12] net/bnxt: use smaller cq when agg ring not needed Lance Richardson
2020-09-09 15:53 ` [dpdk-dev] [PATCH 07/12] net/bnxt: increase max burst size for vector mode Lance Richardson
2020-09-11 15:19 ` Ferruh Yigit
2020-09-11 15:38 ` Lance Richardson
2020-09-11 15:56 ` Ferruh Yigit
2020-09-09 15:53 ` [dpdk-dev] [PATCH 08/12] net/bnxt: use table-based packet type translation Lance Richardson
2020-09-09 15:53 ` Lance Richardson [this message]
2020-09-11 3:42 ` [dpdk-dev] [PATCH 00/12] net/bnxt: vector PMD improvements Ajit Khaparde
2020-09-11 15:58 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200909155302.28656-10-lance.richardson@broadcom.com \
--to=lance.richardson@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=somnath.kotur@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).