Skip to contentSkip to conversation

net: dsa: mv88e6xxx: add MQPRIO/CBS offload

PATCH Superseded Luke Howard 5 participants 14 messages May 27 – May 30

Subsystems (7)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover net: dsa: mv88e6xxx: add MQPRIO/CBS offload

This series adds hardware offload of 802.1Qav (Credit Based Shaper) for conforming Marvell switches. It also introduces a new bridge MDB flag, MDB_FLAGS_STREAM_RESERVED, that userspace can set on RTM_NEWMDB to mark a multicast destination as belonging to a reserved stream; the flag is propagated through switchdev to hardware drivers that can enforce admission of AVB / SR priority traffic only to flagged destinations.

The patches were originally proposed as an RFC in September 2025 [1], but have been updated to absorb most of Cedric Jehasse's recent CBS changes [2] (with the exception of support for more than two shaped queues). The principal application is hardware-offloaded switching of AVB/TSN traffic rather than host-initiated traffic.

In addition to programming the per-queue shaper, the following related registers are configured:

* global isochronous queue pointer threshold
* strict-priority queue scheduling while CBS is active on a port
* in Enhanced/Secure AVB mode, hardware drops frames with AVB priorities whose destination MAC has not been added to the MDB with the new MDB_FLAGS_STREAM_RESERVED flag

A more detailed overview is given in drivers/net/dsa/mv88e6xxx/avb.h.

Support for MDB_FLAGS_STREAM_RESERVED in the software bridge will be submitted as a separate patch series.

[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/

Luke Howard (6):
net: bridge: mdb: add MDB_FLAGS_STREAM_RESERVED flag
net: dsa: mv88e6xxx: add num_tx_queues to chip info structure
net: dsa: mv88e6xxx: add MV88E6XXX_G1_ATU_CTL_MAC_AVB setter
net: dsa: mv88e6xxx: MQPRIO support
net: dsa: mv88e6xxx: CBS support
dt-bindings: net: dsa: mv88e6xxx: add mv88e6xxx-avb-mode property

 .../bindings/net/dsa/marvell,mv88e6xxx.yaml   |  26 +
 drivers/net/dsa/mv88e6xxx/Makefile            |   3 +-
 drivers/net/dsa/mv88e6xxx/avb.c               | 633 ++++++++++++++++++
 drivers/net/dsa/mv88e6xxx/avb.h               | 228 +++++++
 drivers/net/dsa/mv88e6xxx/chip.c              | 372 +++++++++-
 drivers/net/dsa/mv88e6xxx/chip.h              | 101 +++
 drivers/net/dsa/mv88e6xxx/global1.c           |   9 +-
 drivers/net/dsa/mv88e6xxx/global1.h           |  47 +-
 drivers/net/dsa/mv88e6xxx/global1_atu.c       |  17 +
 drivers/net/dsa/mv88e6xxx/global2.h           |  14 +-
 drivers/net/dsa/mv88e6xxx/global2_avb.c       | 205 +++++-
 drivers/net/dsa/mv88e6xxx/port.c              |  54 ++
 drivers/net/dsa/mv88e6xxx/port.h              |  22 +
 include/linux/platform_data/mv88e6xxx.h       |   1 +
 include/net/switchdev.h                       |   4 +
 include/uapi/linux/if_bridge.h                |   2 +
 net/bridge/br_mdb.c                           |  12 +
 net/bridge/br_private.h                       |   2 +
 net/bridge/br_switchdev.c                     |  17 +-
 19 files changed, 1744 insertions(+), 25 deletions(-)
 create mode 100644 drivers/net/dsa/mv88e6xxx/avb.c
 create mode 100644 drivers/net/dsa/mv88e6xxx/avb.h
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/6 net: bridge: mdb: add MDB_FLAGS_STREAM_RESERVED flag

Add a new MDB entry flag, MDB_FLAGS_STREAM_RESERVED, that userspace can set on RTM_NEWMDB to mark a multicast destination as belonging to a reserved stream (e.g. IEEE 802.1Q Stream Reservation Protocol / IEEE 1722 / TSN). The bridge core does no admission control on the basis of the flag; it is metadata propagated through switchdev to hardware drivers that can themselves enforce admission of AVB / SR priority traffic only to flagged destinations.

The flag is settable via the new nested attribute MDBE_ATTR_FLAGS (NLA_U32 bitmask, validated against MDB_FLAGS_SETTABLE_MASK), and is reflected in dump output via br_mdb_entry.flags as is done today for the OFFLOAD/BLOCKED/STAR_EXCL flags.

Assisted-by Claude:claude-4.7-opus
---
 include/net/switchdev.h        |  4 ++++
 include/uapi/linux/if_bridge.h |  2 ++
 net/bridge/br_mdb.c            | 12 ++++++++++++
 net/bridge/br_private.h        |  2 ++
 net/bridge/br_switchdev.c      | 17 +++++++++++------
 5 files changed, 31 insertions(+), 6 deletions(-)
include/net/switchdev.h +4 -0
index ee500706496b0..03d176708b768 100644
@@ -111,10 +111,14 @@ struct switchdev_obj_port_vlan {
 	container_of((OBJ), struct switchdev_obj_port_vlan, obj)
 
 /* SWITCHDEV_OBJ_ID_PORT_MDB */
+
+#define SWITCHDEV_MDB_F_STREAM_RESERVED		BIT(0)
+
 struct switchdev_obj_port_mdb {
 	struct switchdev_obj obj;
 	unsigned char addr[ETH_ALEN];
 	u16 vid;
+	u32 flags;
 };
 
 #define SWITCHDEV_OBJ_PORT_MDB(OBJ) \
include/uapi/linux/if_bridge.h +2 -0
index 21a700c02ef76..51ec314994bec 100644
@@ -705,6 +705,7 @@ struct br_mdb_entry {
 #define MDB_FLAGS_STAR_EXCL		(1 << 2)
 #define MDB_FLAGS_BLOCKED		(1 << 3)
 #define MDB_FLAGS_OFFLOAD_FAILED	(1 << 4)
+#define MDB_FLAGS_STREAM_RESERVED	(1 << 5)
 	__u8 flags;
 	__u16 vid;
 	struct {
@@ -760,6 +761,7 @@ enum {
 	MDBE_ATTR_IFINDEX,
 	MDBE_ATTR_SRC_VNI,
 	MDBE_ATTR_STATE_MASK,
+	MDBE_ATTR_FLAGS,
 	__MDBE_ATTR_MAX,
 };
 #define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
net/bridge/br_mdb.c +12 -0
index e0c7020b12f5f..1320ccd81b0a1 100644
@@ -146,6 +146,8 @@ static void __mdb_entry_fill_flags(struct br_mdb_entry *e, unsigned char flags)
 		e->flags |= MDB_FLAGS_BLOCKED;
 	if (flags & MDB_PG_FLAGS_OFFLOAD_FAILED)
 		e->flags |= MDB_FLAGS_OFFLOAD_FAILED;
+	if (flags & MDB_PG_FLAGS_STREAM_RESERVED)
+		e->flags |= MDB_FLAGS_STREAM_RESERVED;
 }
 
 static void __mdb_entry_to_br_ip(struct br_mdb_entry *entry, struct br_ip *ip,
@@ -664,6 +666,7 @@ static const struct nla_policy br_mdbe_attrs_pol[MDBE_ATTR_MAX + 1] = {
 						  MCAST_INCLUDE),
 	[MDBE_ATTR_SRC_LIST] = NLA_POLICY_NESTED(br_mdbe_src_list_pol),
 	[MDBE_ATTR_RTPROT] = NLA_POLICY_MIN(NLA_U8, RTPROT_STATIC),
+	[MDBE_ATTR_FLAGS] = NLA_POLICY_MASK(NLA_U32, MDB_FLAGS_STREAM_RESERVED),
 };
 
 static bool is_valid_mdb_source(struct nlattr *attr, __be16 proto,
@@ -1072,6 +1075,8 @@ static int br_mdb_add_group(const struct br_mdb_config *cfg,
 	if (entry->state == MDB_PERMANENT)
 		flags |= MDB_PG_FLAGS_PERMANENT;
 
+	flags |= cfg->pg_flags;
+
 	if (br_multicast_is_star_g(&group))
 		return br_mdb_add_group_star_g(cfg, mp, brmctx, flags, extack);
 	else
@@ -1225,6 +1230,13 @@ static int br_mdb_config_attrs_init(struct nlattr *set_attrs,
 		cfg->rt_protocol = nla_get_u8(mdb_attrs[MDBE_ATTR_RTPROT]);
 	}
 
+	if (mdb_attrs[MDBE_ATTR_FLAGS]) {
+		u32 user_flags = nla_get_u32(mdb_attrs[MDBE_ATTR_FLAGS]);
+
+		if (user_flags & MDB_FLAGS_STREAM_RESERVED)
+			cfg->pg_flags |= MDB_PG_FLAGS_STREAM_RESERVED;
+	}
+
 	return 0;
 }
 
net/bridge/br_private.h +2 -0
index 02671e648dac7..b9ee19448e38b 100644
@@ -111,6 +111,7 @@ struct br_mdb_config {
 	struct br_mdb_src_entry		*src_entries;
 	int				num_src_entries;
 	u8				rt_protocol;
+	unsigned char			pg_flags;
 };
 #endif
 
@@ -317,6 +318,7 @@ struct net_bridge_fdb_flush_desc {
 #define MDB_PG_FLAGS_STAR_EXCL		BIT(3)
 #define MDB_PG_FLAGS_BLOCKED		BIT(4)
 #define MDB_PG_FLAGS_OFFLOAD_FAILED	BIT(5)
+#define MDB_PG_FLAGS_STREAM_RESERVED	BIT(6)
 
 #define PG_SRC_ENT_LIMIT	32
 
net/bridge/br_switchdev.c +11 -6
index 18b558a931ad9..bc05cda2f5350 100644
@@ -548,7 +548,8 @@ static void br_switchdev_mdb_complete(struct net_device *dev, int err, void *pri
 }
 
 static void br_switchdev_mdb_populate(struct switchdev_obj_port_mdb *mdb,
-				      const struct net_bridge_mdb_entry *mp)
+				      const struct net_bridge_mdb_entry *mp,
+				      const struct net_bridge_port_group *pg)
 {
 	if (mp->addr.proto == htons(ETH_P_IP))
 		ip_eth_mc_map(mp->addr.dst.ip4, mdb->addr);
@@ -560,6 +561,9 @@ static void br_switchdev_mdb_populate(struct switchdev_obj_port_mdb *mdb,
 		ether_addr_copy(mdb->addr, mp->addr.dst.mac_addr);
 
 	mdb->vid = mp->addr.vid;
+	mdb->flags = 0;
+	if (pg && (pg->flags & MDB_PG_FLAGS_STREAM_RESERVED))
+		mdb->flags |= SWITCHDEV_MDB_F_STREAM_RESERVED;
 }
 
 static void br_switchdev_host_mdb_one(struct net_device *dev,
@@ -575,7 +579,7 @@ static void br_switchdev_host_mdb_one(struct net_device *dev,
 		},
 	};
 
-	br_switchdev_mdb_populate(&mdb, mp);
+	br_switchdev_mdb_populate(&mdb, mp, NULL);
 
 	switch (type) {
 	case RTM_NEWMDB:
@@ -622,6 +626,7 @@ static int br_switchdev_mdb_queue_one(struct list_head *mdb_list,
 				      unsigned long action,
 				      enum switchdev_obj_id id,
 				      const struct net_bridge_mdb_entry *mp,
+				      const struct net_bridge_port_group *pg,
 				      struct net_device *orig_dev)
 {
 	struct switchdev_obj_port_mdb mdb = {
@@ -632,7 +637,7 @@ static int br_switchdev_mdb_queue_one(struct list_head *mdb_list,
 	};
 	struct switchdev_obj_port_mdb *pmdb;
 
-	br_switchdev_mdb_populate(&mdb, mp);
+	br_switchdev_mdb_populate(&mdb, mp, pg);
 
 	if (action == SWITCHDEV_PORT_OBJ_ADD &&
 	    switchdev_port_obj_act_is_deferred(dev, action, &mdb.obj)) {
@@ -671,7 +676,7 @@ void br_switchdev_mdb_notify(struct net_device *dev,
 	if (!pg)
 		return br_switchdev_host_mdb(dev, mp, type);
 
-	br_switchdev_mdb_populate(&mdb, mp);
+	br_switchdev_mdb_populate(&mdb, mp, pg);
 
 	mdb.obj.orig_dev = pg->key.port->dev;
 	switch (type) {
@@ -740,7 +745,7 @@ br_switchdev_mdb_replay(struct net_device *br_dev, struct net_device *dev,
 		if (mp->host_joined) {
 			err = br_switchdev_mdb_queue_one(&mdb_list, dev, action,
 							 SWITCHDEV_OBJ_ID_HOST_MDB,
-							 mp, br_dev);
+							 mp, NULL, br_dev);
 			if (err) {
 				spin_unlock_bh(&br->multicast_lock);
 				goto out_free_mdb;
@@ -754,7 +759,7 @@ br_switchdev_mdb_replay(struct net_device *br_dev, struct net_device *dev,
 
 			err = br_switchdev_mdb_queue_one(&mdb_list, dev, action,
 							 SWITCHDEV_OBJ_ID_PORT_MDB,
-							 mp, dev);
+							 mp, p, dev);
 			if (err) {
 				spin_unlock_bh(&br->multicast_lock);
 				goto out_free_mdb;
Signature · 1 line
2.43.0
#4 lore raw

PATCH 2/6 net: dsa: mv88e6xxx: add num_tx_queues to chip info structure

In reply to Luke Howard

In preparation for adding 802.1Qav support (FQTSS), add an element to struct mv88e6xxx_info indicating the number of transmit queues supported by each chip.

---
 drivers/net/dsa/mv88e6xxx/chip.c | 23 +++++++++++++++++++++++
 drivers/net/dsa/mv88e6xxx/chip.h |  3 +++
 2 files changed, 26 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +23 -0
index c30e4c13565a5..5d45363c67bbd 100644
@@ -4106,6 +4106,8 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
 			goto unlock;
 	}
 
+	ds->num_tx_queues = chip->info->num_tx_queues;
+
 	err = mv88e6xxx_stats_setup(chip);
 	if (err)
 		goto unlock;
@@ -5873,6 +5875,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
+		.num_tx_queues = 4,
 		.ops = &mv88e6141_ops,
 	},
 
@@ -5899,6 +5902,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
 		.ptp_support = true,
+		.num_tx_queues = 4,
 		.ops = &mv88e6161_ops,
 	},
 
@@ -5924,6 +5928,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.ptp_support = true,
+		.num_tx_queues = 4,
 		.ops = &mv88e6165_ops,
 	},
 
@@ -5975,6 +5980,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
+		.num_tx_queues = 4,
 		.ops = &mv88e6172_ops,
 	},
 
@@ -6026,6 +6032,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
+		.num_tx_queues = 4,
 		.ops = &mv88e6176_ops,
 	},
 
@@ -6073,6 +6080,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.atu_move_port_mask = 0x1f,
+		.num_tx_queues = 8,
 		.ops = &mv88e6190_ops,
 	},
 
@@ -6098,6 +6106,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.atu_move_port_mask = 0x1f,
 		.pvt = true,
 		.multi_chip = true,
+		.num_tx_queues = 8,
 		.ops = &mv88e6190x_ops,
 	},
 
@@ -6123,6 +6132,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.ptp_support = true,
+		.num_tx_queues = 4,
 		.ops = &mv88e6191_ops,
 	},
 
@@ -6148,6 +6158,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.ptp_support = true,
+		.num_tx_queues = 8,
 		.ops = &mv88e6393x_ops,
 	},
 
@@ -6175,6 +6186,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.ptp_support = true,
+		.num_tx_queues = 8,
 		.ops = &mv88e6393x_ops,
 	},
 
@@ -6229,6 +6241,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
 		.ptp_support = true,
+		.num_tx_queues = 4,
 		.ops = &mv88e6240_ops,
 	},
 
@@ -6278,6 +6291,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.ptp_support = true,
+		.num_tx_queues = 8,
 		.ops = &mv88e6290_ops,
 	},
 
@@ -6306,6 +6320,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
 		.ptp_support = true,
+		.num_tx_queues = 4,
 		.ops = &mv88e6320_ops,
 	},
 
@@ -6334,6 +6349,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
 		.ptp_support = true,
+		.num_tx_queues = 4,
 		.ops = &mv88e6321_ops,
 	},
 
@@ -6361,6 +6377,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
 		.ptp_support = true,
+		.num_tx_queues = 4,
 		.ops = &mv88e6341_ops,
 	},
 
@@ -6411,6 +6428,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
+		.num_tx_queues = 4,
 		.ops = &mv88e6351_ops,
 	},
 
@@ -6438,6 +6456,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_SUPPORTED,
 		.ptp_support = true,
+		.num_tx_queues = 4,
 		.ops = &mv88e6352_ops,
 	},
 	[MV88E6361] = {
@@ -6465,6 +6484,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.ptp_support = true,
+		.num_tx_queues = 8,
 		.ops = &mv88e6393x_ops,
 	},
 	[MV88E6390] = {
@@ -6493,6 +6513,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_UNDOCUMENTED,
 		.ptp_support = true,
+		.num_tx_queues = 8,
 		.ops = &mv88e6390_ops,
 	},
 	[MV88E6390X] = {
@@ -6519,6 +6540,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.multi_chip = true,
 		.edsa_support = MV88E6XXX_EDSA_UNDOCUMENTED,
 		.ptp_support = true,
+		.num_tx_queues = 8,
 		.ops = &mv88e6390x_ops,
 	},
 
@@ -6546,6 +6568,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.pvt = true,
 		.multi_chip = true,
 		.ptp_support = true,
+		.num_tx_queues = 8,
 		.ops = &mv88e6393x_ops,
 	},
 };
drivers/net/dsa/mv88e6xxx/chip.h +3 -0
index e966e7c4cc5de..146723fbca658 100644
@@ -176,6 +176,9 @@ struct mv88e6xxx_info {
 	/* Supports PTP */
 	bool ptp_support;
 
+	/* Number of TX queues */
+	u8 num_tx_queues;
+
 	/* Internal PHY start index. 0 means that internal PHYs range starts at
 	 * port 0, 1 means internal PHYs range starts at port 1, etc
 	 */
Signature · 1 line
2.43.0
#5 lore raw

PATCH 3/6 net: dsa: mv88e6xxx: add MV88E6XXX_G1_ATU_CTL_MAC_AVB setter

In reply to Luke Howard

Add accessors for the MACAVB bit, which controls whether certain ATU bits cause the entry to be interpreted as AVB or NRL (non-rate-limiting) entries. This is necessary on switches such as the 88E6352 and 88E6240 that support both AVB and NRL ATU entries.

---
 drivers/net/dsa/mv88e6xxx/global1.h     |  2 ++
 drivers/net/dsa/mv88e6xxx/global1_atu.c | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
drivers/net/dsa/mv88e6xxx/global1.h +2 -0
index 3dbb7a1b8fe11..8204321502c1f 100644
@@ -111,6 +111,7 @@
 
 /* Offset 0x0A: ATU Control Register */
 #define MV88E6XXX_G1_ATU_CTL		0x0a
+#define MV88E6XXX_G1_ATU_CTL_MAC_AVB	0x8000
 #define MV88E6XXX_G1_ATU_CTL_LEARN2ALL	0x0008
 #define MV88E6161_G1_ATU_CTL_HASH_MASK	0x0003
 
@@ -322,6 +323,7 @@ int mv88e6390_g1_rmu_disable(struct mv88e6xxx_chip *chip);
 int mv88e6xxx_g1_set_device_number(struct mv88e6xxx_chip *chip, int index);
 
 int mv88e6xxx_g1_atu_set_learn2all(struct mv88e6xxx_chip *chip, bool learn2all);
+int mv88e6xxx_g1_atu_set_mac_avb(struct mv88e6xxx_chip *chip, bool mac_avb);
 int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
 				  unsigned int msecs);
 int mv88e6xxx_g1_atu_getnext(struct mv88e6xxx_chip *chip, u16 fid,
drivers/net/dsa/mv88e6xxx/global1_atu.c +17 -0
index c47f068f56b32..429a1ee44e47d 100644
@@ -41,6 +41,23 @@ int mv88e6xxx_g1_atu_set_learn2all(struct mv88e6xxx_chip *chip, bool learn2all)
 	return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_CTL, val);
 }
 
+int mv88e6xxx_g1_atu_set_mac_avb(struct mv88e6xxx_chip *chip, bool mac_avb)
+{
+	u16 val;
+	int err;
+
+	err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_CTL, &val);
+	if (err)
+		return err;
+
+	if (mac_avb)
+		val |= MV88E6XXX_G1_ATU_CTL_MAC_AVB;
+	else
+		val &= ~MV88E6XXX_G1_ATU_CTL_MAC_AVB;
+
+	return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_CTL, val);
+}
+
 int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
 				  unsigned int msecs)
 {
Signature · 1 line
2.43.0
#7 lore raw

PATCH 5/6 net: dsa: mv88e6xxx: CBS support

In reply to Luke Howard

Add support for the 802.1Qav Credit Based Shaper (CBS) to Marvell switches that support AVB. CBS policies can be configured per-port, but are subject to the global policy limitations imposed by the Marvell MQPRIO implementation.

Assisted-by Claude:claude-4.7-opus
---
 drivers/net/dsa/mv88e6xxx/avb.c  | 189 +++++++++++++++++++++++++------
 drivers/net/dsa/mv88e6xxx/avb.h  |  31 +++++
 drivers/net/dsa/mv88e6xxx/chip.c |  73 ++++++++++++
 drivers/net/dsa/mv88e6xxx/chip.h |  22 ++++
 drivers/net/dsa/mv88e6xxx/port.c |  45 ++++++++
 drivers/net/dsa/mv88e6xxx/port.h |  20 ++++
 6 files changed, 343 insertions(+), 37 deletions(-)
drivers/net/dsa/mv88e6xxx/avb.c +152 -37
index c535bf4fe3623..1a6365ff66378 100644
@@ -107,7 +107,67 @@ static int mv88e6xxx_tc_disable(struct mv88e6xxx_chip *chip)
 	return chip->info->ops->tc_ops->tc_disable(chip);
 }
 
-/* MQPRIO helpers */
+/* MQPRIO and CBS helpers */
+
+/* Ensure strict priority scheduling is enabled for CBS ports */
+static int mv88e6xxx_cbs_update_scheduler(struct mv88e6xxx_chip *chip, int port,
+					  bool has_cbs)
+{
+	const struct mv88e6xxx_ops *ops = chip->info->ops;
+	u8 mode;
+
+	if (!ops->port_set_scheduling_mode)
+		return 0;
+
+	mode = has_cbs ? chip->info->num_tx_queues - 1 : 0;
+
+	return ops->port_set_scheduling_mode(chip, port, mode);
+}
+
+/* Return true if any CBS queue has a non-zero rate configured on a port. */
+static bool mv88e6xxx_avb_port_has_cbs(struct mv88e6xxx_chip *chip, int port)
+{
+	int queue, err;
+	u16 rate;
+
+	for (queue = 0; queue < chip->info->num_tx_queues; queue++) {
+		err = mv88e6xxx_port_qav_read(chip, port,
+					      MV88E6XXX_PORT_QAV_CFG_RATE(queue),
+					      &rate, 1);
+		if (err)
+			continue;
+		else if (rate)
+			return true;
+	}
+
+	return false;
+}
+
+/* Enable/disable CBS and, if supported, strict priority, on a port */
+int mv88e6xxx_qav_set_port_cbs_qopt(struct mv88e6xxx_chip *chip, int port,
+				    const struct tc_cbs_qopt_offload *cbs_qopt)
+{
+	const struct mv88e6xxx_ops *ops = chip->info->ops;
+	const struct mv88e6xxx_tc_ops *tc_ops = ops->tc_ops;
+	bool old_active, new_active;
+	int err;
+
+	if (!tc_ops->set_port_cbs_qopt)
+		return -EOPNOTSUPP;
+
+	old_active = mv88e6xxx_avb_port_has_cbs(chip, port);
+
+	err = tc_ops->set_port_cbs_qopt(chip, port, cbs_qopt);
+	if (err)
+		return err;
+
+	new_active = cbs_qopt->enable ? true : mv88e6xxx_avb_port_has_cbs(chip, port);
+
+	if (old_active != new_active)
+		return mv88e6xxx_cbs_update_scheduler(chip, port, new_active);
+
+	return 0;
+}
 
 /* Set the AVB global policy limit registers
  *
@@ -197,19 +257,19 @@ static u16 mv88e6xxx_avb_get_cfg_avb_mode(struct mv88e6xxx_chip *chip)
 	return cfg;
 }
 
-/* Enable or disable a port for AVB
- *
- * @param chip		Marvell switch chip instance
- * @param port		Switch port
- * @param enable	If true, will enable AVB queues on this port.
- *
- * @return		0 on success, or a negative error value otherwise
- */
-static int mv88e6xxx_avb_set_port_avb_mode(struct mv88e6xxx_chip *chip,
-					   int port, bool enable)
+int mv88e6xxx_avb_set_port_avb_mode(struct mv88e6xxx_chip *chip,
+				    int port, bool enable)
 {
 	u16 cfg;
 
+	/* When disabling, only revert to legacy mode if no CBS queue
+	 * is still active on this port.
+	 */
+	if (!enable && mv88e6xxx_avb_port_has_cbs(chip, port)) {
+		dev_info(chip->dev, "p%d: CBS active, not disabling AVB\n", port);
+		return 0;
+	}
+
 	if (enable)
 		cfg = mv88e6xxx_avb_get_cfg_avb_mode(chip);
 	else
@@ -218,22 +278,6 @@ static int mv88e6xxx_avb_set_port_avb_mode(struct mv88e6xxx_chip *chip,
 	return mv88e6xxx_port_avb_write(chip, port, MV88E6XXX_PORT_AVB_CFG, cfg);
 }
 
-static int mv88e6xxx_avb_set_avb_mode(struct mv88e6xxx_chip *chip, bool enable)
-{
-	int port, err;
-
-	for (port = 0, err = 0; port < mv88e6xxx_num_ports(chip); ++port) {
-		if (!dsa_is_user_port(chip->ds, port))
-			continue;
-
-		err = mv88e6xxx_avb_set_port_avb_mode(chip, port, enable);
-		if (err)
-			break;
-	}
-
-	return err;
-}
-
 int mv88e6xxx_avb_tc_enable(struct mv88e6xxx_chip *chip,
 			    const struct mv88e6xxx_avb_tc_policy *policy)
 {
@@ -254,14 +298,8 @@ int mv88e6xxx_avb_tc_enable(struct mv88e6xxx_chip *chip,
 	if (err)
 		goto err_iso_ptr;
 
-	err = mv88e6xxx_avb_set_avb_mode(chip, true);
-	if (err)
-		goto err_tc;
-
 	return 0;
 
-err_tc:
-	mv88e6xxx_tc_disable(chip);
 err_iso_ptr:
 	mv88e6xxx_qav_set_iso_ptr(chip, 0);
 err_mac_avb:
@@ -273,11 +311,18 @@ int mv88e6xxx_avb_tc_enable(struct mv88e6xxx_chip *chip,
 
 int mv88e6xxx_avb_tc_disable(struct mv88e6xxx_chip *chip)
 {
-	int err;
+	int port, err;
 
-	err = mv88e6xxx_avb_set_avb_mode(chip, false);
-	if (err)
-		return err;
+	/* Revert all user ports to legacy mode irrespective of CBS setting */
+	for (port = 0; port < mv88e6xxx_num_ports(chip); port++) {
+		if (!dsa_is_user_port(chip->ds, port))
+			continue;
+		err = mv88e6xxx_port_avb_write(chip, port,
+					       MV88E6XXX_PORT_AVB_CFG,
+					       MV88E6XXX_PORT_AVB_CFG_AVB_MODE_LEGACY);
+		if (err)
+			return err;
+	}
 
 	err = mv88e6xxx_tc_disable(chip);
 	if (err)
@@ -297,6 +342,26 @@ int mv88e6xxx_avb_tc_disable(struct mv88e6xxx_chip *chip)
 	return 0;
 }
 
+static int mv88e6xxx_qav_set_port_config(struct mv88e6xxx_chip *chip, int port,
+					 int queue, u16 rate, u16 hilimit)
+{
+	int err;
+
+	err = mv88e6xxx_port_qav_write(chip, port,
+				       MV88E6XXX_PORT_QAV_CFG_RATE(queue),
+				       rate);
+	if (err)
+		return err;
+
+	err = mv88e6xxx_port_qav_write(chip, port,
+				       MV88E6XXX_PORT_QAV_CFG_HI_LIMIT(queue),
+				       hilimit);
+	if (err)
+		return err;
+
+	return 0;
+}
+
 /* Assign FPri to QPri mappings for each traffic class
  *
  * @param chip		Marvell switch chip instance
@@ -424,14 +489,63 @@ static int mv88e6352_tc_disable(struct mv88e6xxx_chip *chip)
 	return 0;
 }
 
+static int mv88e6xxx_set_port_cbs_qopt(struct mv88e6xxx_chip *chip, int port,
+				       const struct tc_cbs_qopt_offload *cbs_qopt)
+{
+	const struct mv88e6xxx_qav_info *qav = chip->info->qav;
+	u16 rate, hilimit;
+
+	if (!qav)
+		return -EOPNOTSUPP;
+
+	if (cbs_qopt->enable) {
+		rate = DIV_ROUND_UP(cbs_qopt->idleslope, qav->rate_unit);
+		rate = clamp_t(u16, rate, 1, qav->rate_mask);
+
+		hilimit = cbs_qopt->hicredit;
+		hilimit = clamp_t(u16, hilimit, 1, qav->hi_limit_mask);
+	} else {
+		rate = 0;
+		hilimit = qav->hi_limit_mask;
+	}
+
+	return mv88e6xxx_qav_set_port_config(chip, port, cbs_qopt->queue,
+					     rate, hilimit);
+}
+
 const struct mv88e6xxx_tc_ops mv88e6341_tc_ops = {
 	.tc_enable		= mv88e6352_tc_enable,
 	.tc_disable		= mv88e6352_tc_disable,
+	.set_port_cbs_qopt	= mv88e6xxx_set_port_cbs_qopt,
 };
 
+static int mv88e6352_set_port_cbs_qopt(struct mv88e6xxx_chip *chip, int port,
+				       const struct tc_cbs_qopt_offload *cbs_qopt)
+{
+	u16 cfg;
+	int err;
+
+	err = mv88e6xxx_set_port_cbs_qopt(chip, port, cbs_qopt);
+	if (err)
+		return err;
+
+	/* Set undocumented enable register */
+	err = mv88e6xxx_port_qav_read(chip, port, MV88E6352_PORT_QAV_CFG, &cfg, 1);
+	if (err)
+		return err;
+
+	if (cbs_qopt->enable)
+		cfg |= MV88E6352_PORT_QAV_CFG_ENABLE;
+	else
+		cfg &= ~MV88E6352_PORT_QAV_CFG_ENABLE;
+
+	return mv88e6xxx_port_qav_write(chip, port, MV88E6352_PORT_QAV_CFG, cfg);
+}
+
 const struct mv88e6xxx_tc_ops mv88e6352_tc_ops = {
 	.tc_enable		= mv88e6352_tc_enable,
 	.tc_disable		= mv88e6352_tc_disable,
+	.set_port_cbs_qopt	= mv88e6352_set_port_cbs_qopt,
 };
 
 static inline u16 mv88e6390_avb_pri_map_to_reg(const struct mv88e6xxx_avb_priority_map map[])
@@ -515,4 +629,5 @@ static int mv88e6390_tc_disable(struct mv88e6xxx_chip *chip)
 const struct mv88e6xxx_tc_ops mv88e6390_tc_ops = {
 	.tc_enable		= mv88e6390_tc_enable,
 	.tc_disable		= mv88e6390_tc_disable,
+	.set_port_cbs_qopt	= mv88e6xxx_set_port_cbs_qopt,
 };
drivers/net/dsa/mv88e6xxx/avb.h +31 -0
index 72d1c26a84731..5c21842bb68c4 100644
@@ -94,6 +94,9 @@
 #define MV88E6XXX_AVB_CFG_OUI_HI		0x0C
 #define MV88E6XXX_AVB_CFG_OUI_LO		0x0D
 
+#define MV88E6XXX_PORT_QAV_CFG_RATE(queue)	((((queue) & 0x7) << 1))
+#define MV88E6XXX_PORT_QAV_CFG_HI_LIMIT(queue)	((((queue) & 0x7) << 1) + 1)
+
 /* 6352 Family AVB Global Config (4 TX queues) */
 
 #define MV88E6352_AVB_CFG_AVB_HI_FPRI_GET(p)	MV88E6XXX_AVB_CFG_AVB_HI_FPRI_GET(p)
@@ -110,6 +113,9 @@
 #define MV88E6352_AVB_CFG_AVB_LO_QPRI_GET(p)	FIELD_GET(MV88E6352_AVB_CFG_AVB_LO_QPRI_MASK, p)
 #define MV88E6352_AVB_CFG_AVB_LO_QPRI_SET(p)	FIELD_PREP(MV88E6352_AVB_CFG_AVB_LO_QPRI_MASK, p)
 
+#define MV88E6352_PORT_QAV_CFG			0x08
+#define MV88E6352_PORT_QAV_CFG_ENABLE		0x8000
+
 /* 6390 Family AVB Global Config (8 TX queues) */
 
 #define MV88E6390_AVB_CFG_AVB_HI_FPRI_GET(p)	MV88E6XXX_AVB_CFG_AVB_HI_FPRI_GET(p)
@@ -176,6 +182,17 @@ extern const struct mv88e6xxx_tc_ops mv88e6341_tc_ops;
 extern const struct mv88e6xxx_tc_ops mv88e6352_tc_ops;
 extern const struct mv88e6xxx_tc_ops mv88e6390_tc_ops;
 
+/* Enable or disable a port for AVB. Caller must acquire register lock.
+ *
+ * @param chip		Marvell switch chip instance
+ * @param port		Switch port
+ * @param enable	If true, will enable AVB queues on this port.
+ *
+ * @return		0 on success, or a negative error value otherwise
+ */
+int mv88e6xxx_avb_set_port_avb_mode(struct mv88e6xxx_chip *chip,
+				    int port, bool enable);
+
 /* Set AVB queue priority policy. Caller must acquire register lock.
  *
  * @param chip		Marvell switch chip instance
@@ -194,4 +211,18 @@ int mv88e6xxx_avb_tc_enable(struct mv88e6xxx_chip *chip,
  */
 int mv88e6xxx_avb_tc_disable(struct mv88e6xxx_chip *chip);
 
+struct tc_cbs_qopt_offload;
+
+/* Set AVB credit based shaper policy. Caller must acquire register lock.
+ *
+ * @param chip		Marvell switch chip instance
+ * @param port		Switch port
+ * @param cbs_qopt	CBS policy to apply
+ *
+ * @return		0 on success, or a negative error value otherwise
+ */
+int mv88e6xxx_qav_set_port_cbs_qopt(struct mv88e6xxx_chip *chip,
+				    int port,
+				    const struct tc_cbs_qopt_offload *cbs_qopt);
+
 #endif /* _MV88E6XXX_AVB_H */
drivers/net/dsa/mv88e6xxx/chip.c +73 -0

217 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/chip.h +22 -0
index b6f4331affdc6..6c2f67e3378ef 100644
@@ -126,6 +126,7 @@ enum mv88e6xxx_edsa_support {
 };
 
 struct mv88e6xxx_ops;
+struct mv88e6xxx_qav_info;
 
 struct mv88e6xxx_info {
 	enum mv88e6xxx_family family;
@@ -180,6 +181,11 @@ struct mv88e6xxx_info {
 	/* Number of TX queues */
 	u8 num_tx_queues;
 
+	/* 802.1Qav credit-based shaping capability data, or NULL if the
+	 * chip does not support CBS offload.
+	 */
+	const struct mv88e6xxx_qav_info *qav;
+
 	/* Internal PHY start index. 0 means that internal PHYs range starts at
 	 * port 0, 1 means internal PHYs range starts at port 1, etc
 	 */
@@ -654,6 +660,13 @@ struct mv88e6xxx_ops {
 				   size_t size);
 
 	int (*port_egress_rate_limiting)(struct mv88e6xxx_chip *chip, int port);
+
+	/* Select egress scheduling mode: number of highest-numbered queues that
+	 * use strict priority instead of WRR/WFQ. Used to ensure CBS-shaped
+	 * queues take precedence over best-effort traffic.
+	 */
+	int (*port_set_scheduling_mode)(struct mv88e6xxx_chip *chip, int port,
+					u8 mode);
 	int (*port_pause_limit)(struct mv88e6xxx_chip *chip, int port, u8 in,
 				u8 out);
 	int (*port_disable_learn_limit)(struct mv88e6xxx_chip *chip, int port);
@@ -875,6 +888,15 @@ struct mv88e6xxx_tc_ops {
 	int (*tc_enable)(struct mv88e6xxx_chip *chip,
 			 const struct mv88e6xxx_avb_tc_policy *policy);
 	int (*tc_disable)(struct mv88e6xxx_chip *chip);
+	int (*set_port_cbs_qopt)(struct mv88e6xxx_chip *chip, int port,
+				 const struct tc_cbs_qopt_offload *cbs_qopt);
+};
+
+/* Per-family 802.1Qav credit-based shaping capability data. */
+struct mv88e6xxx_qav_info {
+	u16 rate_unit;		/* in kbps */
+	u16 rate_mask;		/* QPri Rate valid bits mask */
+	u16 hi_limit_mask;	/* QPri Hi Limit valid bits mask */
 };
 
 static inline bool mv88e6xxx_has_stu(struct mv88e6xxx_chip *chip)
drivers/net/dsa/mv88e6xxx/port.c +45 -0

51 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/port.h +20 -0
index 3ebd2ebafbf0f..8aaf3adb5e4d9 100644
@@ -241,6 +241,22 @@
 
 /* Offset 0x0A: Egress Rate Control 2 */
 #define MV88E6XXX_PORT_EGRESS_RATE_CTL2		0x0a
+/* Number of highest-numbered queues using strict priority instead of WRR.
+ * 0 = WRR for all queues, 3 = all queues strict priority.
+ */
+#define MV88E6352_PORT_EGRESS_RATE_CTL2_SCHEDULE_MASK	GENMASK(13, 12)
+
+/* Offset 0x1C: Port Queue Control (6390 family) */
+#define MV88E6390_PORT_QUEUE_CTL			0x1c
+#define MV88E6390_PORT_QUEUE_CTL_UPDATE			BIT(15)
+#define MV88E6390_PORT_QUEUE_CTL_PTR_MASK		GENMASK(14, 8)
+#define MV88E6390_PORT_QUEUE_CTL_DATA_MASK		GENMASK(7, 0)
+/* Pointers */
+#define MV88E6390_PORT_QUEUE_CTL_PTR_SCHEDULE		0x00
+/* Number of highest-numbered queues using strict priority instead of WFQ.
+ * 0 = WFQ for all queues, 7 = all queues strict priority.
+ */
+#define MV88E6390_PORT_QUEUE_CTL_SCHEDULE_MASK		GENMASK(2, 0)
 
 /* Offset 0x0B: Port Association Vector */
 #define MV88E6XXX_PORT_ASSOC_VECTOR			0x0b
@@ -563,6 +579,10 @@ int mv88e6165_port_set_jumbo_size(struct mv88e6xxx_chip *chip, int port,
 				  size_t size);
 int mv88e6095_port_egress_rate_limiting(struct mv88e6xxx_chip *chip, int port);
 int mv88e6097_port_egress_rate_limiting(struct mv88e6xxx_chip *chip, int port);
+int mv88e6352_port_set_scheduling_mode(struct mv88e6xxx_chip *chip, int port,
+				       u8 mode);
+int mv88e6390_port_set_scheduling_mode(struct mv88e6xxx_chip *chip, int port,
+				       u8 mode);
 int mv88e6xxx_port_set_assoc_vector(struct mv88e6xxx_chip *chip, int port,
 				    u16 pav);
 int mv88e6097_port_pause_limit(struct mv88e6xxx_chip *chip, int port, u8 in,
Signature · 1 line
2.43.0
#10 lore raw

PATCH 6/6 dt-bindings: net: dsa: mv88e6xxx: add mv88e6xxx-avb-mode property

In reply to Luke Howard

Add the vendor-specific marvell,mv88e6xxx-avb-mode property for adding stricter handling of frames with non-AVB frame priorities and destination addresses.

---
 .../bindings/net/dsa/marvell,mv88e6xxx.yaml   | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +26 -0
index 19ae600e93394..1a01810e7682c 100644
@@ -97,6 +97,32 @@ properties:
     required:
       - compatible
 
+  marvell,mv88e6xxx-avb-mode:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Marvell MV88E6xxx switches that support Audio Video Bridging /
+      Time-Sensitive Networking (AVB/TSN) traffic prioritization can have
+      ports configured in one of several modes. These modes control the
+      handling of frames with non-AVB frame priorities and destination
+      addresses.
+    oneOf:
+      - description:
+          Standard Mode. Frames whose priority is mapped to an AVB
+          traffic class (TC) are considered AVB frames; other frames are
+          considered legacy (non-AVB).
+        const: 0
+      - description:
+          Enhanced Mode. Frames whose priority is mapped to an AVB TC
+          and for which a static FDB or MDB entry exists are considered
+          AVB frames. Frames with an AVB TC but no matching FDB or MDB
+          entry are dropped. AVB MDB entries can be added using the
+          MDB_FLAGS_STREAM_RESERVED netlink flag.
+        const: 1
+      - description:
+          Secure Mode. As Enhanced Mode, but the matching FDB or MDB
+          entry must also have the source port's bit set.
+        const: 2
+
 allOf:
   - $ref: dsa.yaml#/$defs/ethernet-ports
 
Signature · 1 line
2.43.0
#6 lore raw

PATCH 4/6 net: dsa: mv88e6xxx: MQPRIO support

In reply to Luke Howard

Add support for MQPRIO TC for the Marvell 6352 and 6390 families of switches. Three traffic classes are supported: legacy (TC0), low (TC1) and high (TC2), corresponding to non-AVB, AVB Class B and Class A.

A single Ethernet frame priority can be mapped to either AVB class. "Legacy" (non-AVB) Ethernet frame priorities are distributed amongst the remaining queues, per the MQPRIO policy.

Owing to hardware limitations, queue and frame priority policy is per-switch, not per-port; HW offload can only be enabled across multiple ports if the policy on each enabled port is the same.

---
 drivers/net/dsa/mv88e6xxx/Makefile      |   3 +-
 drivers/net/dsa/mv88e6xxx/avb.c         | 518 ++++++++++++++++++++++++
 drivers/net/dsa/mv88e6xxx/avb.h         | 197 +++++++++
 drivers/net/dsa/mv88e6xxx/chip.c        | 276 ++++++++++++-
 drivers/net/dsa/mv88e6xxx/chip.h        |  76 ++++
 drivers/net/dsa/mv88e6xxx/global1.c     |   9 +-
 drivers/net/dsa/mv88e6xxx/global1.h     |  45 +-
 drivers/net/dsa/mv88e6xxx/global2.h     |  14 +-
 drivers/net/dsa/mv88e6xxx/global2_avb.c | 205 +++++++++-
 drivers/net/dsa/mv88e6xxx/port.c        |   9 +
 drivers/net/dsa/mv88e6xxx/port.h        |   2 +
 include/linux/platform_data/mv88e6xxx.h |   1 +
 12 files changed, 1336 insertions(+), 19 deletions(-)
 create mode 100644 drivers/net/dsa/mv88e6xxx/avb.c
 create mode 100644 drivers/net/dsa/mv88e6xxx/avb.h
drivers/net/dsa/mv88e6xxx/Makefile +2 -1
index b0b08c6f159c6..6123b431e255e 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o
-mv88e6xxx-objs := chip.o
+mv88e6xxx-objs := avb.o
+mv88e6xxx-objs += chip.o
 mv88e6xxx-objs += devlink.o
 mv88e6xxx-objs += global1.o
 mv88e6xxx-objs += global1_atu.o
drivers/net/dsa/mv88e6xxx/avb.c new file +518 -0

518 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/avb.h new file +197 -0

197 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/chip.c +271 -5

420 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/chip.h +76 -0

118 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/global1.c +7 -2
index 9820cd5967574..ce2c5cc3ea585 100644
@@ -356,16 +356,21 @@ int mv88e6085_g1_ip_pri_map(struct mv88e6xxx_chip *chip)
 
 /* Offset 0x18: IEEE-PRI Register */
 
+int mv88e6xxx_g1_set_ieee_pri_map(struct mv88e6xxx_chip *chip, u16 map)
+{
+	return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IEEE_PRI, map);
+}
+
 int mv88e6085_g1_ieee_pri_map(struct mv88e6xxx_chip *chip)
 {
 	/* Reset the IEEE Tag priorities to defaults */
-	return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IEEE_PRI, 0xfa41);
+	return mv88e6xxx_g1_set_ieee_pri_map(chip, 0xfa41);
 }
 
 int mv88e6250_g1_ieee_pri_map(struct mv88e6xxx_chip *chip)
 {
 	/* Reset the IEEE Tag priorities to defaults */
-	return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IEEE_PRI, 0xfa50);
+	return mv88e6xxx_g1_set_ieee_pri_map(chip, 0xfa50);
 }
 
 /* Offset 0x1a: Monitor Control */
drivers/net/dsa/mv88e6xxx/global1.h +44 -1

69 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/global2.h +8 -6
index ff5adf7c9bc3a..8645add6f7da0 100644
@@ -176,15 +176,17 @@
 #define MV88E6352_G2_AVB_CMD_PORT_TAIGLOBAL	0xe
 #define MV88E6165_G2_AVB_CMD_PORT_PTPGLOBAL	0xf
 #define MV88E6352_G2_AVB_CMD_PORT_PTPGLOBAL	0xf
+#define MV88E6352_G2_AVB_CMD_PORT_AVBGLOBAL	0xf
 #define MV88E6390_G2_AVB_CMD_PORT_MASK		0x1f00
 #define MV88E6390_G2_AVB_CMD_PORT_TAIGLOBAL	0x1e
 #define MV88E6390_G2_AVB_CMD_PORT_PTPGLOBAL	0x1f
-#define MV88E6352_G2_AVB_CMD_BLOCK_PTP		0
-#define MV88E6352_G2_AVB_CMD_BLOCK_AVB		1
-#define MV88E6352_G2_AVB_CMD_BLOCK_QAV		2
-#define MV88E6352_G2_AVB_CMD_BLOCK_QVB		3
-#define MV88E6352_G2_AVB_CMD_BLOCK_MASK		0x00e0
-#define MV88E6352_G2_AVB_CMD_ADDR_MASK		0x001f
+#define MV88E6390_G2_AVB_CMD_PORT_AVBGLOBAL	0x1f
+#define MV88E6XXX_G2_AVB_CMD_BLOCK_PTP		0
+#define MV88E6XXX_G2_AVB_CMD_BLOCK_AVB		1
+#define MV88E6XXX_G2_AVB_CMD_BLOCK_QAV		2
+#define MV88E6XXX_G2_AVB_CMD_BLOCK_QVB		3
+#define MV88E6XXX_G2_AVB_CMD_BLOCK_MASK		0x00e0
+#define MV88E6XXX_G2_AVB_CMD_ADDR_MASK		0x001f
 
 /* Offset 0x17: AVB Data Register */
 #define MV88E6352_G2_AVB_DATA		0x17
drivers/net/dsa/mv88e6xxx/global2_avb.c +201 -4

263 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/port.c +9 -0
index ea1fab71968a0..3a842c4d18105 100644
@@ -1606,6 +1606,15 @@ int mv88e6390_port_tag_remap(struct mv88e6xxx_chip *chip, int port)
 	return 0;
 }
 
+int mv88e6390_port_set_ieeepmt_ingress_pcp(struct mv88e6xxx_chip *chip, int port,
+					   u8 pcp, u8 fpri, u8 qpri)
+{
+	return mv88e6xxx_port_ieeepmt_write(chip, port,
+					    MV88E6390_PORT_IEEE_PRIO_MAP_TABLE_INGRESS_PCP,
+					    pcp,
+					    (fpri | qpri << 4));
+}
+
 /* Offset 0x0E: Policy Control Register */
 
 static int
drivers/net/dsa/mv88e6xxx/port.h +2 -0
index 5b6cde9f7406f..3ebd2ebafbf0f 100644
@@ -523,6 +523,8 @@ int mv88e6xxx_port_set_8021q_mode(struct mv88e6xxx_chip *chip, int port,
 				  u16 mode);
 int mv88e6095_port_tag_remap(struct mv88e6xxx_chip *chip, int port);
 int mv88e6390_port_tag_remap(struct mv88e6xxx_chip *chip, int port);
+int mv88e6390_port_set_ieeepmt_ingress_pcp(struct mv88e6xxx_chip *chip, int port,
+					   u8 pcp, u8 fpri, u8 qpri);
 int mv88e6xxx_port_set_egress_mode(struct mv88e6xxx_chip *chip, int port,
 				   enum mv88e6xxx_egress_mode mode);
 int mv88e6085_port_set_frame_mode(struct mv88e6xxx_chip *chip, int port,
include/linux/platform_data/mv88e6xxx.h +1 -0
index 21452a9365e1e..6366360fc15e1 100644
@@ -14,6 +14,7 @@ struct dsa_mv88e6xxx_pdata {
 	struct net_device *netdev;
 	u32 eeprom_len;
 	int irq;
+	int avb_mode;
 };
 
 #endif
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH net-next 1/6] net: bridge: mdb: add MDB_FLAGS_STREAM_RESERVED flag

In reply to Luke Howard
Quoted 15 lines · Luke Howard

Add a new MDB entry flag, MDB_FLAGS_STREAM_RESERVED, that userspace can set on RTM_NEWMDB to mark a multicast destination as belonging to a reserved stream (e.g. IEEE 802.1Q Stream Reservation Protocol / IEEE 1722 / TSN). The bridge core does no admission control on the basis of the flag; it is metadata propagated through switchdev to hardware drivers that can themselves enforce admission of AVB / SR priority traffic only to flagged destinations.

The flag is settable via the new nested attribute MDBE_ATTR_FLAGS (NLA_U32 bitmask, validated against MDB_FLAGS_SETTABLE_MASK), and is reflected in dump output via br_mdb_entry.flags as is done today for the OFFLOAD/BLOCKED/STAR_EXCL flags.

Assisted-by Claude:claude-4.7-opus
Quoted 8 lines
---
  include/net/switchdev.h        |  4 ++++
  include/uapi/linux/if_bridge.h |  2 ++
  net/bridge/br_mdb.c            | 12 ++++++++++++
  net/bridge/br_private.h        |  2 ++
  net/bridge/br_switchdev.c      | 17 +++++++++++------
  5 files changed, 31 insertions(+), 6 deletions(-)

We don't add hw-only functionality, if you'd like to have this flag you'll have to do a software implementation of this feature first. Also please check the slop(code) that Claude generates before sending it, there are obvious issues in this patch.

Cheers,
Nik

Quoted 180 lines
include/net/switchdev.h +4 -0
index ee500706496b0..03d176708b768 100644
@@ -111,10 +111,14 @@ struct switchdev_obj_port_vlan {
  	container_of((OBJ), struct switchdev_obj_port_vlan, obj)
 
  /* SWITCHDEV_OBJ_ID_PORT_MDB */
+
+#define SWITCHDEV_MDB_F_STREAM_RESERVED		BIT(0)
+
  struct switchdev_obj_port_mdb {
  	struct switchdev_obj obj;
  	unsigned char addr[ETH_ALEN];
  	u16 vid;
+	u32 flags;
  };
 
  #define SWITCHDEV_OBJ_PORT_MDB(OBJ) \
include/uapi/linux/if_bridge.h +2 -0
index 21a700c02ef76..51ec314994bec 100644
@@ -705,6 +705,7 @@ struct br_mdb_entry {
  #define MDB_FLAGS_STAR_EXCL		(1 << 2)
  #define MDB_FLAGS_BLOCKED		(1 << 3)
  #define MDB_FLAGS_OFFLOAD_FAILED	(1 << 4)
+#define MDB_FLAGS_STREAM_RESERVED	(1 << 5)
  	__u8 flags;
  	__u16 vid;
  	struct {
@@ -760,6 +761,7 @@ enum {
  	MDBE_ATTR_IFINDEX,
  	MDBE_ATTR_SRC_VNI,
  	MDBE_ATTR_STATE_MASK,
+	MDBE_ATTR_FLAGS,
  	__MDBE_ATTR_MAX,
  };
  #define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
net/bridge/br_mdb.c +12 -0
index e0c7020b12f5f..1320ccd81b0a1 100644
@@ -146,6 +146,8 @@ static void __mdb_entry_fill_flags(struct br_mdb_entry *e, unsigned char flags)
  		e->flags |= MDB_FLAGS_BLOCKED;
  	if (flags & MDB_PG_FLAGS_OFFLOAD_FAILED)
  		e->flags |= MDB_FLAGS_OFFLOAD_FAILED;
+	if (flags & MDB_PG_FLAGS_STREAM_RESERVED)
+		e->flags |= MDB_FLAGS_STREAM_RESERVED;
  }
 
  static void __mdb_entry_to_br_ip(struct br_mdb_entry *entry, struct br_ip *ip,
@@ -664,6 +666,7 @@ static const struct nla_policy br_mdbe_attrs_pol[MDBE_ATTR_MAX + 1] = {
  						  MCAST_INCLUDE),
  	[MDBE_ATTR_SRC_LIST] = NLA_POLICY_NESTED(br_mdbe_src_list_pol),
  	[MDBE_ATTR_RTPROT] = NLA_POLICY_MIN(NLA_U8, RTPROT_STATIC),
+	[MDBE_ATTR_FLAGS] = NLA_POLICY_MASK(NLA_U32, MDB_FLAGS_STREAM_RESERVED),
  };
 
  static bool is_valid_mdb_source(struct nlattr *attr, __be16 proto,
@@ -1072,6 +1075,8 @@ static int br_mdb_add_group(const struct br_mdb_config *cfg,
  	if (entry->state == MDB_PERMANENT)
  		flags |= MDB_PG_FLAGS_PERMANENT;
 
+	flags |= cfg->pg_flags;
+
  	if (br_multicast_is_star_g(&group))
  		return br_mdb_add_group_star_g(cfg, mp, brmctx, flags, extack);
  	else
@@ -1225,6 +1230,13 @@ static int br_mdb_config_attrs_init(struct nlattr *set_attrs,
  		cfg->rt_protocol = nla_get_u8(mdb_attrs[MDBE_ATTR_RTPROT]);
  	}
 
+	if (mdb_attrs[MDBE_ATTR_FLAGS]) {
+		u32 user_flags = nla_get_u32(mdb_attrs[MDBE_ATTR_FLAGS]);
+
+		if (user_flags & MDB_FLAGS_STREAM_RESERVED)
+			cfg->pg_flags |= MDB_PG_FLAGS_STREAM_RESERVED;
+	}
+
  	return 0;
  }
 
net/bridge/br_private.h +2 -0
index 02671e648dac7..b9ee19448e38b 100644
@@ -111,6 +111,7 @@ struct br_mdb_config {
  	struct br_mdb_src_entry		*src_entries;
  	int				num_src_entries;
  	u8				rt_protocol;
+	unsigned char			pg_flags;
  };
  #endif
 
@@ -317,6 +318,7 @@ struct net_bridge_fdb_flush_desc {
  #define MDB_PG_FLAGS_STAR_EXCL		BIT(3)
  #define MDB_PG_FLAGS_BLOCKED		BIT(4)
  #define MDB_PG_FLAGS_OFFLOAD_FAILED	BIT(5)
+#define MDB_PG_FLAGS_STREAM_RESERVED	BIT(6)
 
  #define PG_SRC_ENT_LIMIT	32
 
net/bridge/br_switchdev.c +11 -6
index 18b558a931ad9..bc05cda2f5350 100644
@@ -548,7 +548,8 @@ static void br_switchdev_mdb_complete(struct net_device *dev, int err, void *pri
  }
 
  static void br_switchdev_mdb_populate(struct switchdev_obj_port_mdb *mdb,
-				      const struct net_bridge_mdb_entry *mp)
+				      const struct net_bridge_mdb_entry *mp,
+				      const struct net_bridge_port_group *pg)
  {
  	if (mp->addr.proto == htons(ETH_P_IP))
  		ip_eth_mc_map(mp->addr.dst.ip4, mdb->addr);
@@ -560,6 +561,9 @@ static void br_switchdev_mdb_populate(struct switchdev_obj_port_mdb *mdb,
  		ether_addr_copy(mdb->addr, mp->addr.dst.mac_addr);
 
  	mdb->vid = mp->addr.vid;
+	mdb->flags = 0;
+	if (pg && (pg->flags & MDB_PG_FLAGS_STREAM_RESERVED))
+		mdb->flags |= SWITCHDEV_MDB_F_STREAM_RESERVED;
  }
 
  static void br_switchdev_host_mdb_one(struct net_device *dev,
@@ -575,7 +579,7 @@ static void br_switchdev_host_mdb_one(struct net_device *dev,
  		},
  	};
 
-	br_switchdev_mdb_populate(&mdb, mp);
+	br_switchdev_mdb_populate(&mdb, mp, NULL);
 
  	switch (type) {
  	case RTM_NEWMDB:
@@ -622,6 +626,7 @@ static int br_switchdev_mdb_queue_one(struct list_head *mdb_list,
  				      unsigned long action,
  				      enum switchdev_obj_id id,
  				      const struct net_bridge_mdb_entry *mp,
+				      const struct net_bridge_port_group *pg,
  				      struct net_device *orig_dev)
  {
  	struct switchdev_obj_port_mdb mdb = {
@@ -632,7 +637,7 @@ static int br_switchdev_mdb_queue_one(struct list_head *mdb_list,
  	};
  	struct switchdev_obj_port_mdb *pmdb;
 
-	br_switchdev_mdb_populate(&mdb, mp);
+	br_switchdev_mdb_populate(&mdb, mp, pg);
 
  	if (action == SWITCHDEV_PORT_OBJ_ADD &&
  	    switchdev_port_obj_act_is_deferred(dev, action, &mdb.obj)) {
@@ -671,7 +676,7 @@ void br_switchdev_mdb_notify(struct net_device *dev,
  	if (!pg)
  		return br_switchdev_host_mdb(dev, mp, type);
 
-	br_switchdev_mdb_populate(&mdb, mp);
+	br_switchdev_mdb_populate(&mdb, mp, pg);
 
  	mdb.obj.orig_dev = pg->key.port->dev;
  	switch (type) {
@@ -740,7 +745,7 @@ br_switchdev_mdb_replay(struct net_device *br_dev, struct net_device *dev,
  		if (mp->host_joined) {
  			err = br_switchdev_mdb_queue_one(&mdb_list, dev, action,
  							 SWITCHDEV_OBJ_ID_HOST_MDB,
-							 mp, br_dev);
+							 mp, NULL, br_dev);
  			if (err) {
  				spin_unlock_bh(&br->multicast_lock);
  				goto out_free_mdb;
@@ -754,7 +759,7 @@ br_switchdev_mdb_replay(struct net_device *br_dev, struct net_device *dev,
 
  			err = br_switchdev_mdb_queue_one(&mdb_list, dev, action,
  							 SWITCHDEV_OBJ_ID_PORT_MDB,
-							 mp, dev);
+							 mp, p, dev);
  			if (err) {
  				spin_unlock_bh(&br->multicast_lock);
  				goto out_free_mdb;
#3 lore raw

Re: [PATCH net-next 1/6] net: bridge: mdb: add MDB_FLAGS_STREAM_RESERVED flag

Hi Nik,

Quoted 4 lines

We don't add hw-only functionality, if you'd like to have this flag you'll have to do a software implementation of this feature first. Also please check the slop(code) that Claude generates before sending it, there are obvious issues in this patch.

Noted, will review. I do have a software bridge implementation which I shall include in the next revision if it progresses. I didn’t include it as it still needs configuration knobs to associate one or more traffic classes (or priorities) with this flag.

Cheers,
Luke

#8 lore raw

Re: [PATCH net-next 5/6] net: dsa: mv88e6xxx: CBS support

In reply to Luke Howard
Quoted 16 lines
drivers/net/dsa/mv88e6xxx/chip.c +16 -0
+static int mv88e6xxx_qos_port_cbs_set(struct dsa_switch *ds, int port,
+                                     struct tc_cbs_qopt_offload *cbs_qopt)
+{
+       struct mv88e6xxx_chip *chip = ds->priv;
+       int err;
+
+       if (!dsa_is_user_port(ds, port))
+               return -EINVAL;
+
+       if (cbs_qopt->queue >= chip->info->num_tx_queues) {
+               dev_err(ds->dev, "p%d: invalid AVB queue %d\n", port, cbs_qopt->queue);
+               return -EINVAL;
+       }
+
+       mutex_lock(&chip->reg_lock);
+

drivers/net/dsa/mv88e6xxx/chip.c static int mv88e6xxx_qos_port_mqprio(struct dsa_switch *ds, int port, · line 7106

Quoted 10 lines
drivers/net/dsa/mv88e6xxx/chip.c +10 -0
+       if (cbs_qopt->enable &&
+           !(chip->avb_tc_policy.port_mask & BIT(port))) {
+               err = -EOPNOTSUPP;
+               goto out;
+       }
+
+       err = mv88e6xxx_qav_set_port_cbs_qopt(chip, port, cbs_qopt);
+       if (!err)
+               err = mv88e6xxx_avb_set_port_avb_mode(chip, port, cbs_qopt->enable);
+

Why is the avb_mode set from the cbs setter?
avb_mode is an ingress setting that controls if frames are classified as AVB frames. Cbs configures shaping on egress.
Eg. if an AVB stream is received on port 1 and is forwarded by the switch to port 2. AvbMode needs to be set on port 1 and cbs is configured on port 2.

#9 lore raw

Re: [PATCH net-next 5/6] net: dsa: mv88e6xxx: CBS support

Quoted 6 lines

Why is the avb_mode set from the cbs setter?
avb_mode is an ingress setting that controls if frames are classified as AVB frames. Cbs configures shaping on egress.
Eg. if an AVB stream is received on port 1 and is forwarded by the switch to port 2. AvbMode needs to be set on port 1 and cbs is configured on port 2.

Sounds like a bug which might explain why enhanced/secure mode didn’t work when I last tested it :)

I think it might make sense to have CBS just configure the shaper/strict priority (i.e. as your patch does), and then only enable AVB mode if the shaper TC has a MQPRIO parent (retaining the mapping of TCs to AVB classes).

#11 lore raw

Re: [PATCH net-next 6/6] dt-bindings: net: dsa: mv88e6xxx: add mv88e6xxx-avb-mode property

In reply to Luke Howard
Quoted 14 lines · Luke Howard

Add the vendor-specific marvell,mv88e6xxx-avb-mode property for adding stricter handling of frames with non-AVB frame priorities and destination addresses.

---
 .../bindings/net/dsa/marvell,mv88e6xxx.yaml   | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +0 -0
index 19ae600e93394..1a01810e7682c 100644

Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml properties: · line 100

Quoted 4 lines
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +1 -0
@@ -97,6 +97,32 @@ properties:
     required:
       - compatible
 
+  marvell,mv88e6xxx-avb-mode:

"marvell,avb-mode" should be sufficient here.

Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml properties: · line 107

Quoted 7 lines
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +7 -0
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Marvell MV88E6xxx switches that support Audio Video Bridging /
+      Time-Sensitive Networking (AVB/TSN) traffic prioritization can have
+      ports configured in one of several modes. These modes control the
+      handling of frames with non-AVB frame priorities and destination
+      addresses.

I've got no idea if this is a valid thing to make a property for, but I really don't like this things being integers when there's some pretty clear strings you could use instead: standard, enhanced and secure.

Also, you're missing a default, which is required for optional properties.

Cheers,
Conor.

pw-bot: changes-requested

Quoted 25 lines
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +18 -0
+    oneOf:
+      - description:
+          Standard Mode. Frames whose priority is mapped to an AVB
+          traffic class (TC) are considered AVB frames; other frames are
+          considered legacy (non-AVB).
+        const: 0
+      - description:
+          Enhanced Mode. Frames whose priority is mapped to an AVB TC
+          and for which a static FDB or MDB entry exists are considered
+          AVB frames. Frames with an AVB TC but no matching FDB or MDB
+          entry are dropped. AVB MDB entries can be added using the
+          MDB_FLAGS_STREAM_RESERVED netlink flag.
+        const: 1
+      - description:
+          Secure Mode. As Enhanced Mode, but the matching FDB or MDB
+          entry must also have the source port's bit set.
+        const: 2
+
 allOf:
   - $ref: dsa.yaml#/$defs/ethernet-ports
 
Signature · 1 line
2.43.0
#12 lore raw

Re: [PATCH net-next 6/6] dt-bindings: net: dsa: mv88e6xxx: add mv88e6xxx-avb-mode property

In reply to Luke Howard
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Medium] Encoding runtime network configuration (traffic policy) in the Device Tree. - [Low] Schema…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Encoding runtime network configuration (traffic policy) in the Device Tree.
- [Low] Schema validation fails for all valid inputs due to an array/integer type mismatch.
- [Low] The Device Tree binding description violates OS-agnostic rules by referencing Linux-specific netlink flags. --

commit aae733d9f490b168e212410379f1d8278d34ee3c
Author: Luke Howard <[email protected]>

dt-bindings: net: dsa: mv88e6xxx: add mv88e6xxx-avb-mode property

This commit adds a vendor-specific marvell,mv88e6xxx-avb-mode property to the Marvell MV88E6xxx DSA switch binding. The property configures the handling of frames with non-AVB priorities and destination addresses into Standard, Enhanced, or Secure modes.

Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml properties: · line 101

Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +2 -0
index 19ae600e93394..1a01810e7682c 100644
@@ -97,6 +97,32 @@ properties:
     required:
       - compatible
 
+  marvell,mv88e6xxx-avb-mode:
+    $ref: /schemas/types.yaml#/definitions/uint32

[Severity: Medium]
Does adding this property encode dynamic network configuration policy into the Device Tree?

Device trees are typically meant for static hardware description. Setting how AVB frames are handled and whether frames are dropped appears to be a runtime traffic policy.

Shouldn't this be managed via standard Linux networking UAPIs like devlink, bridge attributes, or tc, rather than being hardcoded in the DT?

Quoted 8 lines
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +8 -0
+    description:
+      Marvell MV88E6xxx switches that support Audio Video Bridging /
+      Time-Sensitive Networking (AVB/TSN) traffic prioritization can have
+      ports configured in one of several modes. These modes control the
+      handling of frames with non-AVB frame priorities and destination
+      addresses.
+    oneOf:
+      - description:

Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml properties: · line 119

Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +10 -0
+          Standard Mode. Frames whose priority is mapped to an AVB
+          traffic class (TC) are considered AVB frames; other frames are
+          considered legacy (non-AVB).
+        const: 0
+      - description:
+          Enhanced Mode. Frames whose priority is mapped to an AVB TC
+          and for which a static FDB or MDB entry exists are considered
+          AVB frames. Frames with an AVB TC but no matching FDB or MDB
+          entry are dropped. AVB MDB entries can be added using the
+          MDB_FLAGS_STREAM_RESERVED netlink flag.

[Severity: Low]
Does referencing MDB_FLAGS_STREAM_RESERVED violate the OS-agnostic rules for Device Tree bindings?

This leaks Linux-specific netlink implementation details directly into the hardware specification.

Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml properties: · line 120

Quoted 1 line
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +1 -0
+        const: 1

[Severity: Low]
Will this schema fail validation for all valid inputs due to an array and integer type mismatch?

The uint32 reference above expects the property to be parsed as a single-element array, but this applies a const constraint for an integer. In JSON schema, an array does not match an integer.

Should this use enum: [0, 1, 2] instead, or place the const inside an items array so it passes the binding checks?

Quoted 4 lines
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml +4 -0
+      - description:
+          Secure Mode. As Enhanced Mode, but the matching FDB or MDB
+          entry must also have the source port's bit set.
+        const: 2
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
#13 lore raw

Re: [PATCH net-next 6/6] dt-bindings: net: dsa: mv88e6xxx: add mv88e6xxx-avb-mode property

Quoted 8 lines · On 30 May 2026, at 10:49 am, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Encoding runtime network configuration (traffic policy) in the Device Tree.
- [Low] Schema validation fails for all valid inputs due to an array/integer type mismatch.
- [Low] The Device Tree binding description violates OS-agnostic rules by referencing Linux-specific netlink flags.

Thank you for the comments. This commit will be removed in the next revision, in favour of configuring the device using devlink.