From: Satheesh Paul Date: Tue, 31 Aug 2021 04:16:14 +0000 (+0530) Subject: common/cnxk: support merging base steering rule X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0cc909cc07c56cd42ba6dd7c94a54221b3218c13;p=dpdk.git common/cnxk: support merging base steering rule This patch adds an ROC API to merge base steering rule with rules added by VF. Signed-off-by: Satheesh Paul Reviewed-by: Kiran Kumar K Acked-by: Ray Kinsella --- diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c index afaa8a7a8f..1c1e043474 100644 --- a/drivers/common/cnxk/roc_npc.c +++ b/drivers/common/cnxk/roc_npc.c @@ -1311,3 +1311,30 @@ roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc) } } } + +int +roc_npc_mcam_merge_base_steering_rule(struct roc_npc *roc_npc, + struct roc_npc_flow *flow) +{ + struct npc_mcam_read_base_rule_rsp *base_rule_rsp; + struct npc *npc = roc_npc_to_npc_priv(roc_npc); + struct mcam_entry *base_entry; + int idx, rc; + + if (roc_nix_is_pf(roc_npc->roc_nix)) + return 0; + + (void)mbox_alloc_msg_npc_read_base_steer_rule(npc->mbox); + rc = mbox_process_msg(npc->mbox, (void *)&base_rule_rsp); + if (rc) { + plt_err("Failed to fetch VF's base MCAM entry"); + return rc; + } + base_entry = &base_rule_rsp->entry_data; + for (idx = 0; idx < ROC_NPC_MAX_MCAM_WIDTH_DWORDS; idx++) { + flow->mcam_data[idx] |= base_entry->kw[idx]; + flow->mcam_mask[idx] |= base_entry->kw_mask[idx]; + } + + return 0; +} diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h index 4d6f8f8cd9..65d4bd6edc 100644 --- a/drivers/common/cnxk/roc_npc.h +++ b/drivers/common/cnxk/roc_npc.h @@ -216,15 +216,12 @@ int __roc_api roc_npc_flow_parse(struct roc_npc *roc_npc, const struct roc_npc_action actions[], struct roc_npc_flow *flow); int __roc_api roc_npc_get_low_priority_mcam(struct roc_npc *roc_npc); - int __roc_api roc_npc_mcam_free_counter(struct roc_npc *roc_npc, uint16_t ctr_id); - int __roc_api roc_npc_mcam_read_counter(struct roc_npc *roc_npc, uint32_t ctr_id, uint64_t *count); int __roc_api roc_npc_mcam_clear_counter(struct roc_npc *roc_npc, uint32_t ctr_id); - int __roc_api roc_npc_mcam_free_all_resources(struct roc_npc *roc_npc); void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc); void __roc_api roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc, @@ -235,4 +232,6 @@ int __roc_api roc_npc_mark_actions_sub_return(struct roc_npc *roc_npc, int __roc_api roc_npc_vtag_actions_get(struct roc_npc *roc_npc); int __roc_api roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc, uint32_t count); +int __roc_api roc_npc_mcam_merge_base_steering_rule(struct roc_npc *roc_npc, + struct roc_npc_flow *flow); #endif /* _ROC_NPC_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index e53cc6b9cc..fff7902b25 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -248,6 +248,7 @@ INTERNAL { roc_npc_mcam_free_all_resources; roc_npc_mcam_free_counter; roc_npc_mcam_free_entry; + roc_npc_mcam_merge_base_steering_rule; roc_npc_mcam_write_entry; roc_npc_mcam_read_counter; roc_npc_profile_name_get;