aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliams, Mitch A <mitch.a.williams@intel.com>2010-02-24 16:59:56 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-26 07:18:35 -0500
commit4edb246626be6e031950205c885bdf29fb2ff1eb (patch)
tree0bc82da3faff62d942c838f3bc020e1081ff9bfe
parent914c8ad2d18b62ad1420f518c0cab0b0b90ab308 (diff)
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: Mitch Williams <mitch.a.williams@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/rtnetlink.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 42da96a4eeee..4dd4c3cdc442 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -930,10 +930,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
930 if (tb[IFLA_VF_MAC]) { 930 if (tb[IFLA_VF_MAC]) {
931 struct ifla_vf_mac *ivm; 931 struct ifla_vf_mac *ivm;
932 ivm = nla_data(tb[IFLA_VF_MAC]); 932 ivm = nla_data(tb[IFLA_VF_MAC]);
933 write_lock_bh(&dev_base_lock); 933 err = -EOPNOTSUPP;
934 if (ops->ndo_set_vf_mac) 934 if (ops->ndo_set_vf_mac)
935 err = ops->ndo_set_vf_mac(dev, ivm->vf, ivm->mac); 935 err = ops->ndo_set_vf_mac(dev, ivm->vf, ivm->mac);
936 write_unlock_bh(&dev_base_lock);
937 if (err < 0) 936 if (err < 0)
938 goto errout; 937 goto errout;
939 modified = 1; 938 modified = 1;
@@ -942,12 +941,11 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
942 if (tb[IFLA_VF_VLAN]) { 941 if (tb[IFLA_VF_VLAN]) {
943 struct ifla_vf_vlan *ivv; 942 struct ifla_vf_vlan *ivv;
944 ivv = nla_data(tb[IFLA_VF_VLAN]); 943 ivv = nla_data(tb[IFLA_VF_VLAN]);
945 write_lock_bh(&dev_base_lock); 944 err = -EOPNOTSUPP;
946 if (ops->ndo_set_vf_vlan) 945 if (ops->ndo_set_vf_vlan)
947 err = ops->ndo_set_vf_vlan(dev, ivv->vf, 946 err = ops->ndo_set_vf_vlan(dev, ivv->vf,
948 (u16)ivv->vlan, 947 ivv->vlan,
949 (u8)ivv->qos); 948 ivv->qos);
950 write_unlock_bh(&dev_base_lock);
951 if (err < 0) 949 if (err < 0)
952 goto errout; 950 goto errout;
953 modified = 1; 951 modified = 1;
@@ -957,10 +955,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
957 if (tb[IFLA_VF_TX_RATE]) { 955 if (tb[IFLA_VF_TX_RATE]) {
958 struct ifla_vf_tx_rate *ivt; 956 struct ifla_vf_tx_rate *ivt;
959 ivt = nla_data(tb[IFLA_VF_TX_RATE]); 957 ivt = nla_data(tb[IFLA_VF_TX_RATE]);
960 write_lock_bh(&dev_base_lock); 958 err = -EOPNOTSUPP;
961 if (ops->ndo_set_vf_tx_rate) 959 if (ops->ndo_set_vf_tx_rate)
962 err = ops->ndo_set_vf_tx_rate(dev, ivt->vf, ivt->rate); 960 err = ops->ndo_set_vf_tx_rate(dev, ivt->vf, ivt->rate);
963 write_unlock_bh(&dev_base_lock);
964 if (err < 0) 961 if (err < 0)
965 goto errout; 962 goto errout;
966 modified = 1; 963 modified = 1;