* [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
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
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-11 20:42 ` Jakub Kicinski
0 siblings, 2 replies; 10+ messages in thread
From: Nikolay Aleksandrov @ 2026-06-10 12:30 UTC (permalink / raw)
To: Yafang Shao, jv, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: netdev, Tonghao Zhang
On 10/06/2026 15:08, Yafang Shao wrote:
> 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,
> };
>
Then update your iproute2 package, sysfs use for options is discouraged
and is not being extended on purpose. Move to netlink.
Cheers,
Nik
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
2026-06-10 12:30 ` Nikolay Aleksandrov
@ 2026-06-10 12:39 ` Yafang Shao
2026-06-10 12:45 ` Nikolay Aleksandrov
2026-06-11 20:42 ` Jakub Kicinski
1 sibling, 1 reply; 10+ messages in thread
From: Yafang Shao @ 2026-06-10 12:39 UTC (permalink / raw)
To: Nikolay Aleksandrov
Cc: jv, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Tonghao Zhang
On Wed, Jun 10, 2026 at 8:30 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>
> On 10/06/2026 15:08, Yafang Shao wrote:
> > 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,
> > };
> >
>
> Then update your iproute2 package, sysfs use for options is discouraged
Could you please explain in detail why this is discouraged?
> and is not being extended on purpose. Move to netlink.
--
Regards
Yafang
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
2026-06-10 12:39 ` Yafang Shao
@ 2026-06-10 12:45 ` Nikolay Aleksandrov
2026-06-10 12:49 ` Yafang Shao
2026-06-10 12:52 ` Nikolay Aleksandrov
0 siblings, 2 replies; 10+ messages in thread
From: Nikolay Aleksandrov @ 2026-06-10 12:45 UTC (permalink / raw)
To: Yafang Shao
Cc: jv, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Tonghao Zhang
On 10/06/2026 15:39, Yafang Shao wrote:
> On Wed, Jun 10, 2026 at 8:30 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>>
>> On 10/06/2026 15:08, Yafang Shao wrote:
>>> 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,
>>> };
>>>
>>
>> Then update your iproute2 package, sysfs use for options is discouraged
>
> Could you please explain in detail why this is discouraged?
>
>> and is not being extended on purpose. Move to netlink.
>
Networking has been moving to netlink-only options for awhile now. Check for
example:
1e16f382ae0b ("net: bridge: add warning comments to avoid extending sysfs")
The preferred way to configure device types is via iproute2/netlink.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
2026-06-10 12:45 ` Nikolay Aleksandrov
@ 2026-06-10 12:49 ` Yafang Shao
2026-06-10 13:00 ` Nikolay Aleksandrov
2026-06-10 12:52 ` Nikolay Aleksandrov
1 sibling, 1 reply; 10+ messages in thread
From: Yafang Shao @ 2026-06-10 12:49 UTC (permalink / raw)
To: Nikolay Aleksandrov
Cc: jv, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Tonghao Zhang
On Wed, Jun 10, 2026 at 8:45 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>
> On 10/06/2026 15:39, Yafang Shao wrote:
> > On Wed, Jun 10, 2026 at 8:30 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
> >>
> >> On 10/06/2026 15:08, Yafang Shao wrote:
> >>> 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,
> >>> };
> >>>
> >>
> >> Then update your iproute2 package, sysfs use for options is discouraged
> >
> > Could you please explain in detail why this is discouraged?
> >
> >> and is not being extended on purpose. Move to netlink.
> >
>
> Networking has been moving to netlink-only options for awhile now. Check for
> example:
> 1e16f382ae0b ("net: bridge: add warning comments to avoid extending sysfs")
>
> The preferred way to configure device types is via iproute2/netlink.
Thanks for your explanation, but I still don't understand the benefit
of it. Could you elaborate further?
--
Regards
Yafang
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
2026-06-10 12:45 ` Nikolay Aleksandrov
2026-06-10 12:49 ` Yafang Shao
@ 2026-06-10 12:52 ` Nikolay Aleksandrov
2026-06-10 12:56 ` Yafang Shao
1 sibling, 1 reply; 10+ messages in thread
From: Nikolay Aleksandrov @ 2026-06-10 12:52 UTC (permalink / raw)
To: Yafang Shao
Cc: jv, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Tonghao Zhang
On 10/06/2026 15:45, Nikolay Aleksandrov wrote:
> On 10/06/2026 15:39, Yafang Shao wrote:
>> On Wed, Jun 10, 2026 at 8:30 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>>>
>>> On 10/06/2026 15:08, Yafang Shao wrote:
>>>> 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,
>>>> };
>>>>
>>>
>>> Then update your iproute2 package, sysfs use for options is discouraged
>>
>> Could you please explain in detail why this is discouraged?
>>
>>> and is not being extended on purpose. Move to netlink.
>>
>
> Networking has been moving to netlink-only options for awhile now. Check for
> example:
> 1e16f382ae0b ("net: bridge: add warning comments to avoid extending sysfs")
>
> The preferred way to configure device types is via iproute2/netlink.
>
>
The author of this option also had sysfs initially in his patch-set and
then removed it, here's my comment at that time:
https://lore.kernel.org/all/d0e0379e-79fb-4a95-b160-6c1ca4276081@blackwall.org/
and also Jay's confirmation that sysfs shouldn't be extended:
https://lore.kernel.org/all/1319073.1747143053@vermin/
Cheers,
Nik
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
2026-06-10 12:52 ` Nikolay Aleksandrov
@ 2026-06-10 12:56 ` Yafang Shao
0 siblings, 0 replies; 10+ messages in thread
From: Yafang Shao @ 2026-06-10 12:56 UTC (permalink / raw)
To: Nikolay Aleksandrov
Cc: jv, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Tonghao Zhang
On Wed, Jun 10, 2026 at 8:52 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>
> On 10/06/2026 15:45, Nikolay Aleksandrov wrote:
> > On 10/06/2026 15:39, Yafang Shao wrote:
> >> On Wed, Jun 10, 2026 at 8:30 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
> >>>
> >>> On 10/06/2026 15:08, Yafang Shao wrote:
> >>>> 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,
> >>>> };
> >>>>
> >>>
> >>> Then update your iproute2 package, sysfs use for options is discouraged
> >>
> >> Could you please explain in detail why this is discouraged?
> >>
> >>> and is not being extended on purpose. Move to netlink.
> >>
> >
> > Networking has been moving to netlink-only options for awhile now. Check for
> > example:
> > 1e16f382ae0b ("net: bridge: add warning comments to avoid extending sysfs")
> >
> > The preferred way to configure device types is via iproute2/netlink.
> >
> >
>
> The author of this option also had sysfs initially in his patch-set and
> then removed it, here's my comment at that time:
> https://lore.kernel.org/all/d0e0379e-79fb-4a95-b160-6c1ca4276081@blackwall.org/
>
> and also Jay's confirmation that sysfs shouldn't be extended:
> https://lore.kernel.org/all/1319073.1747143053@vermin/
Understood. So we'll have to keep this patch in our local kernel.
The production environment is complex enough as it is... ;-)
--
Regards
Yafang
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
2026-06-10 12:49 ` Yafang Shao
@ 2026-06-10 13:00 ` Nikolay Aleksandrov
2026-06-10 13:09 ` Yafang Shao
0 siblings, 1 reply; 10+ messages in thread
From: Nikolay Aleksandrov @ 2026-06-10 13:00 UTC (permalink / raw)
To: Yafang Shao
Cc: jv, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Tonghao Zhang
On 10/06/2026 15:49, Yafang Shao wrote:
> On Wed, Jun 10, 2026 at 8:45 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>>
>> On 10/06/2026 15:39, Yafang Shao wrote:
>>> On Wed, Jun 10, 2026 at 8:30 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>>>>
>>>> On 10/06/2026 15:08, Yafang Shao wrote:
>>>>> 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,
>>>>> };
>>>>>
>>>>
>>>> Then update your iproute2 package, sysfs use for options is discouraged
>>>
>>> Could you please explain in detail why this is discouraged?
>>>
>>>> and is not being extended on purpose. Move to netlink.
>>>
>>
>> Networking has been moving to netlink-only options for awhile now. Check for
>> example:
>> 1e16f382ae0b ("net: bridge: add warning comments to avoid extending sysfs")
>>
>> The preferred way to configure device types is via iproute2/netlink.
>
> Thanks for your explanation, but I still don't understand the benefit
> of it. Could you elaborate further?
>
The benefits of netlink over sysfs?? There are so many.. it will help if you
look into how netlink vs sysfs operate. Netlink is structured, transactional,
typed, easily extendable, you can dump, do specific queries, it is less calls
and it supports notifications. I'm sure I'm missing, but in a nutshell it's
preferred. :)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
2026-06-10 13:00 ` Nikolay Aleksandrov
@ 2026-06-10 13:09 ` Yafang Shao
0 siblings, 0 replies; 10+ messages in thread
From: Yafang Shao @ 2026-06-10 13:09 UTC (permalink / raw)
To: Nikolay Aleksandrov
Cc: jv, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Tonghao Zhang
On Wed, Jun 10, 2026 at 9:00 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>
> On 10/06/2026 15:49, Yafang Shao wrote:
> > On Wed, Jun 10, 2026 at 8:45 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
> >>
> >> On 10/06/2026 15:39, Yafang Shao wrote:
> >>> On Wed, Jun 10, 2026 at 8:30 PM Nikolay Aleksandrov <razor@blackwall.org> wrote:
> >>>>
> >>>> On 10/06/2026 15:08, Yafang Shao wrote:
> >>>>> 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,
> >>>>> };
> >>>>>
> >>>>
> >>>> Then update your iproute2 package, sysfs use for options is discouraged
> >>>
> >>> Could you please explain in detail why this is discouraged?
> >>>
> >>>> and is not being extended on purpose. Move to netlink.
> >>>
> >>
> >> Networking has been moving to netlink-only options for awhile now. Check for
> >> example:
> >> 1e16f382ae0b ("net: bridge: add warning comments to avoid extending sysfs")
> >>
> >> The preferred way to configure device types is via iproute2/netlink.
> >
> > Thanks for your explanation, but I still don't understand the benefit
> > of it. Could you elaborate further?
> >
>
> The benefits of netlink over sysfs?? There are so many.. it will help if you
> look into how netlink vs sysfs operate. Netlink is structured, transactional,
> typed, easily extendable, you can dump, do specific queries, it is less calls
> and it supports notifications. I'm sure I'm missing, but in a nutshell it's
> preferred. :)
Thank you for the explanation. Requesting package upgrades on
production servers is often challenging, particularly when additional
library updates are required. Consequently, sysadmins prefer utilizing
native shell commands, such as echo, to avoid these dependencies;-)
Honestly, if a feature needs userspace tools to be upgraded, it will
take years to see it in production... ;-)
--
Regards
Yafang
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] bonding: add sysfs interface for broadcast_neighbor
2026-06-10 12:30 ` Nikolay Aleksandrov
2026-06-10 12:39 ` Yafang Shao
@ 2026-06-11 20:42 ` Jakub Kicinski
1 sibling, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2026-06-11 20:42 UTC (permalink / raw)
To: Nikolay Aleksandrov
Cc: Yafang Shao, jv, andrew+netdev, davem, edumazet, pabeni, netdev,
Tonghao Zhang
On Wed, 10 Jun 2026 15:30:11 +0300 Nikolay Aleksandrov wrote:
> Then update your iproute2 package, sysfs use for options is discouraged
> and is not being extended on purpose. Move to netlink.
FWIW -- ynl also supports rtnl and bonding options, so even less of a
reason for sysfs these days.
^ permalink raw reply [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.