From: Nithin Dabilpuram <[email protected]> Update nix_rx_action2_s for legacy msns mode support for cn20k
Signed-off-by: Rakesh Kudurumalla <[email protected]> Signed-off-by: Nithin Dabilpuram <[email protected]> --- drivers/common/cnxk/roc_cpt.h | 2 + drivers/common/cnxk/roc_cpt_debug.c | 22 ++++++++ drivers/common/cnxk/roc_nix_debug.c | 2 +- drivers/common/cnxk/roc_nix_inl.c | 4 +- drivers/common/cnxk/roc_npc.c | 54 ++++++++++--------- .../common/cnxk/roc_platform_base_symbols.c | 1 + 6 files changed, 56 insertions(+), 29 deletions(-) diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h index 533d194bd4..1673cdb5db 100644 --- a/drivers/common/cnxk/roc_cpt.h +++ b/drivers/common/cnxk/roc_cpt.h @@ -260,4 +260,6 @@ int __roc_api roc_cpt_int_misc_cb_unregister(roc_cpt_int_misc_cb_t cb, void *arg bool roc_cpt_has_ie_engines(void); +void __roc_api roc_cpt_cq_dump(FILE *file, const struct cpt_cq_s *cq); + #endif /* _ROC_CPT_H_ */ diff --git a/drivers/common/cnxk/roc_cpt_debug.c b/drivers/common/cnxk/roc_cpt_debug.c index 3c1c052e50..91e8cbc30d 100644 --- a/drivers/common/cnxk/roc_cpt_debug.c +++ b/drivers/common/cnxk/roc_cpt_debug.c @@ -191,6 +191,28 @@ roc_cpt_parse_hdr_dump(FILE *file, const union cpt_parse_hdr_u *cpth) cpt_cnxk_parse_hdr_dump(file, &cpth->s); } +void +roc_cpt_cq_dump(FILE *file, const struct cpt_cq_s *cq) +{ + cpt_dump(file, "CPT_CQ \t%p:", cq); + + /* W0 */ + cpt_dump(file, "W0: compcode \t0x%x\t\tdoneint \t%u\t", cq->w0.s.compcode, + cq->w0.s.doneint); + cpt_dump(file, "W0: uc_compcode \t0x%x\t\tuc_info \t0%" PRIu64, cq->w0.s.uc_compcode, + (uint64_t)cq->w0.s.uc_info); + + /* W1 */ + cpt_dump(file, "W1: esn \t%" PRIx64 "\t\n", cq->w1.esn); + + /* W2 */ + cpt_dump(file, "W2: fmt \t0x%x\t\tuc_info2 \t%" PRIu64, cq->w2.s.fmt, + (uint64_t)cq->w2.s.uc_info2); + + /* W3 */ + cpt_dump(file, "W3: comp_ptr \t0x%" PRIx64 "\t\n", cq->w3.comp_ptr); +} + static int cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val) { diff --git a/drivers/common/cnxk/roc_nix_debug.c b/drivers/common/cnxk/roc_nix_debug.c index 9c3bc8abe3..4f4e9b0c6c 100644 --- a/drivers/common/cnxk/roc_nix_debug.c +++ b/drivers/common/cnxk/roc_nix_debug.c @@ -1087,7 +1087,7 @@ roc_nix_cqe_dump(FILE *file, const struct nix_cqe_hdr_s *cq) nix_dump(file, "W5: vtag0_ptr \t%d\t\tvtag1_ptr \t%d\t\tflow_key_alg \t%d", rx->vtag0_ptr, rx->vtag1_ptr, rx->flow_key_alg); - for (i = 0; i < (rx->desc_sizem1 + 1) << 1; i++) + for (i = 0; i < ((rx->desc_sizem1 + 1) << 1) + 2; i++) nix_dump(file, "sg[%u] = %p", i, (void *)sgs[i]); } diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index 935dd37778..4c0ddb66ed 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -2620,11 +2620,9 @@ roc_nix_inl_ctx_write(struct roc_nix *roc_nix, void *sa_dptr, void *sa_cptr, return -EINVAL; if (roc_nix) { - if (inb && roc_nix->custom_inb_sa && sa_len > ROC_NIX_INL_INB_CUSTOM_SA_SZ) { + if (inb && roc_nix->custom_inb_sa && sa_len > ROC_NIX_INL_INB_CUSTOM_SA_SZ) plt_nix_dbg("SA length: %u is more than allocated length: %u", sa_len, ROC_NIX_INL_INB_CUSTOM_SA_SZ); - return -EINVAL; - } nix = roc_nix_to_nix_priv(roc_nix); outb_lf = nix->cpt_lf_base; diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c index a8a31c7f6c..f709c71e36 100644 --- a/drivers/common/cnxk/roc_npc.c +++ b/drivers/common/cnxk/roc_npc.c @@ -544,49 +544,37 @@ npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action struct nix_spi_to_sa_add_rsp *rsp; struct nix_inl_dev *inl_dev; struct idev_cfg *idev; + uint64_t npc_action2 = 0; union { uint64_t reg; union nix_rx_vtag_action_u act; - } vtag_act; + } vtag_act = {0}; struct mbox *mbox; + uint8_t alg = 0; int rc; if (roc_npc->roc_nix->custom_sa_action == 0 || roc_model_is_cn9k() == 1 || act->conf == NULL || flow->is_validate) return 0; - *has_spi_to_sa_action = true; - sec_action = act->conf; - - vtag_act.reg = 0; - vtag_act.act.sa_xor = sec_action->sa_xor; - vtag_act.act.sa_hi = sec_action->sa_hi; - vtag_act.act.sa_lo = sec_action->sa_lo; - idev = idev_get_cfg(); if (!idev) return -1; inl_dev = idev->nix_inl_dev; + *has_spi_to_sa_action = true; + sec_action = act->conf; + switch (sec_action->alg) { case ROC_NPC_SEC_ACTION_ALG0: - break; case ROC_NPC_SEC_ACTION_ALG1: - vtag_act.act.vtag1_valid = false; - vtag_act.act.vtag1_lid = ROC_NPC_SEC_ACTION_ALG1; - break; case ROC_NPC_SEC_ACTION_ALG2: - vtag_act.act.vtag1_valid = false; - vtag_act.act.vtag1_lid = ROC_NPC_SEC_ACTION_ALG2; - break; case ROC_NPC_SEC_ACTION_ALG3: - vtag_act.act.vtag1_valid = false; - vtag_act.act.vtag1_lid = ROC_NPC_SEC_ACTION_ALG3; + alg = sec_action->alg; break; case ROC_NPC_SEC_ACTION_ALG4: - vtag_act.act.vtag1_valid = false; - vtag_act.act.vtag1_lid = 0; + alg = 0; mbox = inl_dev->dev.mbox; req = mbox_alloc_msg_nix_spi_to_sa_add(mbox); if (req == NULL) @@ -595,7 +583,7 @@ npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action req->spi_index = plt_be_to_cpu_32(flow->spi_to_sa_info.spi); req->match_id = flow->match_id; req->valid = true; - if (roc_model_is_cn20k()) { + if (roc_feature_nix_has_inl_profile()) { if (sec_action->use_custom_profile) req->inline_profile_id = sec_action->profile_id; else @@ -614,7 +602,21 @@ npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action return -1; } + if (!roc_feature_nix_has_inl_profile()) { + vtag_act.act.sa_xor = sec_action->sa_xor; + vtag_act.act.sa_hi = sec_action->sa_hi; + vtag_act.act.sa_lo = sec_action->sa_lo; + vtag_act.act.vtag1_valid = false; + vtag_act.act.vtag1_lid = alg; + + } else { + npc_action2 = ((uint64_t)sec_action->sa_xor << 7); + npc_action2 |= ((uint64_t)sec_action->sa_hi << 48); + npc_action2 |= ((uint64_t)sec_action->sa_lo << 32); + npc_action2 |= ((uint64_t)alg << 17); + } flow->vtag_action = vtag_act.reg; + flow->npc_action2 |= npc_action2; return 0; } @@ -679,6 +681,7 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, /* Initialize actions */ flow->ctr_id = NPC_COUNTER_NONE; flow->mtr_id = ROC_NIX_MTR_ID_INVALID; + flow->npc_action2 = 0; pf_func = npc->pf_func; if (flow->has_rep) pf_func = flow->rep_pf_func; @@ -988,19 +991,20 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, } else if (req_act & ROC_NPC_ACTION_TYPE_RSS) { flow->npc_action = NIX_RX_ACTIONOP_UCAST; } else if (req_act & ROC_NPC_ACTION_TYPE_SEC) { - if (roc_model_is_cn20k()) { + if (roc_feature_nix_has_inl_profile()) { const struct roc_npc_sec_action *sa_action = NULL; uint16_t profile_id; - flow->npc_action = NIX_RX_ACTIONOP_UCAST_CPT; - flow->npc_action |= (uint64_t)rq << 20; profile_id = roc_nix_inl_inb_ipsec_profile_id_get(roc_nix, true); if (sec_action && sec_action->conf) { sa_action = (const struct roc_npc_sec_action *)sec_action->conf; if (sa_action->use_custom_profile) profile_id = sa_action->profile_id; } - flow->npc_action2 = (is_non_inp ? (1ULL << 15) : 0) | (profile_id << 8); + flow->npc_action2 |= (is_non_inp ? (1ULL << 15) : 0) | (profile_id << 8); + + flow->npc_action = NIX_RX_ACTIONOP_UCAST_CPT; + flow->npc_action |= (uint64_t)rq << 20; } else { flow->npc_action = NIX_RX_ACTIONOP_UCAST_IPSEC; flow->npc_action |= (uint64_t)rq << 20; diff --git a/drivers/common/cnxk/roc_platform_base_symbols.c b/drivers/common/cnxk/roc_platform_base_symbols.c index de8de910f6..440ff13118 100644 --- a/drivers/common/cnxk/roc_platform_base_symbols.c +++ b/drivers/common/cnxk/roc_platform_base_symbols.c @@ -63,6 +63,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_int_misc_cb_unregister) RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_parse_hdr_dump) RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_afs_print) RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_lfs_print) +RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_cq_dump) RTE_EXPORT_INTERNAL_SYMBOL(roc_dpi_wait_queue_idle) RTE_EXPORT_INTERNAL_SYMBOL(roc_dpi_enable) RTE_EXPORT_INTERNAL_SYMBOL(roc_dpi_disable) -- 2.34.1

