]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xprtrdma: Use sendctx DMA state for Send signaling
authorChuck Lever <chuck.lever@oracle.com>
Tue, 26 May 2026 14:14:01 +0000 (10:14 -0400)
committerAnna Schumaker <anna.schumaker@hammerspace.com>
Mon, 8 Jun 2026 14:21:55 +0000 (10:21 -0400)
Send signaling matters only when the prepared Send has page
mappings to unmap. Today that test is expressed indirectly with
rl_kref, because the Send-side reference is taken only for Sends
with mapped SGEs.

Split the SGE DMA unmap loop into its own helper and use
sc_unmap_count directly for the signaling decision. This keeps the
current behavior but removes one dependency on the old rl_kref
semantics before the request lifetime rules are changed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/rpc_rdma.c

index 7f79a0a2601e65ca1b78f4e1bef621a80af106b9..e5c71cf705a33a74b9c4df8fbe1a7b1a59c53d77 100644 (file)
@@ -474,7 +474,7 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
                ++num_wrs;
        }
 
-       if ((kref_read(&req->rl_kref) > 1) || num_wrs > ep->re_send_count) {
+       if (req->rl_sendctx->sc_unmap_count || num_wrs > ep->re_send_count) {
                send_wr->send_flags |= IB_SEND_SIGNALED;
                ep->re_send_count = min_t(unsigned int, ep->re_send_batch,
                                          num_wrs - ep->re_send_count);
index 0e0f219747109ff0f358afa90b731823c76926f8..16b9987858d683089cf3e3e3660ac0efb60e4a7d 100644 (file)
@@ -477,19 +477,11 @@ static void rpcrdma_sendctx_done(struct kref *kref)
        rep->rr_rxprt->rx_stats.reply_waits_for_send++;
 }
 
-/**
- * rpcrdma_sendctx_unmap - DMA-unmap Send buffer
- * @sc: sendctx containing SGEs to unmap
- *
- */
-void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc)
+static void rpcrdma_sendctx_dma_unmap(struct rpcrdma_sendctx *sc)
 {
        struct rpcrdma_regbuf *rb = sc->sc_req->rl_sendbuf;
        struct ib_sge *sge;
 
-       if (!sc->sc_unmap_count)
-               return;
-
        /* The first two SGEs contain the transport header and
         * the inline buffer. These are always left mapped so
         * they can be cheaply re-used.
@@ -498,7 +490,19 @@ void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc)
             ++sge, --sc->sc_unmap_count)
                ib_dma_unmap_page(rdmab_device(rb), sge->addr, sge->length,
                                  DMA_TO_DEVICE);
+}
+
+/**
+ * rpcrdma_sendctx_unmap - DMA-unmap Send buffer
+ * @sc: sendctx containing SGEs to unmap
+ *
+ */
+void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc)
+{
+       if (!sc->sc_unmap_count)
+               return;
 
+       rpcrdma_sendctx_dma_unmap(sc);
        kref_put(&sc->sc_req->rl_kref, rpcrdma_sendctx_done);
 }