From owner-p4-projects@FreeBSD.ORG Fri Jan 4 21:05:51 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1132A16A420; Fri, 4 Jan 2008 21:05:51 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA40516A419 for ; Fri, 4 Jan 2008 21:05:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B896113C478 for ; Fri, 4 Jan 2008 21:05:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m04L5oG4062825 for ; Fri, 4 Jan 2008 21:05:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m04L5oZo062822 for perforce@freebsd.org; Fri, 4 Jan 2008 21:05:50 GMT (envelope-from hselasky@FreeBSD.org) Date: Fri, 4 Jan 2008 21:05:50 GMT Message-Id: <200801042105.m04L5oZo062822@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 132514 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 21:05:51 -0000 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: