summaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam
diff options
context:
space:
mode:
authorPaul Atkins <patkins@graphiant.com>2021-09-22 10:06:23 +0100
committerNeale Ranns <neale@graphiant.com>2021-11-22 09:30:09 +0000
commit40f9a7ac7ea0c22ee1aade671c871c67af4a5d51 (patch)
treeb30a39fa3b929c944cd9eeb84e763a797091de27 /src/plugins/ioam
parent9e827819a7a442e35fcd171de48d859f84d6bf28 (diff)
ipfix-export: pass an exp to flow_report_add_del
Pass an ipfix_exporter to this function so that callers can choose which exporter they are modifying. Type: improvement Signed-off-by: Paul Atkins <patkins@graphiant.com> Change-Id: Ice0ed19a57baf15b1dc85cd27fe01913e36d7f4f
Diffstat (limited to 'src/plugins/ioam')
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c23
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.h10
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_export.c27
3 files changed, 29 insertions, 31 deletions
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index 141c03a97de..c9cc0770a8c 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -20,11 +20,11 @@
#include <ioam/analyse/ip6/ip6_ioam_analyse.h>
u8 *
-ioam_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address, u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+ioam_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
ip4_header_t *ip;
udp_header_t *udp;
@@ -38,7 +38,6 @@ ioam_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
u32 field_count = 0;
u32 field_index = 0;
flow_report_stream_t *stream;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
@@ -265,8 +264,9 @@ ioam_analyse_add_ipfix_record (flow_report_t * fr,
}
vlib_frame_t *
-ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+ioam_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
vlib_buffer_t *b0 = NULL;
u32 next_offset = 0;
@@ -280,13 +280,12 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
u32 records_this_buffer;
u16 new_l0, old_l0;
ip_csum_t sum0;
- vlib_main_t *vm = frm->vlib_main;
+ vlib_main_t *vm = vlib_get_main ();
ip6_address_t temp;
ioam_analyser_data_t *record = NULL;
flow_report_stream_t *stream;
ioam_analyser_data_t *aggregated_data;
u16 data_len;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
@@ -401,7 +400,7 @@ ioam_flow_create (u8 del)
vnet_flow_report_add_del_args_t args;
int rv;
u32 domain_id = 0;
- flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &flow_report_main.exporters[0];
u16 template_id;
clib_memset (&args, 0, sizeof (args));
@@ -410,7 +409,7 @@ ioam_flow_create (u8 del)
del ? (args.is_add = 0) : (args.is_add = 1);
args.domain_id = domain_id;
- rv = vnet_flow_report_add_del (frm, &args, &template_id);
+ rv = vnet_flow_report_add_del (exp, &args, &template_id);
switch (rv)
{
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.h b/src/plugins/ioam/analyse/ioam_summary_export.h
index 99890ad43d9..8c604b9b04a 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.h
+++ b/src/plugins/ioam/analyse/ioam_summary_export.h
@@ -65,11 +65,11 @@ typedef struct
clib_error_t *ioam_flow_create (u8 del);
-u8 *ioam_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address, u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index);
+u8 *ioam_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index);
u16 ioam_analyse_add_ipfix_record (flow_report_t * fr,
ioam_analyser_data_t * record,
diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c
index 84d8ddf9e93..d8926aa01d4 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_export.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_export.c
@@ -23,20 +23,20 @@
#define UDP_PING_EXPORT_RECORD_SIZE 400
static u8 *
-udp_ping_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address, u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+udp_ping_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return ioam_template_rewrite (frm, fr, collector_address,
- src_address, collector_port, elts, n_elts,
- stream_index);
+ return ioam_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, elts, n_elts, stream_index);
}
static vlib_frame_t *
-udp_ping_send_flows (flow_report_main_t * frm, flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+udp_ping_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
vlib_buffer_t *b0 = NULL;
u32 next_offset = 0;
@@ -50,13 +50,12 @@ udp_ping_send_flows (flow_report_main_t * frm, flow_report_t * fr,
u32 records_this_buffer;
u16 new_l0, old_l0;
ip_csum_t sum0;
- vlib_main_t *vm = frm->vlib_main;
+ vlib_main_t *vm = vlib_get_main ();
flow_report_stream_t *stream;
udp_ping_flow_data *stats;
ip46_udp_ping_flow *ip46_flow;
u16 src_port, dst_port;
u16 data_len;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
data_len = vec_len (udp_ping_main.ip46_flow);
@@ -231,7 +230,7 @@ udp_ping_flow_create (u8 del)
vnet_flow_report_add_del_args_t args;
int rv;
u32 domain_id = 0;
- flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &flow_report_main.exporters[0];
u16 template_id;
clib_memset (&args, 0, sizeof (args));
@@ -241,7 +240,7 @@ udp_ping_flow_create (u8 del)
args.domain_id = domain_id;
args.src_port = UDP_DST_PORT_ipfix;
- rv = vnet_flow_report_add_del (frm, &args, &template_id);
+ rv = vnet_flow_report_add_del (exp, &args, &template_id);
switch (rv)
{