summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/emulex
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@emulex.com>2011-12-30 16:15:30 +0400
committerDavid S. Miller <davem@davemloft.net>2011-12-31 02:19:21 +0400
commit94f434c2055db5fe20f10d4e0ec50ab395e1f62b (patch)
treee64ef47b5b826dc98e6f6224b715892e460aa58d /drivers/net/ethernet/emulex
parent80817cbf5ac13da76f3ee2b9259f26c09b385e84 (diff)
downloadlinux-94f434c2055db5fe20f10d4e0ec50ab395e1f62b.tar.xz
be2net: fix range check for set_qos for a VF
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 10f2313edbe7..fe702c1c866d 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -978,18 +978,22 @@ static int be_set_vf_tx_rate(struct net_device *netdev,
if (!sriov_enabled(adapter))
return -EPERM;
- if (vf >= adapter->num_vfs || rate < 0)
+ if (vf >= adapter->num_vfs)
return -EINVAL;
- if (rate > 10000)
- rate = 10000;
+ if (rate < 100 || rate > 10000) {
+ dev_err(&adapter->pdev->dev,
+ "tx rate must be between 100 and 10000 Mbps\n");
+ return -EINVAL;
+ }
- adapter->vf_cfg[vf].tx_rate = rate;
status = be_cmd_set_qos(adapter, rate / 10, vf + 1);
if (status)
- dev_info(&adapter->pdev->dev,
+ dev_err(&adapter->pdev->dev,
"tx rate %d on VF %d failed\n", rate, vf);
+ else
+ adapter->vf_cfg[vf].tx_rate = rate;
return status;
}