Skip to contentSkip to conversation

net/qede: Fix VF re-load failure after ungraceful termination of DPDK

PATCH In review Manish Chopra 3 participants 4 messages Feb 6, 2020 – Feb 15, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/qede: Fix VF re-load failure after ungraceful termination of DPDK

On ungraceful termination of DPDK application, PMD VF driver fails to re-load due to PF seeing the VF in unexpected state during VF acquisition handshake.

This patch fixes it by allowing VF to request the PF for soft FLR during the load in such cases so that it can get cleanly re-loaded.

Fixes 2ea6f76aff40 ("qede: add core driver")
---
 drivers/net/qede/base/ecore_dev.c     |  2 +-
 drivers/net/qede/base/ecore_dev_api.h |  3 ++
 drivers/net/qede/base/ecore_iov_api.h |  1 +
 drivers/net/qede/base/ecore_sriov.c   | 33 ++++++++++++++++
 drivers/net/qede/base/ecore_vf.c      | 55 +++++++++++++++++++++++++--
 drivers/net/qede/base/ecore_vf.h      | 11 +++++-
 drivers/net/qede/base/ecore_vf_api.h  |  3 ++
 drivers/net/qede/base/ecore_vfpf_if.h | 41 ++++++++++++++++++++
 drivers/net/qede/base/mcp_public.h    |  2 +
 drivers/net/qede/qede_main.c          |  4 ++
 10 files changed, 149 insertions(+), 6 deletions(-)
drivers/net/qede/base/ecore_dev.c +1 -1
index f33b9910c..86ecfb269 100644
@@ -5617,7 +5617,7 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void OSAL_IOMEM *p_regview,
 	p_hwfn->db_phys_addr = db_phys_addr;
 
 	if (IS_VF(p_dev))
-		return ecore_vf_hw_prepare(p_hwfn);
+		return ecore_vf_hw_prepare(p_hwfn, p_params);
 
 	/* Validate that chip access is feasible */
 	if (REG_RD(p_hwfn, PXP_PF_ME_OPAQUE_ADDR) == 0xffffffff) {
drivers/net/qede/base/ecore_dev_api.h +3 -0
index 4d5cc1a0f..5ea8427a0 100644
@@ -277,6 +277,9 @@ struct ecore_hw_prepare_params {
 
 	/* Indicates whether this PF serves a storage target */
 	bool b_is_target;
+
+	/* retry count for VF acquire on channel timeout */
+	u8 acquire_retry_cnt;
 };
 
 /**
drivers/net/qede/base/ecore_iov_api.h +1 -0
index c998dbf8d..545001812 100644
@@ -51,6 +51,7 @@ enum ecore_iov_pf_to_vf_status {
 	PFVF_STATUS_NO_RESOURCE,
 	PFVF_STATUS_FORCED,
 	PFVF_STATUS_MALICIOUS,
+	PFVF_STATUS_ACQUIRED,
 };
 
 struct ecore_mcp_link_params;
drivers/net/qede/base/ecore_sriov.c +33 -0
index deee04ac4..e60257e19 100644
@@ -61,6 +61,39 @@ const char *qede_ecore_channel_tlvs_string[] = {
 	"CHANNEL_TLV_COALESCE_READ",
 	"CHANNEL_TLV_BULLETIN_UPDATE_MAC",
 	"CHANNEL_TLV_UPDATE_MTU",
+	"CHANNEL_TLV_RDMA_ACQUIRE",
+	"CHANNEL_TLV_RDMA_START",
+	"CHANNEL_TLV_RDMA_STOP",
+	"CHANNEL_TLV_RDMA_ADD_USER",
+	"CHANNEL_TLV_RDMA_REMOVE_USER",
+	"CHANNEL_TLV_RDMA_QUERY_COUNTERS",
+	"CHANNEL_TLV_RDMA_ALLOC_TID",
+	"CHANNEL_TLV_RDMA_REGISTER_TID",
+	"CHANNEL_TLV_RDMA_DEREGISTER_TID",
+	"CHANNEL_TLV_RDMA_FREE_TID",
+	"CHANNEL_TLV_RDMA_CREATE_CQ",
+	"CHANNEL_TLV_RDMA_RESIZE_CQ",
+	"CHANNEL_TLV_RDMA_DESTROY_CQ",
+	"CHANNEL_TLV_RDMA_CREATE_QP",
+	"CHANNEL_TLV_RDMA_MODIFY_QP",
+	"CHANNEL_TLV_RDMA_QUERY_QP",
+	"CHANNEL_TLV_RDMA_DESTROY_QP",
+	"CHANNEL_TLV_RDMA_CREATE_SRQ",
+	"CHANNEL_TLV_RDMA_MODIFY_SRQ",
+	"CHANNEL_TLV_RDMA_DESTROY_SRQ",
+	"CHANNEL_TLV_RDMA_QUERY_PORT",
+	"CHANNEL_TLV_RDMA_QUERY_DEVICE",
+	"CHANNEL_TLV_RDMA_IWARP_CONNECT",
+	"CHANNEL_TLV_RDMA_IWARP_ACCEPT",
+	"CHANNEL_TLV_RDMA_IWARP_CREATE_LISTEN",
+	"CHANNEL_TLV_RDMA_IWARP_DESTROY_LISTEN",
+	"CHANNEL_TLV_RDMA_IWARP_PAUSE_LISTEN",
+	"CHANNEL_TLV_RDMA_IWARP_REJECT",
+	"CHANNEL_TLV_RDMA_IWARP_SEND_RTR",
+	"CHANNEL_TLV_ESTABLISH_LL2_CONN",
+	"CHANNEL_TLV_TERMINATE_LL2_CONN",
+	"CHANNEL_TLV_ASYNC_EVENT",
+	"CHANNEL_TLV_SOFT_FLR",
 	"CHANNEL_TLV_MAX"
 };
 
drivers/net/qede/base/ecore_vf.c +51 -4

103 lines not on this page · raw message

drivers/net/qede/base/ecore_vf.h +10 -1
index a07f82ebd..f027eba3e 100644
@@ -11,6 +11,7 @@
 #include "ecore_vf_api.h"
 #include "ecore_l2_api.h"
 #include "ecore_vfpf_if.h"
+#include "ecore_dev_api.h"
 
 /* Default number of CIDs [total of both Rx and Tx] to be requested
  * by default.
@@ -59,6 +60,9 @@ struct ecore_vf_iov {
 	 * bar or via the doorbell bar.
 	 */
 	bool b_doorbell_bar;
+
+	/* retry count for VF acquire on channel timeout */
+	u8 acquire_retry_cnt;
 };
 
 /**
@@ -72,6 +76,8 @@ struct ecore_vf_iov {
 enum _ecore_status_t ecore_vf_pf_get_coalesce(struct ecore_hwfn *p_hwfn,
 					      u16 *p_coal,
 					      struct ecore_queue_cid *p_cid);
+
+enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn);
 /**
  * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
  *             Coalesce value '0' will omit the configuration.
@@ -92,10 +98,13 @@ enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
  *	sends ACQUIRE message
  *
  * @param p_hwfn
+ * @param p_params
  *
  * @return enum _ecore_status_t
  */
-enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn);
+enum _ecore_status_t
+ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn,
+		    struct ecore_hw_prepare_params *p_params);
 
 /**
  * @brief VF - start the RX Queue by sending a message to the PF
drivers/net/qede/base/ecore_vf_api.h +3 -0
index 1a9fb3b1f..43951a9a3 100644
@@ -11,6 +11,9 @@
 #include "ecore_mcp_api.h"
 
 #ifdef CONFIG_ECORE_SRIOV
+
+#define ECORE_VF_ACQUIRE_THRESH 3
+
 /**
  * @brief Read the VF bulletin and act on it if needed
  *
drivers/net/qede/base/ecore_vfpf_if.h +41 -0

59 lines not on this page · raw message

drivers/net/qede/base/mcp_public.h +2 -0
index 98b9723dd..6667c2d7a 100644
@@ -1290,6 +1290,7 @@ struct public_drv_mb {
 /*deprecated don't use*/
 #define DRV_MSG_CODE_INITIATE_FLR_DEPRECATED    0x02000000
 #define DRV_MSG_CODE_INITIATE_PF_FLR            0x02010000
+#define DRV_MSG_CODE_INITIATE_VF_FLR		0x02020000
 #define DRV_MSG_CODE_VF_DISABLED_DONE           0xc0000000
 #define DRV_MSG_CODE_CFG_VF_MSIX                0xc0010000
 #define DRV_MSG_CODE_CFG_PF_VFS_MSIX            0xc0020000
@@ -1749,6 +1750,7 @@ struct public_drv_mb {
 #define FW_MSG_CODE_NIG_DRAIN_DONE              0x30000000
 #define FW_MSG_CODE_VF_DISABLED_DONE            0xb0000000
 #define FW_MSG_CODE_DRV_CFG_VF_MSIX_DONE        0xb0010000
+#define FW_MSG_CODE_INITIATE_VF_FLR_OK		0xb0030000
 #define FW_MSG_CODE_ERR_RESOURCE_TEMPORARY_UNAVAILABLE	0x008b0000
 #define FW_MSG_CODE_ERR_RESOURCE_ALREADY_ALLOCATED	0x008c0000
 #define FW_MSG_CODE_ERR_RESOURCE_NOT_ALLOCATED		0x008d0000
drivers/net/qede/qede_main.c +4 -0
index 4eb79d0fb..8580cbcd7 100644
@@ -56,6 +56,10 @@ qed_probe(struct ecore_dev *edev, struct rte_pci_device *pci_dev,
 	qed_init_pci(edev, pci_dev);
 
 	memset(&hw_prepare_params, 0, sizeof(hw_prepare_params));
+
+	if (is_vf)
+		hw_prepare_params.acquire_retry_cnt = ECORE_VF_ACQUIRE_THRESH;
+
 	hw_prepare_params.personality = ECORE_PCI_ETH;
 	hw_prepare_params.drv_resc_alloc = false;
 	hw_prepare_params.chk_reg_fifo = false;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 net/qede: Do not stop vport if not started.

Stopping an already disabled vport leads to firmware assert. Stop the vport only if it was started.

Fixes 2ea6f76aff40 ("qede: add core driver")
---
 drivers/net/qede/qede_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/qede/qede_ethdev.c +2 -1
index 500440c2c..74dfe895a 100644
@@ -1509,7 +1509,8 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
 	if (eth_dev->data->dev_started)
 		qede_dev_stop(eth_dev);
 
-	qede_stop_vport(edev);
+	if (qdev->vport_started)
+		qede_stop_vport(edev);
 	qdev->vport_started = false;
 	qede_fdir_dealloc_resc(eth_dev);
 	qede_dealloc_fp_resc(eth_dev);
Signature · 1 line
2.17.1
Acked-by on v1 1/2
#2 lore raw
In reply to Manish Chopra

+Jerin

Quoted 10 lines

From: dev <[email protected]> On Behalf Of Manish Chopra
Sent: Thursday, February 06, 2020 12:02 PM

On ungraceful termination of DPDK application, PMD VF driver fails to re-load due to PF seeing the VF in unexpected state during VF acquisition handshake.

This patch fixes it by allowing VF to request the PF for soft FLR during the load in such cases so that it can get cleanly re-loaded.

Fixes 2ea6f76aff40 ("qede: add core driver")
Quoted 5 lines

---

#3 lore raw
Quoted 17 lines · Rasesh Mody

+Jerin

Quoted 10 lines

From: dev <[email protected]> On Behalf Of Manish Chopra
Sent: Thursday, February 06, 2020 12:02 PM

On ungraceful termination of DPDK application, PMD VF driver fails to re-load due to PF seeing the VF in unexpected state during VF acquisition handshake.

This patch fixes it by allowing VF to request the PF for soft FLR during the load in such cases so that it can get cleanly re-loaded.

Fixes 2ea6f76aff40 ("qede: add core driver")
Quoted 1 line
Quoted 6 lines
Quoted 4 lines

---

Fixed following check-git-log.sh warnings[1] Series applied to dpdk-next-net-mrvl/master. Thanks.

[1]

check-git-log failed
Wrong headline format:
net/qede: Do not stop vport if not started.
Wrong headline uppercase:
net/qede: Fix VF re-load failure after ungraceful termination of DPDK net/qede: Do not stop vport if not started.
Headline too long:
net/qede: Fix VF re-load failure after ungraceful termination of DPDK
Is it candidate for Cc: [email protected] backport?
net/qede: Fix VF re-load failure after ungraceful termination of DPDK]

Quoted 1 line