Commit c2f8ceda authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'octeontx2-af-cleanup-and-extend-parser-config'



Stanislaw Kardach says:

====================
octeontx2-af: cleanup and extend parser config

Current KPU configuration data is spread over multiple files which makes
it hard to read. Clean this up by gathering all configuration data in a
single structure and also in a single file (npc_profile.h). This should
increase the readability of KPU handling code (since it always
references same structure), simplify updates to the CAM key extraction
code and allow abstracting out the configuration source.
Additionally extend and fix the parser config to support additional DSA
types, NAT-T-ESP and IPv6 fields.

Patch 1 ensures that CUSTOMx LTYPEs are not aliased with meaningful
LTYPEs where possible.

Patch 2 gathers all KPU profile related data into a single struct and
creates an adapter structure which provides an interface to the KPU
profile for the octeontx2-af driver.

Patches 3-4 add support for Extended DSA, eDSA and Forward DSA.

Patches 5-6 adds IPv6 fields to CAM key extraction and optimize the
parser performance for fragmented IPv6 packets.

Patch 7 refactors ESP handling in the parser to support NAT-T-ESP.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d61491a5 4cb2cce0
Loading
Loading
Loading
Loading
+40 −3
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ enum npc_kpu_lb_ltype {
	NPC_LT_LB_EDSA_VLAN,
	NPC_LT_LB_EXDSA,
	NPC_LT_LB_EXDSA_VLAN,
	NPC_LT_LB_FDSA,
	NPC_LT_LB_CUSTOM0 = 0xE,
	NPC_LT_LB_CUSTOM1 = 0xF,
};
@@ -77,21 +78,21 @@ enum npc_kpu_ld_ltype {
	NPC_LT_LD_ICMP,
	NPC_LT_LD_SCTP,
	NPC_LT_LD_ICMP6,
	NPC_LT_LD_CUSTOM0,
	NPC_LT_LD_CUSTOM1,
	NPC_LT_LD_IGMP = 8,
	NPC_LT_LD_ESP,
	NPC_LT_LD_AH,
	NPC_LT_LD_GRE,
	NPC_LT_LD_NVGRE,
	NPC_LT_LD_NSH,
	NPC_LT_LD_TU_MPLS_IN_NSH,
	NPC_LT_LD_TU_MPLS_IN_IP,
	NPC_LT_LD_CUSTOM0 = 0xE,
	NPC_LT_LD_CUSTOM1 = 0xF,
};

enum npc_kpu_le_ltype {
	NPC_LT_LE_VXLAN = 1,
	NPC_LT_LE_GENEVE,
	NPC_LT_LE_ESP,
	NPC_LT_LE_GTPU = 4,
	NPC_LT_LE_VXLANGPE,
	NPC_LT_LE_GTPC,
@@ -296,6 +297,9 @@ struct nix_rx_action {
#endif
};

/* NPC_AF_INTFX_KEX_CFG field masks */
#define NPC_PARSE_NIBBLE		GENMASK_ULL(30, 0)

/* NIX Receive Vtag Action Structure */
#define VTAG0_VALID_BIT		BIT_ULL(15)
#define VTAG0_TYPE_MASK		GENMASK_ULL(14, 12)
@@ -320,4 +324,37 @@ struct npc_mcam_kex {
	u64 intf_ld_flags[NPC_MAX_INTF][NPC_MAX_LD][NPC_MAX_LFL];
} __packed;

struct npc_lt_def {
	u8	ltype_mask;
	u8	ltype_match;
	u8	lid;
};

struct npc_lt_def_ipsec {
	u8	ltype_mask;
	u8	ltype_match;
	u8	lid;
	u8	spi_offset;
	u8	spi_nz;
};

struct npc_lt_def_cfg {
	struct npc_lt_def	rx_ol2;
	struct npc_lt_def	rx_oip4;
	struct npc_lt_def	rx_iip4;
	struct npc_lt_def	rx_oip6;
	struct npc_lt_def	rx_iip6;
	struct npc_lt_def	rx_otcp;
	struct npc_lt_def	rx_itcp;
	struct npc_lt_def	rx_oudp;
	struct npc_lt_def	rx_iudp;
	struct npc_lt_def	rx_osctp;
	struct npc_lt_def	rx_isctp;
	struct npc_lt_def_ipsec	rx_ipsec[2];
	struct npc_lt_def	pck_ol2;
	struct npc_lt_def	pck_oip4;
	struct npc_lt_def	pck_oip6;
	struct npc_lt_def	pck_iip4;
};

#endif /* NPC_H */
+406 −67
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@
#define NPC_UDP_PORT_VXLANGPE	4790
#define NPC_UDP_PORT_GENEVE	6081
#define NPC_UDP_PORT_MPLS	6635
#define NPC_UDP_PORT_ESP	4500

#define NPC_VXLANGPE_NP_IP	0x1
#define NPC_VXLANGPE_NP_IP6	0x2
@@ -139,6 +140,13 @@

#define NPC_DSA_EXTEND		0x1000
#define NPC_DSA_EDSA		0x8000
#define NPC_DSA_FDSA		0xc000

#define NPC_KEXOF_DMAC	8
#define MKEX_SIGN	0x19bbfdbd15f /* strtoull of "mkexprof" with base:36 */
#define KEX_LD_CFG(bytesm1, hdr_ofs, ena, flags_ena, key_ofs)		\
			(((bytesm1) << 16) | ((hdr_ofs) << 8) | ((ena) << 7) | \
			 ((flags_ena) << 6) | ((key_ofs) & 0x3F))

enum npc_kpu_parser_state {
	NPC_S_NA = 0,
@@ -166,6 +174,7 @@ enum npc_kpu_parser_state {
	NPC_S_KPU3_DSA,
	NPC_S_KPU4_MPLS,
	NPC_S_KPU4_NSH,
	NPC_S_KPU4_FDSA,
	NPC_S_KPU5_IP,
	NPC_S_KPU5_IP6,
	NPC_S_KPU5_ARP,
@@ -189,7 +198,6 @@ enum npc_kpu_parser_state {
	NPC_S_KPU8_IGMP,
	NPC_S_KPU8_ICMP6,
	NPC_S_KPU8_GRE,
	NPC_S_KPU8_ESP,
	NPC_S_KPU8_AH,
	NPC_S_KPU9_TU_MPLS_IN_GRE,
	NPC_S_KPU9_TU_MPLS_IN_NSH,
@@ -201,6 +209,7 @@ enum npc_kpu_parser_state {
	NPC_S_KPU9_GENEVE,
	NPC_S_KPU9_GTPC,
	NPC_S_KPU9_GTPU,
	NPC_S_KPU9_ESP,
	NPC_S_KPU10_TU_MPLS_IN_VXLANGPE,
	NPC_S_KPU10_TU_MPLS_PL,
	NPC_S_KPU10_TU_MPLS,
@@ -271,6 +280,7 @@ enum npc_kpu_lb_lflag {
	NPC_F_LB_L_EDSA_VLAN,
	NPC_F_LB_L_EXDSA,
	NPC_F_LB_L_EXDSA_VLAN,
	NPC_F_LB_L_FDSA,
};

enum npc_kpu_lc_uflag {
@@ -979,7 +989,7 @@ static const struct npc_kpu_profile_action ikpu_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		12, 16, 20, 0, 0,
		12, 14, 20, 0, 0,
		NPC_S_KPU1_EXDSA, 0, 0,
		NPC_LID_LA, NPC_LT_NA,
		0,
@@ -1351,10 +1361,19 @@ static const struct npc_kpu_profile_cam kpu1_cam_entries[] = {
	},
	{
		NPC_S_KPU1_EXDSA, 0xff,
		0x0000,
		0x0000,
		NPC_DSA_EXTEND,
		NPC_DSA_EXTEND,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU1_EXDSA, 0xff,
		NPC_DSA_FDSA,
		NPC_DSA_FDSA,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
@@ -3995,6 +4014,69 @@ static const struct npc_kpu_profile_cam kpu4_cam_entries[] = {
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU4_FDSA, 0xff,
		NPC_ETYPE_IP,
		0xffff,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU4_FDSA, 0xff,
		NPC_ETYPE_IP6,
		0xffff,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU4_FDSA, 0xff,
		NPC_ETYPE_ARP,
		0xffff,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU4_FDSA, 0xff,
		NPC_ETYPE_RARP,
		0xffff,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU4_FDSA, 0xff,
		NPC_ETYPE_PTP,
		0xffff,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU4_FDSA, 0xff,
		NPC_ETYPE_FCOE,
		0xffff,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU4_FDSA, 0xff,
		0x0000,
		NPC_DSA_FDSA,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_NA, 0X00,
		0x0000,
@@ -5341,15 +5423,24 @@ static const struct npc_kpu_profile_cam kpu8_cam_entries[] = {
	},
	{
		NPC_S_KPU8_UDP, 0xff,
		NPC_UDP_PORT_ESP,
		0xffff,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU8_UDP, 0xff,
		0x0000,
		0x0000,
		NPC_UDP_PORT_ESP,
		0xffff,
		0x0000,
		0x0000,
	},
	{
		NPC_S_KPU8_SCTP, 0xff,
		NPC_S_KPU8_UDP, 0xff,
		0x0000,
		0x0000,
		0x0000,
@@ -5358,7 +5449,7 @@ static const struct npc_kpu_profile_cam kpu8_cam_entries[] = {
		0x0000,
	},
	{
		NPC_S_KPU8_ICMP, 0xff,
		NPC_S_KPU8_SCTP, 0xff,
		0x0000,
		0x0000,
		0x0000,
@@ -5367,7 +5458,7 @@ static const struct npc_kpu_profile_cam kpu8_cam_entries[] = {
		0x0000,
	},
	{
		NPC_S_KPU8_IGMP, 0xff,
		NPC_S_KPU8_ICMP, 0xff,
		0x0000,
		0x0000,
		0x0000,
@@ -5376,7 +5467,7 @@ static const struct npc_kpu_profile_cam kpu8_cam_entries[] = {
		0x0000,
	},
	{
		NPC_S_KPU8_ICMP6, 0xff,
		NPC_S_KPU8_IGMP, 0xff,
		0x0000,
		0x0000,
		0x0000,
@@ -5385,7 +5476,7 @@ static const struct npc_kpu_profile_cam kpu8_cam_entries[] = {
		0x0000,
	},
	{
		NPC_S_KPU8_ESP, 0xff,
		NPC_S_KPU8_ICMP6, 0xff,
		0x0000,
		0x0000,
		0x0000,
@@ -6323,6 +6414,15 @@ static const struct npc_kpu_profile_cam kpu9_cam_entries[] = {
		0x0000,
		NPC_MPLS_S,
	},
	{
		NPC_S_KPU9_ESP, 0xff,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
		0x0000,
	},
	{
		NPC_S_NA, 0X00,
		0x0000,
@@ -7672,6 +7772,14 @@ static const struct npc_kpu_profile_action kpu1_action_entries[] = {
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		4, 8, 16, 2, 0,
		NPC_S_KPU4_FDSA, 12, 1,
		NPC_LID_LA, NPC_LT_LA_ETHER,
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_LA, NPC_EC_EDSA_UNK,
		0, 0, 0, 0, 1,
@@ -10033,6 +10141,62 @@ static const struct npc_kpu_profile_action kpu4_action_entries[] = {
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		8, 0, 6, 0, 0,
		NPC_S_KPU5_IP, 6, 1,
		NPC_LID_LB, NPC_LT_LB_FDSA,
		NPC_F_LB_L_FDSA,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		6, 0, 0, 0, 0,
		NPC_S_KPU5_IP6, 6, 1,
		NPC_LID_LB, NPC_LT_LB_FDSA,
		NPC_F_LB_L_FDSA,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 0,
		NPC_S_KPU5_ARP, 6, 1,
		NPC_LID_LB, NPC_LT_LB_FDSA,
		NPC_F_LB_L_FDSA,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		8, 0, 6, 0, 0,
		NPC_S_KPU5_RARP, 6, 1,
		NPC_LID_LB, NPC_LT_LB_FDSA,
		NPC_F_LB_L_FDSA,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		6, 0, 0, 0, 0,
		NPC_S_KPU5_PTP, 6, 1,
		NPC_LID_LB, NPC_LT_LB_FDSA,
		NPC_F_LB_L_FDSA,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 0,
		NPC_S_KPU5_FCOE, 6, 1,
		NPC_LID_LB, NPC_LT_LB_FDSA,
		NPC_F_LB_L_FDSA,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 1,
		NPC_LID_LB, NPC_LT_LB_FDSA,
		NPC_F_LB_U_UNK_ETYPE | NPC_F_LB_L_FDSA,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_LB, NPC_EC_L2_K4,
		0, 0, 0, 0, 1,
@@ -10102,8 +10266,8 @@ static const struct npc_kpu_profile_action kpu5_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 2, 0,
		NPC_S_KPU8_ESP, 20, 1,
		0, 0, 0, 3, 0,
		NPC_S_KPU9_ESP, 20, 1,
		NPC_LID_LC, NPC_LT_LC_IP,
		0,
		0, 0, 0, 0,
@@ -10206,8 +10370,8 @@ static const struct npc_kpu_profile_action kpu5_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 2, 0,
		NPC_S_KPU8_ESP, 0, 1,
		0, 0, 0, 3, 0,
		NPC_S_KPU9_ESP, 0, 1,
		NPC_LID_LC, NPC_LT_LC_IP_OPT,
		0,
		0, 0xf, 0, 2,
@@ -10414,8 +10578,8 @@ static const struct npc_kpu_profile_action kpu5_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 2, 0,
		NPC_S_KPU8_ESP, 40, 1,
		0, 0, 0, 3, 0,
		NPC_S_KPU9_ESP, 40, 1,
		NPC_LID_LC, NPC_LT_LC_IP6_EXT,
		0,
		0, 0, 0, 0,
@@ -10561,80 +10725,80 @@ static const struct npc_kpu_profile_action kpu6_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		2, 12, 0, 1, 0,
		NPC_S_KPU8_TCP, 8, 0,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		2, 8, 10, 1, 0,
		NPC_S_KPU8_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, 8, 0,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		2, 6, 10, 2, 0,
		NPC_S_KPU9_TU_MPLS_IN_IP, 8, 0,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		0, 0, 0, 0,
@@ -10689,8 +10853,8 @@ static const struct npc_kpu_profile_action kpu6_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 1, 0,
		NPC_S_KPU8_ESP, 8, 0,
		0, 0, 0, 2, 0,
		NPC_S_KPU9_ESP, 8, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		1, 0xff, 0, 3,
@@ -10793,8 +10957,8 @@ static const struct npc_kpu_profile_action kpu6_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 1, 0,
		NPC_S_KPU8_ESP, 8, 0,
		0, 0, 0, 2, 0,
		NPC_S_KPU9_ESP, 8, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		1, 0xff, 0, 3,
@@ -10908,8 +11072,8 @@ static const struct npc_kpu_profile_action kpu7_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 0,
		NPC_S_KPU8_ESP, 8, 0,
		0, 0, 0, 1, 0,
		NPC_S_KPU9_ESP, 8, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		1, 0xff, 0, 3,
@@ -10956,80 +11120,80 @@ static const struct npc_kpu_profile_action kpu7_action_entries[] = {
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		2, 12, 0, 0, 0,
		NPC_S_KPU8_TCP, 8, 0,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		0, 0, 0, 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	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		6, 0, 0, 4, 0,
		NPC_S_KPU12_TU_IP6, 8, 0,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		2, 6, 10, 1, 0,
		NPC_S_KPU9_TU_MPLS_IN_IP, 8, 0,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 0,
		NPC_LID_LC, NPC_LT_NA,
		0,
		0, 0, 0, 0,
@@ -11229,6 +11393,22 @@ static const struct npc_kpu_profile_action kpu8_action_entries[] = {
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 0,
		NPC_S_KPU9_ESP, 8, 1,
		NPC_LID_LD, NPC_LT_LD_UDP,
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 0,
		NPC_S_KPU9_ESP, 8, 1,
		NPC_LID_LD, NPC_LT_LD_UDP,
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 7, 0,
@@ -11269,14 +11449,6 @@ static const struct npc_kpu_profile_action kpu8_action_entries[] = {
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 1,
		NPC_LID_LD, NPC_LT_LD_ESP,
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 1,
@@ -12104,6 +12276,14 @@ static const struct npc_kpu_profile_action kpu9_action_entries[] = {
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_RE, NPC_EC_NOERR,
		0, 0, 0, 0, 1,
		NPC_S_NA, 0, 1,
		NPC_LID_LE, NPC_LT_LE_ESP,
		0,
		0, 0, 0, 0,
	},
	{
		NPC_ERRLEV_LE, NPC_EC_UNK,
		0, 0, 0, 0, 1,
@@ -13114,4 +13294,163 @@ static const struct npc_kpu_profile npc_kpu_profiles[] = {
	},
};

static const struct npc_lt_def_cfg npc_lt_defaults = {
	.rx_ol2 = {
		.lid = NPC_LID_LA,
		.ltype_match = NPC_LT_LA_ETHER,
		.ltype_mask = 0x0F,
	},
	.rx_oip4 = {
		.lid = NPC_LID_LC,
		.ltype_match = NPC_LT_LC_IP,
		.ltype_mask = 0x0E,
	},
	.rx_iip4 = {
		.lid = NPC_LID_LG,
		.ltype_match = NPC_LT_LG_TU_IP,
		.ltype_mask = 0x0F,
	},
	.rx_oip6 = {
		.lid = NPC_LID_LC,
		.ltype_match = NPC_LT_LC_IP6,
		.ltype_mask = 0x0E,
	},
	.rx_iip6 = {
		.lid = NPC_LID_LG,
		.ltype_match = NPC_LT_LG_TU_IP6,
		.ltype_mask = 0x0F,
	},
	.rx_otcp = {
		.lid = NPC_LID_LD,
		.ltype_match = NPC_LT_LD_TCP,
		.ltype_mask = 0x0F,
	},
	.rx_itcp = {
		.lid = NPC_LID_LH,
		.ltype_match = NPC_LT_LH_TU_TCP,
		.ltype_mask = 0x0F,
	},
	.rx_oudp = {
		.lid = NPC_LID_LD,
		.ltype_match = NPC_LT_LD_UDP,
		.ltype_mask = 0x0F,
	},
	.rx_iudp = {
		.lid = NPC_LID_LH,
		.ltype_match = NPC_LT_LH_TU_UDP,
		.ltype_mask = 0x0F,
	},
	.rx_osctp = {
		.lid = NPC_LID_LD,
		.ltype_match = NPC_LT_LD_SCTP,
		.ltype_mask = 0x0F,
	},
	.rx_isctp = {
		.lid = NPC_LID_LH,
		.ltype_match = NPC_LT_LH_TU_SCTP,
		.ltype_mask = 0x0F,
	},
	.rx_ipsec = {
		{
			.lid = NPC_LID_LE,
			.ltype_match = NPC_LT_LE_ESP,
			.ltype_mask = 0x0F,
		},
		{
			.spi_offset = 8,
			.lid = NPC_LID_LH,
			.ltype_match = NPC_LT_LH_TU_ESP,
			.ltype_mask = 0x0F,
		},
	},
	.pck_ol2 = {
			.lid = NPC_LID_LA,
			.ltype_match = NPC_LT_LA_ETHER,
			.ltype_mask = 0x0F,
	},
	.pck_oip4 = {
			.lid = NPC_LID_LC,
			.ltype_match = NPC_LT_LC_IP,
			.ltype_mask = 0x0E,
	},
	.pck_iip4 = {
			.lid = NPC_LID_LG,
			.ltype_match = NPC_LT_LG_TU_IP,
			.ltype_mask = 0x0F,
	},
};

static const struct npc_mcam_kex npc_mkex_default = {
	.mkex_sign = MKEX_SIGN,
	.name = "default",
	.kpu_version = NPC_KPU_PROFILE_VER,
	.keyx_cfg = {
		/* nibble: LA..LE (ltype only) + Channel */
		[NIX_INTF_RX] = ((u64)NPC_MCAM_KEY_X2 << 32) | 0x49247,
		[NIX_INTF_TX] = ((u64)NPC_MCAM_KEY_X2 << 32) | ((1ULL << 19) - 1),
	},
	.intf_lid_lt_ld = {
	/* Default RX MCAM KEX profile */
	[NIX_INTF_RX] = {
		[NPC_LID_LA] = {
			/* Layer A: Ethernet: */
			[NPC_LT_LA_ETHER] = {
				/* DMAC: 6 bytes, KW1[47:0] */
				KEX_LD_CFG(0x05, 0x0, 0x1, 0x0, NPC_KEXOF_DMAC),
				/* Ethertype: 2 bytes, KW0[47:32] */
				KEX_LD_CFG(0x01, 0xc, 0x1, 0x0, 0x4),
			},
		},
		[NPC_LID_LB] = {
			/* Layer B: Single VLAN (CTAG) */
			/* CTAG VLAN[2..3] + Ethertype, 4 bytes, KW0[63:32] */
			[NPC_LT_LB_CTAG] = {
				KEX_LD_CFG(0x03, 0x0, 0x1, 0x0, 0x4),
			},
			/* Layer B: Stacked VLAN (STAG|QinQ) */
			[NPC_LT_LB_STAG_QINQ] = {
				/* CTAG VLAN[2..3] + Ethertype, 4 bytes, KW0[63:32] */
				KEX_LD_CFG(0x03, 0x4, 0x1, 0x0, 0x4),
			},
			[NPC_LT_LB_FDSA] = {
				/* SWITCH PORT: 1 byte, KW0[63:48] */
				KEX_LD_CFG(0x0, 0x1, 0x1, 0x0, 0x6),
				/* Ethertype: 2 bytes, KW0[47:32] */
				KEX_LD_CFG(0x01, 0x4, 0x1, 0x0, 0x4),
			},
		},
		[NPC_LID_LC] = {
			/* Layer C: IPv4 */
			[NPC_LT_LC_IP] = {
				/* SIP+DIP: 8 bytes, KW2[63:0] */
				KEX_LD_CFG(0x07, 0xc, 0x1, 0x0, 0x10),
				/* TOS: 1 byte, KW1[63:56] */
				KEX_LD_CFG(0x0, 0x1, 0x1, 0x0, 0xf),
			},
			/* Layer C: IPv6 */
			[NPC_LT_LC_IP6] = {
				/* Everything up to SADDR: 8 bytes, KW2[63:0] */
				KEX_LD_CFG(0x07, 0x0, 0x1, 0x0, 0x10),
			},
		},
		[NPC_LID_LD] = {
			/* Layer D:UDP */
			[NPC_LT_LD_UDP] = {
				/* SPORT: 2 bytes, KW3[15:0] */
				KEX_LD_CFG(0x1, 0x0, 0x1, 0x0, 0x18),
				/* DPORT: 2 bytes, KW3[31:16] */
				KEX_LD_CFG(0x1, 0x2, 0x1, 0x0, 0x1a),
			},
			/* Layer D:TCP */
			[NPC_LT_LD_TCP] = {
				/* SPORT: 2 bytes, KW3[15:0] */
				KEX_LD_CFG(0x1, 0x0, 0x1, 0x0, 0x18),
				/* DPORT: 2 bytes, KW3[31:16] */
				KEX_LD_CFG(0x1, 0x2, 0x1, 0x0, 0x1a),
			},
		},
	},
	},
};

#endif /* NPC_PROFILE_H */
+17 −0
Original line number Diff line number Diff line
@@ -291,6 +291,20 @@ struct rvu_fwdata {

struct ptp;

/* KPU profile adapter structure gathering all KPU configuration data and abstracting out the
 * source where it came from.
 */
struct npc_kpu_profile_adapter {
	const char			*name;
	u64				version;
	const struct npc_lt_def_cfg	*lt_def;
	const struct npc_kpu_profile_action	*ikpu; /* array[pkinds] */
	const struct npc_kpu_profile	*kpu; /* array[kpus] */
	const struct npc_mcam_kex	*mkex;
	size_t				pkinds;
	size_t				kpus;
};

struct rvu {
	void __iomem		*afreg_base;
	void __iomem		*pfreg_base;
@@ -339,6 +353,9 @@ struct rvu {
	/* Firmware data */
	struct rvu_fwdata	*fwdata;

	/* NPC KPU data */
	struct npc_kpu_profile_adapter kpu;

	struct ptp		*ptp;

#ifdef CONFIG_DEBUG_FS
+24 −12
Original line number Diff line number Diff line
@@ -3112,6 +3112,7 @@ static int nix_aq_init(struct rvu *rvu, struct rvu_block *block)

int rvu_nix_init(struct rvu *rvu)
{
	const struct npc_lt_def_cfg *ltdefs;
	struct rvu_hwinfo *hw = rvu->hw;
	struct rvu_block *block;
	int blkaddr, err;
@@ -3142,6 +3143,7 @@ int rvu_nix_init(struct rvu *rvu)
		rvu_write64(rvu, blkaddr, NIX_AF_SQM_DBG_CTL_STATUS, cfg);
	}

	ltdefs = rvu->kpu.lt_def;
	/* Calibrate X2P bus to check if CGX/LBK links are fine */
	err = nix_calibrate_x2p(rvu, blkaddr);
	if (err)
@@ -3189,28 +3191,38 @@ int rvu_nix_init(struct rvu *rvu)
		 * and validate length and checksums.
		 */
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OL2,
			    (NPC_LID_LA << 8) | (NPC_LT_LA_ETHER << 4) | 0x0F);
			    (ltdefs->rx_ol2.lid << 8) | (ltdefs->rx_ol2.ltype_match << 4) |
			    ltdefs->rx_ol2.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OIP4,
			    (NPC_LID_LC << 8) | (NPC_LT_LC_IP << 4) | 0x0F);
			    (ltdefs->rx_oip4.lid << 8) | (ltdefs->rx_oip4.ltype_match << 4) |
			    ltdefs->rx_oip4.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_IIP4,
			    (NPC_LID_LG << 8) | (NPC_LT_LG_TU_IP << 4) | 0x0F);
			    (ltdefs->rx_iip4.lid << 8) | (ltdefs->rx_iip4.ltype_match << 4) |
			    ltdefs->rx_iip4.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OIP6,
			    (NPC_LID_LC << 8) | (NPC_LT_LC_IP6 << 4) | 0x0F);
			    (ltdefs->rx_oip6.lid << 8) | (ltdefs->rx_oip6.ltype_match << 4) |
			    ltdefs->rx_oip6.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_IIP6,
			    (NPC_LID_LG << 8) | (NPC_LT_LG_TU_IP6 << 4) | 0x0F);
			    (ltdefs->rx_iip6.lid << 8) | (ltdefs->rx_iip6.ltype_match << 4) |
			    ltdefs->rx_iip6.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OTCP,
			    (NPC_LID_LD << 8) | (NPC_LT_LD_TCP << 4) | 0x0F);
			    (ltdefs->rx_otcp.lid << 8) | (ltdefs->rx_otcp.ltype_match << 4) |
			    ltdefs->rx_otcp.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_ITCP,
			    (NPC_LID_LH << 8) | (NPC_LT_LH_TU_TCP << 4) | 0x0F);
			    (ltdefs->rx_itcp.lid << 8) | (ltdefs->rx_itcp.ltype_match << 4) |
			    ltdefs->rx_itcp.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OUDP,
			    (NPC_LID_LD << 8) | (NPC_LT_LD_UDP << 4) | 0x0F);
			    (ltdefs->rx_oudp.lid << 8) | (ltdefs->rx_oudp.ltype_match << 4) |
			    ltdefs->rx_oudp.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_IUDP,
			    (NPC_LID_LH << 8) | (NPC_LT_LH_TU_UDP << 4) | 0x0F);
			    (ltdefs->rx_iudp.lid << 8) | (ltdefs->rx_iudp.ltype_match << 4) |
			    ltdefs->rx_iudp.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OSCTP,
			    (NPC_LID_LD << 8) | (NPC_LT_LD_SCTP << 4) | 0x0F);
			    (ltdefs->rx_osctp.lid << 8) | (ltdefs->rx_osctp.ltype_match << 4) |
			    ltdefs->rx_osctp.ltype_mask);
		rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_ISCTP,
			    (NPC_LID_LH << 8) | (NPC_LT_LH_TU_SCTP << 4) |
			    0x0F);
			    (ltdefs->rx_isctp.lid << 8) | (ltdefs->rx_isctp.ltype_match << 4) |
			    ltdefs->rx_isctp.ltype_mask);

		err = nix_rx_flowkey_alg_cfg(rvu, blkaddr);
		if (err)
+70 −132

File changed.

Preview size limit exceeded, changes collapsed.