• Jacob Keller's avatar
    i40e: refactor i40e_put_mac_in_vlan to avoid changing f->vlan · 5feb3d7b
    Jacob Keller authored
    When a PVID has been assigned to a VSI, the function
    i40e_put_mac_in_vlan arbitrarily modifies all filters
    to have the same VLAN. This is obviously incorrect
    because it could be modifying active filters without
    putting them into the NEW state. The correct method
    is to remove then re-add filters which is already done
    in the code where we assign the PVID.
    
    Fix this issue and a few other minor nits at the same
    time. First, when we have a PVID don't even bother
    looping and simply add the filter with the PVID immediately.
    
    In the case of the loop, we now can remove several checks.
    We also don't need to use i40e_find_filter first before
    calling i40e_add_filter, since i40e_add_filter implicitly
    does a lookup already.
    
    Finally, update the return semantics of this function so
    that on failure to add a filter it returns NULL, but on
    success, it returns the last filter added. Otherwise,
    we're just returning the last filter in the list. An
    alternative fix might be to return 0 or an error code,
    but this is pretty invasive to every call site.
    
    Change-ID: I2325dfd843aec76d89fb0d7cb0e7c4f290a34840
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    5feb3d7b
i40e_main.c 316 KB