From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
Qin Ke <qin.ke@corigine.com>,
Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 1/2] net/nfp: report outer L3 packet type by Rx descriptor
Date: Mon, 5 Jun 2023 11:12:06 +0800 [thread overview]
Message-ID: <20230605031207.3381300-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230605031207.3381300-1-chaoyong.he@corigine.com>
From: Qin Ke <qin.ke@corigine.com>
Parse outer layer 3 packet type from Rx descriptor and report it.
Signed-off-by: Qin Ke <qin.ke@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
drivers/net/nfp/nfp_rxtx.c | 17 +++++++++++++++++
drivers/net/nfp/nfp_rxtx.h | 21 +++++++++++++++++----
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 38e084171b..a36efd3aa9 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -321,6 +321,21 @@ nfp_net_set_ptype(const struct nfp_ptype_parsed *nfp_ptype, struct rte_mbuf *mb)
if (nfp_tunnel_ptype != NFP_NET_PTYPE_TUNNEL_NONE)
mbuf_ptype |= RTE_PTYPE_INNER_L2_ETHER;
+ switch (nfp_ptype->outer_l3_ptype) {
+ case NFP_NET_PTYPE_OUTER_L3_NONE:
+ break;
+ case NFP_NET_PTYPE_OUTER_L3_IPV4:
+ mbuf_ptype |= RTE_PTYPE_L3_IPV4;
+ break;
+ case NFP_NET_PTYPE_OUTER_L3_IPV6:
+ mbuf_ptype |= RTE_PTYPE_L3_IPV6;
+ break;
+ default:
+ PMD_RX_LOG(DEBUG, "Unrecognized nfp outer layer 3 packet type: %u",
+ nfp_ptype->outer_l3_ptype);
+ break;
+ }
+
switch (nfp_tunnel_ptype) {
case NFP_NET_PTYPE_TUNNEL_NONE:
break;
@@ -432,6 +447,8 @@ nfp_net_parse_ptype(struct nfp_net_rx_desc *rxds,
NFP_NET_PTYPE_L3_OFFSET;
nfp_ptype.tunnel_ptype = (rxd_ptype & NFP_NET_PTYPE_TUNNEL_MASK) >>
NFP_NET_PTYPE_TUNNEL_OFFSET;
+ nfp_ptype.outer_l3_ptype = (rxd_ptype & NFP_NET_PTYPE_OUTER_L3_MASK) >>
+ NFP_NET_PTYPE_OUTER_L3_OFFSET;
nfp_net_set_ptype(&nfp_ptype, mb);
}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index eebe9b3ee2..cf713b0cd5 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -178,7 +178,7 @@ struct nfp_net_txq {
* 1 0
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | |tunnel | l3 | l4 |
+ * | |ol3|tunnel | l3 | l4 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* Bit map about nfp packet type refers to the following:
@@ -210,6 +210,12 @@ struct nfp_net_txq {
* 0101: NFP_NET_PTYPE_TUNNEL_GENEVE
* 0010, 0011, 0110~1111: reserved
*
+ * Outer L3: bit 10~11, used for outer layer 3.
+ * 00: NFP_NET_PTYPE_OUTER_L3_NONE
+ * 01: NFP_NET_PTYPE_OUTER_L3_IPV6
+ * 10: NFP_NET_PTYPE_OUTER_L3_IPV4
+ * 11: reserved
+ *
* Reserved: bit 10~15, used for extension.
*/
@@ -217,10 +223,12 @@ struct nfp_net_txq {
#define NFP_NET_PTYPE_L4_MASK 0x0007
#define NFP_NET_PTYPE_L3_MASK 0x0038
#define NFP_NET_PTYPE_TUNNEL_MASK 0x03c0
+#define NFP_NET_PTYPE_OUTER_L3_MASK 0x0c00
#define NFP_NET_PTYPE_L4_OFFSET 0
#define NFP_NET_PTYPE_L3_OFFSET 3
#define NFP_NET_PTYPE_TUNNEL_OFFSET 6
+#define NFP_NET_PTYPE_OUTER_L3_OFFSET 10
/* Case about nfp packet type based on the bit map above. */
#define NFP_NET_PTYPE_L4_NONE 0
@@ -244,13 +252,18 @@ struct nfp_net_txq {
#define NFP_NET_PTYPE_TUNNEL_NVGRE 4
#define NFP_NET_PTYPE_TUNNEL_GENEVE 5
+#define NFP_NET_PTYPE_OUTER_L3_NONE 0
+#define NFP_NET_PTYPE_OUTER_L3_IPV6 1
+#define NFP_NET_PTYPE_OUTER_L3_IPV4 2
+
#define NFP_PTYPE2RTE(tunnel, type) ((tunnel) ? RTE_PTYPE_INNER_##type : RTE_PTYPE_##type)
/* Record NFP packet type parsed from rxd.offload_info. */
struct nfp_ptype_parsed {
- uint8_t l4_ptype; /**< Packet type of layer 4, or inner layer 4. */
- uint8_t l3_ptype; /**< Packet type of layer 3, or inner layer 3. */
- uint8_t tunnel_ptype; /**< Packet type of tunnel. */
+ uint8_t l4_ptype; /**< Packet type of layer 4, or inner layer 4. */
+ uint8_t l3_ptype; /**< Packet type of layer 3, or inner layer 3. */
+ uint8_t tunnel_ptype; /**< Packet type of tunnel. */
+ uint8_t outer_l3_ptype; /**< Packet type of outer layer 3. */
};
struct nfp_net_rx_desc {
--
2.39.1
next prev parent reply other threads:[~2023-06-05 3:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 3:12 [PATCH 0/2] report the outer L3 and L4 packet type Chaoyong He
2023-06-05 3:12 ` Chaoyong He [this message]
2023-06-05 3:12 ` [PATCH 2/2] net/nfp: add default process to report outer " Chaoyong He
2023-06-06 9:43 ` [PATCH 0/2] report the outer L3 and " 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=20230605031207.3381300-2-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=niklas.soderlund@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=qin.ke@corigine.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).