common/cnxk: support NIX IRQ
[dpdk.git] / app / test-flow-perf / actions_gen.c
index 1364407..1f5c64f 100644 (file)
@@ -143,12 +143,10 @@ add_set_meta(struct rte_flow_action *actions,
        uint8_t actions_counter,
        __rte_unused struct additional_para para)
 {
-       static struct rte_flow_action_set_meta meta_action;
-
-       do {
-               meta_action.data = RTE_BE32(META_DATA);
-               meta_action.mask = RTE_BE32(0xffffffff);
-       } while (0);
+       static struct rte_flow_action_set_meta meta_action = {
+               .data = RTE_BE32(META_DATA),
+               .mask = RTE_BE32(0xffffffff),
+       };
 
        actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_META;
        actions[actions_counter].conf = &meta_action;
@@ -159,13 +157,11 @@ add_set_tag(struct rte_flow_action *actions,
        uint8_t actions_counter,
        __rte_unused struct additional_para para)
 {
-       static struct rte_flow_action_set_tag tag_action;
-
-       do {
-               tag_action.data = RTE_BE32(META_DATA);
-               tag_action.mask = RTE_BE32(0xffffffff);
-               tag_action.index = TAG_INDEX;
-       } while (0);
+       static struct rte_flow_action_set_tag tag_action = {
+               .data = RTE_BE32(META_DATA),
+               .mask = RTE_BE32(0xffffffff),
+               .index = TAG_INDEX,
+       };
 
        actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_TAG;
        actions[actions_counter].conf = &tag_action;
@@ -176,11 +172,9 @@ add_port_id(struct rte_flow_action *actions,
        uint8_t actions_counter,
        __rte_unused struct additional_para para)
 {
-       static struct rte_flow_action_port_id port_id;
-
-       do {
-               port_id.id = PORT_ID_DST;
-       } while (0);
+       static struct rte_flow_action_port_id port_id = {
+               .id = PORT_ID_DST,
+       };
 
        actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
        actions[actions_counter].conf = &port_id;
@@ -897,6 +891,19 @@ add_vxlan_decap(struct rte_flow_action *actions,
        actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_VXLAN_DECAP;
 }
 
+static void
+add_meter(struct rte_flow_action *actions,
+       uint8_t actions_counter,
+       __rte_unused struct additional_para para)
+{
+       static struct rte_flow_action_meter
+               meters[RTE_MAX_LCORE] __rte_cache_aligned;
+
+       meters[para.core_idx].mtr_id = para.counter;
+       actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_METER;
+       actions[actions_counter].conf = &meters[para.core_idx];
+}
+
 void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
        uint32_t counter, uint16_t next_table, uint16_t hairpinq,
@@ -1109,6 +1116,12 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
                        ),
                        .funct = add_vxlan_decap,
                },
+               {
+                       .mask = FLOW_ACTION_MASK(
+                               RTE_FLOW_ACTION_TYPE_METER
+                       ),
+                       .funct = add_meter,
+               },
        };
 
        for (j = 0; j < MAX_ACTIONS_NUM; j++) {