Commit 478a85f
committed
net: dsa: flush learned FDB on user port bulk delete
Implement ndo_fdb_del_bulk for DSA so that a bulk RTM_DELNEIGH with
NTF_SELF can flush a switch's learned FDB. This is required by user
space applications implementing MRP (802.1Q).
The NTF_MASTER leg of the same request cannot serve this. Where learning
is offloaded the switch learns in hardware and the entries were never in
the bridge FDB, so the bridge has nothing to delete and nothing to notify
back down to the driver.
Fast ageing deletes the dynamically learned entries and nothing else,
which bounds what the handler can accept. ndm_state and ndm_flags select
entries by flag, so any bit set in them asks for entries that fast ageing
cannot delete; refuse the request rather than answer it by deleting the
entries the caller asked to keep. A mask is not the same thing, since
with the bit clear in the request it selects the entries which do not
carry that flag: a dynamically learned entry carries neither of the
ndm_state flags nor NTF_USE, NTF_EXT_LEARNED or NTF_STICKY, so a mask
naming those is satisfied by definition, while NTF_OFFLOADED describes
every entry in a switch and a mask naming it selects nothing that can be
deleted. The validation otherwise follows br_fdb_delete_bulk() and
vxlan_fdb_delete_bulk(), and reports -EOPNOTSUPP rather than -EINVAL
throughout: the request is well formed, it is just not one this port can
serve, and the NTF_MASTER leg may already have flushed the bridge by the
time it is refused.
NDA_IFINDEX scopes a bridge flush to one of its ports, so here it has to
name the port the request was sent to. A LAG or HSR member is refused
outright, because its bridge port is the aggregate device: the flush
could not be notified without also dropping the addresses its siblings
learned.
An unfiltered request asks for the static entries too. Deleting those
behind the bridge's back would leave it believing they are still
programmed, so they are left alone and only the dynamically learned
entries go. Since ds->ops->port_fast_age() returns void, a whole-port
flush which the driver declines or fails to carry out cannot be reported
either.
As on the other fast age paths, the switchdev flush notification also
drops the bridge's dynamic entries for the port, keeping the software FDB
in step with hardware, and the flush covers this port on this switch
only: addresses that other switches in the tree learned on their DSA
links are left alone.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Luke Howard <lukeh@padl.com>1 parent f334ef1 commit 478a85f
3 files changed
Lines changed: 107 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
84 | 104 | | |
85 | 105 | | |
86 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
578 | 663 | | |
579 | 664 | | |
580 | 665 | | |
| |||
2704 | 2789 | | |
2705 | 2790 | | |
2706 | 2791 | | |
| 2792 | + | |
2707 | 2793 | | |
2708 | 2794 | | |
2709 | 2795 | | |
| |||
0 commit comments