[PATCH 1/2] bonding: exposure option coupled_control via sysfs

From: Wanchuan Li
Date: Mon Jul 07 2025 - 05:16:27 EST


Allow get/set of bonding parameter coupled_control
via sysfs.

Signed-off-by: Wanchuan Li <liwanchuan@xxxxxxxxxx>
---
drivers/net/bonding/bond_sysfs.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 1e13bb170515..5a8450b2269d 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -479,6 +479,18 @@ static ssize_t bonding_show_carrier(struct device *d,
static DEVICE_ATTR(use_carrier, 0644,
bonding_show_carrier, bonding_sysfs_store_option);

+/* Show the coupled_control flag. */
+static ssize_t bonding_show_coupled_control(struct device *d,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct bonding *bond = to_bond(d);
+
+ return sysfs_emit(buf, "%d\n", bond->params.coupled_control);
+}
+static DEVICE_ATTR(coupled_control, 0644,
+ bonding_show_coupled_control, bonding_sysfs_store_option);
+

/* Show currently active_slave. */
static ssize_t bonding_show_active_slave(struct device *d,
@@ -791,6 +803,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_coupled_control.attr,
NULL,
};

--
2.49.0