Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
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>,
Jarod Wilson <jarod@redhat.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@resnulli.us>,
Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCH iproute2-next] ip/bond: add lacp active support
Date: Mon, 2 Aug 2021 11:02:20 +0800 [thread overview]
Message-ID: <20210802030220.841726-2-liuhangbin@gmail.com> (raw)
In-Reply-To: <20210802030220.841726-1-liuhangbin@gmail.com>
lacp_active specifies whether to send LACPDU frames periodically.
If set on, the LACPDU frames are sent along with the configured lacp_rate
setting. If set off, the LACPDU frames acts as "speak when spoken to".
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
include/uapi/linux/if_link.h | 1 +
ip/iplink_bond.c | 26 +++++++++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5195ed93..a60dbb96 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -853,6 +853,7 @@ enum {
IFLA_BOND_AD_ACTOR_SYSTEM,
IFLA_BOND_TLB_DYNAMIC_LB,
IFLA_BOND_PEER_NOTIF_DELAY,
+ IFLA_BOND_AD_LACP_ACTIVE,
__IFLA_BOND_MAX,
};
diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c
index d45845bd..a3ca7ec9 100644
--- a/ip/iplink_bond.c
+++ b/ip/iplink_bond.c
@@ -74,6 +74,12 @@ static const char *xmit_hash_policy_tbl[] = {
NULL,
};
+static const char *lacp_active_tbl[] = {
+ "off",
+ "on",
+ NULL,
+};
+
static const char *lacp_rate_tbl[] = {
"slow",
"fast",
@@ -138,6 +144,7 @@ static void print_explain(FILE *f)
" [ lp_interval LP_INTERVAL ]\n"
" [ packets_per_slave PACKETS_PER_SLAVE ]\n"
" [ tlb_dynamic_lb TLB_DYNAMIC_LB ]\n"
+ " [ lacp_active LACP_ACTIVE]\n"
" [ lacp_rate LACP_RATE ]\n"
" [ ad_select AD_SELECT ]\n"
" [ ad_user_port_key PORTKEY ]\n"
@@ -150,6 +157,7 @@ static void print_explain(FILE *f)
"PRIMARY_RESELECT := always|better|failure\n"
"FAIL_OVER_MAC := none|active|follow\n"
"XMIT_HASH_POLICY := layer2|layer2+3|layer3+4|encap2+3|encap3+4|vlan+srcmac\n"
+ "LACP_ACTIVE := off|on\n"
"LACP_RATE := slow|fast\n"
"AD_SELECT := stable|bandwidth|count\n"
);
@@ -165,7 +173,7 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
{
__u8 mode, use_carrier, primary_reselect, fail_over_mac;
__u8 xmit_hash_policy, num_peer_notif, all_slaves_active;
- __u8 lacp_rate, ad_select, tlb_dynamic_lb;
+ __u8 lacp_active, lacp_rate, ad_select, tlb_dynamic_lb;
__u16 ad_user_port_key, ad_actor_sys_prio;
__u32 miimon, updelay, downdelay, peer_notify_delay, arp_interval, arp_validate;
__u32 arp_all_targets, resend_igmp, min_links, lp_interval;
@@ -316,6 +324,13 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
addattr32(n, 1024, IFLA_BOND_PACKETS_PER_SLAVE,
packets_per_slave);
+ } else if (matches(*argv, "lacp_active") == 0) {
+ NEXT_ARG();
+ if (get_index(lacp_active_tbl, *argv) < 0)
+ invarg("invalid lacp_active", *argv);
+
+ lacp_active = get_index(lacp_active_tbl, *argv);
+ addattr8(n, 1024, IFLA_BOND_AD_LACP_ACTIVE, lacp_active);
} else if (matches(*argv, "lacp_rate") == 0) {
NEXT_ARG();
if (get_index(lacp_rate_tbl, *argv) < 0)
@@ -561,6 +576,15 @@ static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
"packets_per_slave %u ",
rta_getattr_u32(tb[IFLA_BOND_PACKETS_PER_SLAVE]));
+ if (tb[IFLA_BOND_AD_LACP_ACTIVE]) {
+ const char *lacp_active = get_name(lacp_active_tbl,
+ rta_getattr_u8(tb[IFLA_BOND_AD_LACP_ACTIVE]));
+ print_string(PRINT_ANY,
+ "ad_lacp_active",
+ "lacp_active %s ",
+ lacp_active);
+ }
+
if (tb[IFLA_BOND_AD_LACP_RATE]) {
const char *lacp_rate = get_name(lacp_rate_tbl,
rta_getattr_u8(tb[IFLA_BOND_AD_LACP_RATE]));
--
2.31.1
next prev parent reply other threads:[~2021-08-02 3:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 3:02 [PATCHv2 net-next] bonding: add new option lacp_active Hangbin Liu
2021-08-02 3:02 ` Hangbin Liu [this message]
2021-08-08 18:17 ` [PATCH iproute2-next] ip/bond: add lacp active support David Ahern
2021-08-03 11:00 ` [PATCHv2 net-next] bonding: add new option lacp_active 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=20210802030220.841726-2-liuhangbin@gmail.com \
--to=liuhangbin@gmail.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=j.vosburgh@gmail.com \
--cc=jarod@redhat.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.com \
--subject='Re: [PATCH iproute2-next] ip/bond: add lacp active support' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).