Skip to content

Commit

Permalink
be2net: Fix to configure VLAN priority for a VF interface.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ajit Khaparde authored and David S. Miller committed Sep 27, 2013
1 parent 45c4597 commit b9fc0e5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1212,28 +1212,29 @@ static int be_set_vf_vlan(struct net_device *netdev,
int vf, u16 vlan, u8 qos)
{
struct be_adapter *adapter = netdev_priv(netdev);
struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf];
int status = 0;

if (!sriov_enabled(adapter))
return -EPERM;

if (vf >= adapter->num_vfs || vlan > 4095)
if (vf >= adapter->num_vfs || vlan > 4095 || qos > 7)
return -EINVAL;

if (vlan) {
if (adapter->vf_cfg[vf].vlan_tag != vlan) {
if (vlan || qos) {
vlan |= qos << VLAN_PRIO_SHIFT;
if (vf_cfg->vlan_tag != vlan) {
/* If this is new value, program it. Else skip. */
adapter->vf_cfg[vf].vlan_tag = vlan;

status = be_cmd_set_hsw_config(adapter, vlan,
vf + 1, adapter->vf_cfg[vf].if_handle, 0);
vf_cfg->vlan_tag = vlan;
status = be_cmd_set_hsw_config(adapter, vlan, vf + 1,
vf_cfg->if_handle, 0);
}
} else {
/* Reset Transparent Vlan Tagging. */
adapter->vf_cfg[vf].vlan_tag = 0;
vlan = adapter->vf_cfg[vf].def_vid;
vf_cfg->vlan_tag = 0;
vlan = vf_cfg->def_vid;
status = be_cmd_set_hsw_config(adapter, vlan, vf + 1,
adapter->vf_cfg[vf].if_handle, 0);
vf_cfg->if_handle, 0);
}


Expand Down

0 comments on commit b9fc0e5

Please sign in to comment.