• Jacob Keller's avatar
    fm10k: don't re-map queues when a mailbox message suffices · 325782a1
    Jacob Keller authored
    When the PF assigns a new MAC address to a VF it uses the base address
    registers to store the MAC address. This allows a VF which loads after
    this setup the ability to get the initial address without having to wait
    for a mailbox message. Unfortunately to do this, the PF must take queue
    ownership away from the VF, which can cause fault errors when there is
    already an active VF driver.
    
    This queue ownership assignment causes race condition between the PF and
    the VF such that potentially a VF can cause FUM fault errors due to
    normal PF/VF driver behavior.
    
    It is not safe to simply allow the PF to write the base address
    registers without taking queue ownership back as the PF must also
    disable the queues, and this would impact active VF use. The current
    code is safe because the queue ownership will prevent the VF from
    actually writing but does trigger the FUM fault.
    
    We can do better by simply avoiding the register write process when
    a mailbox message suffices. If the message can be sent over the mailbox,
    then we will not perform the queue ownership assignment and we won't
    update the base address to be the same as the MAC address.
    
    We do still have to write the TXQCTL registers in order to update the
    VID of the queue. This is necessary because the TXQCTL register is
    read-only from the VF, and thus the VF cannot do this for itself. This
    register does not need to wait for the Tx queue to be disabled and is
    safe for the PF to write during normal VF operation, so we move this
    write to the top of the function above the mailbox message. Without
    this, the TXQCTL register would be misconfigured and cause the VF to Tx
    hang.
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Tested-by: default avatarKrishneil Singh <Krishneil.k.singh@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    325782a1
fm10k_pf.c 57.1 KB