• Björn Töpel's avatar
    i40e: fix XDP_REDIRECT/XDP xmit ring cleanup race · 59eb2a88
    Björn Töpel authored
    When the driver clears the XDP xmit ring due to re-configuration or
    teardown, in-progress ndo_xdp_xmit must be taken into consideration.
    
    The ndo_xdp_xmit function is typically called from a NAPI context that
    the driver does not control. Therefore, we must be careful not to
    clear the XDP ring, while the call is on-going. This patch adds a
    synchronize_rcu() to wait for napi(s) (preempt-disable regions and
    softirqs), prior clearing the queue. Further, the __I40E_CONFIG_BUSY
    flag is checked in the ndo_xdp_xmit implementation to avoid touching
    the XDP xmit queue during re-configuration.
    
    Fixes: d9314c47 ("i40e: add support for XDP_REDIRECT")
    Fixes: 123cecd4 ("i40e: added queue pair disable/enable functions")
    Reported-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
    Signed-off-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    59eb2a88
i40e_txrx.c 105 KB