From patchwork Sun Jun 18 19:24:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bodireddy, Bhanuprakash" X-Patchwork-Id: 777475 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 3wrPSD1VTPz9s3w for ; Mon, 19 Jun 2017 05:34:20 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 63898728; Sun, 18 Jun 2017 19:33:42 +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 4E70D2C for ; Sun, 18 Jun 2017 19:33:38 +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 A575E147 for ; Sun, 18 Jun 2017 19:33:37 +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:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,357,1493708400"; d="scan'208";a="869270250" 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:36 -0700 From: Bhanuprakash Bodireddy To: dev@openvswitch.org Date: Sun, 18 Jun 2017 20:24:14 +0100 Message-Id: <1497813871-27572-2-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 01/18] dpdk: Add helper functions for DPDK datapath keepalive. 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 Introduce helper functions in 'dpdk' module that are needed for DPDK keepalive functionality. Also add dummy functions in 'dpdk-stub' module that are needed when DPDK datapath is not available. Signed-off-by: Bhanuprakash Bodireddy --- lib/dpdk-stub.c | 24 ++++++++++++++++++++++++ lib/dpdk.c | 31 +++++++++++++++++++++++++++++++ lib/dpdk.h | 10 ++++++++++ 3 files changed, 65 insertions(+) diff --git a/lib/dpdk-stub.c b/lib/dpdk-stub.c index daef729..d7fb19b 100644 --- a/lib/dpdk-stub.c +++ b/lib/dpdk-stub.c @@ -48,3 +48,27 @@ dpdk_get_vhost_sock_dir(void) { return NULL; } + +void +dpdk_register_pmd_core(unsigned core_id OVS_UNUSED) +{ + /* Nothing */ +} + +void +dpdk_unregister_pmd_core(unsigned core_id OVS_UNUSED) +{ + /* Nothing */ +} + +void +dpdk_mark_pmd_core_alive(void) +{ + /* Nothing */ +} + +void +dpdk_mark_pmd_core_sleep(void) +{ + /* Nothing */ +} diff --git a/lib/dpdk.c b/lib/dpdk.c index 8da6c32..8db63bf 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #ifdef DPDK_PDUMP @@ -489,3 +490,33 @@ dpdk_set_lcore_id(unsigned cpu) ovs_assert(cpu != NON_PMD_CORE_ID); RTE_PER_LCORE(_lcore_id) = cpu; } + +/* Register packet processing core 'core_id' for liveness checks. */ +void +dpdk_register_pmd_core(unsigned core) +{ + rte_keepalive_register_core(rte_global_keepalive_info, core); +} + +void +dpdk_unregister_pmd_core(unsigned core OVS_UNUSED) +{ + /* XXX: DPDK unfortunately hasn't implemented unregister API + * This will be fixed later, instead use sleep API now. + */ + rte_keepalive_mark_sleep(rte_global_keepalive_info); +} + +/* Mark packet processing core alive. */ +void +dpdk_mark_pmd_core_alive(void) +{ + rte_keepalive_mark_alive(rte_global_keepalive_info); +} + +/* Mark packet processing core as idle. */ +void +dpdk_mark_pmd_core_sleep(void) +{ + rte_keepalive_mark_sleep(rte_global_keepalive_info); +} diff --git a/lib/dpdk.h b/lib/dpdk.h index 673a1f1..bdbb51b 100644 --- a/lib/dpdk.h +++ b/lib/dpdk.h @@ -17,6 +17,7 @@ #ifndef DPDK_H #define DPDK_H +#include #ifdef DPDK_NETDEV #include @@ -26,14 +27,23 @@ #else +#include + #define NON_PMD_CORE_ID UINT32_MAX #endif /* DPDK_NETDEV */ struct smap; +struct rte_keepalive *rte_global_keepalive_info; void dpdk_init(const struct smap *ovs_other_config); void dpdk_set_lcore_id(unsigned cpu); const char *dpdk_get_vhost_sock_dir(void); +/* Keepalive APIs */ +void dpdk_register_pmd_core(unsigned core_id); +void dpdk_unregister_pmd_core(unsigned core_id); +void dpdk_mark_pmd_core_alive(void); +void dpdk_mark_pmd_core_sleep(void); + #endif /* dpdk.h */