All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hajkowski <marcinx.hajkowski@intel.com>
To: david.hunt@intel.com
Cc: dev@dpdk.org, Marcin Hajkowski <marcinx.hajkowski@intel.com>,
	stable@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [dpdk-dev] [PATCH v5 1/4] power: fix invalid socket indicator value
Date: Fri,  5 Apr 2019 15:24:52 +0200	[thread overview]
Message-ID: <20190405132455.15468-2-marcinx.hajkowski@intel.com> (raw)
In-Reply-To: <20190405132455.15468-1-marcinx.hajkowski@intel.com>

From: Marcin Hajkowski <marcinx.hajkowski@intel.com>

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 <marcinx.hajkowski@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 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


  reply	other threads:[~2019-04-05 13:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 13:24 [dpdk-dev] [PATCH v5 0/4] bidirect guest channel Hajkowski
2019-04-05 13:24 ` Hajkowski [this message]
2019-09-27  8:42   ` [dpdk-dev] [PATCH v6 0/4] bidirectional " Marcin Hajkowski
2019-09-27  8:42     ` [dpdk-dev] [PATCH v6 1/4] power: fix invalid socket indicator value Marcin Hajkowski
2019-09-27  8:42     ` [dpdk-dev] [PATCH v6 2/4] power: extend guest channel API for reading Marcin Hajkowski
2019-09-27  8:42     ` [dpdk-dev] [PATCH v6 3/4] power: process incoming confirmation cmds Marcin Hajkowski
2019-09-27  8:42     ` [dpdk-dev] [PATCH v6 4/4] power: send confirmation cmd to vm guest Marcin Hajkowski
2019-10-27 18:29     ` [dpdk-dev] [PATCH v6 0/4] bidirectional guest channel Thomas Monjalon
2019-04-05 13:24 ` [dpdk-dev] [PATCH v5 2/4] power: extend guest channel API for reading Hajkowski
2019-09-26 13:00   ` Hunt, David
2019-09-26 15:53     ` Daly, Lee
2019-04-05 13:24 ` [dpdk-dev] [PATCH v5 3/4] power: process incoming confirmation cmds Hajkowski
2019-09-26 13:01   ` Hunt, David
2019-09-26 15:49     ` Daly, Lee
2019-04-05 13:24 ` [dpdk-dev] [PATCH v5 4/4] power: send confirmation cmd to vm guest Hajkowski
2019-09-26 13:06   ` Hunt, David
2019-09-26 15:47     ` Daly, Lee
2019-04-22 20:36 ` [dpdk-dev] [PATCH v5 0/4] bidirect guest channel Thomas Monjalon
2019-04-24  8:38   ` Hunt, David
2019-04-24  8:44     ` Thomas Monjalon
2019-07-04 19:55       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190405132455.15468-2-marcinx.hajkowski@intel.com \
    --to=marcinx.hajkowski@intel.com \
    --cc=20190402082121.5472-1-marcinx.hajkowski@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.