diff options
author | Ajit Khaparde <ajit.khaparde@emulex.com> | 2011-12-30 12:15:12 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-30 17:19:21 -0500 |
commit | 80817cbf5ac13da76f3ee2b9259f26c09b385e84 (patch) | |
tree | 43d9a1de7211ac7c7c90e75e3a394eb78b395151 /drivers | |
parent | 50612537e9ab29693122fab20fc1eed235054ffe (diff) | |
download | blackbird-op-linux-80817cbf5ac13da76f3ee2b9259f26c09b385e84.tar.gz blackbird-op-linux-80817cbf5ac13da76f3ee2b9259f26c09b385e84.zip |
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: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 76f3a985e1d5..10f2313edbe7 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -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) { struct be_adapter *adapter = netdev_priv(netdev); + int status = 0; - adapter->vlans_added++; - if (!be_physfn(adapter)) - return 0; + if (!be_physfn(adapter)) { + status = -EINVAL; + goto ret; + } adapter->vlan_tag[vid] = 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) { struct be_adapter *adapter = netdev_priv(netdev); + int status = 0; - adapter->vlans_added--; - - if (!be_physfn(adapter)) - return 0; + if (!be_physfn(adapter)) { + status = -EINVAL; + goto ret; + } adapter->vlan_tag[vid] = 0; 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) |