Prefer m_getcl() to EPIC_MGETCLUSTER() which uses MGETHDR()+MCLGET()
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 20 Nov 2005 13:08:35 +0000 (13:08 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 20 Nov 2005 13:08:35 +0000 (13:08 +0000)
sys/dev/netif/tx/if_tx.c
sys/dev/netif/tx/if_txvar.h

index f9c84fc..5ac1509 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/tx/if_tx.c,v 1.61.2.1 2002/10/29 01:43:49 semenu Exp $
- * $DragonFly: src/sys/dev/netif/tx/if_tx.c,v 1.30 2005/11/20 11:59:54 sephe Exp $
+ * $DragonFly: src/sys/dev/netif/tx/if_tx.c,v 1.31 2005/11/20 13:08:35 sephe Exp $
  */
 
 /*
@@ -517,7 +517,7 @@ epic_ifstart(struct ifnet *ifp)
                /* If packet was more than EPIC_MAX_FRAGS parts, */
                /* recopy packet to new allocated mbuf cluster */
                if (NULL != m) {
-                       EPIC_MGETCLUSTER(m);
+                       m = m_getcl(MB_DONTWAIT, MT_DATA, M_PKTHDR);
                        if (NULL == m) {
                                m_freem(m0);
                                ifp->if_oerrors++;
@@ -591,7 +591,7 @@ epic_rx_done(epic_softc_t *sc)
                m = buf->mbuf;
 
                /* Try to get mbuf cluster */
-               EPIC_MGETCLUSTER(buf->mbuf);
+               buf->mbuf = m_getcl(MB_DONTWAIT, MT_DATA, M_PKTHDR);
                if (NULL == buf->mbuf) {
                        buf->mbuf = m;
                        desc->status = 0x8000;
@@ -1444,7 +1444,7 @@ epic_init_rings(epic_softc_t *sc)
                        return EFAULT;
                }
 
-               EPIC_MGETCLUSTER(buf->mbuf);
+               buf->mbuf = m_getcl(MB_DONTWAIT, MT_DATA, M_PKTHDR);
                if (NULL == buf->mbuf) {
                        epic_free_rings(sc);
                        return ENOBUFS;
index eed964a..ccb47d7 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/tx/if_txvar.h,v 1.14.2.1 2002/10/29 01:43:50 semenu Exp $
- * $DragonFly: src/sys/dev/netif/tx/if_txvar.h,v 1.6 2005/11/20 11:59:54 sephe Exp $
+ * $DragonFly: src/sys/dev/netif/tx/if_txvar.h,v 1.7 2005/11/20 13:08:35 sephe Exp $
  */
 
 /*
@@ -120,16 +120,3 @@ struct epic_type {
        epic_read_phy_reg((sc), (phy), (reg))
 #define        PHY_WRITE_2(sc, phy, reg, val)                                  \
        epic_write_phy_reg((sc), (phy), (reg), (val))
-
-/* Macro to get either mbuf cluster or nothing */
-#define EPIC_MGETCLUSTER(m)                                            \
-       { MGETHDR((m),MB_DONTWAIT,MT_DATA);                             \
-         if (m) {                                                      \
-           MCLGET((m),MB_DONTWAIT);                                    \
-           if( 0 == ((m)->m_flags & M_EXT) ) {                         \
-             m_freem(m);                                               \
-             (m) = NULL;                                               \
-           }                                                           \
-         }                                                             \
-       }
-