HomeFreeBSD

lltable: do not require prefix lookup when checking lle allocation rules.

Description

lltable: do not require prefix lookup when checking lle allocation rules.

With the new FIB_ALGO infrastructure, nearly all subsystems use
fib[46]_lookup() functions, which provides lockless lookups.
A number of places remains that uses old-style lookup functions, that
still requires RIB read lock to return the result. One of such places
is arp processing code.
FIB_ALGO implementation makes some tradeoffs, resulting in (relatively)
prolonged periods of holding RIB_WLOCK. If the lock is held and datapath
competes for it, the RX ring may get blocked, ending in traffic delays and losses.
As currently arp processing is performed directly in the interrupt handler,
handling ARP replies triggers the problem descibed above when the amount of
ARP replies is high.

To be more specific, prior to creating new ARP entry, routing lookup for the entry
address in interface fib is executed. The following conditions are the verified:

  1. If lookup returns an empty result, or the resulting prefix is non-directly-reachable, failure is returned. The only exception are host routes w/ gateway==address.
  2. If the routing lookup returns different interface and non-host route, we want to support the use case of having multiple interfaces with the same prefix. In fact, the current code just checks if the returned prefix covers target address (always true) and effectively allow allocating ARP entries for any directly-reachable prefix, regardless of its interface.

Change the code to perform the following:

  1. use fib4_lookup() to get the nexthop, instead of requesting exact prefix.
  2. Rewrite first condition check using nexthop flags (1:1 match)
  3. Rewrite second condition to check for interface addresses matching target address on the input interface.

Differential Revision: https://reviews.freebsd.org/D31824
Reviewed by: ae
MFC after: 1 week
PR: 257965

Details

Provenance
melifaroAuthored on Sep 3 2021, 11:48 AM
Reviewer
ae
Differential Revision
D31824: lltable: do not require prefix lookup when checking lle allocation rules.
Parents
rGefe67f33c322: compiler-rt: add aarch64 init function for LSE atomics
Branches
Unknown
Tags
Unknown