From: Lance Richardson <h.lance.richardson@gmail.com>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Jerin Jacob <jerinj@marvell.com>,
Ruifeng Wang <ruifeng.wang@arm.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Konstantin Ananyev <konstantin.ananyev@intel.com>
Cc: dev@dpdk.org, Lance Richardson <lance.richardson@broadcom.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] net/bnxt: make offload flags mapping per-ring
Date: Fri, 18 Dec 2020 15:28:36 -0500 [thread overview]
Message-ID: <20201218202837.2074736-2-lance604@gmail.com> (raw)
In-Reply-To: <20201218202837.2074736-1-lance604@gmail.com>
From: Lance Richardson <lance.richardson@broadcom.com>
Refactor offload flags mapping table to be dynamic and
per-ring instead of static and global.
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Cc: stable@dpdk.org
---
drivers/net/bnxt/bnxt_rxr.c | 34 +++++++++------------------
drivers/net/bnxt/bnxt_rxr.h | 12 +++++-----
drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 10 ++++----
drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 10 ++++----
4 files changed, 29 insertions(+), 37 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 288b403bf0..1edc8dac43 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -415,24 +415,14 @@ 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)
+bnxt_init_ol_flags_tables(struct bnxt_rx_ring_info *rxr)
{
- static bool initialized;
uint32_t *pt;
int i;
- if (initialized)
- return;
-
/* Initialize ol_flags table. */
- pt = bnxt_ol_flags_table;
+ pt = rxr->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)
@@ -449,7 +439,7 @@ bnxt_init_ol_flags_tables(void)
}
/* Initialize checksum error table. */
- pt = bnxt_ol_flags_err_table;
+ pt = rxr->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))
@@ -464,13 +454,11 @@ bnxt_init_ol_flags_tables(void)
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)
+bnxt_set_ol_flags(struct bnxt_rx_ring_info *rxr, 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;
@@ -491,10 +479,10 @@ bnxt_set_ol_flags(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1,
RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR);
errors = (errors >> 4) & flags;
- ol_flags = bnxt_ol_flags_table[flags & ~errors];
+ ol_flags = rxr->ol_flags_table[flags & ~errors];
if (errors)
- ol_flags |= bnxt_ol_flags_err_table[errors];
+ ol_flags |= rxr->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);
@@ -749,7 +737,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
mbuf->data_len = mbuf->pkt_len;
mbuf->port = rxq->port_id;
- bnxt_set_ol_flags(rxcmp, rxcmp1, mbuf);
+ bnxt_set_ol_flags(rxr, rxcmp, rxcmp1, mbuf);
#ifdef RTE_LIBRTE_IEEE1588
if (unlikely((rte_le_to_cpu_16(rxcmp->flags_type) &
@@ -1127,9 +1115,6 @@ 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);
@@ -1139,6 +1124,9 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
ring = rxr->rx_ring_struct;
bnxt_init_rxbds(ring, type, size);
+ /* Initialize offload flags parsing table. */
+ bnxt_init_ol_flags_tables(rxr);
+
raw_prod = rxr->rx_raw_prod;
for (i = 0; i < ring->ring_size; i++) {
if (unlikely(!rxr->rx_buf_ring[i])) {
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index af6ff0972d..4db1e8761e 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -42,6 +42,9 @@ static inline uint16_t bnxt_tpa_start_agg_id(struct bnxt *bp,
/* Number of descriptors to process per inner loop in vector mode. */
#define RTE_BNXT_DESCS_PER_LOOP 4U
+#define BNXT_OL_FLAGS_TBL_DIM 32
+#define BNXT_OL_FLAGS_ERR_TBL_DIM 16
+
struct bnxt_tpa_info {
struct rte_mbuf *mbuf;
uint16_t len;
@@ -73,6 +76,9 @@ struct bnxt_rx_ring_info {
struct rte_bitmap *ag_bitmap;
struct bnxt_tpa_info *tpa_info;
+
+ uint32_t ol_flags_table[BNXT_OL_FLAGS_TBL_DIM];
+ uint32_t ol_flags_err_table[BNXT_OL_FLAGS_ERR_TBL_DIM];
};
uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -116,10 +122,4 @@ bnxt_cfa_code_dynfield(struct rte_mbuf *mbuf)
#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 81f9a7da2b..d9ac822be8 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -27,11 +27,11 @@
uint32_t tmp, of; \
\
of = vgetq_lane_u32((rss_flags), (pi)) | \
- bnxt_ol_flags_table[vgetq_lane_u32((ol_idx), (pi))]; \
+ rxr->ol_flags_table[vgetq_lane_u32((ol_idx), (pi))]; \
\
tmp = vgetq_lane_u32((errors), (pi)); \
if (tmp) \
- of |= bnxt_ol_flags_err_table[tmp]; \
+ of |= rxr->ol_flags_err_table[tmp]; \
(ol_flags) = of; \
}
@@ -58,7 +58,8 @@
static void
descs_to_mbufs(uint32x4_t mm_rxcmp[4], uint32x4_t mm_rxcmp1[4],
- uint64x2_t mb_init, struct rte_mbuf **mbuf)
+ uint64x2_t mb_init, struct rte_mbuf **mbuf,
+ struct bnxt_rx_ring_info *rxr)
{
const uint8x16_t shuf_msk = {
0xFF, 0xFF, 0xFF, 0xFF, /* pkt_type (zeroes) */
@@ -286,7 +287,8 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
goto out;
}
- descs_to_mbufs(rxcmp, rxcmp1, mb_init, &rx_pkts[nb_rx_pkts]);
+ descs_to_mbufs(rxcmp, rxcmp1, mb_init, &rx_pkts[nb_rx_pkts],
+ rxr);
nb_rx_pkts += num_valid;
if (num_valid < RTE_BNXT_DESCS_PER_LOOP)
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index ce92629ab0..7f5825d333 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -27,11 +27,11 @@
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 */
@@ -268,7 +269,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)
--
2.25.1
next prev parent reply other threads:[~2020-12-18 20:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 20:28 [dpdk-dev] [PATCH 0/2] net/bnxt: fix outer checksum status Lance Richardson
2020-12-18 20:28 ` Lance Richardson [this message]
2020-12-18 20:28 ` [dpdk-dev] [PATCH 2/2] net/bnxt: fix ol_flags " Lance Richardson
2021-01-03 3:42 ` [dpdk-dev] [PATCH 0/2] net/bnxt: fix outer " Ajit Khaparde
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=20201218202837.2074736-2-lance604@gmail.com \
--to=h.lance.richardson@gmail.com \
--cc=ajit.khaparde@broadcom.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=konstantin.ananyev@intel.com \
--cc=lance.richardson@broadcom.com \
--cc=ruifeng.wang@arm.com \
--cc=somnath.kotur@broadcom.com \
--cc=stable@dpdk.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.