Skip to contentSkip to conversation

iplink: bond_slave: add support for actor_port_prio

PATCH Superseded Hangbin Liu 2 participants 6 messages Aug 25, 2025 – Aug 30, 2025

Subsystems (4)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 iplink: bond_slave: add support for actor_port_prio

Add support for the actor_port_prio option for bond slaves. This per-port priority can be used by the bonding driver in ad_select to choose the higher-priority aggregator during failover.

---
v4: no update
v3: rename ad_actor_port_prio to actor_port_prio
v2: no update

---
 ip/iplink_bond.c       |  1 +
 ip/iplink_bond_slave.c | 18 ++++++++++++++++--
 man/man8/ip-link.8.in  |  6 ++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
ip/iplink_bond.c +1 -0
index d6960f6d9b03..1a2c1b3042a0 100644
@@ -91,6 +91,7 @@ static const char *ad_select_tbl[] = {
 	"stable",
 	"bandwidth",
 	"count",
+	"prio",
 	NULL,
 };
 
ip/iplink_bond_slave.c +16 -2
index ad6875006950..c88100e248dd 100644
@@ -15,7 +15,9 @@
 
 static void print_explain(FILE *f)
 {
-	fprintf(f, "Usage: ... bond_slave [ queue_id ID ] [ prio PRIORITY ]\n");
+	fprintf(f, "Usage: ... bond_slave [ queue_id ID ] [ prio PRIORITY ]\n"
+		   "                      [ actor_port_prio PRIORITY ]\n"
+	);
 }
 
 static void explain(void)
@@ -145,12 +147,18 @@ static void bond_slave_print_opt(struct link_util *lu, FILE *f, struct rtattr *t
 			  state);
 		print_slave_oper_state(f, "ad_partner_oper_port_state_str", state);
 	}
+
+	if (tb[IFLA_BOND_SLAVE_ACTOR_PORT_PRIO])
+		print_int(PRINT_ANY,
+			  "actor_port_prio",
+			  "actor_port_prio %d ",
+			  rta_getattr_u16(tb[IFLA_BOND_SLAVE_ACTOR_PORT_PRIO]));
 }
 
 static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
 				struct nlmsghdr *n)
 {
-	__u16 queue_id;
+	__u16 queue_id, actor_port_prio;
 	int prio;
 
 	while (argc > 0) {
@@ -164,6 +172,12 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
 			if (get_s32(&prio, *argv, 0))
 				invarg("prio is invalid", *argv);
 			addattr32(n, 1024, IFLA_BOND_SLAVE_PRIO, prio);
+		} else if (strcmp(*argv, "actor_port_prio") == 0) {
+			NEXT_ARG();
+			if (get_u16(&actor_port_prio, *argv, 0))
+				invarg("actor prio is invalid", *argv);
+			addattr16(n, 1024, IFLA_BOND_SLAVE_ACTOR_PORT_PRIO,
+				  actor_port_prio);
 		} else {
 			if (matches(*argv, "help") != 0)
 				fprintf(stderr,
man/man8/ip-link.8.in +6 -0
index e3297c577152..7995943ab11f 100644
@@ -2846,6 +2846,12 @@ the following additional arguments are supported:
 (a 32bit signed value). This option only valid for active-backup(1),
 balance-tlb (5) and balance-alb (6) mode.
 
+.sp
+.BI actor_port_prio " PRIORITY"
+- set the slave's ad actor port priority for 802.3ad aggregation selection
+logic during failover (a 16bit unsigned value). This option only valid for
+802.3ad (4) mode.
+
 .in -8
 
 .TP
Signature · 1 line
2.50.1
#1 lore raw
Quoted 20 lines · Hangbin Liu

Add support for the actor_port_prio option for bond slaves. This per-port priority can be used by the bonding driver in ad_select to choose the higher-priority aggregator during failover.

---
v4: no update
v3: rename ad_actor_port_prio to actor_port_prio
v2: no update
---

ip/iplink_bond.c       |  1 +
ip/iplink_bond_slave.c | 18 ++++++++++++++++--
man/man8/ip-link.8.in  |  6 ++++++
3 files changed, 23 insertions(+), 2 deletions(-)
ip/iplink_bond.c +0 -0
index d6960f6d9b03..1a2c1b3042a0 100644

ip/iplink_bond.c static const char *ad_select_tbl[] = { · line 94

Quoted 4 lines
ip/iplink_bond.c +1 -0
@@ -91,6 +91,7 @@ static const char *ad_select_tbl[] = {
 	"stable",
 	"bandwidth",
 	"count",
+	"prio",
	Should this be actor_port_prio?

	-J
Quoted 67 lines
ip/iplink_bond.c +0 -0
 	NULL,
 };
 
ip/iplink_bond_slave.c +16 -2
index ad6875006950..c88100e248dd 100644
@@ -15,7 +15,9 @@
 
 static void print_explain(FILE *f)
 {
-	fprintf(f, "Usage: ... bond_slave [ queue_id ID ] [ prio PRIORITY ]\n");
+	fprintf(f, "Usage: ... bond_slave [ queue_id ID ] [ prio PRIORITY ]\n"
+		   "                      [ actor_port_prio PRIORITY ]\n"
+	);
 }
 
 static void explain(void)
@@ -145,12 +147,18 @@ static void bond_slave_print_opt(struct link_util *lu, FILE *f, struct rtattr *t
 			  state);
 		print_slave_oper_state(f, "ad_partner_oper_port_state_str", state);
 	}
+
+	if (tb[IFLA_BOND_SLAVE_ACTOR_PORT_PRIO])
+		print_int(PRINT_ANY,
+			  "actor_port_prio",
+			  "actor_port_prio %d ",
+			  rta_getattr_u16(tb[IFLA_BOND_SLAVE_ACTOR_PORT_PRIO]));
 }
 
 static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
 				struct nlmsghdr *n)
 {
-	__u16 queue_id;
+	__u16 queue_id, actor_port_prio;
 	int prio;
 
 	while (argc > 0) {
@@ -164,6 +172,12 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
 			if (get_s32(&prio, *argv, 0))
 				invarg("prio is invalid", *argv);
 			addattr32(n, 1024, IFLA_BOND_SLAVE_PRIO, prio);
+		} else if (strcmp(*argv, "actor_port_prio") == 0) {
+			NEXT_ARG();
+			if (get_u16(&actor_port_prio, *argv, 0))
+				invarg("actor prio is invalid", *argv);
+			addattr16(n, 1024, IFLA_BOND_SLAVE_ACTOR_PORT_PRIO,
+				  actor_port_prio);
 		} else {
 			if (matches(*argv, "help") != 0)
 				fprintf(stderr,
man/man8/ip-link.8.in +0 -0
index e3297c577152..7995943ab11f 100644
@@ -2846,6 +2846,12 @@ the following additional arguments are supported:
 (a 32bit signed value). This option only valid for active-backup(1),

balance-tlb (5) and balance-alb (6) mode.

+.sp
+.BI actor_port_prio " PRIORITY"
+- set the slave's ad actor port priority for 802.3ad aggregation selection

man/man8/ip-link.8.in +3 -0
+logic during failover (a 16bit unsigned value). This option only valid for
+802.3ad (4) mode.
+

.in -8

Quoted 4 lines

.TP

Signature · 1 line
2.50.1

---
-Jay Vosburgh, [email protected]

#2 lore raw
Quoted 17 lines · Jay Vosburgh
Quoted 15 lines · Hangbin Liu

Add support for the actor_port_prio option for bond slaves. This per-port priority can be used by the bonding driver in ad_select to choose the higher-priority aggregator during failover.

---
v4: no update
v3: rename ad_actor_port_prio to actor_port_prio
v2: no update
---

ip/iplink_bond.c       |  1 +
ip/iplink_bond_slave.c | 18 ++++++++++++++++--
man/man8/ip-link.8.in  |  6 ++++++
3 files changed, 23 insertions(+), 2 deletions(-)
Quoted 11 lines

ip/iplink_bond.c static const char *ad_select_tbl[] = { · line 94

Quoted 9 lines
ip/iplink_bond.c +1 -0
index d6960f6d9b03..1a2c1b3042a0 100644
@@ -91,6 +91,7 @@ static const char *ad_select_tbl[] = {
 	"stable",
 	"bandwidth",
 	"count",
+	"prio",

Should this be actor_port_prio?

hmm, actor_port_prio correspond to the ip link option name, which is also acceptable.

While in kernel, we defined the select policy as

        { "stable",    BOND_AD_STABLE,    BOND_VALFLAG_DEFAULT},
        { "bandwidth", BOND_AD_BANDWIDTH, 0},
        { "count",     BOND_AD_COUNT,     0},

+ { "prio", BOND_AD_PRIO, 0},

So I think the prio here should also be OK.

You can decide which one to use.

Thanks
Hangbin

#3 lore raw
Quoted 30 lines · Hangbin Liu
Quoted 17 lines · Jay Vosburgh
Quoted 15 lines · Hangbin Liu

Add support for the actor_port_prio option for bond slaves. This per-port priority can be used by the bonding driver in ad_select to choose the higher-priority aggregator during failover.

---
v4: no update
v3: rename ad_actor_port_prio to actor_port_prio
v2: no update
---

ip/iplink_bond.c       |  1 +
ip/iplink_bond_slave.c | 18 ++++++++++++++++--
man/man8/ip-link.8.in  |  6 ++++++
3 files changed, 23 insertions(+), 2 deletions(-)
Quoted 11 lines

ip/iplink_bond.c static const char *ad_select_tbl[] = { · line 94

Quoted 9 lines
ip/iplink_bond.c +1 -0
index d6960f6d9b03..1a2c1b3042a0 100644
@@ -91,6 +91,7 @@ static const char *ad_select_tbl[] = {
 	"stable",
 	"bandwidth",
 	"count",
+	"prio",

Should this be actor_port_prio?

Quoted 2 lines

hmm, actor_port_prio correspond to the ip link option name, which is also acceptable.

Isn't this the text of the ip link option name right here (in
the sense of what goes on the "ip link" command line)?

Quoted 6 lines

While in kernel, we defined the select policy as

       { "stable",    BOND_AD_STABLE,    BOND_VALFLAG_DEFAULT},
       { "bandwidth", BOND_AD_BANDWIDTH, 0},
       { "count",     BOND_AD_COUNT,     0},

+ { "prio", BOND_AD_PRIO, 0},

Maybe my memory is starting to go, but I thought in a prior
discussion we'd agreed to change this as well for consistency.

Quoted 3 lines

So I think the prio here should also be OK.

You can decide which one to use.

I would prefer that the two options have discrete names, or,
really, that we not repeat "prio" as it's already used elsewhere. Plus, who knows, maybe in the future we'll have another priority option.

	-J

---
-Jay Vosburgh, [email protected]

#4 lore raw
Quoted 32 lines · Jay Vosburgh
Quoted 30 lines · Hangbin Liu
Quoted 28 lines · Jay Vosburgh
Quoted 20 lines · Hangbin Liu

Add support for the actor_port_prio option for bond slaves. This per-port priority can be used by the bonding driver in ad_select to choose the higher-priority aggregator during failover.

---
v4: no update
v3: rename ad_actor_port_prio to actor_port_prio
v2: no update
---

ip/iplink_bond.c       |  1 +
ip/iplink_bond_slave.c | 18 ++++++++++++++++--
man/man8/ip-link.8.in  |  6 ++++++
3 files changed, 23 insertions(+), 2 deletions(-)
ip/iplink_bond.c +0 -0
index d6960f6d9b03..1a2c1b3042a0 100644

ip/iplink_bond.c static const char *ad_select_tbl[] = { · line 94

Quoted 4 lines
ip/iplink_bond.c +1 -0
@@ -91,6 +91,7 @@ static const char *ad_select_tbl[] = {
 	"stable",
 	"bandwidth",
 	"count",
+	"prio",

Should this be actor_port_prio?

Quoted 5 lines
Quoted 2 lines

hmm, actor_port_prio correspond to the ip link option name, which is also acceptable.

Isn't this the text of the ip link option name right here (in
the sense of what goes on the "ip link" command line)?

"stable", "bandwidth", "count" are not ip link parameters, and same with kernel names, so I also used the kernel name "prio" here.

Quoted 10 lines
Quoted 7 lines

While in kernel, we defined the select policy as

       { "stable",    BOND_AD_STABLE,    BOND_VALFLAG_DEFAULT},
       { "bandwidth", BOND_AD_BANDWIDTH, 0},
       { "count",     BOND_AD_COUNT,     0},

+ { "prio", BOND_AD_PRIO, 0},

Maybe my memory is starting to go, but I thought in a prior
discussion we'd agreed to change this as well for consistency.

Maybe I didn't get your comment[1] correctly. I only changed ad_actor_port_prio to actor_port_prio last time.

Quoted 8 lines
Quoted 4 lines

So I think the prio here should also be OK.

You can decide which one to use.

I would prefer that the two options have discrete names, or,
really, that we not repeat "prio" as it's already used elsewhere. Plus, who knows, maybe in the future we'll have another priority option.

OK, do not use same name for different usage. I will also change the "prio" to "actor_port_prio" in next patch.

[1] https://lore.kernel.org/netdev/1109153.1755380673@famine/

Thanks
Hangbin

#5 lore raw
Quoted 33 lines · Hangbin Liu
Quoted 32 lines · Jay Vosburgh
Quoted 30 lines · Hangbin Liu
Quoted 28 lines · Jay Vosburgh
Quoted 20 lines · Hangbin Liu

Add support for the actor_port_prio option for bond slaves. This per-port priority can be used by the bonding driver in ad_select to choose the higher-priority aggregator during failover.

---
v4: no update
v3: rename ad_actor_port_prio to actor_port_prio
v2: no update
---

ip/iplink_bond.c       |  1 +
ip/iplink_bond_slave.c | 18 ++++++++++++++++--
man/man8/ip-link.8.in  |  6 ++++++
3 files changed, 23 insertions(+), 2 deletions(-)
ip/iplink_bond.c +0 -0
index d6960f6d9b03..1a2c1b3042a0 100644

ip/iplink_bond.c static const char *ad_select_tbl[] = { · line 94

Quoted 4 lines
ip/iplink_bond.c +1 -0
@@ -91,6 +91,7 @@ static const char *ad_select_tbl[] = {
 	"stable",
 	"bandwidth",
 	"count",
+	"prio",

Should this be actor_port_prio?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

hmm, actor_port_prio correspond to the ip link option name, which is also acceptable.

Isn't this the text of the ip link option name right here (in
the sense of what goes on the "ip link" command line)?

"stable", "bandwidth", "count" are not ip link parameters, and same with kernel names, so I also used the kernel name "prio" here.

Perhaps I wasn't explaining sufficiently; I mean that the text
in ad_select_tbl[] is where the name of the option settings comes from for ip link whatever commands. E.g., If I do something like

ip link add dev bond0 type bond [...] ad_select rutabaga

The "rutabaga" text is being compared to the elements of
ad_select_tbl[], correct?

Anyway, what I meant is that I think setting this new priority
option should look something like:

ip link add dev bond0 type bond [...] ad_select actor_port_prio

So that it's called the same thing everwhere, and it matches the
nomenclature used in the standard.

	-J
Quoted 22 lines
Quoted 9 lines
Quoted 6 lines

While in kernel, we defined the select policy as

       { "stable",    BOND_AD_STABLE,    BOND_VALFLAG_DEFAULT},
       { "bandwidth", BOND_AD_BANDWIDTH, 0},
       { "count",     BOND_AD_COUNT,     0},

+ { "prio", BOND_AD_PRIO, 0},

Maybe my memory is starting to go, but I thought in a prior
discussion we'd agreed to change this as well for consistency.

Maybe I didn't get your comment[1] correctly. I only changed ad_actor_port_prio to actor_port_prio last time.

Quoted 8 lines
Quoted 4 lines

So I think the prio here should also be OK.

You can decide which one to use.

I would prefer that the two options have discrete names, or,
really, that we not repeat "prio" as it's already used elsewhere. Plus, who knows, maybe in the future we'll have another priority option.

Quoted 7 lines

OK, do not use same name for different usage. I will also change the "prio" to "actor_port_prio" in next patch.

[1] https://lore.kernel.org/netdev/1109153.1755380673@famine/

Thanks
Hangbin

---
-Jay Vosburgh, [email protected]