Hi Nitin, 

I believe your observation is correct. Adding Neale in case we missed 
something. 

Regards,
Florin

> On Jan 3, 2020, at 10:32 AM, Nitin Saxena <nsax...@marvell.com> wrote:
> 
> Hi Dave,
>  
> Thanks.
>  
> I agree with your point that there is less chance of consecutive packets 
> having same source IP. However both functions: ip4_local_check_src(), 
> ip4_local_check_src_x2() already have the trick to avoid fib lookup for 
> consecutive packets having same source IP. Correct me if I am wrong, 
> currently else {} part in both aforementioned functions seems to be a dead 
> code as PREDICT_FALSE(last_check->first) is always TRUE (as last_check->first 
> is always 1 throughout ip4_local_inline() function).
>  
> Also with my patch, there is no impact on cycle count of ip4_local node (both 
> x86 and ARM) where source IP increments for every packet in a terminating 
> frame. It does decrease cycles for ip4-local when all packets have similar 
> source IP.
>  
> So is there any gap in my understanding or is it deliberate to make else {} 
> case  as dead code?
>  
> Thanks,
> Nitin
>  
> From: Dave Barach (dbarach) <dbar...@cisco.com <mailto:dbar...@cisco.com>> 
> Sent: Friday, January 3, 2020 8:08 PM
> To: Nitin Saxena <nsax...@marvell.com <mailto:nsax...@marvell.com>>; 
> vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io>
> Subject: [EXT] RE: [vpp-dev] Check in ip4_local_inline()
>  
> External Email
> 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 <mailto:vpp-dev@lists.fd.io> <vpp-dev@lists.fd.io 
> <mailto:vpp-dev@lists.fd.io>> On Behalf Of Nitin Saxena
> Sent: Friday, January 3, 2020 8:02 AM
> To: vpp-dev@lists.fd.io <mailto: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 (#15036): https://lists.fd.io/g/vpp-dev/message/15036 
> <https://lists.fd.io/g/vpp-dev/message/15036>
> Mute This Topic: https://lists.fd.io/mt/69397810/675152 
> <https://lists.fd.io/mt/69397810/675152>
> Group Owner: vpp-dev+ow...@lists.fd.io <mailto:vpp-dev+ow...@lists.fd.io>
> Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub 
> <https://lists.fd.io/g/vpp-dev/unsub>  [fcoras.li...@gmail.com 
> <mailto:fcoras.li...@gmail.com>]
> -=-=-=-=-=-=-=-=-=-=-=-

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

View/Reply Online (#15039): https://lists.fd.io/g/vpp-dev/message/15039
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