Skip to contentSkip to conversation

octeontx2-af: NPC parser and RSS improvements

PATCH Superseded [email protected] 1 participant 3 messages Jun 17

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover octeontx2-af: NPC parser and RSS improvements

From: Nitin Shetty J <[email protected]>

This series extends the Marvell OcteonTX2 admin-function driver with two improvements to the NPC (Network Parser CAM) block. The NPC parses packets received by or transmitted from the NIX, and its matching CAM (MCAM) selects which VFs, queues, or output ports handle each packet.

Patch 1 reserves a new range of PKINDs (46-53) to support configurable L2 skip-size parsing. Packets arriving with variable length L2 headers or a CPT (Cryptographic Accelerator Unit) pre-header can be steered to one of four skip-size PKINDs so the NPC advances past the right number of bytes before starting protocol classification. The mbox interface is extended with a skip_size field so PF/VF drivers can program the desired L2 offset at run time without rebuilding firmware.

Patch 2 adds a NIX_FLOW_KEY_TYPE_ROCEV2 flow-key type so the RSS engine can distribute RoCEv2 traffic across receive queues using the destination Queue Pair (QP) field. Without this, all RoCEv2 flows hash the same way and land on a single queue.

Both changes target the admin-function driver to improve overall hardware parsing infrastructure.

Kiran Kumar K (2):
octeontx2-af: reserve 4 PKINDs for skip-size custom use
octeontx2-af: Add RSS hashing support based on RoCEv2 header

 .../net/ethernet/marvell/octeontx2/af/mbox.h  |  2 +
 .../net/ethernet/marvell/octeontx2/af/npc.h   |  4 +-
 .../net/ethernet/marvell/octeontx2/af/rvu.h   |  2 +-
 .../ethernet/marvell/octeontx2/af/rvu_nix.c   |  9 +++-
 .../ethernet/marvell/octeontx2/af/rvu_npc.c   | 42 ++++++++++++++++++-
 5 files changed, 54 insertions(+), 5 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/2 octeontx2-af: reserve 4 PKINDs for skip-size custom use

From: Kiran Kumar K <[email protected]>

The NPC block uses PKINDs to determine how incoming packets are parsed. Reserve PKINDs 46-49 (NPC_RX_SKIP_SIZE_PKIND) for configurable L2 skip-size use in the first pass, and PKINDs 50-53 (NPC_RX_CPT_SKIP_SIZE_PKIND) for the second pass where packets carry a CPT (Cryptographic Accelerator Unit) header.

Add npc_set_skip_size_pkind() to program NPC_AF_PKINDX_ACTION0 for these reserved PKINDs with a user-supplied ptr_advance value representing the L2 size to skip. For the corresponding CPT PKINDs (pkind + 4), additionally configure the var_len_offset, var_len_mask, var_len_shift, and var_len_right fields so the NPC can extract the inner payload length from the CPT header.

Update rvu_npc_set_parse_mode() to accept a new skip_size argument and dispatch to npc_set_skip_size_pkind() when the requested PKIND falls in the newly reserved range. Extend the npc_set_pkind mbox message struct with a skip_size field so PF/VF drivers can supply this value at run time.

Advance NPC_UNRESERVED_PKIND_COUNT to NPC_RX_SKIP_SIZE_PKIND to reflect the updated reservation boundary.

---
 .../net/ethernet/marvell/octeontx2/af/mbox.h  |  1 +
 .../net/ethernet/marvell/octeontx2/af/npc.h   |  4 +-
 .../net/ethernet/marvell/octeontx2/af/rvu.h   |  2 +-
 .../ethernet/marvell/octeontx2/af/rvu_nix.c   |  2 +-
 .../ethernet/marvell/octeontx2/af/rvu_npc.c   | 42 ++++++++++++++++++-
 5 files changed, 46 insertions(+), 5 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +1 -0
index e07fbf842b94..3761ceb830c3 100644
@@ -804,6 +804,7 @@ struct npc_set_pkind {
 			 */
 	u8 var_len_off_mask; /* Mask for length with in offset */
 	u8 shift_dir; /* shift direction to get length of the header at var_len_off */
+	u8 skip_size; /* l2 size to skip */
 };
 
 /* NPA mbox message formats */
drivers/net/ethernet/marvell/octeontx2/af/npc.h +3 -1
index eaed172f1606..719b3618eeb5 100644
@@ -161,10 +161,12 @@ enum npc_kpu_lh_ltype {
  * Software assigns pkind for each incoming port such as CGX
  * Ethernet interfaces, LBK interfaces, etc.
  */
-#define NPC_UNRESERVED_PKIND_COUNT NPC_RX_CPT_HDR_PTP_PKIND
+#define NPC_UNRESERVED_PKIND_COUNT NPC_RX_SKIP_SIZE_PKIND
 
 enum npc_pkind_type {
 	NPC_RX_LBK_PKIND = 0ULL,
+	NPC_RX_SKIP_SIZE_PKIND = 46ULL,
+	NPC_RX_CPT_SKIP_SIZE_PKIND = 50ULL,
 	NPC_RX_CPT_HDR_PTP_PKIND = 54ULL,
 	NPC_RX_CUSTOM_PRE_L2_PKIND = 55ULL,
 	NPC_RX_VLAN_EXDSA_PKIND = 56ULL,
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +1 -1
index 7f3505ae6860..c5610f242687 100644
@@ -1181,7 +1181,7 @@ void rvu_switch_enable_lbk_link(struct rvu *rvu, u16 pcifunc, bool ena);
 
 int rvu_npc_set_parse_mode(struct rvu *rvu, u16 pcifunc, u64 mode, u8 dir,
 			   u64 pkind, u8 var_len_off, u8 var_len_off_mask,
-			   u8 shift_dir);
+			   u8 shift_dir, u8 skip_size);
 int rvu_get_hwvf(struct rvu *rvu, int pcifunc);
 
 /* CN10K MCS */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +1 -1
index d8989395e875..2cb79c5bf689 100644
@@ -5387,7 +5387,7 @@ void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int nixlf)
 
 	/* reset HW config done for Switch headers */
 	rvu_npc_set_parse_mode(rvu, pcifunc, OTX2_PRIV_FLAGS_DEFAULT,
-			       (PKIND_TX | PKIND_RX), 0, 0, 0, 0);
+			       (PKIND_TX | PKIND_RX), 0, 0, 0, 0, 0);
 
 	/* Disabling CGX and NPC config done for PTP */
 	if (pfvf->hw_rx_tstamp_en) {
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +40 -2

62 lines not on this page · raw message

Signature · 1 line
2.48.1
#2 lore raw

PATCH 2/2 octeontx2-af: Add RSS hashing support based on RoCEv2 header

In reply to [email protected]

From: Kiran Kumar K <[email protected]>

Add NIX_FLOW_KEY_TYPE_ROCEV2 flow key type to support RSS hashing on the RoCEv2 destination Queue Pair (QP) field, allowing RoCEv2 traffic to be distributed across receive queues.

---
 drivers/net/ethernet/marvell/octeontx2/af/mbox.h    | 1 +
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 7 +++++++
 2 files changed, 8 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +1 -0
index 3761ceb830c3..7e2b20b4ad0d 100644
@@ -1269,6 +1269,7 @@ struct nix_rss_flowkey_cfg {
 #define NIX_FLOW_KEY_TYPE_IPV4_PROTO	BIT(21)
 #define NIX_FLOW_KEY_TYPE_AH		BIT(22)
 #define NIX_FLOW_KEY_TYPE_ESP		BIT(23)
+#define NIX_FLOW_KEY_TYPE_ROCEV2 BIT(24)
 #define NIX_FLOW_KEY_TYPE_L4_DST_ONLY BIT(28)
 #define NIX_FLOW_KEY_TYPE_L4_SRC_ONLY BIT(29)
 #define NIX_FLOW_KEY_TYPE_L3_DST_ONLY BIT(30)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +7 -0
index 2cb79c5bf689..5c64c4fc3941 100644
@@ -4300,6 +4300,13 @@ static int set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg)
 				keyoff_marker = false;
 			}
 			break;
+		case NIX_FLOW_KEY_TYPE_ROCEV2:
+			field->hdr_offset = 5;
+			field->bytesm1 = 2; /* Destination QP */
+			field->ltype_mask = 0xF;
+			field->lid = NPC_LID_LE;
+			field->ltype_match = NPC_LT_LE_ROCEV2;
+			break;
 		}
 		field->ena = 1;
 
Signature · 1 line
2.48.1