Message ID | 1409148406-5576-1-git-send-email-nikolay@redhat.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
Wed, Aug 27, 2014 at 04:06:46PM CEST, nikolay@redhat.com wrote: >This patch adds support for slave_changelink to the bonding and uses it >to give the ability to change the queue_id of the enslaved devices via >netlink. It sets slave_maxtype and uses bond_changelink as a prototype for >bond_slave_changelink. >Example/test command after the iproute2 patch: > ip link set eth0 type bond_slave queue_id 10 > >CC: David S. Miller <davem@davemloft.net> >CC: Jay Vosburgh <j.vosburgh@gmail.com> >CC: Veaceslav Falico <vfalico@gmail.com> >CC: Andy Gospodarek <andy@greyhouse.net> > >Suggested-by: Jiri Pirko <jiri@resnulli.us> >Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> >--- >note: I intend to add a new option flag to indicate it's a slave option > so a new netdev notifier can be called (NETDEV_CHANGESLAVEINFODATA). No need fo that atm. > I believe the bonding is the first user of slave_changelink so I hope > I haven't missed anything. Once this patch is accepted in some form > I'll post the iproute2 one. This patch is looking good to me. Acked-by: Jiri Pirko <jiri@resnulli.us> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 08/27/2014 04:06 PM, Nikolay Aleksandrov wrote: > This patch adds support for slave_changelink to the bonding and uses it > to give the ability to change the queue_id of the enslaved devices via > netlink. It sets slave_maxtype and uses bond_changelink as a prototype for > bond_slave_changelink. > Example/test command after the iproute2 patch: > ip link set eth0 type bond_slave queue_id 10 > > CC: David S. Miller <davem@davemloft.net> > CC: Jay Vosburgh <j.vosburgh@gmail.com> > CC: Veaceslav Falico <vfalico@gmail.com> > CC: Andy Gospodarek <andy@greyhouse.net> > > Suggested-by: Jiri Pirko <jiri@resnulli.us> > Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> > --- Hi Dave, Would you mind telling me why did this patch get rejected so I can fix it up ? I didn't see any complains and Jiri acked it. Thanks, Nik -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Nikolay Aleksandrov <nikolay@redhat.com> Date: Fri, 29 Aug 2014 13:27:08 +0200 > On 08/27/2014 04:06 PM, Nikolay Aleksandrov wrote: >> This patch adds support for slave_changelink to the bonding and uses it >> to give the ability to change the queue_id of the enslaved devices via >> netlink. It sets slave_maxtype and uses bond_changelink as a prototype for >> bond_slave_changelink. >> Example/test command after the iproute2 patch: >> ip link set eth0 type bond_slave queue_id 10 >> >> CC: David S. Miller <davem@davemloft.net> >> CC: Jay Vosburgh <j.vosburgh@gmail.com> >> CC: Veaceslav Falico <vfalico@gmail.com> >> CC: Andy Gospodarek <andy@greyhouse.net> >> >> Suggested-by: Jiri Pirko <jiri@resnulli.us> >> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> >> --- > > Hi Dave, > Would you mind telling me why did this patch get rejected so I can fix it up ? > I didn't see any complains and Jiri acked it. Sorry, I misread the feedback, this patch is fine, and is now applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c index d163e112f04c..1570deab112e 100644 --- a/drivers/net/bonding/bond_netlink.c +++ b/drivers/net/bonding/bond_netlink.c @@ -107,6 +107,33 @@ static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) return 0; } +static int bond_slave_changelink(struct net_device *bond_dev, + struct net_device *slave_dev, + struct nlattr *tb[], struct nlattr *data[]) +{ + struct bonding *bond = netdev_priv(bond_dev); + struct bond_opt_value newval; + int err; + + if (!data) + return 0; + + if (data[IFLA_BOND_SLAVE_QUEUE_ID]) { + u16 queue_id = nla_get_u16(data[IFLA_BOND_SLAVE_QUEUE_ID]); + char queue_id_str[IFNAMSIZ + 7]; + + /* queue_id option setting expects slave_name:queue_id */ + snprintf(queue_id_str, sizeof(queue_id_str), "%s:%u\n", + slave_dev->name, queue_id); + bond_opt_initstr(&newval, queue_id_str); + err = __bond_opt_set(bond, BOND_OPT_QUEUE_ID, &newval); + if (err) + return err; + } + + return 0; +} + static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[], struct nlattr *data[]) { @@ -553,10 +580,12 @@ struct rtnl_link_ops bond_link_ops __read_mostly = { .priv_size = sizeof(struct bonding), .setup = bond_setup, .maxtype = IFLA_BOND_MAX, + .slave_maxtype = IFLA_BOND_SLAVE_MAX, .policy = bond_policy, .validate = bond_validate, .newlink = bond_newlink, .changelink = bond_changelink, + .slave_changelink = bond_slave_changelink, .get_size = bond_get_size, .fill_info = bond_fill_info, .get_num_tx_queues = bond_get_num_tx_queues,
This patch adds support for slave_changelink to the bonding and uses it to give the ability to change the queue_id of the enslaved devices via netlink. It sets slave_maxtype and uses bond_changelink as a prototype for bond_slave_changelink. Example/test command after the iproute2 patch: ip link set eth0 type bond_slave queue_id 10 CC: David S. Miller <davem@davemloft.net> CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> Suggested-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> --- note: I intend to add a new option flag to indicate it's a slave option so a new netdev notifier can be called (NETDEV_CHANGESLAVEINFODATA). I believe the bonding is the first user of slave_changelink so I hope I haven't missed anything. Once this patch is accepted in some form I'll post the iproute2 one. drivers/net/bonding/bond_netlink.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)