All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
@ 2026-06-10 12:08 Yafang Shao
  2026-06-10 12:30 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 10+ messages in thread
From: Yafang Shao @ 2026-06-10 12:08 UTC (permalink / raw)
  To: jv, andrew+netdev, davem, edumazet, kuba, pabeni
  Cc: netdev, Yafang Shao, Tonghao Zhang

The upstream kernel has supported broadcast_neighbor for 802.3ad mode since
commit ce7a381697cb ("net: bonding: add broadcast_neighbor option for 802.3ad").
When upgrading from our local kernel to 6.18.y stable, we switched from our
out-of-tree implementation to the upstream one.

However, the iproute2 package on our production servers is too old to
support the broadcast_neighbor option. To enable this feature, add a new
sysfs attribute at:

  /sys/class/net/<bond>/bonding/broadcast_neighbor

This allows enabling the feature by writing "1" to the sysfs file, matching
the interface we previously maintained in our local kernel.

The result is as follows,

- For 802.3ad mode

  $ ip link add bond0 type bond mode 802.3ad
  $ cat /sys/class/net/bond0/bonding/broadcast_neighbor
  0
  $ echo 1 > /sys/class/net/bond0/bonding/broadcast_neighbor
  $ cat /sys/class/net/bond0/bonding/broadcast_neighbor
  1

- For other modes

  $ ip link add bond1 type bond
  $ cat /sys/class/net/bond1/bonding/broadcast_neighbor
  0
  $ echo 1 > /sys/class/net/bond1/bonding/broadcast_neighbor
  bash: echo: write error: Permission denied

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Tonghao Zhang <tonghao@bamaicloud.com>
---
 drivers/net/bonding/bond_sysfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index eaba44c76a5e..24eb23634d98 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -750,6 +750,17 @@ static ssize_t bonding_show_ad_user_port_key(struct device *d,
 static DEVICE_ATTR(ad_user_port_key, 0644,
 		   bonding_show_ad_user_port_key, bonding_sysfs_store_option);
 
+static ssize_t bonding_show_broadcast_neighbor(struct device *d,
+					       struct device_attribute *attr,
+					       char *buf)
+{
+	struct bonding *bond = to_bond(d);
+
+	return sysfs_emit(buf, "%d\n", bond->params.broadcast_neighbor);
+}
+static DEVICE_ATTR(broadcast_neighbor, 0644,
+		   bonding_show_broadcast_neighbor, bonding_sysfs_store_option);
+
 static struct attribute *per_bond_attrs[] = {
 	&dev_attr_slaves.attr,
 	&dev_attr_mode.attr,
@@ -789,6 +800,7 @@ static struct attribute *per_bond_attrs[] = {
 	&dev_attr_ad_actor_system.attr,
 	&dev_attr_ad_user_port_key.attr,
 	&dev_attr_arp_missed_max.attr,
+	&dev_attr_broadcast_neighbor.attr,
 	NULL,
 };
 
-- 
2.52.0


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

end of thread, other threads:[~2026-06-11 20:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10 12:08 [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor Yafang Shao
2026-06-10 12:30 ` Nikolay Aleksandrov
2026-06-10 12:39   ` Yafang Shao
2026-06-10 12:45     ` Nikolay Aleksandrov
2026-06-10 12:49       ` Yafang Shao
2026-06-10 13:00         ` Nikolay Aleksandrov
2026-06-10 13:09           ` Yafang Shao
2026-06-10 12:52       ` Nikolay Aleksandrov
2026-06-10 12:56         ` Yafang Shao
2026-06-11 20:42   ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.