On Sat, Jul 30, 2016 at 10:03:33PM +0200, Mark Kettenis wrote:
> Removes a couple of lines of code from the driver.
>
> ok?
This is the right use of m_devget. OK claudio@
PS: realized that the manpage for m_devget still has the old prototype
with the ifp in it...
--
:wq Claudio
>
> Index: if_smsc.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/if_smsc.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 if_smsc.c
> --- if_smsc.c 13 Apr 2016 11:03:37 -0000 1.27
> +++ if_smsc.c 30 Jul 2016 20:01:18 -0000
> @@ -146,7 +146,6 @@ void smsc_init(void *);
> void smsc_stop(struct smsc_softc *);
> void smsc_start(struct ifnet *);
> void smsc_reset(struct smsc_softc *);
> -struct mbuf *smsc_newbuf(void);
>
> void smsc_tick(void *);
> void smsc_tick_task(void *);
> @@ -1197,18 +1196,13 @@ smsc_rxeof(struct usbd_xfer *xfer, void
> else
> total_len -= pktlen;
>
> - m = smsc_newbuf();
> + m = m_devget(buf, pktlen, ETHER_ALIGN);
> if (m == NULL) {
> - smsc_dbg_printf(sc, "smc_newbuf returned NULL\n");
> + smsc_dbg_printf(sc, "m_devget returned NULL\n");
> ifp->if_ierrors++;
> goto done;
> }
>
> - m->m_pkthdr.len = m->m_len = pktlen;
> - m_adj(m, ETHER_ALIGN);
> -
> - memcpy(mtod(m, char *), buf, pktlen);
> -
> ml_enqueue(&ml, m);
> } while (total_len > 0);
>
> @@ -1328,24 +1322,6 @@ smsc_rx_list_init(struct smsc_softc *sc)
> }
>
> return (0);
> -}
> -
> -struct mbuf *
> -smsc_newbuf(void)
> -{
> - struct mbuf *m;
> -
> - MGETHDR(m, M_DONTWAIT, MT_DATA);
> - if (m == NULL)
> - return (NULL);
> -
> - MCLGET(m, M_DONTWAIT);
> - if (!(m->m_flags & M_EXT)) {
> - m_freem(m);
> - return (NULL);
> - }
> -
> - return (m);
> }
>
> int
>