* [PATCHv2 2/2] libibmad: Added smp_query/set _status_via functions
@ 2011-04-05 19:23 Hal Rosenstock
[not found] ` <4D9B6C40.5010801-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Hal Rosenstock @ 2011-04-05 19:23 UTC (permalink / raw)
To: Ira Weiny; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
The smp_query/set functions do not return the MAD status.
The new extended API allows getting the SMP MAD status, and
to differentiate between timeout on MAD response and response
with bad status.
Signed-off-by: Oren Kladnitsky <orenk-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Change since v1:
Proper formatting
diff --git a/include/infiniband/mad.h b/include/infiniband/mad.h
index a0b368a..5d18ec3 100644
--- a/include/infiniband/mad.h
+++ b/include/infiniband/mad.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2004-2009 Voltaire Inc. All rights reserved.
* Copyright (c) 2009 HNR Consulting. All rights reserved.
- * Copyright (c) 2009-2010 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2009-2011 Mellanox Technologies LTD. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
@@ -981,6 +981,14 @@ MAD_EXPORT uint8_t *smp_query_via(void *buf, ib_portid_t * id, unsigned attrid,
MAD_EXPORT uint8_t *smp_set_via(void *buf, ib_portid_t * id, unsigned attrid,
unsigned mod, unsigned timeout,
const struct ibmad_port *srcport);
+MAD_EXPORT uint8_t *smp_query_status_via(void *rcvbuf, ib_portid_t * portid,
+ unsigned attrid, unsigned mod,
+ unsigned timeout, int *rstatus,
+ const struct ibmad_port *srcport);
+MAD_EXPORT uint8_t *smp_set_status_via(void *data, ib_portid_t * portid,
+ unsigned attrid, unsigned mod,
+ unsigned timeout, int *rstatus,
+ const struct ibmad_port *srcport);
/* sa.c */
uint8_t *sa_call(void *rcvbuf, ib_portid_t * portid, ib_sa_call_t * sa,
diff --git a/src/libibmad.map b/src/libibmad.map
index 5778e3e..1e6a028 100644
--- a/src/libibmad.map
+++ b/src/libibmad.map
@@ -101,7 +101,9 @@ IBMAD_1.3 {
ib_vendor_call;
ib_vendor_call_via;
smp_query_via;
+ smp_query_status_via;
smp_set_via;
+ smp_set_status_via;
ib_path_query_via;
ib_resolve_smlid_via;
ib_resolve_guid_via;
diff --git a/src/rpc.c b/src/rpc.c
index c5246fe..a702046 100644
--- a/src/rpc.c
+++ b/src/rpc.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2004-2009 Voltaire Inc. All rights reserved.
* Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
@@ -243,6 +244,8 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * rpc,
redirect = 0;
}
+ rpc->rstatus = status;
+
if (status != 0) {
ERRS("MAD completed with error status 0x%x; dport (%s)",
status, portid2str(dport));
diff --git a/src/smp.c b/src/smp.c
index 3ff58ce..a337663 100644
--- a/src/smp.c
+++ b/src/smp.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2004-2009 Voltaire Inc. All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
@@ -45,11 +46,12 @@
#undef DEBUG
#define DEBUG if (ibdebug) IBWARN
-uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid,
- unsigned mod, unsigned timeout,
- const struct ibmad_port *srcport)
+uint8_t *smp_set_status_via(void *data, ib_portid_t * portid, unsigned attrid,
+ unsigned mod, unsigned timeout, int *rstatus,
+ const struct ibmad_port *srcport)
{
ib_rpc_t rpc = { 0 };
+ uint8_t *res;
DEBUG("attr 0x%x mod 0x%x route %s", attrid, mod, portid2str(portid));
if ((portid->lid <= 0) ||
@@ -69,7 +71,18 @@ uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid,
portid->sl = 0;
portid->qp = 0;
- return mad_rpc(srcport, &rpc, portid, data, data);
+ res = mad_rpc(srcport, &rpc, portid, data, data);
+ if (rstatus)
+ *rstatus = rpc.rstatus;
+ return res;
+}
+
+uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid,
+ unsigned mod, unsigned timeout,
+ const struct ibmad_port *srcport)
+{
+ return smp_set_status_via(data, portid, attrid, mod, timeout, NULL,
+ srcport);
}
uint8_t *smp_set(void *data, ib_portid_t * portid, unsigned attrid,
@@ -78,11 +91,12 @@ uint8_t *smp_set(void *data, ib_portid_t * portid, unsigned attrid,
return smp_set_via(data, portid, attrid, mod, timeout, ibmp);
}
-uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid,
- unsigned mod, unsigned timeout,
- const struct ibmad_port * srcport)
+uint8_t *smp_query_status_via(void *rcvbuf, ib_portid_t * portid,
+ unsigned attrid, unsigned mod, unsigned timeout,
+ int *rstatus, const struct ibmad_port * srcport)
{
ib_rpc_t rpc = { 0 };
+ uint8_t *res;
DEBUG("attr 0x%x mod 0x%x route %s", attrid, mod, portid2str(portid));
rpc.method = IB_MAD_METHOD_GET;
@@ -102,7 +116,18 @@ uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid,
portid->sl = 0;
portid->qp = 0;
- return mad_rpc(srcport, &rpc, portid, rcvbuf, rcvbuf);
+ res = mad_rpc(srcport, &rpc, portid, rcvbuf, rcvbuf);
+ if (rstatus)
+ *rstatus = rpc.rstatus;
+ return res;
+}
+
+uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid,
+ unsigned mod, unsigned timeout,
+ const struct ibmad_port * srcport)
+{
+ return smp_query_status_via(rcvbuf, portid, attrid, mod, timeout, NULL,
+ srcport);
}
uint8_t *smp_query(void *rcvbuf, ib_portid_t * portid, unsigned attrid,
--
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] 2+ messages in thread[parent not found: <4D9B6C40.5010801-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>]
* Re: [PATCHv2 2/2] libibmad: Added smp_query/set _status_via functions [not found] ` <4D9B6C40.5010801-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> @ 2011-04-08 22:31 ` Ira Weiny 0 siblings, 0 replies; 2+ messages in thread From: Ira Weiny @ 2011-04-08 22:31 UTC (permalink / raw) To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Thanks applied, Ira On Tue, 5 Apr 2011 12:23:44 -0700 Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote: > > The smp_query/set functions do not return the MAD status. > The new extended API allows getting the SMP MAD status, and > to differentiate between timeout on MAD response and response > with bad status. > > Signed-off-by: Oren Kladnitsky <orenk-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> > Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > --- > Change since v1: > Proper formatting > > diff --git a/include/infiniband/mad.h b/include/infiniband/mad.h > index a0b368a..5d18ec3 100644 > --- a/include/infiniband/mad.h > +++ b/include/infiniband/mad.h > @@ -1,7 +1,7 @@ > /* > * Copyright (c) 2004-2009 Voltaire Inc. All rights reserved. > * Copyright (c) 2009 HNR Consulting. All rights reserved. > - * Copyright (c) 2009-2010 Mellanox Technologies LTD. All rights reserved. > + * Copyright (c) 2009-2011 Mellanox Technologies LTD. All rights reserved. > * > * This software is available to you under a choice of one of two > * licenses. You may choose to be licensed under the terms of the GNU > @@ -981,6 +981,14 @@ MAD_EXPORT uint8_t *smp_query_via(void *buf, ib_portid_t * id, unsigned attrid, > MAD_EXPORT uint8_t *smp_set_via(void *buf, ib_portid_t * id, unsigned attrid, > unsigned mod, unsigned timeout, > const struct ibmad_port *srcport); > +MAD_EXPORT uint8_t *smp_query_status_via(void *rcvbuf, ib_portid_t * portid, > + unsigned attrid, unsigned mod, > + unsigned timeout, int *rstatus, > + const struct ibmad_port *srcport); > +MAD_EXPORT uint8_t *smp_set_status_via(void *data, ib_portid_t * portid, > + unsigned attrid, unsigned mod, > + unsigned timeout, int *rstatus, > + const struct ibmad_port *srcport); > > /* sa.c */ > uint8_t *sa_call(void *rcvbuf, ib_portid_t * portid, ib_sa_call_t * sa, > diff --git a/src/libibmad.map b/src/libibmad.map > index 5778e3e..1e6a028 100644 > --- a/src/libibmad.map > +++ b/src/libibmad.map > @@ -101,7 +101,9 @@ IBMAD_1.3 { > ib_vendor_call; > ib_vendor_call_via; > smp_query_via; > + smp_query_status_via; > smp_set_via; > + smp_set_status_via; > ib_path_query_via; > ib_resolve_smlid_via; > ib_resolve_guid_via; > diff --git a/src/rpc.c b/src/rpc.c > index c5246fe..a702046 100644 > --- a/src/rpc.c > +++ b/src/rpc.c > @@ -1,6 +1,7 @@ > /* > * Copyright (c) 2004-2009 Voltaire Inc. All rights reserved. > * Copyright (c) 2009 HNR Consulting. All rights reserved. > + * Copyright (c) 2011 Mellanox Technologies LTD. All rights reserved. > * > * This software is available to you under a choice of one of two > * licenses. You may choose to be licensed under the terms of the GNU > @@ -243,6 +244,8 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * rpc, > redirect = 0; > } > > + rpc->rstatus = status; > + > if (status != 0) { > ERRS("MAD completed with error status 0x%x; dport (%s)", > status, portid2str(dport)); > diff --git a/src/smp.c b/src/smp.c > index 3ff58ce..a337663 100644 > --- a/src/smp.c > +++ b/src/smp.c > @@ -1,5 +1,6 @@ > /* > * Copyright (c) 2004-2009 Voltaire Inc. All rights reserved. > + * Copyright (c) 2011 Mellanox Technologies LTD. All rights reserved. > * > * This software is available to you under a choice of one of two > * licenses. You may choose to be licensed under the terms of the GNU > @@ -45,11 +46,12 @@ > #undef DEBUG > #define DEBUG if (ibdebug) IBWARN > > -uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid, > - unsigned mod, unsigned timeout, > - const struct ibmad_port *srcport) > +uint8_t *smp_set_status_via(void *data, ib_portid_t * portid, unsigned attrid, > + unsigned mod, unsigned timeout, int *rstatus, > + const struct ibmad_port *srcport) > { > ib_rpc_t rpc = { 0 }; > + uint8_t *res; > > DEBUG("attr 0x%x mod 0x%x route %s", attrid, mod, portid2str(portid)); > if ((portid->lid <= 0) || > @@ -69,7 +71,18 @@ uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid, > portid->sl = 0; > portid->qp = 0; > > - return mad_rpc(srcport, &rpc, portid, data, data); > + res = mad_rpc(srcport, &rpc, portid, data, data); > + if (rstatus) > + *rstatus = rpc.rstatus; > + return res; > +} > + > +uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid, > + unsigned mod, unsigned timeout, > + const struct ibmad_port *srcport) > +{ > + return smp_set_status_via(data, portid, attrid, mod, timeout, NULL, > + srcport); > } > > uint8_t *smp_set(void *data, ib_portid_t * portid, unsigned attrid, > @@ -78,11 +91,12 @@ uint8_t *smp_set(void *data, ib_portid_t * portid, unsigned attrid, > return smp_set_via(data, portid, attrid, mod, timeout, ibmp); > } > > -uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid, > - unsigned mod, unsigned timeout, > - const struct ibmad_port * srcport) > +uint8_t *smp_query_status_via(void *rcvbuf, ib_portid_t * portid, > + unsigned attrid, unsigned mod, unsigned timeout, > + int *rstatus, const struct ibmad_port * srcport) > { > ib_rpc_t rpc = { 0 }; > + uint8_t *res; > > DEBUG("attr 0x%x mod 0x%x route %s", attrid, mod, portid2str(portid)); > rpc.method = IB_MAD_METHOD_GET; > @@ -102,7 +116,18 @@ uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid, > portid->sl = 0; > portid->qp = 0; > > - return mad_rpc(srcport, &rpc, portid, rcvbuf, rcvbuf); > + res = mad_rpc(srcport, &rpc, portid, rcvbuf, rcvbuf); > + if (rstatus) > + *rstatus = rpc.rstatus; > + return res; > +} > + > +uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid, > + unsigned mod, unsigned timeout, > + const struct ibmad_port * srcport) > +{ > + return smp_query_status_via(rcvbuf, portid, attrid, mod, timeout, NULL, > + srcport); > } > > uint8_t *smp_query(void *rcvbuf, ib_portid_t * portid, unsigned attrid, > -- > 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 -- Ira Weiny Math Programmer/Computer Scientist Lawrence Livermore National Lab 925-423-8008 weiny2-i2BcT+NCU+M@public.gmane.org -- 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] 2+ messages in thread
end of thread, other threads:[~2011-04-08 22:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05 19:23 [PATCHv2 2/2] libibmad: Added smp_query/set _status_via functions Hal Rosenstock
[not found] ` <4D9B6C40.5010801-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-04-08 22:31 ` Ira Weiny
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox