From: Sunil Kumar Kori Date: Tue, 12 Oct 2021 07:05:58 +0000 (+0530) Subject: common/cnxk: support meter in action list X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0ca63f1b4cb02af4c4a8acd85d97e3eeb14b7290;p=dpdk.git common/cnxk: support meter in action list Meter action is added in supported action list. Signed-off-by: Sunil Kumar Kori Acked-by: Jerin Jacob --- diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c index b724ff9401..5a78d9652c 100644 --- a/drivers/common/cnxk/roc_npc.c +++ b/drivers/common/cnxk/roc_npc.c @@ -348,6 +348,7 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, { struct npc *npc = roc_npc_to_npc_priv(roc_npc); const struct roc_npc_action_mark *act_mark; + const struct roc_npc_action_meter *act_mtr; const struct roc_npc_action_queue *act_q; const struct roc_npc_action_vf *vf_act; bool vlan_insert_action = false; @@ -451,6 +452,12 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, case ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT: req_act |= ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT; break; + case ROC_NPC_ACTION_TYPE_METER: + act_mtr = (const struct roc_npc_action_meter *) + actions->conf; + flow->mtr_id = act_mtr->mtr_id; + req_act |= ROC_NPC_ACTION_TYPE_METER; + break; default: errcode = NPC_ERR_ACTION_NOTSUP; goto err_exit; diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h index 65d4bd6edc..10d1ac82a4 100644 --- a/drivers/common/cnxk/roc_npc.h +++ b/drivers/common/cnxk/roc_npc.h @@ -58,7 +58,7 @@ struct roc_npc_flow_item_raw { const uint8_t *pattern; /**< Byte string to look for. */ }; -#define ROC_NPC_MAX_ACTION_COUNT 12 +#define ROC_NPC_MAX_ACTION_COUNT 19 enum roc_npc_action_type { ROC_NPC_ACTION_TYPE_END = (1 << 0), @@ -77,6 +77,7 @@ enum roc_npc_action_type { ROC_NPC_ACTION_TYPE_VLAN_INSERT = (1 << 13), ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT = (1 << 14), ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT = (1 << 15), + ROC_NPC_ACTION_TYPE_METER = (1 << 17), }; struct roc_npc_action { @@ -110,6 +111,10 @@ struct roc_npc_action_of_set_vlan_pcp { uint8_t vlan_pcp; /**< VLAN priority. */ }; +struct roc_npc_action_meter { + uint32_t mtr_id; /**< Meter id to be applied. > */ +}; + struct roc_npc_attr { uint32_t priority; /**< Rule priority level within group. */ uint32_t ingress : 1; /**< Rule applies to ingress traffic. */ @@ -128,6 +133,7 @@ struct roc_npc_flow { uint32_t mcam_id; int32_t ctr_id; uint32_t priority; + uint32_t mtr_id; #define ROC_NPC_MAX_MCAM_WIDTH_DWORDS 7 /* Contiguous match string */ uint64_t mcam_data[ROC_NPC_MAX_MCAM_WIDTH_DWORDS];