The branch stable/14 has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1e87d76855adf09da89700cb33f27acde6839741

commit 1e87d76855adf09da89700cb33f27acde6839741
Author:     John Baldwin <j...@freebsd.org>
AuthorDate: 2024-12-11 02:13:51 +0000
Commit:     John Baldwin <j...@freebsd.org>
CommitDate: 2024-12-27 15:52:55 +0000

    cxgbe tom: Restore support for zerocopy TCP receive for aio_read()
    
    The commit to introduce TCP_USE_DDP support had a couple of bugs that
    broke support for zerocopy receive via aio_read().  First, the length
    and offset arguments to mk_update_tcb_for_ddp() were reversed which
    prevented DDP from working.  Second, the AIO state in the toep was
    initialized too late when the first aio_read() request was queued.
    
    Reported by:    Harshavardhan Tanneru @ Chelsio
    Fixes:          eba13bbc37ab cxgbe: Support TCP_USE_DDP on offloaded TOE 
connections
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 70693a45381b687e40ea30710aa38cb9f24b6b02)
---
 sys/dev/cxgbe/tom/t4_ddp.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c
index a08ddea00d05..7f0e9c46d2bf 100644
--- a/sys/dev/cxgbe/tom/t4_ddp.c
+++ b/sys/dev/cxgbe/tom/t4_ddp.c
@@ -2653,8 +2653,8 @@ sbcopy:
         * which will keep it open and keep the TCP PCB attached until
         * after the job is completed.
         */
-       wr = mk_update_tcb_for_ddp(sc, toep, db_idx, &ps->prsv, ps->len,
-           job->aio_received, ddp_flags, ddp_flags_mask);
+       wr = mk_update_tcb_for_ddp(sc, toep, db_idx, &ps->prsv,
+           job->aio_received, ps->len, ddp_flags, ddp_flags_mask);
        if (wr == NULL) {
                recycle_pageset(toep, ps);
                aio_ddp_requeue_one(toep, job);
@@ -2820,6 +2820,14 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job)
                return (EOPNOTSUPP);
        }
 
+       if ((toep->ddp.flags & DDP_AIO) == 0) {
+               toep->ddp.flags |= DDP_AIO;
+               TAILQ_INIT(&toep->ddp.cached_pagesets);
+               TAILQ_INIT(&toep->ddp.aiojobq);
+               TASK_INIT(&toep->ddp.requeue_task, 0, aio_ddp_requeue_task,
+                   toep);
+       }
+
        /*
         * XXX: Think about possibly returning errors for ENOTCONN,
         * etc.  Perhaps the caller would only queue the request
@@ -2834,14 +2842,6 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job)
        TAILQ_INSERT_TAIL(&toep->ddp.aiojobq, job, list);
        toep->ddp.waiting_count++;
 
-       if ((toep->ddp.flags & DDP_AIO) == 0) {
-               toep->ddp.flags |= DDP_AIO;
-               TAILQ_INIT(&toep->ddp.cached_pagesets);
-               TAILQ_INIT(&toep->ddp.aiojobq);
-               TASK_INIT(&toep->ddp.requeue_task, 0, aio_ddp_requeue_task,
-                   toep);
-       }
-
        /*
         * Try to handle this request synchronously.  If this has
         * to block because the task is running, it will just bail

Reply via email to