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 7A9E2A0524; Mon, 31 May 2021 23:44:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9EB4841176; Mon, 31 May 2021 23:43:01 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0BACA4111C for ; Mon, 31 May 2021 23:42:58 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14VLeDUG025917; Mon, 31 May 2021 14:42:56 -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-transfer-encoding : content-type; s=pfpt0220; bh=tNGBtjSIQv7CunIbLzbwoHM7X7jbo/yO415pAD84dHs=; b=MlBZvorxt613WX1K/2sYxA9Y9EkzpjL36c0dawF2Un0Wdo8UmyeSN0y+XJTj/i9ivMTO EwW2uuqN7BjhVLRrHou7Ok8WcGfZEWKPvo8kt1RvxZtTr/odE0Ry8dV8jj70hU1UNhKU X5QP9FHtEm2ySkTYYdIk2r7p2nL8V2FvNYpsDCbrLm5iTxyxQvYI7tpLm07GzQmMbfqE rrLZIQExHpUj5Bqed53ZeKIGjbUj8URgovO8tQSLT+9/HQY36ftxmaPdG+hbliatehvo +KGKu9aR8AGgsNjXFlSAUkOrADJ7CGSpB0wzL0Q0xoT+hIOSc3TpyOMcd05hIufaxT+b QQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 38vjqj33ad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 31 May 2021 14:42:56 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 31 May 2021 14:42:54 -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; Mon, 31 May 2021 14:42:54 -0700 Received: from EH-LT0048.marvell.com (unknown [10.193.32.52]) by maili.marvell.com (Postfix) with ESMTP id 5E6723F7040; Mon, 31 May 2021 14:42:53 -0700 (PDT) From: Tomasz Duszynski To: CC: , , Tomasz Duszynski , Ray Kinsella , Neil Horman Date: Mon, 31 May 2021 23:41:41 +0200 Message-ID: <20210531214142.30167-28-tduszynski@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210531214142.30167-1-tduszynski@marvell.com> References: <20210531214142.30167-1-tduszynski@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: tctk09Ysh3tROpiNmcWd_3lQPwKmkqE2 X-Proofpoint-ORIG-GUID: tctk09Ysh3tROpiNmcWd_3lQPwKmkqE2 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-31_15:2021-05-31, 2021-05-31 signatures=0 Subject: [dpdk-dev] [PATCH 27/28] raw/cnxk_bphy: add support for registering irq handlers 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 Sender: "dev" Custom irq handlers may be registered/removed on demand. This adds support for doing that. Since registration and removal are related they are in the same patch. Signed-off-by: Jakub Palider Signed-off-by: Tomasz Duszynski --- drivers/raw/cnxk_bphy/cnxk_bphy.c | 14 ++++++++++++ drivers/raw/cnxk_bphy/cnxk_bphy_irq.c | 33 +++++++++++++++++++++++++++ drivers/raw/cnxk_bphy/cnxk_bphy_irq.h | 12 ++++++++-- drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 6 +++++ drivers/raw/cnxk_bphy/version.map | 4 ++++ 5 files changed, 67 insertions(+), 2 deletions(-) diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c index c3aed3018..a6bbdd986 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c @@ -40,6 +40,20 @@ rte_pmd_bphy_intr_mem_get(uint16_t dev_id) return cnxk_bphy_mem_get(dev_id); } +int +rte_pmd_bphy_intr_register(uint16_t dev_id, int irq_num, + cnxk_bphy_intr_handler_t handler, void *data, + int cpu) +{ + return cnxk_bphy_intr_register(dev_id, irq_num, handler, data, cpu); +} + +void +rte_pmd_bphy_intr_unregister(uint16_t dev_id, int irq_num) +{ + cnxk_bphy_intr_unregister(dev_id, irq_num); +} + static const struct rte_rawdev_ops bphy_rawdev_ops = { }; diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c index 5a7698f23..45aada7bf 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c @@ -58,6 +58,39 @@ cnxk_bphy_intr_fini(uint16_t dev_id) bphy_dev->irq_chip = NULL; } +int +cnxk_bphy_intr_register(uint16_t dev_id, int irq_num, + cnxk_bphy_intr_handler_t handler, void *data, int cpu) +{ + struct roc_bphy_intr intr = { + .irq_num = irq_num, + .intr_handler = handler, + .isr_data = data, + .cpu = cpu + }; + + struct bphy_device *bphy_dev = cnxk_bphy_get_bphy_dev_by_dev_id(dev_id); + struct roc_bphy_irq_chip *irq_chip = bphy_dev->irq_chip; + + if (!irq_chip) + return -ENODEV; + if (!handler || !data) + return -EINVAL; + + return roc_bphy_intr_register(irq_chip, &intr); +} + +void +cnxk_bphy_intr_unregister(uint16_t dev_id, int irq_num) +{ + struct bphy_device *bphy_dev = cnxk_bphy_get_bphy_dev_by_dev_id(dev_id); + + if (bphy_dev->irq_chip) + roc_bphy_handler_clear(bphy_dev->irq_chip, irq_num); + else + plt_err("Missing irq chip"); +} + struct bphy_mem * cnxk_bphy_mem_get(uint16_t dev_id) { diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.h b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.h index e52106bc8..6eeb567ed 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.h +++ b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.h @@ -10,6 +10,8 @@ #include +typedef void (*cnxk_bphy_intr_handler_t)(int irq_num, void *isr_data); + struct bphy_mem { struct rte_mem_resource res0; struct rte_mem_resource res2; @@ -25,8 +27,14 @@ int cnxk_bphy_intr_init(uint16_t dev_id); __rte_internal void cnxk_bphy_intr_fini(uint16_t dev_id); __rte_internal -uint64_t cnxk_bphy_irq_max_get(uint16_t dev_id); -__rte_internal struct bphy_mem *cnxk_bphy_mem_get(uint16_t dev_id); +__rte_internal +int cnxk_bphy_intr_register(uint16_t dev_id, int irq_num, + cnxk_bphy_intr_handler_t handler, void *isr_data, + int cpu); +__rte_internal +void cnxk_bphy_intr_unregister(uint16_t dev_id, int irq_num); +__rte_internal +uint64_t cnxk_bphy_irq_max_get(uint16_t dev_id); #endif /* _CNXK_BPHY_IRQ_ */ diff --git a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h index 783b63471..d77bb3b23 100644 --- a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h +++ b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h @@ -110,6 +110,12 @@ int rte_pmd_bphy_intr_init(uint16_t dev_id); __rte_experimental struct cnxk_bphy_mem *rte_pmd_bphy_intr_mem_get(uint16_t dev_id); __rte_experimental +int rte_pmd_bphy_intr_register(uint16_t dev_id, int irq_num, + cnxk_bphy_intr_handler_t handler, void *isr_data, + int cpu); +__rte_experimental void rte_pmd_bphy_intr_fini(uint16_t dev_id); +__rte_experimental +void rte_pmd_bphy_intr_unregister(uint16_t dev_id, int irq_num); #endif /* _CNXK_BPHY_H_ */ diff --git a/drivers/raw/cnxk_bphy/version.map b/drivers/raw/cnxk_bphy/version.map index c7600a863..c4f9b20d0 100644 --- a/drivers/raw/cnxk_bphy/version.map +++ b/drivers/raw/cnxk_bphy/version.map @@ -6,6 +6,8 @@ INTERNAL { cnxk_bphy_intr_init; cnxk_bphy_intr_fini; + cnxk_bphy_intr_register; + cnxk_bphy_intr_unregister; cnxk_bphy_irq_max_get; cnxk_bphy_mem_get; }; @@ -15,4 +17,6 @@ EXPERIMENTAL { rte_pmd_bphy_intr_fini; rte_pmd_bphy_intr_init; rte_pmd_bphy_intr_mem_get; + rte_pmd_bphy_intr_register; + rte_pmd_bphy_intr_unregister; }; -- 2.25.1