Ask yourself how often there will be precisely one source (or dst) IP address 
in this path. Optimizing a specific lab/benchmark case may or may not make 
sense.

D.

From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Nitin Saxena
Sent: Friday, January 3, 2020 8:02 AM
To: vpp-dev@lists.fd.io
Subject: [vpp-dev] Check in ip4_local_inline()

Hi,

I am sending UDP termination packets to VPP interface with single source IP. I 
find that fib lookup is happening for every packet, even if source IP for 
current packet is same as last packet. Is it expected behavior? Following patch 
seems to avoid lookup for every packet.

Thanks,
Nitin

diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index aa554ea..59edaba 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -1542,6 +1542,7 @@ ip4_local_check_src (vlib_buffer_t * b, ip4_header_t * 
ip0,
       last_check->src.as_u32 = ip0->src_address.as_u32;
       last_check->lbi = lbi0;
       last_check->error = *error0;
+      last_check->first = 0;
     }
   else
     {
@@ -1549,7 +1550,6 @@ ip4_local_check_src (vlib_buffer_t * b, ip4_header_t * 
ip0,
        vnet_buffer (b)->ip.adj_index[VLIB_TX];
       vnet_buffer (b)->ip.adj_index[VLIB_TX] = last_check->lbi;
       *error0 = last_check->error;
-      last_check->first = 0;
     }
}

@@ -1638,6 +1638,7 @@ ip4_local_check_src_x2 (vlib_buffer_t ** b, ip4_header_t 
** ip,
       last_check->src.as_u32 = ip[1]->src_address.as_u32;
       last_check->lbi = lbi[1];
       last_check->error = error[1];
+      last_check->first = 0;
     }
   else
     {
@@ -1651,7 +1652,6 @@ ip4_local_check_src_x2 (vlib_buffer_t ** b, ip4_header_t 
** ip,

       error[0] = last_check->error;
       error[1] = last_check->error;
-      last_check->first = 0;
     }
}



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#15032): https://lists.fd.io/g/vpp-dev/message/15032
Mute This Topic: https://lists.fd.io/mt/69397810/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to