RE: [PATCH infiniband-diags] ibccquery.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling
> > Enhanced switch port 0 can support CC (indicated in CC > ClassPortInfo:CapabilityMask.EnhancedPort0CC). > > portnum 0 is a valid port number and offsets should be calculated based on > port 0 rather than port 1. > > Also, fix some error messages to indicate switch port congestion setting > rather > then switch congestion setting failure. > > Signed-off-by: Hal Rosenstock Thanks applied. Ira > --- > diff --git a/src/ibccquery.c b/src/ibccquery.c index ac8bca2..39e45b7 100644 > --- a/src/ibccquery.c > +++ b/src/ibccquery.c > @@ -224,11 +224,11 @@ static char > *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int > > memset(data, '\0', sizeof data); > if (!cc_query_status_via(data, dest, > IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, > - (portnum - 1) / 32, 0, NULL, srcport, > cckey)) > - return "switch congestion setting query failed"; > + portnum / 32, 0, NULL, srcport, > cckey)) > + return "switch port congestion setting query failed"; > > mad_dump_cc_switchportcongestionsettingelement(buf, sizeof > buf, > -data + (((portnum > % 32) - 1) * 4), > +data + ((portnum > % 32) * 4), > 4); > printf("%s", buf); > return NULL; > @@ -236,16 +236,16 @@ static char > *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int > > /* else get all port info */ > > - maxblocks = ((numports - 1) / 32) + 1; > + maxblocks = numports / 32 + 1; > > for (i = 0; i < maxblocks; i++) { > memset(data, '\0', sizeof data); > if (!cc_query_status_via(data, dest, > IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, >i, 0, NULL, srcport, cckey)) > - return "switch congestion setting query failed"; > + return "switch port congestion setting query failed"; > > - for (j = 0; j < 32 && outputcount < numports; j++) { > - printf("Port:%u\n", i * 32 > + j + 1); > + for (j = 0; j < 32 && outputcount <= numports; j++) { > + printf("Port:%u\n", i * 32 > + j); > > mad_dump_cc_switchportcongestionsettingelement(buf, sizeof buf, > data + j > * > 4, > 4); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH infiniband-diags] ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling
> > Enhanced switch port 0 can support CC (indicated in CC > ClassPortInfo:CapabilityMask.EnhancedPort0CC). > > portnum 0 is a valid port number and offsets should be calculated based on > port 0 rather than port 1. > > Also, fix some error messages to indicate switch port congestion setting > rather > then switch congestion setting failure. > > Signed-off-by: Hal Rosenstock Thanks applied. Ira > --- > diff --git a/src/ibccconfig.c b/src/ibccconfig.c index 11dfc07..22b16db 100644 > --- a/src/ibccconfig.c > +++ b/src/ibccconfig.c > @@ -371,9 +371,6 @@ static char > *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int > if ((errstr = parseint(argv[5], &cong_parm_marking_rate, 0))) > return errstr; > > - if (!portnum) > - return "invalid port number specified"; > - > /* Figure out number of ports first */ > if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) > return "node info config failed"; > @@ -389,10 +386,10 @@ static char > *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int > > /* We are modifying only 1 port, so get the current config */ > if (!cc_query_status_via(payload, dest, > IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, > - (portnum - 1) / 32, 0, NULL, srcport, cckey)) > - return "switch congestion setting query failed"; > + portnum / 32, 0, NULL, srcport, cckey)) > + return "switch port congestion setting query failed"; > > - ptr = payload + (((portnum % 32 - 1) * 4)); > + ptr = payload + (((portnum % 32) * 4)); > > mad_encode_field(ptr, > > IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F, > @@ -415,8 +412,8 @@ static char > *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int >&cong_parm_marking_rate); > > if (!cc_config_status_via(payload, rcv, dest, > IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, > - (portnum - 1) / 32, 0, NULL, srcport, cckey)) > - return "switch congestion setting config failed"; > + portnum / 32, 0, NULL, srcport, cckey)) > + return "switch port congestion setting config failed"; > > return NULL; > } -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] libibmad/src/rpc.c: Remove superfluous packet dump
> > When idebug is >= 1, mad_rpc and mad_rpc_rmpp output only the mad data > response in debug output. It does not output the request mad data. This is > confusing since it's not clear if it's request or response output. > > When idebug > 1, full mad send and receive buffers are output, which makes > the mad data output with idebug == 1 superfluous. Remove this output to > remove confusion. > > Signed-off-by: Albert Chu Thanks applied. Ira > --- > src/rpc.c | 11 --- > 1 files changed, 0 insertions(+), 11 deletions(-) > > diff --git a/src/rpc.c b/src/rpc.c > index 8d961f2..f286af7 100644 > --- a/src/rpc.c > +++ b/src/rpc.c > @@ -272,11 +272,6 @@ void *mad_rpc(const struct ibmad_port *port, > ib_rpc_t * rpc, > return NULL; > } > > - if (ibdebug) { > - IBWARN("data offs %d sz %d", rpc->dataoffs, rpc->datasz); > - xdump(stderr, "mad data\n", mad + rpc->dataoffs, rpc- > >datasz); > - } > - > if (rcvdata) > memcpy(rcvdata, mad + rpc->dataoffs, rpc->datasz); > > @@ -322,12 +317,6 @@ void *mad_rpc_rmpp(const struct ibmad_port *port, > ib_rpc_t * rpc, > return NULL; > } > > - if (ibdebug) { > - IBWARN("data offs %d sz %d", rpc->dataoffs, rpc->datasz); > - xdump(stderr, "rmpp mad data\n", mad + rpc->dataoffs, > - rpc->datasz); > - } > - > if (rmpp) { > rmpp->flags = mad_get_field(mad, 0, IB_SA_RMPP_FLAGS_F); > if ((rmpp->flags & 0x3) && > -- > 1.7.1 > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libibmad/src/rpc.c: Remove superfluous packet dump
When idebug is >= 1, mad_rpc and mad_rpc_rmpp output only the mad data response in debug output. It does not output the request mad data. This is confusing since it's not clear if it's request or response output. When idebug > 1, full mad send and receive buffers are output, which makes the mad data output with idebug == 1 superfluous. Remove this output to remove confusion. Signed-off-by: Albert Chu --- src/rpc.c | 11 --- 1 files changed, 0 insertions(+), 11 deletions(-) diff --git a/src/rpc.c b/src/rpc.c index 8d961f2..f286af7 100644 --- a/src/rpc.c +++ b/src/rpc.c @@ -272,11 +272,6 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * rpc, return NULL; } - if (ibdebug) { - IBWARN("data offs %d sz %d", rpc->dataoffs, rpc->datasz); - xdump(stderr, "mad data\n", mad + rpc->dataoffs, rpc->datasz); - } - if (rcvdata) memcpy(rcvdata, mad + rpc->dataoffs, rpc->datasz); @@ -322,12 +317,6 @@ void *mad_rpc_rmpp(const struct ibmad_port *port, ib_rpc_t * rpc, return NULL; } - if (ibdebug) { - IBWARN("data offs %d sz %d", rpc->dataoffs, rpc->datasz); - xdump(stderr, "rmpp mad data\n", mad + rpc->dataoffs, - rpc->datasz); - } - if (rmpp) { rmpp->flags = mad_get_field(mad, 0, IB_SA_RMPP_FLAGS_F); if ((rmpp->flags & 0x3) && -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] libibmad/src/rpc.c: Remove superfluous packet dump
Just didn't hit the issue there so didn't think to remove it there a well. I'll repost Al On Fri, 2015-01-09 at 23:27 +, Weiny, Ira wrote: > Any reason this should not be removed from mad_rpc_rmpp as well? > > Ira > > > > -Original Message- > > From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma- > > ow...@vger.kernel.org] On Behalf Of Albert Chu > > Sent: Friday, December 19, 2014 11:08 AM > > To: linux-rdma@vger.kernel.org > > Subject: [PATCH] libibmad/src/rpc.c: Remove superfluous packet dump > > > > When idebug == 1, mad_rpc outputs only the mad data response in debug > > output. It does not output the request mad data. This is confusing since > > it's not > > clear if it's request or response output. > > > > When idebug > 1, full mad send and receive buffers are output, which makes > > the mad data output with idebug == 1 superfluous. Remove it to remove > > confusion. > > > > Signed-off-by: Albert Chu > > --- > > src/rpc.c |5 - > > 1 files changed, 0 insertions(+), 5 deletions(-) > > > > diff --git a/src/rpc.c b/src/rpc.c > > index 8d961f2..202fac5 100644 > > --- a/src/rpc.c > > +++ b/src/rpc.c > > @@ -272,11 +272,6 @@ void *mad_rpc(const struct ibmad_port *port, > > ib_rpc_t * rpc, > > return NULL; > > } > > > > - if (ibdebug) { > > - IBWARN("data offs %d sz %d", rpc->dataoffs, rpc->datasz); > > - xdump(stderr, "mad data\n", mad + rpc->dataoffs, rpc- > > >datasz); > > - } > > - > > if (rcvdata) > > memcpy(rcvdata, mad + rpc->dataoffs, rpc->datasz); > > > > -- > > 1.7.1 > > > > > > > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > > the body of a message to majord...@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCHv2 libibmad] fields.c: Print SwitchCongestionSetting threshold fields in hex rather than decimal
> for consistency with CC Annex which shows meaning of threshold fields in hex > not decimal > > Signed-off-by: Hal Rosenstock Thanks applied. Ira > --- > Change since v1: > Change fields to hex rather than SwitchPortCongestionSetting:Threshold to be > consistent with CC Annex > > diff --git a/src/fields.c b/src/fields.c index 33a6364..9965811 100644 > --- a/src/fields.c > +++ b/src/fields.c > @@ -858,9 +858,9 @@ static const ib_field_t ib_mad_f[] = { > {0, 32, "Control_Map", mad_dump_hex}, > {32, 256, "Victim_Mask", mad_dump_array}, > {288, 256, "Credit_Mask", mad_dump_array}, > - {BITSOFFS(544, 4), "Threshold", mad_dump_uint}, > + {BITSOFFS(544, 4), "Threshold", mad_dump_hex}, > {BITSOFFS(552, 8), "Packet_Size", mad_dump_uint}, > - {BITSOFFS(560, 4), "CS_Threshold", mad_dump_uint}, > + {BITSOFFS(560, 4), "CS_Threshold", mad_dump_hex}, > {BITSOFFS(576, 16), "CS_ReturnDelay", mad_dump_hex}, /* TODO: CCT > dump */ > {BITSOFFS(592, 16), "Marking_Rate", mad_dump_uint}, > {0, 0}, /* > IB_CC_SWITCH_CONGESTION_SETTING_LAST_F */ -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] libibmad/src/rpc.c: Remove superfluous packet dump
Any reason this should not be removed from mad_rpc_rmpp as well? Ira > -Original Message- > From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma- > ow...@vger.kernel.org] On Behalf Of Albert Chu > Sent: Friday, December 19, 2014 11:08 AM > To: linux-rdma@vger.kernel.org > Subject: [PATCH] libibmad/src/rpc.c: Remove superfluous packet dump > > When idebug == 1, mad_rpc outputs only the mad data response in debug > output. It does not output the request mad data. This is confusing since > it's not > clear if it's request or response output. > > When idebug > 1, full mad send and receive buffers are output, which makes > the mad data output with idebug == 1 superfluous. Remove it to remove > confusion. > > Signed-off-by: Albert Chu > --- > src/rpc.c |5 - > 1 files changed, 0 insertions(+), 5 deletions(-) > > diff --git a/src/rpc.c b/src/rpc.c > index 8d961f2..202fac5 100644 > --- a/src/rpc.c > +++ b/src/rpc.c > @@ -272,11 +272,6 @@ void *mad_rpc(const struct ibmad_port *port, > ib_rpc_t * rpc, > return NULL; > } > > - if (ibdebug) { > - IBWARN("data offs %d sz %d", rpc->dataoffs, rpc->datasz); > - xdump(stderr, "mad data\n", mad + rpc->dataoffs, rpc- > >datasz); > - } > - > if (rcvdata) > memcpy(rcvdata, mad + rpc->dataoffs, rpc->datasz); > > -- > 1.7.1 > > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 00/10] NFS/RDMA server for 3.20
On Fri, Jan 09, 2015 at 03:40:51PM -0500, Chuck Lever wrote: > > On Jan 9, 2015, at 3:39 PM, J. Bruce Fields wrote: > > > On Fri, Jan 09, 2015 at 02:21:54PM -0500, Chuck Lever wrote: > >> In addition to miscellaneous clean up, the following series of > >> patches for the Linux NFS server introduces support in the > >> server’s RPC/RDMA transport implementation for RDMA_NOMSG type > >> messages, and fixes a bug that prevents the server from handling > >> RPC/RDMA messages with inline content following a read list. > >> > >> These patches are contained in the branch "nfsd-rdma-for-3.20" at: > >> > >> git://git.linux-nfs.org/projects/cel/cel-2.6.git > > > > They look OK to me; applying unless someone tells me otherwise. > > I’d like to update the patch descriptions in several of these before > you apply the series. OK, let me know.--b. > > > > > --b. > > > >> > >> --- > >> > >> Chuck Lever (10): > >> svcrdma: Handle additional inline content > >> Move read list XDR round-up logic > >> svcrdma: Support RDMA_NOMSG requests > >> svcrdma: rc_position sanity checking > >> svcrdma: Plant reader function in struct svcxprt_rdma > >> svcrdma: Find rmsgp more reliably > >> svcrdma: Scrub BUG_ON() and WARN_ON() call sites > >> svcrdma: Clean up read chunk counting > >> svcrdma: Remove unused variable > >> svcrdma: Clean up dprintk > >> > >> > >> include/linux/sunrpc/svc_rdma.h | 13 +- > >> net/sunrpc/xprtrdma/svc_rdma_marshal.c | 16 -- > >> net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 251 > >> +++--- > >> net/sunrpc/xprtrdma/svc_rdma_sendto.c| 46 +++-- > >> net/sunrpc/xprtrdma/svc_rdma_transport.c | 47 +++--- > >> 5 files changed, 224 insertions(+), 149 deletions(-) > >> > >> -- > >> Chuck Lever > >> -- > >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > >> the body of a message to majord...@vger.kernel.org > >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > Chuck Lever > chuck[dot]lever[at]oracle[dot]com > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 00/10] NFS/RDMA server for 3.20
On Jan 9, 2015, at 3:39 PM, J. Bruce Fields wrote: > On Fri, Jan 09, 2015 at 02:21:54PM -0500, Chuck Lever wrote: >> In addition to miscellaneous clean up, the following series of >> patches for the Linux NFS server introduces support in the >> server’s RPC/RDMA transport implementation for RDMA_NOMSG type >> messages, and fixes a bug that prevents the server from handling >> RPC/RDMA messages with inline content following a read list. >> >> These patches are contained in the branch "nfsd-rdma-for-3.20" at: >> >> git://git.linux-nfs.org/projects/cel/cel-2.6.git > > They look OK to me; applying unless someone tells me otherwise. I’d like to update the patch descriptions in several of these before you apply the series. > > --b. > >> >> --- >> >> Chuck Lever (10): >> svcrdma: Handle additional inline content >> Move read list XDR round-up logic >> svcrdma: Support RDMA_NOMSG requests >> svcrdma: rc_position sanity checking >> svcrdma: Plant reader function in struct svcxprt_rdma >> svcrdma: Find rmsgp more reliably >> svcrdma: Scrub BUG_ON() and WARN_ON() call sites >> svcrdma: Clean up read chunk counting >> svcrdma: Remove unused variable >> svcrdma: Clean up dprintk >> >> >> include/linux/sunrpc/svc_rdma.h | 13 +- >> net/sunrpc/xprtrdma/svc_rdma_marshal.c | 16 -- >> net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 251 >> +++--- >> net/sunrpc/xprtrdma/svc_rdma_sendto.c| 46 +++-- >> net/sunrpc/xprtrdma/svc_rdma_transport.c | 47 +++--- >> 5 files changed, 224 insertions(+), 149 deletions(-) >> >> -- >> Chuck Lever >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in >> the body of a message to majord...@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html -- Chuck Lever chuck[dot]lever[at]oracle[dot]com -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 00/10] NFS/RDMA server for 3.20
On Fri, Jan 09, 2015 at 02:21:54PM -0500, Chuck Lever wrote: > In addition to miscellaneous clean up, the following series of > patches for the Linux NFS server introduces support in the > server’s RPC/RDMA transport implementation for RDMA_NOMSG type > messages, and fixes a bug that prevents the server from handling > RPC/RDMA messages with inline content following a read list. > > These patches are contained in the branch "nfsd-rdma-for-3.20" at: > > git://git.linux-nfs.org/projects/cel/cel-2.6.git They look OK to me; applying unless someone tells me otherwise. --b. > > --- > > Chuck Lever (10): > svcrdma: Handle additional inline content > Move read list XDR round-up logic > svcrdma: Support RDMA_NOMSG requests > svcrdma: rc_position sanity checking > svcrdma: Plant reader function in struct svcxprt_rdma > svcrdma: Find rmsgp more reliably > svcrdma: Scrub BUG_ON() and WARN_ON() call sites > svcrdma: Clean up read chunk counting > svcrdma: Remove unused variable > svcrdma: Clean up dprintk > > > include/linux/sunrpc/svc_rdma.h | 13 +- > net/sunrpc/xprtrdma/svc_rdma_marshal.c | 16 -- > net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 251 > +++--- > net/sunrpc/xprtrdma/svc_rdma_sendto.c| 46 +++-- > net/sunrpc/xprtrdma/svc_rdma_transport.c | 47 +++--- > 5 files changed, 224 insertions(+), 149 deletions(-) > > -- > Chuck Lever > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 09/10] Move read list XDR round-up logic
On Jan 9, 2015, at 3:14 PM, J. Bruce Fields wrote: > On Fri, Jan 09, 2015 at 02:23:11PM -0500, Chuck Lever wrote: >> Simpler approach, and this needs to be done before the tail is >> copied to the end of the read list (pre-requisite for a subsequent >> patch). >> >> Fixes: e560e3b510d2 ("svcrdma: Add zero padding if the client... ") > > Wait, does this actually fix a bug in that previous commit is or it > just cleanup? No change in behavior. > If the latter, the "Fixes:.." line is confusing, just mention it in the > text ("Simpler approach compared to the original attempt in > e560e3b510d2...”). OK. > > --b. > >> Signed-off-by: Chuck Lever >> --- >> >> net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 37 >> --- >> 1 files changed, 9 insertions(+), 28 deletions(-) >> >> diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c >> b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c >> index 36cf51a..a345cad 100644 >> --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c >> +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c >> @@ -43,7 +43,6 @@ >> #include >> #include >> #include >> -#include >> #include >> #include >> #include >> @@ -434,6 +433,15 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, >> } >> } >> >> +/* Read list may need XDR round-up (see RFC 5666, s. 3.7) */ >> +if (page_offset & 3) { >> +u32 pad = 4 - (page_offset & 3); >> + >> +head->arg.page_len += pad; >> +head->arg.len += pad; >> +head->arg.buflen += pad; >> +} >> + >> ret = 1; >> head->position = position; >> >> @@ -446,32 +454,6 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, >> return ret; >> } >> >> -/* >> - * To avoid a separate RDMA READ just for a handful of zero bytes, >> - * RFC 5666 section 3.7 allows the client to omit the XDR zero pad >> - * in chunk lists. >> - */ >> -static void >> -rdma_fix_xdr_pad(struct xdr_buf *buf) >> -{ >> -unsigned int page_len = buf->page_len; >> -unsigned int size = (XDR_QUADLEN(page_len) << 2) - page_len; >> -unsigned int offset, pg_no; >> -char *p; >> - >> -if (size == 0) >> -return; >> - >> -pg_no = page_len >> PAGE_SHIFT; >> -offset = page_len & ~PAGE_MASK; >> -p = page_address(buf->pages[pg_no]); >> -memset(p + offset, 0, size); >> - >> -buf->page_len += size; >> -buf->buflen += size; >> -buf->len += size; >> -} >> - >> static int rdma_read_complete(struct svc_rqst *rqstp, >>struct svc_rdma_op_ctxt *head) >> { >> @@ -499,7 +481,6 @@ static int rdma_read_complete(struct svc_rqst *rqstp, >> } >> >> /* Point rq_arg.pages past header */ >> -rdma_fix_xdr_pad(&head->arg); >> rqstp->rq_arg.pages = &rqstp->rq_pages[head->hdr_count]; >> rqstp->rq_arg.page_len = head->arg.page_len; >> rqstp->rq_arg.page_base = head->arg.page_base; >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in >> the body of a message to majord...@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Chuck Lever chuck[dot]lever[at]oracle[dot]com -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 09/10] Move read list XDR round-up logic
On Fri, Jan 09, 2015 at 02:23:11PM -0500, Chuck Lever wrote: > Simpler approach, and this needs to be done before the tail is > copied to the end of the read list (pre-requisite for a subsequent > patch). > > Fixes: e560e3b510d2 ("svcrdma: Add zero padding if the client... ") Wait, does this actually fix a bug in that previous commit is or it just cleanup? If the latter, the "Fixes:.." line is confusing, just mention it in the text ("Simpler approach compared to the original attempt in e560e3b510d2..."). --b. > Signed-off-by: Chuck Lever > --- > > net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 37 > --- > 1 files changed, 9 insertions(+), 28 deletions(-) > > diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c > b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c > index 36cf51a..a345cad 100644 > --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c > +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c > @@ -43,7 +43,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -434,6 +433,15 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, > } > } > > + /* Read list may need XDR round-up (see RFC 5666, s. 3.7) */ > + if (page_offset & 3) { > + u32 pad = 4 - (page_offset & 3); > + > + head->arg.page_len += pad; > + head->arg.len += pad; > + head->arg.buflen += pad; > + } > + > ret = 1; > head->position = position; > > @@ -446,32 +454,6 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, > return ret; > } > > -/* > - * To avoid a separate RDMA READ just for a handful of zero bytes, > - * RFC 5666 section 3.7 allows the client to omit the XDR zero pad > - * in chunk lists. > - */ > -static void > -rdma_fix_xdr_pad(struct xdr_buf *buf) > -{ > - unsigned int page_len = buf->page_len; > - unsigned int size = (XDR_QUADLEN(page_len) << 2) - page_len; > - unsigned int offset, pg_no; > - char *p; > - > - if (size == 0) > - return; > - > - pg_no = page_len >> PAGE_SHIFT; > - offset = page_len & ~PAGE_MASK; > - p = page_address(buf->pages[pg_no]); > - memset(p + offset, 0, size); > - > - buf->page_len += size; > - buf->buflen += size; > - buf->len += size; > -} > - > static int rdma_read_complete(struct svc_rqst *rqstp, > struct svc_rdma_op_ctxt *head) > { > @@ -499,7 +481,6 @@ static int rdma_read_complete(struct svc_rqst *rqstp, > } > > /* Point rq_arg.pages past header */ > - rdma_fix_xdr_pad(&head->arg); > rqstp->rq_arg.pages = &rqstp->rq_pages[head->hdr_count]; > rqstp->rq_arg.page_len = head->arg.page_len; > rqstp->rq_arg.page_base = head->arg.page_base; > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 09/10] Move read list XDR round-up logic
Simpler approach, and this needs to be done before the tail is copied to the end of the read list (pre-requisite for a subsequent patch). Fixes: e560e3b510d2 ("svcrdma: Add zero padding if the client... ") Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 37 --- 1 files changed, 9 insertions(+), 28 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 36cf51a..a345cad 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -434,6 +433,15 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, } } + /* Read list may need XDR round-up (see RFC 5666, s. 3.7) */ + if (page_offset & 3) { + u32 pad = 4 - (page_offset & 3); + + head->arg.page_len += pad; + head->arg.len += pad; + head->arg.buflen += pad; + } + ret = 1; head->position = position; @@ -446,32 +454,6 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, return ret; } -/* - * To avoid a separate RDMA READ just for a handful of zero bytes, - * RFC 5666 section 3.7 allows the client to omit the XDR zero pad - * in chunk lists. - */ -static void -rdma_fix_xdr_pad(struct xdr_buf *buf) -{ - unsigned int page_len = buf->page_len; - unsigned int size = (XDR_QUADLEN(page_len) << 2) - page_len; - unsigned int offset, pg_no; - char *p; - - if (size == 0) - return; - - pg_no = page_len >> PAGE_SHIFT; - offset = page_len & ~PAGE_MASK; - p = page_address(buf->pages[pg_no]); - memset(p + offset, 0, size); - - buf->page_len += size; - buf->buflen += size; - buf->len += size; -} - static int rdma_read_complete(struct svc_rqst *rqstp, struct svc_rdma_op_ctxt *head) { @@ -499,7 +481,6 @@ static int rdma_read_complete(struct svc_rqst *rqstp, } /* Point rq_arg.pages past header */ - rdma_fix_xdr_pad(&head->arg); rqstp->rq_arg.pages = &rqstp->rq_pages[head->hdr_count]; rqstp->rq_arg.page_len = head->arg.page_len; rqstp->rq_arg.page_base = head->arg.page_base; -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 10/10] svcrdma: Handle additional inline content
Most NFS RPCs place large payload arguments at the end of the RPC header (eg, NFSv3 WRITE). For NFSv3 WRITE and SYMLINK, RPC/RDMA sends the complete RPC header inline, and the payload argument in a read list. One important case is not like this, however. NFSv4 WRITE compounds can have an operation after the WRITE operation. The proper way to convey an NFSv4 WRITE is to place the GETATTR inline, but _after_ the read list position. (Note Linux clients currently do not do this, but they will be changed to do it in the future). The receiver could put trailing inline content in the XDR tail buffer. But the Linux server's NFSv4 compound processing does not consider the XDR tail buffer. So, move trailing inline content to the end of the page list. This presents the incoming compound to upper layers the same way the socket code does. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 62 +++ 1 files changed, 62 insertions(+), 0 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index a345cad..f44bf4e 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -364,6 +364,63 @@ rdma_rcl_chunk_count(struct rpcrdma_read_chunk *ch) return count; } +/* If there was additional inline content, append it to the end of arg.pages. + * Tail copy has to be done after the reader function has determined how many + * pages are needed for RDMA READ. + */ +static int +rdma_copy_tail(struct svc_rqst *rqstp, struct svc_rdma_op_ctxt *head, + u32 position, u32 byte_count, u32 page_offset, int page_no) +{ + char *srcp, *destp; + int ret; + + ret = 0; + srcp = head->arg.head[0].iov_base + position; + byte_count = head->arg.head[0].iov_len - position; + if (byte_count > PAGE_SIZE) { + dprintk("svcrdma: large tail unsupported\n"); + goto err; + } + + /* Fit as much of the tail on the current page as possible */ + if (page_offset != PAGE_SIZE) { + destp = page_address(rqstp->rq_arg.pages[page_no]); + destp += page_offset; + + while (byte_count--) { + *destp++ = *srcp++; + page_offset++; + if (page_offset == PAGE_SIZE) + break; + } + + goto done; + } + + /* Fit the rest on the next page */ + page_no++; + if (!rqstp->rq_arg.pages[page_no]) { + dprintk("svcrdma: no more room for tail\n"); + goto err; + } + destp = page_address(rqstp->rq_arg.pages[page_no]); + rqstp->rq_respages = &rqstp->rq_arg.pages[page_no+1]; + rqstp->rq_next_page = rqstp->rq_respages + 1; + while (byte_count--) + *destp++ = *srcp++; + +done: + ret = 1; + byte_count = head->arg.head[0].iov_len - position; + head->arg.page_len += byte_count; + head->arg.len += byte_count; + head->arg.buflen += byte_count; + +err: + return ret; +} + static int rdma_read_chunks(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp, struct svc_rqst *rqstp, @@ -440,9 +497,14 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, head->arg.page_len += pad; head->arg.len += pad; head->arg.buflen += pad; + page_offset += pad; } ret = 1; + if (position && position < head->arg.head[0].iov_len) + ret = rdma_copy_tail(rqstp, head, position, +byte_count, page_offset, page_no); + head->arg.head[0].iov_len = position; head->position = position; err: -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 07/10] svcrdma: rc_position sanity checking
An RPC/RDMA client may send large data payloads via a read chunk list. This is a list of scatter/gather elements which are RPC call arguments too large to fit in a small RDMA SEND. Each read chunk list entry has a "position" which is the offset in the RPC header where the chunk list payload should be inserted. Thus content can exist in the RPC header both before _and_ after a chunk list (see RFC 5666). Currently the Linux NFS/RDMA server cannot handle receiving read chunks in more than one position. Fortunately no client currently sends more than one read list per RPC. Ensure that all received chunks have the same "rc_position." Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 16 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index c3aebc1..a67dd1a 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -365,6 +365,7 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, int page_no, ret; struct rpcrdma_read_chunk *ch; u32 handle, page_offset, byte_count; + u32 position; u64 rs_offset; bool last; @@ -389,10 +390,17 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, head->arg.len = rqstp->rq_arg.len; head->arg.buflen = rqstp->rq_arg.buflen; - page_no = 0; page_offset = 0; - for (ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; -ch->rc_discrim != 0; ch++) { - handle = be32_to_cpu(ch->rc_target.rs_handle); + ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; + position = be32_to_cpu(ch->rc_position); + + ret = 0; + page_no = 0; + page_offset = 0; + for (; ch->rc_discrim != xdr_zero; ch++) { + if (be32_to_cpu(ch->rc_position) != position) + goto err; + + handle = be32_to_cpu(ch->rc_target.rs_handle), byte_count = be32_to_cpu(ch->rc_target.rs_length); xdr_decode_hyper((__be32 *)&ch->rc_target.rs_offset, &rs_offset); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 08/10] svcrdma: Support RDMA_NOMSG requests
Currently the Linux server can not decode RDMA_NOMSG type requests. The client sends the RPC/RDMA header via RDMA SEND. The header has a read chunk list that conveys the RPC and NFS headers and the NFS payload (if any). Large operations like NFSv4 CREATE(NF4LNK) will by conveyed via RDMA_NOMSG, so add this support. Signed-off-by: Chuck Lever --- include/linux/sunrpc/svc_rdma.h |1 + net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 39 +-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index f161e30..c343a94 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h @@ -79,6 +79,7 @@ struct svc_rdma_op_ctxt { enum ib_wr_opcode wr_op; enum ib_wc_status wc_status; u32 byte_len; + u32 position; struct svcxprt_rdma *xprt; unsigned long flags; enum dma_data_direction direction; diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index a67dd1a..36cf51a 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -60,6 +60,7 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp, struct svc_rdma_op_ctxt *ctxt, u32 byte_count) { + struct rpcrdma_msg *rmsgp; struct page *page; u32 bc; int sge_no; @@ -82,7 +83,14 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp, /* If data remains, store it in the pagelist */ rqstp->rq_arg.page_len = bc; rqstp->rq_arg.page_base = 0; - rqstp->rq_arg.pages = &rqstp->rq_pages[1]; + + /* RDMA_NOMSG: RDMA READ data should land just after RDMA RECV data */ + rmsgp = (struct rpcrdma_msg *)rqstp->rq_arg.head[0].iov_base; + if (be32_to_cpu(rmsgp->rm_type) == RDMA_NOMSG) + rqstp->rq_arg.pages = &rqstp->rq_pages[0]; + else + rqstp->rq_arg.pages = &rqstp->rq_pages[1]; + sge_no = 1; while (bc && sge_no < ctxt->count) { page = ctxt->pages[sge_no]; @@ -383,7 +391,6 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, */ head->arg.head[0] = rqstp->rq_arg.head[0]; head->arg.tail[0] = rqstp->rq_arg.tail[0]; - head->arg.pages = &head->pages[head->count]; head->hdr_count = head->count; head->arg.page_base = 0; head->arg.page_len = 0; @@ -393,9 +400,17 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; position = be32_to_cpu(ch->rc_position); + /* RDMA_NOMSG: RDMA READ data should land just after RDMA RECV data */ + if (position == 0) { + head->arg.pages = &head->pages[0]; + page_offset = head->byte_len; + } else { + head->arg.pages = &head->pages[head->count]; + page_offset = 0; + } + ret = 0; page_no = 0; - page_offset = 0; for (; ch->rc_discrim != xdr_zero; ch++) { if (be32_to_cpu(ch->rc_position) != position) goto err; @@ -418,7 +433,10 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, head->arg.buflen += ret; } } + ret = 1; + head->position = position; + err: /* Detach arg pages. svc_recv will replenish them */ for (page_no = 0; @@ -465,6 +483,21 @@ static int rdma_read_complete(struct svc_rqst *rqstp, put_page(rqstp->rq_pages[page_no]); rqstp->rq_pages[page_no] = head->pages[page_no]; } + + /* Adjustments made for RDMA_NOMSG type requests */ + if (head->position == 0) { + if (head->arg.len <= head->sge[0].length) { + head->arg.head[0].iov_len = head->arg.len - + head->byte_len; + head->arg.page_len = 0; + } else { + head->arg.head[0].iov_len = head->sge[0].length - + head->byte_len; + head->arg.page_len = head->arg.len - + head->sge[0].length; + } + } + /* Point rq_arg.pages past header */ rdma_fix_xdr_pad(&head->arg); rqstp->rq_arg.pages = &rqstp->rq_pages[head->hdr_count]; -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 03/10] svcrdma: Clean up read chunk counting
The byte_count argument is not used, and the function is called only from one place. Signed-off-by: Chuck Lever --- include/linux/sunrpc/svc_rdma.h |2 -- net/sunrpc/xprtrdma/svc_rdma_marshal.c | 16 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 15 --- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index 975da75..2280325 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h @@ -178,8 +178,6 @@ struct svcxprt_rdma { #define RPCRDMA_MAX_REQ_SIZE4096 /* svc_rdma_marshal.c */ -extern void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *, - int *, int *); extern int svc_rdma_xdr_decode_req(struct rpcrdma_msg **, struct svc_rqst *); extern int svc_rdma_xdr_decode_deferred_req(struct svc_rqst *); extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *, diff --git a/net/sunrpc/xprtrdma/svc_rdma_marshal.c b/net/sunrpc/xprtrdma/svc_rdma_marshal.c index 65b1462..b681855 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_marshal.c +++ b/net/sunrpc/xprtrdma/svc_rdma_marshal.c @@ -71,22 +71,6 @@ static u32 *decode_read_list(u32 *va, u32 *vaend) } /* - * Determine number of chunks and total bytes in chunk list. The chunk - * list has already been verified to fit within the RPCRDMA header. - */ -void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *ch, - int *ch_count, int *byte_count) -{ - /* compute the number of bytes represented by read chunks */ - *byte_count = 0; - *ch_count = 0; - for (; ch->rc_discrim != 0; ch++) { - *byte_count = *byte_count + ntohl(ch->rc_target.rs_length); - *ch_count = *ch_count + 1; - } -} - -/* * Decodes a write chunk list. The expected format is as follows: *descrim : xdr_one *nchunks : diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 2c67de0..b3b7bb8 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -365,12 +365,22 @@ static int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, return ret; } +static unsigned int +rdma_rcl_chunk_count(struct rpcrdma_read_chunk *ch) +{ + unsigned int count; + + for (count = 0; ch->rc_discrim != xdr_zero; ch++) + count++; + return count; +} + static int rdma_read_chunks(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp, struct svc_rqst *rqstp, struct svc_rdma_op_ctxt *head) { - int page_no, ch_count, ret; + int page_no, ret; struct rpcrdma_read_chunk *ch; u32 page_offset, byte_count; u64 rs_offset; @@ -381,8 +391,7 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, if (!ch) return 0; - svc_rdma_rcl_chunk_counts(ch, &ch_count, &byte_count); - if (ch_count > RPCSVC_MAXPAGES) + if (rdma_rcl_chunk_count(ch) > RPCSVC_MAXPAGES) return -EINVAL; /* The request is completed when the RDMA_READs complete. The -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 00/10] NFS/RDMA server for 3.20
In addition to miscellaneous clean up, the following series of patches for the Linux NFS server introduces support in the server’s RPC/RDMA transport implementation for RDMA_NOMSG type messages, and fixes a bug that prevents the server from handling RPC/RDMA messages with inline content following a read list. These patches are contained in the branch "nfsd-rdma-for-3.20" at: git://git.linux-nfs.org/projects/cel/cel-2.6.git --- Chuck Lever (10): svcrdma: Handle additional inline content Move read list XDR round-up logic svcrdma: Support RDMA_NOMSG requests svcrdma: rc_position sanity checking svcrdma: Plant reader function in struct svcxprt_rdma svcrdma: Find rmsgp more reliably svcrdma: Scrub BUG_ON() and WARN_ON() call sites svcrdma: Clean up read chunk counting svcrdma: Remove unused variable svcrdma: Clean up dprintk include/linux/sunrpc/svc_rdma.h | 13 +- net/sunrpc/xprtrdma/svc_rdma_marshal.c | 16 -- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 251 +++--- net/sunrpc/xprtrdma/svc_rdma_sendto.c| 46 +++-- net/sunrpc/xprtrdma/svc_rdma_transport.c | 47 +++--- 5 files changed, 224 insertions(+), 149 deletions(-) -- Chuck Lever -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 06/10] svcrdma: Plant reader function in struct svcxprt_rdma
The RDMA reader function doesn't change once an svcxprt is instantiated. Instead of checking sc_devcap during every incoming RPC, set the reader function once when the connection is accepted. Signed-off-by: Chuck Lever --- include/linux/sunrpc/svc_rdma.h | 10 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 71 +++--- net/sunrpc/xprtrdma/svc_rdma_transport.c |2 + 3 files changed, 39 insertions(+), 44 deletions(-) diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index 2280325..f161e30 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h @@ -150,6 +150,10 @@ struct svcxprt_rdma { struct ib_cq *sc_rq_cq; struct ib_cq *sc_sq_cq; struct ib_mr *sc_phys_mr; /* MR for server memory */ + int (*sc_reader)(struct svcxprt_rdma *, + struct svc_rqst *, + struct svc_rdma_op_ctxt *, + int *, u32 *, u32, u32, u64, bool); u32 sc_dev_caps; /* distilled device caps */ u32 sc_dma_lkey; /* local dma key */ unsigned int sc_frmr_pg_list_len; @@ -195,6 +199,12 @@ extern int svc_rdma_xdr_get_reply_hdr_len(struct rpcrdma_msg *); /* svc_rdma_recvfrom.c */ extern int svc_rdma_recvfrom(struct svc_rqst *); +extern int rdma_read_chunk_lcl(struct svcxprt_rdma *, struct svc_rqst *, + struct svc_rdma_op_ctxt *, int *, u32 *, + u32, u32, u64, bool); +extern int rdma_read_chunk_frmr(struct svcxprt_rdma *, struct svc_rqst *, + struct svc_rdma_op_ctxt *, int *, u32 *, + u32, u32, u64, bool); /* svc_rdma_sendto.c */ extern int svc_rdma_sendto(struct svc_rqst *); diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 577f865..c3aebc1 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -117,26 +117,16 @@ static int rdma_read_max_sge(struct svcxprt_rdma *xprt, int sge_count) return min_t(int, sge_count, xprt->sc_max_sge); } -typedef int (*rdma_reader_fn)(struct svcxprt_rdma *xprt, - struct svc_rqst *rqstp, - struct svc_rdma_op_ctxt *head, - int *page_no, - u32 *page_offset, - u32 rs_handle, - u32 rs_length, - u64 rs_offset, - int last); - /* Issue an RDMA_READ using the local lkey to map the data sink */ -static int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, - struct svc_rqst *rqstp, - struct svc_rdma_op_ctxt *head, - int *page_no, - u32 *page_offset, - u32 rs_handle, - u32 rs_length, - u64 rs_offset, - int last) +int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, + struct svc_rqst *rqstp, + struct svc_rdma_op_ctxt *head, + int *page_no, + u32 *page_offset, + u32 rs_handle, + u32 rs_length, + u64 rs_offset, + bool last) { struct ib_send_wr read_wr; int pages_needed = PAGE_ALIGN(*page_offset + rs_length) >> PAGE_SHIFT; @@ -221,15 +211,15 @@ static int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, } /* Issue an RDMA_READ using an FRMR to map the data sink */ -static int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, - struct svc_rqst *rqstp, - struct svc_rdma_op_ctxt *head, - int *page_no, - u32 *page_offset, - u32 rs_handle, - u32 rs_length, - u64 rs_offset, - int last) +int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, +struct svc_rqst *rqstp, +struct svc_rdma_op_ctxt *head, +int *page_no, +u32 *page_offset, +u32 rs_handle, +u32 rs_length, +u64 rs_offset, +bool last) { struct ib_send_wr read_wr; struct ib_send_wr inv_wr; @@ -374,9 +364,9 @@ static int rdma_read_chunks(struct svcxprt_rdma *xprt, { int page_no, ret; struct rpcrdma
[PATCH v1 01/10] svcrdma: Clean up dprintk
Nit: Fix inconsistent white space in dprintk messages. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index e011027..2c67de0 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -501,8 +501,8 @@ static int rdma_read_complete(struct svc_rqst *rqstp, ret = rqstp->rq_arg.head[0].iov_len + rqstp->rq_arg.page_len + rqstp->rq_arg.tail[0].iov_len; - dprintk("svcrdma: deferred read ret=%d, rq_arg.len =%d, " - "rq_arg.head[0].iov_base=%p, rq_arg.head[0].iov_len = %zd\n", + dprintk("svcrdma: deferred read ret=%d, rq_arg.len=%u, " + "rq_arg.head[0].iov_base=%p, rq_arg.head[0].iov_len=%zu\n", ret, rqstp->rq_arg.len, rqstp->rq_arg.head[0].iov_base, rqstp->rq_arg.head[0].iov_len); @@ -591,8 +591,8 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) + rqstp->rq_arg.tail[0].iov_len; svc_rdma_put_context(ctxt, 0); out: - dprintk("svcrdma: ret = %d, rq_arg.len =%d, " - "rq_arg.head[0].iov_base=%p, rq_arg.head[0].iov_len = %zd\n", + dprintk("svcrdma: ret=%d, rq_arg.len=%u, " + "rq_arg.head[0].iov_base=%p, rq_arg.head[0].iov_len=%zd\n", ret, rqstp->rq_arg.len, rqstp->rq_arg.head[0].iov_base, rqstp->rq_arg.head[0].iov_len); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 02/10] svcrdma: Remove unused variable
Nit: remove an unused variable to squelch a compiler warning. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_transport.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 4e61880..4ba11d0 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c @@ -687,7 +687,6 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv, { struct rdma_cm_id *listen_id; struct svcxprt_rdma *cma_xprt; - struct svc_xprt *xprt; int ret; dprintk("svcrdma: Creating RDMA socket\n"); @@ -698,7 +697,6 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv, cma_xprt = rdma_create_xprt(serv, 1); if (!cma_xprt) return ERR_PTR(-ENOMEM); - xprt = &cma_xprt->sc_xprt; listen_id = rdma_create_id(rdma_listen_handler, cma_xprt, RDMA_PS_TCP, IB_QPT_RC); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v1 04/10] svcrdma: Scrub BUG_ON() and WARN_ON() call sites
Current convention is to avoid using BUG_ON() in places where an oops could cause complete system failure. Replace BUG_ON() call sites in svcrdma with an assertion error message and allow execution to continue safely. Some BUG_ON() calls are removed because they have never fired in production (that we are aware of). Some WARN_ON() calls are also replaced where a back trace is not helpful; e.g., in a workqueue task. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 11 net/sunrpc/xprtrdma/svc_rdma_sendto.c| 28 +++- net/sunrpc/xprtrdma/svc_rdma_transport.c | 43 +++--- 3 files changed, 49 insertions(+), 33 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index b3b7bb8..577f865 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -95,14 +95,6 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp, rqstp->rq_respages = &rqstp->rq_pages[sge_no]; rqstp->rq_next_page = rqstp->rq_respages + 1; - /* We should never run out of SGE because the limit is defined to -* support the max allowed RPC data length -*/ - BUG_ON(bc && (sge_no == ctxt->count)); - BUG_ON((rqstp->rq_arg.head[0].iov_len + rqstp->rq_arg.page_len) - != byte_count); - BUG_ON(rqstp->rq_arg.len != byte_count); - /* If not all pages were used from the SGL, free the remaining ones */ bc = sge_no; while (sge_no < ctxt->count) { @@ -477,8 +469,6 @@ static int rdma_read_complete(struct svc_rqst *rqstp, int page_no; int ret; - BUG_ON(!head); - /* Copy RPC pages */ for (page_no = 0; page_no < head->count; page_no++) { put_page(rqstp->rq_pages[page_no]); @@ -567,7 +557,6 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) } dprintk("svcrdma: processing ctxt=%p on xprt=%p, rqstp=%p, status=%d\n", ctxt, rdma_xprt, rqstp, ctxt->wc_status); - BUG_ON(ctxt->wc_status != IB_WC_SUCCESS); atomic_inc(&rdma_stat_recv); /* Build up the XDR from the receive buffers. */ diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index 9f1b506..7d79897 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -60,8 +60,11 @@ static int map_xdr(struct svcxprt_rdma *xprt, u32 page_off; int page_no; - BUG_ON(xdr->len != - (xdr->head[0].iov_len + xdr->page_len + xdr->tail[0].iov_len)); + if (xdr->len != + (xdr->head[0].iov_len + xdr->page_len + xdr->tail[0].iov_len)) { + pr_err("svcrdma: map_xdr: XDR buffer length error\n"); + return -EIO; + } /* Skip the first sge, this is for the RPCRDMA header */ sge_no = 1; @@ -150,7 +153,11 @@ static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp, int bc; struct svc_rdma_op_ctxt *ctxt; - BUG_ON(vec->count > RPCSVC_MAXPAGES); + if (vec->count > RPCSVC_MAXPAGES) { + pr_err("svcrdma: Too many pages (%lu)\n", vec->count); + return -EIO; + } + dprintk("svcrdma: RDMA_WRITE rmr=%x, to=%llx, xdr_off=%d, " "write_len=%d, vec->sge=%p, vec->count=%lu\n", rmr, (unsigned long long)to, xdr_off, @@ -190,7 +197,10 @@ static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp, sge_off = 0; sge_no++; xdr_sge_no++; - BUG_ON(xdr_sge_no > vec->count); + if (xdr_sge_no > vec->count) { + pr_err("svcrdma: Too many sges (%d)\n", xdr_sge_no); + goto err; + } bc -= sge_bytes; if (sge_no == xprt->sc_max_sge) break; @@ -421,7 +431,10 @@ static int send_reply(struct svcxprt_rdma *rdma, ctxt->sge[sge_no].lkey = rdma->sc_dma_lkey; ctxt->sge[sge_no].length = sge_bytes; } - BUG_ON(byte_count != 0); + if (byte_count != 0) { + pr_err("svcrdma: Could not map %d bytes\n", byte_count); + goto err; + } /* Save all respages in the ctxt and remove them from the * respages array. They are our pages until the I/O @@ -442,7 +455,10 @@ static int send_reply(struct svcxprt_rdma *rdma, } rqstp->rq_next_page = rqstp->rq_respages + 1; - BUG_ON(sge_no > rdma->sc_max_sge); + if (sge_no > rdma->sc_max_sge) { + pr_err("svcrdma: Too many sges (%d)\n", sge_no); + goto err; + } memset(&send_wr, 0, sizeof send_wr); ctxt->wr_op = IB_WR_SEND; send_wr.wr_id = (unsigned long)ctxt; diff --git a/net/sunrpc/xprtrdma/svc_rd
[PATCH v1 05/10] svcrdma: Find rmsgp more reliably
xdr_start() can return the wrong rmsgp address if an assumption about how the xdr_buf was constructed changes. When it gets it wrong, the client receives a reply that has gibberish in the RPC/RDMA header, preventing it from matching a waiting RPC request. Instead, make (and document) just one assumption: that the RDMA header for the client's RPC call is at the start of the first page in rq_pages. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 18 -- 1 files changed, 4 insertions(+), 14 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index 7d79897..7de33d1 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -483,18 +483,6 @@ void svc_rdma_prep_reply_hdr(struct svc_rqst *rqstp) { } -/* - * Return the start of an xdr buffer. - */ -static void *xdr_start(struct xdr_buf *xdr) -{ - return xdr->head[0].iov_base - - (xdr->len - -xdr->page_len - -xdr->tail[0].iov_len - -xdr->head[0].iov_len); -} - int svc_rdma_sendto(struct svc_rqst *rqstp) { struct svc_xprt *xprt = rqstp->rq_xprt; @@ -512,8 +500,10 @@ int svc_rdma_sendto(struct svc_rqst *rqstp) dprintk("svcrdma: sending response for rqstp=%p\n", rqstp); - /* Get the RDMA request header. */ - rdma_argp = xdr_start(&rqstp->rq_arg); + /* Get the RDMA request header. The receive logic always +* places this at the start of page 0. +*/ + rdma_argp = page_address(rqstp->rq_pages[0]); /* Build an req vec for the XDR */ ctxt = svc_rdma_get_context(rdma); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH infiniband-diags] ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling
On 1/9/2015 10:46 AM, Weiny, Ira wrote: > [off-list] > > This replaces the first one? This is ibccconfig. Other was for ibccquery. Similar subjects but separated by tool rather than one patch for both. > >> -Original Message- >> From: Hal Rosenstock [mailto:h...@dev.mellanox.co.il] >> Sent: Friday, January 09, 2015 7:18 AM >> To: Weiny, Ira >> Cc: linux-rdma (linux-rdma@vger.kernel.org); Chu, Al >> Subject: [PATCH infiniband-diags] ibccconfig.c: Account for enhanced switch >> port 0 in SwitchPortCongestionSetting handling >> >> Enhanced switch port 0 can support CC (indicated in CC >> ClassPortInfo:CapabilityMask.EnhancedPort0CC). >> >> portnum 0 is a valid port number and offsets should be calculated based on >> port 0 rather than port 1. >> >> Also, fix some error messages to indicate switch port congestion setting >> rather >> then switch congestion setting failure. >> >> Signed-off-by: Hal Rosenstock >> --- >> diff --git a/src/ibccconfig.c b/src/ibccconfig.c index 11dfc07..22b16db >> 100644 >> --- a/src/ibccconfig.c >> +++ b/src/ibccconfig.c >> @@ -371,9 +371,6 @@ static char >> *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int >> if ((errstr = parseint(argv[5], &cong_parm_marking_rate, 0))) >> return errstr; >> >> -if (!portnum) >> -return "invalid port number specified"; >> - >> /* Figure out number of ports first */ >> if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) >> return "node info config failed"; >> @@ -389,10 +386,10 @@ static char >> *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int >> >> /* We are modifying only 1 port, so get the current config */ >> if (!cc_query_status_via(payload, dest, >> IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, >> - (portnum - 1) / 32, 0, NULL, srcport, cckey)) >> -return "switch congestion setting query failed"; >> + portnum / 32, 0, NULL, srcport, cckey)) >> +return "switch port congestion setting query failed"; >> >> -ptr = payload + (((portnum % 32 - 1) * 4)); >> +ptr = payload + (((portnum % 32) * 4)); >> >> mad_encode_field(ptr, >> >> IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F, >> @@ -415,8 +412,8 @@ static char >> *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int >> &cong_parm_marking_rate); >> >> if (!cc_config_status_via(payload, rcv, dest, >> IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, >> - (portnum - 1) / 32, 0, NULL, srcport, cckey)) >> -return "switch congestion setting config failed"; >> + portnum / 32, 0, NULL, srcport, cckey)) >> +return "switch port congestion setting config failed"; >> >> return NULL; >> } > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH infiniband-diags] ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling
[off-list] This replaces the first one? > -Original Message- > From: Hal Rosenstock [mailto:h...@dev.mellanox.co.il] > Sent: Friday, January 09, 2015 7:18 AM > To: Weiny, Ira > Cc: linux-rdma (linux-rdma@vger.kernel.org); Chu, Al > Subject: [PATCH infiniband-diags] ibccconfig.c: Account for enhanced switch > port 0 in SwitchPortCongestionSetting handling > > Enhanced switch port 0 can support CC (indicated in CC > ClassPortInfo:CapabilityMask.EnhancedPort0CC). > > portnum 0 is a valid port number and offsets should be calculated based on > port 0 rather than port 1. > > Also, fix some error messages to indicate switch port congestion setting > rather > then switch congestion setting failure. > > Signed-off-by: Hal Rosenstock > --- > diff --git a/src/ibccconfig.c b/src/ibccconfig.c index 11dfc07..22b16db 100644 > --- a/src/ibccconfig.c > +++ b/src/ibccconfig.c > @@ -371,9 +371,6 @@ static char > *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int > if ((errstr = parseint(argv[5], &cong_parm_marking_rate, 0))) > return errstr; > > - if (!portnum) > - return "invalid port number specified"; > - > /* Figure out number of ports first */ > if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) > return "node info config failed"; > @@ -389,10 +386,10 @@ static char > *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int > > /* We are modifying only 1 port, so get the current config */ > if (!cc_query_status_via(payload, dest, > IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, > - (portnum - 1) / 32, 0, NULL, srcport, cckey)) > - return "switch congestion setting query failed"; > + portnum / 32, 0, NULL, srcport, cckey)) > + return "switch port congestion setting query failed"; > > - ptr = payload + (((portnum % 32 - 1) * 4)); > + ptr = payload + (((portnum % 32) * 4)); > > mad_encode_field(ptr, > > IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F, > @@ -415,8 +412,8 @@ static char > *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int >&cong_parm_marking_rate); > > if (!cc_config_status_via(payload, rcv, dest, > IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, > - (portnum - 1) / 32, 0, NULL, srcport, cckey)) > - return "switch congestion setting config failed"; > + portnum / 32, 0, NULL, srcport, cckey)) > + return "switch port congestion setting config failed"; > > return NULL; > } -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH infiniband-diags] ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling
Enhanced switch port 0 can support CC (indicated in CC ClassPortInfo:CapabilityMask.EnhancedPort0CC). portnum 0 is a valid port number and offsets should be calculated based on port 0 rather than port 1. Also, fix some error messages to indicate switch port congestion setting rather then switch congestion setting failure. Signed-off-by: Hal Rosenstock --- diff --git a/src/ibccconfig.c b/src/ibccconfig.c index 11dfc07..22b16db 100644 --- a/src/ibccconfig.c +++ b/src/ibccconfig.c @@ -371,9 +371,6 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int if ((errstr = parseint(argv[5], &cong_parm_marking_rate, 0))) return errstr; - if (!portnum) - return "invalid port number specified"; - /* Figure out number of ports first */ if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) return "node info config failed"; @@ -389,10 +386,10 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int /* We are modifying only 1 port, so get the current config */ if (!cc_query_status_via(payload, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, -(portnum - 1) / 32, 0, NULL, srcport, cckey)) - return "switch congestion setting query failed"; +portnum / 32, 0, NULL, srcport, cckey)) + return "switch port congestion setting query failed"; - ptr = payload + (((portnum % 32 - 1) * 4)); + ptr = payload + (((portnum % 32) * 4)); mad_encode_field(ptr, IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F, @@ -415,8 +412,8 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int &cong_parm_marking_rate); if (!cc_config_status_via(payload, rcv, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, - (portnum - 1) / 32, 0, NULL, srcport, cckey)) - return "switch congestion setting config failed"; + portnum / 32, 0, NULL, srcport, cckey)) + return "switch port congestion setting config failed"; return NULL; } -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH infiniband-diags] ibccquery.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling
Enhanced switch port 0 can support CC (indicated in CC ClassPortInfo:CapabilityMask.EnhancedPort0CC). portnum 0 is a valid port number and offsets should be calculated based on port 0 rather than port 1. Also, fix some error messages to indicate switch port congestion setting rather then switch congestion setting failure. Signed-off-by: Hal Rosenstock --- diff --git a/src/ibccquery.c b/src/ibccquery.c index ac8bca2..39e45b7 100644 --- a/src/ibccquery.c +++ b/src/ibccquery.c @@ -224,11 +224,11 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int memset(data, '\0', sizeof data); if (!cc_query_status_via(data, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, -(portnum - 1) / 32, 0, NULL, srcport, cckey)) - return "switch congestion setting query failed"; +portnum / 32, 0, NULL, srcport, cckey)) + return "switch port congestion setting query failed"; mad_dump_cc_switchportcongestionsettingelement(buf, sizeof buf, - data + (((portnum % 32) - 1) * 4), + data + ((portnum % 32) * 4), 4); printf("%s", buf); return NULL; @@ -236,16 +236,16 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int /* else get all port info */ - maxblocks = ((numports - 1) / 32) + 1; + maxblocks = numports / 32 + 1; for (i = 0; i < maxblocks; i++) { memset(data, '\0', sizeof data); if (!cc_query_status_via(data, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, i, 0, NULL, srcport, cckey)) - return "switch congestion setting query failed"; + return "switch port congestion setting query failed"; - for (j = 0; j < 32 && outputcount < numports; j++) { - printf("Port:%u\n", i * 32 + j + 1); + for (j = 0; j < 32 && outputcount <= numports; j++) { + printf("Port:%u\n", i * 32 + j); mad_dump_cc_switchportcongestionsettingelement(buf, sizeof buf, data + j * 4, 4); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] net/9p: add a privport option for RDMA transport.
RDMA can use the same kind of weak security as TCP by checking the client can bind to a privileged port, which is better than nothing if TAUTH isn't implemented. Signed-off-by: Dominique Martinet --- Please note that this does NOT checkpatch because option tokens "Opt_foo" are considered CamelCase. To make this pass one would need to submit a first patch that'd "fix" token names all around 9p code (net and fs), I'd rather stay coherent and keep it as is for now. I tried to stick to keep code similar to the tcp equivalent, but happy to make any change deemed useful. net/9p/trans_rdma.c | 52 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index 14ad43b..3533d2a 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -139,6 +139,7 @@ struct p9_rdma_opts { int sq_depth; int rq_depth; long timeout; + int privport; }; /* @@ -146,7 +147,10 @@ struct p9_rdma_opts { */ enum { /* Options that take integer arguments */ - Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout, Opt_err, + Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout, + /* Options that take no argument */ + Opt_privport, + Opt_err, }; static match_table_t tokens = { @@ -154,6 +158,7 @@ static match_table_t tokens = { {Opt_sq_depth, "sq=%u"}, {Opt_rq_depth, "rq=%u"}, {Opt_timeout, "timeout=%u"}, + {Opt_privport, "privport"}, {Opt_err, NULL}, }; @@ -175,6 +180,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) opts->sq_depth = P9_RDMA_SQ_DEPTH; opts->rq_depth = P9_RDMA_RQ_DEPTH; opts->timeout = P9_RDMA_TIMEOUT; + opts->privport = 0; if (!params) return 0; @@ -193,13 +199,13 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) if (!*p) continue; token = match_token(p, tokens, args); - if (token == Opt_err) - continue; - r = match_int(&args[0], &option); - if (r < 0) { - p9_debug(P9_DEBUG_ERROR, -"integer field, but no integer?\n"); - continue; + if ((token != Opt_err) && (token != Opt_privport)) { + r = match_int(&args[0], &option); + if (r < 0) { + p9_debug(P9_DEBUG_ERROR, +"integer field, but no integer?\n"); + continue; + } } switch (token) { case Opt_port: @@ -214,6 +220,9 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) case Opt_timeout: opts->timeout = option; break; + case Opt_privport: + opts->privport = 1; + break; default: continue; } @@ -607,6 +616,23 @@ static int rdma_cancelled(struct p9_client *client, struct p9_req_t *req) return 0; } +static int p9_rdma_bind_privport(struct p9_trans_rdma *rdma) +{ + struct sockaddr_in cl = { + .sin_family = AF_INET, + .sin_addr.s_addr = htonl(INADDR_ANY), + }; + int port, err = -EINVAL; + + for (port = P9_DEF_MAX_RESVPORT; port >= P9_DEF_MIN_RESVPORT; port--) { + cl.sin_port = htons((ushort)port); + err = rdma_bind_addr(rdma->cm_id, (struct sockaddr *)&cl); + if (err != -EADDRINUSE) + break; + } + return err; +} + /** * trans_create_rdma - Transport method for creating atransport instance * @client: client instance @@ -642,6 +668,16 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args) /* Associate the client with the transport */ client->trans = rdma; + /* Bind to a privileged port if we need to */ + if (opts.privport) { + err = p9_rdma_bind_privport(rdma); + if (err < 0) { + pr_err("%s (%d): problem binding to privport: %d\n", + __func__, task_pid_nr(current), -err); + goto error; + } + } + /* Resolve the server's address */ rdma->addr.sin_family = AF_INET; rdma->addr.sin_addr.s_addr = in_aton(addr); -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv2 libibmad] fields.c: Print SwitchCongestionSetting threshold fields in hex rather than decimal
for consistency with CC Annex which shows meaning of threshold fields in hex not decimal Signed-off-by: Hal Rosenstock --- Change since v1: Change fields to hex rather than SwitchPortCongestionSetting:Threshold to be consistent with CC Annex diff --git a/src/fields.c b/src/fields.c index 33a6364..9965811 100644 --- a/src/fields.c +++ b/src/fields.c @@ -858,9 +858,9 @@ static const ib_field_t ib_mad_f[] = { {0, 32, "Control_Map", mad_dump_hex}, {32, 256, "Victim_Mask", mad_dump_array}, {288, 256, "Credit_Mask", mad_dump_array}, - {BITSOFFS(544, 4), "Threshold", mad_dump_uint}, + {BITSOFFS(544, 4), "Threshold", mad_dump_hex}, {BITSOFFS(552, 8), "Packet_Size", mad_dump_uint}, - {BITSOFFS(560, 4), "CS_Threshold", mad_dump_uint}, + {BITSOFFS(560, 4), "CS_Threshold", mad_dump_hex}, {BITSOFFS(576, 16), "CS_ReturnDelay", mad_dump_hex}, /* TODO: CCT dump */ {BITSOFFS(592, 16), "Marking_Rate", mad_dump_uint}, {0, 0}, /* IB_CC_SWITCH_CONGESTION_SETTING_LAST_F */ -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V1 FIX for-3.19] IB/ipoib: Fix broken multicast flow
On Wed, Jan 7, 2015 at 5:04 PM, Or Gerlitz wrote: > From: Erez Shitrit > > Following commit 016d9fb25cd9 "IPoIB: fix MCAST_FLAG_BUSY usage" > both IPv6 traffic and for the most cases all IPv4 multicast traffic > aren't working. Doug, can you ack the breakage introduced by your commit and the fix? Or. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html