svc_rdma_sendto.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  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. if (xdr->len !=
  60. (xdr->head[0].iov_len + xdr->page_len + xdr->tail[0].iov_len)) {
  61. pr_err("svcrdma: map_xdr: XDR buffer length error\n");
  62. return -EIO;
  63. }
  64. /* Skip the first sge, this is for the RPCRDMA header */
  65. sge_no = 1;
  66. /* Head SGE */
  67. vec->sge[sge_no].iov_base = xdr->head[0].iov_base;
  68. vec->sge[sge_no].iov_len = xdr->head[0].iov_len;
  69. sge_no++;
  70. /* pages SGE */
  71. page_no = 0;
  72. page_bytes = xdr->page_len;
  73. page_off = xdr->page_base;
  74. while (page_bytes) {
  75. vec->sge[sge_no].iov_base =
  76. page_address(xdr->pages[page_no]) + page_off;
  77. sge_bytes = min_t(u32, page_bytes, (PAGE_SIZE - page_off));
  78. page_bytes -= sge_bytes;
  79. vec->sge[sge_no].iov_len = sge_bytes;
  80. sge_no++;
  81. page_no++;
  82. page_off = 0; /* reset for next time through loop */
  83. }
  84. /* Tail SGE */
  85. if (xdr->tail[0].iov_len) {
  86. vec->sge[sge_no].iov_base = xdr->tail[0].iov_base;
  87. vec->sge[sge_no].iov_len = xdr->tail[0].iov_len;
  88. sge_no++;
  89. }
  90. dprintk("svcrdma: map_xdr: sge_no %d page_no %d "
  91. "page_base %u page_len %u head_len %zu tail_len %zu\n",
  92. sge_no, page_no, xdr->page_base, xdr->page_len,
  93. xdr->head[0].iov_len, xdr->tail[0].iov_len);
  94. vec->count = sge_no;
  95. return 0;
  96. }
  97. static dma_addr_t dma_map_xdr(struct svcxprt_rdma *xprt,
  98. struct xdr_buf *xdr,
  99. u32 xdr_off, size_t len, int dir)
  100. {
  101. struct page *page;
  102. dma_addr_t dma_addr;
  103. if (xdr_off < xdr->head[0].iov_len) {
  104. /* This offset is in the head */
  105. xdr_off += (unsigned long)xdr->head[0].iov_base & ~PAGE_MASK;
  106. page = virt_to_page(xdr->head[0].iov_base);
  107. } else {
  108. xdr_off -= xdr->head[0].iov_len;
  109. if (xdr_off < xdr->page_len) {
  110. /* This offset is in the page list */
  111. xdr_off += xdr->page_base;
  112. page = xdr->pages[xdr_off >> PAGE_SHIFT];
  113. xdr_off &= ~PAGE_MASK;
  114. } else {
  115. /* This offset is in the tail */
  116. xdr_off -= xdr->page_len;
  117. xdr_off += (unsigned long)
  118. xdr->tail[0].iov_base & ~PAGE_MASK;
  119. page = virt_to_page(xdr->tail[0].iov_base);
  120. }
  121. }
  122. dma_addr = ib_dma_map_page(xprt->sc_cm_id->device, page, xdr_off,
  123. min_t(size_t, PAGE_SIZE, len), dir);
  124. return dma_addr;
  125. }
  126. /* Assumptions:
  127. * - The specified write_len can be represented in sc_max_sge * PAGE_SIZE
  128. */
  129. static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp,
  130. u32 rmr, u64 to,
  131. u32 xdr_off, int write_len,
  132. struct svc_rdma_req_map *vec)
  133. {
  134. struct ib_send_wr write_wr;
  135. struct ib_sge *sge;
  136. int xdr_sge_no;
  137. int sge_no;
  138. int sge_bytes;
  139. int sge_off;
  140. int bc;
  141. struct svc_rdma_op_ctxt *ctxt;
  142. if (vec->count > RPCSVC_MAXPAGES) {
  143. pr_err("svcrdma: Too many pages (%lu)\n", vec->count);
  144. return -EIO;
  145. }
  146. dprintk("svcrdma: RDMA_WRITE rmr=%x, to=%llx, xdr_off=%d, "
  147. "write_len=%d, vec->sge=%p, vec->count=%lu\n",
  148. rmr, (unsigned long long)to, xdr_off,
  149. write_len, vec->sge, vec->count);
  150. ctxt = svc_rdma_get_context(xprt);
  151. ctxt->direction = DMA_TO_DEVICE;
  152. sge = ctxt->sge;
  153. /* Find the SGE associated with xdr_off */
  154. for (bc = xdr_off, xdr_sge_no = 1; bc && xdr_sge_no < vec->count;
  155. xdr_sge_no++) {
  156. if (vec->sge[xdr_sge_no].iov_len > bc)
  157. break;
  158. bc -= vec->sge[xdr_sge_no].iov_len;
  159. }
  160. sge_off = bc;
  161. bc = write_len;
  162. sge_no = 0;
  163. /* Copy the remaining SGE */
  164. while (bc != 0) {
  165. sge_bytes = min_t(size_t,
  166. bc, vec->sge[xdr_sge_no].iov_len-sge_off);
  167. sge[sge_no].length = sge_bytes;
  168. sge[sge_no].addr =
  169. dma_map_xdr(xprt, &rqstp->rq_res, xdr_off,
  170. sge_bytes, DMA_TO_DEVICE);
  171. xdr_off += sge_bytes;
  172. if (ib_dma_mapping_error(xprt->sc_cm_id->device,
  173. sge[sge_no].addr))
  174. goto err;
  175. atomic_inc(&xprt->sc_dma_used);
  176. sge[sge_no].lkey = xprt->sc_dma_lkey;
  177. ctxt->count++;
  178. sge_off = 0;
  179. sge_no++;
  180. xdr_sge_no++;
  181. if (xdr_sge_no > vec->count) {
  182. pr_err("svcrdma: Too many sges (%d)\n", xdr_sge_no);
  183. goto err;
  184. }
  185. bc -= sge_bytes;
  186. if (sge_no == xprt->sc_max_sge)
  187. break;
  188. }
  189. /* Prepare WRITE WR */
  190. memset(&write_wr, 0, sizeof write_wr);
  191. ctxt->wr_op = IB_WR_RDMA_WRITE;
  192. write_wr.wr_id = (unsigned long)ctxt;
  193. write_wr.sg_list = &sge[0];
  194. write_wr.num_sge = sge_no;
  195. write_wr.opcode = IB_WR_RDMA_WRITE;
  196. write_wr.send_flags = IB_SEND_SIGNALED;
  197. write_wr.wr.rdma.rkey = rmr;
  198. write_wr.wr.rdma.remote_addr = to;
  199. /* Post It */
  200. atomic_inc(&rdma_stat_write);
  201. if (svc_rdma_send(xprt, &write_wr))
  202. goto err;
  203. return write_len - bc;
  204. err:
  205. svc_rdma_unmap_dma(ctxt);
  206. svc_rdma_put_context(ctxt, 0);
  207. /* Fatal error, close transport */
  208. return -EIO;
  209. }
  210. static int send_write_chunks(struct svcxprt_rdma *xprt,
  211. struct rpcrdma_msg *rdma_argp,
  212. struct rpcrdma_msg *rdma_resp,
  213. struct svc_rqst *rqstp,
  214. struct svc_rdma_req_map *vec)
  215. {
  216. u32 xfer_len = rqstp->rq_res.page_len + rqstp->rq_res.tail[0].iov_len;
  217. int write_len;
  218. u32 xdr_off;
  219. int chunk_off;
  220. int chunk_no;
  221. struct rpcrdma_write_array *arg_ary;
  222. struct rpcrdma_write_array *res_ary;
  223. int ret;
  224. arg_ary = svc_rdma_get_write_array(rdma_argp);
  225. if (!arg_ary)
  226. return 0;
  227. res_ary = (struct rpcrdma_write_array *)
  228. &rdma_resp->rm_body.rm_chunks[1];
  229. /* Write chunks start at the pagelist */
  230. for (xdr_off = rqstp->rq_res.head[0].iov_len, chunk_no = 0;
  231. xfer_len && chunk_no < arg_ary->wc_nchunks;
  232. chunk_no++) {
  233. struct rpcrdma_segment *arg_ch;
  234. u64 rs_offset;
  235. arg_ch = &arg_ary->wc_array[chunk_no].wc_target;
  236. write_len = min(xfer_len, ntohl(arg_ch->rs_length));
  237. /* Prepare the response chunk given the length actually
  238. * written */
  239. xdr_decode_hyper((__be32 *)&arg_ch->rs_offset, &rs_offset);
  240. svc_rdma_xdr_encode_array_chunk(res_ary, chunk_no,
  241. arg_ch->rs_handle,
  242. arg_ch->rs_offset,
  243. write_len);
  244. chunk_off = 0;
  245. while (write_len) {
  246. ret = send_write(xprt, rqstp,
  247. ntohl(arg_ch->rs_handle),
  248. rs_offset + chunk_off,
  249. xdr_off,
  250. write_len,
  251. vec);
  252. if (ret <= 0) {
  253. dprintk("svcrdma: RDMA_WRITE failed, ret=%d\n",
  254. ret);
  255. return -EIO;
  256. }
  257. chunk_off += ret;
  258. xdr_off += ret;
  259. xfer_len -= ret;
  260. write_len -= ret;
  261. }
  262. }
  263. /* Update the req with the number of chunks actually used */
  264. svc_rdma_xdr_encode_write_list(rdma_resp, chunk_no);
  265. return rqstp->rq_res.page_len + rqstp->rq_res.tail[0].iov_len;
  266. }
  267. static int send_reply_chunks(struct svcxprt_rdma *xprt,
  268. struct rpcrdma_msg *rdma_argp,
  269. struct rpcrdma_msg *rdma_resp,
  270. struct svc_rqst *rqstp,
  271. struct svc_rdma_req_map *vec)
  272. {
  273. u32 xfer_len = rqstp->rq_res.len;
  274. int write_len;
  275. u32 xdr_off;
  276. int chunk_no;
  277. int chunk_off;
  278. int nchunks;
  279. struct rpcrdma_segment *ch;
  280. struct rpcrdma_write_array *arg_ary;
  281. struct rpcrdma_write_array *res_ary;
  282. int ret;
  283. arg_ary = svc_rdma_get_reply_array(rdma_argp);
  284. if (!arg_ary)
  285. return 0;
  286. /* XXX: need to fix when reply lists occur with read-list and or
  287. * write-list */
  288. res_ary = (struct rpcrdma_write_array *)
  289. &rdma_resp->rm_body.rm_chunks[2];
  290. /* xdr offset starts at RPC message */
  291. nchunks = ntohl(arg_ary->wc_nchunks);
  292. for (xdr_off = 0, chunk_no = 0;
  293. xfer_len && chunk_no < nchunks;
  294. chunk_no++) {
  295. u64 rs_offset;
  296. ch = &arg_ary->wc_array[chunk_no].wc_target;
  297. write_len = min(xfer_len, htonl(ch->rs_length));
  298. /* Prepare the reply chunk given the length actually
  299. * written */
  300. xdr_decode_hyper((__be32 *)&ch->rs_offset, &rs_offset);
  301. svc_rdma_xdr_encode_array_chunk(res_ary, chunk_no,
  302. ch->rs_handle, ch->rs_offset,
  303. write_len);
  304. chunk_off = 0;
  305. while (write_len) {
  306. ret = send_write(xprt, rqstp,
  307. ntohl(ch->rs_handle),
  308. rs_offset + chunk_off,
  309. xdr_off,
  310. write_len,
  311. vec);
  312. if (ret <= 0) {
  313. dprintk("svcrdma: RDMA_WRITE failed, ret=%d\n",
  314. ret);
  315. return -EIO;
  316. }
  317. chunk_off += ret;
  318. xdr_off += ret;
  319. xfer_len -= ret;
  320. write_len -= ret;
  321. }
  322. }
  323. /* Update the req with the number of chunks actually used */
  324. svc_rdma_xdr_encode_reply_array(res_ary, chunk_no);
  325. return rqstp->rq_res.len;
  326. }
  327. /* This function prepares the portion of the RPCRDMA message to be
  328. * sent in the RDMA_SEND. This function is called after data sent via
  329. * RDMA has already been transmitted. There are three cases:
  330. * - The RPCRDMA header, RPC header, and payload are all sent in a
  331. * single RDMA_SEND. This is the "inline" case.
  332. * - The RPCRDMA header and some portion of the RPC header and data
  333. * are sent via this RDMA_SEND and another portion of the data is
  334. * sent via RDMA.
  335. * - The RPCRDMA header [NOMSG] is sent in this RDMA_SEND and the RPC
  336. * header and data are all transmitted via RDMA.
  337. * In all three cases, this function prepares the RPCRDMA header in
  338. * sge[0], the 'type' parameter indicates the type to place in the
  339. * RPCRDMA header, and the 'byte_count' field indicates how much of
  340. * the XDR to include in this RDMA_SEND. NB: The offset of the payload
  341. * to send is zero in the XDR.
  342. */
  343. static int send_reply(struct svcxprt_rdma *rdma,
  344. struct svc_rqst *rqstp,
  345. struct page *page,
  346. struct rpcrdma_msg *rdma_resp,
  347. struct svc_rdma_op_ctxt *ctxt,
  348. struct svc_rdma_req_map *vec,
  349. int byte_count)
  350. {
  351. struct ib_send_wr send_wr;
  352. int sge_no;
  353. int sge_bytes;
  354. int page_no;
  355. int pages;
  356. int ret;
  357. /* Post a recv buffer to handle another request. */
  358. ret = svc_rdma_post_recv(rdma);
  359. if (ret) {
  360. printk(KERN_INFO
  361. "svcrdma: could not post a receive buffer, err=%d."
  362. "Closing transport %p.\n", ret, rdma);
  363. set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
  364. svc_rdma_put_context(ctxt, 0);
  365. return -ENOTCONN;
  366. }
  367. /* Prepare the context */
  368. ctxt->pages[0] = page;
  369. ctxt->count = 1;
  370. /* Prepare the SGE for the RPCRDMA Header */
  371. ctxt->sge[0].lkey = rdma->sc_dma_lkey;
  372. ctxt->sge[0].length = svc_rdma_xdr_get_reply_hdr_len(rdma_resp);
  373. ctxt->sge[0].addr =
  374. ib_dma_map_page(rdma->sc_cm_id->device, page, 0,
  375. ctxt->sge[0].length, DMA_TO_DEVICE);
  376. if (ib_dma_mapping_error(rdma->sc_cm_id->device, ctxt->sge[0].addr))
  377. goto err;
  378. atomic_inc(&rdma->sc_dma_used);
  379. ctxt->direction = DMA_TO_DEVICE;
  380. /* Map the payload indicated by 'byte_count' */
  381. for (sge_no = 1; byte_count && sge_no < vec->count; sge_no++) {
  382. int xdr_off = 0;
  383. sge_bytes = min_t(size_t, vec->sge[sge_no].iov_len, byte_count);
  384. byte_count -= sge_bytes;
  385. ctxt->sge[sge_no].addr =
  386. dma_map_xdr(rdma, &rqstp->rq_res, xdr_off,
  387. sge_bytes, DMA_TO_DEVICE);
  388. xdr_off += sge_bytes;
  389. if (ib_dma_mapping_error(rdma->sc_cm_id->device,
  390. ctxt->sge[sge_no].addr))
  391. goto err;
  392. atomic_inc(&rdma->sc_dma_used);
  393. ctxt->sge[sge_no].lkey = rdma->sc_dma_lkey;
  394. ctxt->sge[sge_no].length = sge_bytes;
  395. }
  396. if (byte_count != 0) {
  397. pr_err("svcrdma: Could not map %d bytes\n", byte_count);
  398. goto err;
  399. }
  400. /* Save all respages in the ctxt and remove them from the
  401. * respages array. They are our pages until the I/O
  402. * completes.
  403. */
  404. pages = rqstp->rq_next_page - rqstp->rq_respages;
  405. for (page_no = 0; page_no < pages; page_no++) {
  406. ctxt->pages[page_no+1] = rqstp->rq_respages[page_no];
  407. ctxt->count++;
  408. rqstp->rq_respages[page_no] = NULL;
  409. /*
  410. * If there are more pages than SGE, terminate SGE
  411. * list so that svc_rdma_unmap_dma doesn't attempt to
  412. * unmap garbage.
  413. */
  414. if (page_no+1 >= sge_no)
  415. ctxt->sge[page_no+1].length = 0;
  416. }
  417. rqstp->rq_next_page = rqstp->rq_respages + 1;
  418. if (sge_no > rdma->sc_max_sge) {
  419. pr_err("svcrdma: Too many sges (%d)\n", sge_no);
  420. goto err;
  421. }
  422. memset(&send_wr, 0, sizeof send_wr);
  423. ctxt->wr_op = IB_WR_SEND;
  424. send_wr.wr_id = (unsigned long)ctxt;
  425. send_wr.sg_list = ctxt->sge;
  426. send_wr.num_sge = sge_no;
  427. send_wr.opcode = IB_WR_SEND;
  428. send_wr.send_flags = IB_SEND_SIGNALED;
  429. ret = svc_rdma_send(rdma, &send_wr);
  430. if (ret)
  431. goto err;
  432. return 0;
  433. err:
  434. svc_rdma_unmap_dma(ctxt);
  435. svc_rdma_put_context(ctxt, 1);
  436. return -EIO;
  437. }
  438. void svc_rdma_prep_reply_hdr(struct svc_rqst *rqstp)
  439. {
  440. }
  441. int svc_rdma_sendto(struct svc_rqst *rqstp)
  442. {
  443. struct svc_xprt *xprt = rqstp->rq_xprt;
  444. struct svcxprt_rdma *rdma =
  445. container_of(xprt, struct svcxprt_rdma, sc_xprt);
  446. struct rpcrdma_msg *rdma_argp;
  447. struct rpcrdma_msg *rdma_resp;
  448. struct rpcrdma_write_array *reply_ary;
  449. enum rpcrdma_proc reply_type;
  450. int ret;
  451. int inline_bytes;
  452. struct page *res_page;
  453. struct svc_rdma_op_ctxt *ctxt;
  454. struct svc_rdma_req_map *vec;
  455. dprintk("svcrdma: sending response for rqstp=%p\n", rqstp);
  456. /* Get the RDMA request header. The receive logic always
  457. * places this at the start of page 0.
  458. */
  459. rdma_argp = page_address(rqstp->rq_pages[0]);
  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. }