• Jacob Keller's avatar
    i40e: use (add|rm)_vlan_all_mac helper functions when changing PVID · 9af52f60
    Jacob Keller authored
    The current flow for adding or updating the PVID for a VF uses
    i40e_vsi_add_vlan and i40e_vsi_kill_vlan which each take, then release
    the hash lock. In addition the two functions also must take special care
    that they do not perform VLAN mode changes as this will make the code in
    i40e_ndo_set_vf_port_vlan behave incorrectly.
    
    Fix these issues by using the new helper functions i40e_add_vlan_all_mac
    and i40e_rm_vlan_all_mac which expect the hash lock to already be taken.
    Additionally these functions do not perform any state updates in regards
    to VLAN mode, so they are safe to use in the PVID update flow.
    
    It should be noted that we don't need the VLAN mode update code here,
    because there are only a few flows here.
    
    (a) we're adding a new PVID
      In this case, if we already had VLAN filters the VSI is knocked
      offline so we don't need to worry about pre-existing VLAN filters
    
    (b) we're replacing an existing PVID
      In this case, we can't have any VLAN filters except those with the old
      PVID which we already take care of manually.
    
    (c) we're removing an existing PVID
      Similarly to above, we can't have any existing VLAN filters except
      those with the old PVID which we already take care of correctly.
    
    Because of this, we do not need (or even want) the special accounting
    done in i40e_vsi_add_vlan, so use of the helpers is a saner alternative.
    It also opens the door for a future patch which will refactor the flow
    of i40e_vsi_add_vlan now that it is not needed in this function.
    
    Change-ID: Ia841f63da94e12b106f41cf7d28ce8ce92f2ad99
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    9af52f60
i40e_virtchnl_pf.c 84.9 KB