From patchwork Mon Nov 25 11:35:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 63270 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C99CAA04C2; Mon, 25 Nov 2019 12:35:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 704152952; Mon, 25 Nov 2019 12:35:48 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 6FD2D28EE for ; Mon, 25 Nov 2019 12:35:46 +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 xAPBYfVP003177 for ; Mon, 25 Nov 2019 03:35:45 -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=wcjiQwrGnQO8wKtJ9VS9QY45vwWI9Q8awdrEzpECpgA=; b=v6Qcda3l4ZuWxG8GMWn+41IyfxkLHoZvDaw0kQGIzLWbpgRuf20ZrvZ6ap5uC/stMDEA zxrCDqE3RpgfwnH+6EQw0WZljWCnzPmPE2esps8j06pwHRk5k/kZbxom3IXzaSHGTE9h WbSufc8vW6l1sR0oINYnaCKkVLBYE4JcLyEMo8rYAWqkJzZCDC4zymYNnpNnyVv89SgS yQ4qdsVUw0Ws0z9WwjRa2CXOxuss2cOzk0EvWz4/uHEeMubwnoQpecaZAVu63ig8H565 ngFO9R+RgVJrsOtr7528zan6iw2PTPk7Wo0madpvgXPvIRXHs7z6ATZinDy0OmRK4qee Cw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2wg3kshs1c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 25 Nov 2019 03:35:45 -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:43 -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:43 -0800 Received: from localhost.localdomain (unknown [10.28.34.200]) by maili.marvell.com (Postfix) with ESMTP id 97A383F703F; Mon, 25 Nov 2019 03:35:41 -0800 (PST) From: Sunil Kumar Kori To: Jerin Jacob , Nithin Dabilpuram , Vamsi Attunuru , "Kiran Kumar K" , Satha Rao CC: , Sunil Kumar Kori Date: Mon, 25 Nov 2019 17:05:33 +0530 Message-ID: <20191125113537.25266-1-skori@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 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 1/5] drivers/octeontx2: allow experimental symbols 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" Multiple experimental symbols are used. They must be allowed to avoid compilation error. Signed-off-by: Sunil Kumar Kori --- drivers/common/octeontx2/Makefile | 2 ++ drivers/net/octeontx2/Makefile | 2 ++ drivers/raw/octeontx2_dma/Makefile | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/common/octeontx2/Makefile b/drivers/common/octeontx2/Makefile index eaff29433..b1c1792fb 100644 --- a/drivers/common/octeontx2/Makefile +++ b/drivers/common/octeontx2/Makefile @@ -22,6 +22,8 @@ CFLAGS += -diag-disable 2259 endif endif +CFLAGS += -DALLOW_EXPERIMENTAL_API + EXPORT_MAP := rte_common_octeontx2_version.map # diff --git a/drivers/net/octeontx2/Makefile b/drivers/net/octeontx2/Makefile index 68f5765db..3da4d8cc1 100644 --- a/drivers/net/octeontx2/Makefile +++ b/drivers/net/octeontx2/Makefile @@ -26,6 +26,8 @@ CFLAGS += -diag-disable 2259 endif endif +CFLAGS += -DALLOW_EXPERIMENTAL_API + EXPORT_MAP := rte_pmd_octeontx2_version.map # diff --git a/drivers/raw/octeontx2_dma/Makefile b/drivers/raw/octeontx2_dma/Makefile index c64ca3497..0d0c530fe 100644 --- a/drivers/raw/octeontx2_dma/Makefile +++ b/drivers/raw/octeontx2_dma/Makefile @@ -22,6 +22,8 @@ CFLAGS += -diag-disable 2259 endif endif +CFLAGS += -DALLOW_EXPERIMENTAL_API + EXPORT_MAP := rte_rawdev_octeontx2_dma_version.map # From patchwork Mon Nov 25 11:35:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 63271 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 633C6A04C2; Mon, 25 Nov 2019 12:35:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2FA1E4C99; Mon, 25 Nov 2019 12:35:50 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 96D9C28EE for ; Mon, 25 Nov 2019 12:35:47 +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 xAPBUloa024978; Mon, 25 Nov 2019 03:35:46 -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=IPdqpmnaQ9wc8giCgyKcDw8l/Ir+HtELGkMyl521L6E=; b=t8JHwHfQCRphMr0Q9Nt9Q3R0/nlUKnKNoPReHGFl6TbsombNFrt+ff0eK7SLKTerOf// 4ThVagaomLd6e+FoeGmKPoRiVNhegKtn3M2ITH/Mti5tQZpYbH+9r6mgAvrGOJmgI2SW B0h26duXSP4eWnTDL76Ff7WjmHq5TTm6E48fJ6sYlqwnpeQva12p8YJDX90L2iKotW8n jeVthTn7izCItsRbZBRvOpKmnypmJulnJFEZkgLiIIuhQCwx0ArmNRduT4LSk7sYpM5N SUuM8kkDPnX43v42VQmWwtG0SWPnhMXVFs+KX8rn/IMw39rqxEDnb5/gDUwEeOUBTEw6 Xg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2wf93gwdsr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 25 Nov 2019 03:35:46 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) 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:45 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 25 Nov 2019 03:35:45 -0800 Received: from localhost.localdomain (unknown [10.28.34.200]) by maili.marvell.com (Postfix) with ESMTP id 09CA63F7041; Mon, 25 Nov 2019 03:35:43 -0800 (PST) From: Sunil Kumar Kori To: Bruce Richardson CC: , Sunil Kumar Kori , Harman Kalra Date: Mon, 25 Nov 2019 17:05:34 +0530 Message-ID: <20191125113537.25266-2-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 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 v3 2/5] eal: add API to check if its interrupt context 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" Added an API to check if current execution is in interrupt context. This will be helpful to handle nested interrupt cases. Signed-off-by: Harman Kalra Signed-off-by: Sunil Kumar Kori --- V3: * Rebased patch on latest commit V2: * Removed unnecessary if statement * Reworded subject line * Updated return values of API lib/librte_eal/common/include/rte_interrupts.h | 15 +++++++++++++++ lib/librte_eal/freebsd/eal/eal_interrupts.c | 5 +++++ lib/librte_eal/linux/eal/eal_interrupts.c | 5 +++++ lib/librte_eal/rte_eal_version.map | 1 + 4 files changed, 26 insertions(+) diff --git a/lib/librte_eal/common/include/rte_interrupts.h b/lib/librte_eal/common/include/rte_interrupts.h index e3b406abc..0a82e28a8 100644 --- a/lib/librte_eal/common/include/rte_interrupts.h +++ b/lib/librte_eal/common/include/rte_interrupts.h @@ -138,6 +138,21 @@ int rte_intr_disable(const struct rte_intr_handle *intr_handle); __rte_experimental int rte_intr_ack(const struct rte_intr_handle *intr_handle); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Check if currently executing in interrupt context + * + * @return + * - positive in case of interrupt context + * - zero in case of process context + * - negative if unsuccessful + */ +__rte_experimental +int +rte_thread_is_intr(void); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/freebsd/eal/eal_interrupts.c b/lib/librte_eal/freebsd/eal/eal_interrupts.c index f6831b790..ce2a27b4a 100644 --- a/lib/librte_eal/freebsd/eal/eal_interrupts.c +++ b/lib/librte_eal/freebsd/eal/eal_interrupts.c @@ -671,3 +671,8 @@ rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle) { RTE_SET_USED(intr_handle); } + +int rte_thread_is_intr(void) +{ + return pthread_equal(intr_thread, pthread_self()); +} diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c index 1955324d3..c00f5a575 100644 --- a/lib/librte_eal/linux/eal/eal_interrupts.c +++ b/lib/librte_eal/linux/eal/eal_interrupts.c @@ -1487,3 +1487,8 @@ rte_intr_cap_multiple(struct rte_intr_handle *intr_handle) return 0; } + +int rte_thread_is_intr(void) +{ + return pthread_equal(intr_thread, pthread_self()); +} diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index e38d02530..397e787cf 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -332,4 +332,5 @@ EXPERIMENTAL { # added in 19.11 rte_log_get_stream; rte_mcfg_get_single_file_segments; + rte_thread_is_intr; }; From patchwork Mon Nov 25 11:35:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 63272 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4E11A04C2; Mon, 25 Nov 2019 12:36:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 78DBD5596; Mon, 25 Nov 2019 12:35:52 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id B2B3E4C74 for ; Mon, 25 Nov 2019 12:35:49 +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 xAPBYnJD003598 for ; Mon, 25 Nov 2019 03:35:49 -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=lzJC76T33pGhu6SFVB9ERdF4GcfAO6kz4k2htwQp8AI=; b=EAlygbT1Ok+UTJKVFyAbVlEsRHQqwriQc8JoiAqm4ns3tzjblYTx85v2GPWJUwexLs2M PctvBT2fj6Z6svA12zZjgtarH7aMNtOXqK7nwdkgmNw6oee+T9RkvJ3uJJHNrylsag+U KjnE5sBd0xeLGnrn3SY26U6SCWUu9ntK5cQ+Rv2eVROuBRtcj8usibntSPmH1M6nxn4z LYyiOaQcoXElRRuVjloflJBLktim4x6YAc8P+jYGjb1n9ec1kDFTy7mMkwCOu6YEhFOQ UHOV+eLebbPny+6APV8h/5j0cmycCZmW7DXQ7vcVoQEcsJNB+OMtN3A2CudDG00WY7UT lQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2wg3kshs1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 25 Nov 2019 03:35:49 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 25 Nov 2019 03:35:47 -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:47 -0800 Received: from localhost.localdomain (unknown [10.28.34.200]) by maili.marvell.com (Postfix) with ESMTP id C4BAF3F703F; Mon, 25 Nov 2019 03:35:45 -0800 (PST) From: Sunil Kumar Kori To: Jerin Jacob , Nithin Dabilpuram , Vamsi Attunuru CC: , Sunil Kumar Kori Date: Mon, 25 Nov 2019 17:05:35 +0530 Message-ID: <20191125113537.25266-3-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 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 3/5] common/octeontx2: add interrupt offset to mbox structure 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" mbox response are triggered at bar2 + RVU_PF_INT or bar2 + RVU_VF_INT, depending upon the device. To process these interrupts different irq handlers are installed. To unify it, added offset field into mbox structure which is initialized with RVU_PF_INT or RVU_VF_INT at the time of otx2_mbox_init. Signed-off-by: Sunil Kumar Kori --- drivers/common/octeontx2/otx2_dev.c | 14 ++++++++++---- drivers/common/octeontx2/otx2_mbox.c | 5 +++-- drivers/common/octeontx2/otx2_mbox.h | 5 +++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c index 0fc799e4a..6f29d6108 100644 --- a/drivers/common/octeontx2/otx2_dev.c +++ b/drivers/common/octeontx2/otx2_dev.c @@ -900,6 +900,7 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, void *otx2_dev) { int up_direction = MBOX_DIR_PFAF_UP; int rc, direction = MBOX_DIR_PFAF; + uint64_t intr_offset = RVU_PF_INT; struct otx2_dev *dev = otx2_dev; uintptr_t bar2, bar4; uint64_t bar4_addr; @@ -924,15 +925,18 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, void *otx2_dev) if (otx2_dev_is_vf(dev)) { direction = MBOX_DIR_VFPF; up_direction = MBOX_DIR_VFPF_UP; + intr_offset = RVU_VF_INT; } /* Initialize the local mbox */ - rc = otx2_mbox_init(&dev->mbox_local, bar4, bar2, direction, 1); + rc = otx2_mbox_init(&dev->mbox_local, bar4, bar2, direction, 1, + intr_offset); if (rc) goto error; dev->mbox = &dev->mbox_local; - rc = otx2_mbox_init(&dev->mbox_up, bar4, bar2, up_direction, 1); + rc = otx2_mbox_init(&dev->mbox_up, bar4, bar2, up_direction, 1, + intr_offset); if (rc) goto error; @@ -967,13 +971,15 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, void *otx2_dev) } /* Init mbox object */ rc = 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; /* PF -> VF UP messages */ rc = 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..ad8e0c3aa 100644 --- a/drivers/common/octeontx2/otx2_mbox.c +++ b/drivers/common/octeontx2/otx2_mbox.c @@ -59,12 +59,13 @@ 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) +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; + mbox->intr_offset = intr_offset; mbox->reg_base = reg_base; mbox->hwbase = hwbase; diff --git a/drivers/common/octeontx2/otx2_mbox.h b/drivers/common/octeontx2/otx2_mbox.h index e0e4e2f63..162d12468 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 */ }; /* 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); From patchwork Mon Nov 25 11:35:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 63273 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 24755A04C2; Mon, 25 Nov 2019 12:36:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CA5405B3E; Mon, 25 Nov 2019 12:35:54 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 07E864CA6 for ; Mon, 25 Nov 2019 12:35:50 +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 xAPBYf3k003169 for ; Mon, 25 Nov 2019 03:35:50 -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=RO8TFtEPzykTibChLvF/h5Lsm6bkBfjSFuRdQJblZrE=; b=YZP4e8AiRUpgKK6C6fqY3R5OpvVnoN8eAk+SCV8dXwgR/s/mdsMb6JbaunegXemRLySf W0H2xs82JaDB6J5GprE8VqOaSPoEplsAWq+ljn48Yg5aIIQ+XpySH3YVEbgDwRmOffOY 5q+7cBzOdrznnZDmR8udkX7XHtJhuaY3kK5ogPYeTQPOBLP6FeFrpWjjmitCzg4MI6C8 Ng9tiWLTbnZ9+9ZH/ZWoxvpZcjKyuLtAADDrrybBD9BoabOmg/UgF4Kre+KnAYFZZgqu 6vQ+11HVRVULDqmEEgTOLUmgCb3KUWxKhFema30bfdEwZy6797ZsojWe4+8K/dXZ5OFF OQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2wg3kshs1n-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 25 Nov 2019 03:35:50 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 25 Nov 2019 03:35:49 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 25 Nov 2019 03:35:49 -0800 Received: from localhost.localdomain (unknown [10.28.34.200]) by maili.marvell.com (Postfix) with ESMTP id BE3123F7040; Mon, 25 Nov 2019 03:35:47 -0800 (PST) From: Sunil Kumar Kori To: Jerin Jacob , Nithin Dabilpuram , Vamsi Attunuru CC: , Sunil Kumar Kori Date: Mon, 25 Nov 2019 17:05:36 +0530 Message-ID: <20191125113537.25266-4-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 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 4/5] 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" Currently otx2_mbox_get_rsp get response once AF driver interrupts after completion. But this funciton will get into deadlock if called in another interrupt context. To avoid it, implemented another version of this function which polls on dedicated memory for a given timeout. Also after clearing interrupt, there could UP messages available for processing. So irq handler must check mbox messages. Signed-off-by: Sunil Kumar Kori --- drivers/common/octeontx2/otx2_mbox.c | 58 +++++++++++++++++++ drivers/common/octeontx2/otx2_mbox.h | 7 +++ .../rte_common_octeontx2_version.map | 7 +++ 3 files changed, 72 insertions(+) diff --git a/drivers/common/octeontx2/otx2_mbox.c b/drivers/common/octeontx2/otx2_mbox.c index ad8e0c3aa..af34fd19d 100644 --- a/drivers/common/octeontx2/otx2_mbox.c +++ b/drivers/common/octeontx2/otx2_mbox.c @@ -11,6 +11,7 @@ #include #include "otx2_mbox.h" +#include "otx2_dev.h" #define RVU_AF_AFPF_MBOX0 (0x02000) #define RVU_AF_AFPF_MBOX1 (0x02008) @@ -245,6 +246,63 @@ otx2_mbox_get_rsp(struct otx2_mbox *mbox, int devid, void **msg) return msghdr->rc; } +/** + * @internal + * Polling for given wait time to get mailbox response + */ +int +otx2_mbox_get_rsp_poll_tmo(struct otx2_mbox *mbox, int devid, void **msg, + uint32_t wait) +{ + struct otx2_mbox_dev *mdev = &mbox->dev[devid]; + uint32_t timeout = 0, sleep = 1; + struct mbox_msghdr *msghdr; + uint64_t rsp_reg = 0; + uintptr_t reg_addr; + uint64_t offset; + + rte_rmb(); + + offset = mbox->rx_start + + RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN); + msghdr = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset); + + reg_addr = mbox->reg_base + mbox->intr_offset; + while (!rsp_reg) { + rte_rmb(); + rsp_reg = otx2_read64(reg_addr); + + if (timeout >= wait) + return -ETIMEDOUT; + + rte_delay_ms(sleep); + timeout += sleep; + } + + if (msg != NULL) + *msg = msghdr; + + /* Clear interrupt */ + otx2_write64(rsp_reg, reg_addr); + + /* Reset mbox */ + otx2_mbox_reset(mbox, 0); + + return msghdr->rc; +} + +/** + * @internal + * Polling for 5 seconds to get mailbox response + */ +int +otx2_mbox_get_rsp_poll(struct otx2_mbox *mbox, int devid, void **msg) +{ + uint32_t wait = 5 * MS_PER_S; /* 5 Seconds */ + + return otx2_mbox_get_rsp_poll_tmo(mbox, devid, msg, wait); +} + /** * @internal * Wait and get mailbox response with timeout diff --git a/drivers/common/octeontx2/otx2_mbox.h b/drivers/common/octeontx2/otx2_mbox.h index 162d12468..237d4cf45 100644 --- a/drivers/common/octeontx2/otx2_mbox.h +++ b/drivers/common/octeontx2/otx2_mbox.h @@ -1570,6 +1570,13 @@ void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid); int otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid); int otx2_mbox_wait_for_rsp_tmo(struct otx2_mbox *mbox, int devid, uint32_t tmo); int otx2_mbox_get_rsp(struct otx2_mbox *mbox, int devid, void **msg); + +__rte_experimental +int otx2_mbox_get_rsp_poll(struct otx2_mbox *mbox, int devid, void **msg); +__rte_experimental +int otx2_mbox_get_rsp_poll_tmo(struct otx2_mbox *mbox, int devid, void **msg, + uint32_t tmo); + int otx2_mbox_get_rsp_tmo(struct otx2_mbox *mbox, int devid, void **msg, uint32_t tmo); int otx2_mbox_get_availmem(struct otx2_mbox *mbox, int devid); diff --git a/drivers/common/octeontx2/rte_common_octeontx2_version.map b/drivers/common/octeontx2/rte_common_octeontx2_version.map index adad21a2d..dcbca2444 100644 --- a/drivers/common/octeontx2/rte_common_octeontx2_version.map +++ b/drivers/common/octeontx2/rte_common_octeontx2_version.map @@ -33,3 +33,10 @@ DPDK_20.0 { local: *; }; + +EXPERIMENTAL { + global: + + otx2_mbox_get_rsp_poll; + otx2_mbox_get_rsp_poll_tmo; +}; From patchwork Mon Nov 25 11:35:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 63274 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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 */);