octeontx2-af: Enable packet length and csum validation
[muen/linux.git] / drivers / net / ethernet / marvell / octeontx2 / af / rvu_npc.c
index a9738958aaa6e3b6004814f64d2a639ef8460345..cc1d8c9e8495afb65ca558fbb4c86f7db0e5c0b1 100644 (file)
@@ -220,6 +220,20 @@ int rvu_npc_init(struct rvu *rvu)
        /* Configure KPU profile */
        npc_parser_profile_init(rvu, blkaddr);
 
+       /* Config Outer L2, IPv4's NPC layer info */
+       rvu_write64(rvu, blkaddr, NPC_AF_PCK_DEF_OL2,
+                   (NPC_LID_LA << 8) | (NPC_LT_LA_ETHER << 4) | 0x0F);
+       rvu_write64(rvu, blkaddr, NPC_AF_PCK_DEF_OIP4,
+                   (NPC_LID_LC << 8) | (NPC_LT_LC_IP << 4) | 0x0F);
+
+       /* Enable below for Rx pkts.
+        * - Outer IPv4 header checksum validation.
+        * - Detect outer L2 broadcast address and set NPC_RESULT_S[L2M].
+        */
+       rvu_write64(rvu, blkaddr, NPC_AF_PCK_CFG,
+                   rvu_read64(rvu, blkaddr, NPC_AF_PCK_CFG) |
+                   BIT_ULL(6) | BIT_ULL(2));
+
        return 0;
 }