bonding: add netlink attributes to slave link dev

If link is IFF_SLAVE, extend link dev netlink attributes to include
slave attributes with new IFLA_SLAVE nest.  Add netlink notification
(RTM_NEWLINK) when slave status changes from backup to active, or
visa-versa.

Adds new ndo_get_slave op to net_device_ops to fill skb with IFLA_SLAVE
attributes.  Currently only used by bonding driver, but could be
used by other aggregating devices with slaves.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
sfeldma@cumulusnetworks.com
2014-01-16 22:57:56 -08:00
committed by David S. Miller
parent 07699f9a7c
commit 1d3ee88ae0
6 changed files with 118 additions and 2 deletions

View File

@@ -285,12 +285,18 @@ static inline bool bond_is_lb(const struct bonding *bond)
static inline void bond_set_active_slave(struct slave *slave)
{
slave->backup = 0;
if (slave->backup) {
slave->backup = 0;
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL);
}
}
static inline void bond_set_backup_slave(struct slave *slave)
{
slave->backup = 1;
if (!slave->backup) {
slave->backup = 1;
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL);
}
}
static inline int bond_slave_state(struct slave *slave)
@@ -426,6 +432,7 @@ int bond_sysfs_slave_add(struct slave *slave);
void bond_sysfs_slave_del(struct slave *slave);
int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb);
int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, int count);
int bond_parse_parm(const char *mode_arg, const struct bond_parm_tbl *tbl);
int bond_parm_tbl_lookup(int mode, const struct bond_parm_tbl *tbl);