From: David Ahern <dsahern@gmail.com>
To: James Prestwood <prestwoj@gmail.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, corbet@lwn.net,
yoshfuji@linux-ipv6.org, dsahern@kernel.org, roopa@nvidia.com,
daniel@iogearbox.net, vladimir.oltean@nxp.com, idosch@nvidia.com,
nikolay@nvidia.com, yajun.deng@linux.dev, zhutong@amazon.com,
johannes@sipsolutions.net, jouni@codeaurora.org
Subject: Re: [RESEND PATCH v7 1/3] net: arp: introduce arp_evict_nocarrier sysctl parameter
Date: Tue, 26 Oct 2021 08:50:24 -0600 [thread overview]
Message-ID: <d080507b-a5a8-aa8f-182f-1182a5405ec0@gmail.com> (raw)
In-Reply-To: <20211025164547.1097091-2-prestwoj@gmail.com>
On 10/25/21 10:45 AM, James Prestwood wrote:
> This change introduces a new sysctl parameter, arp_evict_nocarrier.
> When set (default) the ARP cache will be cleared on a NOCARRIER event.
> This new option has been defaulted to '1' which maintains existing
> behavior.
>
> Clearing the ARP cache on NOCARRIER is relatively new, introduced by:
>
> commit 859bd2ef1fc1110a8031b967ee656c53a6260a76
> Author: David Ahern <dsahern@gmail.com>
> Date: Thu Oct 11 20:33:49 2018 -0700
>
> net: Evict neighbor entries on carrier down
>
> The reason for this changes is to prevent the ARP cache from being
> cleared when a wireless device roams. Specifically for wireless roams
> the ARP cache should not be cleared because the underlying network has not
> changed. Clearing the ARP cache in this case can introduce significant
> delays sending out packets after a roam.
>
> A user reported such a situation here:
>
> https://lore.kernel.org/linux-wireless/CACsRnHWa47zpx3D1oDq9JYnZWniS8yBwW1h0WAVZ6vrbwL_S0w@mail.gmail.com/
>
> After some investigation it was found that the kernel was holding onto
> packets until ARP finished which resulted in this 1 second delay. It
> was also found that the first ARP who-has was never responded to,
> which is actually what caues the delay. This change is more or less
> working around this behavior, but again, there is no reason to clear
> the cache on a roam anyways.
>
> As for the unanswered who-has, we know the packet made it OTA since
> it was seen while monitoring. Why it never received a response is
> unknown. In any case, since this is a problem on the AP side of things
> all that can be done is to work around it until it is solved.
>
> Some background on testing/reproducing the packet delay:
>
> Hardware:
> - 2 access points configured for Fast BSS Transition (Though I don't
> see why regular reassociation wouldn't have the same behavior)
> - Wireless station running IWD as supplicant
> - A device on network able to respond to pings (I used one of the APs)
>
> Procedure:
> - Connect to first AP
> - Ping once to establish an ARP entry
> - Start a tcpdump
> - Roam to second AP
> - Wait for operstate UP event, and note the timestamp
> - Start pinging
>
> Results:
>
> Below is the tcpdump after UP. It was recorded the interface went UP at
> 10:42:01.432875.
>
> 10:42:01.461871 ARP, Request who-has 192.168.254.1 tell 192.168.254.71, length 28
> 10:42:02.497976 ARP, Request who-has 192.168.254.1 tell 192.168.254.71, length 28
> 10:42:02.507162 ARP, Reply 192.168.254.1 is-at ac:86:74:55:b0:20, length 46
> 10:42:02.507185 IP 192.168.254.71 > 192.168.254.1: ICMP echo request, id 52792, seq 1, length 64
> 10:42:02.507205 IP 192.168.254.71 > 192.168.254.1: ICMP echo request, id 52792, seq 2, length 64
> 10:42:02.507212 IP 192.168.254.71 > 192.168.254.1: ICMP echo request, id 52792, seq 3, length 64
> 10:42:02.507219 IP 192.168.254.71 > 192.168.254.1: ICMP echo request, id 52792, seq 4, length 64
> 10:42:02.507225 IP 192.168.254.71 > 192.168.254.1: ICMP echo request, id 52792, seq 5, length 64
> 10:42:02.507232 IP 192.168.254.71 > 192.168.254.1: ICMP echo request, id 52792, seq 6, length 64
> 10:42:02.515373 IP 192.168.254.1 > 192.168.254.71: ICMP echo reply, id 52792, seq 1, length 64
> 10:42:02.521399 IP 192.168.254.1 > 192.168.254.71: ICMP echo reply, id 52792, seq 2, length 64
> 10:42:02.521612 IP 192.168.254.1 > 192.168.254.71: ICMP echo reply, id 52792, seq 3, length 64
> 10:42:02.521941 IP 192.168.254.1 > 192.168.254.71: ICMP echo reply, id 52792, seq 4, length 64
> 10:42:02.522419 IP 192.168.254.1 > 192.168.254.71: ICMP echo reply, id 52792, seq 5, length 64
> 10:42:02.523085 IP 192.168.254.1 > 192.168.254.71: ICMP echo reply, id 52792, seq 6, length 64
>
> You can see the first ARP who-has went out very quickly after UP, but
> was never responded to. Nearly a second later the kernel retries and
> gets a response. Only then do the ping packets go out. If an ARP entry
> is manually added prior to UP (after the cache is cleared) it is seen
> that the first ping is never responded to, so its not only an issue with
> ARP but with data packets in general.
>
> As mentioned prior, the wireless interface was also monitored to verify
> the ping/ARP packet made it OTA which was observed to be true.
>
> Signed-off-by: James Prestwood <prestwoj@gmail.com>
> ---
> Documentation/networking/ip-sysctl.rst | 9 +++++++++
> include/linux/inetdevice.h | 2 ++
> include/uapi/linux/ip.h | 1 +
> include/uapi/linux/sysctl.h | 1 +
> net/ipv4/arp.c | 11 ++++++++++-
> net/ipv4/devinet.c | 4 ++++
> 6 files changed, 27 insertions(+), 1 deletion(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
next prev parent reply other threads:[~2021-10-26 14:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 16:45 [RESEND PATCH v7 0/3] Make neighbor eviction controllable by userspace James Prestwood
2021-10-25 16:45 ` [RESEND PATCH v7 1/3] net: arp: introduce arp_evict_nocarrier sysctl parameter James Prestwood
2021-10-26 14:50 ` David Ahern [this message]
2021-10-25 16:45 ` [RESEND PATCH v7 2/3] net: ndisc: introduce ndisc_evict_nocarrier " James Prestwood
2021-10-26 14:52 ` David Ahern
2021-10-25 16:45 ` [RESEND PATCH v7 3/3] selftests: net: add arp_ndisc_evict_nocarrier James Prestwood
2021-10-26 14:57 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d080507b-a5a8-aa8f-182f-1182a5405ec0@gmail.com \
--to=dsahern@gmail.com \
--cc=corbet@lwn.net \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=idosch@nvidia.com \
--cc=johannes@sipsolutions.net \
--cc=jouni@codeaurora.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=prestwoj@gmail.com \
--cc=roopa@nvidia.com \
--cc=vladimir.oltean@nxp.com \
--cc=yajun.deng@linux.dev \
--cc=yoshfuji@linux-ipv6.org \
--cc=zhutong@amazon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.