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 96CF2A0C43; Sat, 23 Oct 2021 01:33:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0DE134069D; Sat, 23 Oct 2021 01:33:49 +0200 (CEST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mails.dpdk.org (Postfix) with ESMTP id 6B30340150 for ; Sat, 23 Oct 2021 01:33:47 +0200 (CEST) Received: by mail-lf1-f54.google.com with SMTP id j21so194894lfe.0 for ; Fri, 22 Oct 2021 16:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GJLWwKn8112TliFm6ikgpXtXtbKVac0ZniYkzcr0b0Q=; b=WD26TIYTmGydb8kGjlQxSiYoz83H+yMFZdv+U4d7Tg7eKnMBMHZcMskuLc8iPJgtus y9xNLR4GiY7HOA99H/A0k7gCs3Vh7UaKiKM/gXujbQHbW/y8SrI97grfjk6tFPBdLkTA 1CVVF1ty9z5Mh5BUvBfeVEHur/BoRmPJxNDBEA95b/augO/Oj5EGakNludQ+ZB7jMCwD cpKkXFWk5PwxgeidRczMGV/VwN24D/6QwDNGxpaUvhzA/5gZBBAhSlw01grvhDSxwGDW jhYCtAJncglPRrGpD8zKmHpebWH/acpvv7szO1t8U7RFZORkxsxxGQNkP6uFjgCJffCS 3s9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GJLWwKn8112TliFm6ikgpXtXtbKVac0ZniYkzcr0b0Q=; b=WgrD1zFzXjtM3R01ktX1XlPUT2asGqmh9VeKTkvK2r2esCtyz2rghVDs0VGbRtsYK+ NK1Ps0oVIvL48rtUNCYgz4IyHloPyRzK/HGFRbdLJfwE232BTOdfm0oP5jw1ADOxeXB3 zeucdj0cGPrjwZKe0ZoiyzLsyimWRZPtBrCtGorE0Beb4M8fknPB9+vVzGXwfBNRVUr4 TnSZWzC68V/14ORM49o/9eVKDMXyhuY0IPb25HRo0T+rhkmippcvI/cQZPa6n/YZ/SEZ /eOBlRokRbUfA1AfT5agwyix0vT+aamJWzLKSvwrc8UhZ61e3fSdCLHncJvkR7PBq0mv e5Nw== X-Gm-Message-State: AOAM532E9/GW9Sqgkp5HE38zmEamClfkiiZcWgQ7zLNNorIYuq8Q7IO0 GSN0Ir4AFfRuy/vDwRnV9rk= X-Google-Smtp-Source: ABdhPJzPLb80gc4XTpc7k1enhu8MZlLdRHiJhLMIIoR3QBtT9O2XMbIOGFVfoabehc47uBz3yHwivg== X-Received: by 2002:a05:6512:3088:: with SMTP id z8mr2489836lfd.262.1634945626955; Fri, 22 Oct 2021 16:33:46 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id a14sm863390lfs.26.2021.10.22.16.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 16:33:46 -0700 (PDT) Date: Sat, 23 Oct 2021 02:33:45 +0300 From: Dmitry Kozlyuk To: Harman Kalra Cc: , Thomas Monjalon , Ray Kinsella , Message-ID: <20211023023345.558c5f5c@sovereign> In-Reply-To: <20211022204934.132186-2-hkalra@marvell.com> References: <20210826145726.102081-1-hkalra@marvell.com> <20211022204934.132186-1-hkalra@marvell.com> <20211022204934.132186-2-hkalra@marvell.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 1/6] eal/interrupts: implement get set APIs 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" 2021-10-23 02:19 (UTC+0530), Harman Kalra: > Prototype/Implement get set APIs for interrupt handle fields. > User wont be able to access any of the interrupt handle fields > directly while should use these get/set APIs to access/manipulate > them. > > Internal interrupt header i.e. rte_eal_interrupt.h is rearranged, > as APIs defined are moved to rte_interrupts.h and epoll specific > definitions are moved to a new header rte_epoll.h. > Later in the series rte_eal_interrupt.h will be removed. > > Signed-off-by: Harman Kalra > Acked-by: Ray Kinsella Hi Harman, After fixing some comment below feel free to add: Acked-by: Dmitry Kozlyuk > --- > MAINTAINERS | 1 + > lib/eal/common/eal_common_interrupts.c | 421 ++++++++++++++++ > lib/eal/common/meson.build | 1 + > lib/eal/include/meson.build | 1 + > lib/eal/include/rte_eal_interrupts.h | 209 +------- > lib/eal/include/rte_epoll.h | 118 +++++ > lib/eal/include/rte_interrupts.h | 648 ++++++++++++++++++++++++- > lib/eal/version.map | 46 +- > 8 files changed, 1232 insertions(+), 213 deletions(-) > create mode 100644 lib/eal/common/eal_common_interrupts.c > create mode 100644 lib/eal/include/rte_epoll.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 04ea23a04a..d2950400d2 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -211,6 +211,7 @@ F: app/test/test_memzone.c > > Interrupt Subsystem > M: Harman Kalra > +F: lib/eal/include/rte_epoll.h > F: lib/eal/*/*interrupts.* > F: app/test/test_interrupts.c > > diff --git a/lib/eal/common/eal_common_interrupts.c b/lib/eal/common/eal_common_interrupts.c > [...] > +int rte_intr_efds_index_get(const struct rte_intr_handle *intr_handle, > + int index) > +{ > + CHECK_VALID_INTR_HANDLE(intr_handle); > + > + if (index >= intr_handle->nb_intr) { > + RTE_LOG(ERR, EAL, "Invalid size %d, max limit %d\n", index, "size" -> "index" > + intr_handle->nb_intr); > + rte_errno = EINVAL; > + goto fail; > + } > + > + return intr_handle->efds[index]; > +fail: > + return -rte_errno; > +} > [...] > +int rte_intr_vec_list_alloc(struct rte_intr_handle *intr_handle, > + const char *name, int size) > +{ > + CHECK_VALID_INTR_HANDLE(intr_handle); > + > + /* Vector list already allocated */ > + if (intr_handle->intr_vec != NULL) > + return 0; What if `size > intr_handle->vec_list_size`? > + > + if (size > intr_handle->nb_intr) { > + RTE_LOG(ERR, EAL, "Invalid size %d, max limit %d\n", size, > + intr_handle->nb_intr); > + rte_errno = ERANGE; > + goto fail; > + } > + > + intr_handle->intr_vec = rte_zmalloc(name, size * sizeof(int), 0); > + if (intr_handle->intr_vec == NULL) { > + RTE_LOG(ERR, EAL, "Failed to allocate %d intr_vec", size); > + rte_errno = ENOMEM; > + goto fail; > + } > + > + intr_handle->vec_list_size = size; > + > + return 0; > +fail: > + return -rte_errno; > +} > [...] > diff --git a/lib/eal/include/rte_interrupts.h b/lib/eal/include/rte_interrupts.h > index cc3bf45d8c..a29232e16a 100644 > --- a/lib/eal/include/rte_interrupts.h > +++ b/lib/eal/include/rte_interrupts.h > @@ -5,8 +5,11 @@ > #ifndef _RTE_INTERRUPTS_H_ > #define _RTE_INTERRUPTS_H_ > > +#include > + > #include > #include > +#include > > /** > * @file > @@ -22,6 +25,16 @@ extern "C" { > /** Interrupt handle */ > struct rte_intr_handle; > > +/** Interrupt instance allocation flags > + * @see rte_intr_instance_alloc > + */ > +/** Interrupt instance would not be shared within primary secondary process. */ > +#define RTE_INTR_INSTANCE_F_UNSHARED 0x00000001 > +/** Interrupt instance could be shared within primary secondary process. */ > +#define RTE_INTR_INSTANCE_F_SHARED 0x00000002 Nits: "would not" -> "will not" "could" -> "will be" "within primary secondary process" -> "between primary and secondary processes" You previously suggested PRIVATE instead of UNSHARED, it sounded better, but no strog opinion. > [...] > +/** > + * @internal > + * This API is used to populate interrupt handle with src handler fields. "handler" -> "handle" > + * > + * @param intr_handle > + * Interrupt handle pointer. > + * @param src > + * Source interrupt handle to be cloned. > + * > + * @return > + * - On success, zero. > + * - On failure, a negative value and rte_errno is set. > + */ > +__rte_internal > +int > +rte_intr_instance_copy(struct rte_intr_handle *intr_handle, > + const struct rte_intr_handle *src); > [...] > +/** > + * @internal > + * This API returns the sources from where memory is allocated for interrupt > + * instance. > + * > + * @param intr_handle > + * pointer to the interrupt handle. > + * > + * @return > + * - On success, 1 corresponds to memory allocated via DPDK allocator APIs > + * - On success, 0 corresponds to memory allocated from traditional heap. > + * - On failure, negative value. > + */ > +__rte_internal > +int > +rte_intr_instance_alloc_flag_get(const struct rte_intr_handle *intr_handle); It returns flags passed on allow, so return value type and description is inaccurate. Should be uint32_t and a reference to the flag constants.