usbnet.c (c441bfb5f2866de71e092c1b9d866a65978dfe1a) usbnet.c (478890682ff7124bf4eaa6f0af382e9d2c937f73)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * USB Network driver infrastructure
4 * Copyright (C) 2000-2005 by David Brownell
5 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
6 */
7
8/*

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

69
70/* use ethtool to change the level for any given device */
71static int msg_level = -1;
72module_param (msg_level, int, 0);
73MODULE_PARM_DESC (msg_level, "Override default message level");
74
75/*-------------------------------------------------------------------------*/
76
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * USB Network driver infrastructure
4 * Copyright (C) 2000-2005 by David Brownell
5 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
6 */
7
8/*

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

69
70/* use ethtool to change the level for any given device */
71static int msg_level = -1;
72module_param (msg_level, int, 0);
73MODULE_PARM_DESC (msg_level, "Override default message level");
74
75/*-------------------------------------------------------------------------*/
76
77static const char * const usbnet_event_names[] = {
78 [EVENT_TX_HALT] = "EVENT_TX_HALT",
79 [EVENT_RX_HALT] = "EVENT_RX_HALT",
80 [EVENT_RX_MEMORY] = "EVENT_RX_MEMORY",
81 [EVENT_STS_SPLIT] = "EVENT_STS_SPLIT",
82 [EVENT_LINK_RESET] = "EVENT_LINK_RESET",
83 [EVENT_RX_PAUSED] = "EVENT_RX_PAUSED",
84 [EVENT_DEV_ASLEEP] = "EVENT_DEV_ASLEEP",
85 [EVENT_DEV_OPEN] = "EVENT_DEV_OPEN",
86 [EVENT_DEVICE_REPORT_IDLE] = "EVENT_DEVICE_REPORT_IDLE",
87 [EVENT_NO_RUNTIME_PM] = "EVENT_NO_RUNTIME_PM",
88 [EVENT_RX_KILL] = "EVENT_RX_KILL",
89 [EVENT_LINK_CHANGE] = "EVENT_LINK_CHANGE",
90 [EVENT_SET_RX_MODE] = "EVENT_SET_RX_MODE",
91 [EVENT_NO_IP_ALIGN] = "EVENT_NO_IP_ALIGN",
92};
93
77/* handles CDC Ethernet and many other network "bulk data" interfaces */
78int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
79{
80 int tmp;
81 struct usb_host_interface *alt = NULL;
82 struct usb_host_endpoint *in = NULL, *out = NULL;
83 struct usb_host_endpoint *status = NULL;
84

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

447 *
448 * NOTE: annoying asymmetry: if it's active, schedule_work() fails,
449 * but tasklet_schedule() doesn't. hope the failure is rare.
450 */
451void usbnet_defer_kevent (struct usbnet *dev, int work)
452{
453 set_bit (work, &dev->flags);
454 if (!schedule_work (&dev->kevent))
94/* handles CDC Ethernet and many other network "bulk data" interfaces */
95int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
96{
97 int tmp;
98 struct usb_host_interface *alt = NULL;
99 struct usb_host_endpoint *in = NULL, *out = NULL;
100 struct usb_host_endpoint *status = NULL;
101

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

464 *
465 * NOTE: annoying asymmetry: if it's active, schedule_work() fails,
466 * but tasklet_schedule() doesn't. hope the failure is rare.
467 */
468void usbnet_defer_kevent (struct usbnet *dev, int work)
469{
470 set_bit (work, &dev->flags);
471 if (!schedule_work (&dev->kevent))
455 netdev_dbg(dev->net, "kevent %d may have been dropped\n", work);
472 netdev_dbg(dev->net, "kevent %s may have been dropped\n", usbnet_event_names[work]);
456 else
473 else
457 netdev_dbg(dev->net, "kevent %d scheduled\n", work);
474 netdev_dbg(dev->net, "kevent %s scheduled\n", usbnet_event_names[work]);
458}
459EXPORT_SYMBOL_GPL(usbnet_defer_kevent);
460
461/*-------------------------------------------------------------------------*/
462
463static void rx_complete (struct urb *urb);
464
465static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)

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

1592
1593 xdev = interface_to_usbdev (intf);
1594
1595 netif_info(dev, probe, dev->net, "unregister '%s' usb-%s-%s, %s\n",
1596 intf->dev.driver->name,
1597 xdev->bus->bus_name, xdev->devpath,
1598 dev->driver_info->description);
1599
475}
476EXPORT_SYMBOL_GPL(usbnet_defer_kevent);
477
478/*-------------------------------------------------------------------------*/
479
480static void rx_complete (struct urb *urb);
481
482static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)

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

1609
1610 xdev = interface_to_usbdev (intf);
1611
1612 netif_info(dev, probe, dev->net, "unregister '%s' usb-%s-%s, %s\n",
1613 intf->dev.driver->name,
1614 xdev->bus->bus_name, xdev->devpath,
1615 dev->driver_info->description);
1616
1617 if (dev->driver_info->unbind)
1618 dev->driver_info->unbind(dev, intf);
1619
1600 net = dev->net;
1601 unregister_netdev (net);
1602
1603 cancel_work_sync(&dev->kevent);
1604
1605 usb_scuttle_anchored_urbs(&dev->deferred);
1606
1620 net = dev->net;
1621 unregister_netdev (net);
1622
1623 cancel_work_sync(&dev->kevent);
1624
1625 usb_scuttle_anchored_urbs(&dev->deferred);
1626
1607 if (dev->driver_info->unbind)
1608 dev->driver_info->unbind (dev, intf);
1609
1610 usb_kill_urb(dev->interrupt);
1611 usb_free_urb(dev->interrupt);
1612 kfree(dev->padding_pkt);
1613
1614 free_percpu(net->tstats);
1615 free_netdev(net);
1616}
1617EXPORT_SYMBOL_GPL(usbnet_disconnect);

--- 575 unchanged lines hidden ---
1627 usb_kill_urb(dev->interrupt);
1628 usb_free_urb(dev->interrupt);
1629 kfree(dev->padding_pkt);
1630
1631 free_percpu(net->tstats);
1632 free_netdev(net);
1633}
1634EXPORT_SYMBOL_GPL(usbnet_disconnect);

--- 575 unchanged lines hidden ---