Deleted Added
full compact
if_usie.c (239299) if_usie.c (243857)
1/*-
2 * Copyright (c) 2011 Anybots Inc
3 * written by Akinori Furukoshi <moonlightakkiy@yahoo.ca>
4 * - ucom part is based on u3g.c
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2011 Anybots Inc
3 * written by Akinori Furukoshi <moonlightakkiy@yahoo.ca>
4 * - ucom part is based on u3g.c
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/usb/net/if_usie.c 239299 2012-08-15 15:42:57Z hselasky $");
29__FBSDID("$FreeBSD: head/sys/dev/usb/net/if_usie.c 243857 2012-12-04 09:32:43Z glebius $");
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/queue.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/bus.h>
37#include <sys/module.h>

--- 753 unchanged lines hidden (view full) ---

791 m = sc->sc_rxm;
792 sc->sc_rxm = NULL;
793
794 /* fall though */
795 case USB_ST_SETUP:
796tr_setup:
797
798 if (sc->sc_rxm == NULL) {
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/queue.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/bus.h>
37#include <sys/module.h>

--- 753 unchanged lines hidden (view full) ---

791 m = sc->sc_rxm;
792 sc->sc_rxm = NULL;
793
794 /* fall though */
795 case USB_ST_SETUP:
796tr_setup:
797
798 if (sc->sc_rxm == NULL) {
799 sc->sc_rxm = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR,
799 sc->sc_rxm = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR,
800 MJUMPAGESIZE /* could be bigger than MCLBYTES */ );
801 }
802 if (sc->sc_rxm == NULL) {
803 DPRINTF("could not allocate Rx mbuf\n");
804 ifp->if_ierrors++;
805 usbd_xfer_set_stall(xfer);
806 usbd_xfer_set_frames(xfer, 0);
807 } else {

--- 79 unchanged lines hidden (view full) ---

887 m->m_data += (sizeof(struct usie_desc) + pad);
888 m->m_pkthdr.len = m->m_len = ipl;
889 m->m_pkthdr.rcvif = ifp;
890 BPF_MTAP(sc->sc_ifp, m);
891 netisr_dispatch(ipv, m);
892 break;
893 }
894 /* copy aggregated frames to another mbuf */
800 MJUMPAGESIZE /* could be bigger than MCLBYTES */ );
801 }
802 if (sc->sc_rxm == NULL) {
803 DPRINTF("could not allocate Rx mbuf\n");
804 ifp->if_ierrors++;
805 usbd_xfer_set_stall(xfer);
806 usbd_xfer_set_frames(xfer, 0);
807 } else {

--- 79 unchanged lines hidden (view full) ---

887 m->m_data += (sizeof(struct usie_desc) + pad);
888 m->m_pkthdr.len = m->m_len = ipl;
889 m->m_pkthdr.rcvif = ifp;
890 BPF_MTAP(sc->sc_ifp, m);
891 netisr_dispatch(ipv, m);
892 break;
893 }
894 /* copy aggregated frames to another mbuf */
895 m0 = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
895 m0 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
896 if (__predict_false(m0 == NULL)) {
897 DPRINTF("could not allocate mbuf\n");
898 err++;
899 m_freem(m);
900 break;
901 }
902 m_copydata(m, sizeof(struct usie_desc) + pad, ipl, mtod(m0, caddr_t));
903 m0->m_pkthdr.rcvif = ifp;

--- 479 unchanged lines hidden (view full) ---

1383 struct mbuf *m;
1384 struct usb_xfer *xfer;
1385 struct usie_hip *hip;
1386 struct usie_cns *cns;
1387 uint8_t *param;
1388 uint8_t *tmp;
1389 uint8_t cns_len;
1390
896 if (__predict_false(m0 == NULL)) {
897 DPRINTF("could not allocate mbuf\n");
898 err++;
899 m_freem(m);
900 break;
901 }
902 m_copydata(m, sizeof(struct usie_desc) + pad, ipl, mtod(m0, caddr_t));
903 m0->m_pkthdr.rcvif = ifp;

--- 479 unchanged lines hidden (view full) ---

1383 struct mbuf *m;
1384 struct usb_xfer *xfer;
1385 struct usie_hip *hip;
1386 struct usie_cns *cns;
1387 uint8_t *param;
1388 uint8_t *tmp;
1389 uint8_t cns_len;
1390
1391 m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
1391 m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
1392 if (__predict_false(m == NULL)) {
1393 DPRINTF("could not allocate mbuf\n");
1394 ifp->if_ierrors++;
1395 return;
1396 }
1397 /* to align usie_hip{} on 32 bit */
1398 m->m_data += 3;
1399 param = mtod(m, uint8_t *);

--- 211 unchanged lines hidden ---
1392 if (__predict_false(m == NULL)) {
1393 DPRINTF("could not allocate mbuf\n");
1394 ifp->if_ierrors++;
1395 return;
1396 }
1397 /* to align usie_hip{} on 32 bit */
1398 m->m_data += 3;
1399 param = mtod(m, uint8_t *);

--- 211 unchanged lines hidden ---