Page MenuHomeFreeBSD

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

Authored by melifaro on Sep 3 2021, 12:25 PM.
Referenced Files
Unknown Object (File)
Fri, May 17, 7:30 AM
Unknown Object (File)
May 10 2024, 5:55 AM
Unknown Object (File)
Apr 24 2024, 5:02 PM
Unknown Object (File)
Apr 23 2024, 2:30 AM
Unknown Object (File)
Apr 21 2024, 9:40 PM
Unknown Object (File)
Apr 8 2024, 3:44 AM
Unknown Object (File)
Feb 28 2024, 8:15 PM
Unknown Object (File)
Feb 5 2024, 10:37 PM



With the new FIB_ALGO infrastructure, nearly all subsystems use fib[46]_lookup() function, which provide lockless lookups.
However, FIB_ALGO 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, RIB-backed lookups (rib_lookup_info()) require RIB_RLOCK, which triggers the problem described above when the amount of ARP replies is high.

To be more specific, prior to creating new ARP entry, the following check are executed:

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

First check does not require knowledge of an actual prefix, nexthop flags
provide enough information to covert the logic as is. The second check is
more tricky. Following the intent, check per-interface addresses for the
matching prefix covering the target address.

Diff Detail

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

ae added inline comments.

This will look better if you move second condition to the next line.


If you move these declarations to the top of function, the expression will not exceed the line length :)

This revision is now accepted and ready to land.Sep 6 2021, 9:31 AM