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 C743DA04C2; Mon, 25 Nov 2019 12:36:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2A471BC25; Mon, 25 Nov 2019 12:35:57 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1C2D958C4 for ; Mon, 25 Nov 2019 12:35:53 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAPBYm6d003593 for ; Mon, 25 Nov 2019 03:35:52 -0800 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=pfpt0818; bh=qtKTcGvkUcrJZFEmn/bg9sxNO8vUbsn4dx/t2unKQoQ=; b=TMSWUvU9CQIAQBHdE5MkerMFZ+VtwcJwk58iUC3Lp9JJtDhdkqWx05rarHdKwvA086bd cb9yVH8NM3uq5PUVSyMPhSiAfYbUsaTIPtZWwyL+klTCqh+/CC+U/Z2D3lYCJlFWyEX8 RCw/Af2pfd+87u3XhymycxNF3wHRQV85V8Xvpmrs4sq5qYAxFf4FmZuK8JJIPhVK2kpf Ng48tFd+Vs/9Dvw2SR8jtD5ZVIkWBA58B/XTCtqC5Do+Yg39itL5lsgQl1nDnhz5AH9M AQHGY9sS1UiR4Km1eyrG7+mxVzux0mJYkvRAlkxL5at7Zps6fROHRlU3bpNqKLED6i9t JQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2wg3kshs1r-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 25 Nov 2019 03:35:52 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 25 Nov 2019 03:35:51 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 25 Nov 2019 03:35:51 -0800 Received: from localhost.localdomain (unknown [10.28.34.200]) by maili.marvell.com (Postfix) with ESMTP id ABD873F703F; Mon, 25 Nov 2019 03:35:49 -0800 (PST) From: Sunil Kumar Kori To: Jerin Jacob , Nithin Dabilpuram , Vamsi Attunuru CC: , Sunil Kumar Kori Date: Mon, 25 Nov 2019 17:05:37 +0530 Message-ID: <20191125113537.25266-5-skori@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191125113537.25266-1-skori@marvell.com> References: <20191125113537.25266-1-skori@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-25_03:2019-11-21,2019-11-25 signatures=0 Subject: [dpdk-dev] [PATCH 5/5] common/octeontx2: enhancing mbox APIs to get response 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" Based on thread context, mbox API will get response for submitted request. If thread runs in interrupt context then it uses polling based get response API otherwise interrupt based. Signed-off-by: Sunil Kumar Kori --- drivers/common/octeontx2/otx2_dev.c | 27 ++++++++++++--------------- drivers/common/octeontx2/otx2_mbox.h | 21 +++++++++++++++++---- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c index 6f29d6108..d61c712fa 100644 --- a/drivers/common/octeontx2/otx2_dev.c +++ b/drivers/common/octeontx2/otx2_dev.c @@ -577,17 +577,16 @@ otx2_pf_vf_mbox_irq(void *param) intr = otx2_read64(dev->bar2 + RVU_VF_INT); if (intr == 0) - return; + otx2_base_dbg("Proceeding to check mbox UP messages if any"); otx2_write64(intr, dev->bar2 + RVU_VF_INT); otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf); - if (intr) { - /* First process all configuration messages */ - otx2_process_msgs(dev, dev->mbox); - /* Process Uplink messages */ - otx2_process_msgs_up(dev, &dev->mbox_up); - } + /* First process all configuration messages */ + otx2_process_msgs(dev, dev->mbox); + + /* Process Uplink messages */ + otx2_process_msgs_up(dev, &dev->mbox_up); } static void @@ -598,18 +597,16 @@ otx2_af_pf_mbox_irq(void *param) intr = otx2_read64(dev->bar2 + RVU_PF_INT); if (intr == 0) - return; + otx2_base_dbg("Proceeding to check mbox UP messages if any"); otx2_write64(intr, dev->bar2 + RVU_PF_INT); - otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf); - if (intr) { - /* First process all configuration messages */ - otx2_process_msgs(dev, dev->mbox); - /* Process Uplink messages */ - otx2_process_msgs_up(dev, &dev->mbox_up); - } + /* First process all configuration messages */ + otx2_process_msgs(dev, dev->mbox); + + /* Process Uplink messages */ + otx2_process_msgs_up(dev, &dev->mbox_up); } static int diff --git a/drivers/common/octeontx2/otx2_mbox.h b/drivers/common/octeontx2/otx2_mbox.h index 237d4cf45..e82dfe530 100644 --- a/drivers/common/octeontx2/otx2_mbox.h +++ b/drivers/common/octeontx2/otx2_mbox.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -1627,28 +1628,40 @@ static inline int otx2_mbox_process(struct otx2_mbox *mbox) { otx2_mbox_msg_send(mbox, 0); - return otx2_mbox_get_rsp(mbox, 0, NULL); + if (rte_thread_is_intr()) + return otx2_mbox_get_rsp_poll(mbox, 0, NULL); + else + return otx2_mbox_get_rsp(mbox, 0, NULL); } static inline int otx2_mbox_process_msg(struct otx2_mbox *mbox, void **msg) { otx2_mbox_msg_send(mbox, 0); - return otx2_mbox_get_rsp(mbox, 0, msg); + if (rte_thread_is_intr()) + return otx2_mbox_get_rsp_poll(mbox, 0, msg); + else + return otx2_mbox_get_rsp(mbox, 0, msg); } static inline int otx2_mbox_process_tmo(struct otx2_mbox *mbox, uint32_t tmo) { otx2_mbox_msg_send(mbox, 0); - return otx2_mbox_get_rsp_tmo(mbox, 0, NULL, tmo); + if (rte_thread_is_intr()) + return otx2_mbox_get_rsp_poll_tmo(mbox, 0, NULL, tmo); + else + return otx2_mbox_get_rsp_tmo(mbox, 0, NULL, tmo); } static inline int otx2_mbox_process_msg_tmo(struct otx2_mbox *mbox, void **msg, uint32_t tmo) { otx2_mbox_msg_send(mbox, 0); - return otx2_mbox_get_rsp_tmo(mbox, 0, msg, tmo); + if (rte_thread_is_intr()) + return otx2_mbox_get_rsp_poll_tmo(mbox, 0, msg, tmo); + else + return otx2_mbox_get_rsp_tmo(mbox, 0, msg, tmo); } int otx2_send_ready_msg(struct otx2_mbox *mbox, uint16_t *pf_func /* out */); -- 2.17.1