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 E661DA0C4C; Mon, 25 Oct 2021 15:38:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D300840E3C; Mon, 25 Oct 2021 15:38:35 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 736F54003E for ; Mon, 25 Oct 2021 15:38:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635169114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z+WXFP8U8NW39vxQcpSXoehwqx4aTGPFAWfAT5XM3qg=; b=cjEpnBRkpqidgUgImx4x4HXlE5J/zvahsLDPzMFfxl7kBiMP/3dYQCnQNbFpHn83+Cubku ZgM1BHiAWHqrDXGpNMYwoAQM/x8z90XcqLjXHJOJ8EsjvKiuh0nPmb5IhfzhhvcRS1IS/T cV70FbjMPzzny+7OrNd3hAgtwv+PaPg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-535-B6msBSw4MLiqamuAQDQiPA-1; Mon, 25 Oct 2021 09:38:32 -0400 X-MC-Unique: B6msBSw4MLiqamuAQDQiPA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 434979F92B; Mon, 25 Oct 2021 13:38:31 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BB3218533; Mon, 25 Oct 2021 13:38:29 +0000 (UTC) From: David Marchand To: hkalra@marvell.com, dev@dpdk.org Cc: dmitry.kozliuk@gmail.com, rasland@nvidia.com, thomas@monjalon.net Date: Mon, 25 Oct 2021 15:34:53 +0200 Message-Id: <20211025133456.26850-8-david.marchand@redhat.com> In-Reply-To: <20211025133456.26850-1-david.marchand@redhat.com> References: <20211022204934.132186-1-hkalra@marvell.com> <20211025133456.26850-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH v7 7/9] interrupts: make interrupt handle structure opaque 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" From: Harman Kalra Moving interrupt handle structure definition inside a EAL private header to make its fields totally opaque to the outside world. Signed-off-by: Harman Kalra Signed-off-by: David Marchand --- Changes since v5: - let rte_intr_handle fields untouched: - split vfio / uio fd renames in a separate commit, - split event list update in a separate commit, - moved rte_intr_handle definition to a EAL private header, - preserved dumping all info in interrupt tracepoints, --- lib/eal/common/eal_common_interrupts.c | 2 + lib/eal/common/eal_interrupts.h | 37 +++++++++++++ lib/eal/include/meson.build | 1 - lib/eal/include/rte_eal_interrupts.h | 72 -------------------------- lib/eal/include/rte_eal_trace.h | 2 + lib/eal/include/rte_interrupts.h | 24 ++++++++- 6 files changed, 63 insertions(+), 75 deletions(-) create mode 100644 lib/eal/common/eal_interrupts.h delete mode 100644 lib/eal/include/rte_eal_interrupts.h diff --git a/lib/eal/common/eal_common_interrupts.c b/lib/eal/common/eal_common_interrupts.c index d6e6654fbb..1337c560e4 100644 --- a/lib/eal/common/eal_common_interrupts.c +++ b/lib/eal/common/eal_common_interrupts.c @@ -10,6 +10,8 @@ #include #include +#include "eal_interrupts.h" + /* Macros to check for valid interrupt handle */ #define CHECK_VALID_INTR_HANDLE(intr_handle) do { \ if (intr_handle == NULL) { \ diff --git a/lib/eal/common/eal_interrupts.h b/lib/eal/common/eal_interrupts.h new file mode 100644 index 0000000000..beacc04b62 --- /dev/null +++ b/lib/eal/common/eal_interrupts.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation + */ + +#ifndef EAL_INTERRUPTS_H +#define EAL_INTERRUPTS_H + +struct rte_intr_handle { + RTE_STD_C11 + union { + struct { + RTE_STD_C11 + union { + /** VFIO device file descriptor */ + int vfio_dev_fd; + /** UIO cfg file desc for uio_pci_generic */ + int uio_cfg_fd; + }; + int fd; /**< interrupt event file descriptor */ + }; + void *windows_handle; /**< device driver handle */ + }; + uint32_t alloc_flags; /**< flags passed at allocation */ + enum rte_intr_handle_type type; /**< handle type */ + 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 */ + uint16_t nb_intr; + /**< Max vector count, default RTE_MAX_RXTX_INTR_VEC_ID */ + int efds[RTE_MAX_RXTX_INTR_VEC_ID]; /**< intr vectors/efds mapping */ + struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID]; + /**< intr vector epoll event */ + uint16_t vec_list_size; + int *intr_vec; /**< intr vector number array */ +}; + +#endif /* EAL_INTERRUPTS_H */ diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build index 8e258607b8..86468d1a2b 100644 --- a/lib/eal/include/meson.build +++ b/lib/eal/include/meson.build @@ -49,7 +49,6 @@ headers += files( 'rte_version.h', 'rte_vfio.h', ) -indirect_headers += files('rte_eal_interrupts.h') # special case install the generic headers, since they go in a subdir generic_headers = files( diff --git a/lib/eal/include/rte_eal_interrupts.h b/lib/eal/include/rte_eal_interrupts.h deleted file mode 100644 index 60bb60ca59..0000000000 --- a/lib/eal/include/rte_eal_interrupts.h +++ /dev/null @@ -1,72 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2014 Intel Corporation - */ - -#ifndef _RTE_INTERRUPTS_H_ -#error "don't include this file directly, please include generic " -#endif - -/** - * @file rte_eal_interrupts.h - * @internal - * - * Contains function prototypes exposed by the EAL for interrupt handling by - * drivers and other DPDK internal consumers. - */ - -#ifndef _RTE_EAL_INTERRUPTS_H_ -#define _RTE_EAL_INTERRUPTS_H_ - -#define RTE_MAX_RXTX_INTR_VEC_ID 512 -#define RTE_INTR_VEC_ZERO_OFFSET 0 -#define RTE_INTR_VEC_RXTX_OFFSET 1 - -/** - * The interrupt source type, e.g. UIO, VFIO, ALARM etc. - */ -enum rte_intr_handle_type { - RTE_INTR_HANDLE_UNKNOWN = 0, /**< generic unknown handle */ - RTE_INTR_HANDLE_UIO, /**< uio device handle */ - RTE_INTR_HANDLE_UIO_INTX, /**< uio generic handle */ - RTE_INTR_HANDLE_VFIO_LEGACY, /**< vfio device handle (legacy) */ - RTE_INTR_HANDLE_VFIO_MSI, /**< vfio device handle (MSI) */ - RTE_INTR_HANDLE_VFIO_MSIX, /**< vfio device handle (MSIX) */ - RTE_INTR_HANDLE_ALARM, /**< alarm handle */ - RTE_INTR_HANDLE_EXT, /**< external handler */ - RTE_INTR_HANDLE_VDEV, /**< virtual device */ - RTE_INTR_HANDLE_DEV_EVENT, /**< device event handle */ - RTE_INTR_HANDLE_VFIO_REQ, /**< VFIO request handle */ - RTE_INTR_HANDLE_MAX /**< count of elements */ -}; - -/** Handle for interrupts. */ -struct rte_intr_handle { - RTE_STD_C11 - union { - struct { - RTE_STD_C11 - union { - /** VFIO device file descriptor */ - int vfio_dev_fd; - /** UIO cfg file desc for uio_pci_generic */ - int uio_cfg_fd; - }; - int fd; /**< interrupt event file descriptor */ - }; - void *windows_handle; /**< device driver handle */ - }; - uint32_t alloc_flags; /**< flags passed at allocation */ - enum rte_intr_handle_type type; /**< handle type */ - 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 */ - uint16_t nb_intr; - /**< Max vector count, default RTE_MAX_RXTX_INTR_VEC_ID */ - int efds[RTE_MAX_RXTX_INTR_VEC_ID]; /**< intr vectors/efds mapping */ - struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID]; - /**< intr vector epoll event */ - uint16_t vec_list_size; - int *intr_vec; /**< intr vector number array */ -}; - -#endif /* _RTE_EAL_INTERRUPTS_H_ */ diff --git a/lib/eal/include/rte_eal_trace.h b/lib/eal/include/rte_eal_trace.h index 495ae1ee1d..af7b2d0bf0 100644 --- a/lib/eal/include/rte_eal_trace.h +++ b/lib/eal/include/rte_eal_trace.h @@ -19,6 +19,8 @@ extern "C" { #include #include +#include "eal_interrupts.h" + /* Alarm */ RTE_TRACE_POINT( rte_eal_trace_alarm_set, diff --git a/lib/eal/include/rte_interrupts.h b/lib/eal/include/rte_interrupts.h index a515a8c073..edbf0faeef 100644 --- a/lib/eal/include/rte_interrupts.h +++ b/lib/eal/include/rte_interrupts.h @@ -35,6 +35,28 @@ struct rte_intr_handle; /** Interrupt instance will be shared between primary and secondary processes. */ #define RTE_INTR_INSTANCE_F_SHARED RTE_BIT32(0) +#define RTE_MAX_RXTX_INTR_VEC_ID 512 +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1 + +/** + * The interrupt source type, e.g. UIO, VFIO, ALARM etc. + */ +enum rte_intr_handle_type { + RTE_INTR_HANDLE_UNKNOWN = 0, /**< generic unknown handle */ + RTE_INTR_HANDLE_UIO, /**< uio device handle */ + RTE_INTR_HANDLE_UIO_INTX, /**< uio generic handle */ + RTE_INTR_HANDLE_VFIO_LEGACY, /**< vfio device handle (legacy) */ + RTE_INTR_HANDLE_VFIO_MSI, /**< vfio device handle (MSI) */ + RTE_INTR_HANDLE_VFIO_MSIX, /**< vfio device handle (MSIX) */ + RTE_INTR_HANDLE_ALARM, /**< alarm handle */ + RTE_INTR_HANDLE_EXT, /**< external handler */ + RTE_INTR_HANDLE_VDEV, /**< virtual device */ + RTE_INTR_HANDLE_DEV_EVENT, /**< device event handle */ + RTE_INTR_HANDLE_VFIO_REQ, /**< VFIO request handle */ + RTE_INTR_HANDLE_MAX /**< count of elements */ +}; + /** Function to be registered for the specific interrupt */ typedef void (*rte_intr_callback_fn)(void *cb_arg); @@ -45,8 +67,6 @@ typedef void (*rte_intr_callback_fn)(void *cb_arg); typedef void (*rte_intr_unregister_callback_fn)(struct rte_intr_handle *intr_handle, void *cb_arg); -#include "rte_eal_interrupts.h" - /** * It registers the callback for the specific interrupt. Multiple * callbacks can be registered at the same time. -- 2.23.0