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 3C68142B9A; Thu, 25 May 2023 12:09:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3EB3142D49; Thu, 25 May 2023 12:08:50 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2058.outbound.protection.outlook.com [40.107.244.58]) by mails.dpdk.org (Postfix) with ESMTP id 88EB642D4A for ; Thu, 25 May 2023 12:08:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dKWFdmewlqik1IColDinZY560PLbSe5Civo0QAPQHzktlZCB4y/qxmqVCKAymDCfn4eQdDaKUzBRUeZXChtuv8MFhaJmIcxudsoB5ASvoIte9xkd3K+LJJE7uZVSs47uCy6oSR73GMKT42ADsVIRBYyc6VeRAc9OCgycAkvm5FTkTaSsImQZgXQzKObBnyZudoMBfcxXaezLJCJovFLn5IWbf6l48tnzkErth+lIzVbsrCS46A5c0ZV0dfNZGdk0A7sG5WQkRpyi30LrFiyl7nwjY8V92Ik7rp7O7H+9abcYKW54SZqAMYsGAgk1YiGmNJIh1DM1Tql1bvlodHv1ow== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0TewXA6L/eaAXiIwS8nPOW4zxULG1Em7Ok0IB9Ev6vs=; b=a2Q0x3oeI5vjNXpuaoQVvv5GVtL8i1dmGIem5jE/YuJJclIGn3rjF78DQSV1zihMEzzFPCty6o/vMgmDq9z4RSuGW/oZ6nKfKgmXwG9VKLkpfwGYr3MISYf2zsmD/COA4DFuuQ3dnZ2P1kGVgYkz8doazKQB39xqZYQiXc71TNGlTIZx9ae7KJ1AC1PJ8Z7xL9HJFjPm58TmymnXKECPhYFuzFgO6ZU/eB/CUte5cAqjLvUfsZoYGbLbvzQBQa5l4MflrwYv9QlzO61tCjrxmRVtDBokej33ng28xXaMUbGaJU2rM8quYNBvJC3E+US8qzjDfr1gqr5Ia/8Xkwf9xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0TewXA6L/eaAXiIwS8nPOW4zxULG1Em7Ok0IB9Ev6vs=; b=wwEDclcq2kjQrSRJQ3gpdVoJSZGEAzBA7jAmmG+nv7ATcDnrtHpdf3DtBQTfqxcZBItYxlZqLpaAXwB5Vk67s4Qyo7JgeLR9Kh/Cp4jIR7idB8C5qPmH4rgb1KhfElLP2BK7SgS9z1zdlv1UzWD9vFDpYdkupqdmiWczFp96S8Y= Received: from BN9PR03CA0631.namprd03.prod.outlook.com (2603:10b6:408:13b::6) by BL3PR12MB6570.namprd12.prod.outlook.com (2603:10b6:208:38d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Thu, 25 May 2023 10:08:46 +0000 Received: from BN8NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13b:cafe::74) by BN9PR03CA0631.outlook.office365.com (2603:10b6:408:13b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Thu, 25 May 2023 10:08:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT097.mail.protection.outlook.com (10.13.176.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.30 via Frontend Transport; Thu, 25 May 2023 10:08:45 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 05:08:45 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 03:08:45 -0700 Received: from xhdipdslab41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 05:08:42 -0500 From: Nipun Gupta To: , , , , , CC: , , , Nipun Gupta Subject: [PATCH v5 3/5] eal/interrupts: add IRQ count in interrupt handle Date: Thu, 25 May 2023 15:38:19 +0530 Message-ID: <20230525100821.12148-4-nipun.gupta@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230525100821.12148-1-nipun.gupta@amd.com> References: <20230124140746.594066-1-nipun.gupta@amd.com> <20230525100821.12148-1-nipun.gupta@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT097:EE_|BL3PR12MB6570:EE_ X-MS-Office365-Filtering-Correlation-Id: f7c478be-bcf7-4a52-69e4-08db5d0806f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i2yJ9rEKNT4anUCE3UPeGorOZ9S7uaC42Br0FHIWtXjt15F60zCLyBVAQ5oxpgsphms4LAsnVemj1zZRKly8bzVFu7pwMGTELp4PLXbav8N1+paMPVPsjR5Yb/ovZtR+YfvlDckJxX2lHUL5EkV9TAUz+8IoQcxR6GRRMM0N0hbPq9Ne71ucktylWOEqyRx77ZOs76pbtv5rDPpIlCplTpcr+rnAsVA6gjSy0Up5YVzgIrnTl+pAvDQX6UajiwoMD578BZJUOQYXp3hkd5GIhvPRgDSWEnm2JL7HdFOrxJc3ESB6bVhy6bJwzxzaDTq146S7Os0ErDoNo08zUSRW9gfC1NbY8Yzcz+Z8kRhKB8Ra+DsGxebuC4uHUqUU4Yo96P0K8uUI89fVZtbhszQp2/PKaQfWdZIL3JLWb2ffeRjdAce5EEB/c5XbeRjIInH8v8WDwtPzH0S+PoqeSDJvjr0d56uxuJfOxCn7pPr+T0VvpfMSR6UJffIsk0fICG/ZVOqhRCsgE/L0UCBt1Bym8Tod/H/dmNqNIEuqozR+rdcZGCtt5XkAhvcYbkzDMkbeqSjX66UaxaoEmCkJW3oHqxKuuD7alTkmBPxx0738fYwRLTNeU3LhLMHsxqkF3Dvj4+ysuXlYtRm0tUAEPWTvsDRzYO3w09wDbm+hDGiu2hSsK8M5Ze09e8Fbbo4Ph579pnNkSieoxU2QAgtaMoEVdGt3LXLSzJzmNEbMl9vpaVq2LunTZtJQnQIhynj5Z31i+RL3iU1fbcbIbWZtTfVMjw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(396003)(39860400002)(136003)(451199021)(46966006)(40470700004)(36840700001)(82740400003)(40460700003)(26005)(356005)(81166007)(186003)(1076003)(44832011)(2616005)(36860700001)(36756003)(47076005)(83380400001)(2906002)(426003)(336012)(40480700001)(41300700001)(110136005)(316002)(54906003)(6666004)(82310400005)(70586007)(478600001)(70206006)(4326008)(86362001)(8936002)(5660300002)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 10:08:45.9897 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7c478be-bcf7-4a52-69e4-08db5d0806f6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6570 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 Have total number of IRQ count support in interrupt handle. In case of VFIO this IRQ count is returned when VFIO_DEVICE_GET_IRQ_INFO ioctl is invoked. This IRQ_count can used by the devices to store/provide total number of interrupts available and to enable or disable these interrupts. Signed-off-by: Nipun Gupta Acked-by: Ferruh Yigit --- lib/eal/common/eal_common_interrupts.c | 21 +++++++++++++++++ lib/eal/common/eal_interrupts.h | 1 + lib/eal/include/rte_interrupts.h | 32 ++++++++++++++++++++++++++ lib/eal/version.map | 2 ++ 4 files changed, 56 insertions(+) diff --git a/lib/eal/common/eal_common_interrupts.c b/lib/eal/common/eal_common_interrupts.c index 97b64fed58..a0167d9ad4 100644 --- a/lib/eal/common/eal_common_interrupts.c +++ b/lib/eal/common/eal_common_interrupts.c @@ -398,6 +398,27 @@ int rte_intr_elist_index_set(struct rte_intr_handle *intr_handle, return -rte_errno; } +int rte_intr_irq_count_set(struct rte_intr_handle *intr_handle, + int irq_count) +{ + CHECK_VALID_INTR_HANDLE(intr_handle); + + intr_handle->irq_count = irq_count; + + return 0; +fail: + return -rte_errno; +} + +int rte_intr_irq_count_get(const struct rte_intr_handle *intr_handle) +{ + CHECK_VALID_INTR_HANDLE(intr_handle); + + return intr_handle->irq_count; +fail: + return -rte_errno; +} + int rte_intr_vec_list_alloc(struct rte_intr_handle *intr_handle, const char *name, int size) { diff --git a/lib/eal/common/eal_interrupts.h b/lib/eal/common/eal_interrupts.h index 482781b862..eaf8e20187 100644 --- a/lib/eal/common/eal_interrupts.h +++ b/lib/eal/common/eal_interrupts.h @@ -16,6 +16,7 @@ struct rte_intr_handle { }; uint32_t alloc_flags; /**< flags passed at allocation */ enum rte_intr_handle_type type; /**< handle type */ + uint32_t irq_count; /**< Total IRQ count */ uint32_t max_intr; /**< max interrupt requested */ uint32_t nb_efd; /**< number of available efd(event fd) */ uint8_t efd_counter_size; /**< size of efd counter, used for vdev */ diff --git a/lib/eal/include/rte_interrupts.h b/lib/eal/include/rte_interrupts.h index 487e3c8875..415d1fcac0 100644 --- a/lib/eal/include/rte_interrupts.h +++ b/lib/eal/include/rte_interrupts.h @@ -506,6 +506,38 @@ __rte_internal int rte_intr_max_intr_get(const struct rte_intr_handle *intr_handle); +/** + * @internal + * Set the IRQ count field of interrupt handle with user + * provided IRQ count value. + * + * @param intr_handle + * pointer to the interrupt handle. + * @param irq_count + * IRQ count + * + * @return + * - On success, zero. + * - On failure, a negative value and rte_errno is set. + */ +__rte_internal +int +rte_intr_irq_count_set(struct rte_intr_handle *intr_handle, int irq_count); + +/** + * @internal + * Returns the IRQ count field of the given interrupt handle instance. + * + * @param intr_handle + * pointer to the interrupt handle. + * + * @return + * - On success, ir count. + * - On failure, a negative value and rte_errno is set. + */ +__rte_internal +int rte_intr_irq_count_get(const struct rte_intr_handle *intr_handle); + /** * @internal * Set the number of event fd field of interrupt handle diff --git a/lib/eal/version.map b/lib/eal/version.map index 51a820d829..d31c942e04 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -458,6 +458,8 @@ INTERNAL { rte_intr_instance_dup; rte_intr_instance_windows_handle_get; rte_intr_instance_windows_handle_set; + rte_intr_irq_count_get; + rte_intr_irq_count_set; rte_intr_max_intr_get; rte_intr_max_intr_set; rte_intr_nb_efd_get; -- 2.17.1