27 #include <linux/module.h>
28 #include <linux/ctype.h>
29 #include <linux/netdevice.h>
31 #include <linux/ethtool.h>
32 #include <linux/slab.h>
33 #include <linux/mii.h>
37 #define INT51X1_VENDOR_ID 0x09e1
38 #define INT51X1_PRODUCT_ID 0x5121
40 #define INT51X1_HEADER_SIZE 2
42 #define PACKET_TYPE_PROMISCUOUS (1 << 0)
43 #define PACKET_TYPE_ALL_MULTICAST (1 << 1)
44 #define PACKET_TYPE_DIRECTED (1 << 2)
45 #define PACKET_TYPE_BROADCAST (1 << 3)
46 #define PACKET_TYPE_MULTICAST (1 << 4)
48 #define SET_ETHERNET_PACKET_FILTER 0x43
55 netdev_err(dev->
net,
"unexpected tiny rx frame\n");
69 int pack_len = skb->
len;
71 int headroom = skb_headroom(skb);
72 int tailroom = skb_tailroom(skb);
77 if ((pack_with_header_len) < dev->
maxpacket)
78 need_tail = dev->
maxpacket - pack_with_header_len + 1;
84 else if (!(pack_with_header_len % dev->
maxpacket))
87 if (!skb_cloned(skb) &&
88 (headroom + tailroom >= need_tail + INT51X1_HEADER_SIZE)) {
89 if (headroom < INT51X1_HEADER_SIZE || tailroom < need_tail) {
92 skb_set_tail_pointer(skb, skb->
len);
107 pack_len += need_tail;
110 len = (
__le16 *) __skb_push(skb, INT51X1_HEADER_SIZE);
114 memset(__skb_put(skb, need_tail), 0, need_tail);
119 static void int51x1_async_cmd_callback(
struct urb *
urb)
125 dev_warn(&urb->dev->dev,
"async callback failed with %d\n",
status);
131 static void int51x1_set_multicast(
struct net_device *netdev)
136 struct usbnet *dev = netdev_priv(netdev);
142 netdev_info(dev->
net,
"promiscuous mode enabled\n");
154 netdev_warn(dev->
net,
"Error allocating URB\n");
160 netdev_warn(dev->
net,
"Error allocating control msg\n");
170 usb_fill_control_urb(urb, dev->
udev, usb_sndctrlpipe(dev->
udev, 0),
171 (
void *)req,
NULL, 0,
172 int51x1_async_cmd_callback,
177 netdev_warn(dev->
net,
"Error submitting control msg, sts=%d\n",
196 .ndo_set_rx_mode = int51x1_set_multicast,
208 dev->
net->netdev_ops = &int51x1_netdev_ops;
214 .description =
"Intellon usb powerline adapter",
215 .bind = int51x1_bind,
216 .rx_fixup = int51x1_rx_fixup,
217 .tx_fixup = int51x1_tx_fixup,
226 .driver_info = (
unsigned long) &int51x1_info,
232 static struct usb_driver int51x1_driver = {
234 .id_table = products,
239 .disable_hub_initiated_lpm = 1,