From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Jerin Jacob <jerinj@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/2] net/octeontx2: fix ptype translation logic
Date: Wed, 4 Sep 2019 13:34:31 +0530 [thread overview]
Message-ID: <20190904080433.177220-1-ndabilpuram@marvell.com> (raw)
Extract and use layer type LB..LE for non-tunnel ptype and
LF..LH as tunnel ptype translation.
Fixes: 6e892eabce11 ("net/octeontx2: support packet type")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
drivers/net/octeontx2/otx2_lookup.c | 22 ++++++++++++----------
drivers/net/octeontx2/otx2_rx.h | 15 ++++++++-------
2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/drivers/net/octeontx2/otx2_lookup.c b/drivers/net/octeontx2/otx2_lookup.c
index 99199d0..13c26a9 100644
--- a/drivers/net/octeontx2/otx2_lookup.c
+++ b/drivers/net/octeontx2/otx2_lookup.c
@@ -78,7 +78,8 @@ static void
nix_create_non_tunnel_ptype_array(uint16_t *ptype)
{
uint8_t lb, lc, ld, le;
- uint16_t idx, val;
+ uint16_t val;
+ uint32_t idx;
for (idx = 0; idx < PTYPE_NON_TUNNEL_ARRAY_SZ; idx++) {
lb = idx & 0xF;
@@ -180,28 +181,29 @@ nix_create_non_tunnel_ptype_array(uint16_t *ptype)
}
}
-#define TU_SHIFT(x) ((x) >> PTYPE_WIDTH)
+#define TU_SHIFT(x) ((x) >> PTYPE_NON_TUNNEL_WIDTH)
static void
nix_create_tunnel_ptype_array(uint16_t *ptype)
{
- uint8_t le, lf, lg;
- uint16_t idx, val;
+ uint8_t lf, lg, lh;
+ uint16_t val;
+ uint32_t idx;
/* Skip non tunnel ptype array memory */
ptype = ptype + PTYPE_NON_TUNNEL_ARRAY_SZ;
for (idx = 0; idx < PTYPE_TUNNEL_ARRAY_SZ; idx++) {
- le = idx & 0xF;
- lf = (idx & 0xF0) >> 4;
- lg = (idx & 0xF00) >> 8;
+ lf = idx & 0xF;
+ lg = (idx & 0xF0) >> 4;
+ lh = (idx & 0xF00) >> 8;
val = RTE_PTYPE_UNKNOWN;
- switch (le) {
+ switch (lf) {
case NPC_LT_LF_TU_ETHER:
val |= TU_SHIFT(RTE_PTYPE_INNER_L2_ETHER);
break;
}
- switch (lf) {
+ switch (lg) {
case NPC_LT_LG_TU_IP:
val |= TU_SHIFT(RTE_PTYPE_INNER_L3_IPV4);
break;
@@ -209,7 +211,7 @@ nix_create_tunnel_ptype_array(uint16_t *ptype)
val |= TU_SHIFT(RTE_PTYPE_INNER_L3_IPV6);
break;
}
- switch (lg) {
+ switch (lh) {
case NPC_LT_LH_TU_TCP:
val |= TU_SHIFT(RTE_PTYPE_INNER_L4_TCP);
break;
diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h
index d12e8b8..1a1ac40 100644
--- a/drivers/net/octeontx2/otx2_rx.h
+++ b/drivers/net/octeontx2/otx2_rx.h
@@ -8,9 +8,10 @@
/* Default mark value used when none is provided. */
#define OTX2_FLOW_ACTION_FLAG_DEFAULT 0xffff
-#define PTYPE_WIDTH 12
-#define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_WIDTH)
-#define PTYPE_TUNNEL_ARRAY_SZ BIT(PTYPE_WIDTH)
+#define PTYPE_NON_TUNNEL_WIDTH 16
+#define PTYPE_TUNNEL_WIDTH 12
+#define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_NON_TUNNEL_WIDTH)
+#define PTYPE_TUNNEL_ARRAY_SZ BIT(PTYPE_TUNNEL_WIDTH)
#define PTYPE_ARRAY_SZ ((PTYPE_NON_TUNNEL_ARRAY_SZ +\
PTYPE_TUNNEL_ARRAY_SZ) *\
sizeof(uint16_t))
@@ -97,11 +98,11 @@ static __rte_always_inline uint32_t
nix_ptype_get(const void * const lookup_mem, const uint64_t in)
{
const uint16_t * const ptype = lookup_mem;
- const uint16_t lg_lf_le = (in & 0xFFF000000000000) >> 48;
- const uint16_t tu_l2 = ptype[(in & 0x000FFF000000000) >> 36];
- const uint16_t il4_tu = ptype[PTYPE_NON_TUNNEL_ARRAY_SZ + lg_lf_le];
+ const uint16_t lh_lg_lf = (in & 0xFFF0000000000000) >> 52;
+ const uint16_t tu_l2 = ptype[(in & 0x000FFFF000000000) >> 36];
+ const uint16_t il4_tu = ptype[PTYPE_NON_TUNNEL_ARRAY_SZ + lh_lg_lf];
- return (il4_tu << PTYPE_WIDTH) | tu_l2;
+ return (il4_tu << PTYPE_NON_TUNNEL_WIDTH) | tu_l2;
}
static __rte_always_inline uint32_t
--
2.8.4
next reply other threads:[~2019-09-04 8:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 8:04 Nithin Dabilpuram [this message]
2019-09-04 8:04 ` [dpdk-dev] [PATCH 2/2] net/octeontx2: add ptype translation for ICMP6 Nithin Dabilpuram
2019-09-23 8:20 ` [dpdk-dev] [PATCH 1/2] net/octeontx2: fix ptype translation logic Jerin Jacob
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=20190904080433.177220-1-ndabilpuram@marvell.com \
--to=ndabilpuram@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.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 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).