From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 984E6A00C2; Mon, 23 May 2022 18:12:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8AE842B8E; Mon, 23 May 2022 18:11:39 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 60CB042B83 for ; Mon, 23 May 2022 18:11:37 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24NBMWPj027049 for ; Mon, 23 May 2022 09:11:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=e5LIWsBfqMUZnZ2yVvDRh2G2hG6sdoWSwmH2WpRsxiA=; b=KdMhlwkARwsh0VJI1BvYrOFYIRy4e2878lnFh0+76UH+XULmvz4XX2dtIH70I4wGTk2Y amZKwNB0H13S8iZMZagXj03ENueLS7AOsMps+cKievULh4uqHY3WWcCgm5vTYbDKP6Ix JGZ1xreta+gGEJzXuA6b+axTSLTQ82QrDzTtQ+WLQI3P/wkswYLvsdswIkuSJjLSAWdA P+9aiWnF4H42/s+5YAxvDUbG79pcLwqxgFd2+LAcYC4tJwxhdqDJYf/NxdMdNmhK/4VY jaVu0kT90bu4wr91pzJTylqxxjmAJpJbTofnncIR87cmAVEuWjBrxpndfTfso2E89Ekm ZA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3g6wepetat-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 23 May 2022 09:11:36 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 23 May 2022 09:11:35 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 23 May 2022 09:11:35 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id A25903F70A4; Mon, 23 May 2022 09:11:33 -0700 (PDT) From: Harman Kalra To: , Jerin Jacob , Maciej Czekaj CC: Harman Kalra Subject: [PATCH v2 10/11] net/thunderx: device attach from secondary Date: Mon, 23 May 2022 21:40:59 +0530 Message-ID: <20220523161100.86280-10-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220523161100.86280-1-hkalra@marvell.com> References: <20220517173941.189330-2-hkalra@marvell.com> <20220523161100.86280-1-hkalra@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: uNBrcB-ZSP7E_x7FUw21x-UU4WBJA0Ll X-Proofpoint-ORIG-GUID: uNBrcB-ZSP7E_x7FUw21x-UU4WBJA0Ll X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-23_07,2022-05-23_01,2022-02-23_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Adding support for device hotplugging - attach and detach from secondary Signed-off-by: Harman Kalra --- drivers/net/thunderx/base/nicvf_mbox.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c index 352b85d9e2..5993eec4e6 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.c +++ b/drivers/net/thunderx/base/nicvf_mbox.c @@ -85,6 +85,17 @@ nicvf_mbox_send_msg_to_pf(struct nicvf *nic, struct nic_mbx *mbx) nicvf_smp_wmb(); nicvf_mbox_send_msg_to_pf_raw(nic, mbx); + + /* Handling case if mbox is called inside interrupt context, + * Eg if hotplug attach/detach request is initiated from + * secondary and primary handles the request in interrupt + * context as part of multprocess framework. + */ + if (rte_thread_is_intr()) { + nicvf_delay_us(NICVF_MBOX_PF_RESPONSE_DELAY_US); + nicvf_reg_poll_interrupts(nic); + } + /* Give some time to get PF response */ nicvf_delay_us(NICVF_MBOX_PF_RESPONSE_DELAY_US); timeout = NIC_MBOX_MSG_TIMEOUT; @@ -100,10 +111,10 @@ nicvf_mbox_send_msg_to_pf(struct nicvf *nic, struct nic_mbx *mbx) nicvf_delay_us(NICVF_MBOX_PF_RESPONSE_DELAY_US); timeout -= sleep; } - nicvf_log_error("PF didn't ack to msg 0x%02x %s VF%d (%d/%d)", - mbx->msg.msg, nicvf_mbox_msg_str(mbx->msg.msg), - nic->vf_id, i, retry); } + nicvf_log_error("PF didn't ack to msg 0x%02x %s VF%d (%d/%d)", + mbx->msg.msg, nicvf_mbox_msg_str(mbx->msg.msg), + nic->vf_id, i, retry); return -EBUSY; } -- 2.18.0