aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-12-22 13:22:50 -0500
committerDavid Vrabel <david.vrabel@csr.com>2008-12-22 13:22:50 -0500
commitbce83697c5fe84a7a5d38c96fbbe43b4bc028c3e (patch)
treeb8e920af66f5b4de509e95a7295cedbe42878dd6 /drivers/uwb
parent02f11ee181baa562df23e105ba930902f0d0b1bf (diff)
uwb: use dev_dbg() for debug messages
Instead of the home-grown d_fnstart(), d_fnend() and d_printf() macros, use dev_dbg() or remove the message entirely. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/uwb')
-rw-r--r--drivers/uwb/beacon.c10
-rw-r--r--drivers/uwb/est.c14
-rw-r--r--drivers/uwb/hwa-rc.c30
-rw-r--r--drivers/uwb/i1480/dfu/dfu.c10
-rw-r--r--drivers/uwb/i1480/dfu/mac.c18
-rw-r--r--drivers/uwb/i1480/dfu/usb.c26
-rw-r--r--drivers/uwb/i1480/i1480u-wlp/rx.c25
-rw-r--r--drivers/uwb/i1480/i1480u-wlp/tx.c66
-rw-r--r--drivers/uwb/lc-dev.c21
-rw-r--r--drivers/uwb/neh.c7
-rw-r--r--drivers/uwb/reset.c2
-rw-r--r--drivers/uwb/umc-dev.c8
-rw-r--r--drivers/uwb/uwbd.c74
-rw-r--r--drivers/uwb/whc-rc.c53
-rw-r--r--drivers/uwb/wlp/eda.c33
-rw-r--r--drivers/uwb/wlp/messages.c181
-rw-r--r--drivers/uwb/wlp/sysfs.c2
-rw-r--r--drivers/uwb/wlp/txrx.c37
-rw-r--r--drivers/uwb/wlp/wlp-lc.c61
-rw-r--r--drivers/uwb/wlp/wss-lc.c130
20 files changed, 117 insertions, 691 deletions
diff --git a/drivers/uwb/beacon.c b/drivers/uwb/beacon.c
index d9c60cb94993..0315093e2216 100644
--- a/drivers/uwb/beacon.c
+++ b/drivers/uwb/beacon.c
@@ -22,19 +22,16 @@
22 * 22 *
23 * FIXME: docs 23 * FIXME: docs
24 */ 24 */
25
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/module.h> 27#include <linux/module.h>
29#include <linux/device.h> 28#include <linux/device.h>
30#include <linux/err.h> 29#include <linux/err.h>
31#include <linux/kdev_t.h> 30#include <linux/kdev_t.h>
32#include "uwb-internal.h"
33 31
34#define D_LOCAL 0 32#include "uwb-internal.h"
35#include <linux/uwb/debug.h>
36 33
37/** Start Beaconing command structure */ 34/* Start Beaconing command structure */
38struct uwb_rc_cmd_start_beacon { 35struct uwb_rc_cmd_start_beacon {
39 struct uwb_rccb rccb; 36 struct uwb_rccb rccb;
40 __le16 wBPSTOffset; 37 __le16 wBPSTOffset;
@@ -176,9 +173,6 @@ struct uwb_beca_e *__uwb_beca_find_bydev(struct uwb_rc *rc,
176{ 173{
177 struct uwb_beca_e *bce, *next; 174 struct uwb_beca_e *bce, *next;
178 list_for_each_entry_safe(bce, next, &rc->uwb_beca.list, node) { 175 list_for_each_entry_safe(bce, next, &rc->uwb_beca.list, node) {
179 d_printf(6, NULL, "looking for addr %02x:%02x in %02x:%02x\n",
180 dev_addr->data[0], dev_addr->data[1],
181 bce->dev_addr.data[0], bce->dev_addr.data[1]);
182 if (!memcmp(&bce->dev_addr, dev_addr, sizeof(bce->dev_addr))) 176 if (!memcmp(&bce->dev_addr, dev_addr, sizeof(bce->dev_addr)))
183 goto out; 177 goto out;
184 } 178 }
diff --git a/drivers/uwb/est.c b/drivers/uwb/est.c
index 5fe566b7c845..328fcc2b6099 100644
--- a/drivers/uwb/est.c
+++ b/drivers/uwb/est.c
@@ -40,10 +40,8 @@
40 * uwb_est_get_size() 40 * uwb_est_get_size()
41 */ 41 */
42#include <linux/spinlock.h> 42#include <linux/spinlock.h>
43#define D_LOCAL 0
44#include <linux/uwb/debug.h>
45#include "uwb-internal.h"
46 43
44#include "uwb-internal.h"
47 45
48struct uwb_est { 46struct uwb_est {
49 u16 type_event_high; 47 u16 type_event_high;
@@ -52,7 +50,6 @@ struct uwb_est {
52 const struct uwb_est_entry *entry; 50 const struct uwb_est_entry *entry;
53}; 51};
54 52
55
56static struct uwb_est *uwb_est; 53static struct uwb_est *uwb_est;
57static u8 uwb_est_size; 54static u8 uwb_est_size;
58static u8 uwb_est_used; 55static u8 uwb_est_used;
@@ -440,21 +437,12 @@ ssize_t uwb_est_find_size(struct uwb_rc *rc, const struct uwb_rceb *rceb,
440 u8 *ptr = (u8 *) rceb; 437 u8 *ptr = (u8 *) rceb;
441 438
442 read_lock_irqsave(&uwb_est_lock, flags); 439 read_lock_irqsave(&uwb_est_lock, flags);
443 d_printf(2, dev, "Size query for event 0x%02x/%04x/%02x,"
444 " buffer size %ld\n",
445 (unsigned) rceb->bEventType,
446 (unsigned) le16_to_cpu(rceb->wEvent),
447 (unsigned) rceb->bEventContext,
448 (long) rceb_size);
449 size = -ENOSPC; 440 size = -ENOSPC;
450 if (rceb_size < sizeof(*rceb)) 441 if (rceb_size < sizeof(*rceb))
451 goto out; 442 goto out;
452 event = le16_to_cpu(rceb->wEvent); 443 event = le16_to_cpu(rceb->wEvent);
453 type_event_high = rceb->bEventType << 8 | (event & 0xff00) >> 8; 444 type_event_high = rceb->bEventType << 8 | (event & 0xff00) >> 8;
454 for (itr = 0; itr < uwb_est_used; itr++) { 445 for (itr = 0; itr < uwb_est_used; itr++) {
455 d_printf(3, dev, "Checking EST 0x%04x/%04x/%04x\n",
456 uwb_est[itr].type_event_high, uwb_est[itr].vendor,
457 uwb_est[itr].product);
458 if (uwb_est[itr].type_event_high != type_event_high) 446 if (uwb_est[itr].type_event_high != type_event_high)
459 continue; 447 continue;
460 size = uwb_est_get_size(rc, &uwb_est[itr], 448 size = uwb_est_get_size(rc, &uwb_est[itr],
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 158e98d08af9..559f8784acf3 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -57,9 +57,8 @@
57#include <linux/usb/wusb.h> 57#include <linux/usb/wusb.h>
58#include <linux/usb/wusb-wa.h> 58#include <linux/usb/wusb-wa.h>
59#include <linux/uwb.h> 59#include <linux/uwb.h>
60
60#include "uwb-internal.h" 61#include "uwb-internal.h"
61#define D_LOCAL 1
62#include <linux/uwb/debug.h>
63 62
64/* The device uses commands and events from the WHCI specification, although 63/* The device uses commands and events from the WHCI specification, although
65 * reporting itself as WUSB compliant. */ 64 * reporting itself as WUSB compliant. */
@@ -630,17 +629,13 @@ void hwarc_neep_cb(struct urb *urb)
630 629
631 switch (result = urb->status) { 630 switch (result = urb->status) {
632 case 0: 631 case 0:
633 d_printf(3, dev, "NEEP: receive stat %d, %zu bytes\n",
634 urb->status, (size_t)urb->actual_length);
635 uwb_rc_neh_grok(hwarc->uwb_rc, urb->transfer_buffer, 632 uwb_rc_neh_grok(hwarc->uwb_rc, urb->transfer_buffer,
636 urb->actual_length); 633 urb->actual_length);
637 break; 634 break;
638 case -ECONNRESET: /* Not an error, but a controlled situation; */ 635 case -ECONNRESET: /* Not an error, but a controlled situation; */
639 case -ENOENT: /* (we killed the URB)...so, no broadcast */ 636 case -ENOENT: /* (we killed the URB)...so, no broadcast */
640 d_printf(2, dev, "NEEP: URB reset/noent %d\n", urb->status);
641 goto out; 637 goto out;
642 case -ESHUTDOWN: /* going away! */ 638 case -ESHUTDOWN: /* going away! */
643 d_printf(2, dev, "NEEP: URB down %d\n", urb->status);
644 goto out; 639 goto out;
645 default: /* On general errors, retry unless it gets ugly */ 640 default: /* On general errors, retry unless it gets ugly */
646 if (edc_inc(&hwarc->neep_edc, EDC_MAX_ERRORS, 641 if (edc_inc(&hwarc->neep_edc, EDC_MAX_ERRORS,
@@ -649,7 +644,6 @@ void hwarc_neep_cb(struct urb *urb)
649 dev_err(dev, "NEEP: URB error %d\n", urb->status); 644 dev_err(dev, "NEEP: URB error %d\n", urb->status);
650 } 645 }
651 result = usb_submit_urb(urb, GFP_ATOMIC); 646 result = usb_submit_urb(urb, GFP_ATOMIC);
652 d_printf(3, dev, "NEEP: submit %d\n", result);
653 if (result < 0) { 647 if (result < 0) {
654 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", 648 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
655 result); 649 result);
@@ -758,11 +752,11 @@ static int hwarc_get_version(struct uwb_rc *rc)
758 itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength); 752 itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);
759 while (itr_size >= sizeof(*hdr)) { 753 while (itr_size >= sizeof(*hdr)) {
760 hdr = (struct usb_descriptor_header *) itr; 754 hdr = (struct usb_descriptor_header *) itr;
761 d_printf(3, dev, "Extra device descriptor: " 755 dev_dbg(dev, "Extra device descriptor: "
762 "type %02x/%u bytes @ %zu (%zu left)\n", 756 "type %02x/%u bytes @ %zu (%zu left)\n",
763 hdr->bDescriptorType, hdr->bLength, 757 hdr->bDescriptorType, hdr->bLength,
764 (itr - usb_dev->rawdescriptors[actconfig_idx]), 758 (itr - usb_dev->rawdescriptors[actconfig_idx]),
765 itr_size); 759 itr_size);
766 if (hdr->bDescriptorType == USB_DT_CS_RADIO_CONTROL) 760 if (hdr->bDescriptorType == USB_DT_CS_RADIO_CONTROL)
767 goto found; 761 goto found;
768 itr += hdr->bLength; 762 itr += hdr->bLength;
@@ -794,8 +788,7 @@ found:
794 goto error; 788 goto error;
795 } 789 }
796 rc->version = version; 790 rc->version = version;
797 d_printf(3, dev, "Device supports WUSB protocol version 0x%04x \n", 791 dev_dbg(dev, "Device supports WUSB protocol version 0x%04x \n", rc->version);
798 rc->version);
799 result = 0; 792 result = 0;
800error: 793error:
801 return result; 794 return result;
@@ -876,7 +869,6 @@ static void hwarc_disconnect(struct usb_interface *iface)
876 uwb_rc_rm(uwb_rc); 869 uwb_rc_rm(uwb_rc);
877 usb_put_intf(hwarc->usb_iface); 870 usb_put_intf(hwarc->usb_iface);
878 usb_put_dev(hwarc->usb_dev); 871 usb_put_dev(hwarc->usb_dev);
879 d_printf(1, &hwarc->usb_iface->dev, "freed hwarc %p\n", hwarc);
880 kfree(hwarc); 872 kfree(hwarc);
881 uwb_rc_put(uwb_rc); /* when creating the device, refcount = 1 */ 873 uwb_rc_put(uwb_rc); /* when creating the device, refcount = 1 */
882} 874}
@@ -924,13 +916,7 @@ static struct usb_driver hwarc_driver = {
924 916
925static int __init hwarc_driver_init(void) 917static int __init hwarc_driver_init(void)
926{ 918{
927 int result; 919 return usb_register(&hwarc_driver);
928 result = usb_register(&hwarc_driver);
929 if (result < 0)
930 printk(KERN_ERR "HWA-RC: Cannot register USB driver: %d\n",
931 result);
932 return result;
933
934} 920}
935module_init(hwarc_driver_init); 921module_init(hwarc_driver_init);
936 922
diff --git a/drivers/uwb/i1480/dfu/dfu.c b/drivers/uwb/i1480/dfu/dfu.c
index 9097b3b30385..da7b1d08003c 100644
--- a/drivers/uwb/i1480/dfu/dfu.c
+++ b/drivers/uwb/i1480/dfu/dfu.c
@@ -34,10 +34,7 @@
34#include <linux/uwb.h> 34#include <linux/uwb.h>
35#include <linux/random.h> 35#include <linux/random.h>
36 36
37#define D_LOCAL 0 37/*
38#include <linux/uwb/debug.h>
39
40/**
41 * i1480_rceb_check - Check RCEB for expected field values 38 * i1480_rceb_check - Check RCEB for expected field values
42 * @i1480: pointer to device for which RCEB is being checked 39 * @i1480: pointer to device for which RCEB is being checked
43 * @rceb: RCEB being checked 40 * @rceb: RCEB being checked
@@ -83,7 +80,7 @@ int i1480_rceb_check(const struct i1480 *i1480, const struct uwb_rceb *rceb,
83EXPORT_SYMBOL_GPL(i1480_rceb_check); 80EXPORT_SYMBOL_GPL(i1480_rceb_check);
84 81
85 82
86/** 83/*
87 * Execute a Radio Control Command 84 * Execute a Radio Control Command
88 * 85 *
89 * Command data has to be in i1480->cmd_buf. 86 * Command data has to be in i1480->cmd_buf.
@@ -101,7 +98,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size,
101 u8 expected_type = reply->bEventType; 98 u8 expected_type = reply->bEventType;
102 u8 context; 99 u8 context;
103 100
104 d_fnstart(3, i1480->dev, "(%p, %s, %zu)\n", i1480, cmd_name, cmd_size);
105 init_completion(&i1480->evt_complete); 101 init_completion(&i1480->evt_complete);
106 i1480->evt_result = -EINPROGRESS; 102 i1480->evt_result = -EINPROGRESS;
107 do { 103 do {
@@ -150,8 +146,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size,
150 result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context, 146 result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context,
151 expected_type, expected_event); 147 expected_type, expected_event);
152error: 148error:
153 d_fnend(3, i1480->dev, "(%p, %s, %zu) = %zd\n",
154 i1480, cmd_name, cmd_size, result);
155 return result; 149 return result;
156} 150}
157EXPORT_SYMBOL_GPL(i1480_cmd); 151EXPORT_SYMBOL_GPL(i1480_cmd);
diff --git a/drivers/uwb/i1480/dfu/mac.c b/drivers/uwb/i1480/dfu/mac.c
index 2e4d8f07c165..694d0daf88ab 100644
--- a/drivers/uwb/i1480/dfu/mac.c
+++ b/drivers/uwb/i1480/dfu/mac.c
@@ -31,9 +31,6 @@
31#include <linux/uwb.h> 31#include <linux/uwb.h>
32#include "i1480-dfu.h" 32#include "i1480-dfu.h"
33 33
34#define D_LOCAL 0
35#include <linux/uwb/debug.h>
36
37/* 34/*
38 * Descriptor for a continuous segment of MAC fw data 35 * Descriptor for a continuous segment of MAC fw data
39 */ 36 */
@@ -184,10 +181,6 @@ ssize_t i1480_fw_cmp(struct i1480 *i1480, struct fw_hdr *hdr)
184 } 181 }
185 if (memcmp(i1480->cmd_buf, bin + src_itr, result)) { 182 if (memcmp(i1480->cmd_buf, bin + src_itr, result)) {
186 u8 *buf = i1480->cmd_buf; 183 u8 *buf = i1480->cmd_buf;
187 d_printf(2, i1480->dev,
188 "original data @ %p + %u, %zu bytes\n",
189 bin, src_itr, result);
190 d_dump(4, i1480->dev, bin + src_itr, result);
191 for (cnt = 0; cnt < result; cnt++) 184 for (cnt = 0; cnt < result; cnt++)
192 if (bin[src_itr + cnt] != buf[cnt]) { 185 if (bin[src_itr + cnt] != buf[cnt]) {
193 dev_err(i1480->dev, "byte failed at " 186 dev_err(i1480->dev, "byte failed at "
@@ -224,7 +217,6 @@ int mac_fw_hdrs_push(struct i1480 *i1480, struct fw_hdr *hdr,
224 struct fw_hdr *hdr_itr; 217 struct fw_hdr *hdr_itr;
225 int verif_retry_count; 218 int verif_retry_count;
226 219
227 d_fnstart(3, dev, "(%p, %p)\n", i1480, hdr);
228 /* Now, header by header, push them to the hw */ 220 /* Now, header by header, push them to the hw */
229 for (hdr_itr = hdr; hdr_itr != NULL; hdr_itr = hdr_itr->next) { 221 for (hdr_itr = hdr; hdr_itr != NULL; hdr_itr = hdr_itr->next) {
230 verif_retry_count = 0; 222 verif_retry_count = 0;
@@ -264,7 +256,6 @@ retry:
264 break; 256 break;
265 } 257 }
266 } 258 }
267 d_fnend(3, dev, "(%zd)\n", result);
268 return result; 259 return result;
269} 260}
270 261
@@ -337,11 +328,9 @@ int __mac_fw_upload(struct i1480 *i1480, const char *fw_name,
337 const struct firmware *fw; 328 const struct firmware *fw;
338 struct fw_hdr *fw_hdrs; 329 struct fw_hdr *fw_hdrs;
339 330
340 d_fnstart(3, i1480->dev, "(%p, %s, %s)\n", i1480, fw_name, fw_tag);
341 result = request_firmware(&fw, fw_name, i1480->dev); 331 result = request_firmware(&fw, fw_name, i1480->dev);
342 if (result < 0) /* Up to caller to complain on -ENOENT */ 332 if (result < 0) /* Up to caller to complain on -ENOENT */
343 goto out; 333 goto out;
344 d_printf(3, i1480->dev, "%s fw '%s': uploading\n", fw_tag, fw_name);
345 result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size); 334 result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size);
346 if (result < 0) { 335 if (result < 0) {
347 dev_err(i1480->dev, "%s fw '%s': failed to parse firmware " 336 dev_err(i1480->dev, "%s fw '%s': failed to parse firmware "
@@ -363,8 +352,6 @@ out_hdrs_release:
363out_release: 352out_release:
364 release_firmware(fw); 353 release_firmware(fw);
365out: 354out:
366 d_fnend(3, i1480->dev, "(%p, %s, %s) = %d\n", i1480, fw_name, fw_tag,
367 result);
368 return result; 355 return result;
369} 356}
370 357
@@ -433,7 +420,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
433 int result; 420 int result;
434 u32 *val = (u32 *) i1480->cmd_buf; 421 u32 *val = (u32 *) i1480->cmd_buf;
435 422
436 d_fnstart(3, i1480->dev, "(i1480 %p)\n", i1480);
437 for (cnt = 0; cnt < 10; cnt++) { 423 for (cnt = 0; cnt < 10; cnt++) {
438 msleep(100); 424 msleep(100);
439 result = i1480->read(i1480, 0x80080000, 4); 425 result = i1480->read(i1480, 0x80080000, 4);
@@ -447,7 +433,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
447 dev_err(i1480->dev, "Timed out waiting for fw to start\n"); 433 dev_err(i1480->dev, "Timed out waiting for fw to start\n");
448 result = -ETIMEDOUT; 434 result = -ETIMEDOUT;
449out: 435out:
450 d_fnend(3, i1480->dev, "(i1480 %p) = %d\n", i1480, result);
451 return result; 436 return result;
452 437
453} 438}
@@ -467,7 +452,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
467 int result = 0, deprecated_name = 0; 452 int result = 0, deprecated_name = 0;
468 struct i1480_rceb *rcebe = (void *) i1480->evt_buf; 453 struct i1480_rceb *rcebe = (void *) i1480->evt_buf;
469 454
470 d_fnstart(3, i1480->dev, "(%p)\n", i1480);
471 result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC"); 455 result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC");
472 if (result == -ENOENT) { 456 if (result == -ENOENT) {
473 result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate, 457 result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate,
@@ -501,7 +485,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
501 dev_err(i1480->dev, "MAC fw '%s': initialization event returns " 485 dev_err(i1480->dev, "MAC fw '%s': initialization event returns "
502 "wrong size (%zu bytes vs %zu needed)\n", 486 "wrong size (%zu bytes vs %zu needed)\n",
503 i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe)); 487 i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe));
504 dump_bytes(i1480->dev, rcebe, min(i1480->evt_result, (ssize_t)32));
505 goto error_size; 488 goto error_size;
506 } 489 }
507 result = -EIO; 490 result = -EIO;
@@ -522,6 +505,5 @@ error_fw_not_running:
522error_init_timeout: 505error_init_timeout:
523error_size: 506error_size:
524error_setup: 507error_setup:
525 d_fnend(3, i1480->dev, "(i1480 %p) = %d\n", i1480, result);
526 return result; 508 return result;
527} 509}
diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
index b7ea525fc06a..686795e97195 100644
--- a/drivers/uwb/i1480/dfu/usb.c
+++ b/drivers/uwb/i1480/dfu/usb.c
@@ -43,10 +43,6 @@
43#include <linux/usb/wusb-wa.h> 43#include <linux/usb/wusb-wa.h>
44#include "i1480-dfu.h" 44#include "i1480-dfu.h"
45 45
46#define D_LOCAL 0
47#include <linux/uwb/debug.h>
48
49
50struct i1480_usb { 46struct i1480_usb {
51 struct i1480 i1480; 47 struct i1480 i1480;
52 struct usb_device *usb_dev; 48 struct usb_device *usb_dev;
@@ -117,8 +113,6 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
117 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 113 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
118 size_t buffer_size, itr = 0; 114 size_t buffer_size, itr = 0;
119 115
120 d_fnstart(3, i1480->dev, "(%p, 0x%08x, %p, %zu)\n",
121 i1480, memory_address, buffer, size);
122 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */ 116 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */
123 while (size > 0) { 117 while (size > 0) {
124 buffer_size = size < i1480->buf_size ? size : i1480->buf_size; 118 buffer_size = size < i1480->buf_size ? size : i1480->buf_size;
@@ -131,16 +125,10 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
131 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */); 125 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */);
132 if (result < 0) 126 if (result < 0)
133 break; 127 break;
134 d_printf(3, i1480->dev,
135 "wrote @ 0x%08x %u bytes (of %zu bytes requested)\n",
136 memory_address, result, buffer_size);
137 d_dump(4, i1480->dev, i1480->cmd_buf, result);
138 itr += result; 128 itr += result;
139 memory_address += result; 129 memory_address += result;
140 size -= result; 130 size -= result;
141 } 131 }
142 d_fnend(3, i1480->dev, "(%p, 0x%08x, %p, %zu) = %d\n",
143 i1480, memory_address, buffer, size, result);
144 return result; 132 return result;
145} 133}
146 134
@@ -165,8 +153,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
165 size_t itr, read_size = i1480->buf_size; 153 size_t itr, read_size = i1480->buf_size;
166 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 154 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
167 155
168 d_fnstart(3, i1480->dev, "(%p, 0x%08x, %zu)\n",
169 i1480, addr, size);
170 BUG_ON(size > i1480->buf_size); 156 BUG_ON(size > i1480->buf_size);
171 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */ 157 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */
172 BUG_ON(read_size > 512); 158 BUG_ON(read_size > 512);
@@ -200,10 +186,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
200 } 186 }
201 result = bytes; 187 result = bytes;
202out: 188out:
203 d_fnend(3, i1480->dev, "(%p, 0x%08x, %zu) = %zd\n",
204 i1480, addr, size, result);
205 if (result > 0)
206 d_dump(4, i1480->dev, i1480->cmd_buf, result);
207 return result; 189 return result;
208} 190}
209 191
@@ -259,7 +241,6 @@ int i1480_usb_wait_init_done(struct i1480 *i1480)
259 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 241 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
260 struct usb_endpoint_descriptor *epd; 242 struct usb_endpoint_descriptor *epd;
261 243
262 d_fnstart(3, dev, "(%p)\n", i1480);
263 init_completion(&i1480->evt_complete); 244 init_completion(&i1480->evt_complete);
264 i1480->evt_result = -EINPROGRESS; 245 i1480->evt_result = -EINPROGRESS;
265 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc; 246 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc;
@@ -281,14 +262,12 @@ int i1480_usb_wait_init_done(struct i1480 *i1480)
281 goto error_wait; 262 goto error_wait;
282 } 263 }
283 usb_kill_urb(i1480_usb->neep_urb); 264 usb_kill_urb(i1480_usb->neep_urb);
284 d_fnend(3, dev, "(%p) = 0\n", i1480);
285 return 0; 265 return 0;
286 266
287error_wait: 267error_wait:
288 usb_kill_urb(i1480_usb->neep_urb); 268 usb_kill_urb(i1480_usb->neep_urb);
289error_submit: 269error_submit:
290 i1480->evt_result = result; 270 i1480->evt_result = result;
291 d_fnend(3, dev, "(%p) = %d\n", i1480, result);
292 return result; 271 return result;
293} 272}
294 273
@@ -319,7 +298,6 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size)
319 struct uwb_rccb *cmd = i1480->cmd_buf; 298 struct uwb_rccb *cmd = i1480->cmd_buf;
320 u8 iface_no; 299 u8 iface_no;
321 300
322 d_fnstart(3, dev, "(%p, %s, %zu)\n", i1480, cmd_name, cmd_size);
323 /* Post a read on the notification & event endpoint */ 301 /* Post a read on the notification & event endpoint */
324 iface_no = i1480_usb->usb_iface->cur_altsetting->desc.bInterfaceNumber; 302 iface_no = i1480_usb->usb_iface->cur_altsetting->desc.bInterfaceNumber;
325 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc; 303 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc;
@@ -347,15 +325,11 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size)
347 cmd_name, result); 325 cmd_name, result);
348 goto error_submit_ep0; 326 goto error_submit_ep0;
349 } 327 }
350 d_fnend(3, dev, "(%p, %s, %zu) = %d\n",
351 i1480, cmd_name, cmd_size, result);
352 return result; 328 return result;
353 329
354error_submit_ep0: 330error_submit_ep0:
355 usb_kill_urb(i1480_usb->neep_urb); 331 usb_kill_urb(i1480_usb->neep_urb);
356error_submit_ep1: 332error_submit_ep1:
357 d_fnend(3, dev, "(%p, %s, %zu) = %d\n",
358 i1480, cmd_name, cmd_size, result);
359 return result; 333 return result;
360} 334}
361 335
diff --git a/drivers/uwb/i1480/i1480u-wlp/rx.c b/drivers/uwb/i1480/i1480u-wlp/rx.c
index 9fc035354a76..34f4cf9a7d34 100644
--- a/drivers/uwb/i1480/i1480u-wlp/rx.c
+++ b/drivers/uwb/i1480/i1480u-wlp/rx.c
@@ -68,11 +68,7 @@
68#include <linux/etherdevice.h> 68#include <linux/etherdevice.h>
69#include "i1480u-wlp.h" 69#include "i1480u-wlp.h"
70 70
71#define D_LOCAL 0 71/*
72#include <linux/uwb/debug.h>
73
74
75/**
76 * Setup the RX context 72 * Setup the RX context
77 * 73 *
78 * Each URB is provided with a transfer_buffer that is the data field 74 * Each URB is provided with a transfer_buffer that is the data field
@@ -129,7 +125,7 @@ error:
129} 125}
130 126
131 127
132/** Release resources associated to the rx context */ 128/* Release resources associated to the rx context */
133void i1480u_rx_release(struct i1480u *i1480u) 129void i1480u_rx_release(struct i1480u *i1480u)
134{ 130{
135 int cnt; 131 int cnt;
@@ -155,7 +151,7 @@ void i1480u_rx_unlink_urbs(struct i1480u *i1480u)
155 } 151 }
156} 152}
157 153
158/** Fix an out-of-sequence packet */ 154/* Fix an out-of-sequence packet */
159#define i1480u_fix(i1480u, msg...) \ 155#define i1480u_fix(i1480u, msg...) \
160do { \ 156do { \
161 if (printk_ratelimit()) \ 157 if (printk_ratelimit()) \
@@ -166,7 +162,7 @@ do { \
166} while (0) 162} while (0)
167 163
168 164
169/** Drop an out-of-sequence packet */ 165/* Drop an out-of-sequence packet */
170#define i1480u_drop(i1480u, msg...) \ 166#define i1480u_drop(i1480u, msg...) \
171do { \ 167do { \
172 if (printk_ratelimit()) \ 168 if (printk_ratelimit()) \
@@ -177,7 +173,7 @@ do { \
177 173
178 174
179 175
180/** Finalizes setting up the SKB and delivers it 176/* Finalizes setting up the SKB and delivers it
181 * 177 *
182 * We first pass the incoming frame to WLP substack for verification. It 178 * We first pass the incoming frame to WLP substack for verification. It
183 * may also be a WLP association frame in which case WLP will take over the 179 * may also be a WLP association frame in which case WLP will take over the
@@ -192,18 +188,11 @@ void i1480u_skb_deliver(struct i1480u *i1480u)
192 struct net_device *net_dev = i1480u->net_dev; 188 struct net_device *net_dev = i1480u->net_dev;
193 struct device *dev = &i1480u->usb_iface->dev; 189 struct device *dev = &i1480u->usb_iface->dev;
194 190
195 d_printf(6, dev, "RX delivered pre skb(%p), %u bytes\n",
196 i1480u->rx_skb, i1480u->rx_skb->len);
197 d_dump(7, dev, i1480u->rx_skb->data, i1480u->rx_skb->len);
198 should_parse = wlp_receive_frame(dev, &i1480u->wlp, i1480u->rx_skb, 191 should_parse = wlp_receive_frame(dev, &i1480u->wlp, i1480u->rx_skb,
199 &i1480u->rx_srcaddr); 192 &i1480u->rx_srcaddr);
200 if (!should_parse) 193 if (!should_parse)
201 goto out; 194 goto out;
202 i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev); 195 i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev);
203 d_printf(5, dev, "RX delivered skb(%p), %u bytes\n",
204 i1480u->rx_skb, i1480u->rx_skb->len);
205 d_dump(7, dev, i1480u->rx_skb->data,
206 i1480u->rx_skb->len > 72 ? 72 : i1480u->rx_skb->len);
207 i1480u->stats.rx_packets++; 196 i1480u->stats.rx_packets++;
208 i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size; 197 i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size;
209 net_dev->last_rx = jiffies; 198 net_dev->last_rx = jiffies;
@@ -216,7 +205,7 @@ out:
216} 205}
217 206
218 207
219/** 208/*
220 * Process a buffer of data received from the USB RX endpoint 209 * Process a buffer of data received from the USB RX endpoint
221 * 210 *
222 * First fragment arrives with next or last fragment. All other fragments 211 * First fragment arrives with next or last fragment. All other fragments
@@ -404,7 +393,7 @@ out:
404} 393}
405 394
406 395
407/** 396/*
408 * Called when an RX URB has finished receiving or has found some kind 397 * Called when an RX URB has finished receiving or has found some kind
409 * of error condition. 398 * of error condition.
410 * 399 *
diff --git a/drivers/uwb/i1480/i1480u-wlp/tx.c b/drivers/uwb/i1480/i1480u-wlp/tx.c
index 3426bfb68240..39032cc3503e 100644
--- a/drivers/uwb/i1480/i1480u-wlp/tx.c
+++ b/drivers/uwb/i1480/i1480u-wlp/tx.c
@@ -55,8 +55,6 @@
55 */ 55 */
56 56
57#include "i1480u-wlp.h" 57#include "i1480u-wlp.h"
58#define D_LOCAL 5
59#include <linux/uwb/debug.h>
60 58
61enum { 59enum {
62 /* This is only for Next and Last TX packets */ 60 /* This is only for Next and Last TX packets */
@@ -64,7 +62,7 @@ enum {
64 - sizeof(struct untd_hdr_rst), 62 - sizeof(struct untd_hdr_rst),
65}; 63};
66 64
67/** Free resources allocated to a i1480u tx context. */ 65/* Free resources allocated to a i1480u tx context. */
68static 66static
69void i1480u_tx_free(struct i1480u_tx *wtx) 67void i1480u_tx_free(struct i1480u_tx *wtx)
70{ 68{
@@ -99,7 +97,7 @@ void i1480u_tx_unlink_urbs(struct i1480u *i1480u)
99} 97}
100 98
101 99
102/** 100/*
103 * Callback for a completed tx USB URB. 101 * Callback for a completed tx USB URB.
104 * 102 *
105 * TODO: 103 * TODO:
@@ -149,8 +147,6 @@ void i1480u_tx_cb(struct urb *urb)
149 <= i1480u->tx_inflight.threshold 147 <= i1480u->tx_inflight.threshold
150 && netif_queue_stopped(net_dev) 148 && netif_queue_stopped(net_dev)
151 && i1480u->tx_inflight.threshold != 0) { 149 && i1480u->tx_inflight.threshold != 0) {
152 if (d_test(2) && printk_ratelimit())
153 d_printf(2, dev, "Restart queue. \n");
154 netif_start_queue(net_dev); 150 netif_start_queue(net_dev);
155 atomic_inc(&i1480u->tx_inflight.restart_count); 151 atomic_inc(&i1480u->tx_inflight.restart_count);
156 } 152 }
@@ -158,7 +154,7 @@ void i1480u_tx_cb(struct urb *urb)
158} 154}
159 155
160 156
161/** 157/*
162 * Given a buffer that doesn't fit in a single fragment, create an 158 * Given a buffer that doesn't fit in a single fragment, create an
163 * scatter/gather structure for delivery to the USB pipe. 159 * scatter/gather structure for delivery to the USB pipe.
164 * 160 *
@@ -253,15 +249,11 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
253 /* Now do each remaining fragment */ 249 /* Now do each remaining fragment */
254 result = -EINVAL; 250 result = -EINVAL;
255 while (pl_size_left > 0) { 251 while (pl_size_left > 0) {
256 d_printf(5, NULL, "ITR HDR: pl_size_left %zu buf_itr %zu\n",
257 pl_size_left, buf_itr - wtx->buf);
258 if (buf_itr + sizeof(*untd_hdr_rst) - wtx->buf 252 if (buf_itr + sizeof(*untd_hdr_rst) - wtx->buf
259 > wtx->buf_size) { 253 > wtx->buf_size) {
260 printk(KERN_ERR "BUG: no space for header\n"); 254 printk(KERN_ERR "BUG: no space for header\n");
261 goto error_bug; 255 goto error_bug;
262 } 256 }
263 d_printf(5, NULL, "ITR HDR 2: pl_size_left %zu buf_itr %zu\n",
264 pl_size_left, buf_itr - wtx->buf);
265 untd_hdr_rst = buf_itr; 257 untd_hdr_rst = buf_itr;
266 buf_itr += sizeof(*untd_hdr_rst); 258 buf_itr += sizeof(*untd_hdr_rst);
267 if (pl_size_left > i1480u_MAX_PL_SIZE) { 259 if (pl_size_left > i1480u_MAX_PL_SIZE) {
@@ -271,9 +263,6 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
271 frg_pl_size = pl_size_left; 263 frg_pl_size = pl_size_left;
272 untd_hdr_set_type(&untd_hdr_rst->hdr, i1480u_PKT_FRAG_LST); 264 untd_hdr_set_type(&untd_hdr_rst->hdr, i1480u_PKT_FRAG_LST);
273 } 265 }
274 d_printf(5, NULL,
275 "ITR PL: pl_size_left %zu buf_itr %zu frg_pl_size %zu\n",
276 pl_size_left, buf_itr - wtx->buf, frg_pl_size);
277 untd_hdr_set_rx_tx(&untd_hdr_rst->hdr, 0); 266 untd_hdr_set_rx_tx(&untd_hdr_rst->hdr, 0);
278 untd_hdr_rst->hdr.len = cpu_to_le16(frg_pl_size); 267 untd_hdr_rst->hdr.len = cpu_to_le16(frg_pl_size);
279 untd_hdr_rst->padding = 0; 268 untd_hdr_rst->padding = 0;
@@ -286,9 +275,6 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
286 buf_itr += frg_pl_size; 275 buf_itr += frg_pl_size;
287 pl_itr += frg_pl_size; 276 pl_itr += frg_pl_size;
288 pl_size_left -= frg_pl_size; 277 pl_size_left -= frg_pl_size;
289 d_printf(5, NULL,
290 "ITR PL 2: pl_size_left %zu buf_itr %zu frg_pl_size %zu\n",
291 pl_size_left, buf_itr - wtx->buf, frg_pl_size);
292 } 278 }
293 dev_kfree_skb_irq(skb); 279 dev_kfree_skb_irq(skb);
294 return 0; 280 return 0;
@@ -308,7 +294,7 @@ error_buf_alloc:
308} 294}
309 295
310 296
311/** 297/*
312 * Given a buffer that fits in a single fragment, fill out a @wtx 298 * Given a buffer that fits in a single fragment, fill out a @wtx
313 * struct for transmitting it down the USB pipe. 299 * struct for transmitting it down the USB pipe.
314 * 300 *
@@ -346,7 +332,7 @@ int i1480u_tx_create_1(struct i1480u_tx *wtx, struct sk_buff *skb,
346} 332}
347 333
348 334
349/** 335/*
350 * Given a skb to transmit, massage it to become palatable for the TX pipe 336 * Given a skb to transmit, massage it to become palatable for the TX pipe
351 * 337 *
352 * This will break the buffer in chunks smaller than 338 * This will break the buffer in chunks smaller than
@@ -425,7 +411,7 @@ error_wtx_alloc:
425 return NULL; 411 return NULL;
426} 412}
427 413
428/** 414/*
429 * Actual fragmentation and transmission of frame 415 * Actual fragmentation and transmission of frame
430 * 416 *
431 * @wlp: WLP substack data structure 417 * @wlp: WLP substack data structure
@@ -447,20 +433,12 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
447 struct i1480u_tx *wtx; 433 struct i1480u_tx *wtx;
448 struct wlp_tx_hdr *wlp_tx_hdr; 434 struct wlp_tx_hdr *wlp_tx_hdr;
449 static unsigned char dev_bcast[2] = { 0xff, 0xff }; 435 static unsigned char dev_bcast[2] = { 0xff, 0xff };
450#if 0
451 int lockup = 50;
452#endif
453 436
454 d_fnstart(6, dev, "(skb %p (%u), net_dev %p)\n", skb, skb->len,
455 net_dev);
456 BUG_ON(i1480u->wlp.rc == NULL); 437 BUG_ON(i1480u->wlp.rc == NULL);
457 if ((net_dev->flags & IFF_UP) == 0) 438 if ((net_dev->flags & IFF_UP) == 0)
458 goto out; 439 goto out;
459 result = -EBUSY; 440 result = -EBUSY;
460 if (atomic_read(&i1480u->tx_inflight.count) >= i1480u->tx_inflight.max) { 441 if (atomic_read(&i1480u->tx_inflight.count) >= i1480u->tx_inflight.max) {
461 if (d_test(2) && printk_ratelimit())
462 d_printf(2, dev, "Max frames in flight "
463 "stopping queue.\n");
464 netif_stop_queue(net_dev); 442 netif_stop_queue(net_dev);
465 goto error_max_inflight; 443 goto error_max_inflight;
466 } 444 }
@@ -489,21 +467,6 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
489 wlp_tx_hdr_set_delivery_id_type(wlp_tx_hdr, i1480u->options.pca_base_priority); 467 wlp_tx_hdr_set_delivery_id_type(wlp_tx_hdr, i1480u->options.pca_base_priority);
490 } 468 }
491 469
492#if 0
493 dev_info(dev, "TX delivering skb -> USB, %zu bytes\n", skb->len);
494 dump_bytes(dev, skb->data, skb->len > 72 ? 72 : skb->len);
495#endif
496#if 0
497 /* simulates a device lockup after every lockup# packets */
498 if (lockup && ((i1480u->stats.tx_packets + 1) % lockup) == 0) {
499 /* Simulate a dropped transmit interrupt */
500 net_dev->trans_start = jiffies;
501 netif_stop_queue(net_dev);
502 dev_err(dev, "Simulate lockup at %ld\n", jiffies);
503 return result;
504 }
505#endif
506
507 result = usb_submit_urb(wtx->urb, GFP_ATOMIC); /* Go baby */ 470 result = usb_submit_urb(wtx->urb, GFP_ATOMIC); /* Go baby */
508 if (result < 0) { 471 if (result < 0) {
509 dev_err(dev, "TX: cannot submit URB: %d\n", result); 472 dev_err(dev, "TX: cannot submit URB: %d\n", result);
@@ -513,8 +476,6 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
513 } 476 }
514 atomic_inc(&i1480u->tx_inflight.count); 477 atomic_inc(&i1480u->tx_inflight.count);
515 net_dev->trans_start = jiffies; 478 net_dev->trans_start = jiffies;
516 d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
517 net_dev, result);
518 return result; 479 return result;
519 480
520error_tx_urb_submit: 481error_tx_urb_submit:
@@ -522,13 +483,11 @@ error_tx_urb_submit:
522error_wtx_alloc: 483error_wtx_alloc:
523error_max_inflight: 484error_max_inflight:
524out: 485out:
525 d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
526 net_dev, result);
527 return result; 486 return result;
528} 487}
529 488
530 489
531/** 490/*
532 * Transmit an skb Called when an skbuf has to be transmitted 491 * Transmit an skb Called when an skbuf has to be transmitted
533 * 492 *
534 * The skb is first passed to WLP substack to ensure this is a valid 493 * The skb is first passed to WLP substack to ensure this is a valid
@@ -551,9 +510,6 @@ int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
551 struct device *dev = &i1480u->usb_iface->dev; 510 struct device *dev = &i1480u->usb_iface->dev;
552 struct uwb_dev_addr dst; 511 struct uwb_dev_addr dst;
553 512
554 d_fnstart(6, dev, "(skb %p (%u), net_dev %p)\n", skb, skb->len,
555 net_dev);
556 BUG_ON(i1480u->wlp.rc == NULL);
557 if ((net_dev->flags & IFF_UP) == 0) 513 if ((net_dev->flags & IFF_UP) == 0)
558 goto error; 514 goto error;
559 result = wlp_prepare_tx_frame(dev, &i1480u->wlp, skb, &dst); 515 result = wlp_prepare_tx_frame(dev, &i1480u->wlp, skb, &dst);
@@ -562,31 +518,25 @@ int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
562 "Dropping packet.\n", result); 518 "Dropping packet.\n", result);
563 goto error; 519 goto error;
564 } else if (result == 1) { 520 } else if (result == 1) {
565 d_printf(6, dev, "WLP will transmit frame. \n");
566 /* trans_start time will be set when WLP actually transmits 521 /* trans_start time will be set when WLP actually transmits
567 * the frame */ 522 * the frame */
568 goto out; 523 goto out;
569 } 524 }
570 d_printf(6, dev, "Transmitting frame. \n");
571 result = i1480u_xmit_frame(&i1480u->wlp, skb, &dst); 525 result = i1480u_xmit_frame(&i1480u->wlp, skb, &dst);
572 if (result < 0) { 526 if (result < 0) {
573 dev_err(dev, "Frame TX failed (%d).\n", result); 527 dev_err(dev, "Frame TX failed (%d).\n", result);
574 goto error; 528 goto error;
575 } 529 }
576 d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
577 net_dev, result);
578 return NETDEV_TX_OK; 530 return NETDEV_TX_OK;
579error: 531error:
580 dev_kfree_skb_any(skb); 532 dev_kfree_skb_any(skb);
581 i1480u->stats.tx_dropped++; 533 i1480u->stats.tx_dropped++;
582out: 534out:
583 d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
584 net_dev, result);
585 return NETDEV_TX_OK; 535 return NETDEV_TX_OK;
586} 536}
587 537
588 538
589/** 539/*
590 * Called when a pkt transmission doesn't complete in a reasonable period 540 * Called when a pkt transmission doesn't complete in a reasonable period
591 * Device reset may sleep - do it outside of interrupt context (delayed) 541 * Device reset may sleep - do it outside of interrupt context (delayed)
592 */ 542 */
diff --git a/drivers/uwb/lc-dev.c b/drivers/uwb/lc-dev.c
index 15f856c9689a..f78087b85918 100644
--- a/drivers/uwb/lc-dev.c
+++ b/drivers/uwb/lc-dev.c
@@ -22,7 +22,6 @@
22 * 22 *
23 * FIXME: docs 23 * FIXME: docs
24 */ 24 */
25
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/device.h> 26#include <linux/device.h>
28#include <linux/err.h> 27#include <linux/err.h>
@@ -30,10 +29,6 @@
30#include <linux/random.h> 29#include <linux/random.h>
31#include "uwb-internal.h" 30#include "uwb-internal.h"
32 31
33#define D_LOCAL 1
34#include <linux/uwb/debug.h>
35
36
37/* We initialize addresses to 0xff (invalid, as it is bcast) */ 32/* We initialize addresses to 0xff (invalid, as it is bcast) */
38static inline void uwb_dev_addr_init(struct uwb_dev_addr *addr) 33static inline void uwb_dev_addr_init(struct uwb_dev_addr *addr)
39{ 34{
@@ -104,12 +99,9 @@ static void uwb_dev_sys_release(struct device *dev)
104{ 99{
105 struct uwb_dev *uwb_dev = to_uwb_dev(dev); 100 struct uwb_dev *uwb_dev = to_uwb_dev(dev);
106 101
107 d_fnstart(4, NULL, "(dev %p uwb_dev %p)\n", dev, uwb_dev);
108 uwb_bce_put(uwb_dev->bce); 102 uwb_bce_put(uwb_dev->bce);
109 d_printf(0, &uwb_dev->dev, "uwb_dev %p freed\n", uwb_dev);
110 memset(uwb_dev, 0x69, sizeof(*uwb_dev)); 103 memset(uwb_dev, 0x69, sizeof(*uwb_dev));
111 kfree(uwb_dev); 104 kfree(uwb_dev);
112 d_fnend(4, NULL, "(dev %p uwb_dev %p) = void\n", dev, uwb_dev);
113} 105}
114 106
115/* 107/*
@@ -275,12 +267,8 @@ static struct attribute_group *groups[] = {
275 */ 267 */
276static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev) 268static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev)
277{ 269{
278 int result;
279 struct device *dev; 270 struct device *dev;
280 271
281 d_fnstart(4, NULL, "(uwb_dev %p parent_dev %p)\n", uwb_dev, parent_dev);
282 BUG_ON(parent_dev == NULL);
283
284 dev = &uwb_dev->dev; 272 dev = &uwb_dev->dev;
285 /* Device sysfs files are only useful for neighbor devices not 273 /* Device sysfs files are only useful for neighbor devices not
286 local radio controllers. */ 274 local radio controllers. */
@@ -289,18 +277,14 @@ static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev)
289 dev->parent = parent_dev; 277 dev->parent = parent_dev;
290 dev_set_drvdata(dev, uwb_dev); 278 dev_set_drvdata(dev, uwb_dev);
291 279
292 result = device_add(dev); 280 return device_add(dev);
293 d_fnend(4, NULL, "(uwb_dev %p parent_dev %p) = %d\n", uwb_dev, parent_dev, result);
294 return result;
295} 281}
296 282
297 283
298static void __uwb_dev_sys_rm(struct uwb_dev *uwb_dev) 284static void __uwb_dev_sys_rm(struct uwb_dev *uwb_dev)
299{ 285{
300 d_fnstart(4, NULL, "(uwb_dev %p)\n", uwb_dev);
301 dev_set_drvdata(&uwb_dev->dev, NULL); 286 dev_set_drvdata(&uwb_dev->dev, NULL);
302 device_del(&uwb_dev->dev); 287 device_del(&uwb_dev->dev);
303 d_fnend(4, NULL, "(uwb_dev %p) = void\n", uwb_dev);
304} 288}
305 289
306 290
@@ -384,7 +368,6 @@ int __uwb_dev_offair(struct uwb_dev *uwb_dev, struct uwb_rc *rc)
384 struct device *dev = &uwb_dev->dev; 368 struct device *dev = &uwb_dev->dev;
385 char macbuf[UWB_ADDR_STRSIZE], devbuf[UWB_ADDR_STRSIZE]; 369 char macbuf[UWB_ADDR_STRSIZE], devbuf[UWB_ADDR_STRSIZE];
386 370
387 d_fnstart(3, NULL, "(dev %p [uwb_dev %p], uwb_rc %p)\n", dev, uwb_dev, rc);
388 uwb_mac_addr_print(macbuf, sizeof(macbuf), &uwb_dev->mac_addr); 371 uwb_mac_addr_print(macbuf, sizeof(macbuf), &uwb_dev->mac_addr);
389 uwb_dev_addr_print(devbuf, sizeof(devbuf), &uwb_dev->dev_addr); 372 uwb_dev_addr_print(devbuf, sizeof(devbuf), &uwb_dev->dev_addr);
390 dev_info(dev, "uwb device (mac %s dev %s) disconnected from %s %s\n", 373 dev_info(dev, "uwb device (mac %s dev %s) disconnected from %s %s\n",
@@ -393,7 +376,7 @@ int __uwb_dev_offair(struct uwb_dev *uwb_dev, struct uwb_rc *rc)
393 rc ? dev_name(rc->uwb_dev.dev.parent) : ""); 376 rc ? dev_name(rc->uwb_dev.dev.parent) : "");
394 uwb_dev_rm(uwb_dev); 377 uwb_dev_rm(uwb_dev);
395 uwb_dev_put(uwb_dev); /* for the creation in _onair() */ 378 uwb_dev_put(uwb_dev); /* for the creation in _onair() */
396 d_fnend(3, NULL, "(dev %p [uwb_dev %p], uwb_rc %p) = 0\n", dev, uwb_dev, rc); 379
397 return 0; 380 return 0;
398} 381}
399 382
diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c
index 6df18eda1fdb..0af8916d9bef 100644
--- a/drivers/uwb/neh.c
+++ b/drivers/uwb/neh.c
@@ -86,8 +86,6 @@
86#include <linux/err.h> 86#include <linux/err.h>
87 87
88#include "uwb-internal.h" 88#include "uwb-internal.h"
89#define D_LOCAL 0
90#include <linux/uwb/debug.h>
91 89
92/* 90/*
93 * UWB Radio Controller Notification/Event Handle 91 * UWB Radio Controller Notification/Event Handle
@@ -479,8 +477,6 @@ void uwb_rc_neh_grok(struct uwb_rc *rc, void *buf, size_t buf_size)
479 size_t size, real_size, event_size; 477 size_t size, real_size, event_size;
480 int needtofree; 478 int needtofree;
481 479
482 d_fnstart(3, dev, "(rc %p buf %p %zu buf_size)\n", rc, buf, buf_size);
483 d_printf(2, dev, "groking event block: %zu bytes\n", buf_size);
484 itr = buf; 480 itr = buf;
485 size = buf_size; 481 size = buf_size;
486 while (size > 0) { 482 while (size > 0) {
@@ -528,10 +524,7 @@ void uwb_rc_neh_grok(struct uwb_rc *rc, void *buf, size_t buf_size)
528 524
529 itr += real_size; 525 itr += real_size;
530 size -= real_size; 526 size -= real_size;
531 d_printf(2, dev, "consumed %zd bytes, %zu left\n",
532 event_size, size);
533 } 527 }
534 d_fnend(3, dev, "(rc %p buf %p %zu buf_size) = void\n", rc, buf, buf_size);
535} 528}
536EXPORT_SYMBOL_GPL(uwb_rc_neh_grok); 529EXPORT_SYMBOL_GPL(uwb_rc_neh_grok);
537 530
diff --git a/drivers/uwb/reset.c b/drivers/uwb/reset.c
index ce8283cc8098..70f8050221ff 100644
--- a/drivers/uwb/reset.c
+++ b/drivers/uwb/reset.c
@@ -32,8 +32,6 @@
32#include <linux/err.h> 32#include <linux/err.h>
33 33
34#include "uwb-internal.h" 34#include "uwb-internal.h"
35#define D_LOCAL 0
36#include <linux/uwb/debug.h>
37 35
38/** 36/**
39 * Command result codes (WUSB1.0[T8-69]) 37 * Command result codes (WUSB1.0[T8-69])
diff --git a/drivers/uwb/umc-dev.c b/drivers/uwb/umc-dev.c
index 53207e14cd8f..1fc7d8270bb8 100644
--- a/drivers/uwb/umc-dev.c
+++ b/drivers/uwb/umc-dev.c
@@ -7,8 +7,6 @@
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/uwb/umc.h> 9#include <linux/uwb/umc.h>
10#define D_LOCAL 0
11#include <linux/uwb/debug.h>
12 10
13static void umc_device_release(struct device *dev) 11static void umc_device_release(struct device *dev)
14{ 12{
@@ -53,8 +51,6 @@ int umc_device_register(struct umc_dev *umc)
53{ 51{
54 int err; 52 int err;
55 53
56 d_fnstart(3, &umc->dev, "(umc_dev %p)\n", umc);
57
58 err = request_resource(umc->resource.parent, &umc->resource); 54 err = request_resource(umc->resource.parent, &umc->resource);
59 if (err < 0) { 55 if (err < 0) {
60 dev_err(&umc->dev, "can't allocate resource range " 56 dev_err(&umc->dev, "can't allocate resource range "
@@ -68,13 +64,11 @@ int umc_device_register(struct umc_dev *umc)
68 err = device_register(&umc->dev); 64 err = device_register(&umc->dev);
69 if (err < 0) 65 if (err < 0)
70 goto error_device_register; 66 goto error_device_register;
71 d_fnend(3, &umc->dev, "(umc_dev %p) = 0\n", umc);
72 return 0; 67 return 0;
73 68
74error_device_register: 69error_device_register:
75 release_resource(&umc->resource); 70 release_resource(&umc->resource);
76error_request_resource: 71error_request_resource:
77 d_fnend(3, &umc->dev, "(umc_dev %p) = %d\n", umc, err);
78 return err; 72 return err;
79} 73}
80EXPORT_SYMBOL_GPL(umc_device_register); 74EXPORT_SYMBOL_GPL(umc_device_register);
@@ -94,10 +88,8 @@ void umc_device_unregister(struct umc_dev *umc)
94 if (!umc) 88 if (!umc)
95 return; 89 return;
96 dev = get_device(&umc->dev); 90 dev = get_device(&umc->dev);
97 d_fnstart(3, dev, "(umc_dev %p)\n", umc);
98 device_unregister(&umc->dev); 91 device_unregister(&umc->dev);
99 release_resource(&umc->resource); 92 release_resource(&umc->resource);
100 d_fnend(3, dev, "(umc_dev %p) = void\n", umc);
101 put_device(dev); 93 put_device(dev);
102} 94}
103EXPORT_SYMBOL_GPL(umc_device_unregister); 95EXPORT_SYMBOL_GPL(umc_device_unregister);
diff --git a/drivers/uwb/uwbd.c b/drivers/uwb/uwbd.c
index ec42ce92dbce..57bd6bfef37e 100644
--- a/drivers/uwb/uwbd.c
+++ b/drivers/uwb/uwbd.c
@@ -68,17 +68,13 @@
68 * 68 *
69 * Handler functions are called normally uwbd_evt_handle_*(). 69 * Handler functions are called normally uwbd_evt_handle_*().
70 */ 70 */
71
72#include <linux/kthread.h> 71#include <linux/kthread.h>
73#include <linux/module.h> 72#include <linux/module.h>
74#include <linux/freezer.h> 73#include <linux/freezer.h>
75#include "uwb-internal.h"
76
77#define D_LOCAL 1
78#include <linux/uwb/debug.h>
79 74
75#include "uwb-internal.h"
80 76
81/** 77/*
82 * UWBD Event handler function signature 78 * UWBD Event handler function signature
83 * 79 *
84 * Return !0 if the event needs not to be freed (ie the handler 80 * Return !0 if the event needs not to be freed (ie the handler
@@ -101,9 +97,8 @@ struct uwbd_event {
101 const char *name; 97 const char *name;
102}; 98};
103 99
104/** Table of handlers for and properties of the UWBD Radio Control Events */ 100/* Table of handlers for and properties of the UWBD Radio Control Events */
105static 101static struct uwbd_event uwbd_urc_events[] = {
106struct uwbd_event uwbd_events[] = {
107 [UWB_RC_EVT_IE_RCV] = { 102 [UWB_RC_EVT_IE_RCV] = {
108 .handler = uwbd_evt_handle_rc_ie_rcv, 103 .handler = uwbd_evt_handle_rc_ie_rcv,
109 .name = "IE_RECEIVED" 104 .name = "IE_RECEIVED"
@@ -146,23 +141,15 @@ struct uwbd_evt_type_handler {
146 size_t size; 141 size_t size;
147}; 142};
148 143
149#define UWBD_EVT_TYPE_HANDLER(n,a) { \ 144/* Table of handlers for each UWBD Event type. */
150 .name = (n), \ 145static struct uwbd_evt_type_handler uwbd_urc_evt_type_handlers[] = {
151 .uwbd_events = (a), \ 146 [UWB_RC_CET_GENERAL] = {
152 .size = sizeof(a)/sizeof((a)[0]) \ 147 .name = "URC",
153} 148 .uwbd_events = uwbd_urc_events,
154 149 .size = ARRAY_SIZE(uwbd_urc_events),
155 150 },
156/** Table of handlers for each UWBD Event type. */
157static
158struct uwbd_evt_type_handler uwbd_evt_type_handlers[] = {
159 [UWB_RC_CET_GENERAL] = UWBD_EVT_TYPE_HANDLER("RC", uwbd_events)
160}; 151};
161 152
162static const
163size_t uwbd_evt_type_handlers_len =
164 sizeof(uwbd_evt_type_handlers) / sizeof(uwbd_evt_type_handlers[0]);
165
166static const struct uwbd_event uwbd_message_handlers[] = { 153static const struct uwbd_event uwbd_message_handlers[] = {
167 [UWB_EVT_MSG_RESET] = { 154 [UWB_EVT_MSG_RESET] = {
168 .handler = uwbd_msg_handle_reset, 155 .handler = uwbd_msg_handle_reset,
@@ -170,7 +157,7 @@ static const struct uwbd_event uwbd_message_handlers[] = {
170 }, 157 },
171}; 158};
172 159
173/** 160/*
174 * Handle an URC event passed to the UWB Daemon 161 * Handle an URC event passed to the UWB Daemon
175 * 162 *
176 * @evt: the event to handle 163 * @evt: the event to handle
@@ -190,6 +177,7 @@ static const struct uwbd_event uwbd_message_handlers[] = {
190static 177static
191int uwbd_event_handle_urc(struct uwb_event *evt) 178int uwbd_event_handle_urc(struct uwb_event *evt)
192{ 179{
180 int result = -EINVAL;
193 struct uwbd_evt_type_handler *type_table; 181 struct uwbd_evt_type_handler *type_table;
194 uwbd_evt_handler_f handler; 182 uwbd_evt_handler_f handler;
195 u8 type, context; 183 u8 type, context;
@@ -199,26 +187,24 @@ int uwbd_event_handle_urc(struct uwb_event *evt)
199 event = le16_to_cpu(evt->notif.rceb->wEvent); 187 event = le16_to_cpu(evt->notif.rceb->wEvent);
200 context = evt->notif.rceb->bEventContext; 188 context = evt->notif.rceb->bEventContext;
201 189
202 if (type > uwbd_evt_type_handlers_len) { 190 if (type > ARRAY_SIZE(uwbd_urc_evt_type_handlers))
203 printk(KERN_ERR "UWBD: event type %u: unknown (too high)\n", type); 191 goto out;
204 return -EINVAL; 192 type_table = &uwbd_urc_evt_type_handlers[type];
205 } 193 if (type_table->uwbd_events == NULL)
206 type_table = &uwbd_evt_type_handlers[type]; 194 goto out;
207 if (type_table->uwbd_events == NULL) { 195 if (event > type_table->size)
208 printk(KERN_ERR "UWBD: event type %u: unknown\n", type); 196 goto out;
209 return -EINVAL;
210 }
211 if (event > type_table->size) {
212 printk(KERN_ERR "UWBD: event %s[%u]: unknown (too high)\n",
213 type_table->name, event);
214 return -EINVAL;
215 }
216 handler = type_table->uwbd_events[event].handler; 197 handler = type_table->uwbd_events[event].handler;
217 if (handler == NULL) { 198 if (handler == NULL)
218 printk(KERN_ERR "UWBD: event %s[%u]: unknown\n", type_table->name, event); 199 goto out;
219 return -EINVAL; 200
220 } 201 result = (*handler)(evt);
221 return (*handler)(evt); 202out:
203 if (result < 0)
204 dev_err(&evt->rc->uwb_dev.dev,
205 "UWBD: event 0x%02x/%04x/%02x, handling failed: %d\n",
206 type, event, context, result);
207 return result;
222} 208}
223 209
224static void uwbd_event_handle_message(struct uwb_event *evt) 210static void uwbd_event_handle_message(struct uwb_event *evt)
diff --git a/drivers/uwb/whc-rc.c b/drivers/uwb/whc-rc.c
index 5f00386e26c7..19a1dd129212 100644
--- a/drivers/uwb/whc-rc.c
+++ b/drivers/uwb/whc-rc.c
@@ -48,10 +48,8 @@
48#include <linux/uwb.h> 48#include <linux/uwb.h>
49#include <linux/uwb/whci.h> 49#include <linux/uwb/whci.h>
50#include <linux/uwb/umc.h> 50#include <linux/uwb/umc.h>
51#include "uwb-internal.h"
52 51
53#define D_LOCAL 0 52#include "uwb-internal.h"
54#include <linux/uwb/debug.h>
55 53
56/** 54/**
57 * Descriptor for an instance of the UWB Radio Control Driver that 55 * Descriptor for an instance of the UWB Radio Control Driver that
@@ -97,13 +95,8 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
97 struct device *dev = &whcrc->umc_dev->dev; 95 struct device *dev = &whcrc->umc_dev->dev;
98 u32 urccmd; 96 u32 urccmd;
99 97
100 d_fnstart(3, dev, "(%p, %p, %zu)\n", uwb_rc, cmd, cmd_size); 98 if (cmd_size >= 4096)
101 might_sleep(); 99 return -EINVAL;
102
103 if (cmd_size >= 4096) {
104 result = -E2BIG;
105 goto error;
106 }
107 100
108 /* 101 /*
109 * If the URC is halted, then the hardware has reset itself. 102 * If the URC is halted, then the hardware has reset itself.
@@ -114,16 +107,14 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
114 if (le_readl(whcrc->rc_base + URCSTS) & URCSTS_HALTED) { 107 if (le_readl(whcrc->rc_base + URCSTS) & URCSTS_HALTED) {
115 dev_err(dev, "requesting reset of halted radio controller\n"); 108 dev_err(dev, "requesting reset of halted radio controller\n");
116 uwb_rc_reset_all(uwb_rc); 109 uwb_rc_reset_all(uwb_rc);
117 result = -EIO; 110 return -EIO;
118 goto error;
119 } 111 }
120 112
121 result = wait_event_timeout(whcrc->cmd_wq, 113 result = wait_event_timeout(whcrc->cmd_wq,
122 !(le_readl(whcrc->rc_base + URCCMD) & URCCMD_ACTIVE), HZ/2); 114 !(le_readl(whcrc->rc_base + URCCMD) & URCCMD_ACTIVE), HZ/2);
123 if (result == 0) { 115 if (result == 0) {
124 dev_err(dev, "device is not ready to execute commands\n"); 116 dev_err(dev, "device is not ready to execute commands\n");
125 result = -ETIMEDOUT; 117 return -ETIMEDOUT;
126 goto error;
127 } 118 }
128 119
129 memmove(whcrc->cmd_buf, cmd, cmd_size); 120 memmove(whcrc->cmd_buf, cmd, cmd_size);
@@ -136,10 +127,7 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
136 whcrc->rc_base + URCCMD); 127 whcrc->rc_base + URCCMD);
137 spin_unlock(&whcrc->irq_lock); 128 spin_unlock(&whcrc->irq_lock);
138 129
139error: 130 return 0;
140 d_fnend(3, dev, "(%p, %p, %zu) = %d\n",
141 uwb_rc, cmd, cmd_size, result);
142 return result;
143} 131}
144 132
145static int whcrc_reset(struct uwb_rc *rc) 133static int whcrc_reset(struct uwb_rc *rc)
@@ -166,34 +154,25 @@ static int whcrc_reset(struct uwb_rc *rc)
166static 154static
167void whcrc_enable_events(struct whcrc *whcrc) 155void whcrc_enable_events(struct whcrc *whcrc)
168{ 156{
169 struct device *dev = &whcrc->umc_dev->dev;
170 u32 urccmd; 157 u32 urccmd;
171 158
172 d_fnstart(4, dev, "(whcrc %p)\n", whcrc);
173
174 le_writeq(whcrc->evt_dma_buf, whcrc->rc_base + URCEVTADDR); 159 le_writeq(whcrc->evt_dma_buf, whcrc->rc_base + URCEVTADDR);
175 160
176 spin_lock(&whcrc->irq_lock); 161 spin_lock(&whcrc->irq_lock);
177 urccmd = le_readl(whcrc->rc_base + URCCMD) & ~URCCMD_ACTIVE; 162 urccmd = le_readl(whcrc->rc_base + URCCMD) & ~URCCMD_ACTIVE;
178 le_writel(urccmd | URCCMD_EARV, whcrc->rc_base + URCCMD); 163 le_writel(urccmd | URCCMD_EARV, whcrc->rc_base + URCCMD);
179 spin_unlock(&whcrc->irq_lock); 164 spin_unlock(&whcrc->irq_lock);
180
181 d_fnend(4, dev, "(whcrc %p) = void\n", whcrc);
182} 165}
183 166
184static void whcrc_event_work(struct work_struct *work) 167static void whcrc_event_work(struct work_struct *work)
185{ 168{
186 struct whcrc *whcrc = container_of(work, struct whcrc, event_work); 169 struct whcrc *whcrc = container_of(work, struct whcrc, event_work);
187 struct device *dev = &whcrc->umc_dev->dev;
188 size_t size; 170 size_t size;
189 u64 urcevtaddr; 171 u64 urcevtaddr;
190 172
191 urcevtaddr = le_readq(whcrc->rc_base + URCEVTADDR); 173 urcevtaddr = le_readq(whcrc->rc_base + URCEVTADDR);
192 size = urcevtaddr & URCEVTADDR_OFFSET_MASK; 174 size = urcevtaddr & URCEVTADDR_OFFSET_MASK;
193 175
194 d_printf(3, dev, "received %zu octet event\n", size);
195 d_dump(4, dev, whcrc->evt_buf, size > 32 ? 32 : size);
196
197 uwb_rc_neh_grok(whcrc->uwb_rc, whcrc->evt_buf, size); 176 uwb_rc_neh_grok(whcrc->uwb_rc, whcrc->evt_buf, size);
198 whcrc_enable_events(whcrc); 177 whcrc_enable_events(whcrc);
199} 178}
@@ -216,22 +195,15 @@ irqreturn_t whcrc_irq_cb(int irq, void *_whcrc)
216 return IRQ_NONE; 195 return IRQ_NONE;
217 le_writel(urcsts & URCSTS_INT_MASK, whcrc->rc_base + URCSTS); 196 le_writel(urcsts & URCSTS_INT_MASK, whcrc->rc_base + URCSTS);
218 197
219 d_printf(4, dev, "acked 0x%08x, urcsts 0x%08x\n",
220 le_readl(whcrc->rc_base + URCSTS), urcsts);
221
222 if (urcsts & URCSTS_HSE) { 198 if (urcsts & URCSTS_HSE) {
223 dev_err(dev, "host system error -- hardware halted\n"); 199 dev_err(dev, "host system error -- hardware halted\n");
224 /* FIXME: do something sensible here */ 200 /* FIXME: do something sensible here */
225 goto out; 201 goto out;
226 } 202 }
227 if (urcsts & URCSTS_ER) { 203 if (urcsts & URCSTS_ER)
228 d_printf(3, dev, "ER: event ready\n");
229 schedule_work(&whcrc->event_work); 204 schedule_work(&whcrc->event_work);
230 } 205 if (urcsts & URCSTS_RCI)
231 if (urcsts & URCSTS_RCI) {
232 d_printf(3, dev, "RCI: ready to execute another command\n");
233 wake_up_all(&whcrc->cmd_wq); 206 wake_up_all(&whcrc->cmd_wq);
234 }
235out: 207out:
236 return IRQ_HANDLED; 208 return IRQ_HANDLED;
237} 209}
@@ -250,8 +222,7 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
250 whcrc->area = umc_dev->resource.start; 222 whcrc->area = umc_dev->resource.start;
251 whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1; 223 whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1;
252 result = -EBUSY; 224 result = -EBUSY;
253 if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) 225 if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) {
254 == NULL) {
255 dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n", 226 dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n",
256 whcrc->rc_len, whcrc->area, result); 227 whcrc->rc_len, whcrc->area, result);
257 goto error_request_region; 228 goto error_request_region;
@@ -286,8 +257,6 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
286 dev_err(dev, "Can't allocate evt transfer buffer\n"); 257 dev_err(dev, "Can't allocate evt transfer buffer\n");
287 goto error_evt_buffer; 258 goto error_evt_buffer;
288 } 259 }
289 d_printf(3, dev, "UWB RC Interface: %zu bytes at 0x%p, irq %u\n",
290 whcrc->rc_len, whcrc->rc_base, umc_dev->irq);
291 return 0; 260 return 0;
292 261
293error_evt_buffer: 262error_evt_buffer:
@@ -396,7 +365,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
396 struct whcrc *whcrc; 365 struct whcrc *whcrc;
397 struct device *dev = &umc_dev->dev; 366 struct device *dev = &umc_dev->dev;
398 367
399 d_fnstart(3, dev, "(umc_dev %p)\n", umc_dev);
400 result = -ENOMEM; 368 result = -ENOMEM;
401 uwb_rc = uwb_rc_alloc(); 369 uwb_rc = uwb_rc_alloc();
402 if (uwb_rc == NULL) { 370 if (uwb_rc == NULL) {
@@ -428,7 +396,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
428 if (result < 0) 396 if (result < 0)
429 goto error_rc_add; 397 goto error_rc_add;
430 umc_set_drvdata(umc_dev, whcrc); 398 umc_set_drvdata(umc_dev, whcrc);
431 d_fnend(3, dev, "(umc_dev %p) = 0\n", umc_dev);
432 return 0; 399 return 0;
433 400
434error_rc_add: 401error_rc_add:
@@ -438,7 +405,6 @@ error_setup_rc_umc:
438error_alloc: 405error_alloc:
439 uwb_rc_put(uwb_rc); 406 uwb_rc_put(uwb_rc);
440error_rc_alloc: 407error_rc_alloc:
441 d_fnend(3, dev, "(umc_dev %p) = %d\n", umc_dev, result);
442 return result; 408 return result;
443} 409}
444 410
@@ -461,7 +427,6 @@ static void whcrc_remove(struct umc_dev *umc_dev)
461 whcrc_release_rc_umc(whcrc); 427 whcrc_release_rc_umc(whcrc);
462 kfree(whcrc); 428 kfree(whcrc);
463 uwb_rc_put(uwb_rc); 429 uwb_rc_put(uwb_rc);
464 d_printf(1, &umc_dev->dev, "freed whcrc %p\n", whcrc);
465} 430}
466 431
467static int whcrc_pre_reset(struct umc_dev *umc) 432static int whcrc_pre_reset(struct umc_dev *umc)
diff --git a/drivers/uwb/wlp/eda.c b/drivers/uwb/wlp/eda.c
index cdfe8dfc4340..0b4659e4bbd7 100644
--- a/drivers/uwb/wlp/eda.c
+++ b/drivers/uwb/wlp/eda.c
@@ -51,9 +51,7 @@
51 * the tag and address of the transmitting neighbor. 51 * the tag and address of the transmitting neighbor.
52 */ 52 */
53 53
54#define D_LOCAL 5
55#include <linux/netdevice.h> 54#include <linux/netdevice.h>
56#include <linux/uwb/debug.h>
57#include <linux/etherdevice.h> 55#include <linux/etherdevice.h>
58#include <linux/wlp.h> 56#include <linux/wlp.h>
59#include "wlp-internal.h" 57#include "wlp-internal.h"
@@ -304,7 +302,6 @@ int wlp_eda_for_virtual(struct wlp_eda *eda,
304{ 302{
305 int result = 0; 303 int result = 0;
306 struct wlp *wlp = container_of(eda, struct wlp, eda); 304 struct wlp *wlp = container_of(eda, struct wlp, eda);
307 struct device *dev = &wlp->rc->uwb_dev.dev;
308 struct wlp_eda_node *itr; 305 struct wlp_eda_node *itr;
309 unsigned long flags; 306 unsigned long flags;
310 int found = 0; 307 int found = 0;
@@ -313,40 +310,14 @@ int wlp_eda_for_virtual(struct wlp_eda *eda,
313 list_for_each_entry(itr, &eda->cache, list_node) { 310 list_for_each_entry(itr, &eda->cache, list_node) {
314 if (!memcmp(itr->virt_addr, virt_addr, 311 if (!memcmp(itr->virt_addr, virt_addr,
315 sizeof(itr->virt_addr))) { 312 sizeof(itr->virt_addr))) {
316 d_printf(6, dev, "EDA: looking for "
317 "%02x:%02x:%02x:%02x:%02x:%02x hit %02x:%02x "
318 "wss %p tag 0x%02x state %u\n",
319 virt_addr[0], virt_addr[1],
320 virt_addr[2], virt_addr[3],
321 virt_addr[4], virt_addr[5],
322 itr->dev_addr.data[1],
323 itr->dev_addr.data[0], itr->wss,
324 itr->tag, itr->state);
325 result = (*function)(wlp, itr, priv); 313 result = (*function)(wlp, itr, priv);
326 *dev_addr = itr->dev_addr; 314 *dev_addr = itr->dev_addr;
327 found = 1; 315 found = 1;
328 break; 316 break;
329 } else 317 }
330 d_printf(6, dev, "EDA: looking for "
331 "%02x:%02x:%02x:%02x:%02x:%02x "
332 "against "
333 "%02x:%02x:%02x:%02x:%02x:%02x miss\n",
334 virt_addr[0], virt_addr[1],
335 virt_addr[2], virt_addr[3],
336 virt_addr[4], virt_addr[5],
337 itr->virt_addr[0], itr->virt_addr[1],
338 itr->virt_addr[2], itr->virt_addr[3],
339 itr->virt_addr[4], itr->virt_addr[5]);
340 } 318 }
341 if (!found) { 319 if (!found)
342 if (printk_ratelimit())
343 dev_err(dev, "EDA: Eth addr %02x:%02x:%02x"
344 ":%02x:%02x:%02x not found.\n",
345 virt_addr[0], virt_addr[1],
346 virt_addr[2], virt_addr[3],
347 virt_addr[4], virt_addr[5]);
348 result = -ENODEV; 320 result = -ENODEV;
349 }
350 spin_unlock_irqrestore(&eda->lock, flags); 321 spin_unlock_irqrestore(&eda->lock, flags);
351 return result; 322 return result;
352} 323}
diff --git a/drivers/uwb/wlp/messages.c b/drivers/uwb/wlp/messages.c
index a64cb8241713..aa42fcee4c4f 100644
--- a/drivers/uwb/wlp/messages.c
+++ b/drivers/uwb/wlp/messages.c
@@ -24,8 +24,7 @@
24 */ 24 */
25 25
26#include <linux/wlp.h> 26#include <linux/wlp.h>
27#define D_LOCAL 6 27
28#include <linux/uwb/debug.h>
29#include "wlp-internal.h" 28#include "wlp-internal.h"
30 29
31static 30static
@@ -105,24 +104,18 @@ static inline void wlp_set_attr_hdr(struct wlp_attr_hdr *hdr, unsigned type,
105#define wlp_set(type, type_code, name) \ 104#define wlp_set(type, type_code, name) \
106static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \ 105static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
107{ \ 106{ \
108 d_fnstart(6, NULL, "(attribute %p)\n", attr); \
109 wlp_set_attr_hdr(&attr->hdr, type_code, \ 107 wlp_set_attr_hdr(&attr->hdr, type_code, \
110 sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \ 108 sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \
111 attr->name = value; \ 109 attr->name = value; \
112 d_dump(6, NULL, attr, sizeof(*attr)); \
113 d_fnend(6, NULL, "(attribute %p)\n", attr); \
114 return sizeof(*attr); \ 110 return sizeof(*attr); \
115} 111}
116 112
117#define wlp_pset(type, type_code, name) \ 113#define wlp_pset(type, type_code, name) \
118static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \ 114static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
119{ \ 115{ \
120 d_fnstart(6, NULL, "(attribute %p)\n", attr); \
121 wlp_set_attr_hdr(&attr->hdr, type_code, \ 116 wlp_set_attr_hdr(&attr->hdr, type_code, \
122 sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \ 117 sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \
123 attr->name = *value; \ 118 attr->name = *value; \
124 d_dump(6, NULL, attr, sizeof(*attr)); \
125 d_fnend(6, NULL, "(attribute %p)\n", attr); \
126 return sizeof(*attr); \ 119 return sizeof(*attr); \
127} 120}
128 121
@@ -139,11 +132,8 @@ static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
139static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value, \ 132static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value, \
140 size_t len) \ 133 size_t len) \
141{ \ 134{ \
142 d_fnstart(6, NULL, "(attribute %p)\n", attr); \
143 wlp_set_attr_hdr(&attr->hdr, type_code, len); \ 135 wlp_set_attr_hdr(&attr->hdr, type_code, len); \
144 memcpy(attr->name, value, len); \ 136 memcpy(attr->name, value, len); \
145 d_dump(6, NULL, attr, sizeof(*attr) + len); \
146 d_fnend(6, NULL, "(attribute %p)\n", attr); \
147 return sizeof(*attr) + len; \ 137 return sizeof(*attr) + len; \
148} 138}
149 139
@@ -182,7 +172,7 @@ static size_t wlp_set_wss_info(struct wlp_attr_wss_info *attr,
182 size_t datalen; 172 size_t datalen;
183 void *ptr = attr->wss_info; 173 void *ptr = attr->wss_info;
184 size_t used = sizeof(*attr); 174 size_t used = sizeof(*attr);
185 d_fnstart(6, NULL, "(attribute %p)\n", attr); 175
186 datalen = sizeof(struct wlp_wss_info) + strlen(wss->name); 176 datalen = sizeof(struct wlp_wss_info) + strlen(wss->name);
187 wlp_set_attr_hdr(&attr->hdr, WLP_ATTR_WSS_INFO, datalen); 177 wlp_set_attr_hdr(&attr->hdr, WLP_ATTR_WSS_INFO, datalen);
188 used = wlp_set_wssid(ptr, &wss->wssid); 178 used = wlp_set_wssid(ptr, &wss->wssid);
@@ -190,9 +180,6 @@ static size_t wlp_set_wss_info(struct wlp_attr_wss_info *attr,
190 used += wlp_set_accept_enrl(ptr + used, wss->accept_enroll); 180 used += wlp_set_accept_enrl(ptr + used, wss->accept_enroll);
191 used += wlp_set_wss_sec_status(ptr + used, wss->secure_status); 181 used += wlp_set_wss_sec_status(ptr + used, wss->secure_status);
192 used += wlp_set_wss_bcast(ptr + used, &wss->bcast); 182 used += wlp_set_wss_bcast(ptr + used, &wss->bcast);
193 d_dump(6, NULL, attr, sizeof(*attr) + datalen);
194 d_fnend(6, NULL, "(attribute %p, used %d)\n",
195 attr, (int)(sizeof(*attr) + used));
196 return sizeof(*attr) + used; 183 return sizeof(*attr) + used;
197} 184}
198 185
@@ -414,7 +401,6 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
414 size_t used = 0; 401 size_t used = 0;
415 ssize_t result = -EINVAL; 402 ssize_t result = -EINVAL;
416 403
417 d_printf(6, dev, "WLP: WSS info: Retrieving WSS name\n");
418 result = wlp_get_wss_name(wlp, ptr, info->name, buflen); 404 result = wlp_get_wss_name(wlp, ptr, info->name, buflen);
419 if (result < 0) { 405 if (result < 0) {
420 dev_err(dev, "WLP: unable to obtain WSS name from " 406 dev_err(dev, "WLP: unable to obtain WSS name from "
@@ -422,7 +408,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
422 goto error_parse; 408 goto error_parse;
423 } 409 }
424 used += result; 410 used += result;
425 d_printf(6, dev, "WLP: WSS info: Retrieving accept enroll\n"); 411
426 result = wlp_get_accept_enrl(wlp, ptr + used, &info->accept_enroll, 412 result = wlp_get_accept_enrl(wlp, ptr + used, &info->accept_enroll,
427 buflen - used); 413 buflen - used);
428 if (result < 0) { 414 if (result < 0) {
@@ -437,7 +423,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
437 goto error_parse; 423 goto error_parse;
438 } 424 }
439 used += result; 425 used += result;
440 d_printf(6, dev, "WLP: WSS info: Retrieving secure status\n"); 426
441 result = wlp_get_wss_sec_status(wlp, ptr + used, &info->sec_status, 427 result = wlp_get_wss_sec_status(wlp, ptr + used, &info->sec_status,
442 buflen - used); 428 buflen - used);
443 if (result < 0) { 429 if (result < 0) {
@@ -452,7 +438,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
452 goto error_parse; 438 goto error_parse;
453 } 439 }
454 used += result; 440 used += result;
455 d_printf(6, dev, "WLP: WSS info: Retrieving broadcast\n"); 441
456 result = wlp_get_wss_bcast(wlp, ptr + used, &info->bcast, 442 result = wlp_get_wss_bcast(wlp, ptr + used, &info->bcast,
457 buflen - used); 443 buflen - used);
458 if (result < 0) { 444 if (result < 0) {
@@ -530,7 +516,7 @@ static ssize_t wlp_get_wss_info(struct wlp *wlp, struct wlp_attr_wss_info *attr,
530 len = result; 516 len = result;
531 used = sizeof(*attr); 517 used = sizeof(*attr);
532 ptr = attr; 518 ptr = attr;
533 d_printf(6, dev, "WLP: WSS info: Retrieving WSSID\n"); 519
534 result = wlp_get_wssid(wlp, ptr + used, wssid, buflen - used); 520 result = wlp_get_wssid(wlp, ptr + used, wssid, buflen - used);
535 if (result < 0) { 521 if (result < 0) {
536 dev_err(dev, "WLP: unable to obtain WSSID from WSS info.\n"); 522 dev_err(dev, "WLP: unable to obtain WSSID from WSS info.\n");
@@ -553,8 +539,6 @@ static ssize_t wlp_get_wss_info(struct wlp *wlp, struct wlp_attr_wss_info *attr,
553 goto out; 539 goto out;
554 } 540 }
555 result = used; 541 result = used;
556 d_printf(6, dev, "WLP: Successfully parsed WLP information "
557 "attribute. used %zu bytes\n", used);
558out: 542out:
559 return result; 543 return result;
560} 544}
@@ -598,8 +582,6 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp,
598 struct wlp_wssid_e *wssid_e; 582 struct wlp_wssid_e *wssid_e;
599 char buf[WLP_WSS_UUID_STRSIZE]; 583 char buf[WLP_WSS_UUID_STRSIZE];
600 584
601 d_fnstart(6, dev, "wlp %p, attr %p, neighbor %p, wss %p, buflen %d \n",
602 wlp, attr, neighbor, wss, (int)buflen);
603 if (buflen < 0) 585 if (buflen < 0)
604 goto out; 586 goto out;
605 587
@@ -638,8 +620,7 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp,
638 wss->accept_enroll = wss_info.accept_enroll; 620 wss->accept_enroll = wss_info.accept_enroll;
639 wss->state = WLP_WSS_STATE_PART_ENROLLED; 621 wss->state = WLP_WSS_STATE_PART_ENROLLED;
640 wlp_wss_uuid_print(buf, sizeof(buf), &wssid); 622 wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
641 d_printf(2, dev, "WLP: Found WSS %s. Enrolling.\n", 623 dev_dbg(dev, "WLP: Found WSS %s. Enrolling.\n", buf);
642 buf);
643 } else { 624 } else {
644 wssid_e = wlp_create_wssid_e(wlp, neighbor); 625 wssid_e = wlp_create_wssid_e(wlp, neighbor);
645 if (wssid_e == NULL) { 626 if (wssid_e == NULL) {
@@ -660,9 +641,6 @@ error_parse:
660 if (result < 0 && !enroll) /* this was a discovery */ 641 if (result < 0 && !enroll) /* this was a discovery */
661 wlp_remove_neighbor_tmp_info(neighbor); 642 wlp_remove_neighbor_tmp_info(neighbor);
662out: 643out:
663 d_fnend(6, dev, "wlp %p, attr %p, neighbor %p, wss %p, buflen %d, "
664 "result %d \n", wlp, attr, neighbor, wss, (int)buflen,
665 (int)result);
666 return result; 644 return result;
667 645
668} 646}
@@ -718,7 +696,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
718 struct sk_buff *_skb; 696 struct sk_buff *_skb;
719 void *d1_itr; 697 void *d1_itr;
720 698
721 d_fnstart(6, dev, "wlp %p\n", wlp);
722 if (wlp->dev_info == NULL) { 699 if (wlp->dev_info == NULL) {
723 result = __wlp_setup_device_info(wlp); 700 result = __wlp_setup_device_info(wlp);
724 if (result < 0) { 701 if (result < 0) {
@@ -728,24 +705,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
728 } 705 }
729 } 706 }
730 info = wlp->dev_info; 707 info = wlp->dev_info;
731 d_printf(6, dev, "Local properties:\n"
732 "Device name (%d bytes): %s\n"
733 "Model name (%d bytes): %s\n"
734 "Manufacturer (%d bytes): %s\n"
735 "Model number (%d bytes): %s\n"
736 "Serial number (%d bytes): %s\n"
737 "Primary device type: \n"
738 " Category: %d \n"
739 " OUI: %02x:%02x:%02x \n"
740 " OUI Subdivision: %u \n",
741 (int)strlen(info->name), info->name,
742 (int)strlen(info->model_name), info->model_name,
743 (int)strlen(info->manufacturer), info->manufacturer,
744 (int)strlen(info->model_nr), info->model_nr,
745 (int)strlen(info->serial), info->serial,
746 info->prim_dev_type.category,
747 info->prim_dev_type.OUI[0], info->prim_dev_type.OUI[1],
748 info->prim_dev_type.OUI[2], info->prim_dev_type.OUIsubdiv);
749 _skb = dev_alloc_skb(sizeof(*_d1) 708 _skb = dev_alloc_skb(sizeof(*_d1)
750 + sizeof(struct wlp_attr_uuid_e) 709 + sizeof(struct wlp_attr_uuid_e)
751 + sizeof(struct wlp_attr_wss_sel_mthd) 710 + sizeof(struct wlp_attr_wss_sel_mthd)
@@ -768,7 +727,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
768 goto error; 727 goto error;
769 } 728 }
770 _d1 = (void *) _skb->data; 729 _d1 = (void *) _skb->data;
771 d_printf(6, dev, "D1 starts at %p \n", _d1);
772 _d1->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 730 _d1->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
773 _d1->hdr.type = WLP_FRAME_ASSOCIATION; 731 _d1->hdr.type = WLP_FRAME_ASSOCIATION;
774 _d1->type = WLP_ASSOC_D1; 732 _d1->type = WLP_ASSOC_D1;
@@ -791,25 +749,8 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
791 used += wlp_set_prim_dev_type(d1_itr + used, &info->prim_dev_type); 749 used += wlp_set_prim_dev_type(d1_itr + used, &info->prim_dev_type);
792 used += wlp_set_wlp_assc_err(d1_itr + used, WLP_ASSOC_ERROR_NONE); 750 used += wlp_set_wlp_assc_err(d1_itr + used, WLP_ASSOC_ERROR_NONE);
793 skb_put(_skb, sizeof(*_d1) + used); 751 skb_put(_skb, sizeof(*_d1) + used);
794 d_printf(6, dev, "D1 message:\n");
795 d_dump(6, dev, _d1, sizeof(*_d1)
796 + sizeof(struct wlp_attr_uuid_e)
797 + sizeof(struct wlp_attr_wss_sel_mthd)
798 + sizeof(struct wlp_attr_dev_name)
799 + strlen(info->name)
800 + sizeof(struct wlp_attr_manufacturer)
801 + strlen(info->manufacturer)
802 + sizeof(struct wlp_attr_model_name)
803 + strlen(info->model_name)
804 + sizeof(struct wlp_attr_model_nr)
805 + strlen(info->model_nr)
806 + sizeof(struct wlp_attr_serial)
807 + strlen(info->serial)
808 + sizeof(struct wlp_attr_prim_dev_type)
809 + sizeof(struct wlp_attr_wlp_assc_err));
810 *skb = _skb; 752 *skb = _skb;
811error: 753error:
812 d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
813 return result; 754 return result;
814} 755}
815 756
@@ -837,7 +778,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
837 void *d2_itr; 778 void *d2_itr;
838 size_t mem_needed; 779 size_t mem_needed;
839 780
840 d_fnstart(6, dev, "wlp %p\n", wlp);
841 if (wlp->dev_info == NULL) { 781 if (wlp->dev_info == NULL) {
842 result = __wlp_setup_device_info(wlp); 782 result = __wlp_setup_device_info(wlp);
843 if (result < 0) { 783 if (result < 0) {
@@ -847,24 +787,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
847 } 787 }
848 } 788 }
849 info = wlp->dev_info; 789 info = wlp->dev_info;
850 d_printf(6, dev, "Local properties:\n"
851 "Device name (%d bytes): %s\n"
852 "Model name (%d bytes): %s\n"
853 "Manufacturer (%d bytes): %s\n"
854 "Model number (%d bytes): %s\n"
855 "Serial number (%d bytes): %s\n"
856 "Primary device type: \n"
857 " Category: %d \n"
858 " OUI: %02x:%02x:%02x \n"
859 " OUI Subdivision: %u \n",
860 (int)strlen(info->name), info->name,
861 (int)strlen(info->model_name), info->model_name,
862 (int)strlen(info->manufacturer), info->manufacturer,
863 (int)strlen(info->model_nr), info->model_nr,
864 (int)strlen(info->serial), info->serial,
865 info->prim_dev_type.category,
866 info->prim_dev_type.OUI[0], info->prim_dev_type.OUI[1],
867 info->prim_dev_type.OUI[2], info->prim_dev_type.OUIsubdiv);
868 mem_needed = sizeof(*_d2) 790 mem_needed = sizeof(*_d2)
869 + sizeof(struct wlp_attr_uuid_e) 791 + sizeof(struct wlp_attr_uuid_e)
870 + sizeof(struct wlp_attr_uuid_r) 792 + sizeof(struct wlp_attr_uuid_r)
@@ -892,7 +814,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
892 goto error; 814 goto error;
893 } 815 }
894 _d2 = (void *) _skb->data; 816 _d2 = (void *) _skb->data;
895 d_printf(6, dev, "D2 starts at %p \n", _d2);
896 _d2->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 817 _d2->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
897 _d2->hdr.type = WLP_FRAME_ASSOCIATION; 818 _d2->hdr.type = WLP_FRAME_ASSOCIATION;
898 _d2->type = WLP_ASSOC_D2; 819 _d2->type = WLP_ASSOC_D2;
@@ -917,11 +838,8 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
917 used += wlp_set_prim_dev_type(d2_itr + used, &info->prim_dev_type); 838 used += wlp_set_prim_dev_type(d2_itr + used, &info->prim_dev_type);
918 used += wlp_set_wlp_assc_err(d2_itr + used, WLP_ASSOC_ERROR_NONE); 839 used += wlp_set_wlp_assc_err(d2_itr + used, WLP_ASSOC_ERROR_NONE);
919 skb_put(_skb, sizeof(*_d2) + used); 840 skb_put(_skb, sizeof(*_d2) + used);
920 d_printf(6, dev, "D2 message:\n");
921 d_dump(6, dev, _d2, mem_needed);
922 *skb = _skb; 841 *skb = _skb;
923error: 842error:
924 d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
925 return result; 843 return result;
926} 844}
927 845
@@ -947,7 +865,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
947 struct sk_buff *_skb; 865 struct sk_buff *_skb;
948 struct wlp_nonce tmp; 866 struct wlp_nonce tmp;
949 867
950 d_fnstart(6, dev, "wlp %p\n", wlp);
951 _skb = dev_alloc_skb(sizeof(*f0)); 868 _skb = dev_alloc_skb(sizeof(*f0));
952 if (_skb == NULL) { 869 if (_skb == NULL) {
953 dev_err(dev, "WLP: Unable to allocate memory for F0 " 870 dev_err(dev, "WLP: Unable to allocate memory for F0 "
@@ -955,7 +872,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
955 goto error_alloc; 872 goto error_alloc;
956 } 873 }
957 f0 = (void *) _skb->data; 874 f0 = (void *) _skb->data;
958 d_printf(6, dev, "F0 starts at %p \n", f0);
959 f0->f0_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 875 f0->f0_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
960 f0->f0_hdr.hdr.type = WLP_FRAME_ASSOCIATION; 876 f0->f0_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
961 f0->f0_hdr.type = WLP_ASSOC_F0; 877 f0->f0_hdr.type = WLP_ASSOC_F0;
@@ -969,7 +885,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
969 *skb = _skb; 885 *skb = _skb;
970 result = 0; 886 result = 0;
971error_alloc: 887error_alloc:
972 d_fnend(6, dev, "wlp %p, result %d \n", wlp, result);
973 return result; 888 return result;
974} 889}
975 890
@@ -1242,12 +1157,9 @@ void wlp_handle_d1_frame(struct work_struct *ws)
1242 enum wlp_wss_sel_mthd sel_mthd = 0; 1157 enum wlp_wss_sel_mthd sel_mthd = 0;
1243 struct wlp_device_info dev_info; 1158 struct wlp_device_info dev_info;
1244 enum wlp_assc_error assc_err; 1159 enum wlp_assc_error assc_err;
1245 char uuid[WLP_WSS_UUID_STRSIZE];
1246 struct sk_buff *resp = NULL; 1160 struct sk_buff *resp = NULL;
1247 1161
1248 /* Parse D1 frame */ 1162 /* Parse D1 frame */
1249 d_fnstart(6, dev, "WLP: handle D1 frame. wlp = %p, skb = %p\n",
1250 wlp, skb);
1251 mutex_lock(&wss->mutex); 1163 mutex_lock(&wss->mutex);
1252 mutex_lock(&wlp->mutex); /* to access wlp->uuid */ 1164 mutex_lock(&wlp->mutex); /* to access wlp->uuid */
1253 memset(&dev_info, 0, sizeof(dev_info)); 1165 memset(&dev_info, 0, sizeof(dev_info));
@@ -1258,30 +1170,6 @@ void wlp_handle_d1_frame(struct work_struct *ws)
1258 kfree_skb(skb); 1170 kfree_skb(skb);
1259 goto out; 1171 goto out;
1260 } 1172 }
1261 wlp_wss_uuid_print(uuid, sizeof(uuid), &uuid_e);
1262 d_printf(6, dev, "From D1 frame:\n"
1263 "UUID-E: %s\n"
1264 "Selection method: %d\n"
1265 "Device name (%d bytes): %s\n"
1266 "Model name (%d bytes): %s\n"
1267 "Manufacturer (%d bytes): %s\n"
1268 "Model number (%d bytes): %s\n"
1269 "Serial number (%d bytes): %s\n"
1270 "Primary device type: \n"
1271 " Category: %d \n"
1272 " OUI: %02x:%02x:%02x \n"
1273 " OUI Subdivision: %u \n",
1274 uuid, sel_mthd,
1275 (int)strlen(dev_info.name), dev_info.name,
1276 (int)strlen(dev_info.model_name), dev_info.model_name,
1277 (int)strlen(dev_info.manufacturer), dev_info.manufacturer,
1278 (int)strlen(dev_info.model_nr), dev_info.model_nr,
1279 (int)strlen(dev_info.serial), dev_info.serial,
1280 dev_info.prim_dev_type.category,
1281 dev_info.prim_dev_type.OUI[0],
1282 dev_info.prim_dev_type.OUI[1],
1283 dev_info.prim_dev_type.OUI[2],
1284 dev_info.prim_dev_type.OUIsubdiv);
1285 1173
1286 kfree_skb(skb); 1174 kfree_skb(skb);
1287 if (!wlp_uuid_is_set(&wlp->uuid)) { 1175 if (!wlp_uuid_is_set(&wlp->uuid)) {
@@ -1316,7 +1204,6 @@ out:
1316 kfree(frame_ctx); 1204 kfree(frame_ctx);
1317 mutex_unlock(&wlp->mutex); 1205 mutex_unlock(&wlp->mutex);
1318 mutex_unlock(&wss->mutex); 1206 mutex_unlock(&wss->mutex);
1319 d_fnend(6, dev, "WLP: handle D1 frame. wlp = %p\n", wlp);
1320} 1207}
1321 1208
1322/** 1209/**
@@ -1546,10 +1433,8 @@ int wlp_parse_c3c4_frame(struct wlp *wlp, struct sk_buff *skb,
1546 void *ptr = skb->data; 1433 void *ptr = skb->data;
1547 size_t len = skb->len; 1434 size_t len = skb->len;
1548 size_t used; 1435 size_t used;
1549 char buf[WLP_WSS_UUID_STRSIZE];
1550 struct wlp_frame_assoc *assoc = ptr; 1436 struct wlp_frame_assoc *assoc = ptr;
1551 1437
1552 d_fnstart(6, dev, "wlp %p, skb %p \n", wlp, skb);
1553 used = sizeof(*assoc); 1438 used = sizeof(*assoc);
1554 result = wlp_get_wssid(wlp, ptr + used, wssid, len - used); 1439 result = wlp_get_wssid(wlp, ptr + used, wssid, len - used);
1555 if (result < 0) { 1440 if (result < 0) {
@@ -1572,14 +1457,7 @@ int wlp_parse_c3c4_frame(struct wlp *wlp, struct sk_buff *skb,
1572 wlp_assoc_frame_str(assoc->type)); 1457 wlp_assoc_frame_str(assoc->type));
1573 goto error_parse; 1458 goto error_parse;
1574 } 1459 }
1575 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
1576 d_printf(6, dev, "WLP: parsed: WSSID %s, tag 0x%02x, virt "
1577 "%02x:%02x:%02x:%02x:%02x:%02x \n", buf, *tag,
1578 virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
1579 virt_addr->data[3], virt_addr->data[4], virt_addr->data[5]);
1580
1581error_parse: 1460error_parse:
1582 d_fnend(6, dev, "wlp %p, skb %p, result = %d \n", wlp, skb, result);
1583 return result; 1461 return result;
1584} 1462}
1585 1463
@@ -1600,7 +1478,6 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
1600 } *c; 1478 } *c;
1601 struct sk_buff *_skb; 1479 struct sk_buff *_skb;
1602 1480
1603 d_fnstart(6, dev, "wlp %p, wss %p \n", wlp, wss);
1604 _skb = dev_alloc_skb(sizeof(*c)); 1481 _skb = dev_alloc_skb(sizeof(*c));
1605 if (_skb == NULL) { 1482 if (_skb == NULL) {
1606 dev_err(dev, "WLP: Unable to allocate memory for C1/C2 " 1483 dev_err(dev, "WLP: Unable to allocate memory for C1/C2 "
@@ -1608,7 +1485,6 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
1608 goto error_alloc; 1485 goto error_alloc;
1609 } 1486 }
1610 c = (void *) _skb->data; 1487 c = (void *) _skb->data;
1611 d_printf(6, dev, "C1/C2 starts at %p \n", c);
1612 c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 1488 c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
1613 c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION; 1489 c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
1614 c->c_hdr.type = type; 1490 c->c_hdr.type = type;
@@ -1616,12 +1492,9 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
1616 wlp_set_msg_type(&c->c_hdr.msg_type, type); 1492 wlp_set_msg_type(&c->c_hdr.msg_type, type);
1617 wlp_set_wssid(&c->wssid, &wss->wssid); 1493 wlp_set_wssid(&c->wssid, &wss->wssid);
1618 skb_put(_skb, sizeof(*c)); 1494 skb_put(_skb, sizeof(*c));
1619 d_printf(6, dev, "C1/C2 message:\n");
1620 d_dump(6, dev, c, sizeof(*c));
1621 *skb = _skb; 1495 *skb = _skb;
1622 result = 0; 1496 result = 0;
1623error_alloc: 1497error_alloc:
1624 d_fnend(6, dev, "wlp %p, wss %p, result %d \n", wlp, wss, result);
1625 return result; 1498 return result;
1626} 1499}
1627 1500
@@ -1660,7 +1533,6 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
1660 } *c; 1533 } *c;
1661 struct sk_buff *_skb; 1534 struct sk_buff *_skb;
1662 1535
1663 d_fnstart(6, dev, "wlp %p, wss %p \n", wlp, wss);
1664 _skb = dev_alloc_skb(sizeof(*c)); 1536 _skb = dev_alloc_skb(sizeof(*c));
1665 if (_skb == NULL) { 1537 if (_skb == NULL) {
1666 dev_err(dev, "WLP: Unable to allocate memory for C3/C4 " 1538 dev_err(dev, "WLP: Unable to allocate memory for C3/C4 "
@@ -1668,7 +1540,6 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
1668 goto error_alloc; 1540 goto error_alloc;
1669 } 1541 }
1670 c = (void *) _skb->data; 1542 c = (void *) _skb->data;
1671 d_printf(6, dev, "C3/C4 starts at %p \n", c);
1672 c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 1543 c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
1673 c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION; 1544 c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
1674 c->c_hdr.type = type; 1545 c->c_hdr.type = type;
@@ -1678,12 +1549,9 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
1678 wlp_set_wss_tag(&c->wss_tag, wss->tag); 1549 wlp_set_wss_tag(&c->wss_tag, wss->tag);
1679 wlp_set_wss_virt(&c->wss_virt, &wss->virtual_addr); 1550 wlp_set_wss_virt(&c->wss_virt, &wss->virtual_addr);
1680 skb_put(_skb, sizeof(*c)); 1551 skb_put(_skb, sizeof(*c));
1681 d_printf(6, dev, "C3/C4 message:\n");
1682 d_dump(6, dev, c, sizeof(*c));
1683 *skb = _skb; 1552 *skb = _skb;
1684 result = 0; 1553 result = 0;
1685error_alloc: 1554error_alloc:
1686 d_fnend(6, dev, "wlp %p, wss %p, result %d \n", wlp, wss, result);
1687 return result; 1555 return result;
1688} 1556}
1689 1557
@@ -1709,10 +1577,7 @@ static int wlp_send_assoc_##type(struct wlp *wlp, struct wlp_wss *wss, \
1709 struct device *dev = &wlp->rc->uwb_dev.dev; \ 1577 struct device *dev = &wlp->rc->uwb_dev.dev; \
1710 int result; \ 1578 int result; \
1711 struct sk_buff *skb = NULL; \ 1579 struct sk_buff *skb = NULL; \
1712 d_fnstart(6, dev, "wlp %p, wss %p, neighbor: %02x:%02x\n", \ 1580 \
1713 wlp, wss, dev_addr->data[1], dev_addr->data[0]); \
1714 d_printf(6, dev, "WLP: Constructing %s frame. \n", \
1715 wlp_assoc_frame_str(id)); \
1716 /* Build the frame */ \ 1581 /* Build the frame */ \
1717 result = wlp_build_assoc_##type(wlp, wss, &skb); \ 1582 result = wlp_build_assoc_##type(wlp, wss, &skb); \
1718 if (result < 0) { \ 1583 if (result < 0) { \
@@ -1721,9 +1586,6 @@ static int wlp_send_assoc_##type(struct wlp *wlp, struct wlp_wss *wss, \
1721 goto error_build_assoc; \ 1586 goto error_build_assoc; \
1722 } \ 1587 } \
1723 /* Send the frame */ \ 1588 /* Send the frame */ \
1724 d_printf(6, dev, "Transmitting %s frame to %02x:%02x \n", \
1725 wlp_assoc_frame_str(id), \
1726 dev_addr->data[1], dev_addr->data[0]); \
1727 BUG_ON(wlp->xmit_frame == NULL); \ 1589 BUG_ON(wlp->xmit_frame == NULL); \
1728 result = wlp->xmit_frame(wlp, skb, dev_addr); \ 1590 result = wlp->xmit_frame(wlp, skb, dev_addr); \
1729 if (result < 0) { \ 1591 if (result < 0) { \
@@ -1740,8 +1602,6 @@ error_xmit: \
1740 /* We could try again ... */ \ 1602 /* We could try again ... */ \
1741 dev_kfree_skb_any(skb);/*we need to free if tx fails*/ \ 1603 dev_kfree_skb_any(skb);/*we need to free if tx fails*/ \
1742error_build_assoc: \ 1604error_build_assoc: \
1743 d_fnend(6, dev, "wlp %p, wss %p, neighbor: %02x:%02x\n", \
1744 wlp, wss, dev_addr->data[1], dev_addr->data[0]); \
1745 return result; \ 1605 return result; \
1746} 1606}
1747 1607
@@ -1794,12 +1654,9 @@ void wlp_handle_c1_frame(struct work_struct *ws)
1794 struct uwb_dev_addr *src = &frame_ctx->src; 1654 struct uwb_dev_addr *src = &frame_ctx->src;
1795 int result; 1655 int result;
1796 struct wlp_uuid wssid; 1656 struct wlp_uuid wssid;
1797 char buf[WLP_WSS_UUID_STRSIZE];
1798 struct sk_buff *resp = NULL; 1657 struct sk_buff *resp = NULL;
1799 1658
1800 /* Parse C1 frame */ 1659 /* Parse C1 frame */
1801 d_fnstart(6, dev, "WLP: handle C1 frame. wlp = %p, c1 = %p\n",
1802 wlp, c1);
1803 mutex_lock(&wss->mutex); 1660 mutex_lock(&wss->mutex);
1804 result = wlp_get_wssid(wlp, (void *)c1 + sizeof(*c1), &wssid, 1661 result = wlp_get_wssid(wlp, (void *)c1 + sizeof(*c1), &wssid,
1805 len - sizeof(*c1)); 1662 len - sizeof(*c1));
@@ -1807,12 +1664,8 @@ void wlp_handle_c1_frame(struct work_struct *ws)
1807 dev_err(dev, "WLP: unable to obtain WSSID from C1 frame.\n"); 1664 dev_err(dev, "WLP: unable to obtain WSSID from C1 frame.\n");
1808 goto out; 1665 goto out;
1809 } 1666 }
1810 wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
1811 d_printf(6, dev, "Received C1 frame with WSSID %s \n", buf);
1812 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)) 1667 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))
1813 && wss->state == WLP_WSS_STATE_ACTIVE) { 1668 && wss->state == WLP_WSS_STATE_ACTIVE) {
1814 d_printf(6, dev, "WSSID from C1 frame is known locally "
1815 "and is active\n");
1816 /* Construct C2 frame */ 1669 /* Construct C2 frame */
1817 result = wlp_build_assoc_c2(wlp, wss, &resp); 1670 result = wlp_build_assoc_c2(wlp, wss, &resp);
1818 if (result < 0) { 1671 if (result < 0) {
@@ -1820,8 +1673,6 @@ void wlp_handle_c1_frame(struct work_struct *ws)
1820 goto out; 1673 goto out;
1821 } 1674 }
1822 } else { 1675 } else {
1823 d_printf(6, dev, "WSSID from C1 frame is not known locally "
1824 "or is not active\n");
1825 /* Construct F0 frame */ 1676 /* Construct F0 frame */
1826 result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV); 1677 result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV);
1827 if (result < 0) { 1678 if (result < 0) {
@@ -1830,8 +1681,6 @@ void wlp_handle_c1_frame(struct work_struct *ws)
1830 } 1681 }
1831 } 1682 }
1832 /* Send C2 frame */ 1683 /* Send C2 frame */
1833 d_printf(6, dev, "Transmitting response (C2/F0) frame to %02x:%02x \n",
1834 src->data[1], src->data[0]);
1835 BUG_ON(wlp->xmit_frame == NULL); 1684 BUG_ON(wlp->xmit_frame == NULL);
1836 result = wlp->xmit_frame(wlp, resp, src); 1685 result = wlp->xmit_frame(wlp, resp, src);
1837 if (result < 0) { 1686 if (result < 0) {
@@ -1846,7 +1695,6 @@ out:
1846 kfree_skb(frame_ctx->skb); 1695 kfree_skb(frame_ctx->skb);
1847 kfree(frame_ctx); 1696 kfree(frame_ctx);
1848 mutex_unlock(&wss->mutex); 1697 mutex_unlock(&wss->mutex);
1849 d_fnend(6, dev, "WLP: handle C1 frame. wlp = %p\n", wlp);
1850} 1698}
1851 1699
1852/** 1700/**
@@ -1868,27 +1716,20 @@ void wlp_handle_c3_frame(struct work_struct *ws)
1868 struct sk_buff *skb = frame_ctx->skb; 1716 struct sk_buff *skb = frame_ctx->skb;
1869 struct uwb_dev_addr *src = &frame_ctx->src; 1717 struct uwb_dev_addr *src = &frame_ctx->src;
1870 int result; 1718 int result;
1871 char buf[WLP_WSS_UUID_STRSIZE];
1872 struct sk_buff *resp = NULL; 1719 struct sk_buff *resp = NULL;
1873 struct wlp_uuid wssid; 1720 struct wlp_uuid wssid;
1874 u8 tag; 1721 u8 tag;
1875 struct uwb_mac_addr virt_addr; 1722 struct uwb_mac_addr virt_addr;
1876 1723
1877 /* Parse C3 frame */ 1724 /* Parse C3 frame */
1878 d_fnstart(6, dev, "WLP: handle C3 frame. wlp = %p, skb = %p\n",
1879 wlp, skb);
1880 mutex_lock(&wss->mutex); 1725 mutex_lock(&wss->mutex);
1881 result = wlp_parse_c3c4_frame(wlp, skb, &wssid, &tag, &virt_addr); 1726 result = wlp_parse_c3c4_frame(wlp, skb, &wssid, &tag, &virt_addr);
1882 if (result < 0) { 1727 if (result < 0) {
1883 dev_err(dev, "WLP: unable to obtain values from C3 frame.\n"); 1728 dev_err(dev, "WLP: unable to obtain values from C3 frame.\n");
1884 goto out; 1729 goto out;
1885 } 1730 }
1886 wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
1887 d_printf(6, dev, "Received C3 frame with WSSID %s \n", buf);
1888 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)) 1731 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))
1889 && wss->state >= WLP_WSS_STATE_ACTIVE) { 1732 && wss->state >= WLP_WSS_STATE_ACTIVE) {
1890 d_printf(6, dev, "WSSID from C3 frame is known locally "
1891 "and is active\n");
1892 result = wlp_eda_update_node(&wlp->eda, src, wss, 1733 result = wlp_eda_update_node(&wlp->eda, src, wss,
1893 (void *) virt_addr.data, tag, 1734 (void *) virt_addr.data, tag,
1894 WLP_WSS_CONNECTED); 1735 WLP_WSS_CONNECTED);
@@ -1913,8 +1754,6 @@ void wlp_handle_c3_frame(struct work_struct *ws)
1913 } 1754 }
1914 } 1755 }
1915 } else { 1756 } else {
1916 d_printf(6, dev, "WSSID from C3 frame is not known locally "
1917 "or is not active\n");
1918 /* Construct F0 frame */ 1757 /* Construct F0 frame */
1919 result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV); 1758 result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV);
1920 if (result < 0) { 1759 if (result < 0) {
@@ -1923,8 +1762,6 @@ void wlp_handle_c3_frame(struct work_struct *ws)
1923 } 1762 }
1924 } 1763 }
1925 /* Send C4 frame */ 1764 /* Send C4 frame */
1926 d_printf(6, dev, "Transmitting response (C4/F0) frame to %02x:%02x \n",
1927 src->data[1], src->data[0]);
1928 BUG_ON(wlp->xmit_frame == NULL); 1765 BUG_ON(wlp->xmit_frame == NULL);
1929 result = wlp->xmit_frame(wlp, resp, src); 1766 result = wlp->xmit_frame(wlp, resp, src);
1930 if (result < 0) { 1767 if (result < 0) {
@@ -1939,8 +1776,6 @@ out:
1939 kfree_skb(frame_ctx->skb); 1776 kfree_skb(frame_ctx->skb);
1940 kfree(frame_ctx); 1777 kfree(frame_ctx);
1941 mutex_unlock(&wss->mutex); 1778 mutex_unlock(&wss->mutex);
1942 d_fnend(6, dev, "WLP: handle C3 frame. wlp = %p, skb = %p\n",
1943 wlp, skb);
1944} 1779}
1945 1780
1946 1781
diff --git a/drivers/uwb/wlp/sysfs.c b/drivers/uwb/wlp/sysfs.c
index 1bb9b1f97d47..0370399ff4bb 100644
--- a/drivers/uwb/wlp/sysfs.c
+++ b/drivers/uwb/wlp/sysfs.c
@@ -23,8 +23,8 @@
23 * FIXME: Docs 23 * FIXME: Docs
24 * 24 *
25 */ 25 */
26
27#include <linux/wlp.h> 26#include <linux/wlp.h>
27
28#include "wlp-internal.h" 28#include "wlp-internal.h"
29 29
30static 30static
diff --git a/drivers/uwb/wlp/txrx.c b/drivers/uwb/wlp/txrx.c
index c701bd1a2887..cd2035768b47 100644
--- a/drivers/uwb/wlp/txrx.c
+++ b/drivers/uwb/wlp/txrx.c
@@ -26,12 +26,10 @@
26 26
27#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
28#include <linux/wlp.h> 28#include <linux/wlp.h>
29#define D_LOCAL 5
30#include <linux/uwb/debug.h>
31#include "wlp-internal.h"
32 29
30#include "wlp-internal.h"
33 31
34/** 32/*
35 * Direct incoming association msg to correct parsing routine 33 * Direct incoming association msg to correct parsing routine
36 * 34 *
37 * We only expect D1, E1, C1, C3 messages as new. All other incoming 35 * We only expect D1, E1, C1, C3 messages as new. All other incoming
@@ -48,35 +46,31 @@ void wlp_direct_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
48 struct device *dev = &wlp->rc->uwb_dev.dev; 46 struct device *dev = &wlp->rc->uwb_dev.dev;
49 struct wlp_frame_assoc *assoc = (void *) skb->data; 47 struct wlp_frame_assoc *assoc = (void *) skb->data;
50 struct wlp_assoc_frame_ctx *frame_ctx; 48 struct wlp_assoc_frame_ctx *frame_ctx;
51 d_fnstart(5, dev, "wlp %p, skb %p\n", wlp, skb); 49
52 frame_ctx = kmalloc(sizeof(*frame_ctx), GFP_ATOMIC); 50 frame_ctx = kmalloc(sizeof(*frame_ctx), GFP_ATOMIC);
53 if (frame_ctx == NULL) { 51 if (frame_ctx == NULL) {
54 dev_err(dev, "WLP: Unable to allocate memory for association " 52 dev_err(dev, "WLP: Unable to allocate memory for association "
55 "frame handling.\n"); 53 "frame handling.\n");
56 kfree_skb(skb); 54 kfree_skb(skb);
57 goto out; 55 return;
58 } 56 }
59 frame_ctx->wlp = wlp; 57 frame_ctx->wlp = wlp;
60 frame_ctx->skb = skb; 58 frame_ctx->skb = skb;
61 frame_ctx->src = *src; 59 frame_ctx->src = *src;
62 switch (assoc->type) { 60 switch (assoc->type) {
63 case WLP_ASSOC_D1: 61 case WLP_ASSOC_D1:
64 d_printf(5, dev, "Received a D1 frame.\n");
65 INIT_WORK(&frame_ctx->ws, wlp_handle_d1_frame); 62 INIT_WORK(&frame_ctx->ws, wlp_handle_d1_frame);
66 schedule_work(&frame_ctx->ws); 63 schedule_work(&frame_ctx->ws);
67 break; 64 break;
68 case WLP_ASSOC_E1: 65 case WLP_ASSOC_E1:
69 d_printf(5, dev, "Received a E1 frame. FIXME?\n");
70 kfree_skb(skb); /* Temporary until we handle it */ 66 kfree_skb(skb); /* Temporary until we handle it */
71 kfree(frame_ctx); /* Temporary until we handle it */ 67 kfree(frame_ctx); /* Temporary until we handle it */
72 break; 68 break;
73 case WLP_ASSOC_C1: 69 case WLP_ASSOC_C1:
74 d_printf(5, dev, "Received a C1 frame.\n");
75 INIT_WORK(&frame_ctx->ws, wlp_handle_c1_frame); 70 INIT_WORK(&frame_ctx->ws, wlp_handle_c1_frame);
76 schedule_work(&frame_ctx->ws); 71 schedule_work(&frame_ctx->ws);
77 break; 72 break;
78 case WLP_ASSOC_C3: 73 case WLP_ASSOC_C3:
79 d_printf(5, dev, "Received a C3 frame.\n");
80 INIT_WORK(&frame_ctx->ws, wlp_handle_c3_frame); 74 INIT_WORK(&frame_ctx->ws, wlp_handle_c3_frame);
81 schedule_work(&frame_ctx->ws); 75 schedule_work(&frame_ctx->ws);
82 break; 76 break;
@@ -87,11 +81,9 @@ void wlp_direct_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
87 kfree(frame_ctx); 81 kfree(frame_ctx);
88 break; 82 break;
89 } 83 }
90out:
91 d_fnend(5, dev, "wlp %p\n", wlp);
92} 84}
93 85
94/** 86/*
95 * Process incoming association frame 87 * Process incoming association frame
96 * 88 *
97 * Although it could be possible to deal with some incoming association 89 * Although it could be possible to deal with some incoming association
@@ -112,7 +104,6 @@ void wlp_receive_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
112 struct wlp_frame_assoc *assoc = (void *) skb->data; 104 struct wlp_frame_assoc *assoc = (void *) skb->data;
113 struct wlp_session *session = wlp->session; 105 struct wlp_session *session = wlp->session;
114 u8 version; 106 u8 version;
115 d_fnstart(5, dev, "wlp %p, skb %p\n", wlp, skb);
116 107
117 if (wlp_get_version(wlp, &assoc->version, &version, 108 if (wlp_get_version(wlp, &assoc->version, &version,
118 sizeof(assoc->version)) < 0) 109 sizeof(assoc->version)) < 0)
@@ -150,14 +141,12 @@ void wlp_receive_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
150 } else { 141 } else {
151 wlp_direct_assoc_frame(wlp, skb, src); 142 wlp_direct_assoc_frame(wlp, skb, src);
152 } 143 }
153 d_fnend(5, dev, "wlp %p\n", wlp);
154 return; 144 return;
155error: 145error:
156 kfree_skb(skb); 146 kfree_skb(skb);
157 d_fnend(5, dev, "wlp %p\n", wlp);
158} 147}
159 148
160/** 149/*
161 * Verify incoming frame is from connected neighbor, prep to pass to WLP client 150 * Verify incoming frame is from connected neighbor, prep to pass to WLP client
162 * 151 *
163 * Verification proceeds according to WLP 0.99 [7.3.1]. The source address 152 * Verification proceeds according to WLP 0.99 [7.3.1]. The source address
@@ -176,7 +165,6 @@ int wlp_verify_prep_rx_frame(struct wlp *wlp, struct sk_buff *skb,
176 struct wlp_eda_node eda_entry; 165 struct wlp_eda_node eda_entry;
177 struct wlp_frame_std_abbrv_hdr *hdr = (void *) skb->data; 166 struct wlp_frame_std_abbrv_hdr *hdr = (void *) skb->data;
178 167
179 d_fnstart(6, dev, "wlp %p, skb %p \n", wlp, skb);
180 /*verify*/ 168 /*verify*/
181 result = wlp_copy_eda_node(&wlp->eda, src, &eda_entry); 169 result = wlp_copy_eda_node(&wlp->eda, src, &eda_entry);
182 if (result < 0) { 170 if (result < 0) {
@@ -207,11 +195,10 @@ int wlp_verify_prep_rx_frame(struct wlp *wlp, struct sk_buff *skb,
207 /*prep*/ 195 /*prep*/
208 skb_pull(skb, sizeof(*hdr)); 196 skb_pull(skb, sizeof(*hdr));
209out: 197out:
210 d_fnend(6, dev, "wlp %p, skb %p, result = %d \n", wlp, skb, result);
211 return result; 198 return result;
212} 199}
213 200
214/** 201/*
215 * Receive a WLP frame from device 202 * Receive a WLP frame from device
216 * 203 *
217 * @returns: 1 if calling function should free the skb 204 * @returns: 1 if calling function should free the skb
@@ -226,14 +213,12 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb,
226 struct wlp_frame_hdr *hdr; 213 struct wlp_frame_hdr *hdr;
227 int result = 0; 214 int result = 0;
228 215
229 d_fnstart(6, dev, "skb (%p), len (%u)\n", skb, len);
230 if (len < sizeof(*hdr)) { 216 if (len < sizeof(*hdr)) {
231 dev_err(dev, "Not enough data to parse WLP header.\n"); 217 dev_err(dev, "Not enough data to parse WLP header.\n");
232 result = -EINVAL; 218 result = -EINVAL;
233 goto out; 219 goto out;
234 } 220 }
235 hdr = ptr; 221 hdr = ptr;
236 d_dump(6, dev, hdr, sizeof(*hdr));
237 if (le16_to_cpu(hdr->mux_hdr) != WLP_PROTOCOL_ID) { 222 if (le16_to_cpu(hdr->mux_hdr) != WLP_PROTOCOL_ID) {
238 dev_err(dev, "Not a WLP frame type.\n"); 223 dev_err(dev, "Not a WLP frame type.\n");
239 result = -EINVAL; 224 result = -EINVAL;
@@ -270,7 +255,6 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb,
270 "WLP header.\n"); 255 "WLP header.\n");
271 goto out; 256 goto out;
272 } 257 }
273 d_printf(5, dev, "Association frame received.\n");
274 wlp_receive_assoc_frame(wlp, skb, src); 258 wlp_receive_assoc_frame(wlp, skb, src);
275 break; 259 break;
276 default: 260 default:
@@ -283,13 +267,12 @@ out:
283 kfree_skb(skb); 267 kfree_skb(skb);
284 result = 0; 268 result = 0;
285 } 269 }
286 d_fnend(6, dev, "skb (%p)\n", skb);
287 return result; 270 return result;
288} 271}
289EXPORT_SYMBOL_GPL(wlp_receive_frame); 272EXPORT_SYMBOL_GPL(wlp_receive_frame);
290 273
291 274
292/** 275/*
293 * Verify frame from network stack, prepare for further transmission 276 * Verify frame from network stack, prepare for further transmission
294 * 277 *
295 * @skb: the socket buffer that needs to be prepared for transmission (it 278 * @skb: the socket buffer that needs to be prepared for transmission (it
@@ -343,9 +326,7 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
343 int result = -EINVAL; 326 int result = -EINVAL;
344 struct ethhdr *eth_hdr = (void *) skb->data; 327 struct ethhdr *eth_hdr = (void *) skb->data;
345 328
346 d_fnstart(6, dev, "wlp (%p), skb (%p) \n", wlp, skb);
347 if (is_broadcast_ether_addr(eth_hdr->h_dest)) { 329 if (is_broadcast_ether_addr(eth_hdr->h_dest)) {
348 d_printf(6, dev, "WLP: handling broadcast frame. \n");
349 result = wlp_eda_for_each(&wlp->eda, wlp_wss_send_copy, skb); 330 result = wlp_eda_for_each(&wlp->eda, wlp_wss_send_copy, skb);
350 if (result < 0) { 331 if (result < 0) {
351 if (printk_ratelimit()) 332 if (printk_ratelimit())
@@ -357,7 +338,6 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
357 result = 1; 338 result = 1;
358 /* Frame will be transmitted by WLP. */ 339 /* Frame will be transmitted by WLP. */
359 } else { 340 } else {
360 d_printf(6, dev, "WLP: handling unicast frame. \n");
361 result = wlp_eda_for_virtual(&wlp->eda, eth_hdr->h_dest, dst, 341 result = wlp_eda_for_virtual(&wlp->eda, eth_hdr->h_dest, dst,
362 wlp_wss_prep_hdr, skb); 342 wlp_wss_prep_hdr, skb);
363 if (unlikely(result < 0)) { 343 if (unlikely(result < 0)) {
@@ -368,7 +348,6 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
368 } 348 }
369 } 349 }
370out: 350out:
371 d_fnend(6, dev, "wlp (%p), skb (%p). result = %d \n", wlp, skb, result);
372 return result; 351 return result;
373} 352}
374EXPORT_SYMBOL_GPL(wlp_prepare_tx_frame); 353EXPORT_SYMBOL_GPL(wlp_prepare_tx_frame);
diff --git a/drivers/uwb/wlp/wlp-lc.c b/drivers/uwb/wlp/wlp-lc.c
index e531093c4162..13db739c4e39 100644
--- a/drivers/uwb/wlp/wlp-lc.c
+++ b/drivers/uwb/wlp/wlp-lc.c
@@ -21,12 +21,9 @@
21 * 21 *
22 * FIXME: docs 22 * FIXME: docs
23 */ 23 */
24
25#include <linux/wlp.h> 24#include <linux/wlp.h>
26#define D_LOCAL 6
27#include <linux/uwb/debug.h>
28#include "wlp-internal.h"
29 25
26#include "wlp-internal.h"
30 27
31static 28static
32void wlp_neighbor_init(struct wlp_neighbor_e *neighbor) 29void wlp_neighbor_init(struct wlp_neighbor_e *neighbor)
@@ -61,11 +58,6 @@ int __wlp_alloc_device_info(struct wlp *wlp)
61static 58static
62void __wlp_fill_device_info(struct wlp *wlp) 59void __wlp_fill_device_info(struct wlp *wlp)
63{ 60{
64 struct device *dev = &wlp->rc->uwb_dev.dev;
65
66 BUG_ON(wlp->fill_device_info == NULL);
67 d_printf(6, dev, "Retrieving device information "
68 "from device driver.\n");
69 wlp->fill_device_info(wlp, wlp->dev_info); 61 wlp->fill_device_info(wlp, wlp->dev_info);
70} 62}
71 63
@@ -127,7 +119,7 @@ void wlp_remove_neighbor_tmp_info(struct wlp_neighbor_e *neighbor)
127 } 119 }
128} 120}
129 121
130/** 122/*
131 * Populate WLP neighborhood cache with neighbor information 123 * Populate WLP neighborhood cache with neighbor information
132 * 124 *
133 * A new neighbor is found. If it is discoverable then we add it to the 125 * A new neighbor is found. If it is discoverable then we add it to the
@@ -141,10 +133,7 @@ int wlp_add_neighbor(struct wlp *wlp, struct uwb_dev *dev)
141 int discoverable; 133 int discoverable;
142 struct wlp_neighbor_e *neighbor; 134 struct wlp_neighbor_e *neighbor;
143 135
144 d_fnstart(6, &dev->dev, "uwb %p \n", dev); 136 /*
145 d_printf(6, &dev->dev, "Found neighbor device %02x:%02x \n",
146 dev->dev_addr.data[1], dev->dev_addr.data[0]);
147 /**
148 * FIXME: 137 * FIXME:
149 * Use contents of WLP IE found in beacon cache to determine if 138 * Use contents of WLP IE found in beacon cache to determine if
150 * neighbor is discoverable. 139 * neighbor is discoverable.
@@ -167,7 +156,6 @@ int wlp_add_neighbor(struct wlp *wlp, struct uwb_dev *dev)
167 list_add(&neighbor->node, &wlp->neighbors); 156 list_add(&neighbor->node, &wlp->neighbors);
168 } 157 }
169error_no_mem: 158error_no_mem:
170 d_fnend(6, &dev->dev, "uwb %p, result = %d \n", dev, result);
171 return result; 159 return result;
172} 160}
173 161
@@ -255,8 +243,6 @@ int wlp_d1d2_exchange(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
255 dev_err(dev, "Unable to send D1 frame to neighbor " 243 dev_err(dev, "Unable to send D1 frame to neighbor "
256 "%02x:%02x (%d)\n", dev_addr->data[1], 244 "%02x:%02x (%d)\n", dev_addr->data[1],
257 dev_addr->data[0], result); 245 dev_addr->data[0], result);
258 d_printf(6, dev, "Add placeholders into buffer next to "
259 "neighbor information we have (dev address).\n");
260 goto out; 246 goto out;
261 } 247 }
262 /* Create session, wait for response */ 248 /* Create session, wait for response */
@@ -284,8 +270,6 @@ int wlp_d1d2_exchange(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
284 /* Parse message in session->data: it will be either D2 or F0 */ 270 /* Parse message in session->data: it will be either D2 or F0 */
285 skb = session.data; 271 skb = session.data;
286 resp = (void *) skb->data; 272 resp = (void *) skb->data;
287 d_printf(6, dev, "Received response to D1 frame. \n");
288 d_dump(6, dev, skb->data, skb->len > 72 ? 72 : skb->len);
289 273
290 if (resp->type == WLP_ASSOC_F0) { 274 if (resp->type == WLP_ASSOC_F0) {
291 result = wlp_parse_f0(wlp, skb); 275 result = wlp_parse_f0(wlp, skb);
@@ -337,10 +321,9 @@ int wlp_enroll_neighbor(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
337 struct device *dev = &wlp->rc->uwb_dev.dev; 321 struct device *dev = &wlp->rc->uwb_dev.dev;
338 char buf[WLP_WSS_UUID_STRSIZE]; 322 char buf[WLP_WSS_UUID_STRSIZE];
339 struct uwb_dev_addr *dev_addr = &neighbor->uwb_dev->dev_addr; 323 struct uwb_dev_addr *dev_addr = &neighbor->uwb_dev->dev_addr;
324
340 wlp_wss_uuid_print(buf, sizeof(buf), wssid); 325 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
341 d_fnstart(6, dev, "wlp %p, neighbor %p, wss %p, wssid %p (%s)\n", 326
342 wlp, neighbor, wss, wssid, buf);
343 d_printf(6, dev, "Complete me.\n");
344 result = wlp_d1d2_exchange(wlp, neighbor, wss, wssid); 327 result = wlp_d1d2_exchange(wlp, neighbor, wss, wssid);
345 if (result < 0) { 328 if (result < 0) {
346 dev_err(dev, "WLP: D1/D2 message exchange for enrollment " 329 dev_err(dev, "WLP: D1/D2 message exchange for enrollment "
@@ -360,13 +343,10 @@ int wlp_enroll_neighbor(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
360 goto error; 343 goto error;
361 } else { 344 } else {
362 wss->state = WLP_WSS_STATE_ENROLLED; 345 wss->state = WLP_WSS_STATE_ENROLLED;
363 d_printf(2, dev, "WLP: Success Enrollment into unsecure WSS " 346 dev_dbg(dev, "WLP: Success Enrollment into unsecure WSS "
364 "%s using neighbor %02x:%02x. \n", buf, 347 "%s using neighbor %02x:%02x. \n",
365 dev_addr->data[1], dev_addr->data[0]); 348 buf, dev_addr->data[1], dev_addr->data[0]);
366 } 349 }
367
368 d_fnend(6, dev, "wlp %p, neighbor %p, wss %p, wssid %p (%s)\n",
369 wlp, neighbor, wss, wssid, buf);
370out: 350out:
371 return result; 351 return result;
372error: 352error:
@@ -449,7 +429,6 @@ ssize_t wlp_discover(struct wlp *wlp)
449 int result = 0; 429 int result = 0;
450 struct device *dev = &wlp->rc->uwb_dev.dev; 430 struct device *dev = &wlp->rc->uwb_dev.dev;
451 431
452 d_fnstart(6, dev, "wlp %p \n", wlp);
453 mutex_lock(&wlp->nbmutex); 432 mutex_lock(&wlp->nbmutex);
454 /* Clear current neighborhood cache. */ 433 /* Clear current neighborhood cache. */
455 __wlp_neighbors_release(wlp); 434 __wlp_neighbors_release(wlp);
@@ -469,7 +448,6 @@ ssize_t wlp_discover(struct wlp *wlp)
469 } 448 }
470error_dev_for_each: 449error_dev_for_each:
471 mutex_unlock(&wlp->nbmutex); 450 mutex_unlock(&wlp->nbmutex);
472 d_fnend(6, dev, "wlp %p \n", wlp);
473 return result; 451 return result;
474} 452}
475 453
@@ -492,9 +470,6 @@ void wlp_uwb_notifs_cb(void *_wlp, struct uwb_dev *uwb_dev,
492 int result; 470 int result;
493 switch (event) { 471 switch (event) {
494 case UWB_NOTIF_ONAIR: 472 case UWB_NOTIF_ONAIR:
495 d_printf(6, dev, "UWB device %02x:%02x is onair\n",
496 uwb_dev->dev_addr.data[1],
497 uwb_dev->dev_addr.data[0]);
498 result = wlp_eda_create_node(&wlp->eda, 473 result = wlp_eda_create_node(&wlp->eda,
499 uwb_dev->mac_addr.data, 474 uwb_dev->mac_addr.data,
500 &uwb_dev->dev_addr); 475 &uwb_dev->dev_addr);
@@ -505,18 +480,11 @@ void wlp_uwb_notifs_cb(void *_wlp, struct uwb_dev *uwb_dev,
505 uwb_dev->dev_addr.data[0]); 480 uwb_dev->dev_addr.data[0]);
506 break; 481 break;
507 case UWB_NOTIF_OFFAIR: 482 case UWB_NOTIF_OFFAIR:
508 d_printf(6, dev, "UWB device %02x:%02x is offair\n",
509 uwb_dev->dev_addr.data[1],
510 uwb_dev->dev_addr.data[0]);
511 wlp_eda_rm_node(&wlp->eda, &uwb_dev->dev_addr); 483 wlp_eda_rm_node(&wlp->eda, &uwb_dev->dev_addr);
512 mutex_lock(&wlp->nbmutex); 484 mutex_lock(&wlp->nbmutex);
513 list_for_each_entry_safe(neighbor, next, &wlp->neighbors, 485 list_for_each_entry_safe(neighbor, next, &wlp->neighbors, node) {
514 node) { 486 if (neighbor->uwb_dev == uwb_dev)
515 if (neighbor->uwb_dev == uwb_dev) {
516 d_printf(6, dev, "Removing device from "
517 "neighborhood.\n");
518 __wlp_neighbor_release(neighbor); 487 __wlp_neighbor_release(neighbor);
519 }
520 } 488 }
521 mutex_unlock(&wlp->nbmutex); 489 mutex_unlock(&wlp->nbmutex);
522 break; 490 break;
@@ -538,14 +506,13 @@ static void wlp_channel_changed(struct uwb_pal *pal, int channel)
538 506
539int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev) 507int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev)
540{ 508{
541 struct device *dev = &rc->uwb_dev.dev;
542 int result; 509 int result;
543 510
544 d_fnstart(6, dev, "wlp %p\n", wlp);
545 BUG_ON(wlp->fill_device_info == NULL); 511 BUG_ON(wlp->fill_device_info == NULL);
546 BUG_ON(wlp->xmit_frame == NULL); 512 BUG_ON(wlp->xmit_frame == NULL);
547 BUG_ON(wlp->stop_queue == NULL); 513 BUG_ON(wlp->stop_queue == NULL);
548 BUG_ON(wlp->start_queue == NULL); 514 BUG_ON(wlp->start_queue == NULL);
515
549 wlp->rc = rc; 516 wlp->rc = rc;
550 wlp->ndev = ndev; 517 wlp->ndev = ndev;
551 wlp_eda_init(&wlp->eda);/* Set up address cache */ 518 wlp_eda_init(&wlp->eda);/* Set up address cache */
@@ -560,15 +527,12 @@ int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev)
560 if (result < 0) 527 if (result < 0)
561 uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler); 528 uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler);
562 529
563 d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
564 return result; 530 return result;
565} 531}
566EXPORT_SYMBOL_GPL(wlp_setup); 532EXPORT_SYMBOL_GPL(wlp_setup);
567 533
568void wlp_remove(struct wlp *wlp) 534void wlp_remove(struct wlp *wlp)
569{ 535{
570 struct device *dev = &wlp->rc->uwb_dev.dev;
571 d_fnstart(6, dev, "wlp %p\n", wlp);
572 wlp_neighbors_release(wlp); 536 wlp_neighbors_release(wlp);
573 uwb_pal_unregister(&wlp->pal); 537 uwb_pal_unregister(&wlp->pal);
574 uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler); 538 uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler);
@@ -578,9 +542,6 @@ void wlp_remove(struct wlp *wlp)
578 kfree(wlp->dev_info); 542 kfree(wlp->dev_info);
579 mutex_unlock(&wlp->mutex); 543 mutex_unlock(&wlp->mutex);
580 wlp->rc = NULL; 544 wlp->rc = NULL;
581 /* We have to use NULL here because this function can be called
582 * when the device disappeared. */
583 d_fnend(6, NULL, "wlp %p\n", wlp);
584} 545}
585EXPORT_SYMBOL_GPL(wlp_remove); 546EXPORT_SYMBOL_GPL(wlp_remove);
586 547
diff --git a/drivers/uwb/wlp/wss-lc.c b/drivers/uwb/wlp/wss-lc.c
index 96b18c9bd6e9..5913c7a5d922 100644
--- a/drivers/uwb/wlp/wss-lc.c
+++ b/drivers/uwb/wlp/wss-lc.c
@@ -43,14 +43,11 @@
43 * wlp_wss_release() 43 * wlp_wss_release()
44 * wlp_wss_reset() 44 * wlp_wss_reset()
45 */ 45 */
46
47#include <linux/etherdevice.h> /* for is_valid_ether_addr */ 46#include <linux/etherdevice.h> /* for is_valid_ether_addr */
48#include <linux/skbuff.h> 47#include <linux/skbuff.h>
49#include <linux/wlp.h> 48#include <linux/wlp.h>
50#define D_LOCAL 5
51#include <linux/uwb/debug.h>
52#include "wlp-internal.h"
53 49
50#include "wlp-internal.h"
54 51
55size_t wlp_wss_key_print(char *buf, size_t bufsize, u8 *key) 52size_t wlp_wss_key_print(char *buf, size_t bufsize, u8 *key)
56{ 53{
@@ -116,9 +113,6 @@ struct uwb_mac_addr wlp_wss_sel_bcast_addr(struct wlp_wss *wss)
116 */ 113 */
117void wlp_wss_reset(struct wlp_wss *wss) 114void wlp_wss_reset(struct wlp_wss *wss)
118{ 115{
119 struct wlp *wlp = container_of(wss, struct wlp, wss);
120 struct device *dev = &wlp->rc->uwb_dev.dev;
121 d_fnstart(5, dev, "wss (%p) \n", wss);
122 memset(&wss->wssid, 0, sizeof(wss->wssid)); 116 memset(&wss->wssid, 0, sizeof(wss->wssid));
123 wss->hash = 0; 117 wss->hash = 0;
124 memset(&wss->name[0], 0, sizeof(wss->name)); 118 memset(&wss->name[0], 0, sizeof(wss->name));
@@ -127,7 +121,6 @@ void wlp_wss_reset(struct wlp_wss *wss)
127 memset(&wss->master_key[0], 0, sizeof(wss->master_key)); 121 memset(&wss->master_key[0], 0, sizeof(wss->master_key));
128 wss->tag = 0; 122 wss->tag = 0;
129 wss->state = WLP_WSS_STATE_NONE; 123 wss->state = WLP_WSS_STATE_NONE;
130 d_fnend(5, dev, "wss (%p) \n", wss);
131} 124}
132 125
133/** 126/**
@@ -145,7 +138,6 @@ int wlp_wss_sysfs_add(struct wlp_wss *wss, char *wssid_str)
145 struct device *dev = &wlp->rc->uwb_dev.dev; 138 struct device *dev = &wlp->rc->uwb_dev.dev;
146 int result; 139 int result;
147 140
148 d_fnstart(5, dev, "wss (%p), wssid: %s\n", wss, wssid_str);
149 result = kobject_set_name(&wss->kobj, "wss-%s", wssid_str); 141 result = kobject_set_name(&wss->kobj, "wss-%s", wssid_str);
150 if (result < 0) 142 if (result < 0)
151 return result; 143 return result;
@@ -162,7 +154,6 @@ int wlp_wss_sysfs_add(struct wlp_wss *wss, char *wssid_str)
162 result); 154 result);
163 goto error_sysfs_create_group; 155 goto error_sysfs_create_group;
164 } 156 }
165 d_fnend(5, dev, "Completed. result = %d \n", result);
166 return 0; 157 return 0;
167error_sysfs_create_group: 158error_sysfs_create_group:
168 159
@@ -214,22 +205,14 @@ int wlp_wss_enroll_target(struct wlp_wss *wss, struct wlp_uuid *wssid,
214 struct wlp *wlp = container_of(wss, struct wlp, wss); 205 struct wlp *wlp = container_of(wss, struct wlp, wss);
215 struct device *dev = &wlp->rc->uwb_dev.dev; 206 struct device *dev = &wlp->rc->uwb_dev.dev;
216 struct wlp_neighbor_e *neighbor; 207 struct wlp_neighbor_e *neighbor;
217 char buf[WLP_WSS_UUID_STRSIZE];
218 int result = -ENXIO; 208 int result = -ENXIO;
219 struct uwb_dev_addr *dev_addr; 209 struct uwb_dev_addr *dev_addr;
220 210
221 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
222 d_fnstart(5, dev, "wss %p, wssid %s, registrar %02x:%02x \n",
223 wss, buf, dest->data[1], dest->data[0]);
224 mutex_lock(&wlp->nbmutex); 211 mutex_lock(&wlp->nbmutex);
225 list_for_each_entry(neighbor, &wlp->neighbors, node) { 212 list_for_each_entry(neighbor, &wlp->neighbors, node) {
226 dev_addr = &neighbor->uwb_dev->dev_addr; 213 dev_addr = &neighbor->uwb_dev->dev_addr;
227 if (!memcmp(dest, dev_addr, sizeof(*dest))) { 214 if (!memcmp(dest, dev_addr, sizeof(*dest))) {
228 d_printf(5, dev, "Neighbor %02x:%02x is valid, " 215 result = wlp_enroll_neighbor(wlp, neighbor, wss, wssid);
229 "enrolling. \n",
230 dev_addr->data[1], dev_addr->data[0]);
231 result = wlp_enroll_neighbor(wlp, neighbor, wss,
232 wssid);
233 break; 216 break;
234 } 217 }
235 } 218 }
@@ -237,8 +220,6 @@ int wlp_wss_enroll_target(struct wlp_wss *wss, struct wlp_uuid *wssid,
237 dev_err(dev, "WLP: Cannot find neighbor %02x:%02x. \n", 220 dev_err(dev, "WLP: Cannot find neighbor %02x:%02x. \n",
238 dest->data[1], dest->data[0]); 221 dest->data[1], dest->data[0]);
239 mutex_unlock(&wlp->nbmutex); 222 mutex_unlock(&wlp->nbmutex);
240 d_fnend(5, dev, "wss %p, wssid %s, registrar %02x:%02x, result %d \n",
241 wss, buf, dest->data[1], dest->data[0], result);
242 return result; 223 return result;
243} 224}
244 225
@@ -260,16 +241,11 @@ int wlp_wss_enroll_discovered(struct wlp_wss *wss, struct wlp_uuid *wssid)
260 char buf[WLP_WSS_UUID_STRSIZE]; 241 char buf[WLP_WSS_UUID_STRSIZE];
261 int result = -ENXIO; 242 int result = -ENXIO;
262 243
263 wlp_wss_uuid_print(buf, sizeof(buf), wssid); 244
264 d_fnstart(5, dev, "wss %p, wssid %s \n", wss, buf);
265 mutex_lock(&wlp->nbmutex); 245 mutex_lock(&wlp->nbmutex);
266 list_for_each_entry(neighbor, &wlp->neighbors, node) { 246 list_for_each_entry(neighbor, &wlp->neighbors, node) {
267 list_for_each_entry(wssid_e, &neighbor->wssid, node) { 247 list_for_each_entry(wssid_e, &neighbor->wssid, node) {
268 if (!memcmp(wssid, &wssid_e->wssid, sizeof(*wssid))) { 248 if (!memcmp(wssid, &wssid_e->wssid, sizeof(*wssid))) {
269 d_printf(5, dev, "Found WSSID %s in neighbor "
270 "%02x:%02x cache. \n", buf,
271 neighbor->uwb_dev->dev_addr.data[1],
272 neighbor->uwb_dev->dev_addr.data[0]);
273 result = wlp_enroll_neighbor(wlp, neighbor, 249 result = wlp_enroll_neighbor(wlp, neighbor,
274 wss, wssid); 250 wss, wssid);
275 if (result == 0) /* enrollment success */ 251 if (result == 0) /* enrollment success */
@@ -279,10 +255,11 @@ int wlp_wss_enroll_discovered(struct wlp_wss *wss, struct wlp_uuid *wssid)
279 } 255 }
280 } 256 }
281out: 257out:
282 if (result == -ENXIO) 258 if (result == -ENXIO) {
259 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
283 dev_err(dev, "WLP: Cannot find WSSID %s in cache. \n", buf); 260 dev_err(dev, "WLP: Cannot find WSSID %s in cache. \n", buf);
261 }
284 mutex_unlock(&wlp->nbmutex); 262 mutex_unlock(&wlp->nbmutex);
285 d_fnend(5, dev, "wss %p, wssid %s, result %d \n", wss, buf, result);
286 return result; 263 return result;
287} 264}
288 265
@@ -307,27 +284,22 @@ int wlp_wss_enroll(struct wlp_wss *wss, struct wlp_uuid *wssid,
307 struct uwb_dev_addr bcast = {.data = {0xff, 0xff} }; 284 struct uwb_dev_addr bcast = {.data = {0xff, 0xff} };
308 285
309 wlp_wss_uuid_print(buf, sizeof(buf), wssid); 286 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
287
310 if (wss->state != WLP_WSS_STATE_NONE) { 288 if (wss->state != WLP_WSS_STATE_NONE) {
311 dev_err(dev, "WLP: Already enrolled in WSS %s.\n", buf); 289 dev_err(dev, "WLP: Already enrolled in WSS %s.\n", buf);
312 result = -EEXIST; 290 result = -EEXIST;
313 goto error; 291 goto error;
314 } 292 }
315 if (!memcmp(&bcast, devaddr, sizeof(bcast))) { 293 if (!memcmp(&bcast, devaddr, sizeof(bcast)))
316 d_printf(5, dev, "Request to enroll in discovered WSS "
317 "with WSSID %s \n", buf);
318 result = wlp_wss_enroll_discovered(wss, wssid); 294 result = wlp_wss_enroll_discovered(wss, wssid);
319 } else { 295 else
320 d_printf(5, dev, "Request to enroll in WSSID %s with "
321 "registrar %02x:%02x\n", buf, devaddr->data[1],
322 devaddr->data[0]);
323 result = wlp_wss_enroll_target(wss, wssid, devaddr); 296 result = wlp_wss_enroll_target(wss, wssid, devaddr);
324 }
325 if (result < 0) { 297 if (result < 0) {
326 dev_err(dev, "WLP: Unable to enroll into WSS %s, result %d \n", 298 dev_err(dev, "WLP: Unable to enroll into WSS %s, result %d \n",
327 buf, result); 299 buf, result);
328 goto error; 300 goto error;
329 } 301 }
330 d_printf(2, dev, "Successfully enrolled into WSS %s \n", buf); 302 dev_dbg(dev, "Successfully enrolled into WSS %s \n", buf);
331 result = wlp_wss_sysfs_add(wss, buf); 303 result = wlp_wss_sysfs_add(wss, buf);
332 if (result < 0) { 304 if (result < 0) {
333 dev_err(dev, "WLP: Unable to set up sysfs for WSS kobject.\n"); 305 dev_err(dev, "WLP: Unable to set up sysfs for WSS kobject.\n");
@@ -363,7 +335,6 @@ int wlp_wss_activate(struct wlp_wss *wss)
363 u8 hash; /* only include one hash */ 335 u8 hash; /* only include one hash */
364 } ie_data; 336 } ie_data;
365 337
366 d_fnstart(5, dev, "Activating WSS %p. \n", wss);
367 BUG_ON(wss->state != WLP_WSS_STATE_ENROLLED); 338 BUG_ON(wss->state != WLP_WSS_STATE_ENROLLED);
368 wss->hash = wlp_wss_comp_wssid_hash(&wss->wssid); 339 wss->hash = wlp_wss_comp_wssid_hash(&wss->wssid);
369 wss->tag = wss->hash; 340 wss->tag = wss->hash;
@@ -382,7 +353,6 @@ int wlp_wss_activate(struct wlp_wss *wss)
382 wss->state = WLP_WSS_STATE_ACTIVE; 353 wss->state = WLP_WSS_STATE_ACTIVE;
383 result = 0; 354 result = 0;
384error_wlp_ie: 355error_wlp_ie:
385 d_fnend(5, dev, "Activating WSS %p, result = %d \n", wss, result);
386 return result; 356 return result;
387} 357}
388 358
@@ -405,7 +375,6 @@ int wlp_wss_enroll_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
405 int result = 0; 375 int result = 0;
406 char buf[WLP_WSS_UUID_STRSIZE]; 376 char buf[WLP_WSS_UUID_STRSIZE];
407 377
408 d_fnstart(5, dev, "Enrollment and activation requested. \n");
409 mutex_lock(&wss->mutex); 378 mutex_lock(&wss->mutex);
410 result = wlp_wss_enroll(wss, wssid, devaddr); 379 result = wlp_wss_enroll(wss, wssid, devaddr);
411 if (result < 0) { 380 if (result < 0) {
@@ -424,7 +393,6 @@ int wlp_wss_enroll_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
424error_activate: 393error_activate:
425error_enroll: 394error_enroll:
426 mutex_unlock(&wss->mutex); 395 mutex_unlock(&wss->mutex);
427 d_fnend(5, dev, "Completed. result = %d \n", result);
428 return result; 396 return result;
429} 397}
430 398
@@ -447,11 +415,9 @@ int wlp_wss_create_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
447 struct device *dev = &wlp->rc->uwb_dev.dev; 415 struct device *dev = &wlp->rc->uwb_dev.dev;
448 int result = 0; 416 int result = 0;
449 char buf[WLP_WSS_UUID_STRSIZE]; 417 char buf[WLP_WSS_UUID_STRSIZE];
450 d_fnstart(5, dev, "Request to create new WSS.\n"); 418
451 result = wlp_wss_uuid_print(buf, sizeof(buf), wssid); 419 result = wlp_wss_uuid_print(buf, sizeof(buf), wssid);
452 d_printf(5, dev, "Request to create WSS: WSSID=%s, name=%s, " 420
453 "sec_status=%u, accepting enrollment=%u \n",
454 buf, name, sec_status, accept);
455 if (!mutex_trylock(&wss->mutex)) { 421 if (!mutex_trylock(&wss->mutex)) {
456 dev_err(dev, "WLP: WLP association session in progress.\n"); 422 dev_err(dev, "WLP: WLP association session in progress.\n");
457 return -EBUSY; 423 return -EBUSY;
@@ -498,7 +464,6 @@ int wlp_wss_create_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
498 result = 0; 464 result = 0;
499out: 465out:
500 mutex_unlock(&wss->mutex); 466 mutex_unlock(&wss->mutex);
501 d_fnend(5, dev, "Completed. result = %d \n", result);
502 return result; 467 return result;
503} 468}
504 469
@@ -520,16 +485,12 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
520{ 485{
521 int result = 0; 486 int result = 0;
522 struct device *dev = &wlp->rc->uwb_dev.dev; 487 struct device *dev = &wlp->rc->uwb_dev.dev;
523 char buf[WLP_WSS_UUID_STRSIZE];
524 DECLARE_COMPLETION_ONSTACK(completion); 488 DECLARE_COMPLETION_ONSTACK(completion);
525 struct wlp_session session; 489 struct wlp_session session;
526 struct sk_buff *skb; 490 struct sk_buff *skb;
527 struct wlp_frame_assoc *resp; 491 struct wlp_frame_assoc *resp;
528 struct wlp_uuid wssid; 492 struct wlp_uuid wssid;
529 493
530 wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
531 d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
532 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
533 mutex_lock(&wlp->mutex); 494 mutex_lock(&wlp->mutex);
534 /* Send C1 association frame */ 495 /* Send C1 association frame */
535 result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C1); 496 result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C1);
@@ -565,8 +526,6 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
565 /* Parse message in session->data: it will be either C2 or F0 */ 526 /* Parse message in session->data: it will be either C2 or F0 */
566 skb = session.data; 527 skb = session.data;
567 resp = (void *) skb->data; 528 resp = (void *) skb->data;
568 d_printf(5, dev, "Received response to C1 frame. \n");
569 d_dump(5, dev, skb->data, skb->len > 72 ? 72 : skb->len);
570 if (resp->type == WLP_ASSOC_F0) { 529 if (resp->type == WLP_ASSOC_F0) {
571 result = wlp_parse_f0(wlp, skb); 530 result = wlp_parse_f0(wlp, skb);
572 if (result < 0) 531 if (result < 0)
@@ -584,11 +543,9 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
584 result = 0; 543 result = 0;
585 goto error_resp_parse; 544 goto error_resp_parse;
586 } 545 }
587 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))) { 546 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)))
588 d_printf(5, dev, "WSSID in C2 frame matches local "
589 "active WSS.\n");
590 result = 1; 547 result = 1;
591 } else { 548 else {
592 dev_err(dev, "WLP: Received a C2 frame without matching " 549 dev_err(dev, "WLP: Received a C2 frame without matching "
593 "WSSID.\n"); 550 "WSSID.\n");
594 result = 0; 551 result = 0;
@@ -598,8 +555,6 @@ error_resp_parse:
598out: 555out:
599 wlp->session = NULL; 556 wlp->session = NULL;
600 mutex_unlock(&wlp->mutex); 557 mutex_unlock(&wlp->mutex);
601 d_fnend(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
602 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
603 return result; 558 return result;
604} 559}
605 560
@@ -620,16 +575,8 @@ int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss,
620{ 575{
621 struct device *dev = &wlp->rc->uwb_dev.dev; 576 struct device *dev = &wlp->rc->uwb_dev.dev;
622 int result = 0; 577 int result = 0;
623 char buf[WLP_WSS_UUID_STRSIZE];
624 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
625 d_fnstart(5, dev, "wlp %p, wss %p, wssid %s, tag %u, virtual "
626 "%02x:%02x:%02x:%02x:%02x:%02x \n", wlp, wss, buf, *tag,
627 virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
628 virt_addr->data[3], virt_addr->data[4], virt_addr->data[5]);
629 578
630 if (!memcmp(wssid, &wss->wssid, sizeof(*wssid))) { 579 if (!memcmp(wssid, &wss->wssid, sizeof(*wssid))) {
631 d_printf(5, dev, "WSSID from neighbor frame matches local "
632 "active WSS.\n");
633 /* Update EDA cache */ 580 /* Update EDA cache */
634 result = wlp_eda_update_node(&wlp->eda, dev_addr, wss, 581 result = wlp_eda_update_node(&wlp->eda, dev_addr, wss,
635 (void *) virt_addr->data, *tag, 582 (void *) virt_addr->data, *tag,
@@ -638,18 +585,9 @@ int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss,
638 dev_err(dev, "WLP: Unable to update EDA cache " 585 dev_err(dev, "WLP: Unable to update EDA cache "
639 "with new connected neighbor information.\n"); 586 "with new connected neighbor information.\n");
640 } else { 587 } else {
641 dev_err(dev, "WLP: Neighbor does not have matching " 588 dev_err(dev, "WLP: Neighbor does not have matching WSSID.\n");
642 "WSSID.\n");
643 result = -EINVAL; 589 result = -EINVAL;
644 } 590 }
645
646 d_fnend(5, dev, "wlp %p, wss %p, wssid %s, tag %u, virtual "
647 "%02x:%02x:%02x:%02x:%02x:%02x, result = %d \n",
648 wlp, wss, buf, *tag,
649 virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
650 virt_addr->data[3], virt_addr->data[4], virt_addr->data[5],
651 result);
652
653 return result; 591 return result;
654} 592}
655 593
@@ -665,7 +603,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
665{ 603{
666 int result; 604 int result;
667 struct device *dev = &wlp->rc->uwb_dev.dev; 605 struct device *dev = &wlp->rc->uwb_dev.dev;
668 char buf[WLP_WSS_UUID_STRSIZE];
669 struct wlp_uuid wssid; 606 struct wlp_uuid wssid;
670 u8 tag; 607 u8 tag;
671 struct uwb_mac_addr virt_addr; 608 struct uwb_mac_addr virt_addr;
@@ -674,9 +611,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
674 struct wlp_frame_assoc *resp; 611 struct wlp_frame_assoc *resp;
675 struct sk_buff *skb; 612 struct sk_buff *skb;
676 613
677 wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
678 d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
679 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
680 mutex_lock(&wlp->mutex); 614 mutex_lock(&wlp->mutex);
681 /* Send C3 association frame */ 615 /* Send C3 association frame */
682 result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C3); 616 result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C3);
@@ -711,8 +645,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
711 /* Parse message in session->data: it will be either C4 or F0 */ 645 /* Parse message in session->data: it will be either C4 or F0 */
712 skb = session.data; 646 skb = session.data;
713 resp = (void *) skb->data; 647 resp = (void *) skb->data;
714 d_printf(5, dev, "Received response to C3 frame. \n");
715 d_dump(5, dev, skb->data, skb->len > 72 ? 72 : skb->len);
716 if (resp->type == WLP_ASSOC_F0) { 648 if (resp->type == WLP_ASSOC_F0) {
717 result = wlp_parse_f0(wlp, skb); 649 result = wlp_parse_f0(wlp, skb);
718 if (result < 0) 650 if (result < 0)
@@ -744,8 +676,6 @@ out:
744 WLP_WSS_CONNECT_FAILED); 676 WLP_WSS_CONNECT_FAILED);
745 wlp->session = NULL; 677 wlp->session = NULL;
746 mutex_unlock(&wlp->mutex); 678 mutex_unlock(&wlp->mutex);
747 d_fnend(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
748 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
749 return result; 679 return result;
750} 680}
751 681
@@ -780,12 +710,8 @@ void wlp_wss_connect_send(struct work_struct *ws)
780 struct wlp_wss *wss = &wlp->wss; 710 struct wlp_wss *wss = &wlp->wss;
781 int result; 711 int result;
782 struct device *dev = &wlp->rc->uwb_dev.dev; 712 struct device *dev = &wlp->rc->uwb_dev.dev;
783 char buf[WLP_WSS_UUID_STRSIZE];
784 713
785 mutex_lock(&wss->mutex); 714 mutex_lock(&wss->mutex);
786 wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
787 d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
788 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
789 if (wss->state < WLP_WSS_STATE_ACTIVE) { 715 if (wss->state < WLP_WSS_STATE_ACTIVE) {
790 if (printk_ratelimit()) 716 if (printk_ratelimit())
791 dev_err(dev, "WLP: Attempting to connect with " 717 dev_err(dev, "WLP: Attempting to connect with "
@@ -836,7 +762,6 @@ out:
836 BUG_ON(wlp->start_queue == NULL); 762 BUG_ON(wlp->start_queue == NULL);
837 wlp->start_queue(wlp); 763 wlp->start_queue(wlp);
838 mutex_unlock(&wss->mutex); 764 mutex_unlock(&wss->mutex);
839 d_fnend(5, dev, "wlp %p, wss %p (wssid %s)\n", wlp, wss, buf);
840} 765}
841 766
842/** 767/**
@@ -855,7 +780,6 @@ int wlp_wss_prep_hdr(struct wlp *wlp, struct wlp_eda_node *eda_entry,
855 struct sk_buff *skb = _skb; 780 struct sk_buff *skb = _skb;
856 struct wlp_frame_std_abbrv_hdr *std_hdr; 781 struct wlp_frame_std_abbrv_hdr *std_hdr;
857 782
858 d_fnstart(6, dev, "wlp %p \n", wlp);
859 if (eda_entry->state == WLP_WSS_CONNECTED) { 783 if (eda_entry->state == WLP_WSS_CONNECTED) {
860 /* Add WLP header */ 784 /* Add WLP header */
861 BUG_ON(skb_headroom(skb) < sizeof(*std_hdr)); 785 BUG_ON(skb_headroom(skb) < sizeof(*std_hdr));
@@ -873,7 +797,6 @@ int wlp_wss_prep_hdr(struct wlp *wlp, struct wlp_eda_node *eda_entry,
873 dev_addr->data[0]); 797 dev_addr->data[0]);
874 result = -EINVAL; 798 result = -EINVAL;
875 } 799 }
876 d_fnend(6, dev, "wlp %p \n", wlp);
877 return result; 800 return result;
878} 801}
879 802
@@ -893,16 +816,9 @@ int wlp_wss_connect_prep(struct wlp *wlp, struct wlp_eda_node *eda_entry,
893{ 816{
894 int result = 0; 817 int result = 0;
895 struct device *dev = &wlp->rc->uwb_dev.dev; 818 struct device *dev = &wlp->rc->uwb_dev.dev;
896 struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr;
897 unsigned char *eth_addr = eda_entry->eth_addr;
898 struct sk_buff *skb = _skb; 819 struct sk_buff *skb = _skb;
899 struct wlp_assoc_conn_ctx *conn_ctx; 820 struct wlp_assoc_conn_ctx *conn_ctx;
900 821
901 d_fnstart(5, dev, "wlp %p\n", wlp);
902 d_printf(5, dev, "To neighbor %02x:%02x with eth "
903 "%02x:%02x:%02x:%02x:%02x:%02x\n", dev_addr->data[1],
904 dev_addr->data[0], eth_addr[0], eth_addr[1], eth_addr[2],
905 eth_addr[3], eth_addr[4], eth_addr[5]);
906 if (eda_entry->state == WLP_WSS_UNCONNECTED) { 822 if (eda_entry->state == WLP_WSS_UNCONNECTED) {
907 /* We don't want any more packets while we set up connection */ 823 /* We don't want any more packets while we set up connection */
908 BUG_ON(wlp->stop_queue == NULL); 824 BUG_ON(wlp->stop_queue == NULL);
@@ -929,12 +845,9 @@ int wlp_wss_connect_prep(struct wlp *wlp, struct wlp_eda_node *eda_entry,
929 "previously. Not retrying. \n"); 845 "previously. Not retrying. \n");
930 result = -ENONET; 846 result = -ENONET;
931 goto out; 847 goto out;
932 } else { /* eda_entry->state == WLP_WSS_CONNECTED */ 848 } else /* eda_entry->state == WLP_WSS_CONNECTED */
933 d_printf(5, dev, "Neighbor is connected, preparing frame.\n");
934 result = wlp_wss_prep_hdr(wlp, eda_entry, skb); 849 result = wlp_wss_prep_hdr(wlp, eda_entry, skb);
935 }
936out: 850out:
937 d_fnend(5, dev, "wlp %p, result = %d \n", wlp, result);
938 return result; 851 return result;
939} 852}
940 853
@@ -957,8 +870,6 @@ int wlp_wss_send_copy(struct wlp *wlp, struct wlp_eda_node *eda_entry,
957 struct sk_buff *copy; 870 struct sk_buff *copy;
958 struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr; 871 struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr;
959 872
960 d_fnstart(5, dev, "to neighbor %02x:%02x, skb (%p) \n",
961 dev_addr->data[1], dev_addr->data[0], skb);
962 copy = skb_copy(skb, GFP_ATOMIC); 873 copy = skb_copy(skb, GFP_ATOMIC);
963 if (copy == NULL) { 874 if (copy == NULL) {
964 if (printk_ratelimit()) 875 if (printk_ratelimit())
@@ -988,8 +899,6 @@ int wlp_wss_send_copy(struct wlp *wlp, struct wlp_eda_node *eda_entry,
988 dev_kfree_skb_irq(copy);/*we need to free if tx fails */ 899 dev_kfree_skb_irq(copy);/*we need to free if tx fails */
989 } 900 }
990out: 901out:
991 d_fnend(5, dev, "to neighbor %02x:%02x \n", dev_addr->data[1],
992 dev_addr->data[0]);
993 return result; 902 return result;
994} 903}
995 904
@@ -1005,7 +914,7 @@ int wlp_wss_setup(struct net_device *net_dev, struct wlp_wss *wss)
1005 struct wlp *wlp = container_of(wss, struct wlp, wss); 914 struct wlp *wlp = container_of(wss, struct wlp, wss);
1006 struct device *dev = &wlp->rc->uwb_dev.dev; 915 struct device *dev = &wlp->rc->uwb_dev.dev;
1007 int result = 0; 916 int result = 0;
1008 d_fnstart(5, dev, "wss (%p) \n", wss); 917
1009 mutex_lock(&wss->mutex); 918 mutex_lock(&wss->mutex);
1010 wss->kobj.parent = &net_dev->dev.kobj; 919 wss->kobj.parent = &net_dev->dev.kobj;
1011 if (!is_valid_ether_addr(net_dev->dev_addr)) { 920 if (!is_valid_ether_addr(net_dev->dev_addr)) {
@@ -1018,7 +927,6 @@ int wlp_wss_setup(struct net_device *net_dev, struct wlp_wss *wss)
1018 sizeof(wss->virtual_addr.data)); 927 sizeof(wss->virtual_addr.data));
1019out: 928out:
1020 mutex_unlock(&wss->mutex); 929 mutex_unlock(&wss->mutex);
1021 d_fnend(5, dev, "wss (%p) \n", wss);
1022 return result; 930 return result;
1023} 931}
1024EXPORT_SYMBOL_GPL(wlp_wss_setup); 932EXPORT_SYMBOL_GPL(wlp_wss_setup);
@@ -1035,8 +943,7 @@ EXPORT_SYMBOL_GPL(wlp_wss_setup);
1035void wlp_wss_remove(struct wlp_wss *wss) 943void wlp_wss_remove(struct wlp_wss *wss)
1036{ 944{
1037 struct wlp *wlp = container_of(wss, struct wlp, wss); 945 struct wlp *wlp = container_of(wss, struct wlp, wss);
1038 struct device *dev = &wlp->rc->uwb_dev.dev; 946
1039 d_fnstart(5, dev, "wss (%p) \n", wss);
1040 mutex_lock(&wss->mutex); 947 mutex_lock(&wss->mutex);
1041 if (wss->state == WLP_WSS_STATE_ACTIVE) 948 if (wss->state == WLP_WSS_STATE_ACTIVE)
1042 uwb_rc_ie_rm(wlp->rc, UWB_IE_WLP); 949 uwb_rc_ie_rm(wlp->rc, UWB_IE_WLP);
@@ -1050,6 +957,5 @@ void wlp_wss_remove(struct wlp_wss *wss)
1050 wlp_eda_release(&wlp->eda); 957 wlp_eda_release(&wlp->eda);
1051 wlp_eda_init(&wlp->eda); 958 wlp_eda_init(&wlp->eda);
1052 mutex_unlock(&wss->mutex); 959 mutex_unlock(&wss->mutex);
1053 d_fnend(5, dev, "wss (%p) \n", wss);
1054} 960}
1055EXPORT_SYMBOL_GPL(wlp_wss_remove); 961EXPORT_SYMBOL_GPL(wlp_wss_remove);