diff options
author | Klement Sekera <ksekera@cisco.com> | 2020-05-11 08:58:05 +0000 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2020-05-13 11:36:42 +0000 |
commit | bc752e432ff3e252f6e1a3f0372c9532f14909cd (patch) | |
tree | 5399347c1e469d21529a0bc20ffd2d0783434e40 /src/plugins/nat/dslite/dslite_in2out.c | |
parent | 1d61c2194d21df2003ff07ff5feae4130de6277e (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/dslite/dslite_in2out.c')
-rw-r--r-- | src/plugins/nat/dslite/dslite_in2out.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/nat/dslite/dslite_in2out.c b/src/plugins/nat/dslite/dslite_in2out.c index 1d00bb2d7fe..a8204179a58 100644 --- a/src/plugins/nat/dslite/dslite_in2out.c +++ b/src/plugins/nat/dslite/dslite_in2out.c @@ -316,7 +316,7 @@ dslite_in2out_node_fn_inline (vlib_main_t * vm, vlib_node_runtime_t * node, ip40 = vlib_buffer_get_current (b0) + sizeof (ip6_header_t); proto0 = ip_proto_to_nat_proto (ip40->protocol); - if (PREDICT_FALSE (proto0 == ~0)) + if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_OTHER)) { error0 = DSLITE_ERROR_UNSUPPORTED_PROTOCOL; next0 = DSLITE_IN2OUT_NEXT_DROP; |