NetBSD-Bugs archive

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

Re: port-amd64/53155: OS wedges after <12h uptime when >2 bnx network interfaces in use



On May 17,  2:30pm, he%NetBSD.org@localhost (Havard Eidnes) wrote:
-- Subject: Re: port-amd64/53155: OS wedges after <12h uptime when >2 bnx net

| The following reply was made to PR port-amd64/53155; it has been noted by GNATS.
| 
| From: Havard Eidnes <he%NetBSD.org@localhost>
| To: gnats-bugs%NetBSD.org@localhost, hannken%eis.cs.tu-bs.de@localhost
| Cc: port-amd64-maintainer%netbsd.org@localhost
| Subject: Re: port-amd64/53155: OS wedges after <12h uptime when >2 bnx
|  network interfaces in use
| Date: Thu, 17 May 2018 16:28:56 +0200 (CEST)

Try this?

christos

Index: if_bnx.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_bnx.c,v
retrieving revision 1.64
diff -u -u -r1.64 if_bnx.c
--- if_bnx.c	8 May 2018 04:11:09 -0000	1.64
+++ if_bnx.c	17 May 2018 18:28:21 -0000
@@ -3942,6 +3942,7 @@
 	struct ifnet *ifp = &sc->bnx_ec.ec_if;
 	struct bnx_pkt *pkt;
 	int i, s;
+	bool got = false;
 
 	for (i = 0; i < 4; i++) { /* magic! */
 		pkt = pool_get(bnx_tx_pool, PR_WAITOK);
@@ -3961,17 +3962,20 @@
 		TAILQ_INSERT_TAIL(&sc->tx_free_pkts, pkt, pkt_entry);
 		sc->tx_pkt_count++;
 		mutex_exit(&sc->tx_pkt_mtx);
+		got = true;
 	}
 
 	mutex_enter(&sc->tx_pkt_mtx);
 	CLR(sc->bnx_flags, BNX_ALLOC_PKTS_FLAG);
 	mutex_exit(&sc->tx_pkt_mtx);
 
-	/* fire-up TX now that allocations have been done */
-	s = splnet();
-	if (!IFQ_IS_EMPTY(&ifp->if_snd))
-		bnx_start(ifp);
-	splx(s);
+	if (got) {
+		/* fire-up TX now that allocations have been done */
+		s = splnet();
+		if (!IFQ_IS_EMPTY(&ifp->if_snd))
+			bnx_start(ifp);
+		splx(s);
+	}
 
 	return;
 
@@ -3979,6 +3983,10 @@
 	bus_dmamap_destroy(sc->bnx_dmatag, pkt->pkt_dmamap);
 put:
 	pool_put(bnx_tx_pool, pkt);
+	mutex_enter(&sc->tx_pkt_mtx);
+	CLR(sc->bnx_flags, BNX_ALLOC_PKTS_FLAG);
+	mutex_exit(&sc->tx_pkt_mtx);
+
 	return;
 }
 
@@ -4949,8 +4957,8 @@
 
 		if (sc->tx_pkt_count <= TOTAL_TX_BD &&
 		    !ISSET(sc->bnx_flags, BNX_ALLOC_PKTS_FLAG)) {
-			workqueue_enqueue(sc->bnx_wq, &bnx_wk, NULL);
 			SET(sc->bnx_flags, BNX_ALLOC_PKTS_FLAG);
+			workqueue_enqueue(sc->bnx_wq, &bnx_wk, NULL);
 		}
 
 		mutex_exit(&sc->tx_pkt_mtx);


Home | Main Index | Thread Index | Old Index