diff options
author | Klement Sekera <ksekera@cisco.com> | 2021-02-17 18:48:35 +0100 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2021-02-26 13:15:32 +0000 |
commit | 5599fc2dae024bcf150fa4b3b4584e19419f8079 (patch) | |
tree | eb5f6ac95b62de0cf2e017ad04340ee391c4e6f2 /src/plugins/nat/nat44-ed/nat44_ed.h | |
parent | e7a80a98bc1deba86a41cf66280101766e04a310 (diff) |
nat: optimize flow matching in ED NAT
This saves 6 clocks in nat44-ed-in2out node. (112->106 per packet)
Type: improvement
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: I48e757e7f4b6b0d250a432a4659fe6955fc52a07
Diffstat (limited to 'src/plugins/nat/nat44-ed/nat44_ed.h')
-rw-r--r-- | src/plugins/nat/nat44-ed/nat44_ed.h | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/plugins/nat/nat44-ed/nat44_ed.h b/src/plugins/nat/nat44-ed/nat44_ed.h index 10d1207fec8..902e5e34b14 100644 --- a/src/plugins/nat/nat44-ed/nat44_ed.h +++ b/src/plugins/nat/nat44-ed/nat44_ed.h @@ -204,15 +204,22 @@ typedef CLIB_PACKED(struct }) per_vrf_sessions_t; /* *INDENT-ON* */ -typedef struct +typedef union { - ip4_address_t saddr, daddr; - u32 fib_index; - u16 sport, dport; - u16 icmp_id; - u8 proto; + struct + { + ip4_address_t saddr, daddr; + u16 sport; // ICMP id for ICMP case + u16 dport; + u32 fib_index : 24; + u8 proto; + }; + u64 as_u64[2]; + u64x2u as_u128; } nat_6t_t; +STATIC_ASSERT_SIZEOF (nat_6t_t, 2 * sizeof (u64)); + typedef struct { #define NAT_FLOW_OP_SADDR_REWRITE (1 << 1) @@ -223,7 +230,15 @@ typedef struct #define NAT_FLOW_OP_TXFIB_REWRITE (1 << 6) int ops; nat_6t_t match; - nat_6t_t rewrite; + struct + { + ip4_address_t saddr, daddr; + u16 sport; + u16 dport; + u32 fib_index; + u8 proto; + u16 icmp_id; + } rewrite; uword l3_csum_delta; uword l4_csum_delta; } nat_6t_flow_t; |