From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: "Chu, Al" <chu11-i2BcT+NCU+M@public.gmane.org>
Cc: "linux-rdma
(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH ibsim] sim_client.c: Set issm flag on connect when SIM_SET_ISSM set
Date: Mon, 24 Jun 2013 09:08:10 -0400 [thread overview]
Message-ID: <51C844BA.1050608@dev.mellanox.co.il> (raw)
When the SIM_SET_ISSM environment variable is set, ibsim did not
set the issm bit until after an ibsim connection was complete. This
allowed multiple SMs to actively run as the SM on the the same port.
Slight rework of original patch from Al Chu.
Signed-off-by: Albert L. Chu <chu11-i2BcT+NCU+M@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
diff --git a/umad2sim/sim_client.c b/umad2sim/sim_client.c
index eb42a7c..cec72d9 100644
--- a/umad2sim/sim_client.c
+++ b/umad2sim/sim_client.c
@@ -173,12 +173,16 @@ static int sim_attach(int fd, union name_t *name, size_t size)
return 0;
}
-static int sim_connect(struct sim_client *sc, int id, int qp, char *nodeid)
+static int sim_connect(struct sim_client *sc, int id, int qp, char *nodeid,
+ char *issm)
{
struct sim_client_info info = { 0 };
info.id = id;
- info.issm = 0;
+ if (issm)
+ info.issm = 1;
+ else
+ info.issm = 0;
info.qp = qp;
if (nodeid)
@@ -200,7 +204,7 @@ static int sim_disconnect(struct sim_client *sc)
return sim_ctl(sc, SIM_CTL_DISCONNECT, 0, 0);
}
-static int sim_init(struct sim_client *sc, char *nodeid)
+static int sim_init(struct sim_client *sc, char *nodeid, char *issm)
{
union name_t name;
socklen_t size;
@@ -254,7 +258,7 @@ static int sim_init(struct sim_client *sc, char *nodeid)
IBPANIC("can't read data from bound socket");
port = ntohs(name.name_i.sin_port);
- sc->clientid = sim_connect(sc, remote_mode ? port : pid, 0, nodeid);
+ sc->clientid = sim_connect(sc, remote_mode ? port : pid, 0, nodeid, issm);
if (sc->clientid < 0)
IBPANIC("connect failed");
@@ -284,9 +288,11 @@ int sim_client_set_sm(struct sim_client *sc, unsigned issm)
int sim_client_init(struct sim_client *sc)
{
char *nodeid;
+ char *issm;
nodeid = getenv("SIM_HOST");
- if (sim_init(sc, nodeid) < 0)
+ issm = getenv("SIM_SET_ISSM");
+ if (sim_init(sc, nodeid, issm) < 0)
return -1;
if (sim_ctl(sc, SIM_CTL_GET_VENDOR, &sc->vendor,
sizeof(sc->vendor)) < 0)
@@ -301,7 +307,7 @@ int sim_client_init(struct sim_client *sc)
goto _exit;
if (sim_ctl(sc, SIM_CTL_GET_PKEYS, sc->pkeys, sizeof(sc->pkeys)) < 0)
goto _exit;
- if (getenv("SIM_SET_ISSM"))
+ if (issm)
sim_client_set_sm(sc, 1);
return 0;
_exit:
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2013-06-24 13:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=51C844BA.1050608@dev.mellanox.co.il \
--to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
--cc=chu11-i2BcT+NCU+M@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox