Lines Matching refs:ncm

75 	struct ncm_device *ncm = container_of ( ep, struct ncm_device,  in ncm_intr_complete()  local
77 struct net_device *netdev = ncm->netdev; in ncm_intr_complete()
90 DBGC ( ncm, "NCM %p interrupt failed: %s\n", in ncm_intr_complete()
91 ncm, strerror ( rc ) ); in ncm_intr_complete()
92 DBGC_HDA ( ncm, 0, iobuf->data, iob_len ( iobuf ) ); in ncm_intr_complete()
98 DBGC ( ncm, "NCM %p underlength interrupt:\n", ncm ); in ncm_intr_complete()
99 DBGC_HDA ( ncm, 0, iobuf->data, iob_len ( iobuf ) ); in ncm_intr_complete()
110 DBGC ( ncm, "NCM %p link up\n", ncm ); in ncm_intr_complete()
113 DBGC ( ncm, "NCM %p link down\n", ncm ); in ncm_intr_complete()
123 DBGC ( ncm, "NCM %p unrecognised interrupt:\n", ncm ); in ncm_intr_complete()
124 DBGC_HDA ( ncm, 0, iobuf->data, iob_len ( iobuf ) ); in ncm_intr_complete()
159 static int ncm_in_prefill ( struct ncm_device *ncm ) { in ncm_in_prefill() argument
160 struct usb_bus *bus = ncm->bus; in ncm_in_prefill()
177 for ( mtu = ncm->mtu ; mtu >= NCM_MIN_NTB_INPUT_SIZE ; mtu >>= 1 ) { in ncm_in_prefill()
189 usb_refill_init ( &ncm->usbnet.in, 0, mtu, count ); in ncm_in_prefill()
190 if ( ( rc = usb_prefill ( &ncm->usbnet.in ) ) != 0 ) { in ncm_in_prefill()
191 DBGC ( ncm, "NCM %p could not prefill %dx %zd-byte " in ncm_in_prefill()
192 "buffers for bulk IN\n", ncm, count, mtu ); in ncm_in_prefill()
196 DBGC ( ncm, "NCM %p using %dx %zd-byte buffers for bulk IN\n", in ncm_in_prefill()
197 ncm, count, mtu ); in ncm_in_prefill()
201 DBGC ( ncm, "NCM %p could not prefill bulk IN endpoint\n", ncm ); in ncm_in_prefill()
214 struct ncm_device *ncm = container_of ( ep, struct ncm_device, in ncm_in_complete() local
216 struct net_device *netdev = ncm->netdev; in ncm_in_complete()
238 DBGC ( ncm, "NCM %p bulk IN failed: %s\n", in ncm_in_complete()
239 ncm, strerror ( rc ) ); in ncm_in_complete()
246 DBGC ( ncm, "NCM %p packet too short for NTH:\n", ncm ); in ncm_in_complete()
255 DBGC ( ncm, "NCM %p packet too short for NDP:\n", ncm ); in ncm_in_complete()
262 DBGC ( ncm, "NCM %p NDP header length too short:\n", ncm ); in ncm_in_complete()
267 DBGC ( ncm, "NCM %p packet too short for NDP:\n", ncm ); in ncm_in_complete()
284 DBGC ( ncm, "NCM %p underlength datagram:\n", ncm ); in ncm_in_complete()
289 DBGC ( ncm, "NCM %p datagram exceeds packet:\n", ncm ); in ncm_in_complete()
310 headroom = ( sizeof ( struct ncm_ntb_header ) + ncm->padding ); in ncm_in_complete()
331 usb_recycle ( &ncm->usbnet.in, iobuf ); in ncm_in_complete()
338 DBGC_HDA ( ncm, 0, iobuf->data, iob_len ( iobuf ) ); in ncm_in_complete()
341 usb_recycle ( &ncm->usbnet.in, iobuf ); in ncm_in_complete()
356 static int ncm_out_transmit ( struct ncm_device *ncm, in ncm_out_transmit() argument
360 size_t header_len = ( sizeof ( *header ) + ncm->padding ); in ncm_out_transmit()
374 header->nth.sequence = cpu_to_le16 ( ncm->sequence ); in ncm_out_transmit()
387 if ( ( rc = usb_stream ( &ncm->usbnet.out, iobuf, 0 ) ) != 0 ) in ncm_out_transmit()
391 ncm->sequence++; in ncm_out_transmit()
406 struct ncm_device *ncm = container_of ( ep, struct ncm_device, in ncm_out_complete() local
408 struct net_device *netdev = ncm->netdev; in ncm_out_complete()
433 struct ncm_device *ncm = netdev->priv; in ncm_open() local
434 struct usb_device *usb = ncm->usb; in ncm_open()
439 ncm->sequence = 0; in ncm_open()
442 if ( ( rc = ncm_in_prefill ( ncm ) ) != 0 ) in ncm_open()
447 size.mtu = cpu_to_le32 ( ncm->usbnet.in.len ); in ncm_open()
449 ncm->usbnet.comms, &size, in ncm_open()
451 DBGC ( ncm, "NCM %p could not set input size to %zd: %s\n", in ncm_open()
452 ncm, ncm->usbnet.in.len, strerror ( rc ) ); in ncm_open()
458 ncm->usbnet.comms, netdev->ll_addr, in ncm_open()
460 DBGC ( ncm, "NCM %p could not set MAC address: %s\n", in ncm_open()
461 ncm, strerror ( rc ) ); in ncm_open()
466 if ( ( rc = usbnet_open ( &ncm->usbnet ) ) != 0 ) { in ncm_open()
467 DBGC ( ncm, "NCM %p could not open: %s\n", in ncm_open()
468 ncm, strerror ( rc ) ); in ncm_open()
474 usbnet_close ( &ncm->usbnet ); in ncm_open()
477 usb_flush ( &ncm->usbnet.in ); in ncm_open()
488 struct ncm_device *ncm = netdev->priv; in ncm_close() local
491 usbnet_close ( &ncm->usbnet ); in ncm_close()
503 struct ncm_device *ncm = netdev->priv; in ncm_transmit() local
507 if ( ( rc = ncm_out_transmit ( ncm, iobuf ) ) != 0 ) in ncm_transmit()
519 struct ncm_device *ncm = netdev->priv; in ncm_poll() local
523 usb_poll ( ncm->bus ); in ncm_poll()
526 if ( ( rc = usbnet_refill ( &ncm->usbnet ) ) != 0 ) in ncm_poll()
557 struct ncm_device *ncm; in ncm_probe() local
564 netdev = alloc_etherdev ( sizeof ( *ncm ) ); in ncm_probe()
571 ncm = netdev->priv; in ncm_probe()
572 memset ( ncm, 0, sizeof ( *ncm ) ); in ncm_probe()
573 ncm->usb = usb; in ncm_probe()
574 ncm->bus = usb->port->hub->bus; in ncm_probe()
575 ncm->netdev = netdev; in ncm_probe()
576 usbnet_init ( &ncm->usbnet, func, &ncm_intr_operations, in ncm_probe()
578 usb_refill_init ( &ncm->usbnet.intr, 0, 0, NCM_INTR_COUNT ); in ncm_probe()
579 DBGC ( ncm, "NCM %p on %s\n", ncm, func->name ); in ncm_probe()
582 if ( ( rc = usbnet_describe ( &ncm->usbnet, config ) ) != 0 ) { in ncm_probe()
583 DBGC ( ncm, "NCM %p could not describe: %s\n", in ncm_probe()
584 ncm, strerror ( rc ) ); in ncm_probe()
589 comms = usb_interface_descriptor ( config, ncm->usbnet.comms, 0 ); in ncm_probe()
593 DBGC ( ncm, "NCM %p has no Ethernet descriptor\n", ncm ); in ncm_probe()
600 DBGC ( ncm, "NCM %p could not fetch MAC address: %s\n", in ncm_probe()
601 ncm, strerror ( rc ) ); in ncm_probe()
607 ncm->usbnet.comms, &params, in ncm_probe()
609 DBGC ( ncm, "NCM %p could not get NTB parameters: %s\n", in ncm_probe()
610 ncm, strerror ( rc ) ); in ncm_probe()
615 ncm->mtu = le32_to_cpu ( params.in.mtu ); in ncm_probe()
616 DBGC2 ( ncm, "NCM %p maximum IN size is %zd bytes\n", ncm, ncm->mtu ); in ncm_probe()
619 ncm->padding = ( ( le16_to_cpu ( params.out.remainder ) - in ncm_probe()
622 DBGC2 ( ncm, "NCM %p using %zd-byte transmit padding\n", in ncm_probe()
623 ncm, ncm->padding ); in ncm_probe()
624 assert ( ( ( sizeof ( struct ncm_ntb_header ) + ncm->padding + in ncm_probe()
632 usb_func_set_drvdata ( func, ncm ); in ncm_probe()
653 struct ncm_device *ncm = usb_func_get_drvdata ( func ); in ncm_remove() local
654 struct net_device *netdev = ncm->netdev; in ncm_remove()