• Michal Jaron's avatar
    iavf: Fix race between iavf_close and iavf_reset_task · 11c12adc
    Michal Jaron authored
    During stress tests with adding VF to namespace and changing vf's
    trust there was a race between iavf_reset_task and iavf_close.
    Sometimes when IAVF_FLAG_AQ_DISABLE_QUEUES from iavf_close was sent
    to PF after reset and before IAVF_AQ_GET_CONFIG was sent then PF
    returns error IAVF_NOT_SUPPORTED to disable queues request and
    following requests. There is need to get_config before other
    aq_required will be send but iavf_close clears all flags, if
    get_config was not sent before iavf_close, then it will not be send
    at all.
    
    In case when IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS was sent before
    IAVF_FLAG_AQ_DISABLE_QUEUES then there was rtnl_lock deadlock
    between iavf_close and iavf_adminq_task until iavf_close timeouts
    and disable queues was sent after iavf_close ends.
    
    There was also a problem with sending delete/add filters.
    Sometimes when filters was not yet added to PF and in
    iavf_close all filters was set to remove there might be a try
    to remove nonexistent filters on PF.
    
    Add aq_required_tmp to save aq_required flags and send them after
    disable_queues will be handled. Clear flags given to iavf_down
    different than IAVF_FLAG_AQ_GET_CONFIG as this flag is necessary
    to sent other aq_required. Remove some flags that we don't
    want to send as we are in iavf_close and we want to disable
    interface. Remove filters which was not yet sent and send del
    filters flags only when there are filters to remove.
    Signed-off-by: default avatarMichal Jaron <michalx.jaron@intel.com>
    Signed-off-by: default avatarMateusz Palczewski <mateusz.palczewski@intel.com>
    Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    11c12adc
iavf_main.c 144 KB