From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, horms@kernel.org, petrm@nvidia.com,
Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next v3 0/4] net: Fix protodown with macvlan
Date: Thu, 7 May 2026 13:59:02 +0300 [thread overview]
Message-ID: <20260507105906.891817-1-idosch@nvidia.com> (raw)
When protodown is enabled on a macvlan, two bugs cause the macvlan to
incorrectly gain carrier:
1. Toggling the lower device's carrier while protodown is enabled on the
macvlan causes the macvlan to gain carrier, effectively bypassing the
protodown mechanism.
2. Toggling protodown on and then off on the macvlan while the lower
device has no carrier causes the macvlan to gain carrier, since
netif_change_proto_down() unconditionally turns the carrier on.
Patch #1 is a preparation.
Patch #2 solves the first problem by making netif_carrier_on() return
early when protodown is on.
Patch #3 solves the second problem by only calling netif_carrier_on()
when protodown is turned off if there is no linked net device or if the
linked net device has a carrier.
Patch #4 adds a selftest covering both bugs and the basic protodown
functionality.
Targeting at net-next since these are not regressions (i.e., never
worked).
Note that while these changes are in the core, they should only affect
macvlan as protodown is only supported by macvlan and vxlan and only the
former has a linked net device.
v3:
- Keep protodown restricted to carrier state and avoid changing /
calling netif_stacked_transfer_operstate().
v2: https://lore.kernel.org/netdev/20260505081656.463158-1-idosch@nvidia.com/
- Move protodown handling away from drivers to the core (Jakub).
- Add a new test case for vxlan.
v1: https://lore.kernel.org/netdev/20260429124624.835335-1-idosch@nvidia.com/
Ido Schimmel (4):
net: Set dev->proto_down before changing carrier state
net: Do not turn on carrier when protodown is on
net: Do not unconditionally turn on carrier when turning off protodown
selftests: net: Add protodown tests
net/core/dev.c | 23 ++-
net/sched/sch_generic.c | 3 +
tools/testing/selftests/net/Makefile | 1 +
tools/testing/selftests/net/protodown.sh | 182 +++++++++++++++++++++++
4 files changed, 207 insertions(+), 2 deletions(-)
create mode 100755 tools/testing/selftests/net/protodown.sh
--
2.54.0
next reply other threads:[~2026-05-07 11:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-07 10:59 Ido Schimmel [this message]
2026-05-07 10:59 ` [PATCH net-next v3 1/4] net: Set dev->proto_down before changing carrier state Ido Schimmel
2026-05-07 10:59 ` [PATCH net-next v3 2/4] net: Do not turn on carrier when protodown is on Ido Schimmel
2026-05-07 10:59 ` [PATCH net-next v3 3/4] net: Do not unconditionally turn on carrier when turning off protodown Ido Schimmel
2026-05-07 10:59 ` [PATCH net-next v3 4/4] selftests: net: Add protodown tests Ido Schimmel
2026-05-09 0:20 ` [PATCH net-next v3 0/4] net: Fix protodown with macvlan patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260507105906.891817-1-idosch@nvidia.com \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox