From patchwork Sun Jun 18 19:24:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bodireddy, Bhanuprakash" X-Patchwork-Id: 777478 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 3wrPVH48V8z9s3w for ; Mon, 19 Jun 2017 05:36:07 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7E446AB6; Sun, 18 Jun 2017 19:33: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 171AD412 for ; Sun, 18 Jun 2017 19:33:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id AB1B5AB for ; Sun, 18 Jun 2017 19:33:40 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2017 12:33:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,357,1493708400"; d="scan'208";a="869270261" Received: from silpixa00393942.ir.intel.com (HELO silpixa00393942.ger.corp.intel.com) ([10.237.223.42]) by FMSMGA003.fm.intel.com with ESMTP; 18 Jun 2017 12:33:39 -0700 From: Bhanuprakash Bodireddy To: dev@openvswitch.org Date: Sun, 18 Jun 2017 20:24:17 +0100 Message-Id: <1497813871-27572-5-git-send-email-bhanuprakash.bodireddy@intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1497813871-27572-1-git-send-email-bhanuprakash.bodireddy@intel.com> References: <1497813871-27572-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, T_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] [RFC PATCH v3 04/18] 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 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/keepalive.h | 9 +++++++++ 2 files changed, 58 insertions(+) diff --git a/lib/keepalive.c b/lib/keepalive.c index 7d1c01c..747d947 100644 --- a/lib/keepalive.c +++ b/lib/keepalive.c @@ -50,6 +50,55 @@ 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; +} + +inline int +get_ka_init_status(void) +{ + return ka_init_status; +} + +/* Register packet processing PMD thread to KA framework. */ +void +ka_register_pmd_thread(int tid OVS_UNUSED, unsigned core_id) +{ + if (ka_is_enabled()) { + dpdk_register_pmd_core(core_id); + } +} + +/* Unregister packet processing PMD thread from KA framework. */ +void +ka_unregister_pmd_thread(int tid OVS_UNUSED, unsigned core_id) +{ + if (ka_is_enabled()) { + dpdk_unregister_pmd_core(core_id); + } +} + +/* Mark packet processing core alive. */ +inline 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..a35b309 100644 --- a/lib/keepalive.h +++ b/lib/keepalive.h @@ -71,4 +71,13 @@ 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, unsigned); +void ka_unregister_pmd_thread(int, 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); +int ka_get_pmd_tid(unsigned core); + #endif /* keepalive.h */