Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev discussed with thorpej@, and it seems it's better to...
details: https://anonhg.NetBSD.org/src/rev/a4024ff35a9f
branches: trunk
changeset: 933758:a4024ff35a9f
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sat May 30 15:55:47 2020 +0000
description:
discussed with thorpej@, and it seems it's better to allocate the bss
alignment buffer statically (as part of softc) just to be sure to not
affect performance
diffstat:
sys/dev/ic/bwfm.c | 18 ++++++------------
sys/dev/ic/bwfmvar.h | 7 ++++++-
sys/dev/pci/if_bwfm_pci.c | 4 ++--
sys/dev/sdmmc/if_bwfm_sdio.c | 4 ++--
4 files changed, 16 insertions(+), 17 deletions(-)
diffs (101 lines):
diff -r 8ae67f2203ad -r a4024ff35a9f sys/dev/ic/bwfm.c
--- a/sys/dev/ic/bwfm.c Sat May 30 14:16:56 2020 +0000
+++ b/sys/dev/ic/bwfm.c Sat May 30 15:55:47 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.24 2020/05/30 14:03:08 jdolecek Exp $ */
+/* $NetBSD: bwfm.c,v 1.25 2020/05/30 15:55:47 jdolecek Exp $ */
/* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -38,8 +38,8 @@
#include <net80211/ieee80211_var.h>
+#include <dev/ic/bwfmreg.h>
#include <dev/ic/bwfmvar.h>
-#include <dev/ic/bwfmreg.h>
/* #define BWFM_DEBUG */
#ifdef BWFM_DEBUG
@@ -2140,18 +2140,12 @@
bss = &res->bss_info[0];
for (i = 0; i < le16toh(res->bss_count); i++) {
/* Fix alignment of bss_info */
- union {
- struct bwfm_bss_info bss_info;
- uint8_t padding[BWFM_BSS_INFO_BUFLEN];
- } *bss_buf;
- if (len > sizeof(*bss_buf)) {
+ if (len > sizeof(sc->sc_bss_buf)) {
printf("%s: bss_info buffer too big\n", DEVNAME(sc));
} else {
- bss_buf = kmem_alloc(sizeof(*bss_buf),
- KM_SLEEP);
- memcpy(bss_buf, &res->bss_info[i], len);
- bwfm_scan_node(sc, &bss_buf->bss_info, len);
- kmem_free(bss_buf, sizeof(*bss_buf));
+ memcpy(&sc->sc_bss_buf, &res->bss_info[i], len);
+ bwfm_scan_node(sc, &sc->sc_bss_buf.bss_info,
+ len);
}
len -= sizeof(*bss) + le32toh(bss->length);
bss = (void *)(((uintptr_t)bss) + le32toh(bss->length));
diff -r 8ae67f2203ad -r a4024ff35a9f sys/dev/ic/bwfmvar.h
--- a/sys/dev/ic/bwfmvar.h Sat May 30 14:16:56 2020 +0000
+++ b/sys/dev/ic/bwfmvar.h Sat May 30 15:55:47 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfmvar.h,v 1.9 2020/05/30 13:41:58 jdolecek Exp $ */
+/* $NetBSD: bwfmvar.h,v 1.10 2020/05/30 15:55:47 jdolecek Exp $ */
/* $OpenBSD: bwfmvar.h,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -214,6 +214,11 @@
enum ieee80211_state, int);
int sc_bcdc_reqid;
+
+ union {
+ struct bwfm_bss_info bss_info;
+ uint8_t padding[BWFM_BSS_INFO_BUFLEN];
+ } sc_bss_buf;
};
void bwfm_attach(struct bwfm_softc *);
diff -r 8ae67f2203ad -r a4024ff35a9f sys/dev/pci/if_bwfm_pci.c
--- a/sys/dev/pci/if_bwfm_pci.c Sat May 30 14:16:56 2020 +0000
+++ b/sys/dev/pci/if_bwfm_pci.c Sat May 30 15:55:47 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_pci.c,v 1.8 2020/05/30 13:41:58 jdolecek Exp $ */
+/* $NetBSD: if_bwfm_pci.c,v 1.9 2020/05/30 15:55:47 jdolecek Exp $ */
/* $OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -41,8 +41,8 @@
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
+#include <dev/ic/bwfmreg.h>
#include <dev/ic/bwfmvar.h>
-#include <dev/ic/bwfmreg.h>
#include <dev/pci/if_bwfm_pci.h>
#define BWFM_DMA_D2H_SCRATCH_BUF_LEN 8
diff -r 8ae67f2203ad -r a4024ff35a9f sys/dev/sdmmc/if_bwfm_sdio.c
--- a/sys/dev/sdmmc/if_bwfm_sdio.c Sat May 30 14:16:56 2020 +0000
+++ b/sys/dev/sdmmc/if_bwfm_sdio.c Sat May 30 15:55:47 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.17 2020/05/30 13:41:58 jdolecek Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.18 2020/05/30 15:55:47 jdolecek Exp $ */
/* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -44,8 +44,8 @@
#include <dev/sdmmc/sdmmcdevs.h>
#include <dev/sdmmc/sdmmcvar.h>
+#include <dev/ic/bwfmreg.h>
#include <dev/ic/bwfmvar.h>
-#include <dev/ic/bwfmreg.h>
#include <dev/sdmmc/if_bwfm_sdio.h>
#ifdef BWFM_DEBUG
Home |
Main Index |
Thread Index |
Old Index