diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-07-29 14:47:07 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-07-29 14:47:07 -0400 |
commit | ae3568adf42d5d3bb3cfa505b94351c5d1ce4924 (patch) | |
tree | 112865a6e6b1e4ddf70362f3efb295c495ec85b9 /drivers | |
parent | 7f3e01fee41a322747db2d7574516d9fbd3785c0 (diff) | |
parent | b7753c8cd51dce67a0b152efb456a21ff1cc241b (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Diffstat (limited to 'drivers')
106 files changed, 2720 insertions, 2278 deletions
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index 058fbccf2f52..02deef424926 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig | |||
@@ -58,6 +58,18 @@ config BT_HCIUART_BCSP | |||
58 | 58 | ||
59 | Say Y here to compile support for HCI BCSP protocol. | 59 | Say Y here to compile support for HCI BCSP protocol. |
60 | 60 | ||
61 | config BT_HCIUART_ATH3K | ||
62 | bool "Atheros AR300x serial support" | ||
63 | depends on BT_HCIUART | ||
64 | help | ||
65 | HCIATH3K (HCI Atheros AR300x) is a serial protocol for | ||
66 | communication between host and Atheros AR300x Bluetooth devices. | ||
67 | This protocol enables AR300x chips to be enabled with | ||
68 | power management support. | ||
69 | Enable this if you have Atheros AR300x serial Bluetooth device. | ||
70 | |||
71 | Say Y here to compile support for HCI UART ATH3K protocol. | ||
72 | |||
61 | config BT_HCIUART_LL | 73 | config BT_HCIUART_LL |
62 | bool "HCILL protocol support" | 74 | bool "HCILL protocol support" |
63 | depends on BT_HCIUART | 75 | depends on BT_HCIUART |
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile index 7e5aed598121..71bdf13287c4 100644 --- a/drivers/bluetooth/Makefile +++ b/drivers/bluetooth/Makefile | |||
@@ -26,4 +26,5 @@ hci_uart-y := hci_ldisc.o | |||
26 | hci_uart-$(CONFIG_BT_HCIUART_H4) += hci_h4.o | 26 | hci_uart-$(CONFIG_BT_HCIUART_H4) += hci_h4.o |
27 | hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o | 27 | hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o |
28 | hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o | 28 | hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o |
29 | hci_uart-$(CONFIG_BT_HCIUART_ATH3K) += hci_ath.o | ||
29 | hci_uart-objs := $(hci_uart-y) | 30 | hci_uart-objs := $(hci_uart-y) |
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index b0c84c19f442..8b1b643a519b 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c | |||
@@ -224,7 +224,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
224 | 224 | ||
225 | BT_DBG("firmware data %p size %zu", firmware->data, firmware->size); | 225 | BT_DBG("firmware data %p size %zu", firmware->data, firmware->size); |
226 | 226 | ||
227 | data->fw_data = kmalloc(firmware->size, GFP_KERNEL); | 227 | data->fw_data = kmemdup(firmware->data, firmware->size, GFP_KERNEL); |
228 | if (!data->fw_data) { | 228 | if (!data->fw_data) { |
229 | BT_ERR("Can't allocate memory for firmware image"); | 229 | BT_ERR("Can't allocate memory for firmware image"); |
230 | release_firmware(firmware); | 230 | release_firmware(firmware); |
@@ -234,7 +234,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
234 | return -ENOMEM; | 234 | return -ENOMEM; |
235 | } | 235 | } |
236 | 236 | ||
237 | memcpy(data->fw_data, firmware->data, firmware->size); | ||
238 | data->fw_size = firmware->size; | 237 | data->fw_size = firmware->size; |
239 | data->fw_sent = 0; | 238 | data->fw_sent = 0; |
240 | 239 | ||
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index d945cd12433a..751b338d904a 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c | |||
@@ -62,7 +62,7 @@ struct hci_vendor_hdr { | |||
62 | __u8 type; | 62 | __u8 type; |
63 | __le16 snum; | 63 | __le16 snum; |
64 | __le16 dlen; | 64 | __le16 dlen; |
65 | } __attribute__ ((packed)); | 65 | } __packed; |
66 | 66 | ||
67 | static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count) | 67 | static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count) |
68 | { | 68 | { |
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c index b50b41d97a7f..54739b08c308 100644 --- a/drivers/bluetooth/btmrvl_debugfs.c +++ b/drivers/bluetooth/btmrvl_debugfs.c | |||
@@ -216,7 +216,7 @@ static const struct file_operations btmrvl_gpiogap_fops = { | |||
216 | static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf, | 216 | static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf, |
217 | size_t count, loff_t *ppos) | 217 | size_t count, loff_t *ppos) |
218 | { | 218 | { |
219 | struct btmrvl_private *priv = (struct btmrvl_private *) file->private_data; | 219 | struct btmrvl_private *priv = file->private_data; |
220 | char buf[16]; | 220 | char buf[16]; |
221 | long result, ret; | 221 | long result, ret; |
222 | 222 | ||
diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h index bed0ba630235..90bda50dc446 100644 --- a/drivers/bluetooth/btmrvl_drv.h +++ b/drivers/bluetooth/btmrvl_drv.h | |||
@@ -76,6 +76,7 @@ struct btmrvl_private { | |||
76 | int (*hw_host_to_card) (struct btmrvl_private *priv, | 76 | int (*hw_host_to_card) (struct btmrvl_private *priv, |
77 | u8 *payload, u16 nb); | 77 | u8 *payload, u16 nb); |
78 | int (*hw_wakeup_firmware) (struct btmrvl_private *priv); | 78 | int (*hw_wakeup_firmware) (struct btmrvl_private *priv); |
79 | int (*hw_process_int_status) (struct btmrvl_private *priv); | ||
79 | spinlock_t driver_lock; /* spinlock used by driver */ | 80 | spinlock_t driver_lock; /* spinlock used by driver */ |
80 | #ifdef CONFIG_DEBUG_FS | 81 | #ifdef CONFIG_DEBUG_FS |
81 | void *debugfs_data; | 82 | void *debugfs_data; |
@@ -118,13 +119,13 @@ struct btmrvl_cmd { | |||
118 | __le16 ocf_ogf; | 119 | __le16 ocf_ogf; |
119 | u8 length; | 120 | u8 length; |
120 | u8 data[4]; | 121 | u8 data[4]; |
121 | } __attribute__ ((packed)); | 122 | } __packed; |
122 | 123 | ||
123 | struct btmrvl_event { | 124 | struct btmrvl_event { |
124 | u8 ec; /* event counter */ | 125 | u8 ec; /* event counter */ |
125 | u8 length; | 126 | u8 length; |
126 | u8 data[4]; | 127 | u8 data[4]; |
127 | } __attribute__ ((packed)); | 128 | } __packed; |
128 | 129 | ||
129 | /* Prototype of global function */ | 130 | /* Prototype of global function */ |
130 | 131 | ||
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index ee37ef0caee2..0d32ec82e9bf 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
@@ -502,14 +502,17 @@ static int btmrvl_service_main_thread(void *data) | |||
502 | spin_lock_irqsave(&priv->driver_lock, flags); | 502 | spin_lock_irqsave(&priv->driver_lock, flags); |
503 | if (adapter->int_count) { | 503 | if (adapter->int_count) { |
504 | adapter->int_count = 0; | 504 | adapter->int_count = 0; |
505 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
506 | priv->hw_process_int_status(priv); | ||
505 | } else if (adapter->ps_state == PS_SLEEP && | 507 | } else if (adapter->ps_state == PS_SLEEP && |
506 | !skb_queue_empty(&adapter->tx_queue)) { | 508 | !skb_queue_empty(&adapter->tx_queue)) { |
507 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 509 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
508 | adapter->wakeup_tries++; | 510 | adapter->wakeup_tries++; |
509 | priv->hw_wakeup_firmware(priv); | 511 | priv->hw_wakeup_firmware(priv); |
510 | continue; | 512 | continue; |
513 | } else { | ||
514 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
511 | } | 515 | } |
512 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
513 | 516 | ||
514 | if (adapter->ps_state == PS_SLEEP) | 517 | if (adapter->ps_state == PS_SLEEP) |
515 | continue; | 518 | continue; |
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index df0773ebd9e4..dcc2a6ec23f0 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c | |||
@@ -47,6 +47,7 @@ | |||
47 | * module_exit function is called. | 47 | * module_exit function is called. |
48 | */ | 48 | */ |
49 | static u8 user_rmmod; | 49 | static u8 user_rmmod; |
50 | static u8 sdio_ireg; | ||
50 | 51 | ||
51 | static const struct btmrvl_sdio_device btmrvl_sdio_sd6888 = { | 52 | static const struct btmrvl_sdio_device btmrvl_sdio_sd6888 = { |
52 | .helper = "sd8688_helper.bin", | 53 | .helper = "sd8688_helper.bin", |
@@ -83,10 +84,10 @@ static int btmrvl_sdio_read_fw_status(struct btmrvl_sdio_card *card, u16 *dat) | |||
83 | *dat = 0; | 84 | *dat = 0; |
84 | 85 | ||
85 | fws0 = sdio_readb(card->func, CARD_FW_STATUS0_REG, &ret); | 86 | fws0 = sdio_readb(card->func, CARD_FW_STATUS0_REG, &ret); |
87 | if (ret) | ||
88 | return -EIO; | ||
86 | 89 | ||
87 | if (!ret) | 90 | fws1 = sdio_readb(card->func, CARD_FW_STATUS1_REG, &ret); |
88 | fws1 = sdio_readb(card->func, CARD_FW_STATUS1_REG, &ret); | ||
89 | |||
90 | if (ret) | 91 | if (ret) |
91 | return -EIO; | 92 | return -EIO; |
92 | 93 | ||
@@ -216,7 +217,7 @@ static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card) | |||
216 | 217 | ||
217 | tmphlprbufsz = ALIGN_SZ(BTM_UPLD_SIZE, BTSDIO_DMA_ALIGN); | 218 | tmphlprbufsz = ALIGN_SZ(BTM_UPLD_SIZE, BTSDIO_DMA_ALIGN); |
218 | 219 | ||
219 | tmphlprbuf = kmalloc(tmphlprbufsz, GFP_KERNEL); | 220 | tmphlprbuf = kzalloc(tmphlprbufsz, GFP_KERNEL); |
220 | if (!tmphlprbuf) { | 221 | if (!tmphlprbuf) { |
221 | BT_ERR("Unable to allocate buffer for helper." | 222 | BT_ERR("Unable to allocate buffer for helper." |
222 | " Terminating download"); | 223 | " Terminating download"); |
@@ -224,8 +225,6 @@ static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card) | |||
224 | goto done; | 225 | goto done; |
225 | } | 226 | } |
226 | 227 | ||
227 | memset(tmphlprbuf, 0, tmphlprbufsz); | ||
228 | |||
229 | helperbuf = (u8 *) ALIGN_ADDR(tmphlprbuf, BTSDIO_DMA_ALIGN); | 228 | helperbuf = (u8 *) ALIGN_ADDR(tmphlprbuf, BTSDIO_DMA_ALIGN); |
230 | 229 | ||
231 | /* Perform helper data transfer */ | 230 | /* Perform helper data transfer */ |
@@ -318,7 +317,7 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card) | |||
318 | BT_DBG("Downloading FW image (%d bytes)", firmwarelen); | 317 | BT_DBG("Downloading FW image (%d bytes)", firmwarelen); |
319 | 318 | ||
320 | tmpfwbufsz = ALIGN_SZ(BTM_UPLD_SIZE, BTSDIO_DMA_ALIGN); | 319 | tmpfwbufsz = ALIGN_SZ(BTM_UPLD_SIZE, BTSDIO_DMA_ALIGN); |
321 | tmpfwbuf = kmalloc(tmpfwbufsz, GFP_KERNEL); | 320 | tmpfwbuf = kzalloc(tmpfwbufsz, GFP_KERNEL); |
322 | if (!tmpfwbuf) { | 321 | if (!tmpfwbuf) { |
323 | BT_ERR("Unable to allocate buffer for firmware." | 322 | BT_ERR("Unable to allocate buffer for firmware." |
324 | " Terminating download"); | 323 | " Terminating download"); |
@@ -326,8 +325,6 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card) | |||
326 | goto done; | 325 | goto done; |
327 | } | 326 | } |
328 | 327 | ||
329 | memset(tmpfwbuf, 0, tmpfwbufsz); | ||
330 | |||
331 | /* Ensure aligned firmware buffer */ | 328 | /* Ensure aligned firmware buffer */ |
332 | fwbuf = (u8 *) ALIGN_ADDR(tmpfwbuf, BTSDIO_DMA_ALIGN); | 329 | fwbuf = (u8 *) ALIGN_ADDR(tmpfwbuf, BTSDIO_DMA_ALIGN); |
333 | 330 | ||
@@ -555,78 +552,79 @@ exit: | |||
555 | return ret; | 552 | return ret; |
556 | } | 553 | } |
557 | 554 | ||
558 | static int btmrvl_sdio_get_int_status(struct btmrvl_private *priv, u8 * ireg) | 555 | static int btmrvl_sdio_process_int_status(struct btmrvl_private *priv) |
559 | { | 556 | { |
560 | int ret; | 557 | ulong flags; |
561 | u8 sdio_ireg = 0; | 558 | u8 ireg; |
562 | struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; | 559 | struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; |
563 | 560 | ||
564 | *ireg = 0; | 561 | spin_lock_irqsave(&priv->driver_lock, flags); |
565 | 562 | ireg = sdio_ireg; | |
566 | sdio_ireg = sdio_readb(card->func, HOST_INTSTATUS_REG, &ret); | 563 | sdio_ireg = 0; |
567 | if (ret) { | 564 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
568 | BT_ERR("sdio_readb: read int status register failed"); | ||
569 | ret = -EIO; | ||
570 | goto done; | ||
571 | } | ||
572 | |||
573 | if (sdio_ireg != 0) { | ||
574 | /* | ||
575 | * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS | ||
576 | * Clear the interrupt status register and re-enable the | ||
577 | * interrupt. | ||
578 | */ | ||
579 | BT_DBG("sdio_ireg = 0x%x", sdio_ireg); | ||
580 | |||
581 | sdio_writeb(card->func, ~(sdio_ireg) & (DN_LD_HOST_INT_STATUS | | ||
582 | UP_LD_HOST_INT_STATUS), | ||
583 | HOST_INTSTATUS_REG, &ret); | ||
584 | if (ret) { | ||
585 | BT_ERR("sdio_writeb: clear int status register " | ||
586 | "failed"); | ||
587 | ret = -EIO; | ||
588 | goto done; | ||
589 | } | ||
590 | } | ||
591 | 565 | ||
592 | if (sdio_ireg & DN_LD_HOST_INT_STATUS) { | 566 | sdio_claim_host(card->func); |
567 | if (ireg & DN_LD_HOST_INT_STATUS) { | ||
593 | if (priv->btmrvl_dev.tx_dnld_rdy) | 568 | if (priv->btmrvl_dev.tx_dnld_rdy) |
594 | BT_DBG("tx_done already received: " | 569 | BT_DBG("tx_done already received: " |
595 | " int_status=0x%x", sdio_ireg); | 570 | " int_status=0x%x", ireg); |
596 | else | 571 | else |
597 | priv->btmrvl_dev.tx_dnld_rdy = true; | 572 | priv->btmrvl_dev.tx_dnld_rdy = true; |
598 | } | 573 | } |
599 | 574 | ||
600 | if (sdio_ireg & UP_LD_HOST_INT_STATUS) | 575 | if (ireg & UP_LD_HOST_INT_STATUS) |
601 | btmrvl_sdio_card_to_host(priv); | 576 | btmrvl_sdio_card_to_host(priv); |
602 | 577 | ||
603 | *ireg = sdio_ireg; | 578 | sdio_release_host(card->func); |
604 | |||
605 | ret = 0; | ||
606 | 579 | ||
607 | done: | 580 | return 0; |
608 | return ret; | ||
609 | } | 581 | } |
610 | 582 | ||
611 | static void btmrvl_sdio_interrupt(struct sdio_func *func) | 583 | static void btmrvl_sdio_interrupt(struct sdio_func *func) |
612 | { | 584 | { |
613 | struct btmrvl_private *priv; | 585 | struct btmrvl_private *priv; |
614 | struct hci_dev *hcidev; | ||
615 | struct btmrvl_sdio_card *card; | 586 | struct btmrvl_sdio_card *card; |
587 | ulong flags; | ||
616 | u8 ireg = 0; | 588 | u8 ireg = 0; |
589 | int ret; | ||
617 | 590 | ||
618 | card = sdio_get_drvdata(func); | 591 | card = sdio_get_drvdata(func); |
619 | if (card && card->priv) { | 592 | if (!card || !card->priv) { |
620 | priv = card->priv; | 593 | BT_ERR("sbi_interrupt(%p) card or priv is " |
621 | hcidev = priv->btmrvl_dev.hcidev; | 594 | "NULL, card=%p\n", func, card); |
595 | return; | ||
596 | } | ||
622 | 597 | ||
623 | if (btmrvl_sdio_get_int_status(priv, &ireg)) | 598 | priv = card->priv; |
624 | BT_ERR("reading HOST_INT_STATUS_REG failed"); | 599 | |
625 | else | 600 | ireg = sdio_readb(card->func, HOST_INTSTATUS_REG, &ret); |
626 | BT_DBG("HOST_INT_STATUS_REG %#x", ireg); | 601 | if (ret) { |
602 | BT_ERR("sdio_readb: read int status register failed"); | ||
603 | return; | ||
604 | } | ||
605 | |||
606 | if (ireg != 0) { | ||
607 | /* | ||
608 | * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS | ||
609 | * Clear the interrupt status register and re-enable the | ||
610 | * interrupt. | ||
611 | */ | ||
612 | BT_DBG("ireg = 0x%x", ireg); | ||
627 | 613 | ||
628 | btmrvl_interrupt(priv); | 614 | sdio_writeb(card->func, ~(ireg) & (DN_LD_HOST_INT_STATUS | |
615 | UP_LD_HOST_INT_STATUS), | ||
616 | HOST_INTSTATUS_REG, &ret); | ||
617 | if (ret) { | ||
618 | BT_ERR("sdio_writeb: clear int status register failed"); | ||
619 | return; | ||
620 | } | ||
629 | } | 621 | } |
622 | |||
623 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
624 | sdio_ireg |= ireg; | ||
625 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
626 | |||
627 | btmrvl_interrupt(priv); | ||
630 | } | 628 | } |
631 | 629 | ||
632 | static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card) | 630 | static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card) |
@@ -930,6 +928,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func, | |||
930 | /* Initialize the interface specific function pointers */ | 928 | /* Initialize the interface specific function pointers */ |
931 | priv->hw_host_to_card = btmrvl_sdio_host_to_card; | 929 | priv->hw_host_to_card = btmrvl_sdio_host_to_card; |
932 | priv->hw_wakeup_firmware = btmrvl_sdio_wakeup_fw; | 930 | priv->hw_wakeup_firmware = btmrvl_sdio_wakeup_fw; |
931 | priv->hw_process_int_status = btmrvl_sdio_process_int_status; | ||
933 | 932 | ||
934 | if (btmrvl_register_hdev(priv)) { | 933 | if (btmrvl_register_hdev(priv)) { |
935 | BT_ERR("Register hdev failed!"); | 934 | BT_ERR("Register hdev failed!"); |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 5d9cc53bd643..d22ce3cc611e 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -59,6 +59,9 @@ static struct usb_device_id btusb_table[] = { | |||
59 | /* Generic Bluetooth USB device */ | 59 | /* Generic Bluetooth USB device */ |
60 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, | 60 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, |
61 | 61 | ||
62 | /* Apple iMac11,1 */ | ||
63 | { USB_DEVICE(0x05ac, 0x8215) }, | ||
64 | |||
62 | /* AVM BlueFRITZ! USB v2.0 */ | 65 | /* AVM BlueFRITZ! USB v2.0 */ |
63 | { USB_DEVICE(0x057c, 0x3800) }, | 66 | { USB_DEVICE(0x057c, 0x3800) }, |
64 | 67 | ||
@@ -146,6 +149,7 @@ static struct usb_device_id blacklist_table[] = { | |||
146 | #define BTUSB_BULK_RUNNING 1 | 149 | #define BTUSB_BULK_RUNNING 1 |
147 | #define BTUSB_ISOC_RUNNING 2 | 150 | #define BTUSB_ISOC_RUNNING 2 |
148 | #define BTUSB_SUSPENDING 3 | 151 | #define BTUSB_SUSPENDING 3 |
152 | #define BTUSB_DID_ISO_RESUME 4 | ||
149 | 153 | ||
150 | struct btusb_data { | 154 | struct btusb_data { |
151 | struct hci_dev *hdev; | 155 | struct hci_dev *hdev; |
@@ -179,7 +183,6 @@ struct btusb_data { | |||
179 | unsigned int sco_num; | 183 | unsigned int sco_num; |
180 | int isoc_altsetting; | 184 | int isoc_altsetting; |
181 | int suspend_count; | 185 | int suspend_count; |
182 | int did_iso_resume:1; | ||
183 | }; | 186 | }; |
184 | 187 | ||
185 | static int inc_tx(struct btusb_data *data) | 188 | static int inc_tx(struct btusb_data *data) |
@@ -807,7 +810,7 @@ static void btusb_work(struct work_struct *work) | |||
807 | int err; | 810 | int err; |
808 | 811 | ||
809 | if (hdev->conn_hash.sco_num > 0) { | 812 | if (hdev->conn_hash.sco_num > 0) { |
810 | if (!data->did_iso_resume) { | 813 | if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) { |
811 | err = usb_autopm_get_interface(data->isoc); | 814 | err = usb_autopm_get_interface(data->isoc); |
812 | if (err < 0) { | 815 | if (err < 0) { |
813 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 816 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
@@ -815,7 +818,7 @@ static void btusb_work(struct work_struct *work) | |||
815 | return; | 818 | return; |
816 | } | 819 | } |
817 | 820 | ||
818 | data->did_iso_resume = 1; | 821 | set_bit(BTUSB_DID_ISO_RESUME, &data->flags); |
819 | } | 822 | } |
820 | if (data->isoc_altsetting != 2) { | 823 | if (data->isoc_altsetting != 2) { |
821 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 824 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
@@ -836,10 +839,8 @@ static void btusb_work(struct work_struct *work) | |||
836 | usb_kill_anchored_urbs(&data->isoc_anchor); | 839 | usb_kill_anchored_urbs(&data->isoc_anchor); |
837 | 840 | ||
838 | __set_isoc_interface(hdev, 0); | 841 | __set_isoc_interface(hdev, 0); |
839 | if (data->did_iso_resume) { | 842 | if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags)) |
840 | data->did_iso_resume = 0; | ||
841 | usb_autopm_put_interface(data->isoc); | 843 | usb_autopm_put_interface(data->isoc); |
842 | } | ||
843 | } | 844 | } |
844 | } | 845 | } |
845 | 846 | ||
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index ef044d55cb25..cbe9e44a42e9 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -104,7 +104,7 @@ typedef struct { | |||
104 | u8 type; | 104 | u8 type; |
105 | u8 zero; | 105 | u8 zero; |
106 | u16 len; | 106 | u16 len; |
107 | } __attribute__ ((packed)) nsh_t; /* Nokia Specific Header */ | 107 | } __packed nsh_t; /* Nokia Specific Header */ |
108 | 108 | ||
109 | #define NSHL 4 /* Nokia Specific Header Length */ | 109 | #define NSHL 4 /* Nokia Specific Header Length */ |
110 | 110 | ||
diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c new file mode 100644 index 000000000000..6a160c17ea94 --- /dev/null +++ b/drivers/bluetooth/hci_ath.c | |||
@@ -0,0 +1,235 @@ | |||
1 | /* | ||
2 | * Atheros Communication Bluetooth HCIATH3K UART protocol | ||
3 | * | ||
4 | * HCIATH3K (HCI Atheros AR300x Protocol) is a Atheros Communication's | ||
5 | * power management protocol extension to H4 to support AR300x Bluetooth Chip. | ||
6 | * | ||
7 | * Copyright (c) 2009-2010 Atheros Communications Inc. | ||
8 | * | ||
9 | * Acknowledgements: | ||
10 | * This file is based on hci_h4.c, which was written | ||
11 | * by Maxim Krasnyansky and Marcel Holtmann. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #include <linux/module.h> | ||
30 | #include <linux/kernel.h> | ||
31 | |||
32 | #include <linux/init.h> | ||
33 | #include <linux/slab.h> | ||
34 | #include <linux/tty.h> | ||
35 | #include <linux/errno.h> | ||
36 | #include <linux/ioctl.h> | ||
37 | #include <linux/skbuff.h> | ||
38 | |||
39 | #include <net/bluetooth/bluetooth.h> | ||
40 | #include <net/bluetooth/hci_core.h> | ||
41 | |||
42 | #include "hci_uart.h" | ||
43 | |||
44 | struct ath_struct { | ||
45 | struct hci_uart *hu; | ||
46 | unsigned int cur_sleep; | ||
47 | |||
48 | struct sk_buff_head txq; | ||
49 | struct work_struct ctxtsw; | ||
50 | }; | ||
51 | |||
52 | static int ath_wakeup_ar3k(struct tty_struct *tty) | ||
53 | { | ||
54 | struct termios settings; | ||
55 | int status = tty->driver->ops->tiocmget(tty, NULL); | ||
56 | |||
57 | if (status & TIOCM_CTS) | ||
58 | return status; | ||
59 | |||
60 | /* Disable Automatic RTSCTS */ | ||
61 | n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings); | ||
62 | settings.c_cflag &= ~CRTSCTS; | ||
63 | n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings); | ||
64 | |||
65 | /* Clear RTS first */ | ||
66 | status = tty->driver->ops->tiocmget(tty, NULL); | ||
67 | tty->driver->ops->tiocmset(tty, NULL, 0x00, TIOCM_RTS); | ||
68 | mdelay(20); | ||
69 | |||
70 | /* Set RTS, wake up board */ | ||
71 | status = tty->driver->ops->tiocmget(tty, NULL); | ||
72 | tty->driver->ops->tiocmset(tty, NULL, TIOCM_RTS, 0x00); | ||
73 | mdelay(20); | ||
74 | |||
75 | status = tty->driver->ops->tiocmget(tty, NULL); | ||
76 | |||
77 | n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings); | ||
78 | settings.c_cflag |= CRTSCTS; | ||
79 | n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings); | ||
80 | |||
81 | return status; | ||
82 | } | ||
83 | |||
84 | static void ath_hci_uart_work(struct work_struct *work) | ||
85 | { | ||
86 | int status; | ||
87 | struct ath_struct *ath; | ||
88 | struct hci_uart *hu; | ||
89 | struct tty_struct *tty; | ||
90 | |||
91 | ath = container_of(work, struct ath_struct, ctxtsw); | ||
92 | |||
93 | hu = ath->hu; | ||
94 | tty = hu->tty; | ||
95 | |||
96 | /* verify and wake up controller */ | ||
97 | if (ath->cur_sleep) { | ||
98 | status = ath_wakeup_ar3k(tty); | ||
99 | if (!(status & TIOCM_CTS)) | ||
100 | return; | ||
101 | } | ||
102 | |||
103 | /* Ready to send Data */ | ||
104 | clear_bit(HCI_UART_SENDING, &hu->tx_state); | ||
105 | hci_uart_tx_wakeup(hu); | ||
106 | } | ||
107 | |||
108 | /* Initialize protocol */ | ||
109 | static int ath_open(struct hci_uart *hu) | ||
110 | { | ||
111 | struct ath_struct *ath; | ||
112 | |||
113 | BT_DBG("hu %p", hu); | ||
114 | |||
115 | ath = kzalloc(sizeof(*ath), GFP_ATOMIC); | ||
116 | if (!ath) | ||
117 | return -ENOMEM; | ||
118 | |||
119 | skb_queue_head_init(&ath->txq); | ||
120 | |||
121 | hu->priv = ath; | ||
122 | ath->hu = hu; | ||
123 | |||
124 | INIT_WORK(&ath->ctxtsw, ath_hci_uart_work); | ||
125 | |||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | /* Flush protocol data */ | ||
130 | static int ath_flush(struct hci_uart *hu) | ||
131 | { | ||
132 | struct ath_struct *ath = hu->priv; | ||
133 | |||
134 | BT_DBG("hu %p", hu); | ||
135 | |||
136 | skb_queue_purge(&ath->txq); | ||
137 | |||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | /* Close protocol */ | ||
142 | static int ath_close(struct hci_uart *hu) | ||
143 | { | ||
144 | struct ath_struct *ath = hu->priv; | ||
145 | |||
146 | BT_DBG("hu %p", hu); | ||
147 | |||
148 | skb_queue_purge(&ath->txq); | ||
149 | |||
150 | cancel_work_sync(&ath->ctxtsw); | ||
151 | |||
152 | hu->priv = NULL; | ||
153 | kfree(ath); | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | #define HCI_OP_ATH_SLEEP 0xFC04 | ||
159 | |||
160 | /* Enqueue frame for transmittion */ | ||
161 | static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb) | ||
162 | { | ||
163 | struct ath_struct *ath = hu->priv; | ||
164 | |||
165 | if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) { | ||
166 | kfree_skb(skb); | ||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | /* | ||
171 | * Update power management enable flag with parameters of | ||
172 | * HCI sleep enable vendor specific HCI command. | ||
173 | */ | ||
174 | if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { | ||
175 | struct hci_command_hdr *hdr = (void *)skb->data; | ||
176 | |||
177 | if (__le16_to_cpu(hdr->opcode) == HCI_OP_ATH_SLEEP) | ||
178 | ath->cur_sleep = skb->data[HCI_COMMAND_HDR_SIZE]; | ||
179 | } | ||
180 | |||
181 | BT_DBG("hu %p skb %p", hu, skb); | ||
182 | |||
183 | /* Prepend skb with frame type */ | ||
184 | memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); | ||
185 | |||
186 | skb_queue_tail(&ath->txq, skb); | ||
187 | set_bit(HCI_UART_SENDING, &hu->tx_state); | ||
188 | |||
189 | schedule_work(&ath->ctxtsw); | ||
190 | |||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | static struct sk_buff *ath_dequeue(struct hci_uart *hu) | ||
195 | { | ||
196 | struct ath_struct *ath = hu->priv; | ||
197 | |||
198 | return skb_dequeue(&ath->txq); | ||
199 | } | ||
200 | |||
201 | /* Recv data */ | ||
202 | static int ath_recv(struct hci_uart *hu, void *data, int count) | ||
203 | { | ||
204 | if (hci_recv_stream_fragment(hu->hdev, data, count) < 0) | ||
205 | BT_ERR("Frame Reassembly Failed"); | ||
206 | |||
207 | return count; | ||
208 | } | ||
209 | |||
210 | static struct hci_uart_proto athp = { | ||
211 | .id = HCI_UART_ATH3K, | ||
212 | .open = ath_open, | ||
213 | .close = ath_close, | ||
214 | .recv = ath_recv, | ||
215 | .enqueue = ath_enqueue, | ||
216 | .dequeue = ath_dequeue, | ||
217 | .flush = ath_flush, | ||
218 | }; | ||
219 | |||
220 | int __init ath_init(void) | ||
221 | { | ||
222 | int err = hci_uart_register_proto(&athp); | ||
223 | |||
224 | if (!err) | ||
225 | BT_INFO("HCIATH3K protocol initialized"); | ||
226 | else | ||
227 | BT_ERR("HCIATH3K protocol registration failed"); | ||
228 | |||
229 | return err; | ||
230 | } | ||
231 | |||
232 | int __exit ath_deinit(void) | ||
233 | { | ||
234 | return hci_uart_unregister_proto(&athp); | ||
235 | } | ||
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index 42d69d4de05c..9c5b2dc38e29 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c | |||
@@ -739,7 +739,7 @@ static struct hci_uart_proto bcsp = { | |||
739 | .flush = bcsp_flush | 739 | .flush = bcsp_flush |
740 | }; | 740 | }; |
741 | 741 | ||
742 | int bcsp_init(void) | 742 | int __init bcsp_init(void) |
743 | { | 743 | { |
744 | int err = hci_uart_register_proto(&bcsp); | 744 | int err = hci_uart_register_proto(&bcsp); |
745 | 745 | ||
@@ -751,7 +751,7 @@ int bcsp_init(void) | |||
751 | return err; | 751 | return err; |
752 | } | 752 | } |
753 | 753 | ||
754 | int bcsp_deinit(void) | 754 | int __exit bcsp_deinit(void) |
755 | { | 755 | { |
756 | return hci_uart_unregister_proto(&bcsp); | 756 | return hci_uart_unregister_proto(&bcsp); |
757 | } | 757 | } |
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c index 3f038f5308a4..7b8ad93e2c36 100644 --- a/drivers/bluetooth/hci_h4.c +++ b/drivers/bluetooth/hci_h4.c | |||
@@ -151,107 +151,8 @@ static inline int h4_check_data_len(struct h4_struct *h4, int len) | |||
151 | /* Recv data */ | 151 | /* Recv data */ |
152 | static int h4_recv(struct hci_uart *hu, void *data, int count) | 152 | static int h4_recv(struct hci_uart *hu, void *data, int count) |
153 | { | 153 | { |
154 | struct h4_struct *h4 = hu->priv; | 154 | if (hci_recv_stream_fragment(hu->hdev, data, count) < 0) |
155 | register char *ptr; | 155 | BT_ERR("Frame Reassembly Failed"); |
156 | struct hci_event_hdr *eh; | ||
157 | struct hci_acl_hdr *ah; | ||
158 | struct hci_sco_hdr *sh; | ||
159 | register int len, type, dlen; | ||
160 | |||
161 | BT_DBG("hu %p count %d rx_state %ld rx_count %ld", | ||
162 | hu, count, h4->rx_state, h4->rx_count); | ||
163 | |||
164 | ptr = data; | ||
165 | while (count) { | ||
166 | if (h4->rx_count) { | ||
167 | len = min_t(unsigned int, h4->rx_count, count); | ||
168 | memcpy(skb_put(h4->rx_skb, len), ptr, len); | ||
169 | h4->rx_count -= len; count -= len; ptr += len; | ||
170 | |||
171 | if (h4->rx_count) | ||
172 | continue; | ||
173 | |||
174 | switch (h4->rx_state) { | ||
175 | case H4_W4_DATA: | ||
176 | BT_DBG("Complete data"); | ||
177 | |||
178 | hci_recv_frame(h4->rx_skb); | ||
179 | |||
180 | h4->rx_state = H4_W4_PACKET_TYPE; | ||
181 | h4->rx_skb = NULL; | ||
182 | continue; | ||
183 | |||
184 | case H4_W4_EVENT_HDR: | ||
185 | eh = hci_event_hdr(h4->rx_skb); | ||
186 | |||
187 | BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen); | ||
188 | |||
189 | h4_check_data_len(h4, eh->plen); | ||
190 | continue; | ||
191 | |||
192 | case H4_W4_ACL_HDR: | ||
193 | ah = hci_acl_hdr(h4->rx_skb); | ||
194 | dlen = __le16_to_cpu(ah->dlen); | ||
195 | |||
196 | BT_DBG("ACL header: dlen %d", dlen); | ||
197 | |||
198 | h4_check_data_len(h4, dlen); | ||
199 | continue; | ||
200 | |||
201 | case H4_W4_SCO_HDR: | ||
202 | sh = hci_sco_hdr(h4->rx_skb); | ||
203 | |||
204 | BT_DBG("SCO header: dlen %d", sh->dlen); | ||
205 | |||
206 | h4_check_data_len(h4, sh->dlen); | ||
207 | continue; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | /* H4_W4_PACKET_TYPE */ | ||
212 | switch (*ptr) { | ||
213 | case HCI_EVENT_PKT: | ||
214 | BT_DBG("Event packet"); | ||
215 | h4->rx_state = H4_W4_EVENT_HDR; | ||
216 | h4->rx_count = HCI_EVENT_HDR_SIZE; | ||
217 | type = HCI_EVENT_PKT; | ||
218 | break; | ||
219 | |||
220 | case HCI_ACLDATA_PKT: | ||
221 | BT_DBG("ACL packet"); | ||
222 | h4->rx_state = H4_W4_ACL_HDR; | ||
223 | h4->rx_count = HCI_ACL_HDR_SIZE; | ||
224 | type = HCI_ACLDATA_PKT; | ||
225 | break; | ||
226 | |||
227 | case HCI_SCODATA_PKT: | ||
228 | BT_DBG("SCO packet"); | ||
229 | h4->rx_state = H4_W4_SCO_HDR; | ||
230 | h4->rx_count = HCI_SCO_HDR_SIZE; | ||
231 | type = HCI_SCODATA_PKT; | ||
232 | break; | ||
233 | |||
234 | default: | ||
235 | BT_ERR("Unknown HCI packet type %2.2x", (__u8)*ptr); | ||
236 | hu->hdev->stat.err_rx++; | ||
237 | ptr++; count--; | ||
238 | continue; | ||
239 | }; | ||
240 | |||
241 | ptr++; count--; | ||
242 | |||
243 | /* Allocate packet */ | ||
244 | h4->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); | ||
245 | if (!h4->rx_skb) { | ||
246 | BT_ERR("Can't allocate mem for new packet"); | ||
247 | h4->rx_state = H4_W4_PACKET_TYPE; | ||
248 | h4->rx_count = 0; | ||
249 | return -ENOMEM; | ||
250 | } | ||
251 | |||
252 | h4->rx_skb->dev = (void *) hu->hdev; | ||
253 | bt_cb(h4->rx_skb)->pkt_type = type; | ||
254 | } | ||
255 | 156 | ||
256 | return count; | 157 | return count; |
257 | } | 158 | } |
@@ -272,7 +173,7 @@ static struct hci_uart_proto h4p = { | |||
272 | .flush = h4_flush, | 173 | .flush = h4_flush, |
273 | }; | 174 | }; |
274 | 175 | ||
275 | int h4_init(void) | 176 | int __init h4_init(void) |
276 | { | 177 | { |
277 | int err = hci_uart_register_proto(&h4p); | 178 | int err = hci_uart_register_proto(&h4p); |
278 | 179 | ||
@@ -284,7 +185,7 @@ int h4_init(void) | |||
284 | return err; | 185 | return err; |
285 | } | 186 | } |
286 | 187 | ||
287 | int h4_deinit(void) | 188 | int __exit h4_deinit(void) |
288 | { | 189 | { |
289 | return hci_uart_unregister_proto(&h4p); | 190 | return hci_uart_unregister_proto(&h4p); |
290 | } | 191 | } |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 76a1abb8f214..998833d93c13 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -210,7 +210,6 @@ static int hci_uart_close(struct hci_dev *hdev) | |||
210 | static int hci_uart_send_frame(struct sk_buff *skb) | 210 | static int hci_uart_send_frame(struct sk_buff *skb) |
211 | { | 211 | { |
212 | struct hci_dev* hdev = (struct hci_dev *) skb->dev; | 212 | struct hci_dev* hdev = (struct hci_dev *) skb->dev; |
213 | struct tty_struct *tty; | ||
214 | struct hci_uart *hu; | 213 | struct hci_uart *hu; |
215 | 214 | ||
216 | if (!hdev) { | 215 | if (!hdev) { |
@@ -222,7 +221,6 @@ static int hci_uart_send_frame(struct sk_buff *skb) | |||
222 | return -EBUSY; | 221 | return -EBUSY; |
223 | 222 | ||
224 | hu = (struct hci_uart *) hdev->driver_data; | 223 | hu = (struct hci_uart *) hdev->driver_data; |
225 | tty = hu->tty; | ||
226 | 224 | ||
227 | BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); | 225 | BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); |
228 | 226 | ||
@@ -397,6 +395,9 @@ static int hci_uart_register_dev(struct hci_uart *hu) | |||
397 | if (!reset) | 395 | if (!reset) |
398 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); | 396 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); |
399 | 397 | ||
398 | if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) | ||
399 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | ||
400 | |||
400 | if (hci_register_dev(hdev) < 0) { | 401 | if (hci_register_dev(hdev) < 0) { |
401 | BT_ERR("Can't register HCI device"); | 402 | BT_ERR("Can't register HCI device"); |
402 | hci_free_dev(hdev); | 403 | hci_free_dev(hdev); |
@@ -477,6 +478,15 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file * file, | |||
477 | return hu->hdev->id; | 478 | return hu->hdev->id; |
478 | return -EUNATCH; | 479 | return -EUNATCH; |
479 | 480 | ||
481 | case HCIUARTSETFLAGS: | ||
482 | if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) | ||
483 | return -EBUSY; | ||
484 | hu->hdev_flags = arg; | ||
485 | break; | ||
486 | |||
487 | case HCIUARTGETFLAGS: | ||
488 | return hu->hdev_flags; | ||
489 | |||
480 | default: | 490 | default: |
481 | err = n_tty_ioctl_helper(tty, file, cmd, arg); | 491 | err = n_tty_ioctl_helper(tty, file, cmd, arg); |
482 | break; | 492 | break; |
@@ -542,6 +552,9 @@ static int __init hci_uart_init(void) | |||
542 | #ifdef CONFIG_BT_HCIUART_LL | 552 | #ifdef CONFIG_BT_HCIUART_LL |
543 | ll_init(); | 553 | ll_init(); |
544 | #endif | 554 | #endif |
555 | #ifdef CONFIG_BT_HCIUART_ATH3K | ||
556 | ath_init(); | ||
557 | #endif | ||
545 | 558 | ||
546 | return 0; | 559 | return 0; |
547 | } | 560 | } |
@@ -559,6 +572,9 @@ static void __exit hci_uart_exit(void) | |||
559 | #ifdef CONFIG_BT_HCIUART_LL | 572 | #ifdef CONFIG_BT_HCIUART_LL |
560 | ll_deinit(); | 573 | ll_deinit(); |
561 | #endif | 574 | #endif |
575 | #ifdef CONFIG_BT_HCIUART_ATH3K | ||
576 | ath_deinit(); | ||
577 | #endif | ||
562 | 578 | ||
563 | /* Release tty registration of line discipline */ | 579 | /* Release tty registration of line discipline */ |
564 | if ((err = tty_unregister_ldisc(N_HCI))) | 580 | if ((err = tty_unregister_ldisc(N_HCI))) |
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index fb8445c7365e..38595e782d02 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c | |||
@@ -74,7 +74,7 @@ enum hcill_states_e { | |||
74 | 74 | ||
75 | struct hcill_cmd { | 75 | struct hcill_cmd { |
76 | u8 cmd; | 76 | u8 cmd; |
77 | } __attribute__((packed)); | 77 | } __packed; |
78 | 78 | ||
79 | struct ll_struct { | 79 | struct ll_struct { |
80 | unsigned long rx_state; | 80 | unsigned long rx_state; |
@@ -517,7 +517,7 @@ static struct hci_uart_proto llp = { | |||
517 | .flush = ll_flush, | 517 | .flush = ll_flush, |
518 | }; | 518 | }; |
519 | 519 | ||
520 | int ll_init(void) | 520 | int __init ll_init(void) |
521 | { | 521 | { |
522 | int err = hci_uart_register_proto(&llp); | 522 | int err = hci_uart_register_proto(&llp); |
523 | 523 | ||
@@ -529,7 +529,7 @@ int ll_init(void) | |||
529 | return err; | 529 | return err; |
530 | } | 530 | } |
531 | 531 | ||
532 | int ll_deinit(void) | 532 | int __exit ll_deinit(void) |
533 | { | 533 | { |
534 | return hci_uart_unregister_proto(&llp); | 534 | return hci_uart_unregister_proto(&llp); |
535 | } | 535 | } |
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h index 50113db06b9f..99fb35239d1f 100644 --- a/drivers/bluetooth/hci_uart.h +++ b/drivers/bluetooth/hci_uart.h | |||
@@ -31,15 +31,20 @@ | |||
31 | #define HCIUARTSETPROTO _IOW('U', 200, int) | 31 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
32 | #define HCIUARTGETPROTO _IOR('U', 201, int) | 32 | #define HCIUARTGETPROTO _IOR('U', 201, int) |
33 | #define HCIUARTGETDEVICE _IOR('U', 202, int) | 33 | #define HCIUARTGETDEVICE _IOR('U', 202, int) |
34 | #define HCIUARTSETFLAGS _IOW('U', 203, int) | ||
35 | #define HCIUARTGETFLAGS _IOR('U', 204, int) | ||
34 | 36 | ||
35 | /* UART protocols */ | 37 | /* UART protocols */ |
36 | #define HCI_UART_MAX_PROTO 5 | 38 | #define HCI_UART_MAX_PROTO 6 |
37 | 39 | ||
38 | #define HCI_UART_H4 0 | 40 | #define HCI_UART_H4 0 |
39 | #define HCI_UART_BCSP 1 | 41 | #define HCI_UART_BCSP 1 |
40 | #define HCI_UART_3WIRE 2 | 42 | #define HCI_UART_3WIRE 2 |
41 | #define HCI_UART_H4DS 3 | 43 | #define HCI_UART_H4DS 3 |
42 | #define HCI_UART_LL 4 | 44 | #define HCI_UART_LL 4 |
45 | #define HCI_UART_ATH3K 5 | ||
46 | |||
47 | #define HCI_UART_RAW_DEVICE 0 | ||
43 | 48 | ||
44 | struct hci_uart; | 49 | struct hci_uart; |
45 | 50 | ||
@@ -57,6 +62,7 @@ struct hci_uart { | |||
57 | struct tty_struct *tty; | 62 | struct tty_struct *tty; |
58 | struct hci_dev *hdev; | 63 | struct hci_dev *hdev; |
59 | unsigned long flags; | 64 | unsigned long flags; |
65 | unsigned long hdev_flags; | ||
60 | 66 | ||
61 | struct hci_uart_proto *proto; | 67 | struct hci_uart_proto *proto; |
62 | void *priv; | 68 | void *priv; |
@@ -66,7 +72,7 @@ struct hci_uart { | |||
66 | spinlock_t rx_lock; | 72 | spinlock_t rx_lock; |
67 | }; | 73 | }; |
68 | 74 | ||
69 | /* HCI_UART flag bits */ | 75 | /* HCI_UART proto flag bits */ |
70 | #define HCI_UART_PROTO_SET 0 | 76 | #define HCI_UART_PROTO_SET 0 |
71 | 77 | ||
72 | /* TX states */ | 78 | /* TX states */ |
@@ -91,3 +97,8 @@ int bcsp_deinit(void); | |||
91 | int ll_init(void); | 97 | int ll_init(void); |
92 | int ll_deinit(void); | 98 | int ll_deinit(void); |
93 | #endif | 99 | #endif |
100 | |||
101 | #ifdef CONFIG_BT_HCIUART_ATH3K | ||
102 | int ath_init(void); | ||
103 | int ath_deinit(void); | ||
104 | #endif | ||
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index bde2fa8bb639..a105087af963 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c | |||
@@ -373,8 +373,8 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev) | |||
373 | pktlen = status & RDES0_STATUS_FL; | 373 | pktlen = status & RDES0_STATUS_FL; |
374 | if (pktlen > RX_PKT_SIZE) { | 374 | if (pktlen > RX_PKT_SIZE) { |
375 | if (net_ratelimit()) | 375 | if (net_ratelimit()) |
376 | printk(KERN_DEBUG "%s: frame too long (%d)\n", | 376 | wiphy_debug(dev->wiphy, "frame too long (%d)\n", |
377 | wiphy_name(dev->wiphy), pktlen); | 377 | pktlen); |
378 | pktlen = RX_PKT_SIZE; | 378 | pktlen = RX_PKT_SIZE; |
379 | } | 379 | } |
380 | 380 | ||
@@ -454,10 +454,10 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev) | |||
454 | 454 | ||
455 | static irqreturn_t adm8211_interrupt(int irq, void *dev_id) | 455 | static irqreturn_t adm8211_interrupt(int irq, void *dev_id) |
456 | { | 456 | { |
457 | #define ADM8211_INT(x) \ | 457 | #define ADM8211_INT(x) \ |
458 | do { \ | 458 | do { \ |
459 | if (unlikely(stsr & ADM8211_STSR_ ## x)) \ | 459 | if (unlikely(stsr & ADM8211_STSR_ ## x)) \ |
460 | printk(KERN_DEBUG "%s: " #x "\n", wiphy_name(dev->wiphy)); \ | 460 | wiphy_debug(dev->wiphy, "%s\n", #x); \ |
461 | } while (0) | 461 | } while (0) |
462 | 462 | ||
463 | struct ieee80211_hw *dev = dev_id; | 463 | struct ieee80211_hw *dev = dev_id; |
@@ -570,9 +570,9 @@ static int adm8211_write_bbp(struct ieee80211_hw *dev, u8 addr, u8 data) | |||
570 | } | 570 | } |
571 | 571 | ||
572 | if (timeout == 0) { | 572 | if (timeout == 0) { |
573 | printk(KERN_DEBUG "%s: adm8211_write_bbp(%d,%d) failed" | 573 | wiphy_debug(dev->wiphy, |
574 | " prewrite (reg=0x%08x)\n", | 574 | "adm8211_write_bbp(%d,%d) failed prewrite (reg=0x%08x)\n", |
575 | wiphy_name(dev->wiphy), addr, data, reg); | 575 | addr, data, reg); |
576 | return -ETIMEDOUT; | 576 | return -ETIMEDOUT; |
577 | } | 577 | } |
578 | 578 | ||
@@ -605,9 +605,9 @@ static int adm8211_write_bbp(struct ieee80211_hw *dev, u8 addr, u8 data) | |||
605 | if (timeout == 0) { | 605 | if (timeout == 0) { |
606 | ADM8211_CSR_WRITE(BBPCTL, ADM8211_CSR_READ(BBPCTL) & | 606 | ADM8211_CSR_WRITE(BBPCTL, ADM8211_CSR_READ(BBPCTL) & |
607 | ~ADM8211_BBPCTL_WR); | 607 | ~ADM8211_BBPCTL_WR); |
608 | printk(KERN_DEBUG "%s: adm8211_write_bbp(%d,%d) failed" | 608 | wiphy_debug(dev->wiphy, |
609 | " postwrite (reg=0x%08x)\n", | 609 | "adm8211_write_bbp(%d,%d) failed postwrite (reg=0x%08x)\n", |
610 | wiphy_name(dev->wiphy), addr, data, reg); | 610 | addr, data, reg); |
611 | return -ETIMEDOUT; | 611 | return -ETIMEDOUT; |
612 | } | 612 | } |
613 | 613 | ||
@@ -675,8 +675,8 @@ static int adm8211_rf_set_channel(struct ieee80211_hw *dev, unsigned int chan) | |||
675 | break; | 675 | break; |
676 | 676 | ||
677 | default: | 677 | default: |
678 | printk(KERN_DEBUG "%s: unsupported transceiver type %d\n", | 678 | wiphy_debug(dev->wiphy, "unsupported transceiver type %d\n", |
679 | wiphy_name(dev->wiphy), priv->transceiver_type); | 679 | priv->transceiver_type); |
680 | break; | 680 | break; |
681 | } | 681 | } |
682 | 682 | ||
@@ -732,8 +732,8 @@ static int adm8211_rf_set_channel(struct ieee80211_hw *dev, unsigned int chan) | |||
732 | 732 | ||
733 | /* Nothing to do for ADMtek BBP */ | 733 | /* Nothing to do for ADMtek BBP */ |
734 | } else if (priv->bbp_type != ADM8211_TYPE_ADMTEK) | 734 | } else if (priv->bbp_type != ADM8211_TYPE_ADMTEK) |
735 | printk(KERN_DEBUG "%s: unsupported BBP type %d\n", | 735 | wiphy_debug(dev->wiphy, "unsupported bbp type %d\n", |
736 | wiphy_name(dev->wiphy), priv->bbp_type); | 736 | priv->bbp_type); |
737 | 737 | ||
738 | ADM8211_RESTORE(); | 738 | ADM8211_RESTORE(); |
739 | 739 | ||
@@ -1027,13 +1027,12 @@ static int adm8211_hw_init_bbp(struct ieee80211_hw *dev) | |||
1027 | break; | 1027 | break; |
1028 | 1028 | ||
1029 | default: | 1029 | default: |
1030 | printk(KERN_DEBUG "%s: unsupported transceiver %d\n", | 1030 | wiphy_debug(dev->wiphy, "unsupported transceiver %d\n", |
1031 | wiphy_name(dev->wiphy), priv->transceiver_type); | 1031 | priv->transceiver_type); |
1032 | break; | 1032 | break; |
1033 | } | 1033 | } |
1034 | } else | 1034 | } else |
1035 | printk(KERN_DEBUG "%s: unsupported BBP %d\n", | 1035 | wiphy_debug(dev->wiphy, "unsupported bbp %d\n", priv->bbp_type); |
1036 | wiphy_name(dev->wiphy), priv->bbp_type); | ||
1037 | 1036 | ||
1038 | ADM8211_CSR_WRITE(SYNRF, 0); | 1037 | ADM8211_CSR_WRITE(SYNRF, 0); |
1039 | 1038 | ||
@@ -1509,15 +1508,13 @@ static int adm8211_start(struct ieee80211_hw *dev) | |||
1509 | /* Power up MAC and RF chips */ | 1508 | /* Power up MAC and RF chips */ |
1510 | retval = adm8211_hw_reset(dev); | 1509 | retval = adm8211_hw_reset(dev); |
1511 | if (retval) { | 1510 | if (retval) { |
1512 | printk(KERN_ERR "%s: hardware reset failed\n", | 1511 | wiphy_err(dev->wiphy, "hardware reset failed\n"); |
1513 | wiphy_name(dev->wiphy)); | ||
1514 | goto fail; | 1512 | goto fail; |
1515 | } | 1513 | } |
1516 | 1514 | ||
1517 | retval = adm8211_init_rings(dev); | 1515 | retval = adm8211_init_rings(dev); |
1518 | if (retval) { | 1516 | if (retval) { |
1519 | printk(KERN_ERR "%s: failed to initialize rings\n", | 1517 | wiphy_err(dev->wiphy, "failed to initialize rings\n"); |
1520 | wiphy_name(dev->wiphy)); | ||
1521 | goto fail; | 1518 | goto fail; |
1522 | } | 1519 | } |
1523 | 1520 | ||
@@ -1528,8 +1525,7 @@ static int adm8211_start(struct ieee80211_hw *dev) | |||
1528 | retval = request_irq(priv->pdev->irq, adm8211_interrupt, | 1525 | retval = request_irq(priv->pdev->irq, adm8211_interrupt, |
1529 | IRQF_SHARED, "adm8211", dev); | 1526 | IRQF_SHARED, "adm8211", dev); |
1530 | if (retval) { | 1527 | if (retval) { |
1531 | printk(KERN_ERR "%s: failed to register IRQ handler\n", | 1528 | wiphy_err(dev->wiphy, "failed to register irq handler\n"); |
1532 | wiphy_name(dev->wiphy)); | ||
1533 | goto fail; | 1529 | goto fail; |
1534 | } | 1530 | } |
1535 | 1531 | ||
@@ -1906,9 +1902,8 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, | |||
1906 | goto err_free_eeprom; | 1902 | goto err_free_eeprom; |
1907 | } | 1903 | } |
1908 | 1904 | ||
1909 | printk(KERN_INFO "%s: hwaddr %pM, Rev 0x%02x\n", | 1905 | wiphy_info(dev->wiphy, "hwaddr %pm, rev 0x%02x\n", |
1910 | wiphy_name(dev->wiphy), dev->wiphy->perm_addr, | 1906 | dev->wiphy->perm_addr, pdev->revision); |
1911 | pdev->revision); | ||
1912 | 1907 | ||
1913 | return 0; | 1908 | return 0; |
1914 | 1909 | ||
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index cd8caeab86ea..d5140a87f073 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -89,22 +89,19 @@ | |||
89 | #define DBG_DEFAULTS 0 | 89 | #define DBG_DEFAULTS 0 |
90 | 90 | ||
91 | /* Use our own dbg macro */ | 91 | /* Use our own dbg macro */ |
92 | #define at76_dbg(bits, format, arg...) \ | 92 | #define at76_dbg(bits, format, arg...) \ |
93 | do { \ | 93 | do { \ |
94 | if (at76_debug & (bits)) \ | 94 | if (at76_debug & (bits)) \ |
95 | printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , \ | 95 | printk(KERN_DEBUG DRIVER_NAME ": " format "\n", ##arg); \ |
96 | ## arg); \ | 96 | } while (0) |
97 | } while (0) | 97 | |
98 | 98 | #define at76_dbg_dump(bits, buf, len, format, arg...) \ | |
99 | #define at76_dbg_dump(bits, buf, len, format, arg...) \ | 99 | do { \ |
100 | do { \ | 100 | if (at76_debug & (bits)) { \ |
101 | if (at76_debug & (bits)) { \ | 101 | printk(KERN_DEBUG DRIVER_NAME ": " format "\n", ##arg); \ |
102 | printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , \ | 102 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len); \ |
103 | ## arg); \ | 103 | } \ |
104 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, \ | 104 | } while (0) |
105 | buf, len); \ | ||
106 | } \ | ||
107 | } while (0) | ||
108 | 105 | ||
109 | static uint at76_debug = DBG_DEFAULTS; | 106 | static uint at76_debug = DBG_DEFAULTS; |
110 | 107 | ||
@@ -658,8 +655,8 @@ static int at76_get_hw_config(struct at76_priv *priv) | |||
658 | exit: | 655 | exit: |
659 | kfree(hwcfg); | 656 | kfree(hwcfg); |
660 | if (ret < 0) | 657 | if (ret < 0) |
661 | printk(KERN_ERR "%s: cannot get HW Config (error %d)\n", | 658 | wiphy_err(priv->hw->wiphy, "cannot get hw config (error %d)\n", |
662 | wiphy_name(priv->hw->wiphy), ret); | 659 | ret); |
663 | 660 | ||
664 | return ret; | 661 | return ret; |
665 | } | 662 | } |
@@ -794,8 +791,9 @@ static int at76_wait_completion(struct at76_priv *priv, int cmd) | |||
794 | do { | 791 | do { |
795 | status = at76_get_cmd_status(priv->udev, cmd); | 792 | status = at76_get_cmd_status(priv->udev, cmd); |
796 | if (status < 0) { | 793 | if (status < 0) { |
797 | printk(KERN_ERR "%s: at76_get_cmd_status failed: %d\n", | 794 | wiphy_err(priv->hw->wiphy, |
798 | wiphy_name(priv->hw->wiphy), status); | 795 | "at76_get_cmd_status failed: %d\n", |
796 | status); | ||
799 | break; | 797 | break; |
800 | } | 798 | } |
801 | 799 | ||
@@ -810,9 +808,8 @@ static int at76_wait_completion(struct at76_priv *priv, int cmd) | |||
810 | 808 | ||
811 | schedule_timeout_interruptible(HZ / 10); /* 100 ms */ | 809 | schedule_timeout_interruptible(HZ / 10); /* 100 ms */ |
812 | if (time_after(jiffies, timeout)) { | 810 | if (time_after(jiffies, timeout)) { |
813 | printk(KERN_ERR | 811 | wiphy_err(priv->hw->wiphy, |
814 | "%s: completion timeout for command %d\n", | 812 | "completion timeout for command %d\n", cmd); |
815 | wiphy_name(priv->hw->wiphy), cmd); | ||
816 | status = -ETIMEDOUT; | 813 | status = -ETIMEDOUT; |
817 | break; | 814 | break; |
818 | } | 815 | } |
@@ -833,9 +830,9 @@ static int at76_set_mib(struct at76_priv *priv, struct set_mib_buffer *buf) | |||
833 | 830 | ||
834 | ret = at76_wait_completion(priv, CMD_SET_MIB); | 831 | ret = at76_wait_completion(priv, CMD_SET_MIB); |
835 | if (ret != CMD_STATUS_COMPLETE) { | 832 | if (ret != CMD_STATUS_COMPLETE) { |
836 | printk(KERN_INFO | 833 | wiphy_info(priv->hw->wiphy, |
837 | "%s: set_mib: at76_wait_completion failed " | 834 | "set_mib: at76_wait_completion failed with %d\n", |
838 | "with %d\n", wiphy_name(priv->hw->wiphy), ret); | 835 | ret); |
839 | ret = -EIO; | 836 | ret = -EIO; |
840 | } | 837 | } |
841 | 838 | ||
@@ -855,8 +852,8 @@ static int at76_set_radio(struct at76_priv *priv, int enable) | |||
855 | 852 | ||
856 | ret = at76_set_card_command(priv->udev, cmd, NULL, 0); | 853 | ret = at76_set_card_command(priv->udev, cmd, NULL, 0); |
857 | if (ret < 0) | 854 | if (ret < 0) |
858 | printk(KERN_ERR "%s: at76_set_card_command(%d) failed: %d\n", | 855 | wiphy_err(priv->hw->wiphy, |
859 | wiphy_name(priv->hw->wiphy), cmd, ret); | 856 | "at76_set_card_command(%d) failed: %d\n", cmd, ret); |
860 | else | 857 | else |
861 | ret = 1; | 858 | ret = 1; |
862 | 859 | ||
@@ -876,8 +873,8 @@ static int at76_set_pm_mode(struct at76_priv *priv) | |||
876 | 873 | ||
877 | ret = at76_set_mib(priv, &priv->mib_buf); | 874 | ret = at76_set_mib(priv, &priv->mib_buf); |
878 | if (ret < 0) | 875 | if (ret < 0) |
879 | printk(KERN_ERR "%s: set_mib (pm_mode) failed: %d\n", | 876 | wiphy_err(priv->hw->wiphy, "set_mib (pm_mode) failed: %d\n", |
880 | wiphy_name(priv->hw->wiphy), ret); | 877 | ret); |
881 | 878 | ||
882 | return ret; | 879 | return ret; |
883 | } | 880 | } |
@@ -893,8 +890,8 @@ static int at76_set_preamble(struct at76_priv *priv, u8 type) | |||
893 | 890 | ||
894 | ret = at76_set_mib(priv, &priv->mib_buf); | 891 | ret = at76_set_mib(priv, &priv->mib_buf); |
895 | if (ret < 0) | 892 | if (ret < 0) |
896 | printk(KERN_ERR "%s: set_mib (preamble) failed: %d\n", | 893 | wiphy_err(priv->hw->wiphy, "set_mib (preamble) failed: %d\n", |
897 | wiphy_name(priv->hw->wiphy), ret); | 894 | ret); |
898 | 895 | ||
899 | return ret; | 896 | return ret; |
900 | } | 897 | } |
@@ -910,8 +907,8 @@ static int at76_set_frag(struct at76_priv *priv, u16 size) | |||
910 | 907 | ||
911 | ret = at76_set_mib(priv, &priv->mib_buf); | 908 | ret = at76_set_mib(priv, &priv->mib_buf); |
912 | if (ret < 0) | 909 | if (ret < 0) |
913 | printk(KERN_ERR "%s: set_mib (frag threshold) failed: %d\n", | 910 | wiphy_err(priv->hw->wiphy, |
914 | wiphy_name(priv->hw->wiphy), ret); | 911 | "set_mib (frag threshold) failed: %d\n", ret); |
915 | 912 | ||
916 | return ret; | 913 | return ret; |
917 | } | 914 | } |
@@ -927,8 +924,7 @@ static int at76_set_rts(struct at76_priv *priv, u16 size) | |||
927 | 924 | ||
928 | ret = at76_set_mib(priv, &priv->mib_buf); | 925 | ret = at76_set_mib(priv, &priv->mib_buf); |
929 | if (ret < 0) | 926 | if (ret < 0) |
930 | printk(KERN_ERR "%s: set_mib (rts) failed: %d\n", | 927 | wiphy_err(priv->hw->wiphy, "set_mib (rts) failed: %d\n", ret); |
931 | wiphy_name(priv->hw->wiphy), ret); | ||
932 | 928 | ||
933 | return ret; | 929 | return ret; |
934 | } | 930 | } |
@@ -944,8 +940,8 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff) | |||
944 | 940 | ||
945 | ret = at76_set_mib(priv, &priv->mib_buf); | 941 | ret = at76_set_mib(priv, &priv->mib_buf); |
946 | if (ret < 0) | 942 | if (ret < 0) |
947 | printk(KERN_ERR "%s: set_mib (autorate fallback) failed: %d\n", | 943 | wiphy_err(priv->hw->wiphy, |
948 | wiphy_name(priv->hw->wiphy), ret); | 944 | "set_mib (autorate fallback) failed: %d\n", ret); |
949 | 945 | ||
950 | return ret; | 946 | return ret; |
951 | } | 947 | } |
@@ -963,8 +959,8 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv) | |||
963 | ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m, | 959 | ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m, |
964 | sizeof(struct mib_mac_addr)); | 960 | sizeof(struct mib_mac_addr)); |
965 | if (ret < 0) { | 961 | if (ret < 0) { |
966 | printk(KERN_ERR "%s: at76_get_mib (MAC_ADDR) failed: %d\n", | 962 | wiphy_err(priv->hw->wiphy, |
967 | wiphy_name(priv->hw->wiphy), ret); | 963 | "at76_get_mib (mac_addr) failed: %d\n", ret); |
968 | goto exit; | 964 | goto exit; |
969 | } | 965 | } |
970 | 966 | ||
@@ -992,8 +988,8 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv) | |||
992 | ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m, | 988 | ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m, |
993 | sizeof(struct mib_mac_wep)); | 989 | sizeof(struct mib_mac_wep)); |
994 | if (ret < 0) { | 990 | if (ret < 0) { |
995 | printk(KERN_ERR "%s: at76_get_mib (MAC_WEP) failed: %d\n", | 991 | wiphy_err(priv->hw->wiphy, |
996 | wiphy_name(priv->hw->wiphy), ret); | 992 | "at76_get_mib (mac_wep) failed: %d\n", ret); |
997 | goto exit; | 993 | goto exit; |
998 | } | 994 | } |
999 | 995 | ||
@@ -1029,8 +1025,8 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) | |||
1029 | ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m, | 1025 | ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m, |
1030 | sizeof(struct mib_mac_mgmt)); | 1026 | sizeof(struct mib_mac_mgmt)); |
1031 | if (ret < 0) { | 1027 | if (ret < 0) { |
1032 | printk(KERN_ERR "%s: at76_get_mib (MAC_MGMT) failed: %d\n", | 1028 | wiphy_err(priv->hw->wiphy, |
1033 | wiphy_name(priv->hw->wiphy), ret); | 1029 | "at76_get_mib (mac_mgmt) failed: %d\n", ret); |
1034 | goto exit; | 1030 | goto exit; |
1035 | } | 1031 | } |
1036 | 1032 | ||
@@ -1065,8 +1061,8 @@ static void at76_dump_mib_mac(struct at76_priv *priv) | |||
1065 | 1061 | ||
1066 | ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); | 1062 | ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); |
1067 | if (ret < 0) { | 1063 | if (ret < 0) { |
1068 | printk(KERN_ERR "%s: at76_get_mib (MAC) failed: %d\n", | 1064 | wiphy_err(priv->hw->wiphy, |
1069 | wiphy_name(priv->hw->wiphy), ret); | 1065 | "at76_get_mib (mac) failed: %d\n", ret); |
1070 | goto exit; | 1066 | goto exit; |
1071 | } | 1067 | } |
1072 | 1068 | ||
@@ -1102,8 +1098,8 @@ static void at76_dump_mib_phy(struct at76_priv *priv) | |||
1102 | 1098 | ||
1103 | ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); | 1099 | ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); |
1104 | if (ret < 0) { | 1100 | if (ret < 0) { |
1105 | printk(KERN_ERR "%s: at76_get_mib (PHY) failed: %d\n", | 1101 | wiphy_err(priv->hw->wiphy, |
1106 | wiphy_name(priv->hw->wiphy), ret); | 1102 | "at76_get_mib (phy) failed: %d\n", ret); |
1107 | goto exit; | 1103 | goto exit; |
1108 | } | 1104 | } |
1109 | 1105 | ||
@@ -1135,8 +1131,8 @@ static void at76_dump_mib_local(struct at76_priv *priv) | |||
1135 | 1131 | ||
1136 | ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local)); | 1132 | ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local)); |
1137 | if (ret < 0) { | 1133 | if (ret < 0) { |
1138 | printk(KERN_ERR "%s: at76_get_mib (LOCAL) failed: %d\n", | 1134 | wiphy_err(priv->hw->wiphy, |
1139 | wiphy_name(priv->hw->wiphy), ret); | 1135 | "at76_get_mib (local) failed: %d\n", ret); |
1140 | goto exit; | 1136 | goto exit; |
1141 | } | 1137 | } |
1142 | 1138 | ||
@@ -1161,8 +1157,8 @@ static void at76_dump_mib_mdomain(struct at76_priv *priv) | |||
1161 | ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m, | 1157 | ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m, |
1162 | sizeof(struct mib_mdomain)); | 1158 | sizeof(struct mib_mdomain)); |
1163 | if (ret < 0) { | 1159 | if (ret < 0) { |
1164 | printk(KERN_ERR "%s: at76_get_mib (MDOMAIN) failed: %d\n", | 1160 | wiphy_err(priv->hw->wiphy, |
1165 | wiphy_name(priv->hw->wiphy), ret); | 1161 | "at76_get_mib (mdomain) failed: %d\n", ret); |
1166 | goto exit; | 1162 | goto exit; |
1167 | } | 1163 | } |
1168 | 1164 | ||
@@ -1233,16 +1229,16 @@ static int at76_submit_rx_urb(struct at76_priv *priv) | |||
1233 | struct sk_buff *skb = priv->rx_skb; | 1229 | struct sk_buff *skb = priv->rx_skb; |
1234 | 1230 | ||
1235 | if (!priv->rx_urb) { | 1231 | if (!priv->rx_urb) { |
1236 | printk(KERN_ERR "%s: %s: priv->rx_urb is NULL\n", | 1232 | wiphy_err(priv->hw->wiphy, "%s: priv->rx_urb is null\n", |
1237 | wiphy_name(priv->hw->wiphy), __func__); | 1233 | __func__); |
1238 | return -EFAULT; | 1234 | return -EFAULT; |
1239 | } | 1235 | } |
1240 | 1236 | ||
1241 | if (!skb) { | 1237 | if (!skb) { |
1242 | skb = dev_alloc_skb(sizeof(struct at76_rx_buffer)); | 1238 | skb = dev_alloc_skb(sizeof(struct at76_rx_buffer)); |
1243 | if (!skb) { | 1239 | if (!skb) { |
1244 | printk(KERN_ERR "%s: cannot allocate rx skbuff\n", | 1240 | wiphy_err(priv->hw->wiphy, |
1245 | wiphy_name(priv->hw->wiphy)); | 1241 | "cannot allocate rx skbuff\n"); |
1246 | ret = -ENOMEM; | 1242 | ret = -ENOMEM; |
1247 | goto exit; | 1243 | goto exit; |
1248 | } | 1244 | } |
@@ -1261,15 +1257,14 @@ static int at76_submit_rx_urb(struct at76_priv *priv) | |||
1261 | at76_dbg(DBG_DEVSTART, | 1257 | at76_dbg(DBG_DEVSTART, |
1262 | "usb_submit_urb returned -ENODEV"); | 1258 | "usb_submit_urb returned -ENODEV"); |
1263 | else | 1259 | else |
1264 | printk(KERN_ERR "%s: rx, usb_submit_urb failed: %d\n", | 1260 | wiphy_err(priv->hw->wiphy, |
1265 | wiphy_name(priv->hw->wiphy), ret); | 1261 | "rx, usb_submit_urb failed: %d\n", ret); |
1266 | } | 1262 | } |
1267 | 1263 | ||
1268 | exit: | 1264 | exit: |
1269 | if (ret < 0 && ret != -ENODEV) | 1265 | if (ret < 0 && ret != -ENODEV) |
1270 | printk(KERN_ERR "%s: cannot submit rx urb - please unload the " | 1266 | wiphy_err(priv->hw->wiphy, |
1271 | "driver and/or power cycle the device\n", | 1267 | "cannot submit rx urb - please unload the driver and/or power cycle the device\n"); |
1272 | wiphy_name(priv->hw->wiphy)); | ||
1273 | 1268 | ||
1274 | return ret; | 1269 | return ret; |
1275 | } | 1270 | } |
@@ -1438,8 +1433,8 @@ static int at76_startup_device(struct at76_priv *priv) | |||
1438 | ret = at76_set_card_command(priv->udev, CMD_STARTUP, &priv->card_config, | 1433 | ret = at76_set_card_command(priv->udev, CMD_STARTUP, &priv->card_config, |
1439 | sizeof(struct at76_card_config)); | 1434 | sizeof(struct at76_card_config)); |
1440 | if (ret < 0) { | 1435 | if (ret < 0) { |
1441 | printk(KERN_ERR "%s: at76_set_card_command failed: %d\n", | 1436 | wiphy_err(priv->hw->wiphy, "at76_set_card_command failed: %d\n", |
1442 | wiphy_name(priv->hw->wiphy), ret); | 1437 | ret); |
1443 | return ret; | 1438 | return ret; |
1444 | } | 1439 | } |
1445 | 1440 | ||
@@ -1504,8 +1499,8 @@ static void at76_work_set_promisc(struct work_struct *work) | |||
1504 | 1499 | ||
1505 | ret = at76_set_mib(priv, &priv->mib_buf); | 1500 | ret = at76_set_mib(priv, &priv->mib_buf); |
1506 | if (ret < 0) | 1501 | if (ret < 0) |
1507 | printk(KERN_ERR "%s: set_mib (promiscuous_mode) failed: %d\n", | 1502 | wiphy_err(priv->hw->wiphy, |
1508 | wiphy_name(priv->hw->wiphy), ret); | 1503 | "set_mib (promiscuous_mode) failed: %d\n", ret); |
1509 | 1504 | ||
1510 | mutex_unlock(&priv->mtx); | 1505 | mutex_unlock(&priv->mtx); |
1511 | } | 1506 | } |
@@ -1668,16 +1663,16 @@ static int at76_join(struct at76_priv *priv) | |||
1668 | sizeof(struct at76_req_join)); | 1663 | sizeof(struct at76_req_join)); |
1669 | 1664 | ||
1670 | if (ret < 0) { | 1665 | if (ret < 0) { |
1671 | printk(KERN_ERR "%s: at76_set_card_command failed: %d\n", | 1666 | wiphy_err(priv->hw->wiphy, "at76_set_card_command failed: %d\n", |
1672 | wiphy_name(priv->hw->wiphy), ret); | 1667 | ret); |
1673 | return 0; | 1668 | return 0; |
1674 | } | 1669 | } |
1675 | 1670 | ||
1676 | ret = at76_wait_completion(priv, CMD_JOIN); | 1671 | ret = at76_wait_completion(priv, CMD_JOIN); |
1677 | at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret); | 1672 | at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret); |
1678 | if (ret != CMD_STATUS_COMPLETE) { | 1673 | if (ret != CMD_STATUS_COMPLETE) { |
1679 | printk(KERN_ERR "%s: at76_wait_completion failed: %d\n", | 1674 | wiphy_err(priv->hw->wiphy, "at76_wait_completion failed: %d\n", |
1680 | wiphy_name(priv->hw->wiphy), ret); | 1675 | ret); |
1681 | return 0; | 1676 | return 0; |
1682 | } | 1677 | } |
1683 | 1678 | ||
@@ -1745,8 +1740,8 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1745 | at76_dbg(DBG_MAC80211, "%s()", __func__); | 1740 | at76_dbg(DBG_MAC80211, "%s()", __func__); |
1746 | 1741 | ||
1747 | if (priv->tx_urb->status == -EINPROGRESS) { | 1742 | if (priv->tx_urb->status == -EINPROGRESS) { |
1748 | printk(KERN_ERR "%s: %s called while tx urb is pending\n", | 1743 | wiphy_err(priv->hw->wiphy, |
1749 | wiphy_name(priv->hw->wiphy), __func__); | 1744 | "%s called while tx urb is pending\n", __func__); |
1750 | return NETDEV_TX_BUSY; | 1745 | return NETDEV_TX_BUSY; |
1751 | } | 1746 | } |
1752 | 1747 | ||
@@ -1794,13 +1789,12 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1794 | submit_len, at76_mac80211_tx_callback, priv); | 1789 | submit_len, at76_mac80211_tx_callback, priv); |
1795 | ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC); | 1790 | ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC); |
1796 | if (ret) { | 1791 | if (ret) { |
1797 | printk(KERN_ERR "%s: error in tx submit urb: %d\n", | 1792 | wiphy_err(priv->hw->wiphy, "error in tx submit urb: %d\n", ret); |
1798 | wiphy_name(priv->hw->wiphy), ret); | ||
1799 | if (ret == -EINVAL) | 1793 | if (ret == -EINVAL) |
1800 | printk(KERN_ERR | 1794 | wiphy_err(priv->hw->wiphy, |
1801 | "%s: -EINVAL: tx urb %p hcpriv %p complete %p\n", | 1795 | "-einval: tx urb %p hcpriv %p complete %p\n", |
1802 | wiphy_name(priv->hw->wiphy), priv->tx_urb, | 1796 | priv->tx_urb, |
1803 | priv->tx_urb->hcpriv, priv->tx_urb->complete); | 1797 | priv->tx_urb->hcpriv, priv->tx_urb->complete); |
1804 | } | 1798 | } |
1805 | 1799 | ||
1806 | return 0; | 1800 | return 0; |
@@ -1817,8 +1811,8 @@ static int at76_mac80211_start(struct ieee80211_hw *hw) | |||
1817 | 1811 | ||
1818 | ret = at76_submit_rx_urb(priv); | 1812 | ret = at76_submit_rx_urb(priv); |
1819 | if (ret < 0) { | 1813 | if (ret < 0) { |
1820 | printk(KERN_ERR "%s: open: submit_rx_urb failed: %d\n", | 1814 | wiphy_err(priv->hw->wiphy, "open: submit_rx_urb failed: %d\n", |
1821 | wiphy_name(priv->hw->wiphy), ret); | 1815 | ret); |
1822 | goto error; | 1816 | goto error; |
1823 | } | 1817 | } |
1824 | 1818 | ||
@@ -2316,14 +2310,12 @@ static int at76_init_new_device(struct at76_priv *priv, | |||
2316 | 2310 | ||
2317 | priv->mac80211_registered = 1; | 2311 | priv->mac80211_registered = 1; |
2318 | 2312 | ||
2319 | printk(KERN_INFO "%s: USB %s, MAC %pM, firmware %d.%d.%d-%d\n", | 2313 | wiphy_info(priv->hw->wiphy, "usb %s, mac %pm, firmware %d.%d.%d-%d\n", |
2320 | wiphy_name(priv->hw->wiphy), | 2314 | dev_name(&interface->dev), priv->mac_addr, |
2321 | dev_name(&interface->dev), priv->mac_addr, | 2315 | priv->fw_version.major, priv->fw_version.minor, |
2322 | priv->fw_version.major, priv->fw_version.minor, | 2316 | priv->fw_version.patch, priv->fw_version.build); |
2323 | priv->fw_version.patch, priv->fw_version.build); | 2317 | wiphy_info(priv->hw->wiphy, "regulatory domain 0x%02x: %s\n", |
2324 | printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n", | 2318 | priv->regulatory_domain, priv->domain->name); |
2325 | wiphy_name(priv->hw->wiphy), | ||
2326 | priv->regulatory_domain, priv->domain->name); | ||
2327 | 2319 | ||
2328 | exit: | 2320 | exit: |
2329 | return ret; | 2321 | return ret; |
@@ -2485,7 +2477,7 @@ static void at76_disconnect(struct usb_interface *interface) | |||
2485 | if (!priv) | 2477 | if (!priv) |
2486 | return; | 2478 | return; |
2487 | 2479 | ||
2488 | printk(KERN_INFO "%s: disconnecting\n", wiphy_name(priv->hw->wiphy)); | 2480 | wiphy_info(priv->hw->wiphy, "disconnecting\n"); |
2489 | at76_delete_device(priv); | 2481 | at76_delete_device(priv); |
2490 | dev_printk(KERN_INFO, &interface->dev, "disconnected\n"); | 2482 | dev_printk(KERN_INFO, &interface->dev, "disconnected\n"); |
2491 | } | 2483 | } |
diff --git a/drivers/net/wireless/ath/ar9170/cmd.c b/drivers/net/wireless/ath/ar9170/cmd.c index cf6f5c4174a6..4604de09a8b2 100644 --- a/drivers/net/wireless/ath/ar9170/cmd.c +++ b/drivers/net/wireless/ath/ar9170/cmd.c | |||
@@ -48,8 +48,7 @@ int ar9170_write_mem(struct ar9170 *ar, const __le32 *data, size_t len) | |||
48 | 48 | ||
49 | err = ar->exec_cmd(ar, AR9170_CMD_WMEM, len, (u8 *) data, 0, NULL); | 49 | err = ar->exec_cmd(ar, AR9170_CMD_WMEM, len, (u8 *) data, 0, NULL); |
50 | if (err) | 50 | if (err) |
51 | printk(KERN_DEBUG "%s: writing memory failed\n", | 51 | wiphy_debug(ar->hw->wiphy, "writing memory failed\n"); |
52 | wiphy_name(ar->hw->wiphy)); | ||
53 | return err; | 52 | return err; |
54 | } | 53 | } |
55 | 54 | ||
@@ -67,8 +66,8 @@ int ar9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val) | |||
67 | err = ar->exec_cmd(ar, AR9170_CMD_WREG, sizeof(buf), | 66 | err = ar->exec_cmd(ar, AR9170_CMD_WREG, sizeof(buf), |
68 | (u8 *) buf, 0, NULL); | 67 | (u8 *) buf, 0, NULL); |
69 | if (err) | 68 | if (err) |
70 | printk(KERN_DEBUG "%s: writing reg %#x (val %#x) failed\n", | 69 | wiphy_debug(ar->hw->wiphy, "writing reg %#x (val %#x) failed\n", |
71 | wiphy_name(ar->hw->wiphy), reg, val); | 70 | reg, val); |
72 | return err; | 71 | return err; |
73 | } | 72 | } |
74 | 73 | ||
diff --git a/drivers/net/wireless/ath/ar9170/led.c b/drivers/net/wireless/ath/ar9170/led.c index 86c4e79f6bc8..832d90087f8a 100644 --- a/drivers/net/wireless/ath/ar9170/led.c +++ b/drivers/net/wireless/ath/ar9170/led.c | |||
@@ -133,8 +133,8 @@ static int ar9170_register_led(struct ar9170 *ar, int i, char *name, | |||
133 | err = led_classdev_register(wiphy_dev(ar->hw->wiphy), | 133 | err = led_classdev_register(wiphy_dev(ar->hw->wiphy), |
134 | &ar->leds[i].l); | 134 | &ar->leds[i].l); |
135 | if (err) | 135 | if (err) |
136 | printk(KERN_ERR "%s: failed to register %s LED (%d).\n", | 136 | wiphy_err(ar->hw->wiphy, "failed to register %s LED (%d).\n", |
137 | wiphy_name(ar->hw->wiphy), ar->leds[i].name, err); | 137 | ar->leds[i].name, err); |
138 | else | 138 | else |
139 | ar->leds[i].registered = true; | 139 | ar->leds[i].registered = true; |
140 | 140 | ||
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c index 2abc87578994..c67b05f3bcbd 100644 --- a/drivers/net/wireless/ath/ar9170/main.c +++ b/drivers/net/wireless/ath/ar9170/main.c | |||
@@ -198,12 +198,13 @@ static void ar9170_print_txheader(struct ar9170 *ar, struct sk_buff *skb) | |||
198 | struct ar9170_tx_info *arinfo = (void *) txinfo->rate_driver_data; | 198 | struct ar9170_tx_info *arinfo = (void *) txinfo->rate_driver_data; |
199 | struct ieee80211_hdr *hdr = (void *) txc->frame_data; | 199 | struct ieee80211_hdr *hdr = (void *) txc->frame_data; |
200 | 200 | ||
201 | printk(KERN_DEBUG "%s: => FRAME [skb:%p, q:%d, DA:[%pM] s:%d " | 201 | wiphy_debug(ar->hw->wiphy, |
202 | "mac_ctrl:%04x, phy_ctrl:%08x, timeout:[%d ms]]\n", | 202 | "=> FRAME [skb:%p, q:%d, DA:[%pM] s:%d " |
203 | wiphy_name(ar->hw->wiphy), skb, skb_get_queue_mapping(skb), | 203 | "mac_ctrl:%04x, phy_ctrl:%08x, timeout:[%d ms]]\n", |
204 | ieee80211_get_DA(hdr), ar9170_get_seq_h(hdr), | 204 | skb, skb_get_queue_mapping(skb), |
205 | le16_to_cpu(txc->mac_control), le32_to_cpu(txc->phy_control), | 205 | ieee80211_get_DA(hdr), ar9170_get_seq_h(hdr), |
206 | jiffies_to_msecs(arinfo->timeout - jiffies)); | 206 | le16_to_cpu(txc->mac_control), le32_to_cpu(txc->phy_control), |
207 | jiffies_to_msecs(arinfo->timeout - jiffies)); | ||
207 | } | 208 | } |
208 | 209 | ||
209 | static void __ar9170_dump_txqueue(struct ar9170 *ar, | 210 | static void __ar9170_dump_txqueue(struct ar9170 *ar, |
@@ -213,8 +214,8 @@ static void __ar9170_dump_txqueue(struct ar9170 *ar, | |||
213 | int i = 0; | 214 | int i = 0; |
214 | 215 | ||
215 | printk(KERN_DEBUG "---[ cut here ]---\n"); | 216 | printk(KERN_DEBUG "---[ cut here ]---\n"); |
216 | printk(KERN_DEBUG "%s: %d entries in queue.\n", | 217 | wiphy_debug(ar->hw->wiphy, "%d entries in queue.\n", |
217 | wiphy_name(ar->hw->wiphy), skb_queue_len(queue)); | 218 | skb_queue_len(queue)); |
218 | 219 | ||
219 | skb_queue_walk(queue, skb) { | 220 | skb_queue_walk(queue, skb) { |
220 | printk(KERN_DEBUG "index:%d =>\n", i++); | 221 | printk(KERN_DEBUG "index:%d =>\n", i++); |
@@ -244,15 +245,14 @@ static void __ar9170_dump_txstats(struct ar9170 *ar) | |||
244 | { | 245 | { |
245 | int i; | 246 | int i; |
246 | 247 | ||
247 | printk(KERN_DEBUG "%s: QoS queue stats\n", | 248 | wiphy_debug(ar->hw->wiphy, "qos queue stats\n"); |
248 | wiphy_name(ar->hw->wiphy)); | ||
249 | 249 | ||
250 | for (i = 0; i < __AR9170_NUM_TXQ; i++) | 250 | for (i = 0; i < __AR9170_NUM_TXQ; i++) |
251 | printk(KERN_DEBUG "%s: queue:%d limit:%d len:%d waitack:%d " | 251 | wiphy_debug(ar->hw->wiphy, |
252 | " stopped:%d\n", wiphy_name(ar->hw->wiphy), i, | 252 | "queue:%d limit:%d len:%d waitack:%d stopped:%d\n", |
253 | ar->tx_stats[i].limit, ar->tx_stats[i].len, | 253 | i, ar->tx_stats[i].limit, ar->tx_stats[i].len, |
254 | skb_queue_len(&ar->tx_status[i]), | 254 | skb_queue_len(&ar->tx_status[i]), |
255 | ieee80211_queue_stopped(ar->hw, i)); | 255 | ieee80211_queue_stopped(ar->hw, i)); |
256 | } | 256 | } |
257 | #endif /* AR9170_QUEUE_STOP_DEBUG */ | 257 | #endif /* AR9170_QUEUE_STOP_DEBUG */ |
258 | 258 | ||
@@ -274,9 +274,9 @@ static void ar9170_recycle_expired(struct ar9170 *ar, | |||
274 | 274 | ||
275 | if (time_is_before_jiffies(arinfo->timeout)) { | 275 | if (time_is_before_jiffies(arinfo->timeout)) { |
276 | #ifdef AR9170_QUEUE_DEBUG | 276 | #ifdef AR9170_QUEUE_DEBUG |
277 | printk(KERN_DEBUG "%s: [%ld > %ld] frame expired => " | 277 | wiphy_debug(ar->hw->wiphy, |
278 | "recycle\n", wiphy_name(ar->hw->wiphy), | 278 | "[%ld > %ld] frame expired => recycle\n", |
279 | jiffies, arinfo->timeout); | 279 | jiffies, arinfo->timeout); |
280 | ar9170_print_txheader(ar, skb); | 280 | ar9170_print_txheader(ar, skb); |
281 | #endif /* AR9170_QUEUE_DEBUG */ | 281 | #endif /* AR9170_QUEUE_DEBUG */ |
282 | __skb_unlink(skb, queue); | 282 | __skb_unlink(skb, queue); |
@@ -317,8 +317,8 @@ static void ar9170_tx_status(struct ar9170 *ar, struct sk_buff *skb, | |||
317 | break; | 317 | break; |
318 | 318 | ||
319 | default: | 319 | default: |
320 | printk(KERN_ERR "%s: invalid tx_status response (%x).\n", | 320 | wiphy_err(ar->hw->wiphy, |
321 | wiphy_name(ar->hw->wiphy), tx_status); | 321 | "invalid tx_status response (%x)\n", tx_status); |
322 | break; | 322 | break; |
323 | } | 323 | } |
324 | 324 | ||
@@ -339,8 +339,7 @@ void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb) | |||
339 | 339 | ||
340 | if (ar->tx_stats[queue].len < AR9170_NUM_TX_LIMIT_SOFT) { | 340 | if (ar->tx_stats[queue].len < AR9170_NUM_TX_LIMIT_SOFT) { |
341 | #ifdef AR9170_QUEUE_STOP_DEBUG | 341 | #ifdef AR9170_QUEUE_STOP_DEBUG |
342 | printk(KERN_DEBUG "%s: wake queue %d\n", | 342 | wiphy_debug(ar->hw->wiphy, "wake queue %d\n", queue); |
343 | wiphy_name(ar->hw->wiphy), queue); | ||
344 | __ar9170_dump_txstats(ar); | 343 | __ar9170_dump_txstats(ar); |
345 | #endif /* AR9170_QUEUE_STOP_DEBUG */ | 344 | #endif /* AR9170_QUEUE_STOP_DEBUG */ |
346 | ieee80211_wake_queue(ar->hw, queue); | 345 | ieee80211_wake_queue(ar->hw, queue); |
@@ -387,9 +386,9 @@ static struct sk_buff *ar9170_get_queued_skb(struct ar9170 *ar, | |||
387 | 386 | ||
388 | if (mac && compare_ether_addr(ieee80211_get_DA(hdr), mac)) { | 387 | if (mac && compare_ether_addr(ieee80211_get_DA(hdr), mac)) { |
389 | #ifdef AR9170_QUEUE_DEBUG | 388 | #ifdef AR9170_QUEUE_DEBUG |
390 | printk(KERN_DEBUG "%s: skip frame => DA %pM != %pM\n", | 389 | wiphy_debug(ar->hw->wiphy, |
391 | wiphy_name(ar->hw->wiphy), mac, | 390 | "skip frame => da %pm != %pm\n", |
392 | ieee80211_get_DA(hdr)); | 391 | mac, ieee80211_get_DA(hdr)); |
393 | ar9170_print_txheader(ar, skb); | 392 | ar9170_print_txheader(ar, skb); |
394 | #endif /* AR9170_QUEUE_DEBUG */ | 393 | #endif /* AR9170_QUEUE_DEBUG */ |
395 | continue; | 394 | continue; |
@@ -400,8 +399,8 @@ static struct sk_buff *ar9170_get_queued_skb(struct ar9170 *ar, | |||
400 | 399 | ||
401 | if ((rate != AR9170_TX_INVALID_RATE) && (r != rate)) { | 400 | if ((rate != AR9170_TX_INVALID_RATE) && (r != rate)) { |
402 | #ifdef AR9170_QUEUE_DEBUG | 401 | #ifdef AR9170_QUEUE_DEBUG |
403 | printk(KERN_DEBUG "%s: skip frame => rate %d != %d\n", | 402 | wiphy_debug(ar->hw->wiphy, |
404 | wiphy_name(ar->hw->wiphy), rate, r); | 403 | "skip frame => rate %d != %d\n", rate, r); |
405 | ar9170_print_txheader(ar, skb); | 404 | ar9170_print_txheader(ar, skb); |
406 | #endif /* AR9170_QUEUE_DEBUG */ | 405 | #endif /* AR9170_QUEUE_DEBUG */ |
407 | continue; | 406 | continue; |
@@ -413,9 +412,9 @@ static struct sk_buff *ar9170_get_queued_skb(struct ar9170 *ar, | |||
413 | } | 412 | } |
414 | 413 | ||
415 | #ifdef AR9170_QUEUE_DEBUG | 414 | #ifdef AR9170_QUEUE_DEBUG |
416 | printk(KERN_ERR "%s: ESS:[%pM] does not have any " | 415 | wiphy_err(ar->hw->wiphy, |
417 | "outstanding frames in queue.\n", | 416 | "ESS:[%pM] does not have any outstanding frames in queue.\n", |
418 | wiphy_name(ar->hw->wiphy), mac); | 417 | mac); |
419 | __ar9170_dump_txqueue(ar, queue); | 418 | __ar9170_dump_txqueue(ar, queue); |
420 | #endif /* AR9170_QUEUE_DEBUG */ | 419 | #endif /* AR9170_QUEUE_DEBUG */ |
421 | spin_unlock_irqrestore(&queue->lock, flags); | 420 | spin_unlock_irqrestore(&queue->lock, flags); |
@@ -444,8 +443,8 @@ static void ar9170_tx_janitor(struct work_struct *work) | |||
444 | 443 | ||
445 | for (i = 0; i < __AR9170_NUM_TXQ; i++) { | 444 | for (i = 0; i < __AR9170_NUM_TXQ; i++) { |
446 | #ifdef AR9170_QUEUE_DEBUG | 445 | #ifdef AR9170_QUEUE_DEBUG |
447 | printk(KERN_DEBUG "%s: garbage collector scans queue:%d\n", | 446 | wiphy_debug(ar->hw->wiphy, "garbage collector scans queue:%d\n", |
448 | wiphy_name(ar->hw->wiphy), i); | 447 | i); |
449 | ar9170_dump_txqueue(ar, &ar->tx_pending[i]); | 448 | ar9170_dump_txqueue(ar, &ar->tx_pending[i]); |
450 | ar9170_dump_txqueue(ar, &ar->tx_status[i]); | 449 | ar9170_dump_txqueue(ar, &ar->tx_status[i]); |
451 | #endif /* AR9170_QUEUE_DEBUG */ | 450 | #endif /* AR9170_QUEUE_DEBUG */ |
@@ -495,8 +494,9 @@ void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len) | |||
495 | u32 q = (phy & AR9170_TX_PHY_QOS_MASK) >> | 494 | u32 q = (phy & AR9170_TX_PHY_QOS_MASK) >> |
496 | AR9170_TX_PHY_QOS_SHIFT; | 495 | AR9170_TX_PHY_QOS_SHIFT; |
497 | #ifdef AR9170_QUEUE_DEBUG | 496 | #ifdef AR9170_QUEUE_DEBUG |
498 | printk(KERN_DEBUG "%s: recv tx_status for %pM, p:%08x, q:%d\n", | 497 | wiphy_debug(ar->hw->wiphy, |
499 | wiphy_name(ar->hw->wiphy), cmd->tx_status.dst, phy, q); | 498 | "recv tx_status for %pm, p:%08x, q:%d\n", |
499 | cmd->tx_status.dst, phy, q); | ||
500 | #endif /* AR9170_QUEUE_DEBUG */ | 500 | #endif /* AR9170_QUEUE_DEBUG */ |
501 | 501 | ||
502 | skb = ar9170_get_queued_skb(ar, cmd->tx_status.dst, | 502 | skb = ar9170_get_queued_skb(ar, cmd->tx_status.dst, |
@@ -582,7 +582,7 @@ void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len) | |||
582 | break; | 582 | break; |
583 | 583 | ||
584 | default: | 584 | default: |
585 | printk(KERN_INFO "received unhandled event %x\n", cmd->type); | 585 | pr_info("received unhandled event %x\n", cmd->type); |
586 | print_hex_dump_bytes("dump:", DUMP_PREFIX_NONE, buf, len); | 586 | print_hex_dump_bytes("dump:", DUMP_PREFIX_NONE, buf, len); |
587 | break; | 587 | break; |
588 | } | 588 | } |
@@ -675,9 +675,9 @@ static int ar9170_rx_mac_status(struct ar9170 *ar, | |||
675 | /* TODO: update netdevice's RX dropped/errors statistics */ | 675 | /* TODO: update netdevice's RX dropped/errors statistics */ |
676 | 676 | ||
677 | if (ar9170_nag_limiter(ar)) | 677 | if (ar9170_nag_limiter(ar)) |
678 | printk(KERN_DEBUG "%s: received frame with " | 678 | wiphy_debug(ar->hw->wiphy, |
679 | "suspicious error code (%#x).\n", | 679 | "received frame with suspicious error code (%#x).\n", |
680 | wiphy_name(ar->hw->wiphy), error); | 680 | error); |
681 | 681 | ||
682 | return -EINVAL; | 682 | return -EINVAL; |
683 | } | 683 | } |
@@ -704,9 +704,9 @@ static int ar9170_rx_mac_status(struct ar9170 *ar, | |||
704 | break; | 704 | break; |
705 | default: | 705 | default: |
706 | if (ar9170_nag_limiter(ar)) | 706 | if (ar9170_nag_limiter(ar)) |
707 | printk(KERN_ERR "%s: invalid plcp cck rate " | 707 | wiphy_err(ar->hw->wiphy, |
708 | "(%x).\n", wiphy_name(ar->hw->wiphy), | 708 | "invalid plcp cck rate (%x).\n", |
709 | head->plcp[0]); | 709 | head->plcp[0]); |
710 | return -EINVAL; | 710 | return -EINVAL; |
711 | } | 711 | } |
712 | break; | 712 | break; |
@@ -740,9 +740,9 @@ static int ar9170_rx_mac_status(struct ar9170 *ar, | |||
740 | break; | 740 | break; |
741 | default: | 741 | default: |
742 | if (ar9170_nag_limiter(ar)) | 742 | if (ar9170_nag_limiter(ar)) |
743 | printk(KERN_ERR "%s: invalid plcp ofdm rate " | 743 | wiphy_err(ar->hw->wiphy, |
744 | "(%x).\n", wiphy_name(ar->hw->wiphy), | 744 | "invalid plcp ofdm rate (%x).\n", |
745 | head->plcp[0]); | 745 | head->plcp[0]); |
746 | return -EINVAL; | 746 | return -EINVAL; |
747 | } | 747 | } |
748 | if (status->band == IEEE80211_BAND_2GHZ) | 748 | if (status->band == IEEE80211_BAND_2GHZ) |
@@ -761,8 +761,7 @@ static int ar9170_rx_mac_status(struct ar9170 *ar, | |||
761 | 761 | ||
762 | default: | 762 | default: |
763 | if (ar9170_nag_limiter(ar)) | 763 | if (ar9170_nag_limiter(ar)) |
764 | printk(KERN_ERR "%s: invalid modulation\n", | 764 | wiphy_err(ar->hw->wiphy, "invalid modulation\n"); |
765 | wiphy_name(ar->hw->wiphy)); | ||
766 | return -EINVAL; | 765 | return -EINVAL; |
767 | } | 766 | } |
768 | 767 | ||
@@ -863,8 +862,8 @@ static void ar9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) | |||
863 | ar->rx_mpdu.has_plcp = true; | 862 | ar->rx_mpdu.has_plcp = true; |
864 | } else { | 863 | } else { |
865 | if (ar9170_nag_limiter(ar)) | 864 | if (ar9170_nag_limiter(ar)) |
866 | printk(KERN_ERR "%s: plcp info is clipped.\n", | 865 | wiphy_err(ar->hw->wiphy, |
867 | wiphy_name(ar->hw->wiphy)); | 866 | "plcp info is clipped.\n"); |
868 | return ; | 867 | return ; |
869 | } | 868 | } |
870 | break; | 869 | break; |
@@ -877,8 +876,8 @@ static void ar9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) | |||
877 | phy = (void *)(buf + mpdu_len); | 876 | phy = (void *)(buf + mpdu_len); |
878 | } else { | 877 | } else { |
879 | if (ar9170_nag_limiter(ar)) | 878 | if (ar9170_nag_limiter(ar)) |
880 | printk(KERN_ERR "%s: frame tail is clipped.\n", | 879 | wiphy_err(ar->hw->wiphy, |
881 | wiphy_name(ar->hw->wiphy)); | 880 | "frame tail is clipped.\n"); |
882 | return ; | 881 | return ; |
883 | } | 882 | } |
884 | 883 | ||
@@ -888,9 +887,8 @@ static void ar9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) | |||
888 | if (!ar9170_nag_limiter(ar)) | 887 | if (!ar9170_nag_limiter(ar)) |
889 | return ; | 888 | return ; |
890 | 889 | ||
891 | printk(KERN_ERR "%s: rx stream did not start " | 890 | wiphy_err(ar->hw->wiphy, |
892 | "with a first_mpdu frame tag.\n", | 891 | "rx stream did not start with a first_mpdu frame tag.\n"); |
893 | wiphy_name(ar->hw->wiphy)); | ||
894 | 892 | ||
895 | return ; | 893 | return ; |
896 | } | 894 | } |
@@ -954,8 +952,8 @@ void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb) | |||
954 | if (!ar->rx_failover_missing) { | 952 | if (!ar->rx_failover_missing) { |
955 | /* this is no "short read". */ | 953 | /* this is no "short read". */ |
956 | if (ar9170_nag_limiter(ar)) { | 954 | if (ar9170_nag_limiter(ar)) { |
957 | printk(KERN_ERR "%s: missing tag!\n", | 955 | wiphy_err(ar->hw->wiphy, |
958 | wiphy_name(ar->hw->wiphy)); | 956 | "missing tag!\n"); |
959 | goto err_telluser; | 957 | goto err_telluser; |
960 | } else | 958 | } else |
961 | goto err_silent; | 959 | goto err_silent; |
@@ -963,9 +961,8 @@ void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb) | |||
963 | 961 | ||
964 | if (ar->rx_failover_missing > tlen) { | 962 | if (ar->rx_failover_missing > tlen) { |
965 | if (ar9170_nag_limiter(ar)) { | 963 | if (ar9170_nag_limiter(ar)) { |
966 | printk(KERN_ERR "%s: possible multi " | 964 | wiphy_err(ar->hw->wiphy, |
967 | "stream corruption!\n", | 965 | "possible multi stream corruption!\n"); |
968 | wiphy_name(ar->hw->wiphy)); | ||
969 | goto err_telluser; | 966 | goto err_telluser; |
970 | } else | 967 | } else |
971 | goto err_silent; | 968 | goto err_silent; |
@@ -997,9 +994,8 @@ void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb) | |||
997 | if (ar->rx_failover_missing) { | 994 | if (ar->rx_failover_missing) { |
998 | /* TODO: handle double stream corruption. */ | 995 | /* TODO: handle double stream corruption. */ |
999 | if (ar9170_nag_limiter(ar)) { | 996 | if (ar9170_nag_limiter(ar)) { |
1000 | printk(KERN_ERR "%s: double rx stream " | 997 | wiphy_err(ar->hw->wiphy, |
1001 | "corruption!\n", | 998 | "double rx stream corruption!\n"); |
1002 | wiphy_name(ar->hw->wiphy)); | ||
1003 | goto err_telluser; | 999 | goto err_telluser; |
1004 | } else | 1000 | } else |
1005 | goto err_silent; | 1001 | goto err_silent; |
@@ -1042,9 +1038,9 @@ void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb) | |||
1042 | 1038 | ||
1043 | if (tlen) { | 1039 | if (tlen) { |
1044 | if (net_ratelimit()) | 1040 | if (net_ratelimit()) |
1045 | printk(KERN_ERR "%s: %d bytes of unprocessed " | 1041 | wiphy_err(ar->hw->wiphy, |
1046 | "data left in rx stream!\n", | 1042 | "%d bytes of unprocessed data left in rx stream!\n", |
1047 | wiphy_name(ar->hw->wiphy), tlen); | 1043 | tlen); |
1048 | 1044 | ||
1049 | goto err_telluser; | 1045 | goto err_telluser; |
1050 | } | 1046 | } |
@@ -1052,10 +1048,9 @@ void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb) | |||
1052 | return ; | 1048 | return ; |
1053 | 1049 | ||
1054 | err_telluser: | 1050 | err_telluser: |
1055 | printk(KERN_ERR "%s: damaged RX stream data [want:%d, " | 1051 | wiphy_err(ar->hw->wiphy, |
1056 | "data:%d, rx:%d, pending:%d ]\n", | 1052 | "damaged RX stream data [want:%d, data:%d, rx:%d, pending:%d ]\n", |
1057 | wiphy_name(ar->hw->wiphy), clen, wlen, tlen, | 1053 | clen, wlen, tlen, ar->rx_failover_missing); |
1058 | ar->rx_failover_missing); | ||
1059 | 1054 | ||
1060 | if (ar->rx_failover_missing) | 1055 | if (ar->rx_failover_missing) |
1061 | print_hex_dump_bytes("rxbuf:", DUMP_PREFIX_OFFSET, | 1056 | print_hex_dump_bytes("rxbuf:", DUMP_PREFIX_OFFSET, |
@@ -1065,9 +1060,8 @@ err_telluser: | |||
1065 | print_hex_dump_bytes("stream:", DUMP_PREFIX_OFFSET, | 1060 | print_hex_dump_bytes("stream:", DUMP_PREFIX_OFFSET, |
1066 | skb->data, skb->len); | 1061 | skb->data, skb->len); |
1067 | 1062 | ||
1068 | printk(KERN_ERR "%s: please check your hardware and cables, if " | 1063 | wiphy_err(ar->hw->wiphy, |
1069 | "you see this message frequently.\n", | 1064 | "If you see this message frequently, please check your hardware and cables.\n"); |
1070 | wiphy_name(ar->hw->wiphy)); | ||
1071 | 1065 | ||
1072 | err_silent: | 1066 | err_silent: |
1073 | if (ar->rx_failover_missing) { | 1067 | if (ar->rx_failover_missing) { |
@@ -1384,10 +1378,10 @@ static void ar9170_tx(struct ar9170 *ar) | |||
1384 | 1378 | ||
1385 | if (remaining_space < frames) { | 1379 | if (remaining_space < frames) { |
1386 | #ifdef AR9170_QUEUE_DEBUG | 1380 | #ifdef AR9170_QUEUE_DEBUG |
1387 | printk(KERN_DEBUG "%s: tx quota reached queue:%d, " | 1381 | wiphy_debug(ar->hw->wiphy, |
1388 | "remaining slots:%d, needed:%d\n", | 1382 | "tx quota reached queue:%d, " |
1389 | wiphy_name(ar->hw->wiphy), i, remaining_space, | 1383 | "remaining slots:%d, needed:%d\n", |
1390 | frames); | 1384 | i, remaining_space, frames); |
1391 | #endif /* AR9170_QUEUE_DEBUG */ | 1385 | #endif /* AR9170_QUEUE_DEBUG */ |
1392 | frames = remaining_space; | 1386 | frames = remaining_space; |
1393 | } | 1387 | } |
@@ -1396,18 +1390,14 @@ static void ar9170_tx(struct ar9170 *ar) | |||
1396 | ar->tx_stats[i].count += frames; | 1390 | ar->tx_stats[i].count += frames; |
1397 | if (ar->tx_stats[i].len >= ar->tx_stats[i].limit) { | 1391 | if (ar->tx_stats[i].len >= ar->tx_stats[i].limit) { |
1398 | #ifdef AR9170_QUEUE_DEBUG | 1392 | #ifdef AR9170_QUEUE_DEBUG |
1399 | printk(KERN_DEBUG "%s: queue %d full\n", | 1393 | wiphy_debug(ar->hw->wiphy, "queue %d full\n", i); |
1400 | wiphy_name(ar->hw->wiphy), i); | 1394 | wiphy_debug(ar->hw->wiphy, "stuck frames: ===>\n"); |
1401 | |||
1402 | printk(KERN_DEBUG "%s: stuck frames: ===>\n", | ||
1403 | wiphy_name(ar->hw->wiphy)); | ||
1404 | ar9170_dump_txqueue(ar, &ar->tx_pending[i]); | 1395 | ar9170_dump_txqueue(ar, &ar->tx_pending[i]); |
1405 | ar9170_dump_txqueue(ar, &ar->tx_status[i]); | 1396 | ar9170_dump_txqueue(ar, &ar->tx_status[i]); |
1406 | #endif /* AR9170_QUEUE_DEBUG */ | 1397 | #endif /* AR9170_QUEUE_DEBUG */ |
1407 | 1398 | ||
1408 | #ifdef AR9170_QUEUE_STOP_DEBUG | 1399 | #ifdef AR9170_QUEUE_STOP_DEBUG |
1409 | printk(KERN_DEBUG "%s: stop queue %d\n", | 1400 | wiphy_debug(ar->hw->wiphy, "stop queue %d\n", i); |
1410 | wiphy_name(ar->hw->wiphy), i); | ||
1411 | __ar9170_dump_txstats(ar); | 1401 | __ar9170_dump_txstats(ar); |
1412 | #endif /* AR9170_QUEUE_STOP_DEBUG */ | 1402 | #endif /* AR9170_QUEUE_STOP_DEBUG */ |
1413 | ieee80211_stop_queue(ar->hw, i); | 1403 | ieee80211_stop_queue(ar->hw, i); |
@@ -1435,8 +1425,7 @@ static void ar9170_tx(struct ar9170 *ar) | |||
1435 | msecs_to_jiffies(AR9170_TX_TIMEOUT); | 1425 | msecs_to_jiffies(AR9170_TX_TIMEOUT); |
1436 | 1426 | ||
1437 | #ifdef AR9170_QUEUE_DEBUG | 1427 | #ifdef AR9170_QUEUE_DEBUG |
1438 | printk(KERN_DEBUG "%s: send frame q:%d =>\n", | 1428 | wiphy_debug(ar->hw->wiphy, "send frame q:%d =>\n", i); |
1439 | wiphy_name(ar->hw->wiphy), i); | ||
1440 | ar9170_print_txheader(ar, skb); | 1429 | ar9170_print_txheader(ar, skb); |
1441 | #endif /* AR9170_QUEUE_DEBUG */ | 1430 | #endif /* AR9170_QUEUE_DEBUG */ |
1442 | 1431 | ||
@@ -1453,26 +1442,25 @@ static void ar9170_tx(struct ar9170 *ar) | |||
1453 | } | 1442 | } |
1454 | 1443 | ||
1455 | #ifdef AR9170_QUEUE_DEBUG | 1444 | #ifdef AR9170_QUEUE_DEBUG |
1456 | printk(KERN_DEBUG "%s: ar9170_tx report for queue %d\n", | 1445 | wiphy_debug(ar->hw->wiphy, |
1457 | wiphy_name(ar->hw->wiphy), i); | 1446 | "ar9170_tx report for queue %d\n", i); |
1458 | 1447 | ||
1459 | printk(KERN_DEBUG "%s: unprocessed pending frames left:\n", | 1448 | wiphy_debug(ar->hw->wiphy, |
1460 | wiphy_name(ar->hw->wiphy)); | 1449 | "unprocessed pending frames left:\n"); |
1461 | ar9170_dump_txqueue(ar, &ar->tx_pending[i]); | 1450 | ar9170_dump_txqueue(ar, &ar->tx_pending[i]); |
1462 | #endif /* AR9170_QUEUE_DEBUG */ | 1451 | #endif /* AR9170_QUEUE_DEBUG */ |
1463 | 1452 | ||
1464 | if (unlikely(frames_failed)) { | 1453 | if (unlikely(frames_failed)) { |
1465 | #ifdef AR9170_QUEUE_DEBUG | 1454 | #ifdef AR9170_QUEUE_DEBUG |
1466 | printk(KERN_DEBUG "%s: frames failed %d =>\n", | 1455 | wiphy_debug(ar->hw->wiphy, |
1467 | wiphy_name(ar->hw->wiphy), frames_failed); | 1456 | "frames failed %d =>\n", frames_failed); |
1468 | #endif /* AR9170_QUEUE_DEBUG */ | 1457 | #endif /* AR9170_QUEUE_DEBUG */ |
1469 | 1458 | ||
1470 | spin_lock_irqsave(&ar->tx_stats_lock, flags); | 1459 | spin_lock_irqsave(&ar->tx_stats_lock, flags); |
1471 | ar->tx_stats[i].len -= frames_failed; | 1460 | ar->tx_stats[i].len -= frames_failed; |
1472 | ar->tx_stats[i].count -= frames_failed; | 1461 | ar->tx_stats[i].count -= frames_failed; |
1473 | #ifdef AR9170_QUEUE_STOP_DEBUG | 1462 | #ifdef AR9170_QUEUE_STOP_DEBUG |
1474 | printk(KERN_DEBUG "%s: wake queue %d\n", | 1463 | wiphy_debug(ar->hw->wiphy, "wake queue %d\n", i); |
1475 | wiphy_name(ar->hw->wiphy), i); | ||
1476 | __ar9170_dump_txstats(ar); | 1464 | __ar9170_dump_txstats(ar); |
1477 | #endif /* AR9170_QUEUE_STOP_DEBUG */ | 1465 | #endif /* AR9170_QUEUE_STOP_DEBUG */ |
1478 | ieee80211_wake_queue(ar->hw, i); | 1466 | ieee80211_wake_queue(ar->hw, i); |
@@ -1917,6 +1905,24 @@ static int ar9170_get_stats(struct ieee80211_hw *hw, | |||
1917 | return 0; | 1905 | return 0; |
1918 | } | 1906 | } |
1919 | 1907 | ||
1908 | static int ar9170_get_survey(struct ieee80211_hw *hw, int idx, | ||
1909 | struct survey_info *survey) | ||
1910 | { | ||
1911 | struct ar9170 *ar = hw->priv; | ||
1912 | struct ieee80211_conf *conf = &hw->conf; | ||
1913 | |||
1914 | if (idx != 0) | ||
1915 | return -ENOENT; | ||
1916 | |||
1917 | /* TODO: update noise value, e.g. call ar9170_set_channel */ | ||
1918 | |||
1919 | survey->channel = conf->channel; | ||
1920 | survey->filled = SURVEY_INFO_NOISE_DBM; | ||
1921 | survey->noise = ar->noise[0]; | ||
1922 | |||
1923 | return 0; | ||
1924 | } | ||
1925 | |||
1920 | static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue, | 1926 | static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue, |
1921 | const struct ieee80211_tx_queue_params *param) | 1927 | const struct ieee80211_tx_queue_params *param) |
1922 | { | 1928 | { |
@@ -1969,6 +1975,7 @@ static const struct ieee80211_ops ar9170_ops = { | |||
1969 | .get_tsf = ar9170_op_get_tsf, | 1975 | .get_tsf = ar9170_op_get_tsf, |
1970 | .set_key = ar9170_set_key, | 1976 | .set_key = ar9170_set_key, |
1971 | .get_stats = ar9170_get_stats, | 1977 | .get_stats = ar9170_get_stats, |
1978 | .get_survey = ar9170_get_survey, | ||
1972 | .ampdu_action = ar9170_ampdu_action, | 1979 | .ampdu_action = ar9170_ampdu_action, |
1973 | }; | 1980 | }; |
1974 | 1981 | ||
diff --git a/drivers/net/wireless/ath/ar9170/phy.c b/drivers/net/wireless/ath/ar9170/phy.c index 45a415ea809a..0dbfcf79ac96 100644 --- a/drivers/net/wireless/ath/ar9170/phy.c +++ b/drivers/net/wireless/ath/ar9170/phy.c | |||
@@ -670,8 +670,7 @@ static int ar9170_init_rf_banks_0_7(struct ar9170 *ar, bool band5ghz) | |||
670 | ar9170_regwrite_finish(); | 670 | ar9170_regwrite_finish(); |
671 | err = ar9170_regwrite_result(); | 671 | err = ar9170_regwrite_result(); |
672 | if (err) | 672 | if (err) |
673 | printk(KERN_ERR "%s: rf init failed\n", | 673 | wiphy_err(ar->hw->wiphy, "rf init failed\n"); |
674 | wiphy_name(ar->hw->wiphy)); | ||
675 | return err; | 674 | return err; |
676 | } | 675 | } |
677 | 676 | ||
@@ -1702,9 +1701,8 @@ int ar9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel, | |||
1702 | 0x200 | ar->phy_heavy_clip); | 1701 | 0x200 | ar->phy_heavy_clip); |
1703 | if (err) { | 1702 | if (err) { |
1704 | if (ar9170_nag_limiter(ar)) | 1703 | if (ar9170_nag_limiter(ar)) |
1705 | printk(KERN_ERR "%s: failed to set " | 1704 | wiphy_err(ar->hw->wiphy, |
1706 | "heavy clip\n", | 1705 | "failed to set heavy clip\n"); |
1707 | wiphy_name(ar->hw->wiphy)); | ||
1708 | } | 1706 | } |
1709 | } | 1707 | } |
1710 | 1708 | ||
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index ebb9c237a0d5..4cccc29964f6 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c | |||
@@ -239,6 +239,9 @@ static ssize_t read_file_beacon(struct file *file, char __user *user_buf, | |||
239 | "TSF\t\t0x%016llx\tTU: %08x\n", | 239 | "TSF\t\t0x%016llx\tTU: %08x\n", |
240 | (unsigned long long)tsf, TSF_TO_TU(tsf)); | 240 | (unsigned long long)tsf, TSF_TO_TU(tsf)); |
241 | 241 | ||
242 | if (len > sizeof(buf)) | ||
243 | len = sizeof(buf); | ||
244 | |||
242 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 245 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
243 | } | 246 | } |
244 | 247 | ||
@@ -334,6 +337,9 @@ static ssize_t read_file_debug(struct file *file, char __user *user_buf, | |||
334 | sc->debug.level == dbg_info[i].level ? '+' : ' ', | 337 | sc->debug.level == dbg_info[i].level ? '+' : ' ', |
335 | dbg_info[i].level, dbg_info[i].desc); | 338 | dbg_info[i].level, dbg_info[i].desc); |
336 | 339 | ||
340 | if (len > sizeof(buf)) | ||
341 | len = sizeof(buf); | ||
342 | |||
337 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 343 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
338 | } | 344 | } |
339 | 345 | ||
@@ -433,6 +439,9 @@ static ssize_t read_file_antenna(struct file *file, char __user *user_buf, | |||
433 | len += snprintf(buf+len, sizeof(buf)-len, | 439 | len += snprintf(buf+len, sizeof(buf)-len, |
434 | "AR5K_PHY_ANT_SWITCH_TABLE_1\t0x%08x\n", v); | 440 | "AR5K_PHY_ANT_SWITCH_TABLE_1\t0x%08x\n", v); |
435 | 441 | ||
442 | if (len > sizeof(buf)) | ||
443 | len = sizeof(buf); | ||
444 | |||
436 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 445 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
437 | } | 446 | } |
438 | 447 | ||
@@ -542,6 +551,9 @@ static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf, | |||
542 | len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n", | 551 | len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n", |
543 | st->tx_all_count); | 552 | st->tx_all_count); |
544 | 553 | ||
554 | if (len > sizeof(buf)) | ||
555 | len = sizeof(buf); | ||
556 | |||
545 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 557 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
546 | } | 558 | } |
547 | 559 | ||
@@ -681,6 +693,9 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf, | |||
681 | ATH5K_ANI_CCK_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX - | 693 | ATH5K_ANI_CCK_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX - |
682 | ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT2))); | 694 | ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT2))); |
683 | 695 | ||
696 | if (len > sizeof(buf)) | ||
697 | len = sizeof(buf); | ||
698 | |||
684 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 699 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
685 | } | 700 | } |
686 | 701 | ||
@@ -766,6 +781,9 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf, | |||
766 | len += snprintf(buf+len, sizeof(buf)-len, " len: %d\n", n); | 781 | len += snprintf(buf+len, sizeof(buf)-len, " len: %d\n", n); |
767 | } | 782 | } |
768 | 783 | ||
784 | if (len > sizeof(buf)) | ||
785 | len = sizeof(buf); | ||
786 | |||
769 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 787 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
770 | } | 788 | } |
771 | 789 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c index 85fdd26039c8..1a984b02e9e5 100644 --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ b/drivers/net/wireless/ath/ath9k/ahb.c | |||
@@ -131,11 +131,8 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
131 | 131 | ||
132 | ah = sc->sc_ah; | 132 | ah = sc->sc_ah; |
133 | ath9k_hw_name(ah, hw_name, sizeof(hw_name)); | 133 | ath9k_hw_name(ah, hw_name, sizeof(hw_name)); |
134 | printk(KERN_INFO | 134 | wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", |
135 | "%s: %s mem=0x%lx, irq=%d\n", | 135 | hw_name, (unsigned long)mem, irq); |
136 | wiphy_name(hw->wiphy), | ||
137 | hw_name, | ||
138 | (unsigned long)mem, irq); | ||
139 | 136 | ||
140 | return 0; | 137 | return 0; |
141 | 138 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index 4a910b78de52..3d2c8679bc85 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -1506,6 +1506,9 @@ static void ar5008_hw_do_getnf(struct ath_hw *ah, | |||
1506 | nf = MS(REG_READ(ah, AR_PHY_CH2_CCA), AR_PHY_CH2_MINCCA_PWR); | 1506 | nf = MS(REG_READ(ah, AR_PHY_CH2_CCA), AR_PHY_CH2_MINCCA_PWR); |
1507 | nfarray[2] = sign_extend(nf, 9); | 1507 | nfarray[2] = sign_extend(nf, 9); |
1508 | 1508 | ||
1509 | if (!IS_CHAN_HT40(ah->curchan)) | ||
1510 | return; | ||
1511 | |||
1509 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); | 1512 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); |
1510 | nfarray[3] = sign_extend(nf, 9); | 1513 | nfarray[3] = sign_extend(nf, 9); |
1511 | 1514 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c index 4922b8d4a938..adbf031fbc5a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c | |||
@@ -477,7 +477,8 @@ static void ar9002_hw_do_getnf(struct ath_hw *ah, | |||
477 | nfarray[0] = sign_extend(nf, 9); | 477 | nfarray[0] = sign_extend(nf, 9); |
478 | 478 | ||
479 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR9280_PHY_EXT_MINCCA_PWR); | 479 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR9280_PHY_EXT_MINCCA_PWR); |
480 | nfarray[3] = sign_extend(nf, 9); | 480 | if (IS_CHAN_HT40(ah->curchan)) |
481 | nfarray[3] = sign_extend(nf, 9); | ||
481 | 482 | ||
482 | if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) | 483 | if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) |
483 | return; | 484 | return; |
@@ -486,7 +487,8 @@ static void ar9002_hw_do_getnf(struct ath_hw *ah, | |||
486 | nfarray[1] = sign_extend(nf, 9); | 487 | nfarray[1] = sign_extend(nf, 9); |
487 | 488 | ||
488 | nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), AR9280_PHY_CH1_EXT_MINCCA_PWR); | 489 | nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), AR9280_PHY_CH1_EXT_MINCCA_PWR); |
489 | nfarray[4] = sign_extend(nf, 9); | 490 | if (IS_CHAN_HT40(ah->curchan)) |
491 | nfarray[4] = sign_extend(nf, 9); | ||
490 | } | 492 | } |
491 | 493 | ||
492 | static void ar9002_hw_set_nf_limits(struct ath_hw *ah) | 494 | static void ar9002_hw_set_nf_limits(struct ath_hw *ah) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 7c93338540ae..a753a431bb13 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -1029,6 +1029,9 @@ static void ar9003_hw_do_getnf(struct ath_hw *ah, | |||
1029 | nf = MS(REG_READ(ah, AR_PHY_CCA_2), AR_PHY_CH2_MINCCA_PWR); | 1029 | nf = MS(REG_READ(ah, AR_PHY_CCA_2), AR_PHY_CH2_MINCCA_PWR); |
1030 | nfarray[2] = sign_extend(nf, 9); | 1030 | nfarray[2] = sign_extend(nf, 9); |
1031 | 1031 | ||
1032 | if (!IS_CHAN_HT40(ah->curchan)) | ||
1033 | return; | ||
1034 | |||
1032 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); | 1035 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); |
1033 | nfarray[3] = sign_extend(nf, 9); | 1036 | nfarray[3] = sign_extend(nf, 9); |
1034 | 1037 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 6e486a508edb..998ae2c49ed2 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -687,7 +687,7 @@ bool ath9k_all_wiphys_idle(struct ath_softc *sc); | |||
687 | void ath9k_set_wiphy_idle(struct ath_wiphy *aphy, bool idle); | 687 | void ath9k_set_wiphy_idle(struct ath_wiphy *aphy, bool idle); |
688 | 688 | ||
689 | void ath_mac80211_stop_queue(struct ath_softc *sc, u16 skb_queue); | 689 | void ath_mac80211_stop_queue(struct ath_softc *sc, u16 skb_queue); |
690 | void ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue); | 690 | bool ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue); |
691 | 691 | ||
692 | void ath_start_rfkill_poll(struct ath_softc *sc); | 692 | void ath_start_rfkill_poll(struct ath_softc *sc); |
693 | extern void ath9k_rfkill_poll_state(struct ieee80211_hw *hw); | 693 | extern void ath9k_rfkill_poll_state(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index 7f4c55f90e74..139289e4e933 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c | |||
@@ -172,26 +172,9 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) | |||
172 | struct ath9k_nfcal_hist *h; | 172 | struct ath9k_nfcal_hist *h; |
173 | unsigned i, j; | 173 | unsigned i, j; |
174 | int32_t val; | 174 | int32_t val; |
175 | u8 chainmask; | 175 | u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; |
176 | struct ath_common *common = ath9k_hw_common(ah); | 176 | struct ath_common *common = ath9k_hw_common(ah); |
177 | 177 | ||
178 | if (AR_SREV_9300_20_OR_LATER(ah)) | ||
179 | chainmask = 0x3F; | ||
180 | else if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) | ||
181 | chainmask = 0x9; | ||
182 | else if (AR_SREV_9280(ah) || AR_SREV_9287(ah)) { | ||
183 | if ((ah->rxchainmask & 0x2) || (ah->rxchainmask & 0x4)) | ||
184 | chainmask = 0x1B; | ||
185 | else | ||
186 | chainmask = 0x09; | ||
187 | } else { | ||
188 | if (ah->rxchainmask & 0x4) | ||
189 | chainmask = 0x3F; | ||
190 | else if (ah->rxchainmask & 0x2) | ||
191 | chainmask = 0x1B; | ||
192 | else | ||
193 | chainmask = 0x09; | ||
194 | } | ||
195 | h = ah->nfCalHist; | 178 | h = ah->nfCalHist; |
196 | 179 | ||
197 | for (i = 0; i < NUM_NF_READINGS; i++) { | 180 | for (i = 0; i < NUM_NF_READINGS; i++) { |
@@ -278,7 +261,7 @@ static void ath9k_hw_nf_sanitize(struct ath_hw *ah, s16 *nf) | |||
278 | 261 | ||
279 | ath_print(common, ATH_DBG_CALIBRATE, | 262 | ath_print(common, ATH_DBG_CALIBRATE, |
280 | "NF calibrated [%s] [chain %d] is %d\n", | 263 | "NF calibrated [%s] [chain %d] is %d\n", |
281 | (i > 3 ? "ext" : "ctl"), i % 3, nf[i]); | 264 | (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); |
282 | 265 | ||
283 | if (nf[i] > limit->max) { | 266 | if (nf[i] > limit->max) { |
284 | ath_print(common, ATH_DBG_CALIBRATE, | 267 | ath_print(common, ATH_DBG_CALIBRATE, |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 32438771ca2b..cf9bcc67ade2 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -524,6 +524,9 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, | |||
524 | len += snprintf(buf + len, sizeof(buf) - len, | 524 | len += snprintf(buf + len, sizeof(buf) - len, |
525 | "%19s : %10u\n", "TX Rate", priv->debug.txrate); | 525 | "%19s : %10u\n", "TX Rate", priv->debug.txrate); |
526 | 526 | ||
527 | if (len > sizeof(buf)) | ||
528 | len = sizeof(buf); | ||
529 | |||
527 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 530 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
528 | } | 531 | } |
529 | 532 | ||
@@ -569,6 +572,9 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf, | |||
569 | "%20s : %10u\n", "VO queued", | 572 | "%20s : %10u\n", "VO queued", |
570 | priv->debug.tx_stats.queue_stats[WME_AC_VO]); | 573 | priv->debug.tx_stats.queue_stats[WME_AC_VO]); |
571 | 574 | ||
575 | if (len > sizeof(buf)) | ||
576 | len = sizeof(buf); | ||
577 | |||
572 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 578 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
573 | } | 579 | } |
574 | 580 | ||
@@ -595,6 +601,9 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
595 | "%20s : %10u\n", "SKBs Dropped", | 601 | "%20s : %10u\n", "SKBs Dropped", |
596 | priv->debug.rx_stats.skb_dropped); | 602 | priv->debug.rx_stats.skb_dropped); |
597 | 603 | ||
604 | if (len > sizeof(buf)) | ||
605 | len = sizeof(buf); | ||
606 | |||
598 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 607 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
599 | } | 608 | } |
600 | 609 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 2f83f975b891..8d291ccf5c88 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -532,7 +532,8 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
532 | 532 | ||
533 | if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) { | 533 | if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) { |
534 | if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || | 534 | if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || |
535 | (AR_SREV_9280(ah) && !ah->is_pciexpress)) { | 535 | ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) && |
536 | !ah->is_pciexpress)) { | ||
536 | ah->config.serialize_regmode = | 537 | ah->config.serialize_regmode = |
537 | SER_REG_MODE_ON; | 538 | SER_REG_MODE_ON; |
538 | } else { | 539 | } else { |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 6cf0410ae0ba..0429dda0961f 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1994,11 +1994,12 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw) | |||
1994 | 1994 | ||
1995 | mutex_lock(&sc->mutex); | 1995 | mutex_lock(&sc->mutex); |
1996 | if (ath9k_wiphy_scanning(sc)) { | 1996 | if (ath9k_wiphy_scanning(sc)) { |
1997 | printk(KERN_DEBUG "ath9k: Two wiphys trying to scan at the " | ||
1998 | "same time\n"); | ||
1999 | /* | 1997 | /* |
2000 | * Do not allow the concurrent scanning state for now. This | 1998 | * There is a race here in mac80211 but fixing it requires |
2001 | * could be improved with scanning control moved into ath9k. | 1999 | * we revisit how we handle the scan complete callback. |
2000 | * After mac80211 fixes we will not have configured hardware | ||
2001 | * to the home channel nor would we have configured the RX | ||
2002 | * filter yet. | ||
2002 | */ | 2003 | */ |
2003 | mutex_unlock(&sc->mutex); | 2004 | mutex_unlock(&sc->mutex); |
2004 | return; | 2005 | return; |
@@ -2014,6 +2015,10 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw) | |||
2014 | mutex_unlock(&sc->mutex); | 2015 | mutex_unlock(&sc->mutex); |
2015 | } | 2016 | } |
2016 | 2017 | ||
2018 | /* | ||
2019 | * XXX: this requires a revisit after the driver | ||
2020 | * scan_complete gets moved to another place/removed in mac80211. | ||
2021 | */ | ||
2017 | static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) | 2022 | static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) |
2018 | { | 2023 | { |
2019 | struct ath_wiphy *aphy = hw->priv; | 2024 | struct ath_wiphy *aphy = hw->priv; |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 257b10ba6f57..b5b651413e77 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -209,11 +209,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | ath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name)); | 211 | ath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name)); |
212 | printk(KERN_INFO | 212 | wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", |
213 | "%s: %s mem=0x%lx, irq=%d\n", | 213 | hw_name, (unsigned long)mem, pdev->irq); |
214 | wiphy_name(hw->wiphy), | ||
215 | hw_name, | ||
216 | (unsigned long)mem, pdev->irq); | ||
217 | 214 | ||
218 | return 0; | 215 | return 0; |
219 | 216 | ||
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 600ee0ba2880..e49be733d546 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -20,95 +20,145 @@ | |||
20 | #include "ath9k.h" | 20 | #include "ath9k.h" |
21 | 21 | ||
22 | static const struct ath_rate_table ar5416_11na_ratetable = { | 22 | static const struct ath_rate_table ar5416_11na_ratetable = { |
23 | 43, | 23 | 68, |
24 | 8, /* MCS start */ | 24 | 8, /* MCS start */ |
25 | { | 25 | { |
26 | { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ | 26 | [0] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 6000, |
27 | 5400, 0, 12, 0, 0, 0, 0, 0 }, | 27 | 5400, 0, 12, 0, 0, 0, 0 }, /* 6 Mb */ |
28 | { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ | 28 | [1] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 9000, |
29 | 7800, 1, 18, 0, 1, 1, 1, 1 }, | 29 | 7800, 1, 18, 0, 1, 1, 1 }, /* 9 Mb */ |
30 | { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ | 30 | [2] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 12000, |
31 | 10000, 2, 24, 2, 2, 2, 2, 2 }, | 31 | 10000, 2, 24, 2, 2, 2, 2 }, /* 12 Mb */ |
32 | { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ | 32 | [3] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 18000, |
33 | 13900, 3, 36, 2, 3, 3, 3, 3 }, | 33 | 13900, 3, 36, 2, 3, 3, 3 }, /* 18 Mb */ |
34 | { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ | 34 | [4] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 24000, |
35 | 17300, 4, 48, 4, 4, 4, 4, 4 }, | 35 | 17300, 4, 48, 4, 4, 4, 4 }, /* 24 Mb */ |
36 | { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ | 36 | [5] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 36000, |
37 | 23000, 5, 72, 4, 5, 5, 5, 5 }, | 37 | 23000, 5, 72, 4, 5, 5, 5 }, /* 36 Mb */ |
38 | { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ | 38 | [6] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 48000, |
39 | 27400, 6, 96, 4, 6, 6, 6, 6 }, | 39 | 27400, 6, 96, 4, 6, 6, 6 }, /* 48 Mb */ |
40 | { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ | 40 | [7] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 54000, |
41 | 29300, 7, 108, 4, 7, 7, 7, 7 }, | 41 | 29300, 7, 108, 4, 7, 7, 7 }, /* 54 Mb */ |
42 | { VALID_2040, VALID_2040, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ | 42 | [8] = { RC_HT_SDT_2040, WLAN_RC_PHY_HT_20_SS, 6500, |
43 | 6400, 0, 0, 0, 8, 25, 8, 25 }, | 43 | 6400, 0, 0, 0, 38, 8, 38 }, /* 6.5 Mb */ |
44 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ | 44 | [9] = { RC_HT_SDT_20, WLAN_RC_PHY_HT_20_SS, 13000, |
45 | 12700, 1, 1, 2, 9, 26, 9, 26 }, | 45 | 12700, 1, 1, 2, 39, 9, 39 }, /* 13 Mb */ |
46 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ | 46 | [10] = { RC_HT_SDT_20, WLAN_RC_PHY_HT_20_SS, 19500, |
47 | 18800, 2, 2, 2, 10, 27, 10, 27 }, | 47 | 18800, 2, 2, 2, 40, 10, 40 }, /* 19.5 Mb */ |
48 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ | 48 | [11] = { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 26000, |
49 | 25000, 3, 3, 4, 11, 28, 11, 28 }, | 49 | 25000, 3, 3, 4, 41, 11, 41 }, /* 26 Mb */ |
50 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ | 50 | [12] = { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 39000, |
51 | 36700, 4, 4, 4, 12, 29, 12, 29 }, | 51 | 36700, 4, 4, 4, 42, 12, 42 }, /* 39 Mb */ |
52 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ | 52 | [13] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 52000, |
53 | 48100, 5, 5, 4, 13, 30, 13, 30 }, | 53 | 48100, 5, 5, 4, 43, 13, 43 }, /* 52 Mb */ |
54 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ | 54 | [14] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 58500, |
55 | 53500, 6, 6, 4, 14, 31, 14, 31 }, | 55 | 53500, 6, 6, 4, 44, 14, 44 }, /* 58.5 Mb */ |
56 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ | 56 | [15] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 65000, |
57 | 59000, 7, 7, 4, 15, 32, 15, 33 }, | 57 | 59000, 7, 7, 4, 45, 16, 46 }, /* 65 Mb */ |
58 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ | 58 | [16] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS_HGI, 72200, |
59 | 12700, 8, 8, 3, 16, 34, 16, 34 }, | 59 | 65400, 7, 7, 4, 45, 16, 46 }, /* 75 Mb */ |
60 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ | 60 | [17] = { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 13000, |
61 | 24800, 9, 9, 2, 17, 35, 17, 35 }, | 61 | 12700, 8, 8, 0, 47, 17, 47 }, /* 13 Mb */ |
62 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ | 62 | [18] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_DS, 26000, |
63 | 36600, 10, 10, 2, 18, 36, 18, 36 }, | 63 | 24800, 9, 9, 2, 48, 18, 48 }, /* 26 Mb */ |
64 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ | 64 | [19] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_DS, 39000, |
65 | 48100, 11, 11, 4, 19, 37, 19, 37 }, | 65 | 36600, 10, 10, 2, 49, 19, 49 }, /* 39 Mb */ |
66 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ | 66 | [20] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 52000, |
67 | 69500, 12, 12, 4, 20, 38, 20, 38 }, | 67 | 48100, 11, 11, 4, 50, 20, 50 }, /* 52 Mb */ |
68 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ | 68 | [21] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 78000, |
69 | 89500, 13, 13, 4, 21, 39, 21, 39 }, | 69 | 69500, 12, 12, 4, 51, 21, 51 }, /* 78 Mb */ |
70 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ | 70 | [22] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 104000, |
71 | 98900, 14, 14, 4, 22, 40, 22, 40 }, | 71 | 89500, 13, 13, 4, 52, 22, 52 }, /* 104 Mb */ |
72 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ | 72 | [23] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 117000, |
73 | 108300, 15, 15, 4, 23, 41, 24, 42 }, | 73 | 98900, 14, 14, 4, 53, 23, 53 }, /* 117 Mb */ |
74 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS_HGI, 144400, /* 144.4 Mb */ | 74 | [24] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 130000, |
75 | 12000, 15, 15, 4, 23, 41, 24, 42 }, | 75 | 108300, 15, 15, 4, 54, 25, 55 }, /* 130 Mb */ |
76 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ | 76 | [25] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS_HGI, 144400, |
77 | 13200, 0, 0, 0, 8, 25, 25, 25 }, | 77 | 120000, 15, 15, 4, 54, 25, 55 }, /* 144.4 Mb */ |
78 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ | 78 | [26] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 19500, |
79 | 25900, 1, 1, 2, 9, 26, 26, 26 }, | 79 | 17400, 16, 16, 0, 56, 26, 56 }, /* 19.5 Mb */ |
80 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ | 80 | [27] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 39000, |
81 | 38600, 2, 2, 2, 10, 27, 27, 27 }, | 81 | 35100, 17, 17, 2, 57, 27, 57 }, /* 39 Mb */ |
82 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ | 82 | [28] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 58500, |
83 | 49800, 3, 3, 4, 11, 28, 28, 28 }, | 83 | 52600, 18, 18, 2, 58, 28, 58 }, /* 58.5 Mb */ |
84 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ | 84 | [29] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 78000, |
85 | 72200, 4, 4, 4, 12, 29, 29, 29 }, | 85 | 70400, 19, 19, 4, 59, 29, 59 }, /* 78 Mb */ |
86 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ | 86 | [30] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 117000, |
87 | 92900, 5, 5, 4, 13, 30, 30, 30 }, | 87 | 104900, 20, 20, 4, 60, 31, 61 }, /* 117 Mb */ |
88 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ | 88 | [31] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS_HGI, 130000, |
89 | 102700, 6, 6, 4, 14, 31, 31, 31 }, | 89 | 115800, 20, 20, 4, 60, 31, 61 }, /* 130 Mb*/ |
90 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ | 90 | [32] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 156000, |
91 | 112000, 7, 7, 4, 15, 32, 33, 33 }, | 91 | 137200, 21, 21, 4, 62, 33, 63 }, /* 156 Mb */ |
92 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ | 92 | [33] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 173300, |
93 | 122000, 7, 7, 4, 15, 32, 33, 33 }, | 93 | 151100, 21, 21, 4, 62, 33, 63 }, /* 173.3 Mb */ |
94 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ | 94 | [34] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 175500, |
95 | 25800, 8, 8, 0, 16, 34, 34, 34 }, | 95 | 152800, 22, 22, 4, 64, 35, 65 }, /* 175.5 Mb */ |
96 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ | 96 | [35] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 195000, |
97 | 49800, 9, 9, 2, 17, 35, 35, 35 }, | 97 | 168400, 22, 22, 4, 64, 35, 65 }, /* 195 Mb*/ |
98 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ | 98 | [36] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 195000, |
99 | 71900, 10, 10, 2, 18, 36, 36, 36 }, | 99 | 168400, 23, 23, 4, 66, 37, 67 }, /* 195 Mb */ |
100 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ | 100 | [37] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 216700, |
101 | 92500, 11, 11, 4, 19, 37, 37, 37 }, | 101 | 185000, 23, 23, 4, 66, 37, 67 }, /* 216.7 Mb */ |
102 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ | 102 | [38] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 13500, |
103 | 130300, 12, 12, 4, 20, 38, 38, 38 }, | 103 | 13200, 0, 0, 0, 38, 38, 38 }, /* 13.5 Mb*/ |
104 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ | 104 | [39] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 27500, |
105 | 162800, 13, 13, 4, 21, 39, 39, 39 }, | 105 | 25900, 1, 1, 2, 39, 39, 39 }, /* 27.0 Mb*/ |
106 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ | 106 | [40] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 40500, |
107 | 178200, 14, 14, 4, 22, 40, 40, 40 }, | 107 | 38600, 2, 2, 2, 40, 40, 40 }, /* 40.5 Mb*/ |
108 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ | 108 | [41] = { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 54000, |
109 | 192100, 15, 15, 4, 23, 41, 42, 42 }, | 109 | 49800, 3, 3, 4, 41, 41, 41 }, /* 54 Mb */ |
110 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ | 110 | [42] = { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 81500, |
111 | 207000, 15, 15, 4, 23, 41, 42, 42 }, | 111 | 72200, 4, 4, 4, 42, 42, 42 }, /* 81 Mb */ |
112 | [43] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 108000, | ||
113 | 92900, 5, 5, 4, 43, 43, 43 }, /* 108 Mb */ | ||
114 | [44] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 121500, | ||
115 | 102700, 6, 6, 4, 44, 44, 44 }, /* 121.5 Mb*/ | ||
116 | [45] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 135000, | ||
117 | 112000, 7, 7, 4, 45, 46, 46 }, /* 135 Mb */ | ||
118 | [46] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, | ||
119 | 122000, 7, 7, 4, 45, 46, 46 }, /* 150 Mb */ | ||
120 | [47] = { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 27000, | ||
121 | 25800, 8, 8, 0, 47, 47, 47 }, /* 27 Mb */ | ||
122 | [48] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_DS, 54000, | ||
123 | 49800, 9, 9, 2, 48, 48, 48 }, /* 54 Mb */ | ||
124 | [49] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_DS, 81000, | ||
125 | 71900, 10, 10, 2, 49, 49, 49 }, /* 81 Mb */ | ||
126 | [50] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 108000, | ||
127 | 92500, 11, 11, 4, 50, 50, 50 }, /* 108 Mb */ | ||
128 | [51] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 162000, | ||
129 | 130300, 12, 12, 4, 51, 51, 51 }, /* 162 Mb */ | ||
130 | [52] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 216000, | ||
131 | 162800, 13, 13, 4, 52, 52, 52 }, /* 216 Mb */ | ||
132 | [53] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 243000, | ||
133 | 178200, 14, 14, 4, 53, 53, 53 }, /* 243 Mb */ | ||
134 | [54] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 270000, | ||
135 | 192100, 15, 15, 4, 54, 55, 55 }, /* 270 Mb */ | ||
136 | [55] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS_HGI, 300000, | ||
137 | 207000, 15, 15, 4, 54, 55, 55 }, /* 300 Mb */ | ||
138 | [56] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 40500, | ||
139 | 36100, 16, 16, 0, 56, 56, 56 }, /* 40.5 Mb */ | ||
140 | [57] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 81000, | ||
141 | 72900, 17, 17, 2, 57, 57, 57 }, /* 81 Mb */ | ||
142 | [58] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 121500, | ||
143 | 108300, 18, 18, 2, 58, 58, 58 }, /* 121.5 Mb */ | ||
144 | [59] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 162000, | ||
145 | 142000, 19, 19, 4, 59, 59, 59 }, /* 162 Mb */ | ||
146 | [60] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 243000, | ||
147 | 205100, 20, 20, 4, 60, 61, 61 }, /* 243 Mb */ | ||
148 | [61] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS_HGI, 270000, | ||
149 | 224700, 20, 20, 4, 60, 61, 61 }, /* 270 Mb */ | ||
150 | [62] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 324000, | ||
151 | 263100, 21, 21, 4, 62, 63, 63 }, /* 324 Mb */ | ||
152 | [63] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 360000, | ||
153 | 288000, 21, 21, 4, 62, 63, 63 }, /* 360 Mb */ | ||
154 | [64] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 364500, | ||
155 | 290700, 22, 22, 4, 64, 65, 65 }, /* 364.5 Mb */ | ||
156 | [65] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 405000, | ||
157 | 317200, 22, 22, 4, 64, 65, 65 }, /* 405 Mb */ | ||
158 | [66] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 405000, | ||
159 | 317200, 23, 23, 4, 66, 67, 67 }, /* 405 Mb */ | ||
160 | [67] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 450000, | ||
161 | 346400, 23, 23, 4, 66, 67, 67 }, /* 450 Mb */ | ||
112 | }, | 162 | }, |
113 | 50, /* probe interval */ | 163 | 50, /* probe interval */ |
114 | WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ | 164 | WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ |
@@ -118,103 +168,153 @@ static const struct ath_rate_table ar5416_11na_ratetable = { | |||
118 | * for HT are the 64K max aggregate limit */ | 168 | * for HT are the 64K max aggregate limit */ |
119 | 169 | ||
120 | static const struct ath_rate_table ar5416_11ng_ratetable = { | 170 | static const struct ath_rate_table ar5416_11ng_ratetable = { |
121 | 47, | 171 | 72, |
122 | 12, /* MCS start */ | 172 | 12, /* MCS start */ |
123 | { | 173 | { |
124 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ | 174 | [0] = { RC_ALL, WLAN_RC_PHY_CCK, 1000, |
125 | 900, 0, 2, 0, 0, 0, 0, 0 }, | 175 | 900, 0, 2, 0, 0, 0, 0 }, /* 1 Mb */ |
126 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ | 176 | [1] = { RC_ALL, WLAN_RC_PHY_CCK, 2000, |
127 | 1900, 1, 4, 1, 1, 1, 1, 1 }, | 177 | 1900, 1, 4, 1, 1, 1, 1 }, /* 2 Mb */ |
128 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ | 178 | [2] = { RC_ALL, WLAN_RC_PHY_CCK, 5500, |
129 | 4900, 2, 11, 2, 2, 2, 2, 2 }, | 179 | 4900, 2, 11, 2, 2, 2, 2 }, /* 5.5 Mb */ |
130 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ | 180 | [3] = { RC_ALL, WLAN_RC_PHY_CCK, 11000, |
131 | 8100, 3, 22, 3, 3, 3, 3, 3 }, | 181 | 8100, 3, 22, 3, 3, 3, 3 }, /* 11 Mb */ |
132 | { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ | 182 | [4] = { RC_INVALID, WLAN_RC_PHY_OFDM, 6000, |
133 | 5400, 4, 12, 4, 4, 4, 4, 4 }, | 183 | 5400, 4, 12, 4, 4, 4, 4 }, /* 6 Mb */ |
134 | { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ | 184 | [5] = { RC_INVALID, WLAN_RC_PHY_OFDM, 9000, |
135 | 7800, 5, 18, 4, 5, 5, 5, 5 }, | 185 | 7800, 5, 18, 4, 5, 5, 5 }, /* 9 Mb */ |
136 | { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ | 186 | [6] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 12000, |
137 | 10100, 6, 24, 6, 6, 6, 6, 6 }, | 187 | 10100, 6, 24, 6, 6, 6, 6 }, /* 12 Mb */ |
138 | { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ | 188 | [7] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 18000, |
139 | 14100, 7, 36, 6, 7, 7, 7, 7 }, | 189 | 14100, 7, 36, 6, 7, 7, 7 }, /* 18 Mb */ |
140 | { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ | 190 | [8] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 24000, |
141 | 17700, 8, 48, 8, 8, 8, 8, 8 }, | 191 | 17700, 8, 48, 8, 8, 8, 8 }, /* 24 Mb */ |
142 | { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ | 192 | [9] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 36000, |
143 | 23700, 9, 72, 8, 9, 9, 9, 9 }, | 193 | 23700, 9, 72, 8, 9, 9, 9 }, /* 36 Mb */ |
144 | { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ | 194 | [10] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 48000, |
145 | 27400, 10, 96, 8, 10, 10, 10, 10 }, | 195 | 27400, 10, 96, 8, 10, 10, 10 }, /* 48 Mb */ |
146 | { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ | 196 | [11] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 54000, |
147 | 30900, 11, 108, 8, 11, 11, 11, 11 }, | 197 | 30900, 11, 108, 8, 11, 11, 11 }, /* 54 Mb */ |
148 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ | 198 | [12] = { RC_INVALID, WLAN_RC_PHY_HT_20_SS, 6500, |
149 | 6400, 0, 0, 4, 12, 29, 12, 29 }, | 199 | 6400, 0, 0, 4, 42, 12, 42 }, /* 6.5 Mb */ |
150 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ | 200 | [13] = { RC_HT_SDT_20, WLAN_RC_PHY_HT_20_SS, 13000, |
151 | 12700, 1, 1, 6, 13, 30, 13, 30 }, | 201 | 12700, 1, 1, 6, 43, 13, 43 }, /* 13 Mb */ |
152 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ | 202 | [14] = { RC_HT_SDT_20, WLAN_RC_PHY_HT_20_SS, 19500, |
153 | 18800, 2, 2, 6, 14, 31, 14, 31 }, | 203 | 18800, 2, 2, 6, 44, 14, 44 }, /* 19.5 Mb*/ |
154 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ | 204 | [15] = { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 26000, |
155 | 25000, 3, 3, 8, 15, 32, 15, 32 }, | 205 | 25000, 3, 3, 8, 45, 15, 45 }, /* 26 Mb */ |
156 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ | 206 | [16] = { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 39000, |
157 | 36700, 4, 4, 8, 16, 33, 16, 33 }, | 207 | 36700, 4, 4, 8, 46, 16, 46 }, /* 39 Mb */ |
158 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ | 208 | [17] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 52000, |
159 | 48100, 5, 5, 8, 17, 34, 17, 34 }, | 209 | 48100, 5, 5, 8, 47, 17, 47 }, /* 52 Mb */ |
160 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ | 210 | [18] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 58500, |
161 | 53500, 6, 6, 8, 18, 35, 18, 35 }, | 211 | 53500, 6, 6, 8, 48, 18, 48 }, /* 58.5 Mb */ |
162 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ | 212 | [19] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 65000, |
163 | 59000, 7, 7, 8, 19, 36, 19, 37 }, | 213 | 59000, 7, 7, 8, 49, 20, 50 }, /* 65 Mb */ |
164 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ | 214 | [20] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS_HGI, 72200, |
165 | 12700, 8, 8, 4, 20, 38, 20, 38 }, | 215 | 65400, 7, 7, 8, 49, 20, 50 }, /* 65 Mb*/ |
166 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ | 216 | [21] = { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 13000, |
167 | 24800, 9, 9, 6, 21, 39, 21, 39 }, | 217 | 12700, 8, 8, 4, 51, 21, 51 }, /* 13 Mb */ |
168 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ | 218 | [22] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_DS, 26000, |
169 | 36600, 10, 10, 6, 22, 40, 22, 40 }, | 219 | 24800, 9, 9, 6, 52, 22, 52 }, /* 26 Mb */ |
170 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ | 220 | [23] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_DS, 39000, |
171 | 48100, 11, 11, 8, 23, 41, 23, 41 }, | 221 | 36600, 10, 10, 6, 53, 23, 53 }, /* 39 Mb */ |
172 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ | 222 | [24] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 52000, |
173 | 69500, 12, 12, 8, 24, 42, 24, 42 }, | 223 | 48100, 11, 11, 8, 54, 24, 54 }, /* 52 Mb */ |
174 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ | 224 | [25] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 78000, |
175 | 89500, 13, 13, 8, 25, 43, 25, 43 }, | 225 | 69500, 12, 12, 8, 55, 25, 55 }, /* 78 Mb */ |
176 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ | 226 | [26] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 104000, |
177 | 98900, 14, 14, 8, 26, 44, 26, 44 }, | 227 | 89500, 13, 13, 8, 56, 26, 56 }, /* 104 Mb */ |
178 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ | 228 | [27] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 117000, |
179 | 108300, 15, 15, 8, 27, 45, 28, 46 }, | 229 | 98900, 14, 14, 8, 57, 27, 57 }, /* 117 Mb */ |
180 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS_HGI, 144400, /* 130 Mb */ | 230 | [28] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 130000, |
181 | 120000, 15, 15, 8, 27, 45, 28, 46 }, | 231 | 108300, 15, 15, 8, 58, 29, 59 }, /* 130 Mb */ |
182 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ | 232 | [29] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS_HGI, 144400, |
183 | 13200, 0, 0, 8, 12, 29, 29, 29 }, | 233 | 120000, 15, 15, 8, 58, 29, 59 }, /* 144.4 Mb */ |
184 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ | 234 | [30] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 19500, |
185 | 25900, 1, 1, 8, 13, 30, 30, 30 }, | 235 | 17400, 16, 16, 4, 60, 30, 60 }, /* 19.5 Mb */ |
186 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ | 236 | [31] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 39000, |
187 | 38600, 2, 2, 8, 14, 31, 31, 31 }, | 237 | 35100, 17, 17, 6, 61, 31, 61 }, /* 39 Mb */ |
188 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ | 238 | [32] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 58500, |
189 | 49800, 3, 3, 8, 15, 32, 32, 32 }, | 239 | 52600, 18, 18, 6, 62, 32, 62 }, /* 58.5 Mb */ |
190 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ | 240 | [33] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 78000, |
191 | 72200, 4, 4, 8, 16, 33, 33, 33 }, | 241 | 70400, 19, 19, 8, 63, 33, 63 }, /* 78 Mb */ |
192 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ | 242 | [34] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 117000, |
193 | 92900, 5, 5, 8, 17, 34, 34, 34 }, | 243 | 104900, 20, 20, 8, 64, 35, 65 }, /* 117 Mb */ |
194 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ | 244 | [35] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS_HGI, 130000, |
195 | 102700, 6, 6, 8, 18, 35, 35, 35 }, | 245 | 115800, 20, 20, 8, 64, 35, 65 }, /* 130 Mb */ |
196 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ | 246 | [36] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 156000, |
197 | 112000, 7, 7, 8, 19, 36, 37, 37 }, | 247 | 137200, 21, 21, 8, 66, 37, 67 }, /* 156 Mb */ |
198 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ | 248 | [37] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 173300, |
199 | 122000, 7, 7, 8, 19, 36, 37, 37 }, | 249 | 151100, 21, 21, 8, 66, 37, 67 }, /* 173.3 Mb */ |
200 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ | 250 | [38] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 175500, |
201 | 25800, 8, 8, 8, 20, 38, 38, 38 }, | 251 | 152800, 22, 22, 8, 68, 39, 69 }, /* 175.5 Mb */ |
202 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ | 252 | [39] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 195000, |
203 | 49800, 9, 9, 8, 21, 39, 39, 39 }, | 253 | 168400, 22, 22, 8, 68, 39, 69 }, /* 195 Mb */ |
204 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ | 254 | [40] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 195000, |
205 | 71900, 10, 10, 8, 22, 40, 40, 40 }, | 255 | 168400, 23, 23, 8, 70, 41, 71 }, /* 195 Mb */ |
206 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ | 256 | [41] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 216700, |
207 | 92500, 11, 11, 8, 23, 41, 41, 41 }, | 257 | 185000, 23, 23, 8, 70, 41, 71 }, /* 216.7 Mb */ |
208 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ | 258 | [42] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 13500, |
209 | 130300, 12, 12, 8, 24, 42, 42, 42 }, | 259 | 13200, 0, 0, 8, 42, 42, 42 }, /* 13.5 Mb */ |
210 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ | 260 | [43] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 27500, |
211 | 162800, 13, 13, 8, 25, 43, 43, 43 }, | 261 | 25900, 1, 1, 8, 43, 43, 43 }, /* 27.0 Mb */ |
212 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ | 262 | [44] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 40500, |
213 | 178200, 14, 14, 8, 26, 44, 44, 44 }, | 263 | 38600, 2, 2, 8, 44, 44, 44 }, /* 40.5 Mb */ |
214 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ | 264 | [45] = { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 54000, |
215 | 192100, 15, 15, 8, 27, 45, 46, 46 }, | 265 | 49800, 3, 3, 8, 45, 45, 45 }, /* 54 Mb */ |
216 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ | 266 | [46] = { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 81500, |
217 | 207000, 15, 15, 8, 27, 45, 46, 46 }, | 267 | 72200, 4, 4, 8, 46, 46, 46 }, /* 81 Mb */ |
268 | [47] = { RC_HT_S_40 , WLAN_RC_PHY_HT_40_SS, 108000, | ||
269 | 92900, 5, 5, 8, 47, 47, 47 }, /* 108 Mb */ | ||
270 | [48] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 121500, | ||
271 | 102700, 6, 6, 8, 48, 48, 48 }, /* 121.5 Mb */ | ||
272 | [49] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 135000, | ||
273 | 112000, 7, 7, 8, 49, 50, 50 }, /* 135 Mb */ | ||
274 | [50] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, | ||
275 | 122000, 7, 7, 8, 49, 50, 50 }, /* 150 Mb */ | ||
276 | [51] = { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 27000, | ||
277 | 25800, 8, 8, 8, 51, 51, 51 }, /* 27 Mb */ | ||
278 | [52] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_DS, 54000, | ||
279 | 49800, 9, 9, 8, 52, 52, 52 }, /* 54 Mb */ | ||
280 | [53] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_DS, 81000, | ||
281 | 71900, 10, 10, 8, 53, 53, 53 }, /* 81 Mb */ | ||
282 | [54] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 108000, | ||
283 | 92500, 11, 11, 8, 54, 54, 54 }, /* 108 Mb */ | ||
284 | [55] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 162000, | ||
285 | 130300, 12, 12, 8, 55, 55, 55 }, /* 162 Mb */ | ||
286 | [56] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 216000, | ||
287 | 162800, 13, 13, 8, 56, 56, 56 }, /* 216 Mb */ | ||
288 | [57] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 243000, | ||
289 | 178200, 14, 14, 8, 57, 57, 57 }, /* 243 Mb */ | ||
290 | [58] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 270000, | ||
291 | 192100, 15, 15, 8, 58, 59, 59 }, /* 270 Mb */ | ||
292 | [59] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS_HGI, 300000, | ||
293 | 207000, 15, 15, 8, 58, 59, 59 }, /* 300 Mb */ | ||
294 | [60] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 40500, | ||
295 | 36100, 16, 16, 8, 60, 60, 60 }, /* 40.5 Mb */ | ||
296 | [61] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 81000, | ||
297 | 72900, 17, 17, 8, 61, 61, 61 }, /* 81 Mb */ | ||
298 | [62] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 121500, | ||
299 | 108300, 18, 18, 8, 62, 62, 62 }, /* 121.5 Mb */ | ||
300 | [63] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 162000, | ||
301 | 142000, 19, 19, 8, 63, 63, 63 }, /* 162 Mb */ | ||
302 | [64] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 243000, | ||
303 | 205100, 20, 20, 8, 64, 65, 65 }, /* 243 Mb */ | ||
304 | [65] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS_HGI, 270000, | ||
305 | 224700, 20, 20, 8, 64, 65, 65 }, /* 170 Mb */ | ||
306 | [66] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 324000, | ||
307 | 263100, 21, 21, 8, 66, 67, 67 }, /* 324 Mb */ | ||
308 | [67] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 360000, | ||
309 | 288000, 21, 21, 8, 66, 67, 67 }, /* 360 Mb */ | ||
310 | [68] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 364500, | ||
311 | 290700, 22, 22, 8, 68, 69, 69 }, /* 364.5 Mb */ | ||
312 | [69] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 405000, | ||
313 | 317200, 22, 22, 8, 68, 69, 69 }, /* 405 Mb */ | ||
314 | [70] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 405000, | ||
315 | 317200, 23, 23, 8, 70, 71, 71 }, /* 405 Mb */ | ||
316 | [71] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 450000, | ||
317 | 346400, 23, 23, 8, 70, 71, 71 }, /* 450 Mb */ | ||
218 | }, | 318 | }, |
219 | 50, /* probe interval */ | 319 | 50, /* probe interval */ |
220 | WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ | 320 | WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ |
@@ -224,22 +324,22 @@ static const struct ath_rate_table ar5416_11a_ratetable = { | |||
224 | 8, | 324 | 8, |
225 | 0, | 325 | 0, |
226 | { | 326 | { |
227 | { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ | 327 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ |
228 | 5400, 0, 12, 0, 0, 0 }, | 328 | 5400, 0, 12, 0}, |
229 | { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ | 329 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ |
230 | 7800, 1, 18, 0, 1, 0 }, | 330 | 7800, 1, 18, 0}, |
231 | { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ | 331 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ |
232 | 10000, 2, 24, 2, 2, 0 }, | 332 | 10000, 2, 24, 2}, |
233 | { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ | 333 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ |
234 | 13900, 3, 36, 2, 3, 0 }, | 334 | 13900, 3, 36, 2}, |
235 | { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ | 335 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ |
236 | 17300, 4, 48, 4, 4, 0 }, | 336 | 17300, 4, 48, 4}, |
237 | { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ | 337 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ |
238 | 23000, 5, 72, 4, 5, 0 }, | 338 | 23000, 5, 72, 4}, |
239 | { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ | 339 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ |
240 | 27400, 6, 96, 4, 6, 0 }, | 340 | 27400, 6, 96, 4}, |
241 | { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ | 341 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ |
242 | 29300, 7, 108, 4, 7, 0 }, | 342 | 29300, 7, 108, 4}, |
243 | }, | 343 | }, |
244 | 50, /* probe interval */ | 344 | 50, /* probe interval */ |
245 | 0, /* Phy rates allowed initially */ | 345 | 0, /* Phy rates allowed initially */ |
@@ -249,30 +349,30 @@ static const struct ath_rate_table ar5416_11g_ratetable = { | |||
249 | 12, | 349 | 12, |
250 | 0, | 350 | 0, |
251 | { | 351 | { |
252 | { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ | 352 | { RC_L_SDT, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ |
253 | 900, 0, 2, 0, 0, 0 }, | 353 | 900, 0, 2, 0}, |
254 | { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ | 354 | { RC_L_SDT, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ |
255 | 1900, 1, 4, 1, 1, 0 }, | 355 | 1900, 1, 4, 1}, |
256 | { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ | 356 | { RC_L_SDT, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ |
257 | 4900, 2, 11, 2, 2, 0 }, | 357 | 4900, 2, 11, 2}, |
258 | { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ | 358 | { RC_L_SDT, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ |
259 | 8100, 3, 22, 3, 3, 0 }, | 359 | 8100, 3, 22, 3}, |
260 | { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ | 360 | { RC_INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ |
261 | 5400, 4, 12, 4, 4, 0 }, | 361 | 5400, 4, 12, 4}, |
262 | { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ | 362 | { RC_INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ |
263 | 7800, 5, 18, 4, 5, 0 }, | 363 | 7800, 5, 18, 4}, |
264 | { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ | 364 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ |
265 | 10000, 6, 24, 6, 6, 0 }, | 365 | 10000, 6, 24, 6}, |
266 | { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ | 366 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ |
267 | 13900, 7, 36, 6, 7, 0 }, | 367 | 13900, 7, 36, 6}, |
268 | { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ | 368 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ |
269 | 17300, 8, 48, 8, 8, 0 }, | 369 | 17300, 8, 48, 8}, |
270 | { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ | 370 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ |
271 | 23000, 9, 72, 8, 9, 0 }, | 371 | 23000, 9, 72, 8}, |
272 | { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ | 372 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ |
273 | 27400, 10, 96, 8, 10, 0 }, | 373 | 27400, 10, 96, 8}, |
274 | { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ | 374 | { RC_L_SDT, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ |
275 | 29300, 11, 108, 8, 11, 0 }, | 375 | 29300, 11, 108, 8}, |
276 | }, | 376 | }, |
277 | 50, /* probe interval */ | 377 | 50, /* probe interval */ |
278 | 0, /* Phy rates allowed initially */ | 378 | 0, /* Phy rates allowed initially */ |
@@ -342,7 +442,7 @@ static inline void ath_rc_set_valid_txmask(struct ath_rate_priv *ath_rc_priv, | |||
342 | u8 index, int valid_tx_rate) | 442 | u8 index, int valid_tx_rate) |
343 | { | 443 | { |
344 | BUG_ON(index > ath_rc_priv->rate_table_size); | 444 | BUG_ON(index > ath_rc_priv->rate_table_size); |
345 | ath_rc_priv->valid_rate_index[index] = valid_tx_rate ? 1 : 0; | 445 | ath_rc_priv->valid_rate_index[index] = !!valid_tx_rate; |
346 | } | 446 | } |
347 | 447 | ||
348 | static inline | 448 | static inline |
@@ -374,6 +474,8 @@ static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw) | |||
374 | return 0; | 474 | return 0; |
375 | if (WLAN_RC_PHY_DS(phy) && !(capflag & WLAN_RC_DS_FLAG)) | 475 | if (WLAN_RC_PHY_DS(phy) && !(capflag & WLAN_RC_DS_FLAG)) |
376 | return 0; | 476 | return 0; |
477 | if (WLAN_RC_PHY_TS(phy) && !(capflag & WLAN_RC_TS_FLAG)) | ||
478 | return 0; | ||
377 | if (WLAN_RC_PHY_SGI(phy) && !(capflag & WLAN_RC_SGI_FLAG)) | 479 | if (WLAN_RC_PHY_SGI(phy) && !(capflag & WLAN_RC_SGI_FLAG)) |
378 | return 0; | 480 | return 0; |
379 | if (!ignore_cw && WLAN_RC_PHY_HT(phy)) | 481 | if (!ignore_cw && WLAN_RC_PHY_HT(phy)) |
@@ -404,13 +506,9 @@ static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv, | |||
404 | u32 capflag) | 506 | u32 capflag) |
405 | { | 507 | { |
406 | u8 i, hi = 0; | 508 | u8 i, hi = 0; |
407 | u32 valid; | ||
408 | 509 | ||
409 | for (i = 0; i < rate_table->rate_cnt; i++) { | 510 | for (i = 0; i < rate_table->rate_cnt; i++) { |
410 | valid = (!(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG) ? | 511 | if (rate_table->info[i].rate_flags & RC_LEGACY) { |
411 | rate_table->info[i].valid_single_stream : | ||
412 | rate_table->info[i].valid); | ||
413 | if (valid == 1) { | ||
414 | u32 phy = rate_table->info[i].phy; | 512 | u32 phy = rate_table->info[i].phy; |
415 | u8 valid_rate_count = 0; | 513 | u8 valid_rate_count = 0; |
416 | 514 | ||
@@ -422,7 +520,7 @@ static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv, | |||
422 | ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = i; | 520 | ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = i; |
423 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; | 521 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; |
424 | ath_rc_set_valid_txmask(ath_rc_priv, i, 1); | 522 | ath_rc_set_valid_txmask(ath_rc_priv, i, 1); |
425 | hi = A_MAX(hi, i); | 523 | hi = i; |
426 | } | 524 | } |
427 | } | 525 | } |
428 | 526 | ||
@@ -440,9 +538,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, | |||
440 | for (i = 0; i < rateset->rs_nrates; i++) { | 538 | for (i = 0; i < rateset->rs_nrates; i++) { |
441 | for (j = 0; j < rate_table->rate_cnt; j++) { | 539 | for (j = 0; j < rate_table->rate_cnt; j++) { |
442 | u32 phy = rate_table->info[j].phy; | 540 | u32 phy = rate_table->info[j].phy; |
443 | u32 valid = (!(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG) ? | 541 | u16 rate_flags = rate_table->info[i].rate_flags; |
444 | rate_table->info[j].valid_single_stream : | ||
445 | rate_table->info[j].valid); | ||
446 | u8 rate = rateset->rs_rates[i]; | 542 | u8 rate = rateset->rs_rates[i]; |
447 | u8 dot11rate = rate_table->info[j].dot11rate; | 543 | u8 dot11rate = rate_table->info[j].dot11rate; |
448 | 544 | ||
@@ -451,8 +547,9 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, | |||
451 | * (VALID/VALID_20/VALID_40) flags */ | 547 | * (VALID/VALID_20/VALID_40) flags */ |
452 | 548 | ||
453 | if ((rate == dot11rate) && | 549 | if ((rate == dot11rate) && |
454 | ((valid & WLAN_RC_CAP_MODE(capflag)) == | 550 | (rate_flags & WLAN_RC_CAP_MODE(capflag)) == |
455 | WLAN_RC_CAP_MODE(capflag)) && | 551 | WLAN_RC_CAP_MODE(capflag) && |
552 | (rate_flags & WLAN_RC_CAP_STREAM(capflag)) && | ||
456 | !WLAN_RC_PHY_HT(phy)) { | 553 | !WLAN_RC_PHY_HT(phy)) { |
457 | u8 valid_rate_count = 0; | 554 | u8 valid_rate_count = 0; |
458 | 555 | ||
@@ -486,14 +583,13 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv, | |||
486 | for (i = 0; i < rateset->rs_nrates; i++) { | 583 | for (i = 0; i < rateset->rs_nrates; i++) { |
487 | for (j = 0; j < rate_table->rate_cnt; j++) { | 584 | for (j = 0; j < rate_table->rate_cnt; j++) { |
488 | u32 phy = rate_table->info[j].phy; | 585 | u32 phy = rate_table->info[j].phy; |
489 | u32 valid = (!(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG) ? | 586 | u16 rate_flags = rate_table->info[j].rate_flags; |
490 | rate_table->info[j].valid_single_stream : | ||
491 | rate_table->info[j].valid); | ||
492 | u8 rate = rateset->rs_rates[i]; | 587 | u8 rate = rateset->rs_rates[i]; |
493 | u8 dot11rate = rate_table->info[j].dot11rate; | 588 | u8 dot11rate = rate_table->info[j].dot11rate; |
494 | 589 | ||
495 | if ((rate != dot11rate) || !WLAN_RC_PHY_HT(phy) || | 590 | if ((rate != dot11rate) || !WLAN_RC_PHY_HT(phy) || |
496 | !WLAN_RC_PHY_HT_VALID(valid, capflag)) | 591 | !(rate_flags & WLAN_RC_CAP_STREAM(capflag)) || |
592 | !WLAN_RC_PHY_HT_VALID(rate_flags, capflag)) | ||
497 | continue; | 593 | continue; |
498 | 594 | ||
499 | if (!ath_rc_valid_phyrate(phy, capflag, 0)) | 595 | if (!ath_rc_valid_phyrate(phy, capflag, 0)) |
@@ -589,12 +685,15 @@ static u8 ath_rc_get_highest_rix(struct ath_softc *sc, | |||
589 | if (rate > (ath_rc_priv->rate_table_size - 1)) | 685 | if (rate > (ath_rc_priv->rate_table_size - 1)) |
590 | rate = ath_rc_priv->rate_table_size - 1; | 686 | rate = ath_rc_priv->rate_table_size - 1; |
591 | 687 | ||
592 | if (rate_table->info[rate].valid && | 688 | if (RC_TS_ONLY(rate_table->info[rate].rate_flags) && |
593 | (ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG)) | 689 | (ath_rc_priv->ht_cap & WLAN_RC_TS_FLAG)) |
690 | return rate; | ||
691 | |||
692 | if (RC_DS_OR_LATER(rate_table->info[rate].rate_flags) && | ||
693 | (ath_rc_priv->ht_cap & (WLAN_RC_DS_FLAG | WLAN_RC_TS_FLAG))) | ||
594 | return rate; | 694 | return rate; |
595 | 695 | ||
596 | if (rate_table->info[rate].valid_single_stream && | 696 | if (RC_SS_OR_LEGACY(rate_table->info[rate].rate_flags)) |
597 | !(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG)) | ||
598 | return rate; | 697 | return rate; |
599 | 698 | ||
600 | /* This should not happen */ | 699 | /* This should not happen */ |
@@ -1007,12 +1106,19 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1007 | static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, | 1106 | static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, |
1008 | struct ieee80211_tx_rate *rate) | 1107 | struct ieee80211_tx_rate *rate) |
1009 | { | 1108 | { |
1010 | int rix; | 1109 | int rix = 0, i = 0; |
1110 | int mcs_rix_off[] = { 7, 15, 20, 21, 22, 23 }; | ||
1011 | 1111 | ||
1012 | if (!(rate->flags & IEEE80211_TX_RC_MCS)) | 1112 | if (!(rate->flags & IEEE80211_TX_RC_MCS)) |
1013 | return rate->idx; | 1113 | return rate->idx; |
1014 | 1114 | ||
1015 | rix = rate->idx + rate_table->mcs_start; | 1115 | while (rate->idx > mcs_rix_off[i] && |
1116 | i < sizeof(mcs_rix_off)/sizeof(int)) { | ||
1117 | rix++; i++; | ||
1118 | } | ||
1119 | |||
1120 | rix += rate->idx + rate_table->mcs_start; | ||
1121 | |||
1016 | if ((rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && | 1122 | if ((rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && |
1017 | (rate->flags & IEEE80211_TX_RC_SHORT_GI)) | 1123 | (rate->flags & IEEE80211_TX_RC_SHORT_GI)) |
1018 | rix = rate_table->info[rix].ht_index; | 1124 | rix = rate_table->info[rix].ht_index; |
@@ -1020,8 +1126,6 @@ static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, | |||
1020 | rix = rate_table->info[rix].sgi_index; | 1126 | rix = rate_table->info[rix].sgi_index; |
1021 | else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) | 1127 | else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) |
1022 | rix = rate_table->info[rix].cw40index; | 1128 | rix = rate_table->info[rix].cw40index; |
1023 | else | ||
1024 | rix = rate_table->info[rix].base_index; | ||
1025 | 1129 | ||
1026 | return rix; | 1130 | return rix; |
1027 | } | 1131 | } |
@@ -1203,13 +1307,14 @@ static u8 ath_rc_build_ht_caps(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1203 | 1307 | ||
1204 | if (sta->ht_cap.ht_supported) { | 1308 | if (sta->ht_cap.ht_supported) { |
1205 | caps = WLAN_RC_HT_FLAG; | 1309 | caps = WLAN_RC_HT_FLAG; |
1206 | if (sta->ht_cap.mcs.rx_mask[1]) | 1310 | if (sta->ht_cap.mcs.rx_mask[1] && sta->ht_cap.mcs.rx_mask[2]) |
1311 | caps |= WLAN_RC_TS_FLAG | WLAN_RC_DS_FLAG; | ||
1312 | else if (sta->ht_cap.mcs.rx_mask[1]) | ||
1207 | caps |= WLAN_RC_DS_FLAG; | 1313 | caps |= WLAN_RC_DS_FLAG; |
1208 | if (is_cw40) | 1314 | if (is_cw40) |
1209 | caps |= WLAN_RC_40_FLAG; | 1315 | caps |= WLAN_RC_40_FLAG; |
1210 | if (is_sgi) | 1316 | if (is_sgi) |
1211 | caps |= WLAN_RC_SGI_FLAG; | 1317 | caps |= WLAN_RC_SGI_FLAG; |
1212 | |||
1213 | } | 1318 | } |
1214 | 1319 | ||
1215 | return caps; | 1320 | return caps; |
diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h index 3d8d40cdc99e..dc1082654501 100644 --- a/drivers/net/wireless/ath/ath9k/rc.h +++ b/drivers/net/wireless/ath/ath9k/rc.h | |||
@@ -24,32 +24,63 @@ | |||
24 | struct ath_softc; | 24 | struct ath_softc; |
25 | 25 | ||
26 | #define ATH_RATE_MAX 30 | 26 | #define ATH_RATE_MAX 30 |
27 | #define RATE_TABLE_SIZE 64 | 27 | #define RATE_TABLE_SIZE 72 |
28 | #define MAX_TX_RATE_PHY 48 | 28 | #define MAX_TX_RATE_PHY 48 |
29 | 29 | ||
30 | /* VALID_ALL - valid for 20/40/Legacy, | ||
31 | * VALID - Legacy only, | ||
32 | * VALID_20 - HT 20 only, | ||
33 | * VALID_40 - HT 40 only */ | ||
34 | 30 | ||
35 | #define INVALID 0x0 | 31 | #define RC_INVALID 0x0000 |
36 | #define VALID 0x1 | 32 | #define RC_LEGACY 0x0001 |
37 | #define VALID_20 0x2 | 33 | #define RC_SS 0x0002 |
38 | #define VALID_40 0x4 | 34 | #define RC_DS 0x0004 |
39 | #define VALID_2040 (VALID_20|VALID_40) | 35 | #define RC_TS 0x0008 |
40 | #define VALID_ALL (VALID_2040|VALID) | 36 | #define RC_HT_20 0x0010 |
37 | #define RC_HT_40 0x0020 | ||
38 | |||
39 | #define RC_STREAM_MASK 0xe | ||
40 | #define RC_DS_OR_LATER(f) ((((f) & RC_STREAM_MASK) == RC_DS) || \ | ||
41 | (((f) & RC_STREAM_MASK) == (RC_DS | RC_TS))) | ||
42 | #define RC_TS_ONLY(f) (((f) & RC_STREAM_MASK) == RC_TS) | ||
43 | #define RC_SS_OR_LEGACY(f) ((f) & (RC_SS | RC_LEGACY)) | ||
44 | |||
45 | #define RC_HT_2040 (RC_HT_20 | RC_HT_40) | ||
46 | #define RC_ALL_STREAM (RC_SS | RC_DS | RC_TS) | ||
47 | #define RC_L_SD (RC_LEGACY | RC_SS | RC_DS) | ||
48 | #define RC_L_SDT (RC_LEGACY | RC_SS | RC_DS | RC_TS) | ||
49 | #define RC_HT_S_20 (RC_HT_20 | RC_SS) | ||
50 | #define RC_HT_D_20 (RC_HT_20 | RC_DS) | ||
51 | #define RC_HT_T_20 (RC_HT_20 | RC_TS) | ||
52 | #define RC_HT_S_40 (RC_HT_40 | RC_SS) | ||
53 | #define RC_HT_D_40 (RC_HT_40 | RC_DS) | ||
54 | #define RC_HT_T_40 (RC_HT_40 | RC_TS) | ||
55 | |||
56 | #define RC_HT_SD_20 (RC_HT_20 | RC_SS | RC_DS) | ||
57 | #define RC_HT_DT_20 (RC_HT_20 | RC_DS | RC_TS) | ||
58 | #define RC_HT_SD_40 (RC_HT_40 | RC_SS | RC_DS) | ||
59 | #define RC_HT_DT_40 (RC_HT_40 | RC_DS | RC_TS) | ||
60 | |||
61 | #define RC_HT_SD_2040 (RC_HT_2040 | RC_SS | RC_DS) | ||
62 | #define RC_HT_SDT_2040 (RC_HT_2040 | RC_SS | RC_DS | RC_TS) | ||
63 | |||
64 | #define RC_HT_SDT_20 (RC_HT_20 | RC_SS | RC_DS | RC_TS) | ||
65 | #define RC_HT_SDT_40 (RC_HT_40 | RC_SS | RC_DS | RC_TS) | ||
66 | |||
67 | #define RC_ALL (RC_LEGACY | RC_HT_2040 | RC_ALL_STREAM) | ||
41 | 68 | ||
42 | enum { | 69 | enum { |
43 | WLAN_RC_PHY_OFDM, | 70 | WLAN_RC_PHY_OFDM, |
44 | WLAN_RC_PHY_CCK, | 71 | WLAN_RC_PHY_CCK, |
45 | WLAN_RC_PHY_HT_20_SS, | 72 | WLAN_RC_PHY_HT_20_SS, |
46 | WLAN_RC_PHY_HT_20_DS, | 73 | WLAN_RC_PHY_HT_20_DS, |
74 | WLAN_RC_PHY_HT_20_TS, | ||
47 | WLAN_RC_PHY_HT_40_SS, | 75 | WLAN_RC_PHY_HT_40_SS, |
48 | WLAN_RC_PHY_HT_40_DS, | 76 | WLAN_RC_PHY_HT_40_DS, |
77 | WLAN_RC_PHY_HT_40_TS, | ||
49 | WLAN_RC_PHY_HT_20_SS_HGI, | 78 | WLAN_RC_PHY_HT_20_SS_HGI, |
50 | WLAN_RC_PHY_HT_20_DS_HGI, | 79 | WLAN_RC_PHY_HT_20_DS_HGI, |
80 | WLAN_RC_PHY_HT_20_TS_HGI, | ||
51 | WLAN_RC_PHY_HT_40_SS_HGI, | 81 | WLAN_RC_PHY_HT_40_SS_HGI, |
52 | WLAN_RC_PHY_HT_40_DS_HGI, | 82 | WLAN_RC_PHY_HT_40_DS_HGI, |
83 | WLAN_RC_PHY_HT_40_TS_HGI, | ||
53 | WLAN_RC_PHY_MAX | 84 | WLAN_RC_PHY_MAX |
54 | }; | 85 | }; |
55 | 86 | ||
@@ -57,36 +88,50 @@ enum { | |||
57 | || (_phy == WLAN_RC_PHY_HT_40_DS) \ | 88 | || (_phy == WLAN_RC_PHY_HT_40_DS) \ |
58 | || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \ | 89 | || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \ |
59 | || (_phy == WLAN_RC_PHY_HT_40_DS_HGI)) | 90 | || (_phy == WLAN_RC_PHY_HT_40_DS_HGI)) |
91 | #define WLAN_RC_PHY_TS(_phy) ((_phy == WLAN_RC_PHY_HT_20_TS) \ | ||
92 | || (_phy == WLAN_RC_PHY_HT_40_TS) \ | ||
93 | || (_phy == WLAN_RC_PHY_HT_20_TS_HGI) \ | ||
94 | || (_phy == WLAN_RC_PHY_HT_40_TS_HGI)) | ||
60 | #define WLAN_RC_PHY_20(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS) \ | 95 | #define WLAN_RC_PHY_20(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS) \ |
61 | || (_phy == WLAN_RC_PHY_HT_20_DS) \ | 96 | || (_phy == WLAN_RC_PHY_HT_20_DS) \ |
97 | || (_phy == WLAN_RC_PHY_HT_20_TS) \ | ||
62 | || (_phy == WLAN_RC_PHY_HT_20_SS_HGI) \ | 98 | || (_phy == WLAN_RC_PHY_HT_20_SS_HGI) \ |
63 | || (_phy == WLAN_RC_PHY_HT_20_DS_HGI)) | 99 | || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \ |
100 | || (_phy == WLAN_RC_PHY_HT_20_TS_HGI)) | ||
64 | #define WLAN_RC_PHY_40(_phy) ((_phy == WLAN_RC_PHY_HT_40_SS) \ | 101 | #define WLAN_RC_PHY_40(_phy) ((_phy == WLAN_RC_PHY_HT_40_SS) \ |
65 | || (_phy == WLAN_RC_PHY_HT_40_DS) \ | 102 | || (_phy == WLAN_RC_PHY_HT_40_DS) \ |
103 | || (_phy == WLAN_RC_PHY_HT_40_TS) \ | ||
66 | || (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \ | 104 | || (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \ |
67 | || (_phy == WLAN_RC_PHY_HT_40_DS_HGI)) | 105 | || (_phy == WLAN_RC_PHY_HT_40_DS_HGI) \ |
106 | || (_phy == WLAN_RC_PHY_HT_40_TS_HGI)) | ||
68 | #define WLAN_RC_PHY_SGI(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS_HGI) \ | 107 | #define WLAN_RC_PHY_SGI(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS_HGI) \ |
69 | || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \ | 108 | || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \ |
109 | || (_phy == WLAN_RC_PHY_HT_20_TS_HGI) \ | ||
70 | || (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \ | 110 | || (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \ |
71 | || (_phy == WLAN_RC_PHY_HT_40_DS_HGI)) | 111 | || (_phy == WLAN_RC_PHY_HT_40_DS_HGI) \ |
112 | || (_phy == WLAN_RC_PHY_HT_40_TS_HGI)) | ||
72 | 113 | ||
73 | #define WLAN_RC_PHY_HT(_phy) (_phy >= WLAN_RC_PHY_HT_20_SS) | 114 | #define WLAN_RC_PHY_HT(_phy) (_phy >= WLAN_RC_PHY_HT_20_SS) |
74 | 115 | ||
75 | #define WLAN_RC_CAP_MODE(capflag) (((capflag & WLAN_RC_HT_FLAG) ? \ | 116 | #define WLAN_RC_CAP_MODE(capflag) (((capflag & WLAN_RC_HT_FLAG) ? \ |
76 | (capflag & WLAN_RC_40_FLAG) ? VALID_40 : VALID_20 : VALID)) | 117 | ((capflag & WLAN_RC_40_FLAG) ? RC_HT_40 : RC_HT_20) : RC_LEGACY)) |
118 | |||
119 | #define WLAN_RC_CAP_STREAM(capflag) (((capflag & WLAN_RC_TS_FLAG) ? \ | ||
120 | (RC_TS) : ((capflag & WLAN_RC_DS_FLAG) ? RC_DS : RC_SS))) | ||
77 | 121 | ||
78 | /* Return TRUE if flag supports HT20 && client supports HT20 or | 122 | /* Return TRUE if flag supports HT20 && client supports HT20 or |
79 | * return TRUE if flag supports HT40 && client supports HT40. | 123 | * return TRUE if flag supports HT40 && client supports HT40. |
80 | * This is used becos some rates overlap between HT20/HT40. | 124 | * This is used becos some rates overlap between HT20/HT40. |
81 | */ | 125 | */ |
82 | #define WLAN_RC_PHY_HT_VALID(flag, capflag) \ | 126 | #define WLAN_RC_PHY_HT_VALID(flag, capflag) \ |
83 | (((flag & VALID_20) && !(capflag & WLAN_RC_40_FLAG)) || \ | 127 | (((flag & RC_HT_20) && !(capflag & WLAN_RC_40_FLAG)) || \ |
84 | ((flag & VALID_40) && (capflag & WLAN_RC_40_FLAG))) | 128 | ((flag & RC_HT_40) && (capflag & WLAN_RC_40_FLAG))) |
85 | 129 | ||
86 | #define WLAN_RC_DS_FLAG (0x01) | 130 | #define WLAN_RC_DS_FLAG (0x01) |
87 | #define WLAN_RC_40_FLAG (0x02) | 131 | #define WLAN_RC_TS_FLAG (0x02) |
88 | #define WLAN_RC_SGI_FLAG (0x04) | 132 | #define WLAN_RC_40_FLAG (0x04) |
89 | #define WLAN_RC_HT_FLAG (0x08) | 133 | #define WLAN_RC_SGI_FLAG (0x08) |
134 | #define WLAN_RC_HT_FLAG (0x10) | ||
90 | 135 | ||
91 | /** | 136 | /** |
92 | * struct ath_rate_table - Rate Control table | 137 | * struct ath_rate_table - Rate Control table |
@@ -110,15 +155,13 @@ struct ath_rate_table { | |||
110 | int rate_cnt; | 155 | int rate_cnt; |
111 | int mcs_start; | 156 | int mcs_start; |
112 | struct { | 157 | struct { |
113 | u8 valid; | 158 | u16 rate_flags; |
114 | u8 valid_single_stream; | ||
115 | u8 phy; | 159 | u8 phy; |
116 | u32 ratekbps; | 160 | u32 ratekbps; |
117 | u32 user_ratekbps; | 161 | u32 user_ratekbps; |
118 | u8 ratecode; | 162 | u8 ratecode; |
119 | u8 dot11rate; | 163 | u8 dot11rate; |
120 | u8 ctrl_rate; | 164 | u8 ctrl_rate; |
121 | u8 base_index; | ||
122 | u8 cw40index; | 165 | u8 cw40index; |
123 | u8 sgi_index; | 166 | u8 sgi_index; |
124 | u8 ht_index; | 167 | u8 ht_index; |
diff --git a/drivers/net/wireless/ath/ath9k/virtual.c b/drivers/net/wireless/ath/ath9k/virtual.c index 89423ca23d2c..fd20241f57d8 100644 --- a/drivers/net/wireless/ath/ath9k/virtual.c +++ b/drivers/net/wireless/ath/ath9k/virtual.c | |||
@@ -695,16 +695,18 @@ void ath9k_set_wiphy_idle(struct ath_wiphy *aphy, bool idle) | |||
695 | idle ? "idle" : "not-idle"); | 695 | idle ? "idle" : "not-idle"); |
696 | } | 696 | } |
697 | /* Only bother starting a queue on an active virtual wiphy */ | 697 | /* Only bother starting a queue on an active virtual wiphy */ |
698 | void ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue) | 698 | bool ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue) |
699 | { | 699 | { |
700 | struct ieee80211_hw *hw = sc->pri_wiphy->hw; | 700 | struct ieee80211_hw *hw = sc->pri_wiphy->hw; |
701 | unsigned int i; | 701 | unsigned int i; |
702 | bool txq_started = false; | ||
702 | 703 | ||
703 | spin_lock_bh(&sc->wiphy_lock); | 704 | spin_lock_bh(&sc->wiphy_lock); |
704 | 705 | ||
705 | /* Start the primary wiphy */ | 706 | /* Start the primary wiphy */ |
706 | if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE) { | 707 | if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE) { |
707 | ieee80211_wake_queue(hw, skb_queue); | 708 | ieee80211_wake_queue(hw, skb_queue); |
709 | txq_started = true; | ||
708 | goto unlock; | 710 | goto unlock; |
709 | } | 711 | } |
710 | 712 | ||
@@ -718,11 +720,13 @@ void ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue) | |||
718 | 720 | ||
719 | hw = aphy->hw; | 721 | hw = aphy->hw; |
720 | ieee80211_wake_queue(hw, skb_queue); | 722 | ieee80211_wake_queue(hw, skb_queue); |
723 | txq_started = true; | ||
721 | break; | 724 | break; |
722 | } | 725 | } |
723 | 726 | ||
724 | unlock: | 727 | unlock: |
725 | spin_unlock_bh(&sc->wiphy_lock); | 728 | spin_unlock_bh(&sc->wiphy_lock); |
729 | return txq_started; | ||
726 | } | 730 | } |
727 | 731 | ||
728 | /* Go ahead and propagate information to all virtual wiphys, it won't hurt */ | 732 | /* Go ahead and propagate information to all virtual wiphys, it won't hurt */ |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 0644f1e91887..501b72821b4d 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -518,6 +518,14 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
518 | bf = bf_next; | 518 | bf = bf_next; |
519 | } | 519 | } |
520 | 520 | ||
521 | /* prepend un-acked frames to the beginning of the pending frame queue */ | ||
522 | if (!list_empty(&bf_pending)) { | ||
523 | spin_lock_bh(&txq->axq_lock); | ||
524 | list_splice(&bf_pending, &tid->buf_q); | ||
525 | ath_tx_queue_tid(txq, tid); | ||
526 | spin_unlock_bh(&txq->axq_lock); | ||
527 | } | ||
528 | |||
521 | if (tid->state & AGGR_CLEANUP) { | 529 | if (tid->state & AGGR_CLEANUP) { |
522 | if (tid->baw_head == tid->baw_tail) { | 530 | if (tid->baw_head == tid->baw_tail) { |
523 | tid->state &= ~AGGR_ADDBA_COMPLETE; | 531 | tid->state &= ~AGGR_ADDBA_COMPLETE; |
@@ -530,14 +538,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
530 | return; | 538 | return; |
531 | } | 539 | } |
532 | 540 | ||
533 | /* prepend un-acked frames to the beginning of the pending frame queue */ | ||
534 | if (!list_empty(&bf_pending)) { | ||
535 | spin_lock_bh(&txq->axq_lock); | ||
536 | list_splice(&bf_pending, &tid->buf_q); | ||
537 | ath_tx_queue_tid(txq, tid); | ||
538 | spin_unlock_bh(&txq->axq_lock); | ||
539 | } | ||
540 | |||
541 | rcu_read_unlock(); | 541 | rcu_read_unlock(); |
542 | 542 | ||
543 | if (needreset) | 543 | if (needreset) |
@@ -2077,8 +2077,8 @@ static void ath_wake_mac80211_queue(struct ath_softc *sc, struct ath_txq *txq) | |||
2077 | 2077 | ||
2078 | spin_lock_bh(&txq->axq_lock); | 2078 | spin_lock_bh(&txq->axq_lock); |
2079 | if (txq->stopped && sc->tx.pending_frames[qnum] < ATH_MAX_QDEPTH) { | 2079 | if (txq->stopped && sc->tx.pending_frames[qnum] < ATH_MAX_QDEPTH) { |
2080 | ath_mac80211_start_queue(sc, qnum); | 2080 | if (ath_mac80211_start_queue(sc, qnum)) |
2081 | txq->stopped = 0; | 2081 | txq->stopped = 0; |
2082 | } | 2082 | } |
2083 | spin_unlock_bh(&txq->axq_lock); | 2083 | spin_unlock_bh(&txq->axq_lock); |
2084 | } | 2084 | } |
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h index 4736861bc4f8..70f5586d96bd 100644 --- a/drivers/net/wireless/ipw2x00/libipw.h +++ b/drivers/net/wireless/ipw2x00/libipw.h | |||
@@ -828,7 +828,6 @@ struct libipw_device { | |||
828 | int host_strip_iv_icv; | 828 | int host_strip_iv_icv; |
829 | 829 | ||
830 | int host_open_frag; | 830 | int host_open_frag; |
831 | int host_build_iv; | ||
832 | int ieee802_1x; /* is IEEE 802.1X used */ | 831 | int ieee802_1x; /* is IEEE 802.1X used */ |
833 | 832 | ||
834 | /* WPA data */ | 833 | /* WPA data */ |
diff --git a/drivers/net/wireless/ipw2x00/libipw_tx.c b/drivers/net/wireless/ipw2x00/libipw_tx.c index da8beac7fcf3..01c88a71abe1 100644 --- a/drivers/net/wireless/ipw2x00/libipw_tx.c +++ b/drivers/net/wireless/ipw2x00/libipw_tx.c | |||
@@ -260,7 +260,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) | |||
260 | int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size, | 260 | int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size, |
261 | rts_required; | 261 | rts_required; |
262 | unsigned long flags; | 262 | unsigned long flags; |
263 | int encrypt, host_encrypt, host_encrypt_msdu, host_build_iv; | 263 | int encrypt, host_encrypt, host_encrypt_msdu; |
264 | __be16 ether_type; | 264 | __be16 ether_type; |
265 | int bytes, fc, hdr_len; | 265 | int bytes, fc, hdr_len; |
266 | struct sk_buff *skb_frag; | 266 | struct sk_buff *skb_frag; |
@@ -301,7 +301,6 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) | |||
301 | 301 | ||
302 | host_encrypt = ieee->host_encrypt && encrypt && crypt; | 302 | host_encrypt = ieee->host_encrypt && encrypt && crypt; |
303 | host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt && crypt; | 303 | host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt && crypt; |
304 | host_build_iv = ieee->host_build_iv && encrypt && crypt; | ||
305 | 304 | ||
306 | if (!encrypt && ieee->ieee802_1x && | 305 | if (!encrypt && ieee->ieee802_1x && |
307 | ieee->drop_unencrypted && ether_type != htons(ETH_P_PAE)) { | 306 | ieee->drop_unencrypted && ether_type != htons(ETH_P_PAE)) { |
@@ -313,7 +312,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) | |||
313 | skb_copy_from_linear_data(skb, dest, ETH_ALEN); | 312 | skb_copy_from_linear_data(skb, dest, ETH_ALEN); |
314 | skb_copy_from_linear_data_offset(skb, ETH_ALEN, src, ETH_ALEN); | 313 | skb_copy_from_linear_data_offset(skb, ETH_ALEN, src, ETH_ALEN); |
315 | 314 | ||
316 | if (host_encrypt || host_build_iv) | 315 | if (host_encrypt) |
317 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | | 316 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | |
318 | IEEE80211_FCTL_PROTECTED; | 317 | IEEE80211_FCTL_PROTECTED; |
319 | else | 318 | else |
@@ -467,7 +466,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) | |||
467 | for (; i < nr_frags; i++) { | 466 | for (; i < nr_frags; i++) { |
468 | skb_frag = txb->fragments[i]; | 467 | skb_frag = txb->fragments[i]; |
469 | 468 | ||
470 | if (host_encrypt || host_build_iv) | 469 | if (host_encrypt) |
471 | skb_reserve(skb_frag, | 470 | skb_reserve(skb_frag, |
472 | crypt->ops->extra_mpdu_prefix_len); | 471 | crypt->ops->extra_mpdu_prefix_len); |
473 | 472 | ||
@@ -502,15 +501,6 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) | |||
502 | * to insert the IV between the header and the payload */ | 501 | * to insert the IV between the header and the payload */ |
503 | if (host_encrypt) | 502 | if (host_encrypt) |
504 | libipw_encrypt_fragment(ieee, skb_frag, hdr_len); | 503 | libipw_encrypt_fragment(ieee, skb_frag, hdr_len); |
505 | else if (host_build_iv) { | ||
506 | atomic_inc(&crypt->refcnt); | ||
507 | if (crypt->ops->build_iv) | ||
508 | crypt->ops->build_iv(skb_frag, hdr_len, | ||
509 | ieee->sec.keys[ieee->sec.active_key], | ||
510 | ieee->sec.key_sizes[ieee->sec.active_key], | ||
511 | crypt->priv); | ||
512 | atomic_dec(&crypt->refcnt); | ||
513 | } | ||
514 | 504 | ||
515 | if (ieee->config & | 505 | if (ieee->config & |
516 | (CFG_LIBIPW_COMPUTE_FCS | CFG_LIBIPW_RESERVE_FCS)) | 506 | (CFG_LIBIPW_COMPUTE_FCS | CFG_LIBIPW_RESERVE_FCS)) |
diff --git a/drivers/net/wireless/ipw2x00/libipw_wx.c b/drivers/net/wireless/ipw2x00/libipw_wx.c index 8a4bae44b109..d7bd6cf00a81 100644 --- a/drivers/net/wireless/ipw2x00/libipw_wx.c +++ b/drivers/net/wireless/ipw2x00/libipw_wx.c | |||
@@ -320,7 +320,7 @@ int libipw_wx_set_encode(struct libipw_device *ieee, | |||
320 | }; | 320 | }; |
321 | int i, key, key_provided, len; | 321 | int i, key, key_provided, len; |
322 | struct lib80211_crypt_data **crypt; | 322 | struct lib80211_crypt_data **crypt; |
323 | int host_crypto = ieee->host_encrypt || ieee->host_decrypt || ieee->host_build_iv; | 323 | int host_crypto = ieee->host_encrypt || ieee->host_decrypt; |
324 | DECLARE_SSID_BUF(ssid); | 324 | DECLARE_SSID_BUF(ssid); |
325 | 325 | ||
326 | LIBIPW_DEBUG_WX("SET_ENCODE\n"); | 326 | LIBIPW_DEBUG_WX("SET_ENCODE\n"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index c281d07ec5e5..8848333bc3a9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -222,6 +222,7 @@ static struct iwl_lib_ops iwl1000_lib = { | |||
222 | .rx_stats_read = iwl_ucode_rx_stats_read, | 222 | .rx_stats_read = iwl_ucode_rx_stats_read, |
223 | .tx_stats_read = iwl_ucode_tx_stats_read, | 223 | .tx_stats_read = iwl_ucode_tx_stats_read, |
224 | .general_stats_read = iwl_ucode_general_stats_read, | 224 | .general_stats_read = iwl_ucode_general_stats_read, |
225 | .bt_stats_read = iwl_ucode_bt_stats_read, | ||
225 | }, | 226 | }, |
226 | .recover_from_tx_stall = iwl_bg_monitor_recover, | 227 | .recover_from_tx_stall = iwl_bg_monitor_recover, |
227 | .check_plcp_health = iwl_good_plcp_health, | 228 | .check_plcp_health = iwl_good_plcp_health, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 3a0d0adab1ae..d6531ad3906a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1605,8 +1605,8 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv) | |||
1605 | if (!test_bit(STATUS_TEMPERATURE, &priv->status)) | 1605 | if (!test_bit(STATUS_TEMPERATURE, &priv->status)) |
1606 | vt = sign_extend(R4, 23); | 1606 | vt = sign_extend(R4, 23); |
1607 | else | 1607 | else |
1608 | vt = sign_extend(le32_to_cpu( | 1608 | vt = sign_extend(le32_to_cpu(priv->_agn.statistics. |
1609 | priv->_agn.statistics.general.temperature), 23); | 1609 | general.common.temperature), 23); |
1610 | 1610 | ||
1611 | IWL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); | 1611 | IWL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); |
1612 | 1612 | ||
@@ -2285,6 +2285,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2285 | .rx_stats_read = iwl_ucode_rx_stats_read, | 2285 | .rx_stats_read = iwl_ucode_rx_stats_read, |
2286 | .tx_stats_read = iwl_ucode_tx_stats_read, | 2286 | .tx_stats_read = iwl_ucode_tx_stats_read, |
2287 | .general_stats_read = iwl_ucode_general_stats_read, | 2287 | .general_stats_read = iwl_ucode_general_stats_read, |
2288 | .bt_stats_read = iwl_ucode_bt_stats_read, | ||
2288 | }, | 2289 | }, |
2289 | .recover_from_tx_stall = iwl_bg_monitor_recover, | 2290 | .recover_from_tx_stall = iwl_bg_monitor_recover, |
2290 | .check_plcp_health = iwl_good_plcp_health, | 2291 | .check_plcp_health = iwl_good_plcp_health, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 7d89d99ce19c..8093ce2804fb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -265,7 +265,7 @@ static void iwl5150_temperature(struct iwl_priv *priv) | |||
265 | u32 vt = 0; | 265 | u32 vt = 0; |
266 | s32 offset = iwl_temp_calib_to_offset(priv); | 266 | s32 offset = iwl_temp_calib_to_offset(priv); |
267 | 267 | ||
268 | vt = le32_to_cpu(priv->_agn.statistics.general.temperature); | 268 | vt = le32_to_cpu(priv->_agn.statistics.general.common.temperature); |
269 | vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset; | 269 | vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset; |
270 | /* now vt hold the temperature in Kelvin */ | 270 | /* now vt hold the temperature in Kelvin */ |
271 | priv->temperature = KELVIN_TO_CELSIUS(vt); | 271 | priv->temperature = KELVIN_TO_CELSIUS(vt); |
@@ -398,6 +398,7 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
398 | .rx_stats_read = iwl_ucode_rx_stats_read, | 398 | .rx_stats_read = iwl_ucode_rx_stats_read, |
399 | .tx_stats_read = iwl_ucode_tx_stats_read, | 399 | .tx_stats_read = iwl_ucode_tx_stats_read, |
400 | .general_stats_read = iwl_ucode_general_stats_read, | 400 | .general_stats_read = iwl_ucode_general_stats_read, |
401 | .bt_stats_read = iwl_ucode_bt_stats_read, | ||
401 | }, | 402 | }, |
402 | .recover_from_tx_stall = iwl_bg_monitor_recover, | 403 | .recover_from_tx_stall = iwl_bg_monitor_recover, |
403 | .check_plcp_health = iwl_good_plcp_health, | 404 | .check_plcp_health = iwl_good_plcp_health, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 095521952bbe..58270529a0e4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -323,6 +323,7 @@ static struct iwl_lib_ops iwl6000_lib = { | |||
323 | .rx_stats_read = iwl_ucode_rx_stats_read, | 323 | .rx_stats_read = iwl_ucode_rx_stats_read, |
324 | .tx_stats_read = iwl_ucode_tx_stats_read, | 324 | .tx_stats_read = iwl_ucode_tx_stats_read, |
325 | .general_stats_read = iwl_ucode_general_stats_read, | 325 | .general_stats_read = iwl_ucode_general_stats_read, |
326 | .bt_stats_read = iwl_ucode_bt_stats_read, | ||
326 | }, | 327 | }, |
327 | .recover_from_tx_stall = iwl_bg_monitor_recover, | 328 | .recover_from_tx_stall = iwl_bg_monitor_recover, |
328 | .check_plcp_health = iwl_good_plcp_health, | 329 | .check_plcp_health = iwl_good_plcp_health, |
@@ -500,6 +501,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = { | |||
500 | .sensitivity_calib_by_driver = true, | 501 | .sensitivity_calib_by_driver = true, |
501 | .chain_noise_calib_by_driver = true, | 502 | .chain_noise_calib_by_driver = true, |
502 | .need_dc_calib = true, | 503 | .need_dc_calib = true, |
504 | .bt_statistics = true, | ||
503 | }; | 505 | }; |
504 | 506 | ||
505 | struct iwl_cfg iwl6000g2b_2abg_cfg = { | 507 | struct iwl_cfg iwl6000g2b_2abg_cfg = { |
@@ -535,6 +537,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = { | |||
535 | .sensitivity_calib_by_driver = true, | 537 | .sensitivity_calib_by_driver = true, |
536 | .chain_noise_calib_by_driver = true, | 538 | .chain_noise_calib_by_driver = true, |
537 | .need_dc_calib = true, | 539 | .need_dc_calib = true, |
540 | .bt_statistics = true, | ||
538 | }; | 541 | }; |
539 | 542 | ||
540 | struct iwl_cfg iwl6000g2b_2bgn_cfg = { | 543 | struct iwl_cfg iwl6000g2b_2bgn_cfg = { |
@@ -572,6 +575,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = { | |||
572 | .sensitivity_calib_by_driver = true, | 575 | .sensitivity_calib_by_driver = true, |
573 | .chain_noise_calib_by_driver = true, | 576 | .chain_noise_calib_by_driver = true, |
574 | .need_dc_calib = true, | 577 | .need_dc_calib = true, |
578 | .bt_statistics = true, | ||
575 | }; | 579 | }; |
576 | 580 | ||
577 | struct iwl_cfg iwl6000g2b_2bg_cfg = { | 581 | struct iwl_cfg iwl6000g2b_2bg_cfg = { |
@@ -607,6 +611,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = { | |||
607 | .sensitivity_calib_by_driver = true, | 611 | .sensitivity_calib_by_driver = true, |
608 | .chain_noise_calib_by_driver = true, | 612 | .chain_noise_calib_by_driver = true, |
609 | .need_dc_calib = true, | 613 | .need_dc_calib = true, |
614 | .bt_statistics = true, | ||
610 | }; | 615 | }; |
611 | 616 | ||
612 | struct iwl_cfg iwl6000g2b_bgn_cfg = { | 617 | struct iwl_cfg iwl6000g2b_bgn_cfg = { |
@@ -644,6 +649,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = { | |||
644 | .sensitivity_calib_by_driver = true, | 649 | .sensitivity_calib_by_driver = true, |
645 | .chain_noise_calib_by_driver = true, | 650 | .chain_noise_calib_by_driver = true, |
646 | .need_dc_calib = true, | 651 | .need_dc_calib = true, |
652 | .bt_statistics = true, | ||
647 | }; | 653 | }; |
648 | 654 | ||
649 | struct iwl_cfg iwl6000g2b_bg_cfg = { | 655 | struct iwl_cfg iwl6000g2b_bg_cfg = { |
@@ -679,6 +685,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = { | |||
679 | .sensitivity_calib_by_driver = true, | 685 | .sensitivity_calib_by_driver = true, |
680 | .chain_noise_calib_by_driver = true, | 686 | .chain_noise_calib_by_driver = true, |
681 | .need_dc_calib = true, | 687 | .need_dc_calib = true, |
688 | .bt_statistics = true, | ||
682 | }; | 689 | }; |
683 | 690 | ||
684 | /* | 691 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c index 90033e8752bb..c4c5691032a6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c | |||
@@ -605,8 +605,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv) | |||
605 | IWL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret); | 605 | IWL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret); |
606 | } | 606 | } |
607 | 607 | ||
608 | void iwl_sensitivity_calibration(struct iwl_priv *priv, | 608 | void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp) |
609 | struct iwl_notif_statistics *resp) | ||
610 | { | 609 | { |
611 | u32 rx_enable_time; | 610 | u32 rx_enable_time; |
612 | u32 fa_cck; | 611 | u32 fa_cck; |
@@ -616,8 +615,8 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, | |||
616 | u32 norm_fa_ofdm; | 615 | u32 norm_fa_ofdm; |
617 | u32 norm_fa_cck; | 616 | u32 norm_fa_cck; |
618 | struct iwl_sensitivity_data *data = NULL; | 617 | struct iwl_sensitivity_data *data = NULL; |
619 | struct statistics_rx_non_phy *rx_info = &(resp->rx.general); | 618 | struct statistics_rx_non_phy *rx_info; |
620 | struct statistics_rx *statistics = &(resp->rx); | 619 | struct statistics_rx_phy *ofdm, *cck; |
621 | unsigned long flags; | 620 | unsigned long flags; |
622 | struct statistics_general_data statis; | 621 | struct statistics_general_data statis; |
623 | 622 | ||
@@ -632,6 +631,16 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, | |||
632 | } | 631 | } |
633 | 632 | ||
634 | spin_lock_irqsave(&priv->lock, flags); | 633 | spin_lock_irqsave(&priv->lock, flags); |
634 | if (priv->cfg->bt_statistics) { | ||
635 | rx_info = &(((struct iwl_bt_notif_statistics *)resp)-> | ||
636 | rx.general.common); | ||
637 | ofdm = &(((struct iwl_bt_notif_statistics *)resp)->rx.ofdm); | ||
638 | cck = &(((struct iwl_bt_notif_statistics *)resp)->rx.cck); | ||
639 | } else { | ||
640 | rx_info = &(((struct iwl_notif_statistics *)resp)->rx.general); | ||
641 | ofdm = &(((struct iwl_notif_statistics *)resp)->rx.ofdm); | ||
642 | cck = &(((struct iwl_notif_statistics *)resp)->rx.cck); | ||
643 | } | ||
635 | if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { | 644 | if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { |
636 | IWL_DEBUG_CALIB(priv, "<< invalid data.\n"); | 645 | IWL_DEBUG_CALIB(priv, "<< invalid data.\n"); |
637 | spin_unlock_irqrestore(&priv->lock, flags); | 646 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -640,23 +649,23 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, | |||
640 | 649 | ||
641 | /* Extract Statistics: */ | 650 | /* Extract Statistics: */ |
642 | rx_enable_time = le32_to_cpu(rx_info->channel_load); | 651 | rx_enable_time = le32_to_cpu(rx_info->channel_load); |
643 | fa_cck = le32_to_cpu(statistics->cck.false_alarm_cnt); | 652 | fa_cck = le32_to_cpu(cck->false_alarm_cnt); |
644 | fa_ofdm = le32_to_cpu(statistics->ofdm.false_alarm_cnt); | 653 | fa_ofdm = le32_to_cpu(ofdm->false_alarm_cnt); |
645 | bad_plcp_cck = le32_to_cpu(statistics->cck.plcp_err); | 654 | bad_plcp_cck = le32_to_cpu(cck->plcp_err); |
646 | bad_plcp_ofdm = le32_to_cpu(statistics->ofdm.plcp_err); | 655 | bad_plcp_ofdm = le32_to_cpu(ofdm->plcp_err); |
647 | 656 | ||
648 | statis.beacon_silence_rssi_a = | 657 | statis.beacon_silence_rssi_a = |
649 | le32_to_cpu(statistics->general.beacon_silence_rssi_a); | 658 | le32_to_cpu(rx_info->beacon_silence_rssi_a); |
650 | statis.beacon_silence_rssi_b = | 659 | statis.beacon_silence_rssi_b = |
651 | le32_to_cpu(statistics->general.beacon_silence_rssi_b); | 660 | le32_to_cpu(rx_info->beacon_silence_rssi_b); |
652 | statis.beacon_silence_rssi_c = | 661 | statis.beacon_silence_rssi_c = |
653 | le32_to_cpu(statistics->general.beacon_silence_rssi_c); | 662 | le32_to_cpu(rx_info->beacon_silence_rssi_c); |
654 | statis.beacon_energy_a = | 663 | statis.beacon_energy_a = |
655 | le32_to_cpu(statistics->general.beacon_energy_a); | 664 | le32_to_cpu(rx_info->beacon_energy_a); |
656 | statis.beacon_energy_b = | 665 | statis.beacon_energy_b = |
657 | le32_to_cpu(statistics->general.beacon_energy_b); | 666 | le32_to_cpu(rx_info->beacon_energy_b); |
658 | statis.beacon_energy_c = | 667 | statis.beacon_energy_c = |
659 | le32_to_cpu(statistics->general.beacon_energy_c); | 668 | le32_to_cpu(rx_info->beacon_energy_c); |
660 | 669 | ||
661 | spin_unlock_irqrestore(&priv->lock, flags); | 670 | spin_unlock_irqrestore(&priv->lock, flags); |
662 | 671 | ||
@@ -728,8 +737,7 @@ static inline u8 find_first_chain(u8 mask) | |||
728 | * 1) Which antennas are connected. | 737 | * 1) Which antennas are connected. |
729 | * 2) Differential rx gain settings to balance the 3 receivers. | 738 | * 2) Differential rx gain settings to balance the 3 receivers. |
730 | */ | 739 | */ |
731 | void iwl_chain_noise_calibration(struct iwl_priv *priv, | 740 | void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) |
732 | struct iwl_notif_statistics *stat_resp) | ||
733 | { | 741 | { |
734 | struct iwl_chain_noise_data *data = NULL; | 742 | struct iwl_chain_noise_data *data = NULL; |
735 | 743 | ||
@@ -753,7 +761,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
753 | u32 active_chains = 0; | 761 | u32 active_chains = 0; |
754 | u8 num_tx_chains; | 762 | u8 num_tx_chains; |
755 | unsigned long flags; | 763 | unsigned long flags; |
756 | struct statistics_rx_non_phy *rx_info = &(stat_resp->rx.general); | 764 | struct statistics_rx_non_phy *rx_info; |
757 | u8 first_chain; | 765 | u8 first_chain; |
758 | 766 | ||
759 | if (priv->disable_chain_noise_cal) | 767 | if (priv->disable_chain_noise_cal) |
@@ -772,6 +780,13 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
772 | } | 780 | } |
773 | 781 | ||
774 | spin_lock_irqsave(&priv->lock, flags); | 782 | spin_lock_irqsave(&priv->lock, flags); |
783 | if (priv->cfg->bt_statistics) { | ||
784 | rx_info = &(((struct iwl_bt_notif_statistics *)stat_resp)-> | ||
785 | rx.general.common); | ||
786 | } else { | ||
787 | rx_info = &(((struct iwl_notif_statistics *)stat_resp)-> | ||
788 | rx.general); | ||
789 | } | ||
775 | if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { | 790 | if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { |
776 | IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n"); | 791 | IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n"); |
777 | spin_unlock_irqrestore(&priv->lock, flags); | 792 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -780,8 +795,19 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
780 | 795 | ||
781 | rxon_band24 = !!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK); | 796 | rxon_band24 = !!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK); |
782 | rxon_chnum = le16_to_cpu(priv->staging_rxon.channel); | 797 | rxon_chnum = le16_to_cpu(priv->staging_rxon.channel); |
783 | stat_band24 = !!(stat_resp->flag & STATISTICS_REPLY_FLG_BAND_24G_MSK); | 798 | if (priv->cfg->bt_statistics) { |
784 | stat_chnum = le32_to_cpu(stat_resp->flag) >> 16; | 799 | stat_band24 = !!(((struct iwl_bt_notif_statistics *) |
800 | stat_resp)->flag & | ||
801 | STATISTICS_REPLY_FLG_BAND_24G_MSK); | ||
802 | stat_chnum = le32_to_cpu(((struct iwl_bt_notif_statistics *) | ||
803 | stat_resp)->flag) >> 16; | ||
804 | } else { | ||
805 | stat_band24 = !!(((struct iwl_notif_statistics *) | ||
806 | stat_resp)->flag & | ||
807 | STATISTICS_REPLY_FLG_BAND_24G_MSK); | ||
808 | stat_chnum = le32_to_cpu(((struct iwl_notif_statistics *) | ||
809 | stat_resp)->flag) >> 16; | ||
810 | } | ||
785 | 811 | ||
786 | /* Make sure we accumulate data for just the associated channel | 812 | /* Make sure we accumulate data for just the associated channel |
787 | * (even if scanning). */ | 813 | * (even if scanning). */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c index 5e5c5122fb15..f052c6d09b37 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c | |||
@@ -31,21 +31,24 @@ | |||
31 | static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) | 31 | static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) |
32 | { | 32 | { |
33 | int p = 0; | 33 | int p = 0; |
34 | u32 flag; | ||
34 | 35 | ||
35 | p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", | 36 | if (priv->cfg->bt_statistics) |
36 | le32_to_cpu(priv->_agn.statistics.flag)); | 37 | flag = le32_to_cpu(priv->_agn.statistics_bt.flag); |
37 | if (le32_to_cpu(priv->_agn.statistics.flag) & | 38 | else |
38 | UCODE_STATISTICS_CLEAR_MSK) | 39 | flag = le32_to_cpu(priv->_agn.statistics.flag); |
40 | |||
41 | p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag); | ||
42 | if (flag & UCODE_STATISTICS_CLEAR_MSK) | ||
39 | p += scnprintf(buf + p, bufsz - p, | 43 | p += scnprintf(buf + p, bufsz - p, |
40 | "\tStatistics have been cleared\n"); | 44 | "\tStatistics have been cleared\n"); |
41 | p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", | 45 | p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", |
42 | (le32_to_cpu(priv->_agn.statistics.flag) & | 46 | (flag & UCODE_STATISTICS_FREQUENCY_MSK) |
43 | UCODE_STATISTICS_FREQUENCY_MSK) | 47 | ? "2.4 GHz" : "5.2 GHz"); |
44 | ? "2.4 GHz" : "5.2 GHz"); | ||
45 | p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", | 48 | p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", |
46 | (le32_to_cpu(priv->_agn.statistics.flag) & | 49 | (flag & UCODE_STATISTICS_NARROW_BAND_MSK) |
47 | UCODE_STATISTICS_NARROW_BAND_MSK) | 50 | ? "enabled" : "disabled"); |
48 | ? "enabled" : "disabled"); | 51 | |
49 | return p; | 52 | return p; |
50 | } | 53 | } |
51 | 54 | ||
@@ -79,22 +82,43 @@ ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf, | |||
79 | * the last statistics notification from uCode | 82 | * the last statistics notification from uCode |
80 | * might not reflect the current uCode activity | 83 | * might not reflect the current uCode activity |
81 | */ | 84 | */ |
82 | ofdm = &priv->_agn.statistics.rx.ofdm; | 85 | if (priv->cfg->bt_statistics) { |
83 | cck = &priv->_agn.statistics.rx.cck; | 86 | ofdm = &priv->_agn.statistics_bt.rx.ofdm; |
84 | general = &priv->_agn.statistics.rx.general; | 87 | cck = &priv->_agn.statistics_bt.rx.cck; |
85 | ht = &priv->_agn.statistics.rx.ofdm_ht; | 88 | general = &priv->_agn.statistics_bt.rx.general.common; |
86 | accum_ofdm = &priv->_agn.accum_statistics.rx.ofdm; | 89 | ht = &priv->_agn.statistics_bt.rx.ofdm_ht; |
87 | accum_cck = &priv->_agn.accum_statistics.rx.cck; | 90 | accum_ofdm = &priv->_agn.accum_statistics_bt.rx.ofdm; |
88 | accum_general = &priv->_agn.accum_statistics.rx.general; | 91 | accum_cck = &priv->_agn.accum_statistics_bt.rx.cck; |
89 | accum_ht = &priv->_agn.accum_statistics.rx.ofdm_ht; | 92 | accum_general = |
90 | delta_ofdm = &priv->_agn.delta_statistics.rx.ofdm; | 93 | &priv->_agn.accum_statistics_bt.rx.general.common; |
91 | delta_cck = &priv->_agn.delta_statistics.rx.cck; | 94 | accum_ht = &priv->_agn.accum_statistics_bt.rx.ofdm_ht; |
92 | delta_general = &priv->_agn.delta_statistics.rx.general; | 95 | delta_ofdm = &priv->_agn.delta_statistics_bt.rx.ofdm; |
93 | delta_ht = &priv->_agn.delta_statistics.rx.ofdm_ht; | 96 | delta_cck = &priv->_agn.delta_statistics_bt.rx.cck; |
94 | max_ofdm = &priv->_agn.max_delta.rx.ofdm; | 97 | delta_general = |
95 | max_cck = &priv->_agn.max_delta.rx.cck; | 98 | &priv->_agn.delta_statistics_bt.rx.general.common; |
96 | max_general = &priv->_agn.max_delta.rx.general; | 99 | delta_ht = &priv->_agn.delta_statistics_bt.rx.ofdm_ht; |
97 | max_ht = &priv->_agn.max_delta.rx.ofdm_ht; | 100 | max_ofdm = &priv->_agn.max_delta_bt.rx.ofdm; |
101 | max_cck = &priv->_agn.max_delta_bt.rx.cck; | ||
102 | max_general = &priv->_agn.max_delta_bt.rx.general.common; | ||
103 | max_ht = &priv->_agn.max_delta_bt.rx.ofdm_ht; | ||
104 | } else { | ||
105 | ofdm = &priv->_agn.statistics.rx.ofdm; | ||
106 | cck = &priv->_agn.statistics.rx.cck; | ||
107 | general = &priv->_agn.statistics.rx.general; | ||
108 | ht = &priv->_agn.statistics.rx.ofdm_ht; | ||
109 | accum_ofdm = &priv->_agn.accum_statistics.rx.ofdm; | ||
110 | accum_cck = &priv->_agn.accum_statistics.rx.cck; | ||
111 | accum_general = &priv->_agn.accum_statistics.rx.general; | ||
112 | accum_ht = &priv->_agn.accum_statistics.rx.ofdm_ht; | ||
113 | delta_ofdm = &priv->_agn.delta_statistics.rx.ofdm; | ||
114 | delta_cck = &priv->_agn.delta_statistics.rx.cck; | ||
115 | delta_general = &priv->_agn.delta_statistics.rx.general; | ||
116 | delta_ht = &priv->_agn.delta_statistics.rx.ofdm_ht; | ||
117 | max_ofdm = &priv->_agn.max_delta.rx.ofdm; | ||
118 | max_cck = &priv->_agn.max_delta.rx.cck; | ||
119 | max_general = &priv->_agn.max_delta.rx.general; | ||
120 | max_ht = &priv->_agn.max_delta.rx.ofdm_ht; | ||
121 | } | ||
98 | 122 | ||
99 | pos += iwl_statistics_flag(priv, buf, bufsz); | 123 | pos += iwl_statistics_flag(priv, buf, bufsz); |
100 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | 124 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
@@ -560,10 +584,18 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file, | |||
560 | * the last statistics notification from uCode | 584 | * the last statistics notification from uCode |
561 | * might not reflect the current uCode activity | 585 | * might not reflect the current uCode activity |
562 | */ | 586 | */ |
563 | tx = &priv->_agn.statistics.tx; | 587 | if (priv->cfg->bt_statistics) { |
564 | accum_tx = &priv->_agn.accum_statistics.tx; | 588 | tx = &priv->_agn.statistics_bt.tx; |
565 | delta_tx = &priv->_agn.delta_statistics.tx; | 589 | accum_tx = &priv->_agn.accum_statistics_bt.tx; |
566 | max_tx = &priv->_agn.max_delta.tx; | 590 | delta_tx = &priv->_agn.delta_statistics_bt.tx; |
591 | max_tx = &priv->_agn.max_delta_bt.tx; | ||
592 | } else { | ||
593 | tx = &priv->_agn.statistics.tx; | ||
594 | accum_tx = &priv->_agn.accum_statistics.tx; | ||
595 | delta_tx = &priv->_agn.delta_statistics.tx; | ||
596 | max_tx = &priv->_agn.max_delta.tx; | ||
597 | } | ||
598 | |||
567 | pos += iwl_statistics_flag(priv, buf, bufsz); | 599 | pos += iwl_statistics_flag(priv, buf, bufsz); |
568 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | 600 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
569 | "acumulative delta max\n", | 601 | "acumulative delta max\n", |
@@ -759,8 +791,8 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf, | |||
759 | char *buf; | 791 | char *buf; |
760 | int bufsz = sizeof(struct statistics_general) * 10 + 300; | 792 | int bufsz = sizeof(struct statistics_general) * 10 + 300; |
761 | ssize_t ret; | 793 | ssize_t ret; |
762 | struct statistics_general *general, *accum_general; | 794 | struct statistics_general_common *general, *accum_general; |
763 | struct statistics_general *delta_general, *max_general; | 795 | struct statistics_general_common *delta_general, *max_general; |
764 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; | 796 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; |
765 | struct statistics_div *div, *accum_div, *delta_div, *max_div; | 797 | struct statistics_div *div, *accum_div, *delta_div, *max_div; |
766 | 798 | ||
@@ -777,18 +809,34 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf, | |||
777 | * the last statistics notification from uCode | 809 | * the last statistics notification from uCode |
778 | * might not reflect the current uCode activity | 810 | * might not reflect the current uCode activity |
779 | */ | 811 | */ |
780 | general = &priv->_agn.statistics.general; | 812 | if (priv->cfg->bt_statistics) { |
781 | dbg = &priv->_agn.statistics.general.dbg; | 813 | general = &priv->_agn.statistics_bt.general.common; |
782 | div = &priv->_agn.statistics.general.div; | 814 | dbg = &priv->_agn.statistics_bt.general.common.dbg; |
783 | accum_general = &priv->_agn.accum_statistics.general; | 815 | div = &priv->_agn.statistics_bt.general.common.div; |
784 | delta_general = &priv->_agn.delta_statistics.general; | 816 | accum_general = &priv->_agn.accum_statistics_bt.general.common; |
785 | max_general = &priv->_agn.max_delta.general; | 817 | accum_dbg = &priv->_agn.accum_statistics_bt.general.common.dbg; |
786 | accum_dbg = &priv->_agn.accum_statistics.general.dbg; | 818 | accum_div = &priv->_agn.accum_statistics_bt.general.common.div; |
787 | delta_dbg = &priv->_agn.delta_statistics.general.dbg; | 819 | delta_general = &priv->_agn.delta_statistics_bt.general.common; |
788 | max_dbg = &priv->_agn.max_delta.general.dbg; | 820 | max_general = &priv->_agn.max_delta_bt.general.common; |
789 | accum_div = &priv->_agn.accum_statistics.general.div; | 821 | delta_dbg = &priv->_agn.delta_statistics_bt.general.common.dbg; |
790 | delta_div = &priv->_agn.delta_statistics.general.div; | 822 | max_dbg = &priv->_agn.max_delta_bt.general.common.dbg; |
791 | max_div = &priv->_agn.max_delta.general.div; | 823 | delta_div = &priv->_agn.delta_statistics_bt.general.common.div; |
824 | max_div = &priv->_agn.max_delta_bt.general.common.div; | ||
825 | } else { | ||
826 | general = &priv->_agn.statistics.general.common; | ||
827 | dbg = &priv->_agn.statistics.general.common.dbg; | ||
828 | div = &priv->_agn.statistics.general.common.div; | ||
829 | accum_general = &priv->_agn.accum_statistics.general.common; | ||
830 | accum_dbg = &priv->_agn.accum_statistics.general.common.dbg; | ||
831 | accum_div = &priv->_agn.accum_statistics.general.common.div; | ||
832 | delta_general = &priv->_agn.delta_statistics.general.common; | ||
833 | max_general = &priv->_agn.max_delta.general.common; | ||
834 | delta_dbg = &priv->_agn.delta_statistics.general.common.dbg; | ||
835 | max_dbg = &priv->_agn.max_delta.general.common.dbg; | ||
836 | delta_div = &priv->_agn.delta_statistics.general.common.div; | ||
837 | max_div = &priv->_agn.max_delta.general.common.div; | ||
838 | } | ||
839 | |||
792 | pos += iwl_statistics_flag(priv, buf, bufsz); | 840 | pos += iwl_statistics_flag(priv, buf, bufsz); |
793 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | 841 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
794 | "acumulative delta max\n", | 842 | "acumulative delta max\n", |
@@ -876,3 +924,90 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf, | |||
876 | kfree(buf); | 924 | kfree(buf); |
877 | return ret; | 925 | return ret; |
878 | } | 926 | } |
927 | |||
928 | ssize_t iwl_ucode_bt_stats_read(struct file *file, | ||
929 | char __user *user_buf, | ||
930 | size_t count, loff_t *ppos) | ||
931 | { | ||
932 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
933 | int pos = 0; | ||
934 | char *buf; | ||
935 | int bufsz = (sizeof(struct statistics_bt_activity) * 24) + 200; | ||
936 | ssize_t ret; | ||
937 | struct statistics_bt_activity *bt, *accum_bt; | ||
938 | |||
939 | if (!iwl_is_alive(priv)) | ||
940 | return -EAGAIN; | ||
941 | |||
942 | /* make request to uCode to retrieve statistics information */ | ||
943 | mutex_lock(&priv->mutex); | ||
944 | ret = iwl_send_statistics_request(priv, CMD_SYNC, false); | ||
945 | mutex_unlock(&priv->mutex); | ||
946 | |||
947 | if (ret) { | ||
948 | IWL_ERR(priv, | ||
949 | "Error sending statistics request: %zd\n", ret); | ||
950 | return -EAGAIN; | ||
951 | } | ||
952 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
953 | if (!buf) { | ||
954 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
955 | return -ENOMEM; | ||
956 | } | ||
957 | |||
958 | /* | ||
959 | * the statistic information display here is based on | ||
960 | * the last statistics notification from uCode | ||
961 | * might not reflect the current uCode activity | ||
962 | */ | ||
963 | bt = &priv->_agn.statistics_bt.general.activity; | ||
964 | accum_bt = &priv->_agn.accum_statistics_bt.general.activity; | ||
965 | |||
966 | pos += iwl_statistics_flag(priv, buf, bufsz); | ||
967 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_BT:\n"); | ||
968 | pos += scnprintf(buf + pos, bufsz - pos, | ||
969 | "\t\t\tcurrent\t\t\taccumulative\n"); | ||
970 | pos += scnprintf(buf + pos, bufsz - pos, | ||
971 | "hi_priority_tx_req_cnt:\t\t%u\t\t\t%u\n", | ||
972 | le32_to_cpu(bt->hi_priority_tx_req_cnt), | ||
973 | accum_bt->hi_priority_tx_req_cnt); | ||
974 | pos += scnprintf(buf + pos, bufsz - pos, | ||
975 | "hi_priority_tx_denied_cnt:\t%u\t\t\t%u\n", | ||
976 | le32_to_cpu(bt->hi_priority_tx_denied_cnt), | ||
977 | accum_bt->hi_priority_tx_denied_cnt); | ||
978 | pos += scnprintf(buf + pos, bufsz - pos, | ||
979 | "lo_priority_tx_req_cnt:\t\t%u\t\t\t%u\n", | ||
980 | le32_to_cpu(bt->lo_priority_tx_req_cnt), | ||
981 | accum_bt->lo_priority_tx_req_cnt); | ||
982 | pos += scnprintf(buf + pos, bufsz - pos, | ||
983 | "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n", | ||
984 | le32_to_cpu(bt->lo_priority_tx_denied_cnt), | ||
985 | accum_bt->lo_priority_tx_denied_cnt); | ||
986 | pos += scnprintf(buf + pos, bufsz - pos, | ||
987 | "hi_priority_rx_req_cnt:\t\t%u\t\t\t%u\n", | ||
988 | le32_to_cpu(bt->hi_priority_rx_req_cnt), | ||
989 | accum_bt->hi_priority_rx_req_cnt); | ||
990 | pos += scnprintf(buf + pos, bufsz - pos, | ||
991 | "hi_priority_rx_denied_cnt:\t%u\t\t\t%u\n", | ||
992 | le32_to_cpu(bt->hi_priority_rx_denied_cnt), | ||
993 | accum_bt->hi_priority_rx_denied_cnt); | ||
994 | pos += scnprintf(buf + pos, bufsz - pos, | ||
995 | "lo_priority_rx_req_cnt:\t\t%u\t\t\t%u\n", | ||
996 | le32_to_cpu(bt->lo_priority_rx_req_cnt), | ||
997 | accum_bt->lo_priority_rx_req_cnt); | ||
998 | pos += scnprintf(buf + pos, bufsz - pos, | ||
999 | "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n", | ||
1000 | le32_to_cpu(bt->lo_priority_rx_denied_cnt), | ||
1001 | accum_bt->lo_priority_rx_denied_cnt); | ||
1002 | |||
1003 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1004 | "(rx)num_bt_kills:\t\t%u\t\t\t%u\n", | ||
1005 | le32_to_cpu(priv->_agn.statistics_bt.rx. | ||
1006 | general.num_bt_kills), | ||
1007 | priv->_agn.accum_statistics_bt.rx. | ||
1008 | general.num_bt_kills); | ||
1009 | |||
1010 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1011 | kfree(buf); | ||
1012 | return ret; | ||
1013 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h index 59b1f25f0d85..bbdce5913ac7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h | |||
@@ -37,6 +37,8 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file, char __user *user_buf, | |||
37 | size_t count, loff_t *ppos); | 37 | size_t count, loff_t *ppos); |
38 | ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf, | 38 | ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf, |
39 | size_t count, loff_t *ppos); | 39 | size_t count, loff_t *ppos); |
40 | ssize_t iwl_ucode_bt_stats_read(struct file *file, char __user *user_buf, | ||
41 | size_t count, loff_t *ppos); | ||
40 | #else | 42 | #else |
41 | static ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf, | 43 | static ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf, |
42 | size_t count, loff_t *ppos) | 44 | size_t count, loff_t *ppos) |
@@ -53,4 +55,9 @@ static ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user | |||
53 | { | 55 | { |
54 | return 0; | 56 | return 0; |
55 | } | 57 | } |
58 | static ssize_t iwl_ucode_bt_stats_read(struct file *file, char __user *user_buf, | ||
59 | size_t count, loff_t *ppos) | ||
60 | { | ||
61 | return 0; | ||
62 | } | ||
56 | #endif | 63 | #endif |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c index f06d1feedf81..a7216dda9786 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c | |||
@@ -164,7 +164,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv, | |||
164 | 164 | ||
165 | memset(&cmd, 0, sizeof(cmd)); | 165 | memset(&cmd, 0, sizeof(cmd)); |
166 | 166 | ||
167 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; | 167 | cmd.hdr.op_code = priv->_agn.phy_calib_chain_noise_gain_cmd; |
168 | cmd.hdr.first_group = 0; | 168 | cmd.hdr.first_group = 0; |
169 | cmd.hdr.groups_num = 1; | 169 | cmd.hdr.groups_num = 1; |
170 | cmd.hdr.data_valid = 1; | 170 | cmd.hdr.data_valid = 1; |
@@ -197,7 +197,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv) | |||
197 | data->beacon_count = 0; | 197 | data->beacon_count = 0; |
198 | 198 | ||
199 | memset(&cmd, 0, sizeof(cmd)); | 199 | memset(&cmd, 0, sizeof(cmd)); |
200 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; | 200 | cmd.hdr.op_code = priv->_agn.phy_calib_chain_noise_reset_cmd; |
201 | cmd.hdr.first_group = 0; | 201 | cmd.hdr.first_group = 0; |
202 | cmd.hdr.groups_num = 1; | 202 | cmd.hdr.groups_num = 1; |
203 | cmd.hdr.data_valid = 1; | 203 | cmd.hdr.data_valid = 1; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 74623e0d535f..a1b6d202d57c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -364,7 +364,7 @@ void iwlagn_temperature(struct iwl_priv *priv) | |||
364 | { | 364 | { |
365 | /* store temperature from statistics (in Celsius) */ | 365 | /* store temperature from statistics (in Celsius) */ |
366 | priv->temperature = | 366 | priv->temperature = |
367 | le32_to_cpu(priv->_agn.statistics.general.temperature); | 367 | le32_to_cpu(priv->_agn.statistics.general.common.temperature); |
368 | iwl_tt_handler(priv); | 368 | iwl_tt_handler(priv); |
369 | } | 369 | } |
370 | 370 | ||
@@ -1234,7 +1234,10 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1234 | 1234 | ||
1235 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 1235 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); |
1236 | spin_lock_irqsave(&priv->lock, flags); | 1236 | spin_lock_irqsave(&priv->lock, flags); |
1237 | interval = vif ? vif->bss_conf.beacon_int : 0; | 1237 | if (priv->is_internal_short_scan) |
1238 | interval = 0; | ||
1239 | else | ||
1240 | interval = vif->bss_conf.beacon_int; | ||
1238 | spin_unlock_irqrestore(&priv->lock, flags); | 1241 | spin_unlock_irqrestore(&priv->lock, flags); |
1239 | 1242 | ||
1240 | scan->suspend_time = 0; | 1243 | scan->suspend_time = 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c index d54edc326f81..9490eced1198 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c | |||
@@ -67,17 +67,22 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, | |||
67 | * exactly when to expect beacons, therefore only when we're associated. */ | 67 | * exactly when to expect beacons, therefore only when we're associated. */ |
68 | static void iwl_rx_calc_noise(struct iwl_priv *priv) | 68 | static void iwl_rx_calc_noise(struct iwl_priv *priv) |
69 | { | 69 | { |
70 | struct statistics_rx_non_phy *rx_info | 70 | struct statistics_rx_non_phy *rx_info; |
71 | = &(priv->_agn.statistics.rx.general); | ||
72 | int num_active_rx = 0; | 71 | int num_active_rx = 0; |
73 | int total_silence = 0; | 72 | int total_silence = 0; |
74 | int bcn_silence_a = | 73 | int bcn_silence_a, bcn_silence_b, bcn_silence_c; |
74 | int last_rx_noise; | ||
75 | |||
76 | if (priv->cfg->bt_statistics) | ||
77 | rx_info = &(priv->_agn.statistics_bt.rx.general.common); | ||
78 | else | ||
79 | rx_info = &(priv->_agn.statistics.rx.general); | ||
80 | bcn_silence_a = | ||
75 | le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; | 81 | le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; |
76 | int bcn_silence_b = | 82 | bcn_silence_b = |
77 | le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER; | 83 | le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER; |
78 | int bcn_silence_c = | 84 | bcn_silence_c = |
79 | le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER; | 85 | le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER; |
80 | int last_rx_noise; | ||
81 | 86 | ||
82 | if (bcn_silence_a) { | 87 | if (bcn_silence_a) { |
83 | total_silence += bcn_silence_a; | 88 | total_silence += bcn_silence_a; |
@@ -112,17 +117,35 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv) | |||
112 | static void iwl_accumulative_statistics(struct iwl_priv *priv, | 117 | static void iwl_accumulative_statistics(struct iwl_priv *priv, |
113 | __le32 *stats) | 118 | __le32 *stats) |
114 | { | 119 | { |
115 | int i; | 120 | int i, size; |
116 | __le32 *prev_stats; | 121 | __le32 *prev_stats; |
117 | u32 *accum_stats; | 122 | u32 *accum_stats; |
118 | u32 *delta, *max_delta; | 123 | u32 *delta, *max_delta; |
124 | struct statistics_general_common *general, *accum_general; | ||
125 | struct statistics_tx *tx, *accum_tx; | ||
119 | 126 | ||
120 | prev_stats = (__le32 *)&priv->_agn.statistics; | 127 | if (priv->cfg->bt_statistics) { |
121 | accum_stats = (u32 *)&priv->_agn.accum_statistics; | 128 | prev_stats = (__le32 *)&priv->_agn.statistics_bt; |
122 | delta = (u32 *)&priv->_agn.delta_statistics; | 129 | accum_stats = (u32 *)&priv->_agn.accum_statistics_bt; |
123 | max_delta = (u32 *)&priv->_agn.max_delta; | 130 | size = sizeof(struct iwl_bt_notif_statistics); |
124 | 131 | general = &priv->_agn.statistics_bt.general.common; | |
125 | for (i = sizeof(__le32); i < sizeof(struct iwl_notif_statistics); | 132 | accum_general = &priv->_agn.accum_statistics_bt.general.common; |
133 | tx = &priv->_agn.statistics_bt.tx; | ||
134 | accum_tx = &priv->_agn.accum_statistics_bt.tx; | ||
135 | delta = (u32 *)&priv->_agn.delta_statistics_bt; | ||
136 | max_delta = (u32 *)&priv->_agn.max_delta_bt; | ||
137 | } else { | ||
138 | prev_stats = (__le32 *)&priv->_agn.statistics; | ||
139 | accum_stats = (u32 *)&priv->_agn.accum_statistics; | ||
140 | size = sizeof(struct iwl_notif_statistics); | ||
141 | general = &priv->_agn.statistics.general.common; | ||
142 | accum_general = &priv->_agn.accum_statistics.general.common; | ||
143 | tx = &priv->_agn.statistics.tx; | ||
144 | accum_tx = &priv->_agn.accum_statistics.tx; | ||
145 | delta = (u32 *)&priv->_agn.delta_statistics; | ||
146 | max_delta = (u32 *)&priv->_agn.max_delta; | ||
147 | } | ||
148 | for (i = sizeof(__le32); i < size; | ||
126 | i += sizeof(__le32), stats++, prev_stats++, delta++, | 149 | i += sizeof(__le32), stats++, prev_stats++, delta++, |
127 | max_delta++, accum_stats++) { | 150 | max_delta++, accum_stats++) { |
128 | if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) { | 151 | if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) { |
@@ -135,18 +158,12 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv, | |||
135 | } | 158 | } |
136 | 159 | ||
137 | /* reset accumulative statistics for "no-counter" type statistics */ | 160 | /* reset accumulative statistics for "no-counter" type statistics */ |
138 | priv->_agn.accum_statistics.general.temperature = | 161 | accum_general->temperature = general->temperature; |
139 | priv->_agn.statistics.general.temperature; | 162 | accum_general->temperature_m = general->temperature_m; |
140 | priv->_agn.accum_statistics.general.temperature_m = | 163 | accum_general->ttl_timestamp = general->ttl_timestamp; |
141 | priv->_agn.statistics.general.temperature_m; | 164 | accum_tx->tx_power.ant_a = tx->tx_power.ant_a; |
142 | priv->_agn.accum_statistics.general.ttl_timestamp = | 165 | accum_tx->tx_power.ant_b = tx->tx_power.ant_b; |
143 | priv->_agn.statistics.general.ttl_timestamp; | 166 | accum_tx->tx_power.ant_c = tx->tx_power.ant_c; |
144 | priv->_agn.accum_statistics.tx.tx_power.ant_a = | ||
145 | priv->_agn.statistics.tx.tx_power.ant_a; | ||
146 | priv->_agn.accum_statistics.tx.tx_power.ant_b = | ||
147 | priv->_agn.statistics.tx.tx_power.ant_b; | ||
148 | priv->_agn.accum_statistics.tx.tx_power.ant_c = | ||
149 | priv->_agn.statistics.tx.tx_power.ant_c; | ||
150 | } | 167 | } |
151 | #endif | 168 | #endif |
152 | 169 | ||
@@ -185,11 +202,30 @@ bool iwl_good_plcp_health(struct iwl_priv *priv, | |||
185 | * by zero. | 202 | * by zero. |
186 | */ | 203 | */ |
187 | if (plcp_msec) { | 204 | if (plcp_msec) { |
188 | combined_plcp_delta = | 205 | struct statistics_rx_phy *ofdm; |
189 | (le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err) - | 206 | struct statistics_rx_ht_phy *ofdm_ht; |
190 | le32_to_cpu(priv->_agn.statistics.rx.ofdm.plcp_err)) + | 207 | |
191 | (le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err) - | 208 | if (priv->cfg->bt_statistics) { |
192 | le32_to_cpu(priv->_agn.statistics.rx.ofdm_ht.plcp_err)); | 209 | ofdm = &pkt->u.stats_bt.rx.ofdm; |
210 | ofdm_ht = &pkt->u.stats_bt.rx.ofdm_ht; | ||
211 | combined_plcp_delta = | ||
212 | (le32_to_cpu(ofdm->plcp_err) - | ||
213 | le32_to_cpu(priv->_agn.statistics_bt. | ||
214 | rx.ofdm.plcp_err)) + | ||
215 | (le32_to_cpu(ofdm_ht->plcp_err) - | ||
216 | le32_to_cpu(priv->_agn.statistics_bt. | ||
217 | rx.ofdm_ht.plcp_err)); | ||
218 | } else { | ||
219 | ofdm = &pkt->u.stats.rx.ofdm; | ||
220 | ofdm_ht = &pkt->u.stats.rx.ofdm_ht; | ||
221 | combined_plcp_delta = | ||
222 | (le32_to_cpu(ofdm->plcp_err) - | ||
223 | le32_to_cpu(priv->_agn.statistics. | ||
224 | rx.ofdm.plcp_err)) + | ||
225 | (le32_to_cpu(ofdm_ht->plcp_err) - | ||
226 | le32_to_cpu(priv->_agn.statistics. | ||
227 | rx.ofdm_ht.plcp_err)); | ||
228 | } | ||
193 | 229 | ||
194 | if ((combined_plcp_delta > 0) && | 230 | if ((combined_plcp_delta > 0) && |
195 | ((combined_plcp_delta * 100) / plcp_msec) > | 231 | ((combined_plcp_delta * 100) / plcp_msec) > |
@@ -206,15 +242,14 @@ bool iwl_good_plcp_health(struct iwl_priv *priv, | |||
206 | * plcp_msec | 242 | * plcp_msec |
207 | */ | 243 | */ |
208 | IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, " | 244 | IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, " |
209 | "%u, %u, %u, %u, %d, %u mSecs\n", | 245 | "%u, %u, %u, %u, %d, %u mSecs\n", |
210 | priv->cfg->plcp_delta_threshold, | 246 | priv->cfg->plcp_delta_threshold, |
211 | le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err), | 247 | le32_to_cpu(ofdm->plcp_err), |
212 | le32_to_cpu( | 248 | le32_to_cpu(ofdm->plcp_err), |
213 | priv->_agn.statistics.rx.ofdm.plcp_err), | 249 | le32_to_cpu(ofdm_ht->plcp_err), |
214 | le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err), | 250 | le32_to_cpu(ofdm_ht->plcp_err), |
215 | le32_to_cpu( | 251 | combined_plcp_delta, plcp_msec); |
216 | priv->_agn.statistics.rx.ofdm_ht.plcp_err), | 252 | |
217 | combined_plcp_delta, plcp_msec); | ||
218 | rc = false; | 253 | rc = false; |
219 | } | 254 | } |
220 | } | 255 | } |
@@ -227,24 +262,50 @@ void iwl_rx_statistics(struct iwl_priv *priv, | |||
227 | int change; | 262 | int change; |
228 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 263 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
229 | 264 | ||
265 | if (priv->cfg->bt_statistics) { | ||
266 | IWL_DEBUG_RX(priv, | ||
267 | "Statistics notification received (%d vs %d).\n", | ||
268 | (int)sizeof(struct iwl_bt_notif_statistics), | ||
269 | le32_to_cpu(pkt->len_n_flags) & | ||
270 | FH_RSCSR_FRAME_SIZE_MSK); | ||
230 | 271 | ||
231 | IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", | 272 | change = ((priv->_agn.statistics_bt.general.common.temperature != |
232 | (int)sizeof(priv->_agn.statistics), | 273 | pkt->u.stats_bt.general.common.temperature) || |
233 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); | 274 | ((priv->_agn.statistics_bt.flag & |
275 | STATISTICS_REPLY_FLG_HT40_MODE_MSK) != | ||
276 | (pkt->u.stats_bt.flag & | ||
277 | STATISTICS_REPLY_FLG_HT40_MODE_MSK))); | ||
278 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
279 | iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats_bt); | ||
280 | #endif | ||
234 | 281 | ||
235 | change = ((priv->_agn.statistics.general.temperature != | 282 | } else { |
236 | pkt->u.stats.general.temperature) || | 283 | IWL_DEBUG_RX(priv, |
237 | ((priv->_agn.statistics.flag & | 284 | "Statistics notification received (%d vs %d).\n", |
238 | STATISTICS_REPLY_FLG_HT40_MODE_MSK) != | 285 | (int)sizeof(struct iwl_notif_statistics), |
239 | (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK))); | 286 | le32_to_cpu(pkt->len_n_flags) & |
287 | FH_RSCSR_FRAME_SIZE_MSK); | ||
240 | 288 | ||
289 | change = ((priv->_agn.statistics.general.common.temperature != | ||
290 | pkt->u.stats.general.common.temperature) || | ||
291 | ((priv->_agn.statistics.flag & | ||
292 | STATISTICS_REPLY_FLG_HT40_MODE_MSK) != | ||
293 | (pkt->u.stats.flag & | ||
294 | STATISTICS_REPLY_FLG_HT40_MODE_MSK))); | ||
241 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 295 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
242 | iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); | 296 | iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); |
243 | #endif | 297 | #endif |
298 | |||
299 | } | ||
300 | |||
244 | iwl_recover_from_statistics(priv, pkt); | 301 | iwl_recover_from_statistics(priv, pkt); |
245 | 302 | ||
246 | memcpy(&priv->_agn.statistics, &pkt->u.stats, | 303 | if (priv->cfg->bt_statistics) |
247 | sizeof(priv->_agn.statistics)); | 304 | memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt, |
305 | sizeof(priv->_agn.statistics_bt)); | ||
306 | else | ||
307 | memcpy(&priv->_agn.statistics, &pkt->u.stats, | ||
308 | sizeof(priv->_agn.statistics)); | ||
248 | 309 | ||
249 | set_bit(STATUS_STATISTICS, &priv->status); | 310 | set_bit(STATUS_STATISTICS, &priv->status); |
250 | 311 | ||
@@ -277,6 +338,12 @@ void iwl_reply_statistics(struct iwl_priv *priv, | |||
277 | sizeof(struct iwl_notif_statistics)); | 338 | sizeof(struct iwl_notif_statistics)); |
278 | memset(&priv->_agn.max_delta, 0, | 339 | memset(&priv->_agn.max_delta, 0, |
279 | sizeof(struct iwl_notif_statistics)); | 340 | sizeof(struct iwl_notif_statistics)); |
341 | memset(&priv->_agn.accum_statistics_bt, 0, | ||
342 | sizeof(struct iwl_bt_notif_statistics)); | ||
343 | memset(&priv->_agn.delta_statistics_bt, 0, | ||
344 | sizeof(struct iwl_bt_notif_statistics)); | ||
345 | memset(&priv->_agn.max_delta_bt, 0, | ||
346 | sizeof(struct iwl_bt_notif_statistics)); | ||
280 | #endif | 347 | #endif |
281 | IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); | 348 | IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); |
282 | } | 349 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 7391c63fb024..35337b1e7cac 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -27,6 +27,8 @@ | |||
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
31 | |||
30 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
31 | #include <linux/module.h> | 33 | #include <linux/module.h> |
32 | #include <linux/init.h> | 34 | #include <linux/init.h> |
@@ -292,9 +294,7 @@ static u32 iwl_fill_beacon_frame(struct iwl_priv *priv, | |||
292 | struct ieee80211_hdr *hdr, | 294 | struct ieee80211_hdr *hdr, |
293 | int left) | 295 | int left) |
294 | { | 296 | { |
295 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || | 297 | if (!priv->ibss_beacon) |
296 | ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && | ||
297 | (priv->iw_mode != NL80211_IFTYPE_AP))) | ||
298 | return 0; | 298 | return 0; |
299 | 299 | ||
300 | if (priv->ibss_beacon->len > left) | 300 | if (priv->ibss_beacon->len > left) |
@@ -1692,6 +1692,7 @@ static void iwl_nic_start(struct iwl_priv *priv) | |||
1692 | 1692 | ||
1693 | struct iwlagn_ucode_capabilities { | 1693 | struct iwlagn_ucode_capabilities { |
1694 | u32 max_probe_length; | 1694 | u32 max_probe_length; |
1695 | u32 standard_phy_calibration_size; | ||
1695 | }; | 1696 | }; |
1696 | 1697 | ||
1697 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); | 1698 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); |
@@ -1827,7 +1828,6 @@ static int iwlagn_load_firmware(struct iwl_priv *priv, | |||
1827 | u32 tlv_len; | 1828 | u32 tlv_len; |
1828 | enum iwl_ucode_tlv_type tlv_type; | 1829 | enum iwl_ucode_tlv_type tlv_type; |
1829 | const u8 *tlv_data; | 1830 | const u8 *tlv_data; |
1830 | int ret = 0; | ||
1831 | 1831 | ||
1832 | if (len < sizeof(*ucode)) { | 1832 | if (len < sizeof(*ucode)) { |
1833 | IWL_ERR(priv, "uCode has invalid length: %zd\n", len); | 1833 | IWL_ERR(priv, "uCode has invalid length: %zd\n", len); |
@@ -1863,9 +1863,8 @@ static int iwlagn_load_firmware(struct iwl_priv *priv, | |||
1863 | 1863 | ||
1864 | len -= sizeof(*ucode); | 1864 | len -= sizeof(*ucode); |
1865 | 1865 | ||
1866 | while (len >= sizeof(*tlv) && !ret) { | 1866 | while (len >= sizeof(*tlv)) { |
1867 | u16 tlv_alt; | 1867 | u16 tlv_alt; |
1868 | u32 fixed_tlv_size = 4; | ||
1869 | 1868 | ||
1870 | len -= sizeof(*tlv); | 1869 | len -= sizeof(*tlv); |
1871 | tlv = (void *)data; | 1870 | tlv = (void *)data; |
@@ -1913,59 +1912,57 @@ static int iwlagn_load_firmware(struct iwl_priv *priv, | |||
1913 | pieces->boot_size = tlv_len; | 1912 | pieces->boot_size = tlv_len; |
1914 | break; | 1913 | break; |
1915 | case IWL_UCODE_TLV_PROBE_MAX_LEN: | 1914 | case IWL_UCODE_TLV_PROBE_MAX_LEN: |
1916 | if (tlv_len != fixed_tlv_size) | 1915 | if (tlv_len != sizeof(u32)) |
1917 | ret = -EINVAL; | 1916 | goto invalid_tlv_len; |
1918 | else | 1917 | capa->max_probe_length = |
1919 | capa->max_probe_length = | ||
1920 | le32_to_cpup((__le32 *)tlv_data); | 1918 | le32_to_cpup((__le32 *)tlv_data); |
1921 | break; | 1919 | break; |
1922 | case IWL_UCODE_TLV_INIT_EVTLOG_PTR: | 1920 | case IWL_UCODE_TLV_INIT_EVTLOG_PTR: |
1923 | if (tlv_len != fixed_tlv_size) | 1921 | if (tlv_len != sizeof(u32)) |
1924 | ret = -EINVAL; | 1922 | goto invalid_tlv_len; |
1925 | else | 1923 | pieces->init_evtlog_ptr = |
1926 | pieces->init_evtlog_ptr = | ||
1927 | le32_to_cpup((__le32 *)tlv_data); | 1924 | le32_to_cpup((__le32 *)tlv_data); |
1928 | break; | 1925 | break; |
1929 | case IWL_UCODE_TLV_INIT_EVTLOG_SIZE: | 1926 | case IWL_UCODE_TLV_INIT_EVTLOG_SIZE: |
1930 | if (tlv_len != fixed_tlv_size) | 1927 | if (tlv_len != sizeof(u32)) |
1931 | ret = -EINVAL; | 1928 | goto invalid_tlv_len; |
1932 | else | 1929 | pieces->init_evtlog_size = |
1933 | pieces->init_evtlog_size = | ||
1934 | le32_to_cpup((__le32 *)tlv_data); | 1930 | le32_to_cpup((__le32 *)tlv_data); |
1935 | break; | 1931 | break; |
1936 | case IWL_UCODE_TLV_INIT_ERRLOG_PTR: | 1932 | case IWL_UCODE_TLV_INIT_ERRLOG_PTR: |
1937 | if (tlv_len != fixed_tlv_size) | 1933 | if (tlv_len != sizeof(u32)) |
1938 | ret = -EINVAL; | 1934 | goto invalid_tlv_len; |
1939 | else | 1935 | pieces->init_errlog_ptr = |
1940 | pieces->init_errlog_ptr = | ||
1941 | le32_to_cpup((__le32 *)tlv_data); | 1936 | le32_to_cpup((__le32 *)tlv_data); |
1942 | break; | 1937 | break; |
1943 | case IWL_UCODE_TLV_RUNT_EVTLOG_PTR: | 1938 | case IWL_UCODE_TLV_RUNT_EVTLOG_PTR: |
1944 | if (tlv_len != fixed_tlv_size) | 1939 | if (tlv_len != sizeof(u32)) |
1945 | ret = -EINVAL; | 1940 | goto invalid_tlv_len; |
1946 | else | 1941 | pieces->inst_evtlog_ptr = |
1947 | pieces->inst_evtlog_ptr = | ||
1948 | le32_to_cpup((__le32 *)tlv_data); | 1942 | le32_to_cpup((__le32 *)tlv_data); |
1949 | break; | 1943 | break; |
1950 | case IWL_UCODE_TLV_RUNT_EVTLOG_SIZE: | 1944 | case IWL_UCODE_TLV_RUNT_EVTLOG_SIZE: |
1951 | if (tlv_len != fixed_tlv_size) | 1945 | if (tlv_len != sizeof(u32)) |
1952 | ret = -EINVAL; | 1946 | goto invalid_tlv_len; |
1953 | else | 1947 | pieces->inst_evtlog_size = |
1954 | pieces->inst_evtlog_size = | ||
1955 | le32_to_cpup((__le32 *)tlv_data); | 1948 | le32_to_cpup((__le32 *)tlv_data); |
1956 | break; | 1949 | break; |
1957 | case IWL_UCODE_TLV_RUNT_ERRLOG_PTR: | 1950 | case IWL_UCODE_TLV_RUNT_ERRLOG_PTR: |
1958 | if (tlv_len != fixed_tlv_size) | 1951 | if (tlv_len != sizeof(u32)) |
1959 | ret = -EINVAL; | 1952 | goto invalid_tlv_len; |
1960 | else | 1953 | pieces->inst_errlog_ptr = |
1961 | pieces->inst_errlog_ptr = | ||
1962 | le32_to_cpup((__le32 *)tlv_data); | 1954 | le32_to_cpup((__le32 *)tlv_data); |
1963 | break; | 1955 | break; |
1964 | case IWL_UCODE_TLV_ENHANCE_SENS_TBL: | 1956 | case IWL_UCODE_TLV_ENHANCE_SENS_TBL: |
1965 | if (tlv_len) | 1957 | if (tlv_len) |
1966 | ret = -EINVAL; | 1958 | goto invalid_tlv_len; |
1967 | else | 1959 | priv->enhance_sensitivity_table = true; |
1968 | priv->enhance_sensitivity_table = true; | 1960 | break; |
1961 | case IWL_UCODE_TLV_PHY_CALIBRATION_SIZE: | ||
1962 | if (tlv_len != sizeof(u32)) | ||
1963 | goto invalid_tlv_len; | ||
1964 | capa->standard_phy_calibration_size = | ||
1965 | le32_to_cpup((__le32 *)tlv_data); | ||
1969 | break; | 1966 | break; |
1970 | default: | 1967 | default: |
1971 | IWL_WARN(priv, "unknown TLV: %d\n", tlv_type); | 1968 | IWL_WARN(priv, "unknown TLV: %d\n", tlv_type); |
@@ -1976,14 +1973,16 @@ static int iwlagn_load_firmware(struct iwl_priv *priv, | |||
1976 | if (len) { | 1973 | if (len) { |
1977 | IWL_ERR(priv, "invalid TLV after parsing: %zd\n", len); | 1974 | IWL_ERR(priv, "invalid TLV after parsing: %zd\n", len); |
1978 | iwl_print_hex_dump(priv, IWL_DL_FW, (u8 *)data, len); | 1975 | iwl_print_hex_dump(priv, IWL_DL_FW, (u8 *)data, len); |
1979 | ret = -EINVAL; | 1976 | return -EINVAL; |
1980 | } else if (ret) { | ||
1981 | IWL_ERR(priv, "TLV %d has invalid size: %u\n", | ||
1982 | tlv_type, tlv_len); | ||
1983 | iwl_print_hex_dump(priv, IWL_DL_FW, (u8 *)tlv_data, tlv_len); | ||
1984 | } | 1977 | } |
1985 | 1978 | ||
1986 | return ret; | 1979 | return 0; |
1980 | |||
1981 | invalid_tlv_len: | ||
1982 | IWL_ERR(priv, "TLV %d has invalid size: %u\n", tlv_type, tlv_len); | ||
1983 | iwl_print_hex_dump(priv, IWL_DL_FW, tlv_data, tlv_len); | ||
1984 | |||
1985 | return -EINVAL; | ||
1987 | } | 1986 | } |
1988 | 1987 | ||
1989 | /** | 1988 | /** |
@@ -2005,6 +2004,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
2005 | u32 build; | 2004 | u32 build; |
2006 | struct iwlagn_ucode_capabilities ucode_capa = { | 2005 | struct iwlagn_ucode_capabilities ucode_capa = { |
2007 | .max_probe_length = 200, | 2006 | .max_probe_length = 200, |
2007 | .standard_phy_calibration_size = | ||
2008 | IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE, | ||
2008 | }; | 2009 | }; |
2009 | 2010 | ||
2010 | memset(&pieces, 0, sizeof(pieces)); | 2011 | memset(&pieces, 0, sizeof(pieces)); |
@@ -2226,6 +2227,20 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
2226 | pieces.boot_size); | 2227 | pieces.boot_size); |
2227 | memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); | 2228 | memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); |
2228 | 2229 | ||
2230 | /* | ||
2231 | * figure out the offset of chain noise reset and gain commands | ||
2232 | * base on the size of standard phy calibration commands table size | ||
2233 | */ | ||
2234 | if (ucode_capa.standard_phy_calibration_size > | ||
2235 | IWL_MAX_PHY_CALIBRATE_TBL_SIZE) | ||
2236 | ucode_capa.standard_phy_calibration_size = | ||
2237 | IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE; | ||
2238 | |||
2239 | priv->_agn.phy_calib_chain_noise_reset_cmd = | ||
2240 | ucode_capa.standard_phy_calibration_size; | ||
2241 | priv->_agn.phy_calib_chain_noise_gain_cmd = | ||
2242 | ucode_capa.standard_phy_calibration_size + 1; | ||
2243 | |||
2229 | /************************************************** | 2244 | /************************************************** |
2230 | * This is still part of probe() in a sense... | 2245 | * This is still part of probe() in a sense... |
2231 | * | 2246 | * |
@@ -3008,9 +3023,17 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) | |||
3008 | } | 3023 | } |
3009 | 3024 | ||
3010 | if (priv->start_calib) { | 3025 | if (priv->start_calib) { |
3011 | iwl_chain_noise_calibration(priv, &priv->_agn.statistics); | 3026 | if (priv->cfg->bt_statistics) { |
3012 | 3027 | iwl_chain_noise_calibration(priv, | |
3013 | iwl_sensitivity_calibration(priv, &priv->_agn.statistics); | 3028 | (void *)&priv->_agn.statistics_bt); |
3029 | iwl_sensitivity_calibration(priv, | ||
3030 | (void *)&priv->_agn.statistics_bt); | ||
3031 | } else { | ||
3032 | iwl_chain_noise_calibration(priv, | ||
3033 | (void *)&priv->_agn.statistics); | ||
3034 | iwl_sensitivity_calibration(priv, | ||
3035 | (void *)&priv->_agn.statistics); | ||
3036 | } | ||
3014 | } | 3037 | } |
3015 | 3038 | ||
3016 | mutex_unlock(&priv->mutex); | 3039 | mutex_unlock(&priv->mutex); |
@@ -3909,8 +3932,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3909 | struct ieee80211_hw *hw; | 3932 | struct ieee80211_hw *hw; |
3910 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 3933 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
3911 | unsigned long flags; | 3934 | unsigned long flags; |
3912 | u16 pci_cmd; | 3935 | u16 pci_cmd, num_mac; |
3913 | u8 perm_addr[ETH_ALEN]; | ||
3914 | 3936 | ||
3915 | /************************ | 3937 | /************************ |
3916 | * 1. Allocating HW data | 3938 | * 1. Allocating HW data |
@@ -4028,9 +4050,17 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
4028 | goto out_free_eeprom; | 4050 | goto out_free_eeprom; |
4029 | 4051 | ||
4030 | /* extract MAC Address */ | 4052 | /* extract MAC Address */ |
4031 | iwl_eeprom_get_mac(priv, perm_addr); | 4053 | iwl_eeprom_get_mac(priv, priv->addresses[0].addr); |
4032 | IWL_DEBUG_INFO(priv, "MAC address: %pM\n", perm_addr); | 4054 | IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); |
4033 | SET_IEEE80211_PERM_ADDR(priv->hw, perm_addr); | 4055 | priv->hw->wiphy->addresses = priv->addresses; |
4056 | priv->hw->wiphy->n_addresses = 1; | ||
4057 | num_mac = iwl_eeprom_query16(priv, EEPROM_NUM_MAC_ADDRESS); | ||
4058 | if (num_mac > 1) { | ||
4059 | memcpy(priv->addresses[1].addr, priv->addresses[0].addr, | ||
4060 | ETH_ALEN); | ||
4061 | priv->addresses[1].addr[5]++; | ||
4062 | priv->hw->wiphy->n_addresses++; | ||
4063 | } | ||
4034 | 4064 | ||
4035 | /************************ | 4065 | /************************ |
4036 | * 5. Setup HW constants | 4066 | * 5. Setup HW constants |
@@ -4389,19 +4419,18 @@ static int __init iwl_init(void) | |||
4389 | { | 4419 | { |
4390 | 4420 | ||
4391 | int ret; | 4421 | int ret; |
4392 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); | 4422 | pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); |
4393 | printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); | 4423 | pr_info(DRV_COPYRIGHT "\n"); |
4394 | 4424 | ||
4395 | ret = iwlagn_rate_control_register(); | 4425 | ret = iwlagn_rate_control_register(); |
4396 | if (ret) { | 4426 | if (ret) { |
4397 | printk(KERN_ERR DRV_NAME | 4427 | pr_err("Unable to register rate control algorithm: %d\n", ret); |
4398 | "Unable to register rate control algorithm: %d\n", ret); | ||
4399 | return ret; | 4428 | return ret; |
4400 | } | 4429 | } |
4401 | 4430 | ||
4402 | ret = pci_register_driver(&iwl_driver); | 4431 | ret = pci_register_driver(&iwl_driver); |
4403 | if (ret) { | 4432 | if (ret) { |
4404 | printk(KERN_ERR DRV_NAME "Unable to initialize PCI module\n"); | 4433 | pr_err("Unable to initialize PCI module\n"); |
4405 | goto error_register; | 4434 | goto error_register; |
4406 | } | 4435 | } |
4407 | 4436 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.h b/drivers/net/wireless/iwlwifi/iwl-calib.h index 2b7b1df83ba0..ba9523fbb300 100644 --- a/drivers/net/wireless/iwlwifi/iwl-calib.h +++ b/drivers/net/wireless/iwlwifi/iwl-calib.h | |||
@@ -66,10 +66,8 @@ | |||
66 | #include "iwl-core.h" | 66 | #include "iwl-core.h" |
67 | #include "iwl-commands.h" | 67 | #include "iwl-commands.h" |
68 | 68 | ||
69 | void iwl_chain_noise_calibration(struct iwl_priv *priv, | 69 | void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp); |
70 | struct iwl_notif_statistics *stat_resp); | 70 | void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp); |
71 | void iwl_sensitivity_calibration(struct iwl_priv *priv, | ||
72 | struct iwl_notif_statistics *resp); | ||
73 | 71 | ||
74 | void iwl_init_sensitivity(struct iwl_priv *priv); | 72 | void iwl_init_sensitivity(struct iwl_priv *priv); |
75 | void iwl_reset_run_time_calib(struct iwl_priv *priv); | 73 | void iwl_reset_run_time_calib(struct iwl_priv *priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index bd1ec933cd98..60725a5c1b69 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -964,8 +964,8 @@ struct iwl_qosparam_cmd { | |||
964 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ | 964 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ |
965 | #define IWL_INVALID_STATION 255 | 965 | #define IWL_INVALID_STATION 255 |
966 | 966 | ||
967 | #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2); | 967 | #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) |
968 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8); | 968 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) |
969 | #define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) | 969 | #define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) |
970 | #define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) | 970 | #define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) |
971 | #define STA_FLG_MAX_AGG_SIZE_POS (19) | 971 | #define STA_FLG_MAX_AGG_SIZE_POS (19) |
@@ -3127,6 +3127,13 @@ struct statistics_rx_non_phy { | |||
3127 | __le32 beacon_energy_c; | 3127 | __le32 beacon_energy_c; |
3128 | } __packed; | 3128 | } __packed; |
3129 | 3129 | ||
3130 | struct statistics_rx_non_phy_bt { | ||
3131 | struct statistics_rx_non_phy common; | ||
3132 | /* additional stats for bt */ | ||
3133 | __le32 num_bt_kills; | ||
3134 | __le32 reserved[2]; | ||
3135 | } __packed; | ||
3136 | |||
3130 | struct statistics_rx { | 3137 | struct statistics_rx { |
3131 | struct statistics_rx_phy ofdm; | 3138 | struct statistics_rx_phy ofdm; |
3132 | struct statistics_rx_phy cck; | 3139 | struct statistics_rx_phy cck; |
@@ -3134,6 +3141,13 @@ struct statistics_rx { | |||
3134 | struct statistics_rx_ht_phy ofdm_ht; | 3141 | struct statistics_rx_ht_phy ofdm_ht; |
3135 | } __packed; | 3142 | } __packed; |
3136 | 3143 | ||
3144 | struct statistics_rx_bt { | ||
3145 | struct statistics_rx_phy ofdm; | ||
3146 | struct statistics_rx_phy cck; | ||
3147 | struct statistics_rx_non_phy_bt general; | ||
3148 | struct statistics_rx_ht_phy ofdm_ht; | ||
3149 | } __packed; | ||
3150 | |||
3137 | /** | 3151 | /** |
3138 | * struct statistics_tx_power - current tx power | 3152 | * struct statistics_tx_power - current tx power |
3139 | * | 3153 | * |
@@ -3196,7 +3210,7 @@ struct statistics_div { | |||
3196 | __le32 reserved2; | 3210 | __le32 reserved2; |
3197 | } __packed; | 3211 | } __packed; |
3198 | 3212 | ||
3199 | struct statistics_general { | 3213 | struct statistics_general_common { |
3200 | __le32 temperature; /* radio temperature */ | 3214 | __le32 temperature; /* radio temperature */ |
3201 | __le32 temperature_m; /* for 5000 and up, this is radio voltage */ | 3215 | __le32 temperature_m; /* for 5000 and up, this is radio voltage */ |
3202 | struct statistics_dbg dbg; | 3216 | struct statistics_dbg dbg; |
@@ -3212,6 +3226,30 @@ struct statistics_general { | |||
3212 | * in order to get out of bad PHY status | 3226 | * in order to get out of bad PHY status |
3213 | */ | 3227 | */ |
3214 | __le32 num_of_sos_states; | 3228 | __le32 num_of_sos_states; |
3229 | } __packed; | ||
3230 | |||
3231 | struct statistics_bt_activity { | ||
3232 | /* Tx statistics */ | ||
3233 | __le32 hi_priority_tx_req_cnt; | ||
3234 | __le32 hi_priority_tx_denied_cnt; | ||
3235 | __le32 lo_priority_tx_req_cnt; | ||
3236 | __le32 lo_priority_tx_denied_cnt; | ||
3237 | /* Rx statistics */ | ||
3238 | __le32 hi_priority_rx_req_cnt; | ||
3239 | __le32 hi_priority_rx_denied_cnt; | ||
3240 | __le32 lo_priority_rx_req_cnt; | ||
3241 | __le32 lo_priority_rx_denied_cnt; | ||
3242 | } __packed; | ||
3243 | |||
3244 | struct statistics_general { | ||
3245 | struct statistics_general_common common; | ||
3246 | __le32 reserved2; | ||
3247 | __le32 reserved3; | ||
3248 | } __packed; | ||
3249 | |||
3250 | struct statistics_general_bt { | ||
3251 | struct statistics_general_common common; | ||
3252 | struct statistics_bt_activity activity; | ||
3215 | __le32 reserved2; | 3253 | __le32 reserved2; |
3216 | __le32 reserved3; | 3254 | __le32 reserved3; |
3217 | } __packed; | 3255 | } __packed; |
@@ -3273,6 +3311,12 @@ struct iwl_notif_statistics { | |||
3273 | struct statistics_general general; | 3311 | struct statistics_general general; |
3274 | } __packed; | 3312 | } __packed; |
3275 | 3313 | ||
3314 | struct iwl_bt_notif_statistics { | ||
3315 | __le32 flag; | ||
3316 | struct statistics_rx_bt rx; | ||
3317 | struct statistics_tx tx; | ||
3318 | struct statistics_general_bt general; | ||
3319 | } __packed; | ||
3276 | 3320 | ||
3277 | /* | 3321 | /* |
3278 | * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) | 3322 | * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) |
@@ -3616,10 +3660,10 @@ enum { | |||
3616 | IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, | 3660 | IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, |
3617 | IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, | 3661 | IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, |
3618 | IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, | 3662 | IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, |
3619 | IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18, | 3663 | IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 18, |
3620 | IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19, | ||
3621 | }; | 3664 | }; |
3622 | 3665 | ||
3666 | #define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253) | ||
3623 | 3667 | ||
3624 | #define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(0xffffffff) | 3668 | #define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(0xffffffff) |
3625 | 3669 | ||
@@ -3944,6 +3988,7 @@ struct iwl_rx_packet { | |||
3944 | struct iwl_sleep_notification sleep_notif; | 3988 | struct iwl_sleep_notification sleep_notif; |
3945 | struct iwl_spectrum_resp spectrum; | 3989 | struct iwl_spectrum_resp spectrum; |
3946 | struct iwl_notif_statistics stats; | 3990 | struct iwl_notif_statistics stats; |
3991 | struct iwl_bt_notif_statistics stats_bt; | ||
3947 | struct iwl_compressed_ba_resp compressed_ba; | 3992 | struct iwl_compressed_ba_resp compressed_ba; |
3948 | struct iwl_missed_beacon_notif missed_beacon; | 3993 | struct iwl_missed_beacon_notif missed_beacon; |
3949 | struct iwl_coex_medium_notification coex_medium_notif; | 3994 | struct iwl_coex_medium_notification coex_medium_notif; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 676d49df77ed..8024d44ce4bb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -170,7 +170,7 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, | |||
170 | struct ieee80211_hw *hw = | 170 | struct ieee80211_hw *hw = |
171 | ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops); | 171 | ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops); |
172 | if (hw == NULL) { | 172 | if (hw == NULL) { |
173 | printk(KERN_ERR "%s: Can not allocate network device\n", | 173 | pr_err("%s: Can not allocate network device\n", |
174 | cfg->name); | 174 | cfg->name); |
175 | goto out; | 175 | goto out; |
176 | } | 176 | } |
@@ -1748,6 +1748,37 @@ static inline void iwl_set_no_assoc(struct iwl_priv *priv) | |||
1748 | iwlcore_commit_rxon(priv); | 1748 | iwlcore_commit_rxon(priv); |
1749 | } | 1749 | } |
1750 | 1750 | ||
1751 | static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
1752 | { | ||
1753 | struct iwl_priv *priv = hw->priv; | ||
1754 | unsigned long flags; | ||
1755 | __le64 timestamp; | ||
1756 | |||
1757 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
1758 | |||
1759 | if (!iwl_is_ready_rf(priv)) { | ||
1760 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
1761 | return -EIO; | ||
1762 | } | ||
1763 | |||
1764 | spin_lock_irqsave(&priv->lock, flags); | ||
1765 | |||
1766 | if (priv->ibss_beacon) | ||
1767 | dev_kfree_skb(priv->ibss_beacon); | ||
1768 | |||
1769 | priv->ibss_beacon = skb; | ||
1770 | |||
1771 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | ||
1772 | priv->timestamp = le64_to_cpu(timestamp); | ||
1773 | |||
1774 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
1775 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1776 | |||
1777 | priv->cfg->ops->lib->post_associate(priv, priv->vif); | ||
1778 | |||
1779 | return 0; | ||
1780 | } | ||
1781 | |||
1751 | void iwl_bss_info_changed(struct ieee80211_hw *hw, | 1782 | void iwl_bss_info_changed(struct ieee80211_hw *hw, |
1752 | struct ieee80211_vif *vif, | 1783 | struct ieee80211_vif *vif, |
1753 | struct ieee80211_bss_conf *bss_conf, | 1784 | struct ieee80211_bss_conf *bss_conf, |
@@ -1914,38 +1945,6 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1914 | } | 1945 | } |
1915 | EXPORT_SYMBOL(iwl_bss_info_changed); | 1946 | EXPORT_SYMBOL(iwl_bss_info_changed); |
1916 | 1947 | ||
1917 | int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
1918 | { | ||
1919 | struct iwl_priv *priv = hw->priv; | ||
1920 | unsigned long flags; | ||
1921 | __le64 timestamp; | ||
1922 | |||
1923 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
1924 | |||
1925 | if (!iwl_is_ready_rf(priv)) { | ||
1926 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
1927 | return -EIO; | ||
1928 | } | ||
1929 | |||
1930 | spin_lock_irqsave(&priv->lock, flags); | ||
1931 | |||
1932 | if (priv->ibss_beacon) | ||
1933 | dev_kfree_skb(priv->ibss_beacon); | ||
1934 | |||
1935 | priv->ibss_beacon = skb; | ||
1936 | |||
1937 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | ||
1938 | priv->timestamp = le64_to_cpu(timestamp); | ||
1939 | |||
1940 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
1941 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1942 | |||
1943 | priv->cfg->ops->lib->post_associate(priv, priv->vif); | ||
1944 | |||
1945 | return 0; | ||
1946 | } | ||
1947 | EXPORT_SYMBOL(iwl_mac_beacon_update); | ||
1948 | |||
1949 | static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif) | 1948 | static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif) |
1950 | { | 1949 | { |
1951 | iwl_connection_init_rx_config(priv, vif); | 1950 | iwl_connection_init_rx_config(priv, vif); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index fcbba3d604de..e9d23f2f869d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -125,6 +125,8 @@ struct iwl_debugfs_ops { | |||
125 | size_t count, loff_t *ppos); | 125 | size_t count, loff_t *ppos); |
126 | ssize_t (*general_stats_read)(struct file *file, char __user *user_buf, | 126 | ssize_t (*general_stats_read)(struct file *file, char __user *user_buf, |
127 | size_t count, loff_t *ppos); | 127 | size_t count, loff_t *ppos); |
128 | ssize_t (*bt_stats_read)(struct file *file, char __user *user_buf, | ||
129 | size_t count, loff_t *ppos); | ||
128 | }; | 130 | }; |
129 | 131 | ||
130 | struct iwl_temp_ops { | 132 | struct iwl_temp_ops { |
@@ -335,6 +337,7 @@ struct iwl_cfg { | |||
335 | u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; | 337 | u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; |
336 | u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; | 338 | u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; |
337 | const bool need_dc_calib; | 339 | const bool need_dc_calib; |
340 | const bool bt_statistics; | ||
338 | }; | 341 | }; |
339 | 342 | ||
340 | /*************************** | 343 | /*************************** |
@@ -377,7 +380,6 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
377 | struct ieee80211_vif *vif, | 380 | struct ieee80211_vif *vif, |
378 | struct ieee80211_bss_conf *bss_conf, | 381 | struct ieee80211_bss_conf *bss_conf, |
379 | u32 changes); | 382 | u32 changes); |
380 | int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb); | ||
381 | int iwl_commit_rxon(struct iwl_priv *priv); | 383 | int iwl_commit_rxon(struct iwl_priv *priv); |
382 | int iwl_mac_add_interface(struct ieee80211_hw *hw, | 384 | int iwl_mac_add_interface(struct ieee80211_hw *hw, |
383 | struct ieee80211_vif *vif); | 385 | struct ieee80211_vif *vif); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 7b25d1468358..e96a1bb12783 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -1519,6 +1519,16 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file, | |||
1519 | return count; | 1519 | return count; |
1520 | } | 1520 | } |
1521 | 1521 | ||
1522 | static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file, | ||
1523 | char __user *user_buf, | ||
1524 | size_t count, loff_t *ppos) | ||
1525 | { | ||
1526 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
1527 | |||
1528 | return priv->cfg->ops->lib->debugfs_ops.bt_stats_read(file, | ||
1529 | user_buf, count, ppos); | ||
1530 | } | ||
1531 | |||
1522 | DEBUGFS_READ_FILE_OPS(rx_statistics); | 1532 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
1523 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 1533 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
1524 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 1534 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
@@ -1541,6 +1551,7 @@ DEBUGFS_READ_WRITE_FILE_OPS(force_reset); | |||
1541 | DEBUGFS_READ_FILE_OPS(rxon_flags); | 1551 | DEBUGFS_READ_FILE_OPS(rxon_flags); |
1542 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); | 1552 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); |
1543 | DEBUGFS_WRITE_FILE_OPS(txfifo_flush); | 1553 | DEBUGFS_WRITE_FILE_OPS(txfifo_flush); |
1554 | DEBUGFS_READ_FILE_OPS(ucode_bt_stats); | ||
1544 | 1555 | ||
1545 | /* | 1556 | /* |
1546 | * Create the debugfs files and directories | 1557 | * Create the debugfs files and directories |
@@ -1608,6 +1619,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1608 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); | 1619 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); |
1609 | if (priv->cfg->ucode_tracing) | 1620 | if (priv->cfg->ucode_tracing) |
1610 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); | 1621 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); |
1622 | if (priv->cfg->bt_statistics) | ||
1623 | DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR); | ||
1611 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 1624 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
1612 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 1625 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
1613 | if (priv->cfg->sensitivity_calib_by_driver) | 1626 | if (priv->cfg->sensitivity_calib_by_driver) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index c4dba62b74af..f35bcad56e36 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -571,6 +571,7 @@ enum iwl_ucode_tlv_type { | |||
571 | IWL_UCODE_TLV_INIT_EVTLOG_SIZE = 12, | 571 | IWL_UCODE_TLV_INIT_EVTLOG_SIZE = 12, |
572 | IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, | 572 | IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, |
573 | IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, | 573 | IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, |
574 | IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15, | ||
574 | }; | 575 | }; |
575 | 576 | ||
576 | struct iwl_ucode_tlv { | 577 | struct iwl_ucode_tlv { |
@@ -1153,6 +1154,9 @@ struct iwl_priv { | |||
1153 | u32 hw_wa_rev; | 1154 | u32 hw_wa_rev; |
1154 | u8 rev_id; | 1155 | u8 rev_id; |
1155 | 1156 | ||
1157 | /* EEPROM MAC addresses */ | ||
1158 | struct mac_address addresses[2]; | ||
1159 | |||
1156 | /* uCode images, save to reload in case of failure */ | 1160 | /* uCode images, save to reload in case of failure */ |
1157 | int fw_index; /* firmware we're trying to load */ | 1161 | int fw_index; /* firmware we're trying to load */ |
1158 | u32 ucode_ver; /* version of ucode, copy of | 1162 | u32 ucode_ver; /* version of ucode, copy of |
@@ -1321,11 +1325,23 @@ struct iwl_priv { | |||
1321 | u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; | 1325 | u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; |
1322 | u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; | 1326 | u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; |
1323 | 1327 | ||
1328 | /* | ||
1329 | * chain noise reset and gain commands are the | ||
1330 | * two extra calibration commands follows the standard | ||
1331 | * phy calibration commands | ||
1332 | */ | ||
1333 | u8 phy_calib_chain_noise_reset_cmd; | ||
1334 | u8 phy_calib_chain_noise_gain_cmd; | ||
1335 | |||
1324 | struct iwl_notif_statistics statistics; | 1336 | struct iwl_notif_statistics statistics; |
1337 | struct iwl_bt_notif_statistics statistics_bt; | ||
1325 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1338 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1326 | struct iwl_notif_statistics accum_statistics; | 1339 | struct iwl_notif_statistics accum_statistics; |
1327 | struct iwl_notif_statistics delta_statistics; | 1340 | struct iwl_notif_statistics delta_statistics; |
1328 | struct iwl_notif_statistics max_delta; | 1341 | struct iwl_notif_statistics max_delta; |
1342 | struct iwl_bt_notif_statistics accum_statistics_bt; | ||
1343 | struct iwl_bt_notif_statistics delta_statistics_bt; | ||
1344 | struct iwl_bt_notif_statistics max_delta_bt; | ||
1329 | #endif | 1345 | #endif |
1330 | } _agn; | 1346 | } _agn; |
1331 | #endif | 1347 | #endif |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index 3452dfa7b571..a4772aff51fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -402,6 +402,7 @@ struct iwl_eeprom_calib_info { | |||
402 | #define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ | 402 | #define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ |
403 | #define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ | 403 | #define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ |
404 | #define EEPROM_3945_M_VERSION (2*0x4A) /* 1 bytes */ | 404 | #define EEPROM_3945_M_VERSION (2*0x4A) /* 1 bytes */ |
405 | #define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ | ||
405 | 406 | ||
406 | /* The following masks are to be applied on EEPROM_RADIO_CONFIG */ | 407 | /* The following masks are to be applied on EEPROM_RADIO_CONFIG */ |
407 | #define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */ | 408 | #define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 2a7c399fee1e..b0c6b0473901 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -429,11 +429,10 @@ void iwl_bg_scan_check(struct work_struct *data) | |||
429 | return; | 429 | return; |
430 | 430 | ||
431 | mutex_lock(&priv->mutex); | 431 | mutex_lock(&priv->mutex); |
432 | if (test_bit(STATUS_SCANNING, &priv->status) || | 432 | if (test_bit(STATUS_SCANNING, &priv->status) && |
433 | test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | 433 | !test_bit(STATUS_SCAN_ABORTING, &priv->status)) { |
434 | IWL_DEBUG_SCAN(priv, "Scan completion watchdog resetting " | 434 | IWL_DEBUG_SCAN(priv, "Scan completion watchdog (%dms)\n", |
435 | "adapter (%dms)\n", | 435 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); |
436 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); | ||
437 | 436 | ||
438 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) | 437 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) |
439 | iwl_send_scan_abort(priv); | 438 | iwl_send_scan_abort(priv); |
@@ -498,12 +497,11 @@ void iwl_bg_abort_scan(struct work_struct *work) | |||
498 | !test_bit(STATUS_GEO_CONFIGURED, &priv->status)) | 497 | !test_bit(STATUS_GEO_CONFIGURED, &priv->status)) |
499 | return; | 498 | return; |
500 | 499 | ||
501 | mutex_lock(&priv->mutex); | 500 | cancel_delayed_work(&priv->scan_check); |
502 | |||
503 | cancel_delayed_work_sync(&priv->scan_check); | ||
504 | set_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
505 | iwl_send_scan_abort(priv); | ||
506 | 501 | ||
502 | mutex_lock(&priv->mutex); | ||
503 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) | ||
504 | iwl_send_scan_abort(priv); | ||
507 | mutex_unlock(&priv->mutex); | 505 | mutex_unlock(&priv->mutex); |
508 | } | 506 | } |
509 | EXPORT_SYMBOL(iwl_bg_abort_scan); | 507 | EXPORT_SYMBOL(iwl_bg_abort_scan); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 8eb347106902..d24eb47d3705 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -27,6 +27,8 @@ | |||
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
31 | |||
30 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
31 | #include <linux/module.h> | 33 | #include <linux/module.h> |
32 | #include <linux/init.h> | 34 | #include <linux/init.h> |
@@ -311,9 +313,7 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, | |||
311 | int left) | 313 | int left) |
312 | { | 314 | { |
313 | 315 | ||
314 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || | 316 | if (!iwl_is_associated(priv) || !priv->ibss_beacon) |
315 | ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && | ||
316 | (priv->iw_mode != NL80211_IFTYPE_AP))) | ||
317 | return 0; | 317 | return 0; |
318 | 318 | ||
319 | if (priv->ibss_beacon->len > left) | 319 | if (priv->ibss_beacon->len > left) |
@@ -2883,7 +2883,10 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2883 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 2883 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); |
2884 | 2884 | ||
2885 | spin_lock_irqsave(&priv->lock, flags); | 2885 | spin_lock_irqsave(&priv->lock, flags); |
2886 | interval = vif ? vif->bss_conf.beacon_int : 0; | 2886 | if (priv->is_internal_short_scan) |
2887 | interval = 0; | ||
2888 | else | ||
2889 | interval = vif->bss_conf.beacon_int; | ||
2887 | spin_unlock_irqrestore(&priv->lock, flags); | 2890 | spin_unlock_irqrestore(&priv->lock, flags); |
2888 | 2891 | ||
2889 | scan->suspend_time = 0; | 2892 | scan->suspend_time = 0; |
@@ -3932,7 +3935,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
3932 | * space for this driver's private structure */ | 3935 | * space for this driver's private structure */ |
3933 | hw = iwl_alloc_all(cfg, &iwl3945_hw_ops); | 3936 | hw = iwl_alloc_all(cfg, &iwl3945_hw_ops); |
3934 | if (hw == NULL) { | 3937 | if (hw == NULL) { |
3935 | printk(KERN_ERR DRV_NAME "Can not allocate network device\n"); | 3938 | pr_err("Can not allocate network device\n"); |
3936 | err = -ENOMEM; | 3939 | err = -ENOMEM; |
3937 | goto out; | 3940 | goto out; |
3938 | } | 3941 | } |
@@ -4224,19 +4227,18 @@ static int __init iwl3945_init(void) | |||
4224 | { | 4227 | { |
4225 | 4228 | ||
4226 | int ret; | 4229 | int ret; |
4227 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); | 4230 | pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); |
4228 | printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); | 4231 | pr_info(DRV_COPYRIGHT "\n"); |
4229 | 4232 | ||
4230 | ret = iwl3945_rate_control_register(); | 4233 | ret = iwl3945_rate_control_register(); |
4231 | if (ret) { | 4234 | if (ret) { |
4232 | printk(KERN_ERR DRV_NAME | 4235 | pr_err("Unable to register rate control algorithm: %d\n", ret); |
4233 | "Unable to register rate control algorithm: %d\n", ret); | ||
4234 | return ret; | 4236 | return ret; |
4235 | } | 4237 | } |
4236 | 4238 | ||
4237 | ret = pci_register_driver(&iwl3945_driver); | 4239 | ret = pci_register_driver(&iwl3945_driver); |
4238 | if (ret) { | 4240 | if (ret) { |
4239 | printk(KERN_ERR DRV_NAME "Unable to initialize PCI module\n"); | 4241 | pr_err("Unable to initialize PCI module\n"); |
4240 | goto error_register; | 4242 | goto error_register; |
4241 | } | 4243 | } |
4242 | 4244 | ||
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 7e0741608856..25f902760980 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -7,7 +7,6 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/if_arp.h> | ||
11 | #include <linux/ieee80211.h> | 10 | #include <linux/ieee80211.h> |
12 | #include <net/cfg80211.h> | 11 | #include <net/cfg80211.h> |
13 | #include <asm/unaligned.h> | 12 | #include <asm/unaligned.h> |
@@ -1383,93 +1382,10 @@ static int lbs_cfg_del_key(struct wiphy *wiphy, struct net_device *netdev, | |||
1383 | } | 1382 | } |
1384 | 1383 | ||
1385 | 1384 | ||
1386 | |||
1387 | /*************************************************************************** | ||
1388 | * Monitor mode | ||
1389 | */ | ||
1390 | |||
1391 | /* like "struct cmd_ds_802_11_monitor_mode", but with cmd_header. Once we | ||
1392 | * get rid of WEXT, this should go into host.h */ | ||
1393 | struct cmd_monitor_mode { | ||
1394 | struct cmd_header hdr; | ||
1395 | |||
1396 | __le16 action; | ||
1397 | __le16 mode; | ||
1398 | } __packed; | ||
1399 | |||
1400 | static int lbs_enable_monitor_mode(struct lbs_private *priv, int mode) | ||
1401 | { | ||
1402 | struct cmd_monitor_mode cmd; | ||
1403 | int ret; | ||
1404 | |||
1405 | lbs_deb_enter(LBS_DEB_CFG80211); | ||
1406 | |||
1407 | /* | ||
1408 | * cmd 98 00 | ||
1409 | * size 0c 00 | ||
1410 | * sequence xx xx | ||
1411 | * result 00 00 | ||
1412 | * action 01 00 ACT_SET | ||
1413 | * enable 01 00 | ||
1414 | */ | ||
1415 | memset(&cmd, 0, sizeof(cmd)); | ||
1416 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
1417 | cmd.action = cpu_to_le16(CMD_ACT_SET); | ||
1418 | cmd.mode = cpu_to_le16(mode); | ||
1419 | |||
1420 | ret = lbs_cmd_with_response(priv, CMD_802_11_MONITOR_MODE, &cmd); | ||
1421 | |||
1422 | if (ret == 0) | ||
1423 | priv->dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
1424 | else | ||
1425 | priv->dev->type = ARPHRD_ETHER; | ||
1426 | |||
1427 | lbs_deb_leave(LBS_DEB_CFG80211); | ||
1428 | return ret; | ||
1429 | } | ||
1430 | |||
1431 | |||
1432 | |||
1433 | |||
1434 | |||
1435 | |||
1436 | /*************************************************************************** | 1385 | /*************************************************************************** |
1437 | * Get station | 1386 | * Get station |
1438 | */ | 1387 | */ |
1439 | 1388 | ||
1440 | /* | ||
1441 | * Returns the signal or 0 in case of an error. | ||
1442 | */ | ||
1443 | |||
1444 | /* like "struct cmd_ds_802_11_rssi", but with cmd_header. Once we get rid | ||
1445 | * of WEXT, this should go into host.h */ | ||
1446 | struct cmd_rssi { | ||
1447 | struct cmd_header hdr; | ||
1448 | |||
1449 | __le16 n_or_snr; | ||
1450 | __le16 nf; | ||
1451 | __le16 avg_snr; | ||
1452 | __le16 avg_nf; | ||
1453 | } __packed; | ||
1454 | |||
1455 | static int lbs_get_signal(struct lbs_private *priv, s8 *signal, s8 *noise) | ||
1456 | { | ||
1457 | struct cmd_rssi cmd; | ||
1458 | int ret; | ||
1459 | |||
1460 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
1461 | cmd.n_or_snr = cpu_to_le16(DEFAULT_BCN_AVG_FACTOR); | ||
1462 | ret = lbs_cmd_with_response(priv, CMD_802_11_RSSI, &cmd); | ||
1463 | |||
1464 | if (ret == 0) { | ||
1465 | *signal = CAL_RSSI(le16_to_cpu(cmd.n_or_snr), | ||
1466 | le16_to_cpu(cmd.nf)); | ||
1467 | *noise = CAL_NF(le16_to_cpu(cmd.nf)); | ||
1468 | } | ||
1469 | return ret; | ||
1470 | } | ||
1471 | |||
1472 | |||
1473 | static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, | 1389 | static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, |
1474 | u8 *mac, struct station_info *sinfo) | 1390 | u8 *mac, struct station_info *sinfo) |
1475 | { | 1391 | { |
@@ -1490,7 +1406,7 @@ static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, | |||
1490 | sinfo->rx_packets = priv->dev->stats.rx_packets; | 1406 | sinfo->rx_packets = priv->dev->stats.rx_packets; |
1491 | 1407 | ||
1492 | /* Get current RSSI */ | 1408 | /* Get current RSSI */ |
1493 | ret = lbs_get_signal(priv, &signal, &noise); | 1409 | ret = lbs_get_rssi(priv, &signal, &noise); |
1494 | if (ret == 0) { | 1410 | if (ret == 0) { |
1495 | sinfo->signal = signal; | 1411 | sinfo->signal = signal; |
1496 | sinfo->filled |= STATION_INFO_SIGNAL; | 1412 | sinfo->filled |= STATION_INFO_SIGNAL; |
@@ -1530,7 +1446,7 @@ static int lbs_get_survey(struct wiphy *wiphy, struct net_device *dev, | |||
1530 | survey->channel = ieee80211_get_channel(wiphy, | 1446 | survey->channel = ieee80211_get_channel(wiphy, |
1531 | ieee80211_channel_to_frequency(priv->channel)); | 1447 | ieee80211_channel_to_frequency(priv->channel)); |
1532 | 1448 | ||
1533 | ret = lbs_get_signal(priv, &signal, &noise); | 1449 | ret = lbs_get_rssi(priv, &signal, &noise); |
1534 | if (ret == 0) { | 1450 | if (ret == 0) { |
1535 | survey->filled = SURVEY_INFO_NOISE_DBM; | 1451 | survey->filled = SURVEY_INFO_NOISE_DBM; |
1536 | survey->noise = noise; | 1452 | survey->noise = noise; |
@@ -1558,17 +1474,17 @@ static int lbs_change_intf(struct wiphy *wiphy, struct net_device *dev, | |||
1558 | 1474 | ||
1559 | switch (type) { | 1475 | switch (type) { |
1560 | case NL80211_IFTYPE_MONITOR: | 1476 | case NL80211_IFTYPE_MONITOR: |
1561 | ret = lbs_enable_monitor_mode(priv, 1); | 1477 | ret = lbs_set_monitor_mode(priv, 1); |
1562 | break; | 1478 | break; |
1563 | case NL80211_IFTYPE_STATION: | 1479 | case NL80211_IFTYPE_STATION: |
1564 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) | 1480 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) |
1565 | ret = lbs_enable_monitor_mode(priv, 0); | 1481 | ret = lbs_set_monitor_mode(priv, 0); |
1566 | if (!ret) | 1482 | if (!ret) |
1567 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1); | 1483 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1); |
1568 | break; | 1484 | break; |
1569 | case NL80211_IFTYPE_ADHOC: | 1485 | case NL80211_IFTYPE_ADHOC: |
1570 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) | 1486 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) |
1571 | ret = lbs_enable_monitor_mode(priv, 0); | 1487 | ret = lbs_set_monitor_mode(priv, 0); |
1572 | if (!ret) | 1488 | if (!ret) |
1573 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2); | 1489 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2); |
1574 | break; | 1490 | break; |
@@ -2063,113 +1979,20 @@ int lbs_cfg_register(struct lbs_private *priv) | |||
2063 | return ret; | 1979 | return ret; |
2064 | } | 1980 | } |
2065 | 1981 | ||
2066 | /** | ||
2067 | * @brief This function sets DOMAIN INFO to FW | ||
2068 | * @param priv pointer to struct lbs_private | ||
2069 | * @return 0; -1 | ||
2070 | */ | ||
2071 | static int lbs_11d_set_domain_info(struct lbs_private *priv) | ||
2072 | { | ||
2073 | int ret; | ||
2074 | |||
2075 | ret = lbs_prepare_and_send_command(priv, CMD_802_11D_DOMAIN_INFO, | ||
2076 | CMD_ACT_SET, | ||
2077 | CMD_OPTION_WAITFORRSP, 0, NULL); | ||
2078 | if (ret) | ||
2079 | lbs_deb_11d("fail to dnld domain info\n"); | ||
2080 | |||
2081 | return ret; | ||
2082 | } | ||
2083 | |||
2084 | static void lbs_send_domain_info_cmd_fw(struct wiphy *wiphy, | ||
2085 | struct regulatory_request *request) | ||
2086 | { | ||
2087 | u8 no_of_triplet = 0; | ||
2088 | u8 no_of_parsed_chan = 0; | ||
2089 | u8 first_channel = 0, next_chan = 0, max_pwr = 0; | ||
2090 | u8 i, flag = 0; | ||
2091 | enum ieee80211_band band; | ||
2092 | struct ieee80211_supported_band *sband; | ||
2093 | struct ieee80211_channel *ch; | ||
2094 | struct lbs_private *priv = wiphy_priv(wiphy); | ||
2095 | struct lbs_802_11d_domain_reg *domain_info = &priv->domain_reg; | ||
2096 | int ret = 0; | ||
2097 | |||
2098 | lbs_deb_enter(LBS_DEB_CFG80211); | ||
2099 | |||
2100 | /* Set country code */ | ||
2101 | domain_info->country_code[0] = request->alpha2[0]; | ||
2102 | domain_info->country_code[1] = request->alpha2[1]; | ||
2103 | domain_info->country_code[2] = ' '; | ||
2104 | |||
2105 | for (band = 0; band < IEEE80211_NUM_BANDS ; band++) { | ||
2106 | |||
2107 | if (!wiphy->bands[band]) | ||
2108 | continue; | ||
2109 | |||
2110 | sband = wiphy->bands[band]; | ||
2111 | |||
2112 | for (i = 0; i < sband->n_channels ; i++) { | ||
2113 | ch = &sband->channels[i]; | ||
2114 | if (ch->flags & IEEE80211_CHAN_DISABLED) | ||
2115 | continue; | ||
2116 | |||
2117 | if (!flag) { | ||
2118 | flag = 1; | ||
2119 | next_chan = first_channel = (u32) ch->hw_value; | ||
2120 | max_pwr = ch->max_power; | ||
2121 | no_of_parsed_chan = 1; | ||
2122 | continue; | ||
2123 | } | ||
2124 | |||
2125 | if (ch->hw_value == next_chan + 1 && | ||
2126 | ch->max_power == max_pwr) { | ||
2127 | next_chan++; | ||
2128 | no_of_parsed_chan++; | ||
2129 | } else { | ||
2130 | domain_info->triplet[no_of_triplet] | ||
2131 | .chans.first_channel = first_channel; | ||
2132 | domain_info->triplet[no_of_triplet] | ||
2133 | .chans.num_channels = no_of_parsed_chan; | ||
2134 | domain_info->triplet[no_of_triplet] | ||
2135 | .chans.max_power = max_pwr; | ||
2136 | no_of_triplet++; | ||
2137 | flag = 0; | ||
2138 | } | ||
2139 | } | ||
2140 | if (flag) { | ||
2141 | domain_info->triplet[no_of_triplet] | ||
2142 | .chans.first_channel = first_channel; | ||
2143 | domain_info->triplet[no_of_triplet] | ||
2144 | .chans.num_channels = no_of_parsed_chan; | ||
2145 | domain_info->triplet[no_of_triplet] | ||
2146 | .chans.max_power = max_pwr; | ||
2147 | no_of_triplet++; | ||
2148 | } | ||
2149 | } | ||
2150 | |||
2151 | domain_info->no_triplet = no_of_triplet; | ||
2152 | |||
2153 | /* Set domain info */ | ||
2154 | ret = lbs_11d_set_domain_info(priv); | ||
2155 | if (ret) | ||
2156 | lbs_pr_err("11D: error setting domain info in FW\n"); | ||
2157 | |||
2158 | lbs_deb_leave(LBS_DEB_CFG80211); | ||
2159 | } | ||
2160 | |||
2161 | int lbs_reg_notifier(struct wiphy *wiphy, | 1982 | int lbs_reg_notifier(struct wiphy *wiphy, |
2162 | struct regulatory_request *request) | 1983 | struct regulatory_request *request) |
2163 | { | 1984 | { |
1985 | struct lbs_private *priv = wiphy_priv(wiphy); | ||
1986 | int ret; | ||
1987 | |||
2164 | lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain " | 1988 | lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain " |
2165 | "callback for domain %c%c\n", request->alpha2[0], | 1989 | "callback for domain %c%c\n", request->alpha2[0], |
2166 | request->alpha2[1]); | 1990 | request->alpha2[1]); |
2167 | 1991 | ||
2168 | lbs_send_domain_info_cmd_fw(wiphy, request); | 1992 | ret = lbs_set_11d_domain_info(priv, request, wiphy->bands); |
2169 | 1993 | ||
2170 | lbs_deb_leave(LBS_DEB_CFG80211); | 1994 | lbs_deb_leave(LBS_DEB_CFG80211); |
2171 | 1995 | return ret; | |
2172 | return 0; | ||
2173 | } | 1996 | } |
2174 | 1997 | ||
2175 | void lbs_scan_deinit(struct lbs_private *priv) | 1998 | void lbs_scan_deinit(struct lbs_private *priv) |
diff --git a/drivers/net/wireless/libertas/cfg.h b/drivers/net/wireless/libertas/cfg.h index 756fb98f9f05..4f46bb744bee 100644 --- a/drivers/net/wireless/libertas/cfg.h +++ b/drivers/net/wireless/libertas/cfg.h | |||
@@ -13,12 +13,6 @@ void lbs_cfg_free(struct lbs_private *priv); | |||
13 | int lbs_reg_notifier(struct wiphy *wiphy, | 13 | int lbs_reg_notifier(struct wiphy *wiphy, |
14 | struct regulatory_request *request); | 14 | struct regulatory_request *request); |
15 | 15 | ||
16 | /* All of those are TODOs: */ | ||
17 | #define lbs_cmd_802_11_rssi(priv, cmdptr) (0) | ||
18 | #define lbs_ret_802_11_rssi(priv, resp) (0) | ||
19 | #define lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action) (0) | ||
20 | #define lbs_ret_802_11_bcn_ctrl(priv, resp) (0) | ||
21 | |||
22 | void lbs_send_disconnect_notification(struct lbs_private *priv); | 16 | void lbs_send_disconnect_notification(struct lbs_private *priv); |
23 | void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event); | 17 | void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event); |
24 | 18 | ||
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 749fbde4fd54..70745928f3f8 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -6,13 +6,14 @@ | |||
6 | #include <linux/kfifo.h> | 6 | #include <linux/kfifo.h> |
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/if_arp.h> | ||
9 | 10 | ||
10 | #include "decl.h" | 11 | #include "decl.h" |
11 | #include "cfg.h" | 12 | #include "cfg.h" |
12 | #include "cmd.h" | 13 | #include "cmd.h" |
13 | 14 | ||
14 | 15 | #define CAL_NF(nf) ((s32)(-(s32)(nf))) | |
15 | static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); | 16 | #define CAL_RSSI(snr, nf) ((s32)((s32)(snr) + CAL_NF(nf))) |
16 | 17 | ||
17 | /** | 18 | /** |
18 | * @brief Simple callback that copies response back into command | 19 | * @brief Simple callback that copies response back into command |
@@ -74,30 +75,6 @@ static u8 is_command_allowed_in_ps(u16 cmd) | |||
74 | } | 75 | } |
75 | 76 | ||
76 | /** | 77 | /** |
77 | * @brief This function checks if the command is allowed. | ||
78 | * | ||
79 | * @param priv A pointer to lbs_private structure | ||
80 | * @return allowed or not allowed. | ||
81 | */ | ||
82 | |||
83 | static int lbs_is_cmd_allowed(struct lbs_private *priv) | ||
84 | { | ||
85 | int ret = 1; | ||
86 | |||
87 | lbs_deb_enter(LBS_DEB_CMD); | ||
88 | |||
89 | if (!priv->is_auto_deep_sleep_enabled) { | ||
90 | if (priv->is_deep_sleep) { | ||
91 | lbs_deb_cmd("command not allowed in deep sleep\n"); | ||
92 | ret = 0; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | lbs_deb_leave(LBS_DEB_CMD); | ||
97 | return ret; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * @brief Updates the hardware details like MAC address and regulatory region | 78 | * @brief Updates the hardware details like MAC address and regulatory region |
102 | * | 79 | * |
103 | * @param priv A pointer to struct lbs_private structure | 80 | * @param priv A pointer to struct lbs_private structure |
@@ -227,42 +204,49 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, | |||
227 | } | 204 | } |
228 | EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg); | 205 | EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg); |
229 | 206 | ||
230 | static int lbs_cmd_802_11_ps_mode(struct cmd_ds_command *cmd, | 207 | /** |
231 | u16 cmd_action) | 208 | * @brief Sets the Power Save mode |
209 | * | ||
210 | * @param priv A pointer to struct lbs_private structure | ||
211 | * @param cmd_action The Power Save operation (PS_MODE_ACTION_ENTER_PS or | ||
212 | * PS_MODE_ACTION_EXIT_PS) | ||
213 | * @param block Whether to block on a response or not | ||
214 | * | ||
215 | * @return 0 on success, error on failure | ||
216 | */ | ||
217 | int lbs_set_ps_mode(struct lbs_private *priv, u16 cmd_action, bool block) | ||
232 | { | 218 | { |
233 | struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; | 219 | struct cmd_ds_802_11_ps_mode cmd; |
220 | int ret = 0; | ||
234 | 221 | ||
235 | lbs_deb_enter(LBS_DEB_CMD); | 222 | lbs_deb_enter(LBS_DEB_CMD); |
236 | 223 | ||
237 | cmd->command = cpu_to_le16(CMD_802_11_PS_MODE); | 224 | memset(&cmd, 0, sizeof(cmd)); |
238 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) + | 225 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
239 | sizeof(struct cmd_header)); | 226 | cmd.action = cpu_to_le16(cmd_action); |
240 | psm->action = cpu_to_le16(cmd_action); | ||
241 | psm->multipledtim = 0; | ||
242 | switch (cmd_action) { | ||
243 | case CMD_SUBCMD_ENTER_PS: | ||
244 | lbs_deb_cmd("PS command:" "SubCode- Enter PS\n"); | ||
245 | |||
246 | psm->locallisteninterval = 0; | ||
247 | psm->nullpktinterval = 0; | ||
248 | psm->multipledtim = | ||
249 | cpu_to_le16(MRVDRV_DEFAULT_MULTIPLE_DTIM); | ||
250 | break; | ||
251 | |||
252 | case CMD_SUBCMD_EXIT_PS: | ||
253 | lbs_deb_cmd("PS command:" "SubCode- Exit PS\n"); | ||
254 | break; | ||
255 | |||
256 | case CMD_SUBCMD_SLEEP_CONFIRMED: | ||
257 | lbs_deb_cmd("PS command: SubCode- sleep confirm\n"); | ||
258 | break; | ||
259 | 227 | ||
260 | default: | 228 | if (cmd_action == PS_MODE_ACTION_ENTER_PS) { |
261 | break; | 229 | lbs_deb_cmd("PS_MODE: action ENTER_PS\n"); |
230 | cmd.multipledtim = cpu_to_le16(1); /* Default DTIM multiple */ | ||
231 | } else if (cmd_action == PS_MODE_ACTION_EXIT_PS) { | ||
232 | lbs_deb_cmd("PS_MODE: action EXIT_PS\n"); | ||
233 | } else { | ||
234 | /* We don't handle CONFIRM_SLEEP here because it needs to | ||
235 | * be fastpathed to the firmware. | ||
236 | */ | ||
237 | lbs_deb_cmd("PS_MODE: unknown action 0x%X\n", cmd_action); | ||
238 | ret = -EOPNOTSUPP; | ||
239 | goto out; | ||
262 | } | 240 | } |
263 | 241 | ||
264 | lbs_deb_leave(LBS_DEB_CMD); | 242 | if (block) |
265 | return 0; | 243 | ret = lbs_cmd_with_response(priv, CMD_802_11_PS_MODE, &cmd); |
244 | else | ||
245 | lbs_cmd_async(priv, CMD_802_11_PS_MODE, &cmd.hdr, sizeof (cmd)); | ||
246 | |||
247 | out: | ||
248 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
249 | return ret; | ||
266 | } | 250 | } |
267 | 251 | ||
268 | int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, | 252 | int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, |
@@ -576,23 +560,35 @@ int lbs_set_tx_power(struct lbs_private *priv, s16 dbm) | |||
576 | return ret; | 560 | return ret; |
577 | } | 561 | } |
578 | 562 | ||
579 | static int lbs_cmd_802_11_monitor_mode(struct cmd_ds_command *cmd, | 563 | /** |
580 | u16 cmd_action, void *pdata_buf) | 564 | * @brief Enable or disable monitor mode (only implemented on OLPC usb8388 FW) |
565 | * | ||
566 | * @param priv A pointer to struct lbs_private structure | ||
567 | * @param enable 1 to enable monitor mode, 0 to disable | ||
568 | * | ||
569 | * @return 0 on success, error on failure | ||
570 | */ | ||
571 | int lbs_set_monitor_mode(struct lbs_private *priv, int enable) | ||
581 | { | 572 | { |
582 | struct cmd_ds_802_11_monitor_mode *monitor = &cmd->params.monitor; | 573 | struct cmd_ds_802_11_monitor_mode cmd; |
574 | int ret; | ||
583 | 575 | ||
584 | cmd->command = cpu_to_le16(CMD_802_11_MONITOR_MODE); | 576 | memset(&cmd, 0, sizeof(cmd)); |
585 | cmd->size = | 577 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
586 | cpu_to_le16(sizeof(struct cmd_ds_802_11_monitor_mode) + | 578 | cmd.action = cpu_to_le16(CMD_ACT_SET); |
587 | sizeof(struct cmd_header)); | 579 | if (enable) |
580 | cmd.mode = cpu_to_le16(0x1); | ||
581 | |||
582 | lbs_deb_cmd("SET_MONITOR_MODE: %d\n", enable); | ||
588 | 583 | ||
589 | monitor->action = cpu_to_le16(cmd_action); | 584 | ret = lbs_cmd_with_response(priv, CMD_802_11_MONITOR_MODE, &cmd); |
590 | if (cmd_action == CMD_ACT_SET) { | 585 | if (ret == 0) { |
591 | monitor->mode = | 586 | priv->dev->type = enable ? ARPHRD_IEEE80211_RADIOTAP : |
592 | cpu_to_le16((u16) (*(u32 *) pdata_buf)); | 587 | ARPHRD_ETHER; |
593 | } | 588 | } |
594 | 589 | ||
595 | return 0; | 590 | lbs_deb_leave(LBS_DEB_CMD); |
591 | return ret; | ||
596 | } | 592 | } |
597 | 593 | ||
598 | /** | 594 | /** |
@@ -677,78 +673,242 @@ out: | |||
677 | return ret; | 673 | return ret; |
678 | } | 674 | } |
679 | 675 | ||
680 | static int lbs_cmd_reg_access(struct cmd_ds_command *cmdptr, | 676 | /** |
681 | u8 cmd_action, void *pdata_buf) | 677 | * @brief Get current RSSI and noise floor |
678 | * | ||
679 | * @param priv A pointer to struct lbs_private structure | ||
680 | * @param rssi On successful return, signal level in mBm | ||
681 | * | ||
682 | * @return The channel on success, error on failure | ||
683 | */ | ||
684 | int lbs_get_rssi(struct lbs_private *priv, s8 *rssi, s8 *nf) | ||
682 | { | 685 | { |
683 | struct lbs_offset_value *offval; | 686 | struct cmd_ds_802_11_rssi cmd; |
687 | int ret = 0; | ||
684 | 688 | ||
685 | lbs_deb_enter(LBS_DEB_CMD); | 689 | lbs_deb_enter(LBS_DEB_CMD); |
686 | 690 | ||
687 | offval = (struct lbs_offset_value *)pdata_buf; | 691 | BUG_ON(rssi == NULL); |
692 | BUG_ON(nf == NULL); | ||
688 | 693 | ||
689 | switch (le16_to_cpu(cmdptr->command)) { | 694 | memset(&cmd, 0, sizeof(cmd)); |
690 | case CMD_MAC_REG_ACCESS: | 695 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
691 | { | 696 | /* Average SNR over last 8 beacons */ |
692 | struct cmd_ds_mac_reg_access *macreg; | 697 | cmd.n_or_snr = cpu_to_le16(8); |
693 | 698 | ||
694 | cmdptr->size = | 699 | ret = lbs_cmd_with_response(priv, CMD_802_11_RSSI, &cmd); |
695 | cpu_to_le16(sizeof (struct cmd_ds_mac_reg_access) | 700 | if (ret == 0) { |
696 | + sizeof(struct cmd_header)); | 701 | *nf = CAL_NF(le16_to_cpu(cmd.nf)); |
697 | macreg = | 702 | *rssi = CAL_RSSI(le16_to_cpu(cmd.n_or_snr), le16_to_cpu(cmd.nf)); |
698 | (struct cmd_ds_mac_reg_access *)&cmdptr->params. | 703 | } |
699 | macreg; | ||
700 | 704 | ||
701 | macreg->action = cpu_to_le16(cmd_action); | 705 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
702 | macreg->offset = cpu_to_le16((u16) offval->offset); | 706 | return ret; |
703 | macreg->value = cpu_to_le32(offval->value); | 707 | } |
704 | 708 | ||
705 | break; | 709 | /** |
706 | } | 710 | * @brief Send regulatory and 802.11d domain information to the firmware |
711 | * | ||
712 | * @param priv pointer to struct lbs_private | ||
713 | * @param request cfg80211 regulatory request structure | ||
714 | * @param bands the device's supported bands and channels | ||
715 | * | ||
716 | * @return 0 on success, error code on failure | ||
717 | */ | ||
718 | int lbs_set_11d_domain_info(struct lbs_private *priv, | ||
719 | struct regulatory_request *request, | ||
720 | struct ieee80211_supported_band **bands) | ||
721 | { | ||
722 | struct cmd_ds_802_11d_domain_info cmd; | ||
723 | struct mrvl_ie_domain_param_set *domain = &cmd.domain; | ||
724 | struct ieee80211_country_ie_triplet *t; | ||
725 | enum ieee80211_band band; | ||
726 | struct ieee80211_channel *ch; | ||
727 | u8 num_triplet = 0; | ||
728 | u8 num_parsed_chan = 0; | ||
729 | u8 first_channel = 0, next_chan = 0, max_pwr = 0; | ||
730 | u8 i, flag = 0; | ||
731 | size_t triplet_size; | ||
732 | int ret; | ||
707 | 733 | ||
708 | case CMD_BBP_REG_ACCESS: | 734 | lbs_deb_enter(LBS_DEB_11D); |
709 | { | ||
710 | struct cmd_ds_bbp_reg_access *bbpreg; | ||
711 | 735 | ||
712 | cmdptr->size = | 736 | memset(&cmd, 0, sizeof(cmd)); |
713 | cpu_to_le16(sizeof | 737 | cmd.action = cpu_to_le16(CMD_ACT_SET); |
714 | (struct cmd_ds_bbp_reg_access) | ||
715 | + sizeof(struct cmd_header)); | ||
716 | bbpreg = | ||
717 | (struct cmd_ds_bbp_reg_access *)&cmdptr->params. | ||
718 | bbpreg; | ||
719 | 738 | ||
720 | bbpreg->action = cpu_to_le16(cmd_action); | 739 | lbs_deb_11d("Setting country code '%c%c'\n", |
721 | bbpreg->offset = cpu_to_le16((u16) offval->offset); | 740 | request->alpha2[0], request->alpha2[1]); |
722 | bbpreg->value = (u8) offval->value; | ||
723 | 741 | ||
724 | break; | 742 | domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); |
743 | |||
744 | /* Set country code */ | ||
745 | domain->country_code[0] = request->alpha2[0]; | ||
746 | domain->country_code[1] = request->alpha2[1]; | ||
747 | domain->country_code[2] = ' '; | ||
748 | |||
749 | /* Now set up the channel triplets; firmware is somewhat picky here | ||
750 | * and doesn't validate channel numbers and spans; hence it would | ||
751 | * interpret a triplet of (36, 4, 20) as channels 36, 37, 38, 39. Since | ||
752 | * the last 3 aren't valid channels, the driver is responsible for | ||
753 | * splitting that up into 4 triplet pairs of (36, 1, 20) + (40, 1, 20) | ||
754 | * etc. | ||
755 | */ | ||
756 | for (band = 0; | ||
757 | (band < IEEE80211_NUM_BANDS) && (num_triplet < MAX_11D_TRIPLETS); | ||
758 | band++) { | ||
759 | |||
760 | if (!bands[band]) | ||
761 | continue; | ||
762 | |||
763 | for (i = 0; | ||
764 | (i < bands[band]->n_channels) && (num_triplet < MAX_11D_TRIPLETS); | ||
765 | i++) { | ||
766 | ch = &bands[band]->channels[i]; | ||
767 | if (ch->flags & IEEE80211_CHAN_DISABLED) | ||
768 | continue; | ||
769 | |||
770 | if (!flag) { | ||
771 | flag = 1; | ||
772 | next_chan = first_channel = (u32) ch->hw_value; | ||
773 | max_pwr = ch->max_power; | ||
774 | num_parsed_chan = 1; | ||
775 | continue; | ||
776 | } | ||
777 | |||
778 | if ((ch->hw_value == next_chan + 1) && | ||
779 | (ch->max_power == max_pwr)) { | ||
780 | /* Consolidate adjacent channels */ | ||
781 | next_chan++; | ||
782 | num_parsed_chan++; | ||
783 | } else { | ||
784 | /* Add this triplet */ | ||
785 | lbs_deb_11d("11D triplet (%d, %d, %d)\n", | ||
786 | first_channel, num_parsed_chan, | ||
787 | max_pwr); | ||
788 | t = &domain->triplet[num_triplet]; | ||
789 | t->chans.first_channel = first_channel; | ||
790 | t->chans.num_channels = num_parsed_chan; | ||
791 | t->chans.max_power = max_pwr; | ||
792 | num_triplet++; | ||
793 | flag = 0; | ||
794 | } | ||
725 | } | 795 | } |
726 | 796 | ||
727 | case CMD_RF_REG_ACCESS: | 797 | if (flag) { |
728 | { | 798 | /* Add last triplet */ |
729 | struct cmd_ds_rf_reg_access *rfreg; | 799 | lbs_deb_11d("11D triplet (%d, %d, %d)\n", first_channel, |
800 | num_parsed_chan, max_pwr); | ||
801 | t = &domain->triplet[num_triplet]; | ||
802 | t->chans.first_channel = first_channel; | ||
803 | t->chans.num_channels = num_parsed_chan; | ||
804 | t->chans.max_power = max_pwr; | ||
805 | num_triplet++; | ||
806 | } | ||
807 | } | ||
730 | 808 | ||
731 | cmdptr->size = | 809 | lbs_deb_11d("# triplets %d\n", num_triplet); |
732 | cpu_to_le16(sizeof | ||
733 | (struct cmd_ds_rf_reg_access) + | ||
734 | sizeof(struct cmd_header)); | ||
735 | rfreg = | ||
736 | (struct cmd_ds_rf_reg_access *)&cmdptr->params. | ||
737 | rfreg; | ||
738 | 810 | ||
739 | rfreg->action = cpu_to_le16(cmd_action); | 811 | /* Set command header sizes */ |
740 | rfreg->offset = cpu_to_le16((u16) offval->offset); | 812 | triplet_size = num_triplet * sizeof(struct ieee80211_country_ie_triplet); |
741 | rfreg->value = (u8) offval->value; | 813 | domain->header.len = cpu_to_le16(sizeof(domain->country_code) + |
814 | triplet_size); | ||
742 | 815 | ||
743 | break; | 816 | lbs_deb_hex(LBS_DEB_11D, "802.11D domain param set", |
744 | } | 817 | (u8 *) &cmd.domain.country_code, |
818 | le16_to_cpu(domain->header.len)); | ||
745 | 819 | ||
746 | default: | 820 | cmd.hdr.size = cpu_to_le16(sizeof(cmd.hdr) + |
747 | break; | 821 | sizeof(cmd.action) + |
822 | sizeof(cmd.domain.header) + | ||
823 | sizeof(cmd.domain.country_code) + | ||
824 | triplet_size); | ||
825 | |||
826 | ret = lbs_cmd_with_response(priv, CMD_802_11D_DOMAIN_INFO, &cmd); | ||
827 | |||
828 | lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); | ||
829 | return ret; | ||
830 | } | ||
831 | |||
832 | /** | ||
833 | * @brief Read a MAC, Baseband, or RF register | ||
834 | * | ||
835 | * @param priv pointer to struct lbs_private | ||
836 | * @param cmd register command, one of CMD_MAC_REG_ACCESS, | ||
837 | * CMD_BBP_REG_ACCESS, or CMD_RF_REG_ACCESS | ||
838 | * @param offset byte offset of the register to get | ||
839 | * @param value on success, the value of the register at 'offset' | ||
840 | * | ||
841 | * @return 0 on success, error code on failure | ||
842 | */ | ||
843 | int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value) | ||
844 | { | ||
845 | struct cmd_ds_reg_access cmd; | ||
846 | int ret = 0; | ||
847 | |||
848 | lbs_deb_enter(LBS_DEB_CMD); | ||
849 | |||
850 | BUG_ON(value == NULL); | ||
851 | |||
852 | memset(&cmd, 0, sizeof(cmd)); | ||
853 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
854 | cmd.action = cpu_to_le16(CMD_ACT_GET); | ||
855 | |||
856 | if (reg != CMD_MAC_REG_ACCESS && | ||
857 | reg != CMD_BBP_REG_ACCESS && | ||
858 | reg != CMD_RF_REG_ACCESS) { | ||
859 | ret = -EINVAL; | ||
860 | goto out; | ||
748 | } | 861 | } |
749 | 862 | ||
750 | lbs_deb_leave(LBS_DEB_CMD); | 863 | ret = lbs_cmd_with_response(priv, reg, &cmd); |
751 | return 0; | 864 | if (ret) { |
865 | if (reg == CMD_BBP_REG_ACCESS || reg == CMD_RF_REG_ACCESS) | ||
866 | *value = cmd.value.bbp_rf; | ||
867 | else if (reg == CMD_MAC_REG_ACCESS) | ||
868 | *value = le32_to_cpu(cmd.value.mac); | ||
869 | } | ||
870 | |||
871 | out: | ||
872 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
873 | return ret; | ||
874 | } | ||
875 | |||
876 | /** | ||
877 | * @brief Write a MAC, Baseband, or RF register | ||
878 | * | ||
879 | * @param priv pointer to struct lbs_private | ||
880 | * @param cmd register command, one of CMD_MAC_REG_ACCESS, | ||
881 | * CMD_BBP_REG_ACCESS, or CMD_RF_REG_ACCESS | ||
882 | * @param offset byte offset of the register to set | ||
883 | * @param value the value to write to the register at 'offset' | ||
884 | * | ||
885 | * @return 0 on success, error code on failure | ||
886 | */ | ||
887 | int lbs_set_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 value) | ||
888 | { | ||
889 | struct cmd_ds_reg_access cmd; | ||
890 | int ret = 0; | ||
891 | |||
892 | lbs_deb_enter(LBS_DEB_CMD); | ||
893 | |||
894 | memset(&cmd, 0, sizeof(cmd)); | ||
895 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
896 | cmd.action = cpu_to_le16(CMD_ACT_SET); | ||
897 | |||
898 | if (reg == CMD_BBP_REG_ACCESS || reg == CMD_RF_REG_ACCESS) | ||
899 | cmd.value.bbp_rf = (u8) (value & 0xFF); | ||
900 | else if (reg == CMD_MAC_REG_ACCESS) | ||
901 | cmd.value.mac = cpu_to_le32(value); | ||
902 | else { | ||
903 | ret = -EINVAL; | ||
904 | goto out; | ||
905 | } | ||
906 | |||
907 | ret = lbs_cmd_with_response(priv, reg, &cmd); | ||
908 | |||
909 | out: | ||
910 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
911 | return ret; | ||
752 | } | 912 | } |
753 | 913 | ||
754 | static void lbs_queue_cmd(struct lbs_private *priv, | 914 | static void lbs_queue_cmd(struct lbs_private *priv, |
@@ -771,16 +931,15 @@ static void lbs_queue_cmd(struct lbs_private *priv, | |||
771 | 931 | ||
772 | /* Exit_PS command needs to be queued in the header always. */ | 932 | /* Exit_PS command needs to be queued in the header always. */ |
773 | if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { | 933 | if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { |
774 | struct cmd_ds_802_11_ps_mode *psm = (void *) &cmdnode->cmdbuf[1]; | 934 | struct cmd_ds_802_11_ps_mode *psm = (void *) &cmdnode->cmdbuf; |
775 | 935 | ||
776 | if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { | 936 | if (psm->action == cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) { |
777 | if (priv->psstate != PS_STATE_FULL_POWER) | 937 | if (priv->psstate != PS_STATE_FULL_POWER) |
778 | addtail = 0; | 938 | addtail = 0; |
779 | } | 939 | } |
780 | } | 940 | } |
781 | 941 | ||
782 | if (le16_to_cpu(cmdnode->cmdbuf->command) == | 942 | if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_WAKEUP_CONFIRM) |
783 | CMD_802_11_WAKEUP_CONFIRM) | ||
784 | addtail = 0; | 943 | addtail = 0; |
785 | 944 | ||
786 | spin_lock_irqsave(&priv->driver_lock, flags); | 945 | spin_lock_irqsave(&priv->driver_lock, flags); |
@@ -815,7 +974,6 @@ static void lbs_submit_command(struct lbs_private *priv, | |||
815 | 974 | ||
816 | spin_lock_irqsave(&priv->driver_lock, flags); | 975 | spin_lock_irqsave(&priv->driver_lock, flags); |
817 | priv->cur_cmd = cmdnode; | 976 | priv->cur_cmd = cmdnode; |
818 | priv->cur_cmd_retcode = 0; | ||
819 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 977 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
820 | 978 | ||
821 | cmdsize = le16_to_cpu(cmd->size); | 979 | cmdsize = le16_to_cpu(cmd->size); |
@@ -888,9 +1046,6 @@ static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, | |||
888 | void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, | 1046 | void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, |
889 | int result) | 1047 | int result) |
890 | { | 1048 | { |
891 | if (cmd == priv->cur_cmd) | ||
892 | priv->cur_cmd_retcode = result; | ||
893 | |||
894 | cmd->result = result; | 1049 | cmd->result = result; |
895 | cmd->cmdwaitqwoken = 1; | 1050 | cmd->cmdwaitqwoken = 1; |
896 | wake_up_interruptible(&cmd->cmdwait_q); | 1051 | wake_up_interruptible(&cmd->cmdwait_q); |
@@ -958,240 +1113,6 @@ void lbs_set_mac_control(struct lbs_private *priv) | |||
958 | } | 1113 | } |
959 | 1114 | ||
960 | /** | 1115 | /** |
961 | * @brief This function implements command CMD_802_11D_DOMAIN_INFO | ||
962 | * @param priv pointer to struct lbs_private | ||
963 | * @param cmd pointer to cmd buffer | ||
964 | * @param cmdno cmd ID | ||
965 | * @param cmdOption cmd action | ||
966 | * @return 0 | ||
967 | */ | ||
968 | int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, | ||
969 | struct cmd_ds_command *cmd, | ||
970 | u16 cmdoption) | ||
971 | { | ||
972 | struct cmd_ds_802_11d_domain_info *pdomaininfo = | ||
973 | &cmd->params.domaininfo; | ||
974 | struct mrvl_ie_domain_param_set *domain = &pdomaininfo->domain; | ||
975 | u8 nr_triplet = priv->domain_reg.no_triplet; | ||
976 | |||
977 | lbs_deb_enter(LBS_DEB_11D); | ||
978 | |||
979 | lbs_deb_11d("nr_triplet=%x\n", nr_triplet); | ||
980 | |||
981 | pdomaininfo->action = cpu_to_le16(cmdoption); | ||
982 | if (cmdoption == CMD_ACT_GET) { | ||
983 | cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) + | ||
984 | sizeof(struct cmd_header)); | ||
985 | lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd, | ||
986 | le16_to_cpu(cmd->size)); | ||
987 | goto done; | ||
988 | } | ||
989 | |||
990 | domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); | ||
991 | memcpy(domain->countrycode, priv->domain_reg.country_code, | ||
992 | sizeof(domain->countrycode)); | ||
993 | |||
994 | domain->header.len = cpu_to_le16(nr_triplet | ||
995 | * sizeof(struct ieee80211_country_ie_triplet) | ||
996 | + sizeof(domain->countrycode)); | ||
997 | |||
998 | if (nr_triplet) { | ||
999 | memcpy(domain->triplet, priv->domain_reg.triplet, | ||
1000 | nr_triplet * | ||
1001 | sizeof(struct ieee80211_country_ie_triplet)); | ||
1002 | |||
1003 | cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) + | ||
1004 | le16_to_cpu(domain->header.len) + | ||
1005 | sizeof(struct mrvl_ie_header) + | ||
1006 | sizeof(struct cmd_header)); | ||
1007 | } else { | ||
1008 | cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) + | ||
1009 | sizeof(struct cmd_header)); | ||
1010 | } | ||
1011 | |||
1012 | lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd, | ||
1013 | le16_to_cpu(cmd->size)); | ||
1014 | |||
1015 | done: | ||
1016 | lbs_deb_enter(LBS_DEB_11D); | ||
1017 | return 0; | ||
1018 | } | ||
1019 | |||
1020 | /** | ||
1021 | * @brief This function prepare the command before send to firmware. | ||
1022 | * | ||
1023 | * @param priv A pointer to struct lbs_private structure | ||
1024 | * @param cmd_no command number | ||
1025 | * @param cmd_action command action: GET or SET | ||
1026 | * @param wait_option wait option: wait response or not | ||
1027 | * @param cmd_oid cmd oid: treated as sub command | ||
1028 | * @param pdata_buf A pointer to informaion buffer | ||
1029 | * @return 0 or -1 | ||
1030 | */ | ||
1031 | int lbs_prepare_and_send_command(struct lbs_private *priv, | ||
1032 | u16 cmd_no, | ||
1033 | u16 cmd_action, | ||
1034 | u16 wait_option, u32 cmd_oid, void *pdata_buf) | ||
1035 | { | ||
1036 | int ret = 0; | ||
1037 | struct cmd_ctrl_node *cmdnode; | ||
1038 | struct cmd_ds_command *cmdptr; | ||
1039 | unsigned long flags; | ||
1040 | |||
1041 | lbs_deb_enter(LBS_DEB_HOST); | ||
1042 | |||
1043 | if (!priv) { | ||
1044 | lbs_deb_host("PREP_CMD: priv is NULL\n"); | ||
1045 | ret = -1; | ||
1046 | goto done; | ||
1047 | } | ||
1048 | |||
1049 | if (priv->surpriseremoved) { | ||
1050 | lbs_deb_host("PREP_CMD: card removed\n"); | ||
1051 | ret = -1; | ||
1052 | goto done; | ||
1053 | } | ||
1054 | |||
1055 | if (!lbs_is_cmd_allowed(priv)) { | ||
1056 | ret = -EBUSY; | ||
1057 | goto done; | ||
1058 | } | ||
1059 | |||
1060 | cmdnode = lbs_get_cmd_ctrl_node(priv); | ||
1061 | |||
1062 | if (cmdnode == NULL) { | ||
1063 | lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); | ||
1064 | |||
1065 | /* Wake up main thread to execute next command */ | ||
1066 | wake_up_interruptible(&priv->waitq); | ||
1067 | ret = -1; | ||
1068 | goto done; | ||
1069 | } | ||
1070 | |||
1071 | cmdnode->callback = NULL; | ||
1072 | cmdnode->callback_arg = (unsigned long)pdata_buf; | ||
1073 | |||
1074 | cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf; | ||
1075 | |||
1076 | lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no); | ||
1077 | |||
1078 | /* Set sequence number, command and INT option */ | ||
1079 | priv->seqnum++; | ||
1080 | cmdptr->seqnum = cpu_to_le16(priv->seqnum); | ||
1081 | |||
1082 | cmdptr->command = cpu_to_le16(cmd_no); | ||
1083 | cmdptr->result = 0; | ||
1084 | |||
1085 | switch (cmd_no) { | ||
1086 | case CMD_802_11_PS_MODE: | ||
1087 | ret = lbs_cmd_802_11_ps_mode(cmdptr, cmd_action); | ||
1088 | break; | ||
1089 | |||
1090 | case CMD_MAC_REG_ACCESS: | ||
1091 | case CMD_BBP_REG_ACCESS: | ||
1092 | case CMD_RF_REG_ACCESS: | ||
1093 | ret = lbs_cmd_reg_access(cmdptr, cmd_action, pdata_buf); | ||
1094 | break; | ||
1095 | |||
1096 | case CMD_802_11_MONITOR_MODE: | ||
1097 | ret = lbs_cmd_802_11_monitor_mode(cmdptr, | ||
1098 | cmd_action, pdata_buf); | ||
1099 | break; | ||
1100 | |||
1101 | case CMD_802_11_RSSI: | ||
1102 | ret = lbs_cmd_802_11_rssi(priv, cmdptr); | ||
1103 | break; | ||
1104 | |||
1105 | case CMD_802_11_SET_AFC: | ||
1106 | case CMD_802_11_GET_AFC: | ||
1107 | |||
1108 | cmdptr->command = cpu_to_le16(cmd_no); | ||
1109 | cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) + | ||
1110 | sizeof(struct cmd_header)); | ||
1111 | |||
1112 | memmove(&cmdptr->params.afc, | ||
1113 | pdata_buf, sizeof(struct cmd_ds_802_11_afc)); | ||
1114 | |||
1115 | ret = 0; | ||
1116 | goto done; | ||
1117 | |||
1118 | case CMD_802_11D_DOMAIN_INFO: | ||
1119 | cmdptr->command = cpu_to_le16(cmd_no); | ||
1120 | ret = lbs_cmd_802_11d_domain_info(priv, cmdptr, cmd_action); | ||
1121 | break; | ||
1122 | |||
1123 | case CMD_802_11_TPC_CFG: | ||
1124 | cmdptr->command = cpu_to_le16(CMD_802_11_TPC_CFG); | ||
1125 | cmdptr->size = | ||
1126 | cpu_to_le16(sizeof(struct cmd_ds_802_11_tpc_cfg) + | ||
1127 | sizeof(struct cmd_header)); | ||
1128 | |||
1129 | memmove(&cmdptr->params.tpccfg, | ||
1130 | pdata_buf, sizeof(struct cmd_ds_802_11_tpc_cfg)); | ||
1131 | |||
1132 | ret = 0; | ||
1133 | break; | ||
1134 | |||
1135 | #ifdef CONFIG_LIBERTAS_MESH | ||
1136 | |||
1137 | case CMD_BT_ACCESS: | ||
1138 | ret = lbs_cmd_bt_access(cmdptr, cmd_action, pdata_buf); | ||
1139 | break; | ||
1140 | |||
1141 | case CMD_FWT_ACCESS: | ||
1142 | ret = lbs_cmd_fwt_access(cmdptr, cmd_action, pdata_buf); | ||
1143 | break; | ||
1144 | |||
1145 | #endif | ||
1146 | |||
1147 | case CMD_802_11_BEACON_CTRL: | ||
1148 | ret = lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action); | ||
1149 | break; | ||
1150 | case CMD_802_11_DEEP_SLEEP: | ||
1151 | cmdptr->command = cpu_to_le16(CMD_802_11_DEEP_SLEEP); | ||
1152 | cmdptr->size = cpu_to_le16(sizeof(struct cmd_header)); | ||
1153 | break; | ||
1154 | default: | ||
1155 | lbs_pr_err("PREP_CMD: unknown command 0x%04x\n", cmd_no); | ||
1156 | ret = -1; | ||
1157 | break; | ||
1158 | } | ||
1159 | |||
1160 | /* return error, since the command preparation failed */ | ||
1161 | if (ret != 0) { | ||
1162 | lbs_deb_host("PREP_CMD: command preparation failed\n"); | ||
1163 | lbs_cleanup_and_insert_cmd(priv, cmdnode); | ||
1164 | ret = -1; | ||
1165 | goto done; | ||
1166 | } | ||
1167 | |||
1168 | cmdnode->cmdwaitqwoken = 0; | ||
1169 | |||
1170 | lbs_queue_cmd(priv, cmdnode); | ||
1171 | wake_up_interruptible(&priv->waitq); | ||
1172 | |||
1173 | if (wait_option & CMD_OPTION_WAITFORRSP) { | ||
1174 | lbs_deb_host("PREP_CMD: wait for response\n"); | ||
1175 | might_sleep(); | ||
1176 | wait_event_interruptible(cmdnode->cmdwait_q, | ||
1177 | cmdnode->cmdwaitqwoken); | ||
1178 | } | ||
1179 | |||
1180 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
1181 | if (priv->cur_cmd_retcode) { | ||
1182 | lbs_deb_host("PREP_CMD: command failed with return code %d\n", | ||
1183 | priv->cur_cmd_retcode); | ||
1184 | priv->cur_cmd_retcode = 0; | ||
1185 | ret = -1; | ||
1186 | } | ||
1187 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
1188 | |||
1189 | done: | ||
1190 | lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); | ||
1191 | return ret; | ||
1192 | } | ||
1193 | |||
1194 | /** | ||
1195 | * @brief This function allocates the command buffer and link | 1116 | * @brief This function allocates the command buffer and link |
1196 | * it to command free queue. | 1117 | * it to command free queue. |
1197 | * | 1118 | * |
@@ -1284,7 +1205,7 @@ done: | |||
1284 | * @param priv A pointer to struct lbs_private structure | 1205 | * @param priv A pointer to struct lbs_private structure |
1285 | * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or NULL | 1206 | * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or NULL |
1286 | */ | 1207 | */ |
1287 | static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) | 1208 | static struct cmd_ctrl_node *lbs_get_free_cmd_node(struct lbs_private *priv) |
1288 | { | 1209 | { |
1289 | struct cmd_ctrl_node *tempnode; | 1210 | struct cmd_ctrl_node *tempnode; |
1290 | unsigned long flags; | 1211 | unsigned long flags; |
@@ -1367,10 +1288,10 @@ int lbs_execute_next_command(struct lbs_private *priv) | |||
1367 | /* | 1288 | /* |
1368 | * 1. Non-PS command: | 1289 | * 1. Non-PS command: |
1369 | * Queue it. set needtowakeup to TRUE if current state | 1290 | * Queue it. set needtowakeup to TRUE if current state |
1370 | * is SLEEP, otherwise call lbs_ps_wakeup to send Exit_PS. | 1291 | * is SLEEP, otherwise call send EXIT_PS. |
1371 | * 2. PS command but not Exit_PS: | 1292 | * 2. PS command but not EXIT_PS: |
1372 | * Ignore it. | 1293 | * Ignore it. |
1373 | * 3. PS command Exit_PS: | 1294 | * 3. PS command EXIT_PS: |
1374 | * Set needtowakeup to TRUE if current state is SLEEP, | 1295 | * Set needtowakeup to TRUE if current state is SLEEP, |
1375 | * otherwise send this command down to firmware | 1296 | * otherwise send this command down to firmware |
1376 | * immediately. | 1297 | * immediately. |
@@ -1384,8 +1305,11 @@ int lbs_execute_next_command(struct lbs_private *priv) | |||
1384 | /* w/ new scheme, it will not reach here. | 1305 | /* w/ new scheme, it will not reach here. |
1385 | since it is blocked in main_thread. */ | 1306 | since it is blocked in main_thread. */ |
1386 | priv->needtowakeup = 1; | 1307 | priv->needtowakeup = 1; |
1387 | } else | 1308 | } else { |
1388 | lbs_ps_wakeup(priv, 0); | 1309 | lbs_set_ps_mode(priv, |
1310 | PS_MODE_ACTION_EXIT_PS, | ||
1311 | false); | ||
1312 | } | ||
1389 | 1313 | ||
1390 | ret = 0; | 1314 | ret = 0; |
1391 | goto done; | 1315 | goto done; |
@@ -1400,7 +1324,7 @@ int lbs_execute_next_command(struct lbs_private *priv) | |||
1400 | "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n", | 1324 | "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n", |
1401 | psm->action); | 1325 | psm->action); |
1402 | if (psm->action != | 1326 | if (psm->action != |
1403 | cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { | 1327 | cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) { |
1404 | lbs_deb_host( | 1328 | lbs_deb_host( |
1405 | "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); | 1329 | "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); |
1406 | list_del(&cmdnode->list); | 1330 | list_del(&cmdnode->list); |
@@ -1460,13 +1384,16 @@ int lbs_execute_next_command(struct lbs_private *priv) | |||
1460 | lbs_deb_host( | 1384 | lbs_deb_host( |
1461 | "EXEC_NEXT_CMD: WPA enabled and GTK_SET" | 1385 | "EXEC_NEXT_CMD: WPA enabled and GTK_SET" |
1462 | " go back to PS_SLEEP"); | 1386 | " go back to PS_SLEEP"); |
1463 | lbs_ps_sleep(priv, 0); | 1387 | lbs_set_ps_mode(priv, |
1388 | PS_MODE_ACTION_ENTER_PS, | ||
1389 | false); | ||
1464 | } | 1390 | } |
1465 | } else { | 1391 | } else { |
1466 | lbs_deb_host( | 1392 | lbs_deb_host( |
1467 | "EXEC_NEXT_CMD: cmdpendingq empty, " | 1393 | "EXEC_NEXT_CMD: cmdpendingq empty, " |
1468 | "go back to PS_SLEEP"); | 1394 | "go back to PS_SLEEP"); |
1469 | lbs_ps_sleep(priv, 0); | 1395 | lbs_set_ps_mode(priv, PS_MODE_ACTION_ENTER_PS, |
1396 | false); | ||
1470 | } | 1397 | } |
1471 | } | 1398 | } |
1472 | #endif | 1399 | #endif |
@@ -1514,43 +1441,6 @@ out: | |||
1514 | lbs_deb_leave(LBS_DEB_HOST); | 1441 | lbs_deb_leave(LBS_DEB_HOST); |
1515 | } | 1442 | } |
1516 | 1443 | ||
1517 | void lbs_ps_sleep(struct lbs_private *priv, int wait_option) | ||
1518 | { | ||
1519 | lbs_deb_enter(LBS_DEB_HOST); | ||
1520 | |||
1521 | /* | ||
1522 | * PS is currently supported only in Infrastructure mode | ||
1523 | * Remove this check if it is to be supported in IBSS mode also | ||
1524 | */ | ||
1525 | |||
1526 | lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, | ||
1527 | CMD_SUBCMD_ENTER_PS, wait_option, 0, NULL); | ||
1528 | |||
1529 | lbs_deb_leave(LBS_DEB_HOST); | ||
1530 | } | ||
1531 | |||
1532 | /** | ||
1533 | * @brief This function sends Exit_PS command to firmware. | ||
1534 | * | ||
1535 | * @param priv A pointer to struct lbs_private structure | ||
1536 | * @param wait_option wait response or not | ||
1537 | * @return n/a | ||
1538 | */ | ||
1539 | void lbs_ps_wakeup(struct lbs_private *priv, int wait_option) | ||
1540 | { | ||
1541 | __le32 Localpsmode; | ||
1542 | |||
1543 | lbs_deb_enter(LBS_DEB_HOST); | ||
1544 | |||
1545 | Localpsmode = cpu_to_le32(LBS802_11POWERMODECAM); | ||
1546 | |||
1547 | lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, | ||
1548 | CMD_SUBCMD_EXIT_PS, | ||
1549 | wait_option, 0, &Localpsmode); | ||
1550 | |||
1551 | lbs_deb_leave(LBS_DEB_HOST); | ||
1552 | } | ||
1553 | |||
1554 | /** | 1444 | /** |
1555 | * @brief This function checks condition and prepares to | 1445 | * @brief This function checks condition and prepares to |
1556 | * send sleep confirm command to firmware if ok. | 1446 | * send sleep confirm command to firmware if ok. |
@@ -1675,12 +1565,18 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, | |||
1675 | goto done; | 1565 | goto done; |
1676 | } | 1566 | } |
1677 | 1567 | ||
1678 | if (!lbs_is_cmd_allowed(priv)) { | 1568 | /* No commands are allowed in Deep Sleep until we toggle the GPIO |
1679 | cmdnode = ERR_PTR(-EBUSY); | 1569 | * to wake up the card and it has signaled that it's ready. |
1680 | goto done; | 1570 | */ |
1571 | if (!priv->is_auto_deep_sleep_enabled) { | ||
1572 | if (priv->is_deep_sleep) { | ||
1573 | lbs_deb_cmd("command not allowed in deep sleep\n"); | ||
1574 | cmdnode = ERR_PTR(-EBUSY); | ||
1575 | goto done; | ||
1576 | } | ||
1681 | } | 1577 | } |
1682 | 1578 | ||
1683 | cmdnode = lbs_get_cmd_ctrl_node(priv); | 1579 | cmdnode = lbs_get_free_cmd_node(priv); |
1684 | if (cmdnode == NULL) { | 1580 | if (cmdnode == NULL) { |
1685 | lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); | 1581 | lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); |
1686 | 1582 | ||
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 386e565d99ad..7109d6b717ea 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h | |||
@@ -3,6 +3,8 @@ | |||
3 | #ifndef _LBS_CMD_H_ | 3 | #ifndef _LBS_CMD_H_ |
4 | #define _LBS_CMD_H_ | 4 | #define _LBS_CMD_H_ |
5 | 5 | ||
6 | #include <net/cfg80211.h> | ||
7 | |||
6 | #include "host.h" | 8 | #include "host.h" |
7 | #include "dev.h" | 9 | #include "dev.h" |
8 | 10 | ||
@@ -37,11 +39,6 @@ struct cmd_ctrl_node { | |||
37 | #define lbs_cmd_with_response(priv, cmdnr, cmd) \ | 39 | #define lbs_cmd_with_response(priv, cmdnr, cmd) \ |
38 | lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) | 40 | lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) |
39 | 41 | ||
40 | int lbs_prepare_and_send_command(struct lbs_private *priv, | ||
41 | u16 cmd_no, | ||
42 | u16 cmd_action, | ||
43 | u16 wait_option, u32 cmd_oid, void *pdata_buf); | ||
44 | |||
45 | void lbs_cmd_async(struct lbs_private *priv, uint16_t command, | 42 | void lbs_cmd_async(struct lbs_private *priv, uint16_t command, |
46 | struct cmd_header *in_cmd, int in_cmd_size); | 43 | struct cmd_header *in_cmd, int in_cmd_size); |
47 | 44 | ||
@@ -92,10 +89,6 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, | |||
92 | int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, | 89 | int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, |
93 | struct sleep_params *sp); | 90 | struct sleep_params *sp); |
94 | 91 | ||
95 | void lbs_ps_sleep(struct lbs_private *priv, int wait_option); | ||
96 | |||
97 | void lbs_ps_wakeup(struct lbs_private *priv, int wait_option); | ||
98 | |||
99 | void lbs_ps_confirm_sleep(struct lbs_private *priv); | 92 | void lbs_ps_confirm_sleep(struct lbs_private *priv); |
100 | 93 | ||
101 | int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on); | 94 | int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on); |
@@ -129,4 +122,18 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep); | |||
129 | 122 | ||
130 | int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep); | 123 | int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep); |
131 | 124 | ||
125 | int lbs_set_monitor_mode(struct lbs_private *priv, int enable); | ||
126 | |||
127 | int lbs_get_rssi(struct lbs_private *priv, s8 *snr, s8 *nf); | ||
128 | |||
129 | int lbs_set_11d_domain_info(struct lbs_private *priv, | ||
130 | struct regulatory_request *request, | ||
131 | struct ieee80211_supported_band **bands); | ||
132 | |||
133 | int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value); | ||
134 | |||
135 | int lbs_set_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 value); | ||
136 | |||
137 | int lbs_set_ps_mode(struct lbs_private *priv, u16 cmd_action, bool block); | ||
138 | |||
132 | #endif /* _LBS_CMD_H */ | 139 | #endif /* _LBS_CMD_H */ |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index a0d9482ef5e2..5e95da9dcc2e 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -49,171 +49,11 @@ void lbs_mac_event_disconnected(struct lbs_private *priv) | |||
49 | if (priv->psstate != PS_STATE_FULL_POWER) { | 49 | if (priv->psstate != PS_STATE_FULL_POWER) { |
50 | /* make firmware to exit PS mode */ | 50 | /* make firmware to exit PS mode */ |
51 | lbs_deb_cmd("disconnected, so exit PS mode\n"); | 51 | lbs_deb_cmd("disconnected, so exit PS mode\n"); |
52 | lbs_ps_wakeup(priv, 0); | 52 | lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, false); |
53 | } | 53 | } |
54 | lbs_deb_leave(LBS_DEB_ASSOC); | 54 | lbs_deb_leave(LBS_DEB_ASSOC); |
55 | } | 55 | } |
56 | 56 | ||
57 | static int lbs_ret_reg_access(struct lbs_private *priv, | ||
58 | u16 type, struct cmd_ds_command *resp) | ||
59 | { | ||
60 | int ret = 0; | ||
61 | |||
62 | lbs_deb_enter(LBS_DEB_CMD); | ||
63 | |||
64 | switch (type) { | ||
65 | case CMD_RET(CMD_MAC_REG_ACCESS): | ||
66 | { | ||
67 | struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; | ||
68 | |||
69 | priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); | ||
70 | priv->offsetvalue.value = le32_to_cpu(reg->value); | ||
71 | break; | ||
72 | } | ||
73 | |||
74 | case CMD_RET(CMD_BBP_REG_ACCESS): | ||
75 | { | ||
76 | struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; | ||
77 | |||
78 | priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); | ||
79 | priv->offsetvalue.value = reg->value; | ||
80 | break; | ||
81 | } | ||
82 | |||
83 | case CMD_RET(CMD_RF_REG_ACCESS): | ||
84 | { | ||
85 | struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; | ||
86 | |||
87 | priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); | ||
88 | priv->offsetvalue.value = reg->value; | ||
89 | break; | ||
90 | } | ||
91 | |||
92 | default: | ||
93 | ret = -1; | ||
94 | } | ||
95 | |||
96 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
97 | return ret; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * @brief This function parses countryinfo from AP and download country info to FW | ||
102 | * @param priv pointer to struct lbs_private | ||
103 | * @param resp pointer to command response buffer | ||
104 | * @return 0; -1 | ||
105 | */ | ||
106 | static int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp) | ||
107 | { | ||
108 | struct cmd_ds_802_11d_domain_info *domaininfo = | ||
109 | &resp->params.domaininforesp; | ||
110 | struct mrvl_ie_domain_param_set *domain = &domaininfo->domain; | ||
111 | u16 action = le16_to_cpu(domaininfo->action); | ||
112 | s16 ret = 0; | ||
113 | u8 nr_triplet = 0; | ||
114 | |||
115 | lbs_deb_enter(LBS_DEB_11D); | ||
116 | |||
117 | lbs_deb_hex(LBS_DEB_11D, "domain info resp", (u8 *) resp, | ||
118 | (int)le16_to_cpu(resp->size)); | ||
119 | |||
120 | nr_triplet = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) / | ||
121 | sizeof(struct ieee80211_country_ie_triplet); | ||
122 | |||
123 | lbs_deb_11d("domain info resp: nr_triplet %d\n", nr_triplet); | ||
124 | |||
125 | if (nr_triplet > MRVDRV_MAX_TRIPLET_802_11D) { | ||
126 | lbs_deb_11d("invalid number of triplets returned!!\n"); | ||
127 | return -1; | ||
128 | } | ||
129 | |||
130 | switch (action) { | ||
131 | case CMD_ACT_SET: /*Proc set action */ | ||
132 | break; | ||
133 | |||
134 | case CMD_ACT_GET: | ||
135 | break; | ||
136 | default: | ||
137 | lbs_deb_11d("invalid action:%d\n", domaininfo->action); | ||
138 | ret = -1; | ||
139 | break; | ||
140 | } | ||
141 | |||
142 | lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); | ||
143 | return ret; | ||
144 | } | ||
145 | |||
146 | static inline int handle_cmd_response(struct lbs_private *priv, | ||
147 | struct cmd_header *cmd_response) | ||
148 | { | ||
149 | struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response; | ||
150 | int ret = 0; | ||
151 | unsigned long flags; | ||
152 | uint16_t respcmd = le16_to_cpu(resp->command); | ||
153 | |||
154 | lbs_deb_enter(LBS_DEB_HOST); | ||
155 | |||
156 | switch (respcmd) { | ||
157 | case CMD_RET(CMD_MAC_REG_ACCESS): | ||
158 | case CMD_RET(CMD_BBP_REG_ACCESS): | ||
159 | case CMD_RET(CMD_RF_REG_ACCESS): | ||
160 | ret = lbs_ret_reg_access(priv, respcmd, resp); | ||
161 | break; | ||
162 | |||
163 | case CMD_RET(CMD_802_11_SET_AFC): | ||
164 | case CMD_RET(CMD_802_11_GET_AFC): | ||
165 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
166 | memmove((void *)priv->cur_cmd->callback_arg, &resp->params.afc, | ||
167 | sizeof(struct cmd_ds_802_11_afc)); | ||
168 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
169 | |||
170 | break; | ||
171 | |||
172 | case CMD_RET(CMD_802_11_BEACON_STOP): | ||
173 | break; | ||
174 | |||
175 | case CMD_RET(CMD_802_11_RSSI): | ||
176 | ret = lbs_ret_802_11_rssi(priv, resp); | ||
177 | break; | ||
178 | |||
179 | case CMD_RET(CMD_802_11D_DOMAIN_INFO): | ||
180 | ret = lbs_ret_802_11d_domain_info(resp); | ||
181 | break; | ||
182 | |||
183 | case CMD_RET(CMD_802_11_TPC_CFG): | ||
184 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
185 | memmove((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg, | ||
186 | sizeof(struct cmd_ds_802_11_tpc_cfg)); | ||
187 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
188 | break; | ||
189 | |||
190 | case CMD_RET(CMD_BT_ACCESS): | ||
191 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
192 | if (priv->cur_cmd->callback_arg) | ||
193 | memcpy((void *)priv->cur_cmd->callback_arg, | ||
194 | &resp->params.bt.addr1, 2 * ETH_ALEN); | ||
195 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
196 | break; | ||
197 | case CMD_RET(CMD_FWT_ACCESS): | ||
198 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
199 | if (priv->cur_cmd->callback_arg) | ||
200 | memcpy((void *)priv->cur_cmd->callback_arg, &resp->params.fwt, | ||
201 | sizeof(resp->params.fwt)); | ||
202 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
203 | break; | ||
204 | case CMD_RET(CMD_802_11_BEACON_CTRL): | ||
205 | ret = lbs_ret_802_11_bcn_ctrl(priv, resp); | ||
206 | break; | ||
207 | |||
208 | default: | ||
209 | lbs_pr_err("CMD_RESP: unknown cmd response 0x%04x\n", | ||
210 | le16_to_cpu(resp->command)); | ||
211 | break; | ||
212 | } | ||
213 | lbs_deb_leave(LBS_DEB_HOST); | ||
214 | return ret; | ||
215 | } | ||
216 | |||
217 | int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) | 57 | int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) |
218 | { | 58 | { |
219 | uint16_t respcmd, curcmd; | 59 | uint16_t respcmd, curcmd; |
@@ -272,9 +112,6 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) | |||
272 | del_timer(&priv->command_timer); | 112 | del_timer(&priv->command_timer); |
273 | priv->cmd_timed_out = 0; | 113 | priv->cmd_timed_out = 0; |
274 | 114 | ||
275 | /* Store the response code to cur_cmd_retcode. */ | ||
276 | priv->cur_cmd_retcode = result; | ||
277 | |||
278 | if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { | 115 | if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { |
279 | struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1]; | 116 | struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1]; |
280 | u16 action = le16_to_cpu(psmode->action); | 117 | u16 action = le16_to_cpu(psmode->action); |
@@ -292,9 +129,9 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) | |||
292 | * lbs_execute_next_command(). | 129 | * lbs_execute_next_command(). |
293 | */ | 130 | */ |
294 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR && | 131 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR && |
295 | action == CMD_SUBCMD_ENTER_PS) | 132 | action == PS_MODE_ACTION_ENTER_PS) |
296 | priv->psmode = LBS802_11POWERMODECAM; | 133 | priv->psmode = LBS802_11POWERMODECAM; |
297 | } else if (action == CMD_SUBCMD_ENTER_PS) { | 134 | } else if (action == PS_MODE_ACTION_ENTER_PS) { |
298 | priv->needtowakeup = 0; | 135 | priv->needtowakeup = 0; |
299 | priv->psstate = PS_STATE_AWAKE; | 136 | priv->psstate = PS_STATE_AWAKE; |
300 | 137 | ||
@@ -309,11 +146,12 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) | |||
309 | 146 | ||
310 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 147 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
311 | mutex_unlock(&priv->lock); | 148 | mutex_unlock(&priv->lock); |
312 | lbs_ps_wakeup(priv, 0); | 149 | lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, |
150 | false); | ||
313 | mutex_lock(&priv->lock); | 151 | mutex_lock(&priv->lock); |
314 | spin_lock_irqsave(&priv->driver_lock, flags); | 152 | spin_lock_irqsave(&priv->driver_lock, flags); |
315 | } | 153 | } |
316 | } else if (action == CMD_SUBCMD_EXIT_PS) { | 154 | } else if (action == PS_MODE_ACTION_EXIT_PS) { |
317 | priv->needtowakeup = 0; | 155 | priv->needtowakeup = 0; |
318 | priv->psstate = PS_STATE_FULL_POWER; | 156 | priv->psstate = PS_STATE_FULL_POWER; |
319 | lbs_deb_host("CMD_RESP: EXIT_PS command response\n"); | 157 | lbs_deb_host("CMD_RESP: EXIT_PS command response\n"); |
@@ -354,8 +192,7 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) | |||
354 | if (priv->cur_cmd && priv->cur_cmd->callback) { | 192 | if (priv->cur_cmd && priv->cur_cmd->callback) { |
355 | ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, | 193 | ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, |
356 | resp); | 194 | resp); |
357 | } else | 195 | } |
358 | ret = handle_cmd_response(priv, resp); | ||
359 | 196 | ||
360 | spin_lock_irqsave(&priv->driver_lock, flags); | 197 | spin_lock_irqsave(&priv->driver_lock, flags); |
361 | 198 | ||
@@ -452,7 +289,7 @@ int lbs_process_event(struct lbs_private *priv, u32 event) | |||
452 | * in lbs_ps_wakeup() | 289 | * in lbs_ps_wakeup() |
453 | */ | 290 | */ |
454 | lbs_deb_cmd("waking up ...\n"); | 291 | lbs_deb_cmd("waking up ...\n"); |
455 | lbs_ps_wakeup(priv, 0); | 292 | lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, false); |
456 | } | 293 | } |
457 | break; | 294 | break; |
458 | 295 | ||
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 3db621b18a2f..651a79c8de8a 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -446,30 +446,24 @@ static ssize_t lbs_bcnmiss_write(struct file *file, const char __user *userbuf, | |||
446 | } | 446 | } |
447 | 447 | ||
448 | 448 | ||
449 | |||
450 | static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, | 449 | static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, |
451 | size_t count, loff_t *ppos) | 450 | size_t count, loff_t *ppos) |
452 | { | 451 | { |
453 | struct lbs_private *priv = file->private_data; | 452 | struct lbs_private *priv = file->private_data; |
454 | struct lbs_offset_value offval; | ||
455 | ssize_t pos = 0; | 453 | ssize_t pos = 0; |
456 | int ret; | 454 | int ret; |
457 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 455 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
458 | char *buf = (char *)addr; | 456 | char *buf = (char *)addr; |
457 | u32 val = 0; | ||
458 | |||
459 | if (!buf) | 459 | if (!buf) |
460 | return -ENOMEM; | 460 | return -ENOMEM; |
461 | 461 | ||
462 | offval.offset = priv->mac_offset; | 462 | ret = lbs_get_reg(priv, CMD_MAC_REG_ACCESS, priv->mac_offset, &val); |
463 | offval.value = 0; | ||
464 | |||
465 | ret = lbs_prepare_and_send_command(priv, | ||
466 | CMD_MAC_REG_ACCESS, 0, | ||
467 | CMD_OPTION_WAITFORRSP, 0, &offval); | ||
468 | mdelay(10); | 463 | mdelay(10); |
469 | if (!ret) { | 464 | if (!ret) { |
470 | pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n", | 465 | pos = snprintf(buf, len, "MAC[0x%x] = 0x%08x\n", |
471 | priv->mac_offset, priv->offsetvalue.value); | 466 | priv->mac_offset, val); |
472 | |||
473 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 467 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
474 | } | 468 | } |
475 | free_page(addr); | 469 | free_page(addr); |
@@ -507,7 +501,6 @@ static ssize_t lbs_wrmac_write(struct file *file, | |||
507 | struct lbs_private *priv = file->private_data; | 501 | struct lbs_private *priv = file->private_data; |
508 | ssize_t res, buf_size; | 502 | ssize_t res, buf_size; |
509 | u32 offset, value; | 503 | u32 offset, value; |
510 | struct lbs_offset_value offval; | ||
511 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 504 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
512 | char *buf = (char *)addr; | 505 | char *buf = (char *)addr; |
513 | if (!buf) | 506 | if (!buf) |
@@ -524,11 +517,7 @@ static ssize_t lbs_wrmac_write(struct file *file, | |||
524 | goto out_unlock; | 517 | goto out_unlock; |
525 | } | 518 | } |
526 | 519 | ||
527 | offval.offset = offset; | 520 | res = lbs_set_reg(priv, CMD_MAC_REG_ACCESS, offset, value); |
528 | offval.value = value; | ||
529 | res = lbs_prepare_and_send_command(priv, | ||
530 | CMD_MAC_REG_ACCESS, 1, | ||
531 | CMD_OPTION_WAITFORRSP, 0, &offval); | ||
532 | mdelay(10); | 521 | mdelay(10); |
533 | 522 | ||
534 | if (!res) | 523 | if (!res) |
@@ -542,25 +531,20 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, | |||
542 | size_t count, loff_t *ppos) | 531 | size_t count, loff_t *ppos) |
543 | { | 532 | { |
544 | struct lbs_private *priv = file->private_data; | 533 | struct lbs_private *priv = file->private_data; |
545 | struct lbs_offset_value offval; | ||
546 | ssize_t pos = 0; | 534 | ssize_t pos = 0; |
547 | int ret; | 535 | int ret; |
548 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 536 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
549 | char *buf = (char *)addr; | 537 | char *buf = (char *)addr; |
538 | u32 val; | ||
539 | |||
550 | if (!buf) | 540 | if (!buf) |
551 | return -ENOMEM; | 541 | return -ENOMEM; |
552 | 542 | ||
553 | offval.offset = priv->bbp_offset; | 543 | ret = lbs_get_reg(priv, CMD_BBP_REG_ACCESS, priv->bbp_offset, &val); |
554 | offval.value = 0; | ||
555 | |||
556 | ret = lbs_prepare_and_send_command(priv, | ||
557 | CMD_BBP_REG_ACCESS, 0, | ||
558 | CMD_OPTION_WAITFORRSP, 0, &offval); | ||
559 | mdelay(10); | 544 | mdelay(10); |
560 | if (!ret) { | 545 | if (!ret) { |
561 | pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n", | 546 | pos = snprintf(buf, len, "BBP[0x%x] = 0x%08x\n", |
562 | priv->bbp_offset, priv->offsetvalue.value); | 547 | priv->bbp_offset, val); |
563 | |||
564 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 548 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
565 | } | 549 | } |
566 | free_page(addr); | 550 | free_page(addr); |
@@ -599,7 +583,6 @@ static ssize_t lbs_wrbbp_write(struct file *file, | |||
599 | struct lbs_private *priv = file->private_data; | 583 | struct lbs_private *priv = file->private_data; |
600 | ssize_t res, buf_size; | 584 | ssize_t res, buf_size; |
601 | u32 offset, value; | 585 | u32 offset, value; |
602 | struct lbs_offset_value offval; | ||
603 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 586 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
604 | char *buf = (char *)addr; | 587 | char *buf = (char *)addr; |
605 | if (!buf) | 588 | if (!buf) |
@@ -616,11 +599,7 @@ static ssize_t lbs_wrbbp_write(struct file *file, | |||
616 | goto out_unlock; | 599 | goto out_unlock; |
617 | } | 600 | } |
618 | 601 | ||
619 | offval.offset = offset; | 602 | res = lbs_set_reg(priv, CMD_BBP_REG_ACCESS, offset, value); |
620 | offval.value = value; | ||
621 | res = lbs_prepare_and_send_command(priv, | ||
622 | CMD_BBP_REG_ACCESS, 1, | ||
623 | CMD_OPTION_WAITFORRSP, 0, &offval); | ||
624 | mdelay(10); | 603 | mdelay(10); |
625 | 604 | ||
626 | if (!res) | 605 | if (!res) |
@@ -634,25 +613,20 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, | |||
634 | size_t count, loff_t *ppos) | 613 | size_t count, loff_t *ppos) |
635 | { | 614 | { |
636 | struct lbs_private *priv = file->private_data; | 615 | struct lbs_private *priv = file->private_data; |
637 | struct lbs_offset_value offval; | ||
638 | ssize_t pos = 0; | 616 | ssize_t pos = 0; |
639 | int ret; | 617 | int ret; |
640 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 618 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
641 | char *buf = (char *)addr; | 619 | char *buf = (char *)addr; |
620 | u32 val; | ||
621 | |||
642 | if (!buf) | 622 | if (!buf) |
643 | return -ENOMEM; | 623 | return -ENOMEM; |
644 | 624 | ||
645 | offval.offset = priv->rf_offset; | 625 | ret = lbs_get_reg(priv, CMD_RF_REG_ACCESS, priv->rf_offset, &val); |
646 | offval.value = 0; | ||
647 | |||
648 | ret = lbs_prepare_and_send_command(priv, | ||
649 | CMD_RF_REG_ACCESS, 0, | ||
650 | CMD_OPTION_WAITFORRSP, 0, &offval); | ||
651 | mdelay(10); | 626 | mdelay(10); |
652 | if (!ret) { | 627 | if (!ret) { |
653 | pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n", | 628 | pos = snprintf(buf, len, "RF[0x%x] = 0x%08x\n", |
654 | priv->rf_offset, priv->offsetvalue.value); | 629 | priv->rf_offset, val); |
655 | |||
656 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 630 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
657 | } | 631 | } |
658 | free_page(addr); | 632 | free_page(addr); |
@@ -691,7 +665,6 @@ static ssize_t lbs_wrrf_write(struct file *file, | |||
691 | struct lbs_private *priv = file->private_data; | 665 | struct lbs_private *priv = file->private_data; |
692 | ssize_t res, buf_size; | 666 | ssize_t res, buf_size; |
693 | u32 offset, value; | 667 | u32 offset, value; |
694 | struct lbs_offset_value offval; | ||
695 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 668 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
696 | char *buf = (char *)addr; | 669 | char *buf = (char *)addr; |
697 | if (!buf) | 670 | if (!buf) |
@@ -708,11 +681,7 @@ static ssize_t lbs_wrrf_write(struct file *file, | |||
708 | goto out_unlock; | 681 | goto out_unlock; |
709 | } | 682 | } |
710 | 683 | ||
711 | offval.offset = offset; | 684 | res = lbs_set_reg(priv, CMD_RF_REG_ACCESS, offset, value); |
712 | offval.value = value; | ||
713 | res = lbs_prepare_and_send_command(priv, | ||
714 | CMD_RF_REG_ACCESS, 1, | ||
715 | CMD_OPTION_WAITFORRSP, 0, &offval); | ||
716 | mdelay(10); | 685 | mdelay(10); |
717 | 686 | ||
718 | if (!res) | 687 | if (!res) |
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index ba5438a7ba17..1d141fefd767 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h | |||
@@ -53,9 +53,4 @@ int lbs_exit_auto_deep_sleep(struct lbs_private *priv); | |||
53 | u32 lbs_fw_index_to_data_rate(u8 index); | 53 | u32 lbs_fw_index_to_data_rate(u8 index); |
54 | u8 lbs_data_rate_to_fw_index(u32 rate); | 54 | u8 lbs_data_rate_to_fw_index(u32 rate); |
55 | 55 | ||
56 | int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, | ||
57 | struct cmd_ds_command *cmd, u16 cmdoption); | ||
58 | |||
59 | int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp); | ||
60 | |||
61 | #endif | 56 | #endif |
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index ea3f10ef4e00..d00c728cec47 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -172,11 +172,6 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in | |||
172 | #define MRVDRV_MAX_BSS_DESCRIPTS 16 | 172 | #define MRVDRV_MAX_BSS_DESCRIPTS 16 |
173 | #define MRVDRV_MAX_REGION_CODE 6 | 173 | #define MRVDRV_MAX_REGION_CODE 6 |
174 | 174 | ||
175 | #define MRVDRV_IGNORE_MULTIPLE_DTIM 0xfffe | ||
176 | #define MRVDRV_MIN_MULTIPLE_DTIM 1 | ||
177 | #define MRVDRV_MAX_MULTIPLE_DTIM 5 | ||
178 | #define MRVDRV_DEFAULT_MULTIPLE_DTIM 1 | ||
179 | |||
180 | #define MRVDRV_DEFAULT_LISTEN_INTERVAL 10 | 175 | #define MRVDRV_DEFAULT_LISTEN_INTERVAL 10 |
181 | 176 | ||
182 | #define MRVDRV_CHANNELS_PER_SCAN 4 | 177 | #define MRVDRV_CHANNELS_PER_SCAN 4 |
@@ -301,19 +296,6 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in | |||
301 | #define BAND_G (0x02) | 296 | #define BAND_G (0x02) |
302 | #define ALL_802_11_BANDS (BAND_B | BAND_G) | 297 | #define ALL_802_11_BANDS (BAND_B | BAND_G) |
303 | 298 | ||
304 | /** MACRO DEFINITIONS */ | ||
305 | #define CAL_NF(NF) ((s32)(-(s32)(NF))) | ||
306 | #define CAL_RSSI(SNR, NF) ((s32)((s32)(SNR) + CAL_NF(NF))) | ||
307 | #define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI))) | ||
308 | |||
309 | #define DEFAULT_BCN_AVG_FACTOR 8 | ||
310 | #define DEFAULT_DATA_AVG_FACTOR 8 | ||
311 | #define AVG_SCALE 100 | ||
312 | #define CAL_AVG_SNR_NF(AVG, SNRNF, N) \ | ||
313 | (((AVG) == 0) ? ((u16)(SNRNF) * AVG_SCALE) : \ | ||
314 | ((((int)(AVG) * (N -1)) + ((u16)(SNRNF) * \ | ||
315 | AVG_SCALE)) / N)) | ||
316 | |||
317 | #define MAX_RATES 14 | 299 | #define MAX_RATES 14 |
318 | 300 | ||
319 | #define MAX_LEDS 8 | 301 | #define MAX_LEDS 8 |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 4536d9c0ad87..3c7e255e18c7 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -60,14 +60,10 @@ struct lbs_private { | |||
60 | struct dentry *regs_dir; | 60 | struct dentry *regs_dir; |
61 | struct dentry *debugfs_regs_files[6]; | 61 | struct dentry *debugfs_regs_files[6]; |
62 | 62 | ||
63 | /** 11D and domain regulatory data */ | ||
64 | struct lbs_802_11d_domain_reg domain_reg; | ||
65 | |||
66 | /* Hardware debugging */ | 63 | /* Hardware debugging */ |
67 | u32 mac_offset; | 64 | u32 mac_offset; |
68 | u32 bbp_offset; | 65 | u32 bbp_offset; |
69 | u32 rf_offset; | 66 | u32 rf_offset; |
70 | struct lbs_offset_value offsetvalue; | ||
71 | 67 | ||
72 | /* Power management */ | 68 | /* Power management */ |
73 | u16 psmode; | 69 | u16 psmode; |
@@ -115,12 +111,10 @@ struct lbs_private { | |||
115 | struct cmd_ctrl_node *cur_cmd; | 111 | struct cmd_ctrl_node *cur_cmd; |
116 | struct list_head cmdfreeq; /* free command buffers */ | 112 | struct list_head cmdfreeq; /* free command buffers */ |
117 | struct list_head cmdpendingq; /* pending command buffers */ | 113 | struct list_head cmdpendingq; /* pending command buffers */ |
118 | wait_queue_head_t cmd_pending; | ||
119 | struct timer_list command_timer; | 114 | struct timer_list command_timer; |
120 | int cmd_timed_out; | 115 | int cmd_timed_out; |
121 | 116 | ||
122 | /* Command responses sent from the hardware to the driver */ | 117 | /* Command responses sent from the hardware to the driver */ |
123 | int cur_cmd_retcode; | ||
124 | u8 resp_idx; | 118 | u8 resp_idx; |
125 | u8 resp_buf[2][LBS_UPLD_SIZE]; | 119 | u8 resp_buf[2][LBS_UPLD_SIZE]; |
126 | u32 resp_len[2]; | 120 | u32 resp_len[2]; |
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 43d020cd7403..5eac1351a021 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h | |||
@@ -94,11 +94,9 @@ | |||
94 | #define CMD_802_11_BEACON_CTRL 0x00b0 | 94 | #define CMD_802_11_BEACON_CTRL 0x00b0 |
95 | 95 | ||
96 | /* For the IEEE Power Save */ | 96 | /* For the IEEE Power Save */ |
97 | #define CMD_SUBCMD_ENTER_PS 0x0030 | 97 | #define PS_MODE_ACTION_ENTER_PS 0x0030 |
98 | #define CMD_SUBCMD_EXIT_PS 0x0031 | 98 | #define PS_MODE_ACTION_EXIT_PS 0x0031 |
99 | #define CMD_SUBCMD_SLEEP_CONFIRMED 0x0034 | 99 | #define PS_MODE_ACTION_SLEEP_CONFIRMED 0x0034 |
100 | #define CMD_SUBCMD_FULL_POWERDOWN 0x0035 | ||
101 | #define CMD_SUBCMD_FULL_POWERUP 0x0036 | ||
102 | 100 | ||
103 | #define CMD_ENABLE_RSN 0x0001 | 101 | #define CMD_ENABLE_RSN 0x0001 |
104 | #define CMD_DISABLE_RSN 0x0000 | 102 | #define CMD_DISABLE_RSN 0x0000 |
@@ -163,11 +161,6 @@ | |||
163 | #define CMD_ACT_SET_TX_FIX_RATE 0x0001 | 161 | #define CMD_ACT_SET_TX_FIX_RATE 0x0001 |
164 | #define CMD_ACT_GET_TX_RATE 0x0002 | 162 | #define CMD_ACT_GET_TX_RATE 0x0002 |
165 | 163 | ||
166 | /* Define action or option for CMD_802_11_PS_MODE */ | ||
167 | #define CMD_TYPE_CAM 0x0000 | ||
168 | #define CMD_TYPE_MAX_PSP 0x0001 | ||
169 | #define CMD_TYPE_FAST_PSP 0x0002 | ||
170 | |||
171 | /* Options for CMD_802_11_FW_WAKE_METHOD */ | 164 | /* Options for CMD_802_11_FW_WAKE_METHOD */ |
172 | #define CMD_WAKE_METHOD_UNCHANGED 0x0000 | 165 | #define CMD_WAKE_METHOD_UNCHANGED 0x0000 |
173 | #define CMD_WAKE_METHOD_COMMAND_INT 0x0001 | 166 | #define CMD_WAKE_METHOD_COMMAND_INT 0x0001 |
@@ -389,30 +382,22 @@ struct lbs_offset_value { | |||
389 | u32 value; | 382 | u32 value; |
390 | } __packed; | 383 | } __packed; |
391 | 384 | ||
392 | #define MRVDRV_MAX_TRIPLET_802_11D 83 | 385 | #define MAX_11D_TRIPLETS 83 |
393 | |||
394 | #define COUNTRY_CODE_LEN 3 | ||
395 | 386 | ||
396 | struct mrvl_ie_domain_param_set { | 387 | struct mrvl_ie_domain_param_set { |
397 | struct mrvl_ie_header header; | 388 | struct mrvl_ie_header header; |
398 | 389 | ||
399 | u8 countrycode[COUNTRY_CODE_LEN]; | 390 | u8 country_code[3]; |
400 | struct ieee80211_country_ie_triplet triplet[1]; | 391 | struct ieee80211_country_ie_triplet triplet[MAX_11D_TRIPLETS]; |
401 | } __packed; | 392 | } __packed; |
402 | 393 | ||
403 | struct cmd_ds_802_11d_domain_info { | 394 | struct cmd_ds_802_11d_domain_info { |
395 | struct cmd_header hdr; | ||
396 | |||
404 | __le16 action; | 397 | __le16 action; |
405 | struct mrvl_ie_domain_param_set domain; | 398 | struct mrvl_ie_domain_param_set domain; |
406 | } __packed; | 399 | } __packed; |
407 | 400 | ||
408 | struct lbs_802_11d_domain_reg { | ||
409 | /** Country code*/ | ||
410 | u8 country_code[COUNTRY_CODE_LEN]; | ||
411 | /** No. of triplet*/ | ||
412 | u8 no_triplet; | ||
413 | struct ieee80211_country_ie_triplet triplet[MRVDRV_MAX_TRIPLET_802_11D]; | ||
414 | } __packed; | ||
415 | |||
416 | /* | 401 | /* |
417 | * Define data structure for CMD_GET_HW_SPEC | 402 | * Define data structure for CMD_GET_HW_SPEC |
418 | * This structure defines the response for the GET_HW_SPEC command | 403 | * This structure defines the response for the GET_HW_SPEC command |
@@ -575,24 +560,15 @@ struct cmd_ds_802_11_snmp_mib { | |||
575 | u8 value[128]; | 560 | u8 value[128]; |
576 | } __packed; | 561 | } __packed; |
577 | 562 | ||
578 | struct cmd_ds_mac_reg_access { | 563 | struct cmd_ds_reg_access { |
579 | __le16 action; | 564 | struct cmd_header hdr; |
580 | __le16 offset; | ||
581 | __le32 value; | ||
582 | } __packed; | ||
583 | |||
584 | struct cmd_ds_bbp_reg_access { | ||
585 | __le16 action; | ||
586 | __le16 offset; | ||
587 | u8 value; | ||
588 | u8 reserved[3]; | ||
589 | } __packed; | ||
590 | 565 | ||
591 | struct cmd_ds_rf_reg_access { | ||
592 | __le16 action; | 566 | __le16 action; |
593 | __le16 offset; | 567 | __le16 offset; |
594 | u8 value; | 568 | union { |
595 | u8 reserved[3]; | 569 | u8 bbp_rf; /* for BBP and RF registers */ |
570 | __le32 mac; /* for MAC registers */ | ||
571 | } value; | ||
596 | } __packed; | 572 | } __packed; |
597 | 573 | ||
598 | struct cmd_ds_802_11_radio_control { | 574 | struct cmd_ds_802_11_radio_control { |
@@ -603,6 +579,8 @@ struct cmd_ds_802_11_radio_control { | |||
603 | } __packed; | 579 | } __packed; |
604 | 580 | ||
605 | struct cmd_ds_802_11_beacon_control { | 581 | struct cmd_ds_802_11_beacon_control { |
582 | struct cmd_header hdr; | ||
583 | |||
606 | __le16 action; | 584 | __le16 action; |
607 | __le16 beacon_enable; | 585 | __le16 beacon_enable; |
608 | __le16 beacon_period; | 586 | __le16 beacon_period; |
@@ -644,19 +622,19 @@ struct cmd_ds_802_11_rf_channel { | |||
644 | } __packed; | 622 | } __packed; |
645 | 623 | ||
646 | struct cmd_ds_802_11_rssi { | 624 | struct cmd_ds_802_11_rssi { |
647 | /* weighting factor */ | 625 | struct cmd_header hdr; |
648 | __le16 N; | ||
649 | 626 | ||
650 | __le16 reserved_0; | 627 | /* request: number of beacons (N) to average the SNR and NF over |
651 | __le16 reserved_1; | 628 | * response: SNR of most recent beacon |
652 | __le16 reserved_2; | 629 | */ |
653 | } __packed; | 630 | __le16 n_or_snr; |
654 | 631 | ||
655 | struct cmd_ds_802_11_rssi_rsp { | 632 | /* The following fields are only set in the response. |
656 | __le16 SNR; | 633 | * In the request these are reserved and should be set to 0. |
657 | __le16 noisefloor; | 634 | */ |
658 | __le16 avgSNR; | 635 | __le16 nf; /* most recent beacon noise floor */ |
659 | __le16 avgnoisefloor; | 636 | __le16 avg_snr; /* average SNR weighted by N from request */ |
637 | __le16 avg_nf; /* average noise floor weighted by N from request */ | ||
660 | } __packed; | 638 | } __packed; |
661 | 639 | ||
662 | struct cmd_ds_802_11_mac_address { | 640 | struct cmd_ds_802_11_mac_address { |
@@ -675,7 +653,10 @@ struct cmd_ds_802_11_rf_tx_power { | |||
675 | s8 minlevel; | 653 | s8 minlevel; |
676 | } __packed; | 654 | } __packed; |
677 | 655 | ||
656 | /* MONITOR_MODE only exists in OLPC v5 firmware */ | ||
678 | struct cmd_ds_802_11_monitor_mode { | 657 | struct cmd_ds_802_11_monitor_mode { |
658 | struct cmd_header hdr; | ||
659 | |||
679 | __le16 action; | 660 | __le16 action; |
680 | __le16 mode; | 661 | __le16 mode; |
681 | } __packed; | 662 | } __packed; |
@@ -695,11 +676,35 @@ struct cmd_ds_802_11_fw_wake_method { | |||
695 | } __packed; | 676 | } __packed; |
696 | 677 | ||
697 | struct cmd_ds_802_11_ps_mode { | 678 | struct cmd_ds_802_11_ps_mode { |
679 | struct cmd_header hdr; | ||
680 | |||
698 | __le16 action; | 681 | __le16 action; |
682 | |||
683 | /* Interval for keepalive in PS mode: | ||
684 | * 0x0000 = don't change | ||
685 | * 0x001E = firmware default | ||
686 | * 0xFFFF = disable | ||
687 | */ | ||
699 | __le16 nullpktinterval; | 688 | __le16 nullpktinterval; |
689 | |||
690 | /* Number of DTIM intervals to wake up for: | ||
691 | * 0 = don't change | ||
692 | * 1 = firmware default | ||
693 | * 5 = max | ||
694 | */ | ||
700 | __le16 multipledtim; | 695 | __le16 multipledtim; |
696 | |||
701 | __le16 reserved; | 697 | __le16 reserved; |
702 | __le16 locallisteninterval; | 698 | __le16 locallisteninterval; |
699 | |||
700 | /* AdHoc awake period (FW v9+ only): | ||
701 | * 0 = don't change | ||
702 | * 1 = always awake (IEEE standard behavior) | ||
703 | * 2 - 31 = sleep for (n - 1) periods and awake for 1 period | ||
704 | * 32 - 254 = invalid | ||
705 | * 255 = sleep at each ATIM | ||
706 | */ | ||
707 | __le16 adhoc_awake_period; | ||
703 | } __packed; | 708 | } __packed; |
704 | 709 | ||
705 | struct cmd_confirm_sleep { | 710 | struct cmd_confirm_sleep { |
@@ -882,12 +887,17 @@ struct cmd_ds_802_11_pa_cfg { | |||
882 | 887 | ||
883 | 888 | ||
884 | struct cmd_ds_802_11_led_ctrl { | 889 | struct cmd_ds_802_11_led_ctrl { |
890 | struct cmd_header hdr; | ||
891 | |||
885 | __le16 action; | 892 | __le16 action; |
886 | __le16 numled; | 893 | __le16 numled; |
887 | u8 data[256]; | 894 | u8 data[256]; |
888 | } __packed; | 895 | } __packed; |
889 | 896 | ||
897 | /* Automatic Frequency Control */ | ||
890 | struct cmd_ds_802_11_afc { | 898 | struct cmd_ds_802_11_afc { |
899 | struct cmd_header hdr; | ||
900 | |||
891 | __le16 afc_auto; | 901 | __le16 afc_auto; |
892 | union { | 902 | union { |
893 | struct { | 903 | struct { |
@@ -910,6 +920,8 @@ struct cmd_ds_get_tsf { | |||
910 | } __packed; | 920 | } __packed; |
911 | 921 | ||
912 | struct cmd_ds_bt_access { | 922 | struct cmd_ds_bt_access { |
923 | struct cmd_header hdr; | ||
924 | |||
913 | __le16 action; | 925 | __le16 action; |
914 | __le32 id; | 926 | __le32 id; |
915 | u8 addr1[ETH_ALEN]; | 927 | u8 addr1[ETH_ALEN]; |
@@ -917,6 +929,8 @@ struct cmd_ds_bt_access { | |||
917 | } __packed; | 929 | } __packed; |
918 | 930 | ||
919 | struct cmd_ds_fwt_access { | 931 | struct cmd_ds_fwt_access { |
932 | struct cmd_header hdr; | ||
933 | |||
920 | __le16 action; | 934 | __le16 action; |
921 | __le32 id; | 935 | __le32 id; |
922 | u8 valid; | 936 | u8 valid; |
@@ -955,34 +969,4 @@ struct cmd_ds_mesh_access { | |||
955 | 969 | ||
956 | /* Number of stats counters returned by the firmware */ | 970 | /* Number of stats counters returned by the firmware */ |
957 | #define MESH_STATS_NUM 8 | 971 | #define MESH_STATS_NUM 8 |
958 | |||
959 | struct cmd_ds_command { | ||
960 | /* command header */ | ||
961 | __le16 command; | ||
962 | __le16 size; | ||
963 | __le16 seqnum; | ||
964 | __le16 result; | ||
965 | |||
966 | /* command Body */ | ||
967 | union { | ||
968 | struct cmd_ds_802_11_ps_mode psmode; | ||
969 | struct cmd_ds_802_11_monitor_mode monitor; | ||
970 | struct cmd_ds_802_11_rssi rssi; | ||
971 | struct cmd_ds_802_11_rssi_rsp rssirsp; | ||
972 | struct cmd_ds_mac_reg_access macreg; | ||
973 | struct cmd_ds_bbp_reg_access bbpreg; | ||
974 | struct cmd_ds_rf_reg_access rfreg; | ||
975 | |||
976 | struct cmd_ds_802_11d_domain_info domaininfo; | ||
977 | struct cmd_ds_802_11d_domain_info domaininforesp; | ||
978 | |||
979 | struct cmd_ds_802_11_tpc_cfg tpccfg; | ||
980 | struct cmd_ds_802_11_afc afc; | ||
981 | struct cmd_ds_802_11_led_ctrl ledgpio; | ||
982 | |||
983 | struct cmd_ds_bt_access bt; | ||
984 | struct cmd_ds_fwt_access fwt; | ||
985 | struct cmd_ds_802_11_beacon_control bcn_ctrl; | ||
986 | } params; | ||
987 | } __packed; | ||
988 | #endif | 972 | #endif |
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 3678e532874f..07ece9d26c63 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -433,7 +433,7 @@ static int if_usb_send_fw_pkt(struct if_usb_card *cardp) | |||
433 | 433 | ||
434 | static int if_usb_reset_device(struct if_usb_card *cardp) | 434 | static int if_usb_reset_device(struct if_usb_card *cardp) |
435 | { | 435 | { |
436 | struct cmd_ds_command *cmd = cardp->ep_out_buf + 4; | 436 | struct cmd_header *cmd = cardp->ep_out_buf + 4; |
437 | int ret; | 437 | int ret; |
438 | 438 | ||
439 | lbs_deb_enter(LBS_DEB_USB); | 439 | lbs_deb_enter(LBS_DEB_USB); |
@@ -441,7 +441,7 @@ static int if_usb_reset_device(struct if_usb_card *cardp) | |||
441 | *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); | 441 | *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); |
442 | 442 | ||
443 | cmd->command = cpu_to_le16(CMD_802_11_RESET); | 443 | cmd->command = cpu_to_le16(CMD_802_11_RESET); |
444 | cmd->size = cpu_to_le16(sizeof(struct cmd_header)); | 444 | cmd->size = cpu_to_le16(sizeof(cmd)); |
445 | cmd->result = cpu_to_le16(0); | 445 | cmd->result = cpu_to_le16(0); |
446 | cmd->seqnum = cpu_to_le16(0x5a5a); | 446 | cmd->seqnum = cpu_to_le16(0x5a5a); |
447 | usb_tx_block(cardp, cardp->ep_out_buf, 4 + sizeof(struct cmd_header)); | 447 | usb_tx_block(cardp, cardp->ep_out_buf, 4 + sizeof(struct cmd_header)); |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2a0b590a93f1..258967144b96 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -157,12 +157,7 @@ static void lbs_tx_timeout(struct net_device *dev) | |||
157 | to kick it somehow? */ | 157 | to kick it somehow? */ |
158 | lbs_host_to_card_done(priv); | 158 | lbs_host_to_card_done(priv); |
159 | 159 | ||
160 | /* More often than not, this actually happens because the | 160 | /* FIXME: reset the card */ |
161 | firmware has crapped itself -- rather than just a very | ||
162 | busy medium. So send a harmless command, and if/when | ||
163 | _that_ times out, we'll kick it in the head. */ | ||
164 | lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, | ||
165 | 0, 0, NULL); | ||
166 | 161 | ||
167 | lbs_deb_leave(LBS_DEB_TX); | 162 | lbs_deb_leave(LBS_DEB_TX); |
168 | } | 163 | } |
@@ -507,12 +502,6 @@ static int lbs_thread(void *data) | |||
507 | if (!priv->dnld_sent && !priv->cur_cmd) | 502 | if (!priv->dnld_sent && !priv->cur_cmd) |
508 | lbs_execute_next_command(priv); | 503 | lbs_execute_next_command(priv); |
509 | 504 | ||
510 | /* Wake-up command waiters which can't sleep in | ||
511 | * lbs_prepare_and_send_command | ||
512 | */ | ||
513 | if (!list_empty(&priv->cmdpendingq)) | ||
514 | wake_up_all(&priv->cmd_pending); | ||
515 | |||
516 | spin_lock_irq(&priv->driver_lock); | 505 | spin_lock_irq(&priv->driver_lock); |
517 | if (!priv->dnld_sent && priv->tx_pending_len > 0) { | 506 | if (!priv->dnld_sent && priv->tx_pending_len > 0) { |
518 | int ret = priv->hw_host_to_card(priv, MVMS_DAT, | 507 | int ret = priv->hw_host_to_card(priv, MVMS_DAT, |
@@ -538,7 +527,6 @@ static int lbs_thread(void *data) | |||
538 | 527 | ||
539 | del_timer(&priv->command_timer); | 528 | del_timer(&priv->command_timer); |
540 | del_timer(&priv->auto_deepsleep_timer); | 529 | del_timer(&priv->auto_deepsleep_timer); |
541 | wake_up_all(&priv->cmd_pending); | ||
542 | 530 | ||
543 | lbs_deb_leave(LBS_DEB_THREAD); | 531 | lbs_deb_leave(LBS_DEB_THREAD); |
544 | return 0; | 532 | return 0; |
@@ -663,7 +651,6 @@ out: | |||
663 | static void auto_deepsleep_timer_fn(unsigned long data) | 651 | static void auto_deepsleep_timer_fn(unsigned long data) |
664 | { | 652 | { |
665 | struct lbs_private *priv = (struct lbs_private *)data; | 653 | struct lbs_private *priv = (struct lbs_private *)data; |
666 | int ret; | ||
667 | 654 | ||
668 | lbs_deb_enter(LBS_DEB_CMD); | 655 | lbs_deb_enter(LBS_DEB_CMD); |
669 | 656 | ||
@@ -671,14 +658,15 @@ static void auto_deepsleep_timer_fn(unsigned long data) | |||
671 | priv->is_activity_detected = 0; | 658 | priv->is_activity_detected = 0; |
672 | } else { | 659 | } else { |
673 | if (priv->is_auto_deep_sleep_enabled && | 660 | if (priv->is_auto_deep_sleep_enabled && |
674 | (!priv->wakeup_dev_required) && | 661 | (!priv->wakeup_dev_required) && |
675 | (priv->connect_status != LBS_CONNECTED)) { | 662 | (priv->connect_status != LBS_CONNECTED)) { |
663 | struct cmd_header cmd; | ||
664 | |||
676 | lbs_deb_main("Entering auto deep sleep mode...\n"); | 665 | lbs_deb_main("Entering auto deep sleep mode...\n"); |
677 | ret = lbs_prepare_and_send_command(priv, | 666 | memset(&cmd, 0, sizeof(cmd)); |
678 | CMD_802_11_DEEP_SLEEP, 0, | 667 | cmd.size = cpu_to_le16(sizeof(cmd)); |
679 | 0, 0, NULL); | 668 | lbs_cmd_async(priv, CMD_802_11_DEEP_SLEEP, &cmd, |
680 | if (ret) | 669 | sizeof(cmd)); |
681 | lbs_pr_err("Enter Deep Sleep command failed\n"); | ||
682 | } | 670 | } |
683 | } | 671 | } |
684 | mod_timer(&priv->auto_deepsleep_timer , jiffies + | 672 | mod_timer(&priv->auto_deepsleep_timer , jiffies + |
@@ -746,7 +734,6 @@ static int lbs_init_adapter(struct lbs_private *priv) | |||
746 | INIT_LIST_HEAD(&priv->cmdpendingq); | 734 | INIT_LIST_HEAD(&priv->cmdpendingq); |
747 | 735 | ||
748 | spin_lock_init(&priv->driver_lock); | 736 | spin_lock_init(&priv->driver_lock); |
749 | init_waitqueue_head(&priv->cmd_pending); | ||
750 | 737 | ||
751 | /* Allocate the command buffers */ | 738 | /* Allocate the command buffers */ |
752 | if (lbs_allocate_cmd_buffer(priv)) { | 739 | if (lbs_allocate_cmd_buffer(priv)) { |
@@ -902,7 +889,7 @@ void lbs_remove_card(struct lbs_private *priv) | |||
902 | 889 | ||
903 | if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { | 890 | if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { |
904 | priv->psmode = LBS802_11POWERMODECAM; | 891 | priv->psmode = LBS802_11POWERMODECAM; |
905 | lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); | 892 | lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, true); |
906 | } | 893 | } |
907 | 894 | ||
908 | if (priv->is_deep_sleep) { | 895 | if (priv->is_deep_sleep) { |
@@ -1065,7 +1052,7 @@ static int __init lbs_init_module(void) | |||
1065 | memset(&confirm_sleep, 0, sizeof(confirm_sleep)); | 1052 | memset(&confirm_sleep, 0, sizeof(confirm_sleep)); |
1066 | confirm_sleep.hdr.command = cpu_to_le16(CMD_802_11_PS_MODE); | 1053 | confirm_sleep.hdr.command = cpu_to_le16(CMD_802_11_PS_MODE); |
1067 | confirm_sleep.hdr.size = cpu_to_le16(sizeof(confirm_sleep)); | 1054 | confirm_sleep.hdr.size = cpu_to_le16(sizeof(confirm_sleep)); |
1068 | confirm_sleep.action = cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED); | 1055 | confirm_sleep.action = cpu_to_le16(PS_MODE_ACTION_SLEEP_CONFIRMED); |
1069 | lbs_debugfs_init(); | 1056 | lbs_debugfs_init(); |
1070 | lbs_deb_leave(LBS_DEB_MAIN); | 1057 | lbs_deb_leave(LBS_DEB_MAIN); |
1071 | return 0; | 1058 | return 0; |
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index bc5bc1384c35..194762ab0142 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
@@ -455,65 +455,189 @@ void lbs_mesh_set_txpd(struct lbs_private *priv, | |||
455 | * Mesh command handling | 455 | * Mesh command handling |
456 | */ | 456 | */ |
457 | 457 | ||
458 | int lbs_cmd_bt_access(struct cmd_ds_command *cmd, | 458 | /** |
459 | u16 cmd_action, void *pdata_buf) | 459 | * @brief Add or delete Mesh Blinding Table entries |
460 | * | ||
461 | * @param priv A pointer to struct lbs_private structure | ||
462 | * @param add TRUE to add the entry, FALSE to delete it | ||
463 | * @param addr1 Destination address to blind or unblind | ||
464 | * | ||
465 | * @return 0 on success, error on failure | ||
466 | */ | ||
467 | int lbs_mesh_bt_add_del(struct lbs_private *priv, bool add, u8 *addr1) | ||
460 | { | 468 | { |
461 | struct cmd_ds_bt_access *bt_access = &cmd->params.bt; | 469 | struct cmd_ds_bt_access cmd; |
462 | lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); | 470 | int ret = 0; |
463 | 471 | ||
464 | cmd->command = cpu_to_le16(CMD_BT_ACCESS); | 472 | lbs_deb_enter(LBS_DEB_CMD); |
465 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + | ||
466 | sizeof(struct cmd_header)); | ||
467 | cmd->result = 0; | ||
468 | bt_access->action = cpu_to_le16(cmd_action); | ||
469 | 473 | ||
470 | switch (cmd_action) { | 474 | BUG_ON(addr1 == NULL); |
471 | case CMD_ACT_BT_ACCESS_ADD: | 475 | |
472 | memcpy(bt_access->addr1, pdata_buf, 2 * ETH_ALEN); | 476 | memset(&cmd, 0, sizeof(cmd)); |
477 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
478 | memcpy(cmd.addr1, addr1, ETH_ALEN); | ||
479 | if (add) { | ||
480 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_ADD); | ||
473 | lbs_deb_hex(LBS_DEB_MESH, "BT_ADD: blinded MAC addr", | 481 | lbs_deb_hex(LBS_DEB_MESH, "BT_ADD: blinded MAC addr", |
474 | bt_access->addr1, 6); | 482 | addr1, ETH_ALEN); |
475 | break; | 483 | } else { |
476 | case CMD_ACT_BT_ACCESS_DEL: | 484 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_DEL); |
477 | memcpy(bt_access->addr1, pdata_buf, 1 * ETH_ALEN); | ||
478 | lbs_deb_hex(LBS_DEB_MESH, "BT_DEL: blinded MAC addr", | 485 | lbs_deb_hex(LBS_DEB_MESH, "BT_DEL: blinded MAC addr", |
479 | bt_access->addr1, 6); | 486 | addr1, ETH_ALEN); |
480 | break; | ||
481 | case CMD_ACT_BT_ACCESS_LIST: | ||
482 | bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); | ||
483 | break; | ||
484 | case CMD_ACT_BT_ACCESS_RESET: | ||
485 | break; | ||
486 | case CMD_ACT_BT_ACCESS_SET_INVERT: | ||
487 | bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); | ||
488 | break; | ||
489 | case CMD_ACT_BT_ACCESS_GET_INVERT: | ||
490 | break; | ||
491 | default: | ||
492 | break; | ||
493 | } | 487 | } |
494 | lbs_deb_leave(LBS_DEB_CMD); | 488 | |
495 | return 0; | 489 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); |
490 | |||
491 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
492 | return ret; | ||
496 | } | 493 | } |
497 | 494 | ||
498 | int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, | 495 | /** |
499 | u16 cmd_action, void *pdata_buf) | 496 | * @brief Reset/clear the mesh blinding table |
497 | * | ||
498 | * @param priv A pointer to struct lbs_private structure | ||
499 | * | ||
500 | * @return 0 on success, error on failure | ||
501 | */ | ||
502 | int lbs_mesh_bt_reset(struct lbs_private *priv) | ||
500 | { | 503 | { |
501 | struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; | 504 | struct cmd_ds_bt_access cmd; |
502 | lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); | 505 | int ret = 0; |
503 | 506 | ||
504 | cmd->command = cpu_to_le16(CMD_FWT_ACCESS); | 507 | lbs_deb_enter(LBS_DEB_CMD); |
505 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + | ||
506 | sizeof(struct cmd_header)); | ||
507 | cmd->result = 0; | ||
508 | 508 | ||
509 | if (pdata_buf) | 509 | memset(&cmd, 0, sizeof(cmd)); |
510 | memcpy(fwt_access, pdata_buf, sizeof(*fwt_access)); | 510 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
511 | else | 511 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_RESET); |
512 | memset(fwt_access, 0, sizeof(*fwt_access)); | ||
513 | 512 | ||
514 | fwt_access->action = cpu_to_le16(cmd_action); | 513 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); |
515 | 514 | ||
516 | lbs_deb_leave(LBS_DEB_CMD); | 515 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
516 | return ret; | ||
517 | } | ||
518 | |||
519 | /** | ||
520 | * @brief Gets the inverted status of the mesh blinding table | ||
521 | * | ||
522 | * Normally the firmware "blinds" or ignores traffic from mesh nodes in the | ||
523 | * table, but an inverted table allows *only* traffic from nodes listed in | ||
524 | * the table. | ||
525 | * | ||
526 | * @param priv A pointer to struct lbs_private structure | ||
527 | * @param invert On success, TRUE if the blinding table is inverted, | ||
528 | * FALSE if it is not inverted | ||
529 | * | ||
530 | * @return 0 on success, error on failure | ||
531 | */ | ||
532 | int lbs_mesh_bt_get_inverted(struct lbs_private *priv, bool *inverted) | ||
533 | { | ||
534 | struct cmd_ds_bt_access cmd; | ||
535 | int ret = 0; | ||
536 | |||
537 | lbs_deb_enter(LBS_DEB_CMD); | ||
538 | |||
539 | BUG_ON(inverted == NULL); | ||
540 | |||
541 | memset(&cmd, 0, sizeof(cmd)); | ||
542 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
543 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_GET_INVERT); | ||
544 | |||
545 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); | ||
546 | if (ret == 0) | ||
547 | *inverted = !!cmd.id; | ||
548 | |||
549 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
550 | return ret; | ||
551 | } | ||
552 | |||
553 | /** | ||
554 | * @brief Sets the inverted status of the mesh blinding table | ||
555 | * | ||
556 | * Normally the firmware "blinds" or ignores traffic from mesh nodes in the | ||
557 | * table, but an inverted table allows *only* traffic from nodes listed in | ||
558 | * the table. | ||
559 | * | ||
560 | * @param priv A pointer to struct lbs_private structure | ||
561 | * @param invert TRUE to invert the blinding table (only traffic from | ||
562 | * listed nodes allowed), FALSE to return it | ||
563 | * to normal state (listed nodes ignored) | ||
564 | * | ||
565 | * @return 0 on success, error on failure | ||
566 | */ | ||
567 | int lbs_mesh_bt_set_inverted(struct lbs_private *priv, bool inverted) | ||
568 | { | ||
569 | struct cmd_ds_bt_access cmd; | ||
570 | int ret = 0; | ||
571 | |||
572 | lbs_deb_enter(LBS_DEB_CMD); | ||
573 | |||
574 | memset(&cmd, 0, sizeof(cmd)); | ||
575 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
576 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_SET_INVERT); | ||
577 | cmd.id = !!inverted; | ||
578 | |||
579 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); | ||
580 | |||
581 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
582 | return ret; | ||
583 | } | ||
584 | |||
585 | /** | ||
586 | * @brief List an entry in the mesh blinding table | ||
587 | * | ||
588 | * @param priv A pointer to struct lbs_private structure | ||
589 | * @param id The ID of the entry to list | ||
590 | * @param addr1 MAC address associated with the table entry | ||
591 | * | ||
592 | * @return 0 on success, error on failure | ||
593 | */ | ||
594 | int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1) | ||
595 | { | ||
596 | struct cmd_ds_bt_access cmd; | ||
597 | int ret = 0; | ||
598 | |||
599 | lbs_deb_enter(LBS_DEB_CMD); | ||
600 | |||
601 | BUG_ON(addr1 == NULL); | ||
602 | |||
603 | memset(&cmd, 0, sizeof(cmd)); | ||
604 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
605 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_SET_INVERT); | ||
606 | cmd.id = cpu_to_le32(id); | ||
607 | |||
608 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); | ||
609 | if (ret == 0) | ||
610 | memcpy(addr1, cmd.addr1, sizeof(cmd.addr1)); | ||
611 | |||
612 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
613 | return ret; | ||
614 | } | ||
615 | |||
616 | /** | ||
617 | * @brief Access the mesh forwarding table | ||
618 | * | ||
619 | * @param priv A pointer to struct lbs_private structure | ||
620 | * @param cmd_action The forwarding table action to perform | ||
621 | * @param cmd The pre-filled FWT_ACCESS command | ||
622 | * | ||
623 | * @return 0 on success and 'cmd' will be filled with the | ||
624 | * firmware's response | ||
625 | */ | ||
626 | int lbs_cmd_fwt_access(struct lbs_private *priv, u16 cmd_action, | ||
627 | struct cmd_ds_fwt_access *cmd) | ||
628 | { | ||
629 | int ret; | ||
630 | |||
631 | lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); | ||
632 | |||
633 | cmd->hdr.command = cpu_to_le16(CMD_FWT_ACCESS); | ||
634 | cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access)); | ||
635 | cmd->hdr.result = 0; | ||
636 | cmd->action = cpu_to_le16(cmd_action); | ||
637 | |||
638 | ret = lbs_cmd_with_response(priv, CMD_FWT_ACCESS, cmd); | ||
639 | |||
640 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
517 | return 0; | 641 | return 0; |
518 | } | 642 | } |
519 | 643 | ||
diff --git a/drivers/net/wireless/libertas/mesh.h b/drivers/net/wireless/libertas/mesh.h index 84ea2481ff20..afb2e8dead3f 100644 --- a/drivers/net/wireless/libertas/mesh.h +++ b/drivers/net/wireless/libertas/mesh.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <net/iw_handler.h> | 8 | #include <net/iw_handler.h> |
9 | #include <net/lib80211.h> | 9 | #include <net/lib80211.h> |
10 | 10 | ||
11 | #include "host.h" | ||
11 | 12 | ||
12 | #ifdef CONFIG_LIBERTAS_MESH | 13 | #ifdef CONFIG_LIBERTAS_MESH |
13 | 14 | ||
@@ -51,10 +52,15 @@ struct cmd_ds_command; | |||
51 | struct cmd_ds_mesh_access; | 52 | struct cmd_ds_mesh_access; |
52 | struct cmd_ds_mesh_config; | 53 | struct cmd_ds_mesh_config; |
53 | 54 | ||
54 | int lbs_cmd_bt_access(struct cmd_ds_command *cmd, | 55 | int lbs_mesh_bt_add_del(struct lbs_private *priv, bool add, u8 *addr1); |
55 | u16 cmd_action, void *pdata_buf); | 56 | int lbs_mesh_bt_reset(struct lbs_private *priv); |
56 | int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, | 57 | int lbs_mesh_bt_get_inverted(struct lbs_private *priv, bool *inverted); |
57 | u16 cmd_action, void *pdata_buf); | 58 | int lbs_mesh_bt_set_inverted(struct lbs_private *priv, bool inverted); |
59 | int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1); | ||
60 | |||
61 | int lbs_cmd_fwt_access(struct lbs_private *priv, u16 cmd_action, | ||
62 | struct cmd_ds_fwt_access *cmd); | ||
63 | |||
58 | int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, | 64 | int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, |
59 | struct cmd_ds_mesh_access *cmd); | 65 | struct cmd_ds_mesh_access *cmd); |
60 | int lbs_mesh_config_send(struct lbs_private *priv, | 66 | int lbs_mesh_config_send(struct lbs_private *priv, |
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 411a3bbf035e..8000ca6165d0 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c | |||
@@ -180,7 +180,7 @@ void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count) | |||
180 | { | 180 | { |
181 | struct tx_radiotap_hdr *radiotap_hdr; | 181 | struct tx_radiotap_hdr *radiotap_hdr; |
182 | 182 | ||
183 | if (!priv->wdev->iftype == NL80211_IFTYPE_MONITOR || | 183 | if (priv->wdev->iftype != NL80211_IFTYPE_MONITOR || |
184 | priv->currenttxskb == NULL) | 184 | priv->currenttxskb == NULL) |
185 | return; | 185 | return; |
186 | 186 | ||
diff --git a/drivers/net/wireless/libertas_tf/libertas_tf.h b/drivers/net/wireless/libertas_tf/libertas_tf.h index 737eac92ef72..ad77b92d0b41 100644 --- a/drivers/net/wireless/libertas_tf/libertas_tf.h +++ b/drivers/net/wireless/libertas_tf/libertas_tf.h | |||
@@ -253,6 +253,9 @@ struct lbtf_private { | |||
253 | u8 fw_ready; | 253 | u8 fw_ready; |
254 | u8 surpriseremoved; | 254 | u8 surpriseremoved; |
255 | struct sk_buff_head bc_ps_buf; | 255 | struct sk_buff_head bc_ps_buf; |
256 | |||
257 | /* Most recently reported noise in dBm */ | ||
258 | s8 noise; | ||
256 | }; | 259 | }; |
257 | 260 | ||
258 | /* 802.11-related definitions */ | 261 | /* 802.11-related definitions */ |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index 817fffc0de4b..9278b3c8ee30 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -525,6 +525,22 @@ static void lbtf_op_bss_info_changed(struct ieee80211_hw *hw, | |||
525 | lbtf_deb_leave(LBTF_DEB_MACOPS); | 525 | lbtf_deb_leave(LBTF_DEB_MACOPS); |
526 | } | 526 | } |
527 | 527 | ||
528 | static int lbtf_op_get_survey(struct ieee80211_hw *hw, int idx, | ||
529 | struct survey_info *survey) | ||
530 | { | ||
531 | struct lbtf_private *priv = hw->priv; | ||
532 | struct ieee80211_conf *conf = &hw->conf; | ||
533 | |||
534 | if (idx != 0) | ||
535 | return -ENOENT; | ||
536 | |||
537 | survey->channel = conf->channel; | ||
538 | survey->filled = SURVEY_INFO_NOISE_DBM; | ||
539 | survey->noise = priv->noise; | ||
540 | |||
541 | return 0; | ||
542 | } | ||
543 | |||
528 | static const struct ieee80211_ops lbtf_ops = { | 544 | static const struct ieee80211_ops lbtf_ops = { |
529 | .tx = lbtf_op_tx, | 545 | .tx = lbtf_op_tx, |
530 | .start = lbtf_op_start, | 546 | .start = lbtf_op_start, |
@@ -535,6 +551,7 @@ static const struct ieee80211_ops lbtf_ops = { | |||
535 | .prepare_multicast = lbtf_op_prepare_multicast, | 551 | .prepare_multicast = lbtf_op_prepare_multicast, |
536 | .configure_filter = lbtf_op_configure_filter, | 552 | .configure_filter = lbtf_op_configure_filter, |
537 | .bss_info_changed = lbtf_op_bss_info_changed, | 553 | .bss_info_changed = lbtf_op_bss_info_changed, |
554 | .get_survey = lbtf_op_get_survey, | ||
538 | }; | 555 | }; |
539 | 556 | ||
540 | int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | 557 | int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) |
@@ -555,6 +572,7 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | |||
555 | stats.freq = priv->cur_freq; | 572 | stats.freq = priv->cur_freq; |
556 | stats.band = IEEE80211_BAND_2GHZ; | 573 | stats.band = IEEE80211_BAND_2GHZ; |
557 | stats.signal = prxpd->snr; | 574 | stats.signal = prxpd->snr; |
575 | priv->noise = prxpd->nf; | ||
558 | /* Marvell rate index has a hole at value 4 */ | 576 | /* Marvell rate index has a hole at value 4 */ |
559 | if (prxpd->rx_rate > 4) | 577 | if (prxpd->rx_rate > 4) |
560 | --prxpd->rx_rate; | 578 | --prxpd->rx_rate; |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index e7f299dc9ef5..01ad7f77383a 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -486,8 +486,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
486 | struct ieee80211_rx_status rx_status; | 486 | struct ieee80211_rx_status rx_status; |
487 | 487 | ||
488 | if (data->idle) { | 488 | if (data->idle) { |
489 | printk(KERN_DEBUG "%s: Trying to TX when idle - reject\n", | 489 | wiphy_debug(hw->wiphy, "trying to tx when idle - reject\n"); |
490 | wiphy_name(hw->wiphy)); | ||
491 | return false; | 490 | return false; |
492 | } | 491 | } |
493 | 492 | ||
@@ -576,7 +575,7 @@ static int mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
576 | static int mac80211_hwsim_start(struct ieee80211_hw *hw) | 575 | static int mac80211_hwsim_start(struct ieee80211_hw *hw) |
577 | { | 576 | { |
578 | struct mac80211_hwsim_data *data = hw->priv; | 577 | struct mac80211_hwsim_data *data = hw->priv; |
579 | printk(KERN_DEBUG "%s:%s\n", wiphy_name(hw->wiphy), __func__); | 578 | wiphy_debug(hw->wiphy, "%s\n", __func__); |
580 | data->started = 1; | 579 | data->started = 1; |
581 | return 0; | 580 | return 0; |
582 | } | 581 | } |
@@ -587,16 +586,15 @@ static void mac80211_hwsim_stop(struct ieee80211_hw *hw) | |||
587 | struct mac80211_hwsim_data *data = hw->priv; | 586 | struct mac80211_hwsim_data *data = hw->priv; |
588 | data->started = 0; | 587 | data->started = 0; |
589 | del_timer(&data->beacon_timer); | 588 | del_timer(&data->beacon_timer); |
590 | printk(KERN_DEBUG "%s:%s\n", wiphy_name(hw->wiphy), __func__); | 589 | wiphy_debug(hw->wiphy, "%s\n", __func__); |
591 | } | 590 | } |
592 | 591 | ||
593 | 592 | ||
594 | static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw, | 593 | static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw, |
595 | struct ieee80211_vif *vif) | 594 | struct ieee80211_vif *vif) |
596 | { | 595 | { |
597 | printk(KERN_DEBUG "%s:%s (type=%d mac_addr=%pM)\n", | 596 | wiphy_debug(hw->wiphy, "%s (type=%d mac_addr=%pM)\n", |
598 | wiphy_name(hw->wiphy), __func__, vif->type, | 597 | __func__, vif->type, vif->addr); |
599 | vif->addr); | ||
600 | hwsim_set_magic(vif); | 598 | hwsim_set_magic(vif); |
601 | return 0; | 599 | return 0; |
602 | } | 600 | } |
@@ -605,9 +603,8 @@ static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw, | |||
605 | static void mac80211_hwsim_remove_interface( | 603 | static void mac80211_hwsim_remove_interface( |
606 | struct ieee80211_hw *hw, struct ieee80211_vif *vif) | 604 | struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
607 | { | 605 | { |
608 | printk(KERN_DEBUG "%s:%s (type=%d mac_addr=%pM)\n", | 606 | wiphy_debug(hw->wiphy, "%s (type=%d mac_addr=%pM)\n", |
609 | wiphy_name(hw->wiphy), __func__, vif->type, | 607 | __func__, vif->type, vif->addr); |
610 | vif->addr); | ||
611 | hwsim_check_magic(vif); | 608 | hwsim_check_magic(vif); |
612 | hwsim_clear_magic(vif); | 609 | hwsim_clear_magic(vif); |
613 | } | 610 | } |
@@ -670,13 +667,14 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) | |||
670 | [IEEE80211_SMPS_DYNAMIC] = "dynamic", | 667 | [IEEE80211_SMPS_DYNAMIC] = "dynamic", |
671 | }; | 668 | }; |
672 | 669 | ||
673 | printk(KERN_DEBUG "%s:%s (freq=%d/%s idle=%d ps=%d smps=%s)\n", | 670 | wiphy_debug(hw->wiphy, |
674 | wiphy_name(hw->wiphy), __func__, | 671 | "%s (freq=%d/%s idle=%d ps=%d smps=%s)\n", |
675 | conf->channel->center_freq, | 672 | __func__, |
676 | hwsim_chantypes[conf->channel_type], | 673 | conf->channel->center_freq, |
677 | !!(conf->flags & IEEE80211_CONF_IDLE), | 674 | hwsim_chantypes[conf->channel_type], |
678 | !!(conf->flags & IEEE80211_CONF_PS), | 675 | !!(conf->flags & IEEE80211_CONF_IDLE), |
679 | smps_modes[conf->smps_mode]); | 676 | !!(conf->flags & IEEE80211_CONF_PS), |
677 | smps_modes[conf->smps_mode]); | ||
680 | 678 | ||
681 | data->idle = !!(conf->flags & IEEE80211_CONF_IDLE); | 679 | data->idle = !!(conf->flags & IEEE80211_CONF_IDLE); |
682 | 680 | ||
@@ -696,7 +694,7 @@ static void mac80211_hwsim_configure_filter(struct ieee80211_hw *hw, | |||
696 | { | 694 | { |
697 | struct mac80211_hwsim_data *data = hw->priv; | 695 | struct mac80211_hwsim_data *data = hw->priv; |
698 | 696 | ||
699 | printk(KERN_DEBUG "%s:%s\n", wiphy_name(hw->wiphy), __func__); | 697 | wiphy_debug(hw->wiphy, "%s\n", __func__); |
700 | 698 | ||
701 | data->rx_filter = 0; | 699 | data->rx_filter = 0; |
702 | if (*total_flags & FIF_PROMISC_IN_BSS) | 700 | if (*total_flags & FIF_PROMISC_IN_BSS) |
@@ -717,26 +715,23 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | |||
717 | 715 | ||
718 | hwsim_check_magic(vif); | 716 | hwsim_check_magic(vif); |
719 | 717 | ||
720 | printk(KERN_DEBUG "%s:%s(changed=0x%x)\n", | 718 | wiphy_debug(hw->wiphy, "%s(changed=0x%x)\n", __func__, changed); |
721 | wiphy_name(hw->wiphy), __func__, changed); | ||
722 | 719 | ||
723 | if (changed & BSS_CHANGED_BSSID) { | 720 | if (changed & BSS_CHANGED_BSSID) { |
724 | printk(KERN_DEBUG "%s:%s: BSSID changed: %pM\n", | 721 | wiphy_debug(hw->wiphy, "%s: BSSID changed: %pM\n", |
725 | wiphy_name(hw->wiphy), __func__, | 722 | __func__, info->bssid); |
726 | info->bssid); | ||
727 | memcpy(vp->bssid, info->bssid, ETH_ALEN); | 723 | memcpy(vp->bssid, info->bssid, ETH_ALEN); |
728 | } | 724 | } |
729 | 725 | ||
730 | if (changed & BSS_CHANGED_ASSOC) { | 726 | if (changed & BSS_CHANGED_ASSOC) { |
731 | printk(KERN_DEBUG " %s: ASSOC: assoc=%d aid=%d\n", | 727 | wiphy_debug(hw->wiphy, " ASSOC: assoc=%d aid=%d\n", |
732 | wiphy_name(hw->wiphy), info->assoc, info->aid); | 728 | info->assoc, info->aid); |
733 | vp->assoc = info->assoc; | 729 | vp->assoc = info->assoc; |
734 | vp->aid = info->aid; | 730 | vp->aid = info->aid; |
735 | } | 731 | } |
736 | 732 | ||
737 | if (changed & BSS_CHANGED_BEACON_INT) { | 733 | if (changed & BSS_CHANGED_BEACON_INT) { |
738 | printk(KERN_DEBUG " %s: BCNINT: %d\n", | 734 | wiphy_debug(hw->wiphy, " BCNINT: %d\n", info->beacon_int); |
739 | wiphy_name(hw->wiphy), info->beacon_int); | ||
740 | data->beacon_int = 1024 * info->beacon_int / 1000 * HZ / 1000; | 735 | data->beacon_int = 1024 * info->beacon_int / 1000 * HZ / 1000; |
741 | if (WARN_ON(!data->beacon_int)) | 736 | if (WARN_ON(!data->beacon_int)) |
742 | data->beacon_int = 1; | 737 | data->beacon_int = 1; |
@@ -746,31 +741,28 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | |||
746 | } | 741 | } |
747 | 742 | ||
748 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { | 743 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { |
749 | printk(KERN_DEBUG " %s: ERP_CTS_PROT: %d\n", | 744 | wiphy_debug(hw->wiphy, " ERP_CTS_PROT: %d\n", |
750 | wiphy_name(hw->wiphy), info->use_cts_prot); | 745 | info->use_cts_prot); |
751 | } | 746 | } |
752 | 747 | ||
753 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { | 748 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { |
754 | printk(KERN_DEBUG " %s: ERP_PREAMBLE: %d\n", | 749 | wiphy_debug(hw->wiphy, " ERP_PREAMBLE: %d\n", |
755 | wiphy_name(hw->wiphy), info->use_short_preamble); | 750 | info->use_short_preamble); |
756 | } | 751 | } |
757 | 752 | ||
758 | if (changed & BSS_CHANGED_ERP_SLOT) { | 753 | if (changed & BSS_CHANGED_ERP_SLOT) { |
759 | printk(KERN_DEBUG " %s: ERP_SLOT: %d\n", | 754 | wiphy_debug(hw->wiphy, " ERP_SLOT: %d\n", info->use_short_slot); |
760 | wiphy_name(hw->wiphy), info->use_short_slot); | ||
761 | } | 755 | } |
762 | 756 | ||
763 | if (changed & BSS_CHANGED_HT) { | 757 | if (changed & BSS_CHANGED_HT) { |
764 | printk(KERN_DEBUG " %s: HT: op_mode=0x%x, chantype=%s\n", | 758 | wiphy_debug(hw->wiphy, " HT: op_mode=0x%x, chantype=%s\n", |
765 | wiphy_name(hw->wiphy), | 759 | info->ht_operation_mode, |
766 | info->ht_operation_mode, | 760 | hwsim_chantypes[info->channel_type]); |
767 | hwsim_chantypes[info->channel_type]); | ||
768 | } | 761 | } |
769 | 762 | ||
770 | if (changed & BSS_CHANGED_BASIC_RATES) { | 763 | if (changed & BSS_CHANGED_BASIC_RATES) { |
771 | printk(KERN_DEBUG " %s: BASIC_RATES: 0x%llx\n", | 764 | wiphy_debug(hw->wiphy, " BASIC_RATES: 0x%llx\n", |
772 | wiphy_name(hw->wiphy), | 765 | (unsigned long long) info->basic_rates); |
773 | (unsigned long long) info->basic_rates); | ||
774 | } | 766 | } |
775 | } | 767 | } |
776 | 768 | ||
@@ -824,10 +816,11 @@ static int mac80211_hwsim_conf_tx( | |||
824 | struct ieee80211_hw *hw, u16 queue, | 816 | struct ieee80211_hw *hw, u16 queue, |
825 | const struct ieee80211_tx_queue_params *params) | 817 | const struct ieee80211_tx_queue_params *params) |
826 | { | 818 | { |
827 | printk(KERN_DEBUG "%s:%s (queue=%d txop=%d cw_min=%d cw_max=%d " | 819 | wiphy_debug(hw->wiphy, |
828 | "aifs=%d)\n", | 820 | "%s (queue=%d txop=%d cw_min=%d cw_max=%d aifs=%d)\n", |
829 | wiphy_name(hw->wiphy), __func__, queue, | 821 | __func__, queue, |
830 | params->txop, params->cw_min, params->cw_max, params->aifs); | 822 | params->txop, params->cw_min, |
823 | params->cw_max, params->aifs); | ||
831 | return 0; | 824 | return 0; |
832 | } | 825 | } |
833 | 826 | ||
@@ -837,8 +830,7 @@ static int mac80211_hwsim_get_survey( | |||
837 | { | 830 | { |
838 | struct ieee80211_conf *conf = &hw->conf; | 831 | struct ieee80211_conf *conf = &hw->conf; |
839 | 832 | ||
840 | printk(KERN_DEBUG "%s:%s (idx=%d)\n", | 833 | wiphy_debug(hw->wiphy, "%s (idx=%d)\n", __func__, idx); |
841 | wiphy_name(hw->wiphy), __func__, idx); | ||
842 | 834 | ||
843 | if (idx != 0) | 835 | if (idx != 0) |
844 | return -ENOENT; | 836 | return -ENOENT; |
@@ -1108,8 +1100,9 @@ static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif) | |||
1108 | if (!vp->assoc) | 1100 | if (!vp->assoc) |
1109 | return; | 1101 | return; |
1110 | 1102 | ||
1111 | printk(KERN_DEBUG "%s:%s: send PS-Poll to %pM for aid %d\n", | 1103 | wiphy_debug(data->hw->wiphy, |
1112 | wiphy_name(data->hw->wiphy), __func__, vp->bssid, vp->aid); | 1104 | "%s: send PS-Poll to %pM for aid %d\n", |
1105 | __func__, vp->bssid, vp->aid); | ||
1113 | 1106 | ||
1114 | skb = dev_alloc_skb(sizeof(*pspoll)); | 1107 | skb = dev_alloc_skb(sizeof(*pspoll)); |
1115 | if (!skb) | 1108 | if (!skb) |
@@ -1137,8 +1130,9 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac, | |||
1137 | if (!vp->assoc) | 1130 | if (!vp->assoc) |
1138 | return; | 1131 | return; |
1139 | 1132 | ||
1140 | printk(KERN_DEBUG "%s:%s: send data::nullfunc to %pM ps=%d\n", | 1133 | wiphy_debug(data->hw->wiphy, |
1141 | wiphy_name(data->hw->wiphy), __func__, vp->bssid, ps); | 1134 | "%s: send data::nullfunc to %pM ps=%d\n", |
1135 | __func__, vp->bssid, ps); | ||
1142 | 1136 | ||
1143 | skb = dev_alloc_skb(sizeof(*hdr)); | 1137 | skb = dev_alloc_skb(sizeof(*hdr)); |
1144 | if (!skb) | 1138 | if (!skb) |
@@ -1473,9 +1467,8 @@ static int __init init_mac80211_hwsim(void) | |||
1473 | break; | 1467 | break; |
1474 | } | 1468 | } |
1475 | 1469 | ||
1476 | printk(KERN_DEBUG "%s: hwaddr %pM registered\n", | 1470 | wiphy_debug(hw->wiphy, "hwaddr %pm registered\n", |
1477 | wiphy_name(hw->wiphy), | 1471 | hw->wiphy->perm_addr); |
1478 | hw->wiphy->perm_addr); | ||
1479 | 1472 | ||
1480 | data->debugfs = debugfs_create_dir("hwsim", | 1473 | data->debugfs = debugfs_create_dir("hwsim", |
1481 | hw->wiphy->debugfsdir); | 1474 | hw->wiphy->debugfsdir); |
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 0e34260b22b1..d761ed2d8af4 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -86,7 +86,7 @@ struct rxd_ops { | |||
86 | void (*rxd_init)(void *rxd, dma_addr_t next_dma_addr); | 86 | void (*rxd_init)(void *rxd, dma_addr_t next_dma_addr); |
87 | void (*rxd_refill)(void *rxd, dma_addr_t addr, int len); | 87 | void (*rxd_refill)(void *rxd, dma_addr_t addr, int len); |
88 | int (*rxd_process)(void *rxd, struct ieee80211_rx_status *status, | 88 | int (*rxd_process)(void *rxd, struct ieee80211_rx_status *status, |
89 | __le16 *qos); | 89 | __le16 *qos, s8 *noise); |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct mwl8k_device_info { | 92 | struct mwl8k_device_info { |
@@ -207,6 +207,9 @@ struct mwl8k_priv { | |||
207 | 207 | ||
208 | /* Tasklet to perform RX. */ | 208 | /* Tasklet to perform RX. */ |
209 | struct tasklet_struct poll_rx_task; | 209 | struct tasklet_struct poll_rx_task; |
210 | |||
211 | /* Most recently reported noise in dBm */ | ||
212 | s8 noise; | ||
210 | }; | 213 | }; |
211 | 214 | ||
212 | /* Per interface specific private data */ | 215 | /* Per interface specific private data */ |
@@ -741,7 +744,7 @@ static void mwl8k_rxd_8366_ap_refill(void *_rxd, dma_addr_t addr, int len) | |||
741 | 744 | ||
742 | static int | 745 | static int |
743 | mwl8k_rxd_8366_ap_process(void *_rxd, struct ieee80211_rx_status *status, | 746 | mwl8k_rxd_8366_ap_process(void *_rxd, struct ieee80211_rx_status *status, |
744 | __le16 *qos) | 747 | __le16 *qos, s8 *noise) |
745 | { | 748 | { |
746 | struct mwl8k_rxd_8366_ap *rxd = _rxd; | 749 | struct mwl8k_rxd_8366_ap *rxd = _rxd; |
747 | 750 | ||
@@ -752,6 +755,7 @@ mwl8k_rxd_8366_ap_process(void *_rxd, struct ieee80211_rx_status *status, | |||
752 | memset(status, 0, sizeof(*status)); | 755 | memset(status, 0, sizeof(*status)); |
753 | 756 | ||
754 | status->signal = -rxd->rssi; | 757 | status->signal = -rxd->rssi; |
758 | *noise = -rxd->noise_floor; | ||
755 | 759 | ||
756 | if (rxd->rate & MWL8K_8366_AP_RATE_INFO_MCS_FORMAT) { | 760 | if (rxd->rate & MWL8K_8366_AP_RATE_INFO_MCS_FORMAT) { |
757 | status->flag |= RX_FLAG_HT; | 761 | status->flag |= RX_FLAG_HT; |
@@ -839,7 +843,7 @@ static void mwl8k_rxd_sta_refill(void *_rxd, dma_addr_t addr, int len) | |||
839 | 843 | ||
840 | static int | 844 | static int |
841 | mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status, | 845 | mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status, |
842 | __le16 *qos) | 846 | __le16 *qos, s8 *noise) |
843 | { | 847 | { |
844 | struct mwl8k_rxd_sta *rxd = _rxd; | 848 | struct mwl8k_rxd_sta *rxd = _rxd; |
845 | u16 rate_info; | 849 | u16 rate_info; |
@@ -853,6 +857,7 @@ mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status, | |||
853 | memset(status, 0, sizeof(*status)); | 857 | memset(status, 0, sizeof(*status)); |
854 | 858 | ||
855 | status->signal = -rxd->rssi; | 859 | status->signal = -rxd->rssi; |
860 | *noise = -rxd->noise_level; | ||
856 | status->antenna = MWL8K_STA_RATE_INFO_ANTSELECT(rate_info); | 861 | status->antenna = MWL8K_STA_RATE_INFO_ANTSELECT(rate_info); |
857 | status->rate_idx = MWL8K_STA_RATE_INFO_RATEID(rate_info); | 862 | status->rate_idx = MWL8K_STA_RATE_INFO_RATEID(rate_info); |
858 | 863 | ||
@@ -905,16 +910,14 @@ static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index) | |||
905 | 910 | ||
906 | rxq->rxd = pci_alloc_consistent(priv->pdev, size, &rxq->rxd_dma); | 911 | rxq->rxd = pci_alloc_consistent(priv->pdev, size, &rxq->rxd_dma); |
907 | if (rxq->rxd == NULL) { | 912 | if (rxq->rxd == NULL) { |
908 | printk(KERN_ERR "%s: failed to alloc RX descriptors\n", | 913 | wiphy_err(hw->wiphy, "failed to alloc rx descriptors\n"); |
909 | wiphy_name(hw->wiphy)); | ||
910 | return -ENOMEM; | 914 | return -ENOMEM; |
911 | } | 915 | } |
912 | memset(rxq->rxd, 0, size); | 916 | memset(rxq->rxd, 0, size); |
913 | 917 | ||
914 | rxq->buf = kmalloc(MWL8K_RX_DESCS * sizeof(*rxq->buf), GFP_KERNEL); | 918 | rxq->buf = kmalloc(MWL8K_RX_DESCS * sizeof(*rxq->buf), GFP_KERNEL); |
915 | if (rxq->buf == NULL) { | 919 | if (rxq->buf == NULL) { |
916 | printk(KERN_ERR "%s: failed to alloc RX skbuff list\n", | 920 | wiphy_err(hw->wiphy, "failed to alloc rx skbuff list\n"); |
917 | wiphy_name(hw->wiphy)); | ||
918 | pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma); | 921 | pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma); |
919 | return -ENOMEM; | 922 | return -ENOMEM; |
920 | } | 923 | } |
@@ -1055,7 +1058,8 @@ static int rxq_process(struct ieee80211_hw *hw, int index, int limit) | |||
1055 | 1058 | ||
1056 | rxd = rxq->rxd + (rxq->head * priv->rxd_ops->rxd_size); | 1059 | rxd = rxq->rxd + (rxq->head * priv->rxd_ops->rxd_size); |
1057 | 1060 | ||
1058 | pkt_len = priv->rxd_ops->rxd_process(rxd, &status, &qos); | 1061 | pkt_len = priv->rxd_ops->rxd_process(rxd, &status, &qos, |
1062 | &priv->noise); | ||
1059 | if (pkt_len < 0) | 1063 | if (pkt_len < 0) |
1060 | break; | 1064 | break; |
1061 | 1065 | ||
@@ -1141,16 +1145,14 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index) | |||
1141 | 1145 | ||
1142 | txq->txd = pci_alloc_consistent(priv->pdev, size, &txq->txd_dma); | 1146 | txq->txd = pci_alloc_consistent(priv->pdev, size, &txq->txd_dma); |
1143 | if (txq->txd == NULL) { | 1147 | if (txq->txd == NULL) { |
1144 | printk(KERN_ERR "%s: failed to alloc TX descriptors\n", | 1148 | wiphy_err(hw->wiphy, "failed to alloc tx descriptors\n"); |
1145 | wiphy_name(hw->wiphy)); | ||
1146 | return -ENOMEM; | 1149 | return -ENOMEM; |
1147 | } | 1150 | } |
1148 | memset(txq->txd, 0, size); | 1151 | memset(txq->txd, 0, size); |
1149 | 1152 | ||
1150 | txq->skb = kmalloc(MWL8K_TX_DESCS * sizeof(*txq->skb), GFP_KERNEL); | 1153 | txq->skb = kmalloc(MWL8K_TX_DESCS * sizeof(*txq->skb), GFP_KERNEL); |
1151 | if (txq->skb == NULL) { | 1154 | if (txq->skb == NULL) { |
1152 | printk(KERN_ERR "%s: failed to alloc TX skbuff list\n", | 1155 | wiphy_err(hw->wiphy, "failed to alloc tx skbuff list\n"); |
1153 | wiphy_name(hw->wiphy)); | ||
1154 | pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); | 1156 | pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); |
1155 | return -ENOMEM; | 1157 | return -ENOMEM; |
1156 | } | 1158 | } |
@@ -1206,11 +1208,12 @@ static void mwl8k_dump_tx_rings(struct ieee80211_hw *hw) | |||
1206 | unused++; | 1208 | unused++; |
1207 | } | 1209 | } |
1208 | 1210 | ||
1209 | printk(KERN_ERR "%s: txq[%d] len=%d head=%d tail=%d " | 1211 | wiphy_err(hw->wiphy, |
1210 | "fw_owned=%d drv_owned=%d unused=%d\n", | 1212 | "txq[%d] len=%d head=%d tail=%d " |
1211 | wiphy_name(hw->wiphy), i, | 1213 | "fw_owned=%d drv_owned=%d unused=%d\n", |
1212 | txq->len, txq->head, txq->tail, | 1214 | i, |
1213 | fw_owned, drv_owned, unused); | 1215 | txq->len, txq->head, txq->tail, |
1216 | fw_owned, drv_owned, unused); | ||
1214 | } | 1217 | } |
1215 | } | 1218 | } |
1216 | 1219 | ||
@@ -1254,25 +1257,23 @@ static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw) | |||
1254 | if (timeout) { | 1257 | if (timeout) { |
1255 | WARN_ON(priv->pending_tx_pkts); | 1258 | WARN_ON(priv->pending_tx_pkts); |
1256 | if (retry) { | 1259 | if (retry) { |
1257 | printk(KERN_NOTICE "%s: tx rings drained\n", | 1260 | wiphy_notice(hw->wiphy, "tx rings drained\n"); |
1258 | wiphy_name(hw->wiphy)); | ||
1259 | } | 1261 | } |
1260 | break; | 1262 | break; |
1261 | } | 1263 | } |
1262 | 1264 | ||
1263 | if (priv->pending_tx_pkts < oldcount) { | 1265 | if (priv->pending_tx_pkts < oldcount) { |
1264 | printk(KERN_NOTICE "%s: waiting for tx rings " | 1266 | wiphy_notice(hw->wiphy, |
1265 | "to drain (%d -> %d pkts)\n", | 1267 | "waiting for tx rings to drain (%d -> %d pkts)\n", |
1266 | wiphy_name(hw->wiphy), oldcount, | 1268 | oldcount, priv->pending_tx_pkts); |
1267 | priv->pending_tx_pkts); | ||
1268 | retry = 1; | 1269 | retry = 1; |
1269 | continue; | 1270 | continue; |
1270 | } | 1271 | } |
1271 | 1272 | ||
1272 | priv->tx_wait = NULL; | 1273 | priv->tx_wait = NULL; |
1273 | 1274 | ||
1274 | printk(KERN_ERR "%s: tx rings stuck for %d ms\n", | 1275 | wiphy_err(hw->wiphy, "tx rings stuck for %d ms\n", |
1275 | wiphy_name(hw->wiphy), MWL8K_TX_WAIT_TIMEOUT_MS); | 1276 | MWL8K_TX_WAIT_TIMEOUT_MS); |
1276 | mwl8k_dump_tx_rings(hw); | 1277 | mwl8k_dump_tx_rings(hw); |
1277 | 1278 | ||
1278 | rc = -ETIMEDOUT; | 1279 | rc = -ETIMEDOUT; |
@@ -1423,8 +1424,8 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) | |||
1423 | skb->len, PCI_DMA_TODEVICE); | 1424 | skb->len, PCI_DMA_TODEVICE); |
1424 | 1425 | ||
1425 | if (pci_dma_mapping_error(priv->pdev, dma)) { | 1426 | if (pci_dma_mapping_error(priv->pdev, dma)) { |
1426 | printk(KERN_DEBUG "%s: failed to dma map skb, " | 1427 | wiphy_debug(hw->wiphy, |
1427 | "dropping TX frame.\n", wiphy_name(hw->wiphy)); | 1428 | "failed to dma map skb, dropping TX frame.\n"); |
1428 | dev_kfree_skb(skb); | 1429 | dev_kfree_skb(skb); |
1429 | return NETDEV_TX_OK; | 1430 | return NETDEV_TX_OK; |
1430 | } | 1431 | } |
@@ -1572,10 +1573,9 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1572 | PCI_DMA_BIDIRECTIONAL); | 1573 | PCI_DMA_BIDIRECTIONAL); |
1573 | 1574 | ||
1574 | if (!timeout) { | 1575 | if (!timeout) { |
1575 | printk(KERN_ERR "%s: Command %s timeout after %u ms\n", | 1576 | wiphy_err(hw->wiphy, "command %s timeout after %u ms\n", |
1576 | wiphy_name(hw->wiphy), | 1577 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), |
1577 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), | 1578 | MWL8K_CMD_TIMEOUT_MS); |
1578 | MWL8K_CMD_TIMEOUT_MS); | ||
1579 | rc = -ETIMEDOUT; | 1579 | rc = -ETIMEDOUT; |
1580 | } else { | 1580 | } else { |
1581 | int ms; | 1581 | int ms; |
@@ -1584,15 +1584,14 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1584 | 1584 | ||
1585 | rc = cmd->result ? -EINVAL : 0; | 1585 | rc = cmd->result ? -EINVAL : 0; |
1586 | if (rc) | 1586 | if (rc) |
1587 | printk(KERN_ERR "%s: Command %s error 0x%x\n", | 1587 | wiphy_err(hw->wiphy, "command %s error 0x%x\n", |
1588 | wiphy_name(hw->wiphy), | 1588 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), |
1589 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), | 1589 | le16_to_cpu(cmd->result)); |
1590 | le16_to_cpu(cmd->result)); | ||
1591 | else if (ms > 2000) | 1590 | else if (ms > 2000) |
1592 | printk(KERN_NOTICE "%s: Command %s took %d ms\n", | 1591 | wiphy_notice(hw->wiphy, "command %s took %d ms\n", |
1593 | wiphy_name(hw->wiphy), | 1592 | mwl8k_cmd_name(cmd->code, |
1594 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), | 1593 | buf, sizeof(buf)), |
1595 | ms); | 1594 | ms); |
1596 | } | 1595 | } |
1597 | 1596 | ||
1598 | return rc; | 1597 | return rc; |
@@ -3192,8 +3191,8 @@ static int mwl8k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
3192 | int rc; | 3191 | int rc; |
3193 | 3192 | ||
3194 | if (!priv->radio_on) { | 3193 | if (!priv->radio_on) { |
3195 | printk(KERN_DEBUG "%s: dropped TX frame since radio " | 3194 | wiphy_debug(hw->wiphy, |
3196 | "disabled\n", wiphy_name(hw->wiphy)); | 3195 | "dropped TX frame since radio disabled\n"); |
3197 | dev_kfree_skb(skb); | 3196 | dev_kfree_skb(skb); |
3198 | return NETDEV_TX_OK; | 3197 | return NETDEV_TX_OK; |
3199 | } | 3198 | } |
@@ -3211,8 +3210,7 @@ static int mwl8k_start(struct ieee80211_hw *hw) | |||
3211 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, | 3210 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, |
3212 | IRQF_SHARED, MWL8K_NAME, hw); | 3211 | IRQF_SHARED, MWL8K_NAME, hw); |
3213 | if (rc) { | 3212 | if (rc) { |
3214 | printk(KERN_ERR "%s: failed to register IRQ handler\n", | 3213 | wiphy_err(hw->wiphy, "failed to register irq handler\n"); |
3215 | wiphy_name(hw->wiphy)); | ||
3216 | return -EIO; | 3214 | return -EIO; |
3217 | } | 3215 | } |
3218 | 3216 | ||
@@ -3299,9 +3297,8 @@ static int mwl8k_add_interface(struct ieee80211_hw *hw, | |||
3299 | * mode. (Sniffer mode is only used on STA firmware.) | 3297 | * mode. (Sniffer mode is only used on STA firmware.) |
3300 | */ | 3298 | */ |
3301 | if (priv->sniffer_enabled) { | 3299 | if (priv->sniffer_enabled) { |
3302 | printk(KERN_INFO "%s: unable to create STA " | 3300 | wiphy_info(hw->wiphy, |
3303 | "interface due to sniffer mode being enabled\n", | 3301 | "unable to create STA interface because sniffer mode is enabled\n"); |
3304 | wiphy_name(hw->wiphy)); | ||
3305 | return -EINVAL; | 3302 | return -EINVAL; |
3306 | } | 3303 | } |
3307 | 3304 | ||
@@ -3583,9 +3580,8 @@ mwl8k_configure_filter_sniffer(struct ieee80211_hw *hw, | |||
3583 | */ | 3580 | */ |
3584 | if (!list_empty(&priv->vif_list)) { | 3581 | if (!list_empty(&priv->vif_list)) { |
3585 | if (net_ratelimit()) | 3582 | if (net_ratelimit()) |
3586 | printk(KERN_INFO "%s: not enabling sniffer " | 3583 | wiphy_info(hw->wiphy, |
3587 | "mode because STA interface is active\n", | 3584 | "not enabling sniffer mode because STA interface is active\n"); |
3588 | wiphy_name(hw->wiphy)); | ||
3589 | return 0; | 3585 | return 0; |
3590 | } | 3586 | } |
3591 | 3587 | ||
@@ -3765,6 +3761,22 @@ static int mwl8k_get_stats(struct ieee80211_hw *hw, | |||
3765 | return mwl8k_cmd_get_stat(hw, stats); | 3761 | return mwl8k_cmd_get_stat(hw, stats); |
3766 | } | 3762 | } |
3767 | 3763 | ||
3764 | static int mwl8k_get_survey(struct ieee80211_hw *hw, int idx, | ||
3765 | struct survey_info *survey) | ||
3766 | { | ||
3767 | struct mwl8k_priv *priv = hw->priv; | ||
3768 | struct ieee80211_conf *conf = &hw->conf; | ||
3769 | |||
3770 | if (idx != 0) | ||
3771 | return -ENOENT; | ||
3772 | |||
3773 | survey->channel = conf->channel; | ||
3774 | survey->filled = SURVEY_INFO_NOISE_DBM; | ||
3775 | survey->noise = priv->noise; | ||
3776 | |||
3777 | return 0; | ||
3778 | } | ||
3779 | |||
3768 | static int | 3780 | static int |
3769 | mwl8k_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 3781 | mwl8k_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
3770 | enum ieee80211_ampdu_mlme_action action, | 3782 | enum ieee80211_ampdu_mlme_action action, |
@@ -3796,6 +3808,7 @@ static const struct ieee80211_ops mwl8k_ops = { | |||
3796 | .sta_remove = mwl8k_sta_remove, | 3808 | .sta_remove = mwl8k_sta_remove, |
3797 | .conf_tx = mwl8k_conf_tx, | 3809 | .conf_tx = mwl8k_conf_tx, |
3798 | .get_stats = mwl8k_get_stats, | 3810 | .get_stats = mwl8k_get_stats, |
3811 | .get_survey = mwl8k_get_survey, | ||
3799 | .ampdu_action = mwl8k_ampdu_action, | 3812 | .ampdu_action = mwl8k_ampdu_action, |
3800 | }; | 3813 | }; |
3801 | 3814 | ||
@@ -3913,8 +3926,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3913 | 3926 | ||
3914 | priv->sram = pci_iomap(pdev, 0, 0x10000); | 3927 | priv->sram = pci_iomap(pdev, 0, 0x10000); |
3915 | if (priv->sram == NULL) { | 3928 | if (priv->sram == NULL) { |
3916 | printk(KERN_ERR "%s: Cannot map device SRAM\n", | 3929 | wiphy_err(hw->wiphy, "cannot map device sram\n"); |
3917 | wiphy_name(hw->wiphy)); | ||
3918 | goto err_iounmap; | 3930 | goto err_iounmap; |
3919 | } | 3931 | } |
3920 | 3932 | ||
@@ -3926,8 +3938,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3926 | if (priv->regs == NULL) { | 3938 | if (priv->regs == NULL) { |
3927 | priv->regs = pci_iomap(pdev, 2, 0x10000); | 3939 | priv->regs = pci_iomap(pdev, 2, 0x10000); |
3928 | if (priv->regs == NULL) { | 3940 | if (priv->regs == NULL) { |
3929 | printk(KERN_ERR "%s: Cannot map device registers\n", | 3941 | wiphy_err(hw->wiphy, "cannot map device registers\n"); |
3930 | wiphy_name(hw->wiphy)); | ||
3931 | goto err_iounmap; | 3942 | goto err_iounmap; |
3932 | } | 3943 | } |
3933 | } | 3944 | } |
@@ -3939,16 +3950,14 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3939 | /* Ask userland hotplug daemon for the device firmware */ | 3950 | /* Ask userland hotplug daemon for the device firmware */ |
3940 | rc = mwl8k_request_firmware(priv); | 3951 | rc = mwl8k_request_firmware(priv); |
3941 | if (rc) { | 3952 | if (rc) { |
3942 | printk(KERN_ERR "%s: Firmware files not found\n", | 3953 | wiphy_err(hw->wiphy, "firmware files not found\n"); |
3943 | wiphy_name(hw->wiphy)); | ||
3944 | goto err_stop_firmware; | 3954 | goto err_stop_firmware; |
3945 | } | 3955 | } |
3946 | 3956 | ||
3947 | /* Load firmware into hardware */ | 3957 | /* Load firmware into hardware */ |
3948 | rc = mwl8k_load_firmware(hw); | 3958 | rc = mwl8k_load_firmware(hw); |
3949 | if (rc) { | 3959 | if (rc) { |
3950 | printk(KERN_ERR "%s: Cannot start firmware\n", | 3960 | wiphy_err(hw->wiphy, "cannot start firmware\n"); |
3951 | wiphy_name(hw->wiphy)); | ||
3952 | goto err_stop_firmware; | 3961 | goto err_stop_firmware; |
3953 | } | 3962 | } |
3954 | 3963 | ||
@@ -3959,9 +3968,8 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3959 | if (priv->ap_fw) { | 3968 | if (priv->ap_fw) { |
3960 | priv->rxd_ops = priv->device_info->ap_rxd_ops; | 3969 | priv->rxd_ops = priv->device_info->ap_rxd_ops; |
3961 | if (priv->rxd_ops == NULL) { | 3970 | if (priv->rxd_ops == NULL) { |
3962 | printk(KERN_ERR "%s: Driver does not have AP " | 3971 | wiphy_err(hw->wiphy, |
3963 | "firmware image support for this hardware\n", | 3972 | "Driver does not have AP firmware image support for this hardware\n"); |
3964 | wiphy_name(hw->wiphy)); | ||
3965 | goto err_stop_firmware; | 3973 | goto err_stop_firmware; |
3966 | } | 3974 | } |
3967 | } else { | 3975 | } else { |
@@ -4039,8 +4047,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4039 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, | 4047 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, |
4040 | IRQF_SHARED, MWL8K_NAME, hw); | 4048 | IRQF_SHARED, MWL8K_NAME, hw); |
4041 | if (rc) { | 4049 | if (rc) { |
4042 | printk(KERN_ERR "%s: failed to register IRQ handler\n", | 4050 | wiphy_err(hw->wiphy, "failed to register irq handler\n"); |
4043 | wiphy_name(hw->wiphy)); | ||
4044 | goto err_free_queues; | 4051 | goto err_free_queues; |
4045 | } | 4052 | } |
4046 | 4053 | ||
@@ -4060,8 +4067,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4060 | rc = mwl8k_cmd_get_hw_spec_sta(hw); | 4067 | rc = mwl8k_cmd_get_hw_spec_sta(hw); |
4061 | } | 4068 | } |
4062 | if (rc) { | 4069 | if (rc) { |
4063 | printk(KERN_ERR "%s: Cannot initialise firmware\n", | 4070 | wiphy_err(hw->wiphy, "cannot initialise firmware\n"); |
4064 | wiphy_name(hw->wiphy)); | ||
4065 | goto err_free_irq; | 4071 | goto err_free_irq; |
4066 | } | 4072 | } |
4067 | 4073 | ||
@@ -4075,15 +4081,14 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4075 | /* Turn radio off */ | 4081 | /* Turn radio off */ |
4076 | rc = mwl8k_cmd_radio_disable(hw); | 4082 | rc = mwl8k_cmd_radio_disable(hw); |
4077 | if (rc) { | 4083 | if (rc) { |
4078 | printk(KERN_ERR "%s: Cannot disable\n", wiphy_name(hw->wiphy)); | 4084 | wiphy_err(hw->wiphy, "cannot disable\n"); |
4079 | goto err_free_irq; | 4085 | goto err_free_irq; |
4080 | } | 4086 | } |
4081 | 4087 | ||
4082 | /* Clear MAC address */ | 4088 | /* Clear MAC address */ |
4083 | rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00"); | 4089 | rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00"); |
4084 | if (rc) { | 4090 | if (rc) { |
4085 | printk(KERN_ERR "%s: Cannot clear MAC address\n", | 4091 | wiphy_err(hw->wiphy, "cannot clear mac address\n"); |
4086 | wiphy_name(hw->wiphy)); | ||
4087 | goto err_free_irq; | 4092 | goto err_free_irq; |
4088 | } | 4093 | } |
4089 | 4094 | ||
@@ -4093,17 +4098,16 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4093 | 4098 | ||
4094 | rc = ieee80211_register_hw(hw); | 4099 | rc = ieee80211_register_hw(hw); |
4095 | if (rc) { | 4100 | if (rc) { |
4096 | printk(KERN_ERR "%s: Cannot register device\n", | 4101 | wiphy_err(hw->wiphy, "cannot register device\n"); |
4097 | wiphy_name(hw->wiphy)); | ||
4098 | goto err_free_queues; | 4102 | goto err_free_queues; |
4099 | } | 4103 | } |
4100 | 4104 | ||
4101 | printk(KERN_INFO "%s: %s v%d, %pM, %s firmware %u.%u.%u.%u\n", | 4105 | wiphy_info(hw->wiphy, "%s v%d, %pm, %s firmware %u.%u.%u.%u\n", |
4102 | wiphy_name(hw->wiphy), priv->device_info->part_name, | 4106 | priv->device_info->part_name, |
4103 | priv->hw_rev, hw->wiphy->perm_addr, | 4107 | priv->hw_rev, hw->wiphy->perm_addr, |
4104 | priv->ap_fw ? "AP" : "STA", | 4108 | priv->ap_fw ? "AP" : "STA", |
4105 | (priv->fw_rev >> 24) & 0xff, (priv->fw_rev >> 16) & 0xff, | 4109 | (priv->fw_rev >> 24) & 0xff, (priv->fw_rev >> 16) & 0xff, |
4106 | (priv->fw_rev >> 8) & 0xff, priv->fw_rev & 0xff); | 4110 | (priv->fw_rev >> 8) & 0xff, priv->fw_rev & 0xff); |
4107 | 4111 | ||
4108 | return 0; | 4112 | return 0; |
4109 | 4113 | ||
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c index 8c4169c227ae..09fae2f0ea08 100644 --- a/drivers/net/wireless/orinoco/cfg.c +++ b/drivers/net/wireless/orinoco/cfg.c | |||
@@ -117,9 +117,8 @@ static int orinoco_change_vif(struct wiphy *wiphy, struct net_device *dev, | |||
117 | 117 | ||
118 | case NL80211_IFTYPE_MONITOR: | 118 | case NL80211_IFTYPE_MONITOR: |
119 | if (priv->broken_monitor && !force_monitor) { | 119 | if (priv->broken_monitor && !force_monitor) { |
120 | printk(KERN_WARNING "%s: Monitor mode support is " | 120 | wiphy_warn(wiphy, |
121 | "buggy in this firmware, not enabling\n", | 121 | "Monitor mode support is buggy in this firmware, not enabling\n"); |
122 | wiphy_name(wiphy)); | ||
123 | err = -EINVAL; | 122 | err = -EINVAL; |
124 | } | 123 | } |
125 | break; | 124 | break; |
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c index e51650ed49f2..d687cb7f2a59 100644 --- a/drivers/net/wireless/p54/eeprom.c +++ b/drivers/net/wireless/p54/eeprom.c | |||
@@ -149,16 +149,15 @@ static int p54_generate_band(struct ieee80211_hw *dev, | |||
149 | continue; | 149 | continue; |
150 | 150 | ||
151 | if (list->channels[i].data != CHAN_HAS_ALL) { | 151 | if (list->channels[i].data != CHAN_HAS_ALL) { |
152 | printk(KERN_ERR "%s:%s%s%s is/are missing for " | 152 | wiphy_err(dev->wiphy, |
153 | "channel:%d [%d MHz].\n", | 153 | "%s%s%s is/are missing for channel:%d [%d MHz].\n", |
154 | wiphy_name(dev->wiphy), | 154 | (list->channels[i].data & CHAN_HAS_CAL ? "" : |
155 | (list->channels[i].data & CHAN_HAS_CAL ? "" : | 155 | " [iqauto calibration data]"), |
156 | " [iqauto calibration data]"), | 156 | (list->channels[i].data & CHAN_HAS_LIMIT ? "" : |
157 | (list->channels[i].data & CHAN_HAS_LIMIT ? "" : | 157 | " [output power limits]"), |
158 | " [output power limits]"), | 158 | (list->channels[i].data & CHAN_HAS_CURVE ? "" : |
159 | (list->channels[i].data & CHAN_HAS_CURVE ? "" : | 159 | " [curve data]"), |
160 | " [curve data]"), | 160 | list->channels[i].index, list->channels[i].freq); |
161 | list->channels[i].index, list->channels[i].freq); | ||
162 | continue; | 161 | continue; |
163 | } | 162 | } |
164 | 163 | ||
@@ -168,9 +167,8 @@ static int p54_generate_band(struct ieee80211_hw *dev, | |||
168 | } | 167 | } |
169 | 168 | ||
170 | if (j == 0) { | 169 | if (j == 0) { |
171 | printk(KERN_ERR "%s: Disabling totally damaged %s band.\n", | 170 | wiphy_err(dev->wiphy, "disabling totally damaged %d GHz band\n", |
172 | wiphy_name(dev->wiphy), (band == IEEE80211_BAND_2GHZ) ? | 171 | (band == IEEE80211_BAND_2GHZ) ? 2 : 5); |
173 | "2 GHz" : "5 GHz"); | ||
174 | 172 | ||
175 | ret = -ENODATA; | 173 | ret = -ENODATA; |
176 | goto err_out; | 174 | goto err_out; |
@@ -244,9 +242,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
244 | 242 | ||
245 | if ((priv->iq_autocal_len != priv->curve_data->entries) || | 243 | if ((priv->iq_autocal_len != priv->curve_data->entries) || |
246 | (priv->iq_autocal_len != priv->output_limit->entries)) | 244 | (priv->iq_autocal_len != priv->output_limit->entries)) |
247 | printk(KERN_ERR "%s: Unsupported or damaged EEPROM detected. " | 245 | wiphy_err(dev->wiphy, |
248 | "You may not be able to use all channels.\n", | 246 | "Unsupported or damaged EEPROM detected. " |
249 | wiphy_name(dev->wiphy)); | 247 | "You may not be able to use all channels.\n"); |
250 | 248 | ||
251 | max_channel_num = max_t(unsigned int, priv->output_limit->entries, | 249 | max_channel_num = max_t(unsigned int, priv->output_limit->entries, |
252 | priv->iq_autocal_len); | 250 | priv->iq_autocal_len); |
@@ -419,15 +417,14 @@ static void p54_parse_rssical(struct ieee80211_hw *dev, void *data, int len, | |||
419 | int i; | 417 | int i; |
420 | 418 | ||
421 | if (len != (entry_size * num_entries)) { | 419 | if (len != (entry_size * num_entries)) { |
422 | printk(KERN_ERR "%s: unknown rssi calibration data packing " | 420 | wiphy_err(dev->wiphy, |
423 | " type:(%x) len:%d.\n", | 421 | "unknown rssi calibration data packing type:(%x) len:%d.\n", |
424 | wiphy_name(dev->wiphy), type, len); | 422 | type, len); |
425 | 423 | ||
426 | print_hex_dump_bytes("rssical:", DUMP_PREFIX_NONE, | 424 | print_hex_dump_bytes("rssical:", DUMP_PREFIX_NONE, |
427 | data, len); | 425 | data, len); |
428 | 426 | ||
429 | printk(KERN_ERR "%s: please report this issue.\n", | 427 | wiphy_err(dev->wiphy, "please report this issue.\n"); |
430 | wiphy_name(dev->wiphy)); | ||
431 | return; | 428 | return; |
432 | } | 429 | } |
433 | 430 | ||
@@ -445,15 +442,14 @@ static void p54_parse_default_country(struct ieee80211_hw *dev, | |||
445 | struct pda_country *country; | 442 | struct pda_country *country; |
446 | 443 | ||
447 | if (len != sizeof(*country)) { | 444 | if (len != sizeof(*country)) { |
448 | printk(KERN_ERR "%s: found possible invalid default country " | 445 | wiphy_err(dev->wiphy, |
449 | "eeprom entry. (entry size: %d)\n", | 446 | "found possible invalid default country eeprom entry. (entry size: %d)\n", |
450 | wiphy_name(dev->wiphy), len); | 447 | len); |
451 | 448 | ||
452 | print_hex_dump_bytes("country:", DUMP_PREFIX_NONE, | 449 | print_hex_dump_bytes("country:", DUMP_PREFIX_NONE, |
453 | data, len); | 450 | data, len); |
454 | 451 | ||
455 | printk(KERN_ERR "%s: please report this issue.\n", | 452 | wiphy_err(dev->wiphy, "please report this issue.\n"); |
456 | wiphy_name(dev->wiphy)); | ||
457 | return; | 453 | return; |
458 | } | 454 | } |
459 | 455 | ||
@@ -478,8 +474,8 @@ static int p54_convert_output_limits(struct ieee80211_hw *dev, | |||
478 | return -EINVAL; | 474 | return -EINVAL; |
479 | 475 | ||
480 | if (data[0] != 0) { | 476 | if (data[0] != 0) { |
481 | printk(KERN_ERR "%s: unknown output power db revision:%x\n", | 477 | wiphy_err(dev->wiphy, "unknown output power db revision:%x\n", |
482 | wiphy_name(dev->wiphy), data[0]); | 478 | data[0]); |
483 | return -EINVAL; | 479 | return -EINVAL; |
484 | } | 480 | } |
485 | 481 | ||
@@ -587,10 +583,9 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | |||
587 | err = p54_convert_rev1(dev, curve_data); | 583 | err = p54_convert_rev1(dev, curve_data); |
588 | break; | 584 | break; |
589 | default: | 585 | default: |
590 | printk(KERN_ERR "%s: unknown curve data " | 586 | wiphy_err(dev->wiphy, |
591 | "revision %d\n", | 587 | "unknown curve data revision %d\n", |
592 | wiphy_name(dev->wiphy), | 588 | curve_data->cal_method_rev); |
593 | curve_data->cal_method_rev); | ||
594 | err = -ENODEV; | 589 | err = -ENODEV; |
595 | break; | 590 | break; |
596 | } | 591 | } |
@@ -672,8 +667,8 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | |||
672 | 667 | ||
673 | if (!synth || !priv->iq_autocal || !priv->output_limit || | 668 | if (!synth || !priv->iq_autocal || !priv->output_limit || |
674 | !priv->curve_data) { | 669 | !priv->curve_data) { |
675 | printk(KERN_ERR "%s: not all required entries found in eeprom!\n", | 670 | wiphy_err(dev->wiphy, |
676 | wiphy_name(dev->wiphy)); | 671 | "not all required entries found in eeprom!\n"); |
677 | err = -EINVAL; | 672 | err = -EINVAL; |
678 | goto err; | 673 | goto err; |
679 | } | 674 | } |
@@ -699,15 +694,15 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | |||
699 | if (!is_valid_ether_addr(dev->wiphy->perm_addr)) { | 694 | if (!is_valid_ether_addr(dev->wiphy->perm_addr)) { |
700 | u8 perm_addr[ETH_ALEN]; | 695 | u8 perm_addr[ETH_ALEN]; |
701 | 696 | ||
702 | printk(KERN_WARNING "%s: Invalid hwaddr! Using randomly generated MAC addr\n", | 697 | wiphy_warn(dev->wiphy, |
703 | wiphy_name(dev->wiphy)); | 698 | "invalid hwaddr! using randomly generated mac addr\n"); |
704 | random_ether_addr(perm_addr); | 699 | random_ether_addr(perm_addr); |
705 | SET_IEEE80211_PERM_ADDR(dev, perm_addr); | 700 | SET_IEEE80211_PERM_ADDR(dev, perm_addr); |
706 | } | 701 | } |
707 | 702 | ||
708 | printk(KERN_INFO "%s: hwaddr %pM, MAC:isl38%02x RF:%s\n", | 703 | wiphy_info(dev->wiphy, "hwaddr %pm, mac:isl38%02x rf:%s\n", |
709 | wiphy_name(dev->wiphy), dev->wiphy->perm_addr, priv->version, | 704 | dev->wiphy->perm_addr, priv->version, |
710 | p54_rf_chips[priv->rxhw]); | 705 | p54_rf_chips[priv->rxhw]); |
711 | 706 | ||
712 | return 0; | 707 | return 0; |
713 | 708 | ||
@@ -719,8 +714,7 @@ err: | |||
719 | priv->output_limit = NULL; | 714 | priv->output_limit = NULL; |
720 | priv->curve_data = NULL; | 715 | priv->curve_data = NULL; |
721 | 716 | ||
722 | printk(KERN_ERR "%s: eeprom parse failed!\n", | 717 | wiphy_err(dev->wiphy, "eeprom parse failed!\n"); |
723 | wiphy_name(dev->wiphy)); | ||
724 | return err; | 718 | return err; |
725 | } | 719 | } |
726 | EXPORT_SYMBOL_GPL(p54_parse_eeprom); | 720 | EXPORT_SYMBOL_GPL(p54_parse_eeprom); |
diff --git a/drivers/net/wireless/p54/fwio.c b/drivers/net/wireless/p54/fwio.c index c43a5d461ab2..47006bca4852 100644 --- a/drivers/net/wireless/p54/fwio.c +++ b/drivers/net/wireless/p54/fwio.c | |||
@@ -62,16 +62,15 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
62 | case FW_LM20: | 62 | case FW_LM20: |
63 | case FW_LM87: { | 63 | case FW_LM87: { |
64 | char *iftype = (char *)bootrec->data; | 64 | char *iftype = (char *)bootrec->data; |
65 | printk(KERN_INFO "%s: p54 detected a LM%c%c " | 65 | wiphy_info(priv->hw->wiphy, |
66 | "firmware\n", | 66 | "p54 detected a LM%c%c firmware\n", |
67 | wiphy_name(priv->hw->wiphy), | 67 | iftype[2], iftype[3]); |
68 | iftype[2], iftype[3]); | ||
69 | break; | 68 | break; |
70 | } | 69 | } |
71 | case FW_FMAC: | 70 | case FW_FMAC: |
72 | default: | 71 | default: |
73 | printk(KERN_ERR "%s: unsupported firmware\n", | 72 | wiphy_err(priv->hw->wiphy, |
74 | wiphy_name(priv->hw->wiphy)); | 73 | "unsupported firmware\n"); |
75 | return -ENODEV; | 74 | return -ENODEV; |
76 | } | 75 | } |
77 | break; | 76 | break; |
@@ -125,15 +124,15 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
125 | } | 124 | } |
126 | 125 | ||
127 | if (fw_version) | 126 | if (fw_version) |
128 | printk(KERN_INFO "%s: FW rev %s - Softmac protocol %x.%x\n", | 127 | wiphy_info(priv->hw->wiphy, |
129 | wiphy_name(priv->hw->wiphy), fw_version, | 128 | "fw rev %s - softmac protocol %x.%x\n", |
130 | priv->fw_var >> 8, priv->fw_var & 0xff); | 129 | fw_version, priv->fw_var >> 8, priv->fw_var & 0xff); |
131 | 130 | ||
132 | if (priv->fw_var < 0x500) | 131 | if (priv->fw_var < 0x500) |
133 | printk(KERN_INFO "%s: you are using an obsolete firmware. " | 132 | wiphy_info(priv->hw->wiphy, |
134 | "visit http://wireless.kernel.org/en/users/Drivers/p54 " | 133 | "you are using an obsolete firmware. " |
135 | "and grab one for \"kernel >= 2.6.28\"!\n", | 134 | "visit http://wireless.kernel.org/en/users/Drivers/p54 " |
136 | wiphy_name(priv->hw->wiphy)); | 135 | "and grab one for \"kernel >= 2.6.28\"!\n"); |
137 | 136 | ||
138 | if (priv->fw_var >= 0x300) { | 137 | if (priv->fw_var >= 0x300) { |
139 | /* Firmware supports QoS, use it! */ | 138 | /* Firmware supports QoS, use it! */ |
@@ -152,13 +151,14 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
152 | priv->hw->queues = P54_QUEUE_AC_NUM; | 151 | priv->hw->queues = P54_QUEUE_AC_NUM; |
153 | } | 152 | } |
154 | 153 | ||
155 | printk(KERN_INFO "%s: cryptographic accelerator " | 154 | wiphy_info(priv->hw->wiphy, |
156 | "WEP:%s, TKIP:%s, CCMP:%s\n", wiphy_name(priv->hw->wiphy), | 155 | "cryptographic accelerator WEP:%s, TKIP:%s, CCMP:%s\n", |
157 | (priv->privacy_caps & BR_DESC_PRIV_CAP_WEP) ? "YES" : | 156 | (priv->privacy_caps & BR_DESC_PRIV_CAP_WEP) ? "YES" : "no", |
158 | "no", (priv->privacy_caps & (BR_DESC_PRIV_CAP_TKIP | | 157 | (priv->privacy_caps & |
159 | BR_DESC_PRIV_CAP_MICHAEL)) ? "YES" : "no", | 158 | (BR_DESC_PRIV_CAP_TKIP | BR_DESC_PRIV_CAP_MICHAEL)) |
160 | (priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP) ? | 159 | ? "YES" : "no", |
161 | "YES" : "no"); | 160 | (priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP) |
161 | ? "YES" : "no"); | ||
162 | 162 | ||
163 | if (priv->rx_keycache_size) { | 163 | if (priv->rx_keycache_size) { |
164 | /* | 164 | /* |
@@ -247,8 +247,7 @@ int p54_download_eeprom(struct p54_common *priv, void *buf, | |||
247 | 247 | ||
248 | if (!wait_for_completion_interruptible_timeout( | 248 | if (!wait_for_completion_interruptible_timeout( |
249 | &priv->eeprom_comp, HZ)) { | 249 | &priv->eeprom_comp, HZ)) { |
250 | printk(KERN_ERR "%s: device does not respond!\n", | 250 | wiphy_err(priv->hw->wiphy, "device does not respond!\n"); |
251 | wiphy_name(priv->hw->wiphy)); | ||
252 | ret = -EBUSY; | 251 | ret = -EBUSY; |
253 | } | 252 | } |
254 | priv->eeprom = NULL; | 253 | priv->eeprom = NULL; |
@@ -523,9 +522,9 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell) | |||
523 | return 0; | 522 | return 0; |
524 | 523 | ||
525 | err: | 524 | err: |
526 | printk(KERN_ERR "%s: frequency change to channel %d failed.\n", | 525 | wiphy_err(priv->hw->wiphy, "frequency change to channel %d failed.\n", |
527 | wiphy_name(priv->hw->wiphy), ieee80211_frequency_to_channel( | 526 | ieee80211_frequency_to_channel( |
528 | priv->hw->conf.channel->center_freq)); | 527 | priv->hw->conf.channel->center_freq)); |
529 | 528 | ||
530 | dev_kfree_skb_any(skb); | 529 | dev_kfree_skb_any(skb); |
531 | return -EINVAL; | 530 | return -EINVAL; |
@@ -676,8 +675,8 @@ int p54_upload_key(struct p54_common *priv, u8 algo, int slot, u8 idx, u8 len, | |||
676 | break; | 675 | break; |
677 | 676 | ||
678 | default: | 677 | default: |
679 | printk(KERN_ERR "%s: invalid cryptographic algorithm: %d\n", | 678 | wiphy_err(priv->hw->wiphy, |
680 | wiphy_name(priv->hw->wiphy), algo); | 679 | "invalid cryptographic algorithm: %d\n", algo); |
681 | dev_kfree_skb(skb); | 680 | dev_kfree_skb(skb); |
682 | return -EINVAL; | 681 | return -EINVAL; |
683 | } | 682 | } |
diff --git a/drivers/net/wireless/p54/led.c b/drivers/net/wireless/p54/led.c index 9575ac033630..ea91f5cce6b3 100644 --- a/drivers/net/wireless/p54/led.c +++ b/drivers/net/wireless/p54/led.c | |||
@@ -57,8 +57,8 @@ static void p54_update_leds(struct work_struct *work) | |||
57 | 57 | ||
58 | err = p54_set_leds(priv); | 58 | err = p54_set_leds(priv); |
59 | if (err && net_ratelimit()) | 59 | if (err && net_ratelimit()) |
60 | printk(KERN_ERR "%s: failed to update LEDs (%d).\n", | 60 | wiphy_err(priv->hw->wiphy, |
61 | wiphy_name(priv->hw->wiphy), err); | 61 | "failed to update leds (%d).\n", err); |
62 | 62 | ||
63 | if (rerun) | 63 | if (rerun) |
64 | ieee80211_queue_delayed_work(priv->hw, &priv->led_work, | 64 | ieee80211_queue_delayed_work(priv->hw, &priv->led_work, |
@@ -102,8 +102,8 @@ static int p54_register_led(struct p54_common *priv, | |||
102 | 102 | ||
103 | err = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_dev); | 103 | err = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_dev); |
104 | if (err) | 104 | if (err) |
105 | printk(KERN_ERR "%s: Failed to register %s LED.\n", | 105 | wiphy_err(priv->hw->wiphy, |
106 | wiphy_name(priv->hw->wiphy), name); | 106 | "failed to register %s led.\n", name); |
107 | else | 107 | else |
108 | led->registered = 1; | 108 | led->registered = 1; |
109 | 109 | ||
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c index c072f41747ca..47db439b63bf 100644 --- a/drivers/net/wireless/p54/main.c +++ b/drivers/net/wireless/p54/main.c | |||
@@ -507,6 +507,22 @@ out_unlock: | |||
507 | return ret; | 507 | return ret; |
508 | } | 508 | } |
509 | 509 | ||
510 | static int p54_get_survey(struct ieee80211_hw *dev, int idx, | ||
511 | struct survey_info *survey) | ||
512 | { | ||
513 | struct p54_common *priv = dev->priv; | ||
514 | struct ieee80211_conf *conf = &dev->conf; | ||
515 | |||
516 | if (idx != 0) | ||
517 | return -ENOENT; | ||
518 | |||
519 | survey->channel = conf->channel; | ||
520 | survey->filled = SURVEY_INFO_NOISE_DBM; | ||
521 | survey->noise = clamp_t(s8, priv->noise, -128, 127); | ||
522 | |||
523 | return 0; | ||
524 | } | ||
525 | |||
510 | static const struct ieee80211_ops p54_ops = { | 526 | static const struct ieee80211_ops p54_ops = { |
511 | .tx = p54_tx_80211, | 527 | .tx = p54_tx_80211, |
512 | .start = p54_start, | 528 | .start = p54_start, |
@@ -523,6 +539,7 @@ static const struct ieee80211_ops p54_ops = { | |||
523 | .configure_filter = p54_configure_filter, | 539 | .configure_filter = p54_configure_filter, |
524 | .conf_tx = p54_conf_tx, | 540 | .conf_tx = p54_conf_tx, |
525 | .get_stats = p54_get_stats, | 541 | .get_stats = p54_get_stats, |
542 | .get_survey = p54_get_survey, | ||
526 | }; | 543 | }; |
527 | 544 | ||
528 | struct ieee80211_hw *p54_init_common(size_t priv_data_len) | 545 | struct ieee80211_hw *p54_init_common(size_t priv_data_len) |
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index a5ea89cde8c4..822f8dc26e9c 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -466,8 +466,7 @@ static int p54p_open(struct ieee80211_hw *dev) | |||
466 | P54P_READ(dev_int); | 466 | P54P_READ(dev_int); |
467 | 467 | ||
468 | if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) { | 468 | if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) { |
469 | printk(KERN_ERR "%s: Cannot boot firmware!\n", | 469 | wiphy_err(dev->wiphy, "cannot boot firmware!\n"); |
470 | wiphy_name(dev->wiphy)); | ||
471 | p54p_stop(dev); | 470 | p54p_stop(dev); |
472 | return -ETIMEDOUT; | 471 | return -ETIMEDOUT; |
473 | } | 472 | } |
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index 4e6891099d43..427b46f558ed 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
@@ -38,8 +38,8 @@ static void p54_dump_tx_queue(struct p54_common *priv) | |||
38 | u32 largest_hole = 0, free; | 38 | u32 largest_hole = 0, free; |
39 | 39 | ||
40 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 40 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
41 | printk(KERN_DEBUG "%s: / --- tx queue dump (%d entries) ---\n", | 41 | wiphy_debug(priv->hw->wiphy, "/ --- tx queue dump (%d entries) ---\n", |
42 | wiphy_name(priv->hw->wiphy), skb_queue_len(&priv->tx_queue)); | 42 | skb_queue_len(&priv->tx_queue)); |
43 | 43 | ||
44 | prev_addr = priv->rx_start; | 44 | prev_addr = priv->rx_start; |
45 | skb_queue_walk(&priv->tx_queue, skb) { | 45 | skb_queue_walk(&priv->tx_queue, skb) { |
@@ -48,21 +48,23 @@ static void p54_dump_tx_queue(struct p54_common *priv) | |||
48 | hdr = (void *) skb->data; | 48 | hdr = (void *) skb->data; |
49 | 49 | ||
50 | free = range->start_addr - prev_addr; | 50 | free = range->start_addr - prev_addr; |
51 | printk(KERN_DEBUG "%s: | [%02d] => [skb:%p skb_len:0x%04x " | 51 | wiphy_debug(priv->hw->wiphy, |
52 | "hdr:{flags:%02x len:%04x req_id:%04x type:%02x} " | 52 | "| [%02d] => [skb:%p skb_len:0x%04x " |
53 | "mem:{start:%04x end:%04x, free:%d}]\n", | 53 | "hdr:{flags:%02x len:%04x req_id:%04x type:%02x} " |
54 | wiphy_name(priv->hw->wiphy), i++, skb, skb->len, | 54 | "mem:{start:%04x end:%04x, free:%d}]\n", |
55 | le16_to_cpu(hdr->flags), le16_to_cpu(hdr->len), | 55 | i++, skb, skb->len, |
56 | le32_to_cpu(hdr->req_id), le16_to_cpu(hdr->type), | 56 | le16_to_cpu(hdr->flags), le16_to_cpu(hdr->len), |
57 | range->start_addr, range->end_addr, free); | 57 | le32_to_cpu(hdr->req_id), le16_to_cpu(hdr->type), |
58 | range->start_addr, range->end_addr, free); | ||
58 | 59 | ||
59 | prev_addr = range->end_addr; | 60 | prev_addr = range->end_addr; |
60 | largest_hole = max(largest_hole, free); | 61 | largest_hole = max(largest_hole, free); |
61 | } | 62 | } |
62 | free = priv->rx_end - prev_addr; | 63 | free = priv->rx_end - prev_addr; |
63 | largest_hole = max(largest_hole, free); | 64 | largest_hole = max(largest_hole, free); |
64 | printk(KERN_DEBUG "%s: \\ --- [free: %d], largest free block: %d ---\n", | 65 | wiphy_debug(priv->hw->wiphy, |
65 | wiphy_name(priv->hw->wiphy), free, largest_hole); | 66 | "\\ --- [free: %d], largest free block: %d ---\n", |
67 | free, largest_hole); | ||
66 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 68 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
67 | } | 69 | } |
68 | #endif /* P54_MM_DEBUG */ | 70 | #endif /* P54_MM_DEBUG */ |
@@ -538,8 +540,7 @@ static void p54_rx_trap(struct p54_common *priv, struct sk_buff *skb) | |||
538 | case P54_TRAP_BEACON_TX: | 540 | case P54_TRAP_BEACON_TX: |
539 | break; | 541 | break; |
540 | case P54_TRAP_RADAR: | 542 | case P54_TRAP_RADAR: |
541 | printk(KERN_INFO "%s: radar (freq:%d MHz)\n", | 543 | wiphy_info(priv->hw->wiphy, "radar (freq:%d mhz)\n", freq); |
542 | wiphy_name(priv->hw->wiphy), freq); | ||
543 | break; | 544 | break; |
544 | case P54_TRAP_NO_BEACON: | 545 | case P54_TRAP_NO_BEACON: |
545 | if (priv->vif) | 546 | if (priv->vif) |
@@ -558,8 +559,8 @@ static void p54_rx_trap(struct p54_common *priv, struct sk_buff *skb) | |||
558 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, false); | 559 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, false); |
559 | break; | 560 | break; |
560 | default: | 561 | default: |
561 | printk(KERN_INFO "%s: received event:%x freq:%d\n", | 562 | wiphy_info(priv->hw->wiphy, "received event:%x freq:%d\n", |
562 | wiphy_name(priv->hw->wiphy), event, freq); | 563 | event, freq); |
563 | break; | 564 | break; |
564 | } | 565 | } |
565 | } | 566 | } |
@@ -584,8 +585,9 @@ static int p54_rx_control(struct p54_common *priv, struct sk_buff *skb) | |||
584 | p54_rx_eeprom_readback(priv, skb); | 585 | p54_rx_eeprom_readback(priv, skb); |
585 | break; | 586 | break; |
586 | default: | 587 | default: |
587 | printk(KERN_DEBUG "%s: not handling 0x%02x type control frame\n", | 588 | wiphy_debug(priv->hw->wiphy, |
588 | wiphy_name(priv->hw->wiphy), le16_to_cpu(hdr->type)); | 589 | "not handling 0x%02x type control frame\n", |
590 | le16_to_cpu(hdr->type)); | ||
589 | break; | 591 | break; |
590 | } | 592 | } |
591 | return 0; | 593 | return 0; |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 242d59558b79..cdaf93f48263 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -351,6 +351,14 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev, | |||
351 | 351 | ||
352 | if (crypto->cmd == SET_KEY) { | 352 | if (crypto->cmd == SET_KEY) { |
353 | /* | 353 | /* |
354 | * Disallow to set WEP key other than with index 0, | ||
355 | * it is known that not work at least on some hardware. | ||
356 | * SW crypto will be used in that case. | ||
357 | */ | ||
358 | if (key->alg == ALG_WEP && key->keyidx != 0) | ||
359 | return -EOPNOTSUPP; | ||
360 | |||
361 | /* | ||
354 | * Pairwise key will always be entry 0, but this | 362 | * Pairwise key will always be entry 0, but this |
355 | * could collide with a shared key on the same | 363 | * could collide with a shared key on the same |
356 | * position... | 364 | * position... |
@@ -376,7 +384,7 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev, | |||
376 | if (key->hw_key_idx > 0 && crypto->cipher != curr_cipher) | 384 | if (key->hw_key_idx > 0 && crypto->cipher != curr_cipher) |
377 | return -EOPNOTSUPP; | 385 | return -EOPNOTSUPP; |
378 | 386 | ||
379 | rt2500usb_register_multiwrite(rt2x00dev, reg, | 387 | rt2500usb_register_multiwrite(rt2x00dev, KEY_ENTRY(key->hw_key_idx), |
380 | crypto->key, sizeof(crypto->key)); | 388 | crypto->key, sizeof(crypto->key)); |
381 | 389 | ||
382 | /* | 390 | /* |
@@ -817,6 +825,7 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev) | |||
817 | rt2500usb_register_write(rt2x00dev, MAC_CSR8, reg); | 825 | rt2500usb_register_write(rt2x00dev, MAC_CSR8, reg); |
818 | 826 | ||
819 | rt2500usb_register_read(rt2x00dev, TXRX_CSR0, ®); | 827 | rt2500usb_register_read(rt2x00dev, TXRX_CSR0, ®); |
828 | rt2x00_set_field16(®, TXRX_CSR0_ALGORITHM, CIPHER_NONE); | ||
820 | rt2x00_set_field16(®, TXRX_CSR0_IV_OFFSET, IEEE80211_HEADER); | 829 | rt2x00_set_field16(®, TXRX_CSR0_IV_OFFSET, IEEE80211_HEADER); |
821 | rt2x00_set_field16(®, TXRX_CSR0_KEY_ID, 0); | 830 | rt2x00_set_field16(®, TXRX_CSR0_KEY_ID, 0); |
822 | rt2500usb_register_write(rt2x00dev, TXRX_CSR0, reg); | 831 | rt2500usb_register_write(rt2x00dev, TXRX_CSR0, reg); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 4d8d2320c9fd..235e037e6509 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -273,17 +273,24 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
273 | mutex_init(&intf->beacon_skb_mutex); | 273 | mutex_init(&intf->beacon_skb_mutex); |
274 | intf->beacon = entry; | 274 | intf->beacon = entry; |
275 | 275 | ||
276 | if (vif->type == NL80211_IFTYPE_AP) | ||
277 | memcpy(&intf->bssid, vif->addr, ETH_ALEN); | ||
278 | memcpy(&intf->mac, vif->addr, ETH_ALEN); | ||
279 | |||
280 | /* | 276 | /* |
281 | * The MAC adddress must be configured after the device | 277 | * The MAC adddress must be configured after the device |
282 | * has been initialized. Otherwise the device can reset | 278 | * has been initialized. Otherwise the device can reset |
283 | * the MAC registers. | 279 | * the MAC registers. |
280 | * The BSSID address must only be configured in AP mode, | ||
281 | * however we should not send an empty BSSID address for | ||
282 | * STA interfaces at this time, since this can cause | ||
283 | * invalid behavior in the device. | ||
284 | */ | 284 | */ |
285 | rt2x00lib_config_intf(rt2x00dev, intf, vif->type, | 285 | memcpy(&intf->mac, vif->addr, ETH_ALEN); |
286 | intf->mac, intf->bssid); | 286 | if (vif->type == NL80211_IFTYPE_AP) { |
287 | memcpy(&intf->bssid, vif->addr, ETH_ALEN); | ||
288 | rt2x00lib_config_intf(rt2x00dev, intf, vif->type, | ||
289 | intf->mac, intf->bssid); | ||
290 | } else { | ||
291 | rt2x00lib_config_intf(rt2x00dev, intf, vif->type, | ||
292 | intf->mac, NULL); | ||
293 | } | ||
287 | 294 | ||
288 | /* | 295 | /* |
289 | * Some filters depend on the current working mode. We can force | 296 | * Some filters depend on the current working mode. We can force |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index 31808f96a3d6..1d8178563d76 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -103,7 +103,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
103 | { | 103 | { |
104 | struct rtl8180_priv *priv = dev->priv; | 104 | struct rtl8180_priv *priv = dev->priv; |
105 | unsigned int count = 32; | 105 | unsigned int count = 32; |
106 | u8 signal; | 106 | u8 signal, agc, sq; |
107 | 107 | ||
108 | while (count--) { | 108 | while (count--) { |
109 | struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx]; | 109 | struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx]; |
@@ -132,12 +132,16 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
132 | 132 | ||
133 | rx_status.antenna = (flags2 >> 15) & 1; | 133 | rx_status.antenna = (flags2 >> 15) & 1; |
134 | rx_status.rate_idx = (flags >> 20) & 0xF; | 134 | rx_status.rate_idx = (flags >> 20) & 0xF; |
135 | /* TODO: improve signal/rssi reporting for !rtl8185 */ | 135 | agc = (flags2 >> 17) & 0x7F; |
136 | signal = (flags2 >> 17) & 0x7F; | 136 | if (priv->r8185) { |
137 | if (rx_status.rate_idx > 3) | 137 | if (rx_status.rate_idx > 3) |
138 | signal = 90 - clamp_t(u8, signal, 25, 90); | 138 | signal = 90 - clamp_t(u8, agc, 25, 90); |
139 | else | 139 | else |
140 | signal = 95 - clamp_t(u8, signal, 30, 95); | 140 | signal = 95 - clamp_t(u8, agc, 30, 95); |
141 | } else { | ||
142 | sq = flags2 & 0xff; | ||
143 | signal = priv->rf->calc_rssi(agc, sq); | ||
144 | } | ||
141 | rx_status.signal = signal; | 145 | rx_status.signal = signal; |
142 | rx_status.freq = dev->conf.channel->center_freq; | 146 | rx_status.freq = dev->conf.channel->center_freq; |
143 | rx_status.band = dev->conf.channel->band; | 147 | rx_status.band = dev->conf.channel->band; |
@@ -357,7 +361,7 @@ static int rtl8180_init_hw(struct ieee80211_hw *dev) | |||
357 | 361 | ||
358 | /* check success of reset */ | 362 | /* check success of reset */ |
359 | if (rtl818x_ioread8(priv, &priv->map->CMD) & RTL818X_CMD_RESET) { | 363 | if (rtl818x_ioread8(priv, &priv->map->CMD) & RTL818X_CMD_RESET) { |
360 | printk(KERN_ERR "%s: reset timeout!\n", wiphy_name(dev->wiphy)); | 364 | wiphy_err(dev->wiphy, "reset timeout!\n"); |
361 | return -ETIMEDOUT; | 365 | return -ETIMEDOUT; |
362 | } | 366 | } |
363 | 367 | ||
@@ -441,8 +445,7 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev) | |||
441 | &priv->rx_ring_dma); | 445 | &priv->rx_ring_dma); |
442 | 446 | ||
443 | if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { | 447 | if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { |
444 | printk(KERN_ERR "%s: Cannot allocate RX ring\n", | 448 | wiphy_err(dev->wiphy, "cannot allocate rx ring\n"); |
445 | wiphy_name(dev->wiphy)); | ||
446 | return -ENOMEM; | 449 | return -ENOMEM; |
447 | } | 450 | } |
448 | 451 | ||
@@ -499,8 +502,8 @@ static int rtl8180_init_tx_ring(struct ieee80211_hw *dev, | |||
499 | 502 | ||
500 | ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); | 503 | ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); |
501 | if (!ring || (unsigned long)ring & 0xFF) { | 504 | if (!ring || (unsigned long)ring & 0xFF) { |
502 | printk(KERN_ERR "%s: Cannot allocate TX ring (prio = %d)\n", | 505 | wiphy_err(dev->wiphy, "cannot allocate tx ring (prio = %d)\n", |
503 | wiphy_name(dev->wiphy), prio); | 506 | prio); |
504 | return -ENOMEM; | 507 | return -ENOMEM; |
505 | } | 508 | } |
506 | 509 | ||
@@ -565,8 +568,7 @@ static int rtl8180_start(struct ieee80211_hw *dev) | |||
565 | ret = request_irq(priv->pdev->irq, rtl8180_interrupt, | 568 | ret = request_irq(priv->pdev->irq, rtl8180_interrupt, |
566 | IRQF_SHARED, KBUILD_MODNAME, dev); | 569 | IRQF_SHARED, KBUILD_MODNAME, dev); |
567 | if (ret) { | 570 | if (ret) { |
568 | printk(KERN_ERR "%s: failed to register IRQ handler\n", | 571 | wiphy_err(dev->wiphy, "failed to register irq handler\n"); |
569 | wiphy_name(dev->wiphy)); | ||
570 | goto err_free_rings; | 572 | goto err_free_rings; |
571 | } | 573 | } |
572 | 574 | ||
@@ -1103,9 +1105,8 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev, | |||
1103 | goto err_iounmap; | 1105 | goto err_iounmap; |
1104 | } | 1106 | } |
1105 | 1107 | ||
1106 | printk(KERN_INFO "%s: hwaddr %pM, %s + %s\n", | 1108 | wiphy_info(dev->wiphy, "hwaddr %pm, %s + %s\n", |
1107 | wiphy_name(dev->wiphy), mac_addr, | 1109 | mac_addr, chip_name, priv->rf->name); |
1108 | chip_name, priv->rf->name); | ||
1109 | 1110 | ||
1110 | return 0; | 1111 | return 0; |
1111 | 1112 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8180_grf5101.c b/drivers/net/wireless/rtl818x/rtl8180_grf5101.c index 947ee55f18b2..5cab9dfa8c07 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_grf5101.c +++ b/drivers/net/wireless/rtl818x/rtl8180_grf5101.c | |||
@@ -69,6 +69,15 @@ static void grf5101_write_phy_antenna(struct ieee80211_hw *dev, short chan) | |||
69 | rtl8180_write_phy(dev, 0x10, ant); | 69 | rtl8180_write_phy(dev, 0x10, ant); |
70 | } | 70 | } |
71 | 71 | ||
72 | static u8 grf5101_rf_calc_rssi(u8 agc, u8 sq) | ||
73 | { | ||
74 | if (agc > 60) | ||
75 | return 65; | ||
76 | |||
77 | /* TODO(?): just return agc (or agc + 5) to avoid mult / div */ | ||
78 | return 65 * agc / 60; | ||
79 | } | ||
80 | |||
72 | static void grf5101_rf_set_channel(struct ieee80211_hw *dev, | 81 | static void grf5101_rf_set_channel(struct ieee80211_hw *dev, |
73 | struct ieee80211_conf *conf) | 82 | struct ieee80211_conf *conf) |
74 | { | 83 | { |
@@ -176,5 +185,6 @@ const struct rtl818x_rf_ops grf5101_rf_ops = { | |||
176 | .name = "GCT", | 185 | .name = "GCT", |
177 | .init = grf5101_rf_init, | 186 | .init = grf5101_rf_init, |
178 | .stop = grf5101_rf_stop, | 187 | .stop = grf5101_rf_stop, |
179 | .set_chan = grf5101_rf_set_channel | 188 | .set_chan = grf5101_rf_set_channel, |
189 | .calc_rssi = grf5101_rf_calc_rssi, | ||
180 | }; | 190 | }; |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_max2820.c b/drivers/net/wireless/rtl818x/rtl8180_max2820.c index 6c825fd7f3b6..16c4655181c0 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_max2820.c +++ b/drivers/net/wireless/rtl818x/rtl8180_max2820.c | |||
@@ -74,6 +74,22 @@ static void max2820_write_phy_antenna(struct ieee80211_hw *dev, short chan) | |||
74 | rtl8180_write_phy(dev, 0x10, ant); | 74 | rtl8180_write_phy(dev, 0x10, ant); |
75 | } | 75 | } |
76 | 76 | ||
77 | static u8 max2820_rf_calc_rssi(u8 agc, u8 sq) | ||
78 | { | ||
79 | bool odd; | ||
80 | |||
81 | odd = !!(agc & 1); | ||
82 | |||
83 | agc >>= 1; | ||
84 | if (odd) | ||
85 | agc += 76; | ||
86 | else | ||
87 | agc += 66; | ||
88 | |||
89 | /* TODO: change addends above to avoid mult / div below */ | ||
90 | return 65 * agc / 100; | ||
91 | } | ||
92 | |||
77 | static void max2820_rf_set_channel(struct ieee80211_hw *dev, | 93 | static void max2820_rf_set_channel(struct ieee80211_hw *dev, |
78 | struct ieee80211_conf *conf) | 94 | struct ieee80211_conf *conf) |
79 | { | 95 | { |
@@ -148,5 +164,6 @@ const struct rtl818x_rf_ops max2820_rf_ops = { | |||
148 | .name = "Maxim", | 164 | .name = "Maxim", |
149 | .init = max2820_rf_init, | 165 | .init = max2820_rf_init, |
150 | .stop = max2820_rf_stop, | 166 | .stop = max2820_rf_stop, |
151 | .set_chan = max2820_rf_set_channel | 167 | .set_chan = max2820_rf_set_channel, |
168 | .calc_rssi = max2820_rf_calc_rssi, | ||
152 | }; | 169 | }; |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8180_rtl8225.c index 4d2be0d9672b..69e4d4745dae 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_rtl8225.c +++ b/drivers/net/wireless/rtl818x/rtl8180_rtl8225.c | |||
@@ -50,7 +50,10 @@ static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data) | |||
50 | udelay(10); | 50 | udelay(10); |
51 | 51 | ||
52 | for (i = 15; i >= 0; i--) { | 52 | for (i = 15; i >= 0; i--) { |
53 | u16 reg = reg80 | !!(bangdata & (1 << i)); | 53 | u16 reg = reg80; |
54 | |||
55 | if (bangdata & (1 << i)) | ||
56 | reg |= 1; | ||
54 | 57 | ||
55 | if (i & 1) | 58 | if (i & 1) |
56 | rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); | 59 | rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_sa2400.c b/drivers/net/wireless/rtl818x/rtl8180_sa2400.c index cea4e0ccb92d..d064fcc5ec08 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_sa2400.c +++ b/drivers/net/wireless/rtl818x/rtl8180_sa2400.c | |||
@@ -76,6 +76,31 @@ static void sa2400_write_phy_antenna(struct ieee80211_hw *dev, short chan) | |||
76 | 76 | ||
77 | } | 77 | } |
78 | 78 | ||
79 | static u8 sa2400_rf_rssi_map[] = { | ||
80 | 0x64, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e, | ||
81 | 0x5d, 0x5c, 0x5b, 0x5a, 0x57, 0x54, 0x52, 0x50, | ||
82 | 0x4e, 0x4c, 0x4a, 0x48, 0x46, 0x44, 0x41, 0x3f, | ||
83 | 0x3c, 0x3a, 0x37, 0x36, 0x36, 0x1c, 0x1c, 0x1b, | ||
84 | 0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17, | ||
85 | 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13, | ||
86 | 0x13, 0x12, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0f, | ||
87 | 0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b, | ||
88 | 0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07, | ||
89 | 0x07, 0x06, 0x06, 0x05, 0x04, 0x03, 0x02, | ||
90 | }; | ||
91 | |||
92 | static u8 sa2400_rf_calc_rssi(u8 agc, u8 sq) | ||
93 | { | ||
94 | if (sq == 0x80) | ||
95 | return 1; | ||
96 | |||
97 | if (sq > 78) | ||
98 | return 32; | ||
99 | |||
100 | /* TODO: recalc sa2400_rf_rssi_map to avoid mult / div */ | ||
101 | return 65 * sa2400_rf_rssi_map[sq] / 100; | ||
102 | } | ||
103 | |||
79 | static void sa2400_rf_set_channel(struct ieee80211_hw *dev, | 104 | static void sa2400_rf_set_channel(struct ieee80211_hw *dev, |
80 | struct ieee80211_conf *conf) | 105 | struct ieee80211_conf *conf) |
81 | { | 106 | { |
@@ -198,5 +223,6 @@ const struct rtl818x_rf_ops sa2400_rf_ops = { | |||
198 | .name = "Philips", | 223 | .name = "Philips", |
199 | .init = sa2400_rf_init, | 224 | .init = sa2400_rf_init, |
200 | .stop = sa2400_rf_stop, | 225 | .stop = sa2400_rf_stop, |
201 | .set_chan = sa2400_rf_set_channel | 226 | .set_chan = sa2400_rf_set_channel, |
227 | .calc_rssi = sa2400_rf_calc_rssi, | ||
202 | }; | 228 | }; |
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index 891b8490e349..5738a55c1b06 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
@@ -573,7 +573,7 @@ static int rtl8187_cmd_reset(struct ieee80211_hw *dev) | |||
573 | } while (--i); | 573 | } while (--i); |
574 | 574 | ||
575 | if (!i) { | 575 | if (!i) { |
576 | printk(KERN_ERR "%s: Reset timeout!\n", wiphy_name(dev->wiphy)); | 576 | wiphy_err(dev->wiphy, "reset timeout!\n"); |
577 | return -ETIMEDOUT; | 577 | return -ETIMEDOUT; |
578 | } | 578 | } |
579 | 579 | ||
@@ -589,8 +589,7 @@ static int rtl8187_cmd_reset(struct ieee80211_hw *dev) | |||
589 | } while (--i); | 589 | } while (--i); |
590 | 590 | ||
591 | if (!i) { | 591 | if (!i) { |
592 | printk(KERN_ERR "%s: eeprom reset timeout!\n", | 592 | wiphy_err(dev->wiphy, "eeprom reset timeout!\n"); |
593 | wiphy_name(dev->wiphy)); | ||
594 | return -ETIMEDOUT; | 593 | return -ETIMEDOUT; |
595 | } | 594 | } |
596 | 595 | ||
@@ -1527,9 +1526,9 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, | |||
1527 | mutex_init(&priv->conf_mutex); | 1526 | mutex_init(&priv->conf_mutex); |
1528 | skb_queue_head_init(&priv->b_tx_status.queue); | 1527 | skb_queue_head_init(&priv->b_tx_status.queue); |
1529 | 1528 | ||
1530 | printk(KERN_INFO "%s: hwaddr %pM, %s V%d + %s, rfkill mask %d\n", | 1529 | wiphy_info(dev->wiphy, "hwaddr %pm, %s v%d + %s, rfkill mask %d\n", |
1531 | wiphy_name(dev->wiphy), mac_addr, | 1530 | mac_addr, chip_name, priv->asic_rev, priv->rf->name, |
1532 | chip_name, priv->asic_rev, priv->rf->name, priv->rfkill_mask); | 1531 | priv->rfkill_mask); |
1533 | 1532 | ||
1534 | #ifdef CONFIG_RTL8187_LEDS | 1533 | #ifdef CONFIG_RTL8187_LEDS |
1535 | eeprom_93cx6_read(&eeprom, 0x3F, ®); | 1534 | eeprom_93cx6_read(&eeprom, 0x3F, ®); |
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c index a09819386a1e..fd96f9112322 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c +++ b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c | |||
@@ -366,8 +366,8 @@ static void rtl8225_rf_init(struct ieee80211_hw *dev) | |||
366 | rtl8225_write(dev, 0x02, 0x044d); | 366 | rtl8225_write(dev, 0x02, 0x044d); |
367 | msleep(100); | 367 | msleep(100); |
368 | if (!(rtl8225_read(dev, 6) & (1 << 7))) | 368 | if (!(rtl8225_read(dev, 6) & (1 << 7))) |
369 | printk(KERN_WARNING "%s: RF Calibration Failed! %x\n", | 369 | wiphy_warn(dev->wiphy, "rf calibration failed! %x\n", |
370 | wiphy_name(dev->wiphy), rtl8225_read(dev, 6)); | 370 | rtl8225_read(dev, 6)); |
371 | } | 371 | } |
372 | 372 | ||
373 | rtl8225_write(dev, 0x0, 0x127); | 373 | rtl8225_write(dev, 0x0, 0x127); |
@@ -735,8 +735,8 @@ static void rtl8225z2_rf_init(struct ieee80211_hw *dev) | |||
735 | rtl8225_write(dev, 0x02, 0x044D); | 735 | rtl8225_write(dev, 0x02, 0x044D); |
736 | msleep(100); | 736 | msleep(100); |
737 | if (!(rtl8225_read(dev, 6) & (1 << 7))) | 737 | if (!(rtl8225_read(dev, 6) & (1 << 7))) |
738 | printk(KERN_WARNING "%s: RF Calibration Failed! %x\n", | 738 | wiphy_warn(dev->wiphy, "rf calibration failed! %x\n", |
739 | wiphy_name(dev->wiphy), rtl8225_read(dev, 6)); | 739 | rtl8225_read(dev, 6)); |
740 | } | 740 | } |
741 | 741 | ||
742 | msleep(200); | 742 | msleep(200); |
diff --git a/drivers/net/wireless/rtl818x/rtl818x.h b/drivers/net/wireless/rtl818x/rtl818x.h index 978519d1ff4c..1615f63b02f6 100644 --- a/drivers/net/wireless/rtl818x/rtl818x.h +++ b/drivers/net/wireless/rtl818x/rtl818x.h | |||
@@ -193,6 +193,7 @@ struct rtl818x_rf_ops { | |||
193 | void (*stop)(struct ieee80211_hw *); | 193 | void (*stop)(struct ieee80211_hw *); |
194 | void (*set_chan)(struct ieee80211_hw *, struct ieee80211_conf *); | 194 | void (*set_chan)(struct ieee80211_hw *, struct ieee80211_conf *); |
195 | void (*conf_erp)(struct ieee80211_hw *, struct ieee80211_bss_conf *); | 195 | void (*conf_erp)(struct ieee80211_hw *, struct ieee80211_bss_conf *); |
196 | u8 (*calc_rssi)(u8 agc, u8 sq); | ||
196 | }; | 197 | }; |
197 | 198 | ||
198 | /** | 199 | /** |
diff --git a/drivers/net/wireless/wl12xx/wl1251.h b/drivers/net/wireless/wl12xx/wl1251.h index 4f5f02a26e62..6b942a28e6a5 100644 --- a/drivers/net/wireless/wl12xx/wl1251.h +++ b/drivers/net/wireless/wl12xx/wl1251.h | |||
@@ -381,6 +381,9 @@ struct wl1251 { | |||
381 | 381 | ||
382 | u32 chip_id; | 382 | u32 chip_id; |
383 | char fw_ver[21]; | 383 | char fw_ver[21]; |
384 | |||
385 | /* Most recently reported noise in dBm */ | ||
386 | s8 noise; | ||
384 | }; | 387 | }; |
385 | 388 | ||
386 | int wl1251_plt_start(struct wl1251 *wl); | 389 | int wl1251_plt_start(struct wl1251 *wl); |
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c index 2545123931e8..65e0416be5b6 100644 --- a/drivers/net/wireless/wl12xx/wl1251_boot.c +++ b/drivers/net/wireless/wl12xx/wl1251_boot.c | |||
@@ -225,7 +225,7 @@ static void wl1251_boot_set_ecpu_ctrl(struct wl1251 *wl, u32 flag) | |||
225 | int wl1251_boot_run_firmware(struct wl1251 *wl) | 225 | int wl1251_boot_run_firmware(struct wl1251 *wl) |
226 | { | 226 | { |
227 | int loop, ret; | 227 | int loop, ret; |
228 | u32 chip_id, interrupt; | 228 | u32 chip_id, acx_intr; |
229 | 229 | ||
230 | wl1251_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); | 230 | wl1251_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); |
231 | 231 | ||
@@ -242,15 +242,15 @@ int wl1251_boot_run_firmware(struct wl1251 *wl) | |||
242 | loop = 0; | 242 | loop = 0; |
243 | while (loop++ < INIT_LOOP) { | 243 | while (loop++ < INIT_LOOP) { |
244 | udelay(INIT_LOOP_DELAY); | 244 | udelay(INIT_LOOP_DELAY); |
245 | interrupt = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); | 245 | acx_intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); |
246 | 246 | ||
247 | if (interrupt == 0xffffffff) { | 247 | if (acx_intr == 0xffffffff) { |
248 | wl1251_error("error reading hardware complete " | 248 | wl1251_error("error reading hardware complete " |
249 | "init indication"); | 249 | "init indication"); |
250 | return -EIO; | 250 | return -EIO; |
251 | } | 251 | } |
252 | /* check that ACX_INTR_INIT_COMPLETE is enabled */ | 252 | /* check that ACX_INTR_INIT_COMPLETE is enabled */ |
253 | else if (interrupt & WL1251_ACX_INTR_INIT_COMPLETE) { | 253 | else if (acx_intr & WL1251_ACX_INTR_INIT_COMPLETE) { |
254 | wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK, | 254 | wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK, |
255 | WL1251_ACX_INTR_INIT_COMPLETE); | 255 | WL1251_ACX_INTR_INIT_COMPLETE); |
256 | break; | 256 | break; |
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.h b/drivers/net/wireless/wl12xx/wl1251_cmd.h index 7e70dd5a21b8..a9e4991369be 100644 --- a/drivers/net/wireless/wl12xx/wl1251_cmd.h +++ b/drivers/net/wireless/wl12xx/wl1251_cmd.h | |||
@@ -175,8 +175,8 @@ struct cmd_read_write_memory { | |||
175 | #define WL1251_SCAN_NUM_PROBES 3 | 175 | #define WL1251_SCAN_NUM_PROBES 3 |
176 | 176 | ||
177 | struct wl1251_scan_parameters { | 177 | struct wl1251_scan_parameters { |
178 | u32 rx_config_options; | 178 | __le32 rx_config_options; |
179 | u32 rx_filter_options; | 179 | __le32 rx_filter_options; |
180 | 180 | ||
181 | /* | 181 | /* |
182 | * Scan options: | 182 | * Scan options: |
@@ -186,7 +186,7 @@ struct wl1251_scan_parameters { | |||
186 | * bit 2: voice mode, 0 for normal scan. | 186 | * bit 2: voice mode, 0 for normal scan. |
187 | * bit 3: scan priority, 1 for high priority. | 187 | * bit 3: scan priority, 1 for high priority. |
188 | */ | 188 | */ |
189 | u16 scan_options; | 189 | __le16 scan_options; |
190 | 190 | ||
191 | /* Number of channels to scan */ | 191 | /* Number of channels to scan */ |
192 | u8 num_channels; | 192 | u8 num_channels; |
@@ -195,7 +195,7 @@ struct wl1251_scan_parameters { | |||
195 | u8 num_probe_requests; | 195 | u8 num_probe_requests; |
196 | 196 | ||
197 | /* Rate and modulation for probe requests */ | 197 | /* Rate and modulation for probe requests */ |
198 | u16 tx_rate; | 198 | __le16 tx_rate; |
199 | 199 | ||
200 | u8 tid_trigger; | 200 | u8 tid_trigger; |
201 | u8 ssid_len; | 201 | u8 ssid_len; |
@@ -204,8 +204,8 @@ struct wl1251_scan_parameters { | |||
204 | } __packed; | 204 | } __packed; |
205 | 205 | ||
206 | struct wl1251_scan_ch_parameters { | 206 | struct wl1251_scan_ch_parameters { |
207 | u32 min_duration; /* in TU */ | 207 | __le32 min_duration; /* in TU */ |
208 | u32 max_duration; /* in TU */ | 208 | __le32 max_duration; /* in TU */ |
209 | u32 bssid_lsb; | 209 | u32 bssid_lsb; |
210 | u16 bssid_msb; | 210 | u16 bssid_msb; |
211 | 211 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c index 38f72f417183..861a5f33761e 100644 --- a/drivers/net/wireless/wl12xx/wl1251_main.c +++ b/drivers/net/wireless/wl12xx/wl1251_main.c | |||
@@ -411,6 +411,7 @@ static int wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
411 | static int wl1251_op_start(struct ieee80211_hw *hw) | 411 | static int wl1251_op_start(struct ieee80211_hw *hw) |
412 | { | 412 | { |
413 | struct wl1251 *wl = hw->priv; | 413 | struct wl1251 *wl = hw->priv; |
414 | struct wiphy *wiphy = hw->wiphy; | ||
414 | int ret = 0; | 415 | int ret = 0; |
415 | 416 | ||
416 | wl1251_debug(DEBUG_MAC80211, "mac80211 start"); | 417 | wl1251_debug(DEBUG_MAC80211, "mac80211 start"); |
@@ -444,6 +445,10 @@ static int wl1251_op_start(struct ieee80211_hw *hw) | |||
444 | 445 | ||
445 | wl1251_info("firmware booted (%s)", wl->fw_ver); | 446 | wl1251_info("firmware booted (%s)", wl->fw_ver); |
446 | 447 | ||
448 | /* update hw/fw version info in wiphy struct */ | ||
449 | wiphy->hw_version = wl->chip_id; | ||
450 | strncpy(wiphy->fw_version, wl->fw_ver, sizeof(wiphy->fw_version)); | ||
451 | |||
447 | out: | 452 | out: |
448 | if (ret < 0) | 453 | if (ret < 0) |
449 | wl1251_power_off(wl); | 454 | wl1251_power_off(wl); |
@@ -1172,6 +1177,22 @@ out: | |||
1172 | return ret; | 1177 | return ret; |
1173 | } | 1178 | } |
1174 | 1179 | ||
1180 | static int wl1251_op_get_survey(struct ieee80211_hw *hw, int idx, | ||
1181 | struct survey_info *survey) | ||
1182 | { | ||
1183 | struct wl1251 *wl = hw->priv; | ||
1184 | struct ieee80211_conf *conf = &hw->conf; | ||
1185 | |||
1186 | if (idx != 0) | ||
1187 | return -ENOENT; | ||
1188 | |||
1189 | survey->channel = conf->channel; | ||
1190 | survey->filled = SURVEY_INFO_NOISE_DBM; | ||
1191 | survey->noise = wl->noise; | ||
1192 | |||
1193 | return 0; | ||
1194 | } | ||
1195 | |||
1175 | /* can't be const, mac80211 writes to this */ | 1196 | /* can't be const, mac80211 writes to this */ |
1176 | static struct ieee80211_supported_band wl1251_band_2ghz = { | 1197 | static struct ieee80211_supported_band wl1251_band_2ghz = { |
1177 | .channels = wl1251_channels, | 1198 | .channels = wl1251_channels, |
@@ -1193,6 +1214,7 @@ static const struct ieee80211_ops wl1251_ops = { | |||
1193 | .bss_info_changed = wl1251_op_bss_info_changed, | 1214 | .bss_info_changed = wl1251_op_bss_info_changed, |
1194 | .set_rts_threshold = wl1251_op_set_rts_threshold, | 1215 | .set_rts_threshold = wl1251_op_set_rts_threshold, |
1195 | .conf_tx = wl1251_op_conf_tx, | 1216 | .conf_tx = wl1251_op_conf_tx, |
1217 | .get_survey = wl1251_op_get_survey, | ||
1196 | }; | 1218 | }; |
1197 | 1219 | ||
1198 | static int wl1251_read_eeprom_byte(struct wl1251 *wl, off_t offset, u8 *data) | 1220 | static int wl1251_read_eeprom_byte(struct wl1251 *wl, off_t offset, u8 *data) |
diff --git a/drivers/net/wireless/wl12xx/wl1251_rx.c b/drivers/net/wireless/wl12xx/wl1251_rx.c index 851515836a7f..1b6294b3b996 100644 --- a/drivers/net/wireless/wl12xx/wl1251_rx.c +++ b/drivers/net/wireless/wl12xx/wl1251_rx.c | |||
@@ -74,6 +74,12 @@ static void wl1251_rx_status(struct wl1251 *wl, | |||
74 | 74 | ||
75 | status->signal = desc->rssi; | 75 | status->signal = desc->rssi; |
76 | 76 | ||
77 | /* | ||
78 | * FIXME: guessing that snr needs to be divided by two, otherwise | ||
79 | * the values don't make any sense | ||
80 | */ | ||
81 | wl->noise = desc->rssi - desc->snr / 2; | ||
82 | |||
77 | status->freq = ieee80211_channel_to_frequency(desc->channel); | 83 | status->freq = ieee80211_channel_to_frequency(desc->channel); |
78 | 84 | ||
79 | status->flag |= RX_FLAG_TSFT; | 85 | status->flag |= RX_FLAG_TSFT; |
diff --git a/drivers/net/wireless/wl12xx/wl1251_tx.c b/drivers/net/wireless/wl12xx/wl1251_tx.c index c8223185efd2..a38ec199187a 100644 --- a/drivers/net/wireless/wl12xx/wl1251_tx.c +++ b/drivers/net/wireless/wl12xx/wl1251_tx.c | |||
@@ -117,7 +117,7 @@ static void wl1251_tx_frag_block_num(struct tx_double_buffer_desc *tx_hdr) | |||
117 | frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD; | 117 | frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD; |
118 | tx_hdr->frag_threshold = cpu_to_le16(frag_threshold); | 118 | tx_hdr->frag_threshold = cpu_to_le16(frag_threshold); |
119 | 119 | ||
120 | payload_len = tx_hdr->length + MAX_MSDU_SECURITY_LENGTH; | 120 | payload_len = le16_to_cpu(tx_hdr->length) + MAX_MSDU_SECURITY_LENGTH; |
121 | 121 | ||
122 | if (payload_len > frag_threshold) { | 122 | if (payload_len > frag_threshold) { |
123 | mem_blocks_per_frag = | 123 | mem_blocks_per_frag = |
@@ -191,11 +191,13 @@ static int wl1251_tx_send_packet(struct wl1251 *wl, struct sk_buff *skb, | |||
191 | if (control->control.hw_key && | 191 | if (control->control.hw_key && |
192 | control->control.hw_key->alg == ALG_TKIP) { | 192 | control->control.hw_key->alg == ALG_TKIP) { |
193 | int hdrlen; | 193 | int hdrlen; |
194 | u16 fc; | 194 | __le16 fc; |
195 | u16 length; | ||
195 | u8 *pos; | 196 | u8 *pos; |
196 | 197 | ||
197 | fc = *(u16 *)(skb->data + sizeof(*tx_hdr)); | 198 | fc = *(__le16 *)(skb->data + sizeof(*tx_hdr)); |
198 | tx_hdr->length += WL1251_TKIP_IV_SPACE; | 199 | length = le16_to_cpu(tx_hdr->length) + WL1251_TKIP_IV_SPACE; |
200 | tx_hdr->length = cpu_to_le16(length); | ||
199 | 201 | ||
200 | hdrlen = ieee80211_hdrlen(fc); | 202 | hdrlen = ieee80211_hdrlen(fc); |
201 | 203 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1251_tx.h b/drivers/net/wireless/wl12xx/wl1251_tx.h index 65c4be8c2e80..f40eeb37f5aa 100644 --- a/drivers/net/wireless/wl12xx/wl1251_tx.h +++ b/drivers/net/wireless/wl12xx/wl1251_tx.h | |||
@@ -114,7 +114,7 @@ struct tx_control { | |||
114 | 114 | ||
115 | struct tx_double_buffer_desc { | 115 | struct tx_double_buffer_desc { |
116 | /* Length of payload, including headers. */ | 116 | /* Length of payload, including headers. */ |
117 | u16 length; | 117 | __le16 length; |
118 | 118 | ||
119 | /* | 119 | /* |
120 | * A bit mask that specifies the initial rate to be used | 120 | * A bit mask that specifies the initial rate to be used |
@@ -133,10 +133,10 @@ struct tx_double_buffer_desc { | |||
133 | * 0x0800 - 48Mbits | 133 | * 0x0800 - 48Mbits |
134 | * 0x1000 - 54Mbits | 134 | * 0x1000 - 54Mbits |
135 | */ | 135 | */ |
136 | u16 rate; | 136 | __le16 rate; |
137 | 137 | ||
138 | /* Time in us that a packet can spend in the target */ | 138 | /* Time in us that a packet can spend in the target */ |
139 | u32 expiry_time; | 139 | __le32 expiry_time; |
140 | 140 | ||
141 | /* index of the TX queue used for this packet */ | 141 | /* index of the TX queue used for this packet */ |
142 | u8 xmit_queue; | 142 | u8 xmit_queue; |
@@ -150,7 +150,7 @@ struct tx_double_buffer_desc { | |||
150 | * The FW should cut the packet into fragments | 150 | * The FW should cut the packet into fragments |
151 | * of this size. | 151 | * of this size. |
152 | */ | 152 | */ |
153 | u16 frag_threshold; | 153 | __le16 frag_threshold; |
154 | 154 | ||
155 | /* Numbers of HW queue blocks to be allocated */ | 155 | /* Numbers of HW queue blocks to be allocated */ |
156 | u8 num_mem_blocks; | 156 | u8 num_mem_blocks; |
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 53d47d7a2a1d..dd3cee6ea5bb 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -475,6 +475,9 @@ struct wl1271 { | |||
475 | bool sg_enabled; | 475 | bool sg_enabled; |
476 | 476 | ||
477 | struct list_head list; | 477 | struct list_head list; |
478 | |||
479 | /* Most recently reported noise in dBm */ | ||
480 | s8 noise; | ||
478 | }; | 481 | }; |
479 | 482 | ||
480 | int wl1271_plt_start(struct wl1271 *wl); | 483 | int wl1271_plt_start(struct wl1271 *wl); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index d30de58cef90..9d68f0012f05 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -576,7 +576,7 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
576 | goto out; | 576 | goto out; |
577 | } | 577 | } |
578 | 578 | ||
579 | wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); | 579 | wl->nvs = kmemdup(fw->data, sizeof(struct wl1271_nvs_file), GFP_KERNEL); |
580 | 580 | ||
581 | if (!wl->nvs) { | 581 | if (!wl->nvs) { |
582 | wl1271_error("could not allocate memory for the nvs file"); | 582 | wl1271_error("could not allocate memory for the nvs file"); |
@@ -584,8 +584,6 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
584 | goto out; | 584 | goto out; |
585 | } | 585 | } |
586 | 586 | ||
587 | memcpy(wl->nvs, fw->data, fw->size); | ||
588 | |||
589 | out: | 587 | out: |
590 | release_firmware(fw); | 588 | release_firmware(fw); |
591 | 589 | ||
@@ -841,6 +839,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
841 | struct ieee80211_vif *vif) | 839 | struct ieee80211_vif *vif) |
842 | { | 840 | { |
843 | struct wl1271 *wl = hw->priv; | 841 | struct wl1271 *wl = hw->priv; |
842 | struct wiphy *wiphy = hw->wiphy; | ||
844 | int retries = WL1271_BOOT_RETRIES; | 843 | int retries = WL1271_BOOT_RETRIES; |
845 | int ret = 0; | 844 | int ret = 0; |
846 | 845 | ||
@@ -894,6 +893,12 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
894 | 893 | ||
895 | wl->state = WL1271_STATE_ON; | 894 | wl->state = WL1271_STATE_ON; |
896 | wl1271_info("firmware booted (%s)", wl->chip.fw_ver); | 895 | wl1271_info("firmware booted (%s)", wl->chip.fw_ver); |
896 | |||
897 | /* update hw/fw version info in wiphy struct */ | ||
898 | wiphy->hw_version = wl->chip.id; | ||
899 | strncpy(wiphy->fw_version, wl->chip.fw_ver, | ||
900 | sizeof(wiphy->fw_version)); | ||
901 | |||
897 | goto out; | 902 | goto out; |
898 | 903 | ||
899 | irq_disable: | 904 | irq_disable: |
@@ -1929,6 +1934,22 @@ out: | |||
1929 | return mactime; | 1934 | return mactime; |
1930 | } | 1935 | } |
1931 | 1936 | ||
1937 | static int wl1271_op_get_survey(struct ieee80211_hw *hw, int idx, | ||
1938 | struct survey_info *survey) | ||
1939 | { | ||
1940 | struct wl1271 *wl = hw->priv; | ||
1941 | struct ieee80211_conf *conf = &hw->conf; | ||
1942 | |||
1943 | if (idx != 0) | ||
1944 | return -ENOENT; | ||
1945 | |||
1946 | survey->channel = conf->channel; | ||
1947 | survey->filled = SURVEY_INFO_NOISE_DBM; | ||
1948 | survey->noise = wl->noise; | ||
1949 | |||
1950 | return 0; | ||
1951 | } | ||
1952 | |||
1932 | /* can't be const, mac80211 writes to this */ | 1953 | /* can't be const, mac80211 writes to this */ |
1933 | static struct ieee80211_rate wl1271_rates[] = { | 1954 | static struct ieee80211_rate wl1271_rates[] = { |
1934 | { .bitrate = 10, | 1955 | { .bitrate = 10, |
@@ -2158,6 +2179,7 @@ static const struct ieee80211_ops wl1271_ops = { | |||
2158 | .set_rts_threshold = wl1271_op_set_rts_threshold, | 2179 | .set_rts_threshold = wl1271_op_set_rts_threshold, |
2159 | .conf_tx = wl1271_op_conf_tx, | 2180 | .conf_tx = wl1271_op_conf_tx, |
2160 | .get_tsf = wl1271_op_get_tsf, | 2181 | .get_tsf = wl1271_op_get_tsf, |
2182 | .get_survey = wl1271_op_get_survey, | ||
2161 | CFG80211_TESTMODE_CMD(wl1271_tm_cmd) | 2183 | CFG80211_TESTMODE_CMD(wl1271_tm_cmd) |
2162 | }; | 2184 | }; |
2163 | 2185 | ||
@@ -2350,15 +2372,13 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2350 | goto err_hw_alloc; | 2372 | goto err_hw_alloc; |
2351 | } | 2373 | } |
2352 | 2374 | ||
2353 | plat_dev = kmalloc(sizeof(wl1271_device), GFP_KERNEL); | 2375 | plat_dev = kmemdup(&wl1271_device, sizeof(wl1271_device), GFP_KERNEL); |
2354 | if (!plat_dev) { | 2376 | if (!plat_dev) { |
2355 | wl1271_error("could not allocate platform_device"); | 2377 | wl1271_error("could not allocate platform_device"); |
2356 | ret = -ENOMEM; | 2378 | ret = -ENOMEM; |
2357 | goto err_plat_alloc; | 2379 | goto err_plat_alloc; |
2358 | } | 2380 | } |
2359 | 2381 | ||
2360 | memcpy(plat_dev, &wl1271_device, sizeof(wl1271_device)); | ||
2361 | |||
2362 | wl = hw->priv; | 2382 | wl = hw->priv; |
2363 | memset(wl, 0, sizeof(*wl)); | 2383 | memset(wl, 0, sizeof(*wl)); |
2364 | 2384 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c index e98f22b3c3ba..019aa79cd9df 100644 --- a/drivers/net/wireless/wl12xx/wl1271_rx.c +++ b/drivers/net/wireless/wl12xx/wl1271_rx.c | |||
@@ -55,6 +55,13 @@ static void wl1271_rx_status(struct wl1271 *wl, | |||
55 | 55 | ||
56 | status->signal = desc->rssi; | 56 | status->signal = desc->rssi; |
57 | 57 | ||
58 | /* | ||
59 | * FIXME: In wl1251, the SNR should be divided by two. In wl1271 we | ||
60 | * need to divide by two for now, but TI has been discussing about | ||
61 | * changing it. This needs to be rechecked. | ||
62 | */ | ||
63 | wl->noise = desc->rssi - (desc->snr >> 1); | ||
64 | |||
58 | status->freq = ieee80211_channel_to_frequency(desc->channel); | 65 | status->freq = ieee80211_channel_to_frequency(desc->channel); |
59 | 66 | ||
60 | if (desc->flags & WL1271_RX_DESC_ENCRYPT_MASK) { | 67 | if (desc->flags & WL1271_RX_DESC_ENCRYPT_MASK) { |