Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net80211 Use kmem_* instead of malloc/free and use inter...



details:   https://anonhg.NetBSD.org/src/rev/37f646961ce3
branches:  trunk
changeset: 945660:37f646961ce3
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Nov 03 15:06:50 2020 +0000

description:
Use kmem_* instead of malloc/free and use interrupt versions as the
code can be called from interrupt.

diffstat:

 sys/net80211/ieee80211_crypto_ccmp.c |   8 ++++----
 sys/net80211/ieee80211_crypto_tkip.c |  10 +++++-----
 sys/net80211/ieee80211_crypto_wep.c  |  10 +++++-----
 3 files changed, 14 insertions(+), 14 deletions(-)

diffs (126 lines):

diff -r 65ba96d358d5 -r 37f646961ce3 sys/net80211/ieee80211_crypto_ccmp.c
--- a/sys/net80211/ieee80211_crypto_ccmp.c      Tue Nov 03 12:04:56 2020 +0000
+++ b/sys/net80211/ieee80211_crypto_ccmp.c      Tue Nov 03 15:06:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee80211_crypto_ccmp.c,v 1.18 2020/07/28 15:41:26 riastradh Exp $     */
+/*     $NetBSD: ieee80211_crypto_ccmp.c,v 1.19 2020/11/03 15:06:50 mlelstv Exp $       */
 
 /*
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_ccmp.c,v 1.7 2005/07/11 03:06:23 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_ccmp.c,v 1.18 2020/07/28 15:41:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_ccmp.c,v 1.19 2020/11/03 15:06:50 mlelstv Exp $");
 #endif
 
 /*
@@ -106,7 +106,7 @@
 {
        struct ccmp_ctx *ctx;
 
-       ctx = kmem_zalloc(sizeof(*ctx), KM_NOSLEEP);
+       ctx = kmem_intr_zalloc(sizeof(*ctx), KM_NOSLEEP);
        if (ctx == NULL) {
                ic->ic_stats.is_crypto_nomem++;
                return NULL;
@@ -120,7 +120,7 @@
 {
        struct ccmp_ctx *ctx = k->wk_private;
 
-       kmem_free(ctx, sizeof(*ctx));
+       kmem_intr_free(ctx, sizeof(*ctx));
 }
 
 static int
diff -r 65ba96d358d5 -r 37f646961ce3 sys/net80211/ieee80211_crypto_tkip.c
--- a/sys/net80211/ieee80211_crypto_tkip.c      Tue Nov 03 12:04:56 2020 +0000
+++ b/sys/net80211/ieee80211_crypto_tkip.c      Tue Nov 03 15:06:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee80211_crypto_tkip.c,v 1.16 2019/12/19 16:29:50 kamil Exp $ */
+/*     $NetBSD: ieee80211_crypto_tkip.c,v 1.17 2020/11/03 15:06:50 mlelstv Exp $       */
 
 /*
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_tkip.c,v 1.10 2005/08/08 18:46:35 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_tkip.c,v 1.16 2019/12/19 16:29:50 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_tkip.c,v 1.17 2020/11/03 15:06:50 mlelstv Exp $");
 #endif
 
 /*
@@ -49,7 +49,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/kernel.h>
 #include <sys/endian.h>
 
@@ -118,7 +118,7 @@
 {
        struct tkip_ctx *ctx;
 
-       ctx = malloc(sizeof(struct tkip_ctx), M_DEVBUF, M_NOWAIT | M_ZERO);
+       ctx = kmem_intr_zalloc(sizeof(struct tkip_ctx), KM_NOSLEEP);
        if (ctx == NULL) {
                ic->ic_stats.is_crypto_nomem++;
                return NULL;
@@ -133,7 +133,7 @@
 {
        struct tkip_ctx *ctx = k->wk_private;
 
-       free(ctx, M_DEVBUF);
+       kmem_intr_free(ctx, sizeof(struct tkip_ctx));
 }
 
 static int
diff -r 65ba96d358d5 -r 37f646961ce3 sys/net80211/ieee80211_crypto_wep.c
--- a/sys/net80211/ieee80211_crypto_wep.c       Tue Nov 03 12:04:56 2020 +0000
+++ b/sys/net80211/ieee80211_crypto_wep.c       Tue Nov 03 15:06:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee80211_crypto_wep.c,v 1.12 2018/05/03 17:14:37 maxv Exp $   */
+/*     $NetBSD: ieee80211_crypto_wep.c,v 1.13 2020/11/03 15:06:50 mlelstv Exp $        */
 
 /*
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_wep.c,v 1.7 2005/06/10 16:11:24 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_wep.c,v 1.12 2018/05/03 17:14:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_wep.c,v 1.13 2020/11/03 15:06:50 mlelstv Exp $");
 #endif
 
 /*
@@ -45,7 +45,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/kernel.h>
 #include <sys/endian.h>
 
@@ -95,7 +95,7 @@
 {
        struct wep_ctx *ctx;
 
-       ctx = malloc(sizeof(struct wep_ctx), M_DEVBUF, M_NOWAIT | M_ZERO);
+       ctx = kmem_intr_zalloc(sizeof(struct wep_ctx), KM_NOSLEEP);
        if (ctx == NULL) {
                ic->ic_stats.is_crypto_nomem++;
                return NULL;
@@ -111,7 +111,7 @@
 {
        struct wep_ctx *ctx = k->wk_private;
 
-       free(ctx, M_DEVBUF);
+       kmem_intr_free(ctx, sizeof(struct wep_ctx));
 }
 
 static int



Home | Main Index | Thread Index | Old Index