#include "cnxk_ethdev.h"
-/* NIX_RX_PARSE_S's ERRCODE + ERRLEV (12 bits) */
-#define ERRCODE_ERRLEN_WIDTH 12
-#define ERR_ARRAY_SZ ((BIT(ERRCODE_ERRLEN_WIDTH)) * sizeof(uint32_t))
-
-#define SA_TBL_SZ (RTE_MAX_ETHPORTS * sizeof(uint64_t))
-#define LOOKUP_ARRAY_SZ (PTYPE_ARRAY_SZ + ERR_ARRAY_SZ + SA_TBL_SZ)
+#define SA_BASE_TBL_SZ (RTE_MAX_ETHPORTS * sizeof(uintptr_t))
+#define LOOKUP_ARRAY_SZ (PTYPE_ARRAY_SZ + ERR_ARRAY_SZ + SA_BASE_TBL_SZ)
const uint32_t *
cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev)
{
errlev = idx & 0xf;
errcode = (idx & 0xff0) >> 4;
- val = PKT_RX_IP_CKSUM_UNKNOWN;
- val |= PKT_RX_L4_CKSUM_UNKNOWN;
- val |= PKT_RX_OUTER_L4_CKSUM_UNKNOWN;
+ val = RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN;
+ val |= RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN;
+ val |= RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN;
switch (errlev) {
case NPC_ERRLEV_RE:
* including Outer L2 length mismatch error
*/
if (errcode) {
- val |= PKT_RX_IP_CKSUM_BAD;
- val |= PKT_RX_L4_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
} else {
- val |= PKT_RX_IP_CKSUM_GOOD;
- val |= PKT_RX_L4_CKSUM_GOOD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
+ val |= RTE_MBUF_F_RX_L4_CKSUM_GOOD;
}
break;
case NPC_ERRLEV_LC:
if (errcode == NPC_EC_OIP4_CSUM ||
errcode == NPC_EC_IP_FRAG_OFFSET_1) {
- val |= PKT_RX_IP_CKSUM_BAD;
- val |= PKT_RX_OUTER_IP_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_OUTER_IP_CKSUM_BAD;
} else {
- val |= PKT_RX_IP_CKSUM_GOOD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
}
break;
case NPC_ERRLEV_LG:
if (errcode == NPC_EC_IIP4_CSUM)
- val |= PKT_RX_IP_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_BAD;
else
- val |= PKT_RX_IP_CKSUM_GOOD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
break;
case NPC_ERRLEV_NIX:
if (errcode == NIX_RX_PERRCODE_OL4_CHK ||
errcode == NIX_RX_PERRCODE_OL4_LEN ||
errcode == NIX_RX_PERRCODE_OL4_PORT) {
- val |= PKT_RX_IP_CKSUM_GOOD;
- val |= PKT_RX_L4_CKSUM_BAD;
- val |= PKT_RX_OUTER_L4_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
+ val |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_OUTER_L4_CKSUM_BAD;
} else if (errcode == NIX_RX_PERRCODE_IL4_CHK ||
errcode == NIX_RX_PERRCODE_IL4_LEN ||
errcode == NIX_RX_PERRCODE_IL4_PORT) {
- val |= PKT_RX_IP_CKSUM_GOOD;
- val |= PKT_RX_L4_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
+ val |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
} else if (errcode == NIX_RX_PERRCODE_IL3_LEN ||
errcode == NIX_RX_PERRCODE_OL3_LEN) {
- val |= PKT_RX_IP_CKSUM_BAD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_BAD;
} else {
- val |= PKT_RX_IP_CKSUM_GOOD;
- val |= PKT_RX_L4_CKSUM_GOOD;
+ val |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
+ val |= RTE_MBUF_F_RX_L4_CKSUM_GOOD;
}
break;
}
}
return NULL;
}
+
+int
+cnxk_nix_lookup_mem_sa_base_set(struct cnxk_eth_dev *dev)
+{
+ void *lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
+ uint16_t port = dev->eth_dev->data->port_id;
+ uintptr_t sa_base_tbl;
+ uintptr_t sa_base;
+ uint8_t sa_w;
+
+ if (!lookup_mem)
+ return -EIO;
+
+ sa_base = roc_nix_inl_inb_sa_base_get(&dev->nix, dev->inb.inl_dev);
+ if (!sa_base)
+ return -ENOTSUP;
+
+ sa_w = plt_log2_u32(dev->nix.ipsec_in_max_spi + 1 -
+ dev->nix.ipsec_in_min_spi);
+
+ /* Set SA Base in lookup mem */
+ sa_base_tbl = (uintptr_t)lookup_mem;
+ sa_base_tbl += PTYPE_ARRAY_SZ + ERR_ARRAY_SZ;
+ *((uintptr_t *)sa_base_tbl + port) = sa_base | sa_w;
+ return 0;
+}
+
+int
+cnxk_nix_lookup_mem_sa_base_clear(struct cnxk_eth_dev *dev)
+{
+ void *lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
+ uint16_t port = dev->eth_dev->data->port_id;
+ uintptr_t sa_base_tbl;
+
+ if (!lookup_mem)
+ return -EIO;
+
+ /* Set SA Base in lookup mem */
+ sa_base_tbl = (uintptr_t)lookup_mem;
+ sa_base_tbl += PTYPE_ARRAY_SZ + ERR_ARRAY_SZ;
+ *((uintptr_t *)sa_base_tbl + port) = 0;
+ return 0;
+}