Date: Mon, 18 Jan 2021 22:08:14 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: b7e27af36b7d - main - safexcel: Handle command/result descriptor exhaustion gracefully Message-ID: <202101182208.10IM8Ei2039226@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b7e27af36b7df05f4b6cdc706750413f3a048640 commit b7e27af36b7df05f4b6cdc706750413f3a048640 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-01-18 22:07:56 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-01-18 22:07:56 +0000 safexcel: Handle command/result descriptor exhaustion gracefully Rather than returning a hard error in this case, return ERESTART so that upper layers get a chance to retry the request (or drop it, depending on the desired policy). This case is hard to hit due to the somewhat low bound on queued requests, but that will no longer be true after an upcoming change. MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/safexcel/safexcel.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index c30b8178efb1..2f0f10f1d5e8 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -2093,7 +2093,7 @@ safexcel_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, if (cdesc == NULL) { safexcel_cmd_descr_rollback(ring, i); counter_u64_add(req->sc->sc_cdesc_alloc_failures, 1); - req->error = EAGAIN; + req->error = ERESTART; return; } if (i == 0) @@ -2121,7 +2121,7 @@ safexcel_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, ring->cmd_data->sg_nseg); safexcel_res_descr_rollback(ring, i); counter_u64_add(req->sc->sc_rdesc_alloc_failures, 1); - req->error = EAGAIN; + req->error = ERESTART; return; } } @@ -2608,10 +2608,16 @@ safexcel_process(device_t dev, struct cryptop *crp, int hint) error = safexcel_create_chain(ring, req); if (__predict_false(error != 0)) { safexcel_free_request(ring, req); + if (error == ERESTART) + ring->blocked = CRYPTO_SYMQ; mtx_unlock(&ring->mtx); - crp->crp_etype = error; - crypto_done(crp); - return (0); + if (error != ERESTART) { + crp->crp_etype = error; + crypto_done(crp); + return (0); + } else { + return (ERESTART); + } } safexcel_set_token(req);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101182208.10IM8Ei2039226>