2019-06-04 11:11:33 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2002 Petko Manolov (petkan@users.sourceforge.net)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/signal.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
#include <linux/mii.h>
|
|
|
|
#include <linux/ethtool.h>
|
|
|
|
#include <linux/usb.h>
|
2016-12-24 22:46:01 +03:00
|
|
|
#include <linux/uaccess.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* Version Information */
|
|
|
|
#define DRIVER_VERSION "v0.6.2 (2004/08/27)"
|
|
|
|
#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
|
|
|
|
#define DRIVER_DESC "rtl8150 based usb-ethernet driver"
|
|
|
|
|
|
|
|
#define IDR 0x0120
|
|
|
|
#define MAR 0x0126
|
|
|
|
#define CR 0x012e
|
|
|
|
#define TCR 0x012f
|
|
|
|
#define RCR 0x0130
|
|
|
|
#define TSR 0x0132
|
|
|
|
#define RSR 0x0133
|
|
|
|
#define CON0 0x0135
|
|
|
|
#define CON1 0x0136
|
|
|
|
#define MSR 0x0137
|
|
|
|
#define PHYADD 0x0138
|
|
|
|
#define PHYDAT 0x0139
|
|
|
|
#define PHYCNT 0x013b
|
|
|
|
#define GPPC 0x013d
|
|
|
|
#define BMCR 0x0140
|
|
|
|
#define BMSR 0x0142
|
|
|
|
#define ANAR 0x0144
|
|
|
|
#define ANLP 0x0146
|
|
|
|
#define AER 0x0148
|
|
|
|
#define CSCR 0x014C /* This one has the link status */
|
|
|
|
#define CSCR_LINK_STATUS (1 << 3)
|
|
|
|
|
|
|
|
#define IDR_EEPROM 0x1202
|
|
|
|
|
|
|
|
#define PHY_READ 0
|
|
|
|
#define PHY_WRITE 0x20
|
|
|
|
#define PHY_GO 0x40
|
|
|
|
|
|
|
|
#define MII_TIMEOUT 10
|
|
|
|
#define INTBUFSIZE 8
|
|
|
|
|
|
|
|
#define RTL8150_REQT_READ 0xc0
|
|
|
|
#define RTL8150_REQT_WRITE 0x40
|
|
|
|
#define RTL8150_REQ_GET_REGS 0x05
|
|
|
|
#define RTL8150_REQ_SET_REGS 0x05
|
|
|
|
|
|
|
|
|
|
|
|
/* Transmit status register errors */
|
|
|
|
#define TSR_ECOL (1<<5)
|
|
|
|
#define TSR_LCOL (1<<4)
|
|
|
|
#define TSR_LOSS_CRS (1<<3)
|
|
|
|
#define TSR_JBR (1<<2)
|
|
|
|
#define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR)
|
|
|
|
/* Receive status register errors */
|
|
|
|
#define RSR_CRC (1<<2)
|
|
|
|
#define RSR_FAE (1<<1)
|
|
|
|
#define RSR_ERRORS (RSR_CRC | RSR_FAE)
|
|
|
|
|
|
|
|
/* Media status register definitions */
|
|
|
|
#define MSR_DUPLEX (1<<4)
|
|
|
|
#define MSR_SPEED (1<<3)
|
|
|
|
#define MSR_LINK (1<<2)
|
|
|
|
|
|
|
|
/* Interrupt pipe data */
|
|
|
|
#define INT_TSR 0x00
|
|
|
|
#define INT_RSR 0x01
|
|
|
|
#define INT_MSR 0x02
|
|
|
|
#define INT_WAKSR 0x03
|
|
|
|
#define INT_TXOK_CNT 0x04
|
|
|
|
#define INT_RXLOST_CNT 0x05
|
|
|
|
#define INT_CRERR_CNT 0x06
|
|
|
|
#define INT_COL_CNT 0x07
|
|
|
|
|
|
|
|
|
|
|
|
#define RTL8150_MTU 1540
|
|
|
|
#define RTL8150_TX_TIMEOUT (HZ)
|
|
|
|
#define RX_SKB_POOL_SIZE 4
|
|
|
|
|
|
|
|
/* rtl8150 flags */
|
|
|
|
#define RTL8150_HW_CRC 0
|
|
|
|
#define RX_REG_SET 1
|
|
|
|
#define RTL8150_UNPLUG 2
|
|
|
|
#define RX_URB_FAIL 3
|
|
|
|
|
|
|
|
/* Define these values to match your device */
|
2006-12-04 15:27:36 +03:00
|
|
|
#define VENDOR_ID_REALTEK 0x0bda
|
2005-04-17 02:20:36 +04:00
|
|
|
#define VENDOR_ID_MELCO 0x0411
|
2006-12-04 15:27:36 +03:00
|
|
|
#define VENDOR_ID_MICRONET 0x3980
|
2005-04-17 02:20:36 +04:00
|
|
|
#define VENDOR_ID_LONGSHINE 0x07b8
|
2006-12-04 15:27:36 +03:00
|
|
|
#define VENDOR_ID_OQO 0x1557
|
2006-07-06 03:17:27 +04:00
|
|
|
#define VENDOR_ID_ZYXEL 0x0586
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#define PRODUCT_ID_RTL8150 0x8150
|
|
|
|
#define PRODUCT_ID_LUAKTX 0x0012
|
|
|
|
#define PRODUCT_ID_LCS8138TX 0x401a
|
|
|
|
#define PRODUCT_ID_SP128AR 0x0003
|
2006-07-06 03:17:27 +04:00
|
|
|
#define PRODUCT_ID_PRESTIGE 0x401a
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#undef EEPROM_WRITE
|
|
|
|
|
|
|
|
/* table of devices that work with this driver */
|
2017-08-08 18:58:41 +03:00
|
|
|
static const struct usb_device_id rtl8150_table[] = {
|
2005-04-17 02:20:36 +04:00
|
|
|
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)},
|
|
|
|
{USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)},
|
|
|
|
{USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)},
|
|
|
|
{USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)},
|
2006-12-04 15:27:36 +03:00
|
|
|
{USB_DEVICE(VENDOR_ID_OQO, PRODUCT_ID_RTL8150)},
|
2006-07-06 03:17:27 +04:00
|
|
|
{USB_DEVICE(VENDOR_ID_ZYXEL, PRODUCT_ID_PRESTIGE)},
|
2005-04-17 02:20:36 +04:00
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(usb, rtl8150_table);
|
|
|
|
|
|
|
|
struct rtl8150 {
|
|
|
|
unsigned long flags;
|
|
|
|
struct usb_device *udev;
|
|
|
|
struct tasklet_struct tl;
|
|
|
|
struct net_device *netdev;
|
2013-05-20 03:08:47 +04:00
|
|
|
struct urb *rx_urb, *tx_urb, *intr_urb;
|
2005-04-17 02:20:36 +04:00
|
|
|
struct sk_buff *tx_skb, *rx_skb;
|
|
|
|
struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
|
|
|
|
spinlock_t rx_pool_lock;
|
|
|
|
struct usb_ctrlrequest dr;
|
|
|
|
int intr_interval;
|
|
|
|
u8 *intr_buff;
|
|
|
|
u8 phy;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct rtl8150 rtl8150_t;
|
|
|
|
|
2013-05-20 03:08:47 +04:00
|
|
|
struct async_req {
|
|
|
|
struct usb_ctrlrequest dr;
|
|
|
|
u16 rx_creg;
|
|
|
|
};
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
static const char driver_name [] = "rtl8150";
|
|
|
|
|
|
|
|
/*
|
|
|
|
**
|
|
|
|
** device related part of the code
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
|
|
|
|
{
|
2020-09-27 15:49:09 +03:00
|
|
|
return usb_control_msg_recv(dev->udev, 0, RTL8150_REQ_GET_REGS,
|
|
|
|
RTL8150_REQT_READ, indx, 0, data, size,
|
|
|
|
1000, GFP_NOIO);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2017-02-04 19:56:32 +03:00
|
|
|
static int set_registers(rtl8150_t * dev, u16 indx, u16 size, const void *data)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2020-09-27 15:49:09 +03:00
|
|
|
return usb_control_msg_send(dev->udev, 0, RTL8150_REQ_SET_REGS,
|
|
|
|
RTL8150_REQT_WRITE, indx, 0, data, size,
|
|
|
|
1000, GFP_NOIO);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2013-05-20 03:08:47 +04:00
|
|
|
static void async_set_reg_cb(struct urb *urb)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2013-05-20 03:08:47 +04:00
|
|
|
struct async_req *req = (struct async_req *)urb->context;
|
2008-12-19 10:00:59 +03:00
|
|
|
int status = urb->status;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2013-05-20 03:08:47 +04:00
|
|
|
if (status < 0)
|
|
|
|
dev_dbg(&urb->dev->dev, "%s failed with %d", __func__, status);
|
|
|
|
kfree(req);
|
|
|
|
usb_free_urb(urb);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2013-05-20 03:08:47 +04:00
|
|
|
static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2013-05-20 03:08:47 +04:00
|
|
|
int res = -ENOMEM;
|
|
|
|
struct urb *async_urb;
|
|
|
|
struct async_req *req;
|
|
|
|
|
|
|
|
req = kmalloc(sizeof(struct async_req), GFP_ATOMIC);
|
|
|
|
if (req == NULL)
|
|
|
|
return res;
|
|
|
|
async_urb = usb_alloc_urb(0, GFP_ATOMIC);
|
|
|
|
if (async_urb == NULL) {
|
|
|
|
kfree(req);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
req->rx_creg = cpu_to_le16(reg);
|
|
|
|
req->dr.bRequestType = RTL8150_REQT_WRITE;
|
|
|
|
req->dr.bRequest = RTL8150_REQ_SET_REGS;
|
|
|
|
req->dr.wIndex = 0;
|
|
|
|
req->dr.wValue = cpu_to_le16(indx);
|
|
|
|
req->dr.wLength = cpu_to_le16(size);
|
|
|
|
usb_fill_control_urb(async_urb, dev->udev,
|
|
|
|
usb_sndctrlpipe(dev->udev, 0), (void *)&req->dr,
|
|
|
|
&req->rx_creg, size, async_set_reg_cb, req);
|
|
|
|
res = usb_submit_urb(async_urb, GFP_ATOMIC);
|
|
|
|
if (res) {
|
|
|
|
if (res == -ENODEV)
|
2006-07-25 14:39:14 +04:00
|
|
|
netif_device_detach(dev->netdev);
|
2013-05-20 03:08:47 +04:00
|
|
|
dev_err(&dev->udev->dev, "%s failed with %d\n", __func__, res);
|
|
|
|
}
|
|
|
|
return res;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u8 data[3], tmp;
|
|
|
|
|
|
|
|
data[0] = phy;
|
|
|
|
data[1] = data[2] = 0;
|
|
|
|
tmp = indx | PHY_READ | PHY_GO;
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
set_registers(dev, PHYADD, sizeof(data), data);
|
|
|
|
set_registers(dev, PHYCNT, 1, &tmp);
|
|
|
|
do {
|
|
|
|
get_registers(dev, PHYCNT, 1, data);
|
|
|
|
} while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));
|
|
|
|
|
2009-12-27 14:22:08 +03:00
|
|
|
if (i <= MII_TIMEOUT) {
|
2005-04-17 02:20:36 +04:00
|
|
|
get_registers(dev, PHYDAT, 2, data);
|
|
|
|
*reg = data[0] | (data[1] << 8);
|
|
|
|
return 0;
|
|
|
|
} else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u8 data[3], tmp;
|
|
|
|
|
|
|
|
data[0] = phy;
|
2007-02-04 06:02:17 +03:00
|
|
|
data[1] = reg & 0xff;
|
|
|
|
data[2] = (reg >> 8) & 0xff;
|
2005-04-17 02:20:36 +04:00
|
|
|
tmp = indx | PHY_WRITE | PHY_GO;
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
set_registers(dev, PHYADD, sizeof(data), data);
|
|
|
|
set_registers(dev, PHYCNT, 1, &tmp);
|
|
|
|
do {
|
|
|
|
get_registers(dev, PHYCNT, 1, data);
|
|
|
|
} while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));
|
|
|
|
|
2009-12-27 14:22:08 +03:00
|
|
|
if (i <= MII_TIMEOUT)
|
2005-04-17 02:20:36 +04:00
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-10-05 16:29:58 +03:00
|
|
|
static void set_ethernet_addr(rtl8150_t *dev)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2020-10-05 16:29:58 +03:00
|
|
|
u8 node_id[ETH_ALEN];
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = get_registers(dev, IDR, sizeof(node_id), node_id);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2020-10-11 20:30:30 +03:00
|
|
|
if (!ret) {
|
2020-10-05 16:29:58 +03:00
|
|
|
ether_addr_copy(dev->netdev->dev_addr, node_id);
|
|
|
|
} else {
|
|
|
|
eth_hw_addr_random(dev->netdev);
|
|
|
|
netdev_notice(dev->netdev, "Assigned a random MAC address: %pM\n",
|
|
|
|
dev->netdev->dev_addr);
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
|
|
|
|
{
|
|
|
|
struct sockaddr *addr = p;
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
|
|
|
|
|
|
|
if (netif_running(netdev))
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
2012-09-19 13:46:14 +04:00
|
|
|
netdev_dbg(netdev, "Setting MAC address to %pM\n", netdev->dev_addr);
|
2005-04-17 02:20:36 +04:00
|
|
|
/* Set the IDR registers. */
|
2009-12-13 08:47:04 +03:00
|
|
|
set_registers(dev, IDR, netdev->addr_len, netdev->dev_addr);
|
2005-04-17 02:20:36 +04:00
|
|
|
#ifdef EEPROM_WRITE
|
|
|
|
{
|
2009-12-30 07:03:28 +03:00
|
|
|
int i;
|
2005-04-17 02:20:36 +04:00
|
|
|
u8 cr;
|
|
|
|
/* Get the CR contents. */
|
|
|
|
get_registers(dev, CR, 1, &cr);
|
|
|
|
/* Set the WEPROM bit (eeprom write enable). */
|
|
|
|
cr |= 0x20;
|
|
|
|
set_registers(dev, CR, 1, &cr);
|
|
|
|
/* Write the MAC address into eeprom. Eeprom writes must be word-sized,
|
|
|
|
so we need to split them up. */
|
|
|
|
for (i = 0; i * 2 < netdev->addr_len; i++) {
|
2011-09-30 04:38:29 +04:00
|
|
|
set_registers(dev, IDR_EEPROM + (i * 2), 2,
|
2005-04-17 02:20:36 +04:00
|
|
|
netdev->dev_addr + (i * 2));
|
|
|
|
}
|
|
|
|
/* Clear the WEPROM bit (preventing accidental eeprom writes). */
|
|
|
|
cr &= 0xdf;
|
|
|
|
set_registers(dev, CR, 1, &cr);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtl8150_reset(rtl8150_t * dev)
|
|
|
|
{
|
|
|
|
u8 data = 0x10;
|
|
|
|
int i = HZ;
|
|
|
|
|
|
|
|
set_registers(dev, CR, 1, &data);
|
|
|
|
do {
|
|
|
|
get_registers(dev, CR, 1, &data);
|
|
|
|
} while ((data & 0x10) && --i);
|
|
|
|
|
|
|
|
return (i > 0) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int alloc_all_urbs(rtl8150_t * dev)
|
|
|
|
{
|
|
|
|
dev->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
|
|
|
if (!dev->rx_urb)
|
|
|
|
return 0;
|
|
|
|
dev->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
|
|
|
if (!dev->tx_urb) {
|
|
|
|
usb_free_urb(dev->rx_urb);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
|
|
|
|
if (!dev->intr_urb) {
|
|
|
|
usb_free_urb(dev->rx_urb);
|
|
|
|
usb_free_urb(dev->tx_urb);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_all_urbs(rtl8150_t * dev)
|
|
|
|
{
|
|
|
|
usb_free_urb(dev->rx_urb);
|
|
|
|
usb_free_urb(dev->tx_urb);
|
|
|
|
usb_free_urb(dev->intr_urb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void unlink_all_urbs(rtl8150_t * dev)
|
|
|
|
{
|
|
|
|
usb_kill_urb(dev->rx_urb);
|
|
|
|
usb_kill_urb(dev->tx_urb);
|
|
|
|
usb_kill_urb(dev->intr_urb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct sk_buff *pull_skb(rtl8150_t *dev)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
|
|
|
|
if (dev->rx_skb_pool[i]) {
|
|
|
|
skb = dev->rx_skb_pool[i];
|
|
|
|
dev->rx_skb_pool[i] = NULL;
|
|
|
|
return skb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 17:55:46 +04:00
|
|
|
static void read_bulk_callback(struct urb *urb)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
rtl8150_t *dev;
|
|
|
|
unsigned pkt_len, res;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
struct net_device *netdev;
|
2008-12-19 10:00:59 +03:00
|
|
|
int status = urb->status;
|
|
|
|
int result;
|
2018-06-20 22:31:21 +03:00
|
|
|
unsigned long flags;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dev = urb->context;
|
|
|
|
if (!dev)
|
|
|
|
return;
|
|
|
|
if (test_bit(RTL8150_UNPLUG, &dev->flags))
|
|
|
|
return;
|
|
|
|
netdev = dev->netdev;
|
|
|
|
if (!netif_device_present(netdev))
|
|
|
|
return;
|
|
|
|
|
2008-12-19 10:00:59 +03:00
|
|
|
switch (status) {
|
2005-04-17 02:20:36 +04:00
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
case -ENOENT:
|
|
|
|
return; /* the urb is in unlink state */
|
2006-09-19 09:49:02 +04:00
|
|
|
case -ETIME:
|
2009-05-30 09:13:58 +04:00
|
|
|
if (printk_ratelimit())
|
|
|
|
dev_warn(&urb->dev->dev, "may be reset is needed?..\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
goto goon;
|
|
|
|
default:
|
2009-05-30 09:13:58 +04:00
|
|
|
if (printk_ratelimit())
|
|
|
|
dev_warn(&urb->dev->dev, "Rx status %d\n", status);
|
2005-04-17 02:20:36 +04:00
|
|
|
goto goon;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!dev->rx_skb)
|
|
|
|
goto resched;
|
|
|
|
/* protect against short packets (tell me why we got some?!?) */
|
|
|
|
if (urb->actual_length < 4)
|
|
|
|
goto goon;
|
|
|
|
|
|
|
|
res = urb->actual_length;
|
|
|
|
pkt_len = res - 4;
|
|
|
|
|
|
|
|
skb_put(dev->rx_skb, pkt_len);
|
|
|
|
dev->rx_skb->protocol = eth_type_trans(dev->rx_skb, netdev);
|
|
|
|
netif_rx(dev->rx_skb);
|
2009-03-20 22:35:50 +03:00
|
|
|
netdev->stats.rx_packets++;
|
|
|
|
netdev->stats.rx_bytes += pkt_len;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2018-06-20 22:31:21 +03:00
|
|
|
spin_lock_irqsave(&dev->rx_pool_lock, flags);
|
2005-04-17 02:20:36 +04:00
|
|
|
skb = pull_skb(dev);
|
2018-06-20 22:31:21 +03:00
|
|
|
spin_unlock_irqrestore(&dev->rx_pool_lock, flags);
|
2005-04-17 02:20:36 +04:00
|
|
|
if (!skb)
|
|
|
|
goto resched;
|
|
|
|
|
|
|
|
dev->rx_skb = skb;
|
|
|
|
goon:
|
|
|
|
usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
|
|
|
|
dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
|
2008-12-19 10:00:59 +03:00
|
|
|
result = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
|
|
|
|
if (result == -ENODEV)
|
2006-07-25 14:39:14 +04:00
|
|
|
netif_device_detach(dev->netdev);
|
2008-12-19 10:00:59 +03:00
|
|
|
else if (result) {
|
2005-04-17 02:20:36 +04:00
|
|
|
set_bit(RX_URB_FAIL, &dev->flags);
|
|
|
|
goto resched;
|
|
|
|
} else {
|
|
|
|
clear_bit(RX_URB_FAIL, &dev->flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
resched:
|
|
|
|
tasklet_schedule(&dev->tl);
|
|
|
|
}
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 17:55:46 +04:00
|
|
|
static void write_bulk_callback(struct urb *urb)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
rtl8150_t *dev;
|
2008-12-19 10:00:59 +03:00
|
|
|
int status = urb->status;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dev = urb->context;
|
|
|
|
if (!dev)
|
|
|
|
return;
|
|
|
|
dev_kfree_skb_irq(dev->tx_skb);
|
|
|
|
if (!netif_device_present(dev->netdev))
|
|
|
|
return;
|
2008-12-19 10:00:59 +03:00
|
|
|
if (status)
|
2008-08-19 00:21:04 +04:00
|
|
|
dev_info(&urb->dev->dev, "%s: Tx status %d\n",
|
2008-12-19 10:00:59 +03:00
|
|
|
dev->netdev->name, status);
|
2016-05-03 17:33:13 +03:00
|
|
|
netif_trans_update(dev->netdev);
|
2005-04-17 02:20:36 +04:00
|
|
|
netif_wake_queue(dev->netdev);
|
|
|
|
}
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 17:55:46 +04:00
|
|
|
static void intr_callback(struct urb *urb)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
rtl8150_t *dev;
|
|
|
|
__u8 *d;
|
2008-12-19 10:00:59 +03:00
|
|
|
int status = urb->status;
|
|
|
|
int res;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
dev = urb->context;
|
|
|
|
if (!dev)
|
|
|
|
return;
|
2008-12-19 10:00:59 +03:00
|
|
|
switch (status) {
|
2005-04-17 02:20:36 +04:00
|
|
|
case 0: /* success */
|
|
|
|
break;
|
|
|
|
case -ECONNRESET: /* unlink */
|
|
|
|
case -ENOENT:
|
|
|
|
case -ESHUTDOWN:
|
|
|
|
return;
|
|
|
|
/* -EPIPE: should clear the halt */
|
|
|
|
default:
|
2008-08-19 00:21:04 +04:00
|
|
|
dev_info(&urb->dev->dev, "%s: intr status %d\n",
|
2008-12-19 10:00:59 +03:00
|
|
|
dev->netdev->name, status);
|
2005-04-17 02:20:36 +04:00
|
|
|
goto resubmit;
|
|
|
|
}
|
|
|
|
|
|
|
|
d = urb->transfer_buffer;
|
|
|
|
if (d[0] & TSR_ERRORS) {
|
2009-03-20 22:35:50 +03:00
|
|
|
dev->netdev->stats.tx_errors++;
|
2005-04-17 02:20:36 +04:00
|
|
|
if (d[INT_TSR] & (TSR_ECOL | TSR_JBR))
|
2009-03-20 22:35:50 +03:00
|
|
|
dev->netdev->stats.tx_aborted_errors++;
|
2005-04-17 02:20:36 +04:00
|
|
|
if (d[INT_TSR] & TSR_LCOL)
|
2009-03-20 22:35:50 +03:00
|
|
|
dev->netdev->stats.tx_window_errors++;
|
2005-04-17 02:20:36 +04:00
|
|
|
if (d[INT_TSR] & TSR_LOSS_CRS)
|
2009-03-20 22:35:50 +03:00
|
|
|
dev->netdev->stats.tx_carrier_errors++;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
/* Report link status changes to the network stack */
|
|
|
|
if ((d[INT_MSR] & MSR_LINK) == 0) {
|
|
|
|
if (netif_carrier_ok(dev->netdev)) {
|
|
|
|
netif_carrier_off(dev->netdev);
|
2012-09-19 13:46:14 +04:00
|
|
|
netdev_dbg(dev->netdev, "%s: LINK LOST\n", __func__);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!netif_carrier_ok(dev->netdev)) {
|
|
|
|
netif_carrier_on(dev->netdev);
|
2012-09-19 13:46:14 +04:00
|
|
|
netdev_dbg(dev->netdev, "%s: LINK CAME BACK\n", __func__);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resubmit:
|
2008-12-19 10:00:59 +03:00
|
|
|
res = usb_submit_urb (urb, GFP_ATOMIC);
|
|
|
|
if (res == -ENODEV)
|
2006-07-25 14:39:14 +04:00
|
|
|
netif_device_detach(dev->netdev);
|
2008-12-19 10:00:59 +03:00
|
|
|
else if (res)
|
2012-04-25 23:37:49 +04:00
|
|
|
dev_err(&dev->udev->dev,
|
|
|
|
"can't resubmit intr, %s-%s/input0, status %d\n",
|
|
|
|
dev->udev->bus->bus_name, dev->udev->devpath, res);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2006-07-25 14:39:14 +04:00
|
|
|
static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message)
|
|
|
|
{
|
|
|
|
rtl8150_t *dev = usb_get_intfdata(intf);
|
|
|
|
|
|
|
|
netif_device_detach(dev->netdev);
|
|
|
|
|
|
|
|
if (netif_running(dev->netdev)) {
|
|
|
|
usb_kill_urb(dev->rx_urb);
|
|
|
|
usb_kill_urb(dev->intr_urb);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtl8150_resume(struct usb_interface *intf)
|
|
|
|
{
|
|
|
|
rtl8150_t *dev = usb_get_intfdata(intf);
|
|
|
|
|
|
|
|
netif_device_attach(dev->netdev);
|
|
|
|
if (netif_running(dev->netdev)) {
|
|
|
|
dev->rx_urb->status = 0;
|
|
|
|
dev->rx_urb->actual_length = 0;
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 17:55:46 +04:00
|
|
|
read_bulk_callback(dev->rx_urb);
|
2006-07-25 14:39:14 +04:00
|
|
|
|
|
|
|
dev->intr_urb->status = 0;
|
|
|
|
dev->intr_urb->actual_length = 0;
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 17:55:46 +04:00
|
|
|
intr_callback(dev->intr_urb);
|
2006-07-25 14:39:14 +04:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
**
|
|
|
|
** network related part of the code
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void fill_skb_pool(rtl8150_t *dev)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
|
|
|
|
if (dev->rx_skb_pool[i])
|
|
|
|
continue;
|
|
|
|
skb = dev_alloc_skb(RTL8150_MTU + 2);
|
|
|
|
if (!skb) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
skb_reserve(skb, 2);
|
|
|
|
dev->rx_skb_pool[i] = skb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_skb_pool(rtl8150_t *dev)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < RX_SKB_POOL_SIZE; i++)
|
2019-08-21 23:16:02 +03:00
|
|
|
dev_kfree_skb(dev->rx_skb_pool[i]);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2021-01-31 02:47:30 +03:00
|
|
|
static void rx_fixup(struct tasklet_struct *t)
|
2011-09-30 04:38:29 +04:00
|
|
|
{
|
2021-01-31 02:47:30 +03:00
|
|
|
struct rtl8150 *dev = from_tasklet(dev, t, tl);
|
2011-09-30 04:38:29 +04:00
|
|
|
struct sk_buff *skb;
|
|
|
|
int status;
|
|
|
|
|
|
|
|
spin_lock_irq(&dev->rx_pool_lock);
|
|
|
|
fill_skb_pool(dev);
|
|
|
|
spin_unlock_irq(&dev->rx_pool_lock);
|
|
|
|
if (test_bit(RX_URB_FAIL, &dev->flags))
|
|
|
|
if (dev->rx_skb)
|
|
|
|
goto try_again;
|
|
|
|
spin_lock_irq(&dev->rx_pool_lock);
|
|
|
|
skb = pull_skb(dev);
|
|
|
|
spin_unlock_irq(&dev->rx_pool_lock);
|
|
|
|
if (skb == NULL)
|
|
|
|
goto tlsched;
|
|
|
|
dev->rx_skb = skb;
|
|
|
|
usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
|
|
|
|
dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
|
|
|
|
try_again:
|
|
|
|
status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
|
|
|
|
if (status == -ENODEV) {
|
|
|
|
netif_device_detach(dev->netdev);
|
|
|
|
} else if (status) {
|
|
|
|
set_bit(RX_URB_FAIL, &dev->flags);
|
|
|
|
goto tlsched;
|
|
|
|
} else {
|
|
|
|
clear_bit(RX_URB_FAIL, &dev->flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
tlsched:
|
|
|
|
tasklet_schedule(&dev->tl);
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
static int enable_net_traffic(rtl8150_t * dev)
|
|
|
|
{
|
|
|
|
u8 cr, tcr, rcr, msr;
|
|
|
|
|
|
|
|
if (!rtl8150_reset(dev)) {
|
2008-08-14 20:37:34 +04:00
|
|
|
dev_warn(&dev->udev->dev, "device reset failed\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
/* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */
|
|
|
|
rcr = 0x9e;
|
|
|
|
tcr = 0xd8;
|
|
|
|
cr = 0x0c;
|
|
|
|
if (!(rcr & 0x80))
|
|
|
|
set_bit(RTL8150_HW_CRC, &dev->flags);
|
|
|
|
set_registers(dev, RCR, 1, &rcr);
|
|
|
|
set_registers(dev, TCR, 1, &tcr);
|
|
|
|
set_registers(dev, CR, 1, &cr);
|
|
|
|
get_registers(dev, MSR, 1, &msr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void disable_net_traffic(rtl8150_t * dev)
|
|
|
|
{
|
|
|
|
u8 cr;
|
|
|
|
|
|
|
|
get_registers(dev, CR, 1, &cr);
|
|
|
|
cr &= 0xf3;
|
|
|
|
set_registers(dev, CR, 1, &cr);
|
|
|
|
}
|
|
|
|
|
netdev: pass the stuck queue to the timeout handler
This allows incrementing the correct timeout statistic without any mess.
Down the road, devices can learn to reset just the specific queue.
The patch was generated with the following script:
use strict;
use warnings;
our $^I = '.bak';
my @work = (
["arch/m68k/emu/nfeth.c", "nfeth_tx_timeout"],
["arch/um/drivers/net_kern.c", "uml_net_tx_timeout"],
["arch/um/drivers/vector_kern.c", "vector_net_tx_timeout"],
["arch/xtensa/platforms/iss/network.c", "iss_net_tx_timeout"],
["drivers/char/pcmcia/synclink_cs.c", "hdlcdev_tx_timeout"],
["drivers/infiniband/ulp/ipoib/ipoib_main.c", "ipoib_timeout"],
["drivers/infiniband/ulp/ipoib/ipoib_main.c", "ipoib_timeout"],
["drivers/message/fusion/mptlan.c", "mpt_lan_tx_timeout"],
["drivers/misc/sgi-xp/xpnet.c", "xpnet_dev_tx_timeout"],
["drivers/net/appletalk/cops.c", "cops_timeout"],
["drivers/net/arcnet/arcdevice.h", "arcnet_timeout"],
["drivers/net/arcnet/arcnet.c", "arcnet_timeout"],
["drivers/net/arcnet/com20020.c", "arcnet_timeout"],
["drivers/net/ethernet/3com/3c509.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c515.c", "corkscrew_timeout"],
["drivers/net/ethernet/3com/3c574_cs.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c589_cs.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c59x.c", "vortex_tx_timeout"],
["drivers/net/ethernet/3com/3c59x.c", "vortex_tx_timeout"],
["drivers/net/ethernet/3com/typhoon.c", "typhoon_tx_timeout"],
["drivers/net/ethernet/8390/8390.h", "ei_tx_timeout"],
["drivers/net/ethernet/8390/8390.h", "eip_tx_timeout"],
["drivers/net/ethernet/8390/8390.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/8390p.c", "eip_tx_timeout"],
["drivers/net/ethernet/8390/ax88796.c", "ax_ei_tx_timeout"],
["drivers/net/ethernet/8390/axnet_cs.c", "axnet_tx_timeout"],
["drivers/net/ethernet/8390/etherh.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/hydra.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/mac8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/mcf8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/lib8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/ne2k-pci.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/pcnet_cs.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/smc-ultra.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/wd.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/zorro8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/adaptec/starfire.c", "tx_timeout"],
["drivers/net/ethernet/agere/et131x.c", "et131x_tx_timeout"],
["drivers/net/ethernet/allwinner/sun4i-emac.c", "emac_timeout"],
["drivers/net/ethernet/alteon/acenic.c", "ace_watchdog"],
["drivers/net/ethernet/amazon/ena/ena_netdev.c", "ena_tx_timeout"],
["drivers/net/ethernet/amd/7990.h", "lance_tx_timeout"],
["drivers/net/ethernet/amd/7990.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/a2065.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/am79c961a.c", "am79c961_timeout"],
["drivers/net/ethernet/amd/amd8111e.c", "amd8111e_tx_timeout"],
["drivers/net/ethernet/amd/ariadne.c", "ariadne_tx_timeout"],
["drivers/net/ethernet/amd/atarilance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/au1000_eth.c", "au1000_tx_timeout"],
["drivers/net/ethernet/amd/declance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/lance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/mvme147.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/ni65.c", "ni65_timeout"],
["drivers/net/ethernet/amd/nmclan_cs.c", "mace_tx_timeout"],
["drivers/net/ethernet/amd/pcnet32.c", "pcnet32_tx_timeout"],
["drivers/net/ethernet/amd/sunlance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/xgbe/xgbe-drv.c", "xgbe_tx_timeout"],
["drivers/net/ethernet/apm/xgene-v2/main.c", "xge_timeout"],
["drivers/net/ethernet/apm/xgene/xgene_enet_main.c", "xgene_enet_timeout"],
["drivers/net/ethernet/apple/macmace.c", "mace_tx_timeout"],
["drivers/net/ethernet/atheros/ag71xx.c", "ag71xx_tx_timeout"],
["drivers/net/ethernet/atheros/alx/main.c", "alx_tx_timeout"],
["drivers/net/ethernet/atheros/atl1c/atl1c_main.c", "atl1c_tx_timeout"],
["drivers/net/ethernet/atheros/atl1e/atl1e_main.c", "atl1e_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl.c", "atlx_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl1.c", "atlx_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl2.c", "atl2_tx_timeout"],
["drivers/net/ethernet/broadcom/b44.c", "b44_tx_timeout"],
["drivers/net/ethernet/broadcom/bcmsysport.c", "bcm_sysport_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2.c", "bnx2_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnxt/bnxt.c", "bnxt_tx_timeout"],
["drivers/net/ethernet/broadcom/genet/bcmgenet.c", "bcmgenet_timeout"],
["drivers/net/ethernet/broadcom/sb1250-mac.c", "sbmac_tx_timeout"],
["drivers/net/ethernet/broadcom/tg3.c", "tg3_tx_timeout"],
["drivers/net/ethernet/calxeda/xgmac.c", "xgmac_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_main.c", "liquidio_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_vf_main.c", "liquidio_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c", "lio_vf_rep_tx_timeout"],
["drivers/net/ethernet/cavium/thunder/nicvf_main.c", "nicvf_tx_timeout"],
["drivers/net/ethernet/cirrus/cs89x0.c", "net_timeout"],
["drivers/net/ethernet/cisco/enic/enic_main.c", "enic_tx_timeout"],
["drivers/net/ethernet/cisco/enic/enic_main.c", "enic_tx_timeout"],
["drivers/net/ethernet/cortina/gemini.c", "gmac_tx_timeout"],
["drivers/net/ethernet/davicom/dm9000.c", "dm9000_timeout"],
["drivers/net/ethernet/dec/tulip/de2104x.c", "de_tx_timeout"],
["drivers/net/ethernet/dec/tulip/tulip_core.c", "tulip_tx_timeout"],
["drivers/net/ethernet/dec/tulip/winbond-840.c", "tx_timeout"],
["drivers/net/ethernet/dlink/dl2k.c", "rio_tx_timeout"],
["drivers/net/ethernet/dlink/sundance.c", "tx_timeout"],
["drivers/net/ethernet/emulex/benet/be_main.c", "be_tx_timeout"],
["drivers/net/ethernet/ethoc.c", "ethoc_tx_timeout"],
["drivers/net/ethernet/faraday/ftgmac100.c", "ftgmac100_tx_timeout"],
["drivers/net/ethernet/fealnx.c", "fealnx_tx_timeout"],
["drivers/net/ethernet/freescale/dpaa/dpaa_eth.c", "dpaa_tx_timeout"],
["drivers/net/ethernet/freescale/fec_main.c", "fec_timeout"],
["drivers/net/ethernet/freescale/fec_mpc52xx.c", "mpc52xx_fec_tx_timeout"],
["drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c", "fs_timeout"],
["drivers/net/ethernet/freescale/gianfar.c", "gfar_timeout"],
["drivers/net/ethernet/freescale/ucc_geth.c", "ucc_geth_timeout"],
["drivers/net/ethernet/fujitsu/fmvj18x_cs.c", "fjn_tx_timeout"],
["drivers/net/ethernet/google/gve/gve_main.c", "gve_tx_timeout"],
["drivers/net/ethernet/hisilicon/hip04_eth.c", "hip04_timeout"],
["drivers/net/ethernet/hisilicon/hix5hd2_gmac.c", "hix5hd2_net_timeout"],
["drivers/net/ethernet/hisilicon/hns/hns_enet.c", "hns_nic_net_timeout"],
["drivers/net/ethernet/hisilicon/hns3/hns3_enet.c", "hns3_nic_net_timeout"],
["drivers/net/ethernet/huawei/hinic/hinic_main.c", "hinic_tx_timeout"],
["drivers/net/ethernet/i825xx/82596.c", "i596_tx_timeout"],
["drivers/net/ethernet/i825xx/ether1.c", "ether1_timeout"],
["drivers/net/ethernet/i825xx/lib82596.c", "i596_tx_timeout"],
["drivers/net/ethernet/i825xx/sun3_82586.c", "sun3_82586_timeout"],
["drivers/net/ethernet/ibm/ehea/ehea_main.c", "ehea_tx_watchdog"],
["drivers/net/ethernet/ibm/emac/core.c", "emac_tx_timeout"],
["drivers/net/ethernet/ibm/emac/core.c", "emac_tx_timeout"],
["drivers/net/ethernet/ibm/ibmvnic.c", "ibmvnic_tx_timeout"],
["drivers/net/ethernet/intel/e100.c", "e100_tx_timeout"],
["drivers/net/ethernet/intel/e1000/e1000_main.c", "e1000_tx_timeout"],
["drivers/net/ethernet/intel/e1000e/netdev.c", "e1000_tx_timeout"],
["drivers/net/ethernet/intel/fm10k/fm10k_netdev.c", "fm10k_tx_timeout"],
["drivers/net/ethernet/intel/i40e/i40e_main.c", "i40e_tx_timeout"],
["drivers/net/ethernet/intel/iavf/iavf_main.c", "iavf_tx_timeout"],
["drivers/net/ethernet/intel/ice/ice_main.c", "ice_tx_timeout"],
["drivers/net/ethernet/intel/ice/ice_main.c", "ice_tx_timeout"],
["drivers/net/ethernet/intel/igb/igb_main.c", "igb_tx_timeout"],
["drivers/net/ethernet/intel/igbvf/netdev.c", "igbvf_tx_timeout"],
["drivers/net/ethernet/intel/ixgb/ixgb_main.c", "ixgb_tx_timeout"],
["drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c", "adapter->netdev->netdev_ops->ndo_tx_timeout(adapter->netdev);"],
["drivers/net/ethernet/intel/ixgbe/ixgbe_main.c", "ixgbe_tx_timeout"],
["drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c", "ixgbevf_tx_timeout"],
["drivers/net/ethernet/jme.c", "jme_tx_timeout"],
["drivers/net/ethernet/korina.c", "korina_tx_timeout"],
["drivers/net/ethernet/lantiq_etop.c", "ltq_etop_tx_timeout"],
["drivers/net/ethernet/marvell/mv643xx_eth.c", "mv643xx_eth_tx_timeout"],
["drivers/net/ethernet/marvell/pxa168_eth.c", "pxa168_eth_tx_timeout"],
["drivers/net/ethernet/marvell/skge.c", "skge_tx_timeout"],
["drivers/net/ethernet/marvell/sky2.c", "sky2_tx_timeout"],
["drivers/net/ethernet/marvell/sky2.c", "sky2_tx_timeout"],
["drivers/net/ethernet/mediatek/mtk_eth_soc.c", "mtk_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx4/en_netdev.c", "mlx4_en_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx4/en_netdev.c", "mlx4_en_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx5/core/en_main.c", "mlx5e_tx_timeout"],
["drivers/net/ethernet/micrel/ks8842.c", "ks8842_tx_timeout"],
["drivers/net/ethernet/micrel/ksz884x.c", "netdev_tx_timeout"],
["drivers/net/ethernet/microchip/enc28j60.c", "enc28j60_tx_timeout"],
["drivers/net/ethernet/microchip/encx24j600.c", "encx24j600_tx_timeout"],
["drivers/net/ethernet/natsemi/sonic.h", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/sonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/jazzsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/macsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/natsemi.c", "ns_tx_timeout"],
["drivers/net/ethernet/natsemi/ns83820.c", "ns83820_tx_timeout"],
["drivers/net/ethernet/natsemi/xtsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/neterion/s2io.h", "s2io_tx_watchdog"],
["drivers/net/ethernet/neterion/s2io.c", "s2io_tx_watchdog"],
["drivers/net/ethernet/neterion/vxge/vxge-main.c", "vxge_tx_watchdog"],
["drivers/net/ethernet/netronome/nfp/nfp_net_common.c", "nfp_net_tx_timeout"],
["drivers/net/ethernet/nvidia/forcedeth.c", "nv_tx_timeout"],
["drivers/net/ethernet/nvidia/forcedeth.c", "nv_tx_timeout"],
["drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c", "pch_gbe_tx_timeout"],
["drivers/net/ethernet/packetengines/hamachi.c", "hamachi_tx_timeout"],
["drivers/net/ethernet/packetengines/yellowfin.c", "yellowfin_tx_timeout"],
["drivers/net/ethernet/pensando/ionic/ionic_lif.c", "ionic_tx_timeout"],
["drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c", "netxen_tx_timeout"],
["drivers/net/ethernet/qlogic/qla3xxx.c", "ql3xxx_tx_timeout"],
["drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c", "qlcnic_tx_timeout"],
["drivers/net/ethernet/qualcomm/emac/emac.c", "emac_tx_timeout"],
["drivers/net/ethernet/qualcomm/qca_spi.c", "qcaspi_netdev_tx_timeout"],
["drivers/net/ethernet/qualcomm/qca_uart.c", "qcauart_netdev_tx_timeout"],
["drivers/net/ethernet/rdc/r6040.c", "r6040_tx_timeout"],
["drivers/net/ethernet/realtek/8139cp.c", "cp_tx_timeout"],
["drivers/net/ethernet/realtek/8139too.c", "rtl8139_tx_timeout"],
["drivers/net/ethernet/realtek/atp.c", "tx_timeout"],
["drivers/net/ethernet/realtek/r8169_main.c", "rtl8169_tx_timeout"],
["drivers/net/ethernet/renesas/ravb_main.c", "ravb_tx_timeout"],
["drivers/net/ethernet/renesas/sh_eth.c", "sh_eth_tx_timeout"],
["drivers/net/ethernet/renesas/sh_eth.c", "sh_eth_tx_timeout"],
["drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c", "sxgbe_tx_timeout"],
["drivers/net/ethernet/seeq/ether3.c", "ether3_timeout"],
["drivers/net/ethernet/seeq/sgiseeq.c", "timeout"],
["drivers/net/ethernet/sfc/efx.c", "efx_watchdog"],
["drivers/net/ethernet/sfc/falcon/efx.c", "ef4_watchdog"],
["drivers/net/ethernet/sgi/ioc3-eth.c", "ioc3_timeout"],
["drivers/net/ethernet/sgi/meth.c", "meth_tx_timeout"],
["drivers/net/ethernet/silan/sc92031.c", "sc92031_tx_timeout"],
["drivers/net/ethernet/sis/sis190.c", "sis190_tx_timeout"],
["drivers/net/ethernet/sis/sis900.c", "sis900_tx_timeout"],
["drivers/net/ethernet/smsc/epic100.c", "epic_tx_timeout"],
["drivers/net/ethernet/smsc/smc911x.c", "smc911x_timeout"],
["drivers/net/ethernet/smsc/smc9194.c", "smc_timeout"],
["drivers/net/ethernet/smsc/smc91c92_cs.c", "smc_tx_timeout"],
["drivers/net/ethernet/smsc/smc91x.c", "smc_timeout"],
["drivers/net/ethernet/stmicro/stmmac/stmmac_main.c", "stmmac_tx_timeout"],
["drivers/net/ethernet/sun/cassini.c", "cas_tx_timeout"],
["drivers/net/ethernet/sun/ldmvsw.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/niu.c", "niu_tx_timeout"],
["drivers/net/ethernet/sun/sunbmac.c", "bigmac_tx_timeout"],
["drivers/net/ethernet/sun/sungem.c", "gem_tx_timeout"],
["drivers/net/ethernet/sun/sunhme.c", "happy_meal_tx_timeout"],
["drivers/net/ethernet/sun/sunqe.c", "qe_tx_timeout"],
["drivers/net/ethernet/sun/sunvnet.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/sunvnet_common.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/sunvnet_common.h", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/synopsys/dwc-xlgmac-net.c", "xlgmac_tx_timeout"],
["drivers/net/ethernet/ti/cpmac.c", "cpmac_tx_timeout"],
["drivers/net/ethernet/ti/cpsw.c", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/cpsw_priv.c", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/cpsw_priv.h", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/davinci_emac.c", "emac_dev_tx_timeout"],
["drivers/net/ethernet/ti/netcp_core.c", "netcp_ndo_tx_timeout"],
["drivers/net/ethernet/ti/tlan.c", "tlan_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_net.h", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_net.c", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_wireless.c", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/spider_net.c", "spider_net_tx_timeout"],
["drivers/net/ethernet/toshiba/tc35815.c", "tc35815_tx_timeout"],
["drivers/net/ethernet/via/via-rhine.c", "rhine_tx_timeout"],
["drivers/net/ethernet/wiznet/w5100.c", "w5100_tx_timeout"],
["drivers/net/ethernet/wiznet/w5300.c", "w5300_tx_timeout"],
["drivers/net/ethernet/xilinx/xilinx_emaclite.c", "xemaclite_tx_timeout"],
["drivers/net/ethernet/xircom/xirc2ps_cs.c", "xirc_tx_timeout"],
["drivers/net/fjes/fjes_main.c", "fjes_tx_retry"],
["drivers/net/slip/slip.c", "sl_tx_timeout"],
["include/linux/usb/usbnet.h", "usbnet_tx_timeout"],
["drivers/net/usb/aqc111.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/ax88172a.c", "usbnet_tx_timeout"],
["drivers/net/usb/ax88179_178a.c", "usbnet_tx_timeout"],
["drivers/net/usb/catc.c", "catc_tx_timeout"],
["drivers/net/usb/cdc_mbim.c", "usbnet_tx_timeout"],
["drivers/net/usb/cdc_ncm.c", "usbnet_tx_timeout"],
["drivers/net/usb/dm9601.c", "usbnet_tx_timeout"],
["drivers/net/usb/hso.c", "hso_net_tx_timeout"],
["drivers/net/usb/int51x1.c", "usbnet_tx_timeout"],
["drivers/net/usb/ipheth.c", "ipheth_tx_timeout"],
["drivers/net/usb/kaweth.c", "kaweth_tx_timeout"],
["drivers/net/usb/lan78xx.c", "lan78xx_tx_timeout"],
["drivers/net/usb/mcs7830.c", "usbnet_tx_timeout"],
["drivers/net/usb/pegasus.c", "pegasus_tx_timeout"],
["drivers/net/usb/qmi_wwan.c", "usbnet_tx_timeout"],
["drivers/net/usb/r8152.c", "rtl8152_tx_timeout"],
["drivers/net/usb/rndis_host.c", "usbnet_tx_timeout"],
["drivers/net/usb/rtl8150.c", "rtl8150_tx_timeout"],
["drivers/net/usb/sierra_net.c", "usbnet_tx_timeout"],
["drivers/net/usb/smsc75xx.c", "usbnet_tx_timeout"],
["drivers/net/usb/smsc95xx.c", "usbnet_tx_timeout"],
["drivers/net/usb/sr9700.c", "usbnet_tx_timeout"],
["drivers/net/usb/sr9800.c", "usbnet_tx_timeout"],
["drivers/net/usb/usbnet.c", "usbnet_tx_timeout"],
["drivers/net/vmxnet3/vmxnet3_drv.c", "vmxnet3_tx_timeout"],
["drivers/net/wan/cosa.c", "cosa_net_timeout"],
["drivers/net/wan/farsync.c", "fst_tx_timeout"],
["drivers/net/wan/fsl_ucc_hdlc.c", "uhdlc_tx_timeout"],
["drivers/net/wan/lmc/lmc_main.c", "lmc_driver_timeout"],
["drivers/net/wan/x25_asy.c", "x25_asy_timeout"],
["drivers/net/wimax/i2400m/netdev.c", "i2400m_tx_timeout"],
["drivers/net/wireless/intel/ipw2x00/ipw2100.c", "ipw2100_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/main.c", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/orinoco_usb.c", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/orinoco.h", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_dev.c", "islpci_eth_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_eth.c", "islpci_eth_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_eth.h", "islpci_eth_tx_timeout"],
["drivers/net/wireless/marvell/mwifiex/main.c", "mwifiex_tx_timeout"],
["drivers/net/wireless/quantenna/qtnfmac/core.c", "qtnf_netdev_tx_timeout"],
["drivers/net/wireless/quantenna/qtnfmac/core.h", "qtnf_netdev_tx_timeout"],
["drivers/net/wireless/rndis_wlan.c", "usbnet_tx_timeout"],
["drivers/net/wireless/wl3501_cs.c", "wl3501_tx_timeout"],
["drivers/net/wireless/zydas/zd1201.c", "zd1201_tx_timeout"],
["drivers/s390/net/qeth_core.h", "qeth_tx_timeout"],
["drivers/s390/net/qeth_core_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l2_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l2_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l3_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l3_main.c", "qeth_tx_timeout"],
["drivers/staging/ks7010/ks_wlan_net.c", "ks_wlan_tx_timeout"],
["drivers/staging/qlge/qlge_main.c", "qlge_tx_timeout"],
["drivers/staging/rtl8192e/rtl8192e/rtl_core.c", "_rtl92e_tx_timeout"],
["drivers/staging/rtl8192u/r8192U_core.c", "tx_timeout"],
["drivers/staging/unisys/visornic/visornic_main.c", "visornic_xmit_timeout"],
["drivers/staging/wlan-ng/p80211netdev.c", "p80211knetdev_tx_timeout"],
["drivers/tty/n_gsm.c", "gsm_mux_net_tx_timeout"],
["drivers/tty/synclink.c", "hdlcdev_tx_timeout"],
["drivers/tty/synclink_gt.c", "hdlcdev_tx_timeout"],
["drivers/tty/synclinkmp.c", "hdlcdev_tx_timeout"],
["net/atm/lec.c", "lec_tx_timeout"],
["net/bluetooth/bnep/netdev.c", "bnep_net_timeout"]
);
for my $p (@work) {
my @pair = @$p;
my $file = $pair[0];
my $func = $pair[1];
print STDERR $file , ": ", $func,"\n";
our @ARGV = ($file);
while (<ARGV>) {
if (m/($func\s*\(struct\s+net_device\s+\*[A-Za-z_]?[A-Za-z-0-9_]*)(\))/) {
print STDERR "found $1+$2 in $file\n";
}
if (s/($func\s*\(struct\s+net_device\s+\*[A-Za-z_]?[A-Za-z-0-9_]*)(\))/$1, unsigned int txqueue$2/) {
print STDERR "$func found in $file\n";
}
print;
}
}
where the list of files and functions is simply from:
git grep ndo_tx_timeout, with manual addition of headers
in the rare cases where the function is from a header,
then manually changing the few places which actually
call ndo_tx_timeout.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Shannon Nelson <snelson@pensando.io>
Reviewed-by: Martin Habets <mhabets@solarflare.com>
changes from v9:
fixup a forward declaration
changes from v9:
more leftovers from v3 change
changes from v8:
fix up a missing direct call to timeout
rebased on net-next
changes from v7:
fixup leftovers from v3 change
changes from v6:
fix typo in rtl driver
changes from v5:
add missing files (allow any net device argument name)
changes from v4:
add a missing driver header
changes from v3:
change queue # to unsigned
Changes from v2:
added headers
Changes from v1:
Fix errors found by kbuild:
generalize the pattern a bit, to pick up
a couple of instances missed by the previous
version.
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-10 17:23:51 +03:00
|
|
|
static void rtl8150_tx_timeout(struct net_device *netdev, unsigned int txqueue)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
2008-08-14 20:37:34 +04:00
|
|
|
dev_warn(&netdev->dev, "Tx timeout.\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
usb_unlink_urb(dev->tx_urb);
|
2009-03-20 22:35:50 +03:00
|
|
|
netdev->stats.tx_errors++;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rtl8150_set_multicast(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
2013-05-20 03:08:47 +04:00
|
|
|
u16 rx_creg = 0x9e;
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
netif_stop_queue(netdev);
|
|
|
|
if (netdev->flags & IFF_PROMISC) {
|
2013-05-20 03:08:47 +04:00
|
|
|
rx_creg |= 0x0001;
|
2008-08-19 00:21:04 +04:00
|
|
|
dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name);
|
2010-02-08 07:30:35 +03:00
|
|
|
} else if (!netdev_mc_empty(netdev) ||
|
2005-04-17 02:20:36 +04:00
|
|
|
(netdev->flags & IFF_ALLMULTI)) {
|
2013-05-20 03:08:47 +04:00
|
|
|
rx_creg &= 0xfffe;
|
|
|
|
rx_creg |= 0x0002;
|
2018-07-17 01:58:10 +03:00
|
|
|
dev_dbg(&netdev->dev, "%s: allmulti set\n", netdev->name);
|
2005-04-17 02:20:36 +04:00
|
|
|
} else {
|
|
|
|
/* ~RX_MULTICAST, ~RX_PROMISCUOUS */
|
2013-05-20 03:08:47 +04:00
|
|
|
rx_creg &= 0x00fc;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
2013-05-20 03:08:47 +04:00
|
|
|
async_set_registers(dev, RCR, sizeof(rx_creg), rx_creg);
|
2005-04-17 02:20:36 +04:00
|
|
|
netif_wake_queue(netdev);
|
|
|
|
}
|
|
|
|
|
2009-08-31 23:50:45 +04:00
|
|
|
static netdev_tx_t rtl8150_start_xmit(struct sk_buff *skb,
|
|
|
|
struct net_device *netdev)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
|
|
|
int count, res;
|
|
|
|
|
|
|
|
netif_stop_queue(netdev);
|
|
|
|
count = (skb->len < 60) ? 60 : skb->len;
|
|
|
|
count = (count & 0x3f) ? count : count + 1;
|
|
|
|
dev->tx_skb = skb;
|
|
|
|
usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2),
|
|
|
|
skb->data, count, write_bulk_callback, dev);
|
|
|
|
if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) {
|
2006-07-25 14:39:14 +04:00
|
|
|
/* Can we get/handle EPIPE here? */
|
|
|
|
if (res == -ENODEV)
|
|
|
|
netif_device_detach(dev->netdev);
|
|
|
|
else {
|
2008-08-14 20:37:34 +04:00
|
|
|
dev_warn(&netdev->dev, "failed tx_urb %d\n", res);
|
2009-03-20 22:35:50 +03:00
|
|
|
netdev->stats.tx_errors++;
|
2006-07-25 14:39:14 +04:00
|
|
|
netif_start_queue(netdev);
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
} else {
|
2009-03-20 22:35:50 +03:00
|
|
|
netdev->stats.tx_packets++;
|
|
|
|
netdev->stats.tx_bytes += skb->len;
|
2016-05-03 17:33:13 +03:00
|
|
|
netif_trans_update(netdev);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2009-06-23 10:03:08 +04:00
|
|
|
return NETDEV_TX_OK;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void set_carrier(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
|
|
|
short tmp;
|
|
|
|
|
|
|
|
get_registers(dev, CSCR, 2, &tmp);
|
|
|
|
if (tmp & CSCR_LINK_STATUS)
|
|
|
|
netif_carrier_on(netdev);
|
|
|
|
else
|
|
|
|
netif_carrier_off(netdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtl8150_open(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (dev->rx_skb == NULL)
|
|
|
|
dev->rx_skb = pull_skb(dev);
|
|
|
|
if (!dev->rx_skb)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
set_registers(dev, IDR, 6, netdev->dev_addr);
|
2011-09-30 04:38:29 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
|
|
|
|
dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
|
2006-07-25 14:39:14 +04:00
|
|
|
if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) {
|
|
|
|
if (res == -ENODEV)
|
|
|
|
netif_device_detach(dev->netdev);
|
2008-08-14 20:37:34 +04:00
|
|
|
dev_warn(&netdev->dev, "rx_urb submit failed: %d\n", res);
|
2006-07-25 14:39:14 +04:00
|
|
|
return res;
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3),
|
|
|
|
dev->intr_buff, INTBUFSIZE, intr_callback,
|
|
|
|
dev, dev->intr_interval);
|
2006-07-25 14:39:14 +04:00
|
|
|
if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL))) {
|
|
|
|
if (res == -ENODEV)
|
|
|
|
netif_device_detach(dev->netdev);
|
2008-08-14 20:37:34 +04:00
|
|
|
dev_warn(&netdev->dev, "intr_urb submit failed: %d\n", res);
|
2006-07-25 14:39:14 +04:00
|
|
|
usb_kill_urb(dev->rx_urb);
|
|
|
|
return res;
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
enable_net_traffic(dev);
|
|
|
|
set_carrier(netdev);
|
2006-07-25 14:39:14 +04:00
|
|
|
netif_start_queue(netdev);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtl8150_close(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
|
|
|
|
|
|
|
netif_stop_queue(netdev);
|
|
|
|
if (!test_bit(RTL8150_UNPLUG, &dev->flags))
|
|
|
|
disable_net_traffic(dev);
|
|
|
|
unlink_all_urbs(dev);
|
|
|
|
|
2014-11-18 19:25:21 +03:00
|
|
|
return 0;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info)
|
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
|
|
|
|
2013-01-06 04:44:26 +04:00
|
|
|
strlcpy(info->driver, driver_name, sizeof(info->driver));
|
|
|
|
strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
|
|
|
|
usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info));
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2017-03-13 01:16:25 +03:00
|
|
|
static int rtl8150_get_link_ksettings(struct net_device *netdev,
|
|
|
|
struct ethtool_link_ksettings *ecmd)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
|
|
|
short lpa, bmcr;
|
2017-03-13 01:16:25 +03:00
|
|
|
u32 supported;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2017-03-13 01:16:25 +03:00
|
|
|
supported = (SUPPORTED_10baseT_Half |
|
2005-04-17 02:20:36 +04:00
|
|
|
SUPPORTED_10baseT_Full |
|
|
|
|
SUPPORTED_100baseT_Half |
|
|
|
|
SUPPORTED_100baseT_Full |
|
|
|
|
SUPPORTED_Autoneg |
|
|
|
|
SUPPORTED_TP | SUPPORTED_MII);
|
2017-03-13 01:16:25 +03:00
|
|
|
ecmd->base.port = PORT_TP;
|
|
|
|
ecmd->base.phy_address = dev->phy;
|
2005-04-17 02:20:36 +04:00
|
|
|
get_registers(dev, BMCR, 2, &bmcr);
|
|
|
|
get_registers(dev, ANLP, 2, &lpa);
|
|
|
|
if (bmcr & BMCR_ANENABLE) {
|
2011-04-27 22:32:40 +04:00
|
|
|
u32 speed = ((lpa & (LPA_100HALF | LPA_100FULL)) ?
|
|
|
|
SPEED_100 : SPEED_10);
|
2017-03-13 01:16:25 +03:00
|
|
|
ecmd->base.speed = speed;
|
|
|
|
ecmd->base.autoneg = AUTONEG_ENABLE;
|
2011-04-27 22:32:40 +04:00
|
|
|
if (speed == SPEED_100)
|
2017-03-13 01:16:25 +03:00
|
|
|
ecmd->base.duplex = (lpa & LPA_100FULL) ?
|
2005-04-17 02:20:36 +04:00
|
|
|
DUPLEX_FULL : DUPLEX_HALF;
|
|
|
|
else
|
2017-03-13 01:16:25 +03:00
|
|
|
ecmd->base.duplex = (lpa & LPA_10FULL) ?
|
2005-04-17 02:20:36 +04:00
|
|
|
DUPLEX_FULL : DUPLEX_HALF;
|
|
|
|
} else {
|
2017-03-13 01:16:25 +03:00
|
|
|
ecmd->base.autoneg = AUTONEG_DISABLE;
|
|
|
|
ecmd->base.speed = ((bmcr & BMCR_SPEED100) ?
|
|
|
|
SPEED_100 : SPEED_10);
|
|
|
|
ecmd->base.duplex = (bmcr & BMCR_FULLDPLX) ?
|
2005-04-17 02:20:36 +04:00
|
|
|
DUPLEX_FULL : DUPLEX_HALF;
|
|
|
|
}
|
2017-03-13 01:16:25 +03:00
|
|
|
|
|
|
|
ethtool_convert_legacy_u32_to_link_mode(ecmd->link_modes.supported,
|
|
|
|
supported);
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-09-02 12:03:33 +04:00
|
|
|
static const struct ethtool_ops ops = {
|
2005-04-17 02:20:36 +04:00
|
|
|
.get_drvinfo = rtl8150_get_drvinfo,
|
2017-03-13 01:16:25 +03:00
|
|
|
.get_link = ethtool_op_get_link,
|
|
|
|
.get_link_ksettings = rtl8150_get_link_ksettings,
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2021-07-27 16:45:00 +03:00
|
|
|
static int rtl8150_siocdevprivate(struct net_device *netdev, struct ifreq *rq,
|
|
|
|
void __user *udata, int cmd)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
rtl8150_t *dev = netdev_priv(netdev);
|
|
|
|
u16 *data = (u16 *) & rq->ifr_ifru;
|
|
|
|
int res = 0;
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case SIOCDEVPRIVATE:
|
|
|
|
data[0] = dev->phy;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2005-04-17 02:20:36 +04:00
|
|
|
case SIOCDEVPRIVATE + 1:
|
|
|
|
read_mii_word(dev, dev->phy, (data[1] & 0x1f), &data[3]);
|
|
|
|
break;
|
|
|
|
case SIOCDEVPRIVATE + 2:
|
|
|
|
if (!capable(CAP_NET_ADMIN))
|
|
|
|
return -EPERM;
|
|
|
|
write_mii_word(dev, dev->phy, (data[1] & 0x1f), data[2]);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2009-03-20 22:35:51 +03:00
|
|
|
static const struct net_device_ops rtl8150_netdev_ops = {
|
|
|
|
.ndo_open = rtl8150_open,
|
|
|
|
.ndo_stop = rtl8150_close,
|
2021-07-27 16:45:00 +03:00
|
|
|
.ndo_siocdevprivate = rtl8150_siocdevprivate,
|
2009-03-20 22:35:51 +03:00
|
|
|
.ndo_start_xmit = rtl8150_start_xmit,
|
2011-09-30 04:38:29 +04:00
|
|
|
.ndo_tx_timeout = rtl8150_tx_timeout,
|
2011-08-16 10:29:01 +04:00
|
|
|
.ndo_set_rx_mode = rtl8150_set_multicast,
|
2009-03-20 22:35:51 +03:00
|
|
|
.ndo_set_mac_address = rtl8150_set_mac_address,
|
|
|
|
|
|
|
|
.ndo_validate_addr = eth_validate_addr,
|
|
|
|
};
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
static int rtl8150_probe(struct usb_interface *intf,
|
|
|
|
const struct usb_device_id *id)
|
|
|
|
{
|
|
|
|
struct usb_device *udev = interface_to_usbdev(intf);
|
|
|
|
rtl8150_t *dev;
|
|
|
|
struct net_device *netdev;
|
|
|
|
|
|
|
|
netdev = alloc_etherdev(sizeof(rtl8150_t));
|
2012-01-29 17:47:52 +04:00
|
|
|
if (!netdev)
|
2005-04-17 02:20:36 +04:00
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
dev = netdev_priv(netdev);
|
|
|
|
|
|
|
|
dev->intr_buff = kmalloc(INTBUFSIZE, GFP_KERNEL);
|
|
|
|
if (!dev->intr_buff) {
|
|
|
|
free_netdev(netdev);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2021-01-31 02:47:30 +03:00
|
|
|
tasklet_setup(&dev->tl, rx_fixup);
|
2005-04-17 02:20:36 +04:00
|
|
|
spin_lock_init(&dev->rx_pool_lock);
|
2011-09-30 04:38:29 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
dev->udev = udev;
|
|
|
|
dev->netdev = netdev;
|
2009-03-20 22:35:51 +03:00
|
|
|
netdev->netdev_ops = &rtl8150_netdev_ops;
|
2005-04-17 02:20:36 +04:00
|
|
|
netdev->watchdog_timeo = RTL8150_TX_TIMEOUT;
|
2014-05-11 04:12:32 +04:00
|
|
|
netdev->ethtool_ops = &ops;
|
2005-04-17 02:20:36 +04:00
|
|
|
dev->intr_interval = 100; /* 100ms */
|
|
|
|
|
|
|
|
if (!alloc_all_urbs(dev)) {
|
2012-04-25 23:37:49 +04:00
|
|
|
dev_err(&intf->dev, "out of memory\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (!rtl8150_reset(dev)) {
|
2012-04-25 23:37:49 +04:00
|
|
|
dev_err(&intf->dev, "couldn't reset the device\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
goto out1;
|
|
|
|
}
|
|
|
|
fill_skb_pool(dev);
|
|
|
|
set_ethernet_addr(dev);
|
2011-09-30 04:38:29 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
usb_set_intfdata(intf, dev);
|
|
|
|
SET_NETDEV_DEV(netdev, &intf->dev);
|
|
|
|
if (register_netdev(netdev) != 0) {
|
2012-04-25 23:37:49 +04:00
|
|
|
dev_err(&intf->dev, "couldn't register the device\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
goto out2;
|
|
|
|
}
|
2006-03-15 17:29:38 +03:00
|
|
|
|
2008-08-19 00:21:04 +04:00
|
|
|
dev_info(&intf->dev, "%s: rtl8150 is detected\n", netdev->name);
|
2006-03-15 17:29:38 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
out2:
|
|
|
|
usb_set_intfdata(intf, NULL);
|
|
|
|
free_skb_pool(dev);
|
|
|
|
out1:
|
|
|
|
free_all_urbs(dev);
|
|
|
|
out:
|
|
|
|
kfree(dev->intr_buff);
|
|
|
|
free_netdev(netdev);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rtl8150_disconnect(struct usb_interface *intf)
|
|
|
|
{
|
|
|
|
rtl8150_t *dev = usb_get_intfdata(intf);
|
|
|
|
|
|
|
|
usb_set_intfdata(intf, NULL);
|
|
|
|
if (dev) {
|
|
|
|
set_bit(RTL8150_UNPLUG, &dev->flags);
|
2006-08-15 10:11:09 +04:00
|
|
|
tasklet_kill(&dev->tl);
|
2005-04-17 02:20:36 +04:00
|
|
|
unregister_netdev(dev->netdev);
|
|
|
|
unlink_all_urbs(dev);
|
|
|
|
free_all_urbs(dev);
|
|
|
|
free_skb_pool(dev);
|
2019-08-21 23:16:02 +03:00
|
|
|
dev_kfree_skb(dev->rx_skb);
|
2005-04-17 02:20:36 +04:00
|
|
|
kfree(dev->intr_buff);
|
|
|
|
free_netdev(dev->netdev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-30 04:38:29 +04:00
|
|
|
static struct usb_driver rtl8150_driver = {
|
|
|
|
.name = driver_name,
|
|
|
|
.probe = rtl8150_probe,
|
|
|
|
.disconnect = rtl8150_disconnect,
|
|
|
|
.id_table = rtl8150_table,
|
|
|
|
.suspend = rtl8150_suspend,
|
2012-04-23 21:08:51 +04:00
|
|
|
.resume = rtl8150_resume,
|
|
|
|
.disable_hub_initiated_lpm = 1,
|
2011-09-30 04:38:29 +04:00
|
|
|
};
|
|
|
|
|
2011-11-18 21:44:20 +04:00
|
|
|
module_usb_driver(rtl8150_driver);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
MODULE_AUTHOR(DRIVER_AUTHOR);
|
|
|
|
MODULE_DESCRIPTION(DRIVER_DESC);
|
|
|
|
MODULE_LICENSE("GPL");
|