summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat_ipfix_logging.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-05-11 08:58:05 +0000
committerOle Trøan <otroan@employees.org>2020-05-13 11:36:42 +0000
commitbc752e432ff3e252f6e1a3f0372c9532f14909cd (patch)
tree5399347c1e469d21529a0bc20ffd2d0783434e40 /src/plugins/nat/nat_ipfix_logging.c
parent1d61c2194d21df2003ff07ff5feae4130de6277e (diff)
nat: perf improvement - replace branchy code
Use a lookup table instead. Type: improvement Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: Ia8461099828bb8824bf016201f135e6b69c444d1
Diffstat (limited to 'src/plugins/nat/nat_ipfix_logging.c')
-rwxr-xr-xsrc/plugins/nat/nat_ipfix_logging.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/nat/nat_ipfix_logging.c b/src/plugins/nat/nat_ipfix_logging.c
index da8e1f28991..764774224a1 100755
--- a/src/plugins/nat/nat_ipfix_logging.c
+++ b/src/plugins/nat/nat_ipfix_logging.c
@@ -48,7 +48,7 @@ typedef struct
u8 nat_event;
u32 src_ip;
u32 nat_src_ip;
- snat_protocol_t snat_proto;
+ nat_protocol_t nat_proto;
u16 src_port;
u16 nat_src_port;
u32 vrf_id;
@@ -573,7 +573,7 @@ snat_ipfix_send (u32 thread_index, flow_report_main_t * frm,
static void
snat_ipfix_logging_nat44_ses (u32 thread_index, u8 nat_event, u32 src_ip,
- u32 nat_src_ip, snat_protocol_t snat_proto,
+ u32 nat_src_ip, nat_protocol_t nat_proto,
u16 src_port, u16 nat_src_port, u32 vrf_id,
int do_flush)
{
@@ -586,10 +586,10 @@ snat_ipfix_logging_nat44_ses (u32 thread_index, u8 nat_event, u32 src_ip,
u32 offset;
vlib_main_t *vm = vlib_mains[thread_index];
u64 now;
- u8 proto = ~0;
+ u8 proto;
u16 template_id;
- proto = snat_proto_to_ip_proto (snat_proto);
+ proto = nat_proto_to_ip_proto (nat_proto);
now = (u64) ((vlib_time_now (vm) - silm->vlib_time_0) * 1e3);
now += silm->milisecond_time_0;
@@ -1299,7 +1299,7 @@ snat_ipfix_flush_from_main (void)
* @param thread_index thread index
* @param src_ip source IPv4 address
* @param nat_src_ip transaltes source IPv4 address
- * @param snat_proto NAT transport protocol
+ * @param nat_proto NAT transport protocol
* @param src_port source port
* @param nat_src_port translated source port
* @param vrf_id VRF ID
@@ -1308,14 +1308,14 @@ void
snat_ipfix_logging_nat44_ses_create (u32 thread_index,
u32 src_ip,
u32 nat_src_ip,
- snat_protocol_t snat_proto,
+ nat_protocol_t nat_proto,
u16 src_port,
u16 nat_src_port, u32 vrf_id)
{
skip_if_disabled ();
snat_ipfix_logging_nat44_ses (thread_index, NAT44_SESSION_CREATE, src_ip,
- nat_src_ip, snat_proto, src_port, nat_src_port,
+ nat_src_ip, nat_proto, src_port, nat_src_port,
vrf_id, 0);
}
@@ -1325,7 +1325,7 @@ snat_ipfix_logging_nat44_ses_create (u32 thread_index,
* @param thread_index thread index
* @param src_ip source IPv4 address
* @param nat_src_ip transaltes source IPv4 address
- * @param snat_proto NAT transport protocol
+ * @param nat_proto NAT transport protocol
* @param src_port source port
* @param nat_src_port translated source port
* @param vrf_id VRF ID
@@ -1334,14 +1334,14 @@ void
snat_ipfix_logging_nat44_ses_delete (u32 thread_index,
u32 src_ip,
u32 nat_src_ip,
- snat_protocol_t snat_proto,
+ nat_protocol_t nat_proto,
u16 src_port,
u16 nat_src_port, u32 vrf_id)
{
skip_if_disabled ();
snat_ipfix_logging_nat44_ses (thread_index, NAT44_SESSION_DELETE, src_ip,
- nat_src_ip, snat_proto, src_port, nat_src_port,
+ nat_src_ip, nat_proto, src_port, nat_src_port,
vrf_id, 0);
}