Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

svcrdma: Record send_ctxt completion ID in trace_svcrdma_post_send()

First, refactor: Dereference the svc_rdma_send_ctxt inside
svc_rdma_send() instead of at every call site.

Then, it can be passed into trace_svcrdma_post_send() to get the
proper completion ID.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+20 -14
+2 -1
include/linux/sunrpc/svc_rdma.h
··· 196 196 svc_rdma_send_ctxt_get(struct svcxprt_rdma *rdma); 197 197 extern void svc_rdma_send_ctxt_put(struct svcxprt_rdma *rdma, 198 198 struct svc_rdma_send_ctxt *ctxt); 199 - extern int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr); 199 + extern int svc_rdma_send(struct svcxprt_rdma *rdma, 200 + struct svc_rdma_send_ctxt *ctxt); 200 201 extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma, 201 202 struct svc_rdma_send_ctxt *sctxt, 202 203 const struct svc_rdma_recv_ctxt *rctxt,
+11 -7
include/trace/events/rpcrdma.h
··· 1839 1839 1840 1840 TRACE_EVENT(svcrdma_post_send, 1841 1841 TP_PROTO( 1842 - const struct ib_send_wr *wr 1842 + const struct svc_rdma_send_ctxt *ctxt 1843 1843 ), 1844 1844 1845 - TP_ARGS(wr), 1845 + TP_ARGS(ctxt), 1846 1846 1847 1847 TP_STRUCT__entry( 1848 - __field(const void *, cqe) 1848 + __field(u32, cq_id) 1849 + __field(int, completion_id) 1849 1850 __field(unsigned int, num_sge) 1850 1851 __field(u32, inv_rkey) 1851 1852 ), 1852 1853 1853 1854 TP_fast_assign( 1854 - __entry->cqe = wr->wr_cqe; 1855 + const struct ib_send_wr *wr = &ctxt->sc_send_wr; 1856 + 1857 + __entry->cq_id = ctxt->sc_cid.ci_queue_id; 1858 + __entry->completion_id = ctxt->sc_cid.ci_completion_id; 1855 1859 __entry->num_sge = wr->num_sge; 1856 1860 __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ? 1857 1861 wr->ex.invalidate_rkey : 0; 1858 1862 ), 1859 1863 1860 - TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x", 1861 - __entry->cqe, __entry->num_sge, 1862 - __entry->inv_rkey 1864 + TP_printk("cq_id=%u cid=%d num_sge=%u inv_rkey=0x%08x", 1865 + __entry->cq_id, __entry->completion_id, 1866 + __entry->num_sge, __entry->inv_rkey 1863 1867 ) 1864 1868 ); 1865 1869
+1 -1
net/sunrpc/xprtrdma/svc_rdma_backchannel.c
··· 87 87 */ 88 88 get_page(virt_to_page(rqst->rq_buffer)); 89 89 ctxt->sc_send_wr.opcode = IB_WR_SEND; 90 - return svc_rdma_send(rdma, &ctxt->sc_send_wr); 90 + return svc_rdma_send(rdma, ctxt); 91 91 } 92 92 93 93 /* Server-side transport endpoint wants a whole page for its send
+6 -5
net/sunrpc/xprtrdma/svc_rdma_sendto.c
··· 298 298 /** 299 299 * svc_rdma_send - Post a single Send WR 300 300 * @rdma: transport on which to post the WR 301 - * @wr: prepared Send WR to post 301 + * @ctxt: send ctxt with a Send WR ready to post 302 302 * 303 303 * Returns zero the Send WR was posted successfully. Otherwise, a 304 304 * negative errno is returned. 305 305 */ 306 - int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr) 306 + int svc_rdma_send(struct svcxprt_rdma *rdma, struct svc_rdma_send_ctxt *ctxt) 307 307 { 308 + struct ib_send_wr *wr = &ctxt->sc_send_wr; 308 309 int ret; 309 310 310 311 might_sleep(); ··· 331 330 } 332 331 333 332 svc_xprt_get(&rdma->sc_xprt); 334 - trace_svcrdma_post_send(wr); 333 + trace_svcrdma_post_send(ctxt); 335 334 ret = ib_post_send(rdma->sc_qp, wr, NULL); 336 335 if (ret) 337 336 break; ··· 806 805 } else { 807 806 sctxt->sc_send_wr.opcode = IB_WR_SEND; 808 807 } 809 - return svc_rdma_send(rdma, &sctxt->sc_send_wr); 808 + return svc_rdma_send(rdma, sctxt); 810 809 } 811 810 812 811 /** ··· 870 869 sctxt->sc_send_wr.num_sge = 1; 871 870 sctxt->sc_send_wr.opcode = IB_WR_SEND; 872 871 sctxt->sc_sges[0].length = sctxt->sc_hdrbuf.len; 873 - if (svc_rdma_send(rdma, &sctxt->sc_send_wr)) 872 + if (svc_rdma_send(rdma, sctxt)) 874 873 goto put_ctxt; 875 874 return; 876 875