octeontx2-af: add parser support for Forward DSA
authorHariprasad Kelam <hkelam@marvell.com>
Tue, 29 Sep 2020 09:28:16 +0000 (11:28 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Sep 2020 20:12:03 +0000 (13:12 -0700)
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>
drivers/net/ethernet/marvell/octeontx2/af/npc.h
drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h

index 3b069f378b2ac5b894899a18fcbb0846283905eb..e465da97598ffc53e952d554c6c10bf40b777019 100644 (file)
@@ -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,
 };
index a67e9ed718e7d2ec5d9cce7fb0a6fd0a96bebdcd..adc94bab9cbaf96c5877ca6c5b4963a3a10be3a3 100644 (file)
 
 #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 */
@@ -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,
@@ -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 {
@@ -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,
@@ -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,
@@ -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_LT_LA_ETHER,
+               0,
+               0, 0, 0, 0,
+       },
        {
                NPC_ERRLEV_LA, NPC_EC_EDSA_UNK,
                0, 0, 0, 0, 1,
@@ -10039,6 +10121,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,
@@ -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 */