aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSomnath Kotur <somnath.kotur@emulex.com>2014-01-21 05:20:55 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-22 02:12:59 -0500
commita6b74e01f072fbfec57090c3230915ef55a9068b (patch)
tree3acd8676541645da194b2dedf1523a5412e4514d
parent076d1329583ed6db92ebf05bc00335339fd369b1 (diff)
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: Kalesh AP <kalesh.purayil@emulex.com> Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 4dc96394912d..04ac9c6a0d39 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1097,8 +1097,6 @@ static int be_vid_config(struct be_adapter *adapter)
1097 dev_info(&adapter->pdev->dev, 1097 dev_info(&adapter->pdev->dev,
1098 "Disabling VLAN Promiscuous mode.\n"); 1098 "Disabling VLAN Promiscuous mode.\n");
1099 adapter->flags &= ~BE_FLAGS_VLAN_PROMISC; 1099 adapter->flags &= ~BE_FLAGS_VLAN_PROMISC;
1100 dev_info(&adapter->pdev->dev,
1101 "Re-Enabling HW VLAN filtering\n");
1102 } 1100 }
1103 } 1101 }
1104 } 1102 }
@@ -1106,12 +1104,12 @@ static int be_vid_config(struct be_adapter *adapter)
1106 return status; 1104 return status;
1107 1105
1108set_vlan_promisc: 1106set_vlan_promisc:
1109 dev_warn(&adapter->pdev->dev, "Exhausted VLAN HW filters.\n"); 1107 if (adapter->flags & BE_FLAGS_VLAN_PROMISC)
1108 return 0;
1110 1109
1111 status = be_cmd_rx_filter(adapter, BE_FLAGS_VLAN_PROMISC, ON); 1110 status = be_cmd_rx_filter(adapter, BE_FLAGS_VLAN_PROMISC, ON);
1112 if (!status) { 1111 if (!status) {
1113 dev_info(&adapter->pdev->dev, "Enable VLAN Promiscuous mode\n"); 1112 dev_info(&adapter->pdev->dev, "Enable VLAN Promiscuous mode\n");
1114 dev_info(&adapter->pdev->dev, "Disabling HW VLAN filtering\n");
1115 adapter->flags |= BE_FLAGS_VLAN_PROMISC; 1113 adapter->flags |= BE_FLAGS_VLAN_PROMISC;
1116 } else 1114 } else
1117 dev_err(&adapter->pdev->dev, 1115 dev_err(&adapter->pdev->dev,
@@ -1124,19 +1122,18 @@ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
1124 struct be_adapter *adapter = netdev_priv(netdev); 1122 struct be_adapter *adapter = netdev_priv(netdev);
1125 int status = 0; 1123 int status = 0;
1126 1124
1127
1128 /* Packets with VID 0 are always received by Lancer by default */ 1125 /* Packets with VID 0 are always received by Lancer by default */
1129 if (lancer_chip(adapter) && vid == 0) 1126 if (lancer_chip(adapter) && vid == 0)
1130 goto ret; 1127 goto ret;
1131 1128
1132 adapter->vlan_tag[vid] = 1; 1129 adapter->vlan_tag[vid] = 1;
1133 if (adapter->vlans_added <= (be_max_vlans(adapter) + 1)) 1130 adapter->vlans_added++;
1134 status = be_vid_config(adapter);
1135 1131
1136 if (!status) 1132 status = be_vid_config(adapter);
1137 adapter->vlans_added++; 1133 if (status) {
1138 else 1134 adapter->vlans_added--;
1139 adapter->vlan_tag[vid] = 0; 1135 adapter->vlan_tag[vid] = 0;
1136 }
1140ret: 1137ret:
1141 return status; 1138 return status;
1142} 1139}
@@ -1151,9 +1148,7 @@ static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid)
1151 goto ret; 1148 goto ret;
1152 1149
1153 adapter->vlan_tag[vid] = 0; 1150 adapter->vlan_tag[vid] = 0;
1154 if (adapter->vlans_added <= be_max_vlans(adapter)) 1151 status = be_vid_config(adapter);
1155 status = be_vid_config(adapter);
1156
1157 if (!status) 1152 if (!status)
1158 adapter->vlans_added--; 1153 adapter->vlans_added--;
1159 else 1154 else