Commit 10e11aa2 authored by Bin Chen's avatar Bin Chen Committed by Jakub Kicinski

ethernet: Remove vf rate limit check for drivers

The commit a14857c2 ("rtnetlink: verify rate parameters for calls to
ndo_set_vf_rate") has been merged to master, so we can to remove the
now-duplicate checks in drivers.
Signed-off-by: default avatarBin Chen <bin.chen@corigine.com>
Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20220609084717.155154-1-simon.horman@corigine.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 68c51dd9
...@@ -307,7 +307,7 @@ int bnxt_set_vf_bw(struct net_device *dev, int vf_id, int min_tx_rate, ...@@ -307,7 +307,7 @@ int bnxt_set_vf_bw(struct net_device *dev, int vf_id, int min_tx_rate,
return -EINVAL; return -EINVAL;
} }
if (min_tx_rate > pf_link_speed || min_tx_rate > max_tx_rate) { if (min_tx_rate > pf_link_speed) {
netdev_info(bp->dev, "min tx rate %d is invalid for VF %d\n", netdev_info(bp->dev, "min tx rate %d is invalid for VF %d\n",
min_tx_rate, vf_id); min_tx_rate, vf_id);
return -EINVAL; return -EINVAL;
......
...@@ -852,12 +852,6 @@ int hinic_ndo_set_vf_bw(struct net_device *netdev, ...@@ -852,12 +852,6 @@ int hinic_ndo_set_vf_bw(struct net_device *netdev,
return -EINVAL; return -EINVAL;
} }
if (max_tx_rate < min_tx_rate) {
netif_err(nic_dev, drv, netdev, "Max rate %d must be greater than or equal to min rate %d\n",
max_tx_rate, min_tx_rate);
return -EINVAL;
}
err = hinic_port_link_state(nic_dev, &link_state); err = hinic_port_link_state(nic_dev, &link_state);
if (err) { if (err) {
netif_err(nic_dev, drv, netdev, netif_err(nic_dev, drv, netdev,
......
...@@ -1593,16 +1593,6 @@ ice_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate, ...@@ -1593,16 +1593,6 @@ ice_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
goto out_put_vf; goto out_put_vf;
} }
/* when max_tx_rate is zero that means no max Tx rate limiting, so only
* check if max_tx_rate is non-zero
*/
if (max_tx_rate && min_tx_rate > max_tx_rate) {
dev_err(dev, "Cannot set min Tx rate %d Mbps greater than max Tx rate %d Mbps\n",
min_tx_rate, max_tx_rate);
ret = -EINVAL;
goto out_put_vf;
}
if (min_tx_rate && ice_is_dcb_active(pf)) { if (min_tx_rate && ice_is_dcb_active(pf)) {
dev_err(dev, "DCB on PF is currently enabled. VF min Tx rate limiting not allowed on this PF.\n"); dev_err(dev, "DCB on PF is currently enabled. VF min Tx rate limiting not allowed on this PF.\n");
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
......
...@@ -1869,8 +1869,7 @@ int qlcnic_sriov_set_vf_tx_rate(struct net_device *netdev, int vf, ...@@ -1869,8 +1869,7 @@ int qlcnic_sriov_set_vf_tx_rate(struct net_device *netdev, int vf,
if (!min_tx_rate) if (!min_tx_rate)
min_tx_rate = QLC_VF_MIN_TX_RATE; min_tx_rate = QLC_VF_MIN_TX_RATE;
if (max_tx_rate && if (max_tx_rate && max_tx_rate >= 10000) {
(max_tx_rate >= 10000 || max_tx_rate < min_tx_rate)) {
netdev_err(netdev, netdev_err(netdev,
"Invalid max Tx rate, allowed range is [%d - %d]", "Invalid max Tx rate, allowed range is [%d - %d]",
min_tx_rate, QLC_VF_MAX_TX_RATE); min_tx_rate, QLC_VF_MAX_TX_RATE);
...@@ -1880,8 +1879,7 @@ int qlcnic_sriov_set_vf_tx_rate(struct net_device *netdev, int vf, ...@@ -1880,8 +1879,7 @@ int qlcnic_sriov_set_vf_tx_rate(struct net_device *netdev, int vf,
if (!max_tx_rate) if (!max_tx_rate)
max_tx_rate = 10000; max_tx_rate = 10000;
if (min_tx_rate && if (min_tx_rate && min_tx_rate < QLC_VF_MIN_TX_RATE) {
(min_tx_rate > max_tx_rate || min_tx_rate < QLC_VF_MIN_TX_RATE)) {
netdev_err(netdev, netdev_err(netdev,
"Invalid min Tx rate, allowed range is [%d - %d]", "Invalid min Tx rate, allowed range is [%d - %d]",
QLC_VF_MIN_TX_RATE, max_tx_rate); QLC_VF_MIN_TX_RATE, max_tx_rate);
......
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