diff options
author | David Brownell <david-b@pacbell.net> | 2006-06-13 12:54:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:18 -0400 |
commit | 7e27f18c8a37ffb95f677e4e9c3cca818a3e9eb1 (patch) | |
tree | 24bbec7b9e3bd8e2642471e9ee9bd1e45c992e71 /drivers/usb | |
parent | d5681fe8110e1169902df37a8fd8bd01c2b7810e (diff) |
[PATCH] USB: whitespace removal from usb/gadget/ether
This removes extraneous whitespace from the Ethernet/RNDIS gadget driver.
It's all space-at-EOL, spaces-before-tabs, or tabs-then-spaces.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/ether.c | 86 | ||||
-rw-r--r-- | drivers/usb/gadget/rndis.c | 389 | ||||
-rw-r--r-- | drivers/usb/gadget/rndis.h | 26 |
3 files changed, 251 insertions, 250 deletions
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index bd60c816e907..fc4684096fcc 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -101,9 +101,9 @@ static const char driver_desc [] = DRIVER_DESC; | |||
101 | 101 | ||
102 | /* CDC and RNDIS support the same host-chosen outgoing packet filters. */ | 102 | /* CDC and RNDIS support the same host-chosen outgoing packet filters. */ |
103 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ | 103 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ |
104 | |USB_CDC_PACKET_TYPE_ALL_MULTICAST \ | 104 | |USB_CDC_PACKET_TYPE_ALL_MULTICAST \ |
105 | |USB_CDC_PACKET_TYPE_PROMISCUOUS \ | 105 | |USB_CDC_PACKET_TYPE_PROMISCUOUS \ |
106 | |USB_CDC_PACKET_TYPE_DIRECTED) | 106 | |USB_CDC_PACKET_TYPE_DIRECTED) |
107 | 107 | ||
108 | 108 | ||
109 | /*-------------------------------------------------------------------------*/ | 109 | /*-------------------------------------------------------------------------*/ |
@@ -318,7 +318,7 @@ static inline int rndis_active(struct eth_dev *dev) | |||
318 | #define DEFAULT_QLEN 2 /* double buffering by default */ | 318 | #define DEFAULT_QLEN 2 /* double buffering by default */ |
319 | 319 | ||
320 | /* peak bulk transfer bits-per-second */ | 320 | /* peak bulk transfer bits-per-second */ |
321 | #define HS_BPS (13 * 512 * 8 * 1000 * 8) | 321 | #define HS_BPS (13 * 512 * 8 * 1000 * 8) |
322 | #define FS_BPS (19 * 64 * 1 * 1000 * 8) | 322 | #define FS_BPS (19 * 64 * 1 * 1000 * 8) |
323 | 323 | ||
324 | #ifdef CONFIG_USB_GADGET_DUALSPEED | 324 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
@@ -466,7 +466,7 @@ eth_config = { | |||
466 | }; | 466 | }; |
467 | 467 | ||
468 | #ifdef CONFIG_USB_ETH_RNDIS | 468 | #ifdef CONFIG_USB_ETH_RNDIS |
469 | static struct usb_config_descriptor | 469 | static struct usb_config_descriptor |
470 | rndis_config = { | 470 | rndis_config = { |
471 | .bLength = sizeof rndis_config, | 471 | .bLength = sizeof rndis_config, |
472 | .bDescriptorType = USB_DT_CONFIG, | 472 | .bDescriptorType = USB_DT_CONFIG, |
@@ -511,7 +511,7 @@ static const struct usb_interface_descriptor | |||
511 | rndis_control_intf = { | 511 | rndis_control_intf = { |
512 | .bLength = sizeof rndis_control_intf, | 512 | .bLength = sizeof rndis_control_intf, |
513 | .bDescriptorType = USB_DT_INTERFACE, | 513 | .bDescriptorType = USB_DT_INTERFACE, |
514 | 514 | ||
515 | .bInterfaceNumber = 0, | 515 | .bInterfaceNumber = 0, |
516 | .bNumEndpoints = 1, | 516 | .bNumEndpoints = 1, |
517 | .bInterfaceClass = USB_CLASS_COMM, | 517 | .bInterfaceClass = USB_CLASS_COMM, |
@@ -545,20 +545,20 @@ static const struct usb_cdc_union_desc union_desc = { | |||
545 | #ifdef CONFIG_USB_ETH_RNDIS | 545 | #ifdef CONFIG_USB_ETH_RNDIS |
546 | 546 | ||
547 | static const struct usb_cdc_call_mgmt_descriptor call_mgmt_descriptor = { | 547 | static const struct usb_cdc_call_mgmt_descriptor call_mgmt_descriptor = { |
548 | .bLength = sizeof call_mgmt_descriptor, | 548 | .bLength = sizeof call_mgmt_descriptor, |
549 | .bDescriptorType = USB_DT_CS_INTERFACE, | 549 | .bDescriptorType = USB_DT_CS_INTERFACE, |
550 | .bDescriptorSubType = USB_CDC_CALL_MANAGEMENT_TYPE, | 550 | .bDescriptorSubType = USB_CDC_CALL_MANAGEMENT_TYPE, |
551 | 551 | ||
552 | .bmCapabilities = 0x00, | 552 | .bmCapabilities = 0x00, |
553 | .bDataInterface = 0x01, | 553 | .bDataInterface = 0x01, |
554 | }; | 554 | }; |
555 | 555 | ||
556 | static const struct usb_cdc_acm_descriptor acm_descriptor = { | 556 | static const struct usb_cdc_acm_descriptor acm_descriptor = { |
557 | .bLength = sizeof acm_descriptor, | 557 | .bLength = sizeof acm_descriptor, |
558 | .bDescriptorType = USB_DT_CS_INTERFACE, | 558 | .bDescriptorType = USB_DT_CS_INTERFACE, |
559 | .bDescriptorSubType = USB_CDC_ACM_TYPE, | 559 | .bDescriptorSubType = USB_CDC_ACM_TYPE, |
560 | 560 | ||
561 | .bmCapabilities = 0x00, | 561 | .bmCapabilities = 0x00, |
562 | }; | 562 | }; |
563 | 563 | ||
564 | #endif | 564 | #endif |
@@ -595,7 +595,7 @@ static const struct usb_cdc_ether_desc ether_desc = { | |||
595 | * RNDIS requires the status endpoint, since it uses that encapsulation | 595 | * RNDIS requires the status endpoint, since it uses that encapsulation |
596 | * mechanism for its funky RPC scheme. | 596 | * mechanism for its funky RPC scheme. |
597 | */ | 597 | */ |
598 | 598 | ||
599 | #define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */ | 599 | #define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */ |
600 | #define STATUS_BYTECOUNT 16 /* 8 byte header + data */ | 600 | #define STATUS_BYTECOUNT 16 /* 8 byte header + data */ |
601 | 601 | ||
@@ -978,7 +978,7 @@ set_ether_config (struct eth_dev *dev, gfp_t gfp_flags) | |||
978 | 978 | ||
979 | result = usb_ep_enable (dev->status_ep, dev->status); | 979 | result = usb_ep_enable (dev->status_ep, dev->status); |
980 | if (result != 0) { | 980 | if (result != 0) { |
981 | DEBUG (dev, "enable %s --> %d\n", | 981 | DEBUG (dev, "enable %s --> %d\n", |
982 | dev->status_ep->name, result); | 982 | dev->status_ep->name, result); |
983 | goto done; | 983 | goto done; |
984 | } | 984 | } |
@@ -1002,14 +1002,14 @@ set_ether_config (struct eth_dev *dev, gfp_t gfp_flags) | |||
1002 | if (!cdc_active(dev)) { | 1002 | if (!cdc_active(dev)) { |
1003 | result = usb_ep_enable (dev->in_ep, dev->in); | 1003 | result = usb_ep_enable (dev->in_ep, dev->in); |
1004 | if (result != 0) { | 1004 | if (result != 0) { |
1005 | DEBUG(dev, "enable %s --> %d\n", | 1005 | DEBUG(dev, "enable %s --> %d\n", |
1006 | dev->in_ep->name, result); | 1006 | dev->in_ep->name, result); |
1007 | goto done; | 1007 | goto done; |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | result = usb_ep_enable (dev->out_ep, dev->out); | 1010 | result = usb_ep_enable (dev->out_ep, dev->out); |
1011 | if (result != 0) { | 1011 | if (result != 0) { |
1012 | DEBUG (dev, "enable %s --> %d\n", | 1012 | DEBUG (dev, "enable %s --> %d\n", |
1013 | dev->out_ep->name, result); | 1013 | dev->out_ep->name, result); |
1014 | goto done; | 1014 | goto done; |
1015 | } | 1015 | } |
@@ -1144,7 +1144,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, gfp_t gfp_flags) | |||
1144 | #ifdef CONFIG_USB_GADGET_DUALSPEED | 1144 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1145 | case USB_SPEED_HIGH: speed = "high"; break; | 1145 | case USB_SPEED_HIGH: speed = "high"; break; |
1146 | #endif | 1146 | #endif |
1147 | default: speed = "?"; break; | 1147 | default: speed = "?"; break; |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | dev->config = number; | 1150 | dev->config = number; |
@@ -1206,7 +1206,7 @@ static void issue_start_status (struct eth_dev *dev) | |||
1206 | struct usb_request *req = dev->stat_req; | 1206 | struct usb_request *req = dev->stat_req; |
1207 | struct usb_cdc_notification *event; | 1207 | struct usb_cdc_notification *event; |
1208 | int value; | 1208 | int value; |
1209 | 1209 | ||
1210 | DEBUG (dev, "%s, flush old status first\n", __FUNCTION__); | 1210 | DEBUG (dev, "%s, flush old status first\n", __FUNCTION__); |
1211 | 1211 | ||
1212 | /* flush old status | 1212 | /* flush old status |
@@ -1268,7 +1268,7 @@ static void rndis_command_complete (struct usb_ep *ep, struct usb_request *req) | |||
1268 | { | 1268 | { |
1269 | struct eth_dev *dev = ep->driver_data; | 1269 | struct eth_dev *dev = ep->driver_data; |
1270 | int status; | 1270 | int status; |
1271 | 1271 | ||
1272 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ | 1272 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ |
1273 | spin_lock(&dev->lock); | 1273 | spin_lock(&dev->lock); |
1274 | status = rndis_msg_parser (dev->rndis_config, (u8 *) req->buf); | 1274 | status = rndis_msg_parser (dev->rndis_config, (u8 *) req->buf); |
@@ -1472,7 +1472,7 @@ done_set_intf: | |||
1472 | 1472 | ||
1473 | #endif /* DEV_CONFIG_CDC */ | 1473 | #endif /* DEV_CONFIG_CDC */ |
1474 | 1474 | ||
1475 | #ifdef CONFIG_USB_ETH_RNDIS | 1475 | #ifdef CONFIG_USB_ETH_RNDIS |
1476 | /* RNDIS uses the CDC command encapsulation mechanism to implement | 1476 | /* RNDIS uses the CDC command encapsulation mechanism to implement |
1477 | * an RPC scheme, with much getting/setting of attributes by OID. | 1477 | * an RPC scheme, with much getting/setting of attributes by OID. |
1478 | */ | 1478 | */ |
@@ -1489,7 +1489,7 @@ done_set_intf: | |||
1489 | req->complete = rndis_command_complete; | 1489 | req->complete = rndis_command_complete; |
1490 | /* later, rndis_control_ack () sends a notification */ | 1490 | /* later, rndis_control_ack () sends a notification */ |
1491 | break; | 1491 | break; |
1492 | 1492 | ||
1493 | case USB_CDC_GET_ENCAPSULATED_RESPONSE: | 1493 | case USB_CDC_GET_ENCAPSULATED_RESPONSE: |
1494 | if ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE) | 1494 | if ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE) |
1495 | == ctrl->bRequestType | 1495 | == ctrl->bRequestType |
@@ -1641,7 +1641,7 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) | |||
1641 | DEBUG (dev, "no rx skb\n"); | 1641 | DEBUG (dev, "no rx skb\n"); |
1642 | goto enomem; | 1642 | goto enomem; |
1643 | } | 1643 | } |
1644 | 1644 | ||
1645 | /* Some platforms perform better when IP packets are aligned, | 1645 | /* Some platforms perform better when IP packets are aligned, |
1646 | * but on at least one, checksumming fails otherwise. Note: | 1646 | * but on at least one, checksumming fails otherwise. Note: |
1647 | * RNDIS headers involve variable numbers of LE32 values. | 1647 | * RNDIS headers involve variable numbers of LE32 values. |
@@ -1720,7 +1720,7 @@ quiesce: | |||
1720 | case -EOVERFLOW: | 1720 | case -EOVERFLOW: |
1721 | dev->stats.rx_over_errors++; | 1721 | dev->stats.rx_over_errors++; |
1722 | // FALLTHROUGH | 1722 | // FALLTHROUGH |
1723 | 1723 | ||
1724 | default: | 1724 | default: |
1725 | dev->stats.rx_errors++; | 1725 | dev->stats.rx_errors++; |
1726 | DEBUG (dev, "rx status %d\n", status); | 1726 | DEBUG (dev, "rx status %d\n", status); |
@@ -1915,7 +1915,7 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net) | |||
1915 | sizeof (struct rndis_packet_msg_type)); | 1915 | sizeof (struct rndis_packet_msg_type)); |
1916 | if (!skb_rndis) | 1916 | if (!skb_rndis) |
1917 | goto drop; | 1917 | goto drop; |
1918 | 1918 | ||
1919 | dev_kfree_skb_any (skb); | 1919 | dev_kfree_skb_any (skb); |
1920 | skb = skb_rndis; | 1920 | skb = skb_rndis; |
1921 | rndis_add_hdr (skb); | 1921 | rndis_add_hdr (skb); |
@@ -2001,7 +2001,7 @@ static int rndis_control_ack (struct net_device *net) | |||
2001 | struct eth_dev *dev = netdev_priv(net); | 2001 | struct eth_dev *dev = netdev_priv(net); |
2002 | u32 length; | 2002 | u32 length; |
2003 | struct usb_request *resp = dev->stat_req; | 2003 | struct usb_request *resp = dev->stat_req; |
2004 | 2004 | ||
2005 | /* in case RNDIS calls this after disconnect */ | 2005 | /* in case RNDIS calls this after disconnect */ |
2006 | if (!dev->status) { | 2006 | if (!dev->status) { |
2007 | DEBUG (dev, "status ENODEV\n"); | 2007 | DEBUG (dev, "status ENODEV\n"); |
@@ -2021,16 +2021,16 @@ static int rndis_control_ack (struct net_device *net) | |||
2021 | resp->length = 8; | 2021 | resp->length = 8; |
2022 | resp->complete = rndis_control_ack_complete; | 2022 | resp->complete = rndis_control_ack_complete; |
2023 | resp->context = dev; | 2023 | resp->context = dev; |
2024 | 2024 | ||
2025 | *((__le32 *) resp->buf) = __constant_cpu_to_le32 (1); | 2025 | *((__le32 *) resp->buf) = __constant_cpu_to_le32 (1); |
2026 | *((__le32 *) resp->buf + 1) = __constant_cpu_to_le32 (0); | 2026 | *((__le32 *) resp->buf + 1) = __constant_cpu_to_le32 (0); |
2027 | 2027 | ||
2028 | length = usb_ep_queue (dev->status_ep, resp, GFP_ATOMIC); | 2028 | length = usb_ep_queue (dev->status_ep, resp, GFP_ATOMIC); |
2029 | if (length < 0) { | 2029 | if (length < 0) { |
2030 | resp->status = 0; | 2030 | resp->status = 0; |
2031 | rndis_control_ack_complete (dev->status_ep, resp); | 2031 | rndis_control_ack_complete (dev->status_ep, resp); |
2032 | } | 2032 | } |
2033 | 2033 | ||
2034 | return 0; | 2034 | return 0; |
2035 | } | 2035 | } |
2036 | 2036 | ||
@@ -2047,7 +2047,7 @@ static void eth_start (struct eth_dev *dev, gfp_t gfp_flags) | |||
2047 | /* fill the rx queue */ | 2047 | /* fill the rx queue */ |
2048 | rx_fill (dev, gfp_flags); | 2048 | rx_fill (dev, gfp_flags); |
2049 | 2049 | ||
2050 | /* and open the tx floodgates */ | 2050 | /* and open the tx floodgates */ |
2051 | atomic_set (&dev->tx_qlen, 0); | 2051 | atomic_set (&dev->tx_qlen, 0); |
2052 | netif_wake_queue (dev->net); | 2052 | netif_wake_queue (dev->net); |
2053 | if (rndis_active(dev)) { | 2053 | if (rndis_active(dev)) { |
@@ -2076,7 +2076,7 @@ static int eth_stop (struct net_device *net) | |||
2076 | netif_stop_queue (net); | 2076 | netif_stop_queue (net); |
2077 | 2077 | ||
2078 | DEBUG (dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld\n", | 2078 | DEBUG (dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld\n", |
2079 | dev->stats.rx_packets, dev->stats.tx_packets, | 2079 | dev->stats.rx_packets, dev->stats.tx_packets, |
2080 | dev->stats.rx_errors, dev->stats.tx_errors | 2080 | dev->stats.rx_errors, dev->stats.tx_errors |
2081 | ); | 2081 | ); |
2082 | 2082 | ||
@@ -2095,7 +2095,7 @@ static int eth_stop (struct net_device *net) | |||
2095 | usb_ep_enable (dev->status_ep, dev->status); | 2095 | usb_ep_enable (dev->status_ep, dev->status); |
2096 | } | 2096 | } |
2097 | } | 2097 | } |
2098 | 2098 | ||
2099 | if (rndis_active(dev)) { | 2099 | if (rndis_active(dev)) { |
2100 | rndis_set_param_medium (dev->rndis_config, | 2100 | rndis_set_param_medium (dev->rndis_config, |
2101 | NDIS_MEDIUM_802_3, 0); | 2101 | NDIS_MEDIUM_802_3, 0); |
@@ -2301,7 +2301,7 @@ autoconf_fail: | |||
2301 | return -ENODEV; | 2301 | return -ENODEV; |
2302 | } | 2302 | } |
2303 | in_ep->driver_data = in_ep; /* claim */ | 2303 | in_ep->driver_data = in_ep; /* claim */ |
2304 | 2304 | ||
2305 | out_ep = usb_ep_autoconfig (gadget, &fs_sink_desc); | 2305 | out_ep = usb_ep_autoconfig (gadget, &fs_sink_desc); |
2306 | if (!out_ep) | 2306 | if (!out_ep) |
2307 | goto autoconf_fail; | 2307 | goto autoconf_fail; |
@@ -2374,8 +2374,8 @@ autoconf_fail: | |||
2374 | #endif | 2374 | #endif |
2375 | } | 2375 | } |
2376 | 2376 | ||
2377 | net = alloc_etherdev (sizeof *dev); | 2377 | net = alloc_etherdev (sizeof *dev); |
2378 | if (!net) | 2378 | if (!net) |
2379 | return status; | 2379 | return status; |
2380 | dev = netdev_priv(net); | 2380 | dev = netdev_priv(net); |
2381 | spin_lock_init (&dev->lock); | 2381 | spin_lock_init (&dev->lock); |
@@ -2454,7 +2454,7 @@ autoconf_fail: | |||
2454 | dev->gadget = gadget; | 2454 | dev->gadget = gadget; |
2455 | set_gadget_data (gadget, dev); | 2455 | set_gadget_data (gadget, dev); |
2456 | gadget->ep0->driver_data = dev; | 2456 | gadget->ep0->driver_data = dev; |
2457 | 2457 | ||
2458 | /* two kinds of host-initiated state changes: | 2458 | /* two kinds of host-initiated state changes: |
2459 | * - iff DATA transfer is active, carrier is "on" | 2459 | * - iff DATA transfer is active, carrier is "on" |
2460 | * - tx queueing enabled if open *and* carrier is "on" | 2460 | * - tx queueing enabled if open *and* carrier is "on" |
@@ -2462,8 +2462,8 @@ autoconf_fail: | |||
2462 | netif_stop_queue (dev->net); | 2462 | netif_stop_queue (dev->net); |
2463 | netif_carrier_off (dev->net); | 2463 | netif_carrier_off (dev->net); |
2464 | 2464 | ||
2465 | SET_NETDEV_DEV (dev->net, &gadget->dev); | 2465 | SET_NETDEV_DEV (dev->net, &gadget->dev); |
2466 | status = register_netdev (dev->net); | 2466 | status = register_netdev (dev->net); |
2467 | if (status < 0) | 2467 | if (status < 0) |
2468 | goto fail1; | 2468 | goto fail1; |
2469 | 2469 | ||
@@ -2488,7 +2488,7 @@ autoconf_fail: | |||
2488 | u32 vendorID = 0; | 2488 | u32 vendorID = 0; |
2489 | 2489 | ||
2490 | /* FIXME RNDIS vendor id == "vendor NIC code" == ? */ | 2490 | /* FIXME RNDIS vendor id == "vendor NIC code" == ? */ |
2491 | 2491 | ||
2492 | dev->rndis_config = rndis_register (rndis_control_ack); | 2492 | dev->rndis_config = rndis_register (rndis_control_ack); |
2493 | if (dev->rndis_config < 0) { | 2493 | if (dev->rndis_config < 0) { |
2494 | fail0: | 2494 | fail0: |
@@ -2496,7 +2496,7 @@ fail0: | |||
2496 | status = -ENODEV; | 2496 | status = -ENODEV; |
2497 | goto fail; | 2497 | goto fail; |
2498 | } | 2498 | } |
2499 | 2499 | ||
2500 | /* these set up a lot of the OIDs that RNDIS needs */ | 2500 | /* these set up a lot of the OIDs that RNDIS needs */ |
2501 | rndis_set_host_mac (dev->rndis_config, dev->host_mac); | 2501 | rndis_set_host_mac (dev->rndis_config, dev->host_mac); |
2502 | if (rndis_set_param_dev (dev->rndis_config, dev->net, | 2502 | if (rndis_set_param_dev (dev->rndis_config, dev->net, |
@@ -2556,7 +2556,7 @@ static struct usb_gadget_driver eth_driver = { | |||
2556 | .suspend = eth_suspend, | 2556 | .suspend = eth_suspend, |
2557 | .resume = eth_resume, | 2557 | .resume = eth_resume, |
2558 | 2558 | ||
2559 | .driver = { | 2559 | .driver = { |
2560 | .name = (char *) shortname, | 2560 | .name = (char *) shortname, |
2561 | .owner = THIS_MODULE, | 2561 | .owner = THIS_MODULE, |
2562 | }, | 2562 | }, |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 6d6eaad73968..3ff6db7828a0 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -1,23 +1,23 @@ | |||
1 | /* | 1 | /* |
2 | * RNDIS MSG parser | 2 | * RNDIS MSG parser |
3 | * | 3 | * |
4 | * Version: $Id: rndis.c,v 1.19 2004/03/25 21:33:46 robert Exp $ | 4 | * Version: $Id: rndis.c,v 1.19 2004/03/25 21:33:46 robert Exp $ |
5 | * | 5 | * |
6 | * Authors: Benedikt Spranger, Pengutronix | 6 | * Authors: Benedikt Spranger, Pengutronix |
7 | * Robert Schwebel, Pengutronix | 7 | * Robert Schwebel, Pengutronix |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
11 | * version 2, as published by the Free Software Foundation. | 11 | * version 2, as published by the Free Software Foundation. |
12 | * | 12 | * |
13 | * This software was originally developed in conformance with | 13 | * This software was originally developed in conformance with |
14 | * Microsoft's Remote NDIS Specification License Agreement. | 14 | * Microsoft's Remote NDIS Specification License Agreement. |
15 | * | 15 | * |
16 | * 03/12/2004 Kai-Uwe Bloem <linux-development@auerswald.de> | 16 | * 03/12/2004 Kai-Uwe Bloem <linux-development@auerswald.de> |
17 | * Fixed message length bug in init_response | 17 | * Fixed message length bug in init_response |
18 | * | 18 | * |
19 | * 03/25/2004 Kai-Uwe Bloem <linux-development@auerswald.de> | 19 | * 03/25/2004 Kai-Uwe Bloem <linux-development@auerswald.de> |
20 | * Fixed rndis_rm_hdr length bug. | 20 | * Fixed rndis_rm_hdr length bug. |
21 | * | 21 | * |
22 | * Copyright (C) 2004 by David Brownell | 22 | * Copyright (C) 2004 by David Brownell |
23 | * updates to merge with Linux 2.6, better match RNDIS spec | 23 | * updates to merge with Linux 2.6, better match RNDIS spec |
@@ -82,7 +82,7 @@ static rndis_resp_t *rndis_add_response (int configNr, u32 length); | |||
82 | 82 | ||
83 | 83 | ||
84 | /* supported OIDs */ | 84 | /* supported OIDs */ |
85 | static const u32 oid_supported_list [] = | 85 | static const u32 oid_supported_list [] = |
86 | { | 86 | { |
87 | /* the general stuff */ | 87 | /* the general stuff */ |
88 | OID_GEN_SUPPORTED_LIST, | 88 | OID_GEN_SUPPORTED_LIST, |
@@ -103,7 +103,7 @@ static const u32 oid_supported_list [] = | |||
103 | #if 0 | 103 | #if 0 |
104 | OID_GEN_RNDIS_CONFIG_PARAMETER, | 104 | OID_GEN_RNDIS_CONFIG_PARAMETER, |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | /* the statistical stuff */ | 107 | /* the statistical stuff */ |
108 | OID_GEN_XMIT_OK, | 108 | OID_GEN_XMIT_OK, |
109 | OID_GEN_RCV_OK, | 109 | OID_GEN_RCV_OK, |
@@ -127,14 +127,14 @@ static const u32 oid_supported_list [] = | |||
127 | OID_GEN_TRANSMIT_QUEUE_LENGTH, | 127 | OID_GEN_TRANSMIT_QUEUE_LENGTH, |
128 | #endif /* RNDIS_OPTIONAL_STATS */ | 128 | #endif /* RNDIS_OPTIONAL_STATS */ |
129 | 129 | ||
130 | /* mandatory 802.3 */ | 130 | /* mandatory 802.3 */ |
131 | /* the general stuff */ | 131 | /* the general stuff */ |
132 | OID_802_3_PERMANENT_ADDRESS, | 132 | OID_802_3_PERMANENT_ADDRESS, |
133 | OID_802_3_CURRENT_ADDRESS, | 133 | OID_802_3_CURRENT_ADDRESS, |
134 | OID_802_3_MULTICAST_LIST, | 134 | OID_802_3_MULTICAST_LIST, |
135 | OID_802_3_MAC_OPTIONS, | 135 | OID_802_3_MAC_OPTIONS, |
136 | OID_802_3_MAXIMUM_LIST_SIZE, | 136 | OID_802_3_MAXIMUM_LIST_SIZE, |
137 | 137 | ||
138 | /* the statistical stuff */ | 138 | /* the statistical stuff */ |
139 | OID_802_3_RCV_ERROR_ALIGNMENT, | 139 | OID_802_3_RCV_ERROR_ALIGNMENT, |
140 | OID_802_3_XMIT_ONE_COLLISION, | 140 | OID_802_3_XMIT_ONE_COLLISION, |
@@ -172,8 +172,8 @@ static int | |||
172 | gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | 172 | gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, |
173 | rndis_resp_t *r) | 173 | rndis_resp_t *r) |
174 | { | 174 | { |
175 | int retval = -ENOTSUPP; | 175 | int retval = -ENOTSUPP; |
176 | u32 length = 4; /* usually */ | 176 | u32 length = 4; /* usually */ |
177 | __le32 *outbuf; | 177 | __le32 *outbuf; |
178 | int i, count; | 178 | int i, count; |
179 | rndis_query_cmplt_type *resp; | 179 | rndis_query_cmplt_type *resp; |
@@ -211,27 +211,27 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
211 | outbuf[i] = cpu_to_le32 (oid_supported_list[i]); | 211 | outbuf[i] = cpu_to_le32 (oid_supported_list[i]); |
212 | retval = 0; | 212 | retval = 0; |
213 | break; | 213 | break; |
214 | 214 | ||
215 | /* mandatory */ | 215 | /* mandatory */ |
216 | case OID_GEN_HARDWARE_STATUS: | 216 | case OID_GEN_HARDWARE_STATUS: |
217 | DEBUG("%s: OID_GEN_HARDWARE_STATUS\n", __FUNCTION__); | 217 | DEBUG("%s: OID_GEN_HARDWARE_STATUS\n", __FUNCTION__); |
218 | /* Bogus question! | 218 | /* Bogus question! |
219 | * Hardware must be ready to receive high level protocols. | 219 | * Hardware must be ready to receive high level protocols. |
220 | * BTW: | 220 | * BTW: |
221 | * reddite ergo quae sunt Caesaris Caesari | 221 | * reddite ergo quae sunt Caesaris Caesari |
222 | * et quae sunt Dei Deo! | 222 | * et quae sunt Dei Deo! |
223 | */ | 223 | */ |
224 | *outbuf = __constant_cpu_to_le32 (0); | 224 | *outbuf = __constant_cpu_to_le32 (0); |
225 | retval = 0; | 225 | retval = 0; |
226 | break; | 226 | break; |
227 | 227 | ||
228 | /* mandatory */ | 228 | /* mandatory */ |
229 | case OID_GEN_MEDIA_SUPPORTED: | 229 | case OID_GEN_MEDIA_SUPPORTED: |
230 | DEBUG("%s: OID_GEN_MEDIA_SUPPORTED\n", __FUNCTION__); | 230 | DEBUG("%s: OID_GEN_MEDIA_SUPPORTED\n", __FUNCTION__); |
231 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); | 231 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); |
232 | retval = 0; | 232 | retval = 0; |
233 | break; | 233 | break; |
234 | 234 | ||
235 | /* mandatory */ | 235 | /* mandatory */ |
236 | case OID_GEN_MEDIA_IN_USE: | 236 | case OID_GEN_MEDIA_IN_USE: |
237 | DEBUG("%s: OID_GEN_MEDIA_IN_USE\n", __FUNCTION__); | 237 | DEBUG("%s: OID_GEN_MEDIA_IN_USE\n", __FUNCTION__); |
@@ -239,7 +239,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
239 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); | 239 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); |
240 | retval = 0; | 240 | retval = 0; |
241 | break; | 241 | break; |
242 | 242 | ||
243 | /* mandatory */ | 243 | /* mandatory */ |
244 | case OID_GEN_MAXIMUM_FRAME_SIZE: | 244 | case OID_GEN_MAXIMUM_FRAME_SIZE: |
245 | DEBUG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __FUNCTION__); | 245 | DEBUG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __FUNCTION__); |
@@ -249,7 +249,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
249 | retval = 0; | 249 | retval = 0; |
250 | } | 250 | } |
251 | break; | 251 | break; |
252 | 252 | ||
253 | /* mandatory */ | 253 | /* mandatory */ |
254 | case OID_GEN_LINK_SPEED: | 254 | case OID_GEN_LINK_SPEED: |
255 | if (rndis_debug > 1) | 255 | if (rndis_debug > 1) |
@@ -272,7 +272,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
272 | retval = 0; | 272 | retval = 0; |
273 | } | 273 | } |
274 | break; | 274 | break; |
275 | 275 | ||
276 | /* mandatory */ | 276 | /* mandatory */ |
277 | case OID_GEN_RECEIVE_BLOCK_SIZE: | 277 | case OID_GEN_RECEIVE_BLOCK_SIZE: |
278 | DEBUG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __FUNCTION__); | 278 | DEBUG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __FUNCTION__); |
@@ -282,7 +282,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
282 | retval = 0; | 282 | retval = 0; |
283 | } | 283 | } |
284 | break; | 284 | break; |
285 | 285 | ||
286 | /* mandatory */ | 286 | /* mandatory */ |
287 | case OID_GEN_VENDOR_ID: | 287 | case OID_GEN_VENDOR_ID: |
288 | DEBUG("%s: OID_GEN_VENDOR_ID\n", __FUNCTION__); | 288 | DEBUG("%s: OID_GEN_VENDOR_ID\n", __FUNCTION__); |
@@ -290,7 +290,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
290 | rndis_per_dev_params [configNr].vendorID); | 290 | rndis_per_dev_params [configNr].vendorID); |
291 | retval = 0; | 291 | retval = 0; |
292 | break; | 292 | break; |
293 | 293 | ||
294 | /* mandatory */ | 294 | /* mandatory */ |
295 | case OID_GEN_VENDOR_DESCRIPTION: | 295 | case OID_GEN_VENDOR_DESCRIPTION: |
296 | DEBUG("%s: OID_GEN_VENDOR_DESCRIPTION\n", __FUNCTION__); | 296 | DEBUG("%s: OID_GEN_VENDOR_DESCRIPTION\n", __FUNCTION__); |
@@ -356,7 +356,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
356 | DEBUG("%s: OID_GEN_XMIT_OK\n", __FUNCTION__); | 356 | DEBUG("%s: OID_GEN_XMIT_OK\n", __FUNCTION__); |
357 | if (rndis_per_dev_params [configNr].stats) { | 357 | if (rndis_per_dev_params [configNr].stats) { |
358 | *outbuf = cpu_to_le32 ( | 358 | *outbuf = cpu_to_le32 ( |
359 | rndis_per_dev_params [configNr].stats->tx_packets - | 359 | rndis_per_dev_params [configNr].stats->tx_packets - |
360 | rndis_per_dev_params [configNr].stats->tx_errors - | 360 | rndis_per_dev_params [configNr].stats->tx_errors - |
361 | rndis_per_dev_params [configNr].stats->tx_dropped); | 361 | rndis_per_dev_params [configNr].stats->tx_dropped); |
362 | retval = 0; | 362 | retval = 0; |
@@ -369,13 +369,13 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
369 | DEBUG("%s: OID_GEN_RCV_OK\n", __FUNCTION__); | 369 | DEBUG("%s: OID_GEN_RCV_OK\n", __FUNCTION__); |
370 | if (rndis_per_dev_params [configNr].stats) { | 370 | if (rndis_per_dev_params [configNr].stats) { |
371 | *outbuf = cpu_to_le32 ( | 371 | *outbuf = cpu_to_le32 ( |
372 | rndis_per_dev_params [configNr].stats->rx_packets - | 372 | rndis_per_dev_params [configNr].stats->rx_packets - |
373 | rndis_per_dev_params [configNr].stats->rx_errors - | 373 | rndis_per_dev_params [configNr].stats->rx_errors - |
374 | rndis_per_dev_params [configNr].stats->rx_dropped); | 374 | rndis_per_dev_params [configNr].stats->rx_dropped); |
375 | retval = 0; | 375 | retval = 0; |
376 | } | 376 | } |
377 | break; | 377 | break; |
378 | 378 | ||
379 | /* mandatory */ | 379 | /* mandatory */ |
380 | case OID_GEN_XMIT_ERROR: | 380 | case OID_GEN_XMIT_ERROR: |
381 | if (rndis_debug > 1) | 381 | if (rndis_debug > 1) |
@@ -386,7 +386,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
386 | retval = 0; | 386 | retval = 0; |
387 | } | 387 | } |
388 | break; | 388 | break; |
389 | 389 | ||
390 | /* mandatory */ | 390 | /* mandatory */ |
391 | case OID_GEN_RCV_ERROR: | 391 | case OID_GEN_RCV_ERROR: |
392 | if (rndis_debug > 1) | 392 | if (rndis_debug > 1) |
@@ -397,7 +397,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
397 | retval = 0; | 397 | retval = 0; |
398 | } | 398 | } |
399 | break; | 399 | break; |
400 | 400 | ||
401 | /* mandatory */ | 401 | /* mandatory */ |
402 | case OID_GEN_RCV_NO_BUFFER: | 402 | case OID_GEN_RCV_NO_BUFFER: |
403 | DEBUG("%s: OID_GEN_RCV_NO_BUFFER\n", __FUNCTION__); | 403 | DEBUG("%s: OID_GEN_RCV_NO_BUFFER\n", __FUNCTION__); |
@@ -411,7 +411,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
411 | #ifdef RNDIS_OPTIONAL_STATS | 411 | #ifdef RNDIS_OPTIONAL_STATS |
412 | case OID_GEN_DIRECTED_BYTES_XMIT: | 412 | case OID_GEN_DIRECTED_BYTES_XMIT: |
413 | DEBUG("%s: OID_GEN_DIRECTED_BYTES_XMIT\n", __FUNCTION__); | 413 | DEBUG("%s: OID_GEN_DIRECTED_BYTES_XMIT\n", __FUNCTION__); |
414 | /* | 414 | /* |
415 | * Aunt Tilly's size of shoes | 415 | * Aunt Tilly's size of shoes |
416 | * minus antarctica count of penguins | 416 | * minus antarctica count of penguins |
417 | * divided by weight of Alpha Centauri | 417 | * divided by weight of Alpha Centauri |
@@ -419,7 +419,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
419 | if (rndis_per_dev_params [configNr].stats) { | 419 | if (rndis_per_dev_params [configNr].stats) { |
420 | *outbuf = cpu_to_le32 ( | 420 | *outbuf = cpu_to_le32 ( |
421 | (rndis_per_dev_params [configNr] | 421 | (rndis_per_dev_params [configNr] |
422 | .stats->tx_packets - | 422 | .stats->tx_packets - |
423 | rndis_per_dev_params [configNr] | 423 | rndis_per_dev_params [configNr] |
424 | .stats->tx_errors - | 424 | .stats->tx_errors - |
425 | rndis_per_dev_params [configNr] | 425 | rndis_per_dev_params [configNr] |
@@ -428,14 +428,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
428 | retval = 0; | 428 | retval = 0; |
429 | } | 429 | } |
430 | break; | 430 | break; |
431 | 431 | ||
432 | case OID_GEN_DIRECTED_FRAMES_XMIT: | 432 | case OID_GEN_DIRECTED_FRAMES_XMIT: |
433 | DEBUG("%s: OID_GEN_DIRECTED_FRAMES_XMIT\n", __FUNCTION__); | 433 | DEBUG("%s: OID_GEN_DIRECTED_FRAMES_XMIT\n", __FUNCTION__); |
434 | /* dito */ | 434 | /* dito */ |
435 | if (rndis_per_dev_params [configNr].stats) { | 435 | if (rndis_per_dev_params [configNr].stats) { |
436 | *outbuf = cpu_to_le32 ( | 436 | *outbuf = cpu_to_le32 ( |
437 | (rndis_per_dev_params [configNr] | 437 | (rndis_per_dev_params [configNr] |
438 | .stats->tx_packets - | 438 | .stats->tx_packets - |
439 | rndis_per_dev_params [configNr] | 439 | rndis_per_dev_params [configNr] |
440 | .stats->tx_errors - | 440 | .stats->tx_errors - |
441 | rndis_per_dev_params [configNr] | 441 | rndis_per_dev_params [configNr] |
@@ -444,7 +444,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
444 | retval = 0; | 444 | retval = 0; |
445 | } | 445 | } |
446 | break; | 446 | break; |
447 | 447 | ||
448 | case OID_GEN_MULTICAST_BYTES_XMIT: | 448 | case OID_GEN_MULTICAST_BYTES_XMIT: |
449 | DEBUG("%s: OID_GEN_MULTICAST_BYTES_XMIT\n", __FUNCTION__); | 449 | DEBUG("%s: OID_GEN_MULTICAST_BYTES_XMIT\n", __FUNCTION__); |
450 | if (rndis_per_dev_params [configNr].stats) { | 450 | if (rndis_per_dev_params [configNr].stats) { |
@@ -453,7 +453,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
453 | retval = 0; | 453 | retval = 0; |
454 | } | 454 | } |
455 | break; | 455 | break; |
456 | 456 | ||
457 | case OID_GEN_MULTICAST_FRAMES_XMIT: | 457 | case OID_GEN_MULTICAST_FRAMES_XMIT: |
458 | DEBUG("%s: OID_GEN_MULTICAST_FRAMES_XMIT\n", __FUNCTION__); | 458 | DEBUG("%s: OID_GEN_MULTICAST_FRAMES_XMIT\n", __FUNCTION__); |
459 | if (rndis_per_dev_params [configNr].stats) { | 459 | if (rndis_per_dev_params [configNr].stats) { |
@@ -462,7 +462,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
462 | retval = 0; | 462 | retval = 0; |
463 | } | 463 | } |
464 | break; | 464 | break; |
465 | 465 | ||
466 | case OID_GEN_BROADCAST_BYTES_XMIT: | 466 | case OID_GEN_BROADCAST_BYTES_XMIT: |
467 | DEBUG("%s: OID_GEN_BROADCAST_BYTES_XMIT\n", __FUNCTION__); | 467 | DEBUG("%s: OID_GEN_BROADCAST_BYTES_XMIT\n", __FUNCTION__); |
468 | if (rndis_per_dev_params [configNr].stats) { | 468 | if (rndis_per_dev_params [configNr].stats) { |
@@ -471,7 +471,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
471 | retval = 0; | 471 | retval = 0; |
472 | } | 472 | } |
473 | break; | 473 | break; |
474 | 474 | ||
475 | case OID_GEN_BROADCAST_FRAMES_XMIT: | 475 | case OID_GEN_BROADCAST_FRAMES_XMIT: |
476 | DEBUG("%s: OID_GEN_BROADCAST_FRAMES_XMIT\n", __FUNCTION__); | 476 | DEBUG("%s: OID_GEN_BROADCAST_FRAMES_XMIT\n", __FUNCTION__); |
477 | if (rndis_per_dev_params [configNr].stats) { | 477 | if (rndis_per_dev_params [configNr].stats) { |
@@ -480,19 +480,19 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
480 | retval = 0; | 480 | retval = 0; |
481 | } | 481 | } |
482 | break; | 482 | break; |
483 | 483 | ||
484 | case OID_GEN_DIRECTED_BYTES_RCV: | 484 | case OID_GEN_DIRECTED_BYTES_RCV: |
485 | DEBUG("%s: OID_GEN_DIRECTED_BYTES_RCV\n", __FUNCTION__); | 485 | DEBUG("%s: OID_GEN_DIRECTED_BYTES_RCV\n", __FUNCTION__); |
486 | *outbuf = __constant_cpu_to_le32 (0); | 486 | *outbuf = __constant_cpu_to_le32 (0); |
487 | retval = 0; | 487 | retval = 0; |
488 | break; | 488 | break; |
489 | 489 | ||
490 | case OID_GEN_DIRECTED_FRAMES_RCV: | 490 | case OID_GEN_DIRECTED_FRAMES_RCV: |
491 | DEBUG("%s: OID_GEN_DIRECTED_FRAMES_RCV\n", __FUNCTION__); | 491 | DEBUG("%s: OID_GEN_DIRECTED_FRAMES_RCV\n", __FUNCTION__); |
492 | *outbuf = __constant_cpu_to_le32 (0); | 492 | *outbuf = __constant_cpu_to_le32 (0); |
493 | retval = 0; | 493 | retval = 0; |
494 | break; | 494 | break; |
495 | 495 | ||
496 | case OID_GEN_MULTICAST_BYTES_RCV: | 496 | case OID_GEN_MULTICAST_BYTES_RCV: |
497 | DEBUG("%s: OID_GEN_MULTICAST_BYTES_RCV\n", __FUNCTION__); | 497 | DEBUG("%s: OID_GEN_MULTICAST_BYTES_RCV\n", __FUNCTION__); |
498 | if (rndis_per_dev_params [configNr].stats) { | 498 | if (rndis_per_dev_params [configNr].stats) { |
@@ -501,7 +501,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
501 | retval = 0; | 501 | retval = 0; |
502 | } | 502 | } |
503 | break; | 503 | break; |
504 | 504 | ||
505 | case OID_GEN_MULTICAST_FRAMES_RCV: | 505 | case OID_GEN_MULTICAST_FRAMES_RCV: |
506 | DEBUG("%s: OID_GEN_MULTICAST_FRAMES_RCV\n", __FUNCTION__); | 506 | DEBUG("%s: OID_GEN_MULTICAST_FRAMES_RCV\n", __FUNCTION__); |
507 | if (rndis_per_dev_params [configNr].stats) { | 507 | if (rndis_per_dev_params [configNr].stats) { |
@@ -510,7 +510,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
510 | retval = 0; | 510 | retval = 0; |
511 | } | 511 | } |
512 | break; | 512 | break; |
513 | 513 | ||
514 | case OID_GEN_BROADCAST_BYTES_RCV: | 514 | case OID_GEN_BROADCAST_BYTES_RCV: |
515 | DEBUG("%s: OID_GEN_BROADCAST_BYTES_RCV\n", __FUNCTION__); | 515 | DEBUG("%s: OID_GEN_BROADCAST_BYTES_RCV\n", __FUNCTION__); |
516 | if (rndis_per_dev_params [configNr].stats) { | 516 | if (rndis_per_dev_params [configNr].stats) { |
@@ -519,7 +519,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
519 | retval = 0; | 519 | retval = 0; |
520 | } | 520 | } |
521 | break; | 521 | break; |
522 | 522 | ||
523 | case OID_GEN_BROADCAST_FRAMES_RCV: | 523 | case OID_GEN_BROADCAST_FRAMES_RCV: |
524 | DEBUG("%s: OID_GEN_BROADCAST_FRAMES_RCV\n", __FUNCTION__); | 524 | DEBUG("%s: OID_GEN_BROADCAST_FRAMES_RCV\n", __FUNCTION__); |
525 | if (rndis_per_dev_params [configNr].stats) { | 525 | if (rndis_per_dev_params [configNr].stats) { |
@@ -528,7 +528,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
528 | retval = 0; | 528 | retval = 0; |
529 | } | 529 | } |
530 | break; | 530 | break; |
531 | 531 | ||
532 | case OID_GEN_RCV_CRC_ERROR: | 532 | case OID_GEN_RCV_CRC_ERROR: |
533 | DEBUG("%s: OID_GEN_RCV_CRC_ERROR\n", __FUNCTION__); | 533 | DEBUG("%s: OID_GEN_RCV_CRC_ERROR\n", __FUNCTION__); |
534 | if (rndis_per_dev_params [configNr].stats) { | 534 | if (rndis_per_dev_params [configNr].stats) { |
@@ -537,7 +537,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
537 | retval = 0; | 537 | retval = 0; |
538 | } | 538 | } |
539 | break; | 539 | break; |
540 | 540 | ||
541 | case OID_GEN_TRANSMIT_QUEUE_LENGTH: | 541 | case OID_GEN_TRANSMIT_QUEUE_LENGTH: |
542 | DEBUG("%s: OID_GEN_TRANSMIT_QUEUE_LENGTH\n", __FUNCTION__); | 542 | DEBUG("%s: OID_GEN_TRANSMIT_QUEUE_LENGTH\n", __FUNCTION__); |
543 | *outbuf = __constant_cpu_to_le32 (0); | 543 | *outbuf = __constant_cpu_to_le32 (0); |
@@ -558,7 +558,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
558 | retval = 0; | 558 | retval = 0; |
559 | } | 559 | } |
560 | break; | 560 | break; |
561 | 561 | ||
562 | /* mandatory */ | 562 | /* mandatory */ |
563 | case OID_802_3_CURRENT_ADDRESS: | 563 | case OID_802_3_CURRENT_ADDRESS: |
564 | DEBUG("%s: OID_802_3_CURRENT_ADDRESS\n", __FUNCTION__); | 564 | DEBUG("%s: OID_802_3_CURRENT_ADDRESS\n", __FUNCTION__); |
@@ -570,7 +570,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
570 | retval = 0; | 570 | retval = 0; |
571 | } | 571 | } |
572 | break; | 572 | break; |
573 | 573 | ||
574 | /* mandatory */ | 574 | /* mandatory */ |
575 | case OID_802_3_MULTICAST_LIST: | 575 | case OID_802_3_MULTICAST_LIST: |
576 | DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__); | 576 | DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__); |
@@ -578,7 +578,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
578 | *outbuf = __constant_cpu_to_le32 (0xE0000000); | 578 | *outbuf = __constant_cpu_to_le32 (0xE0000000); |
579 | retval = 0; | 579 | retval = 0; |
580 | break; | 580 | break; |
581 | 581 | ||
582 | /* mandatory */ | 582 | /* mandatory */ |
583 | case OID_802_3_MAXIMUM_LIST_SIZE: | 583 | case OID_802_3_MAXIMUM_LIST_SIZE: |
584 | DEBUG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __FUNCTION__); | 584 | DEBUG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __FUNCTION__); |
@@ -586,7 +586,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
586 | *outbuf = __constant_cpu_to_le32 (1); | 586 | *outbuf = __constant_cpu_to_le32 (1); |
587 | retval = 0; | 587 | retval = 0; |
588 | break; | 588 | break; |
589 | 589 | ||
590 | case OID_802_3_MAC_OPTIONS: | 590 | case OID_802_3_MAC_OPTIONS: |
591 | DEBUG("%s: OID_802_3_MAC_OPTIONS\n", __FUNCTION__); | 591 | DEBUG("%s: OID_802_3_MAC_OPTIONS\n", __FUNCTION__); |
592 | break; | 592 | break; |
@@ -602,56 +602,56 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
602 | retval = 0; | 602 | retval = 0; |
603 | } | 603 | } |
604 | break; | 604 | break; |
605 | 605 | ||
606 | /* mandatory */ | 606 | /* mandatory */ |
607 | case OID_802_3_XMIT_ONE_COLLISION: | 607 | case OID_802_3_XMIT_ONE_COLLISION: |
608 | DEBUG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __FUNCTION__); | 608 | DEBUG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __FUNCTION__); |
609 | *outbuf = __constant_cpu_to_le32 (0); | 609 | *outbuf = __constant_cpu_to_le32 (0); |
610 | retval = 0; | 610 | retval = 0; |
611 | break; | 611 | break; |
612 | 612 | ||
613 | /* mandatory */ | 613 | /* mandatory */ |
614 | case OID_802_3_XMIT_MORE_COLLISIONS: | 614 | case OID_802_3_XMIT_MORE_COLLISIONS: |
615 | DEBUG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __FUNCTION__); | 615 | DEBUG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __FUNCTION__); |
616 | *outbuf = __constant_cpu_to_le32 (0); | 616 | *outbuf = __constant_cpu_to_le32 (0); |
617 | retval = 0; | 617 | retval = 0; |
618 | break; | 618 | break; |
619 | 619 | ||
620 | #ifdef RNDIS_OPTIONAL_STATS | 620 | #ifdef RNDIS_OPTIONAL_STATS |
621 | case OID_802_3_XMIT_DEFERRED: | 621 | case OID_802_3_XMIT_DEFERRED: |
622 | DEBUG("%s: OID_802_3_XMIT_DEFERRED\n", __FUNCTION__); | 622 | DEBUG("%s: OID_802_3_XMIT_DEFERRED\n", __FUNCTION__); |
623 | /* TODO */ | 623 | /* TODO */ |
624 | break; | 624 | break; |
625 | 625 | ||
626 | case OID_802_3_XMIT_MAX_COLLISIONS: | 626 | case OID_802_3_XMIT_MAX_COLLISIONS: |
627 | DEBUG("%s: OID_802_3_XMIT_MAX_COLLISIONS\n", __FUNCTION__); | 627 | DEBUG("%s: OID_802_3_XMIT_MAX_COLLISIONS\n", __FUNCTION__); |
628 | /* TODO */ | 628 | /* TODO */ |
629 | break; | 629 | break; |
630 | 630 | ||
631 | case OID_802_3_RCV_OVERRUN: | 631 | case OID_802_3_RCV_OVERRUN: |
632 | DEBUG("%s: OID_802_3_RCV_OVERRUN\n", __FUNCTION__); | 632 | DEBUG("%s: OID_802_3_RCV_OVERRUN\n", __FUNCTION__); |
633 | /* TODO */ | 633 | /* TODO */ |
634 | break; | 634 | break; |
635 | 635 | ||
636 | case OID_802_3_XMIT_UNDERRUN: | 636 | case OID_802_3_XMIT_UNDERRUN: |
637 | DEBUG("%s: OID_802_3_XMIT_UNDERRUN\n", __FUNCTION__); | 637 | DEBUG("%s: OID_802_3_XMIT_UNDERRUN\n", __FUNCTION__); |
638 | /* TODO */ | 638 | /* TODO */ |
639 | break; | 639 | break; |
640 | 640 | ||
641 | case OID_802_3_XMIT_HEARTBEAT_FAILURE: | 641 | case OID_802_3_XMIT_HEARTBEAT_FAILURE: |
642 | DEBUG("%s: OID_802_3_XMIT_HEARTBEAT_FAILURE\n", __FUNCTION__); | 642 | DEBUG("%s: OID_802_3_XMIT_HEARTBEAT_FAILURE\n", __FUNCTION__); |
643 | /* TODO */ | 643 | /* TODO */ |
644 | break; | 644 | break; |
645 | 645 | ||
646 | case OID_802_3_XMIT_TIMES_CRS_LOST: | 646 | case OID_802_3_XMIT_TIMES_CRS_LOST: |
647 | DEBUG("%s: OID_802_3_XMIT_TIMES_CRS_LOST\n", __FUNCTION__); | 647 | DEBUG("%s: OID_802_3_XMIT_TIMES_CRS_LOST\n", __FUNCTION__); |
648 | /* TODO */ | 648 | /* TODO */ |
649 | break; | 649 | break; |
650 | 650 | ||
651 | case OID_802_3_XMIT_LATE_COLLISIONS: | 651 | case OID_802_3_XMIT_LATE_COLLISIONS: |
652 | DEBUG("%s: OID_802_3_XMIT_LATE_COLLISIONS\n", __FUNCTION__); | 652 | DEBUG("%s: OID_802_3_XMIT_LATE_COLLISIONS\n", __FUNCTION__); |
653 | /* TODO */ | 653 | /* TODO */ |
654 | break; | 654 | break; |
655 | #endif /* RNDIS_OPTIONAL_STATS */ | 655 | #endif /* RNDIS_OPTIONAL_STATS */ |
656 | 656 | ||
657 | #ifdef RNDIS_PM | 657 | #ifdef RNDIS_PM |
@@ -676,23 +676,23 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
676 | #endif | 676 | #endif |
677 | 677 | ||
678 | default: | 678 | default: |
679 | printk (KERN_WARNING "%s: query unknown OID 0x%08X\n", | 679 | printk (KERN_WARNING "%s: query unknown OID 0x%08X\n", |
680 | __FUNCTION__, OID); | 680 | __FUNCTION__, OID); |
681 | } | 681 | } |
682 | if (retval < 0) | 682 | if (retval < 0) |
683 | length = 0; | 683 | length = 0; |
684 | 684 | ||
685 | resp->InformationBufferLength = cpu_to_le32 (length); | 685 | resp->InformationBufferLength = cpu_to_le32 (length); |
686 | r->length = length + sizeof *resp; | 686 | r->length = length + sizeof *resp; |
687 | resp->MessageLength = cpu_to_le32 (r->length); | 687 | resp->MessageLength = cpu_to_le32 (r->length); |
688 | return retval; | 688 | return retval; |
689 | } | 689 | } |
690 | 690 | ||
691 | static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, | 691 | static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, |
692 | rndis_resp_t *r) | 692 | rndis_resp_t *r) |
693 | { | 693 | { |
694 | rndis_set_cmplt_type *resp; | 694 | rndis_set_cmplt_type *resp; |
695 | int i, retval = -ENOTSUPP; | 695 | int i, retval = -ENOTSUPP; |
696 | struct rndis_params *params; | 696 | struct rndis_params *params; |
697 | 697 | ||
698 | if (!r) | 698 | if (!r) |
@@ -745,9 +745,9 @@ update_linkstate: | |||
745 | netif_stop_queue (params->dev); | 745 | netif_stop_queue (params->dev); |
746 | } | 746 | } |
747 | break; | 747 | break; |
748 | 748 | ||
749 | case OID_802_3_MULTICAST_LIST: | 749 | case OID_802_3_MULTICAST_LIST: |
750 | /* I think we can ignore this */ | 750 | /* I think we can ignore this */ |
751 | DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__); | 751 | DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__); |
752 | retval = 0; | 752 | retval = 0; |
753 | break; | 753 | break; |
@@ -796,29 +796,29 @@ update_linkstate: | |||
796 | #endif /* RNDIS_PM */ | 796 | #endif /* RNDIS_PM */ |
797 | 797 | ||
798 | default: | 798 | default: |
799 | printk (KERN_WARNING "%s: set unknown OID 0x%08X, size %d\n", | 799 | printk (KERN_WARNING "%s: set unknown OID 0x%08X, size %d\n", |
800 | __FUNCTION__, OID, buf_len); | 800 | __FUNCTION__, OID, buf_len); |
801 | } | 801 | } |
802 | 802 | ||
803 | return retval; | 803 | return retval; |
804 | } | 804 | } |
805 | 805 | ||
806 | /* | 806 | /* |
807 | * Response Functions | 807 | * Response Functions |
808 | */ | 808 | */ |
809 | 809 | ||
810 | static int rndis_init_response (int configNr, rndis_init_msg_type *buf) | 810 | static int rndis_init_response (int configNr, rndis_init_msg_type *buf) |
811 | { | 811 | { |
812 | rndis_init_cmplt_type *resp; | 812 | rndis_init_cmplt_type *resp; |
813 | rndis_resp_t *r; | 813 | rndis_resp_t *r; |
814 | 814 | ||
815 | if (!rndis_per_dev_params [configNr].dev) return -ENOTSUPP; | 815 | if (!rndis_per_dev_params [configNr].dev) return -ENOTSUPP; |
816 | 816 | ||
817 | r = rndis_add_response (configNr, sizeof (rndis_init_cmplt_type)); | 817 | r = rndis_add_response (configNr, sizeof (rndis_init_cmplt_type)); |
818 | if (!r) | 818 | if (!r) |
819 | return -ENOMEM; | 819 | return -ENOMEM; |
820 | resp = (rndis_init_cmplt_type *) r->buf; | 820 | resp = (rndis_init_cmplt_type *) r->buf; |
821 | 821 | ||
822 | resp->MessageType = __constant_cpu_to_le32 ( | 822 | resp->MessageType = __constant_cpu_to_le32 ( |
823 | REMOTE_NDIS_INITIALIZE_CMPLT); | 823 | REMOTE_NDIS_INITIALIZE_CMPLT); |
824 | resp->MessageLength = __constant_cpu_to_le32 (52); | 824 | resp->MessageLength = __constant_cpu_to_le32 (52); |
@@ -837,11 +837,11 @@ static int rndis_init_response (int configNr, rndis_init_msg_type *buf) | |||
837 | resp->PacketAlignmentFactor = __constant_cpu_to_le32 (0); | 837 | resp->PacketAlignmentFactor = __constant_cpu_to_le32 (0); |
838 | resp->AFListOffset = __constant_cpu_to_le32 (0); | 838 | resp->AFListOffset = __constant_cpu_to_le32 (0); |
839 | resp->AFListSize = __constant_cpu_to_le32 (0); | 839 | resp->AFListSize = __constant_cpu_to_le32 (0); |
840 | 840 | ||
841 | if (rndis_per_dev_params [configNr].ack) | 841 | if (rndis_per_dev_params [configNr].ack) |
842 | rndis_per_dev_params [configNr].ack ( | 842 | rndis_per_dev_params [configNr].ack ( |
843 | rndis_per_dev_params [configNr].dev); | 843 | rndis_per_dev_params [configNr].dev); |
844 | 844 | ||
845 | return 0; | 845 | return 0; |
846 | } | 846 | } |
847 | 847 | ||
@@ -849,10 +849,10 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf) | |||
849 | { | 849 | { |
850 | rndis_query_cmplt_type *resp; | 850 | rndis_query_cmplt_type *resp; |
851 | rndis_resp_t *r; | 851 | rndis_resp_t *r; |
852 | 852 | ||
853 | // DEBUG("%s: OID = %08X\n", __FUNCTION__, cpu_to_le32(buf->OID)); | 853 | // DEBUG("%s: OID = %08X\n", __FUNCTION__, cpu_to_le32(buf->OID)); |
854 | if (!rndis_per_dev_params [configNr].dev) return -ENOTSUPP; | 854 | if (!rndis_per_dev_params [configNr].dev) return -ENOTSUPP; |
855 | 855 | ||
856 | /* | 856 | /* |
857 | * we need more memory: | 857 | * we need more memory: |
858 | * gen_ndis_query_resp expects enough space for | 858 | * gen_ndis_query_resp expects enough space for |
@@ -864,10 +864,10 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf) | |||
864 | if (!r) | 864 | if (!r) |
865 | return -ENOMEM; | 865 | return -ENOMEM; |
866 | resp = (rndis_query_cmplt_type *) r->buf; | 866 | resp = (rndis_query_cmplt_type *) r->buf; |
867 | 867 | ||
868 | resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_QUERY_CMPLT); | 868 | resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_QUERY_CMPLT); |
869 | resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ | 869 | resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ |
870 | 870 | ||
871 | if (gen_ndis_query_resp (configNr, le32_to_cpu (buf->OID), | 871 | if (gen_ndis_query_resp (configNr, le32_to_cpu (buf->OID), |
872 | le32_to_cpu(buf->InformationBufferOffset) | 872 | le32_to_cpu(buf->InformationBufferOffset) |
873 | + 8 + (u8 *) buf, | 873 | + 8 + (u8 *) buf, |
@@ -881,10 +881,10 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf) | |||
881 | resp->InformationBufferOffset = __constant_cpu_to_le32 (0); | 881 | resp->InformationBufferOffset = __constant_cpu_to_le32 (0); |
882 | } else | 882 | } else |
883 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); | 883 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); |
884 | 884 | ||
885 | if (rndis_per_dev_params [configNr].ack) | 885 | if (rndis_per_dev_params [configNr].ack) |
886 | rndis_per_dev_params [configNr].ack ( | 886 | rndis_per_dev_params [configNr].ack ( |
887 | rndis_per_dev_params [configNr].dev); | 887 | rndis_per_dev_params [configNr].dev); |
888 | return 0; | 888 | return 0; |
889 | } | 889 | } |
890 | 890 | ||
@@ -893,7 +893,7 @@ static int rndis_set_response (int configNr, rndis_set_msg_type *buf) | |||
893 | u32 BufLength, BufOffset; | 893 | u32 BufLength, BufOffset; |
894 | rndis_set_cmplt_type *resp; | 894 | rndis_set_cmplt_type *resp; |
895 | rndis_resp_t *r; | 895 | rndis_resp_t *r; |
896 | 896 | ||
897 | r = rndis_add_response (configNr, sizeof (rndis_set_cmplt_type)); | 897 | r = rndis_add_response (configNr, sizeof (rndis_set_cmplt_type)); |
898 | if (!r) | 898 | if (!r) |
899 | return -ENOMEM; | 899 | return -ENOMEM; |
@@ -906,26 +906,27 @@ static int rndis_set_response (int configNr, rndis_set_msg_type *buf) | |||
906 | DEBUG("%s: Length: %d\n", __FUNCTION__, BufLength); | 906 | DEBUG("%s: Length: %d\n", __FUNCTION__, BufLength); |
907 | DEBUG("%s: Offset: %d\n", __FUNCTION__, BufOffset); | 907 | DEBUG("%s: Offset: %d\n", __FUNCTION__, BufOffset); |
908 | DEBUG("%s: InfoBuffer: ", __FUNCTION__); | 908 | DEBUG("%s: InfoBuffer: ", __FUNCTION__); |
909 | 909 | ||
910 | for (i = 0; i < BufLength; i++) { | 910 | for (i = 0; i < BufLength; i++) { |
911 | DEBUG ("%02x ", *(((u8 *) buf) + i + 8 + BufOffset)); | 911 | DEBUG ("%02x ", *(((u8 *) buf) + i + 8 + BufOffset)); |
912 | } | 912 | } |
913 | 913 | ||
914 | DEBUG ("\n"); | 914 | DEBUG ("\n"); |
915 | #endif | 915 | #endif |
916 | 916 | ||
917 | resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT); | 917 | resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT); |
918 | resp->MessageLength = __constant_cpu_to_le32 (16); | 918 | resp->MessageLength = __constant_cpu_to_le32 (16); |
919 | resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ | 919 | resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ |
920 | if (gen_ndis_set_resp (configNr, le32_to_cpu (buf->OID), | 920 | if (gen_ndis_set_resp (configNr, le32_to_cpu (buf->OID), |
921 | ((u8 *) buf) + 8 + BufOffset, BufLength, r)) | 921 | ((u8 *) buf) + 8 + BufOffset, BufLength, r)) |
922 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_NOT_SUPPORTED); | 922 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_NOT_SUPPORTED); |
923 | else resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); | 923 | else |
924 | 924 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); | |
925 | |||
925 | if (rndis_per_dev_params [configNr].ack) | 926 | if (rndis_per_dev_params [configNr].ack) |
926 | rndis_per_dev_params [configNr].ack ( | 927 | rndis_per_dev_params [configNr].ack ( |
927 | rndis_per_dev_params [configNr].dev); | 928 | rndis_per_dev_params [configNr].dev); |
928 | 929 | ||
929 | return 0; | 930 | return 0; |
930 | } | 931 | } |
931 | 932 | ||
@@ -933,27 +934,27 @@ static int rndis_reset_response (int configNr, rndis_reset_msg_type *buf) | |||
933 | { | 934 | { |
934 | rndis_reset_cmplt_type *resp; | 935 | rndis_reset_cmplt_type *resp; |
935 | rndis_resp_t *r; | 936 | rndis_resp_t *r; |
936 | 937 | ||
937 | r = rndis_add_response (configNr, sizeof (rndis_reset_cmplt_type)); | 938 | r = rndis_add_response (configNr, sizeof (rndis_reset_cmplt_type)); |
938 | if (!r) | 939 | if (!r) |
939 | return -ENOMEM; | 940 | return -ENOMEM; |
940 | resp = (rndis_reset_cmplt_type *) r->buf; | 941 | resp = (rndis_reset_cmplt_type *) r->buf; |
941 | 942 | ||
942 | resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_RESET_CMPLT); | 943 | resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_RESET_CMPLT); |
943 | resp->MessageLength = __constant_cpu_to_le32 (16); | 944 | resp->MessageLength = __constant_cpu_to_le32 (16); |
944 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); | 945 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); |
945 | /* resent information */ | 946 | /* resent information */ |
946 | resp->AddressingReset = __constant_cpu_to_le32 (1); | 947 | resp->AddressingReset = __constant_cpu_to_le32 (1); |
947 | 948 | ||
948 | if (rndis_per_dev_params [configNr].ack) | 949 | if (rndis_per_dev_params [configNr].ack) |
949 | rndis_per_dev_params [configNr].ack ( | 950 | rndis_per_dev_params [configNr].ack ( |
950 | rndis_per_dev_params [configNr].dev); | 951 | rndis_per_dev_params [configNr].dev); |
951 | 952 | ||
952 | return 0; | 953 | return 0; |
953 | } | 954 | } |
954 | 955 | ||
955 | static int rndis_keepalive_response (int configNr, | 956 | static int rndis_keepalive_response (int configNr, |
956 | rndis_keepalive_msg_type *buf) | 957 | rndis_keepalive_msg_type *buf) |
957 | { | 958 | { |
958 | rndis_keepalive_cmplt_type *resp; | 959 | rndis_keepalive_cmplt_type *resp; |
959 | rndis_resp_t *r; | 960 | rndis_resp_t *r; |
@@ -964,48 +965,48 @@ static int rndis_keepalive_response (int configNr, | |||
964 | if (!r) | 965 | if (!r) |
965 | return -ENOMEM; | 966 | return -ENOMEM; |
966 | resp = (rndis_keepalive_cmplt_type *) r->buf; | 967 | resp = (rndis_keepalive_cmplt_type *) r->buf; |
967 | 968 | ||
968 | resp->MessageType = __constant_cpu_to_le32 ( | 969 | resp->MessageType = __constant_cpu_to_le32 ( |
969 | REMOTE_NDIS_KEEPALIVE_CMPLT); | 970 | REMOTE_NDIS_KEEPALIVE_CMPLT); |
970 | resp->MessageLength = __constant_cpu_to_le32 (16); | 971 | resp->MessageLength = __constant_cpu_to_le32 (16); |
971 | resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ | 972 | resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ |
972 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); | 973 | resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); |
973 | 974 | ||
974 | if (rndis_per_dev_params [configNr].ack) | 975 | if (rndis_per_dev_params [configNr].ack) |
975 | rndis_per_dev_params [configNr].ack ( | 976 | rndis_per_dev_params [configNr].ack ( |
976 | rndis_per_dev_params [configNr].dev); | 977 | rndis_per_dev_params [configNr].dev); |
977 | 978 | ||
978 | return 0; | 979 | return 0; |
979 | } | 980 | } |
980 | 981 | ||
981 | 982 | ||
982 | /* | 983 | /* |
983 | * Device to Host Comunication | 984 | * Device to Host Comunication |
984 | */ | 985 | */ |
985 | static int rndis_indicate_status_msg (int configNr, u32 status) | 986 | static int rndis_indicate_status_msg (int configNr, u32 status) |
986 | { | 987 | { |
987 | rndis_indicate_status_msg_type *resp; | 988 | rndis_indicate_status_msg_type *resp; |
988 | rndis_resp_t *r; | 989 | rndis_resp_t *r; |
989 | 990 | ||
990 | if (rndis_per_dev_params [configNr].state == RNDIS_UNINITIALIZED) | 991 | if (rndis_per_dev_params [configNr].state == RNDIS_UNINITIALIZED) |
991 | return -ENOTSUPP; | 992 | return -ENOTSUPP; |
992 | 993 | ||
993 | r = rndis_add_response (configNr, | 994 | r = rndis_add_response (configNr, |
994 | sizeof (rndis_indicate_status_msg_type)); | 995 | sizeof (rndis_indicate_status_msg_type)); |
995 | if (!r) | 996 | if (!r) |
996 | return -ENOMEM; | 997 | return -ENOMEM; |
997 | resp = (rndis_indicate_status_msg_type *) r->buf; | 998 | resp = (rndis_indicate_status_msg_type *) r->buf; |
998 | 999 | ||
999 | resp->MessageType = __constant_cpu_to_le32 ( | 1000 | resp->MessageType = __constant_cpu_to_le32 ( |
1000 | REMOTE_NDIS_INDICATE_STATUS_MSG); | 1001 | REMOTE_NDIS_INDICATE_STATUS_MSG); |
1001 | resp->MessageLength = __constant_cpu_to_le32 (20); | 1002 | resp->MessageLength = __constant_cpu_to_le32 (20); |
1002 | resp->Status = cpu_to_le32 (status); | 1003 | resp->Status = cpu_to_le32 (status); |
1003 | resp->StatusBufferLength = __constant_cpu_to_le32 (0); | 1004 | resp->StatusBufferLength = __constant_cpu_to_le32 (0); |
1004 | resp->StatusBufferOffset = __constant_cpu_to_le32 (0); | 1005 | resp->StatusBufferOffset = __constant_cpu_to_le32 (0); |
1005 | 1006 | ||
1006 | if (rndis_per_dev_params [configNr].ack) | 1007 | if (rndis_per_dev_params [configNr].ack) |
1007 | rndis_per_dev_params [configNr].ack ( | 1008 | rndis_per_dev_params [configNr].ack ( |
1008 | rndis_per_dev_params [configNr].dev); | 1009 | rndis_per_dev_params [configNr].dev); |
1009 | return 0; | 1010 | return 0; |
1010 | } | 1011 | } |
1011 | 1012 | ||
@@ -1013,7 +1014,7 @@ int rndis_signal_connect (int configNr) | |||
1013 | { | 1014 | { |
1014 | rndis_per_dev_params [configNr].media_state | 1015 | rndis_per_dev_params [configNr].media_state |
1015 | = NDIS_MEDIA_STATE_CONNECTED; | 1016 | = NDIS_MEDIA_STATE_CONNECTED; |
1016 | return rndis_indicate_status_msg (configNr, | 1017 | return rndis_indicate_status_msg (configNr, |
1017 | RNDIS_STATUS_MEDIA_CONNECT); | 1018 | RNDIS_STATUS_MEDIA_CONNECT); |
1018 | } | 1019 | } |
1019 | 1020 | ||
@@ -1045,26 +1046,26 @@ void rndis_set_host_mac (int configNr, const u8 *addr) | |||
1045 | rndis_per_dev_params [configNr].host_mac = addr; | 1046 | rndis_per_dev_params [configNr].host_mac = addr; |
1046 | } | 1047 | } |
1047 | 1048 | ||
1048 | /* | 1049 | /* |
1049 | * Message Parser | 1050 | * Message Parser |
1050 | */ | 1051 | */ |
1051 | int rndis_msg_parser (u8 configNr, u8 *buf) | 1052 | int rndis_msg_parser (u8 configNr, u8 *buf) |
1052 | { | 1053 | { |
1053 | u32 MsgType, MsgLength; | 1054 | u32 MsgType, MsgLength; |
1054 | __le32 *tmp; | 1055 | __le32 *tmp; |
1055 | struct rndis_params *params; | 1056 | struct rndis_params *params; |
1056 | 1057 | ||
1057 | if (!buf) | 1058 | if (!buf) |
1058 | return -ENOMEM; | 1059 | return -ENOMEM; |
1059 | 1060 | ||
1060 | tmp = (__le32 *) buf; | 1061 | tmp = (__le32 *) buf; |
1061 | MsgType = le32_to_cpup(tmp++); | 1062 | MsgType = le32_to_cpup(tmp++); |
1062 | MsgLength = le32_to_cpup(tmp++); | 1063 | MsgLength = le32_to_cpup(tmp++); |
1063 | 1064 | ||
1064 | if (configNr >= RNDIS_MAX_CONFIGS) | 1065 | if (configNr >= RNDIS_MAX_CONFIGS) |
1065 | return -ENOTSUPP; | 1066 | return -ENOTSUPP; |
1066 | params = &rndis_per_dev_params [configNr]; | 1067 | params = &rndis_per_dev_params [configNr]; |
1067 | 1068 | ||
1068 | /* NOTE: RNDIS is *EXTREMELY* chatty ... Windows constantly polls for | 1069 | /* NOTE: RNDIS is *EXTREMELY* chatty ... Windows constantly polls for |
1069 | * rx/tx statistics and link status, in addition to KEEPALIVE traffic | 1070 | * rx/tx statistics and link status, in addition to KEEPALIVE traffic |
1070 | * and normal HC level polling to see if there's any IN traffic. | 1071 | * and normal HC level polling to see if there's any IN traffic. |
@@ -1073,12 +1074,12 @@ int rndis_msg_parser (u8 configNr, u8 *buf) | |||
1073 | /* For USB: responses may take up to 10 seconds */ | 1074 | /* For USB: responses may take up to 10 seconds */ |
1074 | switch (MsgType) { | 1075 | switch (MsgType) { |
1075 | case REMOTE_NDIS_INITIALIZE_MSG: | 1076 | case REMOTE_NDIS_INITIALIZE_MSG: |
1076 | DEBUG("%s: REMOTE_NDIS_INITIALIZE_MSG\n", | 1077 | DEBUG("%s: REMOTE_NDIS_INITIALIZE_MSG\n", |
1077 | __FUNCTION__ ); | 1078 | __FUNCTION__ ); |
1078 | params->state = RNDIS_INITIALIZED; | 1079 | params->state = RNDIS_INITIALIZED; |
1079 | return rndis_init_response (configNr, | 1080 | return rndis_init_response (configNr, |
1080 | (rndis_init_msg_type *) buf); | 1081 | (rndis_init_msg_type *) buf); |
1081 | 1082 | ||
1082 | case REMOTE_NDIS_HALT_MSG: | 1083 | case REMOTE_NDIS_HALT_MSG: |
1083 | DEBUG("%s: REMOTE_NDIS_HALT_MSG\n", | 1084 | DEBUG("%s: REMOTE_NDIS_HALT_MSG\n", |
1084 | __FUNCTION__ ); | 1085 | __FUNCTION__ ); |
@@ -1088,37 +1089,37 @@ int rndis_msg_parser (u8 configNr, u8 *buf) | |||
1088 | netif_stop_queue (params->dev); | 1089 | netif_stop_queue (params->dev); |
1089 | } | 1090 | } |
1090 | return 0; | 1091 | return 0; |
1091 | 1092 | ||
1092 | case REMOTE_NDIS_QUERY_MSG: | 1093 | case REMOTE_NDIS_QUERY_MSG: |
1093 | return rndis_query_response (configNr, | 1094 | return rndis_query_response (configNr, |
1094 | (rndis_query_msg_type *) buf); | 1095 | (rndis_query_msg_type *) buf); |
1095 | 1096 | ||
1096 | case REMOTE_NDIS_SET_MSG: | 1097 | case REMOTE_NDIS_SET_MSG: |
1097 | return rndis_set_response (configNr, | 1098 | return rndis_set_response (configNr, |
1098 | (rndis_set_msg_type *) buf); | 1099 | (rndis_set_msg_type *) buf); |
1099 | 1100 | ||
1100 | case REMOTE_NDIS_RESET_MSG: | 1101 | case REMOTE_NDIS_RESET_MSG: |
1101 | DEBUG("%s: REMOTE_NDIS_RESET_MSG\n", | 1102 | DEBUG("%s: REMOTE_NDIS_RESET_MSG\n", |
1102 | __FUNCTION__ ); | 1103 | __FUNCTION__ ); |
1103 | return rndis_reset_response (configNr, | 1104 | return rndis_reset_response (configNr, |
1104 | (rndis_reset_msg_type *) buf); | 1105 | (rndis_reset_msg_type *) buf); |
1105 | 1106 | ||
1106 | case REMOTE_NDIS_KEEPALIVE_MSG: | 1107 | case REMOTE_NDIS_KEEPALIVE_MSG: |
1107 | /* For USB: host does this every 5 seconds */ | 1108 | /* For USB: host does this every 5 seconds */ |
1108 | if (rndis_debug > 1) | 1109 | if (rndis_debug > 1) |
1109 | DEBUG("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", | 1110 | DEBUG("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", |
1110 | __FUNCTION__ ); | 1111 | __FUNCTION__ ); |
1111 | return rndis_keepalive_response (configNr, | 1112 | return rndis_keepalive_response (configNr, |
1112 | (rndis_keepalive_msg_type *) | 1113 | (rndis_keepalive_msg_type *) |
1113 | buf); | 1114 | buf); |
1114 | 1115 | ||
1115 | default: | 1116 | default: |
1116 | /* At least Windows XP emits some undefined RNDIS messages. | 1117 | /* At least Windows XP emits some undefined RNDIS messages. |
1117 | * In one case those messages seemed to relate to the host | 1118 | * In one case those messages seemed to relate to the host |
1118 | * suspending itself. | 1119 | * suspending itself. |
1119 | */ | 1120 | */ |
1120 | printk (KERN_WARNING | 1121 | printk (KERN_WARNING |
1121 | "%s: unknown RNDIS message 0x%08X len %d\n", | 1122 | "%s: unknown RNDIS message 0x%08X len %d\n", |
1122 | __FUNCTION__ , MsgType, MsgLength); | 1123 | __FUNCTION__ , MsgType, MsgLength); |
1123 | { | 1124 | { |
1124 | unsigned i; | 1125 | unsigned i; |
@@ -1142,14 +1143,14 @@ int rndis_msg_parser (u8 configNr, u8 *buf) | |||
1142 | } | 1143 | } |
1143 | break; | 1144 | break; |
1144 | } | 1145 | } |
1145 | 1146 | ||
1146 | return -ENOTSUPP; | 1147 | return -ENOTSUPP; |
1147 | } | 1148 | } |
1148 | 1149 | ||
1149 | int rndis_register (int (* rndis_control_ack) (struct net_device *)) | 1150 | int rndis_register (int (* rndis_control_ack) (struct net_device *)) |
1150 | { | 1151 | { |
1151 | u8 i; | 1152 | u8 i; |
1152 | 1153 | ||
1153 | for (i = 0; i < RNDIS_MAX_CONFIGS; i++) { | 1154 | for (i = 0; i < RNDIS_MAX_CONFIGS; i++) { |
1154 | if (!rndis_per_dev_params [i].used) { | 1155 | if (!rndis_per_dev_params [i].used) { |
1155 | rndis_per_dev_params [i].used = 1; | 1156 | rndis_per_dev_params [i].used = 1; |
@@ -1159,32 +1160,32 @@ int rndis_register (int (* rndis_control_ack) (struct net_device *)) | |||
1159 | } | 1160 | } |
1160 | } | 1161 | } |
1161 | DEBUG("failed\n"); | 1162 | DEBUG("failed\n"); |
1162 | 1163 | ||
1163 | return -1; | 1164 | return -1; |
1164 | } | 1165 | } |
1165 | 1166 | ||
1166 | void rndis_deregister (int configNr) | 1167 | void rndis_deregister (int configNr) |
1167 | { | 1168 | { |
1168 | DEBUG("%s: \n", __FUNCTION__ ); | 1169 | DEBUG("%s: \n", __FUNCTION__ ); |
1169 | 1170 | ||
1170 | if (configNr >= RNDIS_MAX_CONFIGS) return; | 1171 | if (configNr >= RNDIS_MAX_CONFIGS) return; |
1171 | rndis_per_dev_params [configNr].used = 0; | 1172 | rndis_per_dev_params [configNr].used = 0; |
1172 | 1173 | ||
1173 | return; | 1174 | return; |
1174 | } | 1175 | } |
1175 | 1176 | ||
1176 | int rndis_set_param_dev (u8 configNr, struct net_device *dev, | 1177 | int rndis_set_param_dev (u8 configNr, struct net_device *dev, |
1177 | struct net_device_stats *stats, | 1178 | struct net_device_stats *stats, |
1178 | u16 *cdc_filter) | 1179 | u16 *cdc_filter) |
1179 | { | 1180 | { |
1180 | DEBUG("%s:\n", __FUNCTION__ ); | 1181 | DEBUG("%s:\n", __FUNCTION__ ); |
1181 | if (!dev || !stats) return -1; | 1182 | if (!dev || !stats) return -1; |
1182 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; | 1183 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; |
1183 | 1184 | ||
1184 | rndis_per_dev_params [configNr].dev = dev; | 1185 | rndis_per_dev_params [configNr].dev = dev; |
1185 | rndis_per_dev_params [configNr].stats = stats; | 1186 | rndis_per_dev_params [configNr].stats = stats; |
1186 | rndis_per_dev_params [configNr].filter = cdc_filter; | 1187 | rndis_per_dev_params [configNr].filter = cdc_filter; |
1187 | 1188 | ||
1188 | return 0; | 1189 | return 0; |
1189 | } | 1190 | } |
1190 | 1191 | ||
@@ -1193,10 +1194,10 @@ int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr) | |||
1193 | DEBUG("%s:\n", __FUNCTION__ ); | 1194 | DEBUG("%s:\n", __FUNCTION__ ); |
1194 | if (!vendorDescr) return -1; | 1195 | if (!vendorDescr) return -1; |
1195 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; | 1196 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; |
1196 | 1197 | ||
1197 | rndis_per_dev_params [configNr].vendorID = vendorID; | 1198 | rndis_per_dev_params [configNr].vendorID = vendorID; |
1198 | rndis_per_dev_params [configNr].vendorDescr = vendorDescr; | 1199 | rndis_per_dev_params [configNr].vendorDescr = vendorDescr; |
1199 | 1200 | ||
1200 | return 0; | 1201 | return 0; |
1201 | } | 1202 | } |
1202 | 1203 | ||
@@ -1204,10 +1205,10 @@ int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed) | |||
1204 | { | 1205 | { |
1205 | DEBUG("%s: %u %u\n", __FUNCTION__, medium, speed); | 1206 | DEBUG("%s: %u %u\n", __FUNCTION__, medium, speed); |
1206 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; | 1207 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; |
1207 | 1208 | ||
1208 | rndis_per_dev_params [configNr].medium = medium; | 1209 | rndis_per_dev_params [configNr].medium = medium; |
1209 | rndis_per_dev_params [configNr].speed = speed; | 1210 | rndis_per_dev_params [configNr].speed = speed; |
1210 | 1211 | ||
1211 | return 0; | 1212 | return 0; |
1212 | } | 1213 | } |
1213 | 1214 | ||
@@ -1229,9 +1230,9 @@ void rndis_free_response (int configNr, u8 *buf) | |||
1229 | { | 1230 | { |
1230 | rndis_resp_t *r; | 1231 | rndis_resp_t *r; |
1231 | struct list_head *act, *tmp; | 1232 | struct list_head *act, *tmp; |
1232 | 1233 | ||
1233 | list_for_each_safe (act, tmp, | 1234 | list_for_each_safe (act, tmp, |
1234 | &(rndis_per_dev_params [configNr].resp_queue)) | 1235 | &(rndis_per_dev_params [configNr].resp_queue)) |
1235 | { | 1236 | { |
1236 | r = list_entry (act, rndis_resp_t, list); | 1237 | r = list_entry (act, rndis_resp_t, list); |
1237 | if (r && r->buf == buf) { | 1238 | if (r && r->buf == buf) { |
@@ -1244,12 +1245,12 @@ void rndis_free_response (int configNr, u8 *buf) | |||
1244 | u8 *rndis_get_next_response (int configNr, u32 *length) | 1245 | u8 *rndis_get_next_response (int configNr, u32 *length) |
1245 | { | 1246 | { |
1246 | rndis_resp_t *r; | 1247 | rndis_resp_t *r; |
1247 | struct list_head *act, *tmp; | 1248 | struct list_head *act, *tmp; |
1248 | 1249 | ||
1249 | if (!length) return NULL; | 1250 | if (!length) return NULL; |
1250 | 1251 | ||
1251 | list_for_each_safe (act, tmp, | 1252 | list_for_each_safe (act, tmp, |
1252 | &(rndis_per_dev_params [configNr].resp_queue)) | 1253 | &(rndis_per_dev_params [configNr].resp_queue)) |
1253 | { | 1254 | { |
1254 | r = list_entry (act, rndis_resp_t, list); | 1255 | r = list_entry (act, rndis_resp_t, list); |
1255 | if (!r->send) { | 1256 | if (!r->send) { |
@@ -1258,24 +1259,24 @@ u8 *rndis_get_next_response (int configNr, u32 *length) | |||
1258 | return r->buf; | 1259 | return r->buf; |
1259 | } | 1260 | } |
1260 | } | 1261 | } |
1261 | 1262 | ||
1262 | return NULL; | 1263 | return NULL; |
1263 | } | 1264 | } |
1264 | 1265 | ||
1265 | static rndis_resp_t *rndis_add_response (int configNr, u32 length) | 1266 | static rndis_resp_t *rndis_add_response (int configNr, u32 length) |
1266 | { | 1267 | { |
1267 | rndis_resp_t *r; | 1268 | rndis_resp_t *r; |
1268 | 1269 | ||
1269 | /* NOTE: this gets copied into ether.c USB_BUFSIZ bytes ... */ | 1270 | /* NOTE: this gets copied into ether.c USB_BUFSIZ bytes ... */ |
1270 | r = kmalloc (sizeof (rndis_resp_t) + length, GFP_ATOMIC); | 1271 | r = kmalloc (sizeof (rndis_resp_t) + length, GFP_ATOMIC); |
1271 | if (!r) return NULL; | 1272 | if (!r) return NULL; |
1272 | 1273 | ||
1273 | r->buf = (u8 *) (r + 1); | 1274 | r->buf = (u8 *) (r + 1); |
1274 | r->length = length; | 1275 | r->length = length; |
1275 | r->send = 0; | 1276 | r->send = 0; |
1276 | 1277 | ||
1277 | list_add_tail (&r->list, | 1278 | list_add_tail (&r->list, |
1278 | &(rndis_per_dev_params [configNr].resp_queue)); | 1279 | &(rndis_per_dev_params [configNr].resp_queue)); |
1279 | return r; | 1280 | return r; |
1280 | } | 1281 | } |
1281 | 1282 | ||
@@ -1301,14 +1302,14 @@ int rndis_rm_hdr(struct sk_buff *skb) | |||
1301 | 1302 | ||
1302 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES | 1303 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES |
1303 | 1304 | ||
1304 | static int rndis_proc_read (char *page, char **start, off_t off, int count, int *eof, | 1305 | static int rndis_proc_read (char *page, char **start, off_t off, int count, int *eof, |
1305 | void *data) | 1306 | void *data) |
1306 | { | 1307 | { |
1307 | char *out = page; | 1308 | char *out = page; |
1308 | int len; | 1309 | int len; |
1309 | rndis_params *param = (rndis_params *) data; | 1310 | rndis_params *param = (rndis_params *) data; |
1310 | 1311 | ||
1311 | out += snprintf (out, count, | 1312 | out += snprintf (out, count, |
1312 | "Config Nr. %d\n" | 1313 | "Config Nr. %d\n" |
1313 | "used : %s\n" | 1314 | "used : %s\n" |
1314 | "state : %s\n" | 1315 | "state : %s\n" |
@@ -1316,8 +1317,8 @@ static int rndis_proc_read (char *page, char **start, off_t off, int count, int | |||
1316 | "speed : %d\n" | 1317 | "speed : %d\n" |
1317 | "cable : %s\n" | 1318 | "cable : %s\n" |
1318 | "vendor ID : 0x%08X\n" | 1319 | "vendor ID : 0x%08X\n" |
1319 | "vendor : %s\n", | 1320 | "vendor : %s\n", |
1320 | param->confignr, (param->used) ? "y" : "n", | 1321 | param->confignr, (param->used) ? "y" : "n", |
1321 | ({ char *s = "?"; | 1322 | ({ char *s = "?"; |
1322 | switch (param->state) { | 1323 | switch (param->state) { |
1323 | case RNDIS_UNINITIALIZED: | 1324 | case RNDIS_UNINITIALIZED: |
@@ -1327,32 +1328,32 @@ static int rndis_proc_read (char *page, char **start, off_t off, int count, int | |||
1327 | case RNDIS_DATA_INITIALIZED: | 1328 | case RNDIS_DATA_INITIALIZED: |
1328 | s = "RNDIS_DATA_INITIALIZED"; break; | 1329 | s = "RNDIS_DATA_INITIALIZED"; break; |
1329 | }; s; }), | 1330 | }; s; }), |
1330 | param->medium, | 1331 | param->medium, |
1331 | (param->media_state) ? 0 : param->speed*100, | 1332 | (param->media_state) ? 0 : param->speed*100, |
1332 | (param->media_state) ? "disconnected" : "connected", | 1333 | (param->media_state) ? "disconnected" : "connected", |
1333 | param->vendorID, param->vendorDescr); | 1334 | param->vendorID, param->vendorDescr); |
1334 | 1335 | ||
1335 | len = out - page; | 1336 | len = out - page; |
1336 | len -= off; | 1337 | len -= off; |
1337 | 1338 | ||
1338 | if (len < count) { | 1339 | if (len < count) { |
1339 | *eof = 1; | 1340 | *eof = 1; |
1340 | if (len <= 0) | 1341 | if (len <= 0) |
1341 | return 0; | 1342 | return 0; |
1342 | } else | 1343 | } else |
1343 | len = count; | 1344 | len = count; |
1344 | 1345 | ||
1345 | *start = page + off; | 1346 | *start = page + off; |
1346 | return len; | 1347 | return len; |
1347 | } | 1348 | } |
1348 | 1349 | ||
1349 | static int rndis_proc_write (struct file *file, const char __user *buffer, | 1350 | static int rndis_proc_write (struct file *file, const char __user *buffer, |
1350 | unsigned long count, void *data) | 1351 | unsigned long count, void *data) |
1351 | { | 1352 | { |
1352 | rndis_params *p = data; | 1353 | rndis_params *p = data; |
1353 | u32 speed = 0; | 1354 | u32 speed = 0; |
1354 | int i, fl_speed = 0; | 1355 | int i, fl_speed = 0; |
1355 | 1356 | ||
1356 | for (i = 0; i < count; i++) { | 1357 | for (i = 0; i < count; i++) { |
1357 | char c; | 1358 | char c; |
1358 | if (get_user(c, buffer)) | 1359 | if (get_user(c, buffer)) |
@@ -1379,15 +1380,15 @@ static int rndis_proc_write (struct file *file, const char __user *buffer, | |||
1379 | case 'd': | 1380 | case 'd': |
1380 | rndis_signal_disconnect(p->confignr); | 1381 | rndis_signal_disconnect(p->confignr); |
1381 | break; | 1382 | break; |
1382 | default: | 1383 | default: |
1383 | if (fl_speed) p->speed = speed; | 1384 | if (fl_speed) p->speed = speed; |
1384 | else DEBUG ("%c is not valid\n", c); | 1385 | else DEBUG ("%c is not valid\n", c); |
1385 | break; | 1386 | break; |
1386 | } | 1387 | } |
1387 | 1388 | ||
1388 | buffer++; | 1389 | buffer++; |
1389 | } | 1390 | } |
1390 | 1391 | ||
1391 | return count; | 1392 | return count; |
1392 | } | 1393 | } |
1393 | 1394 | ||
@@ -1408,7 +1409,7 @@ int __init rndis_init (void) | |||
1408 | 1409 | ||
1409 | sprintf (name, NAME_TEMPLATE, i); | 1410 | sprintf (name, NAME_TEMPLATE, i); |
1410 | if (!(rndis_connect_state [i] | 1411 | if (!(rndis_connect_state [i] |
1411 | = create_proc_entry (name, 0660, NULL))) | 1412 | = create_proc_entry (name, 0660, NULL))) |
1412 | { | 1413 | { |
1413 | DEBUG ("%s :remove entries", __FUNCTION__); | 1414 | DEBUG ("%s :remove entries", __FUNCTION__); |
1414 | while (i) { | 1415 | while (i) { |
@@ -1432,7 +1433,7 @@ int __init rndis_init (void) | |||
1432 | = NDIS_MEDIA_STATE_DISCONNECTED; | 1433 | = NDIS_MEDIA_STATE_DISCONNECTED; |
1433 | INIT_LIST_HEAD (&(rndis_per_dev_params [i].resp_queue)); | 1434 | INIT_LIST_HEAD (&(rndis_per_dev_params [i].resp_queue)); |
1434 | } | 1435 | } |
1435 | 1436 | ||
1436 | return 0; | 1437 | return 0; |
1437 | } | 1438 | } |
1438 | 1439 | ||
@@ -1441,7 +1442,7 @@ void rndis_exit (void) | |||
1441 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES | 1442 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES |
1442 | u8 i; | 1443 | u8 i; |
1443 | char name [20]; | 1444 | char name [20]; |
1444 | 1445 | ||
1445 | for (i = 0; i < RNDIS_MAX_CONFIGS; i++) { | 1446 | for (i = 0; i < RNDIS_MAX_CONFIGS; i++) { |
1446 | sprintf (name, NAME_TEMPLATE, i); | 1447 | sprintf (name, NAME_TEMPLATE, i); |
1447 | remove_proc_entry (name, NULL); | 1448 | remove_proc_entry (name, NULL); |
diff --git a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h index 95b4c6326100..2956608be751 100644 --- a/drivers/usb/gadget/rndis.h +++ b/drivers/usb/gadget/rndis.h | |||
@@ -1,15 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | * RNDIS Definitions for Remote NDIS | 2 | * RNDIS Definitions for Remote NDIS |
3 | * | 3 | * |
4 | * Version: $Id: rndis.h,v 1.15 2004/03/25 21:33:46 robert Exp $ | 4 | * Version: $Id: rndis.h,v 1.15 2004/03/25 21:33:46 robert Exp $ |
5 | * | 5 | * |
6 | * Authors: Benedikt Spranger, Pengutronix | 6 | * Authors: Benedikt Spranger, Pengutronix |
7 | * Robert Schwebel, Pengutronix | 7 | * Robert Schwebel, Pengutronix |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
11 | * version 2, as published by the Free Software Foundation. | 11 | * version 2, as published by the Free Software Foundation. |
12 | * | 12 | * |
13 | * This software was originally developed in conformance with | 13 | * This software was originally developed in conformance with |
14 | * Microsoft's Remote NDIS Specification License Agreement. | 14 | * Microsoft's Remote NDIS Specification License Agreement. |
15 | */ | 15 | */ |
@@ -34,7 +34,7 @@ | |||
34 | #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BU /* Device connected */ | 34 | #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BU /* Device connected */ |
35 | #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CU /* Device disconnected */ | 35 | #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CU /* Device disconnected */ |
36 | /* For all not specified status messages: | 36 | /* For all not specified status messages: |
37 | * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx | 37 | * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx |
38 | */ | 38 | */ |
39 | 39 | ||
40 | /* Message Set for Connectionless (802.3) Devices */ | 40 | /* Message Set for Connectionless (802.3) Devices */ |
@@ -69,7 +69,7 @@ | |||
69 | #define OID_PNP_ENABLE_WAKE_UP 0xFD010106 | 69 | #define OID_PNP_ENABLE_WAKE_UP 0xFD010106 |
70 | 70 | ||
71 | 71 | ||
72 | typedef struct rndis_init_msg_type | 72 | typedef struct rndis_init_msg_type |
73 | { | 73 | { |
74 | __le32 MessageType; | 74 | __le32 MessageType; |
75 | __le32 MessageLength; | 75 | __le32 MessageLength; |
@@ -234,12 +234,12 @@ typedef struct rndis_params | |||
234 | 234 | ||
235 | const u8 *host_mac; | 235 | const u8 *host_mac; |
236 | u16 *filter; | 236 | u16 *filter; |
237 | struct net_device *dev; | 237 | struct net_device *dev; |
238 | struct net_device_stats *stats; | 238 | struct net_device_stats *stats; |
239 | 239 | ||
240 | u32 vendorID; | 240 | u32 vendorID; |
241 | const char *vendorDescr; | 241 | const char *vendorDescr; |
242 | int (*ack) (struct net_device *); | 242 | int (*ack) (struct net_device *); |
243 | struct list_head resp_queue; | 243 | struct list_head resp_queue; |
244 | } rndis_params; | 244 | } rndis_params; |
245 | 245 | ||
@@ -250,7 +250,7 @@ void rndis_deregister (int configNr); | |||
250 | int rndis_set_param_dev (u8 configNr, struct net_device *dev, | 250 | int rndis_set_param_dev (u8 configNr, struct net_device *dev, |
251 | struct net_device_stats *stats, | 251 | struct net_device_stats *stats, |
252 | u16 *cdc_filter); | 252 | u16 *cdc_filter); |
253 | int rndis_set_param_vendor (u8 configNr, u32 vendorID, | 253 | int rndis_set_param_vendor (u8 configNr, u32 vendorID, |
254 | const char *vendorDescr); | 254 | const char *vendorDescr); |
255 | int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed); | 255 | int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed); |
256 | void rndis_add_hdr (struct sk_buff *skb); | 256 | void rndis_add_hdr (struct sk_buff *skb); |