public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] bonding: print churn state via netlink
@ 2026-02-24  2:02 Hangbin Liu
  2026-02-24  2:02 ` [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state Hangbin Liu
  2026-02-26 11:00 ` [PATCH net-next] bonding: print churn state via netlink patchwork-bot+netdevbpf
  0 siblings, 2 replies; 7+ messages in thread
From: Hangbin Liu @ 2026-02-24  2:02 UTC (permalink / raw)
  To: netdev
  Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, David Ahern, Hangbin Liu

Currently, the churn state is printed only in sysfs. Add netlink support
so users could get the state via netlink.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 drivers/net/bonding/bond_netlink.c | 9 +++++++++
 include/uapi/linux/if_link.h       | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index 286f11c517f7..ea1a80e658ae 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -29,6 +29,8 @@ static size_t bond_get_slave_size(const struct net_device *bond_dev,
 		nla_total_size(sizeof(u16)) +	/* IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE */
 		nla_total_size(sizeof(s32)) +	/* IFLA_BOND_SLAVE_PRIO */
 		nla_total_size(sizeof(u16)) +	/* IFLA_BOND_SLAVE_ACTOR_PORT_PRIO */
+		nla_total_size(sizeof(u8)) +	/* IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE */
+		nla_total_size(sizeof(u8)) +	/* IFLA_BOND_SLAVE_AD_CHURN_PARTNER_STATE */
 		0;
 }
 
@@ -77,6 +79,13 @@ static int bond_fill_slave_info(struct sk_buff *skb,
 					IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE,
 					ad_port->partner_oper.port_state))
 				goto nla_put_failure;
+
+			if (nla_put_u8(skb, IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE,
+				       ad_port->sm_churn_actor_state))
+				goto nla_put_failure;
+			if (nla_put_u8(skb, IFLA_BOND_SLAVE_AD_CHURN_PARTNER_STATE,
+				       ad_port->sm_churn_partner_state))
+				goto nla_put_failure;
 		}
 
 		if (nla_put_u16(skb, IFLA_BOND_SLAVE_ACTOR_PORT_PRIO,
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index e9b5f79e1ee1..83a96c56b8ca 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -1568,6 +1568,8 @@ enum {
 	IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE,
 	IFLA_BOND_SLAVE_PRIO,
 	IFLA_BOND_SLAVE_ACTOR_PORT_PRIO,
+	IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE,
+	IFLA_BOND_SLAVE_AD_CHURN_PARTNER_STATE,
 	__IFLA_BOND_SLAVE_MAX,
 };
 
-- 
2.50.1


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

* [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state
  2026-02-24  2:02 [PATCH net-next] bonding: print churn state via netlink Hangbin Liu
@ 2026-02-24  2:02 ` Hangbin Liu
  2026-02-25 21:22   ` Stephen Hemminger
  2026-02-26 11:00 ` [PATCH net-next] bonding: print churn state via netlink patchwork-bot+netdevbpf
  1 sibling, 1 reply; 7+ messages in thread
From: Hangbin Liu @ 2026-02-24  2:02 UTC (permalink / raw)
  To: netdev
  Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, David Ahern, Hangbin Liu

Add ability to print both actor and partner port churn states
(MONITOR/CHURN/NO_CHURN) via netlink attributes. This provides
visibility into the LACP churn detection state for bond slaves.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 ip/iplink_bond_slave.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/ip/iplink_bond_slave.c b/ip/iplink_bond_slave.c
index c88100e248dd..5dfe2970941e 100644
--- a/ip/iplink_bond_slave.c
+++ b/ip/iplink_bond_slave.c
@@ -86,6 +86,12 @@ static void print_slave_oper_state(FILE *fp, const char *name, __u16 state)
 	close_json_array(PRINT_ANY, "> ");
 }
 
+static const char *port_churn_state[] = {
+	"MONITOR",
+	"CHURN",
+	"NO_CHURN",
+};
+
 static void bond_slave_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 {
 	SPRINT_BUF(b1);
@@ -148,6 +154,26 @@ static void bond_slave_print_opt(struct link_util *lu, FILE *f, struct rtattr *t
 		print_slave_oper_state(f, "ad_partner_oper_port_state_str", state);
 	}
 
+	if (tb[IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE]) {
+		__u8 state = rta_getattr_u8(tb[IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE]);
+
+		if (state >= ARRAY_SIZE(port_churn_state))
+			print_int(PRINT_ANY, "churn_actor_state", "churn_actor_state %u ", state);
+		else
+			print_string(PRINT_ANY, "churn_actor_state", "churn_actor_state %s ",
+				     port_churn_state[state]);
+	}
+
+	if (tb[IFLA_BOND_SLAVE_AD_CHURN_PARTNER_STATE]) {
+		__u8 state = rta_getattr_u8(tb[IFLA_BOND_SLAVE_AD_CHURN_PARTNER_STATE]);
+
+		if (state >= ARRAY_SIZE(port_churn_state))
+			print_int(PRINT_ANY, "churn_partner_state", "churn_partner_state %u ", state);
+		else
+			print_string(PRINT_ANY, "churn_partner_state", "churn_partner_state %s ",
+				     port_churn_state[state]);
+	}
+
 	if (tb[IFLA_BOND_SLAVE_ACTOR_PORT_PRIO])
 		print_int(PRINT_ANY,
 			  "actor_port_prio",
-- 
2.50.1


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

* Re: [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state
  2026-02-24  2:02 ` [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state Hangbin Liu
@ 2026-02-25 21:22   ` Stephen Hemminger
  2026-02-26  2:10     ` Hangbin Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2026-02-25 21:22 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, David Ahern

On Tue, 24 Feb 2026 02:02:15 +0000
Hangbin Liu <liuhangbin@gmail.com> wrote:

> +	if (tb[IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE]) {
> +		__u8 state = rta_getattr_u8(tb[IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE]);
> +
> +		if (state >= ARRAY_SIZE(port_churn_state))
> +			print_int(PRINT_ANY, "churn_actor_state", "churn_actor_state %u ", state);

You should use print_uint for unsigned values.

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

* Re: [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state
  2026-02-25 21:22   ` Stephen Hemminger
@ 2026-02-26  2:10     ` Hangbin Liu
  2026-02-26  3:03       ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Hangbin Liu @ 2026-02-26  2:10 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: netdev, Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, David Ahern

On Wed, Feb 25, 2026 at 01:22:39PM -0800, Stephen Hemminger wrote:
> On Tue, 24 Feb 2026 02:02:15 +0000
> Hangbin Liu <liuhangbin@gmail.com> wrote:
> 
> > +	if (tb[IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE]) {
> > +		__u8 state = rta_getattr_u8(tb[IFLA_BOND_SLAVE_AD_CHURN_ACTOR_STATE]);
> > +
> > +		if (state >= ARRAY_SIZE(port_churn_state))
> > +			print_int(PRINT_ANY, "churn_actor_state", "churn_actor_state %u ", state);
> 
> You should use print_uint for unsigned values.

Thanks, should I post a v2 version for both the kernel and iproute2 patches,
Or just the iproute2 patch?

Hangbin

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

* Re: [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state
  2026-02-26  2:10     ` Hangbin Liu
@ 2026-02-26  3:03       ` Jakub Kicinski
  2026-02-26  3:35         ` Hangbin Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2026-02-26  3:03 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: Stephen Hemminger, netdev, Jay Vosburgh, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, David Ahern

On Thu, 26 Feb 2026 02:10:21 +0000 Hangbin Liu wrote:
> > You should use print_uint for unsigned values.  
> 
> Thanks, should I post a v2 version for both the kernel and iproute2 patches,
> Or just the iproute2 patch?

Just iproute2, they aren't bundled by patchwork (please refer to 
the netdev maintainer faq for the correct way to co-post iproute2)

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

* Re: [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state
  2026-02-26  3:03       ` Jakub Kicinski
@ 2026-02-26  3:35         ` Hangbin Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Hangbin Liu @ 2026-02-26  3:35 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Stephen Hemminger, netdev, Jay Vosburgh, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, David Ahern

On Wed, Feb 25, 2026 at 07:03:33PM -0800, Jakub Kicinski wrote:
> On Thu, 26 Feb 2026 02:10:21 +0000 Hangbin Liu wrote:
> > > You should use print_uint for unsigned values.  
> > 
> > Thanks, should I post a v2 version for both the kernel and iproute2 patches,
> > Or just the iproute2 patch?
> 
> Just iproute2, they aren't bundled by patchwork (please refer to 
> the netdev maintainer faq for the correct way to co-post iproute2)

Got it. I will post the iproute2 as a new series.

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

* Re: [PATCH net-next] bonding: print churn state via netlink
  2026-02-24  2:02 [PATCH net-next] bonding: print churn state via netlink Hangbin Liu
  2026-02-24  2:02 ` [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state Hangbin Liu
@ 2026-02-26 11:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-26 11:00 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, jv, andrew+netdev, davem, edumazet, kuba, pabeni, dsahern

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 24 Feb 2026 02:02:14 +0000 you wrote:
> Currently, the churn state is printed only in sysfs. Add netlink support
> so users could get the state via netlink.
> 
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>  drivers/net/bonding/bond_netlink.c | 9 +++++++++
>  include/uapi/linux/if_link.h       | 2 ++
>  2 files changed, 11 insertions(+)

Here is the summary with links:
  - [net-next] bonding: print churn state via netlink
    https://git.kernel.org/netdev/net-next/c/4916f2e2f3fc

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-02-26 11:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24  2:02 [PATCH net-next] bonding: print churn state via netlink Hangbin Liu
2026-02-24  2:02 ` [PATCH iproute2-next] iplink: bond_slave: print actor and partner churn state Hangbin Liu
2026-02-25 21:22   ` Stephen Hemminger
2026-02-26  2:10     ` Hangbin Liu
2026-02-26  3:03       ` Jakub Kicinski
2026-02-26  3:35         ` Hangbin Liu
2026-02-26 11:00 ` [PATCH net-next] bonding: print churn state via netlink patchwork-bot+netdevbpf

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