summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2015-12-18 19:08:36 +0000
committerkettenis <kettenis@openbsd.org>2015-12-18 19:08:36 +0000
commitd6e4804683552280d0a2907f8f9d2328bb78e1f2 (patch)
treef7bf57c527f966a21c02636fe66a1530e2185157
parentKNF: add a missing space after an 'if'. (diff)
downloadwireguard-openbsd-d6e4804683552280d0a2907f8f9d2328bb78e1f2.tar.xz
wireguard-openbsd-d6e4804683552280d0a2907f8f9d2328bb78e1f2.zip
Make ix(4) mpsafer. Take advantage of intr_barrier() to eliminate the mutex
introduced in the previous step, and use atomic instructions to make the tx completion path mpsafe as well. ok claudio@, mpi@
-rw-r--r--sys/dev/pci/if_ix.h10
-rw-r--r--sys/dev/pci/ixgbe.h3
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/dev/pci/if_ix.h b/sys/dev/pci/if_ix.h
index 59477252920..0c11746a80c 100644
--- a/sys/dev/pci/if_ix.h
+++ b/sys/dev/pci/if_ix.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ix.h,v 1.29 2015/09/11 13:02:28 stsp Exp $ */
+/* $OpenBSD: if_ix.h,v 1.30 2015/12/18 19:08:36 kettenis Exp $ */
/******************************************************************************
@@ -77,10 +77,9 @@
#define IXGBE_TX_TIMEOUT 5 /* set to 5 seconds */
/*
- * This parameters control when the driver calls the routine to reclaim
- * transmit descriptors.
+ * Thise parameter controls the minimum number of available transmit
+ * descriptors needed before we attempt transmission of a packet.
*/
-#define IXGBE_TX_CLEANUP_THRESHOLD (sc->num_tx_desc / 16)
#define IXGBE_TX_OP_THRESHOLD (sc->num_tx_desc / 32)
#define IXGBE_MAX_FRAME_SIZE 9216
@@ -170,7 +169,7 @@ struct tx_ring {
union ixgbe_adv_tx_desc *tx_base;
struct ixgbe_tx_buf *tx_buffers;
struct ixgbe_dma_alloc txdma;
- volatile uint16_t tx_avail;
+ volatile uint32_t tx_avail;
uint32_t next_avail_desc;
uint32_t next_to_clean;
enum {
@@ -277,7 +276,6 @@ struct ix_softc {
* Receive rings:
* Allocated at run time, an array of rings.
*/
- struct mutex rx_mtx;
struct rx_ring *rx_rings;
uint64_t que_mask;
int num_rx_desc;
diff --git a/sys/dev/pci/ixgbe.h b/sys/dev/pci/ixgbe.h
index 5beeb8f7234..1ab95cbbf7e 100644
--- a/sys/dev/pci/ixgbe.h
+++ b/sys/dev/pci/ixgbe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ixgbe.h,v 1.20 2015/11/24 17:11:40 mpi Exp $ */
+/* $OpenBSD: ixgbe.h,v 1.21 2015/12/18 19:08:36 kettenis Exp $ */
/******************************************************************************
@@ -52,6 +52,7 @@
#include <sys/timeout.h>
#include <sys/pool.h>
#include <sys/rwlock.h>
+#include <sys/atomic.h>
#include <net/if.h>
#include <net/bpf.h>