Commit b5e281ab authored by Ganesh Goudar's avatar Ganesh Goudar Committed by David S. Miller

cxgb4: when max_tx_rate is 0 disable tx rate limiting

in ndo_set_vf_rate() when max_tx_rate is 0 disable tx
rate limiting for that vf.
Signed-off-by: default avatarCasey Leedom <leedom@chelsio.com>
Signed-off-by: default avatarGanesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4ee5489e
...@@ -2749,6 +2749,27 @@ static int cxgb4_mgmt_set_vf_rate(struct net_device *dev, int vf, ...@@ -2749,6 +2749,27 @@ static int cxgb4_mgmt_set_vf_rate(struct net_device *dev, int vf,
return -EINVAL; return -EINVAL;
} }
if (max_tx_rate == 0) {
/* unbind VF to to any Traffic Class */
fw_pfvf =
(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_PFVF) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH));
fw_class = 0xffffffff;
ret = t4_set_params(adap, adap->mbox, adap->pf, vf + 1, 1,
&fw_pfvf, &fw_class);
if (ret) {
dev_err(adap->pdev_dev,
"Err %d in unbinding PF %d VF %d from TX Rate Limiting\n",
ret, adap->pf, vf);
return -EINVAL;
}
dev_info(adap->pdev_dev,
"PF %d VF %d is unbound from TX Rate Limiting\n",
adap->pf, vf);
adap->vfinfo[vf].tx_rate = 0;
return 0;
}
ret = t4_get_link_params(pi, &link_ok, &speed, &mtu); ret = t4_get_link_params(pi, &link_ok, &speed, &mtu);
if (ret != FW_SUCCESS) { if (ret != FW_SUCCESS) {
dev_err(adap->pdev_dev, dev_err(adap->pdev_dev,
...@@ -2798,8 +2819,8 @@ static int cxgb4_mgmt_set_vf_rate(struct net_device *dev, int vf, ...@@ -2798,8 +2819,8 @@ static int cxgb4_mgmt_set_vf_rate(struct net_device *dev, int vf,
&fw_class); &fw_class);
if (ret) { if (ret) {
dev_err(adap->pdev_dev, dev_err(adap->pdev_dev,
"Err %d in binding VF %d to Traffic Class %d\n", "Err %d in binding PF %d VF %d to Traffic Class %d\n",
ret, vf, class_id); ret, adap->pf, vf, class_id);
return -EINVAL; return -EINVAL;
} }
dev_info(adap->pdev_dev, "PF %d VF %d is bound to Class %d\n", dev_info(adap->pdev_dev, "PF %d VF %d is bound to Class %d\n",
......
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