Re: [openib-general] [PATCH] opensm: libibmad: rpc API which supports more than one ports.
On 12:13 Wed 30 Aug , Hal Rosenstock wrote: > Hi Sasha, > > On Tue, 2006-08-29 at 21:29, Sasha Khapyorsky wrote: > > Hi Hal, > > > > On 20:09 Tue 29 Aug , Hal Rosenstock wrote: > > > Hi Sasha, > > > > > > On Fri, 2006-08-25 at 09:17, Sasha Khapyorsky wrote: > > > > This provides RPC like API which may work with several ports. > > > > > > I think you mean "can work" rather "may work" :-) > > > > Yes. > > > > Some limitation we will have from libumad - this tracks already open > > ports. I'm not sure why (the same port can be opened from another > > process or by forking current). I think this may be the next > > improvement there. > > OK. > > > > > Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]> > > > > --- > > > > > > > > libibmad/include/infiniband/mad.h |9 +++ > > > > libibmad/src/libibmad.map |4 + > > > > libibmad/src/register.c | 20 +-- > > > > libibmad/src/rpc.c| 106 > > > > +++-- > > > > libibumad/src/umad.c |4 + > > > > > > ../doc/libibmad.txt should also be updated appropriately for the new > > > routines. > > > > Sure, I thought to stabilize this API first. > > OK. > > > > > 5 files changed, 130 insertions(+), 13 deletions(-) > > > > > > > > diff --git a/libibmad/include/infiniband/mad.h > > > > b/libibmad/include/infiniband/mad.h > > > > index 45ff572..bd8a80b 100644 > > > > --- a/libibmad/include/infiniband/mad.h > > > > +++ b/libibmad/include/infiniband/mad.h > > > > @@ -660,6 +660,7 @@ uint64_t mad_trid(void); > > > > intmad_build_pkt(void *umad, ib_rpc_t *rpc, ib_portid_t *dport, > > > > ib_rmpp_hdr_t *rmpp, void *data); > > > > > > > > /* register.c */ > > > > +intmad_register_port_client(int port_id, int mgmt, uint8_t > > > > rmpp_version); > > > > intmad_register_client(int mgmt, uint8_t rmpp_version); > > > > intmad_register_server(int mgmt, uint8_t rmpp_version, > > > > uint32_t method_mask[4], uint32_t > > > > class_oui); > > > > @@ -704,6 +705,14 @@ void madrpc_lock(void); > > > > void madrpc_unlock(void); > > > > void madrpc_show_errors(int set); > > > > > > > > +void * mad_rpc_open_port(char *dev_name, int dev_port, int > > > > *mgmt_classes, > > > > + int num_classes); > > > > +void mad_rpc_close_port(void *ibmad_port); > > > > +void * mad_rpc(void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport, > > > > + void *payload, void *rcvdata); > > > > +void * mad_rpc_rmpp(void *ibmad_port, ib_rpc_t *rpc, ib_portid_t > > > > *dport, > > > > +ib_rmpp_hdr_t *rmpp, void *data); > > > > + > > > > /* smp.c */ > > > > uint8_t * smp_query(void *buf, ib_portid_t *id, uint attrid, uint mod, > > > > uint timeout); > > > > diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map > > > > index bf81bd1..78b7ff0 100644 > > > > --- a/libibmad/src/libibmad.map > > > > +++ b/libibmad/src/libibmad.map > > > > @@ -62,6 +62,10 @@ IBMAD_1.0 { > > > > > > This should be 1.1 > > > > Ok. > > > > > > > > > ib_resolve_self; > > > > ib_resolve_smlid; > > > > ibdebug; > > > > + mad_rpc_open_port; > > > > + mad_rpc_close_port; > > > > + mad_rpc; > > > > + mad_rpc_rmpp; > > > > madrpc; > > > > madrpc_def_timeout; > > > > madrpc_init; > > > > > > What about mad_register_port_client ? Should that be included here ? > > > > It is not used externally - all registrations are done in _open(). So I > > don't see this as part of the new "API". Maybe if we will decide to > > extend it later we will need to "export" this symbol. > > OK. > > > > > diff --git a/libibmad/src/register.c b/libibmad/src/register.c > > > > index 4f44625..52d6989 100644 > > > > --- a/libibmad/src/register.c > > > > +++ b/libibmad/src/register.c > > > > @@ -43,6 +43,7 @@ #include > > > > #include > > > > #include > > > > #include > > > > +#include > > > > > > > > #include > > > > #include "mad.h" > > > > @@ -118,7 +119,7 @@ mad_agent_class(int agent) > > > > } > > > > > > > > int > > > > -mad_register_client(int mgmt, uint8_t rmpp_version) > > > > +mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version) > > > > { > > > > int vers, agent; > > > > > > > > @@ -126,7 +127,7 @@ mad_register_client(int mgmt, uint8_t rm > > > > DEBUG("Unknown class %d mgmt_class", mgmt); > > > > return -1; > > > > } > > > > - if ((agent = umad_register(madrpc_portid(), mgmt, > > > > + if ((agent = umad_register(port_id, mgmt, > > > >vers, rmpp_version, 0)) < 0) { > > > > DEBUG("Can't register agent for class %d", mgmt); > > > > return -1; > > > > @@ -137,13 +138,22 @@ mad_
Re: [openib-general] [PATCH] opensm: libibmad: rpc API which supports more than one ports.
On Fri, 2006-08-25 at 09:17, Sasha Khapyorsky wrote: > This provides RPC like API which may work with several ports. > > Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]> > --- > > libibmad/include/infiniband/mad.h |9 +++ > libibmad/src/libibmad.map |4 + > libibmad/src/register.c | 20 +-- > libibmad/src/rpc.c| 106 > +++-- > libibumad/src/umad.c |4 + > 5 files changed, 130 insertions(+), 13 deletions(-) Thanks. Applied (to trunk only) as two changes. -- Hal ___ openib-general mailing list openib-general@openib.org http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
Re: [openib-general] [PATCH] opensm: libibmad: rpc API which supports more than one ports.
Hi Sasha, On Tue, 2006-08-29 at 21:29, Sasha Khapyorsky wrote: > Hi Hal, > > On 20:09 Tue 29 Aug , Hal Rosenstock wrote: > > Hi Sasha, > > > > On Fri, 2006-08-25 at 09:17, Sasha Khapyorsky wrote: > > > This provides RPC like API which may work with several ports. > > > > I think you mean "can work" rather "may work" :-) > > Yes. > > Some limitation we will have from libumad - this tracks already open > ports. I'm not sure why (the same port can be opened from another > process or by forking current). I think this may be the next > improvement there. OK. > > > Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]> > > > --- > > > > > > libibmad/include/infiniband/mad.h |9 +++ > > > libibmad/src/libibmad.map |4 + > > > libibmad/src/register.c | 20 +-- > > > libibmad/src/rpc.c| 106 > > > +++-- > > > libibumad/src/umad.c |4 + > > > > ../doc/libibmad.txt should also be updated appropriately for the new > > routines. > > Sure, I thought to stabilize this API first. OK. > > > 5 files changed, 130 insertions(+), 13 deletions(-) > > > > > > diff --git a/libibmad/include/infiniband/mad.h > > > b/libibmad/include/infiniband/mad.h > > > index 45ff572..bd8a80b 100644 > > > --- a/libibmad/include/infiniband/mad.h > > > +++ b/libibmad/include/infiniband/mad.h > > > @@ -660,6 +660,7 @@ uint64_t mad_trid(void); > > > int mad_build_pkt(void *umad, ib_rpc_t *rpc, ib_portid_t *dport, > > > ib_rmpp_hdr_t *rmpp, void *data); > > > > > > /* register.c */ > > > +int mad_register_port_client(int port_id, int mgmt, uint8_t > > > rmpp_version); > > > int mad_register_client(int mgmt, uint8_t rmpp_version); > > > int mad_register_server(int mgmt, uint8_t rmpp_version, > > > uint32_t method_mask[4], uint32_t class_oui); > > > @@ -704,6 +705,14 @@ void madrpc_lock(void); > > > void madrpc_unlock(void); > > > void madrpc_show_errors(int set); > > > > > > +void * mad_rpc_open_port(char *dev_name, int dev_port, int > > > *mgmt_classes, > > > + int num_classes); > > > +void mad_rpc_close_port(void *ibmad_port); > > > +void * mad_rpc(void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport, > > > + void *payload, void *rcvdata); > > > +void * mad_rpc_rmpp(void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport, > > > + ib_rmpp_hdr_t *rmpp, void *data); > > > + > > > /* smp.c */ > > > uint8_t * smp_query(void *buf, ib_portid_t *id, uint attrid, uint mod, > > > uint timeout); > > > diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map > > > index bf81bd1..78b7ff0 100644 > > > --- a/libibmad/src/libibmad.map > > > +++ b/libibmad/src/libibmad.map > > > @@ -62,6 +62,10 @@ IBMAD_1.0 { > > > > This should be 1.1 > > Ok. > > > > > > ib_resolve_self; > > > ib_resolve_smlid; > > > ibdebug; > > > + mad_rpc_open_port; > > > + mad_rpc_close_port; > > > + mad_rpc; > > > + mad_rpc_rmpp; > > > madrpc; > > > madrpc_def_timeout; > > > madrpc_init; > > > > What about mad_register_port_client ? Should that be included here ? > > It is not used externally - all registrations are done in _open(). So I > don't see this as part of the new "API". Maybe if we will decide to > extend it later we will need to "export" this symbol. OK. > > > diff --git a/libibmad/src/register.c b/libibmad/src/register.c > > > index 4f44625..52d6989 100644 > > > --- a/libibmad/src/register.c > > > +++ b/libibmad/src/register.c > > > @@ -43,6 +43,7 @@ #include > > > #include > > > #include > > > #include > > > +#include > > > > > > #include > > > #include "mad.h" > > > @@ -118,7 +119,7 @@ mad_agent_class(int agent) > > > } > > > > > > int > > > -mad_register_client(int mgmt, uint8_t rmpp_version) > > > +mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version) > > > { > > > int vers, agent; > > > > > > @@ -126,7 +127,7 @@ mad_register_client(int mgmt, uint8_t rm > > > DEBUG("Unknown class %d mgmt_class", mgmt); > > > return -1; > > > } > > > - if ((agent = umad_register(madrpc_portid(), mgmt, > > > + if ((agent = umad_register(port_id, mgmt, > > > vers, rmpp_version, 0)) < 0) { > > > DEBUG("Can't register agent for class %d", mgmt); > > > return -1; > > > @@ -137,13 +138,22 @@ mad_register_client(int mgmt, uint8_t rm > > > return -1; > > > } > > > > > > - if (register_agent(agent, mgmt) < 0) > > > - return -1; > > > - > > > return agent; > > > } > > > > > > int > > > +mad_register_client(int mgmt, uint8_t rmpp_version) > > > +{ > > > + int agent; > > > + > > > + agent = mad_register_port_client(madrpc_portid(), mgmt, rmpp_version); > > > + if (agent < 0) > > > + return agent; > > > + > > > + return re
Re: [openib-general] [PATCH] opensm: libibmad: rpc API which supports more than one ports.
Hi Hal, On 20:09 Tue 29 Aug , Hal Rosenstock wrote: > Hi Sasha, > > On Fri, 2006-08-25 at 09:17, Sasha Khapyorsky wrote: > > This provides RPC like API which may work with several ports. > > I think you mean "can work" rather "may work" :-) Yes. Some limitation we will have from libumad - this tracks already open ports. I'm not sure why (the same port can be opened from another process or by forking current). I think this may be the next improvement there. > > > Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]> > > --- > > > > libibmad/include/infiniband/mad.h |9 +++ > > libibmad/src/libibmad.map |4 + > > libibmad/src/register.c | 20 +-- > > libibmad/src/rpc.c| 106 > > +++-- > > libibumad/src/umad.c |4 + > > ../doc/libibmad.txt should also be updated appropriately for the new > routines. Sure, I thought to stabilize this API first. > > > 5 files changed, 130 insertions(+), 13 deletions(-) > > > > diff --git a/libibmad/include/infiniband/mad.h > > b/libibmad/include/infiniband/mad.h > > index 45ff572..bd8a80b 100644 > > --- a/libibmad/include/infiniband/mad.h > > +++ b/libibmad/include/infiniband/mad.h > > @@ -660,6 +660,7 @@ uint64_t mad_trid(void); > > intmad_build_pkt(void *umad, ib_rpc_t *rpc, ib_portid_t *dport, > > ib_rmpp_hdr_t *rmpp, void *data); > > > > /* register.c */ > > +intmad_register_port_client(int port_id, int mgmt, uint8_t > > rmpp_version); > > intmad_register_client(int mgmt, uint8_t rmpp_version); > > intmad_register_server(int mgmt, uint8_t rmpp_version, > > uint32_t method_mask[4], uint32_t class_oui); > > @@ -704,6 +705,14 @@ void madrpc_lock(void); > > void madrpc_unlock(void); > > void madrpc_show_errors(int set); > > > > +void * mad_rpc_open_port(char *dev_name, int dev_port, int > > *mgmt_classes, > > + int num_classes); > > +void mad_rpc_close_port(void *ibmad_port); > > +void * mad_rpc(void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport, > > + void *payload, void *rcvdata); > > +void * mad_rpc_rmpp(void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport, > > +ib_rmpp_hdr_t *rmpp, void *data); > > + > > /* smp.c */ > > uint8_t * smp_query(void *buf, ib_portid_t *id, uint attrid, uint mod, > > uint timeout); > > diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map > > index bf81bd1..78b7ff0 100644 > > --- a/libibmad/src/libibmad.map > > +++ b/libibmad/src/libibmad.map > > @@ -62,6 +62,10 @@ IBMAD_1.0 { > > This should be 1.1 Ok. > > > ib_resolve_self; > > ib_resolve_smlid; > > ibdebug; > > + mad_rpc_open_port; > > + mad_rpc_close_port; > > + mad_rpc; > > + mad_rpc_rmpp; > > madrpc; > > madrpc_def_timeout; > > madrpc_init; > > What about mad_register_port_client ? Should that be included here ? It is not used externally - all registrations are done in _open(). So I don't see this as part of the new "API". Maybe if we will decide to extend it later we will need to "export" this symbol. > > > diff --git a/libibmad/src/register.c b/libibmad/src/register.c > > index 4f44625..52d6989 100644 > > --- a/libibmad/src/register.c > > +++ b/libibmad/src/register.c > > @@ -43,6 +43,7 @@ #include > > #include > > #include > > #include > > +#include > > > > #include > > #include "mad.h" > > @@ -118,7 +119,7 @@ mad_agent_class(int agent) > > } > > > > int > > -mad_register_client(int mgmt, uint8_t rmpp_version) > > +mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version) > > { > > int vers, agent; > > > > @@ -126,7 +127,7 @@ mad_register_client(int mgmt, uint8_t rm > > DEBUG("Unknown class %d mgmt_class", mgmt); > > return -1; > > } > > - if ((agent = umad_register(madrpc_portid(), mgmt, > > + if ((agent = umad_register(port_id, mgmt, > >vers, rmpp_version, 0)) < 0) { > > DEBUG("Can't register agent for class %d", mgmt); > > return -1; > > @@ -137,13 +138,22 @@ mad_register_client(int mgmt, uint8_t rm > > return -1; > > } > > > > - if (register_agent(agent, mgmt) < 0) > > - return -1; > > - > > return agent; > > } > > > > int > > +mad_register_client(int mgmt, uint8_t rmpp_version) > > +{ > > + int agent; > > + > > + agent = mad_register_port_client(madrpc_portid(), mgmt, rmpp_version); > > + if (agent < 0) > > + return agent; > > + > > + return register_agent(agent, mgmt); > > +} > > + > > +int > > mad_register_server(int mgmt, uint8_t rmpp_version, > > uint32_t method_mask[4], uint32_t class_oui) > > { > > diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c > > index b2d3e77..ac4f361 100
Re: [openib-general] [PATCH] opensm: libibmad: rpc API which supports more than one ports.
Hi Sasha, On Fri, 2006-08-25 at 09:17, Sasha Khapyorsky wrote: > This provides RPC like API which may work with several ports. I think you mean "can work" rather "may work" :-) > Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]> > --- > > libibmad/include/infiniband/mad.h |9 +++ > libibmad/src/libibmad.map |4 + > libibmad/src/register.c | 20 +-- > libibmad/src/rpc.c| 106 > +++-- > libibumad/src/umad.c |4 + ../doc/libibmad.txt should also be updated appropriately for the new routines. > 5 files changed, 130 insertions(+), 13 deletions(-) > > diff --git a/libibmad/include/infiniband/mad.h > b/libibmad/include/infiniband/mad.h > index 45ff572..bd8a80b 100644 > --- a/libibmad/include/infiniband/mad.h > +++ b/libibmad/include/infiniband/mad.h > @@ -660,6 +660,7 @@ uint64_t mad_trid(void); > int mad_build_pkt(void *umad, ib_rpc_t *rpc, ib_portid_t *dport, > ib_rmpp_hdr_t *rmpp, void *data); > > /* register.c */ > +int mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version); > int mad_register_client(int mgmt, uint8_t rmpp_version); > int mad_register_server(int mgmt, uint8_t rmpp_version, > uint32_t method_mask[4], uint32_t class_oui); > @@ -704,6 +705,14 @@ void madrpc_lock(void); > void madrpc_unlock(void); > void madrpc_show_errors(int set); > > +void * mad_rpc_open_port(char *dev_name, int dev_port, int > *mgmt_classes, > + int num_classes); > +void mad_rpc_close_port(void *ibmad_port); > +void * mad_rpc(void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport, > + void *payload, void *rcvdata); > +void * mad_rpc_rmpp(void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport, > + ib_rmpp_hdr_t *rmpp, void *data); > + > /* smp.c */ > uint8_t * smp_query(void *buf, ib_portid_t *id, uint attrid, uint mod, > uint timeout); > diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map > index bf81bd1..78b7ff0 100644 > --- a/libibmad/src/libibmad.map > +++ b/libibmad/src/libibmad.map > @@ -62,6 +62,10 @@ IBMAD_1.0 { This should be 1.1 > ib_resolve_self; > ib_resolve_smlid; > ibdebug; > + mad_rpc_open_port; > + mad_rpc_close_port; > + mad_rpc; > + mad_rpc_rmpp; > madrpc; > madrpc_def_timeout; > madrpc_init; What about mad_register_port_client ? Should that be included here ? > diff --git a/libibmad/src/register.c b/libibmad/src/register.c > index 4f44625..52d6989 100644 > --- a/libibmad/src/register.c > +++ b/libibmad/src/register.c > @@ -43,6 +43,7 @@ #include > #include > #include > #include > +#include > > #include > #include "mad.h" > @@ -118,7 +119,7 @@ mad_agent_class(int agent) > } > > int > -mad_register_client(int mgmt, uint8_t rmpp_version) > +mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version) > { > int vers, agent; > > @@ -126,7 +127,7 @@ mad_register_client(int mgmt, uint8_t rm > DEBUG("Unknown class %d mgmt_class", mgmt); > return -1; > } > - if ((agent = umad_register(madrpc_portid(), mgmt, > + if ((agent = umad_register(port_id, mgmt, > vers, rmpp_version, 0)) < 0) { > DEBUG("Can't register agent for class %d", mgmt); > return -1; > @@ -137,13 +138,22 @@ mad_register_client(int mgmt, uint8_t rm > return -1; > } > > - if (register_agent(agent, mgmt) < 0) > - return -1; > - > return agent; > } > > int > +mad_register_client(int mgmt, uint8_t rmpp_version) > +{ > + int agent; > + > + agent = mad_register_port_client(madrpc_portid(), mgmt, rmpp_version); > + if (agent < 0) > + return agent; > + > + return register_agent(agent, mgmt); > +} > + > +int > mad_register_server(int mgmt, uint8_t rmpp_version, > uint32_t method_mask[4], uint32_t class_oui) > { > diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c > index b2d3e77..ac4f361 100644 > --- a/libibmad/src/rpc.c > +++ b/libibmad/src/rpc.c > @@ -48,6 +48,13 @@ #include > #include > #include "mad.h" > > +#define MAX_CLASS 256 > + > +struct ibmad_port { > + int port_id; /* file descriptor returned by umad_open() */ > + int class_agents[MAX_CLASS]; /* class2agent mapper */ > +}; > + > int ibdebug; > > static int mad_portid = -1; > @@ -105,7 +112,8 @@ madrpc_portid(void) > } > > static int > -_do_madrpc(void *sndbuf, void *rcvbuf, int agentid, int len, int timeout) > +_do_madrpc(int port_id, void *sndbuf, void *rcvbuf, int agentid, int len, > +int timeout) > { > uint32_t trid; /* only low 32 bits */ > int retries; > @@ -133,7 +141,7 @@ _do_madrpc(void *sndbuf, void *rcvbuf, i >