be2net: Fix to configure VLAN priority for a VF interface.

Thix fix allows the VLAN priority to be configured for a VF interface
via the "ip link set DEVICE vf NUM" path.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ajit Khaparde 2013-09-27 15:18:46 -05:00 committed by David S. Miller
parent 45c459739e
commit b9fc0e53b0

View file

@ -1212,28 +1212,29 @@ static int be_set_vf_vlan(struct net_device *netdev,
int vf, u16 vlan, u8 qos) int vf, u16 vlan, u8 qos)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf];
int status = 0; int status = 0;
if (!sriov_enabled(adapter)) if (!sriov_enabled(adapter))
return -EPERM; return -EPERM;
if (vf >= adapter->num_vfs || vlan > 4095) if (vf >= adapter->num_vfs || vlan > 4095 || qos > 7)
return -EINVAL; return -EINVAL;
if (vlan) { if (vlan || qos) {
if (adapter->vf_cfg[vf].vlan_tag != vlan) { vlan |= qos << VLAN_PRIO_SHIFT;
if (vf_cfg->vlan_tag != vlan) {
/* If this is new value, program it. Else skip. */ /* If this is new value, program it. Else skip. */
adapter->vf_cfg[vf].vlan_tag = vlan; vf_cfg->vlan_tag = vlan;
status = be_cmd_set_hsw_config(adapter, vlan, vf + 1,
status = be_cmd_set_hsw_config(adapter, vlan, vf_cfg->if_handle, 0);
vf + 1, adapter->vf_cfg[vf].if_handle, 0);
} }
} else { } else {
/* Reset Transparent Vlan Tagging. */ /* Reset Transparent Vlan Tagging. */
adapter->vf_cfg[vf].vlan_tag = 0; vf_cfg->vlan_tag = 0;
vlan = adapter->vf_cfg[vf].def_vid; vlan = vf_cfg->def_vid;
status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, status = be_cmd_set_hsw_config(adapter, vlan, vf + 1,
adapter->vf_cfg[vf].if_handle, 0); vf_cfg->if_handle, 0);
} }