diff options
| author | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-03-25 00:44:21 +0000 |
|---|---|---|
| committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-03-25 00:44:21 +0000 |
| commit | 8a9cf808e68d5c397a4946b340dd22db33c968b1 (patch) | |
| tree | d9c6670400f80fe7f04c24108433cf982d7b148b /sys/dev/usb/if_rue.c | |
| parent | 70a18c225374811d464d42866ac14b791fd4ca49 (diff) | |
Notes
Diffstat (limited to 'sys/dev/usb/if_rue.c')
| -rw-r--r-- | sys/dev/usb/if_rue.c | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/sys/dev/usb/if_rue.c b/sys/dev/usb/if_rue.c index e4ffd81a686a5..a5adaf67d9a6f 100644 --- a/sys/dev/usb/if_rue.c +++ b/sys/dev/usb/if_rue.c @@ -134,7 +134,6 @@ Static int rue_detach(device_ptr_t); Static int rue_tx_list_init(struct rue_softc *); Static int rue_rx_list_init(struct rue_softc *); -Static int rue_newbuf(struct rue_softc *, struct rue_chain *, struct mbuf *); Static int rue_encap(struct rue_softc *, struct mbuf *, int); #ifdef RUE_INTR_PIPE Static void rue_intr(usbd_xfer_handle, usbd_private_handle, usbd_status); @@ -584,6 +583,7 @@ USB_ATTACH(rue) bzero(sc, sizeof (struct rue_softc)); usbd_devinfo(uaa->device, 0, devinfo); + sc->rue_dev = self; sc->rue_udev = uaa->device; sc->rue_unit = device_get_unit(self); @@ -738,43 +738,6 @@ rue_detach(device_ptr_t dev) return (0); } -/* - * Initialize an RX descriptor and attach an MBUF cluster. - */ - -Static int -rue_newbuf(struct rue_softc *sc, struct rue_chain *c, struct mbuf *m) -{ - struct mbuf *m_new = NULL; - - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("rue%d: no memory for rx list " - "-- packet dropped!\n", sc->rue_unit); - return (ENOBUFS); - } - - MCLGET(m_new, M_DONTWAIT); - if (!(m_new->m_flags & M_EXT)) { - printf("rue%d: no memory for rx list " - "-- packet dropped!\n", sc->rue_unit); - m_freem(m_new); - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - } else { - m_new = m; - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - m_new->m_data = m_new->m_ext.ext_buf; - } - - m_adj(m_new, ETHER_ALIGN); - c->rue_mbuf = m_new; - - return (0); -} - Static int rue_rx_list_init(struct rue_softc *sc) { @@ -787,7 +750,8 @@ rue_rx_list_init(struct rue_softc *sc) c = &cd->rue_rx_chain[i]; c->rue_sc = sc; c->rue_idx = i; - if (rue_newbuf(sc, c, NULL) == ENOBUFS) + c->rue_mbuf = usb_ether_newbuf(USBDEVNAME(sc->rue_dev)); + if (c->rue_mbuf == NULL) return (ENOBUFS); if (c->rue_xfer == NULL) { c->rue_xfer = usbd_alloc_xfer(sc->rue_udev); @@ -874,7 +838,8 @@ rue_rxstart(struct ifnet *ifp) RUE_LOCK(sc); c = &sc->rue_cdata.rue_rx_chain[sc->rue_cdata.rue_rx_prod]; - if (rue_newbuf(sc, c, NULL) == ENOBUFS) { + c->rue_mbuf = usb_ether_newbuf(USBDEVNAME(sc->rue_dev)); + if (c->rue_mbuf == NULL) { ifp->if_ierrors++; RUE_UNLOCK(sc); return; |
