]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iplink: bond_slave: add support for actor_port_prio
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 2 Sep 2025 06:47:38 +0000 (06:47 +0000)
committerDavid Ahern <dsahern@kernel.org>
Thu, 11 Sep 2025 20:58:52 +0000 (20:58 +0000)
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.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/iplink_bond.c
ip/iplink_bond_slave.c
man/man8/ip-link.8.in

index d6960f6d9b03fa7ef769fac6bb9f0d24a463b8a5..3ae626a03e6e0dd91e819cc8e57a7e5c353543e0 100644 (file)
@@ -91,6 +91,7 @@ static const char *ad_select_tbl[] = {
        "stable",
        "bandwidth",
        "count",
+       "actor_port_prio",
        NULL,
 };
 
index ad6875006950cac79e83fb7967602db5c83bc3b5..c88100e248dd39dc13a599fcd627b602e91a3cb0 100644 (file)
@@ -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,
index e3297c5771522fc782b7d7d8ba87a7b6d6408df9..7995943ab11fe6a22ccfddecbf8c74f824de4f27 100644 (file)
@@ -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