From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B6056A0541; Thu, 6 Feb 2020 21:01:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE0361C1E7; Thu, 6 Feb 2020 21:01:51 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id ED1651C1DF for ; Thu, 6 Feb 2020 21:01:50 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 016JxhD8013702; Thu, 6 Feb 2020 12:01:50 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=gfZslnHYYx8TezYgXK/3asybuYTrjHnxNcRIU8L++8c=; b=IlHggYVLwTwU353UL6lywXZPnE2xXsLRM/CIDVc+/A+5wdh85kumRuCrmvZ12M9k6k2F vcOP5Ms9Z5k/PDgWsHzcR+a5hiSOpdbKGlSdaB6MzjMDfPSw13KZjHbqOF3BBurNNNcf cwSqr2H9FnmbDjB3Y/eIHjUIs1428gtMy1FpjGYcD5RkHWek8fpMB+PTpLs6VUPeq6DZ hIc0U0nPwu8eKL1qXd0ZsD3qbWXPfVCQCistB+zoCp+hlZY6kyo/JG4LD7z6H2lvp3Ic /a7XTSp7ibtOXlQRi9CEiUOtZ4L23NElydlIYXAnKV5SS80TfEQo4cPENIs5NY+9OlxJ Cg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2xyhmth5et-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 06 Feb 2020 12:01:49 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 6 Feb 2020 12:01:48 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 6 Feb 2020 12:01:48 -0800 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 955BA3F703F; Thu, 6 Feb 2020 12:01:48 -0800 (PST) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 016K1mnY014845; Thu, 6 Feb 2020 12:01:48 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 016K1m1m014844; Thu, 6 Feb 2020 12:01:48 -0800 From: Manish Chopra To: , CC: , Date: Thu, 6 Feb 2020 12:01:45 -0800 Message-ID: <20200206200146.14808-1-manishc@marvell.com> X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-06_03:2020-02-06, 2020-02-06 signatures=0 Subject: [dpdk-dev] [PATCH 1/2] net/qede: Fix VF re-load failure after ungraceful termination of DPDK X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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") Signed-off-by: Manish Chopra Signed-off-by: Shahed Shaikh Signed-off-by: Rasesh Mody --- 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(-) diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index f33b9910c..86ecfb269 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -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) { diff --git a/drivers/net/qede/base/ecore_dev_api.h b/drivers/net/qede/base/ecore_dev_api.h index 4d5cc1a0f..5ea8427a0 100644 --- a/drivers/net/qede/base/ecore_dev_api.h +++ b/drivers/net/qede/base/ecore_dev_api.h @@ -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; }; /** diff --git a/drivers/net/qede/base/ecore_iov_api.h b/drivers/net/qede/base/ecore_iov_api.h index c998dbf8d..545001812 100644 --- a/drivers/net/qede/base/ecore_iov_api.h +++ b/drivers/net/qede/base/ecore_iov_api.h @@ -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; diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c index deee04ac4..e60257e19 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -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" }; diff --git a/drivers/net/qede/base/ecore_vf.c b/drivers/net/qede/base/ecore_vf.c index c5c081426..db03bc494 100644 --- a/drivers/net/qede/base/ecore_vf.c +++ b/drivers/net/qede/base/ecore_vf.c @@ -226,7 +226,6 @@ enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn) return _ecore_vf_pf_release(p_hwfn, true); } -#define VF_ACQUIRE_THRESH 3 static void ecore_vf_pf_acquire_reduce_resc(struct ecore_hwfn *p_hwfn, struct vf_pf_resc_request *p_req, struct pf_vf_resc *p_resp) @@ -251,13 +250,47 @@ static void ecore_vf_pf_acquire_reduce_resc(struct ecore_hwfn *p_hwfn, p_req->num_cids = p_resp->num_cids; } -static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) +static enum _ecore_status_t +ecore_vf_pf_soft_flr_acquire(struct ecore_hwfn *p_hwfn) +{ + struct ecore_vf_iov *p_iov = p_hwfn->vf_iov_info; + struct pfvf_def_resp_tlv *resp; + struct vfpf_soft_flr_tlv *req; + enum _ecore_status_t rc; + + req = ecore_vf_pf_prep(p_hwfn, CHANNEL_TLV_SOFT_FLR, sizeof(*req)); + + /* add list termination tlv */ + ecore_add_tlv(&p_iov->offset, + CHANNEL_TLV_LIST_END, + sizeof(struct channel_list_end_tlv)); + + resp = &p_iov->pf2vf_reply->default_resp; + rc = ecore_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); + + DP_VERBOSE(p_hwfn, ECORE_MSG_IOV, "rc=0x%x\n", rc); + + /* to release the mutex as ecore_vf_pf_acquire() take the mutex */ + ecore_vf_pf_req_end(p_hwfn, ECORE_AGAIN); + + /* As of today, there is no mechanism in place for VF to know the FLR + * status, so sufficiently (worst case time) wait for FLR to complete, + * as mailbox request to MFW by the PF for initiating VF flr and PF + * processing VF FLR could take time. + */ + OSAL_MSLEEP(3000); + + return ecore_vf_pf_acquire(p_hwfn); +} + +enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) { struct ecore_vf_iov *p_iov = p_hwfn->vf_iov_info; struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; struct ecore_vf_acquire_sw_info vf_sw_info; struct ecore_dev *p_dev = p_hwfn->p_dev; + u8 retry_cnt = p_iov->acquire_retry_cnt; struct vf_pf_resc_request *p_resc; bool resources_acquired = false; struct vfpf_acquire_tlv *req; @@ -318,6 +351,14 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) /* send acquire request */ rc = ecore_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); + + if (retry_cnt && rc == ECORE_TIMEOUT) { + DP_VERBOSE(p_hwfn, ECORE_MSG_IOV, + "VF retrying to acquire due to VPC timeout\n"); + retry_cnt--; + continue; + } + if (rc != ECORE_SUCCESS) goto exit; @@ -343,7 +384,7 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) resources_acquired = true; } /* PF refuses to allocate our resources */ else if (resp->hdr.status == PFVF_STATUS_NO_RESOURCE && - attempts < VF_ACQUIRE_THRESH) { + attempts < ECORE_VF_ACQUIRE_THRESH) { ecore_vf_pf_acquire_reduce_resc(p_hwfn, p_resc, &resp->resc); @@ -391,6 +432,9 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) "PF rejected acquisition by VF\n"); rc = ECORE_INVAL; goto exit; + } else if (resp->hdr.status == PFVF_STATUS_ACQUIRED) { + ecore_vf_pf_req_end(p_hwfn, ECORE_AGAIN); + return ecore_vf_pf_soft_flr_acquire(p_hwfn); } else { DP_ERR(p_hwfn, "PF returned err %d to VF acquisition request\n", @@ -477,7 +521,9 @@ u32 ecore_vf_hw_bar_size(struct ecore_hwfn *p_hwfn, return 0; } -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) { struct ecore_hwfn *p_lead = ECORE_LEADING_HWFN(p_hwfn->p_dev); struct ecore_vf_iov *p_iov; @@ -583,6 +629,7 @@ enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn) #endif OSAL_MUTEX_INIT(&p_iov->mutex); + p_iov->acquire_retry_cnt = p_params->acquire_retry_cnt; p_hwfn->vf_iov_info = p_iov; p_hwfn->hw_info.personality = ECORE_PCI_ETH; diff --git a/drivers/net/qede/base/ecore_vf.h b/drivers/net/qede/base/ecore_vf.h index a07f82ebd..f027eba3e 100644 --- a/drivers/net/qede/base/ecore_vf.h +++ b/drivers/net/qede/base/ecore_vf.h @@ -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 diff --git a/drivers/net/qede/base/ecore_vf_api.h b/drivers/net/qede/base/ecore_vf_api.h index 1a9fb3b1f..43951a9a3 100644 --- a/drivers/net/qede/base/ecore_vf_api.h +++ b/drivers/net/qede/base/ecore_vf_api.h @@ -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 * diff --git a/drivers/net/qede/base/ecore_vfpf_if.h b/drivers/net/qede/base/ecore_vfpf_if.h index c7ecb01c2..f92dc428a 100644 --- a/drivers/net/qede/base/ecore_vfpf_if.h +++ b/drivers/net/qede/base/ecore_vfpf_if.h @@ -251,6 +251,13 @@ struct vfpf_qid_tlv { u8 padding[3]; }; +/* Soft FLR req */ +struct vfpf_soft_flr_tlv { + struct vfpf_first_tlv first_tlv; + u32 reserved1; + u32 reserved2; +}; + /* Setup Queue */ struct vfpf_start_rxq_tlv { struct vfpf_first_tlv first_tlv; @@ -557,6 +564,7 @@ union vfpf_tlvs { struct vfpf_read_coal_req_tlv read_coal_req; struct vfpf_bulletin_update_mac_tlv bulletin_update_mac; struct vfpf_update_mtu_tlv update_mtu; + struct vfpf_soft_flr_tlv soft_flr; struct tlv_buffer_size tlv_buf_size; }; @@ -689,6 +697,39 @@ enum { 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_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_RDMA_CREATE_SRQ, + CHANNEL_TLV_RDMA_MODIFY_SRQ, + CHANNEL_TLV_RDMA_DESTROY_SRQ, + CHANNEL_TLV_SOFT_FLR, CHANNEL_TLV_MAX, /* Required for iterating over vport-update tlvs. diff --git a/drivers/net/qede/base/mcp_public.h b/drivers/net/qede/base/mcp_public.h index 98b9723dd..6667c2d7a 100644 --- a/drivers/net/qede/base/mcp_public.h +++ b/drivers/net/qede/base/mcp_public.h @@ -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 diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index 4eb79d0fb..8580cbcd7 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -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; -- 2.17.1