Thread (11 messages) 11 messages, 3 authors, 24d ago

Re: [PATCH net-next v8 2/5] net: add a generation counter for dev->mc changes

flat view

From: Nicolas Dichtel <hidden>
Date: 2026-09-28 11:59:00
Also in: linux-kselftest, lkml

Le 28/09/2026 à 09:53, Nicolas Dichtel a écrit :

Le 27/09/2026 à 02:24, Yuyang Huang a écrit :
quoted
A multi-part RTM_GETMULTICAST dump of dev->mc resumes by position, so
entries added or removed between two dump rounds can be skipped or
repeated. The IPv4 and IPv6 dumps report that with NLM_F_DUMP_INTR by
stamping cb->seq from a per netns generation counter combined with
dev_base_seq, see inet_base_seq().

Add the equivalent for the device multicast lists: a per netns counter
bumped whenever an entry is added to or removed from any dev->mc. The
list helpers do not know which device a list belongs to, so give
netdev_hw_addr_list an owner, set for the lists of a device and NULL
for snapshots and other standalone lists, and change list->count
through helpers that bump the counter of dev_net(owner) when the list
is dev->mc. That covers the dev_mc_* helpers, both lists of a sync,
the hardware sync helpers drivers call from their rx mode callbacks or
their own workers and the reconciliation after an asynchronous rx mode
update. It is atomic since the writers only hold the address lock of
their own device.

Used by the following patch for the AF_PACKET multicast dump.

Signed-off-by: Yuyang Huang <redacted>

If another version is needed, you can rename counter to _counter to highlight
that the helpers should be used.
Sorry, this sentence is a leftover from the first version of my reply.

[snip]
quoted hunk ↗ jump to hunk
For correctness, __hw_addr_splice() should use helper:
@@ -509,8 +509,8 @@ static void __hw_addr_splice(struct netdev_hw_addr_list *dst,
 {
         src->tree = RB_ROOT;
         list_splice_init(&src->list, &dst->list);
-        dst->count += src->count;
-        src->count = 0;
+        __hw_addr_count_add(dst, src->count);
+        __hw_addr_count_reset(src);
 }
Renaming  struct netdev_hw_addr_list->count to _count would help to check all
users and highlight that modifying _count should be done with helpers.
This comment stands.

Regards,
Nicolas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help