usbnet.c (8ecee4620e76aae418bfa0e8cc830e92cb559bbb) usbnet.c (03ad032bb78b2732b607ed198e951240e1d21e59)
1/*
2 * USB Network driver infrastructure
3 * Copyright (C) 2000-2005 by David Brownell
4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

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

32
33// #define DEBUG // error path messages, extra info
34// #define VERBOSE // more; success messages
35
36#include <linux/module.h>
37#include <linux/init.h>
38#include <linux/netdevice.h>
39#include <linux/etherdevice.h>
1/*
2 * USB Network driver infrastructure
3 * Copyright (C) 2000-2005 by David Brownell
4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

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

32
33// #define DEBUG // error path messages, extra info
34// #define VERBOSE // more; success messages
35
36#include <linux/module.h>
37#include <linux/init.h>
38#include <linux/netdevice.h>
39#include <linux/etherdevice.h>
40#include <linux/ctype.h>
40#include <linux/ethtool.h>
41#include <linux/workqueue.h>
42#include <linux/mii.h>
43#include <linux/usb.h>
44#include <linux/usb/usbnet.h>
45
46#define DRIVER_VERSION "22-Aug-2005"
47

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

151 in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
152 dev->out = usb_sndbulkpipe (dev->udev,
153 out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
154 dev->status = status;
155 return 0;
156}
157EXPORT_SYMBOL_GPL(usbnet_get_endpoints);
158
41#include <linux/ethtool.h>
42#include <linux/workqueue.h>
43#include <linux/mii.h>
44#include <linux/usb.h>
45#include <linux/usb/usbnet.h>
46
47#define DRIVER_VERSION "22-Aug-2005"
48

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

152 in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
153 dev->out = usb_sndbulkpipe (dev->udev,
154 out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
155 dev->status = status;
156 return 0;
157}
158EXPORT_SYMBOL_GPL(usbnet_get_endpoints);
159
160static u8 nibble(unsigned char c)
161{
162 if (likely(isdigit(c)))
163 return c - '0';
164 c = toupper(c);
165 if (likely(isxdigit(c)))
166 return 10 + c - 'A';
167 return 0;
168}
169
170int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress)
171{
172 int tmp, i;
173 unsigned char buf [13];
174
175 tmp = usb_string(dev->udev, iMACAddress, buf, sizeof buf);
176 if (tmp != 12) {
177 dev_dbg(&dev->udev->dev,
178 "bad MAC string %d fetch, %d\n", iMACAddress, tmp);
179 if (tmp >= 0)
180 tmp = -EINVAL;
181 return tmp;
182 }
183 for (i = tmp = 0; i < 6; i++, tmp += 2)
184 dev->net->dev_addr [i] =
185 (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]);
186 return 0;
187}
188EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr);
189
159static void intr_complete (struct urb *urb);
160
161static int init_status (struct usbnet *dev, struct usb_interface *intf)
162{
163 char *buf = NULL;
164 unsigned pipe = 0;
165 unsigned maxp;
166 unsigned period;

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

1180#if 0
1181// dma_supported() is deeply broken on almost all architectures
1182 // possible with some EHCI controllers
1183 if (dma_supported (&udev->dev, DMA_BIT_MASK(64)))
1184 net->features |= NETIF_F_HIGHDMA;
1185#endif
1186
1187 net->netdev_ops = &usbnet_netdev_ops;
190static void intr_complete (struct urb *urb);
191
192static int init_status (struct usbnet *dev, struct usb_interface *intf)
193{
194 char *buf = NULL;
195 unsigned pipe = 0;
196 unsigned maxp;
197 unsigned period;

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

1211#if 0
1212// dma_supported() is deeply broken on almost all architectures
1213 // possible with some EHCI controllers
1214 if (dma_supported (&udev->dev, DMA_BIT_MASK(64)))
1215 net->features |= NETIF_F_HIGHDMA;
1216#endif
1217
1218 net->netdev_ops = &usbnet_netdev_ops;
1188#ifdef CONFIG_COMPAT_NET_DEV_OPS
1189 net->hard_start_xmit = usbnet_start_xmit;
1190 net->open = usbnet_open;
1191 net->stop = usbnet_stop;
1192 net->tx_timeout = usbnet_tx_timeout;
1193#endif
1194 net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
1195 net->ethtool_ops = &usbnet_ethtool_ops;
1196
1197 // allow device-specific bind/init procedures
1198 // NOTE net->name still not usable ...
1199 if (info->bind) {
1200 status = info->bind (dev, udev);
1201 if (status < 0)

--- 129 unchanged lines hidden ---
1219 net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
1220 net->ethtool_ops = &usbnet_ethtool_ops;
1221
1222 // allow device-specific bind/init procedures
1223 // NOTE net->name still not usable ...
1224 if (info->bind) {
1225 status = info->bind (dev, udev);
1226 if (status < 0)

--- 129 unchanged lines hidden ---