diff options
author | Sunil Goutham <sgoutham@marvell.com> | 2018-10-22 13:55:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-10-22 23:15:38 -0400 |
commit | 6b3321bacc5a1342e6f3f843234a902f65786b4b (patch) | |
tree | bf97bc801ed43d000c9d8a51e5757d9d44e6f32a | |
parent | d02913d91657941a86208691258837a0fe9a4cd7 (diff) |
octeontx2-af: Enable packet length and csum validation
Config NPC layer info from KPU profile into protocol
checker to identify outer L2/IPv4/TCP/UDP headers in a
packet. And enable IPv4 checksum validation.
L3/L4 and L4 CSUM validation will be enabled by PF/VF
drivers by configuring NIX_AF_LF(0..127)_RX_CFG via mbox
i.e 'nix_lf_alloc_req->rx_cfg'
Also enable setting of NPC_RESULT_S[L2B] when an outer
L2 broadcast address is detected. This will help in
installing NPC MCAM rules for broadcast packets.
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c index 7de5417277e6..02e1d16cf670 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "rvu_struct.h" | 14 | #include "rvu_struct.h" |
15 | #include "rvu_reg.h" | 15 | #include "rvu_reg.h" |
16 | #include "rvu.h" | 16 | #include "rvu.h" |
17 | #include "npc.h" | ||
17 | #include "cgx.h" | 18 | #include "cgx.h" |
18 | 19 | ||
19 | static int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add); | 20 | static int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add); |
@@ -1630,6 +1631,19 @@ int rvu_nix_init(struct rvu *rvu) | |||
1630 | err = nix_setup_mcast(rvu, hw->nix0, blkaddr); | 1631 | err = nix_setup_mcast(rvu, hw->nix0, blkaddr); |
1631 | if (err) | 1632 | if (err) |
1632 | return err; | 1633 | return err; |
1634 | |||
1635 | /* Config Outer L2, IP, TCP and UDP's NPC layer info. | ||
1636 | * This helps HW protocol checker to identify headers | ||
1637 | * and validate length and checksums. | ||
1638 | */ | ||
1639 | rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OL2, | ||
1640 | (NPC_LID_LA << 8) | (NPC_LT_LA_ETHER << 4) | 0x0F); | ||
1641 | rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OUDP, | ||
1642 | (NPC_LID_LD << 8) | (NPC_LT_LD_UDP << 4) | 0x0F); | ||
1643 | rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OTCP, | ||
1644 | (NPC_LID_LD << 8) | (NPC_LT_LD_TCP << 4) | 0x0F); | ||
1645 | rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OIP4, | ||
1646 | (NPC_LID_LC << 8) | (NPC_LT_LC_IP << 4) | 0x0F); | ||
1633 | } | 1647 | } |
1634 | return 0; | 1648 | return 0; |
1635 | } | 1649 | } |
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c index a9738958aaa6..cc1d8c9e8495 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | |||
@@ -220,6 +220,20 @@ int rvu_npc_init(struct rvu *rvu) | |||
220 | /* Configure KPU profile */ | 220 | /* Configure KPU profile */ |
221 | npc_parser_profile_init(rvu, blkaddr); | 221 | npc_parser_profile_init(rvu, blkaddr); |
222 | 222 | ||
223 | /* Config Outer L2, IPv4's NPC layer info */ | ||
224 | rvu_write64(rvu, blkaddr, NPC_AF_PCK_DEF_OL2, | ||
225 | (NPC_LID_LA << 8) | (NPC_LT_LA_ETHER << 4) | 0x0F); | ||
226 | rvu_write64(rvu, blkaddr, NPC_AF_PCK_DEF_OIP4, | ||
227 | (NPC_LID_LC << 8) | (NPC_LT_LC_IP << 4) | 0x0F); | ||
228 | |||
229 | /* Enable below for Rx pkts. | ||
230 | * - Outer IPv4 header checksum validation. | ||
231 | * - Detect outer L2 broadcast address and set NPC_RESULT_S[L2M]. | ||
232 | */ | ||
233 | rvu_write64(rvu, blkaddr, NPC_AF_PCK_CFG, | ||
234 | rvu_read64(rvu, blkaddr, NPC_AF_PCK_CFG) | | ||
235 | BIT_ULL(6) | BIT_ULL(2)); | ||
236 | |||
223 | return 0; | 237 | return 0; |
224 | } | 238 | } |
225 | 239 | ||