aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/flowperpkt-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/flowperpkt-plugin')
-rw-r--r--plugins/flowperpkt-plugin/flowperpkt/flowperpkt.c24
-rw-r--r--plugins/flowperpkt-plugin/flowperpkt/flowperpkt.h3
-rw-r--r--plugins/flowperpkt-plugin/flowperpkt/node.c20
3 files changed, 11 insertions, 36 deletions
diff --git a/plugins/flowperpkt-plugin/flowperpkt/flowperpkt.c b/plugins/flowperpkt-plugin/flowperpkt/flowperpkt.c
index ac508582..dbdb1898 100644
--- a/plugins/flowperpkt-plugin/flowperpkt/flowperpkt.c
+++ b/plugins/flowperpkt-plugin/flowperpkt/flowperpkt.c
@@ -59,10 +59,10 @@ flowperpkt_main_t flowperpkt_main;
/* Define the per-interface configurable feature */
/* *INDENT-OFF* */
-VNET_IP4_TX_FEATURE_INIT (flow_perpacket, static) = {
+VNET_FEATURE_INIT (flow_perpacket, static) = {
+ .arc_name = "ip4-output",
.node_name = "flowperpkt",
- .runs_before = (char *[]){"interface-output", 0},
- .feature_index = &flowperpkt_main.ip4_tx_feature_index,
+ .runs_before = VNET_FEATURES ("interface-output"),
};
/* *INDENT-ON* */
@@ -249,11 +249,6 @@ flowperpkt_data_callback (flow_report_main_t * frm,
static int flowperpkt_tx_interface_add_del_feature
(flowperpkt_main_t * fm, u32 sw_if_index, int is_add)
{
- u32 ci;
- ip4_main_t *im = &ip4_main;
- ip_lookup_main_t *lm = &im->lookup_main;
- vnet_feature_config_main_t *cm = &lm->feature_config_mains[VNET_IP_TX_FEAT];
- u32 feature_index;
flow_report_main_t *frm = &flow_report_main;
vnet_flow_report_add_del_args_t _a, *a = &_a;
int rv;
@@ -276,18 +271,9 @@ static int flowperpkt_tx_interface_add_del_feature
}
}
- feature_index = fm->ip4_tx_feature_index;
+ vnet_feature_enable_disable ("ip4-output", "flowperpkt", sw_if_index,
+ is_add, 0, 0);
- ci = cm->config_index_by_sw_if_index[sw_if_index];
- ci = (is_add
- ? vnet_config_add_feature
- : vnet_config_del_feature)
- (fm->vlib_main, &cm->config_main,
- ci, feature_index, 0 /* config struct */ ,
- 0 /* sizeof config struct */ );
- cm->config_index_by_sw_if_index[sw_if_index] = ci;
-
- vnet_config_update_tx_feature_count (lm, cm, sw_if_index, is_add);
return 0;
}
diff --git a/plugins/flowperpkt-plugin/flowperpkt/flowperpkt.h b/plugins/flowperpkt-plugin/flowperpkt/flowperpkt.h
index 5ddba9ce..31e685eb 100644
--- a/plugins/flowperpkt-plugin/flowperpkt/flowperpkt.h
+++ b/plugins/flowperpkt-plugin/flowperpkt/flowperpkt.h
@@ -35,9 +35,6 @@ typedef struct
/** API message ID base */
u16 msg_id_base;
- /** ip4 feature index */
- u32 ip4_tx_feature_index;
-
/** Has the report been created? */
int report_created;
diff --git a/plugins/flowperpkt-plugin/flowperpkt/node.c b/plugins/flowperpkt-plugin/flowperpkt/node.c
index b01f2be3..86da3a1c 100644
--- a/plugins/flowperpkt-plugin/flowperpkt/node.c
+++ b/plugins/flowperpkt-plugin/flowperpkt/node.c
@@ -284,9 +284,6 @@ flowperpkt_node_fn (vlib_main_t * vm,
{
u32 n_left_from, *from, *to_next;
flowperpkt_next_t next_index;
- ip4_main_t *im = &ip4_main;
- ip_lookup_main_t *lm = &im->lookup_main;
- vnet_feature_config_main_t *cm = &lm->feature_config_mains[VNET_IP_TX_FEAT];
flowperpkt_main_t *fm = &flowperpkt_main;
u64 now;
@@ -337,14 +334,10 @@ flowperpkt_node_fn (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
b1 = vlib_get_buffer (vm, bi1);
-
- vnet_get_config_data (&cm->config_main,
- &b0->current_config_index,
- &next0, 0 /* sizeof config data */ );
-
- vnet_get_config_data (&cm->config_main,
- &b1->current_config_index,
- &next1, 0 /* sizeof config data */ );
+ vnet_feature_next (vnet_buffer (b0)->sw_if_index[VLIB_TX],
+ &next0, b0);
+ vnet_feature_next (vnet_buffer (b1)->sw_if_index[VLIB_TX],
+ &next1, b1);
ip0 = (ip4_header_t *) ((u8 *) vlib_buffer_get_current (b0) +
vnet_buffer (b0)->ip.save_rewrite_length);
@@ -413,9 +406,8 @@ flowperpkt_node_fn (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
- vnet_get_config_data (&cm->config_main,
- &b0->current_config_index,
- &next0, 0 /* sizeof config data */ );
+ vnet_feature_next (vnet_buffer (b0)->sw_if_index[VLIB_TX],
+ &next0, b0);
ip0 = (ip4_header_t *) ((u8 *) vlib_buffer_get_current (b0) +
vnet_buffer (b0)->ip.save_rewrite_length);