From patchwork Fri Aug 4 08:07:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bodireddy, Bhanuprakash" X-Patchwork-Id: 797679 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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 3xP0Hh4THMz9s72 for ; Fri, 4 Aug 2017 18:21:04 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9B149B6E; Fri, 4 Aug 2017 08:17:45 +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 1E82CB65 for ; Fri, 4 Aug 2017 08:17:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id AD68B14D for ; Fri, 4 Aug 2017 08:17:40 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Aug 2017 01:17:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,320,1498546800"; d="scan'208";a="295690586" Received: from silpixa00393942.ir.intel.com (HELO silpixa00393942.ger.corp.intel.com) ([10.237.223.42]) by fmsmga004.fm.intel.com with ESMTP; 04 Aug 2017 01:17:39 -0700 From: Bhanuprakash Bodireddy To: dev@openvswitch.org Date: Fri, 4 Aug 2017 09:07:52 +0100 Message-Id: <1501834086-31829-6-git-send-email-bhanuprakash.bodireddy@intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1501834086-31829-1-git-send-email-bhanuprakash.bodireddy@intel.com> References: <1501834086-31829-1-git-send-email-bhanuprakash.bodireddy@intel.com> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 v3 05/19] keepalive: Add more helper functions to KA framework. 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 introduces helper functions in 'keepalive' module that are needed to register/unregister PMD threads to KA framework. Also introduce APIs to mark the PMD core states. Signed-off-by: Bhanuprakash Bodireddy --- lib/keepalive.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/keepalive.h | 8 ++++++++ 2 files changed, 59 insertions(+) diff --git a/lib/keepalive.c b/lib/keepalive.c index e93dc99..66c969d 100644 --- a/lib/keepalive.c +++ b/lib/keepalive.c @@ -49,6 +49,57 @@ ka_get_pmd_tid(unsigned core_idx) return tid; } +/* Return the Keepalive timer interval. */ +inline uint32_t +get_ka_interval(void) +{ + return keepalive_timer_interval; +} + +int +get_ka_init_status(void) +{ + return ka_init_status; +} + +/* Register thread to KA framework. */ +void +ka_register_pmd_thread(int tid OVS_UNUSED, bool thread_is_pmd OVS_UNUSED, + unsigned core_id) +{ + if (ka_is_enabled()) { + dpdk_register_pmd_core(core_id); + } +} + +/* Unregister thread from KA framework. */ +void +ka_unregister_pmd_thread(int tid OVS_UNUSED, bool thread_is_pmd OVS_UNUSED, + unsigned core_id) +{ + if (ka_is_enabled()) { + dpdk_unregister_pmd_core(core_id); + } +} + +/* Mark packet processing core alive. */ +void +ka_mark_pmd_thread_alive(void) +{ + if (ka_is_enabled()) { + dpdk_mark_pmd_core_alive(); + } +} + +/* Mark packet processing core as idle. */ +inline void +ka_mark_pmd_thread_sleep(void) +{ + if (ka_is_enabled()) { + dpdk_mark_pmd_core_sleep(); + } +} + void ka_set_pmd_state_ts(unsigned core_id, enum keepalive_state state, uint64_t last_alive) diff --git a/lib/keepalive.h b/lib/keepalive.h index b87b66f..c96f2d0 100644 --- a/lib/keepalive.h +++ b/lib/keepalive.h @@ -71,4 +71,12 @@ void ka_set_pmd_state_ts(unsigned, enum keepalive_state, uint64_t); int ka_get_pmd_tid(unsigned core); bool ka_is_enabled(void); +void ka_register_pmd_thread(int, bool, unsigned); +void ka_unregister_pmd_thread(int, bool, unsigned); +void ka_mark_pmd_thread_alive(void); +void ka_mark_pmd_thread_sleep(void); + +uint32_t get_ka_interval(void); +int get_ka_init_status(void); + #endif /* keepalive.h */