From patchwork Mon Jul 3 20:27:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bodireddy, Bhanuprakash" X-Patchwork-Id: 783629 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x1fCZ21hyz9s9Y for ; Tue, 4 Jul 2017 06:40:26 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 511ECB56; Mon, 3 Jul 2017 20:36:27 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D0FF8B1F for ; Mon, 3 Jul 2017 20:36:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6EBCB12F for ; Mon, 3 Jul 2017 20:36:24 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 03 Jul 2017 13:36:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,305,1496127600"; d="scan'208";a="104096427" Received: from silpixa00393942.ir.intel.com (HELO silpixa00393942.ger.corp.intel.com) ([10.237.223.42]) by orsmga004.jf.intel.com with ESMTP; 03 Jul 2017 13:36:22 -0700 From: Bhanuprakash Bodireddy To: dev@openvswitch.org Date: Mon, 3 Jul 2017 21:27:20 +0100 Message-Id: <1499113653-19440-8-git-send-email-bhanuprakash.bodireddy@intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1499113653-19440-1-git-send-email-bhanuprakash.bodireddy@intel.com> References: <1499113653-19440-1-git-send-email-bhanuprakash.bodireddy@intel.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 07/20] dpif-netdev: Add helper function to store datapath tids. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This commit adds an API to store the PMD thread ids in to KA info struct. The thread ids shall be used to check false positives and for status and statistics reporting. Signed-off-by: Bhanuprakash Bodireddy --- lib/dpif-netdev.c | 3 +++ lib/keepalive.c | 13 +++++++++++++ lib/keepalive.h | 1 + 3 files changed, 17 insertions(+) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 4e29085..55a658c 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -48,6 +48,7 @@ #include "fat-rwlock.h" #include "flow.h" #include "hmapx.h" +#include "keepalive.h" #include "latch.h" #include "netdev.h" #include "netdev-vport.h" @@ -3707,6 +3708,8 @@ pmd_thread_main(void *f_) poll_list = NULL; + ka_store_pmd_id(pmd->core_id); + /* Stores the pmd thread's 'pmd' to 'per_pmd_key'. */ ovsthread_setspecific(pmd->dp->per_pmd_key, pmd); ovs_numa_thread_setaffinity_core(pmd->core_id); diff --git a/lib/keepalive.c b/lib/keepalive.c index 80e47ef..da58663 100644 --- a/lib/keepalive.c +++ b/lib/keepalive.c @@ -63,6 +63,19 @@ get_ka_init_status(void) return ka_init_status; } +void +ka_store_pmd_id(unsigned core_idx) +{ + int tid = -1; +#ifdef DPDK_NETDEV + tid = rte_sys_gettid(); +#endif + + if (ka_is_enabled()) { + ka_info->thread_id[core_idx] = tid; + } +} + /* Register thread to KA framework. */ void ka_register_pmd_thread(int tid OVS_UNUSED, bool thread_is_pmd OVS_UNUSED, diff --git a/lib/keepalive.h b/lib/keepalive.h index c96f2d0..f74b23a 100644 --- a/lib/keepalive.h +++ b/lib/keepalive.h @@ -76,6 +76,7 @@ void ka_unregister_pmd_thread(int, bool, unsigned); void ka_mark_pmd_thread_alive(void); void ka_mark_pmd_thread_sleep(void); +void ka_store_pmd_id(unsigned core); uint32_t get_ka_interval(void); int get_ka_init_status(void);