Skip to content

Commit

Permalink
octeontx2-af: add parser support for Forward DSA
Browse files Browse the repository at this point in the history
Marvell Prestera switches supports distributed switch architecture
by inserting Forward DSA tag of 4 bytes right after ethernet SMAC.
This tag don't have a tpid field.

This patch provides parser and extraction support for the same.
Default ldata extraction profile added for FDSA such that Src_port
is extracted and placed inplace of vlanid field. Like extended DSA
and eDSA tags,a special PKIND of 62 is used for this tag.

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hariprasad Kelam authored and David S. Miller committed Sep 29, 2020
1 parent 4200691 commit b61c726
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/marvell/octeontx2/af/npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
144 changes: 144 additions & 0 deletions drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@

#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 */
Expand Down Expand Up @@ -172,6 +173,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,
Expand Down Expand Up @@ -277,6 +279,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 {
Expand Down Expand Up @@ -1364,6 +1367,15 @@ static const struct npc_kpu_profile_cam kpu1_cam_entries[] = {
0x0000,
0x0000,
},
{
NPC_S_KPU1_EXDSA, 0xff,
NPC_DSA_FDSA,
NPC_DSA_FDSA,
0x0000,
0x0000,
0x0000,
0x0000,
},
{
NPC_S_KPU1_EXDSA, 0xff,
0x0000,
Expand Down Expand Up @@ -4001,6 +4013,68 @@ 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,
},
{
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,
Expand Down Expand Up @@ -7678,6 +7752,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_L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},
{
NPC_ERRLEV_LB, NPC_EC_L2_K4,
0, 0, 0, 0, 1,
Expand Down Expand Up @@ -13238,6 +13376,12 @@ static const struct npc_mcam_kex npc_mkex_default = {
/* 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 */
Expand Down

0 comments on commit b61c726

Please sign in to comment.