svc_rdma_sendto.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. /*
  2. * Copyright (c) 2014 Open Grid Computing, Inc. All rights reserved.
  3. * Copyright (c) 2005-2006 Network Appliance, Inc. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the BSD-type
  9. * license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. *
  15. * Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. *
  18. * Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials provided
  21. * with the distribution.
  22. *
  23. * Neither the name of the Network Appliance, Inc. nor the names of
  24. * its contributors may be used to endorse or promote products
  25. * derived from this software without specific prior written
  26. * permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. * Author: Tom Tucker <tom@opengridcomputing.com>
  41. */
  42. #include <linux/sunrpc/debug.h>
  43. #include <linux/sunrpc/rpc_rdma.h>
  44. #include <linux/spinlock.h>
  45. #include <asm/unaligned.h>
  46. #include <rdma/ib_verbs.h>
  47. #include <rdma/rdma_cm.h>
  48. #include <linux/sunrpc/svc_rdma.h>
  49. #define RPCDBG_FACILITY RPCDBG_SVCXPRT
  50. static int map_xdr(struct svcxprt_rdma *xprt,
  51. struct xdr_buf *xdr,
  52. struct svc_rdma_req_map *vec)
  53. {
  54. int sge_no;
  55. u32 sge_bytes;
  56. u32 page_bytes;
  57. u32 page_off;
  58. int page_no;
  59. BUG_ON(xdr->len !=
  60. (xdr->head[0].iov_len + xdr->page_len + xdr->tail[0].iov_len));
  61. /* Skip the first sge, this is for the RPCRDMA header */
  62. sge_no = 1;
  63. /* Head SGE */
  64. vec->sge[sge_no].iov_base = xdr->head[0].iov_base;
  65. vec->sge[sge_no].iov_len = xdr->head[0].iov_len;
  66. sge_no++;
  67. /* pages SGE */
  68. page_no = 0;
  69. page_bytes = xdr->page_len;
  70. page_off = xdr->page_base;
  71. while (page_bytes) {
  72. vec->sge[sge_no].iov_base =
  73. page_address(xdr->pages[page_no]) + page_off;
  74. sge_bytes = min_t(u32, page_bytes, (PAGE_SIZE - page_off));
  75. page_bytes -= sge_bytes;
  76. vec->sge[sge_no].iov_len = sge_bytes;
  77. sge_no++;
  78. page_no++;
  79. page_off = 0; /* reset for next time through loop */
  80. }
  81. /* Tail SGE */
  82. if (xdr->tail[0].iov_len) {
  83. vec->sge[sge_no].iov_base = xdr->tail[0].iov_base;
  84. vec->sge[sge_no].iov_len = xdr->tail[0].iov_len;
  85. sge_no++;
  86. }
  87. dprintk("svcrdma: map_xdr: sge_no %d page_no %d "
  88. "page_base %u page_len %u head_len %zu tail_len %zu\n",
  89. sge_no, page_no, xdr->page_base, xdr->page_len,
  90. xdr->head[0].iov_len, xdr->tail[0].iov_len);
  91. vec->count = sge_no;
  92. return 0;
  93. }
  94. static dma_addr_t dma_map_xdr(struct svcxprt_rdma *xprt,
  95. struct xdr_buf *xdr,
  96. u32 xdr_off, size_t len, int dir)
  97. {
  98. struct page *page;
  99. dma_addr_t dma_addr;
  100. if (xdr_off < xdr->head[0].iov_len) {
  101. /* This offset is in the head */
  102. xdr_off += (unsigned long)xdr->head[0].iov_base & ~PAGE_MASK;
  103. page = virt_to_page(xdr->head[0].iov_base);
  104. } else {
  105. xdr_off -= xdr->head[0].iov_len;
  106. if (xdr_off < xdr->page_len) {
  107. /* This offset is in the page list */
  108. xdr_off += xdr->page_base;
  109. page = xdr->pages[xdr_off >> PAGE_SHIFT];
  110. xdr_off &= ~PAGE_MASK;
  111. } else {
  112. /* This offset is in the tail */
  113. xdr_off -= xdr->page_len;
  114. xdr_off += (unsigned long)
  115. xdr->tail[0].iov_base & ~PAGE_MASK;
  116. page = virt_to_page(xdr->tail[0].iov_base);
  117. }
  118. }
  119. dma_addr = ib_dma_map_page(xprt->sc_cm_id->device, page, xdr_off,
  120. min_t(size_t, PAGE_SIZE, len), dir);
  121. return dma_addr;
  122. }
  123. /* Assumptions:
  124. * - The specified write_len can be represented in sc_max_sge * PAGE_SIZE
  125. */
  126. static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp,
  127. u32 rmr, u64 to,
  128. u32 xdr_off, int write_len,
  129. struct svc_rdma_req_map *vec)
  130. {
  131. struct ib_send_wr write_wr;
  132. struct ib_sge *sge;
  133. int xdr_sge_no;
  134. int sge_no;
  135. int sge_bytes;
  136. int sge_off;
  137. int bc;
  138. struct svc_rdma_op_ctxt *ctxt;
  139. BUG_ON(vec->count > RPCSVC_MAXPAGES);
  140. dprintk("svcrdma: RDMA_WRITE rmr=%x, to=%llx, xdr_off=%d, "
  141. "write_len=%d, vec->sge=%p, vec->count=%lu\n",
  142. rmr, (unsigned long long)to, xdr_off,
  143. write_len, vec->sge, vec->count);
  144. ctxt = svc_rdma_get_context(xprt);
  145. ctxt->direction = DMA_TO_DEVICE;
  146. sge = ctxt->sge;
  147. /* Find the SGE associated with xdr_off */
  148. for (bc = xdr_off, xdr_sge_no = 1; bc && xdr_sge_no < vec->count;
  149. xdr_sge_no++) {
  150. if (vec->sge[xdr_sge_no].iov_len > bc)
  151. break;
  152. bc -= vec->sge[xdr_sge_no].iov_len;
  153. }
  154. sge_off = bc;
  155. bc = write_len;
  156. sge_no = 0;
  157. /* Copy the remaining SGE */
  158. while (bc != 0) {
  159. sge_bytes = min_t(size_t,
  160. bc, vec->sge[xdr_sge_no].iov_len-sge_off);
  161. sge[sge_no].length = sge_bytes;
  162. sge[sge_no].addr =
  163. dma_map_xdr(xprt, &rqstp->rq_res, xdr_off,
  164. sge_bytes, DMA_TO_DEVICE);
  165. xdr_off += sge_bytes;
  166. if (ib_dma_mapping_error(xprt->sc_cm_id->device,
  167. sge[sge_no].addr))
  168. goto err;
  169. atomic_inc(&xprt->sc_dma_used);
  170. sge[sge_no].lkey = xprt->sc_dma_lkey;
  171. ctxt->count++;
  172. sge_off = 0;
  173. sge_no++;
  174. xdr_sge_no++;
  175. BUG_ON(xdr_sge_no > vec->count);
  176. bc -= sge_bytes;
  177. }
  178. /* Prepare WRITE WR */
  179. memset(&write_wr, 0, sizeof write_wr);
  180. ctxt->wr_op = IB_WR_RDMA_WRITE;
  181. write_wr.wr_id = (unsigned long)ctxt;
  182. write_wr.sg_list = &sge[0];
  183. write_wr.num_sge = sge_no;
  184. write_wr.opcode = IB_WR_RDMA_WRITE;
  185. write_wr.send_flags = IB_SEND_SIGNALED;
  186. write_wr.wr.rdma.rkey = rmr;
  187. write_wr.wr.rdma.remote_addr = to;
  188. /* Post It */
  189. atomic_inc(&rdma_stat_write);
  190. if (svc_rdma_send(xprt, &write_wr))
  191. goto err;
  192. return 0;
  193. err:
  194. svc_rdma_unmap_dma(ctxt);
  195. svc_rdma_put_context(ctxt, 0);
  196. /* Fatal error, close transport */
  197. return -EIO;
  198. }
  199. static int send_write_chunks(struct svcxprt_rdma *xprt,
  200. struct rpcrdma_msg *rdma_argp,
  201. struct rpcrdma_msg *rdma_resp,
  202. struct svc_rqst *rqstp,
  203. struct svc_rdma_req_map *vec)
  204. {
  205. u32 xfer_len = rqstp->rq_res.page_len + rqstp->rq_res.tail[0].iov_len;
  206. int write_len;
  207. int max_write;
  208. u32 xdr_off;
  209. int chunk_off;
  210. int chunk_no;
  211. struct rpcrdma_write_array *arg_ary;
  212. struct rpcrdma_write_array *res_ary;
  213. int ret;
  214. arg_ary = svc_rdma_get_write_array(rdma_argp);
  215. if (!arg_ary)
  216. return 0;
  217. res_ary = (struct rpcrdma_write_array *)
  218. &rdma_resp->rm_body.rm_chunks[1];
  219. max_write = xprt->sc_max_sge * PAGE_SIZE;
  220. /* Write chunks start at the pagelist */
  221. for (xdr_off = rqstp->rq_res.head[0].iov_len, chunk_no = 0;
  222. xfer_len && chunk_no < arg_ary->wc_nchunks;
  223. chunk_no++) {
  224. struct rpcrdma_segment *arg_ch;
  225. u64 rs_offset;
  226. arg_ch = &arg_ary->wc_array[chunk_no].wc_target;
  227. write_len = min(xfer_len, ntohl(arg_ch->rs_length));
  228. /* Prepare the response chunk given the length actually
  229. * written */
  230. xdr_decode_hyper((__be32 *)&arg_ch->rs_offset, &rs_offset);
  231. svc_rdma_xdr_encode_array_chunk(res_ary, chunk_no,
  232. arg_ch->rs_handle,
  233. arg_ch->rs_offset,
  234. write_len);
  235. chunk_off = 0;
  236. while (write_len) {
  237. int this_write;
  238. this_write = min(write_len, max_write);
  239. ret = send_write(xprt, rqstp,
  240. ntohl(arg_ch->rs_handle),
  241. rs_offset + chunk_off,
  242. xdr_off,
  243. this_write,
  244. vec);
  245. if (ret) {
  246. dprintk("svcrdma: RDMA_WRITE failed, ret=%d\n",
  247. ret);
  248. return -EIO;
  249. }
  250. chunk_off += this_write;
  251. xdr_off += this_write;
  252. xfer_len -= this_write;
  253. write_len -= this_write;
  254. }
  255. }
  256. /* Update the req with the number of chunks actually used */
  257. svc_rdma_xdr_encode_write_list(rdma_resp, chunk_no);
  258. return rqstp->rq_res.page_len + rqstp->rq_res.tail[0].iov_len;
  259. }
  260. static int send_reply_chunks(struct svcxprt_rdma *xprt,
  261. struct rpcrdma_msg *rdma_argp,
  262. struct rpcrdma_msg *rdma_resp,
  263. struct svc_rqst *rqstp,
  264. struct svc_rdma_req_map *vec)
  265. {
  266. u32 xfer_len = rqstp->rq_res.len;
  267. int write_len;
  268. int max_write;
  269. u32 xdr_off;
  270. int chunk_no;
  271. int chunk_off;
  272. int nchunks;
  273. struct rpcrdma_segment *ch;
  274. struct rpcrdma_write_array *arg_ary;
  275. struct rpcrdma_write_array *res_ary;
  276. int ret;
  277. arg_ary = svc_rdma_get_reply_array(rdma_argp);
  278. if (!arg_ary)
  279. return 0;
  280. /* XXX: need to fix when reply lists occur with read-list and or
  281. * write-list */
  282. res_ary = (struct rpcrdma_write_array *)
  283. &rdma_resp->rm_body.rm_chunks[2];
  284. max_write = xprt->sc_max_sge * PAGE_SIZE;
  285. /* xdr offset starts at RPC message */
  286. nchunks = ntohl(arg_ary->wc_nchunks);
  287. for (xdr_off = 0, chunk_no = 0;
  288. xfer_len && chunk_no < nchunks;
  289. chunk_no++) {
  290. u64 rs_offset;
  291. ch = &arg_ary->wc_array[chunk_no].wc_target;
  292. write_len = min(xfer_len, htonl(ch->rs_length));
  293. /* Prepare the reply chunk given the length actually
  294. * written */
  295. xdr_decode_hyper((__be32 *)&ch->rs_offset, &rs_offset);
  296. svc_rdma_xdr_encode_array_chunk(res_ary, chunk_no,
  297. ch->rs_handle, ch->rs_offset,
  298. write_len);
  299. chunk_off = 0;
  300. while (write_len) {
  301. int this_write;
  302. this_write = min(write_len, max_write);
  303. ret = send_write(xprt, rqstp,
  304. ntohl(ch->rs_handle),
  305. rs_offset + chunk_off,
  306. xdr_off,
  307. this_write,
  308. vec);
  309. if (ret) {
  310. dprintk("svcrdma: RDMA_WRITE failed, ret=%d\n",
  311. ret);
  312. return -EIO;
  313. }
  314. chunk_off += this_write;
  315. xdr_off += this_write;
  316. xfer_len -= this_write;
  317. write_len -= this_write;
  318. }
  319. }
  320. /* Update the req with the number of chunks actually used */
  321. svc_rdma_xdr_encode_reply_array(res_ary, chunk_no);
  322. return rqstp->rq_res.len;
  323. }
  324. /* This function prepares the portion of the RPCRDMA message to be
  325. * sent in the RDMA_SEND. This function is called after data sent via
  326. * RDMA has already been transmitted. There are three cases:
  327. * - The RPCRDMA header, RPC header, and payload are all sent in a
  328. * single RDMA_SEND. This is the "inline" case.
  329. * - The RPCRDMA header and some portion of the RPC header and data
  330. * are sent via this RDMA_SEND and another portion of the data is
  331. * sent via RDMA.
  332. * - The RPCRDMA header [NOMSG] is sent in this RDMA_SEND and the RPC
  333. * header and data are all transmitted via RDMA.
  334. * In all three cases, this function prepares the RPCRDMA header in
  335. * sge[0], the 'type' parameter indicates the type to place in the
  336. * RPCRDMA header, and the 'byte_count' field indicates how much of
  337. * the XDR to include in this RDMA_SEND. NB: The offset of the payload
  338. * to send is zero in the XDR.
  339. */
  340. static int send_reply(struct svcxprt_rdma *rdma,
  341. struct svc_rqst *rqstp,
  342. struct page *page,
  343. struct rpcrdma_msg *rdma_resp,
  344. struct svc_rdma_op_ctxt *ctxt,
  345. struct svc_rdma_req_map *vec,
  346. int byte_count)
  347. {
  348. struct ib_send_wr send_wr;
  349. int sge_no;
  350. int sge_bytes;
  351. int page_no;
  352. int pages;
  353. int ret;
  354. /* Post a recv buffer to handle another request. */
  355. ret = svc_rdma_post_recv(rdma);
  356. if (ret) {
  357. printk(KERN_INFO
  358. "svcrdma: could not post a receive buffer, err=%d."
  359. "Closing transport %p.\n", ret, rdma);
  360. set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
  361. svc_rdma_put_context(ctxt, 0);
  362. return -ENOTCONN;
  363. }
  364. /* Prepare the context */
  365. ctxt->pages[0] = page;
  366. ctxt->count = 1;
  367. /* Prepare the SGE for the RPCRDMA Header */
  368. ctxt->sge[0].lkey = rdma->sc_dma_lkey;
  369. ctxt->sge[0].length = svc_rdma_xdr_get_reply_hdr_len(rdma_resp);
  370. ctxt->sge[0].addr =
  371. ib_dma_map_page(rdma->sc_cm_id->device, page, 0,
  372. ctxt->sge[0].length, DMA_TO_DEVICE);
  373. if (ib_dma_mapping_error(rdma->sc_cm_id->device, ctxt->sge[0].addr))
  374. goto err;
  375. atomic_inc(&rdma->sc_dma_used);
  376. ctxt->direction = DMA_TO_DEVICE;
  377. /* Map the payload indicated by 'byte_count' */
  378. for (sge_no = 1; byte_count && sge_no < vec->count; sge_no++) {
  379. int xdr_off = 0;
  380. sge_bytes = min_t(size_t, vec->sge[sge_no].iov_len, byte_count);
  381. byte_count -= sge_bytes;
  382. ctxt->sge[sge_no].addr =
  383. dma_map_xdr(rdma, &rqstp->rq_res, xdr_off,
  384. sge_bytes, DMA_TO_DEVICE);
  385. xdr_off += sge_bytes;
  386. if (ib_dma_mapping_error(rdma->sc_cm_id->device,
  387. ctxt->sge[sge_no].addr))
  388. goto err;
  389. atomic_inc(&rdma->sc_dma_used);
  390. ctxt->sge[sge_no].lkey = rdma->sc_dma_lkey;
  391. ctxt->sge[sge_no].length = sge_bytes;
  392. }
  393. BUG_ON(byte_count != 0);
  394. /* Save all respages in the ctxt and remove them from the
  395. * respages array. They are our pages until the I/O
  396. * completes.
  397. */
  398. pages = rqstp->rq_next_page - rqstp->rq_respages;
  399. for (page_no = 0; page_no < pages; page_no++) {
  400. ctxt->pages[page_no+1] = rqstp->rq_respages[page_no];
  401. ctxt->count++;
  402. rqstp->rq_respages[page_no] = NULL;
  403. /*
  404. * If there are more pages than SGE, terminate SGE
  405. * list so that svc_rdma_unmap_dma doesn't attempt to
  406. * unmap garbage.
  407. */
  408. if (page_no+1 >= sge_no)
  409. ctxt->sge[page_no+1].length = 0;
  410. }
  411. rqstp->rq_next_page = rqstp->rq_respages + 1;
  412. BUG_ON(sge_no > rdma->sc_max_sge);
  413. memset(&send_wr, 0, sizeof send_wr);
  414. ctxt->wr_op = IB_WR_SEND;
  415. send_wr.wr_id = (unsigned long)ctxt;
  416. send_wr.sg_list = ctxt->sge;
  417. send_wr.num_sge = sge_no;
  418. send_wr.opcode = IB_WR_SEND;
  419. send_wr.send_flags = IB_SEND_SIGNALED;
  420. ret = svc_rdma_send(rdma, &send_wr);
  421. if (ret)
  422. goto err;
  423. return 0;
  424. err:
  425. svc_rdma_unmap_dma(ctxt);
  426. svc_rdma_put_context(ctxt, 1);
  427. return -EIO;
  428. }
  429. void svc_rdma_prep_reply_hdr(struct svc_rqst *rqstp)
  430. {
  431. }
  432. /*
  433. * Return the start of an xdr buffer.
  434. */
  435. static void *xdr_start(struct xdr_buf *xdr)
  436. {
  437. return xdr->head[0].iov_base -
  438. (xdr->len -
  439. xdr->page_len -
  440. xdr->tail[0].iov_len -
  441. xdr->head[0].iov_len);
  442. }
  443. int svc_rdma_sendto(struct svc_rqst *rqstp)
  444. {
  445. struct svc_xprt *xprt = rqstp->rq_xprt;
  446. struct svcxprt_rdma *rdma =
  447. container_of(xprt, struct svcxprt_rdma, sc_xprt);
  448. struct rpcrdma_msg *rdma_argp;
  449. struct rpcrdma_msg *rdma_resp;
  450. struct rpcrdma_write_array *reply_ary;
  451. enum rpcrdma_proc reply_type;
  452. int ret;
  453. int inline_bytes;
  454. struct page *res_page;
  455. struct svc_rdma_op_ctxt *ctxt;
  456. struct svc_rdma_req_map *vec;
  457. dprintk("svcrdma: sending response for rqstp=%p\n", rqstp);
  458. /* Get the RDMA request header. */
  459. rdma_argp = xdr_start(&rqstp->rq_arg);
  460. /* Build an req vec for the XDR */
  461. ctxt = svc_rdma_get_context(rdma);
  462. ctxt->direction = DMA_TO_DEVICE;
  463. vec = svc_rdma_get_req_map();
  464. ret = map_xdr(rdma, &rqstp->rq_res, vec);
  465. if (ret)
  466. goto err0;
  467. inline_bytes = rqstp->rq_res.len;
  468. /* Create the RDMA response header */
  469. res_page = svc_rdma_get_page();
  470. rdma_resp = page_address(res_page);
  471. reply_ary = svc_rdma_get_reply_array(rdma_argp);
  472. if (reply_ary)
  473. reply_type = RDMA_NOMSG;
  474. else
  475. reply_type = RDMA_MSG;
  476. svc_rdma_xdr_encode_reply_header(rdma, rdma_argp,
  477. rdma_resp, reply_type);
  478. /* Send any write-chunk data and build resp write-list */
  479. ret = send_write_chunks(rdma, rdma_argp, rdma_resp,
  480. rqstp, vec);
  481. if (ret < 0) {
  482. printk(KERN_ERR "svcrdma: failed to send write chunks, rc=%d\n",
  483. ret);
  484. goto err1;
  485. }
  486. inline_bytes -= ret;
  487. /* Send any reply-list data and update resp reply-list */
  488. ret = send_reply_chunks(rdma, rdma_argp, rdma_resp,
  489. rqstp, vec);
  490. if (ret < 0) {
  491. printk(KERN_ERR "svcrdma: failed to send reply chunks, rc=%d\n",
  492. ret);
  493. goto err1;
  494. }
  495. inline_bytes -= ret;
  496. ret = send_reply(rdma, rqstp, res_page, rdma_resp, ctxt, vec,
  497. inline_bytes);
  498. svc_rdma_put_req_map(vec);
  499. dprintk("svcrdma: send_reply returns %d\n", ret);
  500. return ret;
  501. err1:
  502. put_page(res_page);
  503. err0:
  504. svc_rdma_put_req_map(vec);
  505. svc_rdma_put_context(ctxt, 0);
  506. return ret;
  507. }