Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci ubsec(4): Tidy up error branches of ubsec_process.
details: https://anonhg.NetBSD.org/src/rev/ee3b86036e00
branches: trunk
changeset: 366323:ee3b86036e00
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun May 22 11:35:13 2022 +0000
description:
ubsec(4): Tidy up error branches of ubsec_process.
Make sure to return zero, not error, when we've already done
crypto_done and set crp_etype.
diffstat:
sys/dev/pci/ubsec.c | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
diffs (71 lines):
diff -r 9b5c1a167bfb -r ee3b86036e00 sys/dev/pci/ubsec.c
--- a/sys/dev/pci/ubsec.c Sun May 22 11:35:05 2022 +0000
+++ b/sys/dev/pci/ubsec.c Sun May 22 11:35:13 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ubsec.c,v 1.56 2022/05/22 11:35:05 riastradh Exp $ */
+/* $NetBSD: ubsec.c,v 1.57 2022/05/22 11:35:13 riastradh Exp $ */
/* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
/* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.56 2022/05/22 11:35:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.57 2022/05/22 11:35:13 riastradh Exp $");
#undef UBSEC_DEBUG
@@ -1163,14 +1163,12 @@
crp->crp_sid, sc->sc_nsessions);
mutex_spin_enter(&sc->sc_mtx);
-
if (SIMPLEQ_EMPTY(&sc->sc_freequeue)) {
ubsecstats.hst_queuefull++;
- sc->sc_needwakeup |= CRYPTO_SYMQ;
mutex_spin_exit(&sc->sc_mtx);
- return(ERESTART);
+ err = ERESTART;
+ goto errout;
}
-
q = SIMPLEQ_FIRST(&sc->sc_freequeue);
SIMPLEQ_REMOVE_HEAD(&sc->sc_freequeue, /*q,*/ q_next);
mutex_spin_exit(&sc->sc_mtx);
@@ -1760,7 +1758,7 @@
if ((hint & CRYPTO_HINT_MORE) == 0 || sc->sc_nqueue >= ubsec_maxbatch)
ubsec_feed(sc);
mutex_spin_exit(&sc->sc_mtx);
- return (0);
+ return 0;
errout:
if (q != NULL) {
@@ -1778,19 +1776,15 @@
SIMPLEQ_INSERT_TAIL(&sc->sc_freequeue, q, q_next);
mutex_spin_exit(&sc->sc_mtx);
}
-#if 0 /* jonathan says: this openbsd code seems to be subsumed elsewhere */
- if (err == EINVAL)
- ubsecstats.hst_invalid++;
- else
- ubsecstats.hst_nomem++;
-#endif
- if (err != ERESTART) {
- crp->crp_etype = err;
- crypto_done(crp);
- } else {
+ if (err == ERESTART) {
+ mutex_spin_enter(&sc->sc_mtx);
sc->sc_needwakeup |= CRYPTO_SYMQ;
+ mutex_spin_exit(&sc->sc_mtx);
+ return ERESTART;
}
- return (err);
+ crp->crp_etype = err;
+ crypto_done(crp);
+ return 0;
}
static void
Home |
Main Index |
Thread Index |
Old Index