summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2013-10-30 04:08:07 +0000
committerdlg <dlg@openbsd.org>2013-10-30 04:08:07 +0000
commit9c4680240094a07988debb873577df17a98bdabc (patch)
treef1c91a9c3ca1bf5d8f52f5a7ec17fd3b8de25607
parentremove #include <sys/workq.h> cos this driver doesnt use it. (diff)
downloadwireguard-openbsd-9c4680240094a07988debb873577df17a98bdabc.tar.xz
wireguard-openbsd-9c4680240094a07988debb873577df17a98bdabc.zip
replace the workq bits to supply new tx pkt descriptors with a task.
tested locally on a dell poweredge 2950
-rw-r--r--sys/dev/pci/if_bnx.c19
-rw-r--r--sys/dev/pci/if_bnxreg.h6
2 files changed, 11 insertions, 14 deletions
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index 47f47076bcb..dffee8cbd0e 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnx.c,v 1.102 2013/10/23 20:22:12 brad Exp $ */
+/* $OpenBSD: if_bnx.c,v 1.103 2013/10/30 04:08:07 dlg Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -2596,6 +2596,7 @@ bnx_dma_alloc(struct bnx_softc *sc)
TAILQ_INIT(&sc->tx_used_pkts);
sc->tx_pkt_count = 0;
mtx_init(&sc->tx_pkt_mtx, IPL_NET);
+ task_set(&sc->tx_alloc_task, bnx_alloc_pkts, sc, NULL);
/*
* Allocate DMA memory for the Rx buffer descriptor chain,
@@ -3768,10 +3769,6 @@ bnx_alloc_pkts(void *xsc, void *arg)
mtx_leave(&sc->tx_pkt_mtx);
}
- mtx_enter(&sc->tx_pkt_mtx);
- CLR(sc->bnx_flags, BNX_ALLOC_PKTS_FLAG);
- mtx_leave(&sc->tx_pkt_mtx);
-
s = splnet();
if (!IFQ_IS_EMPTY(&ifp->if_snd))
bnx_start(ifp);
@@ -4865,17 +4862,17 @@ bnx_tx_encap(struct bnx_softc *sc, struct mbuf *m)
u_int16_t debug_prod;
#endif
u_int32_t addr, prod_bseq;
- int i, error;
+ int i, error, add;
mtx_enter(&sc->tx_pkt_mtx);
pkt = TAILQ_FIRST(&sc->tx_free_pkts);
if (pkt == NULL) {
- if (sc->tx_pkt_count <= TOTAL_TX_BD &&
- !ISSET(sc->bnx_flags, BNX_ALLOC_PKTS_FLAG) &&
- workq_add_task(NULL, 0, bnx_alloc_pkts, sc, NULL) == 0)
- SET(sc->bnx_flags, BNX_ALLOC_PKTS_FLAG);
-
+ add = (sc->tx_pkt_count <= TOTAL_TX_BD);
mtx_leave(&sc->tx_pkt_mtx);
+
+ if (add)
+ task_add(systq, &sc->tx_alloc_task);
+
return (ENOMEM);
}
TAILQ_REMOVE(&sc->tx_free_pkts, pkt, pkt_entry);
diff --git a/sys/dev/pci/if_bnxreg.h b/sys/dev/pci/if_bnxreg.h
index 11a6ab1a355..728250ebe61 100644
--- a/sys/dev/pci/if_bnxreg.h
+++ b/sys/dev/pci/if_bnxreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnxreg.h,v 1.41 2013/08/07 01:06:33 bluhm Exp $ */
+/* $OpenBSD: if_bnxreg.h,v 1.42 2013/10/30 04:08:07 dlg Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -49,7 +49,7 @@
#include <sys/timeout.h>
#include <sys/pool.h>
#include <sys/rwlock.h>
-#include <sys/workq.h>
+#include <sys/task.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -4787,7 +4787,6 @@ struct bnx_softc {
#define BNX_USING_MSI_FLAG 0x20
#define BNX_MFW_ENABLE_FLAG 0x40
#define BNX_ACTIVE_FLAG 0x80
-#define BNX_ALLOC_PKTS_FLAG 0x100
/* PHY specific flags. */
u_int32_t bnx_phy_flags;
@@ -4930,6 +4929,7 @@ struct bnx_softc {
u_int tx_pkt_count;
struct bnx_pkt_list tx_free_pkts;
struct bnx_pkt_list tx_used_pkts;
+ struct task tx_alloc_task;
/* S/W maintained mbuf RX chain structure. */
bus_dmamap_t rx_mbuf_map[TOTAL_RX_BD];