]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bonding: print churn state via netlink
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 24 Feb 2026 02:02:14 +0000 (02:02 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 26 Feb 2026 10:45:35 +0000 (11:45 +0100)
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>
Link: https://patch.msgid.link/20260224020215.6012-1-liuhangbin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/bonding/bond_netlink.c
include/uapi/linux/if_link.h

index 286f11c517f762e298319f3f2d7ace9b4bd1d830..ea1a80e658aeb2862032e006d6a3c92caa2b17e1 100644 (file)
@@ -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,
index e9b5f79e1ee173136f1f25c094180de154df5d88..83a96c56b8cad81d676c46e8a09e6c69619a0ec4 100644 (file)
@@ -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,
 };