Re: Intel 3945ABG

From: Doug Ambrisko <ambrisko_at_ambrisko.com>
Date: Tue, 3 Apr 2007 11:43:07 -0700 (PDT)
Sam Fourman Jr. writes:
| do you have a diff that fixes the leaks?

Note he is working on a new version that deals with the new firmware
that has a different API.

==== //depot/user/benjsc/wpi/sys/dev/wpi/if_wpi.c#16 - /data/home/ambrisko/p4/wpi/sys/dev/wpi/if_wpi.c ====
_at__at_ -107,7 +107,10 _at__at_
 #ifdef WPI_DEBUG
 #define DPRINTF(x)	do { if (wpi_debug != 0) printf x; } while (0)
 #define DPRINTFN(n, x)	do { if (wpi_debug & n) printf x; } while (0)
+/*
 int wpi_debug = 0xfffffffe;
+*/
+int wpi_debug = 0;
 SYSCTL_INT(_debug, OID_AUTO, wpi, CTLFLAG_RW, &wpi_debug, 0, "wpi debug level");
 
 enum {
_at__at_ -589,14 +592,14 _at__at_
 
 	    free( sc->sc_boot, M_DEVBUF );
 
-	    for (ac = 0; ac < 4; ac++)
-	      wpi_free_tx_ring(sc, &sc->txq[ac]);
-	    wpi_free_tx_ring(sc, &sc->cmdq);
-	    wpi_free_tx_ring(sc, &sc->svcq);
-	    wpi_free_rx_ring(sc, &sc->rxq);
-	    wpi_free_rpool(sc);
-	    wpi_free_shared(sc);
 	}
+	for (ac = 0; ac < 4; ac++)
+	    wpi_free_tx_ring(sc, &sc->txq[ac]);
+	wpi_free_tx_ring(sc, &sc->cmdq);
+	wpi_free_tx_ring(sc, &sc->svcq);
+	wpi_free_rx_ring(sc, &sc->rxq);
+	wpi_free_rpool(sc);
+	wpi_free_shared(sc);
 
 	bus_teardown_intr(dev, sc->irq, sc->sc_ih);
 	bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
_at__at_ -833,7 +836,11 _at__at_
 	for (i = 0; i < WPI_RX_RING_COUNT; i++) {
 		data = &ring->data[i];
 
+/*
 		data->m = m_getcl(M_DONTWAIT, MT_DATA, 0);
+*/
+		data->m = NULL;
+		MGETHDR(data->m, M_DONTWAIT, MT_DATA);
 		if (data->m == NULL) {
 			device_printf(sc->sc_dev,
 			    "could not allocate rx mbuf\n");
_at__at_ -850,8 +857,14 _at__at_
 		}
 
 		/* attach RxBuffer to mbuf */
+		data->m->m_data = rbuf->vaddr;
+		data->m->m_len = data->m->m_pkthdr.len = WPI_RBUF_SIZE;
+/*
 		MEXTADD(data->m, rbuf->vaddr, WPI_RBUF_SIZE,wpi_free_rbuf,
 			    rbuf,EXT_NET_DRV,EXT_EXTREF);
+*/
+		MEXTADD(data->m, rbuf->vaddr, WPI_RBUF_SIZE, wpi_free_rbuf,
+			    rbuf, 0, EXT_NET_DRV);
 		if ((data->m->m_flags & M_EXT) == 0) {
 		    m_freem(data->m);
 		    return (ENOBUFS);
_at__at_ -1489,7 +1502,7 _at__at_
 	struct wpi_rbuf *rbuf;
 	struct ieee80211_frame *wh;
 	struct ieee80211_node *ni;
-	struct mbuf *m, *mnew;
+	struct mbuf *m, *mnew = NULL;
 
 	DPRINTFN(WPI_DEBUG_FUNC,("wpi_rx_intr\n"));
 
_at__at_ -1519,7 +1532,10 _at__at_
 		return;
 	}
 #endif
+/*
 	mnew = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+*/
+	MGETHDR(mnew, M_DONTWAIT, MT_DATA);
 	if (mnew == NULL) {
 		ifp->if_ierrors++;
 		return;
_at__at_ -1532,7 +1548,13 _at__at_
 	}
 
 	/* attach Rx buffer to mbuf */
+/*
 	MEXTADD(mnew,rbuf->vaddr,WPI_RBUF_SIZE,wpi_free_rbuf,rbuf,EXT_NET_DRV,EXT_EXTREF);
+*/
+	mnew->m_data = rbuf->vaddr;
+	mnew->m_len = mnew->m_pkthdr.len = WPI_RBUF_SIZE;
+	MEXTADD(mnew, rbuf->vaddr, WPI_RBUF_SIZE, wpi_free_rbuf, rbuf,
+	    0, EXT_NET_DRV);
 
 	m = data->m;
 	data->m = mnew;
Received on Tue Apr 03 2007 - 16:43:08 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:07 UTC