diff options
author | Ajit Khaparde <ajitk@serverengines.com> | 2010-07-22 21:52:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-23 15:41:41 -0400 |
commit | e1d187353fc0597d24cf3169b1bbc1776058e883 (patch) | |
tree | efde8346b78eae97b743fb05b0e13ea3711e8421 /drivers/net/benet/be_main.c | |
parent | 1da87b7fafebb7874622602f79a5fec0425aede7 (diff) |
be2net: code to support tx rate configuration on virtual functions
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r-- | drivers/net/benet/be_main.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 46f087e3422b..79adcdd8fc5c 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -695,7 +695,7 @@ static int be_get_vf_config(struct net_device *netdev, int vf, | |||
695 | return -EINVAL; | 695 | return -EINVAL; |
696 | 696 | ||
697 | vi->vf = vf; | 697 | vi->vf = vf; |
698 | vi->tx_rate = 0; | 698 | vi->tx_rate = adapter->vf_cfg[vf].vf_tx_rate; |
699 | vi->vlan = adapter->vf_cfg[vf].vf_vlan_tag; | 699 | vi->vlan = adapter->vf_cfg[vf].vf_vlan_tag; |
700 | vi->qos = 0; | 700 | vi->qos = 0; |
701 | memcpy(&vi->mac, adapter->vf_cfg[vf].vf_mac_addr, ETH_ALEN); | 701 | memcpy(&vi->mac, adapter->vf_cfg[vf].vf_mac_addr, ETH_ALEN); |
@@ -731,6 +731,30 @@ static int be_set_vf_vlan(struct net_device *netdev, | |||
731 | return status; | 731 | return status; |
732 | } | 732 | } |
733 | 733 | ||
734 | static int be_set_vf_tx_rate(struct net_device *netdev, | ||
735 | int vf, int rate) | ||
736 | { | ||
737 | struct be_adapter *adapter = netdev_priv(netdev); | ||
738 | int status = 0; | ||
739 | |||
740 | if (!adapter->sriov_enabled) | ||
741 | return -EPERM; | ||
742 | |||
743 | if ((vf >= num_vfs) || (rate < 0)) | ||
744 | return -EINVAL; | ||
745 | |||
746 | if (rate > 10000) | ||
747 | rate = 10000; | ||
748 | |||
749 | adapter->vf_cfg[vf].vf_tx_rate = rate; | ||
750 | status = be_cmd_set_qos(adapter, rate / 10, vf); | ||
751 | |||
752 | if (status) | ||
753 | dev_info(&adapter->pdev->dev, | ||
754 | "tx rate %d on VF %d failed\n", rate, vf); | ||
755 | return status; | ||
756 | } | ||
757 | |||
734 | static void be_rx_rate_update(struct be_adapter *adapter) | 758 | static void be_rx_rate_update(struct be_adapter *adapter) |
735 | { | 759 | { |
736 | struct be_drvr_stats *stats = drvr_stats(adapter); | 760 | struct be_drvr_stats *stats = drvr_stats(adapter); |
@@ -2256,6 +2280,7 @@ static struct net_device_ops be_netdev_ops = { | |||
2256 | .ndo_vlan_rx_kill_vid = be_vlan_rem_vid, | 2280 | .ndo_vlan_rx_kill_vid = be_vlan_rem_vid, |
2257 | .ndo_set_vf_mac = be_set_vf_mac, | 2281 | .ndo_set_vf_mac = be_set_vf_mac, |
2258 | .ndo_set_vf_vlan = be_set_vf_vlan, | 2282 | .ndo_set_vf_vlan = be_set_vf_vlan, |
2283 | .ndo_set_vf_tx_rate = be_set_vf_tx_rate, | ||
2259 | .ndo_get_vf_config = be_get_vf_config | 2284 | .ndo_get_vf_config = be_get_vf_config |
2260 | }; | 2285 | }; |
2261 | 2286 | ||