Commit a6b74e01 authored by Somnath Kotur's avatar Somnath Kotur Committed by David S. Miller

be2net: Fix be_vlan_add/rem_vid() routines

The current logic to put interface into VLAN Promiscous mode is not correct.
We should increment "adapter->vlans_added" before calling be_vid_config().
Also removed some unwanted log messages.
Signed-off-by: default avatarKalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: default avatarSomnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 076d1329
...@@ -1097,8 +1097,6 @@ static int be_vid_config(struct be_adapter *adapter) ...@@ -1097,8 +1097,6 @@ static int be_vid_config(struct be_adapter *adapter)
dev_info(&adapter->pdev->dev, dev_info(&adapter->pdev->dev,
"Disabling VLAN Promiscuous mode.\n"); "Disabling VLAN Promiscuous mode.\n");
adapter->flags &= ~BE_FLAGS_VLAN_PROMISC; adapter->flags &= ~BE_FLAGS_VLAN_PROMISC;
dev_info(&adapter->pdev->dev,
"Re-Enabling HW VLAN filtering\n");
} }
} }
} }
...@@ -1106,12 +1104,12 @@ static int be_vid_config(struct be_adapter *adapter) ...@@ -1106,12 +1104,12 @@ static int be_vid_config(struct be_adapter *adapter)
return status; return status;
set_vlan_promisc: set_vlan_promisc:
dev_warn(&adapter->pdev->dev, "Exhausted VLAN HW filters.\n"); if (adapter->flags & BE_FLAGS_VLAN_PROMISC)
return 0;
status = be_cmd_rx_filter(adapter, BE_FLAGS_VLAN_PROMISC, ON); status = be_cmd_rx_filter(adapter, BE_FLAGS_VLAN_PROMISC, ON);
if (!status) { if (!status) {
dev_info(&adapter->pdev->dev, "Enable VLAN Promiscuous mode\n"); dev_info(&adapter->pdev->dev, "Enable VLAN Promiscuous mode\n");
dev_info(&adapter->pdev->dev, "Disabling HW VLAN filtering\n");
adapter->flags |= BE_FLAGS_VLAN_PROMISC; adapter->flags |= BE_FLAGS_VLAN_PROMISC;
} else } else
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
...@@ -1124,19 +1122,18 @@ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid) ...@@ -1124,19 +1122,18 @@ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int status = 0; int status = 0;
/* Packets with VID 0 are always received by Lancer by default */ /* Packets with VID 0 are always received by Lancer by default */
if (lancer_chip(adapter) && vid == 0) if (lancer_chip(adapter) && vid == 0)
goto ret; goto ret;
adapter->vlan_tag[vid] = 1; adapter->vlan_tag[vid] = 1;
if (adapter->vlans_added <= (be_max_vlans(adapter) + 1)) adapter->vlans_added++;
status = be_vid_config(adapter);
if (!status) status = be_vid_config(adapter);
adapter->vlans_added++; if (status) {
else adapter->vlans_added--;
adapter->vlan_tag[vid] = 0; adapter->vlan_tag[vid] = 0;
}
ret: ret:
return status; return status;
} }
...@@ -1151,9 +1148,7 @@ static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid) ...@@ -1151,9 +1148,7 @@ static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid)
goto ret; goto ret;
adapter->vlan_tag[vid] = 0; adapter->vlan_tag[vid] = 0;
if (adapter->vlans_added <= be_max_vlans(adapter)) status = be_vid_config(adapter);
status = be_vid_config(adapter);
if (!status) if (!status)
adapter->vlans_added--; adapter->vlans_added--;
else else
......
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