Skip to content

Commit 205845a

Browse files
Nikolay Aleksandrovdavem330
authored andcommitted
bonding: convert num_grat_arp to the new bonding option API
num_grat_arp wasn't converted to the new bonding option API, so do this now and remove the specific sysfs store option in order to use the standard one. num_grat_arp is the same as num_unsol_na so add it as an alias with the same option settings. An important difference is the option name which is matched in bond_sysfs_store_option(). Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Acked-by: Veaceslav Falico <vfalico@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 94724d1 commit 205845a

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

drivers/net/bonding/bond_options.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,13 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
420420
.flags = BOND_OPTFLAG_IFDOWN,
421421
.values = bond_ad_user_port_key_tbl,
422422
.set = bond_option_ad_user_port_key_set,
423+
},
424+
[BOND_OPT_NUM_PEER_NOTIF_ALIAS] = {
425+
.id = BOND_OPT_NUM_PEER_NOTIF_ALIAS,
426+
.name = "num_grat_arp",
427+
.desc = "Number of peer notifications to send on failover event",
428+
.values = bond_num_peer_notif_tbl,
429+
.set = bond_option_num_peer_notif_set
423430
}
424431
};
425432

drivers/net/bonding/bond_sysfs.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -380,32 +380,18 @@ static ssize_t bonding_show_ad_select(struct device *d,
380380
static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR,
381381
bonding_show_ad_select, bonding_sysfs_store_option);
382382

383-
/* Show and set the number of peer notifications to send after a failover event. */
383+
/* Show the number of peer notifications to send after a failover event. */
384384
static ssize_t bonding_show_num_peer_notif(struct device *d,
385385
struct device_attribute *attr,
386386
char *buf)
387387
{
388388
struct bonding *bond = to_bond(d);
389389
return sprintf(buf, "%d\n", bond->params.num_peer_notif);
390390
}
391-
392-
static ssize_t bonding_store_num_peer_notif(struct device *d,
393-
struct device_attribute *attr,
394-
const char *buf, size_t count)
395-
{
396-
struct bonding *bond = to_bond(d);
397-
int ret;
398-
399-
ret = bond_opt_tryset_rtnl(bond, BOND_OPT_NUM_PEER_NOTIF, (char *)buf);
400-
if (!ret)
401-
ret = count;
402-
403-
return ret;
404-
}
405391
static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR,
406-
bonding_show_num_peer_notif, bonding_store_num_peer_notif);
392+
bonding_show_num_peer_notif, bonding_sysfs_store_option);
407393
static DEVICE_ATTR(num_unsol_na, S_IRUGO | S_IWUSR,
408-
bonding_show_num_peer_notif, bonding_store_num_peer_notif);
394+
bonding_show_num_peer_notif, bonding_sysfs_store_option);
409395

410396
/* Show the MII monitor interval. */
411397
static ssize_t bonding_show_miimon(struct device *d,

include/net/bond_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ enum {
6666
BOND_OPT_AD_ACTOR_SYS_PRIO,
6767
BOND_OPT_AD_ACTOR_SYSTEM,
6868
BOND_OPT_AD_USER_PORT_KEY,
69+
BOND_OPT_NUM_PEER_NOTIF_ALIAS,
6970
BOND_OPT_LAST
7071
};
7172

0 commit comments

Comments
 (0)