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 BB744A04F0; Wed, 18 Dec 2019 03:54:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3937B1BE9E; Wed, 18 Dec 2019 03:54:40 +0100 (CET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70051.outbound.protection.outlook.com [40.107.7.51]) by dpdk.org (Postfix) with ESMTP id ADBEF2C17 for ; Wed, 18 Dec 2019 03:54:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YUqejuGunXFVXz28T/2cbuHwGJFyiNcctwPrLT3FFRg=; b=lhY5a6QttBmK7ojDUdy1hxupMQT+EIWeuiEhtun2EDc0GutzlwqQ9eAKVDBZ605YKOLZuY9SaYKblc7UNMKopQb2jX8PkEYSMXhWdkUtc+f43FpWA5l4vDtzAw2qfCusyYOPouG+KM69PrjOSpW8rJLEZwnaKjUFoDY9dtYjDBU= Received: from AM6PR08CA0040.eurprd08.prod.outlook.com (2603:10a6:20b:c0::28) by AM0PR08MB3795.eurprd08.prod.outlook.com (2603:10a6:208:105::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14; Wed, 18 Dec 2019 02:54:35 +0000 Received: from DB5EUR03FT046.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::209) by AM6PR08CA0040.outlook.office365.com (2603:10a6:20b:c0::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15 via Frontend Transport; Wed, 18 Dec 2019 02:54:35 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT046.mail.protection.outlook.com (10.152.21.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14 via Frontend Transport; Wed, 18 Dec 2019 02:54:35 +0000 Received: ("Tessian outbound 1da651c29646:v40"); Wed, 18 Dec 2019 02:54:35 +0000 X-CR-MTA-TID: 64aa7808 Received: from b25b32299158.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F68D7CF5-4A9C-4CD6-BF0C-A467172C59FF.1; Wed, 18 Dec 2019 02:54:30 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b25b32299158.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 18 Dec 2019 02:54:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lm+MLCd3eJP3KWY2Llxt4+T0XPR5yxGT+VULcsTb6rCJuxXNOgVZJMpPv63YHZEbuKCUavoQS464pX3blQwPEZP6TSR3idfCM7aFC++qLdzePbnV9QpzoibTMTUCrXnKRkUVffwn1AwTKMcs6qCOoF8Q7CSM1+93hs85KNJ8eSwXmRSCEIjL0LDKL1VmYTs0ckyAGsOWugm+ax7NZRBbe4kcJBhGNJREg7VDpoaYnGSdMSwA7Wb1MN+BkmvIHB68Pn7JyB1wWsIqssbms3Myt8EdExLSB/GZv9mPcZrt8xXyQEgxQn3lhbHKfb9jlxvgiops4wQ6BViNNlh4NJyUNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YUqejuGunXFVXz28T/2cbuHwGJFyiNcctwPrLT3FFRg=; b=HyZeSHuRqs3UKlldWvRSPLqQJ3aSS9NKwcms8Lz7RkPiYo1yhAElRfAj1hrOtNiu/08Z3dLk75KtALqNSuIpBa34Gg7nwy2DCZtXuuZmk2EAIXD+c8lb2BJoG6rm0Yo1+NxEr9bU5bOC4jWAEMmOmpOlV8YEFiPUA8BNyNLHNtyyc3MivlGzB+cPNpeJObaowghH3QMysaR4bdst/tKGVfGPS9sIF1t7S0jvRHhPw3NJQJ1lZrVmuhKjd47hLS8YO5z7R/lk3klA4sisjtS3TOq7qINJNiJcWNIJUgqTDuTLY+l0T5y3mZlTV8d8KssHhvteJGebuQiy/RDb2A5UJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YUqejuGunXFVXz28T/2cbuHwGJFyiNcctwPrLT3FFRg=; b=lhY5a6QttBmK7ojDUdy1hxupMQT+EIWeuiEhtun2EDc0GutzlwqQ9eAKVDBZ605YKOLZuY9SaYKblc7UNMKopQb2jX8PkEYSMXhWdkUtc+f43FpWA5l4vDtzAw2qfCusyYOPouG+KM69PrjOSpW8rJLEZwnaKjUFoDY9dtYjDBU= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (10.255.196.79) by VI1PR08MB4159.eurprd08.prod.outlook.com (20.178.204.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.17; Wed, 18 Dec 2019 02:54:28 +0000 Received: from VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::dde8:216f:6a0b:8cfb]) by VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::dde8:216f:6a0b:8cfb%7]) with mapi id 15.20.2538.019; Wed, 18 Dec 2019 02:54:28 +0000 From: Gavin Hu To: Sunil Kumar Kori , "jerinj@marvell.com" , Nithin Dabilpuram , Vamsi Attunuru CC: "dev@dpdk.org" , Harman Kalra , nd Thread-Topic: [dpdk-dev] [PATCH v4 2/2] common/octeontx2: add polling based response mbox message Thread-Index: AQHVtPqDJvb+wvi7BEyfTiSGa0RLS6e/MRzQ Date: Wed, 18 Dec 2019 02:54:28 +0000 Message-ID: References: <20191216103948.22976-2-skori@marvell.com> <20191217165304.22475-1-skori@marvell.com> <20191217165304.22475-2-skori@marvell.com> In-Reply-To: <20191217165304.22475-2-skori@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 7530445d-f46f-456d-9372-2d70df6f2940.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3e722485-1d9b-4ac5-8ad4-08d783659d8b X-MS-TrafficTypeDiagnostic: VI1PR08MB4159:|AM0PR08MB3795: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:5236;OLM:5236; x-forefront-prvs: 0255DF69B9 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(346002)(39860400002)(396003)(376002)(136003)(366004)(13464003)(199004)(189003)(81156014)(26005)(81166006)(33656002)(86362001)(186003)(4326008)(71200400001)(66476007)(64756008)(66946007)(66556008)(66446008)(76116006)(2906002)(8936002)(6506007)(55236004)(53546011)(478600001)(7696005)(52536014)(55016002)(15650500001)(54906003)(9686003)(110136005)(5660300002)(316002)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB4159; H:VI1PR08MB5376.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: bRSfhsbA/EhjGfvoZv/Q41TkFQVoOJCaccbmoAWKvPCPZMeSsGWV2bIbsBlC6D5FHN3FlWqav5G0XWJdPRSOjf6t+H27vYsnbfigAU/xz+Sz8zhoQg5CVtC3cyiA5YpqyqDk9NvDzmEp86uSkb7yGVr7tRpBj86sBdLvYM8DIUmX7k9irRhfaaHQcr3EIY3zMSg/s92U2OjZBKuSlcrk8/P4sP469uV5st01Vi1bWD8TCHl2uUixklxe28m3y9RaONB+h5LnvYXKHlXTXVqvXgB7Va3dK9lumV7BPjMg7KNOSgFrKVD9l8HqbMBE7SyXAIzzsc7yEBYK+xpWPl8eJY0DkJTgEXcJUI8kOo85N2Mla+WGwaI2chW5nk3gq09S93F26Ghf1icxQL76jid+BsAEx8sSV0jNWSwBrEyd1IcUejtYL7gejzEy/jxN8NYTLfoU7YEOKRnm1Tkba6VkdYfgXkNV+hEA4c8jje5oa1sIGkgLtCFH+f8nqJTccUubydKodrglmWZFyQEY+6D1Kg== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4159 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT046.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(346002)(376002)(39860400002)(136003)(396003)(13464003)(189003)(199004)(5660300002)(52536014)(316002)(336012)(2906002)(70586007)(6506007)(53546011)(70206006)(26005)(186003)(76130400001)(110136005)(15650500001)(54906003)(356004)(4326008)(7696005)(478600001)(26826003)(86362001)(55016002)(81166006)(81156014)(8936002)(9686003)(33656002)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB3795; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: bc78025f-6afb-4be2-e8de-08d783659999 NoDisclaimer: True X-Forefront-PRVS: 0255DF69B9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TURTxzRnMt+LBvtVCyH6PNFye24uZMGiRyyfW0S48uqKNGVDIus5chLeAaAVnG6NLAV3AE6zZLNZdQ+m5AZw1/4cZWZImqr/dhQWb8mouXU4ZM1x5AANbrGlWE+C6RhoVJVoO3U6YRJvlWRl6tZjIBFe4HQkunU1v8TZIKyP96OvJPUmSbmsaa8P2k21OdSJ8XHBA9TqGp8rRIUJDyWAIefA39yw963+YzfEGZiwSGAxQxchSLol5tXwRn3boc/C44GvoF2dTn84UKtJB3c2VMSqs1ppmGlMMrVcnO9UDvYkrVb1s6BncEQ0FTEz9isHphQ0YWOPgQHm/ufQFYWhh5CFb2tjBtaoZVPgrTdNQMihjvVsLrn0xtP7X8dkM4omaXLSJ146DiKYtffXq6mXYtA0s0zZALVKevZU1a7v1LTkLgluyvtPAfrqKPi7hBnstSMfEQv4VZctxSxe6VAaLMNooRD+n0evRN+VnHRKxHQAuD8WjQL7leSrEj0NQ2difpnWYggGgcppwzNH6p9qtA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2019 02:54:35.3657 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e722485-1d9b-4ac5-8ad4-08d783659d8b X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3795 Subject: Re: [dpdk-dev] [PATCH v4 2/2] common/octeontx2: add polling based response mbox message 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" Hi Sunil, > -----Original Message----- > From: dev On Behalf Of Sunil Kumar Kori > Sent: Wednesday, December 18, 2019 12:53 AM > To: jerinj@marvell.com; Nithin Dabilpuram ; > Vamsi Attunuru > Cc: dev@dpdk.org; Sunil Kumar Kori ; Harman Kalra > > Subject: [dpdk-dev] [PATCH v4 2/2] common/octeontx2: add polling based > response mbox message >=20 > Currently otx2_mbox_get_rsp_xxx get response once AF driver > interrupts after completion. But this funciton will get into > deadlock if called in another interrupt context. >=20 > To avoid it, implemented another version of this function which polls > on dedicated memory for a given timeout. >=20 > Also after clearing interrupt, there could UP messages available for > processing. So irq handler must check mbox messages. >=20 > Signed-off-by: Sunil Kumar Kori > Signed-off-by: Harman Kalra > --- > v4: > - used rte_io_rmb instead of rte_rmb in mbox_poll. > v3: > - Remove experimental tag as API is defined static. > - Merge all changes to single patch. > v2: > - Included Makefile and meson build changes. > - Rebased patch on 19.11-rc4 >=20 > drivers/common/octeontx2/otx2_dev.c | 41 +++++++++++--------- > drivers/common/octeontx2/otx2_mbox.c | 58 +++++++++++++++++++++++--- > -- > drivers/common/octeontx2/otx2_mbox.h | 5 ++- > 3 files changed, 73 insertions(+), 31 deletions(-) >=20 > diff --git a/drivers/common/octeontx2/otx2_dev.c > b/drivers/common/octeontx2/otx2_dev.c > index 0fc799e4a..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) >=20 > intr =3D otx2_read64(dev->bar2 + RVU_VF_INT); > if (intr =3D=3D 0) > - return; > + otx2_base_dbg("Proceeding to check mbox UP messages if > any"); >=20 > 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); >=20 > - /* 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); > } >=20 > static void > @@ -598,18 +597,16 @@ otx2_af_pf_mbox_irq(void *param) >=20 > intr =3D otx2_read64(dev->bar2 + RVU_PF_INT); > if (intr =3D=3D 0) > - return; > + otx2_base_dbg("Proceeding to check mbox UP messages if > any"); >=20 > 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); >=20 > - /* 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); > } >=20 > static int > @@ -900,6 +897,7 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, > void *otx2_dev) > { > int up_direction =3D MBOX_DIR_PFAF_UP; > int rc, direction =3D MBOX_DIR_PFAF; > + uint64_t intr_offset =3D RVU_PF_INT; > struct otx2_dev *dev =3D otx2_dev; > uintptr_t bar2, bar4; > uint64_t bar4_addr; > @@ -924,15 +922,18 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, > void *otx2_dev) > if (otx2_dev_is_vf(dev)) { > direction =3D MBOX_DIR_VFPF; > up_direction =3D MBOX_DIR_VFPF_UP; > + intr_offset =3D RVU_VF_INT; > } >=20 > /* Initialize the local mbox */ > - rc =3D otx2_mbox_init(&dev->mbox_local, bar4, bar2, direction, 1); > + rc =3D otx2_mbox_init(&dev->mbox_local, bar4, bar2, direction, 1, > + intr_offset); > if (rc) > goto error; > dev->mbox =3D &dev->mbox_local; >=20 > - rc =3D otx2_mbox_init(&dev->mbox_up, bar4, bar2, up_direction, 1); > + rc =3D otx2_mbox_init(&dev->mbox_up, bar4, bar2, up_direction, 1, > + intr_offset); > if (rc) > goto error; >=20 > @@ -967,13 +968,15 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, > void *otx2_dev) > } > /* Init mbox object */ > rc =3D otx2_mbox_init(&dev->mbox_vfpf, (uintptr_t)hwbase, > - bar2, MBOX_DIR_PFVF, pci_dev->max_vfs); > + bar2, MBOX_DIR_PFVF, pci_dev->max_vfs, > + intr_offset); > if (rc) > goto iounmap; >=20 > /* PF -> VF UP messages */ > rc =3D otx2_mbox_init(&dev->mbox_vfpf_up, > (uintptr_t)hwbase, > - bar2, MBOX_DIR_PFVF_UP, pci_dev- > >max_vfs); > + bar2, MBOX_DIR_PFVF_UP, pci_dev- > >max_vfs, > + intr_offset); > if (rc) > goto mbox_fini; > } > diff --git a/drivers/common/octeontx2/otx2_mbox.c > b/drivers/common/octeontx2/otx2_mbox.c > index c359bf42f..358e4b3bd 100644 > --- a/drivers/common/octeontx2/otx2_mbox.c > +++ b/drivers/common/octeontx2/otx2_mbox.c > @@ -11,6 +11,7 @@ > #include >=20 > #include "otx2_mbox.h" > +#include "otx2_dev.h" >=20 > #define RVU_AF_AFPF_MBOX0 (0x02000) > #define RVU_AF_AFPF_MBOX1 (0x02008) > @@ -59,12 +60,13 @@ otx2_mbox_reset(struct otx2_mbox *mbox, int devid) > } >=20 > int > -otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, > - uintptr_t reg_base, int direction, int ndevs) > +otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, uintptr_t > reg_base, > + int direction, int ndevs, uint64_t intr_offset) > { > struct otx2_mbox_dev *mdev; > int devid; >=20 > + mbox->intr_offset =3D intr_offset; > mbox->reg_base =3D reg_base; > mbox->hwbase =3D hwbase; >=20 > @@ -230,8 +232,8 @@ otx2_mbox_get_rsp(struct otx2_mbox *mbox, int > devid, void **msg) > int rc; >=20 > rc =3D otx2_mbox_wait_for_rsp(mbox, devid); > - if (rc !=3D 1) > - return -EIO; > + if (rc < 0) > + return rc; >=20 > rte_rmb(); >=20 > @@ -244,6 +246,38 @@ otx2_mbox_get_rsp(struct otx2_mbox *mbox, int > devid, void **msg) > return msghdr->rc; > } >=20 > +/** > + * Polling for given wait time to get mailbox response > + */ > +static int > +mbox_poll(struct otx2_mbox *mbox, uint32_t wait) > +{ > + uint32_t timeout =3D 0, sleep =3D 1; > + uint32_t wait_us =3D wait * 1000; > + uint64_t rsp_reg =3D 0; > + uintptr_t reg_addr; > + > + reg_addr =3D mbox->reg_base + mbox->intr_offset; > + do { > + rte_smp_rmb(); Device memory is not within the inner sharable domain, here rte_io_rmb shou= ld be used. More details are explained in the v3 thread. > + rsp_reg =3D otx2_read64(reg_addr); > + > + if (timeout >=3D wait_us) > + return -ETIMEDOUT; > + > + rte_delay_us(sleep); > + timeout +=3D sleep; > + } while (!rsp_reg); > + > + /* Clear interrupt */ > + otx2_write64(rsp_reg, reg_addr); > + > + /* Reset mbox */ > + otx2_mbox_reset(mbox, 0); > + > + return 0; > +} > + > /** > * @internal > * Wait and get mailbox response with timeout > @@ -258,8 +292,8 @@ otx2_mbox_get_rsp_tmo(struct otx2_mbox *mbox, > int devid, void **msg, > int rc; >=20 > rc =3D otx2_mbox_wait_for_rsp_tmo(mbox, devid, tmo); > - if (rc !=3D 1) > - return -EIO; > + if (rc < 0) > + return rc; >=20 > rte_rmb(); >=20 > @@ -321,11 +355,15 @@ otx2_mbox_wait_for_rsp_tmo(struct otx2_mbox > *mbox, int devid, uint32_t tmo) > } >=20 > /* Wait message */ > - rc =3D mbox_wait(mbox, devid, tmo); > - if (rc) > - return rc; > + if (rte_thread_is_intr()) > + rc =3D mbox_poll(mbox, tmo); > + else > + rc =3D mbox_wait(mbox, devid, tmo); >=20 > - return mdev->msgs_acked; > + if (!rc) > + rc =3D mdev->num_msgs; > + > + return rc; > } >=20 > /** > diff --git a/drivers/common/octeontx2/otx2_mbox.h > b/drivers/common/octeontx2/otx2_mbox.h > index e0e4e2f63..0535cec36 100644 > --- a/drivers/common/octeontx2/otx2_mbox.h > +++ b/drivers/common/octeontx2/otx2_mbox.h > @@ -73,6 +73,7 @@ struct otx2_mbox { > uint16_t tx_size; /* Size of Tx region */ > uint16_t ndevs; /* The number of peers */ > struct otx2_mbox_dev *dev; > + uint64_t intr_offset; /* Offset to interrupt register */ > }; >=20 > /* Header which precedes all mbox messages */ > @@ -1562,8 +1563,8 @@ struct tim_enable_rsp { > const char *otx2_mbox_id2name(uint16_t id); > int otx2_mbox_id2size(uint16_t id); > void otx2_mbox_reset(struct otx2_mbox *mbox, int devid); > -int otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, > - uintptr_t reg_base, int direction, int ndevs); > +int otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, uintptr_t > reg_base, > + int direction, int ndevsi, uint64_t intr_offset); > void otx2_mbox_fini(struct otx2_mbox *mbox); > void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid); > int otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid); > -- > 2.17.1