Skip to content

Commit

Permalink
cxgbe tom: Restore support for zerocopy TCP receive for aio_read()
Browse files Browse the repository at this point in the history
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:		eba13bb cxgbe: Support TCP_USE_DDP on offloaded TOE connections
MFC after:	1 week
Sponsored by:	Chelsio Communications
  • Loading branch information
bsdjhb committed Dec 11, 2024
1 parent 36a80f4 commit 70693a4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions sys/dev/cxgbe/tom/t4_ddp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2653,8 +2653,8 @@ aio_ddp_requeue(struct toepcb *toep)
* 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);
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 70693a4

Please sign in to comment.