Module Name: src
Committed By: martin
Date: Wed Aug 5 14:59:42 UTC 2020
Modified Files:
src/sys/dev/pci [netbsd-9]: if_ena.c
Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1038):
sys/dev/pci/if_ena.c: revision 1.25
PR port-arm/55532: kernel panic with ena on AWS a1.2xlarge
Do not mark callout and workqueues as mpsafe unless the NET_MPSAFE option
is present.
To generate a diff of this commit:
cvs rdiff -u -r1.15.2.2 -r1.15.2.3 src/sys/dev/pci/if_ena.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_ena.c
diff -u src/sys/dev/pci/if_ena.c:1.15.2.2 src/sys/dev/pci/if_ena.c:1.15.2.3
--- src/sys/dev/pci/if_ena.c:1.15.2.2 Sun Mar 8 14:44:06 2020
+++ src/sys/dev/pci/if_ena.c Wed Aug 5 14:59:41 2020
@@ -27,11 +27,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+#ifdef _KERNEL_OPT
+#include "opt_net_mpsafe.h"
+#endif
+
#include <sys/cdefs.h>
#if 0
__FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $");
#endif
-__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.2 2020/03/08 14:44:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.3 2020/08/05 14:59:41 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,6 +61,14 @@ __KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1
#include <dev/pci/if_enavar.h>
+#ifdef NET_MPSAFE
+#define WQ_FLAGS WQ_MPSAFE
+#define CALLOUT_FLAGS CALLOUT_MPSAFE
+#else
+#define WQ_FLAGS 0
+#define CALLOUT_FLAGS 0
+#endif
+
/*********************************************************
* Function prototypes
*********************************************************/
@@ -682,7 +695,7 @@ ena_setup_tx_resources(struct ena_adapte
/* Allocate workqueues */
int rc = workqueue_create(&tx_ring->enqueue_tq, "ena_tx_enq",
- ena_deferred_mq_start, tx_ring, 0, IPL_NET, WQ_PERCPU | WQ_MPSAFE);
+ ena_deferred_mq_start, tx_ring, 0, IPL_NET, WQ_PERCPU | WQ_FLAGS);
if (unlikely(rc != 0)) {
ena_trace(ENA_ALERT,
"Unable to create workqueue for enqueue task\n");
@@ -889,7 +902,7 @@ ena_setup_rx_resources(struct ena_adapte
/* Allocate workqueues */
int rc = workqueue_create(&rx_ring->cmpl_tq, "ena_rx_comp",
- ena_deferred_rx_cleanup, rx_ring, 0, IPL_NET, WQ_PERCPU | WQ_MPSAFE);
+ ena_deferred_rx_cleanup, rx_ring, 0, IPL_NET, WQ_PERCPU | WQ_FLAGS);
if (unlikely(rc != 0)) {
ena_trace(ENA_ALERT,
"Unable to create workqueue for RX completion task\n");
@@ -3807,11 +3820,11 @@ ena_attach(device_t parent, device_t sel
goto err_ifp_free;
}
- callout_init(&adapter->timer_service, CALLOUT_MPSAFE);
+ callout_init(&adapter->timer_service, CALLOUT_FLAGS);
/* Initialize reset task queue */
rc = workqueue_create(&adapter->reset_tq, "ena_reset_enq",
- ena_reset_task, adapter, 0, IPL_NET, WQ_PERCPU | WQ_MPSAFE);
+ ena_reset_task, adapter, 0, IPL_NET, WQ_PERCPU | WQ_FLAGS);
if (unlikely(rc != 0)) {
ena_trace(ENA_ALERT,
"Unable to create workqueue for reset task\n");