Re: [PATCH net-next v4 3/3] amt: make the per-tunnel group and source limits configurable

From: Omar Ramadan

Date: Mon Nov 30 2026 - 04:50:16 EST


On Sat, 28 Nov 2026 21:28:42 +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> Do the defaults still keep the previous bound here? recs comes from
> the relay amt device's own MTU.

No. With the defaults the MTU term is the smaller one whenever the
relay's amt MTU is 527 or less, as you compute (1792 * recs + 2816
against 120,320), and below about 256 it is smaller than a full refresh
of 32 groups. A gateway sizes its reports to its own MTU, so a relay
whose MTU was lowered would truncate the same tail of every periodic
refresh.

v5 assumes at least an Ethernet link for the second bound, 1500 / 8 =
187 records, and it floors that at min(max_groups, 187) groups. At the
defaults the bound is 120,320 for a relay MTU of 528 or more, and no
lower than the 60,160 that refreshing 32 groups costs below that. The
comment and the message say so.

> Does amt_report_budget() then really cap one Update at "about 416,000
> visits at the ceilings", as the commit message says?

No, for the reason you give: a lookup that misses walks its bucket's
whole chain, about 16 entries at 4096 sources in 256 buckets, and it
was charged as one visit. v5 charges each lookup ceil(max_sources /
hash_buckets) visits, one at the defaults, so the default bound stays
120,320, and 16 at the ceilings. The lookups the MTU bound may charge
are capped at the sources one report can name, mtu / 4.

Your example, one BLOCK record of about 16,000 absent sources against a
full group, is then charged 7 * (256 + 4096 + 16000) + 8 * 16 * 16000 =
2,190,464 against a budget of 440,448 at a relay MTU of 1500, and is
truncated at once. The bound at the ceilings is about 3.0 million for
the first term and about 440,000 for the MTU term, 3.7 times the
default and above the roughly 357,000 that the largest legitimate
report costs. The 416,256 in v4 left the chain length out. This is
arithmetic on the code, and the UML timings in the cover are re-measured
for v5.

I will send v5.

pw-bot: cr

--
Omar