From: Sunil Kumar Kori <skori@marvell.com>
Meter action is added in supported action list.
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v5:
- Fix checkpatch errors
- Fix patch apply errors
v4:
- Rebase support on dpdk-next-net-mrvl branch
- Handled meter action during flow destroy
- Handled meter cleanup during port shutdown
v3:
- Rebase support on latest DPDK
- Handled multilevel chaining for tree hierarchy
- Fix naming convention
v2:
- Rebase support on latest DPDK
- Handled multilevel chaining for linear hierarchy
- Review comments incorporated
drivers/common/cnxk/roc_npc.c | 7 +++++++
drivers/common/cnxk/roc_npc.h | 8 +++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
@@ -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;
@@ -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];