Lines Matching refs:netdev
242 struct net_device *netdev; member
265 struct net_device *netdev = dev->netdev; in ems_usb_read_interrupt_callback() local
268 if (!netif_device_present(netdev)) in ems_usb_read_interrupt_callback()
275 netif_queue_stopped(netdev)) in ems_usb_read_interrupt_callback()
276 netif_wake_queue(netdev); in ems_usb_read_interrupt_callback()
287 netdev_info(netdev, "Rx interrupt aborted %d\n", urb->status); in ems_usb_read_interrupt_callback()
294 netif_device_detach(netdev); in ems_usb_read_interrupt_callback()
296 netdev_err(netdev, "failed resubmitting intr urb: %d\n", err); in ems_usb_read_interrupt_callback()
304 struct net_device_stats *stats = &dev->netdev->stats; in ems_usb_rx_can_msg()
306 skb = alloc_can_skb(dev->netdev, &cf); in ems_usb_rx_can_msg()
334 struct net_device_stats *stats = &dev->netdev->stats; in ems_usb_rx_err()
336 skb = alloc_can_err_skb(dev->netdev, &cf); in ems_usb_rx_err()
348 can_bus_off(dev->netdev); in ems_usb_rx_err()
411 struct net_device *netdev; in ems_usb_read_bulk_callback() local
414 netdev = dev->netdev; in ems_usb_read_bulk_callback()
416 if (!netif_device_present(netdev)) in ems_usb_read_bulk_callback()
427 netdev_info(netdev, "Rx URB aborted (%d)\n", urb->status); in ems_usb_read_bulk_callback()
471 netdev_err(netdev, "format error\n"); in ems_usb_read_bulk_callback()
485 netif_device_detach(netdev); in ems_usb_read_bulk_callback()
487 netdev_err(netdev, in ems_usb_read_bulk_callback()
498 struct net_device *netdev; in ems_usb_write_bulk_callback() local
503 netdev = dev->netdev; in ems_usb_write_bulk_callback()
511 if (!netif_device_present(netdev)) in ems_usb_write_bulk_callback()
515 netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status); in ems_usb_write_bulk_callback()
517 netif_trans_update(netdev); in ems_usb_write_bulk_callback()
520 netdev->stats.tx_packets++; in ems_usb_write_bulk_callback()
521 netdev->stats.tx_bytes += context->dlc; in ems_usb_write_bulk_callback()
523 can_get_echo_skb(netdev, context->echo_index); in ems_usb_write_bulk_callback()
583 struct net_device *netdev = dev->netdev; in ems_usb_start() local
604 netdev_err(netdev, "No memory left for USB buffer\n"); in ems_usb_start()
636 netdev_warn(netdev, "couldn't setup read URBs\n"); in ems_usb_start()
642 netdev_warn(netdev, "rx performance may be slow\n"); in ems_usb_start()
653 netdev_warn(netdev, "intr URB submit failed: %d\n", err); in ems_usb_start()
682 netdev_warn(netdev, "couldn't submit control: %d\n", err); in ems_usb_start()
706 static int ems_usb_open(struct net_device *netdev) in ems_usb_open() argument
708 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_open()
716 err = open_candev(netdev); in ems_usb_open()
724 netif_device_detach(dev->netdev); in ems_usb_open()
726 netdev_warn(netdev, "couldn't start device: %d\n", err); in ems_usb_open()
728 close_candev(netdev); in ems_usb_open()
734 netif_start_queue(netdev); in ems_usb_open()
739 static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *netdev) in ems_usb_start_xmit() argument
741 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_start_xmit()
743 struct net_device_stats *stats = &netdev->stats; in ems_usb_start_xmit()
752 if (can_dropped_invalid_skb(netdev, skb)) in ems_usb_start_xmit()
762 netdev_err(netdev, "No memory left for USB buffer\n"); in ems_usb_start_xmit()
802 netdev_warn(netdev, "couldn't find free context\n"); in ems_usb_start_xmit()
816 can_put_echo_skb(skb, netdev, context->echo_index); in ems_usb_start_xmit()
822 can_free_echo_skb(netdev, context->echo_index); in ems_usb_start_xmit()
830 netif_device_detach(netdev); in ems_usb_start_xmit()
832 netdev_warn(netdev, "failed tx_urb %d\n", err); in ems_usb_start_xmit()
837 netif_trans_update(netdev); in ems_usb_start_xmit()
842 netif_stop_queue(netdev); in ems_usb_start_xmit()
861 static int ems_usb_close(struct net_device *netdev) in ems_usb_close() argument
863 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_close()
868 netif_stop_queue(netdev); in ems_usb_close()
872 netdev_warn(netdev, "couldn't stop device"); in ems_usb_close()
874 close_candev(netdev); in ems_usb_close()
898 static int ems_usb_set_mode(struct net_device *netdev, enum can_mode mode) in ems_usb_set_mode() argument
900 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_set_mode()
905 netdev_warn(netdev, "couldn't start device"); in ems_usb_set_mode()
907 if (netif_queue_stopped(netdev)) in ems_usb_set_mode()
908 netif_wake_queue(netdev); in ems_usb_set_mode()
918 static int ems_usb_set_bittiming(struct net_device *netdev) in ems_usb_set_bittiming() argument
920 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_set_bittiming()
930 netdev_info(netdev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1); in ems_usb_set_bittiming()
974 struct net_device *netdev; in ems_usb_probe() local
978 netdev = alloc_candev(sizeof(struct ems_usb), MAX_TX_URBS); in ems_usb_probe()
979 if (!netdev) { in ems_usb_probe()
984 dev = netdev_priv(netdev); in ems_usb_probe()
987 dev->netdev = netdev; in ems_usb_probe()
996 netdev->netdev_ops = &ems_usb_netdev_ops; in ems_usb_probe()
998 netdev->flags |= IFF_ECHO; /* we support local echo */ in ems_usb_probe()
1023 SET_NETDEV_DEV(netdev, &intf->dev); in ems_usb_probe()
1029 netdev_err(netdev, "couldn't initialize controller: %d\n", err); in ems_usb_probe()
1033 err = register_candev(netdev); in ems_usb_probe()
1035 netdev_err(netdev, "couldn't register CAN device: %d\n", err); in ems_usb_probe()
1051 free_candev(netdev); in ems_usb_probe()
1066 unregister_netdev(dev->netdev); in ems_usb_disconnect()
1075 free_candev(dev->netdev); in ems_usb_disconnect()