ixgbe: Fix race when the VF driver does a reset
Subsystems (3)
PATCH 1/1 ixgbe: Fix race when the VF driver does a reset
When the VF driver does a reset, it (at least the Linux one) writes to the VFCTRL register to issue a reset and then immediately sends a reset message using the mailbox API. This is racy because when the PF driver detects that the VFCTRL register reset pin has been asserted, it clears the mailbox memory. Depending on ordering, the reset message sent by the VF could be cleared by the PF driver. It then responds to the cleared message with a NACK which causes the VF driver to malfunction. Fix this by deferring clearing the mailbox memory until the reset message is received.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +10 -1
@@ -700,7 +700,6 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)u8 num_tcs = adapter->hw_tcs;u32 reg_val;u32 queue; -u32 word;/* remove VLAN filters beloning to this VF */ ixgbe_clear_vf_vlans (adapter, vf);
@@ -758,6 +757,14 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) } } +IXGBE_WRITE_FLUSH (hw); +} + +static void ixgbe_vf_clear_mbx (struct ixgbe_adapter *adapter,u32 vf) +{ +struct ixgbe_hw *hw = &adapter->hw; +u32 word; +/* Clear VF's mailbox memory */ for (word =0 ; word <IXGBE_VFMAILBOX_SIZE ; word++)IXGBE_WRITE_REG_ARRAY (hw,IXGBE_PFMBMEM (vf), word,0 );
@@ -831,6 +838,8 @@ static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)/* reset the filters for the device */ ixgbe_vf_reset_event (adapter, vf); +ixgbe_vf_clear_mbx (adapter, vf); +/* set vf mac address */ if (!is_zero_ether_addr (vf_mac))ixgbe_set_vf_mac (adapter, vf, vf_mac);
Signature · 1 line
2.17.1
Quoted 20 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Ross Lagerwall
Sent: Wednesday, December 5, 2018 5:54 AM
To: netdev at vger.kernel.org; intel-wired-lan at lists.osuosl.org
Cc: Ross Lagerwall <[email protected]>; David S. Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH] ixgbe: Fix race when the VF driver does a resetWhen the VF driver does a reset, it (at least the Linux one) writes to the VFCTRL register to issue a reset and then immediately sends a reset message using the mailbox API. This is racy because when the PF driver detects that the VFCTRL register reset pin has been asserted, it clears the mailbox memory. Depending on ordering, the reset message sent by the VF could be cleared by the PF driver. It then responds to the cleared message with a NACK which causes the VF driver to malfunction.
Fix this by deferring clearing the mailbox memory until the reset message is received.
Quoted 5 lines
Fixes 939b701ad633 ("ixgbe: fix driver behaviour after issuing VFLR")Signed-off-by Ross Lagerwall <[email protected]>--- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)