提交 10329df8 编写于 作者: S Sathya Perla 提交者: David S. Miller

be2net: cleanup be_vid_config()

- get rid of 2 unused arguments to the routine and some unused code
- don't use the term "vlan_tag" in place of "vid" as they are different
Signed-off-by: NSathya Perla <sathya.perla@emulex.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1d1e9a46
...@@ -785,19 +785,12 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -785,19 +785,12 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
* A max of 64 (BE_NUM_VLANS_SUPPORTED) vlans can be configured in BE. * A max of 64 (BE_NUM_VLANS_SUPPORTED) vlans can be configured in BE.
* If the user configures more, place BE in vlan promiscuous mode. * If the user configures more, place BE in vlan promiscuous mode.
*/ */
static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num) static int be_vid_config(struct be_adapter *adapter)
{ {
struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf_num]; u16 vids[BE_NUM_VLANS_SUPPORTED];
u16 vtag[BE_NUM_VLANS_SUPPORTED]; u16 num = 0, i;
u16 ntags = 0, i;
int status = 0; int status = 0;
if (vf) {
vtag[0] = cpu_to_le16(vf_cfg->vlan_tag);
status = be_cmd_vlan_config(adapter, vf_cfg->if_handle, vtag,
1, 1, 0);
}
/* No need to further configure vids if in promiscuous mode */ /* No need to further configure vids if in promiscuous mode */
if (adapter->promiscuous) if (adapter->promiscuous)
return 0; return 0;
...@@ -808,10 +801,10 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num) ...@@ -808,10 +801,10 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num)
/* Construct VLAN Table to give to HW */ /* Construct VLAN Table to give to HW */
for (i = 0; i < VLAN_N_VID; i++) for (i = 0; i < VLAN_N_VID; i++)
if (adapter->vlan_tag[i]) if (adapter->vlan_tag[i])
vtag[ntags++] = cpu_to_le16(i); vids[num++] = cpu_to_le16(i);
status = be_cmd_vlan_config(adapter, adapter->if_handle, status = be_cmd_vlan_config(adapter, adapter->if_handle,
vtag, ntags, 1, 0); vids, num, 1, 0);
/* Set to VLAN promisc mode as setting VLAN filter failed */ /* Set to VLAN promisc mode as setting VLAN filter failed */
if (status) { if (status) {
...@@ -840,7 +833,7 @@ static int be_vlan_add_vid(struct net_device *netdev, u16 vid) ...@@ -840,7 +833,7 @@ static int be_vlan_add_vid(struct net_device *netdev, u16 vid)
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))
status = be_vid_config(adapter, false, 0); status = be_vid_config(adapter);
if (!status) if (!status)
adapter->vlans_added++; adapter->vlans_added++;
...@@ -862,7 +855,7 @@ static int be_vlan_rem_vid(struct net_device *netdev, u16 vid) ...@@ -862,7 +855,7 @@ static int be_vlan_rem_vid(struct net_device *netdev, u16 vid)
adapter->vlan_tag[vid] = 0; adapter->vlan_tag[vid] = 0;
if (adapter->vlans_added <= adapter->max_vlans) if (adapter->vlans_added <= adapter->max_vlans)
status = be_vid_config(adapter, false, 0); status = be_vid_config(adapter);
if (!status) if (!status)
adapter->vlans_added--; adapter->vlans_added--;
...@@ -889,7 +882,7 @@ static void be_set_rx_mode(struct net_device *netdev) ...@@ -889,7 +882,7 @@ static void be_set_rx_mode(struct net_device *netdev)
be_cmd_rx_filter(adapter, IFF_PROMISC, OFF); be_cmd_rx_filter(adapter, IFF_PROMISC, OFF);
if (adapter->vlans_added) if (adapter->vlans_added)
be_vid_config(adapter, false, 0); be_vid_config(adapter);
} }
/* Enable multicast promisc if num configured exceeds what we support */ /* Enable multicast promisc if num configured exceeds what we support */
...@@ -2763,7 +2756,7 @@ static int be_setup(struct be_adapter *adapter) ...@@ -2763,7 +2756,7 @@ static int be_setup(struct be_adapter *adapter)
be_cmd_get_fw_ver(adapter, adapter->fw_ver, NULL); be_cmd_get_fw_ver(adapter, adapter->fw_ver, NULL);
if (adapter->vlans_added) if (adapter->vlans_added)
be_vid_config(adapter, false, 0); be_vid_config(adapter);
be_set_rx_mode(adapter->netdev); be_set_rx_mode(adapter->netdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册