From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-dm3nam03on0091.outbound.protection.outlook.com ([104.47.41.91]:20832 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387961AbeITI3b (ORCPT ); Thu, 20 Sep 2018 04:29:31 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Sebastian Basierski , Jeff Kirsher , Sasha Levin Subject: [PATCH AUTOSEL 4.18 38/56] ixgbe: fix driver behaviour after issuing VFLR Date: Thu, 20 Sep 2018 02:47:53 +0000 Message-ID: <20180920024716.58490-38-alexander.levin@microsoft.com> References: <20180920024716.58490-1-alexander.levin@microsoft.com> In-Reply-To: <20180920024716.58490-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Sebastian Basierski [ Upstream commit 939b701ad63314f5aa90dcd3d866f73954945209 ] Since VFLR doesn't clear VFMBMEM (VF Mailbox Memory) and is not re-enabling queues correctly we should fix this behavior. Signed-off-by: Sebastian Basierski Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- .../net/ethernet/intel/ixgbe/ixgbe_sriov.c | 26 +++++++++++++++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 1 + 2 files changed, 27 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/e= thernet/intel/ixgbe/ixgbe_sriov.c index 6f59933cdff7..2bc4fe475f28 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -688,8 +688,13 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *= adapter, static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32= vf) { struct ixgbe_hw *hw =3D &adapter->hw; + struct ixgbe_ring_feature *vmdq =3D &adapter->ring_feature[RING_F_VMDQ]; struct vf_data_storage *vfinfo =3D &adapter->vfinfo[vf]; + u32 q_per_pool =3D __ALIGN_MASK(1, ~vmdq->mask); u8 num_tcs =3D adapter->hw_tcs; + u32 reg_val; + u32 queue; + u32 word; =20 /* remove VLAN filters beloning to this VF */ ixgbe_clear_vf_vlans(adapter, vf); @@ -726,6 +731,27 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_a= dapter *adapter, u32 vf) =20 /* reset VF api back to unknown */ adapter->vfinfo[vf].vf_api =3D ixgbe_mbox_api_10; + + /* Restart each queue for given VF */ + for (queue =3D 0; queue < q_per_pool; queue++) { + unsigned int reg_idx =3D (vf * q_per_pool) + queue; + + reg_val =3D IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(reg_idx)); + + /* Re-enabling only configured queues */ + if (reg_val) { + reg_val |=3D IXGBE_TXDCTL_ENABLE; + IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(reg_idx), reg_val); + reg_val &=3D ~IXGBE_TXDCTL_ENABLE; + IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(reg_idx), reg_val); + } + } + + /* Clear VF's mailbox memory */ + for (word =3D 0; word < IXGBE_VFMAILBOX_SIZE; word++) + IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf), word, 0); + + IXGBE_WRITE_FLUSH(hw); } =20 static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/et= hernet/intel/ixgbe/ixgbe_type.h index 44cfb2021145..41bcbb337e83 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h @@ -2518,6 +2518,7 @@ enum { /* Translated register #defines */ #define IXGBE_PVFTDH(P) (0x06010 + (0x40 * (P))) #define IXGBE_PVFTDT(P) (0x06018 + (0x40 * (P))) +#define IXGBE_PVFTXDCTL(P) (0x06028 + (0x40 * (P))) #define IXGBE_PVFTDWBAL(P) (0x06038 + (0x40 * (P))) #define IXGBE_PVFTDWBAH(P) (0x0603C + (0x40 * (P))) =20 --=20 2.17.1