aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio
diff options
context:
space:
mode:
authorGanesh Goudar <ganeshgr@chelsio.com>2018-05-10 16:07:23 +0530
committerDavid S. Miller <davem@davemloft.net>2018-05-10 17:52:02 -0400
commitb3c594ab6fcf7a91453442755deb1f3941eeed64 (patch)
tree3cb4f0422c97a6fdf4b92d6dc801f9147ebe6bc9 /drivers/net/ethernet/chelsio
parentMerge branch 'mlxsw-Support-VLAN-devices-in-mirroring-offloads' (diff)
downloadlinux-dev-b3c594ab6fcf7a91453442755deb1f3941eeed64.tar.xz
linux-dev-b3c594ab6fcf7a91453442755deb1f3941eeed64.zip
cxgb4: fix the wrong conversion of Mbps to Kbps
fix the wrong conversion where 1 Mbps was converted to 1024 Kbps. Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 24d2865b8806..1efcc85692f7 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2886,13 +2886,13 @@ static int cxgb_set_tx_maxrate(struct net_device *dev, int index, u32 rate)
}
/* Convert from Mbps to Kbps */
- req_rate = rate << 10;
+ req_rate = rate * 1000;
/* Max rate is 100 Gbps */
- if (req_rate >= SCHED_MAX_RATE_KBPS) {
+ if (req_rate > SCHED_MAX_RATE_KBPS) {
dev_err(adap->pdev_dev,
"Invalid rate %u Mbps, Max rate is %u Mbps\n",
- rate, SCHED_MAX_RATE_KBPS >> 10);
+ rate, SCHED_MAX_RATE_KBPS / 1000);
return -ERANGE;
}