• Ahmed Zaki's avatar
    iavf: remove active_cvlans and active_svlans bitmaps · 9c85b7fa
    Ahmed Zaki authored
    The VLAN filters info is currently being held in a list and 2 bitmaps
    (active_cvlans and active_svlans). We are experiencing some racing where
    data is not in sync in the list and bitmaps. For example, the VLAN is
    initially added to the list but only when the PF replies, it is added to
    the bitmap. If a user adds many V2 VLANS before the PF responds:
    
        while [ $((i++)) ]
            ip l add l eth0 name eth0.$i type vlan id $i
    
    we might end up with more VLAN list entries than the designated limit.
    Also, The "ip link show" will show more links added than the PF limit.
    
    On the other and, the bitmaps are only used to check the number of VLAN
    filters and to re-enable the filters when the interface goes from DOWN to
    UP.
    
    This patch gets rid of the bitmaps and uses the list only. To do that,
    the states of the VLAN filter are modified:
    1 - IAVF_VLAN_REMOVE: the entry needs to be totally removed after informing
      the PF. This is the "ip link del eth0.$i" path.
    2 - IAVF_VLAN_DISABLE: (new) the netdev went down. The filter needs to be
      removed from the PF and then marked INACTIVE.
    3 - IAVF_VLAN_INACTIVE: (new) no PF filter exists, but the user did not
      delete the VLAN.
    
    Fixes: 48ccc43e ("iavf: Add support VIRTCHNL_VF_OFFLOAD_VLAN_V2 during netdev config")
    Signed-off-by: default avatarAhmed Zaki <ahmed.zaki@intel.com>
    Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    9c85b7fa
iavf_virtchnl.c 69.3 KB