diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2014-01-03 23:18:41 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-04 03:03:21 +0100 |
commit | 998e40bbf8f0e10b5d84107afc61e29dbc8d2de4 (patch) | |
tree | 1c46087ba4a99b12a9891d397d8c1adc14c9d243 /drivers/net/bonding/bond_options.c | |
parent | Merge branch 'tg3' (diff) | |
download | linux-998e40bbf8f0e10b5d84107afc61e29dbc8d2de4.tar.xz linux-998e40bbf8f0e10b5d84107afc61e29dbc8d2de4.zip |
bonding: add lacp_rate attribute netlink support
Add IFLA_BOND_AD_LACP_RATE to allow get/set of bonding parameter
lacp_rate via netlink.
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_options.c')
-rw-r--r-- | drivers/net/bonding/bond_options.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index f8a2cd8c7b57..ad67fbf1ba61 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -656,3 +656,32 @@ int bond_option_packets_per_slave_set(struct bonding *bond, return 0; } + +int bond_option_lacp_rate_set(struct bonding *bond, int lacp_rate) +{ + if (bond->dev->flags & IFF_UP) { + pr_err("%s: Unable to update LACP rate because interface is up.\n", + bond->dev->name); + return -EPERM; + } + + if (bond->params.mode != BOND_MODE_8023AD) { + pr_err("%s: Unable to update LACP rate because bond is not in 802.3ad mode.\n", + bond->dev->name); + return -EPERM; + } + + if ((lacp_rate == 1) || (lacp_rate == 0)) { + bond->params.lacp_fast = lacp_rate; + bond_3ad_update_lacp_rate(bond); + pr_info("%s: Setting LACP rate to %s (%d).\n", + bond->dev->name, bond_lacp_tbl[lacp_rate].modename, + lacp_rate); + } else { + pr_err("%s: Ignoring invalid LACP rate value %d.\n", + bond->dev->name, lacp_rate); + return -EINVAL; + } + + return 0; +} |