diff options
author | Neale Ranns <neale.ranns@cisco.com> | 2018-07-30 08:04:40 -0700 |
---|---|---|
committer | Neale Ranns <neale.ranns@cisco.com> | 2018-07-30 08:04:40 -0700 |
commit | c5d4317ad0425d01893dbb4afad9f16c2cde077d (patch) | |
tree | 2bbb6b86a5bf9f051cacc5065a6b6c58be7cbcb6 /src/vnet/ethernet | |
parent | 1f895c9a40f446ca9f1b7803f350c70ebb3ad0fa (diff) |
FIB: return entry prefix by const reference to avoid the copy
Change-Id: I09b8406168df4b6b28df3ede24ee839681be0195
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vnet/ethernet')
-rw-r--r-- | src/vnet/ethernet/arp.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c index f7d8ff867f8..b5c2e6dc748 100644 --- a/src/vnet/ethernet/arp.c +++ b/src/vnet/ethernet/arp.c @@ -964,12 +964,13 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_hw_interface_t *hw_if0; ethernet_arp_header_t *arp0; ethernet_header_t *eth_rx, *eth_tx; - ip4_address_t *if_addr0, proxy_src; + const ip4_address_t *if_addr0; + ip4_address_t proxy_src; u32 pi0, error0, next0, sw_if_index0, conn_sw_if_index0, fib_index0; u8 is_request0, dst_is_local0, is_unnum0, is_vrrp_reply0; ethernet_proxy_arp_t *pa; fib_node_index_t dst_fei, src_fei; - fib_prefix_t pfx0; + const fib_prefix_t *pfx0; fib_entry_flag_t src_flags, dst_flags; u8 *rewrite0, rewrite0_len; @@ -1041,9 +1042,9 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) * to reach us, they only affect how we reach the sender. */ fib_entry_t *src_fib_entry; + const fib_prefix_t *pfx; fib_entry_src_t *src; fib_source_t source; - fib_prefix_t pfx; int attached; int mask; @@ -1106,8 +1107,8 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) /* * shorter mask lookup for the next iteration. */ - fib_entry_get_prefix (src_fei, &pfx); - mask = pfx.fp_len - 1; + pfx = fib_entry_get_prefix (src_fei); + mask = pfx->fp_len - 1; /* * continue until we hit the default route or we find @@ -1165,8 +1166,8 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) } dst_is_local0 = (FIB_ENTRY_FLAG_LOCAL & dst_flags); - fib_entry_get_prefix (dst_fei, &pfx0); - if_addr0 = &pfx0.fp_addr.ip4; + pfx0 = fib_entry_get_prefix (dst_fei); + if_addr0 = &pfx0->fp_addr.ip4; is_vrrp_reply0 = ((arp0->opcode == |