aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex/benet/be_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/emulex/benet/be_main.c')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index f1b092692aa5..cfbec8b495cb 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -785,19 +785,12 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
785 * A max of 64 (BE_NUM_VLANS_SUPPORTED) vlans can be configured in BE. 785 * A max of 64 (BE_NUM_VLANS_SUPPORTED) vlans can be configured in BE.
786 * If the user configures more, place BE in vlan promiscuous mode. 786 * If the user configures more, place BE in vlan promiscuous mode.
787 */ 787 */
788static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num) 788static int be_vid_config(struct be_adapter *adapter)
789{ 789{
790 struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf_num]; 790 u16 vids[BE_NUM_VLANS_SUPPORTED];
791 u16 vtag[BE_NUM_VLANS_SUPPORTED]; 791 u16 num = 0, i;
792 u16 ntags = 0, i;
793 int status = 0; 792 int status = 0;
794 793
795 if (vf) {
796 vtag[0] = cpu_to_le16(vf_cfg->vlan_tag);
797 status = be_cmd_vlan_config(adapter, vf_cfg->if_handle, vtag,
798 1, 1, 0);
799 }
800
801 /* No need to further configure vids if in promiscuous mode */ 794 /* No need to further configure vids if in promiscuous mode */
802 if (adapter->promiscuous) 795 if (adapter->promiscuous)
803 return 0; 796 return 0;
@@ -808,10 +801,10 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num)
808 /* Construct VLAN Table to give to HW */ 801 /* Construct VLAN Table to give to HW */
809 for (i = 0; i < VLAN_N_VID; i++) 802 for (i = 0; i < VLAN_N_VID; i++)
810 if (adapter->vlan_tag[i]) 803 if (adapter->vlan_tag[i])
811 vtag[ntags++] = cpu_to_le16(i); 804 vids[num++] = cpu_to_le16(i);
812 805
813 status = be_cmd_vlan_config(adapter, adapter->if_handle, 806 status = be_cmd_vlan_config(adapter, adapter->if_handle,
814 vtag, ntags, 1, 0); 807 vids, num, 1, 0);
815 808
816 /* Set to VLAN promisc mode as setting VLAN filter failed */ 809 /* Set to VLAN promisc mode as setting VLAN filter failed */
817 if (status) { 810 if (status) {
@@ -840,7 +833,7 @@ static int be_vlan_add_vid(struct net_device *netdev, u16 vid)
840 833
841 adapter->vlan_tag[vid] = 1; 834 adapter->vlan_tag[vid] = 1;
842 if (adapter->vlans_added <= (adapter->max_vlans + 1)) 835 if (adapter->vlans_added <= (adapter->max_vlans + 1))
843 status = be_vid_config(adapter, false, 0); 836 status = be_vid_config(adapter);
844 837
845 if (!status) 838 if (!status)
846 adapter->vlans_added++; 839 adapter->vlans_added++;
@@ -862,7 +855,7 @@ static int be_vlan_rem_vid(struct net_device *netdev, u16 vid)
862 855
863 adapter->vlan_tag[vid] = 0; 856 adapter->vlan_tag[vid] = 0;
864 if (adapter->vlans_added <= adapter->max_vlans) 857 if (adapter->vlans_added <= adapter->max_vlans)
865 status = be_vid_config(adapter, false, 0); 858 status = be_vid_config(adapter);
866 859
867 if (!status) 860 if (!status)
868 adapter->vlans_added--; 861 adapter->vlans_added--;
@@ -889,7 +882,7 @@ static void be_set_rx_mode(struct net_device *netdev)
889 be_cmd_rx_filter(adapter, IFF_PROMISC, OFF); 882 be_cmd_rx_filter(adapter, IFF_PROMISC, OFF);
890 883
891 if (adapter->vlans_added) 884 if (adapter->vlans_added)
892 be_vid_config(adapter, false, 0); 885 be_vid_config(adapter);
893 } 886 }
894 887
895 /* Enable multicast promisc if num configured exceeds what we support */ 888 /* Enable multicast promisc if num configured exceeds what we support */
@@ -2763,7 +2756,7 @@ static int be_setup(struct be_adapter *adapter)
2763 be_cmd_get_fw_ver(adapter, adapter->fw_ver, NULL); 2756 be_cmd_get_fw_ver(adapter, adapter->fw_ver, NULL);
2764 2757
2765 if (adapter->vlans_added) 2758 if (adapter->vlans_added)
2766 be_vid_config(adapter, false, 0); 2759 be_vid_config(adapter);
2767 2760
2768 be_set_rx_mode(adapter->netdev); 2761 be_set_rx_mode(adapter->netdev);
2769 2762