Skip to content

Commit

Permalink
octeontx2-af: add parser support for NAT-T-ESP
Browse files Browse the repository at this point in the history
Add support for NAT-T-ESP to KPU parser configuration. NAT ESP is a UDP
based protocol. So move ESP to LE so that both UDP and ESP can be
extracted.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kiran Kumar K authored and David S. Miller committed Sep 29, 2020
1 parent 246f7d8 commit 4cb2cce
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 29 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/marvell/octeontx2/af/npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ enum npc_kpu_ld_ltype {
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,
Expand All @@ -93,6 +92,7 @@ enum npc_kpu_ld_ltype {
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,
Expand Down
92 changes: 64 additions & 28 deletions drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -197,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,
Expand All @@ -209,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,
Expand Down Expand Up @@ -4056,6 +4057,7 @@ static const struct npc_kpu_profile_cam kpu4_cam_entries[] = {
0x0000,
0x0000,
0x0000,
0x0000,
},
{
NPC_S_KPU4_FDSA, 0xff,
Expand Down Expand Up @@ -5421,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,
Expand All @@ -5438,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,
Expand All @@ -5447,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,
Expand All @@ -5456,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,
Expand All @@ -5465,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,
Expand Down Expand Up @@ -6403,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,
Expand Down Expand Up @@ -10246,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,
Expand Down Expand Up @@ -10350,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,
Expand Down Expand Up @@ -10558,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,
Expand Down Expand Up @@ -10833,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,
Expand Down Expand Up @@ -10937,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,
Expand Down Expand Up @@ -11052,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,
Expand Down Expand Up @@ -11373,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,
Expand Down Expand Up @@ -11413,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,
Expand Down Expand Up @@ -12248,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,
Expand Down Expand Up @@ -13316,8 +13352,8 @@ static const struct npc_lt_def_cfg npc_lt_defaults = {
},
.rx_ipsec = {
{
.lid = NPC_LID_LD,
.ltype_match = NPC_LT_LD_ESP,
.lid = NPC_LID_LE,
.ltype_match = NPC_LT_LE_ESP,
.ltype_mask = 0x0F,
},
{
Expand Down

0 comments on commit 4cb2cce

Please sign in to comment.