Date: Fri, 4 Jan 2008 21:05:50 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 132514 for review Message-ID: <200801042105.m04L5oZo062822@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132514 Change 132514 by hselasky@hselasky_laptop001 on 2008/01/04 21:05:10 Some fixes for CDC ethernet: o I should have used "m_defrag" instead of "m_pullup". Else nothings works properly :-( This introduce some copying of data, but that is not a problem right now. It is currently impossible that USB can support mbuf fragments like ethernet drivers do, but I could send these fragments accross like short terminated USB packets. That will not be backwards compatible, though I will save copying of data and will be useful in general. o Make sure the Device gets a different MAC address than the Host. o if_cdce has been tested and verified to work properly. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/if_cdce.c#44 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/if_cdce.c#44 (text+ko) ==== @@ -433,6 +433,13 @@ } eaddr[i / 2] |= c; } + + if (uaa->usb_mode == USB_MODE_DEVICE) { + /* + * Do not use the same MAC address like the peer ! + */ + eaddr[5] ^= 0xFF; + } } ifp = if_alloc(IFT_ETHER); @@ -580,6 +587,7 @@ struct cdce_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; struct mbuf *m; + struct mbuf *mt; uint32_t crc; uint32_t x; @@ -648,14 +656,18 @@ } m->m_pkthdr.len += 4; } + if (m->m_len != m->m_pkthdr.len) { + mt = m_defrag(m, M_DONTWAIT); + if (mt == NULL) { + m_freem(m); + ifp->if_oerrors++; + continue; + } + m = mt; + } if (m->m_pkthdr.len > MCLBYTES) { m->m_pkthdr.len = MCLBYTES; } - m = m_pullup(m, m->m_pkthdr.len); - if (m == NULL) { - ifp->if_oerrors++; - continue; - } sc->sc_tx_mbufs[x] = m; xfer->frlengths[x] = m->m_len; @@ -695,7 +707,6 @@ goto done; } #endif - usbd_start_hardware(xfer); done:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801042105.m04L5oZo062822>