From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 09438A04FD; Tue, 14 Jan 2020 09:37:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E1811C246; Tue, 14 Jan 2020 09:37:51 +0100 (CET) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by dpdk.org (Postfix) with ESMTP id 65B831C244 for ; Tue, 14 Jan 2020 09:37:50 +0100 (CET) Received: by mail-io1-f67.google.com with SMTP id n11so12905916iom.9 for ; Tue, 14 Jan 2020 00:37:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7lOtZzDODVwwtQagmFAzTvWn4lwluzOvgj0WTf84Prg=; b=KvDBf3W8+nhGklR4icMXfaSWEWDAhpODobAm15Fkia4FMPZ26BsI9moqG+7iAdKaQm 00sS70Se3uiu284jqfkjRVuflfCBPvbVN2Vqaz6C9eFocRfAOKz7IIAMhP8itwpxtKYA A2M9NkUOzr8XW1dM0Jwqf/Z5+SK0wrSsf5Kyh4/QYJ9selqxBs0XZAUzL5MqivVQ1E7c 0NJUherPlJNipv4Kjtz1faijYoCgotbUHfkldvSi6/wgY8G+lIcMyFGHc0jIiLGb7v28 wRQEB1KrO5y44Lyao9k/pzwy+HnWDT2/DCFLtfo0FJy9leWRPW0jF8/EFWsEnCE+F0De CbWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7lOtZzDODVwwtQagmFAzTvWn4lwluzOvgj0WTf84Prg=; b=VPIadBBio/3HkYt723hh11pDAbxyjZlg4eAWhJQ/wva78WfNQzW4MhRuiKx2xua5eV pPpA4Cl4kEjr35SkFn3CLppu4GZZ1m7/B4lDD1is5ixNUqQUHgIn+5RlJlZcIxNQp3Ph qjm/DmXoAjjWbZes20kaHsDM3KcvTaseZoY7G8vyRK9GVuIAptzVaQGSvxHYG5RqprW/ /nFWNpJYYRHUDyxckpQZSkQKGd/Viy66OVUYM2+hPpQljG8G5qbb1+1CkyqCIBtB24lr ljLP2aEtNkj2W8N/6VXZaj3DBvWwqjtkO6LJcJQDDpLZxss4RY1E/nWA5xzwy08sjnf2 cihg== X-Gm-Message-State: APjAAAW14vS3BT7azNE+K9akAPHIQjVPecOBrVI2cPuub04+Zh0idcsP 08e9LbrZUqCXtn9RzGcMO5VwG4WhSrLHLUjclMg= X-Google-Smtp-Source: APXvYqxCXAhpqog4C900DdCh86a+fIyDl7nvsqZ9q2oO3uOcb3vRpK4YxartZKwe2x0072GHyjf6H+OgYWJN/7zr+Oc= X-Received: by 2002:a5e:8e4d:: with SMTP id r13mr14999268ioo.60.1578991069605; Tue, 14 Jan 2020 00:37:49 -0800 (PST) MIME-Version: 1.0 References: <20191218070721.16768-2-skori@marvell.com> <20191220065645.22858-1-skori@marvell.com> In-Reply-To: <20191220065645.22858-1-skori@marvell.com> From: Jerin Jacob Date: Tue, 14 Jan 2020 14:07:33 +0530 Message-ID: To: Sunil Kumar Kori , Thomas Monjalon , David Marchand Cc: Bruce Richardson , dpdk-dev , Harman Kalra Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v6 1/2] 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" On Fri, Dec 20, 2019 at 12:26 PM Sunil Kumar Kori wrote: > > From: Harman Kalra > > 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 Reviewed-by: Jerin Jacob > --- > v6: > - No changes. > v5: > - Fix shared library compilation error > v4: > - No changes. > v3: > - API Comment is updated as per man page. > - Scope updated within the library/driver only. > - Remove experimental tag > v2: > - Rebased patch on 19.11-rc4 > > lib/librte_eal/common/include/rte_eal_interrupts.h | 11 +++++++++++ > 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, 22 insertions(+) > > diff --git a/lib/librte_eal/common/include/rte_eal_interrupts.h b/lib/librte_eal/common/include/rte_eal_interrupts.h > index b370c0d26..19d1d45ab 100644 > --- a/lib/librte_eal/common/include/rte_eal_interrupts.h > +++ b/lib/librte_eal/common/include/rte_eal_interrupts.h > @@ -220,4 +220,15 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle); > int > rte_intr_cap_multiple(struct rte_intr_handle *intr_handle); > > +/** > + * @internal > + * Check if currently executing in interrupt context > + * > + * @return > + * - non zero in case of interrupt context > + * - zero in case of process context > + */ > +int > +rte_thread_is_intr(void); > + > #endif /* _RTE_EAL_INTERRUPTS_H_ */ > 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 14ebb108c..cb8e10709 100644 > --- a/lib/librte_eal/linux/eal/eal_interrupts.c > +++ b/lib/librte_eal/linux/eal/eal_interrupts.c > @@ -1488,3 +1488,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..06ed2e9dc 100644 > --- a/lib/librte_eal/rte_eal_version.map > +++ b/lib/librte_eal/rte_eal_version.map > @@ -91,6 +91,7 @@ DPDK_20.0 { > rte_intr_free_epoll_fd; > rte_intr_rx_ctl; > rte_intr_tls_epfd; > + rte_thread_is_intr; > rte_keepalive_create; > rte_keepalive_dispatch_pings; > rte_keepalive_mark_alive; > -- > 2.17.1 >