From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 30B891B4C8; Fri, 5 Apr 2019 15:28:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:28:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="158546456" Received: from mhajkowx-mobl.ger.corp.intel.com ([10.104.116.181]) by fmsmga002.fm.intel.com with ESMTP; 05 Apr 2019 06:28:13 -0700 From: Hajkowski To: david.hunt@intel.com Cc: dev@dpdk.org, Marcin Hajkowski , stable@dpdk.org, Maxime Coquelin , Anatoly Burakov Date: Fri, 5 Apr 2019 15:24:52 +0200 Message-Id: <20190405132455.15468-2-marcinx.hajkowski@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190405132455.15468-1-marcinx.hajkowski@intel.com> References: <20190405132455.15468-1-marcinx.hajkowski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 1/4] power: fix invalid socket indicator value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: 20190402082121.5472-1-marcinx.hajkowski@intel.com List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Apr 2019 13:28:15 -0000 From: Marcin Hajkowski Currently 0 is being used for not connected slot indication. This is not consistent with linux doc which identifies 0 as valid (connected) slot, thus modification was done to change it. Fixes: cd0d5547 ("power: vm communication channels in guest") Cc: stable@dpdk.org Signed-off-by: Marcin Hajkowski Reviewed-by: Maxime Coquelin Acked-by: Anatoly Burakov --- lib/librte_power/guest_channel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c index c17ea46b4..9cf7d2cb2 100644 --- a/lib/librte_power/guest_channel.c +++ b/lib/librte_power/guest_channel.c @@ -19,7 +19,7 @@ #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1 -static int global_fds[RTE_MAX_LCORE]; +static int global_fds[RTE_MAX_LCORE] = { [0 ... RTE_MAX_LCORE-1] = -1 }; int guest_channel_host_connect(const char *path, unsigned int lcore_id) @@ -35,7 +35,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) return -1; } /* check if path is already open */ - if (global_fds[lcore_id] != 0) { + if (global_fds[lcore_id] != -1) { RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is already open with fd %d\n", lcore_id, global_fds[lcore_id]); return -1; @@ -84,7 +84,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) return 0; error: close(fd); - global_fds[lcore_id] = 0; + global_fds[lcore_id] = -1; return -1; } @@ -100,7 +100,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id) return -1; } - if (global_fds[lcore_id] == 0) { + if (global_fds[lcore_id] < 0) { RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not connected\n"); return -1; } @@ -134,8 +134,8 @@ guest_channel_host_disconnect(unsigned int lcore_id) lcore_id, RTE_MAX_LCORE-1); return; } - if (global_fds[lcore_id] == 0) + if (global_fds[lcore_id] < 0) return; close(global_fds[lcore_id]); - global_fds[lcore_id] = 0; + global_fds[lcore_id] = -1; } -- 2.17.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1FF20A0679 for ; Fri, 5 Apr 2019 15:28:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 10C641B4F4; Fri, 5 Apr 2019 15:28:21 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 30B891B4C8; Fri, 5 Apr 2019 15:28:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:28:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="158546456" Received: from mhajkowx-mobl.ger.corp.intel.com ([10.104.116.181]) by fmsmga002.fm.intel.com with ESMTP; 05 Apr 2019 06:28:13 -0700 From: Hajkowski To: david.hunt@intel.com Cc: dev@dpdk.org, Marcin Hajkowski , stable@dpdk.org, Maxime Coquelin , Anatoly Burakov Date: Fri, 5 Apr 2019 15:24:52 +0200 Message-Id: <20190405132455.15468-2-marcinx.hajkowski@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190405132455.15468-1-marcinx.hajkowski@intel.com> References: <20190405132455.15468-1-marcinx.hajkowski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 1/4] power: fix invalid socket indicator value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: 20190402082121.5472-1-marcinx.hajkowski@intel.com List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190405132452.F5DAZpXSCeAjSrQmDApfkgPW-5Zk8K9e7pGfBt7vfe0@z> From: Marcin Hajkowski Currently 0 is being used for not connected slot indication. This is not consistent with linux doc which identifies 0 as valid (connected) slot, thus modification was done to change it. Fixes: cd0d5547 ("power: vm communication channels in guest") Cc: stable@dpdk.org Signed-off-by: Marcin Hajkowski Reviewed-by: Maxime Coquelin Acked-by: Anatoly Burakov --- lib/librte_power/guest_channel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c index c17ea46b4..9cf7d2cb2 100644 --- a/lib/librte_power/guest_channel.c +++ b/lib/librte_power/guest_channel.c @@ -19,7 +19,7 @@ #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1 -static int global_fds[RTE_MAX_LCORE]; +static int global_fds[RTE_MAX_LCORE] = { [0 ... RTE_MAX_LCORE-1] = -1 }; int guest_channel_host_connect(const char *path, unsigned int lcore_id) @@ -35,7 +35,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) return -1; } /* check if path is already open */ - if (global_fds[lcore_id] != 0) { + if (global_fds[lcore_id] != -1) { RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is already open with fd %d\n", lcore_id, global_fds[lcore_id]); return -1; @@ -84,7 +84,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id) return 0; error: close(fd); - global_fds[lcore_id] = 0; + global_fds[lcore_id] = -1; return -1; } @@ -100,7 +100,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id) return -1; } - if (global_fds[lcore_id] == 0) { + if (global_fds[lcore_id] < 0) { RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not connected\n"); return -1; } @@ -134,8 +134,8 @@ guest_channel_host_disconnect(unsigned int lcore_id) lcore_id, RTE_MAX_LCORE-1); return; } - if (global_fds[lcore_id] == 0) + if (global_fds[lcore_id] < 0) return; close(global_fds[lcore_id]); - global_fds[lcore_id] = 0; + global_fds[lcore_id] = -1; } -- 2.17.2