diff options
145 files changed, 3858 insertions, 2826 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 1e4eb63e2fa4..b04b97fe3217 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3671,7 +3671,7 @@ F: include/linux/mv643xx.h | |||
3671 | MARVELL MWL8K WIRELESS DRIVER | 3671 | MARVELL MWL8K WIRELESS DRIVER |
3672 | M: Lennert Buytenhek <buytenh@wantstofly.org> | 3672 | M: Lennert Buytenhek <buytenh@wantstofly.org> |
3673 | L: linux-wireless@vger.kernel.org | 3673 | L: linux-wireless@vger.kernel.org |
3674 | S: Maintained | 3674 | S: Odd Fixes |
3675 | F: drivers/net/wireless/mwl8k.c | 3675 | F: drivers/net/wireless/mwl8k.c |
3676 | 3676 | ||
3677 | MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER | 3677 | MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER |
@@ -4522,7 +4522,7 @@ PRISM54 WIRELESS DRIVER | |||
4522 | M: "Luis R. Rodriguez" <mcgrof@gmail.com> | 4522 | M: "Luis R. Rodriguez" <mcgrof@gmail.com> |
4523 | L: linux-wireless@vger.kernel.org | 4523 | L: linux-wireless@vger.kernel.org |
4524 | W: http://prism54.org | 4524 | W: http://prism54.org |
4525 | S: Maintained | 4525 | S: Obsolete |
4526 | F: drivers/net/wireless/prism54/ | 4526 | F: drivers/net/wireless/prism54/ |
4527 | 4527 | ||
4528 | PROMISE DC4030 CACHING DISK CONTROLLER DRIVER | 4528 | PROMISE DC4030 CACHING DISK CONTROLLER DRIVER |
@@ -4712,9 +4712,8 @@ S: Maintained | |||
4712 | F: drivers/rapidio/ | 4712 | F: drivers/rapidio/ |
4713 | 4713 | ||
4714 | RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER | 4714 | RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER |
4715 | M: Corey Thomas <coreythomas@charter.net> | ||
4716 | L: linux-wireless@vger.kernel.org | 4715 | L: linux-wireless@vger.kernel.org |
4717 | S: Maintained | 4716 | S: Orphan |
4718 | F: drivers/net/wireless/ray* | 4717 | F: drivers/net/wireless/ray* |
4719 | 4718 | ||
4720 | RCUTORTURE MODULE | 4719 | RCUTORTURE MODULE |
@@ -6037,10 +6036,9 @@ F: Documentation/video4linux/zc0301.txt | |||
6037 | F: drivers/media/video/zc0301/ | 6036 | F: drivers/media/video/zc0301/ |
6038 | 6037 | ||
6039 | USB ZD1201 DRIVER | 6038 | USB ZD1201 DRIVER |
6040 | M: Jeroen Vreeken <pe1rxq@amsat.org> | 6039 | L: linux-wireless@vger.kernel.org |
6041 | L: linux-usb@vger.kernel.org | ||
6042 | W: http://linux-lc100020.sourceforge.net | 6040 | W: http://linux-lc100020.sourceforge.net |
6043 | S: Maintained | 6041 | S: Orphan |
6044 | F: drivers/net/wireless/zd1201.* | 6042 | F: drivers/net/wireless/zd1201.* |
6045 | 6043 | ||
6046 | USB ZR364XX DRIVER | 6044 | USB ZR364XX DRIVER |
@@ -6226,14 +6224,6 @@ F: Documentation/watchdog/ | |||
6226 | F: drivers/watchdog/ | 6224 | F: drivers/watchdog/ |
6227 | F: include/linux/watchdog.h | 6225 | F: include/linux/watchdog.h |
6228 | 6226 | ||
6229 | WAVELAN NETWORK DRIVER & WIRELESS EXTENSIONS | ||
6230 | M: Jean Tourrilhes <jt@hpl.hp.com> | ||
6231 | L: linux-wireless@vger.kernel.org | ||
6232 | W: http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/ | ||
6233 | S: Maintained | ||
6234 | F: Documentation/networking/wavelan.txt | ||
6235 | F: drivers/staging/wavelan/ | ||
6236 | |||
6237 | WD7000 SCSI DRIVER | 6227 | WD7000 SCSI DRIVER |
6238 | M: Miroslav Zagorac <zaga@fly.cc.fer.hr> | 6228 | M: Miroslav Zagorac <zaga@fly.cc.fer.hr> |
6239 | L: linux-scsi@vger.kernel.org | 6229 | L: linux-scsi@vger.kernel.org |
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) { |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 641640dc7ae5..8ea5e3374507 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -601,8 +601,11 @@ static int ioc_settimeout(unsigned int fd, unsigned int cmd, | |||
601 | } | 601 | } |
602 | 602 | ||
603 | /* Bluetooth ioctls */ | 603 | /* Bluetooth ioctls */ |
604 | #define HCIUARTSETPROTO _IOW('U', 200, int) | 604 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
605 | #define HCIUARTGETPROTO _IOR('U', 201, int) | 605 | #define HCIUARTGETPROTO _IOR('U', 201, int) |
606 | #define HCIUARTGETDEVICE _IOR('U', 202, int) | ||
607 | #define HCIUARTSETFLAGS _IOW('U', 203, int) | ||
608 | #define HCIUARTGETFLAGS _IOR('U', 204, int) | ||
606 | 609 | ||
607 | #define BNEPCONNADD _IOW('B', 200, int) | 610 | #define BNEPCONNADD _IOW('B', 200, int) |
608 | #define BNEPCONNDEL _IOW('B', 201, int) | 611 | #define BNEPCONNDEL _IOW('B', 201, int) |
@@ -1328,6 +1331,8 @@ COMPATIBLE_IOCTL(HCISETLINKPOL) | |||
1328 | COMPATIBLE_IOCTL(HCISETLINKMODE) | 1331 | COMPATIBLE_IOCTL(HCISETLINKMODE) |
1329 | COMPATIBLE_IOCTL(HCISETACLMTU) | 1332 | COMPATIBLE_IOCTL(HCISETACLMTU) |
1330 | COMPATIBLE_IOCTL(HCISETSCOMTU) | 1333 | COMPATIBLE_IOCTL(HCISETSCOMTU) |
1334 | COMPATIBLE_IOCTL(HCIBLOCKADDR) | ||
1335 | COMPATIBLE_IOCTL(HCIUNBLOCKADDR) | ||
1331 | COMPATIBLE_IOCTL(HCIINQUIRY) | 1336 | COMPATIBLE_IOCTL(HCIINQUIRY) |
1332 | COMPATIBLE_IOCTL(HCIUARTSETPROTO) | 1337 | COMPATIBLE_IOCTL(HCIUARTSETPROTO) |
1333 | COMPATIBLE_IOCTL(HCIUARTGETPROTO) | 1338 | COMPATIBLE_IOCTL(HCIUARTGETPROTO) |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index ff77e8f882f1..27a902d9b3a9 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -84,7 +84,7 @@ enum { | |||
84 | /* BD Address */ | 84 | /* BD Address */ |
85 | typedef struct { | 85 | typedef struct { |
86 | __u8 b[6]; | 86 | __u8 b[6]; |
87 | } __attribute__((packed)) bdaddr_t; | 87 | } __packed bdaddr_t; |
88 | 88 | ||
89 | #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) | 89 | #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) |
90 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) | 90 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) |
@@ -138,6 +138,7 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); | |||
138 | struct bt_skb_cb { | 138 | struct bt_skb_cb { |
139 | __u8 pkt_type; | 139 | __u8 pkt_type; |
140 | __u8 incoming; | 140 | __u8 incoming; |
141 | __u16 expect; | ||
141 | __u8 tx_seq; | 142 | __u8 tx_seq; |
142 | __u8 retries; | 143 | __u8 retries; |
143 | __u8 sar; | 144 | __u8 sar; |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index fc0c502d9fd1..bcbdd6d4e6dd 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -100,6 +100,9 @@ enum { | |||
100 | #define HCISETACLMTU _IOW('H', 227, int) | 100 | #define HCISETACLMTU _IOW('H', 227, int) |
101 | #define HCISETSCOMTU _IOW('H', 228, int) | 101 | #define HCISETSCOMTU _IOW('H', 228, int) |
102 | 102 | ||
103 | #define HCIBLOCKADDR _IOW('H', 230, int) | ||
104 | #define HCIUNBLOCKADDR _IOW('H', 231, int) | ||
105 | |||
103 | #define HCIINQUIRY _IOR('H', 240, int) | 106 | #define HCIINQUIRY _IOR('H', 240, int) |
104 | 107 | ||
105 | /* HCI timeouts */ | 108 | /* HCI timeouts */ |
@@ -227,7 +230,7 @@ struct hci_cp_inquiry { | |||
227 | __u8 lap[3]; | 230 | __u8 lap[3]; |
228 | __u8 length; | 231 | __u8 length; |
229 | __u8 num_rsp; | 232 | __u8 num_rsp; |
230 | } __attribute__ ((packed)); | 233 | } __packed; |
231 | 234 | ||
232 | #define HCI_OP_INQUIRY_CANCEL 0x0402 | 235 | #define HCI_OP_INQUIRY_CANCEL 0x0402 |
233 | 236 | ||
@@ -241,81 +244,81 @@ struct hci_cp_create_conn { | |||
241 | __u8 pscan_mode; | 244 | __u8 pscan_mode; |
242 | __le16 clock_offset; | 245 | __le16 clock_offset; |
243 | __u8 role_switch; | 246 | __u8 role_switch; |
244 | } __attribute__ ((packed)); | 247 | } __packed; |
245 | 248 | ||
246 | #define HCI_OP_DISCONNECT 0x0406 | 249 | #define HCI_OP_DISCONNECT 0x0406 |
247 | struct hci_cp_disconnect { | 250 | struct hci_cp_disconnect { |
248 | __le16 handle; | 251 | __le16 handle; |
249 | __u8 reason; | 252 | __u8 reason; |
250 | } __attribute__ ((packed)); | 253 | } __packed; |
251 | 254 | ||
252 | #define HCI_OP_ADD_SCO 0x0407 | 255 | #define HCI_OP_ADD_SCO 0x0407 |
253 | struct hci_cp_add_sco { | 256 | struct hci_cp_add_sco { |
254 | __le16 handle; | 257 | __le16 handle; |
255 | __le16 pkt_type; | 258 | __le16 pkt_type; |
256 | } __attribute__ ((packed)); | 259 | } __packed; |
257 | 260 | ||
258 | #define HCI_OP_CREATE_CONN_CANCEL 0x0408 | 261 | #define HCI_OP_CREATE_CONN_CANCEL 0x0408 |
259 | struct hci_cp_create_conn_cancel { | 262 | struct hci_cp_create_conn_cancel { |
260 | bdaddr_t bdaddr; | 263 | bdaddr_t bdaddr; |
261 | } __attribute__ ((packed)); | 264 | } __packed; |
262 | 265 | ||
263 | #define HCI_OP_ACCEPT_CONN_REQ 0x0409 | 266 | #define HCI_OP_ACCEPT_CONN_REQ 0x0409 |
264 | struct hci_cp_accept_conn_req { | 267 | struct hci_cp_accept_conn_req { |
265 | bdaddr_t bdaddr; | 268 | bdaddr_t bdaddr; |
266 | __u8 role; | 269 | __u8 role; |
267 | } __attribute__ ((packed)); | 270 | } __packed; |
268 | 271 | ||
269 | #define HCI_OP_REJECT_CONN_REQ 0x040a | 272 | #define HCI_OP_REJECT_CONN_REQ 0x040a |
270 | struct hci_cp_reject_conn_req { | 273 | struct hci_cp_reject_conn_req { |
271 | bdaddr_t bdaddr; | 274 | bdaddr_t bdaddr; |
272 | __u8 reason; | 275 | __u8 reason; |
273 | } __attribute__ ((packed)); | 276 | } __packed; |
274 | 277 | ||
275 | #define HCI_OP_LINK_KEY_REPLY 0x040b | 278 | #define HCI_OP_LINK_KEY_REPLY 0x040b |
276 | struct hci_cp_link_key_reply { | 279 | struct hci_cp_link_key_reply { |
277 | bdaddr_t bdaddr; | 280 | bdaddr_t bdaddr; |
278 | __u8 link_key[16]; | 281 | __u8 link_key[16]; |
279 | } __attribute__ ((packed)); | 282 | } __packed; |
280 | 283 | ||
281 | #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c | 284 | #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c |
282 | struct hci_cp_link_key_neg_reply { | 285 | struct hci_cp_link_key_neg_reply { |
283 | bdaddr_t bdaddr; | 286 | bdaddr_t bdaddr; |
284 | } __attribute__ ((packed)); | 287 | } __packed; |
285 | 288 | ||
286 | #define HCI_OP_PIN_CODE_REPLY 0x040d | 289 | #define HCI_OP_PIN_CODE_REPLY 0x040d |
287 | struct hci_cp_pin_code_reply { | 290 | struct hci_cp_pin_code_reply { |
288 | bdaddr_t bdaddr; | 291 | bdaddr_t bdaddr; |
289 | __u8 pin_len; | 292 | __u8 pin_len; |
290 | __u8 pin_code[16]; | 293 | __u8 pin_code[16]; |
291 | } __attribute__ ((packed)); | 294 | } __packed; |
292 | 295 | ||
293 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e | 296 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e |
294 | struct hci_cp_pin_code_neg_reply { | 297 | struct hci_cp_pin_code_neg_reply { |
295 | bdaddr_t bdaddr; | 298 | bdaddr_t bdaddr; |
296 | } __attribute__ ((packed)); | 299 | } __packed; |
297 | 300 | ||
298 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f | 301 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f |
299 | struct hci_cp_change_conn_ptype { | 302 | struct hci_cp_change_conn_ptype { |
300 | __le16 handle; | 303 | __le16 handle; |
301 | __le16 pkt_type; | 304 | __le16 pkt_type; |
302 | } __attribute__ ((packed)); | 305 | } __packed; |
303 | 306 | ||
304 | #define HCI_OP_AUTH_REQUESTED 0x0411 | 307 | #define HCI_OP_AUTH_REQUESTED 0x0411 |
305 | struct hci_cp_auth_requested { | 308 | struct hci_cp_auth_requested { |
306 | __le16 handle; | 309 | __le16 handle; |
307 | } __attribute__ ((packed)); | 310 | } __packed; |
308 | 311 | ||
309 | #define HCI_OP_SET_CONN_ENCRYPT 0x0413 | 312 | #define HCI_OP_SET_CONN_ENCRYPT 0x0413 |
310 | struct hci_cp_set_conn_encrypt { | 313 | struct hci_cp_set_conn_encrypt { |
311 | __le16 handle; | 314 | __le16 handle; |
312 | __u8 encrypt; | 315 | __u8 encrypt; |
313 | } __attribute__ ((packed)); | 316 | } __packed; |
314 | 317 | ||
315 | #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 | 318 | #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 |
316 | struct hci_cp_change_conn_link_key { | 319 | struct hci_cp_change_conn_link_key { |
317 | __le16 handle; | 320 | __le16 handle; |
318 | } __attribute__ ((packed)); | 321 | } __packed; |
319 | 322 | ||
320 | #define HCI_OP_REMOTE_NAME_REQ 0x0419 | 323 | #define HCI_OP_REMOTE_NAME_REQ 0x0419 |
321 | struct hci_cp_remote_name_req { | 324 | struct hci_cp_remote_name_req { |
@@ -323,28 +326,28 @@ struct hci_cp_remote_name_req { | |||
323 | __u8 pscan_rep_mode; | 326 | __u8 pscan_rep_mode; |
324 | __u8 pscan_mode; | 327 | __u8 pscan_mode; |
325 | __le16 clock_offset; | 328 | __le16 clock_offset; |
326 | } __attribute__ ((packed)); | 329 | } __packed; |
327 | 330 | ||
328 | #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a | 331 | #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a |
329 | struct hci_cp_remote_name_req_cancel { | 332 | struct hci_cp_remote_name_req_cancel { |
330 | bdaddr_t bdaddr; | 333 | bdaddr_t bdaddr; |
331 | } __attribute__ ((packed)); | 334 | } __packed; |
332 | 335 | ||
333 | #define HCI_OP_READ_REMOTE_FEATURES 0x041b | 336 | #define HCI_OP_READ_REMOTE_FEATURES 0x041b |
334 | struct hci_cp_read_remote_features { | 337 | struct hci_cp_read_remote_features { |
335 | __le16 handle; | 338 | __le16 handle; |
336 | } __attribute__ ((packed)); | 339 | } __packed; |
337 | 340 | ||
338 | #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c | 341 | #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c |
339 | struct hci_cp_read_remote_ext_features { | 342 | struct hci_cp_read_remote_ext_features { |
340 | __le16 handle; | 343 | __le16 handle; |
341 | __u8 page; | 344 | __u8 page; |
342 | } __attribute__ ((packed)); | 345 | } __packed; |
343 | 346 | ||
344 | #define HCI_OP_READ_REMOTE_VERSION 0x041d | 347 | #define HCI_OP_READ_REMOTE_VERSION 0x041d |
345 | struct hci_cp_read_remote_version { | 348 | struct hci_cp_read_remote_version { |
346 | __le16 handle; | 349 | __le16 handle; |
347 | } __attribute__ ((packed)); | 350 | } __packed; |
348 | 351 | ||
349 | #define HCI_OP_SETUP_SYNC_CONN 0x0428 | 352 | #define HCI_OP_SETUP_SYNC_CONN 0x0428 |
350 | struct hci_cp_setup_sync_conn { | 353 | struct hci_cp_setup_sync_conn { |
@@ -355,7 +358,7 @@ struct hci_cp_setup_sync_conn { | |||
355 | __le16 voice_setting; | 358 | __le16 voice_setting; |
356 | __u8 retrans_effort; | 359 | __u8 retrans_effort; |
357 | __le16 pkt_type; | 360 | __le16 pkt_type; |
358 | } __attribute__ ((packed)); | 361 | } __packed; |
359 | 362 | ||
360 | #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 | 363 | #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 |
361 | struct hci_cp_accept_sync_conn_req { | 364 | struct hci_cp_accept_sync_conn_req { |
@@ -366,13 +369,13 @@ struct hci_cp_accept_sync_conn_req { | |||
366 | __le16 content_format; | 369 | __le16 content_format; |
367 | __u8 retrans_effort; | 370 | __u8 retrans_effort; |
368 | __le16 pkt_type; | 371 | __le16 pkt_type; |
369 | } __attribute__ ((packed)); | 372 | } __packed; |
370 | 373 | ||
371 | #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a | 374 | #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a |
372 | struct hci_cp_reject_sync_conn_req { | 375 | struct hci_cp_reject_sync_conn_req { |
373 | bdaddr_t bdaddr; | 376 | bdaddr_t bdaddr; |
374 | __u8 reason; | 377 | __u8 reason; |
375 | } __attribute__ ((packed)); | 378 | } __packed; |
376 | 379 | ||
377 | #define HCI_OP_SNIFF_MODE 0x0803 | 380 | #define HCI_OP_SNIFF_MODE 0x0803 |
378 | struct hci_cp_sniff_mode { | 381 | struct hci_cp_sniff_mode { |
@@ -381,59 +384,59 @@ struct hci_cp_sniff_mode { | |||
381 | __le16 min_interval; | 384 | __le16 min_interval; |
382 | __le16 attempt; | 385 | __le16 attempt; |
383 | __le16 timeout; | 386 | __le16 timeout; |
384 | } __attribute__ ((packed)); | 387 | } __packed; |
385 | 388 | ||
386 | #define HCI_OP_EXIT_SNIFF_MODE 0x0804 | 389 | #define HCI_OP_EXIT_SNIFF_MODE 0x0804 |
387 | struct hci_cp_exit_sniff_mode { | 390 | struct hci_cp_exit_sniff_mode { |
388 | __le16 handle; | 391 | __le16 handle; |
389 | } __attribute__ ((packed)); | 392 | } __packed; |
390 | 393 | ||
391 | #define HCI_OP_ROLE_DISCOVERY 0x0809 | 394 | #define HCI_OP_ROLE_DISCOVERY 0x0809 |
392 | struct hci_cp_role_discovery { | 395 | struct hci_cp_role_discovery { |
393 | __le16 handle; | 396 | __le16 handle; |
394 | } __attribute__ ((packed)); | 397 | } __packed; |
395 | struct hci_rp_role_discovery { | 398 | struct hci_rp_role_discovery { |
396 | __u8 status; | 399 | __u8 status; |
397 | __le16 handle; | 400 | __le16 handle; |
398 | __u8 role; | 401 | __u8 role; |
399 | } __attribute__ ((packed)); | 402 | } __packed; |
400 | 403 | ||
401 | #define HCI_OP_SWITCH_ROLE 0x080b | 404 | #define HCI_OP_SWITCH_ROLE 0x080b |
402 | struct hci_cp_switch_role { | 405 | struct hci_cp_switch_role { |
403 | bdaddr_t bdaddr; | 406 | bdaddr_t bdaddr; |
404 | __u8 role; | 407 | __u8 role; |
405 | } __attribute__ ((packed)); | 408 | } __packed; |
406 | 409 | ||
407 | #define HCI_OP_READ_LINK_POLICY 0x080c | 410 | #define HCI_OP_READ_LINK_POLICY 0x080c |
408 | struct hci_cp_read_link_policy { | 411 | struct hci_cp_read_link_policy { |
409 | __le16 handle; | 412 | __le16 handle; |
410 | } __attribute__ ((packed)); | 413 | } __packed; |
411 | struct hci_rp_read_link_policy { | 414 | struct hci_rp_read_link_policy { |
412 | __u8 status; | 415 | __u8 status; |
413 | __le16 handle; | 416 | __le16 handle; |
414 | __le16 policy; | 417 | __le16 policy; |
415 | } __attribute__ ((packed)); | 418 | } __packed; |
416 | 419 | ||
417 | #define HCI_OP_WRITE_LINK_POLICY 0x080d | 420 | #define HCI_OP_WRITE_LINK_POLICY 0x080d |
418 | struct hci_cp_write_link_policy { | 421 | struct hci_cp_write_link_policy { |
419 | __le16 handle; | 422 | __le16 handle; |
420 | __le16 policy; | 423 | __le16 policy; |
421 | } __attribute__ ((packed)); | 424 | } __packed; |
422 | struct hci_rp_write_link_policy { | 425 | struct hci_rp_write_link_policy { |
423 | __u8 status; | 426 | __u8 status; |
424 | __le16 handle; | 427 | __le16 handle; |
425 | } __attribute__ ((packed)); | 428 | } __packed; |
426 | 429 | ||
427 | #define HCI_OP_READ_DEF_LINK_POLICY 0x080e | 430 | #define HCI_OP_READ_DEF_LINK_POLICY 0x080e |
428 | struct hci_rp_read_def_link_policy { | 431 | struct hci_rp_read_def_link_policy { |
429 | __u8 status; | 432 | __u8 status; |
430 | __le16 policy; | 433 | __le16 policy; |
431 | } __attribute__ ((packed)); | 434 | } __packed; |
432 | 435 | ||
433 | #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f | 436 | #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f |
434 | struct hci_cp_write_def_link_policy { | 437 | struct hci_cp_write_def_link_policy { |
435 | __le16 policy; | 438 | __le16 policy; |
436 | } __attribute__ ((packed)); | 439 | } __packed; |
437 | 440 | ||
438 | #define HCI_OP_SNIFF_SUBRATE 0x0811 | 441 | #define HCI_OP_SNIFF_SUBRATE 0x0811 |
439 | struct hci_cp_sniff_subrate { | 442 | struct hci_cp_sniff_subrate { |
@@ -441,12 +444,12 @@ struct hci_cp_sniff_subrate { | |||
441 | __le16 max_latency; | 444 | __le16 max_latency; |
442 | __le16 min_remote_timeout; | 445 | __le16 min_remote_timeout; |
443 | __le16 min_local_timeout; | 446 | __le16 min_local_timeout; |
444 | } __attribute__ ((packed)); | 447 | } __packed; |
445 | 448 | ||
446 | #define HCI_OP_SET_EVENT_MASK 0x0c01 | 449 | #define HCI_OP_SET_EVENT_MASK 0x0c01 |
447 | struct hci_cp_set_event_mask { | 450 | struct hci_cp_set_event_mask { |
448 | __u8 mask[8]; | 451 | __u8 mask[8]; |
449 | } __attribute__ ((packed)); | 452 | } __packed; |
450 | 453 | ||
451 | #define HCI_OP_RESET 0x0c03 | 454 | #define HCI_OP_RESET 0x0c03 |
452 | 455 | ||
@@ -455,7 +458,7 @@ struct hci_cp_set_event_flt { | |||
455 | __u8 flt_type; | 458 | __u8 flt_type; |
456 | __u8 cond_type; | 459 | __u8 cond_type; |
457 | __u8 condition[0]; | 460 | __u8 condition[0]; |
458 | } __attribute__ ((packed)); | 461 | } __packed; |
459 | 462 | ||
460 | /* Filter types */ | 463 | /* Filter types */ |
461 | #define HCI_FLT_CLEAR_ALL 0x00 | 464 | #define HCI_FLT_CLEAR_ALL 0x00 |
@@ -474,13 +477,13 @@ struct hci_cp_set_event_flt { | |||
474 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 | 477 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 |
475 | struct hci_cp_write_local_name { | 478 | struct hci_cp_write_local_name { |
476 | __u8 name[248]; | 479 | __u8 name[248]; |
477 | } __attribute__ ((packed)); | 480 | } __packed; |
478 | 481 | ||
479 | #define HCI_OP_READ_LOCAL_NAME 0x0c14 | 482 | #define HCI_OP_READ_LOCAL_NAME 0x0c14 |
480 | struct hci_rp_read_local_name { | 483 | struct hci_rp_read_local_name { |
481 | __u8 status; | 484 | __u8 status; |
482 | __u8 name[248]; | 485 | __u8 name[248]; |
483 | } __attribute__ ((packed)); | 486 | } __packed; |
484 | 487 | ||
485 | #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 | 488 | #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 |
486 | 489 | ||
@@ -508,23 +511,23 @@ struct hci_rp_read_local_name { | |||
508 | struct hci_rp_read_class_of_dev { | 511 | struct hci_rp_read_class_of_dev { |
509 | __u8 status; | 512 | __u8 status; |
510 | __u8 dev_class[3]; | 513 | __u8 dev_class[3]; |
511 | } __attribute__ ((packed)); | 514 | } __packed; |
512 | 515 | ||
513 | #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 | 516 | #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 |
514 | struct hci_cp_write_class_of_dev { | 517 | struct hci_cp_write_class_of_dev { |
515 | __u8 dev_class[3]; | 518 | __u8 dev_class[3]; |
516 | } __attribute__ ((packed)); | 519 | } __packed; |
517 | 520 | ||
518 | #define HCI_OP_READ_VOICE_SETTING 0x0c25 | 521 | #define HCI_OP_READ_VOICE_SETTING 0x0c25 |
519 | struct hci_rp_read_voice_setting { | 522 | struct hci_rp_read_voice_setting { |
520 | __u8 status; | 523 | __u8 status; |
521 | __le16 voice_setting; | 524 | __le16 voice_setting; |
522 | } __attribute__ ((packed)); | 525 | } __packed; |
523 | 526 | ||
524 | #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 | 527 | #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 |
525 | struct hci_cp_write_voice_setting { | 528 | struct hci_cp_write_voice_setting { |
526 | __le16 voice_setting; | 529 | __le16 voice_setting; |
527 | } __attribute__ ((packed)); | 530 | } __packed; |
528 | 531 | ||
529 | #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 | 532 | #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 |
530 | struct hci_cp_host_buffer_size { | 533 | struct hci_cp_host_buffer_size { |
@@ -532,18 +535,18 @@ struct hci_cp_host_buffer_size { | |||
532 | __u8 sco_mtu; | 535 | __u8 sco_mtu; |
533 | __le16 acl_max_pkt; | 536 | __le16 acl_max_pkt; |
534 | __le16 sco_max_pkt; | 537 | __le16 sco_max_pkt; |
535 | } __attribute__ ((packed)); | 538 | } __packed; |
536 | 539 | ||
537 | #define HCI_OP_READ_SSP_MODE 0x0c55 | 540 | #define HCI_OP_READ_SSP_MODE 0x0c55 |
538 | struct hci_rp_read_ssp_mode { | 541 | struct hci_rp_read_ssp_mode { |
539 | __u8 status; | 542 | __u8 status; |
540 | __u8 mode; | 543 | __u8 mode; |
541 | } __attribute__ ((packed)); | 544 | } __packed; |
542 | 545 | ||
543 | #define HCI_OP_WRITE_SSP_MODE 0x0c56 | 546 | #define HCI_OP_WRITE_SSP_MODE 0x0c56 |
544 | struct hci_cp_write_ssp_mode { | 547 | struct hci_cp_write_ssp_mode { |
545 | __u8 mode; | 548 | __u8 mode; |
546 | } __attribute__ ((packed)); | 549 | } __packed; |
547 | 550 | ||
548 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 551 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
549 | struct hci_rp_read_local_version { | 552 | struct hci_rp_read_local_version { |
@@ -553,19 +556,19 @@ struct hci_rp_read_local_version { | |||
553 | __u8 lmp_ver; | 556 | __u8 lmp_ver; |
554 | __le16 manufacturer; | 557 | __le16 manufacturer; |
555 | __le16 lmp_subver; | 558 | __le16 lmp_subver; |
556 | } __attribute__ ((packed)); | 559 | } __packed; |
557 | 560 | ||
558 | #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 | 561 | #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 |
559 | struct hci_rp_read_local_commands { | 562 | struct hci_rp_read_local_commands { |
560 | __u8 status; | 563 | __u8 status; |
561 | __u8 commands[64]; | 564 | __u8 commands[64]; |
562 | } __attribute__ ((packed)); | 565 | } __packed; |
563 | 566 | ||
564 | #define HCI_OP_READ_LOCAL_FEATURES 0x1003 | 567 | #define HCI_OP_READ_LOCAL_FEATURES 0x1003 |
565 | struct hci_rp_read_local_features { | 568 | struct hci_rp_read_local_features { |
566 | __u8 status; | 569 | __u8 status; |
567 | __u8 features[8]; | 570 | __u8 features[8]; |
568 | } __attribute__ ((packed)); | 571 | } __packed; |
569 | 572 | ||
570 | #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 | 573 | #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 |
571 | struct hci_rp_read_local_ext_features { | 574 | struct hci_rp_read_local_ext_features { |
@@ -573,7 +576,7 @@ struct hci_rp_read_local_ext_features { | |||
573 | __u8 page; | 576 | __u8 page; |
574 | __u8 max_page; | 577 | __u8 max_page; |
575 | __u8 features[8]; | 578 | __u8 features[8]; |
576 | } __attribute__ ((packed)); | 579 | } __packed; |
577 | 580 | ||
578 | #define HCI_OP_READ_BUFFER_SIZE 0x1005 | 581 | #define HCI_OP_READ_BUFFER_SIZE 0x1005 |
579 | struct hci_rp_read_buffer_size { | 582 | struct hci_rp_read_buffer_size { |
@@ -582,13 +585,13 @@ struct hci_rp_read_buffer_size { | |||
582 | __u8 sco_mtu; | 585 | __u8 sco_mtu; |
583 | __le16 acl_max_pkt; | 586 | __le16 acl_max_pkt; |
584 | __le16 sco_max_pkt; | 587 | __le16 sco_max_pkt; |
585 | } __attribute__ ((packed)); | 588 | } __packed; |
586 | 589 | ||
587 | #define HCI_OP_READ_BD_ADDR 0x1009 | 590 | #define HCI_OP_READ_BD_ADDR 0x1009 |
588 | struct hci_rp_read_bd_addr { | 591 | struct hci_rp_read_bd_addr { |
589 | __u8 status; | 592 | __u8 status; |
590 | bdaddr_t bdaddr; | 593 | bdaddr_t bdaddr; |
591 | } __attribute__ ((packed)); | 594 | } __packed; |
592 | 595 | ||
593 | /* ---- HCI Events ---- */ | 596 | /* ---- HCI Events ---- */ |
594 | #define HCI_EV_INQUIRY_COMPLETE 0x01 | 597 | #define HCI_EV_INQUIRY_COMPLETE 0x01 |
@@ -601,7 +604,7 @@ struct inquiry_info { | |||
601 | __u8 pscan_mode; | 604 | __u8 pscan_mode; |
602 | __u8 dev_class[3]; | 605 | __u8 dev_class[3]; |
603 | __le16 clock_offset; | 606 | __le16 clock_offset; |
604 | } __attribute__ ((packed)); | 607 | } __packed; |
605 | 608 | ||
606 | #define HCI_EV_CONN_COMPLETE 0x03 | 609 | #define HCI_EV_CONN_COMPLETE 0x03 |
607 | struct hci_ev_conn_complete { | 610 | struct hci_ev_conn_complete { |
@@ -610,54 +613,54 @@ struct hci_ev_conn_complete { | |||
610 | bdaddr_t bdaddr; | 613 | bdaddr_t bdaddr; |
611 | __u8 link_type; | 614 | __u8 link_type; |
612 | __u8 encr_mode; | 615 | __u8 encr_mode; |
613 | } __attribute__ ((packed)); | 616 | } __packed; |
614 | 617 | ||
615 | #define HCI_EV_CONN_REQUEST 0x04 | 618 | #define HCI_EV_CONN_REQUEST 0x04 |
616 | struct hci_ev_conn_request { | 619 | struct hci_ev_conn_request { |
617 | bdaddr_t bdaddr; | 620 | bdaddr_t bdaddr; |
618 | __u8 dev_class[3]; | 621 | __u8 dev_class[3]; |
619 | __u8 link_type; | 622 | __u8 link_type; |
620 | } __attribute__ ((packed)); | 623 | } __packed; |
621 | 624 | ||
622 | #define HCI_EV_DISCONN_COMPLETE 0x05 | 625 | #define HCI_EV_DISCONN_COMPLETE 0x05 |
623 | struct hci_ev_disconn_complete { | 626 | struct hci_ev_disconn_complete { |
624 | __u8 status; | 627 | __u8 status; |
625 | __le16 handle; | 628 | __le16 handle; |
626 | __u8 reason; | 629 | __u8 reason; |
627 | } __attribute__ ((packed)); | 630 | } __packed; |
628 | 631 | ||
629 | #define HCI_EV_AUTH_COMPLETE 0x06 | 632 | #define HCI_EV_AUTH_COMPLETE 0x06 |
630 | struct hci_ev_auth_complete { | 633 | struct hci_ev_auth_complete { |
631 | __u8 status; | 634 | __u8 status; |
632 | __le16 handle; | 635 | __le16 handle; |
633 | } __attribute__ ((packed)); | 636 | } __packed; |
634 | 637 | ||
635 | #define HCI_EV_REMOTE_NAME 0x07 | 638 | #define HCI_EV_REMOTE_NAME 0x07 |
636 | struct hci_ev_remote_name { | 639 | struct hci_ev_remote_name { |
637 | __u8 status; | 640 | __u8 status; |
638 | bdaddr_t bdaddr; | 641 | bdaddr_t bdaddr; |
639 | __u8 name[248]; | 642 | __u8 name[248]; |
640 | } __attribute__ ((packed)); | 643 | } __packed; |
641 | 644 | ||
642 | #define HCI_EV_ENCRYPT_CHANGE 0x08 | 645 | #define HCI_EV_ENCRYPT_CHANGE 0x08 |
643 | struct hci_ev_encrypt_change { | 646 | struct hci_ev_encrypt_change { |
644 | __u8 status; | 647 | __u8 status; |
645 | __le16 handle; | 648 | __le16 handle; |
646 | __u8 encrypt; | 649 | __u8 encrypt; |
647 | } __attribute__ ((packed)); | 650 | } __packed; |
648 | 651 | ||
649 | #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 | 652 | #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 |
650 | struct hci_ev_change_link_key_complete { | 653 | struct hci_ev_change_link_key_complete { |
651 | __u8 status; | 654 | __u8 status; |
652 | __le16 handle; | 655 | __le16 handle; |
653 | } __attribute__ ((packed)); | 656 | } __packed; |
654 | 657 | ||
655 | #define HCI_EV_REMOTE_FEATURES 0x0b | 658 | #define HCI_EV_REMOTE_FEATURES 0x0b |
656 | struct hci_ev_remote_features { | 659 | struct hci_ev_remote_features { |
657 | __u8 status; | 660 | __u8 status; |
658 | __le16 handle; | 661 | __le16 handle; |
659 | __u8 features[8]; | 662 | __u8 features[8]; |
660 | } __attribute__ ((packed)); | 663 | } __packed; |
661 | 664 | ||
662 | #define HCI_EV_REMOTE_VERSION 0x0c | 665 | #define HCI_EV_REMOTE_VERSION 0x0c |
663 | struct hci_ev_remote_version { | 666 | struct hci_ev_remote_version { |
@@ -666,7 +669,7 @@ struct hci_ev_remote_version { | |||
666 | __u8 lmp_ver; | 669 | __u8 lmp_ver; |
667 | __le16 manufacturer; | 670 | __le16 manufacturer; |
668 | __le16 lmp_subver; | 671 | __le16 lmp_subver; |
669 | } __attribute__ ((packed)); | 672 | } __packed; |
670 | 673 | ||
671 | #define HCI_EV_QOS_SETUP_COMPLETE 0x0d | 674 | #define HCI_EV_QOS_SETUP_COMPLETE 0x0d |
672 | struct hci_qos { | 675 | struct hci_qos { |
@@ -675,38 +678,38 @@ struct hci_qos { | |||
675 | __u32 peak_bandwidth; | 678 | __u32 peak_bandwidth; |
676 | __u32 latency; | 679 | __u32 latency; |
677 | __u32 delay_variation; | 680 | __u32 delay_variation; |
678 | } __attribute__ ((packed)); | 681 | } __packed; |
679 | struct hci_ev_qos_setup_complete { | 682 | struct hci_ev_qos_setup_complete { |
680 | __u8 status; | 683 | __u8 status; |
681 | __le16 handle; | 684 | __le16 handle; |
682 | struct hci_qos qos; | 685 | struct hci_qos qos; |
683 | } __attribute__ ((packed)); | 686 | } __packed; |
684 | 687 | ||
685 | #define HCI_EV_CMD_COMPLETE 0x0e | 688 | #define HCI_EV_CMD_COMPLETE 0x0e |
686 | struct hci_ev_cmd_complete { | 689 | struct hci_ev_cmd_complete { |
687 | __u8 ncmd; | 690 | __u8 ncmd; |
688 | __le16 opcode; | 691 | __le16 opcode; |
689 | } __attribute__ ((packed)); | 692 | } __packed; |
690 | 693 | ||
691 | #define HCI_EV_CMD_STATUS 0x0f | 694 | #define HCI_EV_CMD_STATUS 0x0f |
692 | struct hci_ev_cmd_status { | 695 | struct hci_ev_cmd_status { |
693 | __u8 status; | 696 | __u8 status; |
694 | __u8 ncmd; | 697 | __u8 ncmd; |
695 | __le16 opcode; | 698 | __le16 opcode; |
696 | } __attribute__ ((packed)); | 699 | } __packed; |
697 | 700 | ||
698 | #define HCI_EV_ROLE_CHANGE 0x12 | 701 | #define HCI_EV_ROLE_CHANGE 0x12 |
699 | struct hci_ev_role_change { | 702 | struct hci_ev_role_change { |
700 | __u8 status; | 703 | __u8 status; |
701 | bdaddr_t bdaddr; | 704 | bdaddr_t bdaddr; |
702 | __u8 role; | 705 | __u8 role; |
703 | } __attribute__ ((packed)); | 706 | } __packed; |
704 | 707 | ||
705 | #define HCI_EV_NUM_COMP_PKTS 0x13 | 708 | #define HCI_EV_NUM_COMP_PKTS 0x13 |
706 | struct hci_ev_num_comp_pkts { | 709 | struct hci_ev_num_comp_pkts { |
707 | __u8 num_hndl; | 710 | __u8 num_hndl; |
708 | /* variable length part */ | 711 | /* variable length part */ |
709 | } __attribute__ ((packed)); | 712 | } __packed; |
710 | 713 | ||
711 | #define HCI_EV_MODE_CHANGE 0x14 | 714 | #define HCI_EV_MODE_CHANGE 0x14 |
712 | struct hci_ev_mode_change { | 715 | struct hci_ev_mode_change { |
@@ -714,44 +717,44 @@ struct hci_ev_mode_change { | |||
714 | __le16 handle; | 717 | __le16 handle; |
715 | __u8 mode; | 718 | __u8 mode; |
716 | __le16 interval; | 719 | __le16 interval; |
717 | } __attribute__ ((packed)); | 720 | } __packed; |
718 | 721 | ||
719 | #define HCI_EV_PIN_CODE_REQ 0x16 | 722 | #define HCI_EV_PIN_CODE_REQ 0x16 |
720 | struct hci_ev_pin_code_req { | 723 | struct hci_ev_pin_code_req { |
721 | bdaddr_t bdaddr; | 724 | bdaddr_t bdaddr; |
722 | } __attribute__ ((packed)); | 725 | } __packed; |
723 | 726 | ||
724 | #define HCI_EV_LINK_KEY_REQ 0x17 | 727 | #define HCI_EV_LINK_KEY_REQ 0x17 |
725 | struct hci_ev_link_key_req { | 728 | struct hci_ev_link_key_req { |
726 | bdaddr_t bdaddr; | 729 | bdaddr_t bdaddr; |
727 | } __attribute__ ((packed)); | 730 | } __packed; |
728 | 731 | ||
729 | #define HCI_EV_LINK_KEY_NOTIFY 0x18 | 732 | #define HCI_EV_LINK_KEY_NOTIFY 0x18 |
730 | struct hci_ev_link_key_notify { | 733 | struct hci_ev_link_key_notify { |
731 | bdaddr_t bdaddr; | 734 | bdaddr_t bdaddr; |
732 | __u8 link_key[16]; | 735 | __u8 link_key[16]; |
733 | __u8 key_type; | 736 | __u8 key_type; |
734 | } __attribute__ ((packed)); | 737 | } __packed; |
735 | 738 | ||
736 | #define HCI_EV_CLOCK_OFFSET 0x1c | 739 | #define HCI_EV_CLOCK_OFFSET 0x1c |
737 | struct hci_ev_clock_offset { | 740 | struct hci_ev_clock_offset { |
738 | __u8 status; | 741 | __u8 status; |
739 | __le16 handle; | 742 | __le16 handle; |
740 | __le16 clock_offset; | 743 | __le16 clock_offset; |
741 | } __attribute__ ((packed)); | 744 | } __packed; |
742 | 745 | ||
743 | #define HCI_EV_PKT_TYPE_CHANGE 0x1d | 746 | #define HCI_EV_PKT_TYPE_CHANGE 0x1d |
744 | struct hci_ev_pkt_type_change { | 747 | struct hci_ev_pkt_type_change { |
745 | __u8 status; | 748 | __u8 status; |
746 | __le16 handle; | 749 | __le16 handle; |
747 | __le16 pkt_type; | 750 | __le16 pkt_type; |
748 | } __attribute__ ((packed)); | 751 | } __packed; |
749 | 752 | ||
750 | #define HCI_EV_PSCAN_REP_MODE 0x20 | 753 | #define HCI_EV_PSCAN_REP_MODE 0x20 |
751 | struct hci_ev_pscan_rep_mode { | 754 | struct hci_ev_pscan_rep_mode { |
752 | bdaddr_t bdaddr; | 755 | bdaddr_t bdaddr; |
753 | __u8 pscan_rep_mode; | 756 | __u8 pscan_rep_mode; |
754 | } __attribute__ ((packed)); | 757 | } __packed; |
755 | 758 | ||
756 | #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 | 759 | #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 |
757 | struct inquiry_info_with_rssi { | 760 | struct inquiry_info_with_rssi { |
@@ -761,7 +764,7 @@ struct inquiry_info_with_rssi { | |||
761 | __u8 dev_class[3]; | 764 | __u8 dev_class[3]; |
762 | __le16 clock_offset; | 765 | __le16 clock_offset; |
763 | __s8 rssi; | 766 | __s8 rssi; |
764 | } __attribute__ ((packed)); | 767 | } __packed; |
765 | struct inquiry_info_with_rssi_and_pscan_mode { | 768 | struct inquiry_info_with_rssi_and_pscan_mode { |
766 | bdaddr_t bdaddr; | 769 | bdaddr_t bdaddr; |
767 | __u8 pscan_rep_mode; | 770 | __u8 pscan_rep_mode; |
@@ -770,7 +773,7 @@ struct inquiry_info_with_rssi_and_pscan_mode { | |||
770 | __u8 dev_class[3]; | 773 | __u8 dev_class[3]; |
771 | __le16 clock_offset; | 774 | __le16 clock_offset; |
772 | __s8 rssi; | 775 | __s8 rssi; |
773 | } __attribute__ ((packed)); | 776 | } __packed; |
774 | 777 | ||
775 | #define HCI_EV_REMOTE_EXT_FEATURES 0x23 | 778 | #define HCI_EV_REMOTE_EXT_FEATURES 0x23 |
776 | struct hci_ev_remote_ext_features { | 779 | struct hci_ev_remote_ext_features { |
@@ -779,7 +782,7 @@ struct hci_ev_remote_ext_features { | |||
779 | __u8 page; | 782 | __u8 page; |
780 | __u8 max_page; | 783 | __u8 max_page; |
781 | __u8 features[8]; | 784 | __u8 features[8]; |
782 | } __attribute__ ((packed)); | 785 | } __packed; |
783 | 786 | ||
784 | #define HCI_EV_SYNC_CONN_COMPLETE 0x2c | 787 | #define HCI_EV_SYNC_CONN_COMPLETE 0x2c |
785 | struct hci_ev_sync_conn_complete { | 788 | struct hci_ev_sync_conn_complete { |
@@ -792,7 +795,7 @@ struct hci_ev_sync_conn_complete { | |||
792 | __le16 rx_pkt_len; | 795 | __le16 rx_pkt_len; |
793 | __le16 tx_pkt_len; | 796 | __le16 tx_pkt_len; |
794 | __u8 air_mode; | 797 | __u8 air_mode; |
795 | } __attribute__ ((packed)); | 798 | } __packed; |
796 | 799 | ||
797 | #define HCI_EV_SYNC_CONN_CHANGED 0x2d | 800 | #define HCI_EV_SYNC_CONN_CHANGED 0x2d |
798 | struct hci_ev_sync_conn_changed { | 801 | struct hci_ev_sync_conn_changed { |
@@ -802,7 +805,7 @@ struct hci_ev_sync_conn_changed { | |||
802 | __u8 retrans_window; | 805 | __u8 retrans_window; |
803 | __le16 rx_pkt_len; | 806 | __le16 rx_pkt_len; |
804 | __le16 tx_pkt_len; | 807 | __le16 tx_pkt_len; |
805 | } __attribute__ ((packed)); | 808 | } __packed; |
806 | 809 | ||
807 | #define HCI_EV_SNIFF_SUBRATE 0x2e | 810 | #define HCI_EV_SNIFF_SUBRATE 0x2e |
808 | struct hci_ev_sniff_subrate { | 811 | struct hci_ev_sniff_subrate { |
@@ -812,7 +815,7 @@ struct hci_ev_sniff_subrate { | |||
812 | __le16 max_rx_latency; | 815 | __le16 max_rx_latency; |
813 | __le16 max_remote_timeout; | 816 | __le16 max_remote_timeout; |
814 | __le16 max_local_timeout; | 817 | __le16 max_local_timeout; |
815 | } __attribute__ ((packed)); | 818 | } __packed; |
816 | 819 | ||
817 | #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f | 820 | #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f |
818 | struct extended_inquiry_info { | 821 | struct extended_inquiry_info { |
@@ -823,37 +826,37 @@ struct extended_inquiry_info { | |||
823 | __le16 clock_offset; | 826 | __le16 clock_offset; |
824 | __s8 rssi; | 827 | __s8 rssi; |
825 | __u8 data[240]; | 828 | __u8 data[240]; |
826 | } __attribute__ ((packed)); | 829 | } __packed; |
827 | 830 | ||
828 | #define HCI_EV_IO_CAPA_REQUEST 0x31 | 831 | #define HCI_EV_IO_CAPA_REQUEST 0x31 |
829 | struct hci_ev_io_capa_request { | 832 | struct hci_ev_io_capa_request { |
830 | bdaddr_t bdaddr; | 833 | bdaddr_t bdaddr; |
831 | } __attribute__ ((packed)); | 834 | } __packed; |
832 | 835 | ||
833 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 | 836 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 |
834 | struct hci_ev_simple_pair_complete { | 837 | struct hci_ev_simple_pair_complete { |
835 | __u8 status; | 838 | __u8 status; |
836 | bdaddr_t bdaddr; | 839 | bdaddr_t bdaddr; |
837 | } __attribute__ ((packed)); | 840 | } __packed; |
838 | 841 | ||
839 | #define HCI_EV_REMOTE_HOST_FEATURES 0x3d | 842 | #define HCI_EV_REMOTE_HOST_FEATURES 0x3d |
840 | struct hci_ev_remote_host_features { | 843 | struct hci_ev_remote_host_features { |
841 | bdaddr_t bdaddr; | 844 | bdaddr_t bdaddr; |
842 | __u8 features[8]; | 845 | __u8 features[8]; |
843 | } __attribute__ ((packed)); | 846 | } __packed; |
844 | 847 | ||
845 | /* Internal events generated by Bluetooth stack */ | 848 | /* Internal events generated by Bluetooth stack */ |
846 | #define HCI_EV_STACK_INTERNAL 0xfd | 849 | #define HCI_EV_STACK_INTERNAL 0xfd |
847 | struct hci_ev_stack_internal { | 850 | struct hci_ev_stack_internal { |
848 | __u16 type; | 851 | __u16 type; |
849 | __u8 data[0]; | 852 | __u8 data[0]; |
850 | } __attribute__ ((packed)); | 853 | } __packed; |
851 | 854 | ||
852 | #define HCI_EV_SI_DEVICE 0x01 | 855 | #define HCI_EV_SI_DEVICE 0x01 |
853 | struct hci_ev_si_device { | 856 | struct hci_ev_si_device { |
854 | __u16 event; | 857 | __u16 event; |
855 | __u16 dev_id; | 858 | __u16 dev_id; |
856 | } __attribute__ ((packed)); | 859 | } __packed; |
857 | 860 | ||
858 | #define HCI_EV_SI_SECURITY 0x02 | 861 | #define HCI_EV_SI_SECURITY 0x02 |
859 | struct hci_ev_si_security { | 862 | struct hci_ev_si_security { |
@@ -861,7 +864,7 @@ struct hci_ev_si_security { | |||
861 | __u16 proto; | 864 | __u16 proto; |
862 | __u16 subproto; | 865 | __u16 subproto; |
863 | __u8 incoming; | 866 | __u8 incoming; |
864 | } __attribute__ ((packed)); | 867 | } __packed; |
865 | 868 | ||
866 | /* ---- HCI Packet structures ---- */ | 869 | /* ---- HCI Packet structures ---- */ |
867 | #define HCI_COMMAND_HDR_SIZE 3 | 870 | #define HCI_COMMAND_HDR_SIZE 3 |
@@ -872,22 +875,22 @@ struct hci_ev_si_security { | |||
872 | struct hci_command_hdr { | 875 | struct hci_command_hdr { |
873 | __le16 opcode; /* OCF & OGF */ | 876 | __le16 opcode; /* OCF & OGF */ |
874 | __u8 plen; | 877 | __u8 plen; |
875 | } __attribute__ ((packed)); | 878 | } __packed; |
876 | 879 | ||
877 | struct hci_event_hdr { | 880 | struct hci_event_hdr { |
878 | __u8 evt; | 881 | __u8 evt; |
879 | __u8 plen; | 882 | __u8 plen; |
880 | } __attribute__ ((packed)); | 883 | } __packed; |
881 | 884 | ||
882 | struct hci_acl_hdr { | 885 | struct hci_acl_hdr { |
883 | __le16 handle; /* Handle & Flags(PB, BC) */ | 886 | __le16 handle; /* Handle & Flags(PB, BC) */ |
884 | __le16 dlen; | 887 | __le16 dlen; |
885 | } __attribute__ ((packed)); | 888 | } __packed; |
886 | 889 | ||
887 | struct hci_sco_hdr { | 890 | struct hci_sco_hdr { |
888 | __le16 handle; | 891 | __le16 handle; |
889 | __u8 dlen; | 892 | __u8 dlen; |
890 | } __attribute__ ((packed)); | 893 | } __packed; |
891 | 894 | ||
892 | #ifdef __KERNEL__ | 895 | #ifdef __KERNEL__ |
893 | #include <linux/skbuff.h> | 896 | #include <linux/skbuff.h> |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index e42f6ed5421c..8b28962e737e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. |
4 | 4 | ||
5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 6 | ||
@@ -12,13 +12,13 @@ | |||
12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. |
14 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | 14 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
15 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | 15 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES |
16 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 16 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
17 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | 19 | ||
20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | 20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | 21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
22 | SOFTWARE IS DISCLAIMED. | 22 | SOFTWARE IS DISCLAIMED. |
23 | */ | 23 | */ |
24 | 24 | ||
@@ -62,6 +62,11 @@ struct hci_conn_hash { | |||
62 | unsigned int sco_num; | 62 | unsigned int sco_num; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | struct bdaddr_list { | ||
66 | struct list_head list; | ||
67 | bdaddr_t bdaddr; | ||
68 | }; | ||
69 | #define NUM_REASSEMBLY 4 | ||
65 | struct hci_dev { | 70 | struct hci_dev { |
66 | struct list_head list; | 71 | struct list_head list; |
67 | spinlock_t lock; | 72 | spinlock_t lock; |
@@ -118,7 +123,7 @@ struct hci_dev { | |||
118 | struct sk_buff_head cmd_q; | 123 | struct sk_buff_head cmd_q; |
119 | 124 | ||
120 | struct sk_buff *sent_cmd; | 125 | struct sk_buff *sent_cmd; |
121 | struct sk_buff *reassembly[3]; | 126 | struct sk_buff *reassembly[NUM_REASSEMBLY]; |
122 | 127 | ||
123 | struct mutex req_lock; | 128 | struct mutex req_lock; |
124 | wait_queue_head_t req_wait_q; | 129 | wait_queue_head_t req_wait_q; |
@@ -127,6 +132,7 @@ struct hci_dev { | |||
127 | 132 | ||
128 | struct inquiry_cache inq_cache; | 133 | struct inquiry_cache inq_cache; |
129 | struct hci_conn_hash conn_hash; | 134 | struct hci_conn_hash conn_hash; |
135 | struct bdaddr_list blacklist; | ||
130 | 136 | ||
131 | struct hci_dev_stats stat; | 137 | struct hci_dev_stats stat; |
132 | 138 | ||
@@ -250,6 +256,7 @@ enum { | |||
250 | HCI_CONN_ENCRYPT_PEND, | 256 | HCI_CONN_ENCRYPT_PEND, |
251 | HCI_CONN_RSWITCH_PEND, | 257 | HCI_CONN_RSWITCH_PEND, |
252 | HCI_CONN_MODE_CHANGE_PEND, | 258 | HCI_CONN_MODE_CHANGE_PEND, |
259 | HCI_CONN_SCO_SETUP_PEND, | ||
253 | }; | 260 | }; |
254 | 261 | ||
255 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | 262 | static inline void hci_conn_hash_init(struct hci_dev *hdev) |
@@ -330,6 +337,7 @@ void hci_acl_connect(struct hci_conn *conn); | |||
330 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason); | 337 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason); |
331 | void hci_add_sco(struct hci_conn *conn, __u16 handle); | 338 | void hci_add_sco(struct hci_conn *conn, __u16 handle); |
332 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); | 339 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); |
340 | void hci_sco_setup(struct hci_conn *conn, __u8 status); | ||
333 | 341 | ||
334 | struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); | 342 | struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); |
335 | int hci_conn_del(struct hci_conn *conn); | 343 | int hci_conn_del(struct hci_conn *conn); |
@@ -380,7 +388,7 @@ static inline void __hci_dev_put(struct hci_dev *d) | |||
380 | } | 388 | } |
381 | 389 | ||
382 | static inline void hci_dev_put(struct hci_dev *d) | 390 | static inline void hci_dev_put(struct hci_dev *d) |
383 | { | 391 | { |
384 | __hci_dev_put(d); | 392 | __hci_dev_put(d); |
385 | module_put(d->owner); | 393 | module_put(d->owner); |
386 | } | 394 | } |
@@ -424,10 +432,14 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg); | |||
424 | int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); | 432 | int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); |
425 | int hci_inquiry(void __user *arg); | 433 | int hci_inquiry(void __user *arg); |
426 | 434 | ||
435 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
436 | int hci_blacklist_clear(struct hci_dev *hdev); | ||
437 | |||
427 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 438 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
428 | 439 | ||
429 | int hci_recv_frame(struct sk_buff *skb); | 440 | int hci_recv_frame(struct sk_buff *skb); |
430 | int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); | 441 | int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); |
442 | int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); | ||
431 | 443 | ||
432 | int hci_register_sysfs(struct hci_dev *hdev); | 444 | int hci_register_sysfs(struct hci_dev *hdev); |
433 | void hci_unregister_sysfs(struct hci_dev *hdev); | 445 | void hci_unregister_sysfs(struct hci_dev *hdev); |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 7c695bfd853c..636724b203ee 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (C) 2000-2001 Qualcomm Incorporated |
4 | Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org> | ||
5 | Copyright (C) 2010 Google Inc. | ||
4 | 6 | ||
5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 7 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 8 | ||
@@ -129,31 +131,31 @@ struct l2cap_conninfo { | |||
129 | struct l2cap_hdr { | 131 | struct l2cap_hdr { |
130 | __le16 len; | 132 | __le16 len; |
131 | __le16 cid; | 133 | __le16 cid; |
132 | } __attribute__ ((packed)); | 134 | } __packed; |
133 | #define L2CAP_HDR_SIZE 4 | 135 | #define L2CAP_HDR_SIZE 4 |
134 | 136 | ||
135 | struct l2cap_cmd_hdr { | 137 | struct l2cap_cmd_hdr { |
136 | __u8 code; | 138 | __u8 code; |
137 | __u8 ident; | 139 | __u8 ident; |
138 | __le16 len; | 140 | __le16 len; |
139 | } __attribute__ ((packed)); | 141 | } __packed; |
140 | #define L2CAP_CMD_HDR_SIZE 4 | 142 | #define L2CAP_CMD_HDR_SIZE 4 |
141 | 143 | ||
142 | struct l2cap_cmd_rej { | 144 | struct l2cap_cmd_rej { |
143 | __le16 reason; | 145 | __le16 reason; |
144 | } __attribute__ ((packed)); | 146 | } __packed; |
145 | 147 | ||
146 | struct l2cap_conn_req { | 148 | struct l2cap_conn_req { |
147 | __le16 psm; | 149 | __le16 psm; |
148 | __le16 scid; | 150 | __le16 scid; |
149 | } __attribute__ ((packed)); | 151 | } __packed; |
150 | 152 | ||
151 | struct l2cap_conn_rsp { | 153 | struct l2cap_conn_rsp { |
152 | __le16 dcid; | 154 | __le16 dcid; |
153 | __le16 scid; | 155 | __le16 scid; |
154 | __le16 result; | 156 | __le16 result; |
155 | __le16 status; | 157 | __le16 status; |
156 | } __attribute__ ((packed)); | 158 | } __packed; |
157 | 159 | ||
158 | /* channel indentifier */ | 160 | /* channel indentifier */ |
159 | #define L2CAP_CID_SIGNALING 0x0001 | 161 | #define L2CAP_CID_SIGNALING 0x0001 |
@@ -177,14 +179,14 @@ struct l2cap_conf_req { | |||
177 | __le16 dcid; | 179 | __le16 dcid; |
178 | __le16 flags; | 180 | __le16 flags; |
179 | __u8 data[0]; | 181 | __u8 data[0]; |
180 | } __attribute__ ((packed)); | 182 | } __packed; |
181 | 183 | ||
182 | struct l2cap_conf_rsp { | 184 | struct l2cap_conf_rsp { |
183 | __le16 scid; | 185 | __le16 scid; |
184 | __le16 flags; | 186 | __le16 flags; |
185 | __le16 result; | 187 | __le16 result; |
186 | __u8 data[0]; | 188 | __u8 data[0]; |
187 | } __attribute__ ((packed)); | 189 | } __packed; |
188 | 190 | ||
189 | #define L2CAP_CONF_SUCCESS 0x0000 | 191 | #define L2CAP_CONF_SUCCESS 0x0000 |
190 | #define L2CAP_CONF_UNACCEPT 0x0001 | 192 | #define L2CAP_CONF_UNACCEPT 0x0001 |
@@ -195,7 +197,7 @@ struct l2cap_conf_opt { | |||
195 | __u8 type; | 197 | __u8 type; |
196 | __u8 len; | 198 | __u8 len; |
197 | __u8 val[0]; | 199 | __u8 val[0]; |
198 | } __attribute__ ((packed)); | 200 | } __packed; |
199 | #define L2CAP_CONF_OPT_SIZE 2 | 201 | #define L2CAP_CONF_OPT_SIZE 2 |
200 | 202 | ||
201 | #define L2CAP_CONF_HINT 0x80 | 203 | #define L2CAP_CONF_HINT 0x80 |
@@ -216,7 +218,7 @@ struct l2cap_conf_rfc { | |||
216 | __le16 retrans_timeout; | 218 | __le16 retrans_timeout; |
217 | __le16 monitor_timeout; | 219 | __le16 monitor_timeout; |
218 | __le16 max_pdu_size; | 220 | __le16 max_pdu_size; |
219 | } __attribute__ ((packed)); | 221 | } __packed; |
220 | 222 | ||
221 | #define L2CAP_MODE_BASIC 0x00 | 223 | #define L2CAP_MODE_BASIC 0x00 |
222 | #define L2CAP_MODE_RETRANS 0x01 | 224 | #define L2CAP_MODE_RETRANS 0x01 |
@@ -227,22 +229,22 @@ struct l2cap_conf_rfc { | |||
227 | struct l2cap_disconn_req { | 229 | struct l2cap_disconn_req { |
228 | __le16 dcid; | 230 | __le16 dcid; |
229 | __le16 scid; | 231 | __le16 scid; |
230 | } __attribute__ ((packed)); | 232 | } __packed; |
231 | 233 | ||
232 | struct l2cap_disconn_rsp { | 234 | struct l2cap_disconn_rsp { |
233 | __le16 dcid; | 235 | __le16 dcid; |
234 | __le16 scid; | 236 | __le16 scid; |
235 | } __attribute__ ((packed)); | 237 | } __packed; |
236 | 238 | ||
237 | struct l2cap_info_req { | 239 | struct l2cap_info_req { |
238 | __le16 type; | 240 | __le16 type; |
239 | } __attribute__ ((packed)); | 241 | } __packed; |
240 | 242 | ||
241 | struct l2cap_info_rsp { | 243 | struct l2cap_info_rsp { |
242 | __le16 type; | 244 | __le16 type; |
243 | __le16 result; | 245 | __le16 result; |
244 | __u8 data[0]; | 246 | __u8 data[0]; |
245 | } __attribute__ ((packed)); | 247 | } __packed; |
246 | 248 | ||
247 | /* info type */ | 249 | /* info type */ |
248 | #define L2CAP_IT_CL_MTU 0x0001 | 250 | #define L2CAP_IT_CL_MTU 0x0001 |
@@ -287,6 +289,11 @@ struct l2cap_conn { | |||
287 | struct l2cap_chan_list chan_list; | 289 | struct l2cap_chan_list chan_list; |
288 | }; | 290 | }; |
289 | 291 | ||
292 | struct sock_del_list { | ||
293 | struct sock *sk; | ||
294 | struct list_head list; | ||
295 | }; | ||
296 | |||
290 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | 297 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 |
291 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 | 298 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 |
292 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 | 299 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 |
@@ -353,7 +360,6 @@ struct l2cap_pinfo { | |||
353 | 360 | ||
354 | __le16 sport; | 361 | __le16 sport; |
355 | 362 | ||
356 | spinlock_t send_lock; | ||
357 | struct timer_list retrans_timer; | 363 | struct timer_list retrans_timer; |
358 | struct timer_list monitor_timer; | 364 | struct timer_list monitor_timer; |
359 | struct timer_list ack_timer; | 365 | struct timer_list ack_timer; |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index 921d7b3c7f8d..a140847d622c 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
@@ -106,19 +106,19 @@ struct rfcomm_hdr { | |||
106 | u8 addr; | 106 | u8 addr; |
107 | u8 ctrl; | 107 | u8 ctrl; |
108 | u8 len; // Actual size can be 2 bytes | 108 | u8 len; // Actual size can be 2 bytes |
109 | } __attribute__ ((packed)); | 109 | } __packed; |
110 | 110 | ||
111 | struct rfcomm_cmd { | 111 | struct rfcomm_cmd { |
112 | u8 addr; | 112 | u8 addr; |
113 | u8 ctrl; | 113 | u8 ctrl; |
114 | u8 len; | 114 | u8 len; |
115 | u8 fcs; | 115 | u8 fcs; |
116 | } __attribute__ ((packed)); | 116 | } __packed; |
117 | 117 | ||
118 | struct rfcomm_mcc { | 118 | struct rfcomm_mcc { |
119 | u8 type; | 119 | u8 type; |
120 | u8 len; | 120 | u8 len; |
121 | } __attribute__ ((packed)); | 121 | } __packed; |
122 | 122 | ||
123 | struct rfcomm_pn { | 123 | struct rfcomm_pn { |
124 | u8 dlci; | 124 | u8 dlci; |
@@ -128,7 +128,7 @@ struct rfcomm_pn { | |||
128 | __le16 mtu; | 128 | __le16 mtu; |
129 | u8 max_retrans; | 129 | u8 max_retrans; |
130 | u8 credits; | 130 | u8 credits; |
131 | } __attribute__ ((packed)); | 131 | } __packed; |
132 | 132 | ||
133 | struct rfcomm_rpn { | 133 | struct rfcomm_rpn { |
134 | u8 dlci; | 134 | u8 dlci; |
@@ -138,17 +138,17 @@ struct rfcomm_rpn { | |||
138 | u8 xon_char; | 138 | u8 xon_char; |
139 | u8 xoff_char; | 139 | u8 xoff_char; |
140 | __le16 param_mask; | 140 | __le16 param_mask; |
141 | } __attribute__ ((packed)); | 141 | } __packed; |
142 | 142 | ||
143 | struct rfcomm_rls { | 143 | struct rfcomm_rls { |
144 | u8 dlci; | 144 | u8 dlci; |
145 | u8 status; | 145 | u8 status; |
146 | } __attribute__ ((packed)); | 146 | } __packed; |
147 | 147 | ||
148 | struct rfcomm_msc { | 148 | struct rfcomm_msc { |
149 | u8 dlci; | 149 | u8 dlci; |
150 | u8 v24_sig; | 150 | u8 v24_sig; |
151 | } __attribute__ ((packed)); | 151 | } __packed; |
152 | 152 | ||
153 | /* ---- Core structures, flags etc ---- */ | 153 | /* ---- Core structures, flags etc ---- */ |
154 | 154 | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 4d1f19d70798..2fd06c60ffbb 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1416,7 +1416,7 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy) | |||
1416 | * | 1416 | * |
1417 | * @wiphy: The wiphy whose name to return | 1417 | * @wiphy: The wiphy whose name to return |
1418 | */ | 1418 | */ |
1419 | static inline const char *wiphy_name(struct wiphy *wiphy) | 1419 | static inline const char *wiphy_name(const struct wiphy *wiphy) |
1420 | { | 1420 | { |
1421 | return dev_name(&wiphy->dev); | 1421 | return dev_name(&wiphy->dev); |
1422 | } | 1422 | } |
@@ -2420,4 +2420,67 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, | |||
2420 | enum nl80211_cqm_rssi_threshold_event rssi_event, | 2420 | enum nl80211_cqm_rssi_threshold_event rssi_event, |
2421 | gfp_t gfp); | 2421 | gfp_t gfp); |
2422 | 2422 | ||
2423 | #ifdef __KERNEL__ | ||
2424 | |||
2425 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | ||
2426 | |||
2427 | /* wiphy_printk helpers, similar to dev_printk */ | ||
2428 | |||
2429 | #define wiphy_printk(level, wiphy, format, args...) \ | ||
2430 | printk(level "%s: " format, wiphy_name(wiphy), ##args) | ||
2431 | #define wiphy_emerg(wiphy, format, args...) \ | ||
2432 | wiphy_printk(KERN_EMERG, wiphy, format, ##args) | ||
2433 | #define wiphy_alert(wiphy, format, args...) \ | ||
2434 | wiphy_printk(KERN_ALERT, wiphy, format, ##args) | ||
2435 | #define wiphy_crit(wiphy, format, args...) \ | ||
2436 | wiphy_printk(KERN_CRIT, wiphy, format, ##args) | ||
2437 | #define wiphy_err(wiphy, format, args...) \ | ||
2438 | wiphy_printk(KERN_ERR, wiphy, format, ##args) | ||
2439 | #define wiphy_warn(wiphy, format, args...) \ | ||
2440 | wiphy_printk(KERN_WARNING, wiphy, format, ##args) | ||
2441 | #define wiphy_notice(wiphy, format, args...) \ | ||
2442 | wiphy_printk(KERN_NOTICE, wiphy, format, ##args) | ||
2443 | #define wiphy_info(wiphy, format, args...) \ | ||
2444 | wiphy_printk(KERN_INFO, wiphy, format, ##args) | ||
2445 | |||
2446 | int wiphy_debug(const struct wiphy *wiphy, const char *format, ...) | ||
2447 | __attribute__ ((format (printf, 2, 3))); | ||
2448 | |||
2449 | #if defined(DEBUG) | ||
2450 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2451 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args) | ||
2452 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
2453 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2454 | dynamic_pr_debug("%s: " format, wiphy_name(wiphy), ##args) | ||
2455 | #else | ||
2456 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2457 | ({ \ | ||
2458 | if (0) \ | ||
2459 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | ||
2460 | 0; \ | ||
2461 | }) | ||
2462 | #endif | ||
2463 | |||
2464 | #if defined(VERBOSE_DEBUG) | ||
2465 | #define wiphy_vdbg wiphy_dbg | ||
2466 | #else | ||
2467 | |||
2468 | #define wiphy_vdbg(wiphy, format, args...) \ | ||
2469 | ({ \ | ||
2470 | if (0) \ | ||
2471 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | ||
2472 | 0; \ | ||
2473 | }) | ||
2474 | #endif | ||
2475 | |||
2476 | /* | ||
2477 | * wiphy_WARN() acts like wiphy_printk(), but with the key difference | ||
2478 | * of using a WARN/WARN_ON to get the message out, including the | ||
2479 | * file/line information and a backtrace. | ||
2480 | */ | ||
2481 | #define wiphy_WARN(wiphy, format, args...) \ | ||
2482 | WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); | ||
2483 | |||
2484 | #endif | ||
2485 | |||
2423 | #endif /* __NET_CFG80211_H */ | 2486 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/lib80211.h b/include/net/lib80211.h index fb4e2784857d..848cce1bb7a5 100644 --- a/include/net/lib80211.h +++ b/include/net/lib80211.h | |||
@@ -54,9 +54,6 @@ struct lib80211_crypto_ops { | |||
54 | /* deinitialize crypto context and free allocated private data */ | 54 | /* deinitialize crypto context and free allocated private data */ |
55 | void (*deinit) (void *priv); | 55 | void (*deinit) (void *priv); |
56 | 56 | ||
57 | int (*build_iv) (struct sk_buff * skb, int hdr_len, | ||
58 | u8 *key, int keylen, void *priv); | ||
59 | |||
60 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return | 57 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return |
61 | * value from decrypt_mpdu is passed as the keyidx value for | 58 | * value from decrypt_mpdu is passed as the keyidx value for |
62 | * decrypt_msdu. skb must have enough head and tail room for the | 59 | * decrypt_msdu. skb must have enough head and tail room for the |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 837353bfcb20..b0787a1dea90 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -194,7 +194,9 @@ enum ieee80211_bss_change { | |||
194 | * if the hardware cannot handle this it must set the | 194 | * if the hardware cannot handle this it must set the |
195 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag | 195 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag |
196 | * @dtim_period: num of beacons before the next DTIM, for beaconing, | 196 | * @dtim_period: num of beacons before the next DTIM, for beaconing, |
197 | * not valid in station mode (cf. hw conf ps_dtim_period) | 197 | * valid in station mode only while @assoc is true and if also |
198 | * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf | ||
199 | * @ps_dtim_period) | ||
198 | * @timestamp: beacon timestamp | 200 | * @timestamp: beacon timestamp |
199 | * @beacon_int: beacon interval | 201 | * @beacon_int: beacon interval |
200 | * @assoc_capability: capabilities taken from assoc resp | 202 | * @assoc_capability: capabilities taken from assoc resp |
@@ -625,11 +627,14 @@ struct ieee80211_rx_status { | |||
625 | * may turn the device off as much as possible. Typically, this flag will | 627 | * may turn the device off as much as possible. Typically, this flag will |
626 | * be set when an interface is set UP but not associated or scanning, but | 628 | * be set when an interface is set UP but not associated or scanning, but |
627 | * it can also be unset in that case when monitor interfaces are active. | 629 | * it can also be unset in that case when monitor interfaces are active. |
630 | * @IEEE80211_CONF_OFFCHANNEL: The device is currently not on its main | ||
631 | * operating channel. | ||
628 | */ | 632 | */ |
629 | enum ieee80211_conf_flags { | 633 | enum ieee80211_conf_flags { |
630 | IEEE80211_CONF_MONITOR = (1<<0), | 634 | IEEE80211_CONF_MONITOR = (1<<0), |
631 | IEEE80211_CONF_PS = (1<<1), | 635 | IEEE80211_CONF_PS = (1<<1), |
632 | IEEE80211_CONF_IDLE = (1<<2), | 636 | IEEE80211_CONF_IDLE = (1<<2), |
637 | IEEE80211_CONF_OFFCHANNEL = (1<<3), | ||
633 | }; | 638 | }; |
634 | 639 | ||
635 | 640 | ||
@@ -1024,6 +1029,9 @@ enum ieee80211_tkip_key_type { | |||
1024 | * connection quality related parameters, such as the RSSI level and | 1029 | * connection quality related parameters, such as the RSSI level and |
1025 | * provide notifications if configured trigger levels are reached. | 1030 | * provide notifications if configured trigger levels are reached. |
1026 | * | 1031 | * |
1032 | * @IEEE80211_HW_NEED_DTIM_PERIOD: | ||
1033 | * This device needs to know the DTIM period for the BSS before | ||
1034 | * associating. | ||
1027 | */ | 1035 | */ |
1028 | enum ieee80211_hw_flags { | 1036 | enum ieee80211_hw_flags { |
1029 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1037 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
@@ -1033,7 +1041,7 @@ enum ieee80211_hw_flags { | |||
1033 | IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, | 1041 | IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, |
1034 | IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, | 1042 | IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, |
1035 | IEEE80211_HW_SIGNAL_DBM = 1<<6, | 1043 | IEEE80211_HW_SIGNAL_DBM = 1<<6, |
1036 | /* use this hole */ | 1044 | IEEE80211_HW_NEED_DTIM_PERIOD = 1<<7, |
1037 | IEEE80211_HW_SPECTRUM_MGMT = 1<<8, | 1045 | IEEE80211_HW_SPECTRUM_MGMT = 1<<8, |
1038 | IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, | 1046 | IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, |
1039 | IEEE80211_HW_SUPPORTS_PS = 1<<10, | 1047 | IEEE80211_HW_SUPPORTS_PS = 1<<10, |
diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig index ee3b3049d385..ed371684c133 100644 --- a/net/bluetooth/Kconfig +++ b/net/bluetooth/Kconfig | |||
@@ -43,19 +43,6 @@ config BT_L2CAP | |||
43 | Say Y here to compile L2CAP support into the kernel or say M to | 43 | Say Y here to compile L2CAP support into the kernel or say M to |
44 | compile it as module (l2cap). | 44 | compile it as module (l2cap). |
45 | 45 | ||
46 | config BT_L2CAP_EXT_FEATURES | ||
47 | bool "L2CAP Extended Features support (EXPERIMENTAL)" | ||
48 | depends on BT_L2CAP && EXPERIMENTAL | ||
49 | help | ||
50 | This option enables the L2CAP Extended Features support. These | ||
51 | new features include the Enhanced Retransmission and Streaming | ||
52 | Modes, the Frame Check Sequence (FCS), and Segmentation and | ||
53 | Reassembly (SAR) for L2CAP packets. They are a required for the | ||
54 | new Alternate MAC/PHY and the Bluetooth Medical Profile. | ||
55 | |||
56 | You should say N unless you know what you are doing. Note that | ||
57 | this is in an experimental state yet. | ||
58 | |||
59 | config BT_SCO | 46 | config BT_SCO |
60 | tristate "SCO links support" | 47 | tristate "SCO links support" |
61 | depends on BT | 48 | depends on BT |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 800b6b9fbbae..0b1e460fe440 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. |
4 | 4 | ||
5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 6 | ||
@@ -155,6 +155,27 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle) | |||
155 | hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp); | 155 | hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp); |
156 | } | 156 | } |
157 | 157 | ||
158 | /* Device _must_ be locked */ | ||
159 | void hci_sco_setup(struct hci_conn *conn, __u8 status) | ||
160 | { | ||
161 | struct hci_conn *sco = conn->link; | ||
162 | |||
163 | BT_DBG("%p", conn); | ||
164 | |||
165 | if (!sco) | ||
166 | return; | ||
167 | |||
168 | if (!status) { | ||
169 | if (lmp_esco_capable(conn->hdev)) | ||
170 | hci_setup_sync(sco, conn->handle); | ||
171 | else | ||
172 | hci_add_sco(sco, conn->handle); | ||
173 | } else { | ||
174 | hci_proto_connect_cfm(sco, status); | ||
175 | hci_conn_del(sco); | ||
176 | } | ||
177 | } | ||
178 | |||
158 | static void hci_conn_timeout(unsigned long arg) | 179 | static void hci_conn_timeout(unsigned long arg) |
159 | { | 180 | { |
160 | struct hci_conn *conn = (void *) arg; | 181 | struct hci_conn *conn = (void *) arg; |
@@ -385,10 +406,13 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 | |||
385 | acl->power_save = 1; | 406 | acl->power_save = 1; |
386 | hci_conn_enter_active_mode(acl); | 407 | hci_conn_enter_active_mode(acl); |
387 | 408 | ||
388 | if (lmp_esco_capable(hdev)) | 409 | if (test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->pend)) { |
389 | hci_setup_sync(sco, acl->handle); | 410 | /* defer SCO setup until mode change completed */ |
390 | else | 411 | set_bit(HCI_CONN_SCO_SETUP_PEND, &acl->pend); |
391 | hci_add_sco(sco, acl->handle); | 412 | return sco; |
413 | } | ||
414 | |||
415 | hci_sco_setup(acl, 0x00); | ||
392 | } | 416 | } |
393 | 417 | ||
394 | return sco; | 418 | return sco; |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 2f768de87011..8303f1c9ef54 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -562,6 +562,7 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
562 | hci_dev_lock_bh(hdev); | 562 | hci_dev_lock_bh(hdev); |
563 | inquiry_cache_flush(hdev); | 563 | inquiry_cache_flush(hdev); |
564 | hci_conn_hash_flush(hdev); | 564 | hci_conn_hash_flush(hdev); |
565 | hci_blacklist_clear(hdev); | ||
565 | hci_dev_unlock_bh(hdev); | 566 | hci_dev_unlock_bh(hdev); |
566 | 567 | ||
567 | hci_notify(hdev, HCI_DEV_DOWN); | 568 | hci_notify(hdev, HCI_DEV_DOWN); |
@@ -913,7 +914,7 @@ int hci_register_dev(struct hci_dev *hdev) | |||
913 | skb_queue_head_init(&hdev->cmd_q); | 914 | skb_queue_head_init(&hdev->cmd_q); |
914 | skb_queue_head_init(&hdev->raw_q); | 915 | skb_queue_head_init(&hdev->raw_q); |
915 | 916 | ||
916 | for (i = 0; i < 3; i++) | 917 | for (i = 0; i < NUM_REASSEMBLY; i++) |
917 | hdev->reassembly[i] = NULL; | 918 | hdev->reassembly[i] = NULL; |
918 | 919 | ||
919 | init_waitqueue_head(&hdev->req_wait_q); | 920 | init_waitqueue_head(&hdev->req_wait_q); |
@@ -923,6 +924,8 @@ int hci_register_dev(struct hci_dev *hdev) | |||
923 | 924 | ||
924 | hci_conn_hash_init(hdev); | 925 | hci_conn_hash_init(hdev); |
925 | 926 | ||
927 | INIT_LIST_HEAD(&hdev->blacklist.list); | ||
928 | |||
926 | memset(&hdev->stat, 0, sizeof(struct hci_dev_stats)); | 929 | memset(&hdev->stat, 0, sizeof(struct hci_dev_stats)); |
927 | 930 | ||
928 | atomic_set(&hdev->promisc, 0); | 931 | atomic_set(&hdev->promisc, 0); |
@@ -970,7 +973,7 @@ int hci_unregister_dev(struct hci_dev *hdev) | |||
970 | 973 | ||
971 | hci_dev_do_close(hdev); | 974 | hci_dev_do_close(hdev); |
972 | 975 | ||
973 | for (i = 0; i < 3; i++) | 976 | for (i = 0; i < NUM_REASSEMBLY; i++) |
974 | kfree_skb(hdev->reassembly[i]); | 977 | kfree_skb(hdev->reassembly[i]); |
975 | 978 | ||
976 | hci_notify(hdev, HCI_DEV_UNREG); | 979 | hci_notify(hdev, HCI_DEV_UNREG); |
@@ -1030,89 +1033,170 @@ int hci_recv_frame(struct sk_buff *skb) | |||
1030 | } | 1033 | } |
1031 | EXPORT_SYMBOL(hci_recv_frame); | 1034 | EXPORT_SYMBOL(hci_recv_frame); |
1032 | 1035 | ||
1033 | /* Receive packet type fragment */ | 1036 | static int hci_reassembly(struct hci_dev *hdev, int type, void *data, |
1034 | #define __reassembly(hdev, type) ((hdev)->reassembly[(type) - 2]) | 1037 | int count, __u8 index, gfp_t gfp_mask) |
1035 | |||
1036 | int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count) | ||
1037 | { | 1038 | { |
1038 | if (type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT) | 1039 | int len = 0; |
1040 | int hlen = 0; | ||
1041 | int remain = count; | ||
1042 | struct sk_buff *skb; | ||
1043 | struct bt_skb_cb *scb; | ||
1044 | |||
1045 | if ((type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT) || | ||
1046 | index >= NUM_REASSEMBLY) | ||
1039 | return -EILSEQ; | 1047 | return -EILSEQ; |
1040 | 1048 | ||
1049 | skb = hdev->reassembly[index]; | ||
1050 | |||
1051 | if (!skb) { | ||
1052 | switch (type) { | ||
1053 | case HCI_ACLDATA_PKT: | ||
1054 | len = HCI_MAX_FRAME_SIZE; | ||
1055 | hlen = HCI_ACL_HDR_SIZE; | ||
1056 | break; | ||
1057 | case HCI_EVENT_PKT: | ||
1058 | len = HCI_MAX_EVENT_SIZE; | ||
1059 | hlen = HCI_EVENT_HDR_SIZE; | ||
1060 | break; | ||
1061 | case HCI_SCODATA_PKT: | ||
1062 | len = HCI_MAX_SCO_SIZE; | ||
1063 | hlen = HCI_SCO_HDR_SIZE; | ||
1064 | break; | ||
1065 | } | ||
1066 | |||
1067 | skb = bt_skb_alloc(len, gfp_mask); | ||
1068 | if (!skb) | ||
1069 | return -ENOMEM; | ||
1070 | |||
1071 | scb = (void *) skb->cb; | ||
1072 | scb->expect = hlen; | ||
1073 | scb->pkt_type = type; | ||
1074 | |||
1075 | skb->dev = (void *) hdev; | ||
1076 | hdev->reassembly[index] = skb; | ||
1077 | } | ||
1078 | |||
1041 | while (count) { | 1079 | while (count) { |
1042 | struct sk_buff *skb = __reassembly(hdev, type); | 1080 | scb = (void *) skb->cb; |
1043 | struct { int expect; } *scb; | 1081 | len = min(scb->expect, (__u16)count); |
1044 | int len = 0; | ||
1045 | 1082 | ||
1046 | if (!skb) { | 1083 | memcpy(skb_put(skb, len), data, len); |
1047 | /* Start of the frame */ | ||
1048 | 1084 | ||
1049 | switch (type) { | 1085 | count -= len; |
1050 | case HCI_EVENT_PKT: | 1086 | data += len; |
1051 | if (count >= HCI_EVENT_HDR_SIZE) { | 1087 | scb->expect -= len; |
1052 | struct hci_event_hdr *h = data; | 1088 | remain = count; |
1053 | len = HCI_EVENT_HDR_SIZE + h->plen; | ||
1054 | } else | ||
1055 | return -EILSEQ; | ||
1056 | break; | ||
1057 | 1089 | ||
1058 | case HCI_ACLDATA_PKT: | 1090 | switch (type) { |
1059 | if (count >= HCI_ACL_HDR_SIZE) { | 1091 | case HCI_EVENT_PKT: |
1060 | struct hci_acl_hdr *h = data; | 1092 | if (skb->len == HCI_EVENT_HDR_SIZE) { |
1061 | len = HCI_ACL_HDR_SIZE + __le16_to_cpu(h->dlen); | 1093 | struct hci_event_hdr *h = hci_event_hdr(skb); |
1062 | } else | 1094 | scb->expect = h->plen; |
1063 | return -EILSEQ; | 1095 | |
1064 | break; | 1096 | if (skb_tailroom(skb) < scb->expect) { |
1097 | kfree_skb(skb); | ||
1098 | hdev->reassembly[index] = NULL; | ||
1099 | return -ENOMEM; | ||
1100 | } | ||
1101 | } | ||
1102 | break; | ||
1065 | 1103 | ||
1066 | case HCI_SCODATA_PKT: | 1104 | case HCI_ACLDATA_PKT: |
1067 | if (count >= HCI_SCO_HDR_SIZE) { | 1105 | if (skb->len == HCI_ACL_HDR_SIZE) { |
1068 | struct hci_sco_hdr *h = data; | 1106 | struct hci_acl_hdr *h = hci_acl_hdr(skb); |
1069 | len = HCI_SCO_HDR_SIZE + h->dlen; | 1107 | scb->expect = __le16_to_cpu(h->dlen); |
1070 | } else | 1108 | |
1071 | return -EILSEQ; | 1109 | if (skb_tailroom(skb) < scb->expect) { |
1072 | break; | 1110 | kfree_skb(skb); |
1111 | hdev->reassembly[index] = NULL; | ||
1112 | return -ENOMEM; | ||
1113 | } | ||
1073 | } | 1114 | } |
1115 | break; | ||
1074 | 1116 | ||
1075 | skb = bt_skb_alloc(len, GFP_ATOMIC); | 1117 | case HCI_SCODATA_PKT: |
1076 | if (!skb) { | 1118 | if (skb->len == HCI_SCO_HDR_SIZE) { |
1077 | BT_ERR("%s no memory for packet", hdev->name); | 1119 | struct hci_sco_hdr *h = hci_sco_hdr(skb); |
1078 | return -ENOMEM; | 1120 | scb->expect = h->dlen; |
1121 | |||
1122 | if (skb_tailroom(skb) < scb->expect) { | ||
1123 | kfree_skb(skb); | ||
1124 | hdev->reassembly[index] = NULL; | ||
1125 | return -ENOMEM; | ||
1126 | } | ||
1079 | } | 1127 | } |
1128 | break; | ||
1129 | } | ||
1130 | |||
1131 | if (scb->expect == 0) { | ||
1132 | /* Complete frame */ | ||
1080 | 1133 | ||
1081 | skb->dev = (void *) hdev; | ||
1082 | bt_cb(skb)->pkt_type = type; | 1134 | bt_cb(skb)->pkt_type = type; |
1135 | hci_recv_frame(skb); | ||
1083 | 1136 | ||
1084 | __reassembly(hdev, type) = skb; | 1137 | hdev->reassembly[index] = NULL; |
1138 | return remain; | ||
1139 | } | ||
1140 | } | ||
1085 | 1141 | ||
1086 | scb = (void *) skb->cb; | 1142 | return remain; |
1087 | scb->expect = len; | 1143 | } |
1088 | } else { | ||
1089 | /* Continuation */ | ||
1090 | 1144 | ||
1091 | scb = (void *) skb->cb; | 1145 | int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count) |
1092 | len = scb->expect; | 1146 | { |
1093 | } | 1147 | int rem = 0; |
1094 | 1148 | ||
1095 | len = min(len, count); | 1149 | if (type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT) |
1150 | return -EILSEQ; | ||
1096 | 1151 | ||
1097 | memcpy(skb_put(skb, len), data, len); | 1152 | while (count) { |
1153 | rem = hci_reassembly(hdev, type, data, count, | ||
1154 | type - 1, GFP_ATOMIC); | ||
1155 | if (rem < 0) | ||
1156 | return rem; | ||
1098 | 1157 | ||
1099 | scb->expect -= len; | 1158 | data += (count - rem); |
1159 | count = rem; | ||
1160 | }; | ||
1100 | 1161 | ||
1101 | if (scb->expect == 0) { | 1162 | return rem; |
1102 | /* Complete frame */ | 1163 | } |
1164 | EXPORT_SYMBOL(hci_recv_fragment); | ||
1103 | 1165 | ||
1104 | __reassembly(hdev, type) = NULL; | 1166 | #define STREAM_REASSEMBLY 0 |
1105 | 1167 | ||
1106 | bt_cb(skb)->pkt_type = type; | 1168 | int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count) |
1107 | hci_recv_frame(skb); | 1169 | { |
1108 | } | 1170 | int type; |
1171 | int rem = 0; | ||
1109 | 1172 | ||
1110 | count -= len; data += len; | 1173 | while (count) { |
1111 | } | 1174 | struct sk_buff *skb = hdev->reassembly[STREAM_REASSEMBLY]; |
1112 | 1175 | ||
1113 | return 0; | 1176 | if (!skb) { |
1177 | struct { char type; } *pkt; | ||
1178 | |||
1179 | /* Start of the frame */ | ||
1180 | pkt = data; | ||
1181 | type = pkt->type; | ||
1182 | |||
1183 | data++; | ||
1184 | count--; | ||
1185 | } else | ||
1186 | type = bt_cb(skb)->pkt_type; | ||
1187 | |||
1188 | rem = hci_reassembly(hdev, type, data, | ||
1189 | count, STREAM_REASSEMBLY, GFP_ATOMIC); | ||
1190 | if (rem < 0) | ||
1191 | return rem; | ||
1192 | |||
1193 | data += (count - rem); | ||
1194 | count = rem; | ||
1195 | }; | ||
1196 | |||
1197 | return rem; | ||
1114 | } | 1198 | } |
1115 | EXPORT_SYMBOL(hci_recv_fragment); | 1199 | EXPORT_SYMBOL(hci_recv_stream_fragment); |
1116 | 1200 | ||
1117 | /* ---- Interface to upper protocols ---- */ | 1201 | /* ---- Interface to upper protocols ---- */ |
1118 | 1202 | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 786b5de0bac4..bfef5bae0b3a 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. |
4 | 4 | ||
5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 6 | ||
@@ -584,7 +584,7 @@ static inline void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) | |||
584 | conn->out = 1; | 584 | conn->out = 1; |
585 | conn->link_mode |= HCI_LM_MASTER; | 585 | conn->link_mode |= HCI_LM_MASTER; |
586 | } else | 586 | } else |
587 | BT_ERR("No memmory for new connection"); | 587 | BT_ERR("No memory for new connection"); |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
@@ -785,9 +785,13 @@ static void hci_cs_sniff_mode(struct hci_dev *hdev, __u8 status) | |||
785 | hci_dev_lock(hdev); | 785 | hci_dev_lock(hdev); |
786 | 786 | ||
787 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); | 787 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); |
788 | if (conn) | 788 | if (conn) { |
789 | clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend); | 789 | clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend); |
790 | 790 | ||
791 | if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->pend)) | ||
792 | hci_sco_setup(conn, status); | ||
793 | } | ||
794 | |||
791 | hci_dev_unlock(hdev); | 795 | hci_dev_unlock(hdev); |
792 | } | 796 | } |
793 | 797 | ||
@@ -808,9 +812,13 @@ static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status) | |||
808 | hci_dev_lock(hdev); | 812 | hci_dev_lock(hdev); |
809 | 813 | ||
810 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); | 814 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); |
811 | if (conn) | 815 | if (conn) { |
812 | clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend); | 816 | clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend); |
813 | 817 | ||
818 | if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->pend)) | ||
819 | hci_sco_setup(conn, status); | ||
820 | } | ||
821 | |||
814 | hci_dev_unlock(hdev); | 822 | hci_dev_unlock(hdev); |
815 | } | 823 | } |
816 | 824 | ||
@@ -915,20 +923,8 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s | |||
915 | } else | 923 | } else |
916 | conn->state = BT_CLOSED; | 924 | conn->state = BT_CLOSED; |
917 | 925 | ||
918 | if (conn->type == ACL_LINK) { | 926 | if (conn->type == ACL_LINK) |
919 | struct hci_conn *sco = conn->link; | 927 | hci_sco_setup(conn, ev->status); |
920 | if (sco) { | ||
921 | if (!ev->status) { | ||
922 | if (lmp_esco_capable(hdev)) | ||
923 | hci_setup_sync(sco, conn->handle); | ||
924 | else | ||
925 | hci_add_sco(sco, conn->handle); | ||
926 | } else { | ||
927 | hci_proto_connect_cfm(sco, ev->status); | ||
928 | hci_conn_del(sco); | ||
929 | } | ||
930 | } | ||
931 | } | ||
932 | 928 | ||
933 | if (ev->status) { | 929 | if (ev->status) { |
934 | hci_proto_connect_cfm(conn, ev->status); | 930 | hci_proto_connect_cfm(conn, ev->status); |
@@ -952,7 +948,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
952 | 948 | ||
953 | mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type); | 949 | mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type); |
954 | 950 | ||
955 | if (mask & HCI_LM_ACCEPT) { | 951 | if ((mask & HCI_LM_ACCEPT) && !hci_blacklist_lookup(hdev, &ev->bdaddr)) { |
956 | /* Connection accepted */ | 952 | /* Connection accepted */ |
957 | struct inquiry_entry *ie; | 953 | struct inquiry_entry *ie; |
958 | struct hci_conn *conn; | 954 | struct hci_conn *conn; |
@@ -965,7 +961,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
965 | conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); | 961 | conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); |
966 | if (!conn) { | 962 | if (!conn) { |
967 | if (!(conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr))) { | 963 | if (!(conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr))) { |
968 | BT_ERR("No memmory for new connection"); | 964 | BT_ERR("No memory for new connection"); |
969 | hci_dev_unlock(hdev); | 965 | hci_dev_unlock(hdev); |
970 | return; | 966 | return; |
971 | } | 967 | } |
@@ -1481,6 +1477,9 @@ static inline void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb | |||
1481 | else | 1477 | else |
1482 | conn->power_save = 0; | 1478 | conn->power_save = 0; |
1483 | } | 1479 | } |
1480 | |||
1481 | if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->pend)) | ||
1482 | hci_sco_setup(conn, ev->status); | ||
1484 | } | 1483 | } |
1485 | 1484 | ||
1486 | hci_dev_unlock(hdev); | 1485 | hci_dev_unlock(hdev); |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 38f08f6b86f6..4f170a595934 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -165,6 +165,86 @@ static int hci_sock_release(struct socket *sock) | |||
165 | return 0; | 165 | return 0; |
166 | } | 166 | } |
167 | 167 | ||
168 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr) | ||
169 | { | ||
170 | struct list_head *p; | ||
171 | struct bdaddr_list *blacklist = &hdev->blacklist; | ||
172 | |||
173 | list_for_each(p, &blacklist->list) { | ||
174 | struct bdaddr_list *b; | ||
175 | |||
176 | b = list_entry(p, struct bdaddr_list, list); | ||
177 | |||
178 | if (bacmp(bdaddr, &b->bdaddr) == 0) | ||
179 | return b; | ||
180 | } | ||
181 | |||
182 | return NULL; | ||
183 | } | ||
184 | |||
185 | static int hci_blacklist_add(struct hci_dev *hdev, void __user *arg) | ||
186 | { | ||
187 | bdaddr_t bdaddr; | ||
188 | struct bdaddr_list *entry; | ||
189 | |||
190 | if (copy_from_user(&bdaddr, arg, sizeof(bdaddr))) | ||
191 | return -EFAULT; | ||
192 | |||
193 | if (bacmp(&bdaddr, BDADDR_ANY) == 0) | ||
194 | return -EBADF; | ||
195 | |||
196 | if (hci_blacklist_lookup(hdev, &bdaddr)) | ||
197 | return -EEXIST; | ||
198 | |||
199 | entry = kzalloc(sizeof(struct bdaddr_list), GFP_KERNEL); | ||
200 | if (!entry) | ||
201 | return -ENOMEM; | ||
202 | |||
203 | bacpy(&entry->bdaddr, &bdaddr); | ||
204 | |||
205 | list_add(&entry->list, &hdev->blacklist.list); | ||
206 | |||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | int hci_blacklist_clear(struct hci_dev *hdev) | ||
211 | { | ||
212 | struct list_head *p, *n; | ||
213 | struct bdaddr_list *blacklist = &hdev->blacklist; | ||
214 | |||
215 | list_for_each_safe(p, n, &blacklist->list) { | ||
216 | struct bdaddr_list *b; | ||
217 | |||
218 | b = list_entry(p, struct bdaddr_list, list); | ||
219 | |||
220 | list_del(p); | ||
221 | kfree(b); | ||
222 | } | ||
223 | |||
224 | return 0; | ||
225 | } | ||
226 | |||
227 | static int hci_blacklist_del(struct hci_dev *hdev, void __user *arg) | ||
228 | { | ||
229 | bdaddr_t bdaddr; | ||
230 | struct bdaddr_list *entry; | ||
231 | |||
232 | if (copy_from_user(&bdaddr, arg, sizeof(bdaddr))) | ||
233 | return -EFAULT; | ||
234 | |||
235 | if (bacmp(&bdaddr, BDADDR_ANY) == 0) | ||
236 | return hci_blacklist_clear(hdev); | ||
237 | |||
238 | entry = hci_blacklist_lookup(hdev, &bdaddr); | ||
239 | if (!entry) | ||
240 | return -ENOENT; | ||
241 | |||
242 | list_del(&entry->list); | ||
243 | kfree(entry); | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
168 | /* Ioctls that require bound socket */ | 248 | /* Ioctls that require bound socket */ |
169 | static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) | 249 | static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) |
170 | { | 250 | { |
@@ -194,6 +274,16 @@ static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsign | |||
194 | case HCIGETAUTHINFO: | 274 | case HCIGETAUTHINFO: |
195 | return hci_get_auth_info(hdev, (void __user *) arg); | 275 | return hci_get_auth_info(hdev, (void __user *) arg); |
196 | 276 | ||
277 | case HCIBLOCKADDR: | ||
278 | if (!capable(CAP_NET_ADMIN)) | ||
279 | return -EACCES; | ||
280 | return hci_blacklist_add(hdev, (void __user *) arg); | ||
281 | |||
282 | case HCIUNBLOCKADDR: | ||
283 | if (!capable(CAP_NET_ADMIN)) | ||
284 | return -EACCES; | ||
285 | return hci_blacklist_del(hdev, (void __user *) arg); | ||
286 | |||
197 | default: | 287 | default: |
198 | if (hdev->ioctl) | 288 | if (hdev->ioctl) |
199 | return hdev->ioctl(hdev, cmd, arg); | 289 | return hdev->ioctl(hdev, cmd, arg); |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 463ffa4fe042..ce44c47eeac1 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -436,6 +436,41 @@ static const struct file_operations inquiry_cache_fops = { | |||
436 | .release = single_release, | 436 | .release = single_release, |
437 | }; | 437 | }; |
438 | 438 | ||
439 | static int blacklist_show(struct seq_file *f, void *p) | ||
440 | { | ||
441 | struct hci_dev *hdev = f->private; | ||
442 | struct bdaddr_list *blacklist = &hdev->blacklist; | ||
443 | struct list_head *l; | ||
444 | |||
445 | hci_dev_lock_bh(hdev); | ||
446 | |||
447 | list_for_each(l, &blacklist->list) { | ||
448 | struct bdaddr_list *b; | ||
449 | bdaddr_t bdaddr; | ||
450 | |||
451 | b = list_entry(l, struct bdaddr_list, list); | ||
452 | |||
453 | baswap(&bdaddr, &b->bdaddr); | ||
454 | |||
455 | seq_printf(f, "%s\n", batostr(&bdaddr)); | ||
456 | } | ||
457 | |||
458 | hci_dev_unlock_bh(hdev); | ||
459 | |||
460 | return 0; | ||
461 | } | ||
462 | |||
463 | static int blacklist_open(struct inode *inode, struct file *file) | ||
464 | { | ||
465 | return single_open(file, blacklist_show, inode->i_private); | ||
466 | } | ||
467 | |||
468 | static const struct file_operations blacklist_fops = { | ||
469 | .open = blacklist_open, | ||
470 | .read = seq_read, | ||
471 | .llseek = seq_lseek, | ||
472 | .release = single_release, | ||
473 | }; | ||
439 | int hci_register_sysfs(struct hci_dev *hdev) | 474 | int hci_register_sysfs(struct hci_dev *hdev) |
440 | { | 475 | { |
441 | struct device *dev = &hdev->dev; | 476 | struct device *dev = &hdev->dev; |
@@ -465,6 +500,9 @@ int hci_register_sysfs(struct hci_dev *hdev) | |||
465 | debugfs_create_file("inquiry_cache", 0444, hdev->debugfs, | 500 | debugfs_create_file("inquiry_cache", 0444, hdev->debugfs, |
466 | hdev, &inquiry_cache_fops); | 501 | hdev, &inquiry_cache_fops); |
467 | 502 | ||
503 | debugfs_create_file("blacklist", 0444, hdev->debugfs, | ||
504 | hdev, &blacklist_fops); | ||
505 | |||
468 | return 0; | 506 | return 0; |
469 | } | 507 | } |
470 | 508 | ||
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index cf3c4073a8a6..9ba1e8eee37c 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (C) 2000-2001 Qualcomm Incorporated |
4 | Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org> | ||
5 | Copyright (C) 2010 Google Inc. | ||
4 | 6 | ||
5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 7 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 8 | ||
@@ -53,15 +55,9 @@ | |||
53 | #include <net/bluetooth/hci_core.h> | 55 | #include <net/bluetooth/hci_core.h> |
54 | #include <net/bluetooth/l2cap.h> | 56 | #include <net/bluetooth/l2cap.h> |
55 | 57 | ||
56 | #define VERSION "2.14" | 58 | #define VERSION "2.15" |
57 | 59 | ||
58 | #ifdef CONFIG_BT_L2CAP_EXT_FEATURES | 60 | static int disable_ertm = 0; |
59 | static int enable_ertm = 1; | ||
60 | #else | ||
61 | static int enable_ertm = 0; | ||
62 | #endif | ||
63 | static int max_transmit = L2CAP_DEFAULT_MAX_TX; | ||
64 | static int tx_window = L2CAP_DEFAULT_TX_WINDOW; | ||
65 | 61 | ||
66 | static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN; | 62 | static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN; |
67 | static u8 l2cap_fixed_chan[8] = { 0x02, }; | 63 | static u8 l2cap_fixed_chan[8] = { 0x02, }; |
@@ -80,9 +76,12 @@ static void __l2cap_sock_close(struct sock *sk, int reason); | |||
80 | static void l2cap_sock_close(struct sock *sk); | 76 | static void l2cap_sock_close(struct sock *sk); |
81 | static void l2cap_sock_kill(struct sock *sk); | 77 | static void l2cap_sock_kill(struct sock *sk); |
82 | 78 | ||
79 | static int l2cap_build_conf_req(struct sock *sk, void *data); | ||
83 | static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, | 80 | static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, |
84 | u8 code, u8 ident, u16 dlen, void *data); | 81 | u8 code, u8 ident, u16 dlen, void *data); |
85 | 82 | ||
83 | static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb); | ||
84 | |||
86 | /* ---- L2CAP timers ---- */ | 85 | /* ---- L2CAP timers ---- */ |
87 | static void l2cap_sock_timeout(unsigned long arg) | 86 | static void l2cap_sock_timeout(unsigned long arg) |
88 | { | 87 | { |
@@ -278,6 +277,24 @@ static void l2cap_chan_del(struct sock *sk, int err) | |||
278 | parent->sk_data_ready(parent, 0); | 277 | parent->sk_data_ready(parent, 0); |
279 | } else | 278 | } else |
280 | sk->sk_state_change(sk); | 279 | sk->sk_state_change(sk); |
280 | |||
281 | skb_queue_purge(TX_QUEUE(sk)); | ||
282 | |||
283 | if (l2cap_pi(sk)->mode == L2CAP_MODE_ERTM) { | ||
284 | struct srej_list *l, *tmp; | ||
285 | |||
286 | del_timer(&l2cap_pi(sk)->retrans_timer); | ||
287 | del_timer(&l2cap_pi(sk)->monitor_timer); | ||
288 | del_timer(&l2cap_pi(sk)->ack_timer); | ||
289 | |||
290 | skb_queue_purge(SREJ_QUEUE(sk)); | ||
291 | skb_queue_purge(BUSY_QUEUE(sk)); | ||
292 | |||
293 | list_for_each_entry_safe(l, tmp, SREJ_LIST(sk), list) { | ||
294 | list_del(&l->list); | ||
295 | kfree(l); | ||
296 | } | ||
297 | } | ||
281 | } | 298 | } |
282 | 299 | ||
283 | /* Service level security */ | 300 | /* Service level security */ |
@@ -351,8 +368,12 @@ static inline void l2cap_send_sframe(struct l2cap_pinfo *pi, u16 control) | |||
351 | struct sk_buff *skb; | 368 | struct sk_buff *skb; |
352 | struct l2cap_hdr *lh; | 369 | struct l2cap_hdr *lh; |
353 | struct l2cap_conn *conn = pi->conn; | 370 | struct l2cap_conn *conn = pi->conn; |
371 | struct sock *sk = (struct sock *)pi; | ||
354 | int count, hlen = L2CAP_HDR_SIZE + 2; | 372 | int count, hlen = L2CAP_HDR_SIZE + 2; |
355 | 373 | ||
374 | if (sk->sk_state != BT_CONNECTED) | ||
375 | return; | ||
376 | |||
356 | if (pi->fcs == L2CAP_FCS_CRC16) | 377 | if (pi->fcs == L2CAP_FCS_CRC16) |
357 | hlen += 2; | 378 | hlen += 2; |
358 | 379 | ||
@@ -440,24 +461,57 @@ static void l2cap_do_start(struct sock *sk) | |||
440 | } | 461 | } |
441 | } | 462 | } |
442 | 463 | ||
443 | static void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk) | 464 | static inline int l2cap_mode_supported(__u8 mode, __u32 feat_mask) |
465 | { | ||
466 | u32 local_feat_mask = l2cap_feat_mask; | ||
467 | if (!disable_ertm) | ||
468 | local_feat_mask |= L2CAP_FEAT_ERTM | L2CAP_FEAT_STREAMING; | ||
469 | |||
470 | switch (mode) { | ||
471 | case L2CAP_MODE_ERTM: | ||
472 | return L2CAP_FEAT_ERTM & feat_mask & local_feat_mask; | ||
473 | case L2CAP_MODE_STREAMING: | ||
474 | return L2CAP_FEAT_STREAMING & feat_mask & local_feat_mask; | ||
475 | default: | ||
476 | return 0x00; | ||
477 | } | ||
478 | } | ||
479 | |||
480 | static void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err) | ||
444 | { | 481 | { |
445 | struct l2cap_disconn_req req; | 482 | struct l2cap_disconn_req req; |
446 | 483 | ||
484 | if (!conn) | ||
485 | return; | ||
486 | |||
487 | skb_queue_purge(TX_QUEUE(sk)); | ||
488 | |||
489 | if (l2cap_pi(sk)->mode == L2CAP_MODE_ERTM) { | ||
490 | del_timer(&l2cap_pi(sk)->retrans_timer); | ||
491 | del_timer(&l2cap_pi(sk)->monitor_timer); | ||
492 | del_timer(&l2cap_pi(sk)->ack_timer); | ||
493 | } | ||
494 | |||
447 | req.dcid = cpu_to_le16(l2cap_pi(sk)->dcid); | 495 | req.dcid = cpu_to_le16(l2cap_pi(sk)->dcid); |
448 | req.scid = cpu_to_le16(l2cap_pi(sk)->scid); | 496 | req.scid = cpu_to_le16(l2cap_pi(sk)->scid); |
449 | l2cap_send_cmd(conn, l2cap_get_ident(conn), | 497 | l2cap_send_cmd(conn, l2cap_get_ident(conn), |
450 | L2CAP_DISCONN_REQ, sizeof(req), &req); | 498 | L2CAP_DISCONN_REQ, sizeof(req), &req); |
499 | |||
500 | sk->sk_state = BT_DISCONN; | ||
501 | sk->sk_err = err; | ||
451 | } | 502 | } |
452 | 503 | ||
453 | /* ---- L2CAP connections ---- */ | 504 | /* ---- L2CAP connections ---- */ |
454 | static void l2cap_conn_start(struct l2cap_conn *conn) | 505 | static void l2cap_conn_start(struct l2cap_conn *conn) |
455 | { | 506 | { |
456 | struct l2cap_chan_list *l = &conn->chan_list; | 507 | struct l2cap_chan_list *l = &conn->chan_list; |
508 | struct sock_del_list del, *tmp1, *tmp2; | ||
457 | struct sock *sk; | 509 | struct sock *sk; |
458 | 510 | ||
459 | BT_DBG("conn %p", conn); | 511 | BT_DBG("conn %p", conn); |
460 | 512 | ||
513 | INIT_LIST_HEAD(&del.list); | ||
514 | |||
461 | read_lock(&l->lock); | 515 | read_lock(&l->lock); |
462 | 516 | ||
463 | for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) { | 517 | for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) { |
@@ -470,20 +524,38 @@ static void l2cap_conn_start(struct l2cap_conn *conn) | |||
470 | } | 524 | } |
471 | 525 | ||
472 | if (sk->sk_state == BT_CONNECT) { | 526 | if (sk->sk_state == BT_CONNECT) { |
473 | if (l2cap_check_security(sk) && | 527 | struct l2cap_conn_req req; |
474 | __l2cap_no_conn_pending(sk)) { | ||
475 | struct l2cap_conn_req req; | ||
476 | req.scid = cpu_to_le16(l2cap_pi(sk)->scid); | ||
477 | req.psm = l2cap_pi(sk)->psm; | ||
478 | 528 | ||
479 | l2cap_pi(sk)->ident = l2cap_get_ident(conn); | 529 | if (!l2cap_check_security(sk) || |
480 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_CONNECT_PEND; | 530 | !__l2cap_no_conn_pending(sk)) { |
531 | bh_unlock_sock(sk); | ||
532 | continue; | ||
533 | } | ||
481 | 534 | ||
482 | l2cap_send_cmd(conn, l2cap_pi(sk)->ident, | 535 | if (!l2cap_mode_supported(l2cap_pi(sk)->mode, |
483 | L2CAP_CONN_REQ, sizeof(req), &req); | 536 | conn->feat_mask) |
537 | && l2cap_pi(sk)->conf_state & | ||
538 | L2CAP_CONF_STATE2_DEVICE) { | ||
539 | tmp1 = kzalloc(sizeof(struct sock_del_list), | ||
540 | GFP_ATOMIC); | ||
541 | tmp1->sk = sk; | ||
542 | list_add_tail(&tmp1->list, &del.list); | ||
543 | bh_unlock_sock(sk); | ||
544 | continue; | ||
484 | } | 545 | } |
546 | |||
547 | req.scid = cpu_to_le16(l2cap_pi(sk)->scid); | ||
548 | req.psm = l2cap_pi(sk)->psm; | ||
549 | |||
550 | l2cap_pi(sk)->ident = l2cap_get_ident(conn); | ||
551 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_CONNECT_PEND; | ||
552 | |||
553 | l2cap_send_cmd(conn, l2cap_pi(sk)->ident, | ||
554 | L2CAP_CONN_REQ, sizeof(req), &req); | ||
555 | |||
485 | } else if (sk->sk_state == BT_CONNECT2) { | 556 | } else if (sk->sk_state == BT_CONNECT2) { |
486 | struct l2cap_conn_rsp rsp; | 557 | struct l2cap_conn_rsp rsp; |
558 | char buf[128]; | ||
487 | rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid); | 559 | rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid); |
488 | rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid); | 560 | rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid); |
489 | 561 | ||
@@ -506,12 +578,31 @@ static void l2cap_conn_start(struct l2cap_conn *conn) | |||
506 | 578 | ||
507 | l2cap_send_cmd(conn, l2cap_pi(sk)->ident, | 579 | l2cap_send_cmd(conn, l2cap_pi(sk)->ident, |
508 | L2CAP_CONN_RSP, sizeof(rsp), &rsp); | 580 | L2CAP_CONN_RSP, sizeof(rsp), &rsp); |
581 | |||
582 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT || | ||
583 | rsp.result != L2CAP_CR_SUCCESS) { | ||
584 | bh_unlock_sock(sk); | ||
585 | continue; | ||
586 | } | ||
587 | |||
588 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; | ||
589 | l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, | ||
590 | l2cap_build_conf_req(sk, buf), buf); | ||
591 | l2cap_pi(sk)->num_conf_req++; | ||
509 | } | 592 | } |
510 | 593 | ||
511 | bh_unlock_sock(sk); | 594 | bh_unlock_sock(sk); |
512 | } | 595 | } |
513 | 596 | ||
514 | read_unlock(&l->lock); | 597 | read_unlock(&l->lock); |
598 | |||
599 | list_for_each_entry_safe(tmp1, tmp2, &del.list, list) { | ||
600 | bh_lock_sock(tmp1->sk); | ||
601 | __l2cap_sock_close(tmp1->sk, ECONNRESET); | ||
602 | bh_unlock_sock(tmp1->sk); | ||
603 | list_del(&tmp1->list); | ||
604 | kfree(tmp1); | ||
605 | } | ||
515 | } | 606 | } |
516 | 607 | ||
517 | static void l2cap_conn_ready(struct l2cap_conn *conn) | 608 | static void l2cap_conn_ready(struct l2cap_conn *conn) |
@@ -740,9 +831,8 @@ static void __l2cap_sock_close(struct sock *sk, int reason) | |||
740 | sk->sk_type == SOCK_STREAM) { | 831 | sk->sk_type == SOCK_STREAM) { |
741 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; | 832 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; |
742 | 833 | ||
743 | sk->sk_state = BT_DISCONN; | ||
744 | l2cap_sock_set_timer(sk, sk->sk_sndtimeo); | 834 | l2cap_sock_set_timer(sk, sk->sk_sndtimeo); |
745 | l2cap_send_disconn_req(conn, sk); | 835 | l2cap_send_disconn_req(conn, sk, reason); |
746 | } else | 836 | } else |
747 | l2cap_chan_del(sk, reason); | 837 | l2cap_chan_del(sk, reason); |
748 | break; | 838 | break; |
@@ -802,6 +892,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent) | |||
802 | 892 | ||
803 | pi->imtu = l2cap_pi(parent)->imtu; | 893 | pi->imtu = l2cap_pi(parent)->imtu; |
804 | pi->omtu = l2cap_pi(parent)->omtu; | 894 | pi->omtu = l2cap_pi(parent)->omtu; |
895 | pi->conf_state = l2cap_pi(parent)->conf_state; | ||
805 | pi->mode = l2cap_pi(parent)->mode; | 896 | pi->mode = l2cap_pi(parent)->mode; |
806 | pi->fcs = l2cap_pi(parent)->fcs; | 897 | pi->fcs = l2cap_pi(parent)->fcs; |
807 | pi->max_tx = l2cap_pi(parent)->max_tx; | 898 | pi->max_tx = l2cap_pi(parent)->max_tx; |
@@ -812,13 +903,15 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent) | |||
812 | } else { | 903 | } else { |
813 | pi->imtu = L2CAP_DEFAULT_MTU; | 904 | pi->imtu = L2CAP_DEFAULT_MTU; |
814 | pi->omtu = 0; | 905 | pi->omtu = 0; |
815 | if (enable_ertm && sk->sk_type == SOCK_STREAM) | 906 | if (!disable_ertm && sk->sk_type == SOCK_STREAM) { |
816 | pi->mode = L2CAP_MODE_ERTM; | 907 | pi->mode = L2CAP_MODE_ERTM; |
817 | else | 908 | pi->conf_state |= L2CAP_CONF_STATE2_DEVICE; |
909 | } else { | ||
818 | pi->mode = L2CAP_MODE_BASIC; | 910 | pi->mode = L2CAP_MODE_BASIC; |
819 | pi->max_tx = max_transmit; | 911 | } |
912 | pi->max_tx = L2CAP_DEFAULT_MAX_TX; | ||
820 | pi->fcs = L2CAP_FCS_CRC16; | 913 | pi->fcs = L2CAP_FCS_CRC16; |
821 | pi->tx_win = tx_window; | 914 | pi->tx_win = L2CAP_DEFAULT_TX_WINDOW; |
822 | pi->sec_level = BT_SECURITY_LOW; | 915 | pi->sec_level = BT_SECURITY_LOW; |
823 | pi->role_switch = 0; | 916 | pi->role_switch = 0; |
824 | pi->force_reliable = 0; | 917 | pi->force_reliable = 0; |
@@ -1067,7 +1160,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al | |||
1067 | break; | 1160 | break; |
1068 | case L2CAP_MODE_ERTM: | 1161 | case L2CAP_MODE_ERTM: |
1069 | case L2CAP_MODE_STREAMING: | 1162 | case L2CAP_MODE_STREAMING: |
1070 | if (enable_ertm) | 1163 | if (!disable_ertm) |
1071 | break; | 1164 | break; |
1072 | /* fall through */ | 1165 | /* fall through */ |
1073 | default: | 1166 | default: |
@@ -1084,6 +1177,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al | |||
1084 | 1177 | ||
1085 | case BT_CONNECTED: | 1178 | case BT_CONNECTED: |
1086 | /* Already connected */ | 1179 | /* Already connected */ |
1180 | err = -EISCONN; | ||
1087 | goto done; | 1181 | goto done; |
1088 | 1182 | ||
1089 | case BT_OPEN: | 1183 | case BT_OPEN: |
@@ -1132,7 +1226,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog) | |||
1132 | break; | 1226 | break; |
1133 | case L2CAP_MODE_ERTM: | 1227 | case L2CAP_MODE_ERTM: |
1134 | case L2CAP_MODE_STREAMING: | 1228 | case L2CAP_MODE_STREAMING: |
1135 | if (enable_ertm) | 1229 | if (!disable_ertm) |
1136 | break; | 1230 | break; |
1137 | /* fall through */ | 1231 | /* fall through */ |
1138 | default: | 1232 | default: |
@@ -1285,9 +1379,11 @@ static void l2cap_monitor_timeout(unsigned long arg) | |||
1285 | { | 1379 | { |
1286 | struct sock *sk = (void *) arg; | 1380 | struct sock *sk = (void *) arg; |
1287 | 1381 | ||
1382 | BT_DBG("sk %p", sk); | ||
1383 | |||
1288 | bh_lock_sock(sk); | 1384 | bh_lock_sock(sk); |
1289 | if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) { | 1385 | if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) { |
1290 | l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk); | 1386 | l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk, ECONNABORTED); |
1291 | bh_unlock_sock(sk); | 1387 | bh_unlock_sock(sk); |
1292 | return; | 1388 | return; |
1293 | } | 1389 | } |
@@ -1303,6 +1399,8 @@ static void l2cap_retrans_timeout(unsigned long arg) | |||
1303 | { | 1399 | { |
1304 | struct sock *sk = (void *) arg; | 1400 | struct sock *sk = (void *) arg; |
1305 | 1401 | ||
1402 | BT_DBG("sk %p", sk); | ||
1403 | |||
1306 | bh_lock_sock(sk); | 1404 | bh_lock_sock(sk); |
1307 | l2cap_pi(sk)->retry_count = 1; | 1405 | l2cap_pi(sk)->retry_count = 1; |
1308 | __mod_monitor_timer(); | 1406 | __mod_monitor_timer(); |
@@ -1341,7 +1439,7 @@ static inline void l2cap_do_send(struct sock *sk, struct sk_buff *skb) | |||
1341 | hci_send_acl(pi->conn->hcon, skb, 0); | 1439 | hci_send_acl(pi->conn->hcon, skb, 0); |
1342 | } | 1440 | } |
1343 | 1441 | ||
1344 | static int l2cap_streaming_send(struct sock *sk) | 1442 | static void l2cap_streaming_send(struct sock *sk) |
1345 | { | 1443 | { |
1346 | struct sk_buff *skb, *tx_skb; | 1444 | struct sk_buff *skb, *tx_skb; |
1347 | struct l2cap_pinfo *pi = l2cap_pi(sk); | 1445 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
@@ -1371,7 +1469,6 @@ static int l2cap_streaming_send(struct sock *sk) | |||
1371 | skb = skb_dequeue(TX_QUEUE(sk)); | 1469 | skb = skb_dequeue(TX_QUEUE(sk)); |
1372 | kfree_skb(skb); | 1470 | kfree_skb(skb); |
1373 | } | 1471 | } |
1374 | return 0; | ||
1375 | } | 1472 | } |
1376 | 1473 | ||
1377 | static void l2cap_retransmit_one_frame(struct sock *sk, u8 tx_seq) | 1474 | static void l2cap_retransmit_one_frame(struct sock *sk, u8 tx_seq) |
@@ -1395,15 +1492,22 @@ static void l2cap_retransmit_one_frame(struct sock *sk, u8 tx_seq) | |||
1395 | 1492 | ||
1396 | if (pi->remote_max_tx && | 1493 | if (pi->remote_max_tx && |
1397 | bt_cb(skb)->retries == pi->remote_max_tx) { | 1494 | bt_cb(skb)->retries == pi->remote_max_tx) { |
1398 | l2cap_send_disconn_req(pi->conn, sk); | 1495 | l2cap_send_disconn_req(pi->conn, sk, ECONNABORTED); |
1399 | return; | 1496 | return; |
1400 | } | 1497 | } |
1401 | 1498 | ||
1402 | tx_skb = skb_clone(skb, GFP_ATOMIC); | 1499 | tx_skb = skb_clone(skb, GFP_ATOMIC); |
1403 | bt_cb(skb)->retries++; | 1500 | bt_cb(skb)->retries++; |
1404 | control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); | 1501 | control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); |
1502 | |||
1503 | if (pi->conn_state & L2CAP_CONN_SEND_FBIT) { | ||
1504 | control |= L2CAP_CTRL_FINAL; | ||
1505 | pi->conn_state &= ~L2CAP_CONN_SEND_FBIT; | ||
1506 | } | ||
1507 | |||
1405 | control |= (pi->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT) | 1508 | control |= (pi->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT) |
1406 | | (tx_seq << L2CAP_CTRL_TXSEQ_SHIFT); | 1509 | | (tx_seq << L2CAP_CTRL_TXSEQ_SHIFT); |
1510 | |||
1407 | put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE); | 1511 | put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE); |
1408 | 1512 | ||
1409 | if (pi->fcs == L2CAP_FCS_CRC16) { | 1513 | if (pi->fcs == L2CAP_FCS_CRC16) { |
@@ -1421,15 +1525,14 @@ static int l2cap_ertm_send(struct sock *sk) | |||
1421 | u16 control, fcs; | 1525 | u16 control, fcs; |
1422 | int nsent = 0; | 1526 | int nsent = 0; |
1423 | 1527 | ||
1424 | if (pi->conn_state & L2CAP_CONN_WAIT_F) | 1528 | if (sk->sk_state != BT_CONNECTED) |
1425 | return 0; | 1529 | return -ENOTCONN; |
1426 | 1530 | ||
1427 | while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full(sk)) && | 1531 | while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full(sk))) { |
1428 | !(pi->conn_state & L2CAP_CONN_REMOTE_BUSY)) { | ||
1429 | 1532 | ||
1430 | if (pi->remote_max_tx && | 1533 | if (pi->remote_max_tx && |
1431 | bt_cb(skb)->retries == pi->remote_max_tx) { | 1534 | bt_cb(skb)->retries == pi->remote_max_tx) { |
1432 | l2cap_send_disconn_req(pi->conn, sk); | 1535 | l2cap_send_disconn_req(pi->conn, sk, ECONNABORTED); |
1433 | break; | 1536 | break; |
1434 | } | 1537 | } |
1435 | 1538 | ||
@@ -1438,6 +1541,8 @@ static int l2cap_ertm_send(struct sock *sk) | |||
1438 | bt_cb(skb)->retries++; | 1541 | bt_cb(skb)->retries++; |
1439 | 1542 | ||
1440 | control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); | 1543 | control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); |
1544 | control &= L2CAP_CTRL_SAR; | ||
1545 | |||
1441 | if (pi->conn_state & L2CAP_CONN_SEND_FBIT) { | 1546 | if (pi->conn_state & L2CAP_CONN_SEND_FBIT) { |
1442 | control |= L2CAP_CTRL_FINAL; | 1547 | control |= L2CAP_CTRL_FINAL; |
1443 | pi->conn_state &= ~L2CAP_CONN_SEND_FBIT; | 1548 | pi->conn_state &= ~L2CAP_CONN_SEND_FBIT; |
@@ -1478,16 +1583,11 @@ static int l2cap_retransmit_frames(struct sock *sk) | |||
1478 | struct l2cap_pinfo *pi = l2cap_pi(sk); | 1583 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
1479 | int ret; | 1584 | int ret; |
1480 | 1585 | ||
1481 | spin_lock_bh(&pi->send_lock); | ||
1482 | |||
1483 | if (!skb_queue_empty(TX_QUEUE(sk))) | 1586 | if (!skb_queue_empty(TX_QUEUE(sk))) |
1484 | sk->sk_send_head = TX_QUEUE(sk)->next; | 1587 | sk->sk_send_head = TX_QUEUE(sk)->next; |
1485 | 1588 | ||
1486 | pi->next_tx_seq = pi->expected_ack_seq; | 1589 | pi->next_tx_seq = pi->expected_ack_seq; |
1487 | ret = l2cap_ertm_send(sk); | 1590 | ret = l2cap_ertm_send(sk); |
1488 | |||
1489 | spin_unlock_bh(&pi->send_lock); | ||
1490 | |||
1491 | return ret; | 1591 | return ret; |
1492 | } | 1592 | } |
1493 | 1593 | ||
@@ -1495,7 +1595,6 @@ static void l2cap_send_ack(struct l2cap_pinfo *pi) | |||
1495 | { | 1595 | { |
1496 | struct sock *sk = (struct sock *)pi; | 1596 | struct sock *sk = (struct sock *)pi; |
1497 | u16 control = 0; | 1597 | u16 control = 0; |
1498 | int nframes; | ||
1499 | 1598 | ||
1500 | control |= pi->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT; | 1599 | control |= pi->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT; |
1501 | 1600 | ||
@@ -1506,11 +1605,7 @@ static void l2cap_send_ack(struct l2cap_pinfo *pi) | |||
1506 | return; | 1605 | return; |
1507 | } | 1606 | } |
1508 | 1607 | ||
1509 | spin_lock_bh(&pi->send_lock); | 1608 | if (l2cap_ertm_send(sk) > 0) |
1510 | nframes = l2cap_ertm_send(sk); | ||
1511 | spin_unlock_bh(&pi->send_lock); | ||
1512 | |||
1513 | if (nframes > 0) | ||
1514 | return; | 1609 | return; |
1515 | 1610 | ||
1516 | control |= L2CAP_SUPER_RCV_READY; | 1611 | control |= L2CAP_SUPER_RCV_READY; |
@@ -1705,10 +1800,8 @@ static inline int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, siz | |||
1705 | size += buflen; | 1800 | size += buflen; |
1706 | } | 1801 | } |
1707 | skb_queue_splice_tail(&sar_queue, TX_QUEUE(sk)); | 1802 | skb_queue_splice_tail(&sar_queue, TX_QUEUE(sk)); |
1708 | spin_lock_bh(&pi->send_lock); | ||
1709 | if (sk->sk_send_head == NULL) | 1803 | if (sk->sk_send_head == NULL) |
1710 | sk->sk_send_head = sar_queue.next; | 1804 | sk->sk_send_head = sar_queue.next; |
1711 | spin_unlock_bh(&pi->send_lock); | ||
1712 | 1805 | ||
1713 | return size; | 1806 | return size; |
1714 | } | 1807 | } |
@@ -1753,7 +1846,7 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1753 | case L2CAP_MODE_BASIC: | 1846 | case L2CAP_MODE_BASIC: |
1754 | /* Check outgoing MTU */ | 1847 | /* Check outgoing MTU */ |
1755 | if (len > pi->omtu) { | 1848 | if (len > pi->omtu) { |
1756 | err = -EINVAL; | 1849 | err = -EMSGSIZE; |
1757 | goto done; | 1850 | goto done; |
1758 | } | 1851 | } |
1759 | 1852 | ||
@@ -1780,14 +1873,9 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1780 | } | 1873 | } |
1781 | __skb_queue_tail(TX_QUEUE(sk), skb); | 1874 | __skb_queue_tail(TX_QUEUE(sk), skb); |
1782 | 1875 | ||
1783 | if (pi->mode == L2CAP_MODE_ERTM) | ||
1784 | spin_lock_bh(&pi->send_lock); | ||
1785 | |||
1786 | if (sk->sk_send_head == NULL) | 1876 | if (sk->sk_send_head == NULL) |
1787 | sk->sk_send_head = skb; | 1877 | sk->sk_send_head = skb; |
1788 | 1878 | ||
1789 | if (pi->mode == L2CAP_MODE_ERTM) | ||
1790 | spin_unlock_bh(&pi->send_lock); | ||
1791 | } else { | 1879 | } else { |
1792 | /* Segment SDU into multiples PDUs */ | 1880 | /* Segment SDU into multiples PDUs */ |
1793 | err = l2cap_sar_segment_sdu(sk, msg, len); | 1881 | err = l2cap_sar_segment_sdu(sk, msg, len); |
@@ -1796,11 +1884,14 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1796 | } | 1884 | } |
1797 | 1885 | ||
1798 | if (pi->mode == L2CAP_MODE_STREAMING) { | 1886 | if (pi->mode == L2CAP_MODE_STREAMING) { |
1799 | err = l2cap_streaming_send(sk); | 1887 | l2cap_streaming_send(sk); |
1800 | } else { | 1888 | } else { |
1801 | spin_lock_bh(&pi->send_lock); | 1889 | if (pi->conn_state & L2CAP_CONN_REMOTE_BUSY && |
1890 | pi->conn_state && L2CAP_CONN_WAIT_F) { | ||
1891 | err = len; | ||
1892 | break; | ||
1893 | } | ||
1802 | err = l2cap_ertm_send(sk); | 1894 | err = l2cap_ertm_send(sk); |
1803 | spin_unlock_bh(&pi->send_lock); | ||
1804 | } | 1895 | } |
1805 | 1896 | ||
1806 | if (err >= 0) | 1897 | if (err >= 0) |
@@ -1809,7 +1900,7 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1809 | 1900 | ||
1810 | default: | 1901 | default: |
1811 | BT_DBG("bad state %1.1x", pi->mode); | 1902 | BT_DBG("bad state %1.1x", pi->mode); |
1812 | err = -EINVAL; | 1903 | err = -EBADFD; |
1813 | } | 1904 | } |
1814 | 1905 | ||
1815 | done: | 1906 | done: |
@@ -1825,6 +1916,8 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1825 | 1916 | ||
1826 | if (sk->sk_state == BT_CONNECT2 && bt_sk(sk)->defer_setup) { | 1917 | if (sk->sk_state == BT_CONNECT2 && bt_sk(sk)->defer_setup) { |
1827 | struct l2cap_conn_rsp rsp; | 1918 | struct l2cap_conn_rsp rsp; |
1919 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; | ||
1920 | u8 buf[128]; | ||
1828 | 1921 | ||
1829 | sk->sk_state = BT_CONFIG; | 1922 | sk->sk_state = BT_CONFIG; |
1830 | 1923 | ||
@@ -1835,6 +1928,16 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1835 | l2cap_send_cmd(l2cap_pi(sk)->conn, l2cap_pi(sk)->ident, | 1928 | l2cap_send_cmd(l2cap_pi(sk)->conn, l2cap_pi(sk)->ident, |
1836 | L2CAP_CONN_RSP, sizeof(rsp), &rsp); | 1929 | L2CAP_CONN_RSP, sizeof(rsp), &rsp); |
1837 | 1930 | ||
1931 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) { | ||
1932 | release_sock(sk); | ||
1933 | return 0; | ||
1934 | } | ||
1935 | |||
1936 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; | ||
1937 | l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, | ||
1938 | l2cap_build_conf_req(sk, buf), buf); | ||
1939 | l2cap_pi(sk)->num_conf_req++; | ||
1940 | |||
1838 | release_sock(sk); | 1941 | release_sock(sk); |
1839 | return 0; | 1942 | return 0; |
1840 | } | 1943 | } |
@@ -1871,13 +1974,19 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us | |||
1871 | break; | 1974 | break; |
1872 | } | 1975 | } |
1873 | 1976 | ||
1977 | if (opts.txwin_size > L2CAP_DEFAULT_TX_WINDOW) { | ||
1978 | err = -EINVAL; | ||
1979 | break; | ||
1980 | } | ||
1981 | |||
1874 | l2cap_pi(sk)->mode = opts.mode; | 1982 | l2cap_pi(sk)->mode = opts.mode; |
1875 | switch (l2cap_pi(sk)->mode) { | 1983 | switch (l2cap_pi(sk)->mode) { |
1876 | case L2CAP_MODE_BASIC: | 1984 | case L2CAP_MODE_BASIC: |
1985 | l2cap_pi(sk)->conf_state &= ~L2CAP_CONF_STATE2_DEVICE; | ||
1877 | break; | 1986 | break; |
1878 | case L2CAP_MODE_ERTM: | 1987 | case L2CAP_MODE_ERTM: |
1879 | case L2CAP_MODE_STREAMING: | 1988 | case L2CAP_MODE_STREAMING: |
1880 | if (enable_ertm) | 1989 | if (!disable_ertm) |
1881 | break; | 1990 | break; |
1882 | /* fall through */ | 1991 | /* fall through */ |
1883 | default: | 1992 | default: |
@@ -2145,6 +2254,10 @@ static int l2cap_sock_shutdown(struct socket *sock, int how) | |||
2145 | err = bt_sock_wait_state(sk, BT_CLOSED, | 2254 | err = bt_sock_wait_state(sk, BT_CLOSED, |
2146 | sk->sk_lingertime); | 2255 | sk->sk_lingertime); |
2147 | } | 2256 | } |
2257 | |||
2258 | if (!err && sk->sk_err) | ||
2259 | err = -sk->sk_err; | ||
2260 | |||
2148 | release_sock(sk); | 2261 | release_sock(sk); |
2149 | return err; | 2262 | return err; |
2150 | } | 2263 | } |
@@ -2365,25 +2478,10 @@ static inline void l2cap_ertm_init(struct sock *sk) | |||
2365 | 2478 | ||
2366 | __skb_queue_head_init(SREJ_QUEUE(sk)); | 2479 | __skb_queue_head_init(SREJ_QUEUE(sk)); |
2367 | __skb_queue_head_init(BUSY_QUEUE(sk)); | 2480 | __skb_queue_head_init(BUSY_QUEUE(sk)); |
2368 | spin_lock_init(&l2cap_pi(sk)->send_lock); | ||
2369 | 2481 | ||
2370 | INIT_WORK(&l2cap_pi(sk)->busy_work, l2cap_busy_work); | 2482 | INIT_WORK(&l2cap_pi(sk)->busy_work, l2cap_busy_work); |
2371 | } | ||
2372 | 2483 | ||
2373 | static int l2cap_mode_supported(__u8 mode, __u32 feat_mask) | 2484 | sk->sk_backlog_rcv = l2cap_ertm_data_rcv; |
2374 | { | ||
2375 | u32 local_feat_mask = l2cap_feat_mask; | ||
2376 | if (enable_ertm) | ||
2377 | local_feat_mask |= L2CAP_FEAT_ERTM | L2CAP_FEAT_STREAMING; | ||
2378 | |||
2379 | switch (mode) { | ||
2380 | case L2CAP_MODE_ERTM: | ||
2381 | return L2CAP_FEAT_ERTM & feat_mask & local_feat_mask; | ||
2382 | case L2CAP_MODE_STREAMING: | ||
2383 | return L2CAP_FEAT_STREAMING & feat_mask & local_feat_mask; | ||
2384 | default: | ||
2385 | return 0x00; | ||
2386 | } | ||
2387 | } | 2485 | } |
2388 | 2486 | ||
2389 | static inline __u8 l2cap_select_mode(__u8 mode, __u16 remote_feat_mask) | 2487 | static inline __u8 l2cap_select_mode(__u8 mode, __u16 remote_feat_mask) |
@@ -2414,10 +2512,10 @@ static int l2cap_build_conf_req(struct sock *sk, void *data) | |||
2414 | switch (pi->mode) { | 2512 | switch (pi->mode) { |
2415 | case L2CAP_MODE_STREAMING: | 2513 | case L2CAP_MODE_STREAMING: |
2416 | case L2CAP_MODE_ERTM: | 2514 | case L2CAP_MODE_ERTM: |
2417 | pi->conf_state |= L2CAP_CONF_STATE2_DEVICE; | 2515 | if (pi->conf_state & L2CAP_CONF_STATE2_DEVICE) |
2418 | if (!l2cap_mode_supported(pi->mode, pi->conn->feat_mask)) | 2516 | break; |
2419 | l2cap_send_disconn_req(pi->conn, sk); | 2517 | |
2420 | break; | 2518 | /* fall through */ |
2421 | default: | 2519 | default: |
2422 | pi->mode = l2cap_select_mode(rfc.mode, pi->conn->feat_mask); | 2520 | pi->mode = l2cap_select_mode(rfc.mode, pi->conn->feat_mask); |
2423 | break; | 2521 | break; |
@@ -2428,6 +2526,14 @@ done: | |||
2428 | case L2CAP_MODE_BASIC: | 2526 | case L2CAP_MODE_BASIC: |
2429 | if (pi->imtu != L2CAP_DEFAULT_MTU) | 2527 | if (pi->imtu != L2CAP_DEFAULT_MTU) |
2430 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu); | 2528 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu); |
2529 | |||
2530 | rfc.mode = L2CAP_MODE_BASIC; | ||
2531 | rfc.txwin_size = 0; | ||
2532 | rfc.max_transmit = 0; | ||
2533 | rfc.retrans_timeout = 0; | ||
2534 | rfc.monitor_timeout = 0; | ||
2535 | rfc.max_pdu_size = 0; | ||
2536 | |||
2431 | break; | 2537 | break; |
2432 | 2538 | ||
2433 | case L2CAP_MODE_ERTM: | 2539 | case L2CAP_MODE_ERTM: |
@@ -2440,9 +2546,6 @@ done: | |||
2440 | if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10) | 2546 | if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10) |
2441 | rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10); | 2547 | rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10); |
2442 | 2548 | ||
2443 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, | ||
2444 | sizeof(rfc), (unsigned long) &rfc); | ||
2445 | |||
2446 | if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS)) | 2549 | if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS)) |
2447 | break; | 2550 | break; |
2448 | 2551 | ||
@@ -2463,9 +2566,6 @@ done: | |||
2463 | if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10) | 2566 | if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10) |
2464 | rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10); | 2567 | rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10); |
2465 | 2568 | ||
2466 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, | ||
2467 | sizeof(rfc), (unsigned long) &rfc); | ||
2468 | |||
2469 | if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS)) | 2569 | if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS)) |
2470 | break; | 2570 | break; |
2471 | 2571 | ||
@@ -2477,6 +2577,9 @@ done: | |||
2477 | break; | 2577 | break; |
2478 | } | 2578 | } |
2479 | 2579 | ||
2580 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc), | ||
2581 | (unsigned long) &rfc); | ||
2582 | |||
2480 | /* FIXME: Need actual value of the flush timeout */ | 2583 | /* FIXME: Need actual value of the flush timeout */ |
2481 | //if (flush_to != L2CAP_DEFAULT_FLUSH_TO) | 2584 | //if (flush_to != L2CAP_DEFAULT_FLUSH_TO) |
2482 | // l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to); | 2585 | // l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to); |
@@ -2541,18 +2644,21 @@ static int l2cap_parse_conf_req(struct sock *sk, void *data) | |||
2541 | } | 2644 | } |
2542 | } | 2645 | } |
2543 | 2646 | ||
2544 | if (pi->num_conf_rsp || pi->num_conf_req) | 2647 | if (pi->num_conf_rsp || pi->num_conf_req > 1) |
2545 | goto done; | 2648 | goto done; |
2546 | 2649 | ||
2547 | switch (pi->mode) { | 2650 | switch (pi->mode) { |
2548 | case L2CAP_MODE_STREAMING: | 2651 | case L2CAP_MODE_STREAMING: |
2549 | case L2CAP_MODE_ERTM: | 2652 | case L2CAP_MODE_ERTM: |
2550 | pi->conf_state |= L2CAP_CONF_STATE2_DEVICE; | 2653 | if (!(pi->conf_state & L2CAP_CONF_STATE2_DEVICE)) { |
2551 | if (!l2cap_mode_supported(pi->mode, pi->conn->feat_mask)) | 2654 | pi->mode = l2cap_select_mode(rfc.mode, |
2655 | pi->conn->feat_mask); | ||
2656 | break; | ||
2657 | } | ||
2658 | |||
2659 | if (pi->mode != rfc.mode) | ||
2552 | return -ECONNREFUSED; | 2660 | return -ECONNREFUSED; |
2553 | break; | 2661 | |
2554 | default: | ||
2555 | pi->mode = l2cap_select_mode(rfc.mode, pi->conn->feat_mask); | ||
2556 | break; | 2662 | break; |
2557 | } | 2663 | } |
2558 | 2664 | ||
@@ -2675,7 +2781,6 @@ static int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *data, | |||
2675 | rfc.mode != pi->mode) | 2781 | rfc.mode != pi->mode) |
2676 | return -ECONNREFUSED; | 2782 | return -ECONNREFUSED; |
2677 | 2783 | ||
2678 | pi->mode = rfc.mode; | ||
2679 | pi->fcs = 0; | 2784 | pi->fcs = 0; |
2680 | 2785 | ||
2681 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, | 2786 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, |
@@ -2684,6 +2789,11 @@ static int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *data, | |||
2684 | } | 2789 | } |
2685 | } | 2790 | } |
2686 | 2791 | ||
2792 | if (pi->mode == L2CAP_MODE_BASIC && pi->mode != rfc.mode) | ||
2793 | return -ECONNREFUSED; | ||
2794 | |||
2795 | pi->mode = rfc.mode; | ||
2796 | |||
2687 | if (*result == L2CAP_CONF_SUCCESS) { | 2797 | if (*result == L2CAP_CONF_SUCCESS) { |
2688 | switch (rfc.mode) { | 2798 | switch (rfc.mode) { |
2689 | case L2CAP_MODE_ERTM: | 2799 | case L2CAP_MODE_ERTM: |
@@ -2778,7 +2888,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
2778 | struct l2cap_chan_list *list = &conn->chan_list; | 2888 | struct l2cap_chan_list *list = &conn->chan_list; |
2779 | struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; | 2889 | struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; |
2780 | struct l2cap_conn_rsp rsp; | 2890 | struct l2cap_conn_rsp rsp; |
2781 | struct sock *sk, *parent; | 2891 | struct sock *parent, *uninitialized_var(sk); |
2782 | int result, status = L2CAP_CS_NO_INFO; | 2892 | int result, status = L2CAP_CS_NO_INFO; |
2783 | 2893 | ||
2784 | u16 dcid = 0, scid = __le16_to_cpu(req->scid); | 2894 | u16 dcid = 0, scid = __le16_to_cpu(req->scid); |
@@ -2887,6 +2997,15 @@ sendresp: | |||
2887 | L2CAP_INFO_REQ, sizeof(info), &info); | 2997 | L2CAP_INFO_REQ, sizeof(info), &info); |
2888 | } | 2998 | } |
2889 | 2999 | ||
3000 | if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) && | ||
3001 | result == L2CAP_CR_SUCCESS) { | ||
3002 | u8 buf[128]; | ||
3003 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; | ||
3004 | l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, | ||
3005 | l2cap_build_conf_req(sk, buf), buf); | ||
3006 | l2cap_pi(sk)->num_conf_req++; | ||
3007 | } | ||
3008 | |||
2890 | return 0; | 3009 | return 0; |
2891 | } | 3010 | } |
2892 | 3011 | ||
@@ -2907,11 +3026,11 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
2907 | if (scid) { | 3026 | if (scid) { |
2908 | sk = l2cap_get_chan_by_scid(&conn->chan_list, scid); | 3027 | sk = l2cap_get_chan_by_scid(&conn->chan_list, scid); |
2909 | if (!sk) | 3028 | if (!sk) |
2910 | return 0; | 3029 | return -EFAULT; |
2911 | } else { | 3030 | } else { |
2912 | sk = l2cap_get_chan_by_ident(&conn->chan_list, cmd->ident); | 3031 | sk = l2cap_get_chan_by_ident(&conn->chan_list, cmd->ident); |
2913 | if (!sk) | 3032 | if (!sk) |
2914 | return 0; | 3033 | return -EFAULT; |
2915 | } | 3034 | } |
2916 | 3035 | ||
2917 | switch (result) { | 3036 | switch (result) { |
@@ -2919,9 +3038,13 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
2919 | sk->sk_state = BT_CONFIG; | 3038 | sk->sk_state = BT_CONFIG; |
2920 | l2cap_pi(sk)->ident = 0; | 3039 | l2cap_pi(sk)->ident = 0; |
2921 | l2cap_pi(sk)->dcid = dcid; | 3040 | l2cap_pi(sk)->dcid = dcid; |
2922 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; | ||
2923 | l2cap_pi(sk)->conf_state &= ~L2CAP_CONF_CONNECT_PEND; | 3041 | l2cap_pi(sk)->conf_state &= ~L2CAP_CONF_CONNECT_PEND; |
2924 | 3042 | ||
3043 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) | ||
3044 | break; | ||
3045 | |||
3046 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; | ||
3047 | |||
2925 | l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, | 3048 | l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, |
2926 | l2cap_build_conf_req(sk, req), req); | 3049 | l2cap_build_conf_req(sk, req), req); |
2927 | l2cap_pi(sk)->num_conf_req++; | 3050 | l2cap_pi(sk)->num_conf_req++; |
@@ -2957,8 +3080,14 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
2957 | if (!sk) | 3080 | if (!sk) |
2958 | return -ENOENT; | 3081 | return -ENOENT; |
2959 | 3082 | ||
2960 | if (sk->sk_state == BT_DISCONN) | 3083 | if (sk->sk_state != BT_CONFIG) { |
3084 | struct l2cap_cmd_rej rej; | ||
3085 | |||
3086 | rej.reason = cpu_to_le16(0x0002); | ||
3087 | l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ, | ||
3088 | sizeof(rej), &rej); | ||
2961 | goto unlock; | 3089 | goto unlock; |
3090 | } | ||
2962 | 3091 | ||
2963 | /* Reject if config buffer is too small. */ | 3092 | /* Reject if config buffer is too small. */ |
2964 | len = cmd_len - sizeof(*req); | 3093 | len = cmd_len - sizeof(*req); |
@@ -2984,7 +3113,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
2984 | /* Complete config. */ | 3113 | /* Complete config. */ |
2985 | len = l2cap_parse_conf_req(sk, rsp); | 3114 | len = l2cap_parse_conf_req(sk, rsp); |
2986 | if (len < 0) { | 3115 | if (len < 0) { |
2987 | l2cap_send_disconn_req(conn, sk); | 3116 | l2cap_send_disconn_req(conn, sk, ECONNRESET); |
2988 | goto unlock; | 3117 | goto unlock; |
2989 | } | 3118 | } |
2990 | 3119 | ||
@@ -3054,7 +3183,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
3054 | char req[64]; | 3183 | char req[64]; |
3055 | 3184 | ||
3056 | if (len > sizeof(req) - sizeof(struct l2cap_conf_req)) { | 3185 | if (len > sizeof(req) - sizeof(struct l2cap_conf_req)) { |
3057 | l2cap_send_disconn_req(conn, sk); | 3186 | l2cap_send_disconn_req(conn, sk, ECONNRESET); |
3058 | goto done; | 3187 | goto done; |
3059 | } | 3188 | } |
3060 | 3189 | ||
@@ -3063,7 +3192,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
3063 | len = l2cap_parse_conf_rsp(sk, rsp->data, | 3192 | len = l2cap_parse_conf_rsp(sk, rsp->data, |
3064 | len, req, &result); | 3193 | len, req, &result); |
3065 | if (len < 0) { | 3194 | if (len < 0) { |
3066 | l2cap_send_disconn_req(conn, sk); | 3195 | l2cap_send_disconn_req(conn, sk, ECONNRESET); |
3067 | goto done; | 3196 | goto done; |
3068 | } | 3197 | } |
3069 | 3198 | ||
@@ -3076,10 +3205,9 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
3076 | } | 3205 | } |
3077 | 3206 | ||
3078 | default: | 3207 | default: |
3079 | sk->sk_state = BT_DISCONN; | ||
3080 | sk->sk_err = ECONNRESET; | 3208 | sk->sk_err = ECONNRESET; |
3081 | l2cap_sock_set_timer(sk, HZ * 5); | 3209 | l2cap_sock_set_timer(sk, HZ * 5); |
3082 | l2cap_send_disconn_req(conn, sk); | 3210 | l2cap_send_disconn_req(conn, sk, ECONNRESET); |
3083 | goto done; | 3211 | goto done; |
3084 | } | 3212 | } |
3085 | 3213 | ||
@@ -3130,16 +3258,6 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd | |||
3130 | 3258 | ||
3131 | sk->sk_shutdown = SHUTDOWN_MASK; | 3259 | sk->sk_shutdown = SHUTDOWN_MASK; |
3132 | 3260 | ||
3133 | skb_queue_purge(TX_QUEUE(sk)); | ||
3134 | |||
3135 | if (l2cap_pi(sk)->mode == L2CAP_MODE_ERTM) { | ||
3136 | skb_queue_purge(SREJ_QUEUE(sk)); | ||
3137 | skb_queue_purge(BUSY_QUEUE(sk)); | ||
3138 | del_timer(&l2cap_pi(sk)->retrans_timer); | ||
3139 | del_timer(&l2cap_pi(sk)->monitor_timer); | ||
3140 | del_timer(&l2cap_pi(sk)->ack_timer); | ||
3141 | } | ||
3142 | |||
3143 | l2cap_chan_del(sk, ECONNRESET); | 3261 | l2cap_chan_del(sk, ECONNRESET); |
3144 | bh_unlock_sock(sk); | 3262 | bh_unlock_sock(sk); |
3145 | 3263 | ||
@@ -3162,16 +3280,6 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd | |||
3162 | if (!sk) | 3280 | if (!sk) |
3163 | return 0; | 3281 | return 0; |
3164 | 3282 | ||
3165 | skb_queue_purge(TX_QUEUE(sk)); | ||
3166 | |||
3167 | if (l2cap_pi(sk)->mode == L2CAP_MODE_ERTM) { | ||
3168 | skb_queue_purge(SREJ_QUEUE(sk)); | ||
3169 | skb_queue_purge(BUSY_QUEUE(sk)); | ||
3170 | del_timer(&l2cap_pi(sk)->retrans_timer); | ||
3171 | del_timer(&l2cap_pi(sk)->monitor_timer); | ||
3172 | del_timer(&l2cap_pi(sk)->ack_timer); | ||
3173 | } | ||
3174 | |||
3175 | l2cap_chan_del(sk, 0); | 3283 | l2cap_chan_del(sk, 0); |
3176 | bh_unlock_sock(sk); | 3284 | bh_unlock_sock(sk); |
3177 | 3285 | ||
@@ -3194,7 +3302,7 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm | |||
3194 | struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) buf; | 3302 | struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) buf; |
3195 | rsp->type = cpu_to_le16(L2CAP_IT_FEAT_MASK); | 3303 | rsp->type = cpu_to_le16(L2CAP_IT_FEAT_MASK); |
3196 | rsp->result = cpu_to_le16(L2CAP_IR_SUCCESS); | 3304 | rsp->result = cpu_to_le16(L2CAP_IR_SUCCESS); |
3197 | if (enable_ertm) | 3305 | if (!disable_ertm) |
3198 | feat_mask |= L2CAP_FEAT_ERTM | L2CAP_FEAT_STREAMING | 3306 | feat_mask |= L2CAP_FEAT_ERTM | L2CAP_FEAT_STREAMING |
3199 | | L2CAP_FEAT_FCS; | 3307 | | L2CAP_FEAT_FCS; |
3200 | put_unaligned_le32(feat_mask, rsp->data); | 3308 | put_unaligned_le32(feat_mask, rsp->data); |
@@ -3359,7 +3467,7 @@ static int l2cap_check_fcs(struct l2cap_pinfo *pi, struct sk_buff *skb) | |||
3359 | our_fcs = crc16(0, skb->data - hdr_size, skb->len + hdr_size); | 3467 | our_fcs = crc16(0, skb->data - hdr_size, skb->len + hdr_size); |
3360 | 3468 | ||
3361 | if (our_fcs != rcv_fcs) | 3469 | if (our_fcs != rcv_fcs) |
3362 | return -EINVAL; | 3470 | return -EBADMSG; |
3363 | } | 3471 | } |
3364 | return 0; | 3472 | return 0; |
3365 | } | 3473 | } |
@@ -3370,25 +3478,19 @@ static inline void l2cap_send_i_or_rr_or_rnr(struct sock *sk) | |||
3370 | u16 control = 0; | 3478 | u16 control = 0; |
3371 | 3479 | ||
3372 | pi->frames_sent = 0; | 3480 | pi->frames_sent = 0; |
3373 | pi->conn_state |= L2CAP_CONN_SEND_FBIT; | ||
3374 | 3481 | ||
3375 | control |= pi->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT; | 3482 | control |= pi->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT; |
3376 | 3483 | ||
3377 | if (pi->conn_state & L2CAP_CONN_LOCAL_BUSY) { | 3484 | if (pi->conn_state & L2CAP_CONN_LOCAL_BUSY) { |
3378 | control |= L2CAP_SUPER_RCV_NOT_READY | L2CAP_CTRL_FINAL; | 3485 | control |= L2CAP_SUPER_RCV_NOT_READY; |
3379 | l2cap_send_sframe(pi, control); | 3486 | l2cap_send_sframe(pi, control); |
3380 | pi->conn_state |= L2CAP_CONN_RNR_SENT; | 3487 | pi->conn_state |= L2CAP_CONN_RNR_SENT; |
3381 | pi->conn_state &= ~L2CAP_CONN_SEND_FBIT; | ||
3382 | } | 3488 | } |
3383 | 3489 | ||
3384 | if (pi->conn_state & L2CAP_CONN_REMOTE_BUSY && pi->unacked_frames > 0) | 3490 | if (pi->conn_state & L2CAP_CONN_REMOTE_BUSY) |
3385 | __mod_retrans_timer(); | 3491 | l2cap_retransmit_frames(sk); |
3386 | |||
3387 | pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; | ||
3388 | 3492 | ||
3389 | spin_lock_bh(&pi->send_lock); | ||
3390 | l2cap_ertm_send(sk); | 3493 | l2cap_ertm_send(sk); |
3391 | spin_unlock_bh(&pi->send_lock); | ||
3392 | 3494 | ||
3393 | if (!(pi->conn_state & L2CAP_CONN_LOCAL_BUSY) && | 3495 | if (!(pi->conn_state & L2CAP_CONN_LOCAL_BUSY) && |
3394 | pi->frames_sent == 0) { | 3496 | pi->frames_sent == 0) { |
@@ -3400,6 +3502,8 @@ static inline void l2cap_send_i_or_rr_or_rnr(struct sock *sk) | |||
3400 | static int l2cap_add_to_srej_queue(struct sock *sk, struct sk_buff *skb, u8 tx_seq, u8 sar) | 3502 | static int l2cap_add_to_srej_queue(struct sock *sk, struct sk_buff *skb, u8 tx_seq, u8 sar) |
3401 | { | 3503 | { |
3402 | struct sk_buff *next_skb; | 3504 | struct sk_buff *next_skb; |
3505 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
3506 | int tx_seq_offset, next_tx_seq_offset; | ||
3403 | 3507 | ||
3404 | bt_cb(skb)->tx_seq = tx_seq; | 3508 | bt_cb(skb)->tx_seq = tx_seq; |
3405 | bt_cb(skb)->sar = sar; | 3509 | bt_cb(skb)->sar = sar; |
@@ -3410,11 +3514,20 @@ static int l2cap_add_to_srej_queue(struct sock *sk, struct sk_buff *skb, u8 tx_s | |||
3410 | return 0; | 3514 | return 0; |
3411 | } | 3515 | } |
3412 | 3516 | ||
3517 | tx_seq_offset = (tx_seq - pi->buffer_seq) % 64; | ||
3518 | if (tx_seq_offset < 0) | ||
3519 | tx_seq_offset += 64; | ||
3520 | |||
3413 | do { | 3521 | do { |
3414 | if (bt_cb(next_skb)->tx_seq == tx_seq) | 3522 | if (bt_cb(next_skb)->tx_seq == tx_seq) |
3415 | return -EINVAL; | 3523 | return -EINVAL; |
3416 | 3524 | ||
3417 | if (bt_cb(next_skb)->tx_seq > tx_seq) { | 3525 | next_tx_seq_offset = (bt_cb(next_skb)->tx_seq - |
3526 | pi->buffer_seq) % 64; | ||
3527 | if (next_tx_seq_offset < 0) | ||
3528 | next_tx_seq_offset += 64; | ||
3529 | |||
3530 | if (next_tx_seq_offset > tx_seq_offset) { | ||
3418 | __skb_queue_before(SREJ_QUEUE(sk), next_skb, skb); | 3531 | __skb_queue_before(SREJ_QUEUE(sk), next_skb, skb); |
3419 | return 0; | 3532 | return 0; |
3420 | } | 3533 | } |
@@ -3532,11 +3645,51 @@ drop: | |||
3532 | pi->sdu = NULL; | 3645 | pi->sdu = NULL; |
3533 | 3646 | ||
3534 | disconnect: | 3647 | disconnect: |
3535 | l2cap_send_disconn_req(pi->conn, sk); | 3648 | l2cap_send_disconn_req(pi->conn, sk, ECONNRESET); |
3536 | kfree_skb(skb); | 3649 | kfree_skb(skb); |
3537 | return 0; | 3650 | return 0; |
3538 | } | 3651 | } |
3539 | 3652 | ||
3653 | static int l2cap_try_push_rx_skb(struct sock *sk) | ||
3654 | { | ||
3655 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
3656 | struct sk_buff *skb; | ||
3657 | u16 control; | ||
3658 | int err; | ||
3659 | |||
3660 | while ((skb = skb_dequeue(BUSY_QUEUE(sk)))) { | ||
3661 | control = bt_cb(skb)->sar << L2CAP_CTRL_SAR_SHIFT; | ||
3662 | err = l2cap_ertm_reassembly_sdu(sk, skb, control); | ||
3663 | if (err < 0) { | ||
3664 | skb_queue_head(BUSY_QUEUE(sk), skb); | ||
3665 | return -EBUSY; | ||
3666 | } | ||
3667 | |||
3668 | pi->buffer_seq = (pi->buffer_seq + 1) % 64; | ||
3669 | } | ||
3670 | |||
3671 | if (!(pi->conn_state & L2CAP_CONN_RNR_SENT)) | ||
3672 | goto done; | ||
3673 | |||
3674 | control = pi->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT; | ||
3675 | control |= L2CAP_SUPER_RCV_READY | L2CAP_CTRL_POLL; | ||
3676 | l2cap_send_sframe(pi, control); | ||
3677 | l2cap_pi(sk)->retry_count = 1; | ||
3678 | |||
3679 | del_timer(&pi->retrans_timer); | ||
3680 | __mod_monitor_timer(); | ||
3681 | |||
3682 | l2cap_pi(sk)->conn_state |= L2CAP_CONN_WAIT_F; | ||
3683 | |||
3684 | done: | ||
3685 | pi->conn_state &= ~L2CAP_CONN_LOCAL_BUSY; | ||
3686 | pi->conn_state &= ~L2CAP_CONN_RNR_SENT; | ||
3687 | |||
3688 | BT_DBG("sk %p, Exit local busy", sk); | ||
3689 | |||
3690 | return 0; | ||
3691 | } | ||
3692 | |||
3540 | static void l2cap_busy_work(struct work_struct *work) | 3693 | static void l2cap_busy_work(struct work_struct *work) |
3541 | { | 3694 | { |
3542 | DECLARE_WAITQUEUE(wait, current); | 3695 | DECLARE_WAITQUEUE(wait, current); |
@@ -3545,7 +3698,6 @@ static void l2cap_busy_work(struct work_struct *work) | |||
3545 | struct sock *sk = (struct sock *)pi; | 3698 | struct sock *sk = (struct sock *)pi; |
3546 | int n_tries = 0, timeo = HZ/5, err; | 3699 | int n_tries = 0, timeo = HZ/5, err; |
3547 | struct sk_buff *skb; | 3700 | struct sk_buff *skb; |
3548 | u16 control; | ||
3549 | 3701 | ||
3550 | lock_sock(sk); | 3702 | lock_sock(sk); |
3551 | 3703 | ||
@@ -3555,8 +3707,8 @@ static void l2cap_busy_work(struct work_struct *work) | |||
3555 | 3707 | ||
3556 | if (n_tries++ > L2CAP_LOCAL_BUSY_TRIES) { | 3708 | if (n_tries++ > L2CAP_LOCAL_BUSY_TRIES) { |
3557 | err = -EBUSY; | 3709 | err = -EBUSY; |
3558 | l2cap_send_disconn_req(pi->conn, sk); | 3710 | l2cap_send_disconn_req(pi->conn, sk, EBUSY); |
3559 | goto done; | 3711 | break; |
3560 | } | 3712 | } |
3561 | 3713 | ||
3562 | if (!timeo) | 3714 | if (!timeo) |
@@ -3564,7 +3716,7 @@ static void l2cap_busy_work(struct work_struct *work) | |||
3564 | 3716 | ||
3565 | if (signal_pending(current)) { | 3717 | if (signal_pending(current)) { |
3566 | err = sock_intr_errno(timeo); | 3718 | err = sock_intr_errno(timeo); |
3567 | goto done; | 3719 | break; |
3568 | } | 3720 | } |
3569 | 3721 | ||
3570 | release_sock(sk); | 3722 | release_sock(sk); |
@@ -3573,40 +3725,12 @@ static void l2cap_busy_work(struct work_struct *work) | |||
3573 | 3725 | ||
3574 | err = sock_error(sk); | 3726 | err = sock_error(sk); |
3575 | if (err) | 3727 | if (err) |
3576 | goto done; | 3728 | break; |
3577 | |||
3578 | while ((skb = skb_dequeue(BUSY_QUEUE(sk)))) { | ||
3579 | control = bt_cb(skb)->sar << L2CAP_CTRL_SAR_SHIFT; | ||
3580 | err = l2cap_ertm_reassembly_sdu(sk, skb, control); | ||
3581 | if (err < 0) { | ||
3582 | skb_queue_head(BUSY_QUEUE(sk), skb); | ||
3583 | break; | ||
3584 | } | ||
3585 | |||
3586 | pi->buffer_seq = (pi->buffer_seq + 1) % 64; | ||
3587 | } | ||
3588 | 3729 | ||
3589 | if (!skb) | 3730 | if (l2cap_try_push_rx_skb(sk) == 0) |
3590 | break; | 3731 | break; |
3591 | } | 3732 | } |
3592 | 3733 | ||
3593 | if (!(pi->conn_state & L2CAP_CONN_RNR_SENT)) | ||
3594 | goto done; | ||
3595 | |||
3596 | control = pi->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT; | ||
3597 | control |= L2CAP_SUPER_RCV_READY | L2CAP_CTRL_POLL; | ||
3598 | l2cap_send_sframe(pi, control); | ||
3599 | l2cap_pi(sk)->retry_count = 1; | ||
3600 | |||
3601 | del_timer(&pi->retrans_timer); | ||
3602 | __mod_monitor_timer(); | ||
3603 | |||
3604 | l2cap_pi(sk)->conn_state |= L2CAP_CONN_WAIT_F; | ||
3605 | |||
3606 | done: | ||
3607 | pi->conn_state &= ~L2CAP_CONN_LOCAL_BUSY; | ||
3608 | pi->conn_state &= ~L2CAP_CONN_RNR_SENT; | ||
3609 | |||
3610 | set_current_state(TASK_RUNNING); | 3734 | set_current_state(TASK_RUNNING); |
3611 | remove_wait_queue(sk_sleep(sk), &wait); | 3735 | remove_wait_queue(sk_sleep(sk), &wait); |
3612 | 3736 | ||
@@ -3621,7 +3745,9 @@ static int l2cap_push_rx_skb(struct sock *sk, struct sk_buff *skb, u16 control) | |||
3621 | if (pi->conn_state & L2CAP_CONN_LOCAL_BUSY) { | 3745 | if (pi->conn_state & L2CAP_CONN_LOCAL_BUSY) { |
3622 | bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT; | 3746 | bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT; |
3623 | __skb_queue_tail(BUSY_QUEUE(sk), skb); | 3747 | __skb_queue_tail(BUSY_QUEUE(sk), skb); |
3624 | return -EBUSY; | 3748 | return l2cap_try_push_rx_skb(sk); |
3749 | |||
3750 | |||
3625 | } | 3751 | } |
3626 | 3752 | ||
3627 | err = l2cap_ertm_reassembly_sdu(sk, skb, control); | 3753 | err = l2cap_ertm_reassembly_sdu(sk, skb, control); |
@@ -3631,6 +3757,8 @@ static int l2cap_push_rx_skb(struct sock *sk, struct sk_buff *skb, u16 control) | |||
3631 | } | 3757 | } |
3632 | 3758 | ||
3633 | /* Busy Condition */ | 3759 | /* Busy Condition */ |
3760 | BT_DBG("sk %p, Enter local busy", sk); | ||
3761 | |||
3634 | pi->conn_state |= L2CAP_CONN_LOCAL_BUSY; | 3762 | pi->conn_state |= L2CAP_CONN_LOCAL_BUSY; |
3635 | bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT; | 3763 | bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT; |
3636 | __skb_queue_tail(BUSY_QUEUE(sk), skb); | 3764 | __skb_queue_tail(BUSY_QUEUE(sk), skb); |
@@ -3641,6 +3769,8 @@ static int l2cap_push_rx_skb(struct sock *sk, struct sk_buff *skb, u16 control) | |||
3641 | 3769 | ||
3642 | pi->conn_state |= L2CAP_CONN_RNR_SENT; | 3770 | pi->conn_state |= L2CAP_CONN_RNR_SENT; |
3643 | 3771 | ||
3772 | del_timer(&pi->ack_timer); | ||
3773 | |||
3644 | queue_work(_busy_wq, &pi->busy_work); | 3774 | queue_work(_busy_wq, &pi->busy_work); |
3645 | 3775 | ||
3646 | return err; | 3776 | return err; |
@@ -3754,7 +3884,7 @@ static void l2cap_check_srej_gap(struct sock *sk, u8 tx_seq) | |||
3754 | l2cap_ertm_reassembly_sdu(sk, skb, control); | 3884 | l2cap_ertm_reassembly_sdu(sk, skb, control); |
3755 | l2cap_pi(sk)->buffer_seq_srej = | 3885 | l2cap_pi(sk)->buffer_seq_srej = |
3756 | (l2cap_pi(sk)->buffer_seq_srej + 1) % 64; | 3886 | (l2cap_pi(sk)->buffer_seq_srej + 1) % 64; |
3757 | tx_seq++; | 3887 | tx_seq = (tx_seq + 1) % 64; |
3758 | } | 3888 | } |
3759 | } | 3889 | } |
3760 | 3890 | ||
@@ -3790,10 +3920,11 @@ static void l2cap_send_srejframe(struct sock *sk, u8 tx_seq) | |||
3790 | l2cap_send_sframe(pi, control); | 3920 | l2cap_send_sframe(pi, control); |
3791 | 3921 | ||
3792 | new = kzalloc(sizeof(struct srej_list), GFP_ATOMIC); | 3922 | new = kzalloc(sizeof(struct srej_list), GFP_ATOMIC); |
3793 | new->tx_seq = pi->expected_tx_seq++; | 3923 | new->tx_seq = pi->expected_tx_seq; |
3924 | pi->expected_tx_seq = (pi->expected_tx_seq + 1) % 64; | ||
3794 | list_add_tail(&new->list, SREJ_LIST(sk)); | 3925 | list_add_tail(&new->list, SREJ_LIST(sk)); |
3795 | } | 3926 | } |
3796 | pi->expected_tx_seq++; | 3927 | pi->expected_tx_seq = (pi->expected_tx_seq + 1) % 64; |
3797 | } | 3928 | } |
3798 | 3929 | ||
3799 | static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, struct sk_buff *skb) | 3930 | static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, struct sk_buff *skb) |
@@ -3802,11 +3933,12 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str | |||
3802 | u8 tx_seq = __get_txseq(rx_control); | 3933 | u8 tx_seq = __get_txseq(rx_control); |
3803 | u8 req_seq = __get_reqseq(rx_control); | 3934 | u8 req_seq = __get_reqseq(rx_control); |
3804 | u8 sar = rx_control >> L2CAP_CTRL_SAR_SHIFT; | 3935 | u8 sar = rx_control >> L2CAP_CTRL_SAR_SHIFT; |
3805 | u8 tx_seq_offset, expected_tx_seq_offset; | 3936 | int tx_seq_offset, expected_tx_seq_offset; |
3806 | int num_to_ack = (pi->tx_win/6) + 1; | 3937 | int num_to_ack = (pi->tx_win/6) + 1; |
3807 | int err = 0; | 3938 | int err = 0; |
3808 | 3939 | ||
3809 | BT_DBG("sk %p rx_control 0x%4.4x len %d", sk, rx_control, skb->len); | 3940 | BT_DBG("sk %p len %d tx_seq %d rx_control 0x%4.4x", sk, skb->len, tx_seq, |
3941 | rx_control); | ||
3810 | 3942 | ||
3811 | if (L2CAP_CTRL_FINAL & rx_control && | 3943 | if (L2CAP_CTRL_FINAL & rx_control && |
3812 | l2cap_pi(sk)->conn_state & L2CAP_CONN_WAIT_F) { | 3944 | l2cap_pi(sk)->conn_state & L2CAP_CONN_WAIT_F) { |
@@ -3828,7 +3960,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str | |||
3828 | 3960 | ||
3829 | /* invalid tx_seq */ | 3961 | /* invalid tx_seq */ |
3830 | if (tx_seq_offset >= pi->tx_win) { | 3962 | if (tx_seq_offset >= pi->tx_win) { |
3831 | l2cap_send_disconn_req(pi->conn, sk); | 3963 | l2cap_send_disconn_req(pi->conn, sk, ECONNRESET); |
3832 | goto drop; | 3964 | goto drop; |
3833 | } | 3965 | } |
3834 | 3966 | ||
@@ -3851,6 +3983,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str | |||
3851 | pi->buffer_seq = pi->buffer_seq_srej; | 3983 | pi->buffer_seq = pi->buffer_seq_srej; |
3852 | pi->conn_state &= ~L2CAP_CONN_SREJ_SENT; | 3984 | pi->conn_state &= ~L2CAP_CONN_SREJ_SENT; |
3853 | l2cap_send_ack(pi); | 3985 | l2cap_send_ack(pi); |
3986 | BT_DBG("sk %p, Exit SREJ_SENT", sk); | ||
3854 | } | 3987 | } |
3855 | } else { | 3988 | } else { |
3856 | struct srej_list *l; | 3989 | struct srej_list *l; |
@@ -3879,6 +4012,8 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str | |||
3879 | 4012 | ||
3880 | pi->conn_state |= L2CAP_CONN_SREJ_SENT; | 4013 | pi->conn_state |= L2CAP_CONN_SREJ_SENT; |
3881 | 4014 | ||
4015 | BT_DBG("sk %p, Enter SREJ", sk); | ||
4016 | |||
3882 | INIT_LIST_HEAD(SREJ_LIST(sk)); | 4017 | INIT_LIST_HEAD(SREJ_LIST(sk)); |
3883 | pi->buffer_seq_srej = pi->buffer_seq; | 4018 | pi->buffer_seq_srej = pi->buffer_seq; |
3884 | 4019 | ||
@@ -3889,6 +4024,8 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str | |||
3889 | pi->conn_state |= L2CAP_CONN_SEND_PBIT; | 4024 | pi->conn_state |= L2CAP_CONN_SEND_PBIT; |
3890 | 4025 | ||
3891 | l2cap_send_srejframe(sk, tx_seq); | 4026 | l2cap_send_srejframe(sk, tx_seq); |
4027 | |||
4028 | del_timer(&pi->ack_timer); | ||
3892 | } | 4029 | } |
3893 | return 0; | 4030 | return 0; |
3894 | 4031 | ||
@@ -3902,6 +4039,10 @@ expected: | |||
3902 | return 0; | 4039 | return 0; |
3903 | } | 4040 | } |
3904 | 4041 | ||
4042 | err = l2cap_push_rx_skb(sk, skb, rx_control); | ||
4043 | if (err < 0) | ||
4044 | return 0; | ||
4045 | |||
3905 | if (rx_control & L2CAP_CTRL_FINAL) { | 4046 | if (rx_control & L2CAP_CTRL_FINAL) { |
3906 | if (pi->conn_state & L2CAP_CONN_REJ_ACT) | 4047 | if (pi->conn_state & L2CAP_CONN_REJ_ACT) |
3907 | pi->conn_state &= ~L2CAP_CONN_REJ_ACT; | 4048 | pi->conn_state &= ~L2CAP_CONN_REJ_ACT; |
@@ -3909,10 +4050,6 @@ expected: | |||
3909 | l2cap_retransmit_frames(sk); | 4050 | l2cap_retransmit_frames(sk); |
3910 | } | 4051 | } |
3911 | 4052 | ||
3912 | err = l2cap_push_rx_skb(sk, skb, rx_control); | ||
3913 | if (err < 0) | ||
3914 | return 0; | ||
3915 | |||
3916 | __mod_ack_timer(); | 4053 | __mod_ack_timer(); |
3917 | 4054 | ||
3918 | pi->num_acked = (pi->num_acked + 1) % num_to_ack; | 4055 | pi->num_acked = (pi->num_acked + 1) % num_to_ack; |
@@ -3930,10 +4067,14 @@ static inline void l2cap_data_channel_rrframe(struct sock *sk, u16 rx_control) | |||
3930 | { | 4067 | { |
3931 | struct l2cap_pinfo *pi = l2cap_pi(sk); | 4068 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
3932 | 4069 | ||
4070 | BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, __get_reqseq(rx_control), | ||
4071 | rx_control); | ||
4072 | |||
3933 | pi->expected_ack_seq = __get_reqseq(rx_control); | 4073 | pi->expected_ack_seq = __get_reqseq(rx_control); |
3934 | l2cap_drop_acked_frames(sk); | 4074 | l2cap_drop_acked_frames(sk); |
3935 | 4075 | ||
3936 | if (rx_control & L2CAP_CTRL_POLL) { | 4076 | if (rx_control & L2CAP_CTRL_POLL) { |
4077 | pi->conn_state |= L2CAP_CONN_SEND_FBIT; | ||
3937 | if (pi->conn_state & L2CAP_CONN_SREJ_SENT) { | 4078 | if (pi->conn_state & L2CAP_CONN_SREJ_SENT) { |
3938 | if ((pi->conn_state & L2CAP_CONN_REMOTE_BUSY) && | 4079 | if ((pi->conn_state & L2CAP_CONN_REMOTE_BUSY) && |
3939 | (pi->unacked_frames > 0)) | 4080 | (pi->unacked_frames > 0)) |
@@ -3962,9 +4103,7 @@ static inline void l2cap_data_channel_rrframe(struct sock *sk, u16 rx_control) | |||
3962 | if (pi->conn_state & L2CAP_CONN_SREJ_SENT) { | 4103 | if (pi->conn_state & L2CAP_CONN_SREJ_SENT) { |
3963 | l2cap_send_ack(pi); | 4104 | l2cap_send_ack(pi); |
3964 | } else { | 4105 | } else { |
3965 | spin_lock_bh(&pi->send_lock); | ||
3966 | l2cap_ertm_send(sk); | 4106 | l2cap_ertm_send(sk); |
3967 | spin_unlock_bh(&pi->send_lock); | ||
3968 | } | 4107 | } |
3969 | } | 4108 | } |
3970 | } | 4109 | } |
@@ -3974,6 +4113,8 @@ static inline void l2cap_data_channel_rejframe(struct sock *sk, u16 rx_control) | |||
3974 | struct l2cap_pinfo *pi = l2cap_pi(sk); | 4113 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
3975 | u8 tx_seq = __get_reqseq(rx_control); | 4114 | u8 tx_seq = __get_reqseq(rx_control); |
3976 | 4115 | ||
4116 | BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, tx_seq, rx_control); | ||
4117 | |||
3977 | pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; | 4118 | pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; |
3978 | 4119 | ||
3979 | pi->expected_ack_seq = tx_seq; | 4120 | pi->expected_ack_seq = tx_seq; |
@@ -3996,16 +4137,18 @@ static inline void l2cap_data_channel_srejframe(struct sock *sk, u16 rx_control) | |||
3996 | struct l2cap_pinfo *pi = l2cap_pi(sk); | 4137 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
3997 | u8 tx_seq = __get_reqseq(rx_control); | 4138 | u8 tx_seq = __get_reqseq(rx_control); |
3998 | 4139 | ||
4140 | BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, tx_seq, rx_control); | ||
4141 | |||
3999 | pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; | 4142 | pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; |
4000 | 4143 | ||
4001 | if (rx_control & L2CAP_CTRL_POLL) { | 4144 | if (rx_control & L2CAP_CTRL_POLL) { |
4002 | pi->expected_ack_seq = tx_seq; | 4145 | pi->expected_ack_seq = tx_seq; |
4003 | l2cap_drop_acked_frames(sk); | 4146 | l2cap_drop_acked_frames(sk); |
4147 | |||
4148 | pi->conn_state |= L2CAP_CONN_SEND_FBIT; | ||
4004 | l2cap_retransmit_one_frame(sk, tx_seq); | 4149 | l2cap_retransmit_one_frame(sk, tx_seq); |
4005 | 4150 | ||
4006 | spin_lock_bh(&pi->send_lock); | ||
4007 | l2cap_ertm_send(sk); | 4151 | l2cap_ertm_send(sk); |
4008 | spin_unlock_bh(&pi->send_lock); | ||
4009 | 4152 | ||
4010 | if (pi->conn_state & L2CAP_CONN_WAIT_F) { | 4153 | if (pi->conn_state & L2CAP_CONN_WAIT_F) { |
4011 | pi->srej_save_reqseq = tx_seq; | 4154 | pi->srej_save_reqseq = tx_seq; |
@@ -4031,10 +4174,15 @@ static inline void l2cap_data_channel_rnrframe(struct sock *sk, u16 rx_control) | |||
4031 | struct l2cap_pinfo *pi = l2cap_pi(sk); | 4174 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
4032 | u8 tx_seq = __get_reqseq(rx_control); | 4175 | u8 tx_seq = __get_reqseq(rx_control); |
4033 | 4176 | ||
4177 | BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, tx_seq, rx_control); | ||
4178 | |||
4034 | pi->conn_state |= L2CAP_CONN_REMOTE_BUSY; | 4179 | pi->conn_state |= L2CAP_CONN_REMOTE_BUSY; |
4035 | pi->expected_ack_seq = tx_seq; | 4180 | pi->expected_ack_seq = tx_seq; |
4036 | l2cap_drop_acked_frames(sk); | 4181 | l2cap_drop_acked_frames(sk); |
4037 | 4182 | ||
4183 | if (rx_control & L2CAP_CTRL_POLL) | ||
4184 | pi->conn_state |= L2CAP_CONN_SEND_FBIT; | ||
4185 | |||
4038 | if (!(pi->conn_state & L2CAP_CONN_SREJ_SENT)) { | 4186 | if (!(pi->conn_state & L2CAP_CONN_SREJ_SENT)) { |
4039 | del_timer(&pi->retrans_timer); | 4187 | del_timer(&pi->retrans_timer); |
4040 | if (rx_control & L2CAP_CTRL_POLL) | 4188 | if (rx_control & L2CAP_CTRL_POLL) |
@@ -4082,12 +4230,83 @@ static inline int l2cap_data_channel_sframe(struct sock *sk, u16 rx_control, str | |||
4082 | return 0; | 4230 | return 0; |
4083 | } | 4231 | } |
4084 | 4232 | ||
4233 | static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb) | ||
4234 | { | ||
4235 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
4236 | u16 control; | ||
4237 | u8 req_seq; | ||
4238 | int len, next_tx_seq_offset, req_seq_offset; | ||
4239 | |||
4240 | control = get_unaligned_le16(skb->data); | ||
4241 | skb_pull(skb, 2); | ||
4242 | len = skb->len; | ||
4243 | |||
4244 | /* | ||
4245 | * We can just drop the corrupted I-frame here. | ||
4246 | * Receiver will miss it and start proper recovery | ||
4247 | * procedures and ask retransmission. | ||
4248 | */ | ||
4249 | if (l2cap_check_fcs(pi, skb)) | ||
4250 | goto drop; | ||
4251 | |||
4252 | if (__is_sar_start(control) && __is_iframe(control)) | ||
4253 | len -= 2; | ||
4254 | |||
4255 | if (pi->fcs == L2CAP_FCS_CRC16) | ||
4256 | len -= 2; | ||
4257 | |||
4258 | if (len > pi->mps) { | ||
4259 | l2cap_send_disconn_req(pi->conn, sk, ECONNRESET); | ||
4260 | goto drop; | ||
4261 | } | ||
4262 | |||
4263 | req_seq = __get_reqseq(control); | ||
4264 | req_seq_offset = (req_seq - pi->expected_ack_seq) % 64; | ||
4265 | if (req_seq_offset < 0) | ||
4266 | req_seq_offset += 64; | ||
4267 | |||
4268 | next_tx_seq_offset = | ||
4269 | (pi->next_tx_seq - pi->expected_ack_seq) % 64; | ||
4270 | if (next_tx_seq_offset < 0) | ||
4271 | next_tx_seq_offset += 64; | ||
4272 | |||
4273 | /* check for invalid req-seq */ | ||
4274 | if (req_seq_offset > next_tx_seq_offset) { | ||
4275 | l2cap_send_disconn_req(pi->conn, sk, ECONNRESET); | ||
4276 | goto drop; | ||
4277 | } | ||
4278 | |||
4279 | if (__is_iframe(control)) { | ||
4280 | if (len < 0) { | ||
4281 | l2cap_send_disconn_req(pi->conn, sk, ECONNRESET); | ||
4282 | goto drop; | ||
4283 | } | ||
4284 | |||
4285 | l2cap_data_channel_iframe(sk, control, skb); | ||
4286 | } else { | ||
4287 | if (len != 0) { | ||
4288 | BT_ERR("%d", len); | ||
4289 | l2cap_send_disconn_req(pi->conn, sk, ECONNRESET); | ||
4290 | goto drop; | ||
4291 | } | ||
4292 | |||
4293 | l2cap_data_channel_sframe(sk, control, skb); | ||
4294 | } | ||
4295 | |||
4296 | return 0; | ||
4297 | |||
4298 | drop: | ||
4299 | kfree_skb(skb); | ||
4300 | return 0; | ||
4301 | } | ||
4302 | |||
4085 | static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk_buff *skb) | 4303 | static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk_buff *skb) |
4086 | { | 4304 | { |
4087 | struct sock *sk; | 4305 | struct sock *sk; |
4088 | struct l2cap_pinfo *pi; | 4306 | struct l2cap_pinfo *pi; |
4089 | u16 control, len; | 4307 | u16 control; |
4090 | u8 tx_seq, req_seq, next_tx_seq_offset, req_seq_offset; | 4308 | u8 tx_seq; |
4309 | int len; | ||
4091 | 4310 | ||
4092 | sk = l2cap_get_chan_by_scid(&conn->chan_list, cid); | 4311 | sk = l2cap_get_chan_by_scid(&conn->chan_list, cid); |
4093 | if (!sk) { | 4312 | if (!sk) { |
@@ -4117,59 +4336,11 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
4117 | break; | 4336 | break; |
4118 | 4337 | ||
4119 | case L2CAP_MODE_ERTM: | 4338 | case L2CAP_MODE_ERTM: |
4120 | control = get_unaligned_le16(skb->data); | 4339 | if (!sock_owned_by_user(sk)) { |
4121 | skb_pull(skb, 2); | 4340 | l2cap_ertm_data_rcv(sk, skb); |
4122 | len = skb->len; | ||
4123 | |||
4124 | if (__is_sar_start(control)) | ||
4125 | len -= 2; | ||
4126 | |||
4127 | if (pi->fcs == L2CAP_FCS_CRC16) | ||
4128 | len -= 2; | ||
4129 | |||
4130 | /* | ||
4131 | * We can just drop the corrupted I-frame here. | ||
4132 | * Receiver will miss it and start proper recovery | ||
4133 | * procedures and ask retransmission. | ||
4134 | */ | ||
4135 | if (len > pi->mps) { | ||
4136 | l2cap_send_disconn_req(pi->conn, sk); | ||
4137 | goto drop; | ||
4138 | } | ||
4139 | |||
4140 | if (l2cap_check_fcs(pi, skb)) | ||
4141 | goto drop; | ||
4142 | |||
4143 | req_seq = __get_reqseq(control); | ||
4144 | req_seq_offset = (req_seq - pi->expected_ack_seq) % 64; | ||
4145 | if (req_seq_offset < 0) | ||
4146 | req_seq_offset += 64; | ||
4147 | |||
4148 | next_tx_seq_offset = | ||
4149 | (pi->next_tx_seq - pi->expected_ack_seq) % 64; | ||
4150 | if (next_tx_seq_offset < 0) | ||
4151 | next_tx_seq_offset += 64; | ||
4152 | |||
4153 | /* check for invalid req-seq */ | ||
4154 | if (req_seq_offset > next_tx_seq_offset) { | ||
4155 | l2cap_send_disconn_req(pi->conn, sk); | ||
4156 | goto drop; | ||
4157 | } | ||
4158 | |||
4159 | if (__is_iframe(control)) { | ||
4160 | if (len < 4) { | ||
4161 | l2cap_send_disconn_req(pi->conn, sk); | ||
4162 | goto drop; | ||
4163 | } | ||
4164 | |||
4165 | l2cap_data_channel_iframe(sk, control, skb); | ||
4166 | } else { | 4341 | } else { |
4167 | if (len != 0) { | 4342 | if (sk_add_backlog(sk, skb)) |
4168 | l2cap_send_disconn_req(pi->conn, sk); | ||
4169 | goto drop; | 4343 | goto drop; |
4170 | } | ||
4171 | |||
4172 | l2cap_data_channel_sframe(sk, control, skb); | ||
4173 | } | 4344 | } |
4174 | 4345 | ||
4175 | goto done; | 4346 | goto done; |
@@ -4179,16 +4350,16 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
4179 | skb_pull(skb, 2); | 4350 | skb_pull(skb, 2); |
4180 | len = skb->len; | 4351 | len = skb->len; |
4181 | 4352 | ||
4353 | if (l2cap_check_fcs(pi, skb)) | ||
4354 | goto drop; | ||
4355 | |||
4182 | if (__is_sar_start(control)) | 4356 | if (__is_sar_start(control)) |
4183 | len -= 2; | 4357 | len -= 2; |
4184 | 4358 | ||
4185 | if (pi->fcs == L2CAP_FCS_CRC16) | 4359 | if (pi->fcs == L2CAP_FCS_CRC16) |
4186 | len -= 2; | 4360 | len -= 2; |
4187 | 4361 | ||
4188 | if (len > pi->mps || len < 4 || __is_sframe(control)) | 4362 | if (len > pi->mps || len < 0 || __is_sframe(control)) |
4189 | goto drop; | ||
4190 | |||
4191 | if (l2cap_check_fcs(pi, skb)) | ||
4192 | goto drop; | 4363 | goto drop; |
4193 | 4364 | ||
4194 | tx_seq = __get_txseq(control); | 4365 | tx_seq = __get_txseq(control); |
@@ -4288,7 +4459,7 @@ static int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) | |||
4288 | struct hlist_node *node; | 4459 | struct hlist_node *node; |
4289 | 4460 | ||
4290 | if (type != ACL_LINK) | 4461 | if (type != ACL_LINK) |
4291 | return 0; | 4462 | return -EINVAL; |
4292 | 4463 | ||
4293 | BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); | 4464 | BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); |
4294 | 4465 | ||
@@ -4321,7 +4492,7 @@ static int l2cap_connect_cfm(struct hci_conn *hcon, u8 status) | |||
4321 | BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); | 4492 | BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); |
4322 | 4493 | ||
4323 | if (hcon->type != ACL_LINK) | 4494 | if (hcon->type != ACL_LINK) |
4324 | return 0; | 4495 | return -EINVAL; |
4325 | 4496 | ||
4326 | if (!status) { | 4497 | if (!status) { |
4327 | conn = l2cap_conn_add(hcon, status); | 4498 | conn = l2cap_conn_add(hcon, status); |
@@ -4350,7 +4521,7 @@ static int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) | |||
4350 | BT_DBG("hcon %p reason %d", hcon, reason); | 4521 | BT_DBG("hcon %p reason %d", hcon, reason); |
4351 | 4522 | ||
4352 | if (hcon->type != ACL_LINK) | 4523 | if (hcon->type != ACL_LINK) |
4353 | return 0; | 4524 | return -EINVAL; |
4354 | 4525 | ||
4355 | l2cap_conn_del(hcon, bt_err(reason)); | 4526 | l2cap_conn_del(hcon, bt_err(reason)); |
4356 | 4527 | ||
@@ -4679,14 +4850,8 @@ EXPORT_SYMBOL(l2cap_load); | |||
4679 | module_init(l2cap_init); | 4850 | module_init(l2cap_init); |
4680 | module_exit(l2cap_exit); | 4851 | module_exit(l2cap_exit); |
4681 | 4852 | ||
4682 | module_param(enable_ertm, bool, 0644); | 4853 | module_param(disable_ertm, bool, 0644); |
4683 | MODULE_PARM_DESC(enable_ertm, "Enable enhanced retransmission mode"); | 4854 | MODULE_PARM_DESC(disable_ertm, "Disable enhanced retransmission mode"); |
4684 | |||
4685 | module_param(max_transmit, uint, 0644); | ||
4686 | MODULE_PARM_DESC(max_transmit, "Max transmit value (default = 3)"); | ||
4687 | |||
4688 | module_param(tx_window, uint, 0644); | ||
4689 | MODULE_PARM_DESC(tx_window, "Transmission window size value (default = 63)"); | ||
4690 | 4855 | ||
4691 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); | 4856 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
4692 | MODULE_DESCRIPTION("Bluetooth L2CAP ver " VERSION); | 4857 | MODULE_DESCRIPTION("Bluetooth L2CAP ver " VERSION); |
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 43fbf6b4b4bf..44a623275951 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -1152,7 +1152,7 @@ error: | |||
1152 | return err; | 1152 | return err; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | void rfcomm_cleanup_sockets(void) | 1155 | void __exit rfcomm_cleanup_sockets(void) |
1156 | { | 1156 | { |
1157 | debugfs_remove(rfcomm_sock_debugfs); | 1157 | debugfs_remove(rfcomm_sock_debugfs); |
1158 | 1158 | ||
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 309b6c261b25..026205c18b78 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -1153,7 +1153,7 @@ static const struct tty_operations rfcomm_ops = { | |||
1153 | .tiocmset = rfcomm_tty_tiocmset, | 1153 | .tiocmset = rfcomm_tty_tiocmset, |
1154 | }; | 1154 | }; |
1155 | 1155 | ||
1156 | int rfcomm_init_ttys(void) | 1156 | int __init rfcomm_init_ttys(void) |
1157 | { | 1157 | { |
1158 | rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS); | 1158 | rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS); |
1159 | if (!rfcomm_tty_driver) | 1159 | if (!rfcomm_tty_driver) |
@@ -1183,7 +1183,7 @@ int rfcomm_init_ttys(void) | |||
1183 | return 0; | 1183 | return 0; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | void rfcomm_cleanup_ttys(void) | 1186 | void __exit rfcomm_cleanup_ttys(void) |
1187 | { | 1187 | { |
1188 | tty_unregister_driver(rfcomm_tty_driver); | 1188 | tty_unregister_driver(rfcomm_tty_driver); |
1189 | put_tty_driver(rfcomm_tty_driver); | 1189 | put_tty_driver(rfcomm_tty_driver); |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index db4d9340c846..29ac8e1a509e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -158,7 +158,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
158 | if (mac_addr) { | 158 | if (mac_addr) { |
159 | sta = sta_info_get_bss(sdata, mac_addr); | 159 | sta = sta_info_get_bss(sdata, mac_addr); |
160 | if (!sta) { | 160 | if (!sta) { |
161 | ieee80211_key_free(key); | 161 | ieee80211_key_free(sdata->local, key); |
162 | err = -ENOENT; | 162 | err = -ENOENT; |
163 | goto out_unlock; | 163 | goto out_unlock; |
164 | } | 164 | } |
@@ -192,7 +192,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |||
192 | goto out_unlock; | 192 | goto out_unlock; |
193 | 193 | ||
194 | if (sta->key) { | 194 | if (sta->key) { |
195 | ieee80211_key_free(sta->key); | 195 | ieee80211_key_free(sdata->local, sta->key); |
196 | WARN_ON(sta->key); | 196 | WARN_ON(sta->key); |
197 | ret = 0; | 197 | ret = 0; |
198 | } | 198 | } |
@@ -205,7 +205,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |||
205 | goto out_unlock; | 205 | goto out_unlock; |
206 | } | 206 | } |
207 | 207 | ||
208 | ieee80211_key_free(sdata->keys[key_idx]); | 208 | ieee80211_key_free(sdata->local, sdata->keys[key_idx]); |
209 | WARN_ON(sdata->keys[key_idx]); | 209 | WARN_ON(sdata->keys[key_idx]); |
210 | 210 | ||
211 | ret = 0; | 211 | ret = 0; |
@@ -324,15 +324,10 @@ static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy, | |||
324 | struct net_device *dev, | 324 | struct net_device *dev, |
325 | u8 key_idx) | 325 | u8 key_idx) |
326 | { | 326 | { |
327 | struct ieee80211_sub_if_data *sdata; | 327 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
328 | |||
329 | rcu_read_lock(); | ||
330 | 328 | ||
331 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
332 | ieee80211_set_default_mgmt_key(sdata, key_idx); | 329 | ieee80211_set_default_mgmt_key(sdata, key_idx); |
333 | 330 | ||
334 | rcu_read_unlock(); | ||
335 | |||
336 | return 0; | 331 | return 0; |
337 | } | 332 | } |
338 | 333 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index ef470064b154..65e0ed6c2975 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -238,6 +238,7 @@ enum ieee80211_work_type { | |||
238 | IEEE80211_WORK_ABORT, | 238 | IEEE80211_WORK_ABORT, |
239 | IEEE80211_WORK_DIRECT_PROBE, | 239 | IEEE80211_WORK_DIRECT_PROBE, |
240 | IEEE80211_WORK_AUTH, | 240 | IEEE80211_WORK_AUTH, |
241 | IEEE80211_WORK_ASSOC_BEACON_WAIT, | ||
241 | IEEE80211_WORK_ASSOC, | 242 | IEEE80211_WORK_ASSOC, |
242 | IEEE80211_WORK_REMAIN_ON_CHANNEL, | 243 | IEEE80211_WORK_REMAIN_ON_CHANNEL, |
243 | }; | 244 | }; |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 50d1cff23d8e..1b9d87ed143a 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -323,13 +323,15 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key) | |||
323 | if (!key) | 323 | if (!key) |
324 | return; | 324 | return; |
325 | 325 | ||
326 | ieee80211_key_disable_hw_accel(key); | 326 | if (key->local) |
327 | ieee80211_key_disable_hw_accel(key); | ||
327 | 328 | ||
328 | if (key->conf.alg == ALG_CCMP) | 329 | if (key->conf.alg == ALG_CCMP) |
329 | ieee80211_aes_key_free(key->u.ccmp.tfm); | 330 | ieee80211_aes_key_free(key->u.ccmp.tfm); |
330 | if (key->conf.alg == ALG_AES_CMAC) | 331 | if (key->conf.alg == ALG_AES_CMAC) |
331 | ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); | 332 | ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); |
332 | ieee80211_debugfs_key_remove(key); | 333 | if (key->local) |
334 | ieee80211_debugfs_key_remove(key); | ||
333 | 335 | ||
334 | kfree(key); | 336 | kfree(key); |
335 | } | 337 | } |
@@ -410,15 +412,12 @@ static void __ieee80211_key_free(struct ieee80211_key *key) | |||
410 | __ieee80211_key_destroy(key); | 412 | __ieee80211_key_destroy(key); |
411 | } | 413 | } |
412 | 414 | ||
413 | void ieee80211_key_free(struct ieee80211_key *key) | 415 | void ieee80211_key_free(struct ieee80211_local *local, |
416 | struct ieee80211_key *key) | ||
414 | { | 417 | { |
415 | struct ieee80211_local *local; | ||
416 | |||
417 | if (!key) | 418 | if (!key) |
418 | return; | 419 | return; |
419 | 420 | ||
420 | local = key->sdata->local; | ||
421 | |||
422 | mutex_lock(&local->key_mtx); | 421 | mutex_lock(&local->key_mtx); |
423 | __ieee80211_key_free(key); | 422 | __ieee80211_key_free(key); |
424 | mutex_unlock(&local->key_mtx); | 423 | mutex_unlock(&local->key_mtx); |
diff --git a/net/mac80211/key.h b/net/mac80211/key.h index a3849fa3fce8..b665bbb7a471 100644 --- a/net/mac80211/key.h +++ b/net/mac80211/key.h | |||
@@ -135,7 +135,8 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, | |||
135 | void ieee80211_key_link(struct ieee80211_key *key, | 135 | void ieee80211_key_link(struct ieee80211_key *key, |
136 | struct ieee80211_sub_if_data *sdata, | 136 | struct ieee80211_sub_if_data *sdata, |
137 | struct sta_info *sta); | 137 | struct sta_info *sta); |
138 | void ieee80211_key_free(struct ieee80211_key *key); | 138 | void ieee80211_key_free(struct ieee80211_local *local, |
139 | struct ieee80211_key *key); | ||
139 | void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx); | 140 | void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx); |
140 | void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, | 141 | void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, |
141 | int idx); | 142 | int idx); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 0e95c750ded9..7cc4f913a431 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -107,12 +107,15 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) | |||
107 | if (scan_chan) { | 107 | if (scan_chan) { |
108 | chan = scan_chan; | 108 | chan = scan_chan; |
109 | channel_type = NL80211_CHAN_NO_HT; | 109 | channel_type = NL80211_CHAN_NO_HT; |
110 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; | ||
110 | } else if (local->tmp_channel) { | 111 | } else if (local->tmp_channel) { |
111 | chan = scan_chan = local->tmp_channel; | 112 | chan = scan_chan = local->tmp_channel; |
112 | channel_type = local->tmp_channel_type; | 113 | channel_type = local->tmp_channel_type; |
114 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; | ||
113 | } else { | 115 | } else { |
114 | chan = local->oper_channel; | 116 | chan = local->oper_channel; |
115 | channel_type = local->_oper_channel_type; | 117 | channel_type = local->_oper_channel_type; |
118 | local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL; | ||
116 | } | 119 | } |
117 | 120 | ||
118 | if (chan != local->hw.conf.channel || | 121 | if (chan != local->hw.conf.channel || |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index cf8d72196c65..b6c163ac22da 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -870,6 +870,11 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
870 | 870 | ||
871 | ieee80211_led_assoc(local, 1); | 871 | ieee80211_led_assoc(local, 1); |
872 | 872 | ||
873 | if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) | ||
874 | bss_conf->dtim_period = bss->dtim_period; | ||
875 | else | ||
876 | bss_conf->dtim_period = 0; | ||
877 | |||
873 | bss_conf->assoc = 1; | 878 | bss_conf->assoc = 1; |
874 | /* | 879 | /* |
875 | * For now just always ask the driver to update the basic rateset | 880 | * For now just always ask the driver to update the basic rateset |
@@ -1751,7 +1756,8 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
1751 | if (wk->sdata != sdata) | 1756 | if (wk->sdata != sdata) |
1752 | continue; | 1757 | continue; |
1753 | 1758 | ||
1754 | if (wk->type != IEEE80211_WORK_ASSOC) | 1759 | if (wk->type != IEEE80211_WORK_ASSOC && |
1760 | wk->type != IEEE80211_WORK_ASSOC_BEACON_WAIT) | ||
1755 | continue; | 1761 | continue; |
1756 | 1762 | ||
1757 | if (memcmp(mgmt->bssid, wk->filter_ta, ETH_ALEN)) | 1763 | if (memcmp(mgmt->bssid, wk->filter_ta, ETH_ALEN)) |
@@ -2086,6 +2092,8 @@ static enum work_done_result ieee80211_assoc_done(struct ieee80211_work *wk, | |||
2086 | struct sk_buff *skb) | 2092 | struct sk_buff *skb) |
2087 | { | 2093 | { |
2088 | struct ieee80211_mgmt *mgmt; | 2094 | struct ieee80211_mgmt *mgmt; |
2095 | struct ieee80211_rx_status *rx_status; | ||
2096 | struct ieee802_11_elems elems; | ||
2089 | u16 status; | 2097 | u16 status; |
2090 | 2098 | ||
2091 | if (!skb) { | 2099 | if (!skb) { |
@@ -2093,6 +2101,19 @@ static enum work_done_result ieee80211_assoc_done(struct ieee80211_work *wk, | |||
2093 | return WORK_DONE_DESTROY; | 2101 | return WORK_DONE_DESTROY; |
2094 | } | 2102 | } |
2095 | 2103 | ||
2104 | if (wk->type == IEEE80211_WORK_ASSOC_BEACON_WAIT) { | ||
2105 | mutex_lock(&wk->sdata->u.mgd.mtx); | ||
2106 | rx_status = (void *) skb->cb; | ||
2107 | ieee802_11_parse_elems(skb->data + 24 + 12, skb->len - 24 - 12, &elems); | ||
2108 | ieee80211_rx_bss_info(wk->sdata, (void *)skb->data, skb->len, rx_status, | ||
2109 | &elems, true); | ||
2110 | mutex_unlock(&wk->sdata->u.mgd.mtx); | ||
2111 | |||
2112 | wk->type = IEEE80211_WORK_ASSOC; | ||
2113 | /* not really done yet */ | ||
2114 | return WORK_DONE_REQUEUE; | ||
2115 | } | ||
2116 | |||
2096 | mgmt = (void *)skb->data; | 2117 | mgmt = (void *)skb->data; |
2097 | status = le16_to_cpu(mgmt->u.assoc_resp.status_code); | 2118 | status = le16_to_cpu(mgmt->u.assoc_resp.status_code); |
2098 | 2119 | ||
@@ -2206,10 +2227,14 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
2206 | if (req->prev_bssid) | 2227 | if (req->prev_bssid) |
2207 | memcpy(wk->assoc.prev_bssid, req->prev_bssid, ETH_ALEN); | 2228 | memcpy(wk->assoc.prev_bssid, req->prev_bssid, ETH_ALEN); |
2208 | 2229 | ||
2209 | wk->type = IEEE80211_WORK_ASSOC; | ||
2210 | wk->chan = req->bss->channel; | 2230 | wk->chan = req->bss->channel; |
2211 | wk->sdata = sdata; | 2231 | wk->sdata = sdata; |
2212 | wk->done = ieee80211_assoc_done; | 2232 | wk->done = ieee80211_assoc_done; |
2233 | if (!bss->dtim_period && | ||
2234 | sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) | ||
2235 | wk->type = IEEE80211_WORK_ASSOC_BEACON_WAIT; | ||
2236 | else | ||
2237 | wk->type = IEEE80211_WORK_ASSOC; | ||
2213 | 2238 | ||
2214 | if (req->use_mfp) { | 2239 | if (req->use_mfp) { |
2215 | ifmgd->mfp = IEEE80211_MFP_REQUIRED; | 2240 | ifmgd->mfp = IEEE80211_MFP_REQUIRED; |
@@ -2257,7 +2282,8 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
2257 | 2282 | ||
2258 | if (wk->type != IEEE80211_WORK_DIRECT_PROBE && | 2283 | if (wk->type != IEEE80211_WORK_DIRECT_PROBE && |
2259 | wk->type != IEEE80211_WORK_AUTH && | 2284 | wk->type != IEEE80211_WORK_AUTH && |
2260 | wk->type != IEEE80211_WORK_ASSOC) | 2285 | wk->type != IEEE80211_WORK_ASSOC && |
2286 | wk->type != IEEE80211_WORK_ASSOC_BEACON_WAIT) | ||
2261 | continue; | 2287 | continue; |
2262 | 2288 | ||
2263 | if (memcmp(req->bss->bssid, wk->filter_ta, ETH_ALEN)) | 2289 | if (memcmp(req->bss->bssid, wk->filter_ta, ETH_ALEN)) |
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index f65ce6dcc8e2..778c604d7939 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
@@ -67,7 +67,6 @@ rix_to_ndx(struct minstrel_sta_info *mi, int rix) | |||
67 | for (i = rix; i >= 0; i--) | 67 | for (i = rix; i >= 0; i--) |
68 | if (mi->r[i].rix == rix) | 68 | if (mi->r[i].rix == rix) |
69 | break; | 69 | break; |
70 | WARN_ON(i < 0); | ||
71 | return i; | 70 | return i; |
72 | } | 71 | } |
73 | 72 | ||
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index b5ace243546c..c5b465904e3b 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -636,7 +636,7 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, | |||
636 | int i; | 636 | int i; |
637 | 637 | ||
638 | /* fall back to the old minstrel for legacy stations */ | 638 | /* fall back to the old minstrel for legacy stations */ |
639 | if (sta && !sta->ht_cap.ht_supported) { | 639 | if (!sta->ht_cap.ht_supported) { |
640 | msp->is_ht = false; | 640 | msp->is_ht = false; |
641 | memset(&msp->legacy, 0, sizeof(msp->legacy)); | 641 | memset(&msp->legacy, 0, sizeof(msp->legacy)); |
642 | msp->legacy.r = msp->ratelist; | 642 | msp->legacy.r = msp->ratelist; |
@@ -748,7 +748,7 @@ minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
748 | return msp; | 748 | return msp; |
749 | 749 | ||
750 | error1: | 750 | error1: |
751 | kfree(msp->sample_table); | 751 | kfree(msp->ratelist); |
752 | error: | 752 | error: |
753 | kfree(msp); | 753 | kfree(msp); |
754 | return NULL; | 754 | return NULL; |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 439c98d93a79..41f20fb7e670 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -114,6 +114,10 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
114 | bss->dtim_period = tim_ie->dtim_period; | 114 | bss->dtim_period = tim_ie->dtim_period; |
115 | } | 115 | } |
116 | 116 | ||
117 | /* If the beacon had no TIM IE, or it was invalid, use 1 */ | ||
118 | if (beacon && !bss->dtim_period) | ||
119 | bss->dtim_period = 1; | ||
120 | |||
117 | /* replace old supported rates if we get new values */ | 121 | /* replace old supported rates if we get new values */ |
118 | srlen = 0; | 122 | srlen = 0; |
119 | if (elems->supp_rates) { | 123 | if (elems->supp_rates) { |
@@ -286,8 +290,6 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | |||
286 | local->scanning = 0; | 290 | local->scanning = 0; |
287 | local->scan_channel = NULL; | 291 | local->scan_channel = NULL; |
288 | 292 | ||
289 | drv_sw_scan_complete(local); | ||
290 | |||
291 | /* we only have to protect scan_req and hw/sw scan */ | 293 | /* we only have to protect scan_req and hw/sw scan */ |
292 | mutex_unlock(&local->scan_mtx); | 294 | mutex_unlock(&local->scan_mtx); |
293 | 295 | ||
@@ -297,6 +299,8 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | |||
297 | 299 | ||
298 | ieee80211_configure_filter(local); | 300 | ieee80211_configure_filter(local); |
299 | 301 | ||
302 | drv_sw_scan_complete(local); | ||
303 | |||
300 | ieee80211_offchannel_return(local, true); | 304 | ieee80211_offchannel_return(local, true); |
301 | 305 | ||
302 | done: | 306 | done: |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 67656cbf2b15..6d86f0c1ad04 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -647,7 +647,7 @@ static int __must_check __sta_info_destroy(struct sta_info *sta) | |||
647 | return ret; | 647 | return ret; |
648 | 648 | ||
649 | if (sta->key) { | 649 | if (sta->key) { |
650 | ieee80211_key_free(sta->key); | 650 | ieee80211_key_free(local, sta->key); |
651 | WARN_ON(sta->key); | 651 | WARN_ON(sta->key); |
652 | } | 652 | } |
653 | 653 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 698d4718b1a4..c54db966926b 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -576,17 +576,6 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
576 | } | 576 | } |
577 | 577 | ||
578 | static ieee80211_tx_result debug_noinline | 578 | static ieee80211_tx_result debug_noinline |
579 | ieee80211_tx_h_sta(struct ieee80211_tx_data *tx) | ||
580 | { | ||
581 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
582 | |||
583 | if (tx->sta && tx->sta->uploaded) | ||
584 | info->control.sta = &tx->sta->sta; | ||
585 | |||
586 | return TX_CONTINUE; | ||
587 | } | ||
588 | |||
589 | static ieee80211_tx_result debug_noinline | ||
590 | ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | 579 | ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) |
591 | { | 580 | { |
592 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 581 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
@@ -1307,6 +1296,11 @@ static int __ieee80211_tx(struct ieee80211_local *local, | |||
1307 | break; | 1296 | break; |
1308 | } | 1297 | } |
1309 | 1298 | ||
1299 | if (sta && sta->uploaded) | ||
1300 | info->control.sta = &sta->sta; | ||
1301 | else | ||
1302 | info->control.sta = NULL; | ||
1303 | |||
1310 | ret = drv_tx(local, skb); | 1304 | ret = drv_tx(local, skb); |
1311 | if (WARN_ON(ret != NETDEV_TX_OK && skb->len != len)) { | 1305 | if (WARN_ON(ret != NETDEV_TX_OK && skb->len != len)) { |
1312 | dev_kfree_skb(skb); | 1306 | dev_kfree_skb(skb); |
@@ -1346,7 +1340,6 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) | |||
1346 | CALL_TXH(ieee80211_tx_h_check_assoc); | 1340 | CALL_TXH(ieee80211_tx_h_check_assoc); |
1347 | CALL_TXH(ieee80211_tx_h_ps_buf); | 1341 | CALL_TXH(ieee80211_tx_h_ps_buf); |
1348 | CALL_TXH(ieee80211_tx_h_select_key); | 1342 | CALL_TXH(ieee80211_tx_h_select_key); |
1349 | CALL_TXH(ieee80211_tx_h_sta); | ||
1350 | if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) | 1343 | if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) |
1351 | CALL_TXH(ieee80211_tx_h_rate_ctrl); | 1344 | CALL_TXH(ieee80211_tx_h_rate_ctrl); |
1352 | 1345 | ||
@@ -1942,11 +1935,13 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1942 | h_pos += encaps_len; | 1935 | h_pos += encaps_len; |
1943 | } | 1936 | } |
1944 | 1937 | ||
1938 | #ifdef CONFIG_MAC80211_MESH | ||
1945 | if (meshhdrlen > 0) { | 1939 | if (meshhdrlen > 0) { |
1946 | memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); | 1940 | memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); |
1947 | nh_pos += meshhdrlen; | 1941 | nh_pos += meshhdrlen; |
1948 | h_pos += meshhdrlen; | 1942 | h_pos += meshhdrlen; |
1949 | } | 1943 | } |
1944 | #endif | ||
1950 | 1945 | ||
1951 | if (ieee80211_is_data_qos(fc)) { | 1946 | if (ieee80211_is_data_qos(fc)) { |
1952 | __le16 *qos_control; | 1947 | __le16 *qos_control; |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 794792177376..748387d45bc0 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -803,8 +803,12 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata) | |||
803 | 803 | ||
804 | /* after reinitialize QoS TX queues setting to default, | 804 | /* after reinitialize QoS TX queues setting to default, |
805 | * disable QoS at all */ | 805 | * disable QoS at all */ |
806 | sdata->vif.bss_conf.qos = sdata->vif.type != NL80211_IFTYPE_STATION; | 806 | |
807 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_QOS); | 807 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { |
808 | sdata->vif.bss_conf.qos = | ||
809 | sdata->vif.type != NL80211_IFTYPE_STATION; | ||
810 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_QOS); | ||
811 | } | ||
808 | } | 812 | } |
809 | 813 | ||
810 | void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | 814 | void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, |
diff --git a/net/mac80211/work.c b/net/mac80211/work.c index c22a71c5cb45..81d4ad64184a 100644 --- a/net/mac80211/work.c +++ b/net/mac80211/work.c | |||
@@ -560,6 +560,22 @@ ieee80211_remain_on_channel_timeout(struct ieee80211_work *wk) | |||
560 | return WORK_ACT_TIMEOUT; | 560 | return WORK_ACT_TIMEOUT; |
561 | } | 561 | } |
562 | 562 | ||
563 | static enum work_action __must_check | ||
564 | ieee80211_assoc_beacon_wait(struct ieee80211_work *wk) | ||
565 | { | ||
566 | if (wk->started) | ||
567 | return WORK_ACT_TIMEOUT; | ||
568 | |||
569 | /* | ||
570 | * Wait up to one beacon interval ... | ||
571 | * should this be more if we miss one? | ||
572 | */ | ||
573 | printk(KERN_DEBUG "%s: waiting for beacon from %pM\n", | ||
574 | wk->sdata->name, wk->filter_ta); | ||
575 | wk->timeout = TU_TO_EXP_TIME(wk->assoc.bss->beacon_interval); | ||
576 | return WORK_ACT_NONE; | ||
577 | } | ||
578 | |||
563 | static void ieee80211_auth_challenge(struct ieee80211_work *wk, | 579 | static void ieee80211_auth_challenge(struct ieee80211_work *wk, |
564 | struct ieee80211_mgmt *mgmt, | 580 | struct ieee80211_mgmt *mgmt, |
565 | size_t len) | 581 | size_t len) |
@@ -709,6 +725,25 @@ ieee80211_rx_mgmt_probe_resp(struct ieee80211_work *wk, | |||
709 | return WORK_ACT_DONE; | 725 | return WORK_ACT_DONE; |
710 | } | 726 | } |
711 | 727 | ||
728 | static enum work_action __must_check | ||
729 | ieee80211_rx_mgmt_beacon(struct ieee80211_work *wk, | ||
730 | struct ieee80211_mgmt *mgmt, size_t len) | ||
731 | { | ||
732 | struct ieee80211_sub_if_data *sdata = wk->sdata; | ||
733 | struct ieee80211_local *local = sdata->local; | ||
734 | |||
735 | ASSERT_WORK_MTX(local); | ||
736 | |||
737 | if (wk->type != IEEE80211_WORK_ASSOC_BEACON_WAIT) | ||
738 | return WORK_ACT_MISMATCH; | ||
739 | |||
740 | if (len < 24 + 12) | ||
741 | return WORK_ACT_NONE; | ||
742 | |||
743 | printk(KERN_DEBUG "%s: beacon received\n", sdata->name); | ||
744 | return WORK_ACT_DONE; | ||
745 | } | ||
746 | |||
712 | static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local, | 747 | static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local, |
713 | struct sk_buff *skb) | 748 | struct sk_buff *skb) |
714 | { | 749 | { |
@@ -731,6 +766,7 @@ static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local, | |||
731 | case IEEE80211_WORK_DIRECT_PROBE: | 766 | case IEEE80211_WORK_DIRECT_PROBE: |
732 | case IEEE80211_WORK_AUTH: | 767 | case IEEE80211_WORK_AUTH: |
733 | case IEEE80211_WORK_ASSOC: | 768 | case IEEE80211_WORK_ASSOC: |
769 | case IEEE80211_WORK_ASSOC_BEACON_WAIT: | ||
734 | bssid = wk->filter_ta; | 770 | bssid = wk->filter_ta; |
735 | break; | 771 | break; |
736 | default: | 772 | default: |
@@ -745,6 +781,9 @@ static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local, | |||
745 | continue; | 781 | continue; |
746 | 782 | ||
747 | switch (fc & IEEE80211_FCTL_STYPE) { | 783 | switch (fc & IEEE80211_FCTL_STYPE) { |
784 | case IEEE80211_STYPE_BEACON: | ||
785 | rma = ieee80211_rx_mgmt_beacon(wk, mgmt, skb->len); | ||
786 | break; | ||
748 | case IEEE80211_STYPE_PROBE_RESP: | 787 | case IEEE80211_STYPE_PROBE_RESP: |
749 | rma = ieee80211_rx_mgmt_probe_resp(wk, mgmt, skb->len, | 788 | rma = ieee80211_rx_mgmt_probe_resp(wk, mgmt, skb->len, |
750 | rx_status); | 789 | rx_status); |
@@ -916,6 +955,9 @@ static void ieee80211_work_work(struct work_struct *work) | |||
916 | case IEEE80211_WORK_REMAIN_ON_CHANNEL: | 955 | case IEEE80211_WORK_REMAIN_ON_CHANNEL: |
917 | rma = ieee80211_remain_on_channel_timeout(wk); | 956 | rma = ieee80211_remain_on_channel_timeout(wk); |
918 | break; | 957 | break; |
958 | case IEEE80211_WORK_ASSOC_BEACON_WAIT: | ||
959 | rma = ieee80211_assoc_beacon_wait(wk); | ||
960 | break; | ||
919 | } | 961 | } |
920 | 962 | ||
921 | wk->started = started; | 963 | wk->started = started; |
@@ -1065,6 +1107,7 @@ ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata, | |||
1065 | case IEEE80211_STYPE_PROBE_RESP: | 1107 | case IEEE80211_STYPE_PROBE_RESP: |
1066 | case IEEE80211_STYPE_ASSOC_RESP: | 1108 | case IEEE80211_STYPE_ASSOC_RESP: |
1067 | case IEEE80211_STYPE_REASSOC_RESP: | 1109 | case IEEE80211_STYPE_REASSOC_RESP: |
1110 | case IEEE80211_STYPE_BEACON: | ||
1068 | skb_queue_tail(&local->work_skb_queue, skb); | 1111 | skb_queue_tail(&local->work_skb_queue, skb); |
1069 | ieee80211_queue_work(&local->hw, &local->work_work); | 1112 | ieee80211_queue_work(&local->hw, &local->work_work); |
1070 | return RX_QUEUED; | 1113 | return RX_QUEUED; |
diff --git a/net/wireless/core.c b/net/wireless/core.c index f65c6494ede9..541e2fff5e9c 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -907,3 +907,52 @@ static void __exit cfg80211_exit(void) | |||
907 | destroy_workqueue(cfg80211_wq); | 907 | destroy_workqueue(cfg80211_wq); |
908 | } | 908 | } |
909 | module_exit(cfg80211_exit); | 909 | module_exit(cfg80211_exit); |
910 | |||
911 | static int ___wiphy_printk(const char *level, const struct wiphy *wiphy, | ||
912 | struct va_format *vaf) | ||
913 | { | ||
914 | if (!wiphy) | ||
915 | return printk("%s(NULL wiphy *): %pV", level, vaf); | ||
916 | |||
917 | return printk("%s%s: %pV", level, wiphy_name(wiphy), vaf); | ||
918 | } | ||
919 | |||
920 | int __wiphy_printk(const char *level, const struct wiphy *wiphy, | ||
921 | const char *fmt, ...) | ||
922 | { | ||
923 | struct va_format vaf; | ||
924 | va_list args; | ||
925 | int r; | ||
926 | |||
927 | va_start(args, fmt); | ||
928 | |||
929 | vaf.fmt = fmt; | ||
930 | vaf.va = &args; | ||
931 | |||
932 | r = ___wiphy_printk(level, wiphy, &vaf); | ||
933 | va_end(args); | ||
934 | |||
935 | return r; | ||
936 | } | ||
937 | EXPORT_SYMBOL(__wiphy_printk); | ||
938 | |||
939 | #define define_wiphy_printk_level(func, kern_level) \ | ||
940 | int func(const struct wiphy *wiphy, const char *fmt, ...) \ | ||
941 | { \ | ||
942 | struct va_format vaf; \ | ||
943 | va_list args; \ | ||
944 | int r; \ | ||
945 | \ | ||
946 | va_start(args, fmt); \ | ||
947 | \ | ||
948 | vaf.fmt = fmt; \ | ||
949 | vaf.va = &args; \ | ||
950 | \ | ||
951 | r = ___wiphy_printk(kern_level, wiphy, &vaf); \ | ||
952 | va_end(args); \ | ||
953 | \ | ||
954 | return r; \ | ||
955 | } \ | ||
956 | EXPORT_SYMBOL(func); | ||
957 | |||
958 | define_wiphy_printk_level(wiphy_debug, KERN_DEBUG); | ||
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index adcabba02e20..27a8ce9343c3 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -247,8 +247,10 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, | |||
247 | if (!netif_running(wdev->netdev)) | 247 | if (!netif_running(wdev->netdev)) |
248 | return 0; | 248 | return 0; |
249 | 249 | ||
250 | if (wdev->wext.keys) | 250 | if (wdev->wext.keys) { |
251 | wdev->wext.keys->def = wdev->wext.default_key; | 251 | wdev->wext.keys->def = wdev->wext.default_key; |
252 | wdev->wext.keys->defmgmt = wdev->wext.default_mgmt_key; | ||
253 | } | ||
252 | 254 | ||
253 | wdev->wext.ibss.privacy = wdev->wext.default_key != -1; | 255 | wdev->wext.ibss.privacy = wdev->wext.default_key != -1; |
254 | 256 | ||
diff --git a/net/wireless/lib80211_crypt_ccmp.c b/net/wireless/lib80211_crypt_ccmp.c index b7fa31d5fd13..dacb3b4b1bdb 100644 --- a/net/wireless/lib80211_crypt_ccmp.c +++ b/net/wireless/lib80211_crypt_ccmp.c | |||
@@ -467,7 +467,6 @@ static struct lib80211_crypto_ops lib80211_crypt_ccmp = { | |||
467 | .name = "CCMP", | 467 | .name = "CCMP", |
468 | .init = lib80211_ccmp_init, | 468 | .init = lib80211_ccmp_init, |
469 | .deinit = lib80211_ccmp_deinit, | 469 | .deinit = lib80211_ccmp_deinit, |
470 | .build_iv = lib80211_ccmp_hdr, | ||
471 | .encrypt_mpdu = lib80211_ccmp_encrypt, | 470 | .encrypt_mpdu = lib80211_ccmp_encrypt, |
472 | .decrypt_mpdu = lib80211_ccmp_decrypt, | 471 | .decrypt_mpdu = lib80211_ccmp_decrypt, |
473 | .encrypt_msdu = NULL, | 472 | .encrypt_msdu = NULL, |
diff --git a/net/wireless/lib80211_crypt_tkip.c b/net/wireless/lib80211_crypt_tkip.c index a7f995613f1f..0fe40510e2cb 100644 --- a/net/wireless/lib80211_crypt_tkip.c +++ b/net/wireless/lib80211_crypt_tkip.c | |||
@@ -757,7 +757,6 @@ static struct lib80211_crypto_ops lib80211_crypt_tkip = { | |||
757 | .name = "TKIP", | 757 | .name = "TKIP", |
758 | .init = lib80211_tkip_init, | 758 | .init = lib80211_tkip_init, |
759 | .deinit = lib80211_tkip_deinit, | 759 | .deinit = lib80211_tkip_deinit, |
760 | .build_iv = lib80211_tkip_hdr, | ||
761 | .encrypt_mpdu = lib80211_tkip_encrypt, | 760 | .encrypt_mpdu = lib80211_tkip_encrypt, |
762 | .decrypt_mpdu = lib80211_tkip_decrypt, | 761 | .decrypt_mpdu = lib80211_tkip_decrypt, |
763 | .encrypt_msdu = lib80211_michael_mic_add, | 762 | .encrypt_msdu = lib80211_michael_mic_add, |
diff --git a/net/wireless/lib80211_crypt_wep.c b/net/wireless/lib80211_crypt_wep.c index 6d41e05ca33b..e2e88878ba35 100644 --- a/net/wireless/lib80211_crypt_wep.c +++ b/net/wireless/lib80211_crypt_wep.c | |||
@@ -269,7 +269,6 @@ static struct lib80211_crypto_ops lib80211_crypt_wep = { | |||
269 | .name = "WEP", | 269 | .name = "WEP", |
270 | .init = lib80211_wep_init, | 270 | .init = lib80211_wep_init, |
271 | .deinit = lib80211_wep_deinit, | 271 | .deinit = lib80211_wep_deinit, |
272 | .build_iv = lib80211_wep_build_iv, | ||
273 | .encrypt_mpdu = lib80211_wep_encrypt, | 272 | .encrypt_mpdu = lib80211_wep_encrypt, |
274 | .decrypt_mpdu = lib80211_wep_decrypt, | 273 | .decrypt_mpdu = lib80211_wep_decrypt, |
275 | .encrypt_msdu = NULL, | 274 | .encrypt_msdu = NULL, |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index fbfac588297c..37902a54e9c1 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2769,6 +2769,7 @@ static int nl80211_get_mesh_params(struct sk_buff *skb, | |||
2769 | 2769 | ||
2770 | nla_put_failure: | 2770 | nla_put_failure: |
2771 | genlmsg_cancel(msg, hdr); | 2771 | genlmsg_cancel(msg, hdr); |
2772 | nlmsg_free(msg); | ||
2772 | err = -EMSGSIZE; | 2773 | err = -EMSGSIZE; |
2773 | out: | 2774 | out: |
2774 | /* Cleanup */ | 2775 | /* Cleanup */ |
@@ -2960,6 +2961,7 @@ static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info) | |||
2960 | 2961 | ||
2961 | nla_put_failure: | 2962 | nla_put_failure: |
2962 | genlmsg_cancel(msg, hdr); | 2963 | genlmsg_cancel(msg, hdr); |
2964 | nlmsg_free(msg); | ||
2963 | err = -EMSGSIZE; | 2965 | err = -EMSGSIZE; |
2964 | out: | 2966 | out: |
2965 | mutex_unlock(&cfg80211_mutex); | 2967 | mutex_unlock(&cfg80211_mutex); |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 48baf28cc4b6..f180db0de66c 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -1306,6 +1306,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
1306 | { | 1306 | { |
1307 | int r = 0; | 1307 | int r = 0; |
1308 | struct wiphy *wiphy = NULL; | 1308 | struct wiphy *wiphy = NULL; |
1309 | enum nl80211_reg_initiator initiator = reg_request->initiator; | ||
1309 | 1310 | ||
1310 | BUG_ON(!reg_request->alpha2); | 1311 | BUG_ON(!reg_request->alpha2); |
1311 | 1312 | ||
@@ -1325,7 +1326,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
1325 | /* This is required so that the orig_* parameters are saved */ | 1326 | /* This is required so that the orig_* parameters are saved */ |
1326 | if (r == -EALREADY && wiphy && | 1327 | if (r == -EALREADY && wiphy && |
1327 | wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) | 1328 | wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) |
1328 | wiphy_update_regulatory(wiphy, reg_request->initiator); | 1329 | wiphy_update_regulatory(wiphy, initiator); |
1329 | out: | 1330 | out: |
1330 | mutex_unlock(®_mutex); | 1331 | mutex_unlock(®_mutex); |
1331 | mutex_unlock(&cfg80211_mutex); | 1332 | mutex_unlock(&cfg80211_mutex); |
@@ -1492,7 +1493,6 @@ void regulatory_hint_11d(struct wiphy *wiphy, | |||
1492 | u8 *country_ie, | 1493 | u8 *country_ie, |
1493 | u8 country_ie_len) | 1494 | u8 country_ie_len) |
1494 | { | 1495 | { |
1495 | struct ieee80211_regdomain *rd = NULL; | ||
1496 | char alpha2[2]; | 1496 | char alpha2[2]; |
1497 | enum environment_cap env = ENVIRON_ANY; | 1497 | enum environment_cap env = ENVIRON_ANY; |
1498 | struct regulatory_request *request; | 1498 | struct regulatory_request *request; |
@@ -1529,7 +1529,7 @@ void regulatory_hint_11d(struct wiphy *wiphy, | |||
1529 | 1529 | ||
1530 | request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); | 1530 | request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); |
1531 | if (!request) | 1531 | if (!request) |
1532 | goto free_rd_out; | 1532 | goto out; |
1533 | 1533 | ||
1534 | request->wiphy_idx = get_wiphy_idx(wiphy); | 1534 | request->wiphy_idx = get_wiphy_idx(wiphy); |
1535 | request->alpha2[0] = alpha2[0]; | 1535 | request->alpha2[0] = alpha2[0]; |
@@ -1543,8 +1543,6 @@ void regulatory_hint_11d(struct wiphy *wiphy, | |||
1543 | 1543 | ||
1544 | return; | 1544 | return; |
1545 | 1545 | ||
1546 | free_rd_out: | ||
1547 | kfree(rd); | ||
1548 | out: | 1546 | out: |
1549 | mutex_unlock(®_mutex); | 1547 | mutex_unlock(®_mutex); |
1550 | } | 1548 | } |