Commit 80817cbf authored by Ajit Khaparde's avatar Ajit Khaparde Committed by David S. Miller

be2net: fix be_vlan_add/rem_vid

1) fix be_vlan_add/rem_vid to return proper status
2) perform appropriate housekeeping if firmware command succeeds.
Signed-off-by: default avatarAjit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 50612537
...@@ -817,32 +817,45 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num) ...@@ -817,32 +817,45 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num)
static int be_vlan_add_vid(struct net_device *netdev, u16 vid) static int be_vlan_add_vid(struct net_device *netdev, u16 vid)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int status = 0;
adapter->vlans_added++; if (!be_physfn(adapter)) {
if (!be_physfn(adapter)) status = -EINVAL;
return 0; goto ret;
}
adapter->vlan_tag[vid] = 1; adapter->vlan_tag[vid] = 1;
if (adapter->vlans_added <= (adapter->max_vlans + 1)) if (adapter->vlans_added <= (adapter->max_vlans + 1))
be_vid_config(adapter, false, 0); status = be_vid_config(adapter, false, 0);
return 0; if (!status)
adapter->vlans_added++;
else
adapter->vlan_tag[vid] = 0;
ret:
return status;
} }
static int be_vlan_rem_vid(struct net_device *netdev, u16 vid) static int be_vlan_rem_vid(struct net_device *netdev, u16 vid)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int status = 0;
adapter->vlans_added--; if (!be_physfn(adapter)) {
status = -EINVAL;
if (!be_physfn(adapter)) goto ret;
return 0; }
adapter->vlan_tag[vid] = 0; adapter->vlan_tag[vid] = 0;
if (adapter->vlans_added <= adapter->max_vlans) if (adapter->vlans_added <= adapter->max_vlans)
be_vid_config(adapter, false, 0); status = be_vid_config(adapter, false, 0);
return 0; if (!status)
adapter->vlans_added--;
else
adapter->vlan_tag[vid] = 1;
ret:
return status;
} }
static void be_set_rx_mode(struct net_device *netdev) static void be_set_rx_mode(struct net_device *netdev)
......
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