From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: Jay Vosburgh <jv@jvosburgh.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>,
Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCHv2 iproute2-next] iplink: bond_slave: print actor and partner churn state
Date: Thu, 26 Feb 2026 03:38:44 +0000 [thread overview]
Message-ID: <20260226033844.18244-1-liuhangbin@gmail.com> (raw)
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>
---
v2: use print_uint() for unsigned int variable (Stephen Hemminger)
---
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..f4b28fbca948 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_uint(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_uint(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
next reply other threads:[~2026-02-26 3:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 3:38 Hangbin Liu [this message]
2026-03-02 15:40 ` [PATCHv2 iproute2-next] iplink: bond_slave: print actor and partner churn state patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260226033844.18244-1-liuhangbin@gmail.com \
--to=liuhangbin@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox