octeontx2-af: Adjust LA pointer for cpt parse header
authorKiran Kumar K <kirankumark@marvell.com>
Wed, 29 Sep 2021 05:58:31 +0000 (11:28 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Sep 2021 12:04:31 +0000 (13:04 +0100)
In case of ltype NPC_LT_LA_CPT_HDR, LA pointer is pointing to the
start of cpt parse header. Since cpt parse header has veriable
length padding, this will be a problem for DMAC extraction. Adding
KPU profile changes to adjust the LA pointer to start at ether header
in case of cpt parse header by
   - Adding ptr advance in pkind 58 to a fixed value 40
   - Adding variable length offset 7 and mask 7 (pad len in
     CPT_PARSE_HDR).
Also added the missing static declaration for npc_set_var_len_offset_pkind
function.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

index 65280a8..1a8c537 100644 (file)
@@ -187,6 +187,8 @@ enum npc_kpu_parser_state {
        NPC_S_KPU2_PREHEADER,
        NPC_S_KPU2_EXDSA,
        NPC_S_KPU2_NGIO,
+       NPC_S_KPU2_CPT_CTAG,
+       NPC_S_KPU2_CPT_QINQ,
        NPC_S_KPU3_CTAG,
        NPC_S_KPU3_STAG,
        NPC_S_KPU3_QINQ,
@@ -1004,11 +1006,11 @@ static struct npc_kpu_profile_action ikpu_action_entries[] = {
        },
        {
                NPC_ERRLEV_RE, NPC_EC_NOERR,
-               40, 54, 58, 0, 0,
-               NPC_S_KPU1_CPT_HDR, 0, 0,
+               12, 16, 20, 0, 0,
+               NPC_S_KPU1_CPT_HDR, 40, 0,
                NPC_LID_LA, NPC_LT_NA,
                0,
-               0, 0, 0, 0,
+               7, 7, 0, 0,
 
        },
        {
@@ -1846,80 +1848,35 @@ static struct npc_kpu_profile_cam kpu1_cam_entries[] = {
        },
        {
                NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
-               0xffff,
                NPC_ETYPE_IP,
                0xffff,
                0x0000,
                0x0000,
-       },
-       {
-               NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
-               0xffff,
-               NPC_ETYPE_IP6,
-               0xffff,
                0x0000,
                0x0000,
        },
        {
                NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
-               0xffff,
-               NPC_ETYPE_CTAG,
-               0xffff,
-               0x0000,
-               0x0000,
-       },
-       {
-               NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
-               0xffff,
-               NPC_ETYPE_QINQ,
+               NPC_ETYPE_IP6,
                0xffff,
                0x0000,
                0x0000,
-       },
-       {
-               NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
-               0xffff,
                0x0000,
                0x0000,
-               NPC_ETYPE_IP,
-               0xffff,
        },
        {
                NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
+               NPC_ETYPE_CTAG,
                0xffff,
                0x0000,
                0x0000,
-               NPC_ETYPE_IP6,
-               0xffff,
-       },
-       {
-               NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
-               0xffff,
                0x0000,
                0x0000,
-               NPC_ETYPE_CTAG,
-               0xffff,
        },
        {
                NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
-               0xffff,
-               0x0000,
-               0x0000,
                NPC_ETYPE_QINQ,
                0xffff,
-       },
-       {
-               NPC_S_KPU1_CPT_HDR, 0xff,
-               0x0000,
-               0x0000,
                0x0000,
                0x0000,
                0x0000,
@@ -2930,6 +2887,42 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
                0x0000,
        },
        {
+               NPC_S_KPU2_CPT_CTAG, 0xff,
+               NPC_ETYPE_IP,
+               0xffff,
+               0x0000,
+               0x0000,
+               0x0000,
+               0x0000,
+       },
+       {
+               NPC_S_KPU2_CPT_CTAG, 0xff,
+               NPC_ETYPE_IP6,
+               0xffff,
+               0x0000,
+               0x0000,
+               0x0000,
+               0x0000,
+       },
+       {
+               NPC_S_KPU2_CPT_QINQ, 0xff,
+               NPC_ETYPE_CTAG,
+               0xffff,
+               NPC_ETYPE_IP,
+               0xffff,
+               0x0000,
+               0x0000,
+       },
+       {
+               NPC_S_KPU2_CPT_QINQ, 0xff,
+               NPC_ETYPE_CTAG,
+               0xffff,
+               NPC_ETYPE_IP6,
+               0xffff,
+               0x0000,
+               0x0000,
+       },
+       {
                NPC_S_NA, 0X00,
                0x0000,
                0x0000,
@@ -9167,39 +9160,7 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = {
        {
                NPC_ERRLEV_RE, NPC_EC_NOERR,
                8, 0, 6, 3, 0,
-               NPC_S_KPU5_CPT_IP, 56, 1,
-               NPC_LID_LA, NPC_LT_LA_CPT_HDR,
-               0,
-               0, 0, 0, 0,
-       },
-       {
-               NPC_ERRLEV_RE, NPC_EC_NOERR,
-               6, 0, 0, 3, 0,
-               NPC_S_KPU5_CPT_IP6, 56, 1,
-               NPC_LID_LA, NPC_LT_LA_CPT_HDR,
-               0,
-               0, 0, 0, 0,
-       },
-       {
-               NPC_ERRLEV_RE, NPC_EC_NOERR,
-               4, 8, 0, 0, 0,
-               NPC_S_KPU2_CTAG, 54, 1,
-               NPC_LID_LA, NPC_LT_LA_CPT_HDR,
-               NPC_F_LA_U_HAS_TAG | NPC_F_LA_L_WITH_VLAN,
-               0, 0, 0, 0,
-       },
-       {
-               NPC_ERRLEV_RE, NPC_EC_NOERR,
-               4, 8, 0, 0, 0,
-               NPC_S_KPU2_QINQ, 54, 1,
-               NPC_LID_LA, NPC_LT_LA_CPT_HDR,
-               NPC_F_LA_U_HAS_TAG | NPC_F_LA_L_WITH_VLAN,
-               0, 0, 0, 0,
-       },
-       {
-               NPC_ERRLEV_RE, NPC_EC_NOERR,
-               8, 0, 6, 3, 0,
-               NPC_S_KPU5_CPT_IP, 60, 1,
+               NPC_S_KPU5_CPT_IP, 14, 1,
                NPC_LID_LA, NPC_LT_LA_CPT_HDR,
                0,
                0, 0, 0, 0,
@@ -9207,7 +9168,7 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = {
        {
                NPC_ERRLEV_RE, NPC_EC_NOERR,
                6, 0, 0, 3, 0,
-               NPC_S_KPU5_CPT_IP6, 60, 1,
+               NPC_S_KPU5_CPT_IP6, 14, 1,
                NPC_LID_LA, NPC_LT_LA_CPT_HDR,
                0,
                0, 0, 0, 0,
@@ -9215,7 +9176,7 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = {
        {
                NPC_ERRLEV_RE, NPC_EC_NOERR,
                4, 8, 0, 0, 0,
-               NPC_S_KPU2_CTAG, 58, 1,
+               NPC_S_KPU2_CPT_CTAG, 12, 1,
                NPC_LID_LA, NPC_LT_LA_CPT_HDR,
                NPC_F_LA_U_HAS_TAG | NPC_F_LA_L_WITH_VLAN,
                0, 0, 0, 0,
@@ -9223,21 +9184,13 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = {
        {
                NPC_ERRLEV_RE, NPC_EC_NOERR,
                4, 8, 0, 0, 0,
-               NPC_S_KPU2_QINQ, 58, 1,
+               NPC_S_KPU2_CPT_QINQ, 12, 1,
                NPC_LID_LA, NPC_LT_LA_CPT_HDR,
                NPC_F_LA_U_HAS_TAG | NPC_F_LA_L_WITH_VLAN,
                0, 0, 0, 0,
        },
        {
                NPC_ERRLEV_RE, NPC_EC_NOERR,
-               0, 0, 0, 0, 1,
-               NPC_S_NA, 0, 1,
-               NPC_LID_LA, NPC_LT_LA_CPT_HDR,
-               NPC_F_LA_L_UNK_ETYPE,
-               0, 0, 0, 0,
-       },
-       {
-               NPC_ERRLEV_RE, NPC_EC_NOERR,
                12, 0, 0, 1, 0,
                NPC_S_KPU3_VLAN_EXDSA, 12, 1,
                NPC_LID_LA, NPC_LT_LA_ETHER,
@@ -10130,6 +10083,38 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = {
                0, 0, 0, 0,
        },
        {
+               NPC_ERRLEV_RE, NPC_EC_NOERR,
+               8, 0, 6, 2, 0,
+               NPC_S_KPU5_CPT_IP, 6, 1,
+               NPC_LID_LB, NPC_LT_LB_CTAG,
+               0,
+               0, 0, 0, 0,
+       },
+       {
+               NPC_ERRLEV_RE, NPC_EC_NOERR,
+               6, 0, 0, 2, 0,
+               NPC_S_KPU5_CPT_IP6, 6, 1,
+               NPC_LID_LB, NPC_LT_LB_CTAG,
+               0,
+               0, 0, 0, 0,
+       },
+       {
+               NPC_ERRLEV_RE, NPC_EC_NOERR,
+               8, 0, 6, 2, 0,
+               NPC_S_KPU5_CPT_IP, 10, 1,
+               NPC_LID_LB, NPC_LT_LB_STAG_QINQ,
+               NPC_F_LB_U_MORE_TAG | NPC_F_LB_L_WITH_CTAG,
+               0, 0, 0, 0,
+       },
+       {
+               NPC_ERRLEV_RE, NPC_EC_NOERR,
+               6, 0, 0, 2, 0,
+               NPC_S_KPU5_CPT_IP6, 10, 1,
+               NPC_LID_LB, NPC_LT_LB_STAG_QINQ,
+               NPC_F_LB_U_MORE_TAG | NPC_F_LB_L_WITH_CTAG,
+               0, 0, 0, 0,
+       },
+       {
                NPC_ERRLEV_LB, NPC_EC_L2_K3,
                0, 0, 0, 0, 1,
                NPC_S_NA, 0, 0,
index 2881ccc..bb6b42b 100644 (file)
@@ -3167,7 +3167,7 @@ int rvu_mbox_handler_npc_get_kex_cfg(struct rvu *rvu, struct msg_req *req,
        return 0;
 }
 
-int
+static int
 npc_set_var_len_offset_pkind(struct rvu *rvu, u16 pcifunc, u64 pkind,
                             u8 var_len_off, u8 var_len_off_mask, u8 shift_dir)
 {