* [PATCH] ibsim: support LID portions of directed-route SMPs
@ 2011-08-05 23:29 Rolf Manderscheid
[not found] ` <E1QpTpp-00026I-7p-nLM+XIojDeH72zTlGHhC+rDks+cytr/Z@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Rolf Manderscheid @ 2011-08-05 23:29 UTC (permalink / raw)
To: alexne-VPRAkNaXOzVWk0Htik3J/w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Heed the DRSLID and DRDLID fields in DR SMPs.
Signed-off-by: Rolf Manderscheid <rvm-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
ibsim/sim_mad.c | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c
index 61d4866..9396ca3 100644
--- a/ibsim/sim_mad.c
+++ b/ibsim/sim_mad.c
@@ -152,11 +152,8 @@ static int decode_sim_MAD(Client * cl, struct sim_request * r, ib_rpc_t * rpc,
if (rpc->mgtclass == 0x81) { // direct route
// word 9
- if (mad_get_field(buf, 0, IB_DRSMP_DRDLID_F) != 0xffff ||
- mad_get_field(buf, 0, IB_DRSMP_DRSLID_F) != 0xffff) {
- IBWARN("dr[ds]lids are used (not supported)");
- return -1;
- }
+ path->drslid = mad_get_field(buf, 0, IB_DRSMP_DRSLID_F);
+ path->drdlid = mad_get_field(buf, 0, IB_DRSMP_DRDLID_F);
// bytes 128 - 256
if (!response)
mad_get_array(buf, 0, IB_DRSMP_PATH_F, path->p);
@@ -1113,11 +1110,27 @@ static Port *direct_route_out_MAD(Port * port, ib_dr_path_t * path)
static Port *route_MAD(Port * port, int response, int lid, ib_dr_path_t * path)
{
- if (lid >= 0 && lid < 0xffff)
- return lid_route_MAD(port, lid);
+ if (lid >= 0 && lid < 0xffff) {
+ port = lid_route_MAD(port, lid);
+ if (!port)
+ return NULL;
+ if (!path)
+ return port;
+ } else if (!path)
+ return NULL; // permissive LID with no DR
+
+ if (response) {
+ port = direct_route_in_MAD(port, path);
+ lid = path->drslid;
+ } else {
+ port = direct_route_out_MAD(port, path);
+ lid = path->drdlid;
+ }
- return response ? direct_route_in_MAD(port, path) :
- direct_route_out_MAD(port, path);
+ if (port && lid >= 0 && lid < 0xffff)
+ port = lid_route_MAD(port, lid);
+
+ return port;
}
static Smpfn *get_handle_fn(ib_rpc_t rpc, int response)
@@ -1176,7 +1189,9 @@ int process_packet(Client * cl, void *p, int size, Client ** dcl)
return 0;
}
- if (!(port = route_MAD(cl->port, response, ntohs(r->dlid), &path))) {
+ port = route_MAD(cl->port, response, ntohs(r->dlid),
+ rpc.mgtclass == 0x81 ? &path : NULL);
+ if (!port) {
IBWARN("routing failed: no route to dest lid %u path %s",
ntohs(r->dlid), pathstr(0, &path));
goto _dropped;
--
1.7.1
--
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ibsim: support LID portions of directed-route SMPs
[not found] ` <E1QpTpp-00026I-7p-nLM+XIojDeH72zTlGHhC+rDks+cytr/Z@public.gmane.org>
@ 2011-08-09 14:50 ` Alex Netes
[not found] ` <20110809145018.GA2056-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Alex Netes @ 2011-08-09 14:50 UTC (permalink / raw)
To: Rolf Manderscheid; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Hi Rolf,
On 17:29 Fri 05 Aug , Rolf Manderscheid wrote:
>
> Heed the DRSLID and DRDLID fields in DR SMPs.
>
> Signed-off-by: Rolf Manderscheid <rvm-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> ---
> ibsim/sim_mad.c | 35 +++++++++++++++++++++++++----------
> 1 files changed, 25 insertions(+), 10 deletions(-)
>
> diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c
> index 61d4866..9396ca3 100644
> --- a/ibsim/sim_mad.c
> +++ b/ibsim/sim_mad.c
> @@ -152,11 +152,8 @@ static int decode_sim_MAD(Client * cl, struct sim_request * r, ib_rpc_t * rpc,
>
> if (rpc->mgtclass == 0x81) { // direct route
> // word 9
> - if (mad_get_field(buf, 0, IB_DRSMP_DRDLID_F) != 0xffff ||
> - mad_get_field(buf, 0, IB_DRSMP_DRSLID_F) != 0xffff) {
> - IBWARN("dr[ds]lids are used (not supported)");
> - return -1;
> - }
> + path->drslid = mad_get_field(buf, 0, IB_DRSMP_DRSLID_F);
> + path->drdlid = mad_get_field(buf, 0, IB_DRSMP_DRDLID_F);
> // bytes 128 - 256
> if (!response)
> mad_get_array(buf, 0, IB_DRSMP_PATH_F, path->p);
> @@ -1113,11 +1110,27 @@ static Port *direct_route_out_MAD(Port * port, ib_dr_path_t * path)
>
> static Port *route_MAD(Port * port, int response, int lid, ib_dr_path_t * path)
> {
> - if (lid >= 0 && lid < 0xffff)
> - return lid_route_MAD(port, lid);
> + if (lid >= 0 && lid < 0xffff) {
> + port = lid_route_MAD(port, lid);
> + if (!port)
> + return NULL;
> + if (!path)
> + return port;
> + } else if (!path)
> + return NULL; // permissive LID with no DR
> +
> + if (response) {
> + port = direct_route_in_MAD(port, path);
> + lid = path->drslid;
> + } else {
> + port = direct_route_out_MAD(port, path);
> + lid = path->drdlid;
> + }
>
> - return response ? direct_route_in_MAD(port, path) :
> - direct_route_out_MAD(port, path);
> + if (port && lid >= 0 && lid < 0xffff)
> + port = lid_route_MAD(port, lid);
> +
> + return port;
> }
route_MAD() breaks the LID route support.
>
> static Smpfn *get_handle_fn(ib_rpc_t rpc, int response)
> @@ -1176,7 +1189,9 @@ int process_packet(Client * cl, void *p, int size, Client ** dcl)
> return 0;
> }
>
> - if (!(port = route_MAD(cl->port, response, ntohs(r->dlid), &path))) {
> + port = route_MAD(cl->port, response, ntohs(r->dlid),
> + rpc.mgtclass == 0x81 ? &path : NULL);
> + if (!port) {
I guess you want to do the same for routing response mads.
> IBWARN("routing failed: no route to dest lid %u path %s",
> ntohs(r->dlid), pathstr(0, &path));
> goto _dropped;
> --
> 1.7.1
>
> --
> 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
--
-- Alex
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ibsim: support LID portions of directed-route SMPs
[not found] ` <20110809145018.GA2056-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
@ 2011-08-11 21:27 ` Rolf Manderscheid
0 siblings, 0 replies; 3+ messages in thread
From: Rolf Manderscheid @ 2011-08-11 21:27 UTC (permalink / raw)
To: Alex Netes; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Hi Alex,
> route_MAD() breaks the LID route support.
I think the change to route_MAD() is sound, there's no change in
behaviour for LID-routed packets. The path argument is expected to be
NULL in the case of a LID routed MAD, which causes an early
return, but this is only an optimization. Even if you forget to pass
in a NULL path (which I did in one case as you pointed out!), the
path->cnt will be zero for LID routed MADs which causes the
direct_route_*_MAD() functions to just return the same port that was
passed in, so it works either way. I tested this with some simple
topologies, running opensm and then doing a perfquery to each
simulated node. I also used python-rdma with a new python simulator
client which is the motivation for this patch. Without this change,
python-rdma exposes the missing handling of leading and/or trailing LIDs
in directed-route SMPs. I'll send an updated patch which passes a
NULL path for LID-routed packets at the second call site.
Rolf
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-11 21:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 23:29 [PATCH] ibsim: support LID portions of directed-route SMPs Rolf Manderscheid
[not found] ` <E1QpTpp-00026I-7p-nLM+XIojDeH72zTlGHhC+rDks+cytr/Z@public.gmane.org>
2011-08-09 14:50 ` Alex Netes
[not found] ` <20110809145018.GA2056-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
2011-08-11 21:27 ` Rolf Manderscheid
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox