Lines Matching refs:netdev
242 struct net_device *netdev; member
263 struct net_device *netdev = dev->netdev; in ems_usb_read_interrupt_callback() local
266 if (!netif_device_present(netdev)) in ems_usb_read_interrupt_callback()
273 netif_queue_stopped(netdev)) in ems_usb_read_interrupt_callback()
274 netif_wake_queue(netdev); in ems_usb_read_interrupt_callback()
285 netdev_info(netdev, "Rx interrupt aborted %d\n", urb->status); in ems_usb_read_interrupt_callback()
292 netif_device_detach(netdev); in ems_usb_read_interrupt_callback()
294 netdev_err(netdev, "failed resubmitting intr urb: %d\n", err); in ems_usb_read_interrupt_callback()
302 struct net_device_stats *stats = &dev->netdev->stats; in ems_usb_rx_can_msg()
304 skb = alloc_can_skb(dev->netdev, &cf); in ems_usb_rx_can_msg()
332 struct net_device_stats *stats = &dev->netdev->stats; in ems_usb_rx_err()
334 skb = alloc_can_err_skb(dev->netdev, &cf); in ems_usb_rx_err()
346 can_bus_off(dev->netdev); in ems_usb_rx_err()
409 struct net_device *netdev; in ems_usb_read_bulk_callback() local
412 netdev = dev->netdev; in ems_usb_read_bulk_callback()
414 if (!netif_device_present(netdev)) in ems_usb_read_bulk_callback()
425 netdev_info(netdev, "Rx URB aborted (%d)\n", urb->status); in ems_usb_read_bulk_callback()
469 netdev_err(netdev, "format error\n"); in ems_usb_read_bulk_callback()
483 netif_device_detach(netdev); in ems_usb_read_bulk_callback()
485 netdev_err(netdev, in ems_usb_read_bulk_callback()
496 struct net_device *netdev; in ems_usb_write_bulk_callback() local
501 netdev = dev->netdev; in ems_usb_write_bulk_callback()
509 if (!netif_device_present(netdev)) in ems_usb_write_bulk_callback()
513 netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status); in ems_usb_write_bulk_callback()
515 netif_trans_update(netdev); in ems_usb_write_bulk_callback()
518 netdev->stats.tx_packets++; in ems_usb_write_bulk_callback()
519 netdev->stats.tx_bytes += context->dlc; in ems_usb_write_bulk_callback()
521 can_get_echo_skb(netdev, context->echo_index); in ems_usb_write_bulk_callback()
581 struct net_device *netdev = dev->netdev; in ems_usb_start() local
601 netdev_err(netdev, "No memory left for USB buffer\n"); in ems_usb_start()
628 netdev_warn(netdev, "couldn't setup read URBs\n"); in ems_usb_start()
634 netdev_warn(netdev, "rx performance may be slow\n"); in ems_usb_start()
645 netdev_warn(netdev, "intr URB submit failed: %d\n", err); in ems_usb_start()
674 netdev_warn(netdev, "couldn't submit control: %d\n", err); in ems_usb_start()
694 static int ems_usb_open(struct net_device *netdev) in ems_usb_open() argument
696 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_open()
704 err = open_candev(netdev); in ems_usb_open()
712 netif_device_detach(dev->netdev); in ems_usb_open()
714 netdev_warn(netdev, "couldn't start device: %d\n", err); in ems_usb_open()
716 close_candev(netdev); in ems_usb_open()
722 netif_start_queue(netdev); in ems_usb_open()
727 static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *netdev) in ems_usb_start_xmit() argument
729 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_start_xmit()
731 struct net_device_stats *stats = &netdev->stats; in ems_usb_start_xmit()
740 if (can_dropped_invalid_skb(netdev, skb)) in ems_usb_start_xmit()
750 netdev_err(netdev, "No memory left for USB buffer\n"); in ems_usb_start_xmit()
790 netdev_warn(netdev, "couldn't find free context\n"); in ems_usb_start_xmit()
804 can_put_echo_skb(skb, netdev, context->echo_index); in ems_usb_start_xmit()
810 can_free_echo_skb(netdev, context->echo_index); in ems_usb_start_xmit()
819 netif_device_detach(netdev); in ems_usb_start_xmit()
821 netdev_warn(netdev, "failed tx_urb %d\n", err); in ems_usb_start_xmit()
826 netif_trans_update(netdev); in ems_usb_start_xmit()
831 netif_stop_queue(netdev); in ems_usb_start_xmit()
850 static int ems_usb_close(struct net_device *netdev) in ems_usb_close() argument
852 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_close()
857 netif_stop_queue(netdev); in ems_usb_close()
861 netdev_warn(netdev, "couldn't stop device"); in ems_usb_close()
863 close_candev(netdev); in ems_usb_close()
887 static int ems_usb_set_mode(struct net_device *netdev, enum can_mode mode) in ems_usb_set_mode() argument
889 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_set_mode()
894 netdev_warn(netdev, "couldn't start device"); in ems_usb_set_mode()
896 if (netif_queue_stopped(netdev)) in ems_usb_set_mode()
897 netif_wake_queue(netdev); in ems_usb_set_mode()
907 static int ems_usb_set_bittiming(struct net_device *netdev) in ems_usb_set_bittiming() argument
909 struct ems_usb *dev = netdev_priv(netdev); in ems_usb_set_bittiming()
919 netdev_info(netdev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1); in ems_usb_set_bittiming()
963 struct net_device *netdev; in ems_usb_probe() local
967 netdev = alloc_candev(sizeof(struct ems_usb), MAX_TX_URBS); in ems_usb_probe()
968 if (!netdev) { in ems_usb_probe()
973 dev = netdev_priv(netdev); in ems_usb_probe()
976 dev->netdev = netdev; in ems_usb_probe()
985 netdev->netdev_ops = &ems_usb_netdev_ops; in ems_usb_probe()
987 netdev->flags |= IFF_ECHO; /* we support local echo */ in ems_usb_probe()
1012 SET_NETDEV_DEV(netdev, &intf->dev); in ems_usb_probe()
1018 netdev_err(netdev, "couldn't initialize controller: %d\n", err); in ems_usb_probe()
1022 err = register_candev(netdev); in ems_usb_probe()
1024 netdev_err(netdev, "couldn't register CAN device: %d\n", err); in ems_usb_probe()
1040 free_candev(netdev); in ems_usb_probe()
1055 unregister_netdev(dev->netdev); in ems_usb_disconnect()
1056 free_candev(dev->netdev); in ems_usb_disconnect()