public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode
@ 2026-03-06 15:10 Cosmin Ratiu
  2026-03-06 15:10 ` [PATCH net v3 1/3] nsim: Add support for VLAN filters Cosmin Ratiu
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Cosmin Ratiu @ 2026-03-06 15:10 UTC (permalink / raw)
  To: netdev
  Cc: Sabrina Dubroca, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Cosmin Ratiu, Dragos Tatulea

This short series adds support for VLANs in macsec devices when offload
mode is enabled. This allows VLAN netdevs on top of macsec netdevs to
function, which accidentally used to be the case in the past, but was
broken. This series adds back proper support.

netdevsim was extended to support VLANs and there's also a selftest for
the new functionality.

V3:
- Moved back to net.
- Added proper rollback support for VLAN filters in case of failure.
- Added VLAN as a requirement for the new macsec tests.

V2: https://lore.kernel.org/netdev/20260227090227.1552512-1-cratiu@nvidia.com/
- Sent to net-next instead of net because of apparent complexity.
- Changed VLAN filtering to only function in offload mode.
- Added tests.

V1: https://lore.kernel.org/netdev/20260107104723.2750725-1-cratiu@nvidia.com/

Cosmin Ratiu (3):
  nsim: Add support for VLAN filters
  selftests: Add macsec offload VLAN tests
  macsec: Support VLAN-filtering lower devices

 drivers/net/macsec.c                          | 44 +++++++++++--
 drivers/net/netdevsim/netdev.c                | 65 ++++++++++++++++++-
 drivers/net/netdevsim/netdevsim.h             |  8 +++
 .../selftests/drivers/net/netdevsim/config    |  1 +
 .../drivers/net/netdevsim/ethtool-common.sh   |  5 +-
 .../drivers/net/netdevsim/macsec-offload.sh   | 59 +++++++++++++++++
 6 files changed, 173 insertions(+), 9 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH net v3 1/3] nsim: Add support for VLAN filters
  2026-03-06 15:10 [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Cosmin Ratiu
@ 2026-03-06 15:10 ` Cosmin Ratiu
  2026-03-06 15:10 ` [PATCH net v3 2/3] selftests: Add macsec offload VLAN tests Cosmin Ratiu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Cosmin Ratiu @ 2026-03-06 15:10 UTC (permalink / raw)
  To: netdev
  Cc: Sabrina Dubroca, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Cosmin Ratiu, Dragos Tatulea

Add support for storing the list of VLANs in nsim devices, together with
ops for adding/removing them and a debug file to show them.

This will be used in upcoming tests.

Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
---
 drivers/net/netdevsim/netdev.c    | 65 ++++++++++++++++++++++++++++++-
 drivers/net/netdevsim/netdevsim.h |  8 ++++
 2 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 6285fbefe38a..33c6d1719db9 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -602,6 +602,36 @@ static int nsim_stop(struct net_device *dev)
 	return 0;
 }
 
+static int nsim_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
+{
+	struct netdevsim *ns = netdev_priv(dev);
+
+	if (vid >= VLAN_N_VID)
+		return -EINVAL;
+
+	if (proto == htons(ETH_P_8021Q))
+		DEBUG_NET_WARN_ON_ONCE(test_and_set_bit(vid, ns->vlan.ctag));
+	else if (proto == htons(ETH_P_8021AD))
+		DEBUG_NET_WARN_ON_ONCE(test_and_set_bit(vid, ns->vlan.stag));
+
+	return 0;
+}
+
+static int nsim_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
+{
+	struct netdevsim *ns = netdev_priv(dev);
+
+	if (vid >= VLAN_N_VID)
+		return -EINVAL;
+
+	if (proto == htons(ETH_P_8021Q))
+		DEBUG_NET_WARN_ON_ONCE(!test_and_clear_bit(vid, ns->vlan.ctag));
+	else if (proto == htons(ETH_P_8021AD))
+		DEBUG_NET_WARN_ON_ONCE(!test_and_clear_bit(vid, ns->vlan.stag));
+
+	return 0;
+}
+
 static int nsim_shaper_set(struct net_shaper_binding *binding,
 			   const struct net_shaper *shaper,
 			   struct netlink_ext_ack *extack)
@@ -659,6 +689,8 @@ static const struct net_device_ops nsim_netdev_ops = {
 	.ndo_bpf		= nsim_bpf,
 	.ndo_open		= nsim_open,
 	.ndo_stop		= nsim_stop,
+	.ndo_vlan_rx_add_vid	= nsim_vlan_rx_add_vid,
+	.ndo_vlan_rx_kill_vid	= nsim_vlan_rx_kill_vid,
 	.net_shaper_ops		= &nsim_shaper_ops,
 };
 
@@ -670,6 +702,8 @@ static const struct net_device_ops nsim_vf_netdev_ops = {
 	.ndo_change_mtu		= nsim_change_mtu,
 	.ndo_setup_tc		= nsim_setup_tc,
 	.ndo_set_features	= nsim_set_features,
+	.ndo_vlan_rx_add_vid	= nsim_vlan_rx_add_vid,
+	.ndo_vlan_rx_kill_vid	= nsim_vlan_rx_kill_vid,
 };
 
 /* We don't have true per-queue stats, yet, so do some random fakery here.
@@ -967,6 +1001,20 @@ static const struct file_operations nsim_pp_hold_fops = {
 	.owner = THIS_MODULE,
 };
 
+static int nsim_vlan_show(struct seq_file *s, void *data)
+{
+	struct netdevsim *ns = s->private;
+	int vid;
+
+	for_each_set_bit(vid, ns->vlan.ctag, VLAN_N_VID)
+		seq_printf(s, "ctag %d\n", vid);
+	for_each_set_bit(vid, ns->vlan.stag, VLAN_N_VID)
+		seq_printf(s, "stag %d\n", vid);
+
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(nsim_vlan);
+
 static void nsim_setup(struct net_device *dev)
 {
 	ether_setup(dev);
@@ -979,14 +1027,18 @@ static void nsim_setup(struct net_device *dev)
 			 NETIF_F_FRAGLIST |
 			 NETIF_F_HW_CSUM |
 			 NETIF_F_LRO |
-			 NETIF_F_TSO;
+			 NETIF_F_TSO |
+			 NETIF_F_HW_VLAN_CTAG_FILTER |
+			 NETIF_F_HW_VLAN_STAG_FILTER;
 	dev->hw_features |= NETIF_F_HW_TC |
 			    NETIF_F_SG |
 			    NETIF_F_FRAGLIST |
 			    NETIF_F_HW_CSUM |
 			    NETIF_F_LRO |
 			    NETIF_F_TSO |
-			    NETIF_F_LOOPBACK;
+			    NETIF_F_LOOPBACK |
+			    NETIF_F_HW_VLAN_CTAG_FILTER |
+			    NETIF_F_HW_VLAN_STAG_FILTER;
 	dev->pcpu_stat_type = NETDEV_PCPU_STAT_DSTATS;
 	dev->max_mtu = ETH_MAX_MTU;
 	dev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_HW_OFFLOAD;
@@ -1154,6 +1206,8 @@ struct netdevsim *nsim_create(struct nsim_dev *nsim_dev,
 	ns->qr_dfs = debugfs_create_file("queue_reset", 0200,
 					 nsim_dev_port->ddir, ns,
 					 &nsim_qreset_fops);
+	ns->vlan_dfs = debugfs_create_file("vlan", 0400, nsim_dev_port->ddir,
+					   ns, &nsim_vlan_fops);
 	return ns;
 
 err_free_netdev:
@@ -1165,7 +1219,9 @@ void nsim_destroy(struct netdevsim *ns)
 {
 	struct net_device *dev = ns->netdev;
 	struct netdevsim *peer;
+	u16 vid;
 
+	debugfs_remove(ns->vlan_dfs);
 	debugfs_remove(ns->qr_dfs);
 	debugfs_remove(ns->pp_dfs);
 
@@ -1175,6 +1231,11 @@ void nsim_destroy(struct netdevsim *ns)
 
 	nsim_psp_uninit(ns);
 
+	for_each_set_bit(vid, ns->vlan.ctag, VLAN_N_VID)
+		DEBUG_NET_WARN_ON_ONCE(1);
+	for_each_set_bit(vid, ns->vlan.stag, VLAN_N_VID)
+		DEBUG_NET_WARN_ON_ONCE(1);
+
 	rtnl_lock();
 	peer = rtnl_dereference(ns->peer);
 	if (peer)
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index f767fc8a7505..f844c27ca78b 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -18,6 +18,7 @@
 #include <linux/ethtool.h>
 #include <linux/ethtool_netlink.h>
 #include <linux/kernel.h>
+#include <linux/if_vlan.h>
 #include <linux/list.h>
 #include <linux/netdevice.h>
 #include <linux/ptp_mock.h>
@@ -75,6 +76,11 @@ struct nsim_macsec {
 	u8 nsim_secy_count;
 };
 
+struct nsim_vlan {
+	DECLARE_BITMAP(ctag, VLAN_N_VID);
+	DECLARE_BITMAP(stag, VLAN_N_VID);
+};
+
 struct nsim_ethtool_pauseparam {
 	bool rx;
 	bool tx;
@@ -135,6 +141,7 @@ struct netdevsim {
 	bool bpf_map_accept;
 	struct nsim_ipsec ipsec;
 	struct nsim_macsec macsec;
+	struct nsim_vlan vlan;
 	struct {
 		u32 inject_error;
 		u32 __ports[2][NSIM_UDP_TUNNEL_N_PORTS];
@@ -146,6 +153,7 @@ struct netdevsim {
 	struct page *page;
 	struct dentry *pp_dfs;
 	struct dentry *qr_dfs;
+	struct dentry *vlan_dfs;
 
 	struct nsim_ethtool ethtool;
 	struct netdevsim __rcu *peer;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH net v3 2/3] selftests: Add macsec offload VLAN tests
  2026-03-06 15:10 [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Cosmin Ratiu
  2026-03-06 15:10 ` [PATCH net v3 1/3] nsim: Add support for VLAN filters Cosmin Ratiu
@ 2026-03-06 15:10 ` Cosmin Ratiu
  2026-03-06 15:10 ` [PATCH net v3 3/3] macsec: Support VLAN-filtering lower devices Cosmin Ratiu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Cosmin Ratiu @ 2026-03-06 15:10 UTC (permalink / raw)
  To: netdev
  Cc: Sabrina Dubroca, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Cosmin Ratiu, Dragos Tatulea

Add macsec offload VLAN tests using the netsim VLAN support just added.
VLAN support is now required for these tests.

Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
---
 .../selftests/drivers/net/netdevsim/config    |  1 +
 .../drivers/net/netdevsim/ethtool-common.sh   |  5 +-
 .../drivers/net/netdevsim/macsec-offload.sh   | 59 +++++++++++++++++++
 3 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/netdevsim/config b/tools/testing/selftests/drivers/net/netdevsim/config
index 5117c78ddf0a..4a3922c59c09 100644
--- a/tools/testing/selftests/drivers/net/netdevsim/config
+++ b/tools/testing/selftests/drivers/net/netdevsim/config
@@ -8,4 +8,5 @@ CONFIG_NET_SCH_MULTIQ=y
 CONFIG_NET_SCH_PRIO=y
 CONFIG_PSAMPLE=y
 CONFIG_PTP_1588_CLOCK_MOCK=y
+CONFIG_VLAN_8021Q=y
 CONFIG_VXLAN=m
diff --git a/tools/testing/selftests/drivers/net/netdevsim/ethtool-common.sh b/tools/testing/selftests/drivers/net/netdevsim/ethtool-common.sh
index 80160579e0cc..b80b88240883 100644
--- a/tools/testing/selftests/drivers/net/netdevsim/ethtool-common.sh
+++ b/tools/testing/selftests/drivers/net/netdevsim/ethtool-common.sh
@@ -30,16 +30,17 @@ function check {
 
     if [ $code $cop 0 ]; then
 	((num_errors++))
-	return
+	return 1
     fi
 
     if [ "$str" != "$exp_str"  ]; then
 	echo -e "Expected: '$exp_str', got '$str'"
 	((num_errors++))
-	return
+	return 1
     fi
 
     ((num_passes++))
+    return 0
 }
 
 function make_netdev {
diff --git a/tools/testing/selftests/drivers/net/netdevsim/macsec-offload.sh b/tools/testing/selftests/drivers/net/netdevsim/macsec-offload.sh
index 98033e6667d2..c4af47eec9fa 100755
--- a/tools/testing/selftests/drivers/net/netdevsim/macsec-offload.sh
+++ b/tools/testing/selftests/drivers/net/netdevsim/macsec-offload.sh
@@ -108,6 +108,65 @@ TMP_FEATS_ON_3="$(ethtool -k $MACSEC_NETDEV)"
 check $?
 
 
+ip link del $MACSEC_NETDEV
+
+
+#
+# test VLAN filter propagation through macsec
+#
+
+VLAN_DFS="$NSIM_DEV_DFS/vlan"
+
+check_vid() {
+    local vid=$1
+    local expected=$2
+
+    if grep -q "ctag $vid" "$VLAN_DFS" 2>/dev/null; then
+	present=1
+    else
+	present=0
+    fi
+    [ "$present" -eq "$expected" ]
+}
+
+# Skip VLAN tests if nsim doesn't support VLANs
+if [ -f $VLAN_DFS ]; then
+    ip link add link $NSIM_NETDEV $MACSEC_NETDEV type macsec offload mac
+    check $?
+    ip link add link $MACSEC_NETDEV ${MACSEC_NETDEV}.10 type vlan id 10
+    check $?
+    check_vid 10 1
+    check $? || echo "VID 10 should be on $MACSEC_NETDEV with offload ON"
+
+    ip link add link $NSIM_NETDEV ${MACSEC_NETDEV}2 type macsec port 5
+    check $?
+    ip link add link ${MACSEC_NETDEV}2 ${MACSEC_NETDEV}2.20 type vlan id 20
+    check $?
+    check_vid 20 0
+    check $? || echo "VID 20 should NOT be on $MACSEC_NETDEV2 with offload OFF"
+
+    ip link set ${MACSEC_NETDEV}2 type macsec offload mac
+    check $?
+    check_vid 20 1
+    check $? || echo "VID 20 should appear after offload ON"
+
+    ip link set ${MACSEC_NETDEV}2 type macsec offload off
+    check $?
+    check_vid 20 0
+    check $? || echo "VID 20 should disappear after offload OFF"
+
+    ip link del ${MACSEC_NETDEV}.10
+    check $?
+    check_vid 10 0
+    check $? || echo "VID 10 should be gone after VLAN delete with offload ON"
+
+    ip link del ${MACSEC_NETDEV}2.20
+    ip link del ${MACSEC_NETDEV}2
+    ip link del $MACSEC_NETDEV
+else
+    echo "SKIP: macsec VLAN tests, no netdevsim support."
+fi
+
 if [ $num_errors -eq 0 ]; then
     echo "PASSED all $((num_passes)) checks"
     exit 0
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH net v3 3/3] macsec: Support VLAN-filtering lower devices
  2026-03-06 15:10 [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Cosmin Ratiu
  2026-03-06 15:10 ` [PATCH net v3 1/3] nsim: Add support for VLAN filters Cosmin Ratiu
  2026-03-06 15:10 ` [PATCH net v3 2/3] selftests: Add macsec offload VLAN tests Cosmin Ratiu
@ 2026-03-06 15:10 ` Cosmin Ratiu
  2026-03-06 19:53 ` [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Jakub Kicinski
  2026-03-07 18:59 ` [syzbot ci] " syzbot ci
  4 siblings, 0 replies; 11+ messages in thread
From: Cosmin Ratiu @ 2026-03-06 15:10 UTC (permalink / raw)
  To: netdev
  Cc: Sabrina Dubroca, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Cosmin Ratiu, Dragos Tatulea

VLAN-filtering is done through two netdev features
(NETIF_F_HW_VLAN_CTAG_FILTER and NETIF_F_HW_VLAN_STAG_FILTER) and two
netdev ops (ndo_vlan_rx_add_vid and ndo_vlan_rx_kill_vid).

Implement these and advertise the features if the lower device supports
them. This allows proper VLAN filtering to work on top of macsec
devices, when the lower device is capable of VLAN filtering.
As a concrete example, having this chain of interfaces now works:
vlan_filtering_capable_dev(1) -> macsec_dev(2) -> macsec_vlan_dev(3)

Before commit [1] this used to accidentally work because the macsec
device (and thus the lower device) was put in promiscuous mode and the
VLAN filter was not used. But after commit [1] correctly made the macsec
driver expose the IFF_UNICAST_FLT flag, promiscuous mode was no longer
used and VLAN filters on dev 1 kicked in. Without support in dev 2 for
propagating VLAN filters down, the register_vlan_dev -> vlan_vid_add ->
__vlan_vid_add -> vlan_add_rx_filter_info call from dev 3 is silently
eaten (because vlan_hw_filter_capable returns false and
vlan_add_rx_filter_info silently succeeds).

For macsec, VLAN filters are only relevant for offload, otherwise
the VLANs are encrypted and the lower devices don't care about them. So
VLAN filters are only passed on to lower devices in offload mode.
Flipping between offload modes now needs to offload/unoffload the
filters with vlan_{get,drop}_rx_*_filter_info().

To avoid the back-and-forth filter updating during rollback, the setting
of macsec->offload is moved after the add/del secy ops. This is safe
since none of the code called from those requires macsec->offload.

[1] commit 0349659fd72f ("macsec: set IFF_UNICAST_FLT priv flag")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
---
 drivers/net/macsec.c | 44 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 5 deletions(-)

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index c2cb2d20976b..dec6a89aae2c 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -2616,14 +2616,22 @@ static int macsec_update_offload(struct net_device *dev, enum macsec_offload off
 	if (!ops)
 		return -EOPNOTSUPP;
 
-	macsec->offload = offload;
-
 	ctx.secy = &macsec->secy;
 	ret = offload == MACSEC_OFFLOAD_OFF ? macsec_offload(ops->mdo_del_secy, &ctx)
 					    : macsec_offload(ops->mdo_add_secy, &ctx);
-	if (ret) {
-		macsec->offload = prev_offload;
+	if (ret)
 		return ret;
+
+	/* Remove VLAN filters when disabling offload. */
+	if (offload == MACSEC_OFFLOAD_OFF) {
+		vlan_drop_rx_ctag_filter_info(dev);
+		vlan_drop_rx_stag_filter_info(dev);
+	}
+	macsec->offload = offload;
+	/* Add VLAN filters when enabling offload. */
+	if (prev_offload == MACSEC_OFFLOAD_OFF) {
+		vlan_get_rx_ctag_filter_info(dev);
+		vlan_get_rx_stag_filter_info(dev);
 	}
 
 	macsec_set_head_tail_room(dev);
@@ -3486,7 +3494,8 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,
 }
 
 #define MACSEC_FEATURES \
-	(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
+	(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
+	 NETIF_F_HW_VLAN_STAG_FILTER | NETIF_F_HW_VLAN_CTAG_FILTER)
 
 #define MACSEC_OFFLOAD_FEATURES \
 	(MACSEC_FEATURES | NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES | \
@@ -3707,6 +3716,29 @@ static int macsec_set_mac_address(struct net_device *dev, void *p)
 	return err;
 }
 
+static int macsec_vlan_rx_add_vid(struct net_device *dev,
+				  __be16 proto, u16 vid)
+{
+	struct macsec_dev *macsec = netdev_priv(dev);
+
+	if (!macsec_is_offloaded(macsec))
+		return 0;
+
+	return vlan_vid_add(macsec->real_dev, proto, vid);
+}
+
+static int macsec_vlan_rx_kill_vid(struct net_device *dev,
+				   __be16 proto, u16 vid)
+{
+	struct macsec_dev *macsec = netdev_priv(dev);
+
+	if (!macsec_is_offloaded(macsec))
+		return 0;
+
+	vlan_vid_del(macsec->real_dev, proto, vid);
+	return 0;
+}
+
 static int macsec_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct macsec_dev *macsec = macsec_priv(dev);
@@ -3748,6 +3780,8 @@ static const struct net_device_ops macsec_netdev_ops = {
 	.ndo_set_rx_mode	= macsec_dev_set_rx_mode,
 	.ndo_change_rx_flags	= macsec_dev_change_rx_flags,
 	.ndo_set_mac_address	= macsec_set_mac_address,
+	.ndo_vlan_rx_add_vid	= macsec_vlan_rx_add_vid,
+	.ndo_vlan_rx_kill_vid	= macsec_vlan_rx_kill_vid,
 	.ndo_start_xmit		= macsec_start_xmit,
 	.ndo_get_stats64	= macsec_get_stats64,
 	.ndo_get_iflink		= macsec_get_iflink,
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode
  2026-03-06 15:10 [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Cosmin Ratiu
                   ` (2 preceding siblings ...)
  2026-03-06 15:10 ` [PATCH net v3 3/3] macsec: Support VLAN-filtering lower devices Cosmin Ratiu
@ 2026-03-06 19:53 ` Jakub Kicinski
  2026-03-06 19:54   ` Jakub Kicinski
  2026-03-09 16:19   ` Cosmin Ratiu
  2026-03-07 18:59 ` [syzbot ci] " syzbot ci
  4 siblings, 2 replies; 11+ messages in thread
From: Jakub Kicinski @ 2026-03-06 19:53 UTC (permalink / raw)
  To: Cosmin Ratiu
  Cc: netdev, Sabrina Dubroca, Andrew Lunn, David S . Miller,
	Eric Dumazet, Paolo Abeni, Dragos Tatulea

On Fri, 6 Mar 2026 17:10:01 +0200 Cosmin Ratiu wrote:
> This short series adds support for VLANs in macsec devices when offload
> mode is enabled. This allows VLAN netdevs on top of macsec netdevs to
> function, which accidentally used to be the case in the past, but was
> broken. This series adds back proper support.
> 
> netdevsim was extended to support VLANs and there's also a selftest for
> the new functionality.

I think it's triggering the warning you added, in most of the tests:

[   20.973710][  T194] WARNING: drivers/net/netdevsim/netdev.c:1234 at nsim_destroy+0x128/0x7b0 [netdevsim], CPU#0: peer.sh/194

Also please see

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode
  2026-03-06 19:53 ` [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Jakub Kicinski
@ 2026-03-06 19:54   ` Jakub Kicinski
  2026-03-09 16:23     ` Cosmin Ratiu
  2026-03-09 16:19   ` Cosmin Ratiu
  1 sibling, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2026-03-06 19:54 UTC (permalink / raw)
  To: Cosmin Ratiu
  Cc: netdev, Sabrina Dubroca, Andrew Lunn, David S . Miller,
	Eric Dumazet, Paolo Abeni, Dragos Tatulea

On Fri, 6 Mar 2026 11:53:53 -0800 Jakub Kicinski wrote:
> Also please see

https://lore.kernel.org/all/20260304151647.2770466-1-kuba@kernel.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [syzbot ci] Re: macsec: Add support for VLAN filtering in offload mode
  2026-03-06 15:10 [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Cosmin Ratiu
                   ` (3 preceding siblings ...)
  2026-03-06 19:53 ` [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Jakub Kicinski
@ 2026-03-07 18:59 ` syzbot ci
  4 siblings, 0 replies; 11+ messages in thread
From: syzbot ci @ 2026-03-07 18:59 UTC (permalink / raw)
  To: andrew, cratiu, davem, dtatulea, edumazet, kuba, netdev, pabeni,
	sd
  Cc: syzbot, syzkaller-bugs

syzbot ci has tested the following series

[v3] macsec: Add support for VLAN filtering in offload mode
https://lore.kernel.org/all/20260306151004.2862198-1-cratiu@nvidia.com
* [PATCH net v3 1/3] nsim: Add support for VLAN filters
* [PATCH net v3 2/3] selftests: Add macsec offload VLAN tests
* [PATCH net v3 3/3] macsec: Support VLAN-filtering lower devices

and found the following issue:
WARNING in nsim_destroy

Full report is available here:
https://ci.syzbot.org/series/82631b62-e289-479c-90ac-235c613bbae1

***

WARNING in nsim_destroy

tree:      net
URL:       https://kernel.googlesource.com/pub/scm/linux/kernel/git/netdev/net.git
base:      b06ccbabe2506fd70b9167a644978b049150224a
arch:      amd64
compiler:  Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config:    https://ci.syzbot.org/builds/0beaf859-b4a7-4d7b-b4cf-b7e48e02f7a5/config
C repro:   https://ci.syzbot.org/findings/6f1250ca-99f0-4162-b147-c373abd95c96/c_repro
syz repro: https://ci.syzbot.org/findings/6f1250ca-99f0-4162-b147-c373abd95c96/syz_repro

------------[ cut here ]------------
1
WARNING: drivers/net/netdevsim/netdev.c:1235 at nsim_destroy+0x155/0x780 drivers/net/netdevsim/netdev.c:1235, CPU#1: kworker/u8:3/5864
Modules linked in:
CPU: 1 UID: 0 PID: 5864 Comm: kworker/u8:3 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: netns cleanup_net
RIP: 0010:nsim_destroy+0x155/0x780 drivers/net/netdevsim/netdev.c:1235
Code: c4 48 89 c6 48 81 e6 00 f0 00 00 31 ff e8 c3 f0 af fa 4c 89 e0 48 25 00 f0 00 00 74 0c e8 d3 eb af fa eb 2e e8 cc eb af fa 90 <0f> 0b 90 41 ff c4 41 0f b7 d4 be 00 10 00 00 4c 89 ff e8 74 6d 8f
RSP: 0018:ffffc90004857628 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 1ffff110222a31b8 RCX: ffff88816f3fd700
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffff90109377 R09: 1ffffffff202126e
R10: dffffc0000000000 R11: fffffbfff202126f R12: 0000000000000000
R13: ffff888111518dc0 R14: dffffc0000000000 R15: ffff888111519508
FS:  0000000000000000(0000) GS:ffff8882a94ae000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007feb04e16038 CR3: 000000000e54a000 CR4: 00000000000006f0
Call Trace:
 <TASK>
 __nsim_dev_port_del+0x14d/0x1b0 drivers/net/netdevsim/dev.c:1528
 nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1540 [inline]
 nsim_dev_reload_destroy+0x288/0x490 drivers/net/netdevsim/dev.c:1764
 nsim_dev_reload_down+0x8a/0xc0 drivers/net/netdevsim/dev.c:1038
 devlink_reload+0x1d1/0x8d0 net/devlink/dev.c:461
 devlink_pernet_pre_exit+0x1e6/0x3f0 net/devlink/core.c:507
 ops_pre_exit_list net/core/net_namespace.c:161 [inline]
 ops_undo_list+0x187/0x940 net/core/net_namespace.c:234
 cleanup_net+0x56b/0x800 net/core/net_namespace.c:704
 process_one_work kernel/workqueue.c:3275 [inline]
 process_scheduled_works+0xaec/0x17a0 kernel/workqueue.c:3358
 worker_thread+0xa50/0xfc0 kernel/workqueue.c:3439
 kthread+0x388/0x470 kernel/kthread.c:467
 ret_from_fork+0x51e/0xb90 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>


***

If these findings have caused you to resend the series or submit a
separate fix, please add the following tag to your commit message:
  Tested-by: syzbot@syzkaller.appspotmail.com

---
This report is generated by a bot. It may contain errors.
syzbot ci engineers can be reached at syzkaller@googlegroups.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode
  2026-03-06 19:53 ` [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Jakub Kicinski
  2026-03-06 19:54   ` Jakub Kicinski
@ 2026-03-09 16:19   ` Cosmin Ratiu
  2026-03-09 16:43     ` Sabrina Dubroca
  1 sibling, 1 reply; 11+ messages in thread
From: Cosmin Ratiu @ 2026-03-09 16:19 UTC (permalink / raw)
  To: kuba@kernel.org
  Cc: pabeni@redhat.com, Dragos Tatulea, edumazet@google.com,
	netdev@vger.kernel.org, andrew+netdev@lunn.ch, sd@queasysnail.net,
	davem@davemloft.net

On Fri, 2026-03-06 at 11:53 -0800, Jakub Kicinski wrote:
> On Fri, 6 Mar 2026 17:10:01 +0200 Cosmin Ratiu wrote:
> > This short series adds support for VLANs in macsec devices when
> > offload
> > mode is enabled. This allows VLAN netdevs on top of macsec netdevs
> > to
> > function, which accidentally used to be the case in the past, but
> > was
> > broken. This series adds back proper support.
> > 
> > netdevsim was extended to support VLANs and there's also a selftest
> > for
> > the new functionality.
> 
> I think it's triggering the warning you added, in most of the tests:
> 
> [   20.973710][  T194] WARNING: drivers/net/netdevsim/netdev.c:1234
> at nsim_destroy+0x128/0x7b0 [netdevsim], CPU#0: peer.sh/194

Right, it seems the fuzzing test adds a bunch of VLANs then destroys
the netsim devs. It doesn't make sense to have those warnings anyway,
it's ok to not clean up the VLAN filters from a device before
destroying it, they're not a resource, they're a setting. I'll remove
the warnings in the next version.

Cosmin.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode
  2026-03-06 19:54   ` Jakub Kicinski
@ 2026-03-09 16:23     ` Cosmin Ratiu
  2026-03-09 21:21       ` Jakub Kicinski
  0 siblings, 1 reply; 11+ messages in thread
From: Cosmin Ratiu @ 2026-03-09 16:23 UTC (permalink / raw)
  To: kuba@kernel.org
  Cc: pabeni@redhat.com, Dragos Tatulea, edumazet@google.com,
	netdev@vger.kernel.org, andrew+netdev@lunn.ch, sd@queasysnail.net,
	davem@davemloft.net

On Fri, 2026-03-06 at 11:54 -0800, Jakub Kicinski wrote:
> On Fri, 6 Mar 2026 11:53:53 -0800 Jakub Kicinski wrote:
> > Also please see
> 
> https://lore.kernel.org/all/20260304151647.2770466-1-kuba@kernel.org/

In this case, netdevsim VLAN support is used as a test fixture for
macsec offload support. So the focus isn't VLAN filters, but what
macsec does with those filters.

Besides, tools/testing/selftests/drivers/net/netdevsim/macsec-
offload.sh was the most natural place to add these tests.

What's your request here?
Would you like me to move that test out of netdevsim and have it work
with real devices as well? Or just add the VLAN part as a separate test
somewhere? Or we leave it like this and keep it in mind for future
tests.

Cosmin.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode
  2026-03-09 16:19   ` Cosmin Ratiu
@ 2026-03-09 16:43     ` Sabrina Dubroca
  0 siblings, 0 replies; 11+ messages in thread
From: Sabrina Dubroca @ 2026-03-09 16:43 UTC (permalink / raw)
  To: Cosmin Ratiu
  Cc: kuba@kernel.org, pabeni@redhat.com, Dragos Tatulea,
	edumazet@google.com, netdev@vger.kernel.org,
	andrew+netdev@lunn.ch, davem@davemloft.net

2026-03-09, 16:19:20 +0000, Cosmin Ratiu wrote:
> On Fri, 2026-03-06 at 11:53 -0800, Jakub Kicinski wrote:
> > On Fri, 6 Mar 2026 17:10:01 +0200 Cosmin Ratiu wrote:
> > > This short series adds support for VLANs in macsec devices when
> > > offload
> > > mode is enabled. This allows VLAN netdevs on top of macsec netdevs
> > > to
> > > function, which accidentally used to be the case in the past, but
> > > was
> > > broken. This series adds back proper support.
> > > 
> > > netdevsim was extended to support VLANs and there's also a selftest
> > > for
> > > the new functionality.
> > 
> > I think it's triggering the warning you added, in most of the tests:
> > 
> > [   20.973710][  T194] WARNING: drivers/net/netdevsim/netdev.c:1234
> > at nsim_destroy+0x128/0x7b0 [netdevsim], CPU#0: peer.sh/194
> 
> Right, it seems the fuzzing test adds a bunch of VLANs then destroys
> the netsim devs. It doesn't make sense to have those warnings anyway,
> it's ok to not clean up the VLAN filters from a device before
> destroying it, they're not a resource, they're a setting. I'll remove
> the warnings in the next version.

But the vlan devices on top of the netdevsim device should have been
deleted (and thus the vlan and their filters removed from the
macsec/netdevsim devices) by the time we finish destroying the
netdevsim device. So this warning just needs to happen a bit later in
nsim_destroy? (I guess just after unregister_netdevice)

-- 
Sabrina

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode
  2026-03-09 16:23     ` Cosmin Ratiu
@ 2026-03-09 21:21       ` Jakub Kicinski
  0 siblings, 0 replies; 11+ messages in thread
From: Jakub Kicinski @ 2026-03-09 21:21 UTC (permalink / raw)
  To: Cosmin Ratiu
  Cc: pabeni@redhat.com, Dragos Tatulea, edumazet@google.com,
	netdev@vger.kernel.org, andrew+netdev@lunn.ch, sd@queasysnail.net,
	davem@davemloft.net

On Mon, 9 Mar 2026 16:23:22 +0000 Cosmin Ratiu wrote:
> What's your request here?
> Would you like me to move that test out of netdevsim and have it work
> with real devices as well? Or just add the VLAN part as a separate test
> somewhere? Or we leave it like this and keep it in mind for future
> tests.

The first option - adding a test that can run on real HW as well as
netdevsim will increase the code the test exercises by an order of
magnitude.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-03-09 21:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 15:10 [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Cosmin Ratiu
2026-03-06 15:10 ` [PATCH net v3 1/3] nsim: Add support for VLAN filters Cosmin Ratiu
2026-03-06 15:10 ` [PATCH net v3 2/3] selftests: Add macsec offload VLAN tests Cosmin Ratiu
2026-03-06 15:10 ` [PATCH net v3 3/3] macsec: Support VLAN-filtering lower devices Cosmin Ratiu
2026-03-06 19:53 ` [PATCH net v3 0/3] macsec: Add support for VLAN filtering in offload mode Jakub Kicinski
2026-03-06 19:54   ` Jakub Kicinski
2026-03-09 16:23     ` Cosmin Ratiu
2026-03-09 21:21       ` Jakub Kicinski
2026-03-09 16:19   ` Cosmin Ratiu
2026-03-09 16:43     ` Sabrina Dubroca
2026-03-07 18:59 ` [syzbot ci] " syzbot ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox