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 D14AEA0093; Tue, 17 May 2022 19:41:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20A2442B8A; Tue, 17 May 2022 19:40:25 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 4B59242B82 for ; Tue, 17 May 2022 19:40:23 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24H9idt1016727 for ; Tue, 17 May 2022 10:40:22 -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=WJ9Gfy09Fn9Wn1qCm3+F1ccrDXWYTUltDZ/+gGbTuP31HwoH67iZDGkP8OvrZqZr9czJ DinK1aJ9YBaBbaWP8r9byrg6F1mQhNB+wGNWfncSkpfaZg34NaLycl67V5kKY3NZG9no ct+V62g7g1ixiWOaCl1HBwlvt9+qDmtpyg6vlB0IqSiCiYO1+Fqdt16zV1E9Q4Df5E02 gk1up5NDY2PQ4cv7ioiXs00KlypSfeltBTzynU4aDX2KuRzX7x3jgDuNwPkCgQYnp2Dk ssP369zKzlscn4Qt8FVhhxv7oMgL9a4pF0efjLvuvHbIaFcpxOYoea15wbZWC9kl7ox4 CQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3g2bxsw90c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 17 May 2022 10:40:22 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 17 May 2022 10:40:20 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 17 May 2022 10:40:20 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id B81E63F7048; Tue, 17 May 2022 10:40:16 -0700 (PDT) From: Harman Kalra To: , Jerin Jacob , Maciej Czekaj CC: Harman Kalra Subject: [PATCH 11/12] net/thunderx: device attach from secondary Date: Tue, 17 May 2022 23:09:40 +0530 Message-ID: <20220517173941.189330-11-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220517173941.189330-1-hkalra@marvell.com> References: <20220517173941.189330-1-hkalra@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: 3B4q_ZsOIPUZON7Z-np-F-AeYGYCESsD X-Proofpoint-GUID: 3B4q_ZsOIPUZON7Z-np-F-AeYGYCESsD 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-17_03,2022-05-17_02,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