[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad33efdf-2627-2b5e-978b-886e4771db49@cumulusnetworks.com>
Date: Fri, 22 Mar 2019 16:50:22 +0100
From: David Ahern <dsa@...ulusnetworks.com>
To: linmiaohe <linmiaohe@...wei.com>,
Shrijeet Mukherjee <shrijeet@...il.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Mingfangsen <mingfangsen@...wei.com>
Subject: Re: [PATCH net] net: vrf: remove redundant vrf neigh entry
On 3/22/19 3:10 PM, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@...wei.com>
>
> When vrf->rth is created, it wouldn't change in his lifetime.And in
> func vrf_finish_output, we always create a neigh with ip_hdr(skb)->daddr
> as key because rth->rt_gateway is equal to 0. But I think we only need
> one vrf neigh entry because we strip the ethernet header and reset the
> dst_entry in vrf_process_v4_outbound.
> So I set rth->rt_gateway to loopback addr(It's ok to set any other
> valid ip address, just choose one.). And we would only create one vrf
> neigh entry. This helps saving some memory and improving the hitting
> rate of neigh lookup.
> If there is something I misunderstand, it's very nice of you to
> let me know. Thanks a lot.
>
> Signed-off-by: linmiaohe <linmiaohe@...wei.com>
> ---
> drivers/net/vrf.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index 7c1430ed0244..2b0227fb8f53 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -738,6 +738,7 @@ static int vrf_rtable_create(struct net_device *dev)
> return -ENOMEM;
>
> rth->dst.output = vrf_output;
> + rth->rt_gateway = htonl(INADDR_LOOPBACK);
>
> rcu_assign_pointer(vrf->rth, rth);
>
Did you investigate how neighbor entries are getting created? The vrf
device has IFF_NOARP set, so neigh entries should not be created.
Powered by blists - more mailing lists