From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: Jay Vosburgh <j.vosburgh@gmail.com>,
Veaceslav Falico <vfalico@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jonathan Toppins <jtoppins@redhat.com>,
Paolo Abeni <pabeni@redhat.com>, David Ahern <dsahern@gmail.com>,
Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCHv3 iproute2-next] iplink: bond_slave: add per port prio support
Date: Tue, 21 Jun 2022 15:51:05 +0800 [thread overview]
Message-ID: <20220621075105.2636726-1-liuhangbin@gmail.com> (raw)
In-Reply-To: <20220621074919.2636622-1-liuhangbin@gmail.com>
Add per port priority support for active slave re-selection during
bonding failover. A higher number means higher priority.
This option is only valid for active-backup(1), balance-tlb (5) and
balance-alb (6) mode.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
v3: no update
v2: update man page
---
ip/iplink_bond_slave.c | 12 +++++++++++-
man/man8/ip-link.8.in | 8 ++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/ip/iplink_bond_slave.c b/ip/iplink_bond_slave.c
index d488aaab..8103704b 100644
--- a/ip/iplink_bond_slave.c
+++ b/ip/iplink_bond_slave.c
@@ -19,7 +19,7 @@
static void print_explain(FILE *f)
{
- fprintf(f, "Usage: ... bond_slave [ queue_id ID ]\n");
+ fprintf(f, "Usage: ... bond_slave [ queue_id ID ] [ prio PRIORITY ]\n");
}
static void explain(void)
@@ -120,6 +120,10 @@ static void bond_slave_print_opt(struct link_util *lu, FILE *f, struct rtattr *t
"queue_id %d ",
rta_getattr_u16(tb[IFLA_BOND_SLAVE_QUEUE_ID]));
+ if (tb[IFLA_BOND_SLAVE_PRIO])
+ print_int(PRINT_ANY, "prio", "prio %d ",
+ rta_getattr_s32(tb[IFLA_BOND_SLAVE_PRIO]));
+
if (tb[IFLA_BOND_SLAVE_AD_AGGREGATOR_ID])
print_int(PRINT_ANY,
"ad_aggregator_id",
@@ -151,6 +155,7 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
__u16 queue_id;
+ int prio;
while (argc > 0) {
if (matches(*argv, "queue_id") == 0) {
@@ -158,6 +163,11 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
if (get_u16(&queue_id, *argv, 0))
invarg("queue_id is invalid", *argv);
addattr16(n, 1024, IFLA_BOND_SLAVE_QUEUE_ID, queue_id);
+ } else if (strcmp(*argv, "prio") == 0) {
+ NEXT_ARG();
+ if (get_s32(&prio, *argv, 0))
+ invarg("prio is invalid", *argv);
+ addattr32(n, 1024, IFLA_BOND_SLAVE_PRIO, prio);
} else {
if (matches(*argv, "help") != 0)
fprintf(stderr,
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 6f332645..3dbcdbb6 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -2567,6 +2567,8 @@ the following additional arguments are supported:
.B "ip link set type bond_slave"
[
.BI queue_id " ID"
+] [
+.BI prio " PRIORITY"
]
.in +8
@@ -2574,6 +2576,12 @@ the following additional arguments are supported:
.BI queue_id " ID"
- set the slave's queue ID (a 16bit unsigned value).
+.sp
+.BI prio " PRIORITY"
+- set the slave's priority for active slave re-selection during failover
+(a 32bit signed value). This option only valid for active-backup(1),
+balance-tlb (5) and balance-alb (6) mode.
+
.in -8
.TP
--
2.35.1
next prev parent reply other threads:[~2022-06-21 7:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 7:49 [PATCHv3 net-next 0/2] Bonding: add per-port priority support Hangbin Liu
2022-06-21 7:49 ` [PATCHv3 net-next 1/2] bonding: add slave_dev field for bond_opt_value Hangbin Liu
2022-06-21 12:41 ` Jonathan Toppins
2022-06-21 7:49 ` [PATCHv3 net-next 2/2] Bonding: add per-port priority for failover re-selection Hangbin Liu
2022-06-21 12:43 ` Jonathan Toppins
2022-06-21 7:51 ` Hangbin Liu [this message]
2022-06-21 12:44 ` [PATCHv3 iproute2-next] iplink: bond_slave: add per port prio support Jonathan Toppins
2022-06-26 17:30 ` patchwork-bot+netdevbpf
2022-06-24 10:50 ` [PATCHv3 net-next 0/2] Bonding: add per-port priority support 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=20220621075105.2636726-1-liuhangbin@gmail.com \
--to=liuhangbin@gmail.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=j.vosburgh@gmail.com \
--cc=jtoppins@redhat.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vfalico@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.