Commit bce83697 authored by David Vrabel's avatar David Vrabel

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: default avatarDavid Vrabel <david.vrabel@csr.com>
parent 02f11ee1
...@@ -62,16 +62,12 @@ ...@@ -62,16 +62,12 @@
#include "../wusbcore/wa-hc.h" #include "../wusbcore/wa-hc.h"
#include "../wusbcore/wusbhc.h" #include "../wusbcore/wusbhc.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
struct hwahc { struct hwahc {
struct wusbhc wusbhc; /* has to be 1st */ struct wusbhc wusbhc; /* has to be 1st */
struct wahc wa; struct wahc wa;
u8 buffer[16]; /* for misc usb transactions */
}; };
/** /*
* FIXME should be wusbhc * FIXME should be wusbhc
* *
* NOTE: we need to cache the Cluster ID because later...there is no * NOTE: we need to cache the Cluster ID because later...there is no
...@@ -125,7 +121,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd) ...@@ -125,7 +121,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc); struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
struct device *dev = &hwahc->wa.usb_iface->dev; struct device *dev = &hwahc->wa.usb_iface->dev;
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
wa_nep_disarm(&hwahc->wa); wa_nep_disarm(&hwahc->wa);
result = __wa_set_feature(&hwahc->wa, WA_RESET); result = __wa_set_feature(&hwahc->wa, WA_RESET);
...@@ -133,7 +128,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd) ...@@ -133,7 +128,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
dev_err(dev, "error commanding HC to reset: %d\n", result); dev_err(dev, "error commanding HC to reset: %d\n", result);
goto error_unlock; goto error_unlock;
} }
d_printf(3, dev, "reset: waiting for device to change state\n");
result = __wa_wait_status(&hwahc->wa, WA_STATUS_RESETTING, 0); result = __wa_wait_status(&hwahc->wa, WA_STATUS_RESETTING, 0);
if (result < 0) { if (result < 0) {
dev_err(dev, "error waiting for HC to reset: %d\n", result); dev_err(dev, "error waiting for HC to reset: %d\n", result);
...@@ -141,7 +135,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd) ...@@ -141,7 +135,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
} }
error_unlock: error_unlock:
mutex_unlock(&wusbhc->mutex); mutex_unlock(&wusbhc->mutex);
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
return result; return result;
} }
...@@ -154,15 +147,9 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd) ...@@ -154,15 +147,9 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
int result; int result;
struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc); struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
struct device *dev = &hwahc->wa.usb_iface->dev;
/* Set up a Host Info WUSB Information Element */
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
result = -ENOSPC; result = -ENOSPC;
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
/* Start the numbering from the top so that the bottom
* range of the unauth addr space is used for devices,
* the top for HCs; use 0xfe - RC# */
addr = wusb_cluster_id_get(); addr = wusb_cluster_id_get();
if (addr == 0) if (addr == 0)
goto error_cluster_id_get; goto error_cluster_id_get;
...@@ -176,7 +163,6 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd) ...@@ -176,7 +163,6 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
result = 0; result = 0;
out: out:
mutex_unlock(&wusbhc->mutex); mutex_unlock(&wusbhc->mutex);
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
return result; return result;
error_set_cluster_id: error_set_cluster_id:
...@@ -213,18 +199,11 @@ static int hwahc_op_resume(struct usb_hcd *usb_hcd) ...@@ -213,18 +199,11 @@ static int hwahc_op_resume(struct usb_hcd *usb_hcd)
*/ */
static void hwahc_op_stop(struct usb_hcd *usb_hcd) static void hwahc_op_stop(struct usb_hcd *usb_hcd)
{ {
int result;
struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
struct wahc *wa = &hwahc->wa;
struct device *dev = &wa->usb_iface->dev;
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
wusb_cluster_id_put(wusbhc->cluster_id); wusb_cluster_id_put(wusbhc->cluster_id);
mutex_unlock(&wusbhc->mutex); mutex_unlock(&wusbhc->mutex);
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
return;
} }
static int hwahc_op_get_frame_number(struct usb_hcd *usb_hcd) static int hwahc_op_get_frame_number(struct usb_hcd *usb_hcd)
...@@ -573,11 +552,11 @@ static int wa_fill_descr(struct wahc *wa) ...@@ -573,11 +552,11 @@ static int wa_fill_descr(struct wahc *wa)
itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength); itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);
while (itr_size >= sizeof(*hdr)) { while (itr_size >= sizeof(*hdr)) {
hdr = (struct usb_descriptor_header *) itr; hdr = (struct usb_descriptor_header *) itr;
d_printf(3, dev, "Extra device descriptor: " dev_dbg(dev, "Extra device descriptor: "
"type %02x/%u bytes @ %zu (%zu left)\n", "type %02x/%u bytes @ %zu (%zu left)\n",
hdr->bDescriptorType, hdr->bLength, hdr->bDescriptorType, hdr->bLength,
(itr - usb_dev->rawdescriptors[actconfig_idx]), (itr - usb_dev->rawdescriptors[actconfig_idx]),
itr_size); itr_size);
if (hdr->bDescriptorType == USB_DT_WIRE_ADAPTER) if (hdr->bDescriptorType == USB_DT_WIRE_ADAPTER)
goto found; goto found;
itr += hdr->bLength; itr += hdr->bLength;
...@@ -786,7 +765,6 @@ static void hwahc_destroy(struct hwahc *hwahc) ...@@ -786,7 +765,6 @@ static void hwahc_destroy(struct hwahc *hwahc)
{ {
struct wusbhc *wusbhc = &hwahc->wusbhc; struct wusbhc *wusbhc = &hwahc->wusbhc;
d_fnstart(1, NULL, "(hwahc %p)\n", hwahc);
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
__wa_destroy(&hwahc->wa); __wa_destroy(&hwahc->wa);
wusbhc_destroy(&hwahc->wusbhc); wusbhc_destroy(&hwahc->wusbhc);
...@@ -796,7 +774,6 @@ static void hwahc_destroy(struct hwahc *hwahc) ...@@ -796,7 +774,6 @@ static void hwahc_destroy(struct hwahc *hwahc)
usb_put_intf(hwahc->wa.usb_iface); usb_put_intf(hwahc->wa.usb_iface);
usb_put_dev(hwahc->wa.usb_dev); usb_put_dev(hwahc->wa.usb_dev);
mutex_unlock(&wusbhc->mutex); mutex_unlock(&wusbhc->mutex);
d_fnend(1, NULL, "(hwahc %p) = void\n", hwahc);
} }
static void hwahc_init(struct hwahc *hwahc) static void hwahc_init(struct hwahc *hwahc)
...@@ -813,7 +790,6 @@ static int hwahc_probe(struct usb_interface *usb_iface, ...@@ -813,7 +790,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
struct hwahc *hwahc; struct hwahc *hwahc;
struct device *dev = &usb_iface->dev; struct device *dev = &usb_iface->dev;
d_fnstart(4, dev, "(%p, %p)\n", usb_iface, id);
result = -ENOMEM; result = -ENOMEM;
usb_hcd = usb_create_hcd(&hwahc_hc_driver, &usb_iface->dev, "wusb-hwa"); usb_hcd = usb_create_hcd(&hwahc_hc_driver, &usb_iface->dev, "wusb-hwa");
if (usb_hcd == NULL) { if (usb_hcd == NULL) {
...@@ -840,7 +816,6 @@ static int hwahc_probe(struct usb_interface *usb_iface, ...@@ -840,7 +816,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
dev_err(dev, "Cannot setup phase B of WUSBHC: %d\n", result); dev_err(dev, "Cannot setup phase B of WUSBHC: %d\n", result);
goto error_wusbhc_b_create; goto error_wusbhc_b_create;
} }
d_fnend(4, dev, "(%p, %p) = 0\n", usb_iface, id);
return 0; return 0;
error_wusbhc_b_create: error_wusbhc_b_create:
...@@ -850,7 +825,6 @@ static int hwahc_probe(struct usb_interface *usb_iface, ...@@ -850,7 +825,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
error_hwahc_create: error_hwahc_create:
usb_put_hcd(usb_hcd); usb_put_hcd(usb_hcd);
error_alloc: error_alloc:
d_fnend(4, dev, "(%p, %p) = %d\n", usb_iface, id, result);
return result; return result;
} }
...@@ -864,16 +838,12 @@ static void hwahc_disconnect(struct usb_interface *usb_iface) ...@@ -864,16 +838,12 @@ static void hwahc_disconnect(struct usb_interface *usb_iface)
wusbhc = usb_hcd_to_wusbhc(usb_hcd); wusbhc = usb_hcd_to_wusbhc(usb_hcd);
hwahc = container_of(wusbhc, struct hwahc, wusbhc); hwahc = container_of(wusbhc, struct hwahc, wusbhc);
d_fnstart(1, NULL, "(hwahc %p [usb_iface %p])\n", hwahc, usb_iface);
wusbhc_b_destroy(&hwahc->wusbhc); wusbhc_b_destroy(&hwahc->wusbhc);
usb_remove_hcd(usb_hcd); usb_remove_hcd(usb_hcd);
hwahc_destroy(hwahc); hwahc_destroy(hwahc);
usb_put_hcd(usb_hcd); usb_put_hcd(usb_hcd);
d_fnend(1, NULL, "(hwahc %p [usb_iface %p]) = void\n", hwahc,
usb_iface);
} }
/** USB device ID's that we handle */
static struct usb_device_id hwahc_id_table[] = { static struct usb_device_id hwahc_id_table[] = {
/* FIXME: use class labels for this */ /* FIXME: use class labels for this */
{ USB_INTERFACE_INFO(0xe0, 0x02, 0x01), }, { USB_INTERFACE_INFO(0xe0, 0x02, 0x01), },
...@@ -890,18 +860,7 @@ static struct usb_driver hwahc_driver = { ...@@ -890,18 +860,7 @@ static struct usb_driver hwahc_driver = {
static int __init hwahc_driver_init(void) static int __init hwahc_driver_init(void)
{ {
int result; return usb_register(&hwahc_driver);
result = usb_register(&hwahc_driver);
if (result < 0) {
printk(KERN_ERR "WA-CDS: Cannot register USB driver: %d\n",
result);
goto error_usb_register;
}
return 0;
error_usb_register:
return result;
} }
module_init(hwahc_driver_init); module_init(hwahc_driver_init);
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#include <linux/uwb.h> #include <linux/uwb.h>
#include <linux/usb/wusb.h> #include <linux/usb/wusb.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#define D_LOCAL 0
#include <linux/uwb/debug.h> #include <linux/uwb/debug.h>
static int debug_crypto_verify = 0; static int debug_crypto_verify = 0;
...@@ -207,9 +206,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc, ...@@ -207,9 +206,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
const u8 bzero[16] = { 0 }; const u8 bzero[16] = { 0 };
size_t zero_padding; size_t zero_padding;
d_fnstart(3, NULL, "(tfm_cbc %p, tfm_aes %p, mic %p, "
"n %p, a %p, b %p, blen %zu)\n",
tfm_cbc, tfm_aes, mic, n, a, b, blen);
/* /*
* These checks should be compile time optimized out * These checks should be compile time optimized out
* ensure @a fills b1's mac_header and following fields * ensure @a fills b1's mac_header and following fields
...@@ -251,16 +247,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc, ...@@ -251,16 +247,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
b1.la = cpu_to_be16(blen + 14); b1.la = cpu_to_be16(blen + 14);
memcpy(&b1.mac_header, a, sizeof(*a)); memcpy(&b1.mac_header, a, sizeof(*a));
d_printf(4, NULL, "I: B0 (%zu bytes)\n", sizeof(b0));
d_dump(4, NULL, &b0, sizeof(b0));
d_printf(4, NULL, "I: B1 (%zu bytes)\n", sizeof(b1));
d_dump(4, NULL, &b1, sizeof(b1));
d_printf(4, NULL, "I: B (%zu bytes)\n", blen);
d_dump(4, NULL, b, blen);
d_printf(4, NULL, "I: B 0-padding (%zu bytes)\n", zero_padding);
d_printf(4, NULL, "D: IV before crypto (%zu)\n", ivsize);
d_dump(4, NULL, iv, ivsize);
sg_init_table(sg, ARRAY_SIZE(sg)); sg_init_table(sg, ARRAY_SIZE(sg));
sg_set_buf(&sg[0], &b0, sizeof(b0)); sg_set_buf(&sg[0], &b0, sizeof(b0));
sg_set_buf(&sg[1], &b1, sizeof(b1)); sg_set_buf(&sg[1], &b1, sizeof(b1));
...@@ -277,8 +263,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc, ...@@ -277,8 +263,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
result); result);
goto error_cbc_crypt; goto error_cbc_crypt;
} }
d_printf(4, NULL, "D: MIC tag\n");
d_dump(4, NULL, iv, ivsize);
/* Now we crypt the MIC Tag (*iv) with Ax -- values per WUSB1.0[6.5] /* Now we crypt the MIC Tag (*iv) with Ax -- values per WUSB1.0[6.5]
* The procedure is to AES crypt the A0 block and XOR the MIC * The procedure is to AES crypt the A0 block and XOR the MIC
...@@ -293,17 +277,10 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc, ...@@ -293,17 +277,10 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
ax.counter = 0; ax.counter = 0;
crypto_cipher_encrypt_one(tfm_aes, (void *)&ax, (void *)&ax); crypto_cipher_encrypt_one(tfm_aes, (void *)&ax, (void *)&ax);
bytewise_xor(mic, &ax, iv, 8); bytewise_xor(mic, &ax, iv, 8);
d_printf(4, NULL, "D: CTR[MIC]\n");
d_dump(4, NULL, &ax, 8);
d_printf(4, NULL, "D: CCM-MIC tag\n");
d_dump(4, NULL, mic, 8);
result = 8; result = 8;
error_cbc_crypt: error_cbc_crypt:
kfree(dst_buf); kfree(dst_buf);
error_dst_buf: error_dst_buf:
d_fnend(3, NULL, "(tfm_cbc %p, tfm_aes %p, mic %p, "
"n %p, a %p, b %p, blen %zu)\n",
tfm_cbc, tfm_aes, mic, n, a, b, blen);
return result; return result;
} }
...@@ -325,10 +302,6 @@ ssize_t wusb_prf(void *out, size_t out_size, ...@@ -325,10 +302,6 @@ ssize_t wusb_prf(void *out, size_t out_size,
u64 sfn = 0; u64 sfn = 0;
__le64 sfn_le; __le64 sfn_le;
d_fnstart(3, NULL, "(out %p, out_size %zu, key %p, _n %p, "
"a %p, b %p, blen %zu, len %zu)\n", out, out_size,
key, _n, a, b, blen, len);
tfm_cbc = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); tfm_cbc = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm_cbc)) { if (IS_ERR(tfm_cbc)) {
result = PTR_ERR(tfm_cbc); result = PTR_ERR(tfm_cbc);
...@@ -370,9 +343,6 @@ ssize_t wusb_prf(void *out, size_t out_size, ...@@ -370,9 +343,6 @@ ssize_t wusb_prf(void *out, size_t out_size,
error_setkey_cbc: error_setkey_cbc:
crypto_free_blkcipher(tfm_cbc); crypto_free_blkcipher(tfm_cbc);
error_alloc_cbc: error_alloc_cbc:
d_fnend(3, NULL, "(out %p, out_size %zu, key %p, _n %p, "
"a %p, b %p, blen %zu, len %zu) = %d\n", out, out_size,
key, _n, a, b, blen, len, (int)bytes);
return result; return result;
} }
......
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include "wusbhc.h" #include "wusbhc.h"
#undef D_LOCAL
#define D_LOCAL 4
#include <linux/uwb/debug.h>
static ssize_t wusb_disconnect_store(struct device *dev, static ssize_t wusb_disconnect_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
......
...@@ -91,10 +91,6 @@ ...@@ -91,10 +91,6 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include "wusbhc.h" #include "wusbhc.h"
#undef D_LOCAL
#define D_LOCAL 1
#include <linux/uwb/debug.h>
static void wusbhc_devconnect_acked_work(struct work_struct *work); static void wusbhc_devconnect_acked_work(struct work_struct *work);
static void wusb_dev_free(struct wusb_dev *wusb_dev) static void wusb_dev_free(struct wusb_dev *wusb_dev)
...@@ -234,6 +230,7 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc, ...@@ -234,6 +230,7 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list); list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list);
wusbhc->cack_count++; wusbhc->cack_count++;
wusbhc_fill_cack_ie(wusbhc); wusbhc_fill_cack_ie(wusbhc);
return wusb_dev; return wusb_dev;
} }
...@@ -244,12 +241,9 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc, ...@@ -244,12 +241,9 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
*/ */
static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
{ {
struct device *dev = wusbhc->dev;
d_fnstart(3, dev, "(wusbhc %p wusb_dev %p)\n", wusbhc, wusb_dev);
list_del_init(&wusb_dev->cack_node); list_del_init(&wusb_dev->cack_node);
wusbhc->cack_count--; wusbhc->cack_count--;
wusbhc_fill_cack_ie(wusbhc); wusbhc_fill_cack_ie(wusbhc);
d_fnend(3, dev, "(wusbhc %p wusb_dev %p) = void\n", wusbhc, wusb_dev);
} }
/* /*
...@@ -257,14 +251,11 @@ static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) ...@@ -257,14 +251,11 @@ static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
static static
void wusbhc_devconnect_acked(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) void wusbhc_devconnect_acked(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
{ {
struct device *dev = wusbhc->dev;
d_fnstart(3, dev, "(wusbhc %p wusb_dev %p)\n", wusbhc, wusb_dev);
wusbhc_cack_rm(wusbhc, wusb_dev); wusbhc_cack_rm(wusbhc, wusb_dev);
if (wusbhc->cack_count) if (wusbhc->cack_count)
wusbhc_mmcie_set(wusbhc, 0, 0, &wusbhc->cack_ie.hdr); wusbhc_mmcie_set(wusbhc, 0, 0, &wusbhc->cack_ie.hdr);
else else
wusbhc_mmcie_rm(wusbhc, &wusbhc->cack_ie.hdr); wusbhc_mmcie_rm(wusbhc, &wusbhc->cack_ie.hdr);
d_fnend(3, dev, "(wusbhc %p wusb_dev %p) = void\n", wusbhc, wusb_dev);
} }
static void wusbhc_devconnect_acked_work(struct work_struct *work) static void wusbhc_devconnect_acked_work(struct work_struct *work)
...@@ -314,7 +305,6 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc, ...@@ -314,7 +305,6 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
struct wusb_port *port; struct wusb_port *port;
unsigned idx, devnum; unsigned idx, devnum;
d_fnstart(3, dev, "(%p, %p, %s)\n", wusbhc, dnc, pr_cdid);
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
/* Check we are not handling it already */ /* Check we are not handling it already */
...@@ -367,7 +357,6 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc, ...@@ -367,7 +357,6 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
*/ */
error_unlock: error_unlock:
mutex_unlock(&wusbhc->mutex); mutex_unlock(&wusbhc->mutex);
d_fnend(3, dev, "(%p, %p, %s) = void\n", wusbhc, dnc, pr_cdid);
return; return;
} }
...@@ -390,10 +379,8 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc, ...@@ -390,10 +379,8 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc, static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
struct wusb_port *port) struct wusb_port *port)
{ {
struct device *dev = wusbhc->dev;
struct wusb_dev *wusb_dev = port->wusb_dev; struct wusb_dev *wusb_dev = port->wusb_dev;
d_fnstart(3, dev, "(wusbhc %p, port %p)\n", wusbhc, port);
port->status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE port->status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE
| USB_PORT_STAT_SUSPEND | USB_PORT_STAT_RESET | USB_PORT_STAT_SUSPEND | USB_PORT_STAT_RESET
| USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED); | USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
...@@ -410,7 +397,6 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc, ...@@ -410,7 +397,6 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
* section 6.2.11.2). */ * section 6.2.11.2). */
wusbhc_gtk_rekey(wusbhc); wusbhc_gtk_rekey(wusbhc);
d_fnend(3, dev, "(wusbhc %p, port %p) = void\n", wusbhc, port);
/* The Wireless USB part has forgotten about the device already; now /* The Wireless USB part has forgotten about the device already; now
* khubd's timer will pick up the disconnection and remove the USB * khubd's timer will pick up the disconnection and remove the USB
* device from the system * device from the system
...@@ -535,10 +521,6 @@ static struct wusb_dev *wusbhc_find_dev_by_addr(struct wusbhc *wusbhc, u8 addr) ...@@ -535,10 +521,6 @@ static struct wusb_dev *wusbhc_find_dev_by_addr(struct wusbhc *wusbhc, u8 addr)
*/ */
static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
{ {
struct device *dev = wusbhc->dev;
d_printf(2, dev, "DN ALIVE: device 0x%02x pong\n", wusb_dev->addr);
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
wusb_dev->entry_ts = jiffies; wusb_dev->entry_ts = jiffies;
__wusbhc_keep_alive(wusbhc); __wusbhc_keep_alive(wusbhc);
...@@ -571,11 +553,10 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc, ...@@ -571,11 +553,10 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc,
"no-beacon" "no-beacon"
}; };
d_fnstart(3, dev, "(%p, %p, %zu)\n", wusbhc, dn_hdr, size);
if (size < sizeof(*dnc)) { if (size < sizeof(*dnc)) {
dev_err(dev, "DN CONNECT: short notification (%zu < %zu)\n", dev_err(dev, "DN CONNECT: short notification (%zu < %zu)\n",
size, sizeof(*dnc)); size, sizeof(*dnc));
goto out; return;
} }
dnc = container_of(dn_hdr, struct wusb_dn_connect, hdr); dnc = container_of(dn_hdr, struct wusb_dn_connect, hdr);
...@@ -587,10 +568,6 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc, ...@@ -587,10 +568,6 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc,
wusb_dn_connect_new_connection(dnc) ? "connect" : "reconnect"); wusb_dn_connect_new_connection(dnc) ? "connect" : "reconnect");
/* ACK the connect */ /* ACK the connect */
wusbhc_devconnect_ack(wusbhc, dnc, pr_cdid); wusbhc_devconnect_ack(wusbhc, dnc, pr_cdid);
out:
d_fnend(3, dev, "(%p, %p, %zu) = void\n",
wusbhc, dn_hdr, size);
return;
} }
/* /*
...@@ -631,19 +608,17 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr, ...@@ -631,19 +608,17 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr,
struct device *dev = wusbhc->dev; struct device *dev = wusbhc->dev;
struct wusb_dev *wusb_dev; struct wusb_dev *wusb_dev;
d_fnstart(3, dev, "(%p, %p)\n", wusbhc, dn_hdr);
if (size < sizeof(struct wusb_dn_hdr)) { if (size < sizeof(struct wusb_dn_hdr)) {
dev_err(dev, "DN data shorter than DN header (%d < %d)\n", dev_err(dev, "DN data shorter than DN header (%d < %d)\n",
(int)size, (int)sizeof(struct wusb_dn_hdr)); (int)size, (int)sizeof(struct wusb_dn_hdr));
goto out; return;
} }
wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr); wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr);
if (wusb_dev == NULL && dn_hdr->bType != WUSB_DN_CONNECT) { if (wusb_dev == NULL && dn_hdr->bType != WUSB_DN_CONNECT) {
dev_dbg(dev, "ignoring DN %d from unconnected device %02x\n", dev_dbg(dev, "ignoring DN %d from unconnected device %02x\n",
dn_hdr->bType, srcaddr); dn_hdr->bType, srcaddr);
goto out; return;
} }
switch (dn_hdr->bType) { switch (dn_hdr->bType) {
...@@ -668,9 +643,6 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr, ...@@ -668,9 +643,6 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr,
dev_warn(dev, "unknown DN %u (%d octets) from %u\n", dev_warn(dev, "unknown DN %u (%d octets) from %u\n",
dn_hdr->bType, (int)size, srcaddr); dn_hdr->bType, (int)size, srcaddr);
} }
out:
d_fnend(3, dev, "(%p, %p) = void\n", wusbhc, dn_hdr);
return;
} }
EXPORT_SYMBOL_GPL(wusbhc_handle_dn); EXPORT_SYMBOL_GPL(wusbhc_handle_dn);
...@@ -700,59 +672,30 @@ void __wusbhc_dev_disable(struct wusbhc *wusbhc, u8 port_idx) ...@@ -700,59 +672,30 @@ void __wusbhc_dev_disable(struct wusbhc *wusbhc, u8 port_idx)
struct wusb_dev *wusb_dev; struct wusb_dev *wusb_dev;
struct wuie_disconnect *ie; struct wuie_disconnect *ie;
d_fnstart(3, dev, "(%p, %u)\n", wusbhc, port_idx);
result = 0;
wusb_dev = wusb_port_by_idx(wusbhc, port_idx)->wusb_dev; wusb_dev = wusb_port_by_idx(wusbhc, port_idx)->wusb_dev;
if (wusb_dev == NULL) { if (wusb_dev == NULL) {
/* reset no device? ignore */ /* reset no device? ignore */
dev_dbg(dev, "DISCONNECT: no device at port %u, ignoring\n", dev_dbg(dev, "DISCONNECT: no device at port %u, ignoring\n",
port_idx); port_idx);
goto error; return;
} }
__wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc, port_idx)); __wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc, port_idx));
result = -ENOMEM;
ie = kzalloc(sizeof(*ie), GFP_KERNEL); ie = kzalloc(sizeof(*ie), GFP_KERNEL);
if (ie == NULL) if (ie == NULL)
goto error; return;
ie->hdr.bLength = sizeof(*ie); ie->hdr.bLength = sizeof(*ie);
ie->hdr.bIEIdentifier = WUIE_ID_DEVICE_DISCONNECT; ie->hdr.bIEIdentifier = WUIE_ID_DEVICE_DISCONNECT;
ie->bDeviceAddress = wusb_dev->addr; ie->bDeviceAddress = wusb_dev->addr;
result = wusbhc_mmcie_set(wusbhc, 0, 0, &ie->hdr); result = wusbhc_mmcie_set(wusbhc, 0, 0, &ie->hdr);
if (result < 0) { if (result < 0)
dev_err(dev, "DISCONNECT: can't set MMC: %d\n", result); dev_err(dev, "DISCONNECT: can't set MMC: %d\n", result);
goto error_kfree; else {
/* At least 6 MMCs, assuming at least 1 MMC per zone. */
msleep(7*4);
wusbhc_mmcie_rm(wusbhc, &ie->hdr);
} }
/* 120ms, hopefully 6 MMCs */
msleep(100);
wusbhc_mmcie_rm(wusbhc, &ie->hdr);
error_kfree:
kfree(ie); kfree(ie);
error:
d_fnend(3, dev, "(%p, %u) = %d\n", wusbhc, port_idx, result);
return;
}
static void wusb_cap_descr_printf(const unsigned level, struct device *dev,
const struct usb_wireless_cap_descriptor *wcd)
{
d_printf(level, dev,
"WUSB Capability Descriptor\n"
" bDevCapabilityType 0x%02x\n"
" bmAttributes 0x%02x\n"
" wPhyRates 0x%04x\n"
" bmTFITXPowerInfo 0x%02x\n"
" bmFFITXPowerInfo 0x%02x\n"
" bmBandGroup 0x%04x\n"
" bReserved 0x%02x\n",
wcd->bDevCapabilityType,
wcd->bmAttributes,
le16_to_cpu(wcd->wPHYRates),
wcd->bmTFITXPowerInfo,
wcd->bmFFITXPowerInfo,
wcd->bmBandGroup,
wcd->bReserved);
} }
/* /*
...@@ -795,8 +738,6 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev, ...@@ -795,8 +738,6 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
} }
cap_size = cap_hdr->bLength; cap_size = cap_hdr->bLength;
cap_type = cap_hdr->bDevCapabilityType; cap_type = cap_hdr->bDevCapabilityType;
d_printf(4, dev, "BOS Capability: 0x%02x (%zu bytes)\n",
cap_type, cap_size);
if (cap_size == 0) if (cap_size == 0)
break; break;
if (cap_size > top - itr) { if (cap_size > top - itr) {
...@@ -808,7 +749,6 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev, ...@@ -808,7 +749,6 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
result = -EBADF; result = -EBADF;
goto error_bad_cap; goto error_bad_cap;
} }
d_dump(3, dev, itr, cap_size);
switch (cap_type) { switch (cap_type) {
case USB_CAP_TYPE_WIRELESS_USB: case USB_CAP_TYPE_WIRELESS_USB:
if (cap_size != sizeof(*wusb_dev->wusb_cap_descr)) if (cap_size != sizeof(*wusb_dev->wusb_cap_descr))
...@@ -816,10 +756,8 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev, ...@@ -816,10 +756,8 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
"descriptor is %zu bytes vs %zu " "descriptor is %zu bytes vs %zu "
"needed\n", cap_size, "needed\n", cap_size,
sizeof(*wusb_dev->wusb_cap_descr)); sizeof(*wusb_dev->wusb_cap_descr));
else { else
wusb_dev->wusb_cap_descr = itr; wusb_dev->wusb_cap_descr = itr;
wusb_cap_descr_printf(3, dev, itr);
}
break; break;
default: default:
dev_err(dev, "BUG? Unknown BOS capability 0x%02x " dev_err(dev, "BUG? Unknown BOS capability 0x%02x "
...@@ -884,9 +822,7 @@ static int wusb_dev_bos_add(struct usb_device *usb_dev, ...@@ -884,9 +822,7 @@ static int wusb_dev_bos_add(struct usb_device *usb_dev,
"%zu bytes): %zd\n", desc_size, result); "%zu bytes): %zd\n", desc_size, result);
goto error_get_descriptor; goto error_get_descriptor;
} }
d_printf(2, dev, "Got BOS descriptor %zd bytes, %u capabilities\n",
result, bos->bNumDeviceCaps);
d_dump(2, dev, bos, result);
result = wusb_dev_bos_grok(usb_dev, wusb_dev, bos, result); result = wusb_dev_bos_grok(usb_dev, wusb_dev, bos, result);
if (result < 0) if (result < 0)
goto error_bad_bos; goto error_bad_bos;
...@@ -952,8 +888,6 @@ static void wusb_dev_add_ncb(struct usb_device *usb_dev) ...@@ -952,8 +888,6 @@ static void wusb_dev_add_ncb(struct usb_device *usb_dev)
if (usb_dev->wusb == 0 || usb_dev->devnum == 1) if (usb_dev->wusb == 0 || usb_dev->devnum == 1)
return; /* skip non wusb and wusb RHs */ return; /* skip non wusb and wusb RHs */
d_fnstart(3, dev, "(usb_dev %p)\n", usb_dev);
wusbhc = wusbhc_get_by_usb_dev(usb_dev); wusbhc = wusbhc_get_by_usb_dev(usb_dev);
if (wusbhc == NULL) if (wusbhc == NULL)
goto error_nodev; goto error_nodev;
...@@ -983,7 +917,6 @@ static void wusb_dev_add_ncb(struct usb_device *usb_dev) ...@@ -983,7 +917,6 @@ static void wusb_dev_add_ncb(struct usb_device *usb_dev)
wusb_dev_put(wusb_dev); wusb_dev_put(wusb_dev);
wusbhc_put(wusbhc); wusbhc_put(wusbhc);
error_nodev: error_nodev:
d_fnend(3, dev, "(usb_dev %p) = void\n", usb_dev);
return; return;
wusb_dev_sysfs_rm(wusb_dev); wusb_dev_sysfs_rm(wusb_dev);
...@@ -1070,11 +1003,10 @@ EXPORT_SYMBOL_GPL(__wusb_dev_get_by_usb_dev); ...@@ -1070,11 +1003,10 @@ EXPORT_SYMBOL_GPL(__wusb_dev_get_by_usb_dev);
void wusb_dev_destroy(struct kref *_wusb_dev) void wusb_dev_destroy(struct kref *_wusb_dev)
{ {
struct wusb_dev *wusb_dev struct wusb_dev *wusb_dev = container_of(_wusb_dev, struct wusb_dev, refcnt);
= container_of(_wusb_dev, struct wusb_dev, refcnt);
list_del_init(&wusb_dev->cack_node); list_del_init(&wusb_dev->cack_node);
wusb_dev_free(wusb_dev); wusb_dev_free(wusb_dev);
d_fnend(1, NULL, "%s (wusb_dev %p) = void\n", __func__, wusb_dev);
} }
EXPORT_SYMBOL_GPL(wusb_dev_destroy); EXPORT_SYMBOL_GPL(wusb_dev_destroy);
...@@ -1086,8 +1018,6 @@ EXPORT_SYMBOL_GPL(wusb_dev_destroy); ...@@ -1086,8 +1018,6 @@ EXPORT_SYMBOL_GPL(wusb_dev_destroy);
*/ */
int wusbhc_devconnect_create(struct wusbhc *wusbhc) int wusbhc_devconnect_create(struct wusbhc *wusbhc)
{ {
d_fnstart(3, wusbhc->dev, "(wusbhc %p)\n", wusbhc);
wusbhc->keep_alive_ie.hdr.bIEIdentifier = WUIE_ID_KEEP_ALIVE; wusbhc->keep_alive_ie.hdr.bIEIdentifier = WUIE_ID_KEEP_ALIVE;
wusbhc->keep_alive_ie.hdr.bLength = sizeof(wusbhc->keep_alive_ie.hdr); wusbhc->keep_alive_ie.hdr.bLength = sizeof(wusbhc->keep_alive_ie.hdr);
INIT_DELAYED_WORK(&wusbhc->keep_alive_timer, wusbhc_keep_alive_run); INIT_DELAYED_WORK(&wusbhc->keep_alive_timer, wusbhc_keep_alive_run);
...@@ -1096,7 +1026,6 @@ int wusbhc_devconnect_create(struct wusbhc *wusbhc) ...@@ -1096,7 +1026,6 @@ int wusbhc_devconnect_create(struct wusbhc *wusbhc)
wusbhc->cack_ie.hdr.bLength = sizeof(wusbhc->cack_ie.hdr); wusbhc->cack_ie.hdr.bLength = sizeof(wusbhc->cack_ie.hdr);
INIT_LIST_HEAD(&wusbhc->cack_list); INIT_LIST_HEAD(&wusbhc->cack_list);
d_fnend(3, wusbhc->dev, "(wusbhc %p) = void\n", wusbhc);
return 0; return 0;
} }
...@@ -1105,8 +1034,7 @@ int wusbhc_devconnect_create(struct wusbhc *wusbhc) ...@@ -1105,8 +1034,7 @@ int wusbhc_devconnect_create(struct wusbhc *wusbhc)
*/ */
void wusbhc_devconnect_destroy(struct wusbhc *wusbhc) void wusbhc_devconnect_destroy(struct wusbhc *wusbhc)
{ {
d_fnstart(3, wusbhc->dev, "(wusbhc %p)\n", wusbhc); /* no op */
d_fnend(3, wusbhc->dev, "(wusbhc %p) = void\n", wusbhc);
} }
/* /*
......
...@@ -71,9 +71,6 @@ ...@@ -71,9 +71,6 @@
*/ */
#include "wusbhc.h" #include "wusbhc.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
/* /*
* Reset a fake port * Reset a fake port
* *
...@@ -142,7 +139,6 @@ int wusbhc_rh_status_data(struct usb_hcd *usb_hcd, char *_buf) ...@@ -142,7 +139,6 @@ int wusbhc_rh_status_data(struct usb_hcd *usb_hcd, char *_buf)
size_t cnt, size; size_t cnt, size;
unsigned long *buf = (unsigned long *) _buf; unsigned long *buf = (unsigned long *) _buf;
d_fnstart(1, wusbhc->dev, "(wusbhc %p)\n", wusbhc);
/* WE DON'T LOCK, see comment */ /* WE DON'T LOCK, see comment */
size = wusbhc->ports_max + 1 /* hub bit */; size = wusbhc->ports_max + 1 /* hub bit */;
size = (size + 8 - 1) / 8; /* round to bytes */ size = (size + 8 - 1) / 8; /* round to bytes */
...@@ -151,8 +147,6 @@ int wusbhc_rh_status_data(struct usb_hcd *usb_hcd, char *_buf) ...@@ -151,8 +147,6 @@ int wusbhc_rh_status_data(struct usb_hcd *usb_hcd, char *_buf)
set_bit(cnt + 1, buf); set_bit(cnt + 1, buf);
else else
clear_bit(cnt + 1, buf); clear_bit(cnt + 1, buf);
d_fnend(1, wusbhc->dev, "(wusbhc %p) %u, buffer:\n", wusbhc, (int)size);
d_dump(1, wusbhc->dev, _buf, size);
return size; return size;
} }
EXPORT_SYMBOL_GPL(wusbhc_rh_status_data); EXPORT_SYMBOL_GPL(wusbhc_rh_status_data);
...@@ -201,9 +195,7 @@ static int wusbhc_rh_get_hub_descr(struct wusbhc *wusbhc, u16 wValue, ...@@ -201,9 +195,7 @@ static int wusbhc_rh_get_hub_descr(struct wusbhc *wusbhc, u16 wValue,
static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature) static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature)
{ {
int result; int result;
struct device *dev = wusbhc->dev;
d_fnstart(4, dev, "(%p, feature 0x%04u)\n", wusbhc, feature);
switch (feature) { switch (feature) {
case C_HUB_LOCAL_POWER: case C_HUB_LOCAL_POWER:
/* FIXME: maybe plug bit 0 to the power input status, /* FIXME: maybe plug bit 0 to the power input status,
...@@ -215,7 +207,6 @@ static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature) ...@@ -215,7 +207,6 @@ static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature)
default: default:
result = -EPIPE; result = -EPIPE;
} }
d_fnend(4, dev, "(%p, feature 0x%04u), %d\n", wusbhc, feature, result);
return result; return result;
} }
...@@ -242,14 +233,10 @@ static int wusbhc_rh_get_hub_status(struct wusbhc *wusbhc, u32 *buf, ...@@ -242,14 +233,10 @@ static int wusbhc_rh_get_hub_status(struct wusbhc *wusbhc, u32 *buf,
static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature, static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature,
u8 selector, u8 port_idx) u8 selector, u8 port_idx)
{ {
int result = -EINVAL;
struct device *dev = wusbhc->dev; struct device *dev = wusbhc->dev;
d_fnstart(4, dev, "(feat 0x%04u, selector 0x%u, port_idx %d)\n",
feature, selector, port_idx);
if (port_idx > wusbhc->ports_max) if (port_idx > wusbhc->ports_max)
goto error; return -EINVAL;
switch (feature) { switch (feature) {
/* According to USB2.0[11.24.2.13]p2, these features /* According to USB2.0[11.24.2.13]p2, these features
...@@ -259,35 +246,27 @@ static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature, ...@@ -259,35 +246,27 @@ static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature,
case USB_PORT_FEAT_C_SUSPEND: case USB_PORT_FEAT_C_SUSPEND:
case USB_PORT_FEAT_C_CONNECTION: case USB_PORT_FEAT_C_CONNECTION:
case USB_PORT_FEAT_C_RESET: case USB_PORT_FEAT_C_RESET:
result = 0; return 0;
break;
case USB_PORT_FEAT_POWER: case USB_PORT_FEAT_POWER:
/* No such thing, but we fake it works */ /* No such thing, but we fake it works */
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
wusb_port_by_idx(wusbhc, port_idx)->status |= USB_PORT_STAT_POWER; wusb_port_by_idx(wusbhc, port_idx)->status |= USB_PORT_STAT_POWER;
mutex_unlock(&wusbhc->mutex); mutex_unlock(&wusbhc->mutex);
result = 0; return 0;
break;
case USB_PORT_FEAT_RESET: case USB_PORT_FEAT_RESET:
result = wusbhc_rh_port_reset(wusbhc, port_idx); return wusbhc_rh_port_reset(wusbhc, port_idx);
break;
case USB_PORT_FEAT_ENABLE: case USB_PORT_FEAT_ENABLE:
case USB_PORT_FEAT_SUSPEND: case USB_PORT_FEAT_SUSPEND:
dev_err(dev, "(port_idx %d) set feat %d/%d UNIMPLEMENTED\n", dev_err(dev, "(port_idx %d) set feat %d/%d UNIMPLEMENTED\n",
port_idx, feature, selector); port_idx, feature, selector);
result = -ENOSYS; return -ENOSYS;
break;
default: default:
dev_err(dev, "(port_idx %d) set feat %d/%d UNKNOWN\n", dev_err(dev, "(port_idx %d) set feat %d/%d UNKNOWN\n",
port_idx, feature, selector); port_idx, feature, selector);
result = -EPIPE; return -EPIPE;
break;
} }
error:
d_fnend(4, dev, "(feat 0x%04u, selector 0x%u, port_idx %d) = %d\n", return 0;
feature, selector, port_idx, result);
return result;
} }
/* /*
...@@ -298,17 +277,13 @@ static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature, ...@@ -298,17 +277,13 @@ static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature,
static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature, static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
u8 selector, u8 port_idx) u8 selector, u8 port_idx)
{ {
int result = -EINVAL; int result = 0;
struct device *dev = wusbhc->dev; struct device *dev = wusbhc->dev;
d_fnstart(4, dev, "(wusbhc %p feat 0x%04x selector %d port_idx %d)\n",
wusbhc, feature, selector, port_idx);
if (port_idx > wusbhc->ports_max) if (port_idx > wusbhc->ports_max)
goto error; return -EINVAL;
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
result = 0;
switch (feature) { switch (feature) {
case USB_PORT_FEAT_POWER: /* fake port always on */ case USB_PORT_FEAT_POWER: /* fake port always on */
/* According to USB2.0[11.24.2.7.1.4], no need to implement? */ /* According to USB2.0[11.24.2.7.1.4], no need to implement? */
...@@ -328,10 +303,8 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature, ...@@ -328,10 +303,8 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
break; break;
case USB_PORT_FEAT_SUSPEND: case USB_PORT_FEAT_SUSPEND:
case USB_PORT_FEAT_C_SUSPEND: case USB_PORT_FEAT_C_SUSPEND:
case 0xffff: /* ??? FIXME */
dev_err(dev, "(port_idx %d) Clear feat %d/%d UNIMPLEMENTED\n", dev_err(dev, "(port_idx %d) Clear feat %d/%d UNIMPLEMENTED\n",
port_idx, feature, selector); port_idx, feature, selector);
/* dump_stack(); */
result = -ENOSYS; result = -ENOSYS;
break; break;
default: default:
...@@ -341,9 +314,7 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature, ...@@ -341,9 +314,7 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
break; break;
} }
mutex_unlock(&wusbhc->mutex); mutex_unlock(&wusbhc->mutex);
error:
d_fnend(4, dev, "(wusbhc %p feat 0x%04x selector %d port_idx %d) = "
"%d\n", wusbhc, feature, selector, port_idx, result);
return result; return result;
} }
...@@ -355,22 +326,17 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature, ...@@ -355,22 +326,17 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
static int wusbhc_rh_get_port_status(struct wusbhc *wusbhc, u16 port_idx, static int wusbhc_rh_get_port_status(struct wusbhc *wusbhc, u16 port_idx,
u32 *_buf, u16 wLength) u32 *_buf, u16 wLength)
{ {
int result = -EINVAL;
u16 *buf = (u16 *) _buf; u16 *buf = (u16 *) _buf;
d_fnstart(1, wusbhc->dev, "(wusbhc %p port_idx %u wLength %u)\n",
wusbhc, port_idx, wLength);
if (port_idx > wusbhc->ports_max) if (port_idx > wusbhc->ports_max)
goto error; return -EINVAL;
mutex_lock(&wusbhc->mutex); mutex_lock(&wusbhc->mutex);
buf[0] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->status); buf[0] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->status);
buf[1] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->change); buf[1] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->change);
result = 0;
mutex_unlock(&wusbhc->mutex); mutex_unlock(&wusbhc->mutex);
error:
d_fnend(1, wusbhc->dev, "(wusbhc %p) = %d, buffer:\n", wusbhc, result); return 0;
d_dump(1, wusbhc->dev, _buf, wLength);
return result;
} }
/* /*
......
...@@ -27,19 +27,6 @@ ...@@ -27,19 +27,6 @@
#include <linux/random.h> #include <linux/random.h>
#include "wusbhc.h" #include "wusbhc.h"
/*
* DEBUG & SECURITY WARNING!!!!
*
* If you enable this past 1, the debug code will weaken the
* cryptographic safety of the system (on purpose, for debugging).
*
* Weaken means:
* we print secret keys and intermediate values all the way,
*/
#undef D_LOCAL
#define D_LOCAL 2
#include <linux/uwb/debug.h>
static void wusbhc_set_gtk_callback(struct urb *urb); static void wusbhc_set_gtk_callback(struct urb *urb);
static void wusbhc_gtk_rekey_done_work(struct work_struct *work); static void wusbhc_gtk_rekey_done_work(struct work_struct *work);
...@@ -219,7 +206,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc, ...@@ -219,7 +206,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
const void *itr, *top; const void *itr, *top;
char buf[64]; char buf[64];
d_fnstart(3, dev, "(usb_dev %p, wusb_dev %p)\n", usb_dev, wusb_dev);
result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, result = usb_get_descriptor(usb_dev, USB_DT_SECURITY,
0, &secd, sizeof(secd)); 0, &secd, sizeof(secd));
if (result < sizeof(secd)) { if (result < sizeof(secd)) {
...@@ -228,8 +214,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc, ...@@ -228,8 +214,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
goto error_secd; goto error_secd;
} }
secd_size = le16_to_cpu(secd.wTotalLength); secd_size = le16_to_cpu(secd.wTotalLength);
d_printf(5, dev, "got %d bytes of sec descriptor, total is %d\n",
result, secd_size);
secd_buf = kmalloc(secd_size, GFP_KERNEL); secd_buf = kmalloc(secd_size, GFP_KERNEL);
if (secd_buf == NULL) { if (secd_buf == NULL) {
dev_err(dev, "Can't allocate space for security descriptors\n"); dev_err(dev, "Can't allocate space for security descriptors\n");
...@@ -242,7 +226,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc, ...@@ -242,7 +226,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
"not enough data: %d\n", result); "not enough data: %d\n", result);
goto error_secd_all; goto error_secd_all;
} }
d_printf(5, dev, "got %d bytes of sec descriptors\n", result);
bytes = 0; bytes = 0;
itr = secd_buf + sizeof(secd); itr = secd_buf + sizeof(secd);
top = secd_buf + result; top = secd_buf + result;
...@@ -279,14 +262,12 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc, ...@@ -279,14 +262,12 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
goto error_no_ccm1; goto error_no_ccm1;
} }
wusb_dev->ccm1_etd = *ccm1_etd; wusb_dev->ccm1_etd = *ccm1_etd;
dev_info(dev, "supported encryption: %s; using %s (0x%02x/%02x)\n", dev_dbg(dev, "supported encryption: %s; using %s (0x%02x/%02x)\n",
buf, wusb_et_name(ccm1_etd->bEncryptionType), buf, wusb_et_name(ccm1_etd->bEncryptionType),
ccm1_etd->bEncryptionValue, ccm1_etd->bAuthKeyIndex); ccm1_etd->bEncryptionValue, ccm1_etd->bAuthKeyIndex);
result = 0; result = 0;
kfree(secd_buf); kfree(secd_buf);
out: out:
d_fnend(3, dev, "(usb_dev %p, wusb_dev %p) = %d\n",
usb_dev, wusb_dev, result);
return result; return result;
...@@ -303,32 +284,6 @@ void wusb_dev_sec_rm(struct wusb_dev *wusb_dev) ...@@ -303,32 +284,6 @@ void wusb_dev_sec_rm(struct wusb_dev *wusb_dev)
/* Nothing so far */ /* Nothing so far */
} }
static void hs_printk(unsigned level, struct device *dev,
struct usb_handshake *hs)
{
d_printf(level, dev,
" bMessageNumber: %u\n"
" bStatus: %u\n"
" tTKID: %02x %02x %02x\n"
" CDID: %02x %02x %02x %02x %02x %02x %02x %02x\n"
" %02x %02x %02x %02x %02x %02x %02x %02x\n"
" nonce: %02x %02x %02x %02x %02x %02x %02x %02x\n"
" %02x %02x %02x %02x %02x %02x %02x %02x\n"
" MIC: %02x %02x %02x %02x %02x %02x %02x %02x\n",
hs->bMessageNumber, hs->bStatus,
hs->tTKID[2], hs->tTKID[1], hs->tTKID[0],
hs->CDID[0], hs->CDID[1], hs->CDID[2], hs->CDID[3],
hs->CDID[4], hs->CDID[5], hs->CDID[6], hs->CDID[7],
hs->CDID[8], hs->CDID[9], hs->CDID[10], hs->CDID[11],
hs->CDID[12], hs->CDID[13], hs->CDID[14], hs->CDID[15],
hs->nonce[0], hs->nonce[1], hs->nonce[2], hs->nonce[3],
hs->nonce[4], hs->nonce[5], hs->nonce[6], hs->nonce[7],
hs->nonce[8], hs->nonce[9], hs->nonce[10], hs->nonce[11],
hs->nonce[12], hs->nonce[13], hs->nonce[14], hs->nonce[15],
hs->MIC[0], hs->MIC[1], hs->MIC[2], hs->MIC[3],
hs->MIC[4], hs->MIC[5], hs->MIC[6], hs->MIC[7]);
}
/** /**
* Update the address of an unauthenticated WUSB device * Update the address of an unauthenticated WUSB device
* *
...@@ -421,9 +376,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, ...@@ -421,9 +376,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
get_random_bytes(&hs[0].nonce, sizeof(hs[0].nonce)); get_random_bytes(&hs[0].nonce, sizeof(hs[0].nonce));
memset(hs[0].MIC, 0, sizeof(hs[0].MIC)); /* Per WUSB1.0[T7-22] */ memset(hs[0].MIC, 0, sizeof(hs[0].MIC)); /* Per WUSB1.0[T7-22] */
d_printf(1, dev, "I: sending hs1:\n");
hs_printk(2, dev, &hs[0]);
result = usb_control_msg( result = usb_control_msg(
usb_dev, usb_sndctrlpipe(usb_dev, 0), usb_dev, usb_sndctrlpipe(usb_dev, 0),
USB_REQ_SET_HANDSHAKE, USB_REQ_SET_HANDSHAKE,
...@@ -444,8 +396,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, ...@@ -444,8 +396,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
dev_err(dev, "Handshake2: request failed: %d\n", result); dev_err(dev, "Handshake2: request failed: %d\n", result);
goto error_hs2; goto error_hs2;
} }
d_printf(1, dev, "got HS2:\n");
hs_printk(2, dev, &hs[1]);
result = -EINVAL; result = -EINVAL;
if (hs[1].bMessageNumber != 2) { if (hs[1].bMessageNumber != 2) {
...@@ -486,10 +436,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, ...@@ -486,10 +436,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
result); result);
goto error_hs2; goto error_hs2;
} }
d_printf(2, dev, "KCK:\n");
d_dump(2, dev, keydvt_out.kck, sizeof(keydvt_out.kck));
d_printf(2, dev, "PTK:\n");
d_dump(2, dev, keydvt_out.ptk, sizeof(keydvt_out.ptk));
/* Compute MIC and verify it */ /* Compute MIC and verify it */
result = wusb_oob_mic(mic, keydvt_out.kck, &ccm_n, &hs[1]); result = wusb_oob_mic(mic, keydvt_out.kck, &ccm_n, &hs[1]);
...@@ -499,8 +445,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, ...@@ -499,8 +445,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
goto error_hs2; goto error_hs2;
} }
d_printf(2, dev, "MIC:\n");
d_dump(2, dev, mic, sizeof(mic));
if (memcmp(hs[1].MIC, mic, sizeof(hs[1].MIC))) { if (memcmp(hs[1].MIC, mic, sizeof(hs[1].MIC))) {
dev_err(dev, "Handshake2 failed: MIC mismatch\n"); dev_err(dev, "Handshake2 failed: MIC mismatch\n");
goto error_hs2; goto error_hs2;
...@@ -520,9 +464,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, ...@@ -520,9 +464,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
goto error_hs2; goto error_hs2;
} }
d_printf(1, dev, "I: sending hs3:\n");
hs_printk(2, dev, &hs[2]);
result = usb_control_msg( result = usb_control_msg(
usb_dev, usb_sndctrlpipe(usb_dev, 0), usb_dev, usb_sndctrlpipe(usb_dev, 0),
USB_REQ_SET_HANDSHAKE, USB_REQ_SET_HANDSHAKE,
...@@ -533,14 +474,11 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, ...@@ -533,14 +474,11 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
goto error_hs3; goto error_hs3;
} }
d_printf(1, dev, "I: turning on encryption on host for device\n");
d_dump(2, dev, keydvt_out.ptk, sizeof(keydvt_out.ptk));
result = wusbhc->set_ptk(wusbhc, wusb_dev->port_idx, tkid, result = wusbhc->set_ptk(wusbhc, wusb_dev->port_idx, tkid,
keydvt_out.ptk, sizeof(keydvt_out.ptk)); keydvt_out.ptk, sizeof(keydvt_out.ptk));
if (result < 0) if (result < 0)
goto error_wusbhc_set_ptk; goto error_wusbhc_set_ptk;
d_printf(1, dev, "I: setting a GTK\n");
result = wusb_dev_set_gtk(wusbhc, wusb_dev); result = wusb_dev_set_gtk(wusbhc, wusb_dev);
if (result < 0) { if (result < 0) {
dev_err(dev, "Set GTK for device: request failed: %d\n", dev_err(dev, "Set GTK for device: request failed: %d\n",
...@@ -550,13 +488,12 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, ...@@ -550,13 +488,12 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
/* Update the device's address from unauth to auth */ /* Update the device's address from unauth to auth */
if (usb_dev->authenticated == 0) { if (usb_dev->authenticated == 0) {
d_printf(1, dev, "I: updating addres to auth from non-auth\n");
result = wusb_dev_update_address(wusbhc, wusb_dev); result = wusb_dev_update_address(wusbhc, wusb_dev);
if (result < 0) if (result < 0)
goto error_dev_update_address; goto error_dev_update_address;
} }
result = 0; result = 0;
d_printf(1, dev, "I: 4way handshke done, device authenticated\n"); dev_info(dev, "device authenticated\n");
error_dev_update_address: error_dev_update_address:
error_wusbhc_set_gtk: error_wusbhc_set_gtk:
...@@ -569,10 +506,8 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, ...@@ -569,10 +506,8 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
memset(&keydvt_in, 0, sizeof(keydvt_in)); memset(&keydvt_in, 0, sizeof(keydvt_in));
memset(&ccm_n, 0, sizeof(ccm_n)); memset(&ccm_n, 0, sizeof(ccm_n));
memset(mic, 0, sizeof(mic)); memset(mic, 0, sizeof(mic));
if (result < 0) { if (result < 0)
/* error path */
wusb_dev_set_encryption(usb_dev, 0); wusb_dev_set_encryption(usb_dev, 0);
}
error_dev_set_encryption: error_dev_set_encryption:
kfree(hs); kfree(hs);
error_kzalloc: error_kzalloc:
......
...@@ -60,13 +60,10 @@ ...@@ -60,13 +60,10 @@
#include <linux/init.h> #include <linux/init.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include "wusbhc.h" #include "wusbhc.h"
#include "wa-hc.h" #include "wa-hc.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
static int __rpipe_get_descr(struct wahc *wa, static int __rpipe_get_descr(struct wahc *wa,
struct usb_rpipe_descriptor *descr, u16 index) struct usb_rpipe_descriptor *descr, u16 index)
{ {
...@@ -76,7 +73,6 @@ static int __rpipe_get_descr(struct wahc *wa, ...@@ -76,7 +73,6 @@ static int __rpipe_get_descr(struct wahc *wa,
/* Get the RPIPE descriptor -- we cannot use the usb_get_descriptor() /* Get the RPIPE descriptor -- we cannot use the usb_get_descriptor()
* function because the arguments are different. * function because the arguments are different.
*/ */
d_printf(1, dev, "rpipe %u: get descr\n", index);
result = usb_control_msg( result = usb_control_msg(
wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0), wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0),
USB_REQ_GET_DESCRIPTOR, USB_REQ_GET_DESCRIPTOR,
...@@ -115,7 +111,6 @@ static int __rpipe_set_descr(struct wahc *wa, ...@@ -115,7 +111,6 @@ static int __rpipe_set_descr(struct wahc *wa,
/* we cannot use the usb_get_descriptor() function because the /* we cannot use the usb_get_descriptor() function because the
* arguments are different. * arguments are different.
*/ */
d_printf(1, dev, "rpipe %u: set descr\n", index);
result = usb_control_msg( result = usb_control_msg(
wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0), wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0),
USB_REQ_SET_DESCRIPTOR, USB_REQ_SET_DESCRIPTOR,
...@@ -174,13 +169,12 @@ void rpipe_destroy(struct kref *_rpipe) ...@@ -174,13 +169,12 @@ void rpipe_destroy(struct kref *_rpipe)
{ {
struct wa_rpipe *rpipe = container_of(_rpipe, struct wa_rpipe, refcnt); struct wa_rpipe *rpipe = container_of(_rpipe, struct wa_rpipe, refcnt);
u8 index = le16_to_cpu(rpipe->descr.wRPipeIndex); u8 index = le16_to_cpu(rpipe->descr.wRPipeIndex);
d_fnstart(1, NULL, "(rpipe %p %u)\n", rpipe, index);
if (rpipe->ep) if (rpipe->ep)
rpipe->ep->hcpriv = NULL; rpipe->ep->hcpriv = NULL;
rpipe_put_idx(rpipe->wa, index); rpipe_put_idx(rpipe->wa, index);
wa_put(rpipe->wa); wa_put(rpipe->wa);
kfree(rpipe); kfree(rpipe);
d_fnend(1, NULL, "(rpipe %p %u)\n", rpipe, index);
} }
EXPORT_SYMBOL_GPL(rpipe_destroy); EXPORT_SYMBOL_GPL(rpipe_destroy);
...@@ -202,7 +196,6 @@ static int rpipe_get_idle(struct wa_rpipe **prpipe, struct wahc *wa, u8 crs, ...@@ -202,7 +196,6 @@ static int rpipe_get_idle(struct wa_rpipe **prpipe, struct wahc *wa, u8 crs,
struct wa_rpipe *rpipe; struct wa_rpipe *rpipe;
struct device *dev = &wa->usb_iface->dev; struct device *dev = &wa->usb_iface->dev;
d_fnstart(3, dev, "(wa %p crs 0x%02x)\n", wa, crs);
rpipe = kzalloc(sizeof(*rpipe), gfp); rpipe = kzalloc(sizeof(*rpipe), gfp);
if (rpipe == NULL) if (rpipe == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -223,14 +216,12 @@ static int rpipe_get_idle(struct wa_rpipe **prpipe, struct wahc *wa, u8 crs, ...@@ -223,14 +216,12 @@ static int rpipe_get_idle(struct wa_rpipe **prpipe, struct wahc *wa, u8 crs,
} }
*prpipe = NULL; *prpipe = NULL;
kfree(rpipe); kfree(rpipe);
d_fnend(3, dev, "(wa %p crs 0x%02x) = -ENXIO\n", wa, crs);
return -ENXIO; return -ENXIO;
found: found:
set_bit(rpipe_idx, wa->rpipe_bm); set_bit(rpipe_idx, wa->rpipe_bm);
rpipe->wa = wa_get(wa); rpipe->wa = wa_get(wa);
*prpipe = rpipe; *prpipe = rpipe;
d_fnstart(3, dev, "(wa %p crs 0x%02x) = 0\n", wa, crs);
return 0; return 0;
} }
...@@ -239,7 +230,6 @@ static int __rpipe_reset(struct wahc *wa, unsigned index) ...@@ -239,7 +230,6 @@ static int __rpipe_reset(struct wahc *wa, unsigned index)
int result; int result;
struct device *dev = &wa->usb_iface->dev; struct device *dev = &wa->usb_iface->dev;
d_printf(1, dev, "rpipe %u: reset\n", index);
result = usb_control_msg( result = usb_control_msg(
wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0), wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0),
USB_REQ_RPIPE_RESET, USB_REQ_RPIPE_RESET,
...@@ -276,7 +266,6 @@ static struct usb_wireless_ep_comp_descriptor *rpipe_epc_find( ...@@ -276,7 +266,6 @@ static struct usb_wireless_ep_comp_descriptor *rpipe_epc_find(
struct usb_descriptor_header *hdr; struct usb_descriptor_header *hdr;
struct usb_wireless_ep_comp_descriptor *epcd; struct usb_wireless_ep_comp_descriptor *epcd;
d_fnstart(3, dev, "(ep %p)\n", ep);
if (ep->desc.bEndpointAddress == 0) { if (ep->desc.bEndpointAddress == 0) {
epcd = &epc0; epcd = &epc0;
goto out; goto out;
...@@ -310,7 +299,6 @@ static struct usb_wireless_ep_comp_descriptor *rpipe_epc_find( ...@@ -310,7 +299,6 @@ static struct usb_wireless_ep_comp_descriptor *rpipe_epc_find(
itr_size -= hdr->bDescriptorType; itr_size -= hdr->bDescriptorType;
} }
out: out:
d_fnend(3, dev, "(ep %p) = %p\n", ep, epcd);
return epcd; return epcd;
} }
...@@ -329,8 +317,6 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa, ...@@ -329,8 +317,6 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa,
struct usb_wireless_ep_comp_descriptor *epcd; struct usb_wireless_ep_comp_descriptor *epcd;
u8 unauth; u8 unauth;
d_fnstart(3, dev, "(rpipe %p wa %p ep %p, urb %p)\n",
rpipe, wa, ep, urb);
epcd = rpipe_epc_find(dev, ep); epcd = rpipe_epc_find(dev, ep);
if (epcd == NULL) { if (epcd == NULL) {
dev_err(dev, "ep 0x%02x: can't find companion descriptor\n", dev_err(dev, "ep 0x%02x: can't find companion descriptor\n",
...@@ -350,10 +336,12 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa, ...@@ -350,10 +336,12 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa,
/* FIXME: use maximum speed as supported or recommended by device */ /* FIXME: use maximum speed as supported or recommended by device */
rpipe->descr.bSpeed = usb_pipeendpoint(urb->pipe) == 0 ? rpipe->descr.bSpeed = usb_pipeendpoint(urb->pipe) == 0 ?
UWB_PHY_RATE_53 : UWB_PHY_RATE_200; UWB_PHY_RATE_53 : UWB_PHY_RATE_200;
d_printf(2, dev, "addr %u (0x%02x) rpipe #%u ep# %u speed %d\n",
urb->dev->devnum, urb->dev->devnum | unauth, dev_dbg(dev, "addr %u (0x%02x) rpipe #%u ep# %u speed %d\n",
le16_to_cpu(rpipe->descr.wRPipeIndex), urb->dev->devnum, urb->dev->devnum | unauth,
usb_pipeendpoint(urb->pipe), rpipe->descr.bSpeed); le16_to_cpu(rpipe->descr.wRPipeIndex),
usb_pipeendpoint(urb->pipe), rpipe->descr.bSpeed);
/* see security.c:wusb_update_address() */ /* see security.c:wusb_update_address() */
if (unlikely(urb->dev->devnum == 0x80)) if (unlikely(urb->dev->devnum == 0x80))
rpipe->descr.bDeviceAddress = 0; rpipe->descr.bDeviceAddress = 0;
...@@ -384,8 +372,6 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa, ...@@ -384,8 +372,6 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa,
} }
result = 0; result = 0;
error: error:
d_fnend(3, dev, "(rpipe %p wa %p ep %p urb %p) = %d\n",
rpipe, wa, ep, urb, result);
return result; return result;
} }
...@@ -405,8 +391,6 @@ static int rpipe_check_aim(const struct wa_rpipe *rpipe, const struct wahc *wa, ...@@ -405,8 +391,6 @@ static int rpipe_check_aim(const struct wa_rpipe *rpipe, const struct wahc *wa,
u8 unauth = (usb_dev->wusb && !usb_dev->authenticated) ? 0x80 : 0; u8 unauth = (usb_dev->wusb && !usb_dev->authenticated) ? 0x80 : 0;
u8 portnum = wusb_port_no_to_idx(urb->dev->portnum); u8 portnum = wusb_port_no_to_idx(urb->dev->portnum);
d_fnstart(3, dev, "(rpipe %p wa %p ep %p, urb %p)\n",
rpipe, wa, ep, urb);
#define AIM_CHECK(rdf, val, text) \ #define AIM_CHECK(rdf, val, text) \
do { \ do { \
if (rpipe->descr.rdf != (val)) { \ if (rpipe->descr.rdf != (val)) { \
...@@ -451,8 +435,6 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep, ...@@ -451,8 +435,6 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep,
struct wa_rpipe *rpipe; struct wa_rpipe *rpipe;
u8 eptype; u8 eptype;
d_fnstart(3, dev, "(wa %p ep %p urb %p gfp 0x%08x)\n", wa, ep, urb,
gfp);
mutex_lock(&wa->rpipe_mutex); mutex_lock(&wa->rpipe_mutex);
rpipe = ep->hcpriv; rpipe = ep->hcpriv;
if (rpipe != NULL) { if (rpipe != NULL) {
...@@ -462,9 +444,9 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep, ...@@ -462,9 +444,9 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep,
goto error; goto error;
} }
__rpipe_get(rpipe); __rpipe_get(rpipe);
d_printf(2, dev, "ep 0x%02x: reusing rpipe %u\n", dev_dbg(dev, "ep 0x%02x: reusing rpipe %u\n",
ep->desc.bEndpointAddress, ep->desc.bEndpointAddress,
le16_to_cpu(rpipe->descr.wRPipeIndex)); le16_to_cpu(rpipe->descr.wRPipeIndex));
} else { } else {
/* hmm, assign idle rpipe, aim it */ /* hmm, assign idle rpipe, aim it */
result = -ENOBUFS; result = -ENOBUFS;
...@@ -480,14 +462,12 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep, ...@@ -480,14 +462,12 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep,
ep->hcpriv = rpipe; ep->hcpriv = rpipe;
rpipe->ep = ep; rpipe->ep = ep;
__rpipe_get(rpipe); /* for caching into ep->hcpriv */ __rpipe_get(rpipe); /* for caching into ep->hcpriv */
d_printf(2, dev, "ep 0x%02x: using rpipe %u\n", dev_dbg(dev, "ep 0x%02x: using rpipe %u\n",
ep->desc.bEndpointAddress, ep->desc.bEndpointAddress,
le16_to_cpu(rpipe->descr.wRPipeIndex)); le16_to_cpu(rpipe->descr.wRPipeIndex));
} }
d_dump(4, dev, &rpipe->descr, sizeof(rpipe->descr));
error: error:
mutex_unlock(&wa->rpipe_mutex); mutex_unlock(&wa->rpipe_mutex);
d_fnend(3, dev, "(wa %p ep %p urb %p gfp 0x%08x)\n", wa, ep, urb, gfp);
return result; return result;
} }
...@@ -507,7 +487,7 @@ int wa_rpipes_create(struct wahc *wa) ...@@ -507,7 +487,7 @@ int wa_rpipes_create(struct wahc *wa)
void wa_rpipes_destroy(struct wahc *wa) void wa_rpipes_destroy(struct wahc *wa)
{ {
struct device *dev = &wa->usb_iface->dev; struct device *dev = &wa->usb_iface->dev;
d_fnstart(3, dev, "(wa %p)\n", wa);
if (!bitmap_empty(wa->rpipe_bm, wa->rpipes)) { if (!bitmap_empty(wa->rpipe_bm, wa->rpipes)) {
char buf[256]; char buf[256];
WARN_ON(1); WARN_ON(1);
...@@ -515,7 +495,6 @@ void wa_rpipes_destroy(struct wahc *wa) ...@@ -515,7 +495,6 @@ void wa_rpipes_destroy(struct wahc *wa)
dev_err(dev, "BUG: pipes not released on exit: %s\n", buf); dev_err(dev, "BUG: pipes not released on exit: %s\n", buf);
} }
kfree(wa->rpipe_bm); kfree(wa->rpipe_bm);
d_fnend(3, dev, "(wa %p)\n", wa);
} }
/* /*
...@@ -530,33 +509,20 @@ void wa_rpipes_destroy(struct wahc *wa) ...@@ -530,33 +509,20 @@ void wa_rpipes_destroy(struct wahc *wa)
*/ */
void rpipe_ep_disable(struct wahc *wa, struct usb_host_endpoint *ep) void rpipe_ep_disable(struct wahc *wa, struct usb_host_endpoint *ep)
{ {
struct device *dev = &wa->usb_iface->dev;
struct wa_rpipe *rpipe; struct wa_rpipe *rpipe;
d_fnstart(2, dev, "(wa %p ep %p)\n", wa, ep);
mutex_lock(&wa->rpipe_mutex); mutex_lock(&wa->rpipe_mutex);
rpipe = ep->hcpriv; rpipe = ep->hcpriv;
if (rpipe != NULL) { if (rpipe != NULL) {
unsigned rc = atomic_read(&rpipe->refcnt.refcount);
int result;
u16 index = le16_to_cpu(rpipe->descr.wRPipeIndex); u16 index = le16_to_cpu(rpipe->descr.wRPipeIndex);
if (rc != 1) usb_control_msg(
d_printf(1, dev, "(wa %p ep %p) rpipe %p refcnt %u\n",
wa, ep, rpipe, rc);
d_printf(1, dev, "rpipe %u: abort\n", index);
result = usb_control_msg(
wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0), wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0),
USB_REQ_RPIPE_ABORT, USB_REQ_RPIPE_ABORT,
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_RPIPE, USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_RPIPE,
0, index, NULL, 0, 1000 /* FIXME: arbitrary */); 0, index, NULL, 0, 1000 /* FIXME: arbitrary */);
if (result < 0 && result != -ENODEV /* dev is gone */)
d_printf(1, dev, "(wa %p rpipe %u): abort failed: %d\n",
wa, index, result);
rpipe_put(rpipe); rpipe_put(rpipe);
} }
mutex_unlock(&wa->rpipe_mutex); mutex_unlock(&wa->rpipe_mutex);
d_fnend(2, dev, "(wa %p ep %p)\n", wa, ep);
return;
} }
EXPORT_SYMBOL_GPL(rpipe_ep_disable); EXPORT_SYMBOL_GPL(rpipe_ep_disable);
...@@ -82,13 +82,10 @@ ...@@ -82,13 +82,10 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/hash.h> #include <linux/hash.h>
#include "wa-hc.h" #include "wa-hc.h"
#include "wusbhc.h" #include "wusbhc.h"
#undef D_LOCAL
#define D_LOCAL 0 /* 0 disabled, > 0 different levels... */
#include <linux/uwb/debug.h>
enum { enum {
WA_SEGS_MAX = 255, WA_SEGS_MAX = 255,
}; };
...@@ -180,7 +177,6 @@ static void wa_xfer_destroy(struct kref *_xfer) ...@@ -180,7 +177,6 @@ static void wa_xfer_destroy(struct kref *_xfer)
} }
} }
kfree(xfer); kfree(xfer);
d_printf(2, NULL, "xfer %p destroyed\n", xfer);
} }
static void wa_xfer_get(struct wa_xfer *xfer) static void wa_xfer_get(struct wa_xfer *xfer)
...@@ -190,10 +186,7 @@ static void wa_xfer_get(struct wa_xfer *xfer) ...@@ -190,10 +186,7 @@ static void wa_xfer_get(struct wa_xfer *xfer)
static void wa_xfer_put(struct wa_xfer *xfer) static void wa_xfer_put(struct wa_xfer *xfer)
{ {
d_fnstart(3, NULL, "(xfer %p) -- ref count bef put %d\n",
xfer, atomic_read(&xfer->refcnt.refcount));
kref_put(&xfer->refcnt, wa_xfer_destroy); kref_put(&xfer->refcnt, wa_xfer_destroy);
d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
} }
/* /*
...@@ -209,7 +202,7 @@ static void wa_xfer_put(struct wa_xfer *xfer) ...@@ -209,7 +202,7 @@ static void wa_xfer_put(struct wa_xfer *xfer)
static void wa_xfer_giveback(struct wa_xfer *xfer) static void wa_xfer_giveback(struct wa_xfer *xfer)
{ {
unsigned long flags; unsigned long flags;
d_fnstart(3, NULL, "(xfer %p)\n", xfer);
spin_lock_irqsave(&xfer->wa->xfer_list_lock, flags); spin_lock_irqsave(&xfer->wa->xfer_list_lock, flags);
list_del_init(&xfer->list_node); list_del_init(&xfer->list_node);
spin_unlock_irqrestore(&xfer->wa->xfer_list_lock, flags); spin_unlock_irqrestore(&xfer->wa->xfer_list_lock, flags);
...@@ -217,7 +210,6 @@ static void wa_xfer_giveback(struct wa_xfer *xfer) ...@@ -217,7 +210,6 @@ static void wa_xfer_giveback(struct wa_xfer *xfer)
wusbhc_giveback_urb(xfer->wa->wusb, xfer->urb, xfer->result); wusbhc_giveback_urb(xfer->wa->wusb, xfer->urb, xfer->result);
wa_put(xfer->wa); wa_put(xfer->wa);
wa_xfer_put(xfer); wa_xfer_put(xfer);
d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
} }
/* /*
...@@ -227,13 +219,10 @@ static void wa_xfer_giveback(struct wa_xfer *xfer) ...@@ -227,13 +219,10 @@ static void wa_xfer_giveback(struct wa_xfer *xfer)
*/ */
static void wa_xfer_completion(struct wa_xfer *xfer) static void wa_xfer_completion(struct wa_xfer *xfer)
{ {
d_fnstart(3, NULL, "(xfer %p)\n", xfer);
if (xfer->wusb_dev) if (xfer->wusb_dev)
wusb_dev_put(xfer->wusb_dev); wusb_dev_put(xfer->wusb_dev);
rpipe_put(xfer->ep->hcpriv); rpipe_put(xfer->ep->hcpriv);
wa_xfer_giveback(xfer); wa_xfer_giveback(xfer);
d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
return;
} }
/* /*
...@@ -243,12 +232,12 @@ static void wa_xfer_completion(struct wa_xfer *xfer) ...@@ -243,12 +232,12 @@ static void wa_xfer_completion(struct wa_xfer *xfer)
*/ */
static unsigned __wa_xfer_is_done(struct wa_xfer *xfer) static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
{ {
struct device *dev = &xfer->wa->usb_iface->dev;
unsigned result, cnt; unsigned result, cnt;
struct wa_seg *seg; struct wa_seg *seg;
struct urb *urb = xfer->urb; struct urb *urb = xfer->urb;
unsigned found_short = 0; unsigned found_short = 0;
d_fnstart(3, NULL, "(xfer %p)\n", xfer);
result = xfer->segs_done == xfer->segs_submitted; result = xfer->segs_done == xfer->segs_submitted;
if (result == 0) if (result == 0)
goto out; goto out;
...@@ -258,10 +247,8 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer) ...@@ -258,10 +247,8 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
switch (seg->status) { switch (seg->status) {
case WA_SEG_DONE: case WA_SEG_DONE:
if (found_short && seg->result > 0) { if (found_short && seg->result > 0) {
if (printk_ratelimit()) dev_dbg(dev, "xfer %p#%u: bad short segments (%zu)\n",
printk(KERN_ERR "xfer %p#%u: bad short " xfer, cnt, seg->result);
"segments (%zu)\n", xfer, cnt,
seg->result);
urb->status = -EINVAL; urb->status = -EINVAL;
goto out; goto out;
} }
...@@ -269,36 +256,30 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer) ...@@ -269,36 +256,30 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
if (seg->result < xfer->seg_size if (seg->result < xfer->seg_size
&& cnt != xfer->segs-1) && cnt != xfer->segs-1)
found_short = 1; found_short = 1;
d_printf(2, NULL, "xfer %p#%u: DONE short %d " dev_dbg(dev, "xfer %p#%u: DONE short %d "
"result %zu urb->actual_length %d\n", "result %zu urb->actual_length %d\n",
xfer, seg->index, found_short, seg->result, xfer, seg->index, found_short, seg->result,
urb->actual_length); urb->actual_length);
break; break;
case WA_SEG_ERROR: case WA_SEG_ERROR:
xfer->result = seg->result; xfer->result = seg->result;
d_printf(2, NULL, "xfer %p#%u: ERROR result %zu\n", dev_dbg(dev, "xfer %p#%u: ERROR result %zu\n",
xfer, seg->index, seg->result); xfer, seg->index, seg->result);
goto out; goto out;
case WA_SEG_ABORTED: case WA_SEG_ABORTED:
WARN_ON(urb->status != -ECONNRESET dev_dbg(dev, "xfer %p#%u ABORTED: result %d\n",
&& urb->status != -ENOENT); xfer, seg->index, urb->status);
d_printf(2, NULL, "xfer %p#%u ABORTED: result %d\n",
xfer, seg->index, urb->status);
xfer->result = urb->status; xfer->result = urb->status;
goto out; goto out;
default: default:
/* if (printk_ratelimit()) */ dev_warn(dev, "xfer %p#%u: is_done bad state %d\n",
printk(KERN_ERR "xfer %p#%u: " xfer, cnt, seg->status);
"is_done bad state %d\n",
xfer, cnt, seg->status);
xfer->result = -EINVAL; xfer->result = -EINVAL;
WARN_ON(1);
goto out; goto out;
} }
} }
xfer->result = 0; xfer->result = 0;
out: out:
d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
return result; return result;
} }
...@@ -424,8 +405,6 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer, ...@@ -424,8 +405,6 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
struct urb *urb = xfer->urb; struct urb *urb = xfer->urb;
struct wa_rpipe *rpipe = xfer->ep->hcpriv; struct wa_rpipe *rpipe = xfer->ep->hcpriv;
d_fnstart(3, dev, "(xfer %p [rpipe %p] urb %p)\n",
xfer, rpipe, urb);
switch (rpipe->descr.bmAttribute & 0x3) { switch (rpipe->descr.bmAttribute & 0x3) {
case USB_ENDPOINT_XFER_CONTROL: case USB_ENDPOINT_XFER_CONTROL:
*pxfer_type = WA_XFER_TYPE_CTL; *pxfer_type = WA_XFER_TYPE_CTL;
...@@ -472,12 +451,10 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer, ...@@ -472,12 +451,10 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
if (xfer->segs == 0 && *pxfer_type == WA_XFER_TYPE_CTL) if (xfer->segs == 0 && *pxfer_type == WA_XFER_TYPE_CTL)
xfer->segs = 1; xfer->segs = 1;
error: error:
d_fnend(3, dev, "(xfer %p [rpipe %p] urb %p) = %d\n",
xfer, rpipe, urb, (int)result);
return result; return result;
} }
/** Fill in the common request header and xfer-type specific data. */ /* Fill in the common request header and xfer-type specific data. */
static void __wa_xfer_setup_hdr0(struct wa_xfer *xfer, static void __wa_xfer_setup_hdr0(struct wa_xfer *xfer,
struct wa_xfer_hdr *xfer_hdr0, struct wa_xfer_hdr *xfer_hdr0,
enum wa_xfer_type xfer_type, enum wa_xfer_type xfer_type,
...@@ -534,14 +511,13 @@ static void wa_seg_dto_cb(struct urb *urb) ...@@ -534,14 +511,13 @@ static void wa_seg_dto_cb(struct urb *urb)
unsigned rpipe_ready = 0; unsigned rpipe_ready = 0;
u8 done = 0; u8 done = 0;
d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
switch (urb->status) { switch (urb->status) {
case 0: case 0:
spin_lock_irqsave(&xfer->lock, flags); spin_lock_irqsave(&xfer->lock, flags);
wa = xfer->wa; wa = xfer->wa;
dev = &wa->usb_iface->dev; dev = &wa->usb_iface->dev;
d_printf(2, dev, "xfer %p#%u: data out done (%d bytes)\n", dev_dbg(dev, "xfer %p#%u: data out done (%d bytes)\n",
xfer, seg->index, urb->actual_length); xfer, seg->index, urb->actual_length);
if (seg->status < WA_SEG_PENDING) if (seg->status < WA_SEG_PENDING)
seg->status = WA_SEG_PENDING; seg->status = WA_SEG_PENDING;
seg->result = urb->actual_length; seg->result = urb->actual_length;
...@@ -555,9 +531,8 @@ static void wa_seg_dto_cb(struct urb *urb) ...@@ -555,9 +531,8 @@ static void wa_seg_dto_cb(struct urb *urb)
wa = xfer->wa; wa = xfer->wa;
dev = &wa->usb_iface->dev; dev = &wa->usb_iface->dev;
rpipe = xfer->ep->hcpriv; rpipe = xfer->ep->hcpriv;
if (printk_ratelimit()) dev_dbg(dev, "xfer %p#%u: data out error %d\n",
dev_err(dev, "xfer %p#%u: data out error %d\n", xfer, seg->index, urb->status);
xfer, seg->index, urb->status);
if (edc_inc(&wa->nep_edc, EDC_MAX_ERRORS, if (edc_inc(&wa->nep_edc, EDC_MAX_ERRORS,
EDC_ERROR_TIMEFRAME)){ EDC_ERROR_TIMEFRAME)){
dev_err(dev, "DTO: URB max acceptable errors " dev_err(dev, "DTO: URB max acceptable errors "
...@@ -578,7 +553,6 @@ static void wa_seg_dto_cb(struct urb *urb) ...@@ -578,7 +553,6 @@ static void wa_seg_dto_cb(struct urb *urb)
if (rpipe_ready) if (rpipe_ready)
wa_xfer_delayed_run(rpipe); wa_xfer_delayed_run(rpipe);
} }
d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
} }
/* /*
...@@ -610,14 +584,12 @@ static void wa_seg_cb(struct urb *urb) ...@@ -610,14 +584,12 @@ static void wa_seg_cb(struct urb *urb)
unsigned rpipe_ready; unsigned rpipe_ready;
u8 done = 0; u8 done = 0;
d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
switch (urb->status) { switch (urb->status) {
case 0: case 0:
spin_lock_irqsave(&xfer->lock, flags); spin_lock_irqsave(&xfer->lock, flags);
wa = xfer->wa; wa = xfer->wa;
dev = &wa->usb_iface->dev; dev = &wa->usb_iface->dev;
d_printf(2, dev, "xfer %p#%u: request done\n", dev_dbg(dev, "xfer %p#%u: request done\n", xfer, seg->index);
xfer, seg->index);
if (xfer->is_inbound && seg->status < WA_SEG_PENDING) if (xfer->is_inbound && seg->status < WA_SEG_PENDING)
seg->status = WA_SEG_PENDING; seg->status = WA_SEG_PENDING;
spin_unlock_irqrestore(&xfer->lock, flags); spin_unlock_irqrestore(&xfer->lock, flags);
...@@ -652,7 +624,6 @@ static void wa_seg_cb(struct urb *urb) ...@@ -652,7 +624,6 @@ static void wa_seg_cb(struct urb *urb)
if (rpipe_ready) if (rpipe_ready)
wa_xfer_delayed_run(rpipe); wa_xfer_delayed_run(rpipe);
} }
d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
} }
/* /*
...@@ -750,9 +721,6 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb) ...@@ -750,9 +721,6 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb)
size_t xfer_hdr_size, cnt, transfer_size; size_t xfer_hdr_size, cnt, transfer_size;
struct wa_xfer_hdr *xfer_hdr0, *xfer_hdr; struct wa_xfer_hdr *xfer_hdr0, *xfer_hdr;
d_fnstart(3, dev, "(xfer %p [rpipe %p] urb %p)\n",
xfer, xfer->ep->hcpriv, urb);
result = __wa_xfer_setup_sizes(xfer, &xfer_type); result = __wa_xfer_setup_sizes(xfer, &xfer_type);
if (result < 0) if (result < 0)
goto error_setup_sizes; goto error_setup_sizes;
...@@ -788,8 +756,6 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb) ...@@ -788,8 +756,6 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb)
result = 0; result = 0;
error_setup_segs: error_setup_segs:
error_setup_sizes: error_setup_sizes:
d_fnend(3, dev, "(xfer %p [rpipe %p] urb %p) = %d\n",
xfer, xfer->ep->hcpriv, urb, result);
return result; return result;
} }
...@@ -843,9 +809,6 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe) ...@@ -843,9 +809,6 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
struct wa_xfer *xfer; struct wa_xfer *xfer;
unsigned long flags; unsigned long flags;
d_fnstart(1, dev, "(rpipe #%d) %d segments available\n",
le16_to_cpu(rpipe->descr.wRPipeIndex),
atomic_read(&rpipe->segs_available));
spin_lock_irqsave(&rpipe->seg_lock, flags); spin_lock_irqsave(&rpipe->seg_lock, flags);
while (atomic_read(&rpipe->segs_available) > 0 while (atomic_read(&rpipe->segs_available) > 0
&& !list_empty(&rpipe->seg_list)) { && !list_empty(&rpipe->seg_list)) {
...@@ -854,10 +817,8 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe) ...@@ -854,10 +817,8 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
list_del(&seg->list_node); list_del(&seg->list_node);
xfer = seg->xfer; xfer = seg->xfer;
result = __wa_seg_submit(rpipe, xfer, seg); result = __wa_seg_submit(rpipe, xfer, seg);
d_printf(1, dev, "xfer %p#%u submitted from delayed " dev_dbg(dev, "xfer %p#%u submitted from delayed [%d segments available] %d\n",
"[%d segments available] %d\n", xfer, seg->index, atomic_read(&rpipe->segs_available), result);
xfer, seg->index,
atomic_read(&rpipe->segs_available), result);
if (unlikely(result < 0)) { if (unlikely(result < 0)) {
spin_unlock_irqrestore(&rpipe->seg_lock, flags); spin_unlock_irqrestore(&rpipe->seg_lock, flags);
spin_lock_irqsave(&xfer->lock, flags); spin_lock_irqsave(&xfer->lock, flags);
...@@ -868,10 +829,6 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe) ...@@ -868,10 +829,6 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
} }
} }
spin_unlock_irqrestore(&rpipe->seg_lock, flags); spin_unlock_irqrestore(&rpipe->seg_lock, flags);
d_fnend(1, dev, "(rpipe #%d) = void, %d segments available\n",
le16_to_cpu(rpipe->descr.wRPipeIndex),
atomic_read(&rpipe->segs_available));
} }
/* /*
...@@ -894,9 +851,6 @@ static int __wa_xfer_submit(struct wa_xfer *xfer) ...@@ -894,9 +851,6 @@ static int __wa_xfer_submit(struct wa_xfer *xfer)
u8 available; u8 available;
u8 empty; u8 empty;
d_fnstart(3, dev, "(xfer %p [rpipe %p])\n",
xfer, xfer->ep->hcpriv);
spin_lock_irqsave(&wa->xfer_list_lock, flags); spin_lock_irqsave(&wa->xfer_list_lock, flags);
list_add_tail(&xfer->list_node, &wa->xfer_list); list_add_tail(&xfer->list_node, &wa->xfer_list);
spin_unlock_irqrestore(&wa->xfer_list_lock, flags); spin_unlock_irqrestore(&wa->xfer_list_lock, flags);
...@@ -908,30 +862,24 @@ static int __wa_xfer_submit(struct wa_xfer *xfer) ...@@ -908,30 +862,24 @@ static int __wa_xfer_submit(struct wa_xfer *xfer)
available = atomic_read(&rpipe->segs_available); available = atomic_read(&rpipe->segs_available);
empty = list_empty(&rpipe->seg_list); empty = list_empty(&rpipe->seg_list);
seg = xfer->seg[cnt]; seg = xfer->seg[cnt];
d_printf(2, dev, "xfer %p#%u: available %u empty %u (%s)\n", dev_dbg(dev, "xfer %p#%u: available %u empty %u (%s)\n",
xfer, cnt, available, empty, xfer, cnt, available, empty,
available == 0 || !empty ? "delayed" : "submitted"); available == 0 || !empty ? "delayed" : "submitted");
if (available == 0 || !empty) { if (available == 0 || !empty) {
d_printf(1, dev, "xfer %p#%u: delayed\n", xfer, cnt); dev_dbg(dev, "xfer %p#%u: delayed\n", xfer, cnt);
seg->status = WA_SEG_DELAYED; seg->status = WA_SEG_DELAYED;
list_add_tail(&seg->list_node, &rpipe->seg_list); list_add_tail(&seg->list_node, &rpipe->seg_list);
} else { } else {
result = __wa_seg_submit(rpipe, xfer, seg); result = __wa_seg_submit(rpipe, xfer, seg);
if (result < 0) if (result < 0) {
__wa_xfer_abort(xfer);
goto error_seg_submit; goto error_seg_submit;
}
} }
xfer->segs_submitted++; xfer->segs_submitted++;
} }
spin_unlock_irqrestore(&rpipe->seg_lock, flags);
d_fnend(3, dev, "(xfer %p [rpipe %p]) = void\n", xfer,
xfer->ep->hcpriv);
return result;
error_seg_submit: error_seg_submit:
__wa_xfer_abort(xfer);
spin_unlock_irqrestore(&rpipe->seg_lock, flags); spin_unlock_irqrestore(&rpipe->seg_lock, flags);
d_fnend(3, dev, "(xfer %p [rpipe %p]) = void\n", xfer,
xfer->ep->hcpriv);
return result; return result;
} }
...@@ -964,11 +912,9 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer) ...@@ -964,11 +912,9 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
struct urb *urb = xfer->urb; struct urb *urb = xfer->urb;
struct wahc *wa = xfer->wa; struct wahc *wa = xfer->wa;
struct wusbhc *wusbhc = wa->wusb; struct wusbhc *wusbhc = wa->wusb;
struct device *dev = &wa->usb_iface->dev;
struct wusb_dev *wusb_dev; struct wusb_dev *wusb_dev;
unsigned done; unsigned done;
d_fnstart(3, dev, "(wa %p urb %p)\n", wa, urb);
result = rpipe_get_by_ep(wa, xfer->ep, urb, xfer->gfp); result = rpipe_get_by_ep(wa, xfer->ep, urb, xfer->gfp);
if (result < 0) if (result < 0)
goto error_rpipe_get; goto error_rpipe_get;
...@@ -997,7 +943,6 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer) ...@@ -997,7 +943,6 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
if (result < 0) if (result < 0)
goto error_xfer_submit; goto error_xfer_submit;
spin_unlock_irqrestore(&xfer->lock, flags); spin_unlock_irqrestore(&xfer->lock, flags);
d_fnend(3, dev, "(wa %p urb %p) = void\n", wa, urb);
return; return;
/* this is basically wa_xfer_completion() broken up wa_xfer_giveback() /* this is basically wa_xfer_completion() broken up wa_xfer_giveback()
...@@ -1015,7 +960,6 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer) ...@@ -1015,7 +960,6 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
error_rpipe_get: error_rpipe_get:
xfer->result = result; xfer->result = result;
wa_xfer_giveback(xfer); wa_xfer_giveback(xfer);
d_fnend(3, dev, "(wa %p urb %p) = (void) %d\n", wa, urb, result);
return; return;
error_xfer_submit: error_xfer_submit:
...@@ -1024,8 +968,6 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer) ...@@ -1024,8 +968,6 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
spin_unlock_irqrestore(&xfer->lock, flags); spin_unlock_irqrestore(&xfer->lock, flags);
if (done) if (done)
wa_xfer_completion(xfer); wa_xfer_completion(xfer);
d_fnend(3, dev, "(wa %p urb %p) = (void) %d\n", wa, urb, result);
return;
} }
/* /*
...@@ -1041,11 +983,9 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer) ...@@ -1041,11 +983,9 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
void wa_urb_enqueue_run(struct work_struct *ws) void wa_urb_enqueue_run(struct work_struct *ws)
{ {
struct wahc *wa = container_of(ws, struct wahc, xfer_work); struct wahc *wa = container_of(ws, struct wahc, xfer_work);
struct device *dev = &wa->usb_iface->dev;
struct wa_xfer *xfer, *next; struct wa_xfer *xfer, *next;
struct urb *urb; struct urb *urb;
d_fnstart(3, dev, "(wa %p)\n", wa);
spin_lock_irq(&wa->xfer_list_lock); spin_lock_irq(&wa->xfer_list_lock);
list_for_each_entry_safe(xfer, next, &wa->xfer_delayed_list, list_for_each_entry_safe(xfer, next, &wa->xfer_delayed_list,
list_node) { list_node) {
...@@ -1059,7 +999,6 @@ void wa_urb_enqueue_run(struct work_struct *ws) ...@@ -1059,7 +999,6 @@ void wa_urb_enqueue_run(struct work_struct *ws)
spin_lock_irq(&wa->xfer_list_lock); spin_lock_irq(&wa->xfer_list_lock);
} }
spin_unlock_irq(&wa->xfer_list_lock); spin_unlock_irq(&wa->xfer_list_lock);
d_fnend(3, dev, "(wa %p) = void\n", wa);
} }
EXPORT_SYMBOL_GPL(wa_urb_enqueue_run); EXPORT_SYMBOL_GPL(wa_urb_enqueue_run);
...@@ -1084,9 +1023,6 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep, ...@@ -1084,9 +1023,6 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
unsigned long my_flags; unsigned long my_flags;
unsigned cant_sleep = irqs_disabled() | in_atomic(); unsigned cant_sleep = irqs_disabled() | in_atomic();
d_fnstart(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x)\n",
wa, ep, urb, urb->transfer_buffer_length, gfp);
if (urb->transfer_buffer == NULL if (urb->transfer_buffer == NULL
&& !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) && !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
&& urb->transfer_buffer_length != 0) { && urb->transfer_buffer_length != 0) {
...@@ -1108,11 +1044,13 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep, ...@@ -1108,11 +1044,13 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
xfer->gfp = gfp; xfer->gfp = gfp;
xfer->ep = ep; xfer->ep = ep;
urb->hcpriv = xfer; urb->hcpriv = xfer;
d_printf(2, dev, "xfer %p urb %p pipe 0x%02x [%d bytes] %s %s %s\n",
xfer, urb, urb->pipe, urb->transfer_buffer_length, dev_dbg(dev, "xfer %p urb %p pipe 0x%02x [%d bytes] %s %s %s\n",
urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP ? "dma" : "nodma", xfer, urb, urb->pipe, urb->transfer_buffer_length,
urb->pipe & USB_DIR_IN ? "inbound" : "outbound", urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP ? "dma" : "nodma",
cant_sleep ? "deferred" : "inline"); urb->pipe & USB_DIR_IN ? "inbound" : "outbound",
cant_sleep ? "deferred" : "inline");
if (cant_sleep) { if (cant_sleep) {
usb_get_urb(urb); usb_get_urb(urb);
spin_lock_irqsave(&wa->xfer_list_lock, my_flags); spin_lock_irqsave(&wa->xfer_list_lock, my_flags);
...@@ -1122,15 +1060,11 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep, ...@@ -1122,15 +1060,11 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
} else { } else {
wa_urb_enqueue_b(xfer); wa_urb_enqueue_b(xfer);
} }
d_fnend(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x) = 0\n",
wa, ep, urb, urb->transfer_buffer_length, gfp);
return 0; return 0;
error_dequeued: error_dequeued:
kfree(xfer); kfree(xfer);
error_kmalloc: error_kmalloc:
d_fnend(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x) = %d\n",
wa, ep, urb, urb->transfer_buffer_length, gfp, result);
return result; return result;
} }
EXPORT_SYMBOL_GPL(wa_urb_enqueue); EXPORT_SYMBOL_GPL(wa_urb_enqueue);
...@@ -1155,7 +1089,6 @@ EXPORT_SYMBOL_GPL(wa_urb_enqueue); ...@@ -1155,7 +1089,6 @@ EXPORT_SYMBOL_GPL(wa_urb_enqueue);
*/ */
int wa_urb_dequeue(struct wahc *wa, struct urb *urb) int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
{ {
struct device *dev = &wa->usb_iface->dev;
unsigned long flags, flags2; unsigned long flags, flags2;
struct wa_xfer *xfer; struct wa_xfer *xfer;
struct wa_seg *seg; struct wa_seg *seg;
...@@ -1163,9 +1096,6 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb) ...@@ -1163,9 +1096,6 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
unsigned cnt; unsigned cnt;
unsigned rpipe_ready = 0; unsigned rpipe_ready = 0;
d_fnstart(3, dev, "(wa %p, urb %p)\n", wa, urb);
d_printf(1, dev, "xfer %p urb %p: aborting\n", urb->hcpriv, urb);
xfer = urb->hcpriv; xfer = urb->hcpriv;
if (xfer == NULL) { if (xfer == NULL) {
/* NOthing setup yet enqueue will see urb->status != /* NOthing setup yet enqueue will see urb->status !=
...@@ -1234,13 +1164,11 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb) ...@@ -1234,13 +1164,11 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
wa_xfer_completion(xfer); wa_xfer_completion(xfer);
if (rpipe_ready) if (rpipe_ready)
wa_xfer_delayed_run(rpipe); wa_xfer_delayed_run(rpipe);
d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
return 0; return 0;
out_unlock: out_unlock:
spin_unlock_irqrestore(&xfer->lock, flags); spin_unlock_irqrestore(&xfer->lock, flags);
out: out:
d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
return 0; return 0;
dequeue_delayed: dequeue_delayed:
...@@ -1250,7 +1178,6 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb) ...@@ -1250,7 +1178,6 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
spin_unlock_irqrestore(&xfer->lock, flags); spin_unlock_irqrestore(&xfer->lock, flags);
wa_xfer_giveback(xfer); wa_xfer_giveback(xfer);
usb_put_urb(urb); /* we got a ref in enqueue() */ usb_put_urb(urb); /* we got a ref in enqueue() */
d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(wa_urb_dequeue); EXPORT_SYMBOL_GPL(wa_urb_dequeue);
...@@ -1326,7 +1253,6 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer) ...@@ -1326,7 +1253,6 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
u8 usb_status; u8 usb_status;
unsigned rpipe_ready = 0; unsigned rpipe_ready = 0;
d_fnstart(3, dev, "(wa %p xfer %p)\n", wa, xfer);
spin_lock_irqsave(&xfer->lock, flags); spin_lock_irqsave(&xfer->lock, flags);
seg_idx = xfer_result->bTransferSegment & 0x7f; seg_idx = xfer_result->bTransferSegment & 0x7f;
if (unlikely(seg_idx >= xfer->segs)) if (unlikely(seg_idx >= xfer->segs))
...@@ -1334,8 +1260,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer) ...@@ -1334,8 +1260,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
seg = xfer->seg[seg_idx]; seg = xfer->seg[seg_idx];
rpipe = xfer->ep->hcpriv; rpipe = xfer->ep->hcpriv;
usb_status = xfer_result->bTransferStatus; usb_status = xfer_result->bTransferStatus;
d_printf(2, dev, "xfer %p#%u: bTransferStatus 0x%02x (seg %u)\n", dev_dbg(dev, "xfer %p#%u: bTransferStatus 0x%02x (seg %u)\n",
xfer, seg_idx, usb_status, seg->status); xfer, seg_idx, usb_status, seg->status);
if (seg->status == WA_SEG_ABORTED if (seg->status == WA_SEG_ABORTED
|| seg->status == WA_SEG_ERROR) /* already handled */ || seg->status == WA_SEG_ERROR) /* already handled */
goto segment_aborted; goto segment_aborted;
...@@ -1391,10 +1317,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer) ...@@ -1391,10 +1317,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
wa_xfer_completion(xfer); wa_xfer_completion(xfer);
if (rpipe_ready) if (rpipe_ready)
wa_xfer_delayed_run(rpipe); wa_xfer_delayed_run(rpipe);
d_fnend(3, dev, "(wa %p xfer %p) = void\n", wa, xfer);
return; return;
error_submit_buf_in: error_submit_buf_in:
if (edc_inc(&wa->dti_edc, EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) { if (edc_inc(&wa->dti_edc, EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
dev_err(dev, "DTI: URB max acceptable errors " dev_err(dev, "DTI: URB max acceptable errors "
...@@ -1416,11 +1340,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer) ...@@ -1416,11 +1340,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
wa_xfer_completion(xfer); wa_xfer_completion(xfer);
if (rpipe_ready) if (rpipe_ready)
wa_xfer_delayed_run(rpipe); wa_xfer_delayed_run(rpipe);
d_fnend(3, dev, "(wa %p xfer %p) = void [segment/DTI-submit error]\n",
wa, xfer);
return; return;
error_bad_seg: error_bad_seg:
spin_unlock_irqrestore(&xfer->lock, flags); spin_unlock_irqrestore(&xfer->lock, flags);
wa_urb_dequeue(wa, xfer->urb); wa_urb_dequeue(wa, xfer->urb);
...@@ -1431,17 +1352,11 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer) ...@@ -1431,17 +1352,11 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
"exceeded, resetting device\n"); "exceeded, resetting device\n");
wa_reset_all(wa); wa_reset_all(wa);
} }
d_fnend(3, dev, "(wa %p xfer %p) = void [bad seg]\n", wa, xfer);
return; return;
segment_aborted: segment_aborted:
/* nothing to do, as the aborter did the completion */ /* nothing to do, as the aborter did the completion */
spin_unlock_irqrestore(&xfer->lock, flags); spin_unlock_irqrestore(&xfer->lock, flags);
d_fnend(3, dev, "(wa %p xfer %p) = void [segment aborted]\n",
wa, xfer);
return;
} }
/* /*
...@@ -1465,15 +1380,14 @@ static void wa_buf_in_cb(struct urb *urb) ...@@ -1465,15 +1380,14 @@ static void wa_buf_in_cb(struct urb *urb)
unsigned long flags; unsigned long flags;
u8 done = 0; u8 done = 0;
d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
switch (urb->status) { switch (urb->status) {
case 0: case 0:
spin_lock_irqsave(&xfer->lock, flags); spin_lock_irqsave(&xfer->lock, flags);
wa = xfer->wa; wa = xfer->wa;
dev = &wa->usb_iface->dev; dev = &wa->usb_iface->dev;
rpipe = xfer->ep->hcpriv; rpipe = xfer->ep->hcpriv;
d_printf(2, dev, "xfer %p#%u: data in done (%zu bytes)\n", dev_dbg(dev, "xfer %p#%u: data in done (%zu bytes)\n",
xfer, seg->index, (size_t)urb->actual_length); xfer, seg->index, (size_t)urb->actual_length);
seg->status = WA_SEG_DONE; seg->status = WA_SEG_DONE;
seg->result = urb->actual_length; seg->result = urb->actual_length;
xfer->segs_done++; xfer->segs_done++;
...@@ -1514,7 +1428,6 @@ static void wa_buf_in_cb(struct urb *urb) ...@@ -1514,7 +1428,6 @@ static void wa_buf_in_cb(struct urb *urb)
if (rpipe_ready) if (rpipe_ready)
wa_xfer_delayed_run(rpipe); wa_xfer_delayed_run(rpipe);
} }
d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
} }
/* /*
...@@ -1553,14 +1466,12 @@ static void wa_xfer_result_cb(struct urb *urb) ...@@ -1553,14 +1466,12 @@ static void wa_xfer_result_cb(struct urb *urb)
struct wa_xfer *xfer; struct wa_xfer *xfer;
u8 usb_status; u8 usb_status;
d_fnstart(3, dev, "(%p)\n", wa);
BUG_ON(wa->dti_urb != urb); BUG_ON(wa->dti_urb != urb);
switch (wa->dti_urb->status) { switch (wa->dti_urb->status) {
case 0: case 0:
/* We have a xfer result buffer; check it */ /* We have a xfer result buffer; check it */
d_printf(2, dev, "DTI: xfer result %d bytes at %p\n", dev_dbg(dev, "DTI: xfer result %d bytes at %p\n",
urb->actual_length, urb->transfer_buffer); urb->actual_length, urb->transfer_buffer);
d_dump(3, dev, urb->transfer_buffer, urb->actual_length);
if (wa->dti_urb->actual_length != sizeof(*xfer_result)) { if (wa->dti_urb->actual_length != sizeof(*xfer_result)) {
dev_err(dev, "DTI Error: xfer result--bad size " dev_err(dev, "DTI Error: xfer result--bad size "
"xfer result (%d bytes vs %zu needed)\n", "xfer result (%d bytes vs %zu needed)\n",
...@@ -1622,7 +1533,6 @@ static void wa_xfer_result_cb(struct urb *urb) ...@@ -1622,7 +1533,6 @@ static void wa_xfer_result_cb(struct urb *urb)
wa_reset_all(wa); wa_reset_all(wa);
} }
out: out:
d_fnend(3, dev, "(%p) = void\n", wa);
return; return;
} }
...@@ -1653,7 +1563,6 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr) ...@@ -1653,7 +1563,6 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr)
struct wa_notif_xfer *notif_xfer; struct wa_notif_xfer *notif_xfer;
const struct usb_endpoint_descriptor *dti_epd = wa->dti_epd; const struct usb_endpoint_descriptor *dti_epd = wa->dti_epd;
d_fnstart(4, dev, "(%p, %p)\n", wa, notif_hdr);
notif_xfer = container_of(notif_hdr, struct wa_notif_xfer, hdr); notif_xfer = container_of(notif_hdr, struct wa_notif_xfer, hdr);
BUG_ON(notif_hdr->bNotifyType != WA_NOTIF_TRANSFER); BUG_ON(notif_hdr->bNotifyType != WA_NOTIF_TRANSFER);
...@@ -1693,7 +1602,6 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr) ...@@ -1693,7 +1602,6 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr)
goto error_dti_urb_submit; goto error_dti_urb_submit;
} }
out: out:
d_fnend(4, dev, "(%p, %p) = void\n", wa, notif_hdr);
return; return;
error_dti_urb_submit: error_dti_urb_submit:
...@@ -1704,6 +1612,4 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr) ...@@ -1704,6 +1612,4 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr)
error_dti_urb_alloc: error_dti_urb_alloc:
error: error:
wa_reset_all(wa); wa_reset_all(wa);
d_fnend(4, dev, "(%p, %p) = void\n", wa, notif_hdr);
return;
} }
...@@ -22,19 +22,16 @@ ...@@ -22,19 +22,16 @@
* *
* FIXME: docs * FIXME: docs
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include "uwb-internal.h"
#define D_LOCAL 0 #include "uwb-internal.h"
#include <linux/uwb/debug.h>
/** Start Beaconing command structure */ /* Start Beaconing command structure */
struct uwb_rc_cmd_start_beacon { struct uwb_rc_cmd_start_beacon {
struct uwb_rccb rccb; struct uwb_rccb rccb;
__le16 wBPSTOffset; __le16 wBPSTOffset;
...@@ -176,9 +173,6 @@ struct uwb_beca_e *__uwb_beca_find_bydev(struct uwb_rc *rc, ...@@ -176,9 +173,6 @@ struct uwb_beca_e *__uwb_beca_find_bydev(struct uwb_rc *rc,
{ {
struct uwb_beca_e *bce, *next; struct uwb_beca_e *bce, *next;
list_for_each_entry_safe(bce, next, &rc->uwb_beca.list, node) { list_for_each_entry_safe(bce, next, &rc->uwb_beca.list, node) {
d_printf(6, NULL, "looking for addr %02x:%02x in %02x:%02x\n",
dev_addr->data[0], dev_addr->data[1],
bce->dev_addr.data[0], bce->dev_addr.data[1]);
if (!memcmp(&bce->dev_addr, dev_addr, sizeof(bce->dev_addr))) if (!memcmp(&bce->dev_addr, dev_addr, sizeof(bce->dev_addr)))
goto out; goto out;
} }
......
...@@ -40,10 +40,8 @@ ...@@ -40,10 +40,8 @@
* uwb_est_get_size() * uwb_est_get_size()
*/ */
#include <linux/spinlock.h> #include <linux/spinlock.h>
#define D_LOCAL 0
#include <linux/uwb/debug.h>
#include "uwb-internal.h"
#include "uwb-internal.h"
struct uwb_est { struct uwb_est {
u16 type_event_high; u16 type_event_high;
...@@ -52,7 +50,6 @@ struct uwb_est { ...@@ -52,7 +50,6 @@ struct uwb_est {
const struct uwb_est_entry *entry; const struct uwb_est_entry *entry;
}; };
static struct uwb_est *uwb_est; static struct uwb_est *uwb_est;
static u8 uwb_est_size; static u8 uwb_est_size;
static u8 uwb_est_used; static u8 uwb_est_used;
...@@ -440,21 +437,12 @@ ssize_t uwb_est_find_size(struct uwb_rc *rc, const struct uwb_rceb *rceb, ...@@ -440,21 +437,12 @@ ssize_t uwb_est_find_size(struct uwb_rc *rc, const struct uwb_rceb *rceb,
u8 *ptr = (u8 *) rceb; u8 *ptr = (u8 *) rceb;
read_lock_irqsave(&uwb_est_lock, flags); read_lock_irqsave(&uwb_est_lock, flags);
d_printf(2, dev, "Size query for event 0x%02x/%04x/%02x,"
" buffer size %ld\n",
(unsigned) rceb->bEventType,
(unsigned) le16_to_cpu(rceb->wEvent),
(unsigned) rceb->bEventContext,
(long) rceb_size);
size = -ENOSPC; size = -ENOSPC;
if (rceb_size < sizeof(*rceb)) if (rceb_size < sizeof(*rceb))
goto out; goto out;
event = le16_to_cpu(rceb->wEvent); event = le16_to_cpu(rceb->wEvent);
type_event_high = rceb->bEventType << 8 | (event & 0xff00) >> 8; type_event_high = rceb->bEventType << 8 | (event & 0xff00) >> 8;
for (itr = 0; itr < uwb_est_used; itr++) { for (itr = 0; itr < uwb_est_used; itr++) {
d_printf(3, dev, "Checking EST 0x%04x/%04x/%04x\n",
uwb_est[itr].type_event_high, uwb_est[itr].vendor,
uwb_est[itr].product);
if (uwb_est[itr].type_event_high != type_event_high) if (uwb_est[itr].type_event_high != type_event_high)
continue; continue;
size = uwb_est_get_size(rc, &uwb_est[itr], size = uwb_est_get_size(rc, &uwb_est[itr],
......
...@@ -57,9 +57,8 @@ ...@@ -57,9 +57,8 @@
#include <linux/usb/wusb.h> #include <linux/usb/wusb.h>
#include <linux/usb/wusb-wa.h> #include <linux/usb/wusb-wa.h>
#include <linux/uwb.h> #include <linux/uwb.h>
#include "uwb-internal.h" #include "uwb-internal.h"
#define D_LOCAL 1
#include <linux/uwb/debug.h>
/* The device uses commands and events from the WHCI specification, although /* The device uses commands and events from the WHCI specification, although
* reporting itself as WUSB compliant. */ * reporting itself as WUSB compliant. */
...@@ -630,17 +629,13 @@ void hwarc_neep_cb(struct urb *urb) ...@@ -630,17 +629,13 @@ void hwarc_neep_cb(struct urb *urb)
switch (result = urb->status) { switch (result = urb->status) {
case 0: case 0:
d_printf(3, dev, "NEEP: receive stat %d, %zu bytes\n",
urb->status, (size_t)urb->actual_length);
uwb_rc_neh_grok(hwarc->uwb_rc, urb->transfer_buffer, uwb_rc_neh_grok(hwarc->uwb_rc, urb->transfer_buffer,
urb->actual_length); urb->actual_length);
break; break;
case -ECONNRESET: /* Not an error, but a controlled situation; */ case -ECONNRESET: /* Not an error, but a controlled situation; */
case -ENOENT: /* (we killed the URB)...so, no broadcast */ case -ENOENT: /* (we killed the URB)...so, no broadcast */
d_printf(2, dev, "NEEP: URB reset/noent %d\n", urb->status);
goto out; goto out;
case -ESHUTDOWN: /* going away! */ case -ESHUTDOWN: /* going away! */
d_printf(2, dev, "NEEP: URB down %d\n", urb->status);
goto out; goto out;
default: /* On general errors, retry unless it gets ugly */ default: /* On general errors, retry unless it gets ugly */
if (edc_inc(&hwarc->neep_edc, EDC_MAX_ERRORS, if (edc_inc(&hwarc->neep_edc, EDC_MAX_ERRORS,
...@@ -649,7 +644,6 @@ void hwarc_neep_cb(struct urb *urb) ...@@ -649,7 +644,6 @@ void hwarc_neep_cb(struct urb *urb)
dev_err(dev, "NEEP: URB error %d\n", urb->status); dev_err(dev, "NEEP: URB error %d\n", urb->status);
} }
result = usb_submit_urb(urb, GFP_ATOMIC); result = usb_submit_urb(urb, GFP_ATOMIC);
d_printf(3, dev, "NEEP: submit %d\n", result);
if (result < 0) { if (result < 0) {
dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
result); result);
...@@ -758,11 +752,11 @@ static int hwarc_get_version(struct uwb_rc *rc) ...@@ -758,11 +752,11 @@ static int hwarc_get_version(struct uwb_rc *rc)
itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength); itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);
while (itr_size >= sizeof(*hdr)) { while (itr_size >= sizeof(*hdr)) {
hdr = (struct usb_descriptor_header *) itr; hdr = (struct usb_descriptor_header *) itr;
d_printf(3, dev, "Extra device descriptor: " dev_dbg(dev, "Extra device descriptor: "
"type %02x/%u bytes @ %zu (%zu left)\n", "type %02x/%u bytes @ %zu (%zu left)\n",
hdr->bDescriptorType, hdr->bLength, hdr->bDescriptorType, hdr->bLength,
(itr - usb_dev->rawdescriptors[actconfig_idx]), (itr - usb_dev->rawdescriptors[actconfig_idx]),
itr_size); itr_size);
if (hdr->bDescriptorType == USB_DT_CS_RADIO_CONTROL) if (hdr->bDescriptorType == USB_DT_CS_RADIO_CONTROL)
goto found; goto found;
itr += hdr->bLength; itr += hdr->bLength;
...@@ -794,8 +788,7 @@ static int hwarc_get_version(struct uwb_rc *rc) ...@@ -794,8 +788,7 @@ static int hwarc_get_version(struct uwb_rc *rc)
goto error; goto error;
} }
rc->version = version; rc->version = version;
d_printf(3, dev, "Device supports WUSB protocol version 0x%04x \n", dev_dbg(dev, "Device supports WUSB protocol version 0x%04x \n", rc->version);
rc->version);
result = 0; result = 0;
error: error:
return result; return result;
...@@ -876,7 +869,6 @@ static void hwarc_disconnect(struct usb_interface *iface) ...@@ -876,7 +869,6 @@ static void hwarc_disconnect(struct usb_interface *iface)
uwb_rc_rm(uwb_rc); uwb_rc_rm(uwb_rc);
usb_put_intf(hwarc->usb_iface); usb_put_intf(hwarc->usb_iface);
usb_put_dev(hwarc->usb_dev); usb_put_dev(hwarc->usb_dev);
d_printf(1, &hwarc->usb_iface->dev, "freed hwarc %p\n", hwarc);
kfree(hwarc); kfree(hwarc);
uwb_rc_put(uwb_rc); /* when creating the device, refcount = 1 */ uwb_rc_put(uwb_rc); /* when creating the device, refcount = 1 */
} }
...@@ -924,13 +916,7 @@ static struct usb_driver hwarc_driver = { ...@@ -924,13 +916,7 @@ static struct usb_driver hwarc_driver = {
static int __init hwarc_driver_init(void) static int __init hwarc_driver_init(void)
{ {
int result; return usb_register(&hwarc_driver);
result = usb_register(&hwarc_driver);
if (result < 0)
printk(KERN_ERR "HWA-RC: Cannot register USB driver: %d\n",
result);
return result;
} }
module_init(hwarc_driver_init); module_init(hwarc_driver_init);
......
...@@ -34,10 +34,7 @@ ...@@ -34,10 +34,7 @@
#include <linux/uwb.h> #include <linux/uwb.h>
#include <linux/random.h> #include <linux/random.h>
#define D_LOCAL 0 /*
#include <linux/uwb/debug.h>
/**
* i1480_rceb_check - Check RCEB for expected field values * i1480_rceb_check - Check RCEB for expected field values
* @i1480: pointer to device for which RCEB is being checked * @i1480: pointer to device for which RCEB is being checked
* @rceb: RCEB being checked * @rceb: RCEB being checked
...@@ -83,7 +80,7 @@ int i1480_rceb_check(const struct i1480 *i1480, const struct uwb_rceb *rceb, ...@@ -83,7 +80,7 @@ int i1480_rceb_check(const struct i1480 *i1480, const struct uwb_rceb *rceb,
EXPORT_SYMBOL_GPL(i1480_rceb_check); EXPORT_SYMBOL_GPL(i1480_rceb_check);
/** /*
* Execute a Radio Control Command * Execute a Radio Control Command
* *
* Command data has to be in i1480->cmd_buf. * 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,7 +98,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size,
u8 expected_type = reply->bEventType; u8 expected_type = reply->bEventType;
u8 context; u8 context;
d_fnstart(3, i1480->dev, "(%p, %s, %zu)\n", i1480, cmd_name, cmd_size);
init_completion(&i1480->evt_complete); init_completion(&i1480->evt_complete);
i1480->evt_result = -EINPROGRESS; i1480->evt_result = -EINPROGRESS;
do { do {
...@@ -150,8 +146,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size, ...@@ -150,8 +146,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size,
result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context, result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context,
expected_type, expected_event); expected_type, expected_event);
error: error:
d_fnend(3, i1480->dev, "(%p, %s, %zu) = %zd\n",
i1480, cmd_name, cmd_size, result);
return result; return result;
} }
EXPORT_SYMBOL_GPL(i1480_cmd); EXPORT_SYMBOL_GPL(i1480_cmd);
......
...@@ -31,9 +31,6 @@ ...@@ -31,9 +31,6 @@
#include <linux/uwb.h> #include <linux/uwb.h>
#include "i1480-dfu.h" #include "i1480-dfu.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
/* /*
* Descriptor for a continuous segment of MAC fw data * Descriptor for a continuous segment of MAC fw data
*/ */
...@@ -184,10 +181,6 @@ ssize_t i1480_fw_cmp(struct i1480 *i1480, struct fw_hdr *hdr) ...@@ -184,10 +181,6 @@ ssize_t i1480_fw_cmp(struct i1480 *i1480, struct fw_hdr *hdr)
} }
if (memcmp(i1480->cmd_buf, bin + src_itr, result)) { if (memcmp(i1480->cmd_buf, bin + src_itr, result)) {
u8 *buf = i1480->cmd_buf; u8 *buf = i1480->cmd_buf;
d_printf(2, i1480->dev,
"original data @ %p + %u, %zu bytes\n",
bin, src_itr, result);
d_dump(4, i1480->dev, bin + src_itr, result);
for (cnt = 0; cnt < result; cnt++) for (cnt = 0; cnt < result; cnt++)
if (bin[src_itr + cnt] != buf[cnt]) { if (bin[src_itr + cnt] != buf[cnt]) {
dev_err(i1480->dev, "byte failed at " dev_err(i1480->dev, "byte failed at "
...@@ -224,7 +217,6 @@ int mac_fw_hdrs_push(struct i1480 *i1480, struct fw_hdr *hdr, ...@@ -224,7 +217,6 @@ int mac_fw_hdrs_push(struct i1480 *i1480, struct fw_hdr *hdr,
struct fw_hdr *hdr_itr; struct fw_hdr *hdr_itr;
int verif_retry_count; int verif_retry_count;
d_fnstart(3, dev, "(%p, %p)\n", i1480, hdr);
/* Now, header by header, push them to the hw */ /* Now, header by header, push them to the hw */
for (hdr_itr = hdr; hdr_itr != NULL; hdr_itr = hdr_itr->next) { for (hdr_itr = hdr; hdr_itr != NULL; hdr_itr = hdr_itr->next) {
verif_retry_count = 0; verif_retry_count = 0;
...@@ -264,7 +256,6 @@ int mac_fw_hdrs_push(struct i1480 *i1480, struct fw_hdr *hdr, ...@@ -264,7 +256,6 @@ int mac_fw_hdrs_push(struct i1480 *i1480, struct fw_hdr *hdr,
break; break;
} }
} }
d_fnend(3, dev, "(%zd)\n", result);
return result; return result;
} }
...@@ -337,11 +328,9 @@ int __mac_fw_upload(struct i1480 *i1480, const char *fw_name, ...@@ -337,11 +328,9 @@ int __mac_fw_upload(struct i1480 *i1480, const char *fw_name,
const struct firmware *fw; const struct firmware *fw;
struct fw_hdr *fw_hdrs; struct fw_hdr *fw_hdrs;
d_fnstart(3, i1480->dev, "(%p, %s, %s)\n", i1480, fw_name, fw_tag);
result = request_firmware(&fw, fw_name, i1480->dev); result = request_firmware(&fw, fw_name, i1480->dev);
if (result < 0) /* Up to caller to complain on -ENOENT */ if (result < 0) /* Up to caller to complain on -ENOENT */
goto out; goto out;
d_printf(3, i1480->dev, "%s fw '%s': uploading\n", fw_tag, fw_name);
result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size); result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size);
if (result < 0) { if (result < 0) {
dev_err(i1480->dev, "%s fw '%s': failed to parse firmware " dev_err(i1480->dev, "%s fw '%s': failed to parse firmware "
...@@ -363,8 +352,6 @@ int __mac_fw_upload(struct i1480 *i1480, const char *fw_name, ...@@ -363,8 +352,6 @@ int __mac_fw_upload(struct i1480 *i1480, const char *fw_name,
out_release: out_release:
release_firmware(fw); release_firmware(fw);
out: out:
d_fnend(3, i1480->dev, "(%p, %s, %s) = %d\n", i1480, fw_name, fw_tag,
result);
return result; return result;
} }
...@@ -433,7 +420,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480) ...@@ -433,7 +420,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
int result; int result;
u32 *val = (u32 *) i1480->cmd_buf; u32 *val = (u32 *) i1480->cmd_buf;
d_fnstart(3, i1480->dev, "(i1480 %p)\n", i1480);
for (cnt = 0; cnt < 10; cnt++) { for (cnt = 0; cnt < 10; cnt++) {
msleep(100); msleep(100);
result = i1480->read(i1480, 0x80080000, 4); result = i1480->read(i1480, 0x80080000, 4);
...@@ -447,7 +433,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480) ...@@ -447,7 +433,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
dev_err(i1480->dev, "Timed out waiting for fw to start\n"); dev_err(i1480->dev, "Timed out waiting for fw to start\n");
result = -ETIMEDOUT; result = -ETIMEDOUT;
out: out:
d_fnend(3, i1480->dev, "(i1480 %p) = %d\n", i1480, result);
return result; return result;
} }
...@@ -467,7 +452,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480) ...@@ -467,7 +452,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
int result = 0, deprecated_name = 0; int result = 0, deprecated_name = 0;
struct i1480_rceb *rcebe = (void *) i1480->evt_buf; struct i1480_rceb *rcebe = (void *) i1480->evt_buf;
d_fnstart(3, i1480->dev, "(%p)\n", i1480);
result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC"); result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC");
if (result == -ENOENT) { if (result == -ENOENT) {
result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate, result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate,
...@@ -501,7 +485,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480) ...@@ -501,7 +485,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
dev_err(i1480->dev, "MAC fw '%s': initialization event returns " dev_err(i1480->dev, "MAC fw '%s': initialization event returns "
"wrong size (%zu bytes vs %zu needed)\n", "wrong size (%zu bytes vs %zu needed)\n",
i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe)); i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe));
dump_bytes(i1480->dev, rcebe, min(i1480->evt_result, (ssize_t)32));
goto error_size; goto error_size;
} }
result = -EIO; result = -EIO;
...@@ -522,6 +505,5 @@ int i1480_mac_fw_upload(struct i1480 *i1480) ...@@ -522,6 +505,5 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
error_init_timeout: error_init_timeout:
error_size: error_size:
error_setup: error_setup:
d_fnend(3, i1480->dev, "(i1480 %p) = %d\n", i1480, result);
return result; return result;
} }
...@@ -43,10 +43,6 @@ ...@@ -43,10 +43,6 @@
#include <linux/usb/wusb-wa.h> #include <linux/usb/wusb-wa.h>
#include "i1480-dfu.h" #include "i1480-dfu.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
struct i1480_usb { struct i1480_usb {
struct i1480 i1480; struct i1480 i1480;
struct usb_device *usb_dev; struct usb_device *usb_dev;
...@@ -117,8 +113,6 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address, ...@@ -117,8 +113,6 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
size_t buffer_size, itr = 0; size_t buffer_size, itr = 0;
d_fnstart(3, i1480->dev, "(%p, 0x%08x, %p, %zu)\n",
i1480, memory_address, buffer, size);
BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */ BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */
while (size > 0) { while (size > 0) {
buffer_size = size < i1480->buf_size ? size : i1480->buf_size; 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,16 +125,10 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */); i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */);
if (result < 0) if (result < 0)
break; break;
d_printf(3, i1480->dev,
"wrote @ 0x%08x %u bytes (of %zu bytes requested)\n",
memory_address, result, buffer_size);
d_dump(4, i1480->dev, i1480->cmd_buf, result);
itr += result; itr += result;
memory_address += result; memory_address += result;
size -= result; size -= result;
} }
d_fnend(3, i1480->dev, "(%p, 0x%08x, %p, %zu) = %d\n",
i1480, memory_address, buffer, size, result);
return result; return result;
} }
...@@ -165,8 +153,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size) ...@@ -165,8 +153,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
size_t itr, read_size = i1480->buf_size; size_t itr, read_size = i1480->buf_size;
struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
d_fnstart(3, i1480->dev, "(%p, 0x%08x, %zu)\n",
i1480, addr, size);
BUG_ON(size > i1480->buf_size); BUG_ON(size > i1480->buf_size);
BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */ BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */
BUG_ON(read_size > 512); BUG_ON(read_size > 512);
...@@ -200,10 +186,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size) ...@@ -200,10 +186,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
} }
result = bytes; result = bytes;
out: out:
d_fnend(3, i1480->dev, "(%p, 0x%08x, %zu) = %zd\n",
i1480, addr, size, result);
if (result > 0)
d_dump(4, i1480->dev, i1480->cmd_buf, result);
return result; return result;
} }
...@@ -259,7 +241,6 @@ int i1480_usb_wait_init_done(struct i1480 *i1480) ...@@ -259,7 +241,6 @@ int i1480_usb_wait_init_done(struct i1480 *i1480)
struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
struct usb_endpoint_descriptor *epd; struct usb_endpoint_descriptor *epd;
d_fnstart(3, dev, "(%p)\n", i1480);
init_completion(&i1480->evt_complete); init_completion(&i1480->evt_complete);
i1480->evt_result = -EINPROGRESS; i1480->evt_result = -EINPROGRESS;
epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc; epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc;
...@@ -281,14 +262,12 @@ int i1480_usb_wait_init_done(struct i1480 *i1480) ...@@ -281,14 +262,12 @@ int i1480_usb_wait_init_done(struct i1480 *i1480)
goto error_wait; goto error_wait;
} }
usb_kill_urb(i1480_usb->neep_urb); usb_kill_urb(i1480_usb->neep_urb);
d_fnend(3, dev, "(%p) = 0\n", i1480);
return 0; return 0;
error_wait: error_wait:
usb_kill_urb(i1480_usb->neep_urb); usb_kill_urb(i1480_usb->neep_urb);
error_submit: error_submit:
i1480->evt_result = result; i1480->evt_result = result;
d_fnend(3, dev, "(%p) = %d\n", i1480, result);
return result; return result;
} }
...@@ -319,7 +298,6 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size) ...@@ -319,7 +298,6 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size)
struct uwb_rccb *cmd = i1480->cmd_buf; struct uwb_rccb *cmd = i1480->cmd_buf;
u8 iface_no; u8 iface_no;
d_fnstart(3, dev, "(%p, %s, %zu)\n", i1480, cmd_name, cmd_size);
/* Post a read on the notification & event endpoint */ /* Post a read on the notification & event endpoint */
iface_no = i1480_usb->usb_iface->cur_altsetting->desc.bInterfaceNumber; iface_no = i1480_usb->usb_iface->cur_altsetting->desc.bInterfaceNumber;
epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc; 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,15 +325,11 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size)
cmd_name, result); cmd_name, result);
goto error_submit_ep0; goto error_submit_ep0;
} }
d_fnend(3, dev, "(%p, %s, %zu) = %d\n",
i1480, cmd_name, cmd_size, result);
return result; return result;
error_submit_ep0: error_submit_ep0:
usb_kill_urb(i1480_usb->neep_urb); usb_kill_urb(i1480_usb->neep_urb);
error_submit_ep1: error_submit_ep1:
d_fnend(3, dev, "(%p, %s, %zu) = %d\n",
i1480, cmd_name, cmd_size, result);
return result; return result;
} }
......
...@@ -68,11 +68,7 @@ ...@@ -68,11 +68,7 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include "i1480u-wlp.h" #include "i1480u-wlp.h"
#define D_LOCAL 0 /*
#include <linux/uwb/debug.h>
/**
* Setup the RX context * Setup the RX context
* *
* Each URB is provided with a transfer_buffer that is the data field * Each URB is provided with a transfer_buffer that is the data field
...@@ -129,7 +125,7 @@ int i1480u_rx_setup(struct i1480u *i1480u) ...@@ -129,7 +125,7 @@ int i1480u_rx_setup(struct i1480u *i1480u)
} }
/** Release resources associated to the rx context */ /* Release resources associated to the rx context */
void i1480u_rx_release(struct i1480u *i1480u) void i1480u_rx_release(struct i1480u *i1480u)
{ {
int cnt; int cnt;
...@@ -155,7 +151,7 @@ void i1480u_rx_unlink_urbs(struct i1480u *i1480u) ...@@ -155,7 +151,7 @@ void i1480u_rx_unlink_urbs(struct i1480u *i1480u)
} }
} }
/** Fix an out-of-sequence packet */ /* Fix an out-of-sequence packet */
#define i1480u_fix(i1480u, msg...) \ #define i1480u_fix(i1480u, msg...) \
do { \ do { \
if (printk_ratelimit()) \ if (printk_ratelimit()) \
...@@ -166,7 +162,7 @@ do { \ ...@@ -166,7 +162,7 @@ do { \
} while (0) } while (0)
/** Drop an out-of-sequence packet */ /* Drop an out-of-sequence packet */
#define i1480u_drop(i1480u, msg...) \ #define i1480u_drop(i1480u, msg...) \
do { \ do { \
if (printk_ratelimit()) \ if (printk_ratelimit()) \
...@@ -177,7 +173,7 @@ do { \ ...@@ -177,7 +173,7 @@ do { \
/** Finalizes setting up the SKB and delivers it /* Finalizes setting up the SKB and delivers it
* *
* We first pass the incoming frame to WLP substack for verification. It * We first pass the incoming frame to WLP substack for verification. It
* may also be a WLP association frame in which case WLP will take over the * 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,18 +188,11 @@ void i1480u_skb_deliver(struct i1480u *i1480u)
struct net_device *net_dev = i1480u->net_dev; struct net_device *net_dev = i1480u->net_dev;
struct device *dev = &i1480u->usb_iface->dev; struct device *dev = &i1480u->usb_iface->dev;
d_printf(6, dev, "RX delivered pre skb(%p), %u bytes\n",
i1480u->rx_skb, i1480u->rx_skb->len);
d_dump(7, dev, i1480u->rx_skb->data, i1480u->rx_skb->len);
should_parse = wlp_receive_frame(dev, &i1480u->wlp, i1480u->rx_skb, should_parse = wlp_receive_frame(dev, &i1480u->wlp, i1480u->rx_skb,
&i1480u->rx_srcaddr); &i1480u->rx_srcaddr);
if (!should_parse) if (!should_parse)
goto out; goto out;
i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev); i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev);
d_printf(5, dev, "RX delivered skb(%p), %u bytes\n",
i1480u->rx_skb, i1480u->rx_skb->len);
d_dump(7, dev, i1480u->rx_skb->data,
i1480u->rx_skb->len > 72 ? 72 : i1480u->rx_skb->len);
i1480u->stats.rx_packets++; i1480u->stats.rx_packets++;
i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size; i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size;
net_dev->last_rx = jiffies; net_dev->last_rx = jiffies;
...@@ -216,7 +205,7 @@ void i1480u_skb_deliver(struct i1480u *i1480u) ...@@ -216,7 +205,7 @@ void i1480u_skb_deliver(struct i1480u *i1480u)
} }
/** /*
* Process a buffer of data received from the USB RX endpoint * Process a buffer of data received from the USB RX endpoint
* *
* First fragment arrives with next or last fragment. All other fragments * First fragment arrives with next or last fragment. All other fragments
...@@ -404,7 +393,7 @@ void i1480u_rx_buffer(struct i1480u_rx_buf *rx_buf) ...@@ -404,7 +393,7 @@ void i1480u_rx_buffer(struct i1480u_rx_buf *rx_buf)
} }
/** /*
* Called when an RX URB has finished receiving or has found some kind * Called when an RX URB has finished receiving or has found some kind
* of error condition. * of error condition.
* *
......
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
*/ */
#include "i1480u-wlp.h" #include "i1480u-wlp.h"
#define D_LOCAL 5
#include <linux/uwb/debug.h>
enum { enum {
/* This is only for Next and Last TX packets */ /* This is only for Next and Last TX packets */
...@@ -64,7 +62,7 @@ enum { ...@@ -64,7 +62,7 @@ enum {
- sizeof(struct untd_hdr_rst), - sizeof(struct untd_hdr_rst),
}; };
/** Free resources allocated to a i1480u tx context. */ /* Free resources allocated to a i1480u tx context. */
static static
void i1480u_tx_free(struct i1480u_tx *wtx) void i1480u_tx_free(struct i1480u_tx *wtx)
{ {
...@@ -99,7 +97,7 @@ void i1480u_tx_unlink_urbs(struct i1480u *i1480u) ...@@ -99,7 +97,7 @@ void i1480u_tx_unlink_urbs(struct i1480u *i1480u)
} }
/** /*
* Callback for a completed tx USB URB. * Callback for a completed tx USB URB.
* *
* TODO: * TODO:
...@@ -149,8 +147,6 @@ void i1480u_tx_cb(struct urb *urb) ...@@ -149,8 +147,6 @@ void i1480u_tx_cb(struct urb *urb)
<= i1480u->tx_inflight.threshold <= i1480u->tx_inflight.threshold
&& netif_queue_stopped(net_dev) && netif_queue_stopped(net_dev)
&& i1480u->tx_inflight.threshold != 0) { && i1480u->tx_inflight.threshold != 0) {
if (d_test(2) && printk_ratelimit())
d_printf(2, dev, "Restart queue. \n");
netif_start_queue(net_dev); netif_start_queue(net_dev);
atomic_inc(&i1480u->tx_inflight.restart_count); atomic_inc(&i1480u->tx_inflight.restart_count);
} }
...@@ -158,7 +154,7 @@ void i1480u_tx_cb(struct urb *urb) ...@@ -158,7 +154,7 @@ void i1480u_tx_cb(struct urb *urb)
} }
/** /*
* Given a buffer that doesn't fit in a single fragment, create an * Given a buffer that doesn't fit in a single fragment, create an
* scatter/gather structure for delivery to the USB pipe. * scatter/gather structure for delivery to the USB pipe.
* *
...@@ -253,15 +249,11 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb, ...@@ -253,15 +249,11 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
/* Now do each remaining fragment */ /* Now do each remaining fragment */
result = -EINVAL; result = -EINVAL;
while (pl_size_left > 0) { while (pl_size_left > 0) {
d_printf(5, NULL, "ITR HDR: pl_size_left %zu buf_itr %zu\n",
pl_size_left, buf_itr - wtx->buf);
if (buf_itr + sizeof(*untd_hdr_rst) - wtx->buf if (buf_itr + sizeof(*untd_hdr_rst) - wtx->buf
> wtx->buf_size) { > wtx->buf_size) {
printk(KERN_ERR "BUG: no space for header\n"); printk(KERN_ERR "BUG: no space for header\n");
goto error_bug; goto error_bug;
} }
d_printf(5, NULL, "ITR HDR 2: pl_size_left %zu buf_itr %zu\n",
pl_size_left, buf_itr - wtx->buf);
untd_hdr_rst = buf_itr; untd_hdr_rst = buf_itr;
buf_itr += sizeof(*untd_hdr_rst); buf_itr += sizeof(*untd_hdr_rst);
if (pl_size_left > i1480u_MAX_PL_SIZE) { 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,9 +263,6 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
frg_pl_size = pl_size_left; frg_pl_size = pl_size_left;
untd_hdr_set_type(&untd_hdr_rst->hdr, i1480u_PKT_FRAG_LST); untd_hdr_set_type(&untd_hdr_rst->hdr, i1480u_PKT_FRAG_LST);
} }
d_printf(5, NULL,
"ITR PL: pl_size_left %zu buf_itr %zu frg_pl_size %zu\n",
pl_size_left, buf_itr - wtx->buf, frg_pl_size);
untd_hdr_set_rx_tx(&untd_hdr_rst->hdr, 0); untd_hdr_set_rx_tx(&untd_hdr_rst->hdr, 0);
untd_hdr_rst->hdr.len = cpu_to_le16(frg_pl_size); untd_hdr_rst->hdr.len = cpu_to_le16(frg_pl_size);
untd_hdr_rst->padding = 0; untd_hdr_rst->padding = 0;
...@@ -286,9 +275,6 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb, ...@@ -286,9 +275,6 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
buf_itr += frg_pl_size; buf_itr += frg_pl_size;
pl_itr += frg_pl_size; pl_itr += frg_pl_size;
pl_size_left -= frg_pl_size; pl_size_left -= frg_pl_size;
d_printf(5, NULL,
"ITR PL 2: pl_size_left %zu buf_itr %zu frg_pl_size %zu\n",
pl_size_left, buf_itr - wtx->buf, frg_pl_size);
} }
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
return 0; return 0;
...@@ -308,7 +294,7 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb, ...@@ -308,7 +294,7 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
} }
/** /*
* Given a buffer that fits in a single fragment, fill out a @wtx * Given a buffer that fits in a single fragment, fill out a @wtx
* struct for transmitting it down the USB pipe. * struct for transmitting it down the USB pipe.
* *
...@@ -346,7 +332,7 @@ int i1480u_tx_create_1(struct i1480u_tx *wtx, struct sk_buff *skb, ...@@ -346,7 +332,7 @@ int i1480u_tx_create_1(struct i1480u_tx *wtx, struct sk_buff *skb,
} }
/** /*
* Given a skb to transmit, massage it to become palatable for the TX pipe * Given a skb to transmit, massage it to become palatable for the TX pipe
* *
* This will break the buffer in chunks smaller than * This will break the buffer in chunks smaller than
...@@ -425,7 +411,7 @@ struct i1480u_tx *i1480u_tx_create(struct i1480u *i1480u, ...@@ -425,7 +411,7 @@ struct i1480u_tx *i1480u_tx_create(struct i1480u *i1480u,
return NULL; return NULL;
} }
/** /*
* Actual fragmentation and transmission of frame * Actual fragmentation and transmission of frame
* *
* @wlp: WLP substack data structure * @wlp: WLP substack data structure
...@@ -447,20 +433,12 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb, ...@@ -447,20 +433,12 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
struct i1480u_tx *wtx; struct i1480u_tx *wtx;
struct wlp_tx_hdr *wlp_tx_hdr; struct wlp_tx_hdr *wlp_tx_hdr;
static unsigned char dev_bcast[2] = { 0xff, 0xff }; static unsigned char dev_bcast[2] = { 0xff, 0xff };
#if 0
int lockup = 50;
#endif
d_fnstart(6, dev, "(skb %p (%u), net_dev %p)\n", skb, skb->len,
net_dev);
BUG_ON(i1480u->wlp.rc == NULL); BUG_ON(i1480u->wlp.rc == NULL);
if ((net_dev->flags & IFF_UP) == 0) if ((net_dev->flags & IFF_UP) == 0)
goto out; goto out;
result = -EBUSY; result = -EBUSY;
if (atomic_read(&i1480u->tx_inflight.count) >= i1480u->tx_inflight.max) { if (atomic_read(&i1480u->tx_inflight.count) >= i1480u->tx_inflight.max) {
if (d_test(2) && printk_ratelimit())
d_printf(2, dev, "Max frames in flight "
"stopping queue.\n");
netif_stop_queue(net_dev); netif_stop_queue(net_dev);
goto error_max_inflight; goto error_max_inflight;
} }
...@@ -489,21 +467,6 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb, ...@@ -489,21 +467,6 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
wlp_tx_hdr_set_delivery_id_type(wlp_tx_hdr, i1480u->options.pca_base_priority); wlp_tx_hdr_set_delivery_id_type(wlp_tx_hdr, i1480u->options.pca_base_priority);
} }
#if 0
dev_info(dev, "TX delivering skb -> USB, %zu bytes\n", skb->len);
dump_bytes(dev, skb->data, skb->len > 72 ? 72 : skb->len);
#endif
#if 0
/* simulates a device lockup after every lockup# packets */
if (lockup && ((i1480u->stats.tx_packets + 1) % lockup) == 0) {
/* Simulate a dropped transmit interrupt */
net_dev->trans_start = jiffies;
netif_stop_queue(net_dev);
dev_err(dev, "Simulate lockup at %ld\n", jiffies);
return result;
}
#endif
result = usb_submit_urb(wtx->urb, GFP_ATOMIC); /* Go baby */ result = usb_submit_urb(wtx->urb, GFP_ATOMIC); /* Go baby */
if (result < 0) { if (result < 0) {
dev_err(dev, "TX: cannot submit URB: %d\n", result); 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,8 +476,6 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
} }
atomic_inc(&i1480u->tx_inflight.count); atomic_inc(&i1480u->tx_inflight.count);
net_dev->trans_start = jiffies; net_dev->trans_start = jiffies;
d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
net_dev, result);
return result; return result;
error_tx_urb_submit: error_tx_urb_submit:
...@@ -522,13 +483,11 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb, ...@@ -522,13 +483,11 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
error_wtx_alloc: error_wtx_alloc:
error_max_inflight: error_max_inflight:
out: out:
d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
net_dev, result);
return result; return result;
} }
/** /*
* Transmit an skb Called when an skbuf has to be transmitted * Transmit an skb Called when an skbuf has to be transmitted
* *
* The skb is first passed to WLP substack to ensure this is a valid * 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,9 +510,6 @@ int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
struct device *dev = &i1480u->usb_iface->dev; struct device *dev = &i1480u->usb_iface->dev;
struct uwb_dev_addr dst; struct uwb_dev_addr dst;
d_fnstart(6, dev, "(skb %p (%u), net_dev %p)\n", skb, skb->len,
net_dev);
BUG_ON(i1480u->wlp.rc == NULL);
if ((net_dev->flags & IFF_UP) == 0) if ((net_dev->flags & IFF_UP) == 0)
goto error; goto error;
result = wlp_prepare_tx_frame(dev, &i1480u->wlp, skb, &dst); 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,31 +518,25 @@ int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
"Dropping packet.\n", result); "Dropping packet.\n", result);
goto error; goto error;
} else if (result == 1) { } else if (result == 1) {
d_printf(6, dev, "WLP will transmit frame. \n");
/* trans_start time will be set when WLP actually transmits /* trans_start time will be set when WLP actually transmits
* the frame */ * the frame */
goto out; goto out;
} }
d_printf(6, dev, "Transmitting frame. \n");
result = i1480u_xmit_frame(&i1480u->wlp, skb, &dst); result = i1480u_xmit_frame(&i1480u->wlp, skb, &dst);
if (result < 0) { if (result < 0) {
dev_err(dev, "Frame TX failed (%d).\n", result); dev_err(dev, "Frame TX failed (%d).\n", result);
goto error; goto error;
} }
d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
net_dev, result);
return NETDEV_TX_OK; return NETDEV_TX_OK;
error: error:
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
i1480u->stats.tx_dropped++; i1480u->stats.tx_dropped++;
out: out:
d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
net_dev, result);
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
/** /*
* Called when a pkt transmission doesn't complete in a reasonable period * Called when a pkt transmission doesn't complete in a reasonable period
* Device reset may sleep - do it outside of interrupt context (delayed) * Device reset may sleep - do it outside of interrupt context (delayed)
*/ */
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* *
* FIXME: docs * FIXME: docs
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -30,10 +29,6 @@ ...@@ -30,10 +29,6 @@
#include <linux/random.h> #include <linux/random.h>
#include "uwb-internal.h" #include "uwb-internal.h"
#define D_LOCAL 1
#include <linux/uwb/debug.h>
/* We initialize addresses to 0xff (invalid, as it is bcast) */ /* We initialize addresses to 0xff (invalid, as it is bcast) */
static inline void uwb_dev_addr_init(struct uwb_dev_addr *addr) static inline void uwb_dev_addr_init(struct uwb_dev_addr *addr)
{ {
...@@ -104,12 +99,9 @@ static void uwb_dev_sys_release(struct device *dev) ...@@ -104,12 +99,9 @@ static void uwb_dev_sys_release(struct device *dev)
{ {
struct uwb_dev *uwb_dev = to_uwb_dev(dev); struct uwb_dev *uwb_dev = to_uwb_dev(dev);
d_fnstart(4, NULL, "(dev %p uwb_dev %p)\n", dev, uwb_dev);
uwb_bce_put(uwb_dev->bce); uwb_bce_put(uwb_dev->bce);
d_printf(0, &uwb_dev->dev, "uwb_dev %p freed\n", uwb_dev);
memset(uwb_dev, 0x69, sizeof(*uwb_dev)); memset(uwb_dev, 0x69, sizeof(*uwb_dev));
kfree(uwb_dev); kfree(uwb_dev);
d_fnend(4, NULL, "(dev %p uwb_dev %p) = void\n", dev, uwb_dev);
} }
/* /*
...@@ -275,12 +267,8 @@ static struct attribute_group *groups[] = { ...@@ -275,12 +267,8 @@ static struct attribute_group *groups[] = {
*/ */
static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev) static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev)
{ {
int result;
struct device *dev; struct device *dev;
d_fnstart(4, NULL, "(uwb_dev %p parent_dev %p)\n", uwb_dev, parent_dev);
BUG_ON(parent_dev == NULL);
dev = &uwb_dev->dev; dev = &uwb_dev->dev;
/* Device sysfs files are only useful for neighbor devices not /* Device sysfs files are only useful for neighbor devices not
local radio controllers. */ local radio controllers. */
...@@ -289,18 +277,14 @@ static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev) ...@@ -289,18 +277,14 @@ static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev)
dev->parent = parent_dev; dev->parent = parent_dev;
dev_set_drvdata(dev, uwb_dev); dev_set_drvdata(dev, uwb_dev);
result = device_add(dev); return device_add(dev);
d_fnend(4, NULL, "(uwb_dev %p parent_dev %p) = %d\n", uwb_dev, parent_dev, result);
return result;
} }
static void __uwb_dev_sys_rm(struct uwb_dev *uwb_dev) static void __uwb_dev_sys_rm(struct uwb_dev *uwb_dev)
{ {
d_fnstart(4, NULL, "(uwb_dev %p)\n", uwb_dev);
dev_set_drvdata(&uwb_dev->dev, NULL); dev_set_drvdata(&uwb_dev->dev, NULL);
device_del(&uwb_dev->dev); device_del(&uwb_dev->dev);
d_fnend(4, NULL, "(uwb_dev %p) = void\n", uwb_dev);
} }
...@@ -384,7 +368,6 @@ int __uwb_dev_offair(struct uwb_dev *uwb_dev, struct uwb_rc *rc) ...@@ -384,7 +368,6 @@ int __uwb_dev_offair(struct uwb_dev *uwb_dev, struct uwb_rc *rc)
struct device *dev = &uwb_dev->dev; struct device *dev = &uwb_dev->dev;
char macbuf[UWB_ADDR_STRSIZE], devbuf[UWB_ADDR_STRSIZE]; char macbuf[UWB_ADDR_STRSIZE], devbuf[UWB_ADDR_STRSIZE];
d_fnstart(3, NULL, "(dev %p [uwb_dev %p], uwb_rc %p)\n", dev, uwb_dev, rc);
uwb_mac_addr_print(macbuf, sizeof(macbuf), &uwb_dev->mac_addr); uwb_mac_addr_print(macbuf, sizeof(macbuf), &uwb_dev->mac_addr);
uwb_dev_addr_print(devbuf, sizeof(devbuf), &uwb_dev->dev_addr); uwb_dev_addr_print(devbuf, sizeof(devbuf), &uwb_dev->dev_addr);
dev_info(dev, "uwb device (mac %s dev %s) disconnected from %s %s\n", 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,7 +376,7 @@ int __uwb_dev_offair(struct uwb_dev *uwb_dev, struct uwb_rc *rc)
rc ? dev_name(rc->uwb_dev.dev.parent) : ""); rc ? dev_name(rc->uwb_dev.dev.parent) : "");
uwb_dev_rm(uwb_dev); uwb_dev_rm(uwb_dev);
uwb_dev_put(uwb_dev); /* for the creation in _onair() */ uwb_dev_put(uwb_dev); /* for the creation in _onair() */
d_fnend(3, NULL, "(dev %p [uwb_dev %p], uwb_rc %p) = 0\n", dev, uwb_dev, rc);
return 0; return 0;
} }
......
...@@ -86,8 +86,6 @@ ...@@ -86,8 +86,6 @@
#include <linux/err.h> #include <linux/err.h>
#include "uwb-internal.h" #include "uwb-internal.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
/* /*
* UWB Radio Controller Notification/Event Handle * 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,8 +477,6 @@ void uwb_rc_neh_grok(struct uwb_rc *rc, void *buf, size_t buf_size)
size_t size, real_size, event_size; size_t size, real_size, event_size;
int needtofree; int needtofree;
d_fnstart(3, dev, "(rc %p buf %p %zu buf_size)\n", rc, buf, buf_size);
d_printf(2, dev, "groking event block: %zu bytes\n", buf_size);
itr = buf; itr = buf;
size = buf_size; size = buf_size;
while (size > 0) { while (size > 0) {
...@@ -528,10 +524,7 @@ void uwb_rc_neh_grok(struct uwb_rc *rc, void *buf, size_t buf_size) ...@@ -528,10 +524,7 @@ void uwb_rc_neh_grok(struct uwb_rc *rc, void *buf, size_t buf_size)
itr += real_size; itr += real_size;
size -= real_size; size -= real_size;
d_printf(2, dev, "consumed %zd bytes, %zu left\n",
event_size, size);
} }
d_fnend(3, dev, "(rc %p buf %p %zu buf_size) = void\n", rc, buf, buf_size);
} }
EXPORT_SYMBOL_GPL(uwb_rc_neh_grok); EXPORT_SYMBOL_GPL(uwb_rc_neh_grok);
......
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#include <linux/err.h> #include <linux/err.h>
#include "uwb-internal.h" #include "uwb-internal.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
/** /**
* Command result codes (WUSB1.0[T8-69]) * Command result codes (WUSB1.0[T8-69])
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/uwb/umc.h> #include <linux/uwb/umc.h>
#define D_LOCAL 0
#include <linux/uwb/debug.h>
static void umc_device_release(struct device *dev) static void umc_device_release(struct device *dev)
{ {
...@@ -53,8 +51,6 @@ int umc_device_register(struct umc_dev *umc) ...@@ -53,8 +51,6 @@ int umc_device_register(struct umc_dev *umc)
{ {
int err; int err;
d_fnstart(3, &umc->dev, "(umc_dev %p)\n", umc);
err = request_resource(umc->resource.parent, &umc->resource); err = request_resource(umc->resource.parent, &umc->resource);
if (err < 0) { if (err < 0) {
dev_err(&umc->dev, "can't allocate resource range " dev_err(&umc->dev, "can't allocate resource range "
...@@ -68,13 +64,11 @@ int umc_device_register(struct umc_dev *umc) ...@@ -68,13 +64,11 @@ int umc_device_register(struct umc_dev *umc)
err = device_register(&umc->dev); err = device_register(&umc->dev);
if (err < 0) if (err < 0)
goto error_device_register; goto error_device_register;
d_fnend(3, &umc->dev, "(umc_dev %p) = 0\n", umc);
return 0; return 0;
error_device_register: error_device_register:
release_resource(&umc->resource); release_resource(&umc->resource);
error_request_resource: error_request_resource:
d_fnend(3, &umc->dev, "(umc_dev %p) = %d\n", umc, err);
return err; return err;
} }
EXPORT_SYMBOL_GPL(umc_device_register); EXPORT_SYMBOL_GPL(umc_device_register);
...@@ -94,10 +88,8 @@ void umc_device_unregister(struct umc_dev *umc) ...@@ -94,10 +88,8 @@ void umc_device_unregister(struct umc_dev *umc)
if (!umc) if (!umc)
return; return;
dev = get_device(&umc->dev); dev = get_device(&umc->dev);
d_fnstart(3, dev, "(umc_dev %p)\n", umc);
device_unregister(&umc->dev); device_unregister(&umc->dev);
release_resource(&umc->resource); release_resource(&umc->resource);
d_fnend(3, dev, "(umc_dev %p) = void\n", umc);
put_device(dev); put_device(dev);
} }
EXPORT_SYMBOL_GPL(umc_device_unregister); EXPORT_SYMBOL_GPL(umc_device_unregister);
...@@ -68,17 +68,13 @@ ...@@ -68,17 +68,13 @@
* *
* Handler functions are called normally uwbd_evt_handle_*(). * Handler functions are called normally uwbd_evt_handle_*().
*/ */
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include "uwb-internal.h"
#define D_LOCAL 1
#include <linux/uwb/debug.h>
#include "uwb-internal.h"
/** /*
* UWBD Event handler function signature * UWBD Event handler function signature
* *
* Return !0 if the event needs not to be freed (ie the handler * Return !0 if the event needs not to be freed (ie the handler
...@@ -101,9 +97,8 @@ struct uwbd_event { ...@@ -101,9 +97,8 @@ struct uwbd_event {
const char *name; const char *name;
}; };
/** Table of handlers for and properties of the UWBD Radio Control Events */ /* Table of handlers for and properties of the UWBD Radio Control Events */
static static struct uwbd_event uwbd_urc_events[] = {
struct uwbd_event uwbd_events[] = {
[UWB_RC_EVT_IE_RCV] = { [UWB_RC_EVT_IE_RCV] = {
.handler = uwbd_evt_handle_rc_ie_rcv, .handler = uwbd_evt_handle_rc_ie_rcv,
.name = "IE_RECEIVED" .name = "IE_RECEIVED"
...@@ -146,23 +141,15 @@ struct uwbd_evt_type_handler { ...@@ -146,23 +141,15 @@ struct uwbd_evt_type_handler {
size_t size; size_t size;
}; };
#define UWBD_EVT_TYPE_HANDLER(n,a) { \ /* Table of handlers for each UWBD Event type. */
.name = (n), \ static struct uwbd_evt_type_handler uwbd_urc_evt_type_handlers[] = {
.uwbd_events = (a), \ [UWB_RC_CET_GENERAL] = {
.size = sizeof(a)/sizeof((a)[0]) \ .name = "URC",
} .uwbd_events = uwbd_urc_events,
.size = ARRAY_SIZE(uwbd_urc_events),
},
/** Table of handlers for each UWBD Event type. */
static
struct uwbd_evt_type_handler uwbd_evt_type_handlers[] = {
[UWB_RC_CET_GENERAL] = UWBD_EVT_TYPE_HANDLER("RC", uwbd_events)
}; };
static const
size_t uwbd_evt_type_handlers_len =
sizeof(uwbd_evt_type_handlers) / sizeof(uwbd_evt_type_handlers[0]);
static const struct uwbd_event uwbd_message_handlers[] = { static const struct uwbd_event uwbd_message_handlers[] = {
[UWB_EVT_MSG_RESET] = { [UWB_EVT_MSG_RESET] = {
.handler = uwbd_msg_handle_reset, .handler = uwbd_msg_handle_reset,
...@@ -170,7 +157,7 @@ static const struct uwbd_event uwbd_message_handlers[] = { ...@@ -170,7 +157,7 @@ static const struct uwbd_event uwbd_message_handlers[] = {
}, },
}; };
/** /*
* Handle an URC event passed to the UWB Daemon * Handle an URC event passed to the UWB Daemon
* *
* @evt: the event to handle * @evt: the event to handle
...@@ -190,6 +177,7 @@ static const struct uwbd_event uwbd_message_handlers[] = { ...@@ -190,6 +177,7 @@ static const struct uwbd_event uwbd_message_handlers[] = {
static static
int uwbd_event_handle_urc(struct uwb_event *evt) int uwbd_event_handle_urc(struct uwb_event *evt)
{ {
int result = -EINVAL;
struct uwbd_evt_type_handler *type_table; struct uwbd_evt_type_handler *type_table;
uwbd_evt_handler_f handler; uwbd_evt_handler_f handler;
u8 type, context; u8 type, context;
...@@ -199,26 +187,24 @@ int uwbd_event_handle_urc(struct uwb_event *evt) ...@@ -199,26 +187,24 @@ int uwbd_event_handle_urc(struct uwb_event *evt)
event = le16_to_cpu(evt->notif.rceb->wEvent); event = le16_to_cpu(evt->notif.rceb->wEvent);
context = evt->notif.rceb->bEventContext; context = evt->notif.rceb->bEventContext;
if (type > uwbd_evt_type_handlers_len) { if (type > ARRAY_SIZE(uwbd_urc_evt_type_handlers))
printk(KERN_ERR "UWBD: event type %u: unknown (too high)\n", type); goto out;
return -EINVAL; type_table = &uwbd_urc_evt_type_handlers[type];
} if (type_table->uwbd_events == NULL)
type_table = &uwbd_evt_type_handlers[type]; goto out;
if (type_table->uwbd_events == NULL) { if (event > type_table->size)
printk(KERN_ERR "UWBD: event type %u: unknown\n", type); goto out;
return -EINVAL;
}
if (event > type_table->size) {
printk(KERN_ERR "UWBD: event %s[%u]: unknown (too high)\n",
type_table->name, event);
return -EINVAL;
}
handler = type_table->uwbd_events[event].handler; handler = type_table->uwbd_events[event].handler;
if (handler == NULL) { if (handler == NULL)
printk(KERN_ERR "UWBD: event %s[%u]: unknown\n", type_table->name, event); goto out;
return -EINVAL;
} result = (*handler)(evt);
return (*handler)(evt); out:
if (result < 0)
dev_err(&evt->rc->uwb_dev.dev,
"UWBD: event 0x%02x/%04x/%02x, handling failed: %d\n",
type, event, context, result);
return result;
} }
static void uwbd_event_handle_message(struct uwb_event *evt) static void uwbd_event_handle_message(struct uwb_event *evt)
......
...@@ -48,10 +48,8 @@ ...@@ -48,10 +48,8 @@
#include <linux/uwb.h> #include <linux/uwb.h>
#include <linux/uwb/whci.h> #include <linux/uwb/whci.h>
#include <linux/uwb/umc.h> #include <linux/uwb/umc.h>
#include "uwb-internal.h"
#define D_LOCAL 0 #include "uwb-internal.h"
#include <linux/uwb/debug.h>
/** /**
* Descriptor for an instance of the UWB Radio Control Driver that * 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,13 +95,8 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
struct device *dev = &whcrc->umc_dev->dev; struct device *dev = &whcrc->umc_dev->dev;
u32 urccmd; u32 urccmd;
d_fnstart(3, dev, "(%p, %p, %zu)\n", uwb_rc, cmd, cmd_size); if (cmd_size >= 4096)
might_sleep(); return -EINVAL;
if (cmd_size >= 4096) {
result = -E2BIG;
goto error;
}
/* /*
* If the URC is halted, then the hardware has reset itself. * 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,16 +107,14 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
if (le_readl(whcrc->rc_base + URCSTS) & URCSTS_HALTED) { if (le_readl(whcrc->rc_base + URCSTS) & URCSTS_HALTED) {
dev_err(dev, "requesting reset of halted radio controller\n"); dev_err(dev, "requesting reset of halted radio controller\n");
uwb_rc_reset_all(uwb_rc); uwb_rc_reset_all(uwb_rc);
result = -EIO; return -EIO;
goto error;
} }
result = wait_event_timeout(whcrc->cmd_wq, result = wait_event_timeout(whcrc->cmd_wq,
!(le_readl(whcrc->rc_base + URCCMD) & URCCMD_ACTIVE), HZ/2); !(le_readl(whcrc->rc_base + URCCMD) & URCCMD_ACTIVE), HZ/2);
if (result == 0) { if (result == 0) {
dev_err(dev, "device is not ready to execute commands\n"); dev_err(dev, "device is not ready to execute commands\n");
result = -ETIMEDOUT; return -ETIMEDOUT;
goto error;
} }
memmove(whcrc->cmd_buf, cmd, cmd_size); memmove(whcrc->cmd_buf, cmd, cmd_size);
...@@ -136,10 +127,7 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc, ...@@ -136,10 +127,7 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
whcrc->rc_base + URCCMD); whcrc->rc_base + URCCMD);
spin_unlock(&whcrc->irq_lock); spin_unlock(&whcrc->irq_lock);
error: return 0;
d_fnend(3, dev, "(%p, %p, %zu) = %d\n",
uwb_rc, cmd, cmd_size, result);
return result;
} }
static int whcrc_reset(struct uwb_rc *rc) static int whcrc_reset(struct uwb_rc *rc)
...@@ -166,34 +154,25 @@ static int whcrc_reset(struct uwb_rc *rc) ...@@ -166,34 +154,25 @@ static int whcrc_reset(struct uwb_rc *rc)
static static
void whcrc_enable_events(struct whcrc *whcrc) void whcrc_enable_events(struct whcrc *whcrc)
{ {
struct device *dev = &whcrc->umc_dev->dev;
u32 urccmd; u32 urccmd;
d_fnstart(4, dev, "(whcrc %p)\n", whcrc);
le_writeq(whcrc->evt_dma_buf, whcrc->rc_base + URCEVTADDR); le_writeq(whcrc->evt_dma_buf, whcrc->rc_base + URCEVTADDR);
spin_lock(&whcrc->irq_lock); spin_lock(&whcrc->irq_lock);
urccmd = le_readl(whcrc->rc_base + URCCMD) & ~URCCMD_ACTIVE; urccmd = le_readl(whcrc->rc_base + URCCMD) & ~URCCMD_ACTIVE;
le_writel(urccmd | URCCMD_EARV, whcrc->rc_base + URCCMD); le_writel(urccmd | URCCMD_EARV, whcrc->rc_base + URCCMD);
spin_unlock(&whcrc->irq_lock); spin_unlock(&whcrc->irq_lock);
d_fnend(4, dev, "(whcrc %p) = void\n", whcrc);
} }
static void whcrc_event_work(struct work_struct *work) static void whcrc_event_work(struct work_struct *work)
{ {
struct whcrc *whcrc = container_of(work, struct whcrc, event_work); struct whcrc *whcrc = container_of(work, struct whcrc, event_work);
struct device *dev = &whcrc->umc_dev->dev;
size_t size; size_t size;
u64 urcevtaddr; u64 urcevtaddr;
urcevtaddr = le_readq(whcrc->rc_base + URCEVTADDR); urcevtaddr = le_readq(whcrc->rc_base + URCEVTADDR);
size = urcevtaddr & URCEVTADDR_OFFSET_MASK; size = urcevtaddr & URCEVTADDR_OFFSET_MASK;
d_printf(3, dev, "received %zu octet event\n", size);
d_dump(4, dev, whcrc->evt_buf, size > 32 ? 32 : size);
uwb_rc_neh_grok(whcrc->uwb_rc, whcrc->evt_buf, size); uwb_rc_neh_grok(whcrc->uwb_rc, whcrc->evt_buf, size);
whcrc_enable_events(whcrc); whcrc_enable_events(whcrc);
} }
...@@ -216,22 +195,15 @@ irqreturn_t whcrc_irq_cb(int irq, void *_whcrc) ...@@ -216,22 +195,15 @@ irqreturn_t whcrc_irq_cb(int irq, void *_whcrc)
return IRQ_NONE; return IRQ_NONE;
le_writel(urcsts & URCSTS_INT_MASK, whcrc->rc_base + URCSTS); le_writel(urcsts & URCSTS_INT_MASK, whcrc->rc_base + URCSTS);
d_printf(4, dev, "acked 0x%08x, urcsts 0x%08x\n",
le_readl(whcrc->rc_base + URCSTS), urcsts);
if (urcsts & URCSTS_HSE) { if (urcsts & URCSTS_HSE) {
dev_err(dev, "host system error -- hardware halted\n"); dev_err(dev, "host system error -- hardware halted\n");
/* FIXME: do something sensible here */ /* FIXME: do something sensible here */
goto out; goto out;
} }
if (urcsts & URCSTS_ER) { if (urcsts & URCSTS_ER)
d_printf(3, dev, "ER: event ready\n");
schedule_work(&whcrc->event_work); schedule_work(&whcrc->event_work);
} if (urcsts & URCSTS_RCI)
if (urcsts & URCSTS_RCI) {
d_printf(3, dev, "RCI: ready to execute another command\n");
wake_up_all(&whcrc->cmd_wq); wake_up_all(&whcrc->cmd_wq);
}
out: out:
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -250,8 +222,7 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc) ...@@ -250,8 +222,7 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
whcrc->area = umc_dev->resource.start; whcrc->area = umc_dev->resource.start;
whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1; whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1;
result = -EBUSY; result = -EBUSY;
if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) {
== NULL) {
dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n", dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n",
whcrc->rc_len, whcrc->area, result); whcrc->rc_len, whcrc->area, result);
goto error_request_region; goto error_request_region;
...@@ -286,8 +257,6 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc) ...@@ -286,8 +257,6 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
dev_err(dev, "Can't allocate evt transfer buffer\n"); dev_err(dev, "Can't allocate evt transfer buffer\n");
goto error_evt_buffer; goto error_evt_buffer;
} }
d_printf(3, dev, "UWB RC Interface: %zu bytes at 0x%p, irq %u\n",
whcrc->rc_len, whcrc->rc_base, umc_dev->irq);
return 0; return 0;
error_evt_buffer: error_evt_buffer:
...@@ -396,7 +365,6 @@ int whcrc_probe(struct umc_dev *umc_dev) ...@@ -396,7 +365,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
struct whcrc *whcrc; struct whcrc *whcrc;
struct device *dev = &umc_dev->dev; struct device *dev = &umc_dev->dev;
d_fnstart(3, dev, "(umc_dev %p)\n", umc_dev);
result = -ENOMEM; result = -ENOMEM;
uwb_rc = uwb_rc_alloc(); uwb_rc = uwb_rc_alloc();
if (uwb_rc == NULL) { if (uwb_rc == NULL) {
...@@ -428,7 +396,6 @@ int whcrc_probe(struct umc_dev *umc_dev) ...@@ -428,7 +396,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
if (result < 0) if (result < 0)
goto error_rc_add; goto error_rc_add;
umc_set_drvdata(umc_dev, whcrc); umc_set_drvdata(umc_dev, whcrc);
d_fnend(3, dev, "(umc_dev %p) = 0\n", umc_dev);
return 0; return 0;
error_rc_add: error_rc_add:
...@@ -438,7 +405,6 @@ int whcrc_probe(struct umc_dev *umc_dev) ...@@ -438,7 +405,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
error_alloc: error_alloc:
uwb_rc_put(uwb_rc); uwb_rc_put(uwb_rc);
error_rc_alloc: error_rc_alloc:
d_fnend(3, dev, "(umc_dev %p) = %d\n", umc_dev, result);
return result; return result;
} }
...@@ -461,7 +427,6 @@ static void whcrc_remove(struct umc_dev *umc_dev) ...@@ -461,7 +427,6 @@ static void whcrc_remove(struct umc_dev *umc_dev)
whcrc_release_rc_umc(whcrc); whcrc_release_rc_umc(whcrc);
kfree(whcrc); kfree(whcrc);
uwb_rc_put(uwb_rc); uwb_rc_put(uwb_rc);
d_printf(1, &umc_dev->dev, "freed whcrc %p\n", whcrc);
} }
static int whcrc_pre_reset(struct umc_dev *umc) static int whcrc_pre_reset(struct umc_dev *umc)
......
...@@ -51,9 +51,7 @@ ...@@ -51,9 +51,7 @@
* the tag and address of the transmitting neighbor. * the tag and address of the transmitting neighbor.
*/ */
#define D_LOCAL 5
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/uwb/debug.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/wlp.h> #include <linux/wlp.h>
#include "wlp-internal.h" #include "wlp-internal.h"
...@@ -304,7 +302,6 @@ int wlp_eda_for_virtual(struct wlp_eda *eda, ...@@ -304,7 +302,6 @@ int wlp_eda_for_virtual(struct wlp_eda *eda,
{ {
int result = 0; int result = 0;
struct wlp *wlp = container_of(eda, struct wlp, eda); struct wlp *wlp = container_of(eda, struct wlp, eda);
struct device *dev = &wlp->rc->uwb_dev.dev;
struct wlp_eda_node *itr; struct wlp_eda_node *itr;
unsigned long flags; unsigned long flags;
int found = 0; int found = 0;
...@@ -313,40 +310,14 @@ int wlp_eda_for_virtual(struct wlp_eda *eda, ...@@ -313,40 +310,14 @@ int wlp_eda_for_virtual(struct wlp_eda *eda,
list_for_each_entry(itr, &eda->cache, list_node) { list_for_each_entry(itr, &eda->cache, list_node) {
if (!memcmp(itr->virt_addr, virt_addr, if (!memcmp(itr->virt_addr, virt_addr,
sizeof(itr->virt_addr))) { sizeof(itr->virt_addr))) {
d_printf(6, dev, "EDA: looking for "
"%02x:%02x:%02x:%02x:%02x:%02x hit %02x:%02x "
"wss %p tag 0x%02x state %u\n",
virt_addr[0], virt_addr[1],
virt_addr[2], virt_addr[3],
virt_addr[4], virt_addr[5],
itr->dev_addr.data[1],
itr->dev_addr.data[0], itr->wss,
itr->tag, itr->state);
result = (*function)(wlp, itr, priv); result = (*function)(wlp, itr, priv);
*dev_addr = itr->dev_addr; *dev_addr = itr->dev_addr;
found = 1; found = 1;
break; break;
} else }
d_printf(6, dev, "EDA: looking for "
"%02x:%02x:%02x:%02x:%02x:%02x "
"against "
"%02x:%02x:%02x:%02x:%02x:%02x miss\n",
virt_addr[0], virt_addr[1],
virt_addr[2], virt_addr[3],
virt_addr[4], virt_addr[5],
itr->virt_addr[0], itr->virt_addr[1],
itr->virt_addr[2], itr->virt_addr[3],
itr->virt_addr[4], itr->virt_addr[5]);
} }
if (!found) { if (!found)
if (printk_ratelimit())
dev_err(dev, "EDA: Eth addr %02x:%02x:%02x"
":%02x:%02x:%02x not found.\n",
virt_addr[0], virt_addr[1],
virt_addr[2], virt_addr[3],
virt_addr[4], virt_addr[5]);
result = -ENODEV; result = -ENODEV;
}
spin_unlock_irqrestore(&eda->lock, flags); spin_unlock_irqrestore(&eda->lock, flags);
return result; return result;
} }
......
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
*/ */
#include <linux/wlp.h> #include <linux/wlp.h>
#define D_LOCAL 6
#include <linux/uwb/debug.h>
#include "wlp-internal.h" #include "wlp-internal.h"
static static
...@@ -105,24 +104,18 @@ static inline void wlp_set_attr_hdr(struct wlp_attr_hdr *hdr, unsigned type, ...@@ -105,24 +104,18 @@ static inline void wlp_set_attr_hdr(struct wlp_attr_hdr *hdr, unsigned type,
#define wlp_set(type, type_code, name) \ #define wlp_set(type, type_code, name) \
static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \ static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
{ \ { \
d_fnstart(6, NULL, "(attribute %p)\n", attr); \
wlp_set_attr_hdr(&attr->hdr, type_code, \ wlp_set_attr_hdr(&attr->hdr, type_code, \
sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \ sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \
attr->name = value; \ attr->name = value; \
d_dump(6, NULL, attr, sizeof(*attr)); \
d_fnend(6, NULL, "(attribute %p)\n", attr); \
return sizeof(*attr); \ return sizeof(*attr); \
} }
#define wlp_pset(type, type_code, name) \ #define wlp_pset(type, type_code, name) \
static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \ static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
{ \ { \
d_fnstart(6, NULL, "(attribute %p)\n", attr); \
wlp_set_attr_hdr(&attr->hdr, type_code, \ wlp_set_attr_hdr(&attr->hdr, type_code, \
sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \ sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \
attr->name = *value; \ attr->name = *value; \
d_dump(6, NULL, attr, sizeof(*attr)); \
d_fnend(6, NULL, "(attribute %p)\n", attr); \
return sizeof(*attr); \ return sizeof(*attr); \
} }
...@@ -139,11 +132,8 @@ static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \ ...@@ -139,11 +132,8 @@ static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value, \ static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value, \
size_t len) \ size_t len) \
{ \ { \
d_fnstart(6, NULL, "(attribute %p)\n", attr); \
wlp_set_attr_hdr(&attr->hdr, type_code, len); \ wlp_set_attr_hdr(&attr->hdr, type_code, len); \
memcpy(attr->name, value, len); \ memcpy(attr->name, value, len); \
d_dump(6, NULL, attr, sizeof(*attr) + len); \
d_fnend(6, NULL, "(attribute %p)\n", attr); \
return sizeof(*attr) + len; \ return sizeof(*attr) + len; \
} }
...@@ -182,7 +172,7 @@ static size_t wlp_set_wss_info(struct wlp_attr_wss_info *attr, ...@@ -182,7 +172,7 @@ static size_t wlp_set_wss_info(struct wlp_attr_wss_info *attr,
size_t datalen; size_t datalen;
void *ptr = attr->wss_info; void *ptr = attr->wss_info;
size_t used = sizeof(*attr); size_t used = sizeof(*attr);
d_fnstart(6, NULL, "(attribute %p)\n", attr);
datalen = sizeof(struct wlp_wss_info) + strlen(wss->name); datalen = sizeof(struct wlp_wss_info) + strlen(wss->name);
wlp_set_attr_hdr(&attr->hdr, WLP_ATTR_WSS_INFO, datalen); wlp_set_attr_hdr(&attr->hdr, WLP_ATTR_WSS_INFO, datalen);
used = wlp_set_wssid(ptr, &wss->wssid); 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,9 +180,6 @@ static size_t wlp_set_wss_info(struct wlp_attr_wss_info *attr,
used += wlp_set_accept_enrl(ptr + used, wss->accept_enroll); used += wlp_set_accept_enrl(ptr + used, wss->accept_enroll);
used += wlp_set_wss_sec_status(ptr + used, wss->secure_status); used += wlp_set_wss_sec_status(ptr + used, wss->secure_status);
used += wlp_set_wss_bcast(ptr + used, &wss->bcast); used += wlp_set_wss_bcast(ptr + used, &wss->bcast);
d_dump(6, NULL, attr, sizeof(*attr) + datalen);
d_fnend(6, NULL, "(attribute %p, used %d)\n",
attr, (int)(sizeof(*attr) + used));
return sizeof(*attr) + used; return sizeof(*attr) + used;
} }
...@@ -414,7 +401,6 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp, ...@@ -414,7 +401,6 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
size_t used = 0; size_t used = 0;
ssize_t result = -EINVAL; ssize_t result = -EINVAL;
d_printf(6, dev, "WLP: WSS info: Retrieving WSS name\n");
result = wlp_get_wss_name(wlp, ptr, info->name, buflen); result = wlp_get_wss_name(wlp, ptr, info->name, buflen);
if (result < 0) { if (result < 0) {
dev_err(dev, "WLP: unable to obtain WSS name from " 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,7 +408,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
goto error_parse; goto error_parse;
} }
used += result; used += result;
d_printf(6, dev, "WLP: WSS info: Retrieving accept enroll\n");
result = wlp_get_accept_enrl(wlp, ptr + used, &info->accept_enroll, result = wlp_get_accept_enrl(wlp, ptr + used, &info->accept_enroll,
buflen - used); buflen - used);
if (result < 0) { if (result < 0) {
...@@ -437,7 +423,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp, ...@@ -437,7 +423,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
goto error_parse; goto error_parse;
} }
used += result; used += result;
d_printf(6, dev, "WLP: WSS info: Retrieving secure status\n");
result = wlp_get_wss_sec_status(wlp, ptr + used, &info->sec_status, result = wlp_get_wss_sec_status(wlp, ptr + used, &info->sec_status,
buflen - used); buflen - used);
if (result < 0) { if (result < 0) {
...@@ -452,7 +438,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp, ...@@ -452,7 +438,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
goto error_parse; goto error_parse;
} }
used += result; used += result;
d_printf(6, dev, "WLP: WSS info: Retrieving broadcast\n");
result = wlp_get_wss_bcast(wlp, ptr + used, &info->bcast, result = wlp_get_wss_bcast(wlp, ptr + used, &info->bcast,
buflen - used); buflen - used);
if (result < 0) { if (result < 0) {
...@@ -530,7 +516,7 @@ static ssize_t wlp_get_wss_info(struct wlp *wlp, struct wlp_attr_wss_info *attr, ...@@ -530,7 +516,7 @@ static ssize_t wlp_get_wss_info(struct wlp *wlp, struct wlp_attr_wss_info *attr,
len = result; len = result;
used = sizeof(*attr); used = sizeof(*attr);
ptr = attr; ptr = attr;
d_printf(6, dev, "WLP: WSS info: Retrieving WSSID\n");
result = wlp_get_wssid(wlp, ptr + used, wssid, buflen - used); result = wlp_get_wssid(wlp, ptr + used, wssid, buflen - used);
if (result < 0) { if (result < 0) {
dev_err(dev, "WLP: unable to obtain WSSID from WSS info.\n"); 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,8 +539,6 @@ static ssize_t wlp_get_wss_info(struct wlp *wlp, struct wlp_attr_wss_info *attr,
goto out; goto out;
} }
result = used; result = used;
d_printf(6, dev, "WLP: Successfully parsed WLP information "
"attribute. used %zu bytes\n", used);
out: out:
return result; return result;
} }
...@@ -598,8 +582,6 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp, ...@@ -598,8 +582,6 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp,
struct wlp_wssid_e *wssid_e; struct wlp_wssid_e *wssid_e;
char buf[WLP_WSS_UUID_STRSIZE]; char buf[WLP_WSS_UUID_STRSIZE];
d_fnstart(6, dev, "wlp %p, attr %p, neighbor %p, wss %p, buflen %d \n",
wlp, attr, neighbor, wss, (int)buflen);
if (buflen < 0) if (buflen < 0)
goto out; goto out;
...@@ -638,8 +620,7 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp, ...@@ -638,8 +620,7 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp,
wss->accept_enroll = wss_info.accept_enroll; wss->accept_enroll = wss_info.accept_enroll;
wss->state = WLP_WSS_STATE_PART_ENROLLED; wss->state = WLP_WSS_STATE_PART_ENROLLED;
wlp_wss_uuid_print(buf, sizeof(buf), &wssid); wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
d_printf(2, dev, "WLP: Found WSS %s. Enrolling.\n", dev_dbg(dev, "WLP: Found WSS %s. Enrolling.\n", buf);
buf);
} else { } else {
wssid_e = wlp_create_wssid_e(wlp, neighbor); wssid_e = wlp_create_wssid_e(wlp, neighbor);
if (wssid_e == NULL) { if (wssid_e == NULL) {
...@@ -660,9 +641,6 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp, ...@@ -660,9 +641,6 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp,
if (result < 0 && !enroll) /* this was a discovery */ if (result < 0 && !enroll) /* this was a discovery */
wlp_remove_neighbor_tmp_info(neighbor); wlp_remove_neighbor_tmp_info(neighbor);
out: out:
d_fnend(6, dev, "wlp %p, attr %p, neighbor %p, wss %p, buflen %d, "
"result %d \n", wlp, attr, neighbor, wss, (int)buflen,
(int)result);
return result; return result;
} }
...@@ -718,7 +696,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss, ...@@ -718,7 +696,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
struct sk_buff *_skb; struct sk_buff *_skb;
void *d1_itr; void *d1_itr;
d_fnstart(6, dev, "wlp %p\n", wlp);
if (wlp->dev_info == NULL) { if (wlp->dev_info == NULL) {
result = __wlp_setup_device_info(wlp); result = __wlp_setup_device_info(wlp);
if (result < 0) { if (result < 0) {
...@@ -728,24 +705,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss, ...@@ -728,24 +705,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
} }
} }
info = wlp->dev_info; info = wlp->dev_info;
d_printf(6, dev, "Local properties:\n"
"Device name (%d bytes): %s\n"
"Model name (%d bytes): %s\n"
"Manufacturer (%d bytes): %s\n"
"Model number (%d bytes): %s\n"
"Serial number (%d bytes): %s\n"
"Primary device type: \n"
" Category: %d \n"
" OUI: %02x:%02x:%02x \n"
" OUI Subdivision: %u \n",
(int)strlen(info->name), info->name,
(int)strlen(info->model_name), info->model_name,
(int)strlen(info->manufacturer), info->manufacturer,
(int)strlen(info->model_nr), info->model_nr,
(int)strlen(info->serial), info->serial,
info->prim_dev_type.category,
info->prim_dev_type.OUI[0], info->prim_dev_type.OUI[1],
info->prim_dev_type.OUI[2], info->prim_dev_type.OUIsubdiv);
_skb = dev_alloc_skb(sizeof(*_d1) _skb = dev_alloc_skb(sizeof(*_d1)
+ sizeof(struct wlp_attr_uuid_e) + sizeof(struct wlp_attr_uuid_e)
+ sizeof(struct wlp_attr_wss_sel_mthd) + 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,7 +727,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
goto error; goto error;
} }
_d1 = (void *) _skb->data; _d1 = (void *) _skb->data;
d_printf(6, dev, "D1 starts at %p \n", _d1);
_d1->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); _d1->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
_d1->hdr.type = WLP_FRAME_ASSOCIATION; _d1->hdr.type = WLP_FRAME_ASSOCIATION;
_d1->type = WLP_ASSOC_D1; _d1->type = WLP_ASSOC_D1;
...@@ -791,25 +749,8 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss, ...@@ -791,25 +749,8 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
used += wlp_set_prim_dev_type(d1_itr + used, &info->prim_dev_type); used += wlp_set_prim_dev_type(d1_itr + used, &info->prim_dev_type);
used += wlp_set_wlp_assc_err(d1_itr + used, WLP_ASSOC_ERROR_NONE); used += wlp_set_wlp_assc_err(d1_itr + used, WLP_ASSOC_ERROR_NONE);
skb_put(_skb, sizeof(*_d1) + used); skb_put(_skb, sizeof(*_d1) + used);
d_printf(6, dev, "D1 message:\n");
d_dump(6, dev, _d1, sizeof(*_d1)
+ sizeof(struct wlp_attr_uuid_e)
+ sizeof(struct wlp_attr_wss_sel_mthd)
+ sizeof(struct wlp_attr_dev_name)
+ strlen(info->name)
+ sizeof(struct wlp_attr_manufacturer)
+ strlen(info->manufacturer)
+ sizeof(struct wlp_attr_model_name)
+ strlen(info->model_name)
+ sizeof(struct wlp_attr_model_nr)
+ strlen(info->model_nr)
+ sizeof(struct wlp_attr_serial)
+ strlen(info->serial)
+ sizeof(struct wlp_attr_prim_dev_type)
+ sizeof(struct wlp_attr_wlp_assc_err));
*skb = _skb; *skb = _skb;
error: error:
d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
return result; return result;
} }
...@@ -837,7 +778,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss, ...@@ -837,7 +778,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
void *d2_itr; void *d2_itr;
size_t mem_needed; size_t mem_needed;
d_fnstart(6, dev, "wlp %p\n", wlp);
if (wlp->dev_info == NULL) { if (wlp->dev_info == NULL) {
result = __wlp_setup_device_info(wlp); result = __wlp_setup_device_info(wlp);
if (result < 0) { if (result < 0) {
...@@ -847,24 +787,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss, ...@@ -847,24 +787,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
} }
} }
info = wlp->dev_info; info = wlp->dev_info;
d_printf(6, dev, "Local properties:\n"
"Device name (%d bytes): %s\n"
"Model name (%d bytes): %s\n"
"Manufacturer (%d bytes): %s\n"
"Model number (%d bytes): %s\n"
"Serial number (%d bytes): %s\n"
"Primary device type: \n"
" Category: %d \n"
" OUI: %02x:%02x:%02x \n"
" OUI Subdivision: %u \n",
(int)strlen(info->name), info->name,
(int)strlen(info->model_name), info->model_name,
(int)strlen(info->manufacturer), info->manufacturer,
(int)strlen(info->model_nr), info->model_nr,
(int)strlen(info->serial), info->serial,
info->prim_dev_type.category,
info->prim_dev_type.OUI[0], info->prim_dev_type.OUI[1],
info->prim_dev_type.OUI[2], info->prim_dev_type.OUIsubdiv);
mem_needed = sizeof(*_d2) mem_needed = sizeof(*_d2)
+ sizeof(struct wlp_attr_uuid_e) + sizeof(struct wlp_attr_uuid_e)
+ sizeof(struct wlp_attr_uuid_r) + sizeof(struct wlp_attr_uuid_r)
...@@ -892,7 +814,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss, ...@@ -892,7 +814,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
goto error; goto error;
} }
_d2 = (void *) _skb->data; _d2 = (void *) _skb->data;
d_printf(6, dev, "D2 starts at %p \n", _d2);
_d2->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); _d2->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
_d2->hdr.type = WLP_FRAME_ASSOCIATION; _d2->hdr.type = WLP_FRAME_ASSOCIATION;
_d2->type = WLP_ASSOC_D2; _d2->type = WLP_ASSOC_D2;
...@@ -917,11 +838,8 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss, ...@@ -917,11 +838,8 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
used += wlp_set_prim_dev_type(d2_itr + used, &info->prim_dev_type); used += wlp_set_prim_dev_type(d2_itr + used, &info->prim_dev_type);
used += wlp_set_wlp_assc_err(d2_itr + used, WLP_ASSOC_ERROR_NONE); used += wlp_set_wlp_assc_err(d2_itr + used, WLP_ASSOC_ERROR_NONE);
skb_put(_skb, sizeof(*_d2) + used); skb_put(_skb, sizeof(*_d2) + used);
d_printf(6, dev, "D2 message:\n");
d_dump(6, dev, _d2, mem_needed);
*skb = _skb; *skb = _skb;
error: error:
d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
return result; return result;
} }
...@@ -947,7 +865,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb, ...@@ -947,7 +865,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
struct sk_buff *_skb; struct sk_buff *_skb;
struct wlp_nonce tmp; struct wlp_nonce tmp;
d_fnstart(6, dev, "wlp %p\n", wlp);
_skb = dev_alloc_skb(sizeof(*f0)); _skb = dev_alloc_skb(sizeof(*f0));
if (_skb == NULL) { if (_skb == NULL) {
dev_err(dev, "WLP: Unable to allocate memory for F0 " 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,7 +872,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
goto error_alloc; goto error_alloc;
} }
f0 = (void *) _skb->data; f0 = (void *) _skb->data;
d_printf(6, dev, "F0 starts at %p \n", f0);
f0->f0_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); f0->f0_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
f0->f0_hdr.hdr.type = WLP_FRAME_ASSOCIATION; f0->f0_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
f0->f0_hdr.type = WLP_ASSOC_F0; f0->f0_hdr.type = WLP_ASSOC_F0;
...@@ -969,7 +885,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb, ...@@ -969,7 +885,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
*skb = _skb; *skb = _skb;
result = 0; result = 0;
error_alloc: error_alloc:
d_fnend(6, dev, "wlp %p, result %d \n", wlp, result);
return result; return result;
} }
...@@ -1242,12 +1157,9 @@ void wlp_handle_d1_frame(struct work_struct *ws) ...@@ -1242,12 +1157,9 @@ void wlp_handle_d1_frame(struct work_struct *ws)
enum wlp_wss_sel_mthd sel_mthd = 0; enum wlp_wss_sel_mthd sel_mthd = 0;
struct wlp_device_info dev_info; struct wlp_device_info dev_info;
enum wlp_assc_error assc_err; enum wlp_assc_error assc_err;
char uuid[WLP_WSS_UUID_STRSIZE];
struct sk_buff *resp = NULL; struct sk_buff *resp = NULL;
/* Parse D1 frame */ /* Parse D1 frame */
d_fnstart(6, dev, "WLP: handle D1 frame. wlp = %p, skb = %p\n",
wlp, skb);
mutex_lock(&wss->mutex); mutex_lock(&wss->mutex);
mutex_lock(&wlp->mutex); /* to access wlp->uuid */ mutex_lock(&wlp->mutex); /* to access wlp->uuid */
memset(&dev_info, 0, sizeof(dev_info)); memset(&dev_info, 0, sizeof(dev_info));
...@@ -1258,30 +1170,6 @@ void wlp_handle_d1_frame(struct work_struct *ws) ...@@ -1258,30 +1170,6 @@ void wlp_handle_d1_frame(struct work_struct *ws)
kfree_skb(skb); kfree_skb(skb);
goto out; goto out;
} }
wlp_wss_uuid_print(uuid, sizeof(uuid), &uuid_e);
d_printf(6, dev, "From D1 frame:\n"
"UUID-E: %s\n"
"Selection method: %d\n"
"Device name (%d bytes): %s\n"
"Model name (%d bytes): %s\n"
"Manufacturer (%d bytes): %s\n"
"Model number (%d bytes): %s\n"
"Serial number (%d bytes): %s\n"
"Primary device type: \n"
" Category: %d \n"
" OUI: %02x:%02x:%02x \n"
" OUI Subdivision: %u \n",
uuid, sel_mthd,
(int)strlen(dev_info.name), dev_info.name,
(int)strlen(dev_info.model_name), dev_info.model_name,
(int)strlen(dev_info.manufacturer), dev_info.manufacturer,
(int)strlen(dev_info.model_nr), dev_info.model_nr,
(int)strlen(dev_info.serial), dev_info.serial,
dev_info.prim_dev_type.category,
dev_info.prim_dev_type.OUI[0],
dev_info.prim_dev_type.OUI[1],
dev_info.prim_dev_type.OUI[2],
dev_info.prim_dev_type.OUIsubdiv);
kfree_skb(skb); kfree_skb(skb);
if (!wlp_uuid_is_set(&wlp->uuid)) { if (!wlp_uuid_is_set(&wlp->uuid)) {
...@@ -1316,7 +1204,6 @@ void wlp_handle_d1_frame(struct work_struct *ws) ...@@ -1316,7 +1204,6 @@ void wlp_handle_d1_frame(struct work_struct *ws)
kfree(frame_ctx); kfree(frame_ctx);
mutex_unlock(&wlp->mutex); mutex_unlock(&wlp->mutex);
mutex_unlock(&wss->mutex); mutex_unlock(&wss->mutex);
d_fnend(6, dev, "WLP: handle D1 frame. wlp = %p\n", wlp);
} }
/** /**
...@@ -1546,10 +1433,8 @@ int wlp_parse_c3c4_frame(struct wlp *wlp, struct sk_buff *skb, ...@@ -1546,10 +1433,8 @@ int wlp_parse_c3c4_frame(struct wlp *wlp, struct sk_buff *skb,
void *ptr = skb->data; void *ptr = skb->data;
size_t len = skb->len; size_t len = skb->len;
size_t used; size_t used;
char buf[WLP_WSS_UUID_STRSIZE];
struct wlp_frame_assoc *assoc = ptr; struct wlp_frame_assoc *assoc = ptr;
d_fnstart(6, dev, "wlp %p, skb %p \n", wlp, skb);
used = sizeof(*assoc); used = sizeof(*assoc);
result = wlp_get_wssid(wlp, ptr + used, wssid, len - used); result = wlp_get_wssid(wlp, ptr + used, wssid, len - used);
if (result < 0) { if (result < 0) {
...@@ -1572,14 +1457,7 @@ int wlp_parse_c3c4_frame(struct wlp *wlp, struct sk_buff *skb, ...@@ -1572,14 +1457,7 @@ int wlp_parse_c3c4_frame(struct wlp *wlp, struct sk_buff *skb,
wlp_assoc_frame_str(assoc->type)); wlp_assoc_frame_str(assoc->type));
goto error_parse; goto error_parse;
} }
wlp_wss_uuid_print(buf, sizeof(buf), wssid);
d_printf(6, dev, "WLP: parsed: WSSID %s, tag 0x%02x, virt "
"%02x:%02x:%02x:%02x:%02x:%02x \n", buf, *tag,
virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
virt_addr->data[3], virt_addr->data[4], virt_addr->data[5]);
error_parse: error_parse:
d_fnend(6, dev, "wlp %p, skb %p, result = %d \n", wlp, skb, result);
return result; return result;
} }
...@@ -1600,7 +1478,6 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss, ...@@ -1600,7 +1478,6 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
} *c; } *c;
struct sk_buff *_skb; struct sk_buff *_skb;
d_fnstart(6, dev, "wlp %p, wss %p \n", wlp, wss);
_skb = dev_alloc_skb(sizeof(*c)); _skb = dev_alloc_skb(sizeof(*c));
if (_skb == NULL) { if (_skb == NULL) {
dev_err(dev, "WLP: Unable to allocate memory for C1/C2 " 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,7 +1485,6 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
goto error_alloc; goto error_alloc;
} }
c = (void *) _skb->data; c = (void *) _skb->data;
d_printf(6, dev, "C1/C2 starts at %p \n", c);
c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION; c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
c->c_hdr.type = type; c->c_hdr.type = type;
...@@ -1616,12 +1492,9 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss, ...@@ -1616,12 +1492,9 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
wlp_set_msg_type(&c->c_hdr.msg_type, type); wlp_set_msg_type(&c->c_hdr.msg_type, type);
wlp_set_wssid(&c->wssid, &wss->wssid); wlp_set_wssid(&c->wssid, &wss->wssid);
skb_put(_skb, sizeof(*c)); skb_put(_skb, sizeof(*c));
d_printf(6, dev, "C1/C2 message:\n");
d_dump(6, dev, c, sizeof(*c));
*skb = _skb; *skb = _skb;
result = 0; result = 0;
error_alloc: error_alloc:
d_fnend(6, dev, "wlp %p, wss %p, result %d \n", wlp, wss, result);
return result; return result;
} }
...@@ -1660,7 +1533,6 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss, ...@@ -1660,7 +1533,6 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
} *c; } *c;
struct sk_buff *_skb; struct sk_buff *_skb;
d_fnstart(6, dev, "wlp %p, wss %p \n", wlp, wss);
_skb = dev_alloc_skb(sizeof(*c)); _skb = dev_alloc_skb(sizeof(*c));
if (_skb == NULL) { if (_skb == NULL) {
dev_err(dev, "WLP: Unable to allocate memory for C3/C4 " 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,7 +1540,6 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
goto error_alloc; goto error_alloc;
} }
c = (void *) _skb->data; c = (void *) _skb->data;
d_printf(6, dev, "C3/C4 starts at %p \n", c);
c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION; c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
c->c_hdr.type = type; c->c_hdr.type = type;
...@@ -1678,12 +1549,9 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss, ...@@ -1678,12 +1549,9 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
wlp_set_wss_tag(&c->wss_tag, wss->tag); wlp_set_wss_tag(&c->wss_tag, wss->tag);
wlp_set_wss_virt(&c->wss_virt, &wss->virtual_addr); wlp_set_wss_virt(&c->wss_virt, &wss->virtual_addr);
skb_put(_skb, sizeof(*c)); skb_put(_skb, sizeof(*c));
d_printf(6, dev, "C3/C4 message:\n");
d_dump(6, dev, c, sizeof(*c));
*skb = _skb; *skb = _skb;
result = 0; result = 0;
error_alloc: error_alloc:
d_fnend(6, dev, "wlp %p, wss %p, result %d \n", wlp, wss, result);
return result; return result;
} }
...@@ -1709,10 +1577,7 @@ static int wlp_send_assoc_##type(struct wlp *wlp, struct wlp_wss *wss, \ ...@@ -1709,10 +1577,7 @@ static int wlp_send_assoc_##type(struct wlp *wlp, struct wlp_wss *wss, \
struct device *dev = &wlp->rc->uwb_dev.dev; \ struct device *dev = &wlp->rc->uwb_dev.dev; \
int result; \ int result; \
struct sk_buff *skb = NULL; \ struct sk_buff *skb = NULL; \
d_fnstart(6, dev, "wlp %p, wss %p, neighbor: %02x:%02x\n", \ \
wlp, wss, dev_addr->data[1], dev_addr->data[0]); \
d_printf(6, dev, "WLP: Constructing %s frame. \n", \
wlp_assoc_frame_str(id)); \
/* Build the frame */ \ /* Build the frame */ \
result = wlp_build_assoc_##type(wlp, wss, &skb); \ result = wlp_build_assoc_##type(wlp, wss, &skb); \
if (result < 0) { \ if (result < 0) { \
...@@ -1721,9 +1586,6 @@ static int wlp_send_assoc_##type(struct wlp *wlp, struct wlp_wss *wss, \ ...@@ -1721,9 +1586,6 @@ static int wlp_send_assoc_##type(struct wlp *wlp, struct wlp_wss *wss, \
goto error_build_assoc; \ goto error_build_assoc; \
} \ } \
/* Send the frame */ \ /* Send the frame */ \
d_printf(6, dev, "Transmitting %s frame to %02x:%02x \n", \
wlp_assoc_frame_str(id), \
dev_addr->data[1], dev_addr->data[0]); \
BUG_ON(wlp->xmit_frame == NULL); \ BUG_ON(wlp->xmit_frame == NULL); \
result = wlp->xmit_frame(wlp, skb, dev_addr); \ result = wlp->xmit_frame(wlp, skb, dev_addr); \
if (result < 0) { \ if (result < 0) { \
...@@ -1740,8 +1602,6 @@ error_xmit: \ ...@@ -1740,8 +1602,6 @@ error_xmit: \
/* We could try again ... */ \ /* We could try again ... */ \
dev_kfree_skb_any(skb);/*we need to free if tx fails*/ \ dev_kfree_skb_any(skb);/*we need to free if tx fails*/ \
error_build_assoc: \ error_build_assoc: \
d_fnend(6, dev, "wlp %p, wss %p, neighbor: %02x:%02x\n", \
wlp, wss, dev_addr->data[1], dev_addr->data[0]); \
return result; \ return result; \
} }
...@@ -1794,12 +1654,9 @@ void wlp_handle_c1_frame(struct work_struct *ws) ...@@ -1794,12 +1654,9 @@ void wlp_handle_c1_frame(struct work_struct *ws)
struct uwb_dev_addr *src = &frame_ctx->src; struct uwb_dev_addr *src = &frame_ctx->src;
int result; int result;
struct wlp_uuid wssid; struct wlp_uuid wssid;
char buf[WLP_WSS_UUID_STRSIZE];
struct sk_buff *resp = NULL; struct sk_buff *resp = NULL;
/* Parse C1 frame */ /* Parse C1 frame */
d_fnstart(6, dev, "WLP: handle C1 frame. wlp = %p, c1 = %p\n",
wlp, c1);
mutex_lock(&wss->mutex); mutex_lock(&wss->mutex);
result = wlp_get_wssid(wlp, (void *)c1 + sizeof(*c1), &wssid, result = wlp_get_wssid(wlp, (void *)c1 + sizeof(*c1), &wssid,
len - sizeof(*c1)); len - sizeof(*c1));
...@@ -1807,12 +1664,8 @@ void wlp_handle_c1_frame(struct work_struct *ws) ...@@ -1807,12 +1664,8 @@ void wlp_handle_c1_frame(struct work_struct *ws)
dev_err(dev, "WLP: unable to obtain WSSID from C1 frame.\n"); dev_err(dev, "WLP: unable to obtain WSSID from C1 frame.\n");
goto out; goto out;
} }
wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
d_printf(6, dev, "Received C1 frame with WSSID %s \n", buf);
if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)) if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))
&& wss->state == WLP_WSS_STATE_ACTIVE) { && wss->state == WLP_WSS_STATE_ACTIVE) {
d_printf(6, dev, "WSSID from C1 frame is known locally "
"and is active\n");
/* Construct C2 frame */ /* Construct C2 frame */
result = wlp_build_assoc_c2(wlp, wss, &resp); result = wlp_build_assoc_c2(wlp, wss, &resp);
if (result < 0) { if (result < 0) {
...@@ -1820,8 +1673,6 @@ void wlp_handle_c1_frame(struct work_struct *ws) ...@@ -1820,8 +1673,6 @@ void wlp_handle_c1_frame(struct work_struct *ws)
goto out; goto out;
} }
} else { } else {
d_printf(6, dev, "WSSID from C1 frame is not known locally "
"or is not active\n");
/* Construct F0 frame */ /* Construct F0 frame */
result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV); result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV);
if (result < 0) { if (result < 0) {
...@@ -1830,8 +1681,6 @@ void wlp_handle_c1_frame(struct work_struct *ws) ...@@ -1830,8 +1681,6 @@ void wlp_handle_c1_frame(struct work_struct *ws)
} }
} }
/* Send C2 frame */ /* Send C2 frame */
d_printf(6, dev, "Transmitting response (C2/F0) frame to %02x:%02x \n",
src->data[1], src->data[0]);
BUG_ON(wlp->xmit_frame == NULL); BUG_ON(wlp->xmit_frame == NULL);
result = wlp->xmit_frame(wlp, resp, src); result = wlp->xmit_frame(wlp, resp, src);
if (result < 0) { if (result < 0) {
...@@ -1846,7 +1695,6 @@ void wlp_handle_c1_frame(struct work_struct *ws) ...@@ -1846,7 +1695,6 @@ void wlp_handle_c1_frame(struct work_struct *ws)
kfree_skb(frame_ctx->skb); kfree_skb(frame_ctx->skb);
kfree(frame_ctx); kfree(frame_ctx);
mutex_unlock(&wss->mutex); mutex_unlock(&wss->mutex);
d_fnend(6, dev, "WLP: handle C1 frame. wlp = %p\n", wlp);
} }
/** /**
...@@ -1868,27 +1716,20 @@ void wlp_handle_c3_frame(struct work_struct *ws) ...@@ -1868,27 +1716,20 @@ void wlp_handle_c3_frame(struct work_struct *ws)
struct sk_buff *skb = frame_ctx->skb; struct sk_buff *skb = frame_ctx->skb;
struct uwb_dev_addr *src = &frame_ctx->src; struct uwb_dev_addr *src = &frame_ctx->src;
int result; int result;
char buf[WLP_WSS_UUID_STRSIZE];
struct sk_buff *resp = NULL; struct sk_buff *resp = NULL;
struct wlp_uuid wssid; struct wlp_uuid wssid;
u8 tag; u8 tag;
struct uwb_mac_addr virt_addr; struct uwb_mac_addr virt_addr;
/* Parse C3 frame */ /* Parse C3 frame */
d_fnstart(6, dev, "WLP: handle C3 frame. wlp = %p, skb = %p\n",
wlp, skb);
mutex_lock(&wss->mutex); mutex_lock(&wss->mutex);
result = wlp_parse_c3c4_frame(wlp, skb, &wssid, &tag, &virt_addr); result = wlp_parse_c3c4_frame(wlp, skb, &wssid, &tag, &virt_addr);
if (result < 0) { if (result < 0) {
dev_err(dev, "WLP: unable to obtain values from C3 frame.\n"); dev_err(dev, "WLP: unable to obtain values from C3 frame.\n");
goto out; goto out;
} }
wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
d_printf(6, dev, "Received C3 frame with WSSID %s \n", buf);
if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)) if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))
&& wss->state >= WLP_WSS_STATE_ACTIVE) { && wss->state >= WLP_WSS_STATE_ACTIVE) {
d_printf(6, dev, "WSSID from C3 frame is known locally "
"and is active\n");
result = wlp_eda_update_node(&wlp->eda, src, wss, result = wlp_eda_update_node(&wlp->eda, src, wss,
(void *) virt_addr.data, tag, (void *) virt_addr.data, tag,
WLP_WSS_CONNECTED); WLP_WSS_CONNECTED);
...@@ -1913,8 +1754,6 @@ void wlp_handle_c3_frame(struct work_struct *ws) ...@@ -1913,8 +1754,6 @@ void wlp_handle_c3_frame(struct work_struct *ws)
} }
} }
} else { } else {
d_printf(6, dev, "WSSID from C3 frame is not known locally "
"or is not active\n");
/* Construct F0 frame */ /* Construct F0 frame */
result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV); result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV);
if (result < 0) { if (result < 0) {
...@@ -1923,8 +1762,6 @@ void wlp_handle_c3_frame(struct work_struct *ws) ...@@ -1923,8 +1762,6 @@ void wlp_handle_c3_frame(struct work_struct *ws)
} }
} }
/* Send C4 frame */ /* Send C4 frame */
d_printf(6, dev, "Transmitting response (C4/F0) frame to %02x:%02x \n",
src->data[1], src->data[0]);
BUG_ON(wlp->xmit_frame == NULL); BUG_ON(wlp->xmit_frame == NULL);
result = wlp->xmit_frame(wlp, resp, src); result = wlp->xmit_frame(wlp, resp, src);
if (result < 0) { if (result < 0) {
...@@ -1939,8 +1776,6 @@ void wlp_handle_c3_frame(struct work_struct *ws) ...@@ -1939,8 +1776,6 @@ void wlp_handle_c3_frame(struct work_struct *ws)
kfree_skb(frame_ctx->skb); kfree_skb(frame_ctx->skb);
kfree(frame_ctx); kfree(frame_ctx);
mutex_unlock(&wss->mutex); mutex_unlock(&wss->mutex);
d_fnend(6, dev, "WLP: handle C3 frame. wlp = %p, skb = %p\n",
wlp, skb);
} }
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
* FIXME: Docs * FIXME: Docs
* *
*/ */
#include <linux/wlp.h> #include <linux/wlp.h>
#include "wlp-internal.h" #include "wlp-internal.h"
static static
......
...@@ -26,12 +26,10 @@ ...@@ -26,12 +26,10 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/wlp.h> #include <linux/wlp.h>
#define D_LOCAL 5
#include <linux/uwb/debug.h>
#include "wlp-internal.h"
#include "wlp-internal.h"
/** /*
* Direct incoming association msg to correct parsing routine * Direct incoming association msg to correct parsing routine
* *
* We only expect D1, E1, C1, C3 messages as new. All other incoming * 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,35 +46,31 @@ void wlp_direct_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
struct wlp_frame_assoc *assoc = (void *) skb->data; struct wlp_frame_assoc *assoc = (void *) skb->data;
struct wlp_assoc_frame_ctx *frame_ctx; struct wlp_assoc_frame_ctx *frame_ctx;
d_fnstart(5, dev, "wlp %p, skb %p\n", wlp, skb);
frame_ctx = kmalloc(sizeof(*frame_ctx), GFP_ATOMIC); frame_ctx = kmalloc(sizeof(*frame_ctx), GFP_ATOMIC);
if (frame_ctx == NULL) { if (frame_ctx == NULL) {
dev_err(dev, "WLP: Unable to allocate memory for association " dev_err(dev, "WLP: Unable to allocate memory for association "
"frame handling.\n"); "frame handling.\n");
kfree_skb(skb); kfree_skb(skb);
goto out; return;
} }
frame_ctx->wlp = wlp; frame_ctx->wlp = wlp;
frame_ctx->skb = skb; frame_ctx->skb = skb;
frame_ctx->src = *src; frame_ctx->src = *src;
switch (assoc->type) { switch (assoc->type) {
case WLP_ASSOC_D1: case WLP_ASSOC_D1:
d_printf(5, dev, "Received a D1 frame.\n");
INIT_WORK(&frame_ctx->ws, wlp_handle_d1_frame); INIT_WORK(&frame_ctx->ws, wlp_handle_d1_frame);
schedule_work(&frame_ctx->ws); schedule_work(&frame_ctx->ws);
break; break;
case WLP_ASSOC_E1: case WLP_ASSOC_E1:
d_printf(5, dev, "Received a E1 frame. FIXME?\n");
kfree_skb(skb); /* Temporary until we handle it */ kfree_skb(skb); /* Temporary until we handle it */
kfree(frame_ctx); /* Temporary until we handle it */ kfree(frame_ctx); /* Temporary until we handle it */
break; break;
case WLP_ASSOC_C1: case WLP_ASSOC_C1:
d_printf(5, dev, "Received a C1 frame.\n");
INIT_WORK(&frame_ctx->ws, wlp_handle_c1_frame); INIT_WORK(&frame_ctx->ws, wlp_handle_c1_frame);
schedule_work(&frame_ctx->ws); schedule_work(&frame_ctx->ws);
break; break;
case WLP_ASSOC_C3: case WLP_ASSOC_C3:
d_printf(5, dev, "Received a C3 frame.\n");
INIT_WORK(&frame_ctx->ws, wlp_handle_c3_frame); INIT_WORK(&frame_ctx->ws, wlp_handle_c3_frame);
schedule_work(&frame_ctx->ws); schedule_work(&frame_ctx->ws);
break; break;
...@@ -87,11 +81,9 @@ void wlp_direct_assoc_frame(struct wlp *wlp, struct sk_buff *skb, ...@@ -87,11 +81,9 @@ void wlp_direct_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
kfree(frame_ctx); kfree(frame_ctx);
break; break;
} }
out:
d_fnend(5, dev, "wlp %p\n", wlp);
} }
/** /*
* Process incoming association frame * Process incoming association frame
* *
* Although it could be possible to deal with some incoming association * 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,7 +104,6 @@ void wlp_receive_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
struct wlp_frame_assoc *assoc = (void *) skb->data; struct wlp_frame_assoc *assoc = (void *) skb->data;
struct wlp_session *session = wlp->session; struct wlp_session *session = wlp->session;
u8 version; u8 version;
d_fnstart(5, dev, "wlp %p, skb %p\n", wlp, skb);
if (wlp_get_version(wlp, &assoc->version, &version, if (wlp_get_version(wlp, &assoc->version, &version,
sizeof(assoc->version)) < 0) sizeof(assoc->version)) < 0)
...@@ -150,14 +141,12 @@ void wlp_receive_assoc_frame(struct wlp *wlp, struct sk_buff *skb, ...@@ -150,14 +141,12 @@ void wlp_receive_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
} else { } else {
wlp_direct_assoc_frame(wlp, skb, src); wlp_direct_assoc_frame(wlp, skb, src);
} }
d_fnend(5, dev, "wlp %p\n", wlp);
return; return;
error: error:
kfree_skb(skb); kfree_skb(skb);
d_fnend(5, dev, "wlp %p\n", wlp);
} }
/** /*
* Verify incoming frame is from connected neighbor, prep to pass to WLP client * Verify incoming frame is from connected neighbor, prep to pass to WLP client
* *
* Verification proceeds according to WLP 0.99 [7.3.1]. The source address * 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,7 +165,6 @@ int wlp_verify_prep_rx_frame(struct wlp *wlp, struct sk_buff *skb,
struct wlp_eda_node eda_entry; struct wlp_eda_node eda_entry;
struct wlp_frame_std_abbrv_hdr *hdr = (void *) skb->data; struct wlp_frame_std_abbrv_hdr *hdr = (void *) skb->data;
d_fnstart(6, dev, "wlp %p, skb %p \n", wlp, skb);
/*verify*/ /*verify*/
result = wlp_copy_eda_node(&wlp->eda, src, &eda_entry); result = wlp_copy_eda_node(&wlp->eda, src, &eda_entry);
if (result < 0) { if (result < 0) {
...@@ -207,11 +195,10 @@ int wlp_verify_prep_rx_frame(struct wlp *wlp, struct sk_buff *skb, ...@@ -207,11 +195,10 @@ int wlp_verify_prep_rx_frame(struct wlp *wlp, struct sk_buff *skb,
/*prep*/ /*prep*/
skb_pull(skb, sizeof(*hdr)); skb_pull(skb, sizeof(*hdr));
out: out:
d_fnend(6, dev, "wlp %p, skb %p, result = %d \n", wlp, skb, result);
return result; return result;
} }
/** /*
* Receive a WLP frame from device * Receive a WLP frame from device
* *
* @returns: 1 if calling function should free the skb * @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,14 +213,12 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb,
struct wlp_frame_hdr *hdr; struct wlp_frame_hdr *hdr;
int result = 0; int result = 0;
d_fnstart(6, dev, "skb (%p), len (%u)\n", skb, len);
if (len < sizeof(*hdr)) { if (len < sizeof(*hdr)) {
dev_err(dev, "Not enough data to parse WLP header.\n"); dev_err(dev, "Not enough data to parse WLP header.\n");
result = -EINVAL; result = -EINVAL;
goto out; goto out;
} }
hdr = ptr; hdr = ptr;
d_dump(6, dev, hdr, sizeof(*hdr));
if (le16_to_cpu(hdr->mux_hdr) != WLP_PROTOCOL_ID) { if (le16_to_cpu(hdr->mux_hdr) != WLP_PROTOCOL_ID) {
dev_err(dev, "Not a WLP frame type.\n"); dev_err(dev, "Not a WLP frame type.\n");
result = -EINVAL; result = -EINVAL;
...@@ -270,7 +255,6 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb, ...@@ -270,7 +255,6 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb,
"WLP header.\n"); "WLP header.\n");
goto out; goto out;
} }
d_printf(5, dev, "Association frame received.\n");
wlp_receive_assoc_frame(wlp, skb, src); wlp_receive_assoc_frame(wlp, skb, src);
break; break;
default: default:
...@@ -283,13 +267,12 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb, ...@@ -283,13 +267,12 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb,
kfree_skb(skb); kfree_skb(skb);
result = 0; result = 0;
} }
d_fnend(6, dev, "skb (%p)\n", skb);
return result; return result;
} }
EXPORT_SYMBOL_GPL(wlp_receive_frame); EXPORT_SYMBOL_GPL(wlp_receive_frame);
/** /*
* Verify frame from network stack, prepare for further transmission * Verify frame from network stack, prepare for further transmission
* *
* @skb: the socket buffer that needs to be prepared for transmission (it * @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,9 +326,7 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
int result = -EINVAL; int result = -EINVAL;
struct ethhdr *eth_hdr = (void *) skb->data; struct ethhdr *eth_hdr = (void *) skb->data;
d_fnstart(6, dev, "wlp (%p), skb (%p) \n", wlp, skb);
if (is_broadcast_ether_addr(eth_hdr->h_dest)) { if (is_broadcast_ether_addr(eth_hdr->h_dest)) {
d_printf(6, dev, "WLP: handling broadcast frame. \n");
result = wlp_eda_for_each(&wlp->eda, wlp_wss_send_copy, skb); result = wlp_eda_for_each(&wlp->eda, wlp_wss_send_copy, skb);
if (result < 0) { if (result < 0) {
if (printk_ratelimit()) if (printk_ratelimit())
...@@ -357,7 +338,6 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp, ...@@ -357,7 +338,6 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
result = 1; result = 1;
/* Frame will be transmitted by WLP. */ /* Frame will be transmitted by WLP. */
} else { } else {
d_printf(6, dev, "WLP: handling unicast frame. \n");
result = wlp_eda_for_virtual(&wlp->eda, eth_hdr->h_dest, dst, result = wlp_eda_for_virtual(&wlp->eda, eth_hdr->h_dest, dst,
wlp_wss_prep_hdr, skb); wlp_wss_prep_hdr, skb);
if (unlikely(result < 0)) { if (unlikely(result < 0)) {
...@@ -368,7 +348,6 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp, ...@@ -368,7 +348,6 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
} }
} }
out: out:
d_fnend(6, dev, "wlp (%p), skb (%p). result = %d \n", wlp, skb, result);
return result; return result;
} }
EXPORT_SYMBOL_GPL(wlp_prepare_tx_frame); EXPORT_SYMBOL_GPL(wlp_prepare_tx_frame);
...@@ -21,12 +21,9 @@ ...@@ -21,12 +21,9 @@
* *
* FIXME: docs * FIXME: docs
*/ */
#include <linux/wlp.h> #include <linux/wlp.h>
#define D_LOCAL 6
#include <linux/uwb/debug.h>
#include "wlp-internal.h"
#include "wlp-internal.h"
static static
void wlp_neighbor_init(struct wlp_neighbor_e *neighbor) void wlp_neighbor_init(struct wlp_neighbor_e *neighbor)
...@@ -61,11 +58,6 @@ int __wlp_alloc_device_info(struct wlp *wlp) ...@@ -61,11 +58,6 @@ int __wlp_alloc_device_info(struct wlp *wlp)
static static
void __wlp_fill_device_info(struct wlp *wlp) void __wlp_fill_device_info(struct wlp *wlp)
{ {
struct device *dev = &wlp->rc->uwb_dev.dev;
BUG_ON(wlp->fill_device_info == NULL);
d_printf(6, dev, "Retrieving device information "
"from device driver.\n");
wlp->fill_device_info(wlp, wlp->dev_info); wlp->fill_device_info(wlp, wlp->dev_info);
} }
...@@ -127,7 +119,7 @@ void wlp_remove_neighbor_tmp_info(struct wlp_neighbor_e *neighbor) ...@@ -127,7 +119,7 @@ void wlp_remove_neighbor_tmp_info(struct wlp_neighbor_e *neighbor)
} }
} }
/** /*
* Populate WLP neighborhood cache with neighbor information * Populate WLP neighborhood cache with neighbor information
* *
* A new neighbor is found. If it is discoverable then we add it to the * 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,10 +133,7 @@ int wlp_add_neighbor(struct wlp *wlp, struct uwb_dev *dev)
int discoverable; int discoverable;
struct wlp_neighbor_e *neighbor; struct wlp_neighbor_e *neighbor;
d_fnstart(6, &dev->dev, "uwb %p \n", dev); /*
d_printf(6, &dev->dev, "Found neighbor device %02x:%02x \n",
dev->dev_addr.data[1], dev->dev_addr.data[0]);
/**
* FIXME: * FIXME:
* Use contents of WLP IE found in beacon cache to determine if * Use contents of WLP IE found in beacon cache to determine if
* neighbor is discoverable. * neighbor is discoverable.
...@@ -167,7 +156,6 @@ int wlp_add_neighbor(struct wlp *wlp, struct uwb_dev *dev) ...@@ -167,7 +156,6 @@ int wlp_add_neighbor(struct wlp *wlp, struct uwb_dev *dev)
list_add(&neighbor->node, &wlp->neighbors); list_add(&neighbor->node, &wlp->neighbors);
} }
error_no_mem: error_no_mem:
d_fnend(6, &dev->dev, "uwb %p, result = %d \n", dev, result);
return result; return result;
} }
...@@ -255,8 +243,6 @@ int wlp_d1d2_exchange(struct wlp *wlp, struct wlp_neighbor_e *neighbor, ...@@ -255,8 +243,6 @@ int wlp_d1d2_exchange(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
dev_err(dev, "Unable to send D1 frame to neighbor " dev_err(dev, "Unable to send D1 frame to neighbor "
"%02x:%02x (%d)\n", dev_addr->data[1], "%02x:%02x (%d)\n", dev_addr->data[1],
dev_addr->data[0], result); dev_addr->data[0], result);
d_printf(6, dev, "Add placeholders into buffer next to "
"neighbor information we have (dev address).\n");
goto out; goto out;
} }
/* Create session, wait for response */ /* Create session, wait for response */
...@@ -284,8 +270,6 @@ int wlp_d1d2_exchange(struct wlp *wlp, struct wlp_neighbor_e *neighbor, ...@@ -284,8 +270,6 @@ int wlp_d1d2_exchange(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
/* Parse message in session->data: it will be either D2 or F0 */ /* Parse message in session->data: it will be either D2 or F0 */
skb = session.data; skb = session.data;
resp = (void *) skb->data; resp = (void *) skb->data;
d_printf(6, dev, "Received response to D1 frame. \n");
d_dump(6, dev, skb->data, skb->len > 72 ? 72 : skb->len);
if (resp->type == WLP_ASSOC_F0) { if (resp->type == WLP_ASSOC_F0) {
result = wlp_parse_f0(wlp, skb); result = wlp_parse_f0(wlp, skb);
...@@ -337,10 +321,9 @@ int wlp_enroll_neighbor(struct wlp *wlp, struct wlp_neighbor_e *neighbor, ...@@ -337,10 +321,9 @@ int wlp_enroll_neighbor(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
char buf[WLP_WSS_UUID_STRSIZE]; char buf[WLP_WSS_UUID_STRSIZE];
struct uwb_dev_addr *dev_addr = &neighbor->uwb_dev->dev_addr; struct uwb_dev_addr *dev_addr = &neighbor->uwb_dev->dev_addr;
wlp_wss_uuid_print(buf, sizeof(buf), wssid); wlp_wss_uuid_print(buf, sizeof(buf), wssid);
d_fnstart(6, dev, "wlp %p, neighbor %p, wss %p, wssid %p (%s)\n",
wlp, neighbor, wss, wssid, buf);
d_printf(6, dev, "Complete me.\n");
result = wlp_d1d2_exchange(wlp, neighbor, wss, wssid); result = wlp_d1d2_exchange(wlp, neighbor, wss, wssid);
if (result < 0) { if (result < 0) {
dev_err(dev, "WLP: D1/D2 message exchange for enrollment " 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,13 +343,10 @@ int wlp_enroll_neighbor(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
goto error; goto error;
} else { } else {
wss->state = WLP_WSS_STATE_ENROLLED; wss->state = WLP_WSS_STATE_ENROLLED;
d_printf(2, dev, "WLP: Success Enrollment into unsecure WSS " dev_dbg(dev, "WLP: Success Enrollment into unsecure WSS "
"%s using neighbor %02x:%02x. \n", buf, "%s using neighbor %02x:%02x. \n",
dev_addr->data[1], dev_addr->data[0]); buf, dev_addr->data[1], dev_addr->data[0]);
} }
d_fnend(6, dev, "wlp %p, neighbor %p, wss %p, wssid %p (%s)\n",
wlp, neighbor, wss, wssid, buf);
out: out:
return result; return result;
error: error:
...@@ -449,7 +429,6 @@ ssize_t wlp_discover(struct wlp *wlp) ...@@ -449,7 +429,6 @@ ssize_t wlp_discover(struct wlp *wlp)
int result = 0; int result = 0;
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
d_fnstart(6, dev, "wlp %p \n", wlp);
mutex_lock(&wlp->nbmutex); mutex_lock(&wlp->nbmutex);
/* Clear current neighborhood cache. */ /* Clear current neighborhood cache. */
__wlp_neighbors_release(wlp); __wlp_neighbors_release(wlp);
...@@ -469,7 +448,6 @@ ssize_t wlp_discover(struct wlp *wlp) ...@@ -469,7 +448,6 @@ ssize_t wlp_discover(struct wlp *wlp)
} }
error_dev_for_each: error_dev_for_each:
mutex_unlock(&wlp->nbmutex); mutex_unlock(&wlp->nbmutex);
d_fnend(6, dev, "wlp %p \n", wlp);
return result; return result;
} }
...@@ -492,9 +470,6 @@ void wlp_uwb_notifs_cb(void *_wlp, struct uwb_dev *uwb_dev, ...@@ -492,9 +470,6 @@ void wlp_uwb_notifs_cb(void *_wlp, struct uwb_dev *uwb_dev,
int result; int result;
switch (event) { switch (event) {
case UWB_NOTIF_ONAIR: case UWB_NOTIF_ONAIR:
d_printf(6, dev, "UWB device %02x:%02x is onair\n",
uwb_dev->dev_addr.data[1],
uwb_dev->dev_addr.data[0]);
result = wlp_eda_create_node(&wlp->eda, result = wlp_eda_create_node(&wlp->eda,
uwb_dev->mac_addr.data, uwb_dev->mac_addr.data,
&uwb_dev->dev_addr); &uwb_dev->dev_addr);
...@@ -505,18 +480,11 @@ void wlp_uwb_notifs_cb(void *_wlp, struct uwb_dev *uwb_dev, ...@@ -505,18 +480,11 @@ void wlp_uwb_notifs_cb(void *_wlp, struct uwb_dev *uwb_dev,
uwb_dev->dev_addr.data[0]); uwb_dev->dev_addr.data[0]);
break; break;
case UWB_NOTIF_OFFAIR: case UWB_NOTIF_OFFAIR:
d_printf(6, dev, "UWB device %02x:%02x is offair\n",
uwb_dev->dev_addr.data[1],
uwb_dev->dev_addr.data[0]);
wlp_eda_rm_node(&wlp->eda, &uwb_dev->dev_addr); wlp_eda_rm_node(&wlp->eda, &uwb_dev->dev_addr);
mutex_lock(&wlp->nbmutex); mutex_lock(&wlp->nbmutex);
list_for_each_entry_safe(neighbor, next, &wlp->neighbors, list_for_each_entry_safe(neighbor, next, &wlp->neighbors, node) {
node) { if (neighbor->uwb_dev == uwb_dev)
if (neighbor->uwb_dev == uwb_dev) {
d_printf(6, dev, "Removing device from "
"neighborhood.\n");
__wlp_neighbor_release(neighbor); __wlp_neighbor_release(neighbor);
}
} }
mutex_unlock(&wlp->nbmutex); mutex_unlock(&wlp->nbmutex);
break; break;
...@@ -538,14 +506,13 @@ static void wlp_channel_changed(struct uwb_pal *pal, int channel) ...@@ -538,14 +506,13 @@ static void wlp_channel_changed(struct uwb_pal *pal, int channel)
int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev) int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev)
{ {
struct device *dev = &rc->uwb_dev.dev;
int result; int result;
d_fnstart(6, dev, "wlp %p\n", wlp);
BUG_ON(wlp->fill_device_info == NULL); BUG_ON(wlp->fill_device_info == NULL);
BUG_ON(wlp->xmit_frame == NULL); BUG_ON(wlp->xmit_frame == NULL);
BUG_ON(wlp->stop_queue == NULL); BUG_ON(wlp->stop_queue == NULL);
BUG_ON(wlp->start_queue == NULL); BUG_ON(wlp->start_queue == NULL);
wlp->rc = rc; wlp->rc = rc;
wlp->ndev = ndev; wlp->ndev = ndev;
wlp_eda_init(&wlp->eda);/* Set up address cache */ 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,15 +527,12 @@ int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev)
if (result < 0) if (result < 0)
uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler); uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler);
d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
return result; return result;
} }
EXPORT_SYMBOL_GPL(wlp_setup); EXPORT_SYMBOL_GPL(wlp_setup);
void wlp_remove(struct wlp *wlp) void wlp_remove(struct wlp *wlp)
{ {
struct device *dev = &wlp->rc->uwb_dev.dev;
d_fnstart(6, dev, "wlp %p\n", wlp);
wlp_neighbors_release(wlp); wlp_neighbors_release(wlp);
uwb_pal_unregister(&wlp->pal); uwb_pal_unregister(&wlp->pal);
uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler); uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler);
...@@ -578,9 +542,6 @@ void wlp_remove(struct wlp *wlp) ...@@ -578,9 +542,6 @@ void wlp_remove(struct wlp *wlp)
kfree(wlp->dev_info); kfree(wlp->dev_info);
mutex_unlock(&wlp->mutex); mutex_unlock(&wlp->mutex);
wlp->rc = NULL; wlp->rc = NULL;
/* We have to use NULL here because this function can be called
* when the device disappeared. */
d_fnend(6, NULL, "wlp %p\n", wlp);
} }
EXPORT_SYMBOL_GPL(wlp_remove); EXPORT_SYMBOL_GPL(wlp_remove);
......
...@@ -43,14 +43,11 @@ ...@@ -43,14 +43,11 @@
* wlp_wss_release() * wlp_wss_release()
* wlp_wss_reset() * wlp_wss_reset()
*/ */
#include <linux/etherdevice.h> /* for is_valid_ether_addr */ #include <linux/etherdevice.h> /* for is_valid_ether_addr */
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/wlp.h> #include <linux/wlp.h>
#define D_LOCAL 5
#include <linux/uwb/debug.h>
#include "wlp-internal.h"
#include "wlp-internal.h"
size_t wlp_wss_key_print(char *buf, size_t bufsize, u8 *key) size_t wlp_wss_key_print(char *buf, size_t bufsize, u8 *key)
{ {
...@@ -116,9 +113,6 @@ struct uwb_mac_addr wlp_wss_sel_bcast_addr(struct wlp_wss *wss) ...@@ -116,9 +113,6 @@ struct uwb_mac_addr wlp_wss_sel_bcast_addr(struct wlp_wss *wss)
*/ */
void wlp_wss_reset(struct wlp_wss *wss) void wlp_wss_reset(struct wlp_wss *wss)
{ {
struct wlp *wlp = container_of(wss, struct wlp, wss);
struct device *dev = &wlp->rc->uwb_dev.dev;
d_fnstart(5, dev, "wss (%p) \n", wss);
memset(&wss->wssid, 0, sizeof(wss->wssid)); memset(&wss->wssid, 0, sizeof(wss->wssid));
wss->hash = 0; wss->hash = 0;
memset(&wss->name[0], 0, sizeof(wss->name)); memset(&wss->name[0], 0, sizeof(wss->name));
...@@ -127,7 +121,6 @@ void wlp_wss_reset(struct wlp_wss *wss) ...@@ -127,7 +121,6 @@ void wlp_wss_reset(struct wlp_wss *wss)
memset(&wss->master_key[0], 0, sizeof(wss->master_key)); memset(&wss->master_key[0], 0, sizeof(wss->master_key));
wss->tag = 0; wss->tag = 0;
wss->state = WLP_WSS_STATE_NONE; wss->state = WLP_WSS_STATE_NONE;
d_fnend(5, dev, "wss (%p) \n", wss);
} }
/** /**
...@@ -145,7 +138,6 @@ int wlp_wss_sysfs_add(struct wlp_wss *wss, char *wssid_str) ...@@ -145,7 +138,6 @@ int wlp_wss_sysfs_add(struct wlp_wss *wss, char *wssid_str)
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
int result; int result;
d_fnstart(5, dev, "wss (%p), wssid: %s\n", wss, wssid_str);
result = kobject_set_name(&wss->kobj, "wss-%s", wssid_str); result = kobject_set_name(&wss->kobj, "wss-%s", wssid_str);
if (result < 0) if (result < 0)
return result; return result;
...@@ -162,7 +154,6 @@ int wlp_wss_sysfs_add(struct wlp_wss *wss, char *wssid_str) ...@@ -162,7 +154,6 @@ int wlp_wss_sysfs_add(struct wlp_wss *wss, char *wssid_str)
result); result);
goto error_sysfs_create_group; goto error_sysfs_create_group;
} }
d_fnend(5, dev, "Completed. result = %d \n", result);
return 0; return 0;
error_sysfs_create_group: error_sysfs_create_group:
...@@ -214,22 +205,14 @@ int wlp_wss_enroll_target(struct wlp_wss *wss, struct wlp_uuid *wssid, ...@@ -214,22 +205,14 @@ int wlp_wss_enroll_target(struct wlp_wss *wss, struct wlp_uuid *wssid,
struct wlp *wlp = container_of(wss, struct wlp, wss); struct wlp *wlp = container_of(wss, struct wlp, wss);
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
struct wlp_neighbor_e *neighbor; struct wlp_neighbor_e *neighbor;
char buf[WLP_WSS_UUID_STRSIZE];
int result = -ENXIO; int result = -ENXIO;
struct uwb_dev_addr *dev_addr; struct uwb_dev_addr *dev_addr;
wlp_wss_uuid_print(buf, sizeof(buf), wssid);
d_fnstart(5, dev, "wss %p, wssid %s, registrar %02x:%02x \n",
wss, buf, dest->data[1], dest->data[0]);
mutex_lock(&wlp->nbmutex); mutex_lock(&wlp->nbmutex);
list_for_each_entry(neighbor, &wlp->neighbors, node) { list_for_each_entry(neighbor, &wlp->neighbors, node) {
dev_addr = &neighbor->uwb_dev->dev_addr; dev_addr = &neighbor->uwb_dev->dev_addr;
if (!memcmp(dest, dev_addr, sizeof(*dest))) { if (!memcmp(dest, dev_addr, sizeof(*dest))) {
d_printf(5, dev, "Neighbor %02x:%02x is valid, " result = wlp_enroll_neighbor(wlp, neighbor, wss, wssid);
"enrolling. \n",
dev_addr->data[1], dev_addr->data[0]);
result = wlp_enroll_neighbor(wlp, neighbor, wss,
wssid);
break; break;
} }
} }
...@@ -237,8 +220,6 @@ int wlp_wss_enroll_target(struct wlp_wss *wss, struct wlp_uuid *wssid, ...@@ -237,8 +220,6 @@ int wlp_wss_enroll_target(struct wlp_wss *wss, struct wlp_uuid *wssid,
dev_err(dev, "WLP: Cannot find neighbor %02x:%02x. \n", dev_err(dev, "WLP: Cannot find neighbor %02x:%02x. \n",
dest->data[1], dest->data[0]); dest->data[1], dest->data[0]);
mutex_unlock(&wlp->nbmutex); mutex_unlock(&wlp->nbmutex);
d_fnend(5, dev, "wss %p, wssid %s, registrar %02x:%02x, result %d \n",
wss, buf, dest->data[1], dest->data[0], result);
return result; return result;
} }
...@@ -260,16 +241,11 @@ int wlp_wss_enroll_discovered(struct wlp_wss *wss, struct wlp_uuid *wssid) ...@@ -260,16 +241,11 @@ int wlp_wss_enroll_discovered(struct wlp_wss *wss, struct wlp_uuid *wssid)
char buf[WLP_WSS_UUID_STRSIZE]; char buf[WLP_WSS_UUID_STRSIZE];
int result = -ENXIO; int result = -ENXIO;
wlp_wss_uuid_print(buf, sizeof(buf), wssid);
d_fnstart(5, dev, "wss %p, wssid %s \n", wss, buf);
mutex_lock(&wlp->nbmutex); mutex_lock(&wlp->nbmutex);
list_for_each_entry(neighbor, &wlp->neighbors, node) { list_for_each_entry(neighbor, &wlp->neighbors, node) {
list_for_each_entry(wssid_e, &neighbor->wssid, node) { list_for_each_entry(wssid_e, &neighbor->wssid, node) {
if (!memcmp(wssid, &wssid_e->wssid, sizeof(*wssid))) { if (!memcmp(wssid, &wssid_e->wssid, sizeof(*wssid))) {
d_printf(5, dev, "Found WSSID %s in neighbor "
"%02x:%02x cache. \n", buf,
neighbor->uwb_dev->dev_addr.data[1],
neighbor->uwb_dev->dev_addr.data[0]);
result = wlp_enroll_neighbor(wlp, neighbor, result = wlp_enroll_neighbor(wlp, neighbor,
wss, wssid); wss, wssid);
if (result == 0) /* enrollment success */ if (result == 0) /* enrollment success */
...@@ -279,10 +255,11 @@ int wlp_wss_enroll_discovered(struct wlp_wss *wss, struct wlp_uuid *wssid) ...@@ -279,10 +255,11 @@ int wlp_wss_enroll_discovered(struct wlp_wss *wss, struct wlp_uuid *wssid)
} }
} }
out: out:
if (result == -ENXIO) if (result == -ENXIO) {
wlp_wss_uuid_print(buf, sizeof(buf), wssid);
dev_err(dev, "WLP: Cannot find WSSID %s in cache. \n", buf); dev_err(dev, "WLP: Cannot find WSSID %s in cache. \n", buf);
}
mutex_unlock(&wlp->nbmutex); mutex_unlock(&wlp->nbmutex);
d_fnend(5, dev, "wss %p, wssid %s, result %d \n", wss, buf, result);
return result; return result;
} }
...@@ -307,27 +284,22 @@ int wlp_wss_enroll(struct wlp_wss *wss, struct wlp_uuid *wssid, ...@@ -307,27 +284,22 @@ int wlp_wss_enroll(struct wlp_wss *wss, struct wlp_uuid *wssid,
struct uwb_dev_addr bcast = {.data = {0xff, 0xff} }; struct uwb_dev_addr bcast = {.data = {0xff, 0xff} };
wlp_wss_uuid_print(buf, sizeof(buf), wssid); wlp_wss_uuid_print(buf, sizeof(buf), wssid);
if (wss->state != WLP_WSS_STATE_NONE) { if (wss->state != WLP_WSS_STATE_NONE) {
dev_err(dev, "WLP: Already enrolled in WSS %s.\n", buf); dev_err(dev, "WLP: Already enrolled in WSS %s.\n", buf);
result = -EEXIST; result = -EEXIST;
goto error; goto error;
} }
if (!memcmp(&bcast, devaddr, sizeof(bcast))) { if (!memcmp(&bcast, devaddr, sizeof(bcast)))
d_printf(5, dev, "Request to enroll in discovered WSS "
"with WSSID %s \n", buf);
result = wlp_wss_enroll_discovered(wss, wssid); result = wlp_wss_enroll_discovered(wss, wssid);
} else { else
d_printf(5, dev, "Request to enroll in WSSID %s with "
"registrar %02x:%02x\n", buf, devaddr->data[1],
devaddr->data[0]);
result = wlp_wss_enroll_target(wss, wssid, devaddr); result = wlp_wss_enroll_target(wss, wssid, devaddr);
}
if (result < 0) { if (result < 0) {
dev_err(dev, "WLP: Unable to enroll into WSS %s, result %d \n", dev_err(dev, "WLP: Unable to enroll into WSS %s, result %d \n",
buf, result); buf, result);
goto error; goto error;
} }
d_printf(2, dev, "Successfully enrolled into WSS %s \n", buf); dev_dbg(dev, "Successfully enrolled into WSS %s \n", buf);
result = wlp_wss_sysfs_add(wss, buf); result = wlp_wss_sysfs_add(wss, buf);
if (result < 0) { if (result < 0) {
dev_err(dev, "WLP: Unable to set up sysfs for WSS kobject.\n"); 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,7 +335,6 @@ int wlp_wss_activate(struct wlp_wss *wss)
u8 hash; /* only include one hash */ u8 hash; /* only include one hash */
} ie_data; } ie_data;
d_fnstart(5, dev, "Activating WSS %p. \n", wss);
BUG_ON(wss->state != WLP_WSS_STATE_ENROLLED); BUG_ON(wss->state != WLP_WSS_STATE_ENROLLED);
wss->hash = wlp_wss_comp_wssid_hash(&wss->wssid); wss->hash = wlp_wss_comp_wssid_hash(&wss->wssid);
wss->tag = wss->hash; wss->tag = wss->hash;
...@@ -382,7 +353,6 @@ int wlp_wss_activate(struct wlp_wss *wss) ...@@ -382,7 +353,6 @@ int wlp_wss_activate(struct wlp_wss *wss)
wss->state = WLP_WSS_STATE_ACTIVE; wss->state = WLP_WSS_STATE_ACTIVE;
result = 0; result = 0;
error_wlp_ie: error_wlp_ie:
d_fnend(5, dev, "Activating WSS %p, result = %d \n", wss, result);
return result; return result;
} }
...@@ -405,7 +375,6 @@ int wlp_wss_enroll_activate(struct wlp_wss *wss, struct wlp_uuid *wssid, ...@@ -405,7 +375,6 @@ int wlp_wss_enroll_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
int result = 0; int result = 0;
char buf[WLP_WSS_UUID_STRSIZE]; char buf[WLP_WSS_UUID_STRSIZE];
d_fnstart(5, dev, "Enrollment and activation requested. \n");
mutex_lock(&wss->mutex); mutex_lock(&wss->mutex);
result = wlp_wss_enroll(wss, wssid, devaddr); result = wlp_wss_enroll(wss, wssid, devaddr);
if (result < 0) { if (result < 0) {
...@@ -424,7 +393,6 @@ int wlp_wss_enroll_activate(struct wlp_wss *wss, struct wlp_uuid *wssid, ...@@ -424,7 +393,6 @@ int wlp_wss_enroll_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
error_activate: error_activate:
error_enroll: error_enroll:
mutex_unlock(&wss->mutex); mutex_unlock(&wss->mutex);
d_fnend(5, dev, "Completed. result = %d \n", result);
return result; return result;
} }
...@@ -447,11 +415,9 @@ int wlp_wss_create_activate(struct wlp_wss *wss, struct wlp_uuid *wssid, ...@@ -447,11 +415,9 @@ int wlp_wss_create_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
int result = 0; int result = 0;
char buf[WLP_WSS_UUID_STRSIZE]; char buf[WLP_WSS_UUID_STRSIZE];
d_fnstart(5, dev, "Request to create new WSS.\n");
result = wlp_wss_uuid_print(buf, sizeof(buf), wssid); result = wlp_wss_uuid_print(buf, sizeof(buf), wssid);
d_printf(5, dev, "Request to create WSS: WSSID=%s, name=%s, "
"sec_status=%u, accepting enrollment=%u \n",
buf, name, sec_status, accept);
if (!mutex_trylock(&wss->mutex)) { if (!mutex_trylock(&wss->mutex)) {
dev_err(dev, "WLP: WLP association session in progress.\n"); dev_err(dev, "WLP: WLP association session in progress.\n");
return -EBUSY; return -EBUSY;
...@@ -498,7 +464,6 @@ int wlp_wss_create_activate(struct wlp_wss *wss, struct wlp_uuid *wssid, ...@@ -498,7 +464,6 @@ int wlp_wss_create_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
result = 0; result = 0;
out: out:
mutex_unlock(&wss->mutex); mutex_unlock(&wss->mutex);
d_fnend(5, dev, "Completed. result = %d \n", result);
return result; return result;
} }
...@@ -520,16 +485,12 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss, ...@@ -520,16 +485,12 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
{ {
int result = 0; int result = 0;
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
char buf[WLP_WSS_UUID_STRSIZE];
DECLARE_COMPLETION_ONSTACK(completion); DECLARE_COMPLETION_ONSTACK(completion);
struct wlp_session session; struct wlp_session session;
struct sk_buff *skb; struct sk_buff *skb;
struct wlp_frame_assoc *resp; struct wlp_frame_assoc *resp;
struct wlp_uuid wssid; struct wlp_uuid wssid;
wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
mutex_lock(&wlp->mutex); mutex_lock(&wlp->mutex);
/* Send C1 association frame */ /* Send C1 association frame */
result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C1); 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,8 +526,6 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
/* Parse message in session->data: it will be either C2 or F0 */ /* Parse message in session->data: it will be either C2 or F0 */
skb = session.data; skb = session.data;
resp = (void *) skb->data; resp = (void *) skb->data;
d_printf(5, dev, "Received response to C1 frame. \n");
d_dump(5, dev, skb->data, skb->len > 72 ? 72 : skb->len);
if (resp->type == WLP_ASSOC_F0) { if (resp->type == WLP_ASSOC_F0) {
result = wlp_parse_f0(wlp, skb); result = wlp_parse_f0(wlp, skb);
if (result < 0) if (result < 0)
...@@ -584,11 +543,9 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss, ...@@ -584,11 +543,9 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
result = 0; result = 0;
goto error_resp_parse; goto error_resp_parse;
} }
if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))) { if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)))
d_printf(5, dev, "WSSID in C2 frame matches local "
"active WSS.\n");
result = 1; result = 1;
} else { else {
dev_err(dev, "WLP: Received a C2 frame without matching " dev_err(dev, "WLP: Received a C2 frame without matching "
"WSSID.\n"); "WSSID.\n");
result = 0; result = 0;
...@@ -598,8 +555,6 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss, ...@@ -598,8 +555,6 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
out: out:
wlp->session = NULL; wlp->session = NULL;
mutex_unlock(&wlp->mutex); mutex_unlock(&wlp->mutex);
d_fnend(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
return result; return result;
} }
...@@ -620,16 +575,8 @@ int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss, ...@@ -620,16 +575,8 @@ int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss,
{ {
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
int result = 0; int result = 0;
char buf[WLP_WSS_UUID_STRSIZE];
wlp_wss_uuid_print(buf, sizeof(buf), wssid);
d_fnstart(5, dev, "wlp %p, wss %p, wssid %s, tag %u, virtual "
"%02x:%02x:%02x:%02x:%02x:%02x \n", wlp, wss, buf, *tag,
virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
virt_addr->data[3], virt_addr->data[4], virt_addr->data[5]);
if (!memcmp(wssid, &wss->wssid, sizeof(*wssid))) { if (!memcmp(wssid, &wss->wssid, sizeof(*wssid))) {
d_printf(5, dev, "WSSID from neighbor frame matches local "
"active WSS.\n");
/* Update EDA cache */ /* Update EDA cache */
result = wlp_eda_update_node(&wlp->eda, dev_addr, wss, result = wlp_eda_update_node(&wlp->eda, dev_addr, wss,
(void *) virt_addr->data, *tag, (void *) virt_addr->data, *tag,
...@@ -638,18 +585,9 @@ int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss, ...@@ -638,18 +585,9 @@ int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss,
dev_err(dev, "WLP: Unable to update EDA cache " dev_err(dev, "WLP: Unable to update EDA cache "
"with new connected neighbor information.\n"); "with new connected neighbor information.\n");
} else { } else {
dev_err(dev, "WLP: Neighbor does not have matching " dev_err(dev, "WLP: Neighbor does not have matching WSSID.\n");
"WSSID.\n");
result = -EINVAL; result = -EINVAL;
} }
d_fnend(5, dev, "wlp %p, wss %p, wssid %s, tag %u, virtual "
"%02x:%02x:%02x:%02x:%02x:%02x, result = %d \n",
wlp, wss, buf, *tag,
virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
virt_addr->data[3], virt_addr->data[4], virt_addr->data[5],
result);
return result; return result;
} }
...@@ -665,7 +603,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss, ...@@ -665,7 +603,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
{ {
int result; int result;
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
char buf[WLP_WSS_UUID_STRSIZE];
struct wlp_uuid wssid; struct wlp_uuid wssid;
u8 tag; u8 tag;
struct uwb_mac_addr virt_addr; struct uwb_mac_addr virt_addr;
...@@ -674,9 +611,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss, ...@@ -674,9 +611,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
struct wlp_frame_assoc *resp; struct wlp_frame_assoc *resp;
struct sk_buff *skb; struct sk_buff *skb;
wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
mutex_lock(&wlp->mutex); mutex_lock(&wlp->mutex);
/* Send C3 association frame */ /* Send C3 association frame */
result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C3); 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,8 +645,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
/* Parse message in session->data: it will be either C4 or F0 */ /* Parse message in session->data: it will be either C4 or F0 */
skb = session.data; skb = session.data;
resp = (void *) skb->data; resp = (void *) skb->data;
d_printf(5, dev, "Received response to C3 frame. \n");
d_dump(5, dev, skb->data, skb->len > 72 ? 72 : skb->len);
if (resp->type == WLP_ASSOC_F0) { if (resp->type == WLP_ASSOC_F0) {
result = wlp_parse_f0(wlp, skb); result = wlp_parse_f0(wlp, skb);
if (result < 0) if (result < 0)
...@@ -744,8 +676,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss, ...@@ -744,8 +676,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
WLP_WSS_CONNECT_FAILED); WLP_WSS_CONNECT_FAILED);
wlp->session = NULL; wlp->session = NULL;
mutex_unlock(&wlp->mutex); mutex_unlock(&wlp->mutex);
d_fnend(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
return result; return result;
} }
...@@ -780,12 +710,8 @@ void wlp_wss_connect_send(struct work_struct *ws) ...@@ -780,12 +710,8 @@ void wlp_wss_connect_send(struct work_struct *ws)
struct wlp_wss *wss = &wlp->wss; struct wlp_wss *wss = &wlp->wss;
int result; int result;
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
char buf[WLP_WSS_UUID_STRSIZE];
mutex_lock(&wss->mutex); mutex_lock(&wss->mutex);
wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
if (wss->state < WLP_WSS_STATE_ACTIVE) { if (wss->state < WLP_WSS_STATE_ACTIVE) {
if (printk_ratelimit()) if (printk_ratelimit())
dev_err(dev, "WLP: Attempting to connect with " dev_err(dev, "WLP: Attempting to connect with "
...@@ -836,7 +762,6 @@ void wlp_wss_connect_send(struct work_struct *ws) ...@@ -836,7 +762,6 @@ void wlp_wss_connect_send(struct work_struct *ws)
BUG_ON(wlp->start_queue == NULL); BUG_ON(wlp->start_queue == NULL);
wlp->start_queue(wlp); wlp->start_queue(wlp);
mutex_unlock(&wss->mutex); mutex_unlock(&wss->mutex);
d_fnend(5, dev, "wlp %p, wss %p (wssid %s)\n", wlp, wss, buf);
} }
/** /**
...@@ -855,7 +780,6 @@ int wlp_wss_prep_hdr(struct wlp *wlp, struct wlp_eda_node *eda_entry, ...@@ -855,7 +780,6 @@ int wlp_wss_prep_hdr(struct wlp *wlp, struct wlp_eda_node *eda_entry,
struct sk_buff *skb = _skb; struct sk_buff *skb = _skb;
struct wlp_frame_std_abbrv_hdr *std_hdr; struct wlp_frame_std_abbrv_hdr *std_hdr;
d_fnstart(6, dev, "wlp %p \n", wlp);
if (eda_entry->state == WLP_WSS_CONNECTED) { if (eda_entry->state == WLP_WSS_CONNECTED) {
/* Add WLP header */ /* Add WLP header */
BUG_ON(skb_headroom(skb) < sizeof(*std_hdr)); 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,7 +797,6 @@ int wlp_wss_prep_hdr(struct wlp *wlp, struct wlp_eda_node *eda_entry,
dev_addr->data[0]); dev_addr->data[0]);
result = -EINVAL; result = -EINVAL;
} }
d_fnend(6, dev, "wlp %p \n", wlp);
return result; return result;
} }
...@@ -893,16 +816,9 @@ int wlp_wss_connect_prep(struct wlp *wlp, struct wlp_eda_node *eda_entry, ...@@ -893,16 +816,9 @@ int wlp_wss_connect_prep(struct wlp *wlp, struct wlp_eda_node *eda_entry,
{ {
int result = 0; int result = 0;
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr;
unsigned char *eth_addr = eda_entry->eth_addr;
struct sk_buff *skb = _skb; struct sk_buff *skb = _skb;
struct wlp_assoc_conn_ctx *conn_ctx; struct wlp_assoc_conn_ctx *conn_ctx;
d_fnstart(5, dev, "wlp %p\n", wlp);
d_printf(5, dev, "To neighbor %02x:%02x with eth "
"%02x:%02x:%02x:%02x:%02x:%02x\n", dev_addr->data[1],
dev_addr->data[0], eth_addr[0], eth_addr[1], eth_addr[2],
eth_addr[3], eth_addr[4], eth_addr[5]);
if (eda_entry->state == WLP_WSS_UNCONNECTED) { if (eda_entry->state == WLP_WSS_UNCONNECTED) {
/* We don't want any more packets while we set up connection */ /* We don't want any more packets while we set up connection */
BUG_ON(wlp->stop_queue == NULL); 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,12 +845,9 @@ int wlp_wss_connect_prep(struct wlp *wlp, struct wlp_eda_node *eda_entry,
"previously. Not retrying. \n"); "previously. Not retrying. \n");
result = -ENONET; result = -ENONET;
goto out; goto out;
} else { /* eda_entry->state == WLP_WSS_CONNECTED */ } else /* eda_entry->state == WLP_WSS_CONNECTED */
d_printf(5, dev, "Neighbor is connected, preparing frame.\n");
result = wlp_wss_prep_hdr(wlp, eda_entry, skb); result = wlp_wss_prep_hdr(wlp, eda_entry, skb);
}
out: out:
d_fnend(5, dev, "wlp %p, result = %d \n", wlp, result);
return result; return result;
} }
...@@ -957,8 +870,6 @@ int wlp_wss_send_copy(struct wlp *wlp, struct wlp_eda_node *eda_entry, ...@@ -957,8 +870,6 @@ int wlp_wss_send_copy(struct wlp *wlp, struct wlp_eda_node *eda_entry,
struct sk_buff *copy; struct sk_buff *copy;
struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr; struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr;
d_fnstart(5, dev, "to neighbor %02x:%02x, skb (%p) \n",
dev_addr->data[1], dev_addr->data[0], skb);
copy = skb_copy(skb, GFP_ATOMIC); copy = skb_copy(skb, GFP_ATOMIC);
if (copy == NULL) { if (copy == NULL) {
if (printk_ratelimit()) if (printk_ratelimit())
...@@ -988,8 +899,6 @@ int wlp_wss_send_copy(struct wlp *wlp, struct wlp_eda_node *eda_entry, ...@@ -988,8 +899,6 @@ int wlp_wss_send_copy(struct wlp *wlp, struct wlp_eda_node *eda_entry,
dev_kfree_skb_irq(copy);/*we need to free if tx fails */ dev_kfree_skb_irq(copy);/*we need to free if tx fails */
} }
out: out:
d_fnend(5, dev, "to neighbor %02x:%02x \n", dev_addr->data[1],
dev_addr->data[0]);
return result; return result;
} }
...@@ -1005,7 +914,7 @@ int wlp_wss_setup(struct net_device *net_dev, struct wlp_wss *wss) ...@@ -1005,7 +914,7 @@ int wlp_wss_setup(struct net_device *net_dev, struct wlp_wss *wss)
struct wlp *wlp = container_of(wss, struct wlp, wss); struct wlp *wlp = container_of(wss, struct wlp, wss);
struct device *dev = &wlp->rc->uwb_dev.dev; struct device *dev = &wlp->rc->uwb_dev.dev;
int result = 0; int result = 0;
d_fnstart(5, dev, "wss (%p) \n", wss);
mutex_lock(&wss->mutex); mutex_lock(&wss->mutex);
wss->kobj.parent = &net_dev->dev.kobj; wss->kobj.parent = &net_dev->dev.kobj;
if (!is_valid_ether_addr(net_dev->dev_addr)) { 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,7 +927,6 @@ int wlp_wss_setup(struct net_device *net_dev, struct wlp_wss *wss)
sizeof(wss->virtual_addr.data)); sizeof(wss->virtual_addr.data));
out: out:
mutex_unlock(&wss->mutex); mutex_unlock(&wss->mutex);
d_fnend(5, dev, "wss (%p) \n", wss);
return result; return result;
} }
EXPORT_SYMBOL_GPL(wlp_wss_setup); EXPORT_SYMBOL_GPL(wlp_wss_setup);
...@@ -1035,8 +943,7 @@ EXPORT_SYMBOL_GPL(wlp_wss_setup); ...@@ -1035,8 +943,7 @@ EXPORT_SYMBOL_GPL(wlp_wss_setup);
void wlp_wss_remove(struct wlp_wss *wss) void wlp_wss_remove(struct wlp_wss *wss)
{ {
struct wlp *wlp = container_of(wss, struct wlp, wss); struct wlp *wlp = container_of(wss, struct wlp, wss);
struct device *dev = &wlp->rc->uwb_dev.dev;
d_fnstart(5, dev, "wss (%p) \n", wss);
mutex_lock(&wss->mutex); mutex_lock(&wss->mutex);
if (wss->state == WLP_WSS_STATE_ACTIVE) if (wss->state == WLP_WSS_STATE_ACTIVE)
uwb_rc_ie_rm(wlp->rc, UWB_IE_WLP); uwb_rc_ie_rm(wlp->rc, UWB_IE_WLP);
...@@ -1050,6 +957,5 @@ void wlp_wss_remove(struct wlp_wss *wss) ...@@ -1050,6 +957,5 @@ void wlp_wss_remove(struct wlp_wss *wss)
wlp_eda_release(&wlp->eda); wlp_eda_release(&wlp->eda);
wlp_eda_init(&wlp->eda); wlp_eda_init(&wlp->eda);
mutex_unlock(&wss->mutex); mutex_unlock(&wss->mutex);
d_fnend(5, dev, "wss (%p) \n", wss);
} }
EXPORT_SYMBOL_GPL(wlp_wss_remove); EXPORT_SYMBOL_GPL(wlp_wss_remove);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment