Commit 4edb2466 authored by Williams, Mitch A's avatar Williams, Mitch A Committed by David S. Miller

rtnetlink: clean up SR-IOV config interface

This patch consists of a few minor cleanups to the SR-IOV
configurion code in rtnetlink.
- Remove unneccesary lock
- Remove unneccesary casts
- Return correct error code for no driver support

These changes are based on comments from Patrick McHardy
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 914c8ad2
...@@ -930,10 +930,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, ...@@ -930,10 +930,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
if (tb[IFLA_VF_MAC]) { if (tb[IFLA_VF_MAC]) {
struct ifla_vf_mac *ivm; struct ifla_vf_mac *ivm;
ivm = nla_data(tb[IFLA_VF_MAC]); ivm = nla_data(tb[IFLA_VF_MAC]);
write_lock_bh(&dev_base_lock); err = -EOPNOTSUPP;
if (ops->ndo_set_vf_mac) if (ops->ndo_set_vf_mac)
err = ops->ndo_set_vf_mac(dev, ivm->vf, ivm->mac); err = ops->ndo_set_vf_mac(dev, ivm->vf, ivm->mac);
write_unlock_bh(&dev_base_lock);
if (err < 0) if (err < 0)
goto errout; goto errout;
modified = 1; modified = 1;
...@@ -942,12 +941,11 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, ...@@ -942,12 +941,11 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
if (tb[IFLA_VF_VLAN]) { if (tb[IFLA_VF_VLAN]) {
struct ifla_vf_vlan *ivv; struct ifla_vf_vlan *ivv;
ivv = nla_data(tb[IFLA_VF_VLAN]); ivv = nla_data(tb[IFLA_VF_VLAN]);
write_lock_bh(&dev_base_lock); err = -EOPNOTSUPP;
if (ops->ndo_set_vf_vlan) if (ops->ndo_set_vf_vlan)
err = ops->ndo_set_vf_vlan(dev, ivv->vf, err = ops->ndo_set_vf_vlan(dev, ivv->vf,
(u16)ivv->vlan, ivv->vlan,
(u8)ivv->qos); ivv->qos);
write_unlock_bh(&dev_base_lock);
if (err < 0) if (err < 0)
goto errout; goto errout;
modified = 1; modified = 1;
...@@ -957,10 +955,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, ...@@ -957,10 +955,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
if (tb[IFLA_VF_TX_RATE]) { if (tb[IFLA_VF_TX_RATE]) {
struct ifla_vf_tx_rate *ivt; struct ifla_vf_tx_rate *ivt;
ivt = nla_data(tb[IFLA_VF_TX_RATE]); ivt = nla_data(tb[IFLA_VF_TX_RATE]);
write_lock_bh(&dev_base_lock); err = -EOPNOTSUPP;
if (ops->ndo_set_vf_tx_rate) if (ops->ndo_set_vf_tx_rate)
err = ops->ndo_set_vf_tx_rate(dev, ivt->vf, ivt->rate); err = ops->ndo_set_vf_tx_rate(dev, ivt->vf, ivt->rate);
write_unlock_bh(&dev_base_lock);
if (err < 0) if (err < 0)
goto errout; goto errout;
modified = 1; modified = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment