summaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam
diff options
context:
space:
mode:
authorPaul Atkins <patkins@graphiant.com>2021-09-21 20:49:12 +0100
committerNeale Ranns <neale@graphiant.com>2021-11-22 09:30:09 +0000
commit9ec6449e298ed10695c4afbba951ac46daa52e43 (patch)
treeef9589f9e172ea905587812e440c3dfc9d1fc5a0 /src/plugins/ioam
parenta3767bda9817eab15dd0eca0955d5ad194ec8840 (diff)
ipfix-export: refactor fields in flow_report_main
Pull out the fields in flow_report_main_t that are specific to a single exporter and move them into a new structure that represents an exporter. Add a pool of exporters to flow_report_main_t and do a pool_get() to get the entry at index 0, so that the existing users of the code need only change the path at which they access the old fields and have no need to make further code changes. In functions that were accessing the fields that now make up the ipfix_exporter create a local var that points to the first (always valid) exporter and use this as the base for the fields rather than finding them from flow_report_main. This is in preparation for supporting multiple flow_exporters. Note that at the moment the code supports multiple 'streams' for a given exporter, where each stream has its own source port, domain id and template space. But all streams within an exporter have the same destination address, so this is not the same as multiple exporters. Type: refactor Signed-off-by: Paul Atkins <patkins@graphiant.com> Change-Id: I49f5c7fb9e901773351d31dc8a59178c37e99301
Diffstat (limited to 'src/plugins/ioam')
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c10
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_export.c5
2 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index 032272f5ec7..141c03a97de 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -38,8 +38,9 @@ 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 = &frm->streams[fr->stream_index];
+ stream = &exp->streams[fr->stream_index];
/* Determine field count */
#define _(field,mask,item,length) \
@@ -285,8 +286,9 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
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 = &frm->streams[fr->stream_index];
+ stream = &exp->streams[fr->stream_index];
clib_memset (&temp, 0, sizeof (ip6_address_t));
@@ -339,7 +341,7 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
records_this_buffer++;
/* Flush data if packet len is about to reach path mtu */
- if (next_offset > (frm->path_mtu - 250))
+ if (next_offset > (exp->path_mtu - 250))
flush = 1;
}
@@ -366,7 +368,7 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
udp->length =
clib_host_to_net_u16 (b0->current_length - sizeof (*ip));
- if (frm->udp_checksum)
+ if (exp->udp_checksum)
{
/* RFC 7011 section 10.3.2. */
udp->checksum = ip4_tcp_udp_compute_checksum (vm, b0, ip);
diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c
index 3e835989a6f..84d8ddf9e93 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_export.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_export.c
@@ -56,8 +56,9 @@ udp_ping_send_flows (flow_report_main_t * frm, flow_report_t * fr,
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 = &frm->streams[fr->stream_index];
+ stream = &exp->streams[fr->stream_index];
data_len = vec_len (udp_ping_main.ip46_flow);
for (i = 0; i < data_len; i++)
@@ -120,7 +121,7 @@ udp_ping_send_flows (flow_report_main_t * frm, flow_report_t * fr,
records_this_buffer++;
/* Flush data if packet len is about to reach path mtu */
- if (next_offset > (frm->path_mtu - UDP_PING_EXPORT_RECORD_SIZE))
+ if (next_offset > (exp->path_mtu - UDP_PING_EXPORT_RECORD_SIZE))
{
b0->current_length = next_offset;
b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;