Skip to contentSkip to conversation

common/cnxk: fix printing disabled MKEX registers

PATCH Superseded [email protected] 2 participants 8 messages Aug 1, 2022 – Sep 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 common/cnxk: fix printing disabled MKEX registers

From: Satheesh Paul <[email protected]>

This patch skips printing disabled MKEX registers when dumping hardware flow MCAM entry data.

Fixes 9869c39918 ("common/cnxk: support flow entry dump")
---
 drivers/common/cnxk/roc_npc_mcam_dump.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_npc_mcam_dump.c +5 -3
index 2aaf3ccd0b..16997bd38a 100644
@@ -310,8 +310,10 @@ npc_flow_print_item(FILE *file, struct npc *npc, struct npc_xtract_info *xinfo,
 		for (i = 0; i < NPC_MAX_LFL; i++) {
 			lflags_info = npc->prx_fxcfg[intf][ld][i].xtract;
 
-			npc_flow_print_xtractinfo(file, lflags_info, flow, lid,
-						  lt);
+			if (!lflags_info->enable)
+				continue;
+
+			npc_flow_print_xtractinfo(file, lflags_info, flow, lid, lt);
 		}
 	}
 }
@@ -620,7 +622,7 @@ roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 	mcam_read_req->entry = flow->mcam_id;
 	rc = mbox_process_msg(npc->mbox, (void *)&mcam_read_rsp);
 	if (rc) {
-		plt_err("Failed to fetch MCAM entry");
+		plt_err("Failed to fetch MCAM entry:%d", flow->mcam_id);
 		return;
 	}
 
Signature · 1 line
2.35.3
#1 lore raw

PATCH 2/3 common/cnxk: print counters along with flow dump

From: Satheesh Paul <[email protected]>

When dumping hardware flow data, print any counter configured on the flow as well.

---
 drivers/common/cnxk/roc_npc_mcam_dump.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_npc_mcam_dump.c +9 -2
index 16997bd38a..fe57811a84 100644
@@ -590,12 +590,19 @@ roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	struct npc_mcam_read_entry_req *mcam_read_req;
 	struct npc_mcam_read_entry_rsp *mcam_read_rsp;
+	uint64_t count = 0;
 	bool is_rx = 0;
 	int i, rc = 0;
 
 	fprintf(file, "MCAM Index:%d\n", flow->mcam_id);
-	fprintf(file, "Interface :%s (%d)\n", intf_str[flow->nix_intf],
-		flow->nix_intf);
+	if (flow->ctr_id != NPC_COUNTER_NONE && flow->use_ctr) {
+		rc = roc_npc_mcam_read_counter(roc_npc, flow->ctr_id, &count);
+		if (rc)
+			return;
+		fprintf(file, "Hit count: %" PRIu64 "\n", count);
+	}
+
+	fprintf(file, "Interface :%s (%d)\n", intf_str[flow->nix_intf], flow->nix_intf);
 	fprintf(file, "Priority  :%d\n", flow->priority);
 
 	if (flow->nix_intf == NIX_INTF_RX)
Signature · 1 line
2.35.3
#2 lore raw

PATCH 3/3 common/cnxk: update MKEX capability flags

In reply to [email protected]

From: Satheesh Paul <[email protected]>

Update MKEX capability flags to enable parsing
VLAN PCP, DSCP and GTPv1 TEID.

---
 drivers/common/cnxk/roc_npc_mcam.c | 86 ++++++++++++------------------
 drivers/common/cnxk/roc_npc_priv.h | 12 +++--
 2 files changed, 44 insertions(+), 54 deletions(-)
drivers/common/cnxk/roc_npc_mcam.c +35 -51
index 245eeb0107..a71f0c8b8a 100644
@@ -232,80 +232,64 @@ npc_get_kex_capability(struct npc *npc)
 	memset(&kex_cap, 0, sizeof(kex_cap));
 
 	/* Ethtype: Offset 12B, len 2B */
-	kex_cap.bit.ethtype_0 = npc_is_kex_enabled(
-		npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
+	kex_cap.bit.ethtype_0 = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
 	/* QINQ VLAN Ethtype: offset 8B, len 2B */
-	kex_cap.bit.ethtype_x = npc_is_kex_enabled(
-		npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
+	kex_cap.bit.ethtype_x =
+		npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
 	/* VLAN ID0 : Outer VLAN: Offset 2B, len 2B */
-	kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(
-		npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
-	/* VLAN ID0 : Inner VLAN: offset 6B, len 2B */
-	kex_cap.bit.vlan_id_x = npc_is_kex_enabled(
-		npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
+	kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
+	/* VLAN PCP0 : Outer VLAN: Offset 2B, len 1B */
+	kex_cap.bit.vlan_pcp_0 = npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 1);
+	/* VLAN IDX : Inner VLAN: offset 6B, len 2B */
+	kex_cap.bit.vlan_id_x =
+		npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
 	/* DMCA: offset 0B, len 6B */
-	kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER,
-					      0 * 8, 6 * 8);
+	kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 0 * 8, 6 * 8);
 	/* IP proto: offset 9B, len 1B */
-	kex_cap.bit.ip_proto =
-		npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+	kex_cap.bit.ip_proto = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+	/* IPv4 dscp: offset 1B, len 1B, IPv6 dscp: offset 0B, len 2B */
+	kex_cap.bit.ip_dscp = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 1 * 8, 1 * 8) &
+			      npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 0, 2 * 8);
 	/* UDP dport: offset 2B, len 2B */
-	kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-						   NPC_LT_LD_UDP, 2 * 8, 2 * 8);
+	kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_UDP, 2 * 8, 2 * 8);
 	/* UDP sport: offset 0B, len 2B */
-	kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-						   NPC_LT_LD_UDP, 0 * 8, 2 * 8);
+	kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_UDP, 0 * 8, 2 * 8);
 	/* TCP dport: offset 2B, len 2B */
-	kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-						   NPC_LT_LD_TCP, 2 * 8, 2 * 8);
+	kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_TCP, 2 * 8, 2 * 8);
 	/* TCP sport: offset 0B, len 2B */
-	kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-						   NPC_LT_LD_TCP, 0 * 8, 2 * 8);
+	kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_TCP, 0 * 8, 2 * 8);
 	/* IP SIP: offset 12B, len 4B */
-	kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
-						  12 * 8, 4 * 8);
+	kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 12 * 8, 4 * 8);
 	/* IP DIP: offset 14B, len 4B */
-	kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
-						  14 * 8, 4 * 8);
+	kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 14 * 8, 4 * 8);
 	/* IP6 SIP: offset 8B, len 16B */
-	kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6,
-					8 * 8, 16 * 8);
+	kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 8 * 8, 16 * 8);
 	/* IP6 DIP: offset 24B, len 16B */
-	kex_cap.bit.dip6_addr = npc_is_kex_enabled(
-		npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
+	kex_cap.bit.dip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
 	/* ESP SPI: offset 0B, len 4B */
-	kex_cap.bit.ipsec_spi = npc_is_kex_enabled(npc, NPC_LID_LE,
-						   NPC_LT_LE_ESP, 0 * 8, 4 * 8);
+	kex_cap.bit.ipsec_spi = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_ESP, 0 * 8, 4 * 8);
 	/* VXLAN VNI: offset 4B, len 3B */
-	kex_cap.bit.ld_vni = npc_is_kex_enabled(npc, NPC_LID_LE,
-						NPC_LT_LE_VXLAN, 0 * 8, 3 * 8);
+	kex_cap.bit.ld_vni = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_VXLAN, 0 * 8, 3 * 8);
 
 	/* Custom L3 frame: varied offset and lengths */
-	kex_cap.bit.custom_l3 =
-		npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM0, 0, 0);
-	kex_cap.bit.custom_l3 |= (uint64_t)npc_is_kex_enabled(npc, NPC_LID_LC,
-					NPC_LT_LC_CUSTOM1, 0, 0);
+	kex_cap.bit.custom_l3 = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM0, 0, 0);
+	kex_cap.bit.custom_l3 |=
+		(uint64_t)npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM1, 0, 0);
 	/* SCTP sport : offset 0B, len 2B */
-	kex_cap.bit.sctp_sport = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_SCTP, 0 * 8, 2 * 8);
+	kex_cap.bit.sctp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_SCTP, 0 * 8, 2 * 8);
 	/* SCTP dport : offset 2B, len 2B */
-	kex_cap.bit.sctp_dport = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_SCTP, 2 * 8, 2 * 8);
+	kex_cap.bit.sctp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_SCTP, 2 * 8, 2 * 8);
 	/* ICMP type : offset 0B, len 1B */
-	kex_cap.bit.icmp_type = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_ICMP, 0 * 8, 1 * 8);
+	kex_cap.bit.icmp_type = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 0 * 8, 1 * 8);
 	/* ICMP code : offset 1B, len 1B */
-	kex_cap.bit.icmp_code = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_ICMP, 1 * 8, 1 * 8);
+	kex_cap.bit.icmp_code = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 1 * 8, 1 * 8);
 	/* ICMP id : offset 4B, len 2B */
-	kex_cap.bit.icmp_id = npc_is_kex_enabled(npc, NPC_LID_LD,
-						 NPC_LT_LD_ICMP, 4 * 8, 2 * 8);
+	kex_cap.bit.icmp_id = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 4 * 8, 2 * 8);
 	/* IGMP grp_addr : offset 4B, len 4B */
-	kex_cap.bit.igmp_grp_addr = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_IGMP, 4 * 8, 4 * 8);
+	kex_cap.bit.igmp_grp_addr =
+		npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_IGMP, 4 * 8, 4 * 8);
 	/* GTPU teid : offset 4B, len 4B */
-	kex_cap.bit.gtpu_teid = npc_is_kex_enabled(
-		npc, NPC_LID_LE, NPC_LT_LE_GTPU, 4 * 8, 4 * 8);
+	kex_cap.bit.gtpv1_teid = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_GTPU, 4 * 8, 4 * 8);
 	return kex_cap.all_bits;
 }
 
drivers/common/cnxk/roc_npc_priv.h +9 -3
index b08539d8f8..1a597280d1 100644
@@ -100,6 +100,7 @@ enum npc_err_status {
 enum npc_mcam_intf { NPC_MCAM_RX, NPC_MCAM_TX };
 
 typedef union npc_kex_cap_terms_t {
+	/** Packet Matching Rule term fields */
 	struct {
 		/** Total length of received packet */
 		uint64_t len : 1;
@@ -111,10 +112,14 @@ typedef union npc_kex_cap_terms_t {
 		uint64_t vlan_id_0 : 1;
 		/** Last VLAN ID (inner) */
 		uint64_t vlan_id_x : 1;
+		/** PCP in the first VLAN header */
+		uint64_t vlan_pcp_0 : 1;
 		/** destination MAC address */
 		uint64_t dmac : 1;
 		/** IP Protocol or IPv6 Next Header */
 		uint64_t ip_proto : 1;
+		/** DSCP in IP header */
+		uint64_t ip_dscp : 1;
 		/** Destination UDP port, implies IPPROTO=17 */
 		uint64_t udp_dport : 1;
 		/** Destination TCP port implies IPPROTO=6 */
@@ -155,12 +160,13 @@ typedef union npc_kex_cap_terms_t {
 		uint64_t sctp_sport : 1;
 		/** Destination SCTP port */
 		uint64_t sctp_dport : 1;
-		/** GTPU Tunnel endpoint identifier */
-		uint64_t gtpu_teid : 1;
-
+		/** GTPv1 tunnel endpoint identifier */
+		uint64_t gtpv1_teid : 1;
 	} bit;
+
 	/** All bits of the bit field structure */
 	uint64_t all_bits;
+
 } npc_kex_cap_terms_t;
 
 struct npc_parse_item_info {
Signature · 1 line
2.35.3
#3 lore raw

Re: [dpdk-dev] [PATCH 3/3] common/cnxk: update MKEX capability flags

Quoted 6 lines · On Mon, Aug 1, 2022 at 11:47 AM <[email protected]> wrote:

From: Satheesh Paul <[email protected]>

Update MKEX capability flags to enable parsing
VLAN PCP, DSCP and GTPv1 TEID.

Quoted 6 lines
---
 drivers/common/cnxk/roc_npc_mcam.c | 86 ++++++++++++------------------
 drivers/common/cnxk/roc_npc_priv.h | 12 +++--
 2 files changed, 44 insertions(+), 54 deletions(-)

Build issues clang

[792/3405] Compiling C object drivers/libtmp_rte_common_cnxk.a.p/common_cnxk_roc_npc_mcam.c.o
FAILED: drivers/libtmp_rte_common_cnxk.a.p/common_cnxk_roc_npc_mcam.c.o ccache clang -Idrivers/libtmp_rte_common_cnxk.a.p -Idrivers -I../drivers -Idrivers/common/cnxk -I../drivers/common/cnxk -Idrivers/bus/pci -I../drivers/bus/pci -Ilib/net -I../lib/net -Ilib/ethdev -I../lib/ethdev -Ilib/meter -I../lib/meter -I
. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I ../lib/kvargs -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/pci -I../lib/pci -I../drivers/bus/pci/linux -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/security -I../lib/secur
ity -Ilib/cryptodev -I../lib/cryptodev -Ilib/rcu -I../lib/rcu -fcolor-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -O2 -g -include rte_config.h -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-securit
y -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-missing-field-initializers -D_GNU_SOURCE -fP
IC -march=native -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -DRTE_LOG_DEFAULT_LOGTYPE=pmd.common.cnxk -MD -MQ drivers/libtmp_rte_common_cnxk.a.p/common_cnxk_roc_npc_mcam.c.o -MF drivers/libtmp_rte_common_cnxk.a.p/common_cnxk_roc_npc_mcam .c.o.d -o drivers/libtmp_rte_common_cnxk.a.p/common_cnxk_roc_npc_mcam.c.o -c ../drivers/common/cnxk/roc_npc_mcam.c ../drivers/common/cnxk/roc_npc_mcam.c:251:24: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
kex_cap.bit.ip_dscp = npc_is_kex_enabled(npc, NPC_LID_LC,
NPC_LT_LC_IP, 1 * 8, 1 * 8) &

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                       &&

../drivers/common/cnxk/roc_npc_mcam.c:251:24: note: cast one or both operands to int to silence this warning
1 error generated.
[793/3405] Compiling C

Quoted 168 lines
drivers/common/cnxk/roc_npc_mcam.c +35 -51
index 245eeb0107..a71f0c8b8a 100644
@@ -232,80 +232,64 @@ npc_get_kex_capability(struct npc *npc)
        memset(&kex_cap, 0, sizeof(kex_cap));
 
        /* Ethtype: Offset 12B, len 2B */
-       kex_cap.bit.ethtype_0 = npc_is_kex_enabled(
-               npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
+       kex_cap.bit.ethtype_0 = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
        /* QINQ VLAN Ethtype: offset 8B, len 2B */
-       kex_cap.bit.ethtype_x = npc_is_kex_enabled(
-               npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
+       kex_cap.bit.ethtype_x =
+               npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
        /* VLAN ID0 : Outer VLAN: Offset 2B, len 2B */
-       kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(
-               npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
-       /* VLAN ID0 : Inner VLAN: offset 6B, len 2B */
-       kex_cap.bit.vlan_id_x = npc_is_kex_enabled(
-               npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
+       kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
+       /* VLAN PCP0 : Outer VLAN: Offset 2B, len 1B */
+       kex_cap.bit.vlan_pcp_0 = npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 1);
+       /* VLAN IDX : Inner VLAN: offset 6B, len 2B */
+       kex_cap.bit.vlan_id_x =
+               npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
        /* DMCA: offset 0B, len 6B */
-       kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER,
-                                             0 * 8, 6 * 8);
+       kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 0 * 8, 6 * 8);
        /* IP proto: offset 9B, len 1B */
-       kex_cap.bit.ip_proto =
-               npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+       kex_cap.bit.ip_proto = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+       /* IPv4 dscp: offset 1B, len 1B, IPv6 dscp: offset 0B, len 2B */
+       kex_cap.bit.ip_dscp = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 1 * 8, 1 * 8) &
+                             npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 0, 2 * 8);
        /* UDP dport: offset 2B, len 2B */
-       kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                  NPC_LT_LD_UDP, 2 * 8, 2 * 8);
+       kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_UDP, 2 * 8, 2 * 8);
        /* UDP sport: offset 0B, len 2B */
-       kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                  NPC_LT_LD_UDP, 0 * 8, 2 * 8);
+       kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_UDP, 0 * 8, 2 * 8);
        /* TCP dport: offset 2B, len 2B */
-       kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                  NPC_LT_LD_TCP, 2 * 8, 2 * 8);
+       kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_TCP, 2 * 8, 2 * 8);
        /* TCP sport: offset 0B, len 2B */
-       kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                  NPC_LT_LD_TCP, 0 * 8, 2 * 8);
+       kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_TCP, 0 * 8, 2 * 8);
        /* IP SIP: offset 12B, len 4B */
-       kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
-                                                 12 * 8, 4 * 8);
+       kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 12 * 8, 4 * 8);
        /* IP DIP: offset 14B, len 4B */
-       kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
-                                                 14 * 8, 4 * 8);
+       kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 14 * 8, 4 * 8);
        /* IP6 SIP: offset 8B, len 16B */
-       kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6,
-                                       8 * 8, 16 * 8);
+       kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 8 * 8, 16 * 8);
        /* IP6 DIP: offset 24B, len 16B */
-       kex_cap.bit.dip6_addr = npc_is_kex_enabled(
-               npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
+       kex_cap.bit.dip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
        /* ESP SPI: offset 0B, len 4B */
-       kex_cap.bit.ipsec_spi = npc_is_kex_enabled(npc, NPC_LID_LE,
-                                                  NPC_LT_LE_ESP, 0 * 8, 4 * 8);
+       kex_cap.bit.ipsec_spi = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_ESP, 0 * 8, 4 * 8);
        /* VXLAN VNI: offset 4B, len 3B */
-       kex_cap.bit.ld_vni = npc_is_kex_enabled(npc, NPC_LID_LE,
-                                               NPC_LT_LE_VXLAN, 0 * 8, 3 * 8);
+       kex_cap.bit.ld_vni = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_VXLAN, 0 * 8, 3 * 8);
 
        /* Custom L3 frame: varied offset and lengths */
-       kex_cap.bit.custom_l3 =
-               npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM0, 0, 0);
-       kex_cap.bit.custom_l3 |= (uint64_t)npc_is_kex_enabled(npc, NPC_LID_LC,
-                                       NPC_LT_LC_CUSTOM1, 0, 0);
+       kex_cap.bit.custom_l3 = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM0, 0, 0);
+       kex_cap.bit.custom_l3 |=
+               (uint64_t)npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM1, 0, 0);
        /* SCTP sport : offset 0B, len 2B */
-       kex_cap.bit.sctp_sport = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_SCTP, 0 * 8, 2 * 8);
+       kex_cap.bit.sctp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_SCTP, 0 * 8, 2 * 8);
        /* SCTP dport : offset 2B, len 2B */
-       kex_cap.bit.sctp_dport = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_SCTP, 2 * 8, 2 * 8);
+       kex_cap.bit.sctp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_SCTP, 2 * 8, 2 * 8);
        /* ICMP type : offset 0B, len 1B */
-       kex_cap.bit.icmp_type = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_ICMP, 0 * 8, 1 * 8);
+       kex_cap.bit.icmp_type = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 0 * 8, 1 * 8);
        /* ICMP code : offset 1B, len 1B */
-       kex_cap.bit.icmp_code = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_ICMP, 1 * 8, 1 * 8);
+       kex_cap.bit.icmp_code = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 1 * 8, 1 * 8);
        /* ICMP id : offset 4B, len 2B */
-       kex_cap.bit.icmp_id = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                NPC_LT_LD_ICMP, 4 * 8, 2 * 8);
+       kex_cap.bit.icmp_id = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 4 * 8, 2 * 8);
        /* IGMP grp_addr : offset 4B, len 4B */
-       kex_cap.bit.igmp_grp_addr = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_IGMP, 4 * 8, 4 * 8);
+       kex_cap.bit.igmp_grp_addr =
+               npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_IGMP, 4 * 8, 4 * 8);
        /* GTPU teid : offset 4B, len 4B */
-       kex_cap.bit.gtpu_teid = npc_is_kex_enabled(
-               npc, NPC_LID_LE, NPC_LT_LE_GTPU, 4 * 8, 4 * 8);
+       kex_cap.bit.gtpv1_teid = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_GTPU, 4 * 8, 4 * 8);
        return kex_cap.all_bits;
 }
 
drivers/common/cnxk/roc_npc_priv.h +9 -4
index b08539d8f8..1a597280d1 100644
@@ -100,6 +100,7 @@ enum npc_err_status {
 enum npc_mcam_intf { NPC_MCAM_RX, NPC_MCAM_TX };
 
 typedef union npc_kex_cap_terms_t {
+       /** Packet Matching Rule term fields */
        struct {
                /** Total length of received packet */
                uint64_t len : 1;
@@ -111,10 +112,14 @@ typedef union npc_kex_cap_terms_t {
                uint64_t vlan_id_0 : 1;
                /** Last VLAN ID (inner) */
                uint64_t vlan_id_x : 1;
+               /** PCP in the first VLAN header */
+               uint64_t vlan_pcp_0 : 1;
                /** destination MAC address */
                uint64_t dmac : 1;
                /** IP Protocol or IPv6 Next Header */
                uint64_t ip_proto : 1;
+               /** DSCP in IP header */
+               uint64_t ip_dscp : 1;
                /** Destination UDP port, implies IPPROTO=17 */
                uint64_t udp_dport : 1;
                /** Destination TCP port implies IPPROTO=6 */
@@ -155,12 +160,13 @@ typedef union npc_kex_cap_terms_t {
                uint64_t sctp_sport : 1;
                /** Destination SCTP port */
                uint64_t sctp_dport : 1;
-               /** GTPU Tunnel endpoint identifier */
-               uint64_t gtpu_teid : 1;
-
+               /** GTPv1 tunnel endpoint identifier */
+               uint64_t gtpv1_teid : 1;
        } bit;
+
        /** All bits of the bit field structure */
        uint64_t all_bits;
+
 } npc_kex_cap_terms_t;
 
 struct npc_parse_item_info {
--

2.35.3

#4 lore raw

PATCH v2 1/3 common/cnxk: fix printing disabled MKEX registers

In reply to [email protected]

From: Satheesh Paul <[email protected]>

This patch skips printing disabled MKEX registers when dumping hardware flow MCAM entry data.

Fixes 9869c39918 ("common/cnxk: support flow entry dump")
---
 drivers/common/cnxk/roc_npc_mcam_dump.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_npc_mcam_dump.c +5 -3
index 2aaf3ccd0b..16997bd38a 100644
@@ -310,8 +310,10 @@ npc_flow_print_item(FILE *file, struct npc *npc, struct npc_xtract_info *xinfo,
 		for (i = 0; i < NPC_MAX_LFL; i++) {
 			lflags_info = npc->prx_fxcfg[intf][ld][i].xtract;
 
-			npc_flow_print_xtractinfo(file, lflags_info, flow, lid,
-						  lt);
+			if (!lflags_info->enable)
+				continue;
+
+			npc_flow_print_xtractinfo(file, lflags_info, flow, lid, lt);
 		}
 	}
 }
@@ -620,7 +622,7 @@ roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 	mcam_read_req->entry = flow->mcam_id;
 	rc = mbox_process_msg(npc->mbox, (void *)&mcam_read_rsp);
 	if (rc) {
-		plt_err("Failed to fetch MCAM entry");
+		plt_err("Failed to fetch MCAM entry:%d", flow->mcam_id);
 		return;
 	}
 
Signature · 1 line
2.35.3
#5 lore raw

PATCH v2 2/3 common/cnxk: print counters along with flow dump

From: Satheesh Paul <[email protected]>

When dumping hardware flow data, print any counter configured on the flow as well.

---
 drivers/common/cnxk/roc_npc_mcam_dump.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_npc_mcam_dump.c +9 -2
index 16997bd38a..fe57811a84 100644
@@ -590,12 +590,19 @@ roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	struct npc_mcam_read_entry_req *mcam_read_req;
 	struct npc_mcam_read_entry_rsp *mcam_read_rsp;
+	uint64_t count = 0;
 	bool is_rx = 0;
 	int i, rc = 0;
 
 	fprintf(file, "MCAM Index:%d\n", flow->mcam_id);
-	fprintf(file, "Interface :%s (%d)\n", intf_str[flow->nix_intf],
-		flow->nix_intf);
+	if (flow->ctr_id != NPC_COUNTER_NONE && flow->use_ctr) {
+		rc = roc_npc_mcam_read_counter(roc_npc, flow->ctr_id, &count);
+		if (rc)
+			return;
+		fprintf(file, "Hit count: %" PRIu64 "\n", count);
+	}
+
+	fprintf(file, "Interface :%s (%d)\n", intf_str[flow->nix_intf], flow->nix_intf);
 	fprintf(file, "Priority  :%d\n", flow->priority);
 
 	if (flow->nix_intf == NIX_INTF_RX)
Signature · 1 line
2.35.3
#6 lore raw

PATCH v2 3/3 common/cnxk: update MKEX capability flags

In reply to [email protected]

From: Satheesh Paul <[email protected]>

Update MKEX capability flags to enable parsing
VLAN PCP, DSCP and GTPv1 TEID.

---
v2:
* Fixed clang build issue

 drivers/common/cnxk/roc_npc_mcam.c | 86 ++++++++++++------------------
 drivers/common/cnxk/roc_npc_priv.h | 12 +++--
 2 files changed, 44 insertions(+), 54 deletions(-)
drivers/common/cnxk/roc_npc_mcam.c +35 -51
index 245eeb0107..82a9756189 100644
@@ -232,80 +232,64 @@ npc_get_kex_capability(struct npc *npc)
 	memset(&kex_cap, 0, sizeof(kex_cap));
 
 	/* Ethtype: Offset 12B, len 2B */
-	kex_cap.bit.ethtype_0 = npc_is_kex_enabled(
-		npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
+	kex_cap.bit.ethtype_0 = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
 	/* QINQ VLAN Ethtype: offset 8B, len 2B */
-	kex_cap.bit.ethtype_x = npc_is_kex_enabled(
-		npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
+	kex_cap.bit.ethtype_x =
+		npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
 	/* VLAN ID0 : Outer VLAN: Offset 2B, len 2B */
-	kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(
-		npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
-	/* VLAN ID0 : Inner VLAN: offset 6B, len 2B */
-	kex_cap.bit.vlan_id_x = npc_is_kex_enabled(
-		npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
+	kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
+	/* VLAN PCP0 : Outer VLAN: Offset 2B, len 1B */
+	kex_cap.bit.vlan_pcp_0 = npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 1);
+	/* VLAN IDX : Inner VLAN: offset 6B, len 2B */
+	kex_cap.bit.vlan_id_x =
+		npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
 	/* DMCA: offset 0B, len 6B */
-	kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER,
-					      0 * 8, 6 * 8);
+	kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 0 * 8, 6 * 8);
 	/* IP proto: offset 9B, len 1B */
-	kex_cap.bit.ip_proto =
-		npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+	kex_cap.bit.ip_proto = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+	/* IPv4 dscp: offset 1B, len 1B, IPv6 dscp: offset 0B, len 2B */
+	kex_cap.bit.ip_dscp = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 1 * 8, 1 * 8) &&
+			      npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 0, 2 * 8);
 	/* UDP dport: offset 2B, len 2B */
-	kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-						   NPC_LT_LD_UDP, 2 * 8, 2 * 8);
+	kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_UDP, 2 * 8, 2 * 8);
 	/* UDP sport: offset 0B, len 2B */
-	kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-						   NPC_LT_LD_UDP, 0 * 8, 2 * 8);
+	kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_UDP, 0 * 8, 2 * 8);
 	/* TCP dport: offset 2B, len 2B */
-	kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-						   NPC_LT_LD_TCP, 2 * 8, 2 * 8);
+	kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_TCP, 2 * 8, 2 * 8);
 	/* TCP sport: offset 0B, len 2B */
-	kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-						   NPC_LT_LD_TCP, 0 * 8, 2 * 8);
+	kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_TCP, 0 * 8, 2 * 8);
 	/* IP SIP: offset 12B, len 4B */
-	kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
-						  12 * 8, 4 * 8);
+	kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 12 * 8, 4 * 8);
 	/* IP DIP: offset 14B, len 4B */
-	kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
-						  14 * 8, 4 * 8);
+	kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 14 * 8, 4 * 8);
 	/* IP6 SIP: offset 8B, len 16B */
-	kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6,
-					8 * 8, 16 * 8);
+	kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 8 * 8, 16 * 8);
 	/* IP6 DIP: offset 24B, len 16B */
-	kex_cap.bit.dip6_addr = npc_is_kex_enabled(
-		npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
+	kex_cap.bit.dip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
 	/* ESP SPI: offset 0B, len 4B */
-	kex_cap.bit.ipsec_spi = npc_is_kex_enabled(npc, NPC_LID_LE,
-						   NPC_LT_LE_ESP, 0 * 8, 4 * 8);
+	kex_cap.bit.ipsec_spi = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_ESP, 0 * 8, 4 * 8);
 	/* VXLAN VNI: offset 4B, len 3B */
-	kex_cap.bit.ld_vni = npc_is_kex_enabled(npc, NPC_LID_LE,
-						NPC_LT_LE_VXLAN, 0 * 8, 3 * 8);
+	kex_cap.bit.ld_vni = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_VXLAN, 0 * 8, 3 * 8);
 
 	/* Custom L3 frame: varied offset and lengths */
-	kex_cap.bit.custom_l3 =
-		npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM0, 0, 0);
-	kex_cap.bit.custom_l3 |= (uint64_t)npc_is_kex_enabled(npc, NPC_LID_LC,
-					NPC_LT_LC_CUSTOM1, 0, 0);
+	kex_cap.bit.custom_l3 = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM0, 0, 0);
+	kex_cap.bit.custom_l3 |=
+		(uint64_t)npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM1, 0, 0);
 	/* SCTP sport : offset 0B, len 2B */
-	kex_cap.bit.sctp_sport = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_SCTP, 0 * 8, 2 * 8);
+	kex_cap.bit.sctp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_SCTP, 0 * 8, 2 * 8);
 	/* SCTP dport : offset 2B, len 2B */
-	kex_cap.bit.sctp_dport = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_SCTP, 2 * 8, 2 * 8);
+	kex_cap.bit.sctp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_SCTP, 2 * 8, 2 * 8);
 	/* ICMP type : offset 0B, len 1B */
-	kex_cap.bit.icmp_type = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_ICMP, 0 * 8, 1 * 8);
+	kex_cap.bit.icmp_type = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 0 * 8, 1 * 8);
 	/* ICMP code : offset 1B, len 1B */
-	kex_cap.bit.icmp_code = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_ICMP, 1 * 8, 1 * 8);
+	kex_cap.bit.icmp_code = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 1 * 8, 1 * 8);
 	/* ICMP id : offset 4B, len 2B */
-	kex_cap.bit.icmp_id = npc_is_kex_enabled(npc, NPC_LID_LD,
-						 NPC_LT_LD_ICMP, 4 * 8, 2 * 8);
+	kex_cap.bit.icmp_id = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 4 * 8, 2 * 8);
 	/* IGMP grp_addr : offset 4B, len 4B */
-	kex_cap.bit.igmp_grp_addr = npc_is_kex_enabled(
-		npc, NPC_LID_LD, NPC_LT_LD_IGMP, 4 * 8, 4 * 8);
+	kex_cap.bit.igmp_grp_addr =
+		npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_IGMP, 4 * 8, 4 * 8);
 	/* GTPU teid : offset 4B, len 4B */
-	kex_cap.bit.gtpu_teid = npc_is_kex_enabled(
-		npc, NPC_LID_LE, NPC_LT_LE_GTPU, 4 * 8, 4 * 8);
+	kex_cap.bit.gtpv1_teid = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_GTPU, 4 * 8, 4 * 8);
 	return kex_cap.all_bits;
 }
 
drivers/common/cnxk/roc_npc_priv.h +9 -3
index b08539d8f8..1a597280d1 100644
@@ -100,6 +100,7 @@ enum npc_err_status {
 enum npc_mcam_intf { NPC_MCAM_RX, NPC_MCAM_TX };
 
 typedef union npc_kex_cap_terms_t {
+	/** Packet Matching Rule term fields */
 	struct {
 		/** Total length of received packet */
 		uint64_t len : 1;
@@ -111,10 +112,14 @@ typedef union npc_kex_cap_terms_t {
 		uint64_t vlan_id_0 : 1;
 		/** Last VLAN ID (inner) */
 		uint64_t vlan_id_x : 1;
+		/** PCP in the first VLAN header */
+		uint64_t vlan_pcp_0 : 1;
 		/** destination MAC address */
 		uint64_t dmac : 1;
 		/** IP Protocol or IPv6 Next Header */
 		uint64_t ip_proto : 1;
+		/** DSCP in IP header */
+		uint64_t ip_dscp : 1;
 		/** Destination UDP port, implies IPPROTO=17 */
 		uint64_t udp_dport : 1;
 		/** Destination TCP port implies IPPROTO=6 */
@@ -155,12 +160,13 @@ typedef union npc_kex_cap_terms_t {
 		uint64_t sctp_sport : 1;
 		/** Destination SCTP port */
 		uint64_t sctp_dport : 1;
-		/** GTPU Tunnel endpoint identifier */
-		uint64_t gtpu_teid : 1;
-
+		/** GTPv1 tunnel endpoint identifier */
+		uint64_t gtpv1_teid : 1;
 	} bit;
+
 	/** All bits of the bit field structure */
 	uint64_t all_bits;
+
 } npc_kex_cap_terms_t;
 
 struct npc_parse_item_info {
Signature · 1 line
2.35.3
#7 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] common/cnxk: update MKEX capability flags

Quoted 9 lines · On Mon, Aug 29, 2022 at 11:55 AM <[email protected]> wrote:

From: Satheesh Paul <[email protected]>

Update MKEX capability flags to enable parsing
VLAN PCP, DSCP and GTPv1 TEID.

---

Series applied to dpdk-next-net-mrvl/for-next-net. Thanks.

Quoted 174 lines

v2:
* Fixed clang build issue

 drivers/common/cnxk/roc_npc_mcam.c | 86 ++++++++++++------------------
 drivers/common/cnxk/roc_npc_priv.h | 12 +++--
 2 files changed, 44 insertions(+), 54 deletions(-)
drivers/common/cnxk/roc_npc_mcam.c +35 -51
index 245eeb0107..82a9756189 100644
@@ -232,80 +232,64 @@ npc_get_kex_capability(struct npc *npc)
        memset(&kex_cap, 0, sizeof(kex_cap));
 
        /* Ethtype: Offset 12B, len 2B */
-       kex_cap.bit.ethtype_0 = npc_is_kex_enabled(
-               npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
+       kex_cap.bit.ethtype_0 = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
        /* QINQ VLAN Ethtype: offset 8B, len 2B */
-       kex_cap.bit.ethtype_x = npc_is_kex_enabled(
-               npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
+       kex_cap.bit.ethtype_x =
+               npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
        /* VLAN ID0 : Outer VLAN: Offset 2B, len 2B */
-       kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(
-               npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
-       /* VLAN ID0 : Inner VLAN: offset 6B, len 2B */
-       kex_cap.bit.vlan_id_x = npc_is_kex_enabled(
-               npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
+       kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
+       /* VLAN PCP0 : Outer VLAN: Offset 2B, len 1B */
+       kex_cap.bit.vlan_pcp_0 = npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 1);
+       /* VLAN IDX : Inner VLAN: offset 6B, len 2B */
+       kex_cap.bit.vlan_id_x =
+               npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
        /* DMCA: offset 0B, len 6B */
-       kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER,
-                                             0 * 8, 6 * 8);
+       kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 0 * 8, 6 * 8);
        /* IP proto: offset 9B, len 1B */
-       kex_cap.bit.ip_proto =
-               npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+       kex_cap.bit.ip_proto = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+       /* IPv4 dscp: offset 1B, len 1B, IPv6 dscp: offset 0B, len 2B */
+       kex_cap.bit.ip_dscp = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 1 * 8, 1 * 8) &&
+                             npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 0, 2 * 8);
        /* UDP dport: offset 2B, len 2B */
-       kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                  NPC_LT_LD_UDP, 2 * 8, 2 * 8);
+       kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_UDP, 2 * 8, 2 * 8);
        /* UDP sport: offset 0B, len 2B */
-       kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                  NPC_LT_LD_UDP, 0 * 8, 2 * 8);
+       kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_UDP, 0 * 8, 2 * 8);
        /* TCP dport: offset 2B, len 2B */
-       kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                  NPC_LT_LD_TCP, 2 * 8, 2 * 8);
+       kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_TCP, 2 * 8, 2 * 8);
        /* TCP sport: offset 0B, len 2B */
-       kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                  NPC_LT_LD_TCP, 0 * 8, 2 * 8);
+       kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_TCP, 0 * 8, 2 * 8);
        /* IP SIP: offset 12B, len 4B */
-       kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
-                                                 12 * 8, 4 * 8);
+       kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 12 * 8, 4 * 8);
        /* IP DIP: offset 14B, len 4B */
-       kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
-                                                 14 * 8, 4 * 8);
+       kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 14 * 8, 4 * 8);
        /* IP6 SIP: offset 8B, len 16B */
-       kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6,
-                                       8 * 8, 16 * 8);
+       kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 8 * 8, 16 * 8);
        /* IP6 DIP: offset 24B, len 16B */
-       kex_cap.bit.dip6_addr = npc_is_kex_enabled(
-               npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
+       kex_cap.bit.dip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
        /* ESP SPI: offset 0B, len 4B */
-       kex_cap.bit.ipsec_spi = npc_is_kex_enabled(npc, NPC_LID_LE,
-                                                  NPC_LT_LE_ESP, 0 * 8, 4 * 8);
+       kex_cap.bit.ipsec_spi = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_ESP, 0 * 8, 4 * 8);
        /* VXLAN VNI: offset 4B, len 3B */
-       kex_cap.bit.ld_vni = npc_is_kex_enabled(npc, NPC_LID_LE,
-                                               NPC_LT_LE_VXLAN, 0 * 8, 3 * 8);
+       kex_cap.bit.ld_vni = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_VXLAN, 0 * 8, 3 * 8);
 
        /* Custom L3 frame: varied offset and lengths */
-       kex_cap.bit.custom_l3 =
-               npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM0, 0, 0);
-       kex_cap.bit.custom_l3 |= (uint64_t)npc_is_kex_enabled(npc, NPC_LID_LC,
-                                       NPC_LT_LC_CUSTOM1, 0, 0);
+       kex_cap.bit.custom_l3 = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM0, 0, 0);
+       kex_cap.bit.custom_l3 |=
+               (uint64_t)npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_CUSTOM1, 0, 0);
        /* SCTP sport : offset 0B, len 2B */
-       kex_cap.bit.sctp_sport = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_SCTP, 0 * 8, 2 * 8);
+       kex_cap.bit.sctp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_SCTP, 0 * 8, 2 * 8);
        /* SCTP dport : offset 2B, len 2B */
-       kex_cap.bit.sctp_dport = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_SCTP, 2 * 8, 2 * 8);
+       kex_cap.bit.sctp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_SCTP, 2 * 8, 2 * 8);
        /* ICMP type : offset 0B, len 1B */
-       kex_cap.bit.icmp_type = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_ICMP, 0 * 8, 1 * 8);
+       kex_cap.bit.icmp_type = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 0 * 8, 1 * 8);
        /* ICMP code : offset 1B, len 1B */
-       kex_cap.bit.icmp_code = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_ICMP, 1 * 8, 1 * 8);
+       kex_cap.bit.icmp_code = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 1 * 8, 1 * 8);
        /* ICMP id : offset 4B, len 2B */
-       kex_cap.bit.icmp_id = npc_is_kex_enabled(npc, NPC_LID_LD,
-                                                NPC_LT_LD_ICMP, 4 * 8, 2 * 8);
+       kex_cap.bit.icmp_id = npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_ICMP, 4 * 8, 2 * 8);
        /* IGMP grp_addr : offset 4B, len 4B */
-       kex_cap.bit.igmp_grp_addr = npc_is_kex_enabled(
-               npc, NPC_LID_LD, NPC_LT_LD_IGMP, 4 * 8, 4 * 8);
+       kex_cap.bit.igmp_grp_addr =
+               npc_is_kex_enabled(npc, NPC_LID_LD, NPC_LT_LD_IGMP, 4 * 8, 4 * 8);
        /* GTPU teid : offset 4B, len 4B */
-       kex_cap.bit.gtpu_teid = npc_is_kex_enabled(
-               npc, NPC_LID_LE, NPC_LT_LE_GTPU, 4 * 8, 4 * 8);
+       kex_cap.bit.gtpv1_teid = npc_is_kex_enabled(npc, NPC_LID_LE, NPC_LT_LE_GTPU, 4 * 8, 4 * 8);
        return kex_cap.all_bits;
 }
 
drivers/common/cnxk/roc_npc_priv.h +9 -4
index b08539d8f8..1a597280d1 100644
@@ -100,6 +100,7 @@ enum npc_err_status {
 enum npc_mcam_intf { NPC_MCAM_RX, NPC_MCAM_TX };
 
 typedef union npc_kex_cap_terms_t {
+       /** Packet Matching Rule term fields */
        struct {
                /** Total length of received packet */
                uint64_t len : 1;
@@ -111,10 +112,14 @@ typedef union npc_kex_cap_terms_t {
                uint64_t vlan_id_0 : 1;
                /** Last VLAN ID (inner) */
                uint64_t vlan_id_x : 1;
+               /** PCP in the first VLAN header */
+               uint64_t vlan_pcp_0 : 1;
                /** destination MAC address */
                uint64_t dmac : 1;
                /** IP Protocol or IPv6 Next Header */
                uint64_t ip_proto : 1;
+               /** DSCP in IP header */
+               uint64_t ip_dscp : 1;
                /** Destination UDP port, implies IPPROTO=17 */
                uint64_t udp_dport : 1;
                /** Destination TCP port implies IPPROTO=6 */
@@ -155,12 +160,13 @@ typedef union npc_kex_cap_terms_t {
                uint64_t sctp_sport : 1;
                /** Destination SCTP port */
                uint64_t sctp_dport : 1;
-               /** GTPU Tunnel endpoint identifier */
-               uint64_t gtpu_teid : 1;
-
+               /** GTPv1 tunnel endpoint identifier */
+               uint64_t gtpv1_teid : 1;
        } bit;
+
        /** All bits of the bit field structure */
        uint64_t all_bits;
+
 } npc_kex_cap_terms_t;
 
 struct npc_parse_item_info {
--

2.35.3