diff options
author | Kalle Valo <kvalo@qca.qualcomm.com> | 2014-05-14 09:20:08 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2014-05-14 09:20:08 -0400 |
commit | e21353576df1fae38710bdbff1c3abfe49f651cd (patch) | |
tree | 3074ad8e4be3762cae1e1f5d11d103ce8c216329 | |
parent | d9bc4b9b693d52dc14dc1de5dfec760634067d8c (diff) | |
parent | 5f407acbb7d6a92841c455b37a6ad4833757740e (diff) |
Merge remote-tracking branch 'wireless-next/master' into ath-next
190 files changed, 4382 insertions, 2773 deletions
diff --git a/Documentation/DocBook/80211.tmpl b/Documentation/DocBook/80211.tmpl index 044b76436e83..d9b9416c989f 100644 --- a/Documentation/DocBook/80211.tmpl +++ b/Documentation/DocBook/80211.tmpl | |||
@@ -100,6 +100,7 @@ | |||
100 | !Finclude/net/cfg80211.h wdev_priv | 100 | !Finclude/net/cfg80211.h wdev_priv |
101 | !Finclude/net/cfg80211.h ieee80211_iface_limit | 101 | !Finclude/net/cfg80211.h ieee80211_iface_limit |
102 | !Finclude/net/cfg80211.h ieee80211_iface_combination | 102 | !Finclude/net/cfg80211.h ieee80211_iface_combination |
103 | !Finclude/net/cfg80211.h cfg80211_check_combinations | ||
103 | </chapter> | 104 | </chapter> |
104 | <chapter> | 105 | <chapter> |
105 | <title>Actions and configuration</title> | 106 | <title>Actions and configuration</title> |
diff --git a/MAINTAINERS b/MAINTAINERS index 6dc67b1fdb50..a80a586cbdcd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -7277,7 +7277,6 @@ F: drivers/video/aty/aty128fb.c | |||
7277 | RALINK RT2X00 WIRELESS LAN DRIVER | 7277 | RALINK RT2X00 WIRELESS LAN DRIVER |
7278 | P: rt2x00 project | 7278 | P: rt2x00 project |
7279 | M: Ivo van Doorn <IvDoorn@gmail.com> | 7279 | M: Ivo van Doorn <IvDoorn@gmail.com> |
7280 | M: Gertjan van Wingerde <gwingerde@gmail.com> | ||
7281 | M: Helmut Schaa <helmut.schaa@googlemail.com> | 7280 | M: Helmut Schaa <helmut.schaa@googlemail.com> |
7282 | L: linux-wireless@vger.kernel.org | 7281 | L: linux-wireless@vger.kernel.org |
7283 | L: users@rt2x00.serialmonkey.com (moderated for non-subscribers) | 7282 | L: users@rt2x00.serialmonkey.com (moderated for non-subscribers) |
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c index e4dec9fcb084..9c6029ba526f 100644 --- a/arch/arm/mach-tegra/board-paz00.c +++ b/arch/arm/mach-tegra/board-paz00.c | |||
@@ -23,9 +23,7 @@ | |||
23 | #include "board.h" | 23 | #include "board.h" |
24 | 24 | ||
25 | static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = { | 25 | static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = { |
26 | .name = "wifi_rfkill", | 26 | .name = "wifi_rfkill", |
27 | .reset_gpio = 25, /* PD1 */ | ||
28 | .shutdown_gpio = 85, /* PK5 */ | ||
29 | .type = RFKILL_TYPE_WLAN, | 27 | .type = RFKILL_TYPE_WLAN, |
30 | }; | 28 | }; |
31 | 29 | ||
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index be571fef185d..a83b57e57b63 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -82,6 +82,7 @@ static const struct usb_device_id ath3k_table[] = { | |||
82 | { USB_DEVICE(0x04CA, 0x3004) }, | 82 | { USB_DEVICE(0x04CA, 0x3004) }, |
83 | { USB_DEVICE(0x04CA, 0x3005) }, | 83 | { USB_DEVICE(0x04CA, 0x3005) }, |
84 | { USB_DEVICE(0x04CA, 0x3006) }, | 84 | { USB_DEVICE(0x04CA, 0x3006) }, |
85 | { USB_DEVICE(0x04CA, 0x3007) }, | ||
85 | { USB_DEVICE(0x04CA, 0x3008) }, | 86 | { USB_DEVICE(0x04CA, 0x3008) }, |
86 | { USB_DEVICE(0x04CA, 0x300b) }, | 87 | { USB_DEVICE(0x04CA, 0x300b) }, |
87 | { USB_DEVICE(0x0930, 0x0219) }, | 88 | { USB_DEVICE(0x0930, 0x0219) }, |
@@ -131,6 +132,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { | |||
131 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, | 132 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, |
132 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 133 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
133 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, | 134 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, | ||
134 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 136 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, | 137 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
136 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 138 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h index 7399303d7d99..dc79f88f8717 100644 --- a/drivers/bluetooth/btmrvl_drv.h +++ b/drivers/bluetooth/btmrvl_drv.h | |||
@@ -59,6 +59,8 @@ struct btmrvl_device { | |||
59 | }; | 59 | }; |
60 | 60 | ||
61 | struct btmrvl_adapter { | 61 | struct btmrvl_adapter { |
62 | void *hw_regs_buf; | ||
63 | u8 *hw_regs; | ||
62 | u32 int_count; | 64 | u32 int_count; |
63 | struct sk_buff_head tx_queue; | 65 | struct sk_buff_head tx_queue; |
64 | u8 psmode; | 66 | u8 psmode; |
@@ -140,7 +142,7 @@ void btmrvl_interrupt(struct btmrvl_private *priv); | |||
140 | bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); | 142 | bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); |
141 | int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); | 143 | int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); |
142 | 144 | ||
143 | int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd); | 145 | int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, u8 subcmd); |
144 | int btmrvl_send_hscfg_cmd(struct btmrvl_private *priv); | 146 | int btmrvl_send_hscfg_cmd(struct btmrvl_private *priv); |
145 | int btmrvl_enable_ps(struct btmrvl_private *priv); | 147 | int btmrvl_enable_ps(struct btmrvl_private *priv); |
146 | int btmrvl_prepare_command(struct btmrvl_private *priv); | 148 | int btmrvl_prepare_command(struct btmrvl_private *priv); |
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 2c4997ce2484..e9dbddb0b8f1 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <net/bluetooth/hci_core.h> | 24 | #include <net/bluetooth/hci_core.h> |
25 | 25 | ||
26 | #include "btmrvl_drv.h" | 26 | #include "btmrvl_drv.h" |
27 | #include "btmrvl_sdio.h" | ||
27 | 28 | ||
28 | #define VERSION "1.0" | 29 | #define VERSION "1.0" |
29 | 30 | ||
@@ -201,7 +202,7 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, | |||
201 | return 0; | 202 | return 0; |
202 | } | 203 | } |
203 | 204 | ||
204 | int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd) | 205 | int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, u8 subcmd) |
205 | { | 206 | { |
206 | int ret; | 207 | int ret; |
207 | 208 | ||
@@ -337,10 +338,25 @@ static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb) | |||
337 | 338 | ||
338 | static void btmrvl_init_adapter(struct btmrvl_private *priv) | 339 | static void btmrvl_init_adapter(struct btmrvl_private *priv) |
339 | { | 340 | { |
341 | int buf_size; | ||
342 | |||
340 | skb_queue_head_init(&priv->adapter->tx_queue); | 343 | skb_queue_head_init(&priv->adapter->tx_queue); |
341 | 344 | ||
342 | priv->adapter->ps_state = PS_AWAKE; | 345 | priv->adapter->ps_state = PS_AWAKE; |
343 | 346 | ||
347 | buf_size = ALIGN_SZ(SDIO_BLOCK_SIZE, BTSDIO_DMA_ALIGN); | ||
348 | priv->adapter->hw_regs_buf = kzalloc(buf_size, GFP_KERNEL); | ||
349 | if (!priv->adapter->hw_regs_buf) { | ||
350 | priv->adapter->hw_regs = NULL; | ||
351 | BT_ERR("Unable to allocate buffer for hw_regs."); | ||
352 | } else { | ||
353 | priv->adapter->hw_regs = | ||
354 | (u8 *)ALIGN_ADDR(priv->adapter->hw_regs_buf, | ||
355 | BTSDIO_DMA_ALIGN); | ||
356 | BT_DBG("hw_regs_buf=%p hw_regs=%p", | ||
357 | priv->adapter->hw_regs_buf, priv->adapter->hw_regs); | ||
358 | } | ||
359 | |||
344 | init_waitqueue_head(&priv->adapter->cmd_wait_q); | 360 | init_waitqueue_head(&priv->adapter->cmd_wait_q); |
345 | } | 361 | } |
346 | 362 | ||
@@ -348,6 +364,7 @@ static void btmrvl_free_adapter(struct btmrvl_private *priv) | |||
348 | { | 364 | { |
349 | skb_queue_purge(&priv->adapter->tx_queue); | 365 | skb_queue_purge(&priv->adapter->tx_queue); |
350 | 366 | ||
367 | kfree(priv->adapter->hw_regs_buf); | ||
351 | kfree(priv->adapter); | 368 | kfree(priv->adapter); |
352 | 369 | ||
353 | priv->adapter = NULL; | 370 | priv->adapter = NULL; |
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index 1b52c9f5230d..9dedca516ff5 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c | |||
@@ -64,6 +64,7 @@ static const struct btmrvl_sdio_card_reg btmrvl_reg_8688 = { | |||
64 | .io_port_0 = 0x00, | 64 | .io_port_0 = 0x00, |
65 | .io_port_1 = 0x01, | 65 | .io_port_1 = 0x01, |
66 | .io_port_2 = 0x02, | 66 | .io_port_2 = 0x02, |
67 | .int_read_to_clear = false, | ||
67 | }; | 68 | }; |
68 | static const struct btmrvl_sdio_card_reg btmrvl_reg_87xx = { | 69 | static const struct btmrvl_sdio_card_reg btmrvl_reg_87xx = { |
69 | .cfg = 0x00, | 70 | .cfg = 0x00, |
@@ -80,6 +81,7 @@ static const struct btmrvl_sdio_card_reg btmrvl_reg_87xx = { | |||
80 | .io_port_0 = 0x78, | 81 | .io_port_0 = 0x78, |
81 | .io_port_1 = 0x79, | 82 | .io_port_1 = 0x79, |
82 | .io_port_2 = 0x7a, | 83 | .io_port_2 = 0x7a, |
84 | .int_read_to_clear = false, | ||
83 | }; | 85 | }; |
84 | 86 | ||
85 | static const struct btmrvl_sdio_card_reg btmrvl_reg_88xx = { | 87 | static const struct btmrvl_sdio_card_reg btmrvl_reg_88xx = { |
@@ -97,6 +99,9 @@ static const struct btmrvl_sdio_card_reg btmrvl_reg_88xx = { | |||
97 | .io_port_0 = 0xd8, | 99 | .io_port_0 = 0xd8, |
98 | .io_port_1 = 0xd9, | 100 | .io_port_1 = 0xd9, |
99 | .io_port_2 = 0xda, | 101 | .io_port_2 = 0xda, |
102 | .int_read_to_clear = true, | ||
103 | .host_int_rsr = 0x01, | ||
104 | .card_misc_cfg = 0xcc, | ||
100 | }; | 105 | }; |
101 | 106 | ||
102 | static const struct btmrvl_sdio_device btmrvl_sdio_sd8688 = { | 107 | static const struct btmrvl_sdio_device btmrvl_sdio_sd8688 = { |
@@ -667,46 +672,78 @@ static int btmrvl_sdio_process_int_status(struct btmrvl_private *priv) | |||
667 | return 0; | 672 | return 0; |
668 | } | 673 | } |
669 | 674 | ||
670 | static void btmrvl_sdio_interrupt(struct sdio_func *func) | 675 | static int btmrvl_sdio_read_to_clear(struct btmrvl_sdio_card *card, u8 *ireg) |
671 | { | 676 | { |
672 | struct btmrvl_private *priv; | 677 | struct btmrvl_adapter *adapter = card->priv->adapter; |
673 | struct btmrvl_sdio_card *card; | ||
674 | ulong flags; | ||
675 | u8 ireg = 0; | ||
676 | int ret; | 678 | int ret; |
677 | 679 | ||
678 | card = sdio_get_drvdata(func); | 680 | ret = sdio_readsb(card->func, adapter->hw_regs, 0, SDIO_BLOCK_SIZE); |
679 | if (!card || !card->priv) { | 681 | if (ret) { |
680 | BT_ERR("sbi_interrupt(%p) card or priv is " | 682 | BT_ERR("sdio_readsb: read int hw_regs failed: %d", ret); |
681 | "NULL, card=%p\n", func, card); | 683 | return ret; |
682 | return; | ||
683 | } | 684 | } |
684 | 685 | ||
685 | priv = card->priv; | 686 | *ireg = adapter->hw_regs[card->reg->host_intstatus]; |
687 | BT_DBG("hw_regs[%#x]=%#x", card->reg->host_intstatus, *ireg); | ||
688 | |||
689 | return 0; | ||
690 | } | ||
686 | 691 | ||
687 | ireg = sdio_readb(card->func, card->reg->host_intstatus, &ret); | 692 | static int btmrvl_sdio_write_to_clear(struct btmrvl_sdio_card *card, u8 *ireg) |
693 | { | ||
694 | int ret; | ||
695 | |||
696 | *ireg = sdio_readb(card->func, card->reg->host_intstatus, &ret); | ||
688 | if (ret) { | 697 | if (ret) { |
689 | BT_ERR("sdio_readb: read int status register failed"); | 698 | BT_ERR("sdio_readb: read int status failed: %d", ret); |
690 | return; | 699 | return ret; |
691 | } | 700 | } |
692 | 701 | ||
693 | if (ireg != 0) { | 702 | if (*ireg) { |
694 | /* | 703 | /* |
695 | * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS | 704 | * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS |
696 | * Clear the interrupt status register and re-enable the | 705 | * Clear the interrupt status register and re-enable the |
697 | * interrupt. | 706 | * interrupt. |
698 | */ | 707 | */ |
699 | BT_DBG("ireg = 0x%x", ireg); | 708 | BT_DBG("int_status = 0x%x", *ireg); |
700 | 709 | ||
701 | sdio_writeb(card->func, ~(ireg) & (DN_LD_HOST_INT_STATUS | | 710 | sdio_writeb(card->func, ~(*ireg) & (DN_LD_HOST_INT_STATUS | |
702 | UP_LD_HOST_INT_STATUS), | 711 | UP_LD_HOST_INT_STATUS), |
703 | card->reg->host_intstatus, &ret); | 712 | card->reg->host_intstatus, &ret); |
704 | if (ret) { | 713 | if (ret) { |
705 | BT_ERR("sdio_writeb: clear int status register failed"); | 714 | BT_ERR("sdio_writeb: clear int status failed: %d", ret); |
706 | return; | 715 | return ret; |
707 | } | 716 | } |
708 | } | 717 | } |
709 | 718 | ||
719 | return 0; | ||
720 | } | ||
721 | |||
722 | static void btmrvl_sdio_interrupt(struct sdio_func *func) | ||
723 | { | ||
724 | struct btmrvl_private *priv; | ||
725 | struct btmrvl_sdio_card *card; | ||
726 | ulong flags; | ||
727 | u8 ireg = 0; | ||
728 | int ret; | ||
729 | |||
730 | card = sdio_get_drvdata(func); | ||
731 | if (!card || !card->priv) { | ||
732 | BT_ERR("sbi_interrupt(%p) card or priv is " | ||
733 | "NULL, card=%p\n", func, card); | ||
734 | return; | ||
735 | } | ||
736 | |||
737 | priv = card->priv; | ||
738 | |||
739 | if (card->reg->int_read_to_clear) | ||
740 | ret = btmrvl_sdio_read_to_clear(card, &ireg); | ||
741 | else | ||
742 | ret = btmrvl_sdio_write_to_clear(card, &ireg); | ||
743 | |||
744 | if (ret) | ||
745 | return; | ||
746 | |||
710 | spin_lock_irqsave(&priv->driver_lock, flags); | 747 | spin_lock_irqsave(&priv->driver_lock, flags); |
711 | sdio_ireg |= ireg; | 748 | sdio_ireg |= ireg; |
712 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 749 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
@@ -777,6 +814,30 @@ static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card) | |||
777 | 814 | ||
778 | BT_DBG("SDIO FUNC%d IO port: 0x%x", func->num, card->ioport); | 815 | BT_DBG("SDIO FUNC%d IO port: 0x%x", func->num, card->ioport); |
779 | 816 | ||
817 | if (card->reg->int_read_to_clear) { | ||
818 | reg = sdio_readb(func, card->reg->host_int_rsr, &ret); | ||
819 | if (ret < 0) { | ||
820 | ret = -EIO; | ||
821 | goto release_irq; | ||
822 | } | ||
823 | sdio_writeb(func, reg | 0x3f, card->reg->host_int_rsr, &ret); | ||
824 | if (ret < 0) { | ||
825 | ret = -EIO; | ||
826 | goto release_irq; | ||
827 | } | ||
828 | |||
829 | reg = sdio_readb(func, card->reg->card_misc_cfg, &ret); | ||
830 | if (ret < 0) { | ||
831 | ret = -EIO; | ||
832 | goto release_irq; | ||
833 | } | ||
834 | sdio_writeb(func, reg | 0x10, card->reg->card_misc_cfg, &ret); | ||
835 | if (ret < 0) { | ||
836 | ret = -EIO; | ||
837 | goto release_irq; | ||
838 | } | ||
839 | } | ||
840 | |||
780 | sdio_set_drvdata(func, card); | 841 | sdio_set_drvdata(func, card); |
781 | 842 | ||
782 | sdio_release_host(func); | 843 | sdio_release_host(func); |
diff --git a/drivers/bluetooth/btmrvl_sdio.h b/drivers/bluetooth/btmrvl_sdio.h index 43d35a609ca9..d4dd3b0fa53d 100644 --- a/drivers/bluetooth/btmrvl_sdio.h +++ b/drivers/bluetooth/btmrvl_sdio.h | |||
@@ -78,6 +78,9 @@ struct btmrvl_sdio_card_reg { | |||
78 | u8 io_port_0; | 78 | u8 io_port_0; |
79 | u8 io_port_1; | 79 | u8 io_port_1; |
80 | u8 io_port_2; | 80 | u8 io_port_2; |
81 | bool int_read_to_clear; | ||
82 | u8 host_int_rsr; | ||
83 | u8 card_misc_cfg; | ||
81 | }; | 84 | }; |
82 | 85 | ||
83 | struct btmrvl_sdio_card { | 86 | struct btmrvl_sdio_card { |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index f338b0c5a8de..a7dfbf9a3afb 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -152,6 +152,7 @@ static const struct usb_device_id blacklist_table[] = { | |||
152 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, | 152 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, |
153 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 153 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
154 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, | 154 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, |
155 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, | ||
155 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 156 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
156 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, | 157 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
157 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 158 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
@@ -1485,10 +1486,8 @@ static int btusb_probe(struct usb_interface *intf, | |||
1485 | if (id->driver_info & BTUSB_BCM92035) | 1486 | if (id->driver_info & BTUSB_BCM92035) |
1486 | hdev->setup = btusb_setup_bcm92035; | 1487 | hdev->setup = btusb_setup_bcm92035; |
1487 | 1488 | ||
1488 | if (id->driver_info & BTUSB_INTEL) { | 1489 | if (id->driver_info & BTUSB_INTEL) |
1489 | usb_enable_autosuspend(data->udev); | ||
1490 | hdev->setup = btusb_setup_intel; | 1490 | hdev->setup = btusb_setup_intel; |
1491 | } | ||
1492 | 1491 | ||
1493 | /* Interface numbers are hardcoded in the specification */ | 1492 | /* Interface numbers are hardcoded in the specification */ |
1494 | data->isoc = usb_ifnum_to_if(data->udev, 1); | 1493 | data->isoc = usb_ifnum_to_if(data->udev, 1); |
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c index 7048a583fe51..66db9a803373 100644 --- a/drivers/bluetooth/hci_h4.c +++ b/drivers/bluetooth/hci_h4.c | |||
@@ -55,13 +55,6 @@ struct h4_struct { | |||
55 | struct sk_buff_head txq; | 55 | struct sk_buff_head txq; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | /* H4 receiver States */ | ||
59 | #define H4_W4_PACKET_TYPE 0 | ||
60 | #define H4_W4_EVENT_HDR 1 | ||
61 | #define H4_W4_ACL_HDR 2 | ||
62 | #define H4_W4_SCO_HDR 3 | ||
63 | #define H4_W4_DATA 4 | ||
64 | |||
65 | /* Initialize protocol */ | 58 | /* Initialize protocol */ |
66 | static int h4_open(struct hci_uart *hu) | 59 | static int h4_open(struct hci_uart *hu) |
67 | { | 60 | { |
diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c index 507d9a9ee69a..f92050617ae6 100644 --- a/drivers/net/wireless/ath/ar5523/ar5523.c +++ b/drivers/net/wireless/ath/ar5523/ar5523.c | |||
@@ -1090,7 +1090,8 @@ static int ar5523_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | |||
1090 | return ret; | 1090 | return ret; |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | static void ar5523_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1093 | static void ar5523_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1094 | u32 queues, bool drop) | ||
1094 | { | 1095 | { |
1095 | struct ar5523 *ar = hw->priv; | 1096 | struct ar5523 *ar = hw->priv; |
1096 | 1097 | ||
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index e2c01dc5900c..7026f021ccbb 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c | |||
@@ -3651,7 +3651,8 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value) | |||
3651 | return ret; | 3651 | return ret; |
3652 | } | 3652 | } |
3653 | 3653 | ||
3654 | static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 3654 | static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
3655 | u32 queues, bool drop) | ||
3655 | { | 3656 | { |
3656 | struct ath10k *ar = hw->priv; | 3657 | struct ath10k *ar = hw->priv; |
3657 | bool skip; | 3658 | bool skip; |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 1a2973b7acf2..0fce1c76638e 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -3709,8 +3709,8 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3709 | AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CHIRP), | 3709 | AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CHIRP), |
3710 | AR5K_TPC); | 3710 | AR5K_TPC); |
3711 | } else { | 3711 | } else { |
3712 | ath5k_hw_reg_write(ah, AR5K_PHY_TXPOWER_RATE_MAX | | 3712 | ath5k_hw_reg_write(ah, AR5K_TUNE_MAX_TXPOWER, |
3713 | AR5K_TUNE_MAX_TXPOWER, AR5K_PHY_TXPOWER_RATE_MAX); | 3713 | AR5K_PHY_TXPOWER_RATE_MAX); |
3714 | } | 3714 | } |
3715 | 3715 | ||
3716 | return 0; | 3716 | return 0; |
diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile index 8e1c7b0fe76c..8fcd586d1c39 100644 --- a/drivers/net/wireless/ath/ath9k/Makefile +++ b/drivers/net/wireless/ath/ath9k/Makefile | |||
@@ -53,7 +53,8 @@ obj-$(CONFIG_ATH9K_HW) += ath9k_hw.o | |||
53 | obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o | 53 | obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o |
54 | ath9k_common-y:= common.o \ | 54 | ath9k_common-y:= common.o \ |
55 | common-init.o \ | 55 | common-init.o \ |
56 | common-beacon.o | 56 | common-beacon.o \ |
57 | common-debug.o | ||
57 | 58 | ||
58 | ath9k_htc-y += htc_hst.o \ | 59 | ath9k_htc-y += htc_hst.o \ |
59 | hif_usb.o \ | 60 | hif_usb.o \ |
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c index a0398fe3eb28..be3eb2a8d602 100644 --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ b/drivers/net/wireless/ath/ath9k/ahb.c | |||
@@ -86,7 +86,6 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
86 | int irq; | 86 | int irq; |
87 | int ret = 0; | 87 | int ret = 0; |
88 | struct ath_hw *ah; | 88 | struct ath_hw *ah; |
89 | struct ath_common *common; | ||
90 | char hw_name[64]; | 89 | char hw_name[64]; |
91 | 90 | ||
92 | if (!dev_get_platdata(&pdev->dev)) { | 91 | if (!dev_get_platdata(&pdev->dev)) { |
@@ -146,9 +145,6 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
146 | wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", | 145 | wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", |
147 | hw_name, (unsigned long)mem, irq); | 146 | hw_name, (unsigned long)mem, irq); |
148 | 147 | ||
149 | common = ath9k_hw_common(sc->sc_ah); | ||
150 | /* Will be cleared in ath9k_start() */ | ||
151 | set_bit(ATH_OP_INVALID, &common->op_flags); | ||
152 | return 0; | 148 | return 0; |
153 | 149 | ||
154 | err_irq: | 150 | err_irq: |
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index 6d47783f2e5b..ba502a2d199b 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -155,6 +155,9 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel, | |||
155 | ATH9K_ANI_RSSI_THR_LOW, | 155 | ATH9K_ANI_RSSI_THR_LOW, |
156 | ATH9K_ANI_RSSI_THR_HIGH); | 156 | ATH9K_ANI_RSSI_THR_HIGH); |
157 | 157 | ||
158 | if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_OFDM_DEF_LEVEL) | ||
159 | immunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL; | ||
160 | |||
158 | if (!scan) | 161 | if (!scan) |
159 | aniState->ofdmNoiseImmunityLevel = immunityLevel; | 162 | aniState->ofdmNoiseImmunityLevel = immunityLevel; |
160 | 163 | ||
@@ -235,6 +238,9 @@ static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel, | |||
235 | BEACON_RSSI(ah), ATH9K_ANI_RSSI_THR_LOW, | 238 | BEACON_RSSI(ah), ATH9K_ANI_RSSI_THR_LOW, |
236 | ATH9K_ANI_RSSI_THR_HIGH); | 239 | ATH9K_ANI_RSSI_THR_HIGH); |
237 | 240 | ||
241 | if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_CCK_DEF_LEVEL) | ||
242 | immunityLevel = ATH9K_ANI_CCK_DEF_LEVEL; | ||
243 | |||
238 | if (ah->opmode == NL80211_IFTYPE_STATION && | 244 | if (ah->opmode == NL80211_IFTYPE_STATION && |
239 | BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_LOW && | 245 | BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_LOW && |
240 | immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI) | 246 | immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h index 0a6163e9248c..c38399bc9aa9 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | |||
@@ -410,7 +410,7 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
410 | {0x00009e30, 0x06336f77}, | 410 | {0x00009e30, 0x06336f77}, |
411 | {0x00009e34, 0x6af6532f}, | 411 | {0x00009e34, 0x6af6532f}, |
412 | {0x00009e38, 0x0cc80c00}, | 412 | {0x00009e38, 0x0cc80c00}, |
413 | {0x00009e40, 0x0d261820}, | 413 | {0x00009e40, 0x0d261800}, |
414 | {0x00009e4c, 0x00001004}, | 414 | {0x00009e4c, 0x00001004}, |
415 | {0x00009e50, 0x00ff03f1}, | 415 | {0x00009e50, 0x00ff03f1}, |
416 | {0x00009e54, 0x00000000}, | 416 | {0x00009e54, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h index f76139bbb74f..2c42ff05efa3 100644 --- a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h | |||
@@ -592,7 +592,7 @@ static const u32 ar9331_1p1_baseband_core[][2] = { | |||
592 | {0x00009e30, 0x06336f77}, | 592 | {0x00009e30, 0x06336f77}, |
593 | {0x00009e34, 0x6af6532f}, | 593 | {0x00009e34, 0x6af6532f}, |
594 | {0x00009e38, 0x0cc80c00}, | 594 | {0x00009e38, 0x0cc80c00}, |
595 | {0x00009e40, 0x0d261820}, | 595 | {0x00009e40, 0x0d261800}, |
596 | {0x00009e4c, 0x00001004}, | 596 | {0x00009e4c, 0x00001004}, |
597 | {0x00009e50, 0x00ff03f1}, | 597 | {0x00009e50, 0x00ff03f1}, |
598 | {0x00009fc0, 0x803e4788}, | 598 | {0x00009fc0, 0x803e4788}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h index 0ac8be96097f..2154efcd3900 100644 --- a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h | |||
@@ -231,7 +231,7 @@ static const u32 ar9331_1p2_baseband_core[][2] = { | |||
231 | {0x00009e30, 0x06336f77}, | 231 | {0x00009e30, 0x06336f77}, |
232 | {0x00009e34, 0x6af6532f}, | 232 | {0x00009e34, 0x6af6532f}, |
233 | {0x00009e38, 0x0cc80c00}, | 233 | {0x00009e38, 0x0cc80c00}, |
234 | {0x00009e40, 0x0d261820}, | 234 | {0x00009e40, 0x0d261800}, |
235 | {0x00009e4c, 0x00001004}, | 235 | {0x00009e4c, 0x00001004}, |
236 | {0x00009e50, 0x00ff03f1}, | 236 | {0x00009e50, 0x00ff03f1}, |
237 | {0x00009fc0, 0x803e4788}, | 237 | {0x00009fc0, 0x803e4788}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h index a01f0edb6518..b995ffe88b33 100644 --- a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h | |||
@@ -318,7 +318,7 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
318 | {0x00009e30, 0x06336f77}, | 318 | {0x00009e30, 0x06336f77}, |
319 | {0x00009e34, 0x6af6532f}, | 319 | {0x00009e34, 0x6af6532f}, |
320 | {0x00009e38, 0x0cc80c00}, | 320 | {0x00009e38, 0x0cc80c00}, |
321 | {0x00009e40, 0x0d261820}, | 321 | {0x00009e40, 0x0d261800}, |
322 | {0x00009e4c, 0x00001004}, | 322 | {0x00009e4c, 0x00001004}, |
323 | {0x00009e50, 0x00ff03f1}, | 323 | {0x00009e50, 0x00ff03f1}, |
324 | {0x00009e54, 0x00000000}, | 324 | {0x00009e54, 0x00000000}, |
@@ -348,9 +348,9 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
348 | {0x0000a370, 0x00000000}, | 348 | {0x0000a370, 0x00000000}, |
349 | {0x0000a390, 0x00000001}, | 349 | {0x0000a390, 0x00000001}, |
350 | {0x0000a394, 0x00000444}, | 350 | {0x0000a394, 0x00000444}, |
351 | {0x0000a398, 0x00000000}, | 351 | {0x0000a398, 0x001f0e0f}, |
352 | {0x0000a39c, 0x210d0401}, | 352 | {0x0000a39c, 0x0075393f}, |
353 | {0x0000a3a0, 0xab9a7144}, | 353 | {0x0000a3a0, 0xb79f6427}, |
354 | {0x0000a3a4, 0x00000000}, | 354 | {0x0000a3a4, 0x00000000}, |
355 | {0x0000a3a8, 0xaaaaaaaa}, | 355 | {0x0000a3a8, 0xaaaaaaaa}, |
356 | {0x0000a3ac, 0x3c466478}, | 356 | {0x0000a3ac, 0x3c466478}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h index 3c9113d9b1bc..8e5c3b9786e3 100644 --- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h | |||
@@ -257,9 +257,9 @@ static const u32 qca953x_1p0_baseband_core[][2] = { | |||
257 | {0x0000a370, 0x00000000}, | 257 | {0x0000a370, 0x00000000}, |
258 | {0x0000a390, 0x00000001}, | 258 | {0x0000a390, 0x00000001}, |
259 | {0x0000a394, 0x00000444}, | 259 | {0x0000a394, 0x00000444}, |
260 | {0x0000a398, 0x1f020503}, | 260 | {0x0000a398, 0x001f0e0f}, |
261 | {0x0000a39c, 0x29180c03}, | 261 | {0x0000a39c, 0x0075393f}, |
262 | {0x0000a3a0, 0x9a8b6844}, | 262 | {0x0000a3a0, 0xb79f6427}, |
263 | {0x0000a3a4, 0x000000ff}, | 263 | {0x0000a3a4, 0x000000ff}, |
264 | {0x0000a3a8, 0x6a6a6a6a}, | 264 | {0x0000a3a8, 0x6a6a6a6a}, |
265 | {0x0000a3ac, 0x6a6a6a6a}, | 265 | {0x0000a3ac, 0x6a6a6a6a}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h index e6aec2c0207f..a5ca65240af3 100644 --- a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h | |||
@@ -90,7 +90,7 @@ static const u32 ar9580_1p0_baseband_core[][2] = { | |||
90 | {0x00009e30, 0x06336f77}, | 90 | {0x00009e30, 0x06336f77}, |
91 | {0x00009e34, 0x6af6532f}, | 91 | {0x00009e34, 0x6af6532f}, |
92 | {0x00009e38, 0x0cc80c00}, | 92 | {0x00009e38, 0x0cc80c00}, |
93 | {0x00009e40, 0x0d261820}, | 93 | {0x00009e40, 0x0d261800}, |
94 | {0x00009e4c, 0x00001004}, | 94 | {0x00009e4c, 0x00001004}, |
95 | {0x00009e50, 0x00ff03f1}, | 95 | {0x00009e50, 0x00ff03f1}, |
96 | {0x00009e54, 0x00000000}, | 96 | {0x00009e54, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 05935f638525..20dd344bf645 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
24 | #include <linux/completion.h> | 24 | #include <linux/completion.h> |
25 | 25 | ||
26 | #include "debug.h" | ||
27 | #include "common.h" | 26 | #include "common.h" |
27 | #include "debug.h" | ||
28 | #include "mci.h" | 28 | #include "mci.h" |
29 | #include "dfs.h" | 29 | #include "dfs.h" |
30 | #include "spectral.h" | 30 | #include "spectral.h" |
@@ -254,7 +254,6 @@ struct ath_atx_tid { | |||
254 | 254 | ||
255 | s8 bar_index; | 255 | s8 bar_index; |
256 | bool sched; | 256 | bool sched; |
257 | bool paused; | ||
258 | bool active; | 257 | bool active; |
259 | }; | 258 | }; |
260 | 259 | ||
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index bd9e634879e6..e387f0b2954a 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -537,8 +537,6 @@ static void ath9k_cache_beacon_config(struct ath_softc *sc, | |||
537 | cur_conf->dtim_period = bss_conf->dtim_period; | 537 | cur_conf->dtim_period = bss_conf->dtim_period; |
538 | cur_conf->dtim_count = 1; | 538 | cur_conf->dtim_count = 1; |
539 | cur_conf->ibss_creator = bss_conf->ibss_creator; | 539 | cur_conf->ibss_creator = bss_conf->ibss_creator; |
540 | cur_conf->bmiss_timeout = | ||
541 | ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; | ||
542 | 540 | ||
543 | /* | 541 | /* |
544 | * It looks like mac80211 may end up using beacon interval of zero in | 542 | * It looks like mac80211 may end up using beacon interval of zero in |
@@ -549,6 +547,9 @@ static void ath9k_cache_beacon_config(struct ath_softc *sc, | |||
549 | if (cur_conf->beacon_interval == 0) | 547 | if (cur_conf->beacon_interval == 0) |
550 | cur_conf->beacon_interval = 100; | 548 | cur_conf->beacon_interval = 100; |
551 | 549 | ||
550 | cur_conf->bmiss_timeout = | ||
551 | ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; | ||
552 | |||
552 | /* | 553 | /* |
553 | * We don't parse dtim period from mac80211 during the driver | 554 | * We don't parse dtim period from mac80211 during the driver |
554 | * initialization as it breaks association with hidden-ssid | 555 | * initialization as it breaks association with hidden-ssid |
diff --git a/drivers/net/wireless/ath/ath9k/common-debug.c b/drivers/net/wireless/ath/ath9k/common-debug.c new file mode 100644 index 000000000000..3b289f933405 --- /dev/null +++ b/drivers/net/wireless/ath/ath9k/common-debug.c | |||
@@ -0,0 +1,253 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008-2011 Atheros Communications Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #include "common.h" | ||
18 | |||
19 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | ||
20 | size_t count, loff_t *ppos) | ||
21 | { | ||
22 | struct ath_hw *ah = file->private_data; | ||
23 | u32 len = 0, size = 6000; | ||
24 | char *buf; | ||
25 | size_t retval; | ||
26 | |||
27 | buf = kzalloc(size, GFP_KERNEL); | ||
28 | if (buf == NULL) | ||
29 | return -ENOMEM; | ||
30 | |||
31 | len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size); | ||
32 | |||
33 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
34 | kfree(buf); | ||
35 | |||
36 | return retval; | ||
37 | } | ||
38 | |||
39 | static const struct file_operations fops_modal_eeprom = { | ||
40 | .read = read_file_modal_eeprom, | ||
41 | .open = simple_open, | ||
42 | .owner = THIS_MODULE, | ||
43 | .llseek = default_llseek, | ||
44 | }; | ||
45 | |||
46 | |||
47 | void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy, | ||
48 | struct ath_hw *ah) | ||
49 | { | ||
50 | debugfs_create_file("modal_eeprom", S_IRUSR, debugfs_phy, ah, | ||
51 | &fops_modal_eeprom); | ||
52 | } | ||
53 | EXPORT_SYMBOL(ath9k_cmn_debug_modal_eeprom); | ||
54 | |||
55 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | ||
56 | size_t count, loff_t *ppos) | ||
57 | { | ||
58 | struct ath_hw *ah = file->private_data; | ||
59 | u32 len = 0, size = 1500; | ||
60 | ssize_t retval = 0; | ||
61 | char *buf; | ||
62 | |||
63 | buf = kzalloc(size, GFP_KERNEL); | ||
64 | if (!buf) | ||
65 | return -ENOMEM; | ||
66 | |||
67 | len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size); | ||
68 | |||
69 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
70 | kfree(buf); | ||
71 | |||
72 | return retval; | ||
73 | } | ||
74 | |||
75 | static const struct file_operations fops_base_eeprom = { | ||
76 | .read = read_file_base_eeprom, | ||
77 | .open = simple_open, | ||
78 | .owner = THIS_MODULE, | ||
79 | .llseek = default_llseek, | ||
80 | }; | ||
81 | |||
82 | void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, | ||
83 | struct ath_hw *ah) | ||
84 | { | ||
85 | debugfs_create_file("base_eeprom", S_IRUSR, debugfs_phy, ah, | ||
86 | &fops_base_eeprom); | ||
87 | } | ||
88 | EXPORT_SYMBOL(ath9k_cmn_debug_base_eeprom); | ||
89 | |||
90 | void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, | ||
91 | struct ath_rx_status *rs) | ||
92 | { | ||
93 | #define RX_PHY_ERR_INC(c) rxstats->phy_err_stats[c]++ | ||
94 | #define RX_CMN_STAT_INC(c) (rxstats->c++) | ||
95 | |||
96 | RX_CMN_STAT_INC(rx_pkts_all); | ||
97 | rxstats->rx_bytes_all += rs->rs_datalen; | ||
98 | |||
99 | if (rs->rs_status & ATH9K_RXERR_CRC) | ||
100 | RX_CMN_STAT_INC(crc_err); | ||
101 | if (rs->rs_status & ATH9K_RXERR_DECRYPT) | ||
102 | RX_CMN_STAT_INC(decrypt_crc_err); | ||
103 | if (rs->rs_status & ATH9K_RXERR_MIC) | ||
104 | RX_CMN_STAT_INC(mic_err); | ||
105 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) | ||
106 | RX_CMN_STAT_INC(pre_delim_crc_err); | ||
107 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) | ||
108 | RX_CMN_STAT_INC(post_delim_crc_err); | ||
109 | if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) | ||
110 | RX_CMN_STAT_INC(decrypt_busy_err); | ||
111 | |||
112 | if (rs->rs_status & ATH9K_RXERR_PHY) { | ||
113 | RX_CMN_STAT_INC(phy_err); | ||
114 | if (rs->rs_phyerr < ATH9K_PHYERR_MAX) | ||
115 | RX_PHY_ERR_INC(rs->rs_phyerr); | ||
116 | } | ||
117 | |||
118 | #undef RX_CMN_STAT_INC | ||
119 | #undef RX_PHY_ERR_INC | ||
120 | } | ||
121 | EXPORT_SYMBOL(ath9k_cmn_debug_stat_rx); | ||
122 | |||
123 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | ||
124 | size_t count, loff_t *ppos) | ||
125 | { | ||
126 | #define RXS_ERR(s, e) \ | ||
127 | do { \ | ||
128 | len += scnprintf(buf + len, size - len, \ | ||
129 | "%18s : %10u\n", s, \ | ||
130 | rxstats->e); \ | ||
131 | } while (0) | ||
132 | |||
133 | struct ath_rx_stats *rxstats = file->private_data; | ||
134 | char *buf; | ||
135 | unsigned int len = 0, size = 1600; | ||
136 | ssize_t retval = 0; | ||
137 | |||
138 | buf = kzalloc(size, GFP_KERNEL); | ||
139 | if (buf == NULL) | ||
140 | return -ENOMEM; | ||
141 | |||
142 | RXS_ERR("PKTS-ALL", rx_pkts_all); | ||
143 | RXS_ERR("BYTES-ALL", rx_bytes_all); | ||
144 | RXS_ERR("BEACONS", rx_beacons); | ||
145 | RXS_ERR("FRAGS", rx_frags); | ||
146 | RXS_ERR("SPECTRAL", rx_spectral); | ||
147 | |||
148 | RXS_ERR("CRC ERR", crc_err); | ||
149 | RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); | ||
150 | RXS_ERR("PHY ERR", phy_err); | ||
151 | RXS_ERR("MIC ERR", mic_err); | ||
152 | RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); | ||
153 | RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); | ||
154 | RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); | ||
155 | RXS_ERR("LENGTH-ERR", rx_len_err); | ||
156 | RXS_ERR("OOM-ERR", rx_oom_err); | ||
157 | RXS_ERR("RATE-ERR", rx_rate_err); | ||
158 | RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); | ||
159 | |||
160 | if (len > size) | ||
161 | len = size; | ||
162 | |||
163 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
164 | kfree(buf); | ||
165 | |||
166 | return retval; | ||
167 | |||
168 | #undef RXS_ERR | ||
169 | } | ||
170 | |||
171 | static const struct file_operations fops_recv = { | ||
172 | .read = read_file_recv, | ||
173 | .open = simple_open, | ||
174 | .owner = THIS_MODULE, | ||
175 | .llseek = default_llseek, | ||
176 | }; | ||
177 | |||
178 | void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, | ||
179 | struct ath_rx_stats *rxstats) | ||
180 | { | ||
181 | debugfs_create_file("recv", S_IRUSR, debugfs_phy, rxstats, | ||
182 | &fops_recv); | ||
183 | } | ||
184 | EXPORT_SYMBOL(ath9k_cmn_debug_recv); | ||
185 | |||
186 | static ssize_t read_file_phy_err(struct file *file, char __user *user_buf, | ||
187 | size_t count, loff_t *ppos) | ||
188 | { | ||
189 | #define PHY_ERR(s, p) \ | ||
190 | len += scnprintf(buf + len, size - len, "%22s : %10u\n", s, \ | ||
191 | rxstats->phy_err_stats[p]); | ||
192 | |||
193 | struct ath_rx_stats *rxstats = file->private_data; | ||
194 | char *buf; | ||
195 | unsigned int len = 0, size = 1600; | ||
196 | ssize_t retval = 0; | ||
197 | |||
198 | buf = kzalloc(size, GFP_KERNEL); | ||
199 | if (buf == NULL) | ||
200 | return -ENOMEM; | ||
201 | |||
202 | PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); | ||
203 | PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING); | ||
204 | PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY); | ||
205 | PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE); | ||
206 | PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH); | ||
207 | PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR); | ||
208 | PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE); | ||
209 | PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR); | ||
210 | PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING); | ||
211 | PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); | ||
212 | PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); | ||
213 | PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); | ||
214 | PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP); | ||
215 | PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE); | ||
216 | PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART); | ||
217 | PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT); | ||
218 | PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING); | ||
219 | PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC); | ||
220 | PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL); | ||
221 | PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE); | ||
222 | PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART); | ||
223 | PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); | ||
224 | PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP); | ||
225 | PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR); | ||
226 | PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); | ||
227 | PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); | ||
228 | |||
229 | if (len > size) | ||
230 | len = size; | ||
231 | |||
232 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
233 | kfree(buf); | ||
234 | |||
235 | return retval; | ||
236 | |||
237 | #undef PHY_ERR | ||
238 | } | ||
239 | |||
240 | static const struct file_operations fops_phy_err = { | ||
241 | .read = read_file_phy_err, | ||
242 | .open = simple_open, | ||
243 | .owner = THIS_MODULE, | ||
244 | .llseek = default_llseek, | ||
245 | }; | ||
246 | |||
247 | void ath9k_cmn_debug_phy_err(struct dentry *debugfs_phy, | ||
248 | struct ath_rx_stats *rxstats) | ||
249 | { | ||
250 | debugfs_create_file("phy_err", S_IRUSR, debugfs_phy, rxstats, | ||
251 | &fops_phy_err); | ||
252 | } | ||
253 | EXPORT_SYMBOL(ath9k_cmn_debug_phy_err); | ||
diff --git a/drivers/net/wireless/ath/ath9k/common-debug.h b/drivers/net/wireless/ath/ath9k/common-debug.h new file mode 100644 index 000000000000..7c9788490f7f --- /dev/null +++ b/drivers/net/wireless/ath/ath9k/common-debug.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008-2011 Atheros Communications Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | |||
18 | |||
19 | /** | ||
20 | * struct ath_rx_stats - RX Statistics | ||
21 | * @rx_pkts_all: No. of total frames received, including ones that | ||
22 | may have had errors. | ||
23 | * @rx_bytes_all: No. of total bytes received, including ones that | ||
24 | may have had errors. | ||
25 | * @crc_err: No. of frames with incorrect CRC value | ||
26 | * @decrypt_crc_err: No. of frames whose CRC check failed after | ||
27 | decryption process completed | ||
28 | * @phy_err: No. of frames whose reception failed because the PHY | ||
29 | encountered an error | ||
30 | * @mic_err: No. of frames with incorrect TKIP MIC verification failure | ||
31 | * @pre_delim_crc_err: Pre-Frame delimiter CRC error detections | ||
32 | * @post_delim_crc_err: Post-Frame delimiter CRC error detections | ||
33 | * @decrypt_busy_err: Decryption interruptions counter | ||
34 | * @phy_err_stats: Individual PHY error statistics | ||
35 | * @rx_len_err: No. of frames discarded due to bad length. | ||
36 | * @rx_oom_err: No. of frames dropped due to OOM issues. | ||
37 | * @rx_rate_err: No. of frames dropped due to rate errors. | ||
38 | * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. | ||
39 | * @rx_beacons: No. of beacons received. | ||
40 | * @rx_frags: No. of rx-fragements received. | ||
41 | * @rx_spectral: No of spectral packets received. | ||
42 | */ | ||
43 | struct ath_rx_stats { | ||
44 | u32 rx_pkts_all; | ||
45 | u32 rx_bytes_all; | ||
46 | u32 crc_err; | ||
47 | u32 decrypt_crc_err; | ||
48 | u32 phy_err; | ||
49 | u32 mic_err; | ||
50 | u32 pre_delim_crc_err; | ||
51 | u32 post_delim_crc_err; | ||
52 | u32 decrypt_busy_err; | ||
53 | u32 phy_err_stats[ATH9K_PHYERR_MAX]; | ||
54 | u32 rx_len_err; | ||
55 | u32 rx_oom_err; | ||
56 | u32 rx_rate_err; | ||
57 | u32 rx_too_many_frags_err; | ||
58 | u32 rx_beacons; | ||
59 | u32 rx_frags; | ||
60 | u32 rx_spectral; | ||
61 | }; | ||
62 | |||
63 | void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy, | ||
64 | struct ath_hw *ah); | ||
65 | void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, | ||
66 | struct ath_hw *ah); | ||
67 | void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, | ||
68 | struct ath_rx_status *rs); | ||
69 | void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, | ||
70 | struct ath_rx_stats *rxstats); | ||
71 | void ath9k_cmn_debug_phy_err(struct dentry *debugfs_phy, | ||
72 | struct ath_rx_stats *rxstats); | ||
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h index ca38116838f0..ffc454b18637 100644 --- a/drivers/net/wireless/ath/ath9k/common.h +++ b/drivers/net/wireless/ath/ath9k/common.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include "common-init.h" | 24 | #include "common-init.h" |
25 | #include "common-beacon.h" | 25 | #include "common-beacon.h" |
26 | #include "common-debug.h" | ||
26 | 27 | ||
27 | /* Common header for Atheros 802.11n base driver cores */ | 28 | /* Common header for Atheros 802.11n base driver cores */ |
28 | 29 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 780ff1bee6f6..6cc42be48d4e 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -948,151 +948,11 @@ static const struct file_operations fops_reset = { | |||
948 | .llseek = default_llseek, | 948 | .llseek = default_llseek, |
949 | }; | 949 | }; |
950 | 950 | ||
951 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | ||
952 | size_t count, loff_t *ppos) | ||
953 | { | ||
954 | #define RXS_ERR(s, e) \ | ||
955 | do { \ | ||
956 | len += scnprintf(buf + len, size - len, \ | ||
957 | "%18s : %10u\n", s, \ | ||
958 | sc->debug.stats.rxstats.e);\ | ||
959 | } while (0) | ||
960 | |||
961 | struct ath_softc *sc = file->private_data; | ||
962 | char *buf; | ||
963 | unsigned int len = 0, size = 1600; | ||
964 | ssize_t retval = 0; | ||
965 | |||
966 | buf = kzalloc(size, GFP_KERNEL); | ||
967 | if (buf == NULL) | ||
968 | return -ENOMEM; | ||
969 | |||
970 | RXS_ERR("PKTS-ALL", rx_pkts_all); | ||
971 | RXS_ERR("BYTES-ALL", rx_bytes_all); | ||
972 | RXS_ERR("BEACONS", rx_beacons); | ||
973 | RXS_ERR("FRAGS", rx_frags); | ||
974 | RXS_ERR("SPECTRAL", rx_spectral); | ||
975 | |||
976 | RXS_ERR("CRC ERR", crc_err); | ||
977 | RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); | ||
978 | RXS_ERR("PHY ERR", phy_err); | ||
979 | RXS_ERR("MIC ERR", mic_err); | ||
980 | RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); | ||
981 | RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); | ||
982 | RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); | ||
983 | RXS_ERR("LENGTH-ERR", rx_len_err); | ||
984 | RXS_ERR("OOM-ERR", rx_oom_err); | ||
985 | RXS_ERR("RATE-ERR", rx_rate_err); | ||
986 | RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); | ||
987 | |||
988 | if (len > size) | ||
989 | len = size; | ||
990 | |||
991 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
992 | kfree(buf); | ||
993 | |||
994 | return retval; | ||
995 | |||
996 | #undef RXS_ERR | ||
997 | } | ||
998 | |||
999 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) | 951 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) |
1000 | { | 952 | { |
1001 | #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ | 953 | ath9k_cmn_debug_stat_rx(&sc->debug.stats.rxstats, rs); |
1002 | |||
1003 | RX_STAT_INC(rx_pkts_all); | ||
1004 | sc->debug.stats.rxstats.rx_bytes_all += rs->rs_datalen; | ||
1005 | |||
1006 | if (rs->rs_status & ATH9K_RXERR_CRC) | ||
1007 | RX_STAT_INC(crc_err); | ||
1008 | if (rs->rs_status & ATH9K_RXERR_DECRYPT) | ||
1009 | RX_STAT_INC(decrypt_crc_err); | ||
1010 | if (rs->rs_status & ATH9K_RXERR_MIC) | ||
1011 | RX_STAT_INC(mic_err); | ||
1012 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) | ||
1013 | RX_STAT_INC(pre_delim_crc_err); | ||
1014 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) | ||
1015 | RX_STAT_INC(post_delim_crc_err); | ||
1016 | if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) | ||
1017 | RX_STAT_INC(decrypt_busy_err); | ||
1018 | |||
1019 | if (rs->rs_status & ATH9K_RXERR_PHY) { | ||
1020 | RX_STAT_INC(phy_err); | ||
1021 | if (rs->rs_phyerr < ATH9K_PHYERR_MAX) | ||
1022 | RX_PHY_ERR_INC(rs->rs_phyerr); | ||
1023 | } | ||
1024 | |||
1025 | #undef RX_PHY_ERR_INC | ||
1026 | } | 954 | } |
1027 | 955 | ||
1028 | static const struct file_operations fops_recv = { | ||
1029 | .read = read_file_recv, | ||
1030 | .open = simple_open, | ||
1031 | .owner = THIS_MODULE, | ||
1032 | .llseek = default_llseek, | ||
1033 | }; | ||
1034 | |||
1035 | static ssize_t read_file_phy_err(struct file *file, char __user *user_buf, | ||
1036 | size_t count, loff_t *ppos) | ||
1037 | { | ||
1038 | #define PHY_ERR(s, p) \ | ||
1039 | len += scnprintf(buf + len, size - len, "%22s : %10u\n", s, \ | ||
1040 | sc->debug.stats.rxstats.phy_err_stats[p]); | ||
1041 | |||
1042 | struct ath_softc *sc = file->private_data; | ||
1043 | char *buf; | ||
1044 | unsigned int len = 0, size = 1600; | ||
1045 | ssize_t retval = 0; | ||
1046 | |||
1047 | buf = kzalloc(size, GFP_KERNEL); | ||
1048 | if (buf == NULL) | ||
1049 | return -ENOMEM; | ||
1050 | |||
1051 | PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); | ||
1052 | PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING); | ||
1053 | PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY); | ||
1054 | PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE); | ||
1055 | PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH); | ||
1056 | PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR); | ||
1057 | PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE); | ||
1058 | PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR); | ||
1059 | PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING); | ||
1060 | PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); | ||
1061 | PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); | ||
1062 | PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); | ||
1063 | PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP); | ||
1064 | PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE); | ||
1065 | PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART); | ||
1066 | PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT); | ||
1067 | PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING); | ||
1068 | PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC); | ||
1069 | PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL); | ||
1070 | PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE); | ||
1071 | PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART); | ||
1072 | PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); | ||
1073 | PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP); | ||
1074 | PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR); | ||
1075 | PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); | ||
1076 | PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); | ||
1077 | |||
1078 | if (len > size) | ||
1079 | len = size; | ||
1080 | |||
1081 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1082 | kfree(buf); | ||
1083 | |||
1084 | return retval; | ||
1085 | |||
1086 | #undef PHY_ERR | ||
1087 | } | ||
1088 | |||
1089 | static const struct file_operations fops_phy_err = { | ||
1090 | .read = read_file_phy_err, | ||
1091 | .open = simple_open, | ||
1092 | .owner = THIS_MODULE, | ||
1093 | .llseek = default_llseek, | ||
1094 | }; | ||
1095 | |||
1096 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, | 956 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, |
1097 | size_t count, loff_t *ppos) | 957 | size_t count, loff_t *ppos) |
1098 | { | 958 | { |
@@ -1268,62 +1128,6 @@ static const struct file_operations fops_dump_nfcal = { | |||
1268 | .llseek = default_llseek, | 1128 | .llseek = default_llseek, |
1269 | }; | 1129 | }; |
1270 | 1130 | ||
1271 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | ||
1272 | size_t count, loff_t *ppos) | ||
1273 | { | ||
1274 | struct ath_softc *sc = file->private_data; | ||
1275 | struct ath_hw *ah = sc->sc_ah; | ||
1276 | u32 len = 0, size = 1500; | ||
1277 | ssize_t retval = 0; | ||
1278 | char *buf; | ||
1279 | |||
1280 | buf = kzalloc(size, GFP_KERNEL); | ||
1281 | if (!buf) | ||
1282 | return -ENOMEM; | ||
1283 | |||
1284 | len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size); | ||
1285 | |||
1286 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1287 | kfree(buf); | ||
1288 | |||
1289 | return retval; | ||
1290 | } | ||
1291 | |||
1292 | static const struct file_operations fops_base_eeprom = { | ||
1293 | .read = read_file_base_eeprom, | ||
1294 | .open = simple_open, | ||
1295 | .owner = THIS_MODULE, | ||
1296 | .llseek = default_llseek, | ||
1297 | }; | ||
1298 | |||
1299 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | ||
1300 | size_t count, loff_t *ppos) | ||
1301 | { | ||
1302 | struct ath_softc *sc = file->private_data; | ||
1303 | struct ath_hw *ah = sc->sc_ah; | ||
1304 | u32 len = 0, size = 6000; | ||
1305 | char *buf; | ||
1306 | size_t retval; | ||
1307 | |||
1308 | buf = kzalloc(size, GFP_KERNEL); | ||
1309 | if (buf == NULL) | ||
1310 | return -ENOMEM; | ||
1311 | |||
1312 | len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size); | ||
1313 | |||
1314 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1315 | kfree(buf); | ||
1316 | |||
1317 | return retval; | ||
1318 | } | ||
1319 | |||
1320 | static const struct file_operations fops_modal_eeprom = { | ||
1321 | .read = read_file_modal_eeprom, | ||
1322 | .open = simple_open, | ||
1323 | .owner = THIS_MODULE, | ||
1324 | .llseek = default_llseek, | ||
1325 | }; | ||
1326 | |||
1327 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT | 1131 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
1328 | static ssize_t read_file_btcoex(struct file *file, char __user *user_buf, | 1132 | static ssize_t read_file_btcoex(struct file *file, char __user *user_buf, |
1329 | size_t count, loff_t *ppos) | 1133 | size_t count, loff_t *ppos) |
@@ -1524,10 +1328,10 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1524 | &fops_misc); | 1328 | &fops_misc); |
1525 | debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, | 1329 | debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, |
1526 | &fops_reset); | 1330 | &fops_reset); |
1527 | debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, | 1331 | |
1528 | &fops_recv); | 1332 | ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); |
1529 | debugfs_create_file("phy_err", S_IRUSR, sc->debug.debugfs_phy, sc, | 1333 | ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); |
1530 | &fops_phy_err); | 1334 | |
1531 | debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy, | 1335 | debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy, |
1532 | &ah->rxchainmask); | 1336 | &ah->rxchainmask); |
1533 | debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy, | 1337 | debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy, |
@@ -1547,10 +1351,10 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1547 | &fops_regdump); | 1351 | &fops_regdump); |
1548 | debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, | 1352 | debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, |
1549 | &fops_dump_nfcal); | 1353 | &fops_dump_nfcal); |
1550 | debugfs_create_file("base_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, | 1354 | |
1551 | &fops_base_eeprom); | 1355 | ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); |
1552 | debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, | 1356 | ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); |
1553 | &fops_modal_eeprom); | 1357 | |
1554 | debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, | 1358 | debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, |
1555 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); | 1359 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); |
1556 | debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, | 1360 | debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, |
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index 559a68c2709c..53ae15bd0c9d 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
@@ -221,50 +221,6 @@ struct ath_rx_rate_stats { | |||
221 | } cck_stats[4]; | 221 | } cck_stats[4]; |
222 | }; | 222 | }; |
223 | 223 | ||
224 | /** | ||
225 | * struct ath_rx_stats - RX Statistics | ||
226 | * @rx_pkts_all: No. of total frames received, including ones that | ||
227 | may have had errors. | ||
228 | * @rx_bytes_all: No. of total bytes received, including ones that | ||
229 | may have had errors. | ||
230 | * @crc_err: No. of frames with incorrect CRC value | ||
231 | * @decrypt_crc_err: No. of frames whose CRC check failed after | ||
232 | decryption process completed | ||
233 | * @phy_err: No. of frames whose reception failed because the PHY | ||
234 | encountered an error | ||
235 | * @mic_err: No. of frames with incorrect TKIP MIC verification failure | ||
236 | * @pre_delim_crc_err: Pre-Frame delimiter CRC error detections | ||
237 | * @post_delim_crc_err: Post-Frame delimiter CRC error detections | ||
238 | * @decrypt_busy_err: Decryption interruptions counter | ||
239 | * @phy_err_stats: Individual PHY error statistics | ||
240 | * @rx_len_err: No. of frames discarded due to bad length. | ||
241 | * @rx_oom_err: No. of frames dropped due to OOM issues. | ||
242 | * @rx_rate_err: No. of frames dropped due to rate errors. | ||
243 | * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. | ||
244 | * @rx_beacons: No. of beacons received. | ||
245 | * @rx_frags: No. of rx-fragements received. | ||
246 | * @rx_spectral: No of spectral packets received. | ||
247 | */ | ||
248 | struct ath_rx_stats { | ||
249 | u32 rx_pkts_all; | ||
250 | u32 rx_bytes_all; | ||
251 | u32 crc_err; | ||
252 | u32 decrypt_crc_err; | ||
253 | u32 phy_err; | ||
254 | u32 mic_err; | ||
255 | u32 pre_delim_crc_err; | ||
256 | u32 post_delim_crc_err; | ||
257 | u32 decrypt_busy_err; | ||
258 | u32 phy_err_stats[ATH9K_PHYERR_MAX]; | ||
259 | u32 rx_len_err; | ||
260 | u32 rx_oom_err; | ||
261 | u32 rx_rate_err; | ||
262 | u32 rx_too_many_frags_err; | ||
263 | u32 rx_beacons; | ||
264 | u32 rx_frags; | ||
265 | u32 rx_spectral; | ||
266 | }; | ||
267 | |||
268 | #define ANT_MAIN 0 | 224 | #define ANT_MAIN 0 |
269 | #define ANT_ALT 1 | 225 | #define ANT_ALT 1 |
270 | 226 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug_sta.c b/drivers/net/wireless/ath/ath9k/debug_sta.c index d76e6e0120d2..ffca918ff16a 100644 --- a/drivers/net/wireless/ath/ath9k/debug_sta.c +++ b/drivers/net/wireless/ath/ath9k/debug_sta.c | |||
@@ -72,7 +72,7 @@ static ssize_t read_file_node_aggr(struct file *file, char __user *user_buf, | |||
72 | ath_txq_lock(sc, txq); | 72 | ath_txq_lock(sc, txq); |
73 | if (tid->active) { | 73 | if (tid->active) { |
74 | len += scnprintf(buf + len, size - len, | 74 | len += scnprintf(buf + len, size - len, |
75 | "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n", | 75 | "%3d%11d%10d%10d%10d%10d%9d%6d\n", |
76 | tid->tidno, | 76 | tid->tidno, |
77 | tid->seq_start, | 77 | tid->seq_start, |
78 | tid->seq_next, | 78 | tid->seq_next, |
@@ -80,8 +80,7 @@ static ssize_t read_file_node_aggr(struct file *file, char __user *user_buf, | |||
80 | tid->baw_head, | 80 | tid->baw_head, |
81 | tid->baw_tail, | 81 | tid->baw_tail, |
82 | tid->bar_index, | 82 | tid->bar_index, |
83 | tid->sched, | 83 | tid->sched); |
84 | tid->paused); | ||
85 | } | 84 | } |
86 | ath_txq_unlock(sc, txq); | 85 | ath_txq_unlock(sc, txq); |
87 | } | 86 | } |
diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c index 857bb28b3894..5049bec5c676 100644 --- a/drivers/net/wireless/ath/ath9k/dfs.c +++ b/drivers/net/wireless/ath/ath9k/dfs.c | |||
@@ -178,12 +178,12 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, | |||
178 | pe.ts = mactime; | 178 | pe.ts = mactime; |
179 | if (ath9k_postprocess_radar_event(sc, &ard, &pe)) { | 179 | if (ath9k_postprocess_radar_event(sc, &ard, &pe)) { |
180 | struct dfs_pattern_detector *pd = sc->dfs_detector; | 180 | struct dfs_pattern_detector *pd = sc->dfs_detector; |
181 | static u64 last_ts; | ||
182 | ath_dbg(common, DFS, | 181 | ath_dbg(common, DFS, |
183 | "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " | 182 | "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " |
184 | "width=%d, rssi=%d, delta_ts=%llu\n", | 183 | "width=%d, rssi=%d, delta_ts=%llu\n", |
185 | pe.freq, pe.ts, pe.width, pe.rssi, pe.ts-last_ts); | 184 | pe.freq, pe.ts, pe.width, pe.rssi, |
186 | last_ts = pe.ts; | 185 | pe.ts - sc->debug.stats.dfs_stats.last_ts); |
186 | sc->debug.stats.dfs_stats.last_ts = pe.ts; | ||
187 | DFS_STAT_INC(sc, pulses_processed); | 187 | DFS_STAT_INC(sc, pulses_processed); |
188 | if (pd != NULL && pd->add_pulse(pd, &pe)) { | 188 | if (pd != NULL && pd->add_pulse(pd, &pe)) { |
189 | DFS_STAT_INC(sc, radar_detected); | 189 | DFS_STAT_INC(sc, radar_detected); |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.h b/drivers/net/wireless/ath/ath9k/dfs_debug.h index 7936c9126a20..d9486867a5e0 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.h +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.h | |||
@@ -51,6 +51,7 @@ struct ath_dfs_stats { | |||
51 | /* pattern detection stats */ | 51 | /* pattern detection stats */ |
52 | u32 pulses_processed; | 52 | u32 pulses_processed; |
53 | u32 radar_detected; | 53 | u32 radar_detected; |
54 | u64 last_ts; | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | #if defined(CONFIG_ATH9K_DFS_DEBUGFS) | 57 | #if defined(CONFIG_ATH9K_DFS_DEBUGFS) |
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index dab1f0cab993..04d2f4f90e49 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -325,14 +325,14 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb) | |||
325 | 325 | ||
326 | #define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) | 326 | #define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) |
327 | #define TX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) | 327 | #define TX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) |
328 | #define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c++) | 328 | #define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) |
329 | #define RX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c += a) | 329 | #define RX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) |
330 | #define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ | 330 | #define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ |
331 | 331 | ||
332 | #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++) | 332 | #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++) |
333 | 333 | ||
334 | void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, | 334 | void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, |
335 | struct ath_htc_rx_status *rxs); | 335 | struct ath_rx_status *rs); |
336 | 336 | ||
337 | struct ath_tx_stats { | 337 | struct ath_tx_stats { |
338 | u32 buf_queued; | 338 | u32 buf_queued; |
@@ -345,25 +345,18 @@ struct ath_tx_stats { | |||
345 | u32 queue_stats[IEEE80211_NUM_ACS]; | 345 | u32 queue_stats[IEEE80211_NUM_ACS]; |
346 | }; | 346 | }; |
347 | 347 | ||
348 | struct ath_rx_stats { | 348 | struct ath_skbrx_stats { |
349 | u32 skb_allocated; | 349 | u32 skb_allocated; |
350 | u32 skb_completed; | 350 | u32 skb_completed; |
351 | u32 skb_completed_bytes; | 351 | u32 skb_completed_bytes; |
352 | u32 skb_dropped; | 352 | u32 skb_dropped; |
353 | u32 err_crc; | ||
354 | u32 err_decrypt_crc; | ||
355 | u32 err_mic; | ||
356 | u32 err_pre_delim; | ||
357 | u32 err_post_delim; | ||
358 | u32 err_decrypt_busy; | ||
359 | u32 err_phy; | ||
360 | u32 err_phy_stats[ATH9K_PHYERR_MAX]; | ||
361 | }; | 353 | }; |
362 | 354 | ||
363 | struct ath9k_debug { | 355 | struct ath9k_debug { |
364 | struct dentry *debugfs_phy; | 356 | struct dentry *debugfs_phy; |
365 | struct ath_tx_stats tx_stats; | 357 | struct ath_tx_stats tx_stats; |
366 | struct ath_rx_stats rx_stats; | 358 | struct ath_rx_stats rx_stats; |
359 | struct ath_skbrx_stats skbrx_stats; | ||
367 | }; | 360 | }; |
368 | 361 | ||
369 | void ath9k_htc_get_et_strings(struct ieee80211_hw *hw, | 362 | void ath9k_htc_get_et_strings(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c index fb071ee4fcfb..8b529e4b8ac4 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c | |||
@@ -243,39 +243,14 @@ static const struct file_operations fops_xmit = { | |||
243 | }; | 243 | }; |
244 | 244 | ||
245 | void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, | 245 | void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, |
246 | struct ath_htc_rx_status *rxs) | 246 | struct ath_rx_status *rs) |
247 | { | 247 | { |
248 | #define RX_PHY_ERR_INC(c) priv->debug.rx_stats.err_phy_stats[c]++ | 248 | ath9k_cmn_debug_stat_rx(&priv->debug.rx_stats, rs); |
249 | |||
250 | if (rxs->rs_status & ATH9K_RXERR_CRC) | ||
251 | priv->debug.rx_stats.err_crc++; | ||
252 | if (rxs->rs_status & ATH9K_RXERR_DECRYPT) | ||
253 | priv->debug.rx_stats.err_decrypt_crc++; | ||
254 | if (rxs->rs_status & ATH9K_RXERR_MIC) | ||
255 | priv->debug.rx_stats.err_mic++; | ||
256 | if (rxs->rs_status & ATH9K_RX_DELIM_CRC_PRE) | ||
257 | priv->debug.rx_stats.err_pre_delim++; | ||
258 | if (rxs->rs_status & ATH9K_RX_DELIM_CRC_POST) | ||
259 | priv->debug.rx_stats.err_post_delim++; | ||
260 | if (rxs->rs_status & ATH9K_RX_DECRYPT_BUSY) | ||
261 | priv->debug.rx_stats.err_decrypt_busy++; | ||
262 | |||
263 | if (rxs->rs_status & ATH9K_RXERR_PHY) { | ||
264 | priv->debug.rx_stats.err_phy++; | ||
265 | if (rxs->rs_phyerr < ATH9K_PHYERR_MAX) | ||
266 | RX_PHY_ERR_INC(rxs->rs_phyerr); | ||
267 | } | ||
268 | |||
269 | #undef RX_PHY_ERR_INC | ||
270 | } | 249 | } |
271 | 250 | ||
272 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | 251 | static ssize_t read_file_skb_rx(struct file *file, char __user *user_buf, |
273 | size_t count, loff_t *ppos) | 252 | size_t count, loff_t *ppos) |
274 | { | 253 | { |
275 | #define PHY_ERR(s, p) \ | ||
276 | len += scnprintf(buf + len, size - len, "%20s : %10u\n", s, \ | ||
277 | priv->debug.rx_stats.err_phy_stats[p]); | ||
278 | |||
279 | struct ath9k_htc_priv *priv = file->private_data; | 254 | struct ath9k_htc_priv *priv = file->private_data; |
280 | char *buf; | 255 | char *buf; |
281 | unsigned int len = 0, size = 1500; | 256 | unsigned int len = 0, size = 1500; |
@@ -287,63 +262,13 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
287 | 262 | ||
288 | len += scnprintf(buf + len, size - len, | 263 | len += scnprintf(buf + len, size - len, |
289 | "%20s : %10u\n", "SKBs allocated", | 264 | "%20s : %10u\n", "SKBs allocated", |
290 | priv->debug.rx_stats.skb_allocated); | 265 | priv->debug.skbrx_stats.skb_allocated); |
291 | len += scnprintf(buf + len, size - len, | 266 | len += scnprintf(buf + len, size - len, |
292 | "%20s : %10u\n", "SKBs completed", | 267 | "%20s : %10u\n", "SKBs completed", |
293 | priv->debug.rx_stats.skb_completed); | 268 | priv->debug.skbrx_stats.skb_completed); |
294 | len += scnprintf(buf + len, size - len, | 269 | len += scnprintf(buf + len, size - len, |
295 | "%20s : %10u\n", "SKBs Dropped", | 270 | "%20s : %10u\n", "SKBs Dropped", |
296 | priv->debug.rx_stats.skb_dropped); | 271 | priv->debug.skbrx_stats.skb_dropped); |
297 | |||
298 | len += scnprintf(buf + len, size - len, | ||
299 | "%20s : %10u\n", "CRC ERR", | ||
300 | priv->debug.rx_stats.err_crc); | ||
301 | len += scnprintf(buf + len, size - len, | ||
302 | "%20s : %10u\n", "DECRYPT CRC ERR", | ||
303 | priv->debug.rx_stats.err_decrypt_crc); | ||
304 | len += scnprintf(buf + len, size - len, | ||
305 | "%20s : %10u\n", "MIC ERR", | ||
306 | priv->debug.rx_stats.err_mic); | ||
307 | len += scnprintf(buf + len, size - len, | ||
308 | "%20s : %10u\n", "PRE-DELIM CRC ERR", | ||
309 | priv->debug.rx_stats.err_pre_delim); | ||
310 | len += scnprintf(buf + len, size - len, | ||
311 | "%20s : %10u\n", "POST-DELIM CRC ERR", | ||
312 | priv->debug.rx_stats.err_post_delim); | ||
313 | len += scnprintf(buf + len, size - len, | ||
314 | "%20s : %10u\n", "DECRYPT BUSY ERR", | ||
315 | priv->debug.rx_stats.err_decrypt_busy); | ||
316 | len += scnprintf(buf + len, size - len, | ||
317 | "%20s : %10u\n", "TOTAL PHY ERR", | ||
318 | priv->debug.rx_stats.err_phy); | ||
319 | |||
320 | |||
321 | PHY_ERR("UNDERRUN", ATH9K_PHYERR_UNDERRUN); | ||
322 | PHY_ERR("TIMING", ATH9K_PHYERR_TIMING); | ||
323 | PHY_ERR("PARITY", ATH9K_PHYERR_PARITY); | ||
324 | PHY_ERR("RATE", ATH9K_PHYERR_RATE); | ||
325 | PHY_ERR("LENGTH", ATH9K_PHYERR_LENGTH); | ||
326 | PHY_ERR("RADAR", ATH9K_PHYERR_RADAR); | ||
327 | PHY_ERR("SERVICE", ATH9K_PHYERR_SERVICE); | ||
328 | PHY_ERR("TOR", ATH9K_PHYERR_TOR); | ||
329 | PHY_ERR("OFDM-TIMING", ATH9K_PHYERR_OFDM_TIMING); | ||
330 | PHY_ERR("OFDM-SIGNAL-PARITY", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); | ||
331 | PHY_ERR("OFDM-RATE", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); | ||
332 | PHY_ERR("OFDM-LENGTH", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); | ||
333 | PHY_ERR("OFDM-POWER-DROP", ATH9K_PHYERR_OFDM_POWER_DROP); | ||
334 | PHY_ERR("OFDM-SERVICE", ATH9K_PHYERR_OFDM_SERVICE); | ||
335 | PHY_ERR("OFDM-RESTART", ATH9K_PHYERR_OFDM_RESTART); | ||
336 | PHY_ERR("FALSE-RADAR-EXT", ATH9K_PHYERR_FALSE_RADAR_EXT); | ||
337 | PHY_ERR("CCK-TIMING", ATH9K_PHYERR_CCK_TIMING); | ||
338 | PHY_ERR("CCK-HEADER-CRC", ATH9K_PHYERR_CCK_HEADER_CRC); | ||
339 | PHY_ERR("CCK-RATE", ATH9K_PHYERR_CCK_RATE_ILLEGAL); | ||
340 | PHY_ERR("CCK-SERVICE", ATH9K_PHYERR_CCK_SERVICE); | ||
341 | PHY_ERR("CCK-RESTART", ATH9K_PHYERR_CCK_RESTART); | ||
342 | PHY_ERR("CCK-LENGTH", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); | ||
343 | PHY_ERR("CCK-POWER-DROP", ATH9K_PHYERR_CCK_POWER_DROP); | ||
344 | PHY_ERR("HT-CRC", ATH9K_PHYERR_HT_CRC_ERROR); | ||
345 | PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); | ||
346 | PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL); | ||
347 | 272 | ||
348 | if (len > size) | 273 | if (len > size) |
349 | len = size; | 274 | len = size; |
@@ -352,12 +277,10 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
352 | kfree(buf); | 277 | kfree(buf); |
353 | 278 | ||
354 | return retval; | 279 | return retval; |
355 | |||
356 | #undef PHY_ERR | ||
357 | } | 280 | } |
358 | 281 | ||
359 | static const struct file_operations fops_recv = { | 282 | static const struct file_operations fops_skb_rx = { |
360 | .read = read_file_recv, | 283 | .read = read_file_skb_rx, |
361 | .open = simple_open, | 284 | .open = simple_open, |
362 | .owner = THIS_MODULE, | 285 | .owner = THIS_MODULE, |
363 | .llseek = default_llseek, | 286 | .llseek = default_llseek, |
@@ -486,423 +409,6 @@ static const struct file_operations fops_debug = { | |||
486 | .llseek = default_llseek, | 409 | .llseek = default_llseek, |
487 | }; | 410 | }; |
488 | 411 | ||
489 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | ||
490 | size_t count, loff_t *ppos) | ||
491 | { | ||
492 | struct ath9k_htc_priv *priv = file->private_data; | ||
493 | struct ath_common *common = ath9k_hw_common(priv->ah); | ||
494 | struct base_eep_header *pBase = NULL; | ||
495 | unsigned int len = 0, size = 1500; | ||
496 | ssize_t retval = 0; | ||
497 | char *buf; | ||
498 | |||
499 | pBase = ath9k_htc_get_eeprom_base(priv); | ||
500 | |||
501 | if (pBase == NULL) { | ||
502 | ath_err(common, "Unknown EEPROM type\n"); | ||
503 | return 0; | ||
504 | } | ||
505 | |||
506 | buf = kzalloc(size, GFP_KERNEL); | ||
507 | if (buf == NULL) | ||
508 | return -ENOMEM; | ||
509 | |||
510 | len += scnprintf(buf + len, size - len, | ||
511 | "%20s : %10d\n", "Major Version", | ||
512 | pBase->version >> 12); | ||
513 | len += scnprintf(buf + len, size - len, | ||
514 | "%20s : %10d\n", "Minor Version", | ||
515 | pBase->version & 0xFFF); | ||
516 | len += scnprintf(buf + len, size - len, | ||
517 | "%20s : %10d\n", "Checksum", | ||
518 | pBase->checksum); | ||
519 | len += scnprintf(buf + len, size - len, | ||
520 | "%20s : %10d\n", "Length", | ||
521 | pBase->length); | ||
522 | len += scnprintf(buf + len, size - len, | ||
523 | "%20s : %10d\n", "RegDomain1", | ||
524 | pBase->regDmn[0]); | ||
525 | len += scnprintf(buf + len, size - len, | ||
526 | "%20s : %10d\n", "RegDomain2", | ||
527 | pBase->regDmn[1]); | ||
528 | len += scnprintf(buf + len, size - len, | ||
529 | "%20s : %10d\n", | ||
530 | "TX Mask", pBase->txMask); | ||
531 | len += scnprintf(buf + len, size - len, | ||
532 | "%20s : %10d\n", | ||
533 | "RX Mask", pBase->rxMask); | ||
534 | len += scnprintf(buf + len, size - len, | ||
535 | "%20s : %10d\n", | ||
536 | "Allow 5GHz", | ||
537 | !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); | ||
538 | len += scnprintf(buf + len, size - len, | ||
539 | "%20s : %10d\n", | ||
540 | "Allow 2GHz", | ||
541 | !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); | ||
542 | len += scnprintf(buf + len, size - len, | ||
543 | "%20s : %10d\n", | ||
544 | "Disable 2GHz HT20", | ||
545 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT20)); | ||
546 | len += scnprintf(buf + len, size - len, | ||
547 | "%20s : %10d\n", | ||
548 | "Disable 2GHz HT40", | ||
549 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT40)); | ||
550 | len += scnprintf(buf + len, size - len, | ||
551 | "%20s : %10d\n", | ||
552 | "Disable 5Ghz HT20", | ||
553 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT20)); | ||
554 | len += scnprintf(buf + len, size - len, | ||
555 | "%20s : %10d\n", | ||
556 | "Disable 5Ghz HT40", | ||
557 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT40)); | ||
558 | len += scnprintf(buf + len, size - len, | ||
559 | "%20s : %10d\n", | ||
560 | "Big Endian", | ||
561 | !!(pBase->eepMisc & 0x01)); | ||
562 | len += scnprintf(buf + len, size - len, | ||
563 | "%20s : %10d\n", | ||
564 | "Cal Bin Major Ver", | ||
565 | (pBase->binBuildNumber >> 24) & 0xFF); | ||
566 | len += scnprintf(buf + len, size - len, | ||
567 | "%20s : %10d\n", | ||
568 | "Cal Bin Minor Ver", | ||
569 | (pBase->binBuildNumber >> 16) & 0xFF); | ||
570 | len += scnprintf(buf + len, size - len, | ||
571 | "%20s : %10d\n", | ||
572 | "Cal Bin Build", | ||
573 | (pBase->binBuildNumber >> 8) & 0xFF); | ||
574 | |||
575 | /* | ||
576 | * UB91 specific data. | ||
577 | */ | ||
578 | if (AR_SREV_9271(priv->ah)) { | ||
579 | struct base_eep_header_4k *pBase4k = | ||
580 | &priv->ah->eeprom.map4k.baseEepHeader; | ||
581 | |||
582 | len += scnprintf(buf + len, size - len, | ||
583 | "%20s : %10d\n", | ||
584 | "TX Gain type", | ||
585 | pBase4k->txGainType); | ||
586 | } | ||
587 | |||
588 | /* | ||
589 | * UB95 specific data. | ||
590 | */ | ||
591 | if (priv->ah->hw_version.usbdev == AR9287_USB) { | ||
592 | struct base_eep_ar9287_header *pBase9287 = | ||
593 | &priv->ah->eeprom.map9287.baseEepHeader; | ||
594 | |||
595 | len += scnprintf(buf + len, size - len, | ||
596 | "%20s : %10ddB\n", | ||
597 | "Power Table Offset", | ||
598 | pBase9287->pwrTableOffset); | ||
599 | |||
600 | len += scnprintf(buf + len, size - len, | ||
601 | "%20s : %10d\n", | ||
602 | "OpenLoop Power Ctrl", | ||
603 | pBase9287->openLoopPwrCntl); | ||
604 | } | ||
605 | |||
606 | len += scnprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress", | ||
607 | pBase->macAddr); | ||
608 | if (len > size) | ||
609 | len = size; | ||
610 | |||
611 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
612 | kfree(buf); | ||
613 | |||
614 | return retval; | ||
615 | } | ||
616 | |||
617 | static const struct file_operations fops_base_eeprom = { | ||
618 | .read = read_file_base_eeprom, | ||
619 | .open = simple_open, | ||
620 | .owner = THIS_MODULE, | ||
621 | .llseek = default_llseek, | ||
622 | }; | ||
623 | |||
624 | static ssize_t read_4k_modal_eeprom(struct file *file, | ||
625 | char __user *user_buf, | ||
626 | size_t count, loff_t *ppos) | ||
627 | { | ||
628 | #define PR_EEP(_s, _val) \ | ||
629 | do { \ | ||
630 | len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ | ||
631 | _s, (_val)); \ | ||
632 | } while (0) | ||
633 | |||
634 | struct ath9k_htc_priv *priv = file->private_data; | ||
635 | struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader; | ||
636 | unsigned int len = 0, size = 2048; | ||
637 | ssize_t retval = 0; | ||
638 | char *buf; | ||
639 | |||
640 | buf = kzalloc(size, GFP_KERNEL); | ||
641 | if (buf == NULL) | ||
642 | return -ENOMEM; | ||
643 | |||
644 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
645 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
646 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
647 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
648 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
649 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
650 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
651 | PR_EEP("PGA Desired size", pModal->pgaDesiredSize); | ||
652 | PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); | ||
653 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
654 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
655 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
656 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
657 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
658 | PR_EEP("xpdGain", pModal->xpdGain); | ||
659 | PR_EEP("External PD", pModal->xpd); | ||
660 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
661 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
662 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
663 | PR_EEP("O/D Bias Version", pModal->version); | ||
664 | PR_EEP("CCK OutputBias", pModal->ob_0); | ||
665 | PR_EEP("BPSK OutputBias", pModal->ob_1); | ||
666 | PR_EEP("QPSK OutputBias", pModal->ob_2); | ||
667 | PR_EEP("16QAM OutputBias", pModal->ob_3); | ||
668 | PR_EEP("64QAM OutputBias", pModal->ob_4); | ||
669 | PR_EEP("CCK Driver1_Bias", pModal->db1_0); | ||
670 | PR_EEP("BPSK Driver1_Bias", pModal->db1_1); | ||
671 | PR_EEP("QPSK Driver1_Bias", pModal->db1_2); | ||
672 | PR_EEP("16QAM Driver1_Bias", pModal->db1_3); | ||
673 | PR_EEP("64QAM Driver1_Bias", pModal->db1_4); | ||
674 | PR_EEP("CCK Driver2_Bias", pModal->db2_0); | ||
675 | PR_EEP("BPSK Driver2_Bias", pModal->db2_1); | ||
676 | PR_EEP("QPSK Driver2_Bias", pModal->db2_2); | ||
677 | PR_EEP("16QAM Driver2_Bias", pModal->db2_3); | ||
678 | PR_EEP("64QAM Driver2_Bias", pModal->db2_4); | ||
679 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
680 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
681 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
682 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
683 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
684 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
685 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
686 | PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); | ||
687 | PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); | ||
688 | PR_EEP("Ant. Diversity ctl1", pModal->antdiv_ctl1); | ||
689 | PR_EEP("Ant. Diversity ctl2", pModal->antdiv_ctl2); | ||
690 | PR_EEP("TX Diversity", pModal->tx_diversity); | ||
691 | |||
692 | if (len > size) | ||
693 | len = size; | ||
694 | |||
695 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
696 | kfree(buf); | ||
697 | |||
698 | return retval; | ||
699 | |||
700 | #undef PR_EEP | ||
701 | } | ||
702 | |||
703 | static ssize_t read_def_modal_eeprom(struct file *file, | ||
704 | char __user *user_buf, | ||
705 | size_t count, loff_t *ppos) | ||
706 | { | ||
707 | #define PR_EEP(_s, _val) \ | ||
708 | do { \ | ||
709 | if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \ | ||
710 | pModal = &priv->ah->eeprom.def.modalHeader[1]; \ | ||
711 | len += scnprintf(buf + len, size - len, "%20s : %8d%7s", \ | ||
712 | _s, (_val), "|"); \ | ||
713 | } \ | ||
714 | if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \ | ||
715 | pModal = &priv->ah->eeprom.def.modalHeader[0]; \ | ||
716 | len += scnprintf(buf + len, size - len, "%9d\n",\ | ||
717 | (_val)); \ | ||
718 | } \ | ||
719 | } while (0) | ||
720 | |||
721 | struct ath9k_htc_priv *priv = file->private_data; | ||
722 | struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader; | ||
723 | struct modal_eep_header *pModal = NULL; | ||
724 | unsigned int len = 0, size = 3500; | ||
725 | ssize_t retval = 0; | ||
726 | char *buf; | ||
727 | |||
728 | buf = kzalloc(size, GFP_KERNEL); | ||
729 | if (buf == NULL) | ||
730 | return -ENOMEM; | ||
731 | |||
732 | len += scnprintf(buf + len, size - len, | ||
733 | "%31s %15s\n", "2G", "5G"); | ||
734 | len += scnprintf(buf + len, size - len, | ||
735 | "%32s %16s\n", "====", "====\n"); | ||
736 | |||
737 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
738 | PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); | ||
739 | PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]); | ||
740 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
741 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
742 | PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); | ||
743 | PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]); | ||
744 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
745 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
746 | PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); | ||
747 | PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]); | ||
748 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
749 | PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); | ||
750 | PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]); | ||
751 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
752 | PR_EEP("PGA Desired size", pModal->pgaDesiredSize); | ||
753 | PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); | ||
754 | PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]); | ||
755 | PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]); | ||
756 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
757 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
758 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
759 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
760 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
761 | PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); | ||
762 | PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]); | ||
763 | PR_EEP("xpdGain", pModal->xpdGain); | ||
764 | PR_EEP("External PD", pModal->xpd); | ||
765 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
766 | PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); | ||
767 | PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]); | ||
768 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
769 | PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); | ||
770 | PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]); | ||
771 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
772 | PR_EEP("Chain0 OutputBias", pModal->ob); | ||
773 | PR_EEP("Chain0 DriverBias", pModal->db); | ||
774 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
775 | PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain); | ||
776 | PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain); | ||
777 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
778 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
779 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
780 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
781 | PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); | ||
782 | PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]); | ||
783 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
784 | PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); | ||
785 | PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]); | ||
786 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
787 | PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); | ||
788 | PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]); | ||
789 | PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]); | ||
790 | PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); | ||
791 | PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]); | ||
792 | PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]); | ||
793 | PR_EEP("Chain1 OutputBias", pModal->ob_ch1); | ||
794 | PR_EEP("Chain1 DriverBias", pModal->db_ch1); | ||
795 | PR_EEP("LNA Control", pModal->lna_ctl); | ||
796 | PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]); | ||
797 | PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]); | ||
798 | PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]); | ||
799 | |||
800 | if (len > size) | ||
801 | len = size; | ||
802 | |||
803 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
804 | kfree(buf); | ||
805 | |||
806 | return retval; | ||
807 | |||
808 | #undef PR_EEP | ||
809 | } | ||
810 | |||
811 | static ssize_t read_9287_modal_eeprom(struct file *file, | ||
812 | char __user *user_buf, | ||
813 | size_t count, loff_t *ppos) | ||
814 | { | ||
815 | #define PR_EEP(_s, _val) \ | ||
816 | do { \ | ||
817 | len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ | ||
818 | _s, (_val)); \ | ||
819 | } while (0) | ||
820 | |||
821 | struct ath9k_htc_priv *priv = file->private_data; | ||
822 | struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader; | ||
823 | unsigned int len = 0, size = 3000; | ||
824 | ssize_t retval = 0; | ||
825 | char *buf; | ||
826 | |||
827 | buf = kzalloc(size, GFP_KERNEL); | ||
828 | if (buf == NULL) | ||
829 | return -ENOMEM; | ||
830 | |||
831 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
832 | PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); | ||
833 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
834 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
835 | PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); | ||
836 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
837 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
838 | PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); | ||
839 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
840 | PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); | ||
841 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
842 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
843 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
844 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
845 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
846 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
847 | PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); | ||
848 | PR_EEP("xpdGain", pModal->xpdGain); | ||
849 | PR_EEP("External PD", pModal->xpd); | ||
850 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
851 | PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); | ||
852 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
853 | PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); | ||
854 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
855 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
856 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
857 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
858 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
859 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
860 | PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); | ||
861 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
862 | PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); | ||
863 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
864 | PR_EEP("AR92x7 Version", pModal->version); | ||
865 | PR_EEP("DriverBias1", pModal->db1); | ||
866 | PR_EEP("DriverBias2", pModal->db1); | ||
867 | PR_EEP("CCK OutputBias", pModal->ob_cck); | ||
868 | PR_EEP("PSK OutputBias", pModal->ob_psk); | ||
869 | PR_EEP("QAM OutputBias", pModal->ob_qam); | ||
870 | PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off); | ||
871 | |||
872 | if (len > size) | ||
873 | len = size; | ||
874 | |||
875 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
876 | kfree(buf); | ||
877 | |||
878 | return retval; | ||
879 | |||
880 | #undef PR_EEP | ||
881 | } | ||
882 | |||
883 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | ||
884 | size_t count, loff_t *ppos) | ||
885 | { | ||
886 | struct ath9k_htc_priv *priv = file->private_data; | ||
887 | |||
888 | if (AR_SREV_9271(priv->ah)) | ||
889 | return read_4k_modal_eeprom(file, user_buf, count, ppos); | ||
890 | else if (priv->ah->hw_version.usbdev == AR9280_USB) | ||
891 | return read_def_modal_eeprom(file, user_buf, count, ppos); | ||
892 | else if (priv->ah->hw_version.usbdev == AR9287_USB) | ||
893 | return read_9287_modal_eeprom(file, user_buf, count, ppos); | ||
894 | |||
895 | return 0; | ||
896 | } | ||
897 | |||
898 | static const struct file_operations fops_modal_eeprom = { | ||
899 | .read = read_file_modal_eeprom, | ||
900 | .open = simple_open, | ||
901 | .owner = THIS_MODULE, | ||
902 | .llseek = default_llseek, | ||
903 | }; | ||
904 | |||
905 | |||
906 | /* Ethtool support for get-stats */ | 412 | /* Ethtool support for get-stats */ |
907 | #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" | 413 | #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" |
908 | static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = { | 414 | static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = { |
@@ -947,6 +453,8 @@ int ath9k_htc_get_et_sset_count(struct ieee80211_hw *hw, | |||
947 | 453 | ||
948 | #define STXBASE priv->debug.tx_stats | 454 | #define STXBASE priv->debug.tx_stats |
949 | #define SRXBASE priv->debug.rx_stats | 455 | #define SRXBASE priv->debug.rx_stats |
456 | #define SKBTXBASE priv->debug.tx_stats | ||
457 | #define SKBRXBASE priv->debug.skbrx_stats | ||
950 | #define ASTXQ(a) \ | 458 | #define ASTXQ(a) \ |
951 | data[i++] = STXBASE.a[IEEE80211_AC_BE]; \ | 459 | data[i++] = STXBASE.a[IEEE80211_AC_BE]; \ |
952 | data[i++] = STXBASE.a[IEEE80211_AC_BK]; \ | 460 | data[i++] = STXBASE.a[IEEE80211_AC_BK]; \ |
@@ -960,24 +468,24 @@ void ath9k_htc_get_et_stats(struct ieee80211_hw *hw, | |||
960 | struct ath9k_htc_priv *priv = hw->priv; | 468 | struct ath9k_htc_priv *priv = hw->priv; |
961 | int i = 0; | 469 | int i = 0; |
962 | 470 | ||
963 | data[i++] = STXBASE.skb_success; | 471 | data[i++] = SKBTXBASE.skb_success; |
964 | data[i++] = STXBASE.skb_success_bytes; | 472 | data[i++] = SKBTXBASE.skb_success_bytes; |
965 | data[i++] = SRXBASE.skb_completed; | 473 | data[i++] = SKBRXBASE.skb_completed; |
966 | data[i++] = SRXBASE.skb_completed_bytes; | 474 | data[i++] = SKBRXBASE.skb_completed_bytes; |
967 | 475 | ||
968 | ASTXQ(queue_stats); | 476 | ASTXQ(queue_stats); |
969 | 477 | ||
970 | data[i++] = SRXBASE.err_crc; | 478 | data[i++] = SRXBASE.crc_err; |
971 | data[i++] = SRXBASE.err_decrypt_crc; | 479 | data[i++] = SRXBASE.decrypt_crc_err; |
972 | data[i++] = SRXBASE.err_phy; | 480 | data[i++] = SRXBASE.phy_err; |
973 | data[i++] = SRXBASE.err_mic; | 481 | data[i++] = SRXBASE.mic_err; |
974 | data[i++] = SRXBASE.err_pre_delim; | 482 | data[i++] = SRXBASE.pre_delim_crc_err; |
975 | data[i++] = SRXBASE.err_post_delim; | 483 | data[i++] = SRXBASE.post_delim_crc_err; |
976 | data[i++] = SRXBASE.err_decrypt_busy; | 484 | data[i++] = SRXBASE.decrypt_busy_err; |
977 | 485 | ||
978 | data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_RADAR]; | 486 | data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_RADAR]; |
979 | data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_OFDM_TIMING]; | 487 | data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]; |
980 | data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_CCK_TIMING]; | 488 | data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_CCK_TIMING]; |
981 | 489 | ||
982 | WARN_ON(i != ATH9K_HTC_SSTATS_LEN); | 490 | WARN_ON(i != ATH9K_HTC_SSTATS_LEN); |
983 | } | 491 | } |
@@ -1001,18 +509,21 @@ int ath9k_htc_init_debug(struct ath_hw *ah) | |||
1001 | priv, &fops_tgt_rx_stats); | 509 | priv, &fops_tgt_rx_stats); |
1002 | debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, | 510 | debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, |
1003 | priv, &fops_xmit); | 511 | priv, &fops_xmit); |
1004 | debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy, | 512 | debugfs_create_file("skb_rx", S_IRUSR, priv->debug.debugfs_phy, |
1005 | priv, &fops_recv); | 513 | priv, &fops_skb_rx); |
514 | |||
515 | ath9k_cmn_debug_recv(priv->debug.debugfs_phy, &priv->debug.rx_stats); | ||
516 | ath9k_cmn_debug_phy_err(priv->debug.debugfs_phy, &priv->debug.rx_stats); | ||
517 | |||
1006 | debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, | 518 | debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, |
1007 | priv, &fops_slot); | 519 | priv, &fops_slot); |
1008 | debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, | 520 | debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, |
1009 | priv, &fops_queue); | 521 | priv, &fops_queue); |
1010 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, | 522 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, |
1011 | priv, &fops_debug); | 523 | priv, &fops_debug); |
1012 | debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, | 524 | |
1013 | priv, &fops_base_eeprom); | 525 | ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); |
1014 | debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy, | 526 | ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); |
1015 | priv, &fops_modal_eeprom); | ||
1016 | 527 | ||
1017 | return 0; | 528 | return 0; |
1018 | } | 529 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 289f3d8924b5..bb86eb2ffc95 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -996,8 +996,6 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | |||
996 | goto rx_next; | 996 | goto rx_next; |
997 | } | 997 | } |
998 | 998 | ||
999 | ath9k_htc_err_stat_rx(priv, rxstatus); | ||
1000 | |||
1001 | /* Get the RX status information */ | 999 | /* Get the RX status information */ |
1002 | 1000 | ||
1003 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); | 1001 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); |
@@ -1005,6 +1003,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | |||
1005 | /* Copy everything from ath_htc_rx_status (HTC_RX_FRAME_HEADER). | 1003 | /* Copy everything from ath_htc_rx_status (HTC_RX_FRAME_HEADER). |
1006 | * After this, we can drop this part of skb. */ | 1004 | * After this, we can drop this part of skb. */ |
1007 | rx_status_htc_to_ath(&rx_stats, rxstatus); | 1005 | rx_status_htc_to_ath(&rx_stats, rxstatus); |
1006 | ath9k_htc_err_stat_rx(priv, &rx_stats); | ||
1008 | rx_status->mactime = be64_to_cpu(rxstatus->rs_tstamp); | 1007 | rx_status->mactime = be64_to_cpu(rxstatus->rs_tstamp); |
1009 | skb_pull(skb, HTC_RX_FRAME_HEADER_SIZE); | 1008 | skb_pull(skb, HTC_RX_FRAME_HEADER_SIZE); |
1010 | 1009 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index c8a9dfab1fee..2a8ed8375ec0 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "ar9003_mac.h" | 26 | #include "ar9003_mac.h" |
27 | #include "ar9003_mci.h" | 27 | #include "ar9003_mci.h" |
28 | #include "ar9003_phy.h" | 28 | #include "ar9003_phy.h" |
29 | #include "debug.h" | ||
30 | #include "ath9k.h" | 29 | #include "ath9k.h" |
31 | 30 | ||
32 | static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); | 31 | static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); |
@@ -246,6 +245,8 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah) | |||
246 | return; | 245 | return; |
247 | case AR9300_DEVID_AR953X: | 246 | case AR9300_DEVID_AR953X: |
248 | ah->hw_version.macVersion = AR_SREV_VERSION_9531; | 247 | ah->hw_version.macVersion = AR_SREV_VERSION_9531; |
248 | if (ah->get_mac_revision) | ||
249 | ah->hw_version.macRev = ah->get_mac_revision(); | ||
249 | return; | 250 | return; |
250 | } | 251 | } |
251 | 252 | ||
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 21e174cfc909..1af77081181e 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -508,7 +508,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, | |||
508 | sc->tx99_power = MAX_RATE_POWER + 1; | 508 | sc->tx99_power = MAX_RATE_POWER + 1; |
509 | init_waitqueue_head(&sc->tx_wait); | 509 | init_waitqueue_head(&sc->tx_wait); |
510 | 510 | ||
511 | if (!pdata) { | 511 | if (!pdata || pdata->use_eeprom) { |
512 | ah->ah_flags |= AH_USE_EEPROM; | 512 | ah->ah_flags |= AH_USE_EEPROM; |
513 | sc->sc_ah->led_pin = -1; | 513 | sc->sc_ah->led_pin = -1; |
514 | } else { | 514 | } else { |
@@ -714,7 +714,8 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
714 | if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) | 714 | if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) |
715 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; | 715 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; |
716 | 716 | ||
717 | hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR; | 717 | hw->wiphy->features |= (NL80211_FEATURE_ACTIVE_MONITOR | |
718 | NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE); | ||
718 | 719 | ||
719 | if (!config_enabled(CONFIG_ATH9K_TX99)) { | 720 | if (!config_enabled(CONFIG_ATH9K_TX99)) { |
720 | hw->wiphy->interface_modes = | 721 | hw->wiphy->interface_modes = |
@@ -786,6 +787,9 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, | |||
786 | common = ath9k_hw_common(ah); | 787 | common = ath9k_hw_common(ah); |
787 | ath9k_set_hw_capab(sc, hw); | 788 | ath9k_set_hw_capab(sc, hw); |
788 | 789 | ||
790 | /* Will be cleared in ath9k_start() */ | ||
791 | set_bit(ATH_OP_INVALID, &common->op_flags); | ||
792 | |||
789 | /* Initialize regulatory */ | 793 | /* Initialize regulatory */ |
790 | error = ath_regd_init(&common->regulatory, sc->hw->wiphy, | 794 | error = ath_regd_init(&common->regulatory, sc->hw->wiphy, |
791 | ath9k_reg_notifier); | 795 | ath9k_reg_notifier); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 22c9e5471f9c..8d7b9b66fefa 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1989,7 +1989,8 @@ static bool ath9k_has_tx_pending(struct ath_softc *sc) | |||
1989 | return !!npend; | 1989 | return !!npend; |
1990 | } | 1990 | } |
1991 | 1991 | ||
1992 | static void ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1992 | static void ath9k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1993 | u32 queues, bool drop) | ||
1993 | { | 1994 | { |
1994 | struct ath_softc *sc = hw->priv; | 1995 | struct ath_softc *sc = hw->priv; |
1995 | struct ath_hw *ah = sc->sc_ah; | 1996 | struct ath_hw *ah = sc->sc_ah; |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 25304adece57..c1e82f779544 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -686,7 +686,7 @@ static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data) | |||
686 | struct ath_softc *sc = (struct ath_softc *) common->priv; | 686 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
687 | struct ath9k_platform_data *pdata = sc->dev->platform_data; | 687 | struct ath9k_platform_data *pdata = sc->dev->platform_data; |
688 | 688 | ||
689 | if (pdata) { | 689 | if (pdata && !pdata->use_eeprom) { |
690 | if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { | 690 | if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { |
691 | ath_err(common, | 691 | ath_err(common, |
692 | "%s: eeprom read failed, offset %08x is out of range\n", | 692 | "%s: eeprom read failed, offset %08x is out of range\n", |
@@ -784,7 +784,6 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
784 | { | 784 | { |
785 | struct ath_softc *sc; | 785 | struct ath_softc *sc; |
786 | struct ieee80211_hw *hw; | 786 | struct ieee80211_hw *hw; |
787 | struct ath_common *common; | ||
788 | u8 csz; | 787 | u8 csz; |
789 | u32 val; | 788 | u32 val; |
790 | int ret = 0; | 789 | int ret = 0; |
@@ -877,10 +876,6 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
877 | wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", | 876 | wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", |
878 | hw_name, (unsigned long)sc->mem, pdev->irq); | 877 | hw_name, (unsigned long)sc->mem, pdev->irq); |
879 | 878 | ||
880 | /* Will be cleared in ath9k_start() */ | ||
881 | common = ath9k_hw_common(sc->sc_ah); | ||
882 | set_bit(ATH_OP_INVALID, &common->op_flags); | ||
883 | |||
884 | return 0; | 879 | return 0; |
885 | 880 | ||
886 | err_init: | 881 | err_init: |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index a01efd3e741e..43ae199601f7 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -538,8 +538,8 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb) | |||
538 | sc->ps_flags &= ~PS_BEACON_SYNC; | 538 | sc->ps_flags &= ~PS_BEACON_SYNC; |
539 | ath_dbg(common, PS, | 539 | ath_dbg(common, PS, |
540 | "Reconfigure beacon timers based on synchronized timestamp\n"); | 540 | "Reconfigure beacon timers based on synchronized timestamp\n"); |
541 | ath9k_set_beacon(sc); | 541 | if (!(WARN_ON_ONCE(sc->cur_beacon_conf.beacon_interval == 0))) |
542 | 542 | ath9k_set_beacon(sc); | |
543 | if (sc->p2p_ps_vif) | 543 | if (sc->p2p_ps_vif) |
544 | ath9k_update_p2p_ps(sc, sc->p2p_ps_vif->vif); | 544 | ath9k_update_p2p_ps(sc, sc->p2p_ps_vif->vif); |
545 | } | 545 | } |
@@ -978,6 +978,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
978 | u64 tsf = 0; | 978 | u64 tsf = 0; |
979 | unsigned long flags; | 979 | unsigned long flags; |
980 | dma_addr_t new_buf_addr; | 980 | dma_addr_t new_buf_addr; |
981 | unsigned int budget = 512; | ||
981 | 982 | ||
982 | if (edma) | 983 | if (edma) |
983 | dma_type = DMA_BIDIRECTIONAL; | 984 | dma_type = DMA_BIDIRECTIONAL; |
@@ -1116,15 +1117,17 @@ requeue_drop_frag: | |||
1116 | } | 1117 | } |
1117 | requeue: | 1118 | requeue: |
1118 | list_add_tail(&bf->list, &sc->rx.rxbuf); | 1119 | list_add_tail(&bf->list, &sc->rx.rxbuf); |
1119 | if (flush) | ||
1120 | continue; | ||
1121 | 1120 | ||
1122 | if (edma) { | 1121 | if (edma) { |
1123 | ath_rx_edma_buf_link(sc, qtype); | 1122 | ath_rx_edma_buf_link(sc, qtype); |
1124 | } else { | 1123 | } else { |
1125 | ath_rx_buf_relink(sc, bf); | 1124 | ath_rx_buf_relink(sc, bf); |
1126 | ath9k_hw_rxena(ah); | 1125 | if (!flush) |
1126 | ath9k_hw_rxena(ah); | ||
1127 | } | 1127 | } |
1128 | |||
1129 | if (!budget--) | ||
1130 | break; | ||
1128 | } while (1); | 1131 | } while (1); |
1129 | 1132 | ||
1130 | if (!(ah->imask & ATH9K_INT_RXEOL)) { | 1133 | if (!(ah->imask & ATH9K_INT_RXEOL)) { |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 87cbec47fb48..66acb2cbd9df 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -107,9 +107,6 @@ static void ath_tx_queue_tid(struct ath_txq *txq, struct ath_atx_tid *tid) | |||
107 | { | 107 | { |
108 | struct ath_atx_ac *ac = tid->ac; | 108 | struct ath_atx_ac *ac = tid->ac; |
109 | 109 | ||
110 | if (tid->paused) | ||
111 | return; | ||
112 | |||
113 | if (tid->sched) | 110 | if (tid->sched) |
114 | return; | 111 | return; |
115 | 112 | ||
@@ -1407,7 +1404,6 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1407 | ath_tx_tid_change_state(sc, txtid); | 1404 | ath_tx_tid_change_state(sc, txtid); |
1408 | 1405 | ||
1409 | txtid->active = true; | 1406 | txtid->active = true; |
1410 | txtid->paused = true; | ||
1411 | *ssn = txtid->seq_start = txtid->seq_next; | 1407 | *ssn = txtid->seq_start = txtid->seq_next; |
1412 | txtid->bar_index = -1; | 1408 | txtid->bar_index = -1; |
1413 | 1409 | ||
@@ -1427,7 +1423,6 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | |||
1427 | 1423 | ||
1428 | ath_txq_lock(sc, txq); | 1424 | ath_txq_lock(sc, txq); |
1429 | txtid->active = false; | 1425 | txtid->active = false; |
1430 | txtid->paused = false; | ||
1431 | ath_tx_flush_tid(sc, txtid); | 1426 | ath_tx_flush_tid(sc, txtid); |
1432 | ath_tx_tid_change_state(sc, txtid); | 1427 | ath_tx_tid_change_state(sc, txtid); |
1433 | ath_txq_unlock_complete(sc, txq); | 1428 | ath_txq_unlock_complete(sc, txq); |
@@ -1487,7 +1482,7 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) | |||
1487 | ath_txq_lock(sc, txq); | 1482 | ath_txq_lock(sc, txq); |
1488 | ac->clear_ps_filter = true; | 1483 | ac->clear_ps_filter = true; |
1489 | 1484 | ||
1490 | if (!tid->paused && ath_tid_has_buffered(tid)) { | 1485 | if (ath_tid_has_buffered(tid)) { |
1491 | ath_tx_queue_tid(txq, tid); | 1486 | ath_tx_queue_tid(txq, tid); |
1492 | ath_txq_schedule(sc, txq); | 1487 | ath_txq_schedule(sc, txq); |
1493 | } | 1488 | } |
@@ -1510,7 +1505,6 @@ void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1510 | ath_txq_lock(sc, txq); | 1505 | ath_txq_lock(sc, txq); |
1511 | 1506 | ||
1512 | tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; | 1507 | tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; |
1513 | tid->paused = false; | ||
1514 | 1508 | ||
1515 | if (ath_tid_has_buffered(tid)) { | 1509 | if (ath_tid_has_buffered(tid)) { |
1516 | ath_tx_queue_tid(txq, tid); | 1510 | ath_tx_queue_tid(txq, tid); |
@@ -1544,8 +1538,6 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw, | |||
1544 | continue; | 1538 | continue; |
1545 | 1539 | ||
1546 | tid = ATH_AN_2_TID(an, i); | 1540 | tid = ATH_AN_2_TID(an, i); |
1547 | if (tid->paused) | ||
1548 | continue; | ||
1549 | 1541 | ||
1550 | ath_txq_lock(sc, tid->ac->txq); | 1542 | ath_txq_lock(sc, tid->ac->txq); |
1551 | while (nframes > 0) { | 1543 | while (nframes > 0) { |
@@ -1844,9 +1836,6 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) | |||
1844 | list_del(&tid->list); | 1836 | list_del(&tid->list); |
1845 | tid->sched = false; | 1837 | tid->sched = false; |
1846 | 1838 | ||
1847 | if (tid->paused) | ||
1848 | continue; | ||
1849 | |||
1850 | if (ath_tx_sched_aggr(sc, txq, tid, &stop)) | 1839 | if (ath_tx_sched_aggr(sc, txq, tid, &stop)) |
1851 | sent = true; | 1840 | sent = true; |
1852 | 1841 | ||
@@ -2698,7 +2687,6 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) | |||
2698 | tid->baw_size = WME_MAX_BA; | 2687 | tid->baw_size = WME_MAX_BA; |
2699 | tid->baw_head = tid->baw_tail = 0; | 2688 | tid->baw_head = tid->baw_tail = 0; |
2700 | tid->sched = false; | 2689 | tid->sched = false; |
2701 | tid->paused = false; | ||
2702 | tid->active = false; | 2690 | tid->active = false; |
2703 | __skb_queue_head_init(&tid->buf_q); | 2691 | __skb_queue_head_init(&tid->buf_q); |
2704 | __skb_queue_head_init(&tid->retry_q); | 2692 | __skb_queue_head_init(&tid->retry_q); |
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 4c8cdb097b65..f8ded84b7be8 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c | |||
@@ -1707,7 +1707,9 @@ found: | |||
1707 | return 0; | 1707 | return 0; |
1708 | } | 1708 | } |
1709 | 1709 | ||
1710 | static void carl9170_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1710 | static void carl9170_op_flush(struct ieee80211_hw *hw, |
1711 | struct ieee80211_vif *vif, | ||
1712 | u32 queues, bool drop) | ||
1711 | { | 1713 | { |
1712 | struct ar9170 *ar = hw->priv; | 1714 | struct ar9170 *ar = hw->priv; |
1713 | unsigned int vid; | 1715 | unsigned int vid; |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index 088d544ec63f..1c7d27bf4bf0 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -1,7 +1,8 @@ | |||
1 | config B43 | 1 | config B43 |
2 | tristate "Broadcom 43xx wireless support (mac80211 stack)" | 2 | tristate "Broadcom 43xx wireless support (mac80211 stack)" |
3 | depends on SSB_POSSIBLE && MAC80211 && HAS_DMA | 3 | depends on (BCMA_POSSIBLE || SSB_POSSIBLE) && MAC80211 && HAS_DMA |
4 | select SSB | 4 | select BCMA if B43_BCMA |
5 | select SSB if B43_SSB | ||
5 | select FW_LOADER | 6 | select FW_LOADER |
6 | ---help--- | 7 | ---help--- |
7 | b43 is a driver for the Broadcom 43xx series wireless devices. | 8 | b43 is a driver for the Broadcom 43xx series wireless devices. |
@@ -27,14 +28,33 @@ config B43 | |||
27 | If unsure, say M. | 28 | If unsure, say M. |
28 | 29 | ||
29 | config B43_BCMA | 30 | config B43_BCMA |
30 | bool "Support for BCMA bus" | 31 | bool |
31 | depends on B43 && (BCMA = y || BCMA = B43) | ||
32 | default y | ||
33 | 32 | ||
34 | config B43_SSB | 33 | config B43_SSB |
35 | bool | 34 | bool |
36 | depends on B43 && (SSB = y || SSB = B43) | 35 | |
37 | default y | 36 | choice |
37 | prompt "Supported bus types" | ||
38 | depends on B43 | ||
39 | default B43_BCMA_AND_SSB | ||
40 | |||
41 | config B43_BUSES_BCMA_AND_SSB | ||
42 | bool "BCMA and SSB" | ||
43 | depends on BCMA_POSSIBLE && SSB_POSSIBLE | ||
44 | select B43_BCMA | ||
45 | select B43_SSB | ||
46 | |||
47 | config B43_BUSES_BCMA | ||
48 | bool "BCMA only" | ||
49 | depends on BCMA_POSSIBLE | ||
50 | select B43_BCMA | ||
51 | |||
52 | config B43_BUSES_SSB | ||
53 | bool "SSB only" | ||
54 | depends on SSB_POSSIBLE | ||
55 | select B43_SSB | ||
56 | |||
57 | endchoice | ||
38 | 58 | ||
39 | # Auto-select SSB PCI-HOST support, if possible | 59 | # Auto-select SSB PCI-HOST support, if possible |
40 | config B43_PCI_AUTOSELECT | 60 | config B43_PCI_AUTOSELECT |
@@ -98,7 +118,7 @@ config B43_BCMA_PIO | |||
98 | 118 | ||
99 | config B43_PIO | 119 | config B43_PIO |
100 | bool | 120 | bool |
101 | depends on B43 | 121 | depends on B43 && B43_SSB |
102 | select SSB_BLOCKIO | 122 | select SSB_BLOCKIO |
103 | default y | 123 | default y |
104 | 124 | ||
@@ -116,7 +136,7 @@ config B43_PHY_N | |||
116 | 136 | ||
117 | config B43_PHY_LP | 137 | config B43_PHY_LP |
118 | bool "Support for low-power (LP-PHY) devices" | 138 | bool "Support for low-power (LP-PHY) devices" |
119 | depends on B43 | 139 | depends on B43 && B43_SSB |
120 | default y | 140 | default y |
121 | ---help--- | 141 | ---help--- |
122 | Support for the LP-PHY. | 142 | Support for the LP-PHY. |
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h index 184c95659279..f3205c6988bc 100644 --- a/drivers/net/wireless/b43/bus.h +++ b/drivers/net/wireless/b43/bus.h | |||
@@ -5,7 +5,9 @@ enum b43_bus_type { | |||
5 | #ifdef CONFIG_B43_BCMA | 5 | #ifdef CONFIG_B43_BCMA |
6 | B43_BUS_BCMA, | 6 | B43_BUS_BCMA, |
7 | #endif | 7 | #endif |
8 | #ifdef CONFIG_B43_SSB | ||
8 | B43_BUS_SSB, | 9 | B43_BUS_SSB, |
10 | #endif | ||
9 | }; | 11 | }; |
10 | 12 | ||
11 | struct b43_bus_dev { | 13 | struct b43_bus_dev { |
@@ -52,13 +54,21 @@ struct b43_bus_dev { | |||
52 | 54 | ||
53 | static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev) | 55 | static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev) |
54 | { | 56 | { |
57 | #ifdef CONFIG_B43_SSB | ||
55 | return (dev->bus_type == B43_BUS_SSB && | 58 | return (dev->bus_type == B43_BUS_SSB && |
56 | dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA); | 59 | dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA); |
60 | #else | ||
61 | return false; | ||
62 | #endif | ||
57 | } | 63 | } |
58 | static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev) | 64 | static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev) |
59 | { | 65 | { |
66 | #ifdef CONFIG_B43_SSB | ||
60 | return (dev->bus_type == B43_BUS_SSB && | 67 | return (dev->bus_type == B43_BUS_SSB && |
61 | dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); | 68 | dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); |
69 | #else | ||
70 | return false; | ||
71 | #endif | ||
62 | } | 72 | } |
63 | 73 | ||
64 | struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core); | 74 | struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 07024c69d0b5..558abe7718e4 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1195,14 +1195,20 @@ static void b43_bcma_wireless_core_reset(struct b43_wldev *dev, bool gmode) | |||
1195 | B43_BCMA_CLKCTLST_PHY_PLL_REQ; | 1195 | B43_BCMA_CLKCTLST_PHY_PLL_REQ; |
1196 | u32 status = B43_BCMA_CLKCTLST_80211_PLL_ST | | 1196 | u32 status = B43_BCMA_CLKCTLST_80211_PLL_ST | |
1197 | B43_BCMA_CLKCTLST_PHY_PLL_ST; | 1197 | B43_BCMA_CLKCTLST_PHY_PLL_ST; |
1198 | u32 flags; | ||
1199 | |||
1200 | flags = B43_BCMA_IOCTL_PHY_CLKEN; | ||
1201 | if (gmode) | ||
1202 | flags |= B43_BCMA_IOCTL_GMODE; | ||
1203 | b43_device_enable(dev, flags); | ||
1198 | 1204 | ||
1199 | b43_device_enable(dev, B43_BCMA_IOCTL_PHY_CLKEN); | ||
1200 | bcma_core_set_clockmode(dev->dev->bdev, BCMA_CLKMODE_FAST); | 1205 | bcma_core_set_clockmode(dev->dev->bdev, BCMA_CLKMODE_FAST); |
1201 | b43_bcma_phy_reset(dev); | 1206 | b43_bcma_phy_reset(dev); |
1202 | bcma_core_pll_ctl(dev->dev->bdev, req, status, true); | 1207 | bcma_core_pll_ctl(dev->dev->bdev, req, status, true); |
1203 | } | 1208 | } |
1204 | #endif | 1209 | #endif |
1205 | 1210 | ||
1211 | #ifdef CONFIG_B43_SSB | ||
1206 | static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) | 1212 | static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) |
1207 | { | 1213 | { |
1208 | struct ssb_device *sdev = dev->dev->sdev; | 1214 | struct ssb_device *sdev = dev->dev->sdev; |
@@ -1230,6 +1236,7 @@ static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) | |||
1230 | ssb_read32(sdev, SSB_TMSLOW); /* flush */ | 1236 | ssb_read32(sdev, SSB_TMSLOW); /* flush */ |
1231 | msleep(1); | 1237 | msleep(1); |
1232 | } | 1238 | } |
1239 | #endif | ||
1233 | 1240 | ||
1234 | void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode) | 1241 | void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode) |
1235 | { | 1242 | { |
@@ -2730,6 +2737,8 @@ out: | |||
2730 | /* Initialize the GPIOs | 2737 | /* Initialize the GPIOs |
2731 | * http://bcm-specs.sipsolutions.net/GPIO | 2738 | * http://bcm-specs.sipsolutions.net/GPIO |
2732 | */ | 2739 | */ |
2740 | |||
2741 | #ifdef CONFIG_B43_SSB | ||
2733 | static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) | 2742 | static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) |
2734 | { | 2743 | { |
2735 | struct ssb_bus *bus = dev->dev->sdev->bus; | 2744 | struct ssb_bus *bus = dev->dev->sdev->bus; |
@@ -2740,10 +2749,13 @@ static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) | |||
2740 | return bus->chipco.dev; | 2749 | return bus->chipco.dev; |
2741 | #endif | 2750 | #endif |
2742 | } | 2751 | } |
2752 | #endif | ||
2743 | 2753 | ||
2744 | static int b43_gpio_init(struct b43_wldev *dev) | 2754 | static int b43_gpio_init(struct b43_wldev *dev) |
2745 | { | 2755 | { |
2756 | #ifdef CONFIG_B43_SSB | ||
2746 | struct ssb_device *gpiodev; | 2757 | struct ssb_device *gpiodev; |
2758 | #endif | ||
2747 | u32 mask, set; | 2759 | u32 mask, set; |
2748 | 2760 | ||
2749 | b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0); | 2761 | b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0); |
@@ -2802,7 +2814,9 @@ static int b43_gpio_init(struct b43_wldev *dev) | |||
2802 | /* Turn off all GPIO stuff. Call this on module unload, for example. */ | 2814 | /* Turn off all GPIO stuff. Call this on module unload, for example. */ |
2803 | static void b43_gpio_cleanup(struct b43_wldev *dev) | 2815 | static void b43_gpio_cleanup(struct b43_wldev *dev) |
2804 | { | 2816 | { |
2817 | #ifdef CONFIG_B43_SSB | ||
2805 | struct ssb_device *gpiodev; | 2818 | struct ssb_device *gpiodev; |
2819 | #endif | ||
2806 | 2820 | ||
2807 | switch (dev->dev->bus_type) { | 2821 | switch (dev->dev->bus_type) { |
2808 | #ifdef CONFIG_B43_BCMA | 2822 | #ifdef CONFIG_B43_BCMA |
@@ -3687,7 +3701,9 @@ static void b43_op_set_tsf(struct ieee80211_hw *hw, | |||
3687 | 3701 | ||
3688 | static void b43_put_phy_into_reset(struct b43_wldev *dev) | 3702 | static void b43_put_phy_into_reset(struct b43_wldev *dev) |
3689 | { | 3703 | { |
3704 | #ifdef CONFIG_B43_SSB | ||
3690 | u32 tmp; | 3705 | u32 tmp; |
3706 | #endif | ||
3691 | 3707 | ||
3692 | switch (dev->dev->bus_type) { | 3708 | switch (dev->dev->bus_type) { |
3693 | #ifdef CONFIG_B43_BCMA | 3709 | #ifdef CONFIG_B43_BCMA |
@@ -4577,8 +4593,12 @@ static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev) | |||
4577 | struct ssb_bus *bus; | 4593 | struct ssb_bus *bus; |
4578 | u32 tmp; | 4594 | u32 tmp; |
4579 | 4595 | ||
4596 | #ifdef CONFIG_B43_SSB | ||
4580 | if (dev->dev->bus_type != B43_BUS_SSB) | 4597 | if (dev->dev->bus_type != B43_BUS_SSB) |
4581 | return; | 4598 | return; |
4599 | #else | ||
4600 | return; | ||
4601 | #endif | ||
4582 | 4602 | ||
4583 | bus = dev->dev->sdev->bus; | 4603 | bus = dev->dev->sdev->bus; |
4584 | 4604 | ||
@@ -4733,7 +4753,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev) | |||
4733 | } | 4753 | } |
4734 | if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) | 4754 | if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) |
4735 | hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ | 4755 | hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ |
4736 | #ifdef CONFIG_SSB_DRIVER_PCICORE | 4756 | #if defined(CONFIG_B43_SSB) && defined(CONFIG_SSB_DRIVER_PCICORE) |
4737 | if (dev->dev->bus_type == B43_BUS_SSB && | 4757 | if (dev->dev->bus_type == B43_BUS_SSB && |
4738 | dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && | 4758 | dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && |
4739 | dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) | 4759 | dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) |
@@ -5173,7 +5193,6 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
5173 | } | 5193 | } |
5174 | 5194 | ||
5175 | dev->phy.gmode = have_2ghz_phy; | 5195 | dev->phy.gmode = have_2ghz_phy; |
5176 | dev->phy.radio_on = true; | ||
5177 | b43_wireless_core_reset(dev, dev->phy.gmode); | 5196 | b43_wireless_core_reset(dev, dev->phy.gmode); |
5178 | 5197 | ||
5179 | err = b43_phy_versioning(dev); | 5198 | err = b43_phy_versioning(dev); |
@@ -5306,6 +5325,7 @@ static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl) | |||
5306 | (pdev->subsystem_vendor == PCI_VENDOR_ID_##_subvendor) && \ | 5325 | (pdev->subsystem_vendor == PCI_VENDOR_ID_##_subvendor) && \ |
5307 | (pdev->subsystem_device == _subdevice) ) | 5326 | (pdev->subsystem_device == _subdevice) ) |
5308 | 5327 | ||
5328 | #ifdef CONFIG_B43_SSB | ||
5309 | static void b43_sprom_fixup(struct ssb_bus *bus) | 5329 | static void b43_sprom_fixup(struct ssb_bus *bus) |
5310 | { | 5330 | { |
5311 | struct pci_dev *pdev; | 5331 | struct pci_dev *pdev; |
@@ -5337,6 +5357,7 @@ static void b43_wireless_exit(struct b43_bus_dev *dev, struct b43_wl *wl) | |||
5337 | ssb_set_devtypedata(dev->sdev, NULL); | 5357 | ssb_set_devtypedata(dev->sdev, NULL); |
5338 | ieee80211_free_hw(hw); | 5358 | ieee80211_free_hw(hw); |
5339 | } | 5359 | } |
5360 | #endif | ||
5340 | 5361 | ||
5341 | static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) | 5362 | static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) |
5342 | { | 5363 | { |
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index dbaa51890198..3e45989f418d 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
@@ -96,7 +96,7 @@ int b43_phy_init(struct b43_wldev *dev) | |||
96 | 96 | ||
97 | phy->channel = ops->get_default_chan(dev); | 97 | phy->channel = ops->get_default_chan(dev); |
98 | 98 | ||
99 | ops->software_rfkill(dev, false); | 99 | b43_software_rfkill(dev, false); |
100 | err = ops->init(dev); | 100 | err = ops->init(dev); |
101 | if (err) { | 101 | if (err) { |
102 | b43err(dev->wl, "PHY init failed\n"); | 102 | b43err(dev->wl, "PHY init failed\n"); |
@@ -116,7 +116,7 @@ err_phy_exit: | |||
116 | if (ops->exit) | 116 | if (ops->exit) |
117 | ops->exit(dev); | 117 | ops->exit(dev); |
118 | err_block_rf: | 118 | err_block_rf: |
119 | ops->software_rfkill(dev, true); | 119 | b43_software_rfkill(dev, true); |
120 | 120 | ||
121 | return err; | 121 | return err; |
122 | } | 122 | } |
@@ -125,7 +125,7 @@ void b43_phy_exit(struct b43_wldev *dev) | |||
125 | { | 125 | { |
126 | const struct b43_phy_operations *ops = dev->phy.ops; | 126 | const struct b43_phy_operations *ops = dev->phy.ops; |
127 | 127 | ||
128 | ops->software_rfkill(dev, true); | 128 | b43_software_rfkill(dev, true); |
129 | if (ops->exit) | 129 | if (ops->exit) |
130 | ops->exit(dev); | 130 | ops->exit(dev); |
131 | } | 131 | } |
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 482b31210d28..41dab89a2942 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -807,9 +807,16 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
807 | u16 bias, cbias; | 807 | u16 bias, cbias; |
808 | u16 pag_boost, padg_boost, pgag_boost, mixg_boost; | 808 | u16 pag_boost, padg_boost, pgag_boost, mixg_boost; |
809 | u16 paa_boost, pada_boost, pgaa_boost, mixa_boost; | 809 | u16 paa_boost, pada_boost, pgaa_boost, mixa_boost; |
810 | bool is_pkg_fab_smic; | ||
810 | 811 | ||
811 | B43_WARN_ON(dev->phy.rev < 3); | 812 | B43_WARN_ON(dev->phy.rev < 3); |
812 | 813 | ||
814 | is_pkg_fab_smic = | ||
815 | ((dev->dev->chip_id == BCMA_CHIP_ID_BCM43224 || | ||
816 | dev->dev->chip_id == BCMA_CHIP_ID_BCM43225 || | ||
817 | dev->dev->chip_id == BCMA_CHIP_ID_BCM43421) && | ||
818 | dev->dev->chip_pkg == BCMA_PKG_ID_BCM43224_FAB_SMIC); | ||
819 | |||
813 | b43_chantab_radio_2056_upload(dev, e); | 820 | b43_chantab_radio_2056_upload(dev, e); |
814 | b2056_upload_syn_pll_cp2(dev, band == IEEE80211_BAND_5GHZ); | 821 | b2056_upload_syn_pll_cp2(dev, band == IEEE80211_BAND_5GHZ); |
815 | 822 | ||
@@ -817,7 +824,8 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
817 | b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | 824 | b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { |
818 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); | 825 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); |
819 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1F); | 826 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1F); |
820 | if (dev->dev->chip_id == 0x4716) { | 827 | if (dev->dev->chip_id == BCMA_CHIP_ID_BCM4716 || |
828 | dev->dev->chip_id == BCMA_CHIP_ID_BCM47162) { | ||
821 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x14); | 829 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x14); |
822 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0); | 830 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0); |
823 | } else { | 831 | } else { |
@@ -825,6 +833,13 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
825 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x14); | 833 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x14); |
826 | } | 834 | } |
827 | } | 835 | } |
836 | if (sprom->boardflags2_hi & B43_BFH2_GPLL_WAR2 && | ||
837 | b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | ||
838 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1f); | ||
839 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1f); | ||
840 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x0b); | ||
841 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x20); | ||
842 | } | ||
828 | if (sprom->boardflags2_lo & B43_BFL2_APLL_WAR && | 843 | if (sprom->boardflags2_lo & B43_BFL2_APLL_WAR && |
829 | b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { | 844 | b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { |
830 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); | 845 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); |
@@ -840,7 +855,8 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
840 | b43_radio_write(dev, | 855 | b43_radio_write(dev, |
841 | offset | B2056_TX_PADG_IDAC, 0xcc); | 856 | offset | B2056_TX_PADG_IDAC, 0xcc); |
842 | 857 | ||
843 | if (dev->dev->chip_id == 0x4716) { | 858 | if (dev->dev->chip_id == BCMA_CHIP_ID_BCM4716 || |
859 | dev->dev->chip_id == BCMA_CHIP_ID_BCM47162) { | ||
844 | bias = 0x40; | 860 | bias = 0x40; |
845 | cbias = 0x45; | 861 | cbias = 0x45; |
846 | pag_boost = 0x5; | 862 | pag_boost = 0x5; |
@@ -849,6 +865,10 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
849 | } else { | 865 | } else { |
850 | bias = 0x25; | 866 | bias = 0x25; |
851 | cbias = 0x20; | 867 | cbias = 0x20; |
868 | if (is_pkg_fab_smic) { | ||
869 | bias = 0x2a; | ||
870 | cbias = 0x38; | ||
871 | } | ||
852 | pag_boost = 0x4; | 872 | pag_boost = 0x4; |
853 | pgag_boost = 0x03; | 873 | pgag_boost = 0x03; |
854 | mixg_boost = 0x65; | 874 | mixg_boost = 0x65; |
@@ -917,6 +937,8 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
917 | mixa_boost = 0xF; | 937 | mixa_boost = 0xF; |
918 | } | 938 | } |
919 | 939 | ||
940 | cbias = is_pkg_fab_smic ? 0x35 : 0x30; | ||
941 | |||
920 | for (i = 0; i < 2; i++) { | 942 | for (i = 0; i < 2; i++) { |
921 | offset = i ? B2056_TX1 : B2056_TX0; | 943 | offset = i ? B2056_TX1 : B2056_TX0; |
922 | 944 | ||
@@ -935,11 +957,11 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
935 | b43_radio_write(dev, | 957 | b43_radio_write(dev, |
936 | offset | B2056_TX_PADA_CASCBIAS, 0x03); | 958 | offset | B2056_TX_PADA_CASCBIAS, 0x03); |
937 | b43_radio_write(dev, | 959 | b43_radio_write(dev, |
938 | offset | B2056_TX_INTPAA_IAUX_STAT, 0x50); | 960 | offset | B2056_TX_INTPAA_IAUX_STAT, 0x30); |
939 | b43_radio_write(dev, | 961 | b43_radio_write(dev, |
940 | offset | B2056_TX_INTPAA_IMAIN_STAT, 0x50); | 962 | offset | B2056_TX_INTPAA_IMAIN_STAT, 0x30); |
941 | b43_radio_write(dev, | 963 | b43_radio_write(dev, |
942 | offset | B2056_TX_INTPAA_CASCBIAS, 0x30); | 964 | offset | B2056_TX_INTPAA_CASCBIAS, cbias); |
943 | } | 965 | } |
944 | } | 966 | } |
945 | 967 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/brcm80211/brcmfmac/chip.c index df130ef53d1c..c7c9f15c0fe0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c | |||
@@ -303,10 +303,10 @@ static void brcmf_chip_ai_coredisable(struct brcmf_core_priv *core, | |||
303 | 303 | ||
304 | ci = core->chip; | 304 | ci = core->chip; |
305 | 305 | ||
306 | /* if core is already in reset, just return */ | 306 | /* if core is already in reset, skip reset */ |
307 | regdata = ci->ops->read32(ci->ctx, core->wrapbase + BCMA_RESET_CTL); | 307 | regdata = ci->ops->read32(ci->ctx, core->wrapbase + BCMA_RESET_CTL); |
308 | if ((regdata & BCMA_RESET_CTL_RESET) != 0) | 308 | if ((regdata & BCMA_RESET_CTL_RESET) != 0) |
309 | return; | 309 | goto in_reset_configure; |
310 | 310 | ||
311 | /* configure reset */ | 311 | /* configure reset */ |
312 | ci->ops->write32(ci->ctx, core->wrapbase + BCMA_IOCTL, | 312 | ci->ops->write32(ci->ctx, core->wrapbase + BCMA_IOCTL, |
@@ -322,6 +322,7 @@ static void brcmf_chip_ai_coredisable(struct brcmf_core_priv *core, | |||
322 | SPINWAIT(ci->ops->read32(ci->ctx, core->wrapbase + BCMA_RESET_CTL) != | 322 | SPINWAIT(ci->ops->read32(ci->ctx, core->wrapbase + BCMA_RESET_CTL) != |
323 | BCMA_RESET_CTL_RESET, 300); | 323 | BCMA_RESET_CTL_RESET, 300); |
324 | 324 | ||
325 | in_reset_configure: | ||
325 | /* in-reset configure */ | 326 | /* in-reset configure */ |
326 | ci->ops->write32(ci->ctx, core->wrapbase + BCMA_IOCTL, | 327 | ci->ops->write32(ci->ctx, core->wrapbase + BCMA_IOCTL, |
327 | reset | BCMA_IOCTL_FGC | BCMA_IOCTL_CLK); | 328 | reset | BCMA_IOCTL_FGC | BCMA_IOCTL_CLK); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h index 939d6b132922..16f9ab2568a8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h | |||
@@ -186,7 +186,7 @@ void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx); | |||
186 | void brcmf_txflowblock_if(struct brcmf_if *ifp, | 186 | void brcmf_txflowblock_if(struct brcmf_if *ifp, |
187 | enum brcmf_netif_stop_reason reason, bool state); | 187 | enum brcmf_netif_stop_reason reason, bool state); |
188 | u32 brcmf_get_chip_info(struct brcmf_if *ifp); | 188 | u32 brcmf_get_chip_info(struct brcmf_if *ifp); |
189 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, | 189 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx, |
190 | bool success); | 190 | bool success); |
191 | 191 | ||
192 | /* Sets dongle media info (drv_version, mac address). */ | 192 | /* Sets dongle media info (drv_version, mac address). */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h index c4535616064e..c5dcd82e884b 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | |||
@@ -99,6 +99,7 @@ struct brcmf_bus { | |||
99 | unsigned long tx_realloc; | 99 | unsigned long tx_realloc; |
100 | u32 chip; | 100 | u32 chip; |
101 | u32 chiprev; | 101 | u32 chiprev; |
102 | bool always_use_fws_queue; | ||
102 | 103 | ||
103 | struct brcmf_bus_ops *ops; | 104 | struct brcmf_bus_ops *ops; |
104 | }; | 105 | }; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index 6a8983a1fb9c..ed3e32ce8c23 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | |||
@@ -32,6 +32,9 @@ | |||
32 | #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 | 32 | #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 |
33 | #define BRCMF_DEFAULT_PACKET_FILTER "100 0 0 0 0x01 0x00" | 33 | #define BRCMF_DEFAULT_PACKET_FILTER "100 0 0 0 0x01 0x00" |
34 | 34 | ||
35 | /* boost value for RSSI_DELTA in preferred join selection */ | ||
36 | #define BRCMF_JOIN_PREF_RSSI_BOOST 8 | ||
37 | |||
35 | 38 | ||
36 | bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, | 39 | bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, |
37 | struct sk_buff *pkt, int prec) | 40 | struct sk_buff *pkt, int prec) |
@@ -246,6 +249,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) | |||
246 | { | 249 | { |
247 | s8 eventmask[BRCMF_EVENTING_MASK_LEN]; | 250 | s8 eventmask[BRCMF_EVENTING_MASK_LEN]; |
248 | u8 buf[BRCMF_DCMD_SMLEN]; | 251 | u8 buf[BRCMF_DCMD_SMLEN]; |
252 | struct brcmf_join_pref_params join_pref_params[2]; | ||
249 | char *ptr; | 253 | char *ptr; |
250 | s32 err; | 254 | s32 err; |
251 | 255 | ||
@@ -298,6 +302,20 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) | |||
298 | goto done; | 302 | goto done; |
299 | } | 303 | } |
300 | 304 | ||
305 | /* Setup join_pref to select target by RSSI(with boost on 5GHz) */ | ||
306 | join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA; | ||
307 | join_pref_params[0].len = 2; | ||
308 | join_pref_params[0].rssi_gain = BRCMF_JOIN_PREF_RSSI_BOOST; | ||
309 | join_pref_params[0].band = WLC_BAND_5G; | ||
310 | join_pref_params[1].type = BRCMF_JOIN_PREF_RSSI; | ||
311 | join_pref_params[1].len = 2; | ||
312 | join_pref_params[1].rssi_gain = 0; | ||
313 | join_pref_params[1].band = 0; | ||
314 | err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, | ||
315 | sizeof(join_pref_params)); | ||
316 | if (err) | ||
317 | brcmf_err("Set join_pref error (%d)\n", err); | ||
318 | |||
301 | /* Setup event_msgs, enable E_IF */ | 319 | /* Setup event_msgs, enable E_IF */ |
302 | err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, | 320 | err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, |
303 | BRCMF_EVENTING_MASK_LEN); | 321 | BRCMF_EVENTING_MASK_LEN); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 7d28cd385092..4cacc3d85212 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -190,7 +190,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, | |||
190 | int ret; | 190 | int ret; |
191 | struct brcmf_if *ifp = netdev_priv(ndev); | 191 | struct brcmf_if *ifp = netdev_priv(ndev); |
192 | struct brcmf_pub *drvr = ifp->drvr; | 192 | struct brcmf_pub *drvr = ifp->drvr; |
193 | struct ethhdr *eh; | 193 | struct ethhdr *eh = (struct ethhdr *)(skb->data); |
194 | 194 | ||
195 | brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx); | 195 | brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx); |
196 | 196 | ||
@@ -236,6 +236,9 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, | |||
236 | goto done; | 236 | goto done; |
237 | } | 237 | } |
238 | 238 | ||
239 | if (eh->h_proto == htons(ETH_P_PAE)) | ||
240 | atomic_inc(&ifp->pend_8021x_cnt); | ||
241 | |||
239 | ret = brcmf_fws_process_skb(ifp, skb); | 242 | ret = brcmf_fws_process_skb(ifp, skb); |
240 | 243 | ||
241 | done: | 244 | done: |
@@ -538,31 +541,26 @@ void brcmf_rx_frame(struct device *dev, struct sk_buff *skb) | |||
538 | brcmf_netif_rx(ifp, skb); | 541 | brcmf_netif_rx(ifp, skb); |
539 | } | 542 | } |
540 | 543 | ||
541 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, | 544 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx, |
542 | bool success) | 545 | bool success) |
543 | { | 546 | { |
544 | struct brcmf_if *ifp; | 547 | struct brcmf_if *ifp; |
545 | struct ethhdr *eh; | 548 | struct ethhdr *eh; |
546 | u8 ifidx; | ||
547 | u16 type; | 549 | u16 type; |
548 | int res; | ||
549 | |||
550 | res = brcmf_proto_hdrpull(drvr, false, &ifidx, txp); | ||
551 | 550 | ||
552 | ifp = drvr->iflist[ifidx]; | 551 | ifp = drvr->iflist[ifidx]; |
553 | if (!ifp) | 552 | if (!ifp) |
554 | goto done; | 553 | goto done; |
555 | 554 | ||
556 | if (res == 0) { | 555 | eh = (struct ethhdr *)(txp->data); |
557 | eh = (struct ethhdr *)(txp->data); | 556 | type = ntohs(eh->h_proto); |
558 | type = ntohs(eh->h_proto); | ||
559 | 557 | ||
560 | if (type == ETH_P_PAE) { | 558 | if (type == ETH_P_PAE) { |
561 | atomic_dec(&ifp->pend_8021x_cnt); | 559 | atomic_dec(&ifp->pend_8021x_cnt); |
562 | if (waitqueue_active(&ifp->pend_8021x_wait)) | 560 | if (waitqueue_active(&ifp->pend_8021x_wait)) |
563 | wake_up(&ifp->pend_8021x_wait); | 561 | wake_up(&ifp->pend_8021x_wait); |
564 | } | ||
565 | } | 562 | } |
563 | |||
566 | if (!success) | 564 | if (!success) |
567 | ifp->stats.tx_errors++; | 565 | ifp->stats.tx_errors++; |
568 | done: | 566 | done: |
@@ -573,13 +571,17 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success) | |||
573 | { | 571 | { |
574 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); | 572 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
575 | struct brcmf_pub *drvr = bus_if->drvr; | 573 | struct brcmf_pub *drvr = bus_if->drvr; |
574 | u8 ifidx; | ||
576 | 575 | ||
577 | /* await txstatus signal for firmware if active */ | 576 | /* await txstatus signal for firmware if active */ |
578 | if (brcmf_fws_fc_active(drvr->fws)) { | 577 | if (brcmf_fws_fc_active(drvr->fws)) { |
579 | if (!success) | 578 | if (!success) |
580 | brcmf_fws_bustxfail(drvr->fws, txp); | 579 | brcmf_fws_bustxfail(drvr->fws, txp); |
581 | } else { | 580 | } else { |
582 | brcmf_txfinalize(drvr, txp, success); | 581 | if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp)) |
582 | brcmu_pkt_buf_free_skb(txp); | ||
583 | else | ||
584 | brcmf_txfinalize(drvr, txp, ifidx, success); | ||
583 | } | 585 | } |
584 | } | 586 | } |
585 | 587 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h index 614e4888504f..2bc68a2137fc 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h | |||
@@ -53,6 +53,14 @@ | |||
53 | #define BRCMF_OBSS_COEX_OFF 0 | 53 | #define BRCMF_OBSS_COEX_OFF 0 |
54 | #define BRCMF_OBSS_COEX_ON 1 | 54 | #define BRCMF_OBSS_COEX_ON 1 |
55 | 55 | ||
56 | /* join preference types for join_pref iovar */ | ||
57 | enum brcmf_join_pref_types { | ||
58 | BRCMF_JOIN_PREF_RSSI = 1, | ||
59 | BRCMF_JOIN_PREF_WPA, | ||
60 | BRCMF_JOIN_PREF_BAND, | ||
61 | BRCMF_JOIN_PREF_RSSI_DELTA, | ||
62 | }; | ||
63 | |||
56 | enum brcmf_fil_p2p_if_types { | 64 | enum brcmf_fil_p2p_if_types { |
57 | BRCMF_FIL_P2P_IF_CLIENT, | 65 | BRCMF_FIL_P2P_IF_CLIENT, |
58 | BRCMF_FIL_P2P_IF_GO, | 66 | BRCMF_FIL_P2P_IF_GO, |
@@ -282,6 +290,22 @@ struct brcmf_assoc_params_le { | |||
282 | __le16 chanspec_list[1]; | 290 | __le16 chanspec_list[1]; |
283 | }; | 291 | }; |
284 | 292 | ||
293 | /** | ||
294 | * struct join_pref params - parameters for preferred join selection. | ||
295 | * | ||
296 | * @type: preference type (see enum brcmf_join_pref_types). | ||
297 | * @len: length of bytes following (currently always 2). | ||
298 | * @rssi_gain: signal gain for selection (only when @type is RSSI_DELTA). | ||
299 | * @band: band to which selection preference applies. | ||
300 | * This is used if @type is BAND or RSSI_DELTA. | ||
301 | */ | ||
302 | struct brcmf_join_pref_params { | ||
303 | u8 type; | ||
304 | u8 len; | ||
305 | u8 rssi_gain; | ||
306 | u8 band; | ||
307 | }; | ||
308 | |||
285 | /* used for join with or without a specific bssid and channel list */ | 309 | /* used for join with or without a specific bssid and channel list */ |
286 | struct brcmf_join_params { | 310 | struct brcmf_join_params { |
287 | struct brcmf_ssid_le ssid_le; | 311 | struct brcmf_ssid_le ssid_le; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c index c3e7d76dbf35..699908de314a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | |||
@@ -476,6 +476,7 @@ struct brcmf_fws_info { | |||
476 | bool bus_flow_blocked; | 476 | bool bus_flow_blocked; |
477 | bool creditmap_received; | 477 | bool creditmap_received; |
478 | u8 mode; | 478 | u8 mode; |
479 | bool avoid_queueing; | ||
479 | }; | 480 | }; |
480 | 481 | ||
481 | /* | 482 | /* |
@@ -1369,13 +1370,12 @@ done: | |||
1369 | } | 1370 | } |
1370 | 1371 | ||
1371 | static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, | 1372 | static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, |
1372 | struct sk_buff *skb, u32 genbit, | 1373 | struct sk_buff *skb, u8 ifidx, |
1373 | u16 seq) | 1374 | u32 genbit, u16 seq) |
1374 | { | 1375 | { |
1375 | struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac; | 1376 | struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac; |
1376 | u32 hslot; | 1377 | u32 hslot; |
1377 | int ret; | 1378 | int ret; |
1378 | u8 ifidx; | ||
1379 | 1379 | ||
1380 | hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); | 1380 | hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); |
1381 | 1381 | ||
@@ -1389,29 +1389,21 @@ static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, | |||
1389 | 1389 | ||
1390 | entry->generation = genbit; | 1390 | entry->generation = genbit; |
1391 | 1391 | ||
1392 | ret = brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb); | 1392 | brcmf_skb_htod_tag_set_field(skb, GENERATION, genbit); |
1393 | if (ret == 0) { | 1393 | brcmf_skbcb(skb)->htod_seq = seq; |
1394 | brcmf_skb_htod_tag_set_field(skb, GENERATION, genbit); | 1394 | if (brcmf_skb_htod_seq_get_field(skb, FROMFW)) { |
1395 | brcmf_skbcb(skb)->htod_seq = seq; | 1395 | brcmf_skb_htod_seq_set_field(skb, FROMDRV, 1); |
1396 | if (brcmf_skb_htod_seq_get_field(skb, FROMFW)) { | 1396 | brcmf_skb_htod_seq_set_field(skb, FROMFW, 0); |
1397 | brcmf_skb_htod_seq_set_field(skb, FROMDRV, 1); | 1397 | } else { |
1398 | brcmf_skb_htod_seq_set_field(skb, FROMFW, 0); | 1398 | brcmf_skb_htod_seq_set_field(skb, FROMDRV, 0); |
1399 | } else { | ||
1400 | brcmf_skb_htod_seq_set_field(skb, FROMDRV, 0); | ||
1401 | } | ||
1402 | ret = brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_SUPPRESSED, fifo, | ||
1403 | skb); | ||
1404 | } | 1399 | } |
1400 | ret = brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_SUPPRESSED, fifo, skb); | ||
1405 | 1401 | ||
1406 | if (ret != 0) { | 1402 | if (ret != 0) { |
1407 | /* suppress q is full or hdrpull failed, drop this packet */ | 1403 | /* suppress q is full drop this packet */ |
1408 | brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, | 1404 | brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, true); |
1409 | true); | ||
1410 | } else { | 1405 | } else { |
1411 | /* | 1406 | /* Mark suppressed to avoid a double free during wlfc cleanup */ |
1412 | * Mark suppressed to avoid a double free during | ||
1413 | * wlfc cleanup | ||
1414 | */ | ||
1415 | brcmf_fws_hanger_mark_suppressed(&fws->hanger, hslot); | 1407 | brcmf_fws_hanger_mark_suppressed(&fws->hanger, hslot); |
1416 | } | 1408 | } |
1417 | 1409 | ||
@@ -1428,6 +1420,7 @@ brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, | |||
1428 | struct sk_buff *skb; | 1420 | struct sk_buff *skb; |
1429 | struct brcmf_skbuff_cb *skcb; | 1421 | struct brcmf_skbuff_cb *skcb; |
1430 | struct brcmf_fws_mac_descriptor *entry = NULL; | 1422 | struct brcmf_fws_mac_descriptor *entry = NULL; |
1423 | u8 ifidx; | ||
1431 | 1424 | ||
1432 | brcmf_dbg(DATA, "flags %d\n", flags); | 1425 | brcmf_dbg(DATA, "flags %d\n", flags); |
1433 | 1426 | ||
@@ -1476,12 +1469,15 @@ brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, | |||
1476 | } | 1469 | } |
1477 | brcmf_fws_macdesc_return_req_credit(skb); | 1470 | brcmf_fws_macdesc_return_req_credit(skb); |
1478 | 1471 | ||
1472 | if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) { | ||
1473 | brcmu_pkt_buf_free_skb(skb); | ||
1474 | return -EINVAL; | ||
1475 | } | ||
1479 | if (!remove_from_hanger) | 1476 | if (!remove_from_hanger) |
1480 | ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, genbit, | 1477 | ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx, |
1481 | seq); | 1478 | genbit, seq); |
1482 | |||
1483 | if (remove_from_hanger || ret) | 1479 | if (remove_from_hanger || ret) |
1484 | brcmf_txfinalize(fws->drvr, skb, true); | 1480 | brcmf_txfinalize(fws->drvr, skb, ifidx, true); |
1485 | 1481 | ||
1486 | return 0; | 1482 | return 0; |
1487 | } | 1483 | } |
@@ -1868,7 +1864,7 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1868 | struct ethhdr *eh = (struct ethhdr *)(skb->data); | 1864 | struct ethhdr *eh = (struct ethhdr *)(skb->data); |
1869 | int fifo = BRCMF_FWS_FIFO_BCMC; | 1865 | int fifo = BRCMF_FWS_FIFO_BCMC; |
1870 | bool multicast = is_multicast_ether_addr(eh->h_dest); | 1866 | bool multicast = is_multicast_ether_addr(eh->h_dest); |
1871 | bool pae = eh->h_proto == htons(ETH_P_PAE); | 1867 | int rc = 0; |
1872 | 1868 | ||
1873 | brcmf_dbg(DATA, "tx proto=0x%X\n", ntohs(eh->h_proto)); | 1869 | brcmf_dbg(DATA, "tx proto=0x%X\n", ntohs(eh->h_proto)); |
1874 | /* determine the priority */ | 1870 | /* determine the priority */ |
@@ -1876,8 +1872,13 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1876 | skb->priority = cfg80211_classify8021d(skb, NULL); | 1872 | skb->priority = cfg80211_classify8021d(skb, NULL); |
1877 | 1873 | ||
1878 | drvr->tx_multicast += !!multicast; | 1874 | drvr->tx_multicast += !!multicast; |
1879 | if (pae) | 1875 | |
1880 | atomic_inc(&ifp->pend_8021x_cnt); | 1876 | if (fws->avoid_queueing) { |
1877 | rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb); | ||
1878 | if (rc < 0) | ||
1879 | brcmf_txfinalize(drvr, skb, ifp->ifidx, false); | ||
1880 | return rc; | ||
1881 | } | ||
1881 | 1882 | ||
1882 | /* set control buffer information */ | 1883 | /* set control buffer information */ |
1883 | skcb->if_flags = 0; | 1884 | skcb->if_flags = 0; |
@@ -1899,15 +1900,12 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1899 | brcmf_fws_schedule_deq(fws); | 1900 | brcmf_fws_schedule_deq(fws); |
1900 | } else { | 1901 | } else { |
1901 | brcmf_err("drop skb: no hanger slot\n"); | 1902 | brcmf_err("drop skb: no hanger slot\n"); |
1902 | if (pae) { | 1903 | brcmf_txfinalize(drvr, skb, ifp->ifidx, false); |
1903 | atomic_dec(&ifp->pend_8021x_cnt); | 1904 | rc = -ENOMEM; |
1904 | if (waitqueue_active(&ifp->pend_8021x_wait)) | ||
1905 | wake_up(&ifp->pend_8021x_wait); | ||
1906 | } | ||
1907 | brcmu_pkt_buf_free_skb(skb); | ||
1908 | } | 1905 | } |
1909 | brcmf_fws_unlock(fws); | 1906 | brcmf_fws_unlock(fws); |
1910 | return 0; | 1907 | |
1908 | return rc; | ||
1911 | } | 1909 | } |
1912 | 1910 | ||
1913 | void brcmf_fws_reset_interface(struct brcmf_if *ifp) | 1911 | void brcmf_fws_reset_interface(struct brcmf_if *ifp) |
@@ -1982,7 +1980,8 @@ static void brcmf_fws_dequeue_worker(struct work_struct *worker) | |||
1982 | ret = brcmf_proto_txdata(drvr, ifidx, 0, skb); | 1980 | ret = brcmf_proto_txdata(drvr, ifidx, 0, skb); |
1983 | brcmf_fws_lock(fws); | 1981 | brcmf_fws_lock(fws); |
1984 | if (ret < 0) | 1982 | if (ret < 0) |
1985 | brcmf_txfinalize(drvr, skb, false); | 1983 | brcmf_txfinalize(drvr, skb, ifidx, |
1984 | false); | ||
1986 | if (fws->bus_flow_blocked) | 1985 | if (fws->bus_flow_blocked) |
1987 | break; | 1986 | break; |
1988 | } | 1987 | } |
@@ -2039,6 +2038,13 @@ int brcmf_fws_init(struct brcmf_pub *drvr) | |||
2039 | fws->drvr = drvr; | 2038 | fws->drvr = drvr; |
2040 | fws->fcmode = fcmode; | 2039 | fws->fcmode = fcmode; |
2041 | 2040 | ||
2041 | if ((drvr->bus_if->always_use_fws_queue == false) && | ||
2042 | (fcmode == BRCMF_FWS_FCMODE_NONE)) { | ||
2043 | fws->avoid_queueing = true; | ||
2044 | brcmf_dbg(INFO, "FWS queueing will be avoided\n"); | ||
2045 | return 0; | ||
2046 | } | ||
2047 | |||
2042 | fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); | 2048 | fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); |
2043 | if (fws->fws_wq == NULL) { | 2049 | if (fws->fws_wq == NULL) { |
2044 | brcmf_err("workqueue creation failed\n"); | 2050 | brcmf_err("workqueue creation failed\n"); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/nvram.c b/drivers/net/wireless/brcm80211/brcmfmac/nvram.c index d5ef86db631b..5c450d11dbc9 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/nvram.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/nvram.c | |||
@@ -18,72 +18,205 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/firmware.h> | 19 | #include <linux/firmware.h> |
20 | 20 | ||
21 | #include "dhd_dbg.h" | ||
21 | #include "nvram.h" | 22 | #include "nvram.h" |
22 | 23 | ||
23 | /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a file | 24 | enum nvram_parser_state { |
25 | IDLE, | ||
26 | KEY, | ||
27 | VALUE, | ||
28 | COMMENT, | ||
29 | END | ||
30 | }; | ||
31 | |||
32 | /** | ||
33 | * struct nvram_parser - internal info for parser. | ||
34 | * | ||
35 | * @state: current parser state. | ||
36 | * @fwnv: input buffer being parsed. | ||
37 | * @nvram: output buffer with parse result. | ||
38 | * @nvram_len: lenght of parse result. | ||
39 | * @line: current line. | ||
40 | * @column: current column in line. | ||
41 | * @pos: byte offset in input buffer. | ||
42 | * @entry: start position of key,value entry. | ||
43 | */ | ||
44 | struct nvram_parser { | ||
45 | enum nvram_parser_state state; | ||
46 | const struct firmware *fwnv; | ||
47 | u8 *nvram; | ||
48 | u32 nvram_len; | ||
49 | u32 line; | ||
50 | u32 column; | ||
51 | u32 pos; | ||
52 | u32 entry; | ||
53 | }; | ||
54 | |||
55 | static bool is_nvram_char(char c) | ||
56 | { | ||
57 | /* comment marker excluded */ | ||
58 | if (c == '#') | ||
59 | return false; | ||
60 | |||
61 | /* key and value may have any other readable character */ | ||
62 | return (c > 0x20 && c < 0x7f); | ||
63 | } | ||
64 | |||
65 | static bool is_whitespace(char c) | ||
66 | { | ||
67 | return (c == ' ' || c == '\r' || c == '\n' || c == '\t'); | ||
68 | } | ||
69 | |||
70 | static enum nvram_parser_state brcmf_nvram_handle_idle(struct nvram_parser *nvp) | ||
71 | { | ||
72 | char c; | ||
73 | |||
74 | c = nvp->fwnv->data[nvp->pos]; | ||
75 | if (c == '\n') | ||
76 | return COMMENT; | ||
77 | if (is_whitespace(c)) | ||
78 | goto proceed; | ||
79 | if (c == '#') | ||
80 | return COMMENT; | ||
81 | if (is_nvram_char(c)) { | ||
82 | nvp->entry = nvp->pos; | ||
83 | return KEY; | ||
84 | } | ||
85 | brcmf_dbg(INFO, "warning: ln=%d:col=%d: ignoring invalid character\n", | ||
86 | nvp->line, nvp->column); | ||
87 | proceed: | ||
88 | nvp->column++; | ||
89 | nvp->pos++; | ||
90 | return IDLE; | ||
91 | } | ||
92 | |||
93 | static enum nvram_parser_state brcmf_nvram_handle_key(struct nvram_parser *nvp) | ||
94 | { | ||
95 | enum nvram_parser_state st = nvp->state; | ||
96 | char c; | ||
97 | |||
98 | c = nvp->fwnv->data[nvp->pos]; | ||
99 | if (c == '=') { | ||
100 | st = VALUE; | ||
101 | } else if (!is_nvram_char(c)) { | ||
102 | brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n", | ||
103 | nvp->line, nvp->column); | ||
104 | return COMMENT; | ||
105 | } | ||
106 | |||
107 | nvp->column++; | ||
108 | nvp->pos++; | ||
109 | return st; | ||
110 | } | ||
111 | |||
112 | static enum nvram_parser_state | ||
113 | brcmf_nvram_handle_value(struct nvram_parser *nvp) | ||
114 | { | ||
115 | char c; | ||
116 | char *skv; | ||
117 | char *ekv; | ||
118 | u32 cplen; | ||
119 | |||
120 | c = nvp->fwnv->data[nvp->pos]; | ||
121 | if (!is_nvram_char(c)) { | ||
122 | /* key,value pair complete */ | ||
123 | ekv = (u8 *)&nvp->fwnv->data[nvp->pos]; | ||
124 | skv = (u8 *)&nvp->fwnv->data[nvp->entry]; | ||
125 | cplen = ekv - skv; | ||
126 | /* copy to output buffer */ | ||
127 | memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen); | ||
128 | nvp->nvram_len += cplen; | ||
129 | nvp->nvram[nvp->nvram_len] = '\0'; | ||
130 | nvp->nvram_len++; | ||
131 | return IDLE; | ||
132 | } | ||
133 | nvp->pos++; | ||
134 | nvp->column++; | ||
135 | return VALUE; | ||
136 | } | ||
137 | |||
138 | static enum nvram_parser_state | ||
139 | brcmf_nvram_handle_comment(struct nvram_parser *nvp) | ||
140 | { | ||
141 | char *eol, *sol; | ||
142 | |||
143 | sol = (char *)&nvp->fwnv->data[nvp->pos]; | ||
144 | eol = strchr(sol, '\n'); | ||
145 | if (eol == NULL) | ||
146 | return END; | ||
147 | |||
148 | /* eat all moving to next line */ | ||
149 | nvp->line++; | ||
150 | nvp->column = 1; | ||
151 | nvp->pos += (eol - sol) + 1; | ||
152 | return IDLE; | ||
153 | } | ||
154 | |||
155 | static enum nvram_parser_state brcmf_nvram_handle_end(struct nvram_parser *nvp) | ||
156 | { | ||
157 | /* final state */ | ||
158 | return END; | ||
159 | } | ||
160 | |||
161 | static enum nvram_parser_state | ||
162 | (*nv_parser_states[])(struct nvram_parser *nvp) = { | ||
163 | brcmf_nvram_handle_idle, | ||
164 | brcmf_nvram_handle_key, | ||
165 | brcmf_nvram_handle_value, | ||
166 | brcmf_nvram_handle_comment, | ||
167 | brcmf_nvram_handle_end | ||
168 | }; | ||
169 | |||
170 | static int brcmf_init_nvram_parser(struct nvram_parser *nvp, | ||
171 | const struct firmware *nv) | ||
172 | { | ||
173 | memset(nvp, 0, sizeof(*nvp)); | ||
174 | nvp->fwnv = nv; | ||
175 | /* Alloc for extra 0 byte + roundup by 4 + length field */ | ||
176 | nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL); | ||
177 | if (!nvp->nvram) | ||
178 | return -ENOMEM; | ||
179 | |||
180 | nvp->line = 1; | ||
181 | nvp->column = 1; | ||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil | ||
24 | * and ending in a NUL. Removes carriage returns, empty lines, comment lines, | 186 | * and ending in a NUL. Removes carriage returns, empty lines, comment lines, |
25 | * and converts newlines to NULs. Shortens buffer as needed and pads with NULs. | 187 | * and converts newlines to NULs. Shortens buffer as needed and pads with NULs. |
26 | * End of buffer is completed with token identifying length of buffer. | 188 | * End of buffer is completed with token identifying length of buffer. |
27 | */ | 189 | */ |
28 | void *brcmf_nvram_strip(const struct firmware *nv, u32 *new_length) | 190 | void *brcmf_nvram_strip(const struct firmware *nv, u32 *new_length) |
29 | { | 191 | { |
30 | u8 *nvram; | 192 | struct nvram_parser nvp; |
31 | u32 i; | 193 | u32 pad; |
32 | u32 len; | ||
33 | u32 column; | ||
34 | u8 val; | ||
35 | bool comment; | ||
36 | u32 token; | 194 | u32 token; |
37 | __le32 token_le; | 195 | __le32 token_le; |
38 | 196 | ||
39 | /* Alloc for extra 0 byte + roundup by 4 + length field */ | 197 | if (brcmf_init_nvram_parser(&nvp, nv) < 0) |
40 | nvram = kmalloc(nv->size + 1 + 3 + sizeof(token_le), GFP_KERNEL); | ||
41 | if (!nvram) | ||
42 | return NULL; | 198 | return NULL; |
43 | 199 | ||
44 | len = 0; | 200 | while (nvp.pos < nv->size) { |
45 | column = 0; | 201 | nvp.state = nv_parser_states[nvp.state](&nvp); |
46 | comment = false; | 202 | if (nvp.state == END) |
47 | for (i = 0; i < nv->size; i++) { | ||
48 | val = nv->data[i]; | ||
49 | if (val == 0) | ||
50 | break; | 203 | break; |
51 | if (val == '\r') | ||
52 | continue; | ||
53 | if (comment && (val != '\n')) | ||
54 | continue; | ||
55 | comment = false; | ||
56 | if (val == '#') { | ||
57 | comment = true; | ||
58 | continue; | ||
59 | } | ||
60 | if (val == '\n') { | ||
61 | if (column == 0) | ||
62 | continue; | ||
63 | nvram[len] = 0; | ||
64 | len++; | ||
65 | column = 0; | ||
66 | continue; | ||
67 | } | ||
68 | nvram[len] = val; | ||
69 | len++; | ||
70 | column++; | ||
71 | } | 204 | } |
72 | column = len; | 205 | pad = nvp.nvram_len; |
73 | *new_length = roundup(len + 1, 4); | 206 | *new_length = roundup(nvp.nvram_len + 1, 4); |
74 | while (column != *new_length) { | 207 | while (pad != *new_length) { |
75 | nvram[column] = 0; | 208 | nvp.nvram[pad] = 0; |
76 | column++; | 209 | pad++; |
77 | } | 210 | } |
78 | 211 | ||
79 | token = *new_length / 4; | 212 | token = *new_length / 4; |
80 | token = (~token << 16) | (token & 0x0000FFFF); | 213 | token = (~token << 16) | (token & 0x0000FFFF); |
81 | token_le = cpu_to_le32(token); | 214 | token_le = cpu_to_le32(token); |
82 | 215 | ||
83 | memcpy(&nvram[*new_length], &token_le, sizeof(token_le)); | 216 | memcpy(&nvp.nvram[*new_length], &token_le, sizeof(token_le)); |
84 | *new_length += sizeof(token_le); | 217 | *new_length += sizeof(token_le); |
85 | 218 | ||
86 | return nvram; | 219 | return nvp.nvram; |
87 | } | 220 | } |
88 | 221 | ||
89 | void brcmf_nvram_free(void *nvram) | 222 | void brcmf_nvram_free(void *nvram) |
@@ -91,4 +224,3 @@ void brcmf_nvram_free(void *nvram) | |||
91 | kfree(nvram); | 224 | kfree(nvram); |
92 | } | 225 | } |
93 | 226 | ||
94 | |||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 24f65cd53859..3ce0e7cfd027 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -1254,6 +1254,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | |||
1254 | bus->chip = bus_pub->devid; | 1254 | bus->chip = bus_pub->devid; |
1255 | bus->chiprev = bus_pub->chiprev; | 1255 | bus->chiprev = bus_pub->chiprev; |
1256 | bus->proto_type = BRCMF_PROTO_BCDC; | 1256 | bus->proto_type = BRCMF_PROTO_BCDC; |
1257 | bus->always_use_fws_queue = true; | ||
1257 | 1258 | ||
1258 | /* Attach to the common driver interface */ | 1259 | /* Attach to the common driver interface */ |
1259 | ret = brcmf_attach(dev); | 1260 | ret = brcmf_attach(dev); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index afb3d15e38ff..70bc2542061a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -221,9 +221,9 @@ static const struct ieee80211_regdomain brcmf_regdom = { | |||
221 | */ | 221 | */ |
222 | REG_RULE(2484-10, 2484+10, 20, 6, 20, 0), | 222 | REG_RULE(2484-10, 2484+10, 20, 6, 20, 0), |
223 | /* IEEE 802.11a, channel 36..64 */ | 223 | /* IEEE 802.11a, channel 36..64 */ |
224 | REG_RULE(5150-10, 5350+10, 40, 6, 20, 0), | 224 | REG_RULE(5150-10, 5350+10, 80, 6, 20, 0), |
225 | /* IEEE 802.11a, channel 100..165 */ | 225 | /* IEEE 802.11a, channel 100..165 */ |
226 | REG_RULE(5470-10, 5850+10, 40, 6, 20, 0), } | 226 | REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), } |
227 | }; | 227 | }; |
228 | 228 | ||
229 | static const u32 __wl_cipher_suites[] = { | 229 | static const u32 __wl_cipher_suites[] = { |
@@ -341,6 +341,60 @@ static u8 brcmf_mw_to_qdbm(u16 mw) | |||
341 | return qdbm; | 341 | return qdbm; |
342 | } | 342 | } |
343 | 343 | ||
344 | u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | ||
345 | struct cfg80211_chan_def *ch) | ||
346 | { | ||
347 | struct brcmu_chan ch_inf; | ||
348 | s32 primary_offset; | ||
349 | |||
350 | brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", | ||
351 | ch->chan->center_freq, ch->center_freq1, ch->width); | ||
352 | ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); | ||
353 | primary_offset = ch->center_freq1 - ch->chan->center_freq; | ||
354 | switch (ch->width) { | ||
355 | case NL80211_CHAN_WIDTH_20: | ||
356 | ch_inf.bw = BRCMU_CHAN_BW_20; | ||
357 | WARN_ON(primary_offset != 0); | ||
358 | break; | ||
359 | case NL80211_CHAN_WIDTH_40: | ||
360 | ch_inf.bw = BRCMU_CHAN_BW_40; | ||
361 | if (primary_offset < 0) | ||
362 | ch_inf.sb = BRCMU_CHAN_SB_U; | ||
363 | else | ||
364 | ch_inf.sb = BRCMU_CHAN_SB_L; | ||
365 | break; | ||
366 | case NL80211_CHAN_WIDTH_80: | ||
367 | ch_inf.bw = BRCMU_CHAN_BW_80; | ||
368 | if (primary_offset < 0) { | ||
369 | if (primary_offset < -CH_10MHZ_APART) | ||
370 | ch_inf.sb = BRCMU_CHAN_SB_UU; | ||
371 | else | ||
372 | ch_inf.sb = BRCMU_CHAN_SB_UL; | ||
373 | } else { | ||
374 | if (primary_offset > CH_10MHZ_APART) | ||
375 | ch_inf.sb = BRCMU_CHAN_SB_LL; | ||
376 | else | ||
377 | ch_inf.sb = BRCMU_CHAN_SB_LU; | ||
378 | } | ||
379 | break; | ||
380 | default: | ||
381 | WARN_ON_ONCE(1); | ||
382 | } | ||
383 | switch (ch->chan->band) { | ||
384 | case IEEE80211_BAND_2GHZ: | ||
385 | ch_inf.band = BRCMU_CHAN_BAND_2G; | ||
386 | break; | ||
387 | case IEEE80211_BAND_5GHZ: | ||
388 | ch_inf.band = BRCMU_CHAN_BAND_5G; | ||
389 | break; | ||
390 | default: | ||
391 | WARN_ON_ONCE(1); | ||
392 | } | ||
393 | d11inf->encchspec(&ch_inf); | ||
394 | |||
395 | return ch_inf.chspec; | ||
396 | } | ||
397 | |||
344 | u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, | 398 | u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, |
345 | struct ieee80211_channel *ch) | 399 | struct ieee80211_channel *ch) |
346 | { | 400 | { |
@@ -1236,8 +1290,8 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, | |||
1236 | params->chandef.chan->center_freq); | 1290 | params->chandef.chan->center_freq); |
1237 | if (params->channel_fixed) { | 1291 | if (params->channel_fixed) { |
1238 | /* adding chanspec */ | 1292 | /* adding chanspec */ |
1239 | chanspec = channel_to_chanspec(&cfg->d11inf, | 1293 | chanspec = chandef_to_chanspec(&cfg->d11inf, |
1240 | params->chandef.chan); | 1294 | ¶ms->chandef); |
1241 | join_params.params_le.chanspec_list[0] = | 1295 | join_params.params_le.chanspec_list[0] = |
1242 | cpu_to_le16(chanspec); | 1296 | cpu_to_le16(chanspec); |
1243 | join_params.params_le.chanspec_num = cpu_to_le32(1); | 1297 | join_params.params_le.chanspec_num = cpu_to_le32(1); |
@@ -3734,23 +3788,6 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, | |||
3734 | } | 3788 | } |
3735 | 3789 | ||
3736 | static s32 | 3790 | static s32 |
3737 | brcmf_cfg80211_set_channel(struct brcmf_cfg80211_info *cfg, | ||
3738 | struct brcmf_if *ifp, | ||
3739 | struct ieee80211_channel *channel) | ||
3740 | { | ||
3741 | u16 chanspec; | ||
3742 | s32 err; | ||
3743 | |||
3744 | brcmf_dbg(TRACE, "band=%d, center_freq=%d\n", channel->band, | ||
3745 | channel->center_freq); | ||
3746 | |||
3747 | chanspec = channel_to_chanspec(&cfg->d11inf, channel); | ||
3748 | err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); | ||
3749 | |||
3750 | return err; | ||
3751 | } | ||
3752 | |||
3753 | static s32 | ||
3754 | brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | 3791 | brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, |
3755 | struct cfg80211_ap_settings *settings) | 3792 | struct cfg80211_ap_settings *settings) |
3756 | { | 3793 | { |
@@ -3765,11 +3802,12 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3765 | struct brcmf_join_params join_params; | 3802 | struct brcmf_join_params join_params; |
3766 | enum nl80211_iftype dev_role; | 3803 | enum nl80211_iftype dev_role; |
3767 | struct brcmf_fil_bss_enable_le bss_enable; | 3804 | struct brcmf_fil_bss_enable_le bss_enable; |
3805 | u16 chanspec; | ||
3768 | 3806 | ||
3769 | brcmf_dbg(TRACE, "channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", | 3807 | brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n", |
3770 | cfg80211_get_chandef_type(&settings->chandef), | 3808 | settings->chandef.chan->hw_value, |
3771 | settings->beacon_interval, | 3809 | settings->chandef.center_freq1, settings->chandef.width, |
3772 | settings->dtim_period); | 3810 | settings->beacon_interval, settings->dtim_period); |
3773 | brcmf_dbg(TRACE, "ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", | 3811 | brcmf_dbg(TRACE, "ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", |
3774 | settings->ssid, settings->ssid_len, settings->auth_type, | 3812 | settings->ssid, settings->ssid_len, settings->auth_type, |
3775 | settings->inactivity_timeout); | 3813 | settings->inactivity_timeout); |
@@ -3826,9 +3864,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3826 | 3864 | ||
3827 | brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); | 3865 | brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); |
3828 | 3866 | ||
3829 | err = brcmf_cfg80211_set_channel(cfg, ifp, settings->chandef.chan); | 3867 | chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef); |
3868 | err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); | ||
3830 | if (err < 0) { | 3869 | if (err < 0) { |
3831 | brcmf_err("Set Channel failed, %d\n", err); | 3870 | brcmf_err("Set Channel failed: chspec=%d, %d\n", chanspec, err); |
3832 | goto exit; | 3871 | goto exit; |
3833 | } | 3872 | } |
3834 | 3873 | ||
@@ -4364,6 +4403,8 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) | |||
4364 | WIPHY_FLAG_OFFCHAN_TX | | 4403 | WIPHY_FLAG_OFFCHAN_TX | |
4365 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | | 4404 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | |
4366 | WIPHY_FLAG_SUPPORTS_TDLS; | 4405 | WIPHY_FLAG_SUPPORTS_TDLS; |
4406 | if (!brcmf_roamoff) | ||
4407 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; | ||
4367 | wiphy->mgmt_stypes = brcmf_txrx_stypes; | 4408 | wiphy->mgmt_stypes = brcmf_txrx_stypes; |
4368 | wiphy->max_remain_on_channel_duration = 5000; | 4409 | wiphy->max_remain_on_channel_duration = 5000; |
4369 | brcmf_wiphy_pno_params(wiphy); | 4410 | brcmf_wiphy_pno_params(wiphy); |
@@ -4685,7 +4726,6 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, | |||
4685 | struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; | 4726 | struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; |
4686 | struct ieee80211_channel *chan; | 4727 | struct ieee80211_channel *chan; |
4687 | s32 err = 0; | 4728 | s32 err = 0; |
4688 | u16 reason; | ||
4689 | 4729 | ||
4690 | if (brcmf_is_apmode(ifp->vif)) { | 4730 | if (brcmf_is_apmode(ifp->vif)) { |
4691 | err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); | 4731 | err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); |
@@ -4706,16 +4746,6 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, | |||
4706 | brcmf_dbg(CONN, "Linkdown\n"); | 4746 | brcmf_dbg(CONN, "Linkdown\n"); |
4707 | if (!brcmf_is_ibssmode(ifp->vif)) { | 4747 | if (!brcmf_is_ibssmode(ifp->vif)) { |
4708 | brcmf_bss_connect_done(cfg, ndev, e, false); | 4748 | brcmf_bss_connect_done(cfg, ndev, e, false); |
4709 | if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, | ||
4710 | &ifp->vif->sme_state)) { | ||
4711 | reason = 0; | ||
4712 | if (((e->event_code == BRCMF_E_DEAUTH_IND) || | ||
4713 | (e->event_code == BRCMF_E_DISASSOC_IND)) && | ||
4714 | (e->reason != WLAN_REASON_UNSPECIFIED)) | ||
4715 | reason = e->reason; | ||
4716 | cfg80211_disconnected(ndev, reason, NULL, 0, | ||
4717 | GFP_KERNEL); | ||
4718 | } | ||
4719 | } | 4749 | } |
4720 | brcmf_link_down(ifp->vif); | 4750 | brcmf_link_down(ifp->vif); |
4721 | brcmf_init_prof(ndev_to_prof(ndev)); | 4751 | brcmf_init_prof(ndev_to_prof(ndev)); |
@@ -4948,7 +4978,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_if *ifp) | |||
4948 | if (!err) { | 4978 | if (!err) { |
4949 | /* only set 2G bandwidth using bw_cap command */ | 4979 | /* only set 2G bandwidth using bw_cap command */ |
4950 | band_bwcap.band = cpu_to_le32(WLC_BAND_2G); | 4980 | band_bwcap.band = cpu_to_le32(WLC_BAND_2G); |
4951 | band_bwcap.bw_cap = cpu_to_le32(WLC_BW_40MHZ_BIT); | 4981 | band_bwcap.bw_cap = cpu_to_le32(WLC_BW_CAP_40MHZ); |
4952 | err = brcmf_fil_iovar_data_set(ifp, "bw_cap", &band_bwcap, | 4982 | err = brcmf_fil_iovar_data_set(ifp, "bw_cap", &band_bwcap, |
4953 | sizeof(band_bwcap)); | 4983 | sizeof(band_bwcap)); |
4954 | } else { | 4984 | } else { |
@@ -5215,6 +5245,9 @@ static s32 brcmf_construct_reginfo(struct brcmf_cfg80211_info *cfg, | |||
5215 | if (!(bw_cap[band] & WLC_BW_40MHZ_BIT) && | 5245 | if (!(bw_cap[band] & WLC_BW_40MHZ_BIT) && |
5216 | ch.bw == BRCMU_CHAN_BW_40) | 5246 | ch.bw == BRCMU_CHAN_BW_40) |
5217 | continue; | 5247 | continue; |
5248 | if (!(bw_cap[band] & WLC_BW_80MHZ_BIT) && | ||
5249 | ch.bw == BRCMU_CHAN_BW_80) | ||
5250 | continue; | ||
5218 | update = false; | 5251 | update = false; |
5219 | for (j = 0; (j < *n_cnt && (*n_cnt < array_size)); j++) { | 5252 | for (j = 0; (j < *n_cnt && (*n_cnt < array_size)); j++) { |
5220 | if (band_chan_arr[j].hw_value == ch.chnum) { | 5253 | if (band_chan_arr[j].hw_value == ch.chnum) { |
@@ -5231,10 +5264,13 @@ static s32 brcmf_construct_reginfo(struct brcmf_cfg80211_info *cfg, | |||
5231 | ieee80211_channel_to_frequency(ch.chnum, band); | 5264 | ieee80211_channel_to_frequency(ch.chnum, band); |
5232 | band_chan_arr[index].hw_value = ch.chnum; | 5265 | band_chan_arr[index].hw_value = ch.chnum; |
5233 | 5266 | ||
5234 | if (ch.bw == BRCMU_CHAN_BW_40) { | 5267 | /* assuming the chanspecs order is HT20, |
5235 | /* assuming the order is HT20, HT40 Upper, | 5268 | * HT40 upper, HT40 lower, and VHT80. |
5236 | * HT40 lower from chanspecs | 5269 | */ |
5237 | */ | 5270 | if (ch.bw == BRCMU_CHAN_BW_80) { |
5271 | band_chan_arr[index].flags &= | ||
5272 | ~IEEE80211_CHAN_NO_80MHZ; | ||
5273 | } else if (ch.bw == BRCMU_CHAN_BW_40) { | ||
5238 | ht40_flag = band_chan_arr[index].flags & | 5274 | ht40_flag = band_chan_arr[index].flags & |
5239 | IEEE80211_CHAN_NO_HT40; | 5275 | IEEE80211_CHAN_NO_HT40; |
5240 | if (ch.sb == BRCMU_CHAN_SB_U) { | 5276 | if (ch.sb == BRCMU_CHAN_SB_U) { |
@@ -5255,8 +5291,13 @@ static s32 brcmf_construct_reginfo(struct brcmf_cfg80211_info *cfg, | |||
5255 | IEEE80211_CHAN_NO_HT40MINUS; | 5291 | IEEE80211_CHAN_NO_HT40MINUS; |
5256 | } | 5292 | } |
5257 | } else { | 5293 | } else { |
5294 | /* disable other bandwidths for now as mentioned | ||
5295 | * order assure they are enabled for subsequent | ||
5296 | * chanspecs. | ||
5297 | */ | ||
5258 | band_chan_arr[index].flags = | 5298 | band_chan_arr[index].flags = |
5259 | IEEE80211_CHAN_NO_HT40; | 5299 | IEEE80211_CHAN_NO_HT40 | |
5300 | IEEE80211_CHAN_NO_80MHZ; | ||
5260 | ch.bw = BRCMU_CHAN_BW_20; | 5301 | ch.bw = BRCMU_CHAN_BW_20; |
5261 | cfg->d11inf.encchspec(&ch); | 5302 | cfg->d11inf.encchspec(&ch); |
5262 | channel = ch.chspec; | 5303 | channel = ch.chspec; |
@@ -5323,13 +5364,63 @@ static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[]) | |||
5323 | } | 5364 | } |
5324 | } | 5365 | } |
5325 | 5366 | ||
5367 | static void brcmf_update_ht_cap(struct ieee80211_supported_band *band, | ||
5368 | u32 bw_cap[2], u32 nchain) | ||
5369 | { | ||
5370 | band->ht_cap.ht_supported = true; | ||
5371 | if (bw_cap[band->band] & WLC_BW_40MHZ_BIT) { | ||
5372 | band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; | ||
5373 | band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; | ||
5374 | } | ||
5375 | band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; | ||
5376 | band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; | ||
5377 | band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; | ||
5378 | band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; | ||
5379 | memset(band->ht_cap.mcs.rx_mask, 0xff, nchain); | ||
5380 | band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; | ||
5381 | } | ||
5382 | |||
5383 | static __le16 brcmf_get_mcs_map(u32 nchain, enum ieee80211_vht_mcs_support supp) | ||
5384 | { | ||
5385 | u16 mcs_map; | ||
5386 | int i; | ||
5387 | |||
5388 | for (i = 0, mcs_map = 0xFFFF; i < nchain; i++) | ||
5389 | mcs_map = (mcs_map << 2) | supp; | ||
5390 | |||
5391 | return cpu_to_le16(mcs_map); | ||
5392 | } | ||
5393 | |||
5394 | static void brcmf_update_vht_cap(struct ieee80211_supported_band *band, | ||
5395 | u32 bw_cap[2], u32 nchain) | ||
5396 | { | ||
5397 | __le16 mcs_map; | ||
5398 | |||
5399 | /* not allowed in 2.4G band */ | ||
5400 | if (band->band == IEEE80211_BAND_2GHZ) | ||
5401 | return; | ||
5402 | |||
5403 | band->vht_cap.vht_supported = true; | ||
5404 | /* 80MHz is mandatory */ | ||
5405 | band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_80; | ||
5406 | if (bw_cap[band->band] & WLC_BW_160MHZ_BIT) { | ||
5407 | band->vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; | ||
5408 | band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160; | ||
5409 | } | ||
5410 | /* all support 256-QAM */ | ||
5411 | mcs_map = brcmf_get_mcs_map(nchain, IEEE80211_VHT_MCS_SUPPORT_0_9); | ||
5412 | band->vht_cap.vht_mcs.rx_mcs_map = mcs_map; | ||
5413 | band->vht_cap.vht_mcs.tx_mcs_map = mcs_map; | ||
5414 | } | ||
5415 | |||
5326 | static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) | 5416 | static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) |
5327 | { | 5417 | { |
5328 | struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); | 5418 | struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); |
5329 | struct wiphy *wiphy; | 5419 | struct wiphy *wiphy; |
5330 | s32 phy_list; | 5420 | s32 phy_list; |
5331 | u32 band_list[3]; | 5421 | u32 band_list[3]; |
5332 | u32 nmode; | 5422 | u32 nmode = 0; |
5423 | u32 vhtmode = 0; | ||
5333 | u32 bw_cap[2] = { 0, 0 }; | 5424 | u32 bw_cap[2] = { 0, 0 }; |
5334 | u32 rxchain; | 5425 | u32 rxchain; |
5335 | u32 nchain; | 5426 | u32 nchain; |
@@ -5360,14 +5451,16 @@ static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) | |||
5360 | brcmf_dbg(INFO, "BRCMF_C_GET_BANDLIST reported: 0x%08x 0x%08x 0x%08x phy\n", | 5451 | brcmf_dbg(INFO, "BRCMF_C_GET_BANDLIST reported: 0x%08x 0x%08x 0x%08x phy\n", |
5361 | band_list[0], band_list[1], band_list[2]); | 5452 | band_list[0], band_list[1], band_list[2]); |
5362 | 5453 | ||
5454 | (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); | ||
5363 | err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); | 5455 | err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); |
5364 | if (err) { | 5456 | if (err) { |
5365 | brcmf_err("nmode error (%d)\n", err); | 5457 | brcmf_err("nmode error (%d)\n", err); |
5366 | } else { | 5458 | } else { |
5367 | brcmf_get_bwcap(ifp, bw_cap); | 5459 | brcmf_get_bwcap(ifp, bw_cap); |
5368 | } | 5460 | } |
5369 | brcmf_dbg(INFO, "nmode=%d, bw_cap=(%d, %d)\n", nmode, | 5461 | brcmf_dbg(INFO, "nmode=%d, vhtmode=%d, bw_cap=(%d, %d)\n", |
5370 | bw_cap[IEEE80211_BAND_2GHZ], bw_cap[IEEE80211_BAND_5GHZ]); | 5462 | nmode, vhtmode, bw_cap[IEEE80211_BAND_2GHZ], |
5463 | bw_cap[IEEE80211_BAND_5GHZ]); | ||
5371 | 5464 | ||
5372 | err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); | 5465 | err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); |
5373 | if (err) { | 5466 | if (err) { |
@@ -5398,17 +5491,10 @@ static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) | |||
5398 | else | 5491 | else |
5399 | continue; | 5492 | continue; |
5400 | 5493 | ||
5401 | if (bw_cap[band->band] & WLC_BW_40MHZ_BIT) { | 5494 | if (nmode) |
5402 | band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; | 5495 | brcmf_update_ht_cap(band, bw_cap, nchain); |
5403 | band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; | 5496 | if (vhtmode) |
5404 | } | 5497 | brcmf_update_vht_cap(band, bw_cap, nchain); |
5405 | band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; | ||
5406 | band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; | ||
5407 | band->ht_cap.ht_supported = true; | ||
5408 | band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; | ||
5409 | band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; | ||
5410 | memset(band->ht_cap.mcs.rx_mask, 0xff, nchain); | ||
5411 | band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; | ||
5412 | bands[band->band] = band; | 5498 | bands[band->band] = band; |
5413 | } | 5499 | } |
5414 | 5500 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index 8c5fa4e58139..43c71bfaa474 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
@@ -897,7 +897,8 @@ static bool brcms_tx_flush_completed(struct brcms_info *wl) | |||
897 | return result; | 897 | return result; |
898 | } | 898 | } |
899 | 899 | ||
900 | static void brcms_ops_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 900 | static void brcms_ops_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
901 | u32 queues, bool drop) | ||
901 | { | 902 | { |
902 | struct brcms_info *wl = hw->priv; | 903 | struct brcms_info *wl = hw->priv; |
903 | int ret; | 904 | int ret; |
diff --git a/drivers/net/wireless/brcm80211/brcmutil/d11.c b/drivers/net/wireless/brcm80211/brcmutil/d11.c index 30e54e2c6c9b..6cbc33d0fc19 100644 --- a/drivers/net/wireless/brcm80211/brcmutil/d11.c +++ b/drivers/net/wireless/brcm80211/brcmutil/d11.c | |||
@@ -21,43 +21,81 @@ | |||
21 | #include <brcmu_wifi.h> | 21 | #include <brcmu_wifi.h> |
22 | #include <brcmu_d11.h> | 22 | #include <brcmu_d11.h> |
23 | 23 | ||
24 | static void brcmu_d11n_encchspec(struct brcmu_chan *ch) | 24 | static u16 d11n_sb(enum brcmu_chan_sb sb) |
25 | { | 25 | { |
26 | ch->chspec = ch->chnum & BRCMU_CHSPEC_CH_MASK; | 26 | switch (sb) { |
27 | case BRCMU_CHAN_SB_NONE: | ||
28 | return BRCMU_CHSPEC_D11N_SB_N; | ||
29 | case BRCMU_CHAN_SB_L: | ||
30 | return BRCMU_CHSPEC_D11N_SB_L; | ||
31 | case BRCMU_CHAN_SB_U: | ||
32 | return BRCMU_CHSPEC_D11N_SB_U; | ||
33 | default: | ||
34 | WARN_ON(1); | ||
35 | } | ||
36 | return 0; | ||
37 | } | ||
27 | 38 | ||
28 | switch (ch->bw) { | 39 | static u16 d11n_bw(enum brcmu_chan_bw bw) |
40 | { | ||
41 | switch (bw) { | ||
29 | case BRCMU_CHAN_BW_20: | 42 | case BRCMU_CHAN_BW_20: |
30 | ch->chspec |= BRCMU_CHSPEC_D11N_BW_20 | BRCMU_CHSPEC_D11N_SB_N; | 43 | return BRCMU_CHSPEC_D11N_BW_20; |
31 | break; | ||
32 | case BRCMU_CHAN_BW_40: | 44 | case BRCMU_CHAN_BW_40: |
45 | return BRCMU_CHSPEC_D11N_BW_40; | ||
33 | default: | 46 | default: |
34 | WARN_ON_ONCE(1); | 47 | WARN_ON(1); |
35 | break; | ||
36 | } | 48 | } |
49 | return 0; | ||
50 | } | ||
37 | 51 | ||
52 | static void brcmu_d11n_encchspec(struct brcmu_chan *ch) | ||
53 | { | ||
54 | if (ch->bw == BRCMU_CHAN_BW_20) | ||
55 | ch->sb = BRCMU_CHAN_SB_NONE; | ||
56 | |||
57 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_CH_MASK, | ||
58 | BRCMU_CHSPEC_CH_SHIFT, ch->chnum); | ||
59 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11N_SB_MASK, | ||
60 | 0, d11n_sb(ch->sb)); | ||
61 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11N_BW_MASK, | ||
62 | 0, d11n_bw(ch->bw)); | ||
63 | |||
64 | ch->chspec &= ~BRCMU_CHSPEC_D11N_BND_MASK; | ||
38 | if (ch->chnum <= CH_MAX_2G_CHANNEL) | 65 | if (ch->chnum <= CH_MAX_2G_CHANNEL) |
39 | ch->chspec |= BRCMU_CHSPEC_D11N_BND_2G; | 66 | ch->chspec |= BRCMU_CHSPEC_D11N_BND_2G; |
40 | else | 67 | else |
41 | ch->chspec |= BRCMU_CHSPEC_D11N_BND_5G; | 68 | ch->chspec |= BRCMU_CHSPEC_D11N_BND_5G; |
42 | } | 69 | } |
43 | 70 | ||
44 | static void brcmu_d11ac_encchspec(struct brcmu_chan *ch) | 71 | static u16 d11ac_bw(enum brcmu_chan_bw bw) |
45 | { | 72 | { |
46 | ch->chspec = ch->chnum & BRCMU_CHSPEC_CH_MASK; | 73 | switch (bw) { |
47 | |||
48 | switch (ch->bw) { | ||
49 | case BRCMU_CHAN_BW_20: | 74 | case BRCMU_CHAN_BW_20: |
50 | ch->chspec |= BRCMU_CHSPEC_D11AC_BW_20; | 75 | return BRCMU_CHSPEC_D11AC_BW_20; |
51 | break; | ||
52 | case BRCMU_CHAN_BW_40: | 76 | case BRCMU_CHAN_BW_40: |
77 | return BRCMU_CHSPEC_D11AC_BW_40; | ||
53 | case BRCMU_CHAN_BW_80: | 78 | case BRCMU_CHAN_BW_80: |
54 | case BRCMU_CHAN_BW_80P80: | 79 | return BRCMU_CHSPEC_D11AC_BW_80; |
55 | case BRCMU_CHAN_BW_160: | ||
56 | default: | 80 | default: |
57 | WARN_ON_ONCE(1); | 81 | WARN_ON(1); |
58 | break; | ||
59 | } | 82 | } |
83 | return 0; | ||
84 | } | ||
60 | 85 | ||
86 | static void brcmu_d11ac_encchspec(struct brcmu_chan *ch) | ||
87 | { | ||
88 | if (ch->bw == BRCMU_CHAN_BW_20 || ch->sb == BRCMU_CHAN_SB_NONE) | ||
89 | ch->sb = BRCMU_CHAN_SB_L; | ||
90 | |||
91 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_CH_MASK, | ||
92 | BRCMU_CHSPEC_CH_SHIFT, ch->chnum); | ||
93 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11AC_SB_MASK, | ||
94 | BRCMU_CHSPEC_D11AC_SB_SHIFT, ch->sb); | ||
95 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11AC_BW_MASK, | ||
96 | 0, d11ac_bw(ch->bw)); | ||
97 | |||
98 | ch->chspec &= ~BRCMU_CHSPEC_D11AC_BND_MASK; | ||
61 | if (ch->chnum <= CH_MAX_2G_CHANNEL) | 99 | if (ch->chnum <= CH_MAX_2G_CHANNEL) |
62 | ch->chspec |= BRCMU_CHSPEC_D11AC_BND_2G; | 100 | ch->chspec |= BRCMU_CHSPEC_D11AC_BND_2G; |
63 | else | 101 | else |
@@ -73,6 +111,7 @@ static void brcmu_d11n_decchspec(struct brcmu_chan *ch) | |||
73 | switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) { | 111 | switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) { |
74 | case BRCMU_CHSPEC_D11N_BW_20: | 112 | case BRCMU_CHSPEC_D11N_BW_20: |
75 | ch->bw = BRCMU_CHAN_BW_20; | 113 | ch->bw = BRCMU_CHAN_BW_20; |
114 | ch->sb = BRCMU_CHAN_SB_NONE; | ||
76 | break; | 115 | break; |
77 | case BRCMU_CHSPEC_D11N_BW_40: | 116 | case BRCMU_CHSPEC_D11N_BW_40: |
78 | ch->bw = BRCMU_CHAN_BW_40; | 117 | ch->bw = BRCMU_CHAN_BW_40; |
@@ -112,6 +151,7 @@ static void brcmu_d11ac_decchspec(struct brcmu_chan *ch) | |||
112 | switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) { | 151 | switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) { |
113 | case BRCMU_CHSPEC_D11AC_BW_20: | 152 | case BRCMU_CHSPEC_D11AC_BW_20: |
114 | ch->bw = BRCMU_CHAN_BW_20; | 153 | ch->bw = BRCMU_CHAN_BW_20; |
154 | ch->sb = BRCMU_CHAN_SB_NONE; | ||
115 | break; | 155 | break; |
116 | case BRCMU_CHSPEC_D11AC_BW_40: | 156 | case BRCMU_CHSPEC_D11AC_BW_40: |
117 | ch->bw = BRCMU_CHAN_BW_40; | 157 | ch->bw = BRCMU_CHAN_BW_40; |
@@ -128,6 +168,25 @@ static void brcmu_d11ac_decchspec(struct brcmu_chan *ch) | |||
128 | break; | 168 | break; |
129 | case BRCMU_CHSPEC_D11AC_BW_80: | 169 | case BRCMU_CHSPEC_D11AC_BW_80: |
130 | ch->bw = BRCMU_CHAN_BW_80; | 170 | ch->bw = BRCMU_CHAN_BW_80; |
171 | ch->sb = brcmu_maskget16(ch->chspec, BRCMU_CHSPEC_D11AC_SB_MASK, | ||
172 | BRCMU_CHSPEC_D11AC_SB_SHIFT); | ||
173 | switch (ch->sb) { | ||
174 | case BRCMU_CHAN_SB_LL: | ||
175 | ch->chnum -= CH_30MHZ_APART; | ||
176 | break; | ||
177 | case BRCMU_CHAN_SB_LU: | ||
178 | ch->chnum -= CH_10MHZ_APART; | ||
179 | break; | ||
180 | case BRCMU_CHAN_SB_UL: | ||
181 | ch->chnum += CH_10MHZ_APART; | ||
182 | break; | ||
183 | case BRCMU_CHAN_SB_UU: | ||
184 | ch->chnum += CH_30MHZ_APART; | ||
185 | break; | ||
186 | default: | ||
187 | WARN_ON_ONCE(1); | ||
188 | break; | ||
189 | } | ||
131 | break; | 190 | break; |
132 | case BRCMU_CHSPEC_D11AC_BW_8080: | 191 | case BRCMU_CHSPEC_D11AC_BW_8080: |
133 | case BRCMU_CHSPEC_D11AC_BW_160: | 192 | case BRCMU_CHSPEC_D11AC_BW_160: |
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_d11.h b/drivers/net/wireless/brcm80211/include/brcmu_d11.h index 8660a2cba098..f9745ea8b3e0 100644 --- a/drivers/net/wireless/brcm80211/include/brcmu_d11.h +++ b/drivers/net/wireless/brcm80211/include/brcmu_d11.h | |||
@@ -108,13 +108,7 @@ enum brcmu_chan_bw { | |||
108 | }; | 108 | }; |
109 | 109 | ||
110 | enum brcmu_chan_sb { | 110 | enum brcmu_chan_sb { |
111 | BRCMU_CHAN_SB_NONE = 0, | 111 | BRCMU_CHAN_SB_NONE = -1, |
112 | BRCMU_CHAN_SB_L, | ||
113 | BRCMU_CHAN_SB_U, | ||
114 | BRCMU_CHAN_SB_LL, | ||
115 | BRCMU_CHAN_SB_LU, | ||
116 | BRCMU_CHAN_SB_UL, | ||
117 | BRCMU_CHAN_SB_UU, | ||
118 | BRCMU_CHAN_SB_LLL, | 112 | BRCMU_CHAN_SB_LLL, |
119 | BRCMU_CHAN_SB_LLU, | 113 | BRCMU_CHAN_SB_LLU, |
120 | BRCMU_CHAN_SB_LUL, | 114 | BRCMU_CHAN_SB_LUL, |
@@ -123,6 +117,12 @@ enum brcmu_chan_sb { | |||
123 | BRCMU_CHAN_SB_ULU, | 117 | BRCMU_CHAN_SB_ULU, |
124 | BRCMU_CHAN_SB_UUL, | 118 | BRCMU_CHAN_SB_UUL, |
125 | BRCMU_CHAN_SB_UUU, | 119 | BRCMU_CHAN_SB_UUU, |
120 | BRCMU_CHAN_SB_L = BRCMU_CHAN_SB_LLL, | ||
121 | BRCMU_CHAN_SB_U = BRCMU_CHAN_SB_LLU, | ||
122 | BRCMU_CHAN_SB_LL = BRCMU_CHAN_SB_LLL, | ||
123 | BRCMU_CHAN_SB_LU = BRCMU_CHAN_SB_LLU, | ||
124 | BRCMU_CHAN_SB_UL = BRCMU_CHAN_SB_LUL, | ||
125 | BRCMU_CHAN_SB_UU = BRCMU_CHAN_SB_LUU, | ||
126 | }; | 126 | }; |
127 | 127 | ||
128 | struct brcmu_chan { | 128 | struct brcmu_chan { |
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h index 74419d4bd123..76b5d3a86294 100644 --- a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h +++ b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #define CH_UPPER_SB 0x01 | 29 | #define CH_UPPER_SB 0x01 |
30 | #define CH_LOWER_SB 0x02 | 30 | #define CH_LOWER_SB 0x02 |
31 | #define CH_EWA_VALID 0x04 | 31 | #define CH_EWA_VALID 0x04 |
32 | #define CH_30MHZ_APART 6 | ||
32 | #define CH_20MHZ_APART 4 | 33 | #define CH_20MHZ_APART 4 |
33 | #define CH_10MHZ_APART 2 | 34 | #define CH_10MHZ_APART 2 |
34 | #define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */ | 35 | #define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */ |
diff --git a/drivers/net/wireless/cw1200/sta.c b/drivers/net/wireless/cw1200/sta.c index 103f7bce8932..cd0cad7f7759 100644 --- a/drivers/net/wireless/cw1200/sta.c +++ b/drivers/net/wireless/cw1200/sta.c | |||
@@ -936,7 +936,8 @@ static int __cw1200_flush(struct cw1200_common *priv, bool drop) | |||
936 | return ret; | 936 | return ret; |
937 | } | 937 | } |
938 | 938 | ||
939 | void cw1200_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 939 | void cw1200_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
940 | u32 queues, bool drop) | ||
940 | { | 941 | { |
941 | struct cw1200_common *priv = hw->priv; | 942 | struct cw1200_common *priv = hw->priv; |
942 | 943 | ||
diff --git a/drivers/net/wireless/cw1200/sta.h b/drivers/net/wireless/cw1200/sta.h index 35babb62cc6a..b7e386b7662b 100644 --- a/drivers/net/wireless/cw1200/sta.h +++ b/drivers/net/wireless/cw1200/sta.h | |||
@@ -40,7 +40,8 @@ int cw1200_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd, | |||
40 | 40 | ||
41 | int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value); | 41 | int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value); |
42 | 42 | ||
43 | void cw1200_flush(struct ieee80211_hw *hw, u32 queues, bool drop); | 43 | void cw1200_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
44 | u32 queues, bool drop); | ||
44 | 45 | ||
45 | u64 cw1200_prepare_multicast(struct ieee80211_hw *hw, | 46 | u64 cw1200_prepare_multicast(struct ieee80211_hw *hw, |
46 | struct netdev_hw_addr_list *mc_list); | 47 | struct netdev_hw_addr_list *mc_list); |
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c index d37a6fd90d40..b598e2803500 100644 --- a/drivers/net/wireless/iwlegacy/3945.c +++ b/drivers/net/wireless/iwlegacy/3945.c | |||
@@ -573,7 +573,7 @@ il3945_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) | |||
573 | rx_status.flag |= RX_FLAG_SHORTPRE; | 573 | rx_status.flag |= RX_FLAG_SHORTPRE; |
574 | 574 | ||
575 | if ((unlikely(rx_stats->phy_count > 20))) { | 575 | if ((unlikely(rx_stats->phy_count > 20))) { |
576 | D_DROP("dsp size out of range [0,20]: %d/n", | 576 | D_DROP("dsp size out of range [0,20]: %d\n", |
577 | rx_stats->phy_count); | 577 | rx_stats->phy_count); |
578 | return; | 578 | return; |
579 | } | 579 | } |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 888ad5c74639..c159c05db6ef 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -670,7 +670,7 @@ il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) | |||
670 | } | 670 | } |
671 | 671 | ||
672 | if ((unlikely(phy_res->cfg_phy_cnt > 20))) { | 672 | if ((unlikely(phy_res->cfg_phy_cnt > 20))) { |
673 | D_DROP("dsp size out of range [0,20]: %d/n", | 673 | D_DROP("dsp size out of range [0,20]: %d\n", |
674 | phy_res->cfg_phy_cnt); | 674 | phy_res->cfg_phy_cnt); |
675 | return; | 675 | return; |
676 | } | 676 | } |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 4f42174d9994..ecc674627e6e 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -4755,7 +4755,8 @@ out: | |||
4755 | } | 4755 | } |
4756 | EXPORT_SYMBOL(il_mac_change_interface); | 4756 | EXPORT_SYMBOL(il_mac_change_interface); |
4757 | 4757 | ||
4758 | void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 4758 | void il_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
4759 | u32 queues, bool drop) | ||
4759 | { | 4760 | { |
4760 | struct il_priv *il = hw->priv; | 4761 | struct il_priv *il = hw->priv; |
4761 | unsigned long timeout = jiffies + msecs_to_jiffies(500); | 4762 | unsigned long timeout = jiffies + msecs_to_jiffies(500); |
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index dfb13c70efe8..ea5c0f863c4e 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -1723,7 +1723,8 @@ void il_mac_remove_interface(struct ieee80211_hw *hw, | |||
1723 | struct ieee80211_vif *vif); | 1723 | struct ieee80211_vif *vif); |
1724 | int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1724 | int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1725 | enum nl80211_iftype newtype, bool newp2p); | 1725 | enum nl80211_iftype newtype, bool newp2p); |
1726 | void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop); | 1726 | void il_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1727 | u32 queues, bool drop); | ||
1727 | int il_alloc_txq_mem(struct il_priv *il); | 1728 | int il_alloc_txq_mem(struct il_priv *il); |
1728 | void il_free_txq_mem(struct il_priv *il); | 1729 | void il_free_txq_mem(struct il_priv *il); |
1729 | 1730 | ||
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index 74b3b4de7bb7..b82d30c0f0c9 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -2,10 +2,6 @@ config IWLWIFI | |||
2 | tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " | 2 | tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " |
3 | depends on PCI && MAC80211 && HAS_IOMEM | 3 | depends on PCI && MAC80211 && HAS_IOMEM |
4 | select FW_LOADER | 4 | select FW_LOADER |
5 | select NEW_LEDS | ||
6 | select LEDS_CLASS | ||
7 | select LEDS_TRIGGERS | ||
8 | select MAC80211_LEDS | ||
9 | ---help--- | 5 | ---help--- |
10 | Select to build the driver supporting the: | 6 | Select to build the driver supporting the: |
11 | 7 | ||
@@ -43,6 +39,14 @@ config IWLWIFI | |||
43 | say M here and read <file:Documentation/kbuild/modules.txt>. The | 39 | say M here and read <file:Documentation/kbuild/modules.txt>. The |
44 | module will be called iwlwifi. | 40 | module will be called iwlwifi. |
45 | 41 | ||
42 | config IWLWIFI_LEDS | ||
43 | bool | ||
44 | depends on IWLWIFI | ||
45 | depends on LEDS_CLASS | ||
46 | select LEDS_TRIGGERS | ||
47 | select MAC80211_LEDS | ||
48 | default y | ||
49 | |||
46 | config IWLDVM | 50 | config IWLDVM |
47 | tristate "Intel Wireless WiFi DVM Firmware support" | 51 | tristate "Intel Wireless WiFi DVM Firmware support" |
48 | depends on IWLWIFI | 52 | depends on IWLWIFI |
diff --git a/drivers/net/wireless/iwlwifi/dvm/Makefile b/drivers/net/wireless/iwlwifi/dvm/Makefile index dce7ab2e0c4b..4d19685f31c3 100644 --- a/drivers/net/wireless/iwlwifi/dvm/Makefile +++ b/drivers/net/wireless/iwlwifi/dvm/Makefile | |||
@@ -4,9 +4,10 @@ iwldvm-objs += main.o rs.o mac80211.o ucode.o tx.o | |||
4 | iwldvm-objs += lib.o calib.o tt.o sta.o rx.o | 4 | iwldvm-objs += lib.o calib.o tt.o sta.o rx.o |
5 | 5 | ||
6 | iwldvm-objs += power.o | 6 | iwldvm-objs += power.o |
7 | iwldvm-objs += scan.o led.o | 7 | iwldvm-objs += scan.o |
8 | iwldvm-objs += rxon.o devices.o | 8 | iwldvm-objs += rxon.o devices.o |
9 | 9 | ||
10 | iwldvm-$(CONFIG_IWLWIFI_LEDS) += led.o | ||
10 | iwldvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o | 11 | iwldvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o |
11 | 12 | ||
12 | ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ | 13 | ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ |
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h index 3441f70d0ff9..a6f22c32a279 100644 --- a/drivers/net/wireless/iwlwifi/dvm/dev.h +++ b/drivers/net/wireless/iwlwifi/dvm/dev.h | |||
@@ -888,9 +888,11 @@ struct iwl_priv { | |||
888 | 888 | ||
889 | struct iwl_event_log event_log; | 889 | struct iwl_event_log event_log; |
890 | 890 | ||
891 | #ifdef CONFIG_IWLWIFI_LEDS | ||
891 | struct led_classdev led; | 892 | struct led_classdev led; |
892 | unsigned long blink_on, blink_off; | 893 | unsigned long blink_on, blink_off; |
893 | bool led_registered; | 894 | bool led_registered; |
895 | #endif | ||
894 | 896 | ||
895 | /* WoWLAN GTK rekey data */ | 897 | /* WoWLAN GTK rekey data */ |
896 | u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; | 898 | u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/led.h b/drivers/net/wireless/iwlwifi/dvm/led.h index 6a0817d9c4fa..1c6b2252d0f2 100644 --- a/drivers/net/wireless/iwlwifi/dvm/led.h +++ b/drivers/net/wireless/iwlwifi/dvm/led.h | |||
@@ -36,8 +36,20 @@ struct iwl_priv; | |||
36 | #define IWL_LED_ACTIVITY (0<<1) | 36 | #define IWL_LED_ACTIVITY (0<<1) |
37 | #define IWL_LED_LINK (1<<1) | 37 | #define IWL_LED_LINK (1<<1) |
38 | 38 | ||
39 | #ifdef CONFIG_IWLWIFI_LEDS | ||
39 | void iwlagn_led_enable(struct iwl_priv *priv); | 40 | void iwlagn_led_enable(struct iwl_priv *priv); |
40 | void iwl_leds_init(struct iwl_priv *priv); | 41 | void iwl_leds_init(struct iwl_priv *priv); |
41 | void iwl_leds_exit(struct iwl_priv *priv); | 42 | void iwl_leds_exit(struct iwl_priv *priv); |
43 | #else | ||
44 | static inline void iwlagn_led_enable(struct iwl_priv *priv) | ||
45 | { | ||
46 | } | ||
47 | static inline void iwl_leds_init(struct iwl_priv *priv) | ||
48 | { | ||
49 | } | ||
50 | static inline void iwl_leds_exit(struct iwl_priv *priv) | ||
51 | { | ||
52 | } | ||
53 | #endif | ||
42 | 54 | ||
43 | #endif /* __iwl_leds_h__ */ | 55 | #endif /* __iwl_leds_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index d3abc15125d6..29af7b51e370 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c | |||
@@ -1091,7 +1091,8 @@ static void iwlagn_configure_filter(struct ieee80211_hw *hw, | |||
1091 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | 1091 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | static void iwlagn_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1094 | static void iwlagn_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1095 | u32 queues, bool drop) | ||
1095 | { | 1096 | { |
1096 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 1097 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
1097 | 1098 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index f73de239cdc1..48730064da73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -98,7 +98,7 @@ | |||
98 | #define NVM_HW_SECTION_NUM_FAMILY_7000 0 | 98 | #define NVM_HW_SECTION_NUM_FAMILY_7000 0 |
99 | 99 | ||
100 | static const struct iwl_base_params iwl7000_base_params = { | 100 | static const struct iwl_base_params iwl7000_base_params = { |
101 | .eeprom_size = OTP_LOW_IMAGE_SIZE, | 101 | .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_7000, |
102 | .num_of_queues = IWLAGN_NUM_QUEUES, | 102 | .num_of_queues = IWLAGN_NUM_QUEUES, |
103 | .pll_cfg_val = 0, | 103 | .pll_cfg_val = 0, |
104 | .shadow_ram_support = true, | 104 | .shadow_ram_support = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c index f5bd82b88592..b26b68ce8205 100644 --- a/drivers/net/wireless/iwlwifi/iwl-8000.c +++ b/drivers/net/wireless/iwlwifi/iwl-8000.c | |||
@@ -85,7 +85,7 @@ | |||
85 | #define NVM_HW_SECTION_NUM_FAMILY_8000 10 | 85 | #define NVM_HW_SECTION_NUM_FAMILY_8000 10 |
86 | 86 | ||
87 | static const struct iwl_base_params iwl8000_base_params = { | 87 | static const struct iwl_base_params iwl8000_base_params = { |
88 | .eeprom_size = OTP_LOW_IMAGE_SIZE, | 88 | .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000, |
89 | .num_of_queues = IWLAGN_NUM_QUEUES, | 89 | .num_of_queues = IWLAGN_NUM_QUEUES, |
90 | .pll_cfg_val = 0, | 90 | .pll_cfg_val = 0, |
91 | .shadow_ram_support = true, | 91 | .shadow_ram_support = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h index 7f37fb86837b..04a483d38659 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h | |||
@@ -102,9 +102,7 @@ | |||
102 | 102 | ||
103 | /* EEPROM */ | 103 | /* EEPROM */ |
104 | #define IWLAGN_EEPROM_IMG_SIZE 2048 | 104 | #define IWLAGN_EEPROM_IMG_SIZE 2048 |
105 | /* OTP */ | 105 | |
106 | /* lower blocks contain EEPROM image and calibration data */ | ||
107 | #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ | ||
108 | /* high blocks contain PAPD data */ | 106 | /* high blocks contain PAPD data */ |
109 | #define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */ | 107 | #define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */ |
110 | #define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */ | 108 | #define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h index 7ce82d9c7222..97f23d6e480b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/iwlwifi/iwl-config.h | |||
@@ -193,6 +193,11 @@ struct iwl_ht_params { | |||
193 | #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS 0x80 | 193 | #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS 0x80 |
194 | #define EEPROM_REGULATORY_BAND_NO_HT40 0 | 194 | #define EEPROM_REGULATORY_BAND_NO_HT40 0 |
195 | 195 | ||
196 | /* lower blocks contain EEPROM image and calibration data */ | ||
197 | #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ | ||
198 | #define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (4 * 512 * sizeof(u16)) /* 4 KB */ | ||
199 | #define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */ | ||
200 | |||
196 | struct iwl_eeprom_params { | 201 | struct iwl_eeprom_params { |
197 | const u8 regulatory_bands[7]; | 202 | const u8 regulatory_bands[7]; |
198 | bool enhanced_txpower; | 203 | bool enhanced_txpower; |
@@ -269,6 +274,7 @@ struct iwl_cfg { | |||
269 | u8 nvm_hw_section_num; | 274 | u8 nvm_hw_section_num; |
270 | bool lp_xtal_workaround; | 275 | bool lp_xtal_workaround; |
271 | const struct iwl_pwr_tx_backoff *pwr_tx_backoffs; | 276 | const struct iwl_pwr_tx_backoff *pwr_tx_backoffs; |
277 | bool no_power_up_nic_in_init; | ||
272 | }; | 278 | }; |
273 | 279 | ||
274 | /* | 280 | /* |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-error-dump.h b/drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h index f381908be7e5..2953ffceda38 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-error-dump.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h | |||
@@ -72,11 +72,14 @@ | |||
72 | * @IWL_FW_ERROR_DUMP_SRAM: | 72 | * @IWL_FW_ERROR_DUMP_SRAM: |
73 | * @IWL_FW_ERROR_DUMP_REG: | 73 | * @IWL_FW_ERROR_DUMP_REG: |
74 | * @IWL_FW_ERROR_DUMP_RXF: | 74 | * @IWL_FW_ERROR_DUMP_RXF: |
75 | * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as | ||
76 | * &struct iwl_fw_error_dump_txcmd packets | ||
75 | */ | 77 | */ |
76 | enum iwl_fw_error_dump_type { | 78 | enum iwl_fw_error_dump_type { |
77 | IWL_FW_ERROR_DUMP_SRAM = 0, | 79 | IWL_FW_ERROR_DUMP_SRAM = 0, |
78 | IWL_FW_ERROR_DUMP_REG = 1, | 80 | IWL_FW_ERROR_DUMP_REG = 1, |
79 | IWL_FW_ERROR_DUMP_RXF = 2, | 81 | IWL_FW_ERROR_DUMP_RXF = 2, |
82 | IWL_FW_ERROR_DUMP_TXCMD = 3, | ||
80 | 83 | ||
81 | IWL_FW_ERROR_DUMP_MAX, | 84 | IWL_FW_ERROR_DUMP_MAX, |
82 | }; | 85 | }; |
@@ -105,4 +108,27 @@ struct iwl_fw_error_dump_file { | |||
105 | u8 data[0]; | 108 | u8 data[0]; |
106 | } __packed; | 109 | } __packed; |
107 | 110 | ||
111 | /** | ||
112 | * struct iwl_fw_error_dump_txcmd - TX command data | ||
113 | * @cmdlen: original length of command | ||
114 | * @caplen: captured length of command (may be less) | ||
115 | * @data: captured command data, @caplen bytes | ||
116 | */ | ||
117 | struct iwl_fw_error_dump_txcmd { | ||
118 | __le32 cmdlen; | ||
119 | __le32 caplen; | ||
120 | u8 data[]; | ||
121 | } __packed; | ||
122 | |||
123 | /** | ||
124 | * iwl_mvm_fw_error_next_data - advance fw error dump data pointer | ||
125 | * @data: previous data block | ||
126 | * Returns: next data block | ||
127 | */ | ||
128 | static inline struct iwl_fw_error_dump_data * | ||
129 | iwl_mvm_fw_error_next_data(struct iwl_fw_error_dump_data *data) | ||
130 | { | ||
131 | return (void *)(data->data + le32_to_cpu(data->len)); | ||
132 | } | ||
133 | |||
108 | #endif /* __fw_error_dump_h__ */ | 134 | #endif /* __fw_error_dump_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index f5927d0cf9b6..6fea27c0dd8e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
@@ -116,9 +116,11 @@ enum iwl_ucode_tlv_flag { | |||
116 | /** | 116 | /** |
117 | * enum iwl_ucode_tlv_api - ucode api | 117 | * enum iwl_ucode_tlv_api - ucode api |
118 | * @IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID: wowlan config includes tid field. | 118 | * @IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID: wowlan config includes tid field. |
119 | * @IWL_UCODE_TLV_API_CSA_FLOW: ucode can do unbind-bind flow for CSA. | ||
119 | */ | 120 | */ |
120 | enum iwl_ucode_tlv_api { | 121 | enum iwl_ucode_tlv_api { |
121 | IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0), | 122 | IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0), |
123 | IWL_UCODE_TLV_API_CSA_FLOW = BIT(4), | ||
122 | }; | 124 | }; |
123 | 125 | ||
124 | /** | 126 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c index 4049c0d626ba..49963e4a887e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/types.h> | 62 | #include <linux/types.h> |
63 | #include <linux/slab.h> | 63 | #include <linux/slab.h> |
64 | #include <linux/export.h> | 64 | #include <linux/export.h> |
65 | #include <linux/etherdevice.h> | ||
65 | #include "iwl-drv.h" | 66 | #include "iwl-drv.h" |
66 | #include "iwl-modparams.h" | 67 | #include "iwl-modparams.h" |
67 | #include "iwl-nvm-parse.h" | 68 | #include "iwl-nvm-parse.h" |
@@ -450,13 +451,7 @@ static void iwl_set_hw_address(const struct iwl_cfg *cfg, | |||
450 | struct iwl_nvm_data *data, | 451 | struct iwl_nvm_data *data, |
451 | const __le16 *nvm_sec) | 452 | const __le16 *nvm_sec) |
452 | { | 453 | { |
453 | u8 hw_addr[ETH_ALEN]; | 454 | const u8 *hw_addr = (const u8 *)(nvm_sec + HW_ADDR); |
454 | |||
455 | if (cfg->device_family != IWL_DEVICE_FAMILY_8000) | ||
456 | memcpy(hw_addr, nvm_sec + HW_ADDR, ETH_ALEN); | ||
457 | else | ||
458 | memcpy(hw_addr, nvm_sec + MAC_ADDRESS_OVERRIDE_FAMILY_8000, | ||
459 | ETH_ALEN); | ||
460 | 455 | ||
461 | /* The byte order is little endian 16 bit, meaning 214365 */ | 456 | /* The byte order is little endian 16 bit, meaning 214365 */ |
462 | data->hw_addr[0] = hw_addr[1]; | 457 | data->hw_addr[0] = hw_addr[1]; |
@@ -467,6 +462,41 @@ static void iwl_set_hw_address(const struct iwl_cfg *cfg, | |||
467 | data->hw_addr[5] = hw_addr[4]; | 462 | data->hw_addr[5] = hw_addr[4]; |
468 | } | 463 | } |
469 | 464 | ||
465 | static void iwl_set_hw_address_family_8000(const struct iwl_cfg *cfg, | ||
466 | struct iwl_nvm_data *data, | ||
467 | const __le16 *mac_override, | ||
468 | const __le16 *nvm_hw) | ||
469 | { | ||
470 | const u8 *hw_addr; | ||
471 | |||
472 | if (mac_override) { | ||
473 | hw_addr = (const u8 *)(mac_override + | ||
474 | MAC_ADDRESS_OVERRIDE_FAMILY_8000); | ||
475 | |||
476 | /* The byte order is little endian 16 bit, meaning 214365 */ | ||
477 | data->hw_addr[0] = hw_addr[1]; | ||
478 | data->hw_addr[1] = hw_addr[0]; | ||
479 | data->hw_addr[2] = hw_addr[3]; | ||
480 | data->hw_addr[3] = hw_addr[2]; | ||
481 | data->hw_addr[4] = hw_addr[5]; | ||
482 | data->hw_addr[5] = hw_addr[4]; | ||
483 | |||
484 | if (is_valid_ether_addr(hw_addr)) | ||
485 | return; | ||
486 | } | ||
487 | |||
488 | /* take the MAC address from the OTP */ | ||
489 | hw_addr = (const u8 *)(nvm_hw + HW_ADDR0_FAMILY_8000); | ||
490 | data->hw_addr[0] = hw_addr[3]; | ||
491 | data->hw_addr[1] = hw_addr[2]; | ||
492 | data->hw_addr[2] = hw_addr[1]; | ||
493 | data->hw_addr[3] = hw_addr[0]; | ||
494 | |||
495 | hw_addr = (const u8 *)(nvm_hw + HW_ADDR1_FAMILY_8000); | ||
496 | data->hw_addr[4] = hw_addr[1]; | ||
497 | data->hw_addr[5] = hw_addr[0]; | ||
498 | } | ||
499 | |||
470 | struct iwl_nvm_data * | 500 | struct iwl_nvm_data * |
471 | iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, | 501 | iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, |
472 | const __le16 *nvm_hw, const __le16 *nvm_sw, | 502 | const __le16 *nvm_hw, const __le16 *nvm_sw, |
@@ -526,7 +556,7 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, | |||
526 | rx_chains); | 556 | rx_chains); |
527 | } else { | 557 | } else { |
528 | /* MAC address in family 8000 */ | 558 | /* MAC address in family 8000 */ |
529 | iwl_set_hw_address(cfg, data, mac_override); | 559 | iwl_set_hw_address_family_8000(cfg, data, mac_override, nvm_hw); |
530 | 560 | ||
531 | iwl_init_sbands(dev, cfg, data, regulatory, | 561 | iwl_init_sbands(dev, cfg, data, regulatory, |
532 | sku & NVM_SKU_CAP_11AC_ENABLE, tx_chains, | 562 | sku & NVM_SKU_CAP_11AC_ENABLE, tx_chains, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 22fd94ec8048..84ad48de6e29 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -463,6 +463,11 @@ struct iwl_trans; | |||
463 | * @unref: release a reference previously taken with @ref. Note that | 463 | * @unref: release a reference previously taken with @ref. Note that |
464 | * initially the reference count is 1, making an initial @unref | 464 | * initially the reference count is 1, making an initial @unref |
465 | * necessary to allow low power states. | 465 | * necessary to allow low power states. |
466 | * @dump_data: fill a data dump with debug data, maybe containing last | ||
467 | * TX'ed commands and similar. When called with a NULL buffer and | ||
468 | * zero buffer length, provide only the (estimated) required buffer | ||
469 | * length. Return the used buffer length. | ||
470 | * Note that the transport must fill in the proper file headers. | ||
466 | */ | 471 | */ |
467 | struct iwl_trans_ops { | 472 | struct iwl_trans_ops { |
468 | 473 | ||
@@ -511,6 +516,10 @@ struct iwl_trans_ops { | |||
511 | u32 value); | 516 | u32 value); |
512 | void (*ref)(struct iwl_trans *trans); | 517 | void (*ref)(struct iwl_trans *trans); |
513 | void (*unref)(struct iwl_trans *trans); | 518 | void (*unref)(struct iwl_trans *trans); |
519 | |||
520 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
521 | u32 (*dump_data)(struct iwl_trans *trans, void *buf, u32 buflen); | ||
522 | #endif | ||
514 | }; | 523 | }; |
515 | 524 | ||
516 | /** | 525 | /** |
@@ -664,6 +673,16 @@ static inline void iwl_trans_unref(struct iwl_trans *trans) | |||
664 | trans->ops->unref(trans); | 673 | trans->ops->unref(trans); |
665 | } | 674 | } |
666 | 675 | ||
676 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
677 | static inline u32 iwl_trans_dump_data(struct iwl_trans *trans, | ||
678 | void *buf, u32 buflen) | ||
679 | { | ||
680 | if (!trans->ops->dump_data) | ||
681 | return 0; | ||
682 | return trans->ops->dump_data(trans, buf, buflen); | ||
683 | } | ||
684 | #endif | ||
685 | |||
667 | static inline int iwl_trans_send_cmd(struct iwl_trans *trans, | 686 | static inline int iwl_trans_send_cmd(struct iwl_trans *trans, |
668 | struct iwl_host_cmd *cmd) | 687 | struct iwl_host_cmd *cmd) |
669 | { | 688 | { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/Makefile b/drivers/net/wireless/iwlwifi/mvm/Makefile index ccdd3b7c4cce..c30d7f64ec1e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/Makefile +++ b/drivers/net/wireless/iwlwifi/mvm/Makefile | |||
@@ -3,8 +3,9 @@ iwlmvm-y += fw.o mac80211.o nvm.o ops.o phy-ctxt.o mac-ctxt.o | |||
3 | iwlmvm-y += utils.o rx.o tx.o binding.o quota.o sta.o sf.o | 3 | iwlmvm-y += utils.o rx.o tx.o binding.o quota.o sta.o sf.o |
4 | iwlmvm-y += scan.o time-event.o rs.o | 4 | iwlmvm-y += scan.o time-event.o rs.o |
5 | iwlmvm-y += power.o coex.o | 5 | iwlmvm-y += power.o coex.o |
6 | iwlmvm-y += led.o tt.o offloading.o | 6 | iwlmvm-y += tt.o offloading.o |
7 | iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o | 7 | iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o |
8 | iwlmvm-$(CONFIG_IWLWIFI_LEDS) += led.o | ||
8 | iwlmvm-$(CONFIG_PM_SLEEP) += d3.o | 9 | iwlmvm-$(CONFIG_PM_SLEEP) += d3.o |
9 | 10 | ||
10 | ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ | 11 | ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 8f4b03dbaf3f..4284672d0397 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
@@ -611,14 +611,14 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
611 | bt_cmd->flags |= cpu_to_le32(BT_COEX_SYNC2SCO); | 611 | bt_cmd->flags |= cpu_to_le32(BT_COEX_SYNC2SCO); |
612 | 612 | ||
613 | if (IWL_MVM_BT_COEX_CORUNNING) { | 613 | if (IWL_MVM_BT_COEX_CORUNNING) { |
614 | bt_cmd->valid_bit_msk = cpu_to_le32(BT_VALID_CORUN_LUT_20 | | 614 | bt_cmd->valid_bit_msk |= cpu_to_le32(BT_VALID_CORUN_LUT_20 | |
615 | BT_VALID_CORUN_LUT_40); | 615 | BT_VALID_CORUN_LUT_40); |
616 | bt_cmd->flags |= cpu_to_le32(BT_COEX_CORUNNING); | 616 | bt_cmd->flags |= cpu_to_le32(BT_COEX_CORUNNING); |
617 | } | 617 | } |
618 | 618 | ||
619 | if (IWL_MVM_BT_COEX_MPLUT) { | 619 | if (IWL_MVM_BT_COEX_MPLUT) { |
620 | bt_cmd->flags |= cpu_to_le32(BT_COEX_MPLUT); | 620 | bt_cmd->flags |= cpu_to_le32(BT_COEX_MPLUT); |
621 | bt_cmd->valid_bit_msk = cpu_to_le32(BT_VALID_MULTI_PRIO_LUT); | 621 | bt_cmd->valid_bit_msk |= cpu_to_le32(BT_VALID_MULTI_PRIO_LUT); |
622 | } | 622 | } |
623 | 623 | ||
624 | if (mvm->cfg->bt_shared_single_ant) | 624 | if (mvm->cfg->bt_shared_single_ant) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index f462c9baa2b5..bef487bb880e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
@@ -67,7 +67,7 @@ | |||
67 | #include "iwl-io.h" | 67 | #include "iwl-io.h" |
68 | #include "iwl-prph.h" | 68 | #include "iwl-prph.h" |
69 | #include "debugfs.h" | 69 | #include "debugfs.h" |
70 | #include "fw-error-dump.h" | 70 | #include "iwl-fw-error-dump.h" |
71 | 71 | ||
72 | static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm *mvm, char *buf, | 72 | static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm *mvm, char *buf, |
73 | size_t count, loff_t *ppos) | 73 | size_t count, loff_t *ppos) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h index 6174c027ff59..6959fda3fe09 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h | |||
@@ -187,9 +187,9 @@ enum iwl_scan_type { | |||
187 | * this number of packets were received (typically 1) | 187 | * this number of packets were received (typically 1) |
188 | * @passive2active: is auto switching from passive to active during scan allowed | 188 | * @passive2active: is auto switching from passive to active during scan allowed |
189 | * @rxchain_sel_flags: RXON_RX_CHAIN_* | 189 | * @rxchain_sel_flags: RXON_RX_CHAIN_* |
190 | * @max_out_time: in usecs, max out of serving channel time | 190 | * @max_out_time: in TUs, max out of serving channel time |
191 | * @suspend_time: how long to pause scan when returning to service channel: | 191 | * @suspend_time: how long to pause scan when returning to service channel: |
192 | * bits 0-19: beacon interal in usecs (suspend before executing) | 192 | * bits 0-19: beacon interal in TUs (suspend before executing) |
193 | * bits 20-23: reserved | 193 | * bits 20-23: reserved |
194 | * bits 24-31: number of beacons (suspend between channels) | 194 | * bits 24-31: number of beacons (suspend between channels) |
195 | * @rxon_flags: RXON_FLG_* | 195 | * @rxon_flags: RXON_FLG_* |
@@ -387,8 +387,8 @@ enum scan_framework_client { | |||
387 | * @quiet_plcp_th: quiet channel num of packets threshold | 387 | * @quiet_plcp_th: quiet channel num of packets threshold |
388 | * @good_CRC_th: passive to active promotion threshold | 388 | * @good_CRC_th: passive to active promotion threshold |
389 | * @rx_chain: RXON rx chain. | 389 | * @rx_chain: RXON rx chain. |
390 | * @max_out_time: max uSec to be out of assoceated channel | 390 | * @max_out_time: max TUs to be out of assoceated channel |
391 | * @suspend_time: pause scan this long when returning to service channel | 391 | * @suspend_time: pause scan this TUs when returning to service channel |
392 | * @flags: RXON flags | 392 | * @flags: RXON flags |
393 | * @filter_flags: RXONfilter | 393 | * @filter_flags: RXONfilter |
394 | * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz. | 394 | * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz. |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c index 3d99cf564ba6..34ae3f32b300 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/iwlwifi/mvm/fw.c | |||
@@ -295,7 +295,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
295 | /* Read the NVM only at driver load time, no need to do this twice */ | 295 | /* Read the NVM only at driver load time, no need to do this twice */ |
296 | if (read_nvm) { | 296 | if (read_nvm) { |
297 | /* Read nvm */ | 297 | /* Read nvm */ |
298 | ret = iwl_nvm_init(mvm); | 298 | ret = iwl_nvm_init(mvm, true); |
299 | if (ret) { | 299 | if (ret) { |
300 | IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); | 300 | IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); |
301 | goto error; | 301 | goto error; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index 7110ec2605d6..56cf58e95698 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
@@ -1237,11 +1237,23 @@ int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, | |||
1237 | u32 rate __maybe_unused = | 1237 | u32 rate __maybe_unused = |
1238 | le32_to_cpu(beacon->beacon_notify_hdr.initial_rate); | 1238 | le32_to_cpu(beacon->beacon_notify_hdr.initial_rate); |
1239 | 1239 | ||
1240 | lockdep_assert_held(&mvm->mutex); | ||
1241 | |||
1240 | IWL_DEBUG_RX(mvm, "beacon status %#x retries:%d tsf:0x%16llX rate:%d\n", | 1242 | IWL_DEBUG_RX(mvm, "beacon status %#x retries:%d tsf:0x%16llX rate:%d\n", |
1241 | status & TX_STATUS_MSK, | 1243 | status & TX_STATUS_MSK, |
1242 | beacon->beacon_notify_hdr.failure_frame, | 1244 | beacon->beacon_notify_hdr.failure_frame, |
1243 | le64_to_cpu(beacon->tsf), | 1245 | le64_to_cpu(beacon->tsf), |
1244 | rate); | 1246 | rate); |
1247 | |||
1248 | if (unlikely(mvm->csa_vif && mvm->csa_vif->csa_active)) { | ||
1249 | if (!ieee80211_csa_is_complete(mvm->csa_vif)) { | ||
1250 | iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm->csa_vif); | ||
1251 | } else { | ||
1252 | ieee80211_csa_finish(mvm->csa_vif); | ||
1253 | mvm->csa_vif = NULL; | ||
1254 | } | ||
1255 | } | ||
1256 | |||
1245 | return 0; | 1257 | return 0; |
1246 | } | 1258 | } |
1247 | 1259 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 97c3deae6552..f20cbd06a49f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -320,6 +320,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
320 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_GO_UAPSD) | 320 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_GO_UAPSD) |
321 | hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; | 321 | hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; |
322 | 322 | ||
323 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_CSA_FLOW) | ||
324 | hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; | ||
325 | |||
323 | hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; | 326 | hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; |
324 | hw->wiphy->n_iface_combinations = | 327 | hw->wiphy->n_iface_combinations = |
325 | ARRAY_SIZE(iwl_mvm_iface_combinations); | 328 | ARRAY_SIZE(iwl_mvm_iface_combinations); |
@@ -539,13 +542,22 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, | |||
539 | return -EACCES; | 542 | return -EACCES; |
540 | 543 | ||
541 | /* return from D0i3 before starting a new Tx aggregation */ | 544 | /* return from D0i3 before starting a new Tx aggregation */ |
542 | if (action == IEEE80211_AMPDU_TX_START) { | 545 | switch (action) { |
546 | case IEEE80211_AMPDU_TX_START: | ||
547 | case IEEE80211_AMPDU_TX_STOP_CONT: | ||
548 | case IEEE80211_AMPDU_TX_STOP_FLUSH: | ||
549 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: | ||
550 | case IEEE80211_AMPDU_TX_OPERATIONAL: | ||
543 | iwl_mvm_ref(mvm, IWL_MVM_REF_TX_AGG); | 551 | iwl_mvm_ref(mvm, IWL_MVM_REF_TX_AGG); |
544 | tx_agg_ref = true; | 552 | tx_agg_ref = true; |
545 | 553 | ||
546 | /* | 554 | /* |
547 | * wait synchronously until D0i3 exit to get the correct | 555 | * for tx start, wait synchronously until D0i3 exit to |
548 | * sequence number for the tid | 556 | * get the correct sequence number for the tid. |
557 | * additionally, some other ampdu actions use direct | ||
558 | * target access, which is not handled automatically | ||
559 | * by the trans layer (unlike commands), so wait for | ||
560 | * d0i3 exit in these cases as well. | ||
549 | */ | 561 | */ |
550 | if (!wait_event_timeout(mvm->d0i3_exit_waitq, | 562 | if (!wait_event_timeout(mvm->d0i3_exit_waitq, |
551 | !test_bit(IWL_MVM_STATUS_IN_D0I3, &mvm->status), HZ)) { | 563 | !test_bit(IWL_MVM_STATUS_IN_D0I3, &mvm->status), HZ)) { |
@@ -553,6 +565,9 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, | |||
553 | iwl_mvm_unref(mvm, IWL_MVM_REF_TX_AGG); | 565 | iwl_mvm_unref(mvm, IWL_MVM_REF_TX_AGG); |
554 | return -EIO; | 566 | return -EIO; |
555 | } | 567 | } |
568 | break; | ||
569 | default: | ||
570 | break; | ||
556 | } | 571 | } |
557 | 572 | ||
558 | mutex_lock(&mvm->mutex); | 573 | mutex_lock(&mvm->mutex); |
@@ -1005,7 +1020,7 @@ static void iwl_mvm_mc_iface_iterator(void *_data, u8 *mac, | |||
1005 | memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN); | 1020 | memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN); |
1006 | len = roundup(sizeof(*cmd) + cmd->count * ETH_ALEN, 4); | 1021 | len = roundup(sizeof(*cmd) + cmd->count * ETH_ALEN, 4); |
1007 | 1022 | ||
1008 | ret = iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC, len, cmd); | 1023 | ret = iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_ASYNC, len, cmd); |
1009 | if (ret) | 1024 | if (ret) |
1010 | IWL_ERR(mvm, "mcast filter cmd error. ret=%d\n", ret); | 1025 | IWL_ERR(mvm, "mcast filter cmd error. ret=%d\n", ret); |
1011 | } | 1026 | } |
@@ -1021,7 +1036,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) | |||
1021 | if (WARN_ON_ONCE(!mvm->mcast_filter_cmd)) | 1036 | if (WARN_ON_ONCE(!mvm->mcast_filter_cmd)) |
1022 | return; | 1037 | return; |
1023 | 1038 | ||
1024 | ieee80211_iterate_active_interfaces( | 1039 | ieee80211_iterate_active_interfaces_atomic( |
1025 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | 1040 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
1026 | iwl_mvm_mc_iface_iterator, &iter_data); | 1041 | iwl_mvm_mc_iface_iterator, &iter_data); |
1027 | } | 1042 | } |
@@ -1814,6 +1829,11 @@ static int iwl_mvm_mac_sched_scan_start(struct ieee80211_hw *hw, | |||
1814 | 1829 | ||
1815 | mutex_lock(&mvm->mutex); | 1830 | mutex_lock(&mvm->mutex); |
1816 | 1831 | ||
1832 | if (!iwl_mvm_is_idle(mvm)) { | ||
1833 | ret = -EBUSY; | ||
1834 | goto out; | ||
1835 | } | ||
1836 | |||
1817 | switch (mvm->scan_status) { | 1837 | switch (mvm->scan_status) { |
1818 | case IWL_MVM_SCAN_OS: | 1838 | case IWL_MVM_SCAN_OS: |
1819 | IWL_DEBUG_SCAN(mvm, "Stopping previous scan for sched_scan\n"); | 1839 | IWL_DEBUG_SCAN(mvm, "Stopping previous scan for sched_scan\n"); |
@@ -2186,6 +2206,11 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, | |||
2186 | 2206 | ||
2187 | switch (vif->type) { | 2207 | switch (vif->type) { |
2188 | case NL80211_IFTYPE_AP: | 2208 | case NL80211_IFTYPE_AP: |
2209 | /* Unless it's a CSA flow we have nothing to do here */ | ||
2210 | if (vif->csa_active) { | ||
2211 | mvmvif->ap_ibss_active = true; | ||
2212 | break; | ||
2213 | } | ||
2189 | case NL80211_IFTYPE_ADHOC: | 2214 | case NL80211_IFTYPE_ADHOC: |
2190 | /* | 2215 | /* |
2191 | * The AP binding flow is handled as part of the start_ap flow | 2216 | * The AP binding flow is handled as part of the start_ap flow |
@@ -2222,6 +2247,12 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, | |||
2222 | goto out_remove_binding; | 2247 | goto out_remove_binding; |
2223 | } | 2248 | } |
2224 | 2249 | ||
2250 | /* Handle binding during CSA */ | ||
2251 | if (vif->type == NL80211_IFTYPE_AP) { | ||
2252 | iwl_mvm_update_quotas(mvm, vif); | ||
2253 | iwl_mvm_mac_ctxt_changed(mvm, vif); | ||
2254 | } | ||
2255 | |||
2225 | goto out_unlock; | 2256 | goto out_unlock; |
2226 | 2257 | ||
2227 | out_remove_binding: | 2258 | out_remove_binding: |
@@ -2246,13 +2277,20 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw, | |||
2246 | iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); | 2277 | iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); |
2247 | 2278 | ||
2248 | switch (vif->type) { | 2279 | switch (vif->type) { |
2249 | case NL80211_IFTYPE_AP: | ||
2250 | case NL80211_IFTYPE_ADHOC: | 2280 | case NL80211_IFTYPE_ADHOC: |
2251 | goto out_unlock; | 2281 | goto out_unlock; |
2252 | case NL80211_IFTYPE_MONITOR: | 2282 | case NL80211_IFTYPE_MONITOR: |
2253 | mvmvif->monitor_active = false; | 2283 | mvmvif->monitor_active = false; |
2254 | iwl_mvm_update_quotas(mvm, NULL); | 2284 | iwl_mvm_update_quotas(mvm, NULL); |
2255 | break; | 2285 | break; |
2286 | case NL80211_IFTYPE_AP: | ||
2287 | /* This part is triggered only during CSA */ | ||
2288 | if (!vif->csa_active || !mvmvif->ap_ibss_active) | ||
2289 | goto out_unlock; | ||
2290 | |||
2291 | mvmvif->ap_ibss_active = false; | ||
2292 | iwl_mvm_update_quotas(mvm, NULL); | ||
2293 | /*TODO: bt_coex notification here? */ | ||
2256 | default: | 2294 | default: |
2257 | break; | 2295 | break; |
2258 | } | 2296 | } |
@@ -2348,6 +2386,53 @@ static int iwl_mvm_mac_testmode_cmd(struct ieee80211_hw *hw, | |||
2348 | } | 2386 | } |
2349 | #endif | 2387 | #endif |
2350 | 2388 | ||
2389 | static void iwl_mvm_channel_switch_beacon(struct ieee80211_hw *hw, | ||
2390 | struct ieee80211_vif *vif, | ||
2391 | struct cfg80211_chan_def *chandef) | ||
2392 | { | ||
2393 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | ||
2394 | |||
2395 | mutex_lock(&mvm->mutex); | ||
2396 | if (WARN(mvm->csa_vif && mvm->csa_vif->csa_active, | ||
2397 | "Another CSA is already in progress")) | ||
2398 | goto out_unlock; | ||
2399 | |||
2400 | IWL_DEBUG_MAC80211(mvm, "CSA started to freq %d\n", | ||
2401 | chandef->center_freq1); | ||
2402 | mvm->csa_vif = vif; | ||
2403 | |||
2404 | out_unlock: | ||
2405 | mutex_unlock(&mvm->mutex); | ||
2406 | } | ||
2407 | |||
2408 | static void iwl_mvm_mac_flush(struct ieee80211_hw *hw, | ||
2409 | struct ieee80211_vif *vif, u32 queues, bool drop) | ||
2410 | { | ||
2411 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | ||
2412 | struct iwl_mvm_vif *mvmvif; | ||
2413 | struct iwl_mvm_sta *mvmsta; | ||
2414 | |||
2415 | if (!vif || vif->type != NL80211_IFTYPE_STATION) | ||
2416 | return; | ||
2417 | |||
2418 | mutex_lock(&mvm->mutex); | ||
2419 | mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
2420 | mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id); | ||
2421 | |||
2422 | if (WARN_ON_ONCE(!mvmsta)) | ||
2423 | goto done; | ||
2424 | |||
2425 | if (drop) { | ||
2426 | if (iwl_mvm_flush_tx_path(mvm, mvmsta->tfd_queue_msk, true)) | ||
2427 | IWL_ERR(mvm, "flush request fail\n"); | ||
2428 | } else { | ||
2429 | iwl_trans_wait_tx_queue_empty(mvm->trans, | ||
2430 | mvmsta->tfd_queue_msk); | ||
2431 | } | ||
2432 | done: | ||
2433 | mutex_unlock(&mvm->mutex); | ||
2434 | } | ||
2435 | |||
2351 | const struct ieee80211_ops iwl_mvm_hw_ops = { | 2436 | const struct ieee80211_ops iwl_mvm_hw_ops = { |
2352 | .tx = iwl_mvm_mac_tx, | 2437 | .tx = iwl_mvm_mac_tx, |
2353 | .ampdu_action = iwl_mvm_mac_ampdu_action, | 2438 | .ampdu_action = iwl_mvm_mac_ampdu_action, |
@@ -2371,6 +2456,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = { | |||
2371 | .sta_rc_update = iwl_mvm_sta_rc_update, | 2456 | .sta_rc_update = iwl_mvm_sta_rc_update, |
2372 | .conf_tx = iwl_mvm_mac_conf_tx, | 2457 | .conf_tx = iwl_mvm_mac_conf_tx, |
2373 | .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx, | 2458 | .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx, |
2459 | .flush = iwl_mvm_mac_flush, | ||
2374 | .sched_scan_start = iwl_mvm_mac_sched_scan_start, | 2460 | .sched_scan_start = iwl_mvm_mac_sched_scan_start, |
2375 | .sched_scan_stop = iwl_mvm_mac_sched_scan_stop, | 2461 | .sched_scan_stop = iwl_mvm_mac_sched_scan_stop, |
2376 | .set_key = iwl_mvm_mac_set_key, | 2462 | .set_key = iwl_mvm_mac_set_key, |
@@ -2390,6 +2476,8 @@ const struct ieee80211_ops iwl_mvm_hw_ops = { | |||
2390 | 2476 | ||
2391 | .set_tim = iwl_mvm_set_tim, | 2477 | .set_tim = iwl_mvm_set_tim, |
2392 | 2478 | ||
2479 | .channel_switch_beacon = iwl_mvm_channel_switch_beacon, | ||
2480 | |||
2393 | CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd) | 2481 | CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd) |
2394 | 2482 | ||
2395 | #ifdef CONFIG_PM_SLEEP | 2483 | #ifdef CONFIG_PM_SLEEP |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 17c42da5f9f2..8747d03311f3 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -589,7 +589,9 @@ struct iwl_mvm { | |||
589 | u32 *fw_error_rxf; | 589 | u32 *fw_error_rxf; |
590 | u32 fw_error_rxf_len; | 590 | u32 fw_error_rxf_len; |
591 | 591 | ||
592 | #ifdef CONFIG_IWLWIFI_LEDS | ||
592 | struct led_classdev led; | 593 | struct led_classdev led; |
594 | #endif | ||
593 | 595 | ||
594 | struct ieee80211_vif *p2p_device_vif; | 596 | struct ieee80211_vif *p2p_device_vif; |
595 | 597 | ||
@@ -642,6 +644,8 @@ struct iwl_mvm { | |||
642 | 644 | ||
643 | /* Indicate if device power save is allowed */ | 645 | /* Indicate if device power save is allowed */ |
644 | bool ps_disabled; | 646 | bool ps_disabled; |
647 | |||
648 | struct ieee80211_vif *csa_vif; | ||
645 | }; | 649 | }; |
646 | 650 | ||
647 | /* Extract MVM priv from op_mode and _hw */ | 651 | /* Extract MVM priv from op_mode and _hw */ |
@@ -757,7 +761,7 @@ int iwl_mvm_rx_statistics(struct iwl_mvm *mvm, | |||
757 | struct iwl_device_cmd *cmd); | 761 | struct iwl_device_cmd *cmd); |
758 | 762 | ||
759 | /* NVM */ | 763 | /* NVM */ |
760 | int iwl_nvm_init(struct iwl_mvm *mvm); | 764 | int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic); |
761 | int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); | 765 | int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); |
762 | 766 | ||
763 | int iwl_mvm_up(struct iwl_mvm *mvm); | 767 | int iwl_mvm_up(struct iwl_mvm *mvm); |
@@ -896,8 +900,18 @@ int iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm, | |||
896 | struct iwl_rx_cmd_buffer *rxb, | 900 | struct iwl_rx_cmd_buffer *rxb, |
897 | struct iwl_device_cmd *cmd); | 901 | struct iwl_device_cmd *cmd); |
898 | 902 | ||
903 | #ifdef CONFIG_IWLWIFI_LEDS | ||
899 | int iwl_mvm_leds_init(struct iwl_mvm *mvm); | 904 | int iwl_mvm_leds_init(struct iwl_mvm *mvm); |
900 | void iwl_mvm_leds_exit(struct iwl_mvm *mvm); | 905 | void iwl_mvm_leds_exit(struct iwl_mvm *mvm); |
906 | #else | ||
907 | static inline int iwl_mvm_leds_init(struct iwl_mvm *mvm) | ||
908 | { | ||
909 | return 0; | ||
910 | } | ||
911 | static inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm) | ||
912 | { | ||
913 | } | ||
914 | #endif | ||
901 | 915 | ||
902 | /* D3 (WoWLAN, NetDetect) */ | 916 | /* D3 (WoWLAN, NetDetect) */ |
903 | int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); | 917 | int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); |
@@ -1015,6 +1029,9 @@ static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif) | |||
1015 | return mvmvif->low_latency; | 1029 | return mvmvif->low_latency; |
1016 | } | 1030 | } |
1017 | 1031 | ||
1032 | /* Assoc status */ | ||
1033 | bool iwl_mvm_is_idle(struct iwl_mvm *mvm); | ||
1034 | |||
1018 | /* Thermal management and CT-kill */ | 1035 | /* Thermal management and CT-kill */ |
1019 | void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff); | 1036 | void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff); |
1020 | void iwl_mvm_tt_handler(struct iwl_mvm *mvm); | 1037 | void iwl_mvm_tt_handler(struct iwl_mvm *mvm); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/nvm.c b/drivers/net/wireless/iwlwifi/mvm/nvm.c index cf2d09f53782..6b88c29ebe6b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/nvm.c +++ b/drivers/net/wireless/iwlwifi/mvm/nvm.c | |||
@@ -238,13 +238,20 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm) | |||
238 | return NULL; | 238 | return NULL; |
239 | } | 239 | } |
240 | } else { | 240 | } else { |
241 | /* SW and REGULATORY sections are mandatory */ | ||
241 | if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || | 242 | if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || |
242 | !mvm->nvm_sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data || | ||
243 | !mvm->nvm_sections[NVM_SECTION_TYPE_REGULATORY].data) { | 243 | !mvm->nvm_sections[NVM_SECTION_TYPE_REGULATORY].data) { |
244 | IWL_ERR(mvm, | 244 | IWL_ERR(mvm, |
245 | "Can't parse empty family 8000 NVM sections\n"); | 245 | "Can't parse empty family 8000 NVM sections\n"); |
246 | return NULL; | 246 | return NULL; |
247 | } | 247 | } |
248 | /* MAC_OVERRIDE or at least HW section must exist */ | ||
249 | if (!mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data && | ||
250 | !mvm->nvm_sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data) { | ||
251 | IWL_ERR(mvm, | ||
252 | "Can't parse mac_address, empty sections\n"); | ||
253 | return NULL; | ||
254 | } | ||
248 | } | 255 | } |
249 | 256 | ||
250 | if (WARN_ON(!mvm->cfg)) | 257 | if (WARN_ON(!mvm->cfg)) |
@@ -427,7 +434,7 @@ int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm) | |||
427 | return ret; | 434 | return ret; |
428 | } | 435 | } |
429 | 436 | ||
430 | int iwl_nvm_init(struct iwl_mvm *mvm) | 437 | int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic) |
431 | { | 438 | { |
432 | int ret, i, section; | 439 | int ret, i, section; |
433 | u8 *nvm_buffer, *temp; | 440 | u8 *nvm_buffer, *temp; |
@@ -437,13 +444,8 @@ int iwl_nvm_init(struct iwl_mvm *mvm) | |||
437 | if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS)) | 444 | if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS)) |
438 | return -EINVAL; | 445 | return -EINVAL; |
439 | 446 | ||
440 | /* load external NVM if configured */ | 447 | /* load NVM values from nic */ |
441 | if (iwlwifi_mod_params.nvm_file) { | 448 | if (read_nvm_from_nic) { |
442 | /* move to External NVM flow */ | ||
443 | ret = iwl_mvm_read_external_nvm(mvm); | ||
444 | if (ret) | ||
445 | return ret; | ||
446 | } else { | ||
447 | /* list of NVM sections we are allowed/need to read */ | 449 | /* list of NVM sections we are allowed/need to read */ |
448 | if (mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) { | 450 | if (mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) { |
449 | nvm_to_read[0] = mvm->cfg->nvm_hw_section_num; | 451 | nvm_to_read[0] = mvm->cfg->nvm_hw_section_num; |
@@ -463,7 +465,6 @@ int iwl_nvm_init(struct iwl_mvm *mvm) | |||
463 | /* Read From FW NVM */ | 465 | /* Read From FW NVM */ |
464 | IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n"); | 466 | IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n"); |
465 | 467 | ||
466 | /* TODO: find correct NVM max size for a section */ | ||
467 | nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size, | 468 | nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size, |
468 | GFP_KERNEL); | 469 | GFP_KERNEL); |
469 | if (!nvm_buffer) | 470 | if (!nvm_buffer) |
@@ -511,6 +512,15 @@ int iwl_nvm_init(struct iwl_mvm *mvm) | |||
511 | return ret; | 512 | return ret; |
512 | } | 513 | } |
513 | 514 | ||
515 | /* load external NVM if configured */ | ||
516 | if (iwlwifi_mod_params.nvm_file) { | ||
517 | /* move to External NVM flow */ | ||
518 | ret = iwl_mvm_read_external_nvm(mvm); | ||
519 | if (ret) | ||
520 | return ret; | ||
521 | } | ||
522 | |||
523 | /* parse the relevant nvm sections */ | ||
514 | mvm->nvm_data = iwl_parse_nvm_sections(mvm); | 524 | mvm->nvm_data = iwl_parse_nvm_sections(mvm); |
515 | if (!mvm->nvm_data) | 525 | if (!mvm->nvm_data) |
516 | return -ENODATA; | 526 | return -ENODATA; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index 7a5a8bac5fd0..f8530b329d17 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -79,8 +79,8 @@ | |||
79 | #include "iwl-prph.h" | 79 | #include "iwl-prph.h" |
80 | #include "rs.h" | 80 | #include "rs.h" |
81 | #include "fw-api-scan.h" | 81 | #include "fw-api-scan.h" |
82 | #include "fw-error-dump.h" | ||
83 | #include "time-event.h" | 82 | #include "time-event.h" |
83 | #include "iwl-fw-error-dump.h" | ||
84 | 84 | ||
85 | /* | 85 | /* |
86 | * module name, copyright, version, etc. | 86 | * module name, copyright, version, etc. |
@@ -220,7 +220,7 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { | |||
220 | RX_HANDLER(BA_NOTIF, iwl_mvm_rx_ba_notif, false), | 220 | RX_HANDLER(BA_NOTIF, iwl_mvm_rx_ba_notif, false), |
221 | 221 | ||
222 | RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, true), | 222 | RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, true), |
223 | RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, false), | 223 | RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, true), |
224 | RX_HANDLER(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, true), | 224 | RX_HANDLER(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, true), |
225 | RX_HANDLER(ANTENNA_COUPLING_NOTIFICATION, | 225 | RX_HANDLER(ANTENNA_COUPLING_NOTIFICATION, |
226 | iwl_mvm_rx_ant_coupling_notif, true), | 226 | iwl_mvm_rx_ant_coupling_notif, true), |
@@ -467,12 +467,18 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
467 | min_backoff = calc_min_backoff(trans, cfg); | 467 | min_backoff = calc_min_backoff(trans, cfg); |
468 | iwl_mvm_tt_initialize(mvm, min_backoff); | 468 | iwl_mvm_tt_initialize(mvm, min_backoff); |
469 | 469 | ||
470 | if (WARN(cfg->no_power_up_nic_in_init && !iwlwifi_mod_params.nvm_file, | ||
471 | "not allowing power-up and not having nvm_file\n")) | ||
472 | goto out_free; | ||
473 | |||
470 | /* | 474 | /* |
471 | * If the NVM exists in an external file, | 475 | * Even if nvm exists in the nvm_file driver should read agin the nvm |
472 | * there is no need to unnecessarily power up the NIC at driver load | 476 | * from the nic because there might be entries that exist in the OTP |
477 | * and not in the file. | ||
478 | * for nics with no_power_up_nic_in_init: rely completley on nvm_file | ||
473 | */ | 479 | */ |
474 | if (iwlwifi_mod_params.nvm_file) { | 480 | if (cfg->no_power_up_nic_in_init && iwlwifi_mod_params.nvm_file) { |
475 | err = iwl_nvm_init(mvm); | 481 | err = iwl_nvm_init(mvm, false); |
476 | if (err) | 482 | if (err) |
477 | goto out_free; | 483 | goto out_free; |
478 | } else { | 484 | } else { |
@@ -519,7 +525,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
519 | out_free: | 525 | out_free: |
520 | iwl_phy_db_free(mvm->phy_db); | 526 | iwl_phy_db_free(mvm->phy_db); |
521 | kfree(mvm->scan_cmd); | 527 | kfree(mvm->scan_cmd); |
522 | if (!iwlwifi_mod_params.nvm_file) | 528 | if (!cfg->no_power_up_nic_in_init || !iwlwifi_mod_params.nvm_file) |
523 | iwl_trans_op_mode_leave(trans); | 529 | iwl_trans_op_mode_leave(trans); |
524 | ieee80211_free_hw(mvm->hw); | 530 | ieee80211_free_hw(mvm->hw); |
525 | return NULL; | 531 | return NULL; |
@@ -816,6 +822,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | |||
816 | struct iwl_fw_error_dump_file *dump_file; | 822 | struct iwl_fw_error_dump_file *dump_file; |
817 | struct iwl_fw_error_dump_data *dump_data; | 823 | struct iwl_fw_error_dump_data *dump_data; |
818 | u32 file_len; | 824 | u32 file_len; |
825 | u32 trans_len; | ||
819 | 826 | ||
820 | lockdep_assert_held(&mvm->mutex); | 827 | lockdep_assert_held(&mvm->mutex); |
821 | 828 | ||
@@ -827,6 +834,10 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | |||
827 | sizeof(*dump_file) + | 834 | sizeof(*dump_file) + |
828 | sizeof(*dump_data) * 2; | 835 | sizeof(*dump_data) * 2; |
829 | 836 | ||
837 | trans_len = iwl_trans_dump_data(mvm->trans, NULL, 0); | ||
838 | if (trans_len) | ||
839 | file_len += trans_len; | ||
840 | |||
830 | dump_file = vmalloc(file_len); | 841 | dump_file = vmalloc(file_len); |
831 | if (!dump_file) | 842 | if (!dump_file) |
832 | return; | 843 | return; |
@@ -840,7 +851,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | |||
840 | dump_data->len = cpu_to_le32(mvm->fw_error_rxf_len); | 851 | dump_data->len = cpu_to_le32(mvm->fw_error_rxf_len); |
841 | memcpy(dump_data->data, mvm->fw_error_rxf, mvm->fw_error_rxf_len); | 852 | memcpy(dump_data->data, mvm->fw_error_rxf, mvm->fw_error_rxf_len); |
842 | 853 | ||
843 | dump_data = (void *)((u8 *)dump_data->data + mvm->fw_error_rxf_len); | 854 | dump_data = iwl_mvm_fw_error_next_data(dump_data); |
844 | dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_SRAM); | 855 | dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_SRAM); |
845 | dump_data->len = cpu_to_le32(mvm->fw_error_sram_len); | 856 | dump_data->len = cpu_to_le32(mvm->fw_error_sram_len); |
846 | 857 | ||
@@ -858,6 +869,15 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | |||
858 | kfree(mvm->fw_error_sram); | 869 | kfree(mvm->fw_error_sram); |
859 | mvm->fw_error_sram = NULL; | 870 | mvm->fw_error_sram = NULL; |
860 | mvm->fw_error_sram_len = 0; | 871 | mvm->fw_error_sram_len = 0; |
872 | |||
873 | if (trans_len) { | ||
874 | void *buf = iwl_mvm_fw_error_next_data(dump_data); | ||
875 | u32 real_trans_len = iwl_trans_dump_data(mvm->trans, buf, | ||
876 | trans_len); | ||
877 | dump_data = (void *)((u8 *)buf + real_trans_len); | ||
878 | dump_file->file_len = | ||
879 | cpu_to_le32(file_len - trans_len + real_trans_len); | ||
880 | } | ||
861 | } | 881 | } |
862 | #endif | 882 | #endif |
863 | 883 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c index 237efe0ac1c4..eafc517a5f9e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c | |||
@@ -202,18 +202,15 @@ int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, | |||
202 | struct cfg80211_chan_def *chandef, | 202 | struct cfg80211_chan_def *chandef, |
203 | u8 chains_static, u8 chains_dynamic) | 203 | u8 chains_static, u8 chains_dynamic) |
204 | { | 204 | { |
205 | int ret; | ||
206 | |||
207 | WARN_ON(!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && | 205 | WARN_ON(!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && |
208 | ctxt->ref); | 206 | ctxt->ref); |
209 | lockdep_assert_held(&mvm->mutex); | 207 | lockdep_assert_held(&mvm->mutex); |
210 | 208 | ||
211 | ctxt->channel = chandef->chan; | 209 | ctxt->channel = chandef->chan; |
212 | ret = iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, | ||
213 | chains_static, chains_dynamic, | ||
214 | FW_CTXT_ACTION_ADD, 0); | ||
215 | 210 | ||
216 | return ret; | 211 | return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, |
212 | chains_static, chains_dynamic, | ||
213 | FW_CTXT_ACTION_ADD, 0); | ||
217 | } | 214 | } |
218 | 215 | ||
219 | /* | 216 | /* |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index d44b2b33b5cc..10ad1dca5f17 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
@@ -211,7 +211,7 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
211 | .next_columns = { | 211 | .next_columns = { |
212 | RS_COLUMN_LEGACY_ANT_B, | 212 | RS_COLUMN_LEGACY_ANT_B, |
213 | RS_COLUMN_SISO_ANT_A, | 213 | RS_COLUMN_SISO_ANT_A, |
214 | RS_COLUMN_SISO_ANT_B, | 214 | RS_COLUMN_MIMO2, |
215 | RS_COLUMN_INVALID, | 215 | RS_COLUMN_INVALID, |
216 | RS_COLUMN_INVALID, | 216 | RS_COLUMN_INVALID, |
217 | RS_COLUMN_INVALID, | 217 | RS_COLUMN_INVALID, |
@@ -223,8 +223,8 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
223 | .ant = ANT_B, | 223 | .ant = ANT_B, |
224 | .next_columns = { | 224 | .next_columns = { |
225 | RS_COLUMN_LEGACY_ANT_A, | 225 | RS_COLUMN_LEGACY_ANT_A, |
226 | RS_COLUMN_SISO_ANT_A, | ||
227 | RS_COLUMN_SISO_ANT_B, | 226 | RS_COLUMN_SISO_ANT_B, |
227 | RS_COLUMN_MIMO2, | ||
228 | RS_COLUMN_INVALID, | 228 | RS_COLUMN_INVALID, |
229 | RS_COLUMN_INVALID, | 229 | RS_COLUMN_INVALID, |
230 | RS_COLUMN_INVALID, | 230 | RS_COLUMN_INVALID, |
@@ -238,10 +238,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
238 | RS_COLUMN_SISO_ANT_B, | 238 | RS_COLUMN_SISO_ANT_B, |
239 | RS_COLUMN_MIMO2, | 239 | RS_COLUMN_MIMO2, |
240 | RS_COLUMN_SISO_ANT_A_SGI, | 240 | RS_COLUMN_SISO_ANT_A_SGI, |
241 | RS_COLUMN_SISO_ANT_B_SGI, | ||
242 | RS_COLUMN_LEGACY_ANT_A, | 241 | RS_COLUMN_LEGACY_ANT_A, |
243 | RS_COLUMN_LEGACY_ANT_B, | 242 | RS_COLUMN_LEGACY_ANT_B, |
244 | RS_COLUMN_INVALID, | 243 | RS_COLUMN_INVALID, |
244 | RS_COLUMN_INVALID, | ||
245 | }, | 245 | }, |
246 | .checks = { | 246 | .checks = { |
247 | rs_siso_allow, | 247 | rs_siso_allow, |
@@ -254,10 +254,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
254 | RS_COLUMN_SISO_ANT_A, | 254 | RS_COLUMN_SISO_ANT_A, |
255 | RS_COLUMN_MIMO2, | 255 | RS_COLUMN_MIMO2, |
256 | RS_COLUMN_SISO_ANT_B_SGI, | 256 | RS_COLUMN_SISO_ANT_B_SGI, |
257 | RS_COLUMN_SISO_ANT_A_SGI, | ||
258 | RS_COLUMN_LEGACY_ANT_A, | 257 | RS_COLUMN_LEGACY_ANT_A, |
259 | RS_COLUMN_LEGACY_ANT_B, | 258 | RS_COLUMN_LEGACY_ANT_B, |
260 | RS_COLUMN_INVALID, | 259 | RS_COLUMN_INVALID, |
260 | RS_COLUMN_INVALID, | ||
261 | }, | 261 | }, |
262 | .checks = { | 262 | .checks = { |
263 | rs_siso_allow, | 263 | rs_siso_allow, |
@@ -271,10 +271,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
271 | RS_COLUMN_SISO_ANT_B_SGI, | 271 | RS_COLUMN_SISO_ANT_B_SGI, |
272 | RS_COLUMN_MIMO2_SGI, | 272 | RS_COLUMN_MIMO2_SGI, |
273 | RS_COLUMN_SISO_ANT_A, | 273 | RS_COLUMN_SISO_ANT_A, |
274 | RS_COLUMN_SISO_ANT_B, | ||
275 | RS_COLUMN_MIMO2, | ||
276 | RS_COLUMN_LEGACY_ANT_A, | 274 | RS_COLUMN_LEGACY_ANT_A, |
277 | RS_COLUMN_LEGACY_ANT_B, | 275 | RS_COLUMN_LEGACY_ANT_B, |
276 | RS_COLUMN_INVALID, | ||
277 | RS_COLUMN_INVALID, | ||
278 | }, | 278 | }, |
279 | .checks = { | 279 | .checks = { |
280 | rs_siso_allow, | 280 | rs_siso_allow, |
@@ -289,10 +289,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
289 | RS_COLUMN_SISO_ANT_A_SGI, | 289 | RS_COLUMN_SISO_ANT_A_SGI, |
290 | RS_COLUMN_MIMO2_SGI, | 290 | RS_COLUMN_MIMO2_SGI, |
291 | RS_COLUMN_SISO_ANT_B, | 291 | RS_COLUMN_SISO_ANT_B, |
292 | RS_COLUMN_SISO_ANT_A, | ||
293 | RS_COLUMN_MIMO2, | ||
294 | RS_COLUMN_LEGACY_ANT_A, | 292 | RS_COLUMN_LEGACY_ANT_A, |
295 | RS_COLUMN_LEGACY_ANT_B, | 293 | RS_COLUMN_LEGACY_ANT_B, |
294 | RS_COLUMN_INVALID, | ||
295 | RS_COLUMN_INVALID, | ||
296 | }, | 296 | }, |
297 | .checks = { | 297 | .checks = { |
298 | rs_siso_allow, | 298 | rs_siso_allow, |
@@ -304,12 +304,12 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
304 | .ant = ANT_AB, | 304 | .ant = ANT_AB, |
305 | .next_columns = { | 305 | .next_columns = { |
306 | RS_COLUMN_SISO_ANT_A, | 306 | RS_COLUMN_SISO_ANT_A, |
307 | RS_COLUMN_SISO_ANT_B, | ||
308 | RS_COLUMN_SISO_ANT_A_SGI, | ||
309 | RS_COLUMN_SISO_ANT_B_SGI, | ||
310 | RS_COLUMN_MIMO2_SGI, | 307 | RS_COLUMN_MIMO2_SGI, |
311 | RS_COLUMN_LEGACY_ANT_A, | 308 | RS_COLUMN_LEGACY_ANT_A, |
312 | RS_COLUMN_LEGACY_ANT_B, | 309 | RS_COLUMN_LEGACY_ANT_B, |
310 | RS_COLUMN_INVALID, | ||
311 | RS_COLUMN_INVALID, | ||
312 | RS_COLUMN_INVALID, | ||
313 | }, | 313 | }, |
314 | .checks = { | 314 | .checks = { |
315 | rs_mimo_allow, | 315 | rs_mimo_allow, |
@@ -321,12 +321,12 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
321 | .sgi = true, | 321 | .sgi = true, |
322 | .next_columns = { | 322 | .next_columns = { |
323 | RS_COLUMN_SISO_ANT_A_SGI, | 323 | RS_COLUMN_SISO_ANT_A_SGI, |
324 | RS_COLUMN_SISO_ANT_B_SGI, | ||
325 | RS_COLUMN_SISO_ANT_A, | ||
326 | RS_COLUMN_SISO_ANT_B, | ||
327 | RS_COLUMN_MIMO2, | 324 | RS_COLUMN_MIMO2, |
328 | RS_COLUMN_LEGACY_ANT_A, | 325 | RS_COLUMN_LEGACY_ANT_A, |
329 | RS_COLUMN_LEGACY_ANT_B, | 326 | RS_COLUMN_LEGACY_ANT_B, |
327 | RS_COLUMN_INVALID, | ||
328 | RS_COLUMN_INVALID, | ||
329 | RS_COLUMN_INVALID, | ||
330 | }, | 330 | }, |
331 | .checks = { | 331 | .checks = { |
332 | rs_mimo_allow, | 332 | rs_mimo_allow, |
@@ -1031,7 +1031,7 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, | |||
1031 | return; | 1031 | return; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | #ifdef CPTCFG_MAC80211_DEBUGFS | 1034 | #ifdef CONFIG_MAC80211_DEBUGFS |
1035 | /* Disable last tx check if we are debugging with fixed rate */ | 1035 | /* Disable last tx check if we are debugging with fixed rate */ |
1036 | if (lq_sta->dbg_fixed_rate) { | 1036 | if (lq_sta->dbg_fixed_rate) { |
1037 | IWL_DEBUG_RATE(mvm, "Fixed rate. avoid rate scaling\n"); | 1037 | IWL_DEBUG_RATE(mvm, "Fixed rate. avoid rate scaling\n"); |
@@ -1335,105 +1335,50 @@ static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, | |||
1335 | tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); | 1335 | tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); |
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | /* | ||
1339 | * Find starting rate for new "search" high-throughput mode of modulation. | ||
1340 | * Goal is to find lowest expected rate (under perfect conditions) that is | ||
1341 | * above the current measured throughput of "active" mode, to give new mode | ||
1342 | * a fair chance to prove itself without too many challenges. | ||
1343 | * | ||
1344 | * This gets called when transitioning to more aggressive modulation | ||
1345 | * (i.e. legacy to SISO or MIMO, or SISO to MIMO), as well as less aggressive | ||
1346 | * (i.e. MIMO to SISO). When moving to MIMO, bit rate will typically need | ||
1347 | * to decrease to match "active" throughput. When moving from MIMO to SISO, | ||
1348 | * bit rate will typically need to increase, but not if performance was bad. | ||
1349 | */ | ||
1350 | static s32 rs_get_best_rate(struct iwl_mvm *mvm, | 1338 | static s32 rs_get_best_rate(struct iwl_mvm *mvm, |
1351 | struct iwl_lq_sta *lq_sta, | 1339 | struct iwl_lq_sta *lq_sta, |
1352 | struct iwl_scale_tbl_info *tbl, /* "search" */ | 1340 | struct iwl_scale_tbl_info *tbl, /* "search" */ |
1353 | u16 rate_mask, s8 index) | 1341 | unsigned long rate_mask, s8 index) |
1354 | { | 1342 | { |
1355 | /* "active" values */ | ||
1356 | struct iwl_scale_tbl_info *active_tbl = | 1343 | struct iwl_scale_tbl_info *active_tbl = |
1357 | &(lq_sta->lq_info[lq_sta->active_tbl]); | 1344 | &(lq_sta->lq_info[lq_sta->active_tbl]); |
1358 | s32 active_sr = active_tbl->win[index].success_ratio; | 1345 | s32 success_ratio = active_tbl->win[index].success_ratio; |
1359 | s32 active_tpt = active_tbl->expected_tpt[index]; | 1346 | u16 expected_current_tpt = active_tbl->expected_tpt[index]; |
1360 | /* expected "search" throughput */ | ||
1361 | const u16 *tpt_tbl = tbl->expected_tpt; | 1347 | const u16 *tpt_tbl = tbl->expected_tpt; |
1362 | |||
1363 | s32 new_rate, high, low, start_hi; | ||
1364 | u16 high_low; | 1348 | u16 high_low; |
1365 | s8 rate = index; | 1349 | u32 target_tpt; |
1366 | 1350 | int rate_idx; | |
1367 | new_rate = high = low = start_hi = IWL_RATE_INVALID; | ||
1368 | |||
1369 | while (1) { | ||
1370 | high_low = rs_get_adjacent_rate(mvm, rate, rate_mask, | ||
1371 | tbl->rate.type); | ||
1372 | |||
1373 | low = high_low & 0xff; | ||
1374 | high = (high_low >> 8) & 0xff; | ||
1375 | 1351 | ||
1376 | /* | 1352 | if (success_ratio > RS_SR_NO_DECREASE) { |
1377 | * Lower the "search" bit rate, to give new "search" mode | 1353 | target_tpt = 100 * expected_current_tpt; |
1378 | * approximately the same throughput as "active" if: | 1354 | IWL_DEBUG_RATE(mvm, |
1379 | * | 1355 | "SR %d high. Find rate exceeding EXPECTED_CURRENT %d\n", |
1380 | * 1) "Active" mode has been working modestly well (but not | 1356 | success_ratio, target_tpt); |
1381 | * great), and expected "search" throughput (under perfect | 1357 | } else { |
1382 | * conditions) at candidate rate is above the actual | 1358 | target_tpt = lq_sta->last_tpt; |
1383 | * measured "active" throughput (but less than expected | 1359 | IWL_DEBUG_RATE(mvm, |
1384 | * "active" throughput under perfect conditions). | 1360 | "SR %d not thag good. Find rate exceeding ACTUAL_TPT %d\n", |
1385 | * OR | 1361 | success_ratio, target_tpt); |
1386 | * 2) "Active" mode has been working perfectly or very well | 1362 | } |
1387 | * and expected "search" throughput (under perfect | ||
1388 | * conditions) at candidate rate is above expected | ||
1389 | * "active" throughput (under perfect conditions). | ||
1390 | */ | ||
1391 | if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) && | ||
1392 | ((active_sr > RS_SR_FORCE_DECREASE) && | ||
1393 | (active_sr <= IWL_RATE_HIGH_TH) && | ||
1394 | (tpt_tbl[rate] <= active_tpt))) || | ||
1395 | ((active_sr >= IWL_RATE_SCALE_SWITCH) && | ||
1396 | (tpt_tbl[rate] > active_tpt))) { | ||
1397 | /* (2nd or later pass) | ||
1398 | * If we've already tried to raise the rate, and are | ||
1399 | * now trying to lower it, use the higher rate. */ | ||
1400 | if (start_hi != IWL_RATE_INVALID) { | ||
1401 | new_rate = start_hi; | ||
1402 | break; | ||
1403 | } | ||
1404 | |||
1405 | new_rate = rate; | ||
1406 | |||
1407 | /* Loop again with lower rate */ | ||
1408 | if (low != IWL_RATE_INVALID) | ||
1409 | rate = low; | ||
1410 | 1363 | ||
1411 | /* Lower rate not available, use the original */ | 1364 | rate_idx = find_first_bit(&rate_mask, BITS_PER_LONG); |
1412 | else | ||
1413 | break; | ||
1414 | 1365 | ||
1415 | /* Else try to raise the "search" rate to match "active" */ | 1366 | while (rate_idx != IWL_RATE_INVALID) { |
1416 | } else { | 1367 | if (target_tpt < (100 * tpt_tbl[rate_idx])) |
1417 | /* (2nd or later pass) | 1368 | break; |
1418 | * If we've already tried to lower the rate, and are | ||
1419 | * now trying to raise it, use the lower rate. */ | ||
1420 | if (new_rate != IWL_RATE_INVALID) | ||
1421 | break; | ||
1422 | 1369 | ||
1423 | /* Loop again with higher rate */ | 1370 | high_low = rs_get_adjacent_rate(mvm, rate_idx, rate_mask, |
1424 | else if (high != IWL_RATE_INVALID) { | 1371 | tbl->rate.type); |
1425 | start_hi = high; | ||
1426 | rate = high; | ||
1427 | 1372 | ||
1428 | /* Higher rate not available, use the original */ | 1373 | rate_idx = (high_low >> 8) & 0xff; |
1429 | } else { | ||
1430 | new_rate = rate; | ||
1431 | break; | ||
1432 | } | ||
1433 | } | ||
1434 | } | 1374 | } |
1435 | 1375 | ||
1436 | return new_rate; | 1376 | IWL_DEBUG_RATE(mvm, "Best rate found %d target_tp %d expected_new %d\n", |
1377 | rate_idx, target_tpt, | ||
1378 | rate_idx != IWL_RATE_INVALID ? | ||
1379 | 100 * tpt_tbl[rate_idx] : IWL_INVALID_VALUE); | ||
1380 | |||
1381 | return rate_idx; | ||
1437 | } | 1382 | } |
1438 | 1383 | ||
1439 | static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) | 1384 | static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) |
@@ -1608,7 +1553,7 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
1608 | 1553 | ||
1609 | tpt = lq_sta->last_tpt / 100; | 1554 | tpt = lq_sta->last_tpt / 100; |
1610 | expected_tpt_tbl = rs_get_expected_tpt_table(lq_sta, next_col, | 1555 | expected_tpt_tbl = rs_get_expected_tpt_table(lq_sta, next_col, |
1611 | tbl->rate.bw); | 1556 | rs_bw_from_sta_bw(sta)); |
1612 | if (WARN_ON_ONCE(!expected_tpt_tbl)) | 1557 | if (WARN_ON_ONCE(!expected_tpt_tbl)) |
1613 | continue; | 1558 | continue; |
1614 | 1559 | ||
@@ -1649,7 +1594,7 @@ static int rs_switch_to_column(struct iwl_mvm *mvm, | |||
1649 | const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; | 1594 | const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; |
1650 | u32 sz = (sizeof(struct iwl_scale_tbl_info) - | 1595 | u32 sz = (sizeof(struct iwl_scale_tbl_info) - |
1651 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); | 1596 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); |
1652 | u16 rate_mask = 0; | 1597 | unsigned long rate_mask = 0; |
1653 | u32 rate_idx = 0; | 1598 | u32 rate_idx = 0; |
1654 | 1599 | ||
1655 | memcpy(search_tbl, tbl, sz); | 1600 | memcpy(search_tbl, tbl, sz); |
@@ -1691,7 +1636,7 @@ static int rs_switch_to_column(struct iwl_mvm *mvm, | |||
1691 | !(BIT(rate_idx) & rate_mask)) { | 1636 | !(BIT(rate_idx) & rate_mask)) { |
1692 | IWL_DEBUG_RATE(mvm, | 1637 | IWL_DEBUG_RATE(mvm, |
1693 | "can not switch with index %d" | 1638 | "can not switch with index %d" |
1694 | " rate mask %x\n", | 1639 | " rate mask %lx\n", |
1695 | rate_idx, rate_mask); | 1640 | rate_idx, rate_mask); |
1696 | 1641 | ||
1697 | goto err; | 1642 | goto err; |
@@ -1805,16 +1750,21 @@ static void rs_get_adjacent_txp(struct iwl_mvm *mvm, int index, | |||
1805 | *stronger = TPC_INVALID; | 1750 | *stronger = TPC_INVALID; |
1806 | } | 1751 | } |
1807 | 1752 | ||
1808 | static bool rs_tpc_allowed(struct iwl_mvm *mvm, struct rs_rate *rate, | 1753 | static bool rs_tpc_allowed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1809 | enum ieee80211_band band) | 1754 | struct rs_rate *rate, enum ieee80211_band band) |
1810 | { | 1755 | { |
1811 | int index = rate->index; | 1756 | int index = rate->index; |
1757 | bool cam = (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM); | ||
1758 | bool sta_ps_disabled = (vif->type == NL80211_IFTYPE_STATION && | ||
1759 | !vif->bss_conf.ps); | ||
1812 | 1760 | ||
1761 | IWL_DEBUG_RATE(mvm, "cam: %d sta_ps_disabled %d\n", | ||
1762 | cam, sta_ps_disabled); | ||
1813 | /* | 1763 | /* |
1814 | * allow tpc only if power management is enabled, or bt coex | 1764 | * allow tpc only if power management is enabled, or bt coex |
1815 | * activity grade allows it and we are on 2.4Ghz. | 1765 | * activity grade allows it and we are on 2.4Ghz. |
1816 | */ | 1766 | */ |
1817 | if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM && | 1767 | if ((cam || sta_ps_disabled) && |
1818 | !iwl_mvm_bt_coex_is_tpc_allowed(mvm, band)) | 1768 | !iwl_mvm_bt_coex_is_tpc_allowed(mvm, band)) |
1819 | return false; | 1769 | return false; |
1820 | 1770 | ||
@@ -1931,7 +1881,7 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm, | |||
1931 | band = chanctx_conf->def.chan->band; | 1881 | band = chanctx_conf->def.chan->band; |
1932 | rcu_read_unlock(); | 1882 | rcu_read_unlock(); |
1933 | 1883 | ||
1934 | if (!rs_tpc_allowed(mvm, rate, band)) { | 1884 | if (!rs_tpc_allowed(mvm, vif, rate, band)) { |
1935 | IWL_DEBUG_RATE(mvm, | 1885 | IWL_DEBUG_RATE(mvm, |
1936 | "tpc is not allowed. remove txp restrictions"); | 1886 | "tpc is not allowed. remove txp restrictions"); |
1937 | lq_sta->lq.reduced_tpc = TPC_NO_REDUCTION; | 1887 | lq_sta->lq.reduced_tpc = TPC_NO_REDUCTION; |
@@ -2235,7 +2185,8 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, | |||
2235 | break; | 2185 | break; |
2236 | case RS_ACTION_STAY: | 2186 | case RS_ACTION_STAY: |
2237 | /* No change */ | 2187 | /* No change */ |
2238 | update_lq = rs_tpc_perform(mvm, sta, lq_sta, tbl); | 2188 | if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) |
2189 | update_lq = rs_tpc_perform(mvm, sta, lq_sta, tbl); | ||
2239 | break; | 2190 | break; |
2240 | default: | 2191 | default: |
2241 | break; | 2192 | break; |
@@ -2489,10 +2440,6 @@ static void rs_vht_set_enabled_rates(struct ieee80211_sta *sta, | |||
2489 | if (i == IWL_RATE_9M_INDEX) | 2440 | if (i == IWL_RATE_9M_INDEX) |
2490 | continue; | 2441 | continue; |
2491 | 2442 | ||
2492 | /* Disable MCS9 as a workaround */ | ||
2493 | if (i == IWL_RATE_MCS_9_INDEX) | ||
2494 | continue; | ||
2495 | |||
2496 | /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ | 2443 | /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ |
2497 | if (i == IWL_RATE_MCS_9_INDEX && | 2444 | if (i == IWL_RATE_MCS_9_INDEX && |
2498 | sta->bandwidth == IEEE80211_STA_RX_BW_20) | 2445 | sta->bandwidth == IEEE80211_STA_RX_BW_20) |
@@ -2511,10 +2458,6 @@ static void rs_vht_set_enabled_rates(struct ieee80211_sta *sta, | |||
2511 | if (i == IWL_RATE_9M_INDEX) | 2458 | if (i == IWL_RATE_9M_INDEX) |
2512 | continue; | 2459 | continue; |
2513 | 2460 | ||
2514 | /* Disable MCS9 as a workaround */ | ||
2515 | if (i == IWL_RATE_MCS_9_INDEX) | ||
2516 | continue; | ||
2517 | |||
2518 | /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ | 2461 | /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ |
2519 | if (i == IWL_RATE_MCS_9_INDEX && | 2462 | if (i == IWL_RATE_MCS_9_INDEX && |
2520 | sta->bandwidth == IEEE80211_STA_RX_BW_20) | 2463 | sta->bandwidth == IEEE80211_STA_RX_BW_20) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 63e7b16edb55..36ae01a18dee 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -277,51 +277,22 @@ static void iwl_mvm_scan_calc_params(struct iwl_mvm *mvm, | |||
277 | IEEE80211_IFACE_ITER_NORMAL, | 277 | IEEE80211_IFACE_ITER_NORMAL, |
278 | iwl_mvm_scan_condition_iterator, | 278 | iwl_mvm_scan_condition_iterator, |
279 | &global_bound); | 279 | &global_bound); |
280 | /* | ||
281 | * Under low latency traffic passive scan is fragmented meaning | ||
282 | * that dwell on a particular channel will be fragmented. Each fragment | ||
283 | * dwell time is 20ms and fragments period is 105ms. Skipping to next | ||
284 | * channel will be delayed by the same period - 105ms. So suspend_time | ||
285 | * parameter describing both fragments and channels skipping periods is | ||
286 | * set to 105ms. This value is chosen so that overall passive scan | ||
287 | * duration will not be too long. Max_out_time in this case is set to | ||
288 | * 70ms, so for active scanning operating channel will be left for 70ms | ||
289 | * while for passive still for 20ms (fragment dwell). | ||
290 | */ | ||
291 | if (global_bound) { | ||
292 | if (!iwl_mvm_low_latency(mvm)) { | ||
293 | params->suspend_time = ieee80211_tu_to_usec(100); | ||
294 | params->max_out_time = ieee80211_tu_to_usec(600); | ||
295 | } else { | ||
296 | params->suspend_time = ieee80211_tu_to_usec(105); | ||
297 | /* P2P doesn't support fragmented passive scan, so | ||
298 | * configure max_out_time to be at least longest dwell | ||
299 | * time for passive scan. | ||
300 | */ | ||
301 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p) { | ||
302 | params->max_out_time = ieee80211_tu_to_usec(70); | ||
303 | params->passive_fragmented = true; | ||
304 | } else { | ||
305 | u32 passive_dwell; | ||
306 | 280 | ||
307 | /* | 281 | if (!global_bound) |
308 | * Use band G so that passive channel dwell time | 282 | goto not_bound; |
309 | * will be assigned with maximum value. | 283 | |
310 | */ | 284 | params->suspend_time = 100; |
311 | band = IEEE80211_BAND_2GHZ; | 285 | params->max_out_time = 600; |
312 | passive_dwell = iwl_mvm_get_passive_dwell(band); | 286 | |
313 | params->max_out_time = | 287 | if (iwl_mvm_low_latency(mvm)) { |
314 | ieee80211_tu_to_usec(passive_dwell); | 288 | params->suspend_time = 250; |
315 | } | 289 | params->max_out_time = 250; |
316 | } | ||
317 | } | 290 | } |
318 | 291 | ||
292 | not_bound: | ||
293 | |||
319 | for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) { | 294 | for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) { |
320 | if (params->passive_fragmented) | 295 | params->dwell[band].passive = iwl_mvm_get_passive_dwell(band); |
321 | params->dwell[band].passive = 20; | ||
322 | else | ||
323 | params->dwell[band].passive = | ||
324 | iwl_mvm_get_passive_dwell(band); | ||
325 | params->dwell[band].active = iwl_mvm_get_active_dwell(band, | 296 | params->dwell[band].active = iwl_mvm_get_active_dwell(band, |
326 | n_ssids); | 297 | n_ssids); |
327 | } | 298 | } |
@@ -770,7 +741,7 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
770 | int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels; | 741 | int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels; |
771 | int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; | 742 | int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; |
772 | int head = 0; | 743 | int head = 0; |
773 | int tail = band_2ghz + band_5ghz; | 744 | int tail = band_2ghz + band_5ghz - 1; |
774 | u32 ssid_bitmap; | 745 | u32 ssid_bitmap; |
775 | int cmd_len; | 746 | int cmd_len; |
776 | int ret; | 747 | int ret; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c index c5f4532cafa9..2f82d0dc7ad8 100644 --- a/drivers/net/wireless/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/iwlwifi/mvm/utils.c | |||
@@ -519,6 +519,7 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) | |||
519 | iwl_mvm_dump_umac_error_log(mvm); | 519 | iwl_mvm_dump_umac_error_log(mvm); |
520 | } | 520 | } |
521 | 521 | ||
522 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
522 | void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm) | 523 | void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm) |
523 | { | 524 | { |
524 | const struct fw_img *img; | 525 | const struct fw_img *img; |
@@ -581,6 +582,7 @@ void iwl_mvm_fw_error_rxf_dump(struct iwl_mvm *mvm) | |||
581 | } | 582 | } |
582 | iwl_trans_release_nic_access(mvm->trans, &flags); | 583 | iwl_trans_release_nic_access(mvm->trans, &flags); |
583 | } | 584 | } |
585 | #endif | ||
584 | 586 | ||
585 | /** | 587 | /** |
586 | * iwl_mvm_send_lq_cmd() - Send link quality command | 588 | * iwl_mvm_send_lq_cmd() - Send link quality command |
@@ -688,3 +690,22 @@ bool iwl_mvm_low_latency(struct iwl_mvm *mvm) | |||
688 | 690 | ||
689 | return result; | 691 | return result; |
690 | } | 692 | } |
693 | |||
694 | static void iwl_mvm_idle_iter(void *_data, u8 *mac, struct ieee80211_vif *vif) | ||
695 | { | ||
696 | bool *idle = _data; | ||
697 | |||
698 | if (!vif->bss_conf.idle) | ||
699 | *idle = false; | ||
700 | } | ||
701 | |||
702 | bool iwl_mvm_is_idle(struct iwl_mvm *mvm) | ||
703 | { | ||
704 | bool idle = true; | ||
705 | |||
706 | ieee80211_iterate_active_interfaces_atomic( | ||
707 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | ||
708 | iwl_mvm_idle_iter, &idle); | ||
709 | |||
710 | return idle; | ||
711 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h index 1b95d856dfd5..6c22b23a2845 100644 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | |||
@@ -117,21 +117,19 @@ struct iwl_dma_ptr { | |||
117 | /** | 117 | /** |
118 | * iwl_queue_inc_wrap - increment queue index, wrap back to beginning | 118 | * iwl_queue_inc_wrap - increment queue index, wrap back to beginning |
119 | * @index -- current index | 119 | * @index -- current index |
120 | * @n_bd -- total number of entries in queue (must be power of 2) | ||
121 | */ | 120 | */ |
122 | static inline int iwl_queue_inc_wrap(int index, int n_bd) | 121 | static inline int iwl_queue_inc_wrap(int index) |
123 | { | 122 | { |
124 | return ++index & (n_bd - 1); | 123 | return ++index & (TFD_QUEUE_SIZE_MAX - 1); |
125 | } | 124 | } |
126 | 125 | ||
127 | /** | 126 | /** |
128 | * iwl_queue_dec_wrap - decrement queue index, wrap back to end | 127 | * iwl_queue_dec_wrap - decrement queue index, wrap back to end |
129 | * @index -- current index | 128 | * @index -- current index |
130 | * @n_bd -- total number of entries in queue (must be power of 2) | ||
131 | */ | 129 | */ |
132 | static inline int iwl_queue_dec_wrap(int index, int n_bd) | 130 | static inline int iwl_queue_dec_wrap(int index) |
133 | { | 131 | { |
134 | return --index & (n_bd - 1); | 132 | return --index & (TFD_QUEUE_SIZE_MAX - 1); |
135 | } | 133 | } |
136 | 134 | ||
137 | struct iwl_cmd_meta { | 135 | struct iwl_cmd_meta { |
@@ -145,13 +143,13 @@ struct iwl_cmd_meta { | |||
145 | * | 143 | * |
146 | * Contains common data for Rx and Tx queues. | 144 | * Contains common data for Rx and Tx queues. |
147 | * | 145 | * |
148 | * Note the difference between n_bd and n_window: the hardware | 146 | * Note the difference between TFD_QUEUE_SIZE_MAX and n_window: the hardware |
149 | * always assumes 256 descriptors, so n_bd is always 256 (unless | 147 | * always assumes 256 descriptors, so TFD_QUEUE_SIZE_MAX is always 256 (unless |
150 | * there might be HW changes in the future). For the normal TX | 148 | * there might be HW changes in the future). For the normal TX |
151 | * queues, n_window, which is the size of the software queue data | 149 | * queues, n_window, which is the size of the software queue data |
152 | * is also 256; however, for the command queue, n_window is only | 150 | * is also 256; however, for the command queue, n_window is only |
153 | * 32 since we don't need so many commands pending. Since the HW | 151 | * 32 since we don't need so many commands pending. Since the HW |
154 | * still uses 256 BDs for DMA though, n_bd stays 256. As a result, | 152 | * still uses 256 BDs for DMA though, TFD_QUEUE_SIZE_MAX stays 256. As a result, |
155 | * the software buffers (in the variables @meta, @txb in struct | 153 | * the software buffers (in the variables @meta, @txb in struct |
156 | * iwl_txq) only have 32 entries, while the HW buffers (@tfds in | 154 | * iwl_txq) only have 32 entries, while the HW buffers (@tfds in |
157 | * the same struct) have 256. | 155 | * the same struct) have 256. |
@@ -162,7 +160,6 @@ struct iwl_cmd_meta { | |||
162 | * data is a window overlayed over the HW queue. | 160 | * data is a window overlayed over the HW queue. |
163 | */ | 161 | */ |
164 | struct iwl_queue { | 162 | struct iwl_queue { |
165 | int n_bd; /* number of BDs in this queue */ | ||
166 | int write_ptr; /* 1-st empty entry (index) host_w*/ | 163 | int write_ptr; /* 1-st empty entry (index) host_w*/ |
167 | int read_ptr; /* last used entry (index) host_r*/ | 164 | int read_ptr; /* last used entry (index) host_r*/ |
168 | /* use for monitoring and recovering the stuck queue */ | 165 | /* use for monitoring and recovering the stuck queue */ |
@@ -373,6 +370,13 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
373 | struct sk_buff_head *skbs); | 370 | struct sk_buff_head *skbs); |
374 | void iwl_trans_pcie_tx_reset(struct iwl_trans *trans); | 371 | void iwl_trans_pcie_tx_reset(struct iwl_trans *trans); |
375 | 372 | ||
373 | static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) | ||
374 | { | ||
375 | struct iwl_tfd_tb *tb = &tfd->tbs[idx]; | ||
376 | |||
377 | return le16_to_cpu(tb->hi_n_len) >> 4; | ||
378 | } | ||
379 | |||
376 | /***************************************************** | 380 | /***************************************************** |
377 | * Error handling | 381 | * Error handling |
378 | ******************************************************/ | 382 | ******************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index 4a26a082a1ba..a2698e5e062c 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -850,7 +850,7 @@ static u32 iwl_pcie_int_cause_ict(struct iwl_trans *trans) | |||
850 | trans_pcie->ict_index, read); | 850 | trans_pcie->ict_index, read); |
851 | trans_pcie->ict_tbl[trans_pcie->ict_index] = 0; | 851 | trans_pcie->ict_tbl[trans_pcie->ict_index] = 0; |
852 | trans_pcie->ict_index = | 852 | trans_pcie->ict_index = |
853 | iwl_queue_inc_wrap(trans_pcie->ict_index, ICT_COUNT); | 853 | ((trans_pcie->ict_index + 1) & (ICT_COUNT - 1)); |
854 | 854 | ||
855 | read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]); | 855 | read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]); |
856 | trace_iwlwifi_dev_ict_read(trans->dev, trans_pcie->ict_index, | 856 | trace_iwlwifi_dev_ict_read(trans->dev, trans_pcie->ict_index, |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index f98ef1e62eb9..a1af903f6c9b 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include "iwl-csr.h" | 73 | #include "iwl-csr.h" |
74 | #include "iwl-prph.h" | 74 | #include "iwl-prph.h" |
75 | #include "iwl-agn-hw.h" | 75 | #include "iwl-agn-hw.h" |
76 | #include "iwl-fw-error-dump.h" | ||
76 | #include "internal.h" | 77 | #include "internal.h" |
77 | 78 | ||
78 | static u32 iwl_trans_pcie_read_shr(struct iwl_trans *trans, u32 reg) | 79 | static u32 iwl_trans_pcie_read_shr(struct iwl_trans *trans, u32 reg) |
@@ -1337,8 +1338,8 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, u32 txq_bm) | |||
1337 | IWL_ERR(trans, | 1338 | IWL_ERR(trans, |
1338 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", | 1339 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", |
1339 | cnt, active ? "" : "in", fifo, tbl_dw, | 1340 | cnt, active ? "" : "in", fifo, tbl_dw, |
1340 | iwl_read_prph(trans, | 1341 | iwl_read_prph(trans, SCD_QUEUE_RDPTR(cnt)) & |
1341 | SCD_QUEUE_RDPTR(cnt)) & (txq->q.n_bd - 1), | 1342 | (TFD_QUEUE_SIZE_MAX - 1), |
1342 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(cnt))); | 1343 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(cnt))); |
1343 | } | 1344 | } |
1344 | 1345 | ||
@@ -1669,6 +1670,61 @@ err: | |||
1669 | IWL_ERR(trans, "failed to create the trans debugfs entry\n"); | 1670 | IWL_ERR(trans, "failed to create the trans debugfs entry\n"); |
1670 | return -ENOMEM; | 1671 | return -ENOMEM; |
1671 | } | 1672 | } |
1673 | |||
1674 | static u32 iwl_trans_pcie_get_cmdlen(struct iwl_tfd *tfd) | ||
1675 | { | ||
1676 | u32 cmdlen = 0; | ||
1677 | int i; | ||
1678 | |||
1679 | for (i = 0; i < IWL_NUM_OF_TBS; i++) | ||
1680 | cmdlen += iwl_pcie_tfd_tb_get_len(tfd, i); | ||
1681 | |||
1682 | return cmdlen; | ||
1683 | } | ||
1684 | |||
1685 | static u32 iwl_trans_pcie_dump_data(struct iwl_trans *trans, | ||
1686 | void *buf, u32 buflen) | ||
1687 | { | ||
1688 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
1689 | struct iwl_fw_error_dump_data *data; | ||
1690 | struct iwl_txq *cmdq = &trans_pcie->txq[trans_pcie->cmd_queue]; | ||
1691 | struct iwl_fw_error_dump_txcmd *txcmd; | ||
1692 | u32 len; | ||
1693 | int i, ptr; | ||
1694 | |||
1695 | if (!buf) | ||
1696 | return sizeof(*data) + | ||
1697 | cmdq->q.n_window * (sizeof(*txcmd) + | ||
1698 | TFD_MAX_PAYLOAD_SIZE); | ||
1699 | |||
1700 | len = 0; | ||
1701 | data = buf; | ||
1702 | data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_TXCMD); | ||
1703 | txcmd = (void *)data->data; | ||
1704 | spin_lock_bh(&cmdq->lock); | ||
1705 | ptr = cmdq->q.write_ptr; | ||
1706 | for (i = 0; i < cmdq->q.n_window; i++) { | ||
1707 | u8 idx = get_cmd_index(&cmdq->q, ptr); | ||
1708 | u32 caplen, cmdlen; | ||
1709 | |||
1710 | cmdlen = iwl_trans_pcie_get_cmdlen(&cmdq->tfds[ptr]); | ||
1711 | caplen = min_t(u32, TFD_MAX_PAYLOAD_SIZE, cmdlen); | ||
1712 | |||
1713 | if (cmdlen) { | ||
1714 | len += sizeof(*txcmd) + caplen; | ||
1715 | txcmd->cmdlen = cpu_to_le32(cmdlen); | ||
1716 | txcmd->caplen = cpu_to_le32(caplen); | ||
1717 | memcpy(txcmd->data, cmdq->entries[idx].cmd, caplen); | ||
1718 | txcmd = (void *)((u8 *)txcmd->data + caplen); | ||
1719 | } | ||
1720 | |||
1721 | ptr = iwl_queue_dec_wrap(ptr); | ||
1722 | } | ||
1723 | spin_unlock_bh(&cmdq->lock); | ||
1724 | |||
1725 | data->len = cpu_to_le32(len); | ||
1726 | return sizeof(*data) + len; | ||
1727 | } | ||
1672 | #else | 1728 | #else |
1673 | static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, | 1729 | static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, |
1674 | struct dentry *dir) | 1730 | struct dentry *dir) |
@@ -1711,6 +1767,10 @@ static const struct iwl_trans_ops trans_ops_pcie = { | |||
1711 | .grab_nic_access = iwl_trans_pcie_grab_nic_access, | 1767 | .grab_nic_access = iwl_trans_pcie_grab_nic_access, |
1712 | .release_nic_access = iwl_trans_pcie_release_nic_access, | 1768 | .release_nic_access = iwl_trans_pcie_release_nic_access, |
1713 | .set_bits_mask = iwl_trans_pcie_set_bits_mask, | 1769 | .set_bits_mask = iwl_trans_pcie_set_bits_mask, |
1770 | |||
1771 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
1772 | .dump_data = iwl_trans_pcie_dump_data, | ||
1773 | #endif | ||
1714 | }; | 1774 | }; |
1715 | 1775 | ||
1716 | struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | 1776 | struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
@@ -1788,6 +1848,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
1788 | * PCI Tx retries from interfering with C3 CPU state */ | 1848 | * PCI Tx retries from interfering with C3 CPU state */ |
1789 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | 1849 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); |
1790 | 1850 | ||
1851 | trans->dev = &pdev->dev; | ||
1852 | trans_pcie->pci_dev = pdev; | ||
1853 | iwl_disable_interrupts(trans); | ||
1854 | |||
1791 | err = pci_enable_msi(pdev); | 1855 | err = pci_enable_msi(pdev); |
1792 | if (err) { | 1856 | if (err) { |
1793 | dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", err); | 1857 | dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", err); |
@@ -1799,8 +1863,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
1799 | } | 1863 | } |
1800 | } | 1864 | } |
1801 | 1865 | ||
1802 | trans->dev = &pdev->dev; | ||
1803 | trans_pcie->pci_dev = pdev; | ||
1804 | trans->hw_rev = iwl_read32(trans, CSR_HW_REV); | 1866 | trans->hw_rev = iwl_read32(trans, CSR_HW_REV); |
1805 | trans->hw_id = (pdev->device << 16) + pdev->subsystem_device; | 1867 | trans->hw_id = (pdev->device << 16) + pdev->subsystem_device; |
1806 | snprintf(trans->hw_id_str, sizeof(trans->hw_id_str), | 1868 | snprintf(trans->hw_id_str, sizeof(trans->hw_id_str), |
@@ -1826,8 +1888,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
1826 | goto out_pci_disable_msi; | 1888 | goto out_pci_disable_msi; |
1827 | } | 1889 | } |
1828 | 1890 | ||
1829 | trans_pcie->inta_mask = CSR_INI_SET_MASK; | ||
1830 | |||
1831 | if (iwl_pcie_alloc_ict(trans)) | 1891 | if (iwl_pcie_alloc_ict(trans)) |
1832 | goto out_free_cmd_pool; | 1892 | goto out_free_cmd_pool; |
1833 | 1893 | ||
@@ -1839,6 +1899,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
1839 | goto out_free_ict; | 1899 | goto out_free_ict; |
1840 | } | 1900 | } |
1841 | 1901 | ||
1902 | trans_pcie->inta_mask = CSR_INI_SET_MASK; | ||
1903 | |||
1842 | return trans; | 1904 | return trans; |
1843 | 1905 | ||
1844 | out_free_ict: | 1906 | out_free_ict: |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index dde6031f4257..77a512a5a755 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -70,20 +70,20 @@ static int iwl_queue_space(const struct iwl_queue *q) | |||
70 | 70 | ||
71 | /* | 71 | /* |
72 | * To avoid ambiguity between empty and completely full queues, there | 72 | * To avoid ambiguity between empty and completely full queues, there |
73 | * should always be less than q->n_bd elements in the queue. | 73 | * should always be less than TFD_QUEUE_SIZE_MAX elements in the queue. |
74 | * If q->n_window is smaller than q->n_bd, there is no need to reserve | 74 | * If q->n_window is smaller than TFD_QUEUE_SIZE_MAX, there is no need |
75 | * any queue entries for this purpose. | 75 | * to reserve any queue entries for this purpose. |
76 | */ | 76 | */ |
77 | if (q->n_window < q->n_bd) | 77 | if (q->n_window < TFD_QUEUE_SIZE_MAX) |
78 | max = q->n_window; | 78 | max = q->n_window; |
79 | else | 79 | else |
80 | max = q->n_bd - 1; | 80 | max = TFD_QUEUE_SIZE_MAX - 1; |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * q->n_bd is a power of 2, so the following is equivalent to modulo by | 83 | * TFD_QUEUE_SIZE_MAX is a power of 2, so the following is equivalent to |
84 | * q->n_bd and is well defined for negative dividends. | 84 | * modulo by TFD_QUEUE_SIZE_MAX and is well defined. |
85 | */ | 85 | */ |
86 | used = (q->write_ptr - q->read_ptr) & (q->n_bd - 1); | 86 | used = (q->write_ptr - q->read_ptr) & (TFD_QUEUE_SIZE_MAX - 1); |
87 | 87 | ||
88 | if (WARN_ON(used > max)) | 88 | if (WARN_ON(used > max)) |
89 | return 0; | 89 | return 0; |
@@ -94,17 +94,11 @@ static int iwl_queue_space(const struct iwl_queue *q) | |||
94 | /* | 94 | /* |
95 | * iwl_queue_init - Initialize queue's high/low-water and read/write indexes | 95 | * iwl_queue_init - Initialize queue's high/low-water and read/write indexes |
96 | */ | 96 | */ |
97 | static int iwl_queue_init(struct iwl_queue *q, int count, int slots_num, u32 id) | 97 | static int iwl_queue_init(struct iwl_queue *q, int slots_num, u32 id) |
98 | { | 98 | { |
99 | q->n_bd = count; | ||
100 | q->n_window = slots_num; | 99 | q->n_window = slots_num; |
101 | q->id = id; | 100 | q->id = id; |
102 | 101 | ||
103 | /* count must be power-of-two size, otherwise iwl_queue_inc_wrap | ||
104 | * and iwl_queue_dec_wrap are broken. */ | ||
105 | if (WARN_ON(!is_power_of_2(count))) | ||
106 | return -EINVAL; | ||
107 | |||
108 | /* slots_num must be power-of-two size, otherwise | 102 | /* slots_num must be power-of-two size, otherwise |
109 | * get_cmd_index is broken. */ | 103 | * get_cmd_index is broken. */ |
110 | if (WARN_ON(!is_power_of_2(slots_num))) | 104 | if (WARN_ON(!is_power_of_2(slots_num))) |
@@ -197,13 +191,13 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data) | |||
197 | IWL_ERR(trans, | 191 | IWL_ERR(trans, |
198 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", | 192 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", |
199 | i, active ? "" : "in", fifo, tbl_dw, | 193 | i, active ? "" : "in", fifo, tbl_dw, |
200 | iwl_read_prph(trans, | 194 | iwl_read_prph(trans, SCD_QUEUE_RDPTR(i)) & |
201 | SCD_QUEUE_RDPTR(i)) & (txq->q.n_bd - 1), | 195 | (TFD_QUEUE_SIZE_MAX - 1), |
202 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); | 196 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); |
203 | } | 197 | } |
204 | 198 | ||
205 | for (i = q->read_ptr; i != q->write_ptr; | 199 | for (i = q->read_ptr; i != q->write_ptr; |
206 | i = iwl_queue_inc_wrap(i, q->n_bd)) | 200 | i = iwl_queue_inc_wrap(i)) |
207 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, | 201 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, |
208 | le32_to_cpu(txq->scratchbufs[i].scratch)); | 202 | le32_to_cpu(txq->scratchbufs[i].scratch)); |
209 | 203 | ||
@@ -359,13 +353,6 @@ static inline dma_addr_t iwl_pcie_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) | |||
359 | return addr; | 353 | return addr; |
360 | } | 354 | } |
361 | 355 | ||
362 | static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) | ||
363 | { | ||
364 | struct iwl_tfd_tb *tb = &tfd->tbs[idx]; | ||
365 | |||
366 | return le16_to_cpu(tb->hi_n_len) >> 4; | ||
367 | } | ||
368 | |||
369 | static inline void iwl_pcie_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, | 356 | static inline void iwl_pcie_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, |
370 | dma_addr_t addr, u16 len) | 357 | dma_addr_t addr, u16 len) |
371 | { | 358 | { |
@@ -425,13 +412,17 @@ static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq) | |||
425 | { | 412 | { |
426 | struct iwl_tfd *tfd_tmp = txq->tfds; | 413 | struct iwl_tfd *tfd_tmp = txq->tfds; |
427 | 414 | ||
428 | /* rd_ptr is bounded by n_bd and idx is bounded by n_window */ | 415 | /* rd_ptr is bounded by TFD_QUEUE_SIZE_MAX and |
416 | * idx is bounded by n_window | ||
417 | */ | ||
429 | int rd_ptr = txq->q.read_ptr; | 418 | int rd_ptr = txq->q.read_ptr; |
430 | int idx = get_cmd_index(&txq->q, rd_ptr); | 419 | int idx = get_cmd_index(&txq->q, rd_ptr); |
431 | 420 | ||
432 | lockdep_assert_held(&txq->lock); | 421 | lockdep_assert_held(&txq->lock); |
433 | 422 | ||
434 | /* We have only q->n_window txq->entries, but we use q->n_bd tfds */ | 423 | /* We have only q->n_window txq->entries, but we use |
424 | * TFD_QUEUE_SIZE_MAX tfds | ||
425 | */ | ||
435 | iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr]); | 426 | iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr]); |
436 | 427 | ||
437 | /* free SKB */ | 428 | /* free SKB */ |
@@ -452,7 +443,7 @@ static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq) | |||
452 | } | 443 | } |
453 | 444 | ||
454 | static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq, | 445 | static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq, |
455 | dma_addr_t addr, u16 len, u8 reset) | 446 | dma_addr_t addr, u16 len, bool reset) |
456 | { | 447 | { |
457 | struct iwl_queue *q; | 448 | struct iwl_queue *q; |
458 | struct iwl_tfd *tfd, *tfd_tmp; | 449 | struct iwl_tfd *tfd, *tfd_tmp; |
@@ -565,8 +556,7 @@ static int iwl_pcie_txq_init(struct iwl_trans *trans, struct iwl_txq *txq, | |||
565 | BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); | 556 | BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); |
566 | 557 | ||
567 | /* Initialize queue's high/low-water marks, and head/tail indexes */ | 558 | /* Initialize queue's high/low-water marks, and head/tail indexes */ |
568 | ret = iwl_queue_init(&txq->q, TFD_QUEUE_SIZE_MAX, slots_num, | 559 | ret = iwl_queue_init(&txq->q, slots_num, txq_id); |
569 | txq_id); | ||
570 | if (ret) | 560 | if (ret) |
571 | return ret; | 561 | return ret; |
572 | 562 | ||
@@ -591,15 +581,12 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id) | |||
591 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; | 581 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; |
592 | struct iwl_queue *q = &txq->q; | 582 | struct iwl_queue *q = &txq->q; |
593 | 583 | ||
594 | if (!q->n_bd) | ||
595 | return; | ||
596 | |||
597 | spin_lock_bh(&txq->lock); | 584 | spin_lock_bh(&txq->lock); |
598 | while (q->write_ptr != q->read_ptr) { | 585 | while (q->write_ptr != q->read_ptr) { |
599 | IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n", | 586 | IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n", |
600 | txq_id, q->read_ptr); | 587 | txq_id, q->read_ptr); |
601 | iwl_pcie_txq_free_tfd(trans, txq); | 588 | iwl_pcie_txq_free_tfd(trans, txq); |
602 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); | 589 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr); |
603 | } | 590 | } |
604 | txq->active = false; | 591 | txq->active = false; |
605 | spin_unlock_bh(&txq->lock); | 592 | spin_unlock_bh(&txq->lock); |
@@ -636,10 +623,12 @@ static void iwl_pcie_txq_free(struct iwl_trans *trans, int txq_id) | |||
636 | } | 623 | } |
637 | 624 | ||
638 | /* De-alloc circular buffer of TFDs */ | 625 | /* De-alloc circular buffer of TFDs */ |
639 | if (txq->q.n_bd) { | 626 | if (txq->tfds) { |
640 | dma_free_coherent(dev, sizeof(struct iwl_tfd) * | 627 | dma_free_coherent(dev, |
641 | txq->q.n_bd, txq->tfds, txq->q.dma_addr); | 628 | sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX, |
629 | txq->tfds, txq->q.dma_addr); | ||
642 | txq->q.dma_addr = 0; | 630 | txq->q.dma_addr = 0; |
631 | txq->tfds = NULL; | ||
643 | 632 | ||
644 | dma_free_coherent(dev, | 633 | dma_free_coherent(dev, |
645 | sizeof(*txq->scratchbufs) * txq->q.n_window, | 634 | sizeof(*txq->scratchbufs) * txq->q.n_window, |
@@ -948,8 +937,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
948 | { | 937 | { |
949 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 938 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
950 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; | 939 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; |
951 | /* n_bd is usually 256 => n_bd - 1 = 0xff */ | 940 | int tfd_num = ssn & (TFD_QUEUE_SIZE_MAX - 1); |
952 | int tfd_num = ssn & (txq->q.n_bd - 1); | ||
953 | struct iwl_queue *q = &txq->q; | 941 | struct iwl_queue *q = &txq->q; |
954 | int last_to_free; | 942 | int last_to_free; |
955 | 943 | ||
@@ -973,12 +961,12 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
973 | 961 | ||
974 | /*Since we free until index _not_ inclusive, the one before index is | 962 | /*Since we free until index _not_ inclusive, the one before index is |
975 | * the last we will free. This one must be used */ | 963 | * the last we will free. This one must be used */ |
976 | last_to_free = iwl_queue_dec_wrap(tfd_num, q->n_bd); | 964 | last_to_free = iwl_queue_dec_wrap(tfd_num); |
977 | 965 | ||
978 | if (!iwl_queue_used(q, last_to_free)) { | 966 | if (!iwl_queue_used(q, last_to_free)) { |
979 | IWL_ERR(trans, | 967 | IWL_ERR(trans, |
980 | "%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n", | 968 | "%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n", |
981 | __func__, txq_id, last_to_free, q->n_bd, | 969 | __func__, txq_id, last_to_free, TFD_QUEUE_SIZE_MAX, |
982 | q->write_ptr, q->read_ptr); | 970 | q->write_ptr, q->read_ptr); |
983 | goto out; | 971 | goto out; |
984 | } | 972 | } |
@@ -988,7 +976,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
988 | 976 | ||
989 | for (; | 977 | for (; |
990 | q->read_ptr != tfd_num; | 978 | q->read_ptr != tfd_num; |
991 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 979 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr)) { |
992 | 980 | ||
993 | if (WARN_ON_ONCE(txq->entries[txq->q.read_ptr].skb == NULL)) | 981 | if (WARN_ON_ONCE(txq->entries[txq->q.read_ptr].skb == NULL)) |
994 | continue; | 982 | continue; |
@@ -1027,16 +1015,16 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) | |||
1027 | 1015 | ||
1028 | lockdep_assert_held(&txq->lock); | 1016 | lockdep_assert_held(&txq->lock); |
1029 | 1017 | ||
1030 | if ((idx >= q->n_bd) || (!iwl_queue_used(q, idx))) { | 1018 | if ((idx >= TFD_QUEUE_SIZE_MAX) || (!iwl_queue_used(q, idx))) { |
1031 | IWL_ERR(trans, | 1019 | IWL_ERR(trans, |
1032 | "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", | 1020 | "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", |
1033 | __func__, txq_id, idx, q->n_bd, | 1021 | __func__, txq_id, idx, TFD_QUEUE_SIZE_MAX, |
1034 | q->write_ptr, q->read_ptr); | 1022 | q->write_ptr, q->read_ptr); |
1035 | return; | 1023 | return; |
1036 | } | 1024 | } |
1037 | 1025 | ||
1038 | for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; | 1026 | for (idx = iwl_queue_inc_wrap(idx); q->read_ptr != idx; |
1039 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 1027 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr)) { |
1040 | 1028 | ||
1041 | if (nfreed++ > 0) { | 1029 | if (nfreed++ > 0) { |
1042 | IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", | 1030 | IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", |
@@ -1327,28 +1315,39 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1327 | cmd_pos = offsetof(struct iwl_device_cmd, payload); | 1315 | cmd_pos = offsetof(struct iwl_device_cmd, payload); |
1328 | copy_size = sizeof(out_cmd->hdr); | 1316 | copy_size = sizeof(out_cmd->hdr); |
1329 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { | 1317 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
1330 | int copy = 0; | 1318 | int copy; |
1331 | 1319 | ||
1332 | if (!cmd->len[i]) | 1320 | if (!cmd->len[i]) |
1333 | continue; | 1321 | continue; |
1334 | 1322 | ||
1335 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ | ||
1336 | if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { | ||
1337 | copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; | ||
1338 | |||
1339 | if (copy > cmd->len[i]) | ||
1340 | copy = cmd->len[i]; | ||
1341 | } | ||
1342 | |||
1343 | /* copy everything if not nocopy/dup */ | 1323 | /* copy everything if not nocopy/dup */ |
1344 | if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | | 1324 | if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | |
1345 | IWL_HCMD_DFL_DUP))) | 1325 | IWL_HCMD_DFL_DUP))) { |
1346 | copy = cmd->len[i]; | 1326 | copy = cmd->len[i]; |
1347 | 1327 | ||
1348 | if (copy) { | ||
1349 | memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); | 1328 | memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); |
1350 | cmd_pos += copy; | 1329 | cmd_pos += copy; |
1351 | copy_size += copy; | 1330 | copy_size += copy; |
1331 | continue; | ||
1332 | } | ||
1333 | |||
1334 | /* | ||
1335 | * Otherwise we need at least IWL_HCMD_SCRATCHBUF_SIZE copied | ||
1336 | * in total (for the scratchbuf handling), but copy up to what | ||
1337 | * we can fit into the payload for debug dump purposes. | ||
1338 | */ | ||
1339 | copy = min_t(int, TFD_MAX_PAYLOAD_SIZE - cmd_pos, cmd->len[i]); | ||
1340 | |||
1341 | memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); | ||
1342 | cmd_pos += copy; | ||
1343 | |||
1344 | /* However, treat copy_size the proper way, we need it below */ | ||
1345 | if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { | ||
1346 | copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; | ||
1347 | |||
1348 | if (copy > cmd->len[i]) | ||
1349 | copy = cmd->len[i]; | ||
1350 | copy_size += copy; | ||
1352 | } | 1351 | } |
1353 | } | 1352 | } |
1354 | 1353 | ||
@@ -1363,7 +1362,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1363 | memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size); | 1362 | memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size); |
1364 | iwl_pcie_txq_build_tfd(trans, txq, | 1363 | iwl_pcie_txq_build_tfd(trans, txq, |
1365 | iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr), | 1364 | iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr), |
1366 | scratch_size, 1); | 1365 | scratch_size, true); |
1367 | 1366 | ||
1368 | /* map first command fragment, if any remains */ | 1367 | /* map first command fragment, if any remains */ |
1369 | if (copy_size > scratch_size) { | 1368 | if (copy_size > scratch_size) { |
@@ -1379,7 +1378,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1379 | } | 1378 | } |
1380 | 1379 | ||
1381 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, | 1380 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, |
1382 | copy_size - scratch_size, 0); | 1381 | copy_size - scratch_size, false); |
1383 | } | 1382 | } |
1384 | 1383 | ||
1385 | /* map the remaining (adjusted) nocopy/dup fragments */ | 1384 | /* map the remaining (adjusted) nocopy/dup fragments */ |
@@ -1402,7 +1401,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1402 | goto out; | 1401 | goto out; |
1403 | } | 1402 | } |
1404 | 1403 | ||
1405 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmdlen[i], 0); | 1404 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmdlen[i], false); |
1406 | } | 1405 | } |
1407 | 1406 | ||
1408 | out_meta->flags = cmd->flags; | 1407 | out_meta->flags = cmd->flags; |
@@ -1445,7 +1444,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1445 | } | 1444 | } |
1446 | 1445 | ||
1447 | /* Increment and update queue's write index */ | 1446 | /* Increment and update queue's write index */ |
1448 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); | 1447 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr); |
1449 | iwl_pcie_txq_inc_wr_ptr(trans, txq); | 1448 | iwl_pcie_txq_inc_wr_ptr(trans, txq); |
1450 | 1449 | ||
1451 | spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); | 1450 | spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); |
@@ -1740,7 +1739,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1740 | memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr, | 1739 | memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr, |
1741 | IWL_HCMD_SCRATCHBUF_SIZE); | 1740 | IWL_HCMD_SCRATCHBUF_SIZE); |
1742 | iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, | 1741 | iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, |
1743 | IWL_HCMD_SCRATCHBUF_SIZE, 1); | 1742 | IWL_HCMD_SCRATCHBUF_SIZE, true); |
1744 | 1743 | ||
1745 | /* there must be data left over for TB1 or this code must be changed */ | 1744 | /* there must be data left over for TB1 or this code must be changed */ |
1746 | BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE); | 1745 | BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE); |
@@ -1750,7 +1749,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1750 | tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); | 1749 | tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); |
1751 | if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) | 1750 | if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) |
1752 | goto out_err; | 1751 | goto out_err; |
1753 | iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, 0); | 1752 | iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, false); |
1754 | 1753 | ||
1755 | /* | 1754 | /* |
1756 | * Set up TFD's third entry to point directly to remainder | 1755 | * Set up TFD's third entry to point directly to remainder |
@@ -1766,7 +1765,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1766 | &txq->tfds[q->write_ptr]); | 1765 | &txq->tfds[q->write_ptr]); |
1767 | goto out_err; | 1766 | goto out_err; |
1768 | } | 1767 | } |
1769 | iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, 0); | 1768 | iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, false); |
1770 | } | 1769 | } |
1771 | 1770 | ||
1772 | /* Set up entry for this TFD in Tx byte-count array */ | 1771 | /* Set up entry for this TFD in Tx byte-count array */ |
@@ -1788,7 +1787,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1788 | mod_timer(&txq->stuck_timer, jiffies + trans_pcie->wd_timeout); | 1787 | mod_timer(&txq->stuck_timer, jiffies + trans_pcie->wd_timeout); |
1789 | 1788 | ||
1790 | /* Tell device the write index *just past* this latest filled TFD */ | 1789 | /* Tell device the write index *just past* this latest filled TFD */ |
1791 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); | 1790 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr); |
1792 | if (!wait_write_ptr) | 1791 | if (!wait_write_ptr) |
1793 | iwl_pcie_txq_inc_wr_ptr(trans, txq); | 1792 | iwl_pcie_txq_inc_wr_ptr(trans, txq); |
1794 | 1793 | ||
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 9d7a52f5a410..a312c653d116 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -1676,7 +1676,9 @@ static int mac80211_hwsim_ampdu_action(struct ieee80211_hw *hw, | |||
1676 | return 0; | 1676 | return 0; |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | static void mac80211_hwsim_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1679 | static void mac80211_hwsim_flush(struct ieee80211_hw *hw, |
1680 | struct ieee80211_vif *vif, | ||
1681 | u32 queues, bool drop) | ||
1680 | { | 1682 | { |
1681 | /* Not implemented, queues only on kernel side */ | 1683 | /* Not implemented, queues only on kernel side */ |
1682 | } | 1684 | } |
@@ -2056,6 +2058,7 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, | |||
2056 | WIPHY_FLAG_AP_UAPSD | | 2058 | WIPHY_FLAG_AP_UAPSD | |
2057 | WIPHY_FLAG_HAS_CHANNEL_SWITCH; | 2059 | WIPHY_FLAG_HAS_CHANNEL_SWITCH; |
2058 | hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR; | 2060 | hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR; |
2061 | hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE; | ||
2059 | 2062 | ||
2060 | /* ask mac80211 to reserve space for magic */ | 2063 | /* ask mac80211 to reserve space for magic */ |
2061 | hw->vif_data_size = sizeof(struct hwsim_vif_priv); | 2064 | hw->vif_data_size = sizeof(struct hwsim_vif_priv); |
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c index 2bd07d681c5e..e1c2f67ae85e 100644 --- a/drivers/net/wireless/mwifiex/11n.c +++ b/drivers/net/wireless/mwifiex/11n.c | |||
@@ -749,3 +749,45 @@ void mwifiex_set_ba_params(struct mwifiex_private *priv) | |||
749 | 749 | ||
750 | return; | 750 | return; |
751 | } | 751 | } |
752 | |||
753 | u8 mwifiex_get_sec_chan_offset(int chan) | ||
754 | { | ||
755 | u8 sec_offset; | ||
756 | |||
757 | switch (chan) { | ||
758 | case 36: | ||
759 | case 44: | ||
760 | case 52: | ||
761 | case 60: | ||
762 | case 100: | ||
763 | case 108: | ||
764 | case 116: | ||
765 | case 124: | ||
766 | case 132: | ||
767 | case 140: | ||
768 | case 149: | ||
769 | case 157: | ||
770 | sec_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
771 | break; | ||
772 | case 40: | ||
773 | case 48: | ||
774 | case 56: | ||
775 | case 64: | ||
776 | case 104: | ||
777 | case 112: | ||
778 | case 120: | ||
779 | case 128: | ||
780 | case 136: | ||
781 | case 144: | ||
782 | case 153: | ||
783 | case 161: | ||
784 | sec_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
785 | break; | ||
786 | case 165: | ||
787 | default: | ||
788 | sec_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
789 | break; | ||
790 | } | ||
791 | |||
792 | return sec_offset; | ||
793 | } | ||
diff --git a/drivers/net/wireless/mwifiex/11n.h b/drivers/net/wireless/mwifiex/11n.h index 40b007a00f4b..43889d9e3b35 100644 --- a/drivers/net/wireless/mwifiex/11n.h +++ b/drivers/net/wireless/mwifiex/11n.h | |||
@@ -63,6 +63,7 @@ int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, | |||
63 | int cmd_action, | 63 | int cmd_action, |
64 | struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl); | 64 | struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl); |
65 | void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra); | 65 | void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra); |
66 | u8 mwifiex_get_sec_chan_offset(int chan); | ||
66 | 67 | ||
67 | static inline u8 | 68 | static inline u8 |
68 | mwifiex_is_station_ampdu_allowed(struct mwifiex_private *priv, | 69 | mwifiex_is_station_ampdu_allowed(struct mwifiex_private *priv, |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 421322f5e5fb..8dee6c86f4f1 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -960,9 +960,6 @@ mwifiex_cmd_timeout_func(unsigned long function_context) | |||
960 | if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) | 960 | if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) |
961 | mwifiex_init_fw_complete(adapter); | 961 | mwifiex_init_fw_complete(adapter); |
962 | 962 | ||
963 | if (adapter->if_ops.fw_dump) | ||
964 | adapter->if_ops.fw_dump(adapter); | ||
965 | |||
966 | if (adapter->if_ops.card_reset) | 963 | if (adapter->if_ops.card_reset) |
967 | adapter->if_ops.card_reset(adapter); | 964 | adapter->if_ops.card_reset(adapter); |
968 | } | 965 | } |
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index b485dc1ae5eb..ee59508307cc 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -169,6 +169,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
169 | #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) | 169 | #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) |
170 | #define TLV_TYPE_COALESCE_RULE (PROPRIETARY_TLV_BASE_ID + 154) | 170 | #define TLV_TYPE_COALESCE_RULE (PROPRIETARY_TLV_BASE_ID + 154) |
171 | #define TLV_TYPE_KEY_PARAM_V2 (PROPRIETARY_TLV_BASE_ID + 156) | 171 | #define TLV_TYPE_KEY_PARAM_V2 (PROPRIETARY_TLV_BASE_ID + 156) |
172 | #define TLV_TYPE_TDLS_IDLE_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 194) | ||
172 | #define TLV_TYPE_FW_API_REV (PROPRIETARY_TLV_BASE_ID + 199) | 173 | #define TLV_TYPE_FW_API_REV (PROPRIETARY_TLV_BASE_ID + 199) |
173 | 174 | ||
174 | #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 | 175 | #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 |
@@ -229,6 +230,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
229 | #define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8)) | 230 | #define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8)) |
230 | #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22)) | 231 | #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22)) |
231 | #define ISSUPP_BEAMFORMING(Dot11nDevCap) (Dot11nDevCap & BIT(30)) | 232 | #define ISSUPP_BEAMFORMING(Dot11nDevCap) (Dot11nDevCap & BIT(30)) |
233 | #define ISALLOWED_CHANWIDTH40(ht_param) (ht_param & BIT(2)) | ||
232 | 234 | ||
233 | /* httxcfg bitmap | 235 | /* httxcfg bitmap |
234 | * 0 reserved | 236 | * 0 reserved |
@@ -487,6 +489,7 @@ enum P2P_MODES { | |||
487 | #define EVENT_UAP_MIC_COUNTERMEASURES 0x0000004c | 489 | #define EVENT_UAP_MIC_COUNTERMEASURES 0x0000004c |
488 | #define EVENT_HOSTWAKE_STAIE 0x0000004d | 490 | #define EVENT_HOSTWAKE_STAIE 0x0000004d |
489 | #define EVENT_CHANNEL_SWITCH_ANN 0x00000050 | 491 | #define EVENT_CHANNEL_SWITCH_ANN 0x00000050 |
492 | #define EVENT_TDLS_GENERIC_EVENT 0x00000052 | ||
490 | #define EVENT_EXT_SCAN_REPORT 0x00000058 | 493 | #define EVENT_EXT_SCAN_REPORT 0x00000058 |
491 | #define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f | 494 | #define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f |
492 | 495 | ||
@@ -519,6 +522,7 @@ enum P2P_MODES { | |||
519 | #define ACT_TDLS_DELETE 0x00 | 522 | #define ACT_TDLS_DELETE 0x00 |
520 | #define ACT_TDLS_CREATE 0x01 | 523 | #define ACT_TDLS_CREATE 0x01 |
521 | #define ACT_TDLS_CONFIG 0x02 | 524 | #define ACT_TDLS_CONFIG 0x02 |
525 | #define TDLS_EVENT_LINK_TEAR_DOWN 3 | ||
522 | 526 | ||
523 | #define MWIFIEX_FW_V15 15 | 527 | #define MWIFIEX_FW_V15 15 |
524 | 528 | ||
@@ -708,6 +712,13 @@ struct mwifiex_ie_types_vendor_param_set { | |||
708 | u8 ie[MWIFIEX_MAX_VSIE_LEN]; | 712 | u8 ie[MWIFIEX_MAX_VSIE_LEN]; |
709 | }; | 713 | }; |
710 | 714 | ||
715 | #define MWIFIEX_TDLS_IDLE_TIMEOUT 60 | ||
716 | |||
717 | struct mwifiex_ie_types_tdls_idle_timeout { | ||
718 | struct mwifiex_ie_types_header header; | ||
719 | __le16 value; | ||
720 | } __packed; | ||
721 | |||
711 | struct mwifiex_ie_types_rsn_param_set { | 722 | struct mwifiex_ie_types_rsn_param_set { |
712 | struct mwifiex_ie_types_header header; | 723 | struct mwifiex_ie_types_header header; |
713 | u8 rsn_ie[1]; | 724 | u8 rsn_ie[1]; |
@@ -1745,6 +1756,15 @@ struct host_cmd_ds_802_11_subsc_evt { | |||
1745 | __le16 events; | 1756 | __le16 events; |
1746 | } __packed; | 1757 | } __packed; |
1747 | 1758 | ||
1759 | struct mwifiex_tdls_generic_event { | ||
1760 | __le16 type; | ||
1761 | u8 peer_mac[ETH_ALEN]; | ||
1762 | union { | ||
1763 | __le16 reason_code; | ||
1764 | __le16 reserved; | ||
1765 | } u; | ||
1766 | } __packed; | ||
1767 | |||
1748 | struct mwifiex_ie { | 1768 | struct mwifiex_ie { |
1749 | __le16 ie_index; | 1769 | __le16 ie_index; |
1750 | __le16 mgmt_subtype_mask; | 1770 | __le16 mgmt_subtype_mask; |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 6bc645a120fa..cbabc12fbda3 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -881,8 +881,6 @@ mwifiex_add_card(void *card, struct semaphore *sem, | |||
881 | goto err_kmalloc; | 881 | goto err_kmalloc; |
882 | 882 | ||
883 | INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); | 883 | INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); |
884 | if (adapter->if_ops.iface_work) | ||
885 | INIT_WORK(&adapter->iface_work, adapter->if_ops.iface_work); | ||
886 | 884 | ||
887 | /* Register the device. Fill up the private data structure with relevant | 885 | /* Register the device. Fill up the private data structure with relevant |
888 | information from the card. */ | 886 | information from the card. */ |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index d70457b26e26..34181192a666 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -674,7 +674,6 @@ struct mwifiex_if_ops { | |||
674 | void (*card_reset) (struct mwifiex_adapter *); | 674 | void (*card_reset) (struct mwifiex_adapter *); |
675 | void (*fw_dump)(struct mwifiex_adapter *); | 675 | void (*fw_dump)(struct mwifiex_adapter *); |
676 | int (*clean_pcie_ring) (struct mwifiex_adapter *adapter); | 676 | int (*clean_pcie_ring) (struct mwifiex_adapter *adapter); |
677 | void (*iface_work)(struct work_struct *work); | ||
678 | }; | 677 | }; |
679 | 678 | ||
680 | struct mwifiex_adapter { | 679 | struct mwifiex_adapter { |
@@ -810,7 +809,6 @@ struct mwifiex_adapter { | |||
810 | bool ext_scan; | 809 | bool ext_scan; |
811 | u8 fw_api_ver; | 810 | u8 fw_api_ver; |
812 | u8 fw_key_api_major_ver, fw_key_api_minor_ver; | 811 | u8 fw_key_api_major_ver, fw_key_api_minor_ver; |
813 | struct work_struct iface_work; | ||
814 | }; | 812 | }; |
815 | 813 | ||
816 | int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); | 814 | int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 51989b31137a..c2cfeec466d8 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -37,9 +37,6 @@ static struct mwifiex_if_ops pcie_ops; | |||
37 | 37 | ||
38 | static struct semaphore add_remove_card_sem; | 38 | static struct semaphore add_remove_card_sem; |
39 | 39 | ||
40 | /* enum mwifiex_pcie_work_flags bitmap */ | ||
41 | static unsigned long pcie_work_flags; | ||
42 | |||
43 | static int | 40 | static int |
44 | mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, | 41 | mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, |
45 | size_t size, int flags) | 42 | size_t size, int flags) |
@@ -224,8 +221,6 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) | |||
224 | if (!adapter || !adapter->priv_num) | 221 | if (!adapter || !adapter->priv_num) |
225 | return; | 222 | return; |
226 | 223 | ||
227 | cancel_work_sync(&adapter->iface_work); | ||
228 | |||
229 | if (user_rmmod) { | 224 | if (user_rmmod) { |
230 | #ifdef CONFIG_PM_SLEEP | 225 | #ifdef CONFIG_PM_SLEEP |
231 | if (adapter->is_suspended) | 226 | if (adapter->is_suspended) |
@@ -312,17 +307,6 @@ static int mwifiex_read_reg(struct mwifiex_adapter *adapter, int reg, u32 *data) | |||
312 | return 0; | 307 | return 0; |
313 | } | 308 | } |
314 | 309 | ||
315 | /* This function reads u8 data from PCIE card register. */ | ||
316 | static int mwifiex_read_reg_byte(struct mwifiex_adapter *adapter, | ||
317 | int reg, u8 *data) | ||
318 | { | ||
319 | struct pcie_service_card *card = adapter->card; | ||
320 | |||
321 | *data = ioread8(card->pci_mmap1 + reg); | ||
322 | |||
323 | return 0; | ||
324 | } | ||
325 | |||
326 | /* | 310 | /* |
327 | * This function adds delay loop to ensure FW is awake before proceeding. | 311 | * This function adds delay loop to ensure FW is awake before proceeding. |
328 | */ | 312 | */ |
@@ -2188,215 +2172,6 @@ static int mwifiex_pcie_host_to_card(struct mwifiex_adapter *adapter, u8 type, | |||
2188 | return 0; | 2172 | return 0; |
2189 | } | 2173 | } |
2190 | 2174 | ||
2191 | /* This function read/write firmware */ | ||
2192 | static enum rdwr_status | ||
2193 | mwifiex_pcie_rdwr_firmware(struct mwifiex_adapter *adapter, u8 doneflag) | ||
2194 | { | ||
2195 | int ret, tries; | ||
2196 | u8 ctrl_data; | ||
2197 | |||
2198 | ret = mwifiex_write_reg(adapter, DEBUG_DUMP_CTRL_REG, DEBUG_HOST_READY); | ||
2199 | if (ret) { | ||
2200 | dev_err(adapter->dev, "PCIE write err\n"); | ||
2201 | return RDWR_STATUS_FAILURE; | ||
2202 | } | ||
2203 | |||
2204 | for (tries = 0; tries < MAX_POLL_TRIES; tries++) { | ||
2205 | mwifiex_read_reg_byte(adapter, DEBUG_DUMP_CTRL_REG, &ctrl_data); | ||
2206 | if (ctrl_data == DEBUG_FW_DONE) | ||
2207 | return RDWR_STATUS_SUCCESS; | ||
2208 | if (doneflag && ctrl_data == doneflag) | ||
2209 | return RDWR_STATUS_DONE; | ||
2210 | if (ctrl_data != DEBUG_HOST_READY) { | ||
2211 | dev_info(adapter->dev, | ||
2212 | "The ctrl reg was changed, re-try again!\n"); | ||
2213 | mwifiex_write_reg(adapter, DEBUG_DUMP_CTRL_REG, | ||
2214 | DEBUG_HOST_READY); | ||
2215 | if (ret) { | ||
2216 | dev_err(adapter->dev, "PCIE write err\n"); | ||
2217 | return RDWR_STATUS_FAILURE; | ||
2218 | } | ||
2219 | } | ||
2220 | usleep_range(100, 200); | ||
2221 | } | ||
2222 | |||
2223 | dev_err(adapter->dev, "Fail to pull ctrl_data\n"); | ||
2224 | return RDWR_STATUS_FAILURE; | ||
2225 | } | ||
2226 | |||
2227 | /* This function dump firmware memory to file */ | ||
2228 | static void mwifiex_pcie_fw_dump_work(struct work_struct *work) | ||
2229 | { | ||
2230 | struct mwifiex_adapter *adapter = | ||
2231 | container_of(work, struct mwifiex_adapter, iface_work); | ||
2232 | unsigned int reg, reg_start, reg_end; | ||
2233 | u8 *dbg_ptr; | ||
2234 | struct timeval t; | ||
2235 | u8 dump_num = 0, idx, i, read_reg, doneflag = 0; | ||
2236 | enum rdwr_status stat; | ||
2237 | u32 memory_size; | ||
2238 | u8 filename[MAX_FULL_NAME_LEN]; | ||
2239 | mm_segment_t fs; | ||
2240 | loff_t pos; | ||
2241 | u8 *end_ptr; | ||
2242 | u8 *name_prefix = "/var/log/fw_dump_"; | ||
2243 | struct memory_type_mapping mem_type_mapping_tbl[] = { | ||
2244 | {"ITCM", NULL, NULL, 0xF0}, | ||
2245 | {"DTCM", NULL, NULL, 0xF1}, | ||
2246 | {"SQRAM", NULL, NULL, 0xF2}, | ||
2247 | {"IRAM", NULL, NULL, 0xF3}, | ||
2248 | }; | ||
2249 | |||
2250 | if (!adapter) { | ||
2251 | dev_err(adapter->dev, "Could not dump firmwware info\n"); | ||
2252 | return; | ||
2253 | } | ||
2254 | |||
2255 | do_gettimeofday(&t); | ||
2256 | dev_info(adapter->dev, "== mwifiex firmware dump start: %u.%06u ==\n", | ||
2257 | (u32)t.tv_sec, (u32)t.tv_usec); | ||
2258 | |||
2259 | /* Read the number of the memories which will dump */ | ||
2260 | stat = mwifiex_pcie_rdwr_firmware(adapter, doneflag); | ||
2261 | if (stat == RDWR_STATUS_FAILURE) | ||
2262 | goto done; | ||
2263 | |||
2264 | reg = DEBUG_DUMP_START_REG; | ||
2265 | mwifiex_read_reg_byte(adapter, reg, &dump_num); | ||
2266 | |||
2267 | /* Read the length of every memory which will dump */ | ||
2268 | for (idx = 0; idx < dump_num; idx++) { | ||
2269 | struct memory_type_mapping *entry = &mem_type_mapping_tbl[idx]; | ||
2270 | |||
2271 | stat = mwifiex_pcie_rdwr_firmware(adapter, doneflag); | ||
2272 | if (stat == RDWR_STATUS_FAILURE) | ||
2273 | goto done; | ||
2274 | |||
2275 | memory_size = 0; | ||
2276 | reg = DEBUG_DUMP_START_REG; | ||
2277 | for (i = 0; i < 4; i++) { | ||
2278 | mwifiex_read_reg_byte(adapter, reg, &read_reg); | ||
2279 | memory_size |= (read_reg << (i * 8)); | ||
2280 | reg++; | ||
2281 | } | ||
2282 | |||
2283 | if (memory_size == 0) { | ||
2284 | dev_info(adapter->dev, "Firmware dump Finished!\n"); | ||
2285 | break; | ||
2286 | } | ||
2287 | |||
2288 | dev_info(adapter->dev, | ||
2289 | "%s_SIZE=0x%x\n", entry->mem_name, memory_size); | ||
2290 | entry->mem_ptr = vmalloc(memory_size + 1); | ||
2291 | if (!entry->mem_ptr) { | ||
2292 | dev_err(adapter->dev, | ||
2293 | "Vmalloc %s failed\n", entry->mem_name); | ||
2294 | goto done; | ||
2295 | } | ||
2296 | dbg_ptr = entry->mem_ptr; | ||
2297 | end_ptr = dbg_ptr + memory_size; | ||
2298 | |||
2299 | doneflag = entry->done_flag; | ||
2300 | do_gettimeofday(&t); | ||
2301 | dev_info(adapter->dev, "Start %s output %u.%06u, please wait...\n", | ||
2302 | entry->mem_name, (u32)t.tv_sec, (u32)t.tv_usec); | ||
2303 | |||
2304 | do { | ||
2305 | stat = mwifiex_pcie_rdwr_firmware(adapter, doneflag); | ||
2306 | if (RDWR_STATUS_FAILURE == stat) | ||
2307 | goto done; | ||
2308 | |||
2309 | reg_start = DEBUG_DUMP_START_REG; | ||
2310 | reg_end = DEBUG_DUMP_END_REG; | ||
2311 | for (reg = reg_start; reg <= reg_end; reg++) { | ||
2312 | mwifiex_read_reg_byte(adapter, reg, dbg_ptr); | ||
2313 | if (dbg_ptr < end_ptr) | ||
2314 | dbg_ptr++; | ||
2315 | else | ||
2316 | dev_err(adapter->dev, | ||
2317 | "Allocated buf not enough\n"); | ||
2318 | } | ||
2319 | |||
2320 | if (stat != RDWR_STATUS_DONE) | ||
2321 | continue; | ||
2322 | |||
2323 | dev_info(adapter->dev, "%s done: size=0x%lx\n", | ||
2324 | entry->mem_name, dbg_ptr - entry->mem_ptr); | ||
2325 | memset(filename, 0, sizeof(filename)); | ||
2326 | memcpy(filename, name_prefix, strlen(name_prefix)); | ||
2327 | strcat(filename, entry->mem_name); | ||
2328 | do_gettimeofday(&t); | ||
2329 | entry->file_mem = filp_open(filename, O_CREAT | O_RDWR, | ||
2330 | 0644); | ||
2331 | if (IS_ERR(entry->file_mem)) { | ||
2332 | dev_info(adapter->dev, | ||
2333 | "Create %s file failed at %s, opening another dir /tmp\n", | ||
2334 | entry->mem_name, filename); | ||
2335 | memset(filename, 0, sizeof(filename)); | ||
2336 | sprintf(filename, "%s%s", "/tmp/fw_dump_", | ||
2337 | entry->mem_name); | ||
2338 | entry->file_mem = | ||
2339 | filp_open(filename, | ||
2340 | O_CREAT | O_RDWR, 0644); | ||
2341 | } | ||
2342 | if (!IS_ERR(entry->file_mem)) { | ||
2343 | dev_info(adapter->dev, | ||
2344 | "Start to save the output : %u.%06u, please wait...\n", | ||
2345 | (u32)t.tv_sec, (u32)t.tv_usec); | ||
2346 | fs = get_fs(); | ||
2347 | set_fs(KERNEL_DS); | ||
2348 | pos = 0; | ||
2349 | vfs_write(entry->file_mem, | ||
2350 | (char __user *)entry->mem_ptr, | ||
2351 | memory_size, &pos); | ||
2352 | filp_close(entry->file_mem, NULL); | ||
2353 | set_fs(fs); | ||
2354 | dev_info(adapter->dev, | ||
2355 | "The output %s have been saved to file successfully!\n", | ||
2356 | entry->mem_name); | ||
2357 | } else { | ||
2358 | dev_err(adapter->dev, | ||
2359 | "Failed to create file %s\n", filename); | ||
2360 | } | ||
2361 | vfree(entry->mem_ptr); | ||
2362 | entry->mem_ptr = NULL; | ||
2363 | break; | ||
2364 | } while (true); | ||
2365 | } | ||
2366 | do_gettimeofday(&t); | ||
2367 | dev_info(adapter->dev, "== mwifiex firmware dump end: %u.%06u ==\n", | ||
2368 | (u32)t.tv_sec, (u32)t.tv_usec); | ||
2369 | |||
2370 | done: | ||
2371 | for (idx = 0; idx < ARRAY_SIZE(mem_type_mapping_tbl); idx++) { | ||
2372 | struct memory_type_mapping *entry = &mem_type_mapping_tbl[idx]; | ||
2373 | |||
2374 | if (entry->mem_ptr) { | ||
2375 | vfree(entry->mem_ptr); | ||
2376 | entry->mem_ptr = NULL; | ||
2377 | } | ||
2378 | } | ||
2379 | |||
2380 | return; | ||
2381 | } | ||
2382 | |||
2383 | static void mwifiex_pcie_work(struct work_struct *work) | ||
2384 | { | ||
2385 | if (test_and_clear_bit(MWIFIEX_PCIE_WORK_FW_DUMP, &pcie_work_flags)) | ||
2386 | mwifiex_pcie_fw_dump_work(work); | ||
2387 | } | ||
2388 | |||
2389 | /* This function dumps FW information */ | ||
2390 | static void mwifiex_pcie_fw_dump(struct mwifiex_adapter *adapter) | ||
2391 | { | ||
2392 | if (test_bit(MWIFIEX_PCIE_WORK_FW_DUMP, &pcie_work_flags)) | ||
2393 | return; | ||
2394 | |||
2395 | set_bit(MWIFIEX_PCIE_WORK_FW_DUMP, &pcie_work_flags); | ||
2396 | |||
2397 | schedule_work(&adapter->iface_work); | ||
2398 | } | ||
2399 | |||
2400 | /* | 2175 | /* |
2401 | * This function initializes the PCI-E host memory space, WCB rings, etc. | 2176 | * This function initializes the PCI-E host memory space, WCB rings, etc. |
2402 | * | 2177 | * |
@@ -2618,8 +2393,6 @@ static struct mwifiex_if_ops pcie_ops = { | |||
2618 | .cleanup_mpa_buf = NULL, | 2393 | .cleanup_mpa_buf = NULL, |
2619 | .init_fw_port = mwifiex_pcie_init_fw_port, | 2394 | .init_fw_port = mwifiex_pcie_init_fw_port, |
2620 | .clean_pcie_ring = mwifiex_clean_pcie_ring_buf, | 2395 | .clean_pcie_ring = mwifiex_clean_pcie_ring_buf, |
2621 | .fw_dump = mwifiex_pcie_fw_dump, | ||
2622 | .iface_work = mwifiex_pcie_work, | ||
2623 | }; | 2396 | }; |
2624 | 2397 | ||
2625 | /* | 2398 | /* |
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h index 3abba32e9448..e8ec561f8a64 100644 --- a/drivers/net/wireless/mwifiex/pcie.h +++ b/drivers/net/wireless/mwifiex/pcie.h | |||
@@ -100,28 +100,6 @@ | |||
100 | #define MWIFIEX_DEF_SLEEP_COOKIE 0xBEEFBEEF | 100 | #define MWIFIEX_DEF_SLEEP_COOKIE 0xBEEFBEEF |
101 | #define MWIFIEX_MAX_DELAY_COUNT 5 | 101 | #define MWIFIEX_MAX_DELAY_COUNT 5 |
102 | 102 | ||
103 | #define DEBUG_DUMP_CTRL_REG 0xCF4 | ||
104 | #define DEBUG_DUMP_START_REG 0xCF8 | ||
105 | #define DEBUG_DUMP_END_REG 0xCFF | ||
106 | #define DEBUG_HOST_READY 0xEE | ||
107 | #define DEBUG_FW_DONE 0xFF | ||
108 | |||
109 | #define MAX_NAME_LEN 8 | ||
110 | #define MAX_FULL_NAME_LEN 32 | ||
111 | |||
112 | struct memory_type_mapping { | ||
113 | u8 mem_name[MAX_NAME_LEN]; | ||
114 | u8 *mem_ptr; | ||
115 | struct file *file_mem; | ||
116 | u8 done_flag; | ||
117 | }; | ||
118 | |||
119 | enum rdwr_status { | ||
120 | RDWR_STATUS_SUCCESS = 0, | ||
121 | RDWR_STATUS_FAILURE = 1, | ||
122 | RDWR_STATUS_DONE = 2 | ||
123 | }; | ||
124 | |||
125 | struct mwifiex_pcie_card_reg { | 103 | struct mwifiex_pcie_card_reg { |
126 | u16 cmd_addr_lo; | 104 | u16 cmd_addr_lo; |
127 | u16 cmd_addr_hi; | 105 | u16 cmd_addr_hi; |
@@ -344,9 +322,4 @@ mwifiex_pcie_txbd_not_full(struct pcie_service_card *card) | |||
344 | 322 | ||
345 | return 0; | 323 | return 0; |
346 | } | 324 | } |
347 | |||
348 | enum mwifiex_pcie_work_flags { | ||
349 | MWIFIEX_PCIE_WORK_FW_DUMP, | ||
350 | }; | ||
351 | |||
352 | #endif /* _MWIFIEX_PCIE_H */ | 325 | #endif /* _MWIFIEX_PCIE_H */ |
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index e3cac1495cc7..88202ce0c139 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c | |||
@@ -1546,6 +1546,7 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv, | |||
1546 | struct mwifiex_ie_types_extcap *extcap; | 1546 | struct mwifiex_ie_types_extcap *extcap; |
1547 | struct mwifiex_ie_types_vhtcap *vht_capab; | 1547 | struct mwifiex_ie_types_vhtcap *vht_capab; |
1548 | struct mwifiex_ie_types_aid *aid; | 1548 | struct mwifiex_ie_types_aid *aid; |
1549 | struct mwifiex_ie_types_tdls_idle_timeout *timeout; | ||
1549 | u8 *pos, qos_info; | 1550 | u8 *pos, qos_info; |
1550 | u16 config_len = 0; | 1551 | u16 config_len = 0; |
1551 | struct station_parameters *params = priv->sta_params; | 1552 | struct station_parameters *params = priv->sta_params; |
@@ -1643,6 +1644,12 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv, | |||
1643 | config_len += sizeof(struct mwifiex_ie_types_aid); | 1644 | config_len += sizeof(struct mwifiex_ie_types_aid); |
1644 | } | 1645 | } |
1645 | 1646 | ||
1647 | timeout = (void *)(pos + config_len); | ||
1648 | timeout->header.type = cpu_to_le16(TLV_TYPE_TDLS_IDLE_TIMEOUT); | ||
1649 | timeout->header.len = cpu_to_le16(sizeof(timeout->value)); | ||
1650 | timeout->value = cpu_to_le16(MWIFIEX_TDLS_IDLE_TIMEOUT); | ||
1651 | config_len += sizeof(struct mwifiex_ie_types_tdls_idle_timeout); | ||
1652 | |||
1646 | break; | 1653 | break; |
1647 | default: | 1654 | default: |
1648 | dev_err(priv->adapter->dev, "Unknown TDLS operation\n"); | 1655 | dev_err(priv->adapter->dev, "Unknown TDLS operation\n"); |
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index 368450cc56c7..5aea719219a3 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -134,6 +134,42 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) | |||
134 | netif_carrier_off(priv->netdev); | 134 | netif_carrier_off(priv->netdev); |
135 | } | 135 | } |
136 | 136 | ||
137 | static int mwifiex_parse_tdls_event(struct mwifiex_private *priv, | ||
138 | struct sk_buff *event_skb) | ||
139 | { | ||
140 | struct mwifiex_adapter *adapter = priv->adapter; | ||
141 | struct mwifiex_sta_node *sta_ptr; | ||
142 | struct mwifiex_tdls_generic_event *tdls_evt = | ||
143 | (void *)event_skb->data + sizeof(adapter->event_cause); | ||
144 | |||
145 | /* reserved 2 bytes are not mandatory in tdls event */ | ||
146 | if (event_skb->len < (sizeof(struct mwifiex_tdls_generic_event) - | ||
147 | sizeof(u16) - sizeof(adapter->event_cause))) { | ||
148 | dev_err(adapter->dev, "Invalid event length!\n"); | ||
149 | return -1; | ||
150 | } | ||
151 | |||
152 | sta_ptr = mwifiex_get_sta_entry(priv, tdls_evt->peer_mac); | ||
153 | if (!sta_ptr) { | ||
154 | dev_err(adapter->dev, "cannot get sta entry!\n"); | ||
155 | return -1; | ||
156 | } | ||
157 | |||
158 | switch (le16_to_cpu(tdls_evt->type)) { | ||
159 | case TDLS_EVENT_LINK_TEAR_DOWN: | ||
160 | cfg80211_tdls_oper_request(priv->netdev, | ||
161 | tdls_evt->peer_mac, | ||
162 | NL80211_TDLS_TEARDOWN, | ||
163 | le16_to_cpu(tdls_evt->u.reason_code), | ||
164 | GFP_KERNEL); | ||
165 | break; | ||
166 | default: | ||
167 | break; | ||
168 | } | ||
169 | |||
170 | return 0; | ||
171 | } | ||
172 | |||
137 | /* | 173 | /* |
138 | * This function handles events generated by firmware. | 174 | * This function handles events generated by firmware. |
139 | * | 175 | * |
@@ -459,6 +495,10 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
459 | false); | 495 | false); |
460 | break; | 496 | break; |
461 | 497 | ||
498 | case EVENT_TDLS_GENERIC_EVENT: | ||
499 | ret = mwifiex_parse_tdls_event(priv, adapter->event_skb); | ||
500 | break; | ||
501 | |||
462 | default: | 502 | default: |
463 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", | 503 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", |
464 | eventcause); | 504 | eventcause); |
diff --git a/drivers/net/wireless/mwifiex/tdls.c b/drivers/net/wireless/mwifiex/tdls.c index 97662a1ba58c..6bef47c2a70d 100644 --- a/drivers/net/wireless/mwifiex/tdls.c +++ b/drivers/net/wireless/mwifiex/tdls.c | |||
@@ -185,6 +185,48 @@ static int mwifiex_tdls_add_vht_capab(struct mwifiex_private *priv, | |||
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | static int | ||
189 | mwifiex_tdls_add_ht_oper(struct mwifiex_private *priv, u8 *mac, | ||
190 | u8 vht_enabled, struct sk_buff *skb) | ||
191 | { | ||
192 | struct ieee80211_ht_operation *ht_oper; | ||
193 | struct mwifiex_sta_node *sta_ptr; | ||
194 | struct mwifiex_bssdescriptor *bss_desc = | ||
195 | &priv->curr_bss_params.bss_descriptor; | ||
196 | u8 *pos; | ||
197 | |||
198 | sta_ptr = mwifiex_get_sta_entry(priv, mac); | ||
199 | if (unlikely(!sta_ptr)) { | ||
200 | dev_warn(priv->adapter->dev, | ||
201 | "TDLS peer station not found in list\n"); | ||
202 | return -1; | ||
203 | } | ||
204 | |||
205 | pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_operation) + 2); | ||
206 | *pos++ = WLAN_EID_HT_OPERATION; | ||
207 | *pos++ = sizeof(struct ieee80211_ht_operation); | ||
208 | ht_oper = (void *)pos; | ||
209 | |||
210 | ht_oper->primary_chan = bss_desc->channel; | ||
211 | |||
212 | /* follow AP's channel bandwidth */ | ||
213 | if (ISSUPP_CHANWIDTH40(priv->adapter->hw_dot_11n_dev_cap) && | ||
214 | bss_desc->bcn_ht_cap && | ||
215 | ISALLOWED_CHANWIDTH40(bss_desc->bcn_ht_oper->ht_param)) | ||
216 | ht_oper->ht_param = bss_desc->bcn_ht_oper->ht_param; | ||
217 | |||
218 | if (vht_enabled) { | ||
219 | ht_oper->ht_param = | ||
220 | mwifiex_get_sec_chan_offset(bss_desc->channel); | ||
221 | ht_oper->ht_param |= BIT(2); | ||
222 | } | ||
223 | |||
224 | memcpy(&sta_ptr->tdls_cap.ht_oper, ht_oper, | ||
225 | sizeof(struct ieee80211_ht_operation)); | ||
226 | |||
227 | return 0; | ||
228 | } | ||
229 | |||
188 | static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv, | 230 | static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv, |
189 | u8 *mac, struct sk_buff *skb) | 231 | u8 *mac, struct sk_buff *skb) |
190 | { | 232 | { |
@@ -428,6 +470,17 @@ static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, | |||
428 | dev_kfree_skb_any(skb); | 470 | dev_kfree_skb_any(skb); |
429 | return ret; | 471 | return ret; |
430 | } | 472 | } |
473 | ret = mwifiex_tdls_add_ht_oper(priv, peer, 1, skb); | ||
474 | if (ret) { | ||
475 | dev_kfree_skb_any(skb); | ||
476 | return ret; | ||
477 | } | ||
478 | } else { | ||
479 | ret = mwifiex_tdls_add_ht_oper(priv, peer, 0, skb); | ||
480 | if (ret) { | ||
481 | dev_kfree_skb_any(skb); | ||
482 | return ret; | ||
483 | } | ||
431 | } | 484 | } |
432 | break; | 485 | break; |
433 | 486 | ||
diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c index f9805c9353d2..1cbb7835806f 100644 --- a/drivers/net/wireless/orinoco/orinoco_usb.c +++ b/drivers/net/wireless/orinoco/orinoco_usb.c | |||
@@ -1687,7 +1687,7 @@ static int ezusb_probe(struct usb_interface *interface, | |||
1687 | firmware.code = fw_entry->data; | 1687 | firmware.code = fw_entry->data; |
1688 | } | 1688 | } |
1689 | if (firmware.size && firmware.code) { | 1689 | if (firmware.size && firmware.code) { |
1690 | if (ezusb_firmware_download(upriv, &firmware)) | 1690 | if (ezusb_firmware_download(upriv, &firmware) < 0) |
1691 | goto error; | 1691 | goto error; |
1692 | } else { | 1692 | } else { |
1693 | err("No firmware to download"); | 1693 | err("No firmware to download"); |
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c index eede90b63f84..7be3a4839640 100644 --- a/drivers/net/wireless/p54/main.c +++ b/drivers/net/wireless/p54/main.c | |||
@@ -669,7 +669,8 @@ static unsigned int p54_flush_count(struct p54_common *priv) | |||
669 | return total; | 669 | return total; |
670 | } | 670 | } |
671 | 671 | ||
672 | static void p54_flush(struct ieee80211_hw *dev, u32 queues, bool drop) | 672 | static void p54_flush(struct ieee80211_hw *dev, struct ieee80211_vif *vif, |
673 | u32 queues, bool drop) | ||
673 | { | 674 | { |
674 | struct p54_common *priv = dev->priv; | 675 | struct p54_common *priv = dev->priv; |
675 | unsigned int total, i; | 676 | unsigned int total, i; |
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c index 84164747ace0..54aaeb09debf 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c | |||
@@ -656,6 +656,7 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw, | |||
656 | case IEEE80211_AMPDU_TX_START: | 656 | case IEEE80211_AMPDU_TX_START: |
657 | common->vif_info[ii].seq_start = seq_no; | 657 | common->vif_info[ii].seq_start = seq_no; |
658 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 658 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
659 | status = 0; | ||
659 | break; | 660 | break; |
660 | 661 | ||
661 | case IEEE80211_AMPDU_TX_STOP_CONT: | 662 | case IEEE80211_AMPDU_TX_STOP_CONT: |
diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c index 1b28cda6ca88..2eefbf159bc0 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c | |||
@@ -1083,7 +1083,7 @@ void rsi_inform_bss_status(struct rsi_common *common, | |||
1083 | { | 1083 | { |
1084 | if (status) { | 1084 | if (status) { |
1085 | rsi_hal_send_sta_notify_frame(common, | 1085 | rsi_hal_send_sta_notify_frame(common, |
1086 | NL80211_IFTYPE_STATION, | 1086 | RSI_IFTYPE_STATION, |
1087 | STA_CONNECTED, | 1087 | STA_CONNECTED, |
1088 | bssid, | 1088 | bssid, |
1089 | qos_enable, | 1089 | qos_enable, |
@@ -1092,7 +1092,7 @@ void rsi_inform_bss_status(struct rsi_common *common, | |||
1092 | rsi_send_auto_rate_request(common); | 1092 | rsi_send_auto_rate_request(common); |
1093 | } else { | 1093 | } else { |
1094 | rsi_hal_send_sta_notify_frame(common, | 1094 | rsi_hal_send_sta_notify_frame(common, |
1095 | NL80211_IFTYPE_STATION, | 1095 | RSI_IFTYPE_STATION, |
1096 | STA_DISCONNECTED, | 1096 | STA_DISCONNECTED, |
1097 | bssid, | 1097 | bssid, |
1098 | qos_enable, | 1098 | qos_enable, |
diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h b/drivers/net/wireless/rsi/rsi_mgmt.h index ac67c4ad63c2..225215a3b8bb 100644 --- a/drivers/net/wireless/rsi/rsi_mgmt.h +++ b/drivers/net/wireless/rsi/rsi_mgmt.h | |||
@@ -73,6 +73,7 @@ | |||
73 | #define RX_BA_INDICATION 1 | 73 | #define RX_BA_INDICATION 1 |
74 | #define RSI_TBL_SZ 40 | 74 | #define RSI_TBL_SZ 40 |
75 | #define MAX_RETRIES 8 | 75 | #define MAX_RETRIES 8 |
76 | #define RSI_IFTYPE_STATION 0 | ||
76 | 77 | ||
77 | #define STD_RATE_MCS7 0x07 | 78 | #define STD_RATE_MCS7 0x07 |
78 | #define STD_RATE_MCS6 0x06 | 79 | #define STD_RATE_MCS6 0x06 |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index e3b885d8f7db..010b76505243 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -1448,7 +1448,8 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, | |||
1448 | struct ieee80211_vif *vif, u16 queue, | 1448 | struct ieee80211_vif *vif, u16 queue, |
1449 | const struct ieee80211_tx_queue_params *params); | 1449 | const struct ieee80211_tx_queue_params *params); |
1450 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); | 1450 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); |
1451 | void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop); | 1451 | void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1452 | u32 queues, bool drop); | ||
1452 | int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); | 1453 | int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); |
1453 | int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); | 1454 | int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); |
1454 | void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, | 1455 | void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index ddeb5a709aa3..212ac4842c16 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -621,20 +621,18 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, | |||
621 | bss_conf->bssid); | 621 | bss_conf->bssid); |
622 | 622 | ||
623 | /* | 623 | /* |
624 | * Update the beacon. This is only required on USB devices. PCI | ||
625 | * devices fetch beacons periodically. | ||
626 | */ | ||
627 | if (changes & BSS_CHANGED_BEACON && rt2x00_is_usb(rt2x00dev)) | ||
628 | rt2x00queue_update_beacon(rt2x00dev, vif); | ||
629 | |||
630 | /* | ||
631 | * Start/stop beaconing. | 624 | * Start/stop beaconing. |
632 | */ | 625 | */ |
633 | if (changes & BSS_CHANGED_BEACON_ENABLED) { | 626 | if (changes & BSS_CHANGED_BEACON_ENABLED) { |
634 | if (!bss_conf->enable_beacon && intf->enable_beacon) { | 627 | if (!bss_conf->enable_beacon && intf->enable_beacon) { |
635 | rt2x00queue_clear_beacon(rt2x00dev, vif); | ||
636 | rt2x00dev->intf_beaconing--; | 628 | rt2x00dev->intf_beaconing--; |
637 | intf->enable_beacon = false; | 629 | intf->enable_beacon = false; |
630 | /* | ||
631 | * Clear beacon in the H/W for this vif. This is needed | ||
632 | * to disable beaconing on this particular interface | ||
633 | * and keep it running on other interfaces. | ||
634 | */ | ||
635 | rt2x00queue_clear_beacon(rt2x00dev, vif); | ||
638 | 636 | ||
639 | if (rt2x00dev->intf_beaconing == 0) { | 637 | if (rt2x00dev->intf_beaconing == 0) { |
640 | /* | 638 | /* |
@@ -645,11 +643,15 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, | |||
645 | rt2x00queue_stop_queue(rt2x00dev->bcn); | 643 | rt2x00queue_stop_queue(rt2x00dev->bcn); |
646 | mutex_unlock(&intf->beacon_skb_mutex); | 644 | mutex_unlock(&intf->beacon_skb_mutex); |
647 | } | 645 | } |
648 | |||
649 | |||
650 | } else if (bss_conf->enable_beacon && !intf->enable_beacon) { | 646 | } else if (bss_conf->enable_beacon && !intf->enable_beacon) { |
651 | rt2x00dev->intf_beaconing++; | 647 | rt2x00dev->intf_beaconing++; |
652 | intf->enable_beacon = true; | 648 | intf->enable_beacon = true; |
649 | /* | ||
650 | * Upload beacon to the H/W. This is only required on | ||
651 | * USB devices. PCI devices fetch beacons periodically. | ||
652 | */ | ||
653 | if (rt2x00_is_usb(rt2x00dev)) | ||
654 | rt2x00queue_update_beacon(rt2x00dev, vif); | ||
653 | 655 | ||
654 | if (rt2x00dev->intf_beaconing == 1) { | 656 | if (rt2x00dev->intf_beaconing == 1) { |
655 | /* | 657 | /* |
@@ -747,7 +749,8 @@ void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw) | |||
747 | } | 749 | } |
748 | EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); | 750 | EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); |
749 | 751 | ||
750 | void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 752 | void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
753 | u32 queues, bool drop) | ||
751 | { | 754 | { |
752 | struct rt2x00_dev *rt2x00dev = hw->priv; | 755 | struct rt2x00_dev *rt2x00dev = hw->priv; |
753 | struct data_queue *queue; | 756 | struct data_queue *queue; |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 50d69b13f984..2c1c02bafa10 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c | |||
@@ -284,6 +284,8 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
284 | rx_status.band = dev->conf.chandef.chan->band; | 284 | rx_status.band = dev->conf.chandef.chan->band; |
285 | rx_status.mactime = tsft; | 285 | rx_status.mactime = tsft; |
286 | rx_status.flag |= RX_FLAG_MACTIME_START; | 286 | rx_status.flag |= RX_FLAG_MACTIME_START; |
287 | if (flags & RTL818X_RX_DESC_FLAG_SPLCP) | ||
288 | rx_status.flag |= RX_FLAG_SHORTPRE; | ||
287 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) | 289 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) |
288 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; | 290 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; |
289 | 291 | ||
@@ -461,18 +463,23 @@ static void rtl8180_tx(struct ieee80211_hw *dev, | |||
461 | RTL818X_TX_DESC_FLAG_NO_ENC; | 463 | RTL818X_TX_DESC_FLAG_NO_ENC; |
462 | 464 | ||
463 | rc_flags = info->control.rates[0].flags; | 465 | rc_flags = info->control.rates[0].flags; |
466 | |||
467 | /* HW will perform RTS-CTS when only RTS flags is set. | ||
468 | * HW will perform CTS-to-self when both RTS and CTS flags are set. | ||
469 | * RTS rate and RTS duration will be used also for CTS-to-self. | ||
470 | */ | ||
464 | if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { | 471 | if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { |
465 | tx_flags |= RTL818X_TX_DESC_FLAG_RTS; | 472 | tx_flags |= RTL818X_TX_DESC_FLAG_RTS; |
466 | tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; | 473 | tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; |
474 | rts_duration = ieee80211_rts_duration(dev, priv->vif, | ||
475 | skb->len, info); | ||
467 | } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { | 476 | } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { |
468 | tx_flags |= RTL818X_TX_DESC_FLAG_CTS; | 477 | tx_flags |= RTL818X_TX_DESC_FLAG_RTS | RTL818X_TX_DESC_FLAG_CTS; |
469 | tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; | 478 | tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; |
479 | rts_duration = ieee80211_ctstoself_duration(dev, priv->vif, | ||
480 | skb->len, info); | ||
470 | } | 481 | } |
471 | 482 | ||
472 | if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) | ||
473 | rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, | ||
474 | info); | ||
475 | |||
476 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8180) { | 483 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8180) { |
477 | unsigned int remainder; | 484 | unsigned int remainder; |
478 | 485 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index 0ca17cda48fa..629ad8cfa17b 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c | |||
@@ -253,14 +253,21 @@ static void rtl8187_tx(struct ieee80211_hw *dev, | |||
253 | flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; | 253 | flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; |
254 | if (ieee80211_has_morefrags(tx_hdr->frame_control)) | 254 | if (ieee80211_has_morefrags(tx_hdr->frame_control)) |
255 | flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; | 255 | flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; |
256 | |||
257 | /* HW will perform RTS-CTS when only RTS flags is set. | ||
258 | * HW will perform CTS-to-self when both RTS and CTS flags are set. | ||
259 | * RTS rate and RTS duration will be used also for CTS-to-self. | ||
260 | */ | ||
256 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { | 261 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { |
257 | flags |= RTL818X_TX_DESC_FLAG_RTS; | 262 | flags |= RTL818X_TX_DESC_FLAG_RTS; |
258 | flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; | 263 | flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; |
259 | rts_dur = ieee80211_rts_duration(dev, priv->vif, | 264 | rts_dur = ieee80211_rts_duration(dev, priv->vif, |
260 | skb->len, info); | 265 | skb->len, info); |
261 | } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { | 266 | } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { |
262 | flags |= RTL818X_TX_DESC_FLAG_CTS; | 267 | flags |= RTL818X_TX_DESC_FLAG_RTS | RTL818X_TX_DESC_FLAG_CTS; |
263 | flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; | 268 | flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; |
269 | rts_dur = ieee80211_ctstoself_duration(dev, priv->vif, | ||
270 | skb->len, info); | ||
264 | } | 271 | } |
265 | 272 | ||
266 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 273 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
@@ -381,6 +388,8 @@ static void rtl8187_rx_cb(struct urb *urb) | |||
381 | rx_status.freq = dev->conf.chandef.chan->center_freq; | 388 | rx_status.freq = dev->conf.chandef.chan->center_freq; |
382 | rx_status.band = dev->conf.chandef.chan->band; | 389 | rx_status.band = dev->conf.chandef.chan->band; |
383 | rx_status.flag |= RX_FLAG_MACTIME_START; | 390 | rx_status.flag |= RX_FLAG_MACTIME_START; |
391 | if (flags & RTL818X_RX_DESC_FLAG_SPLCP) | ||
392 | rx_status.flag |= RX_FLAG_SHORTPRE; | ||
384 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) | 393 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) |
385 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; | 394 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; |
386 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); | 395 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index 4ec424f26672..b1ed6d0796f6 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
@@ -1387,7 +1387,8 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw) | |||
1387 | * before switch channel or power save, or tx buffer packet | 1387 | * before switch channel or power save, or tx buffer packet |
1388 | * maybe send after offchannel or rf sleep, this may cause | 1388 | * maybe send after offchannel or rf sleep, this may cause |
1389 | * dis-association by AP */ | 1389 | * dis-association by AP */ |
1390 | static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1390 | static void rtl_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1391 | u32 queues, bool drop) | ||
1391 | { | 1392 | { |
1392 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1393 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1393 | 1394 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c index 1b4101bf9974..79792d477b43 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c | |||
@@ -93,7 +93,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw) | |||
93 | u8 tid; | 93 | u8 tid; |
94 | 94 | ||
95 | rtl8188ee_bt_reg_init(hw); | 95 | rtl8188ee_bt_reg_init(hw); |
96 | rtlpci->msi_support = true; | 96 | rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; |
97 | 97 | ||
98 | rtlpriv->dm.dm_initialgain_enable = 1; | 98 | rtlpriv->dm.dm_initialgain_enable = 1; |
99 | rtlpriv->dm.dm_flag = 0; | 99 | rtlpriv->dm.dm_flag = 0; |
@@ -267,6 +267,7 @@ static struct rtl_mod_params rtl88ee_mod_params = { | |||
267 | .inactiveps = true, | 267 | .inactiveps = true, |
268 | .swctrl_lps = false, | 268 | .swctrl_lps = false, |
269 | .fwctrl_lps = true, | 269 | .fwctrl_lps = true, |
270 | .msi_support = false, | ||
270 | .debug = DBG_EMERG, | 271 | .debug = DBG_EMERG, |
271 | }; | 272 | }; |
272 | 273 | ||
@@ -383,10 +384,12 @@ module_param_named(debug, rtl88ee_mod_params.debug, int, 0444); | |||
383 | module_param_named(ips, rtl88ee_mod_params.inactiveps, bool, 0444); | 384 | module_param_named(ips, rtl88ee_mod_params.inactiveps, bool, 0444); |
384 | module_param_named(swlps, rtl88ee_mod_params.swctrl_lps, bool, 0444); | 385 | module_param_named(swlps, rtl88ee_mod_params.swctrl_lps, bool, 0444); |
385 | module_param_named(fwlps, rtl88ee_mod_params.fwctrl_lps, bool, 0444); | 386 | module_param_named(fwlps, rtl88ee_mod_params.fwctrl_lps, bool, 0444); |
387 | module_param_named(msi, rtl88ee_mod_params.msi_support, bool, 0444); | ||
386 | MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); | 388 | MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); |
387 | MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); | 389 | MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); |
388 | MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); | 390 | MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); |
389 | MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); | 391 | MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); |
392 | MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); | ||
390 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); | 393 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); |
391 | 394 | ||
392 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); | 395 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c index 06ef47cd6203..5b4c225396f2 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | |||
@@ -293,7 +293,7 @@ static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw, | |||
293 | u8 *psaddr; | 293 | u8 *psaddr; |
294 | __le16 fc; | 294 | __le16 fc; |
295 | u16 type, ufc; | 295 | u16 type, ufc; |
296 | bool match_bssid, packet_toself, packet_beacon, addr; | 296 | bool match_bssid, packet_toself, packet_beacon = false, addr; |
297 | 297 | ||
298 | tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift; | 298 | tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift; |
299 | 299 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 68b5c7e92cfb..a903c2671b4d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -511,7 +511,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw) | |||
511 | pr_info("MAC auto ON okay!\n"); | 511 | pr_info("MAC auto ON okay!\n"); |
512 | break; | 512 | break; |
513 | } | 513 | } |
514 | if (pollingCount++ > 100) { | 514 | if (pollingCount++ > 1000) { |
515 | RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, | 515 | RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, |
516 | "Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n"); | 516 | "Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n"); |
517 | return -ENODEV; | 517 | return -ENODEV; |
@@ -1001,7 +1001,7 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw) | |||
1001 | err = _rtl92cu_init_mac(hw); | 1001 | err = _rtl92cu_init_mac(hw); |
1002 | if (err) { | 1002 | if (err) { |
1003 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "init mac failed!\n"); | 1003 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "init mac failed!\n"); |
1004 | return err; | 1004 | goto exit; |
1005 | } | 1005 | } |
1006 | err = rtl92c_download_fw(hw); | 1006 | err = rtl92c_download_fw(hw); |
1007 | if (err) { | 1007 | if (err) { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c index 36b48be8329c..2b3c78baa9f8 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | |||
@@ -49,6 +49,12 @@ static u8 _rtl92se_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 skb_queue) | |||
49 | if (ieee80211_is_nullfunc(fc)) | 49 | if (ieee80211_is_nullfunc(fc)) |
50 | return QSLT_HIGH; | 50 | return QSLT_HIGH; |
51 | 51 | ||
52 | /* Kernel commit 1bf4bbb4024dcdab changed EAPOL packets to use | ||
53 | * queue V0 at priority 7; however, the RTL8192SE appears to have | ||
54 | * that queue at priority 6 | ||
55 | */ | ||
56 | if (skb->priority == 7) | ||
57 | return QSLT_VO; | ||
52 | return skb->priority; | 58 | return skb->priority; |
53 | } | 59 | } |
54 | 60 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/rtlwifi/rtl8723be/sw.c index b4577ebc4bb0..ff12bf41644b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8723be/sw.c | |||
@@ -92,7 +92,7 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) | |||
92 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 92 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
93 | 93 | ||
94 | rtl8723be_bt_reg_init(hw); | 94 | rtl8723be_bt_reg_init(hw); |
95 | rtlpci->msi_support = true; | 95 | rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; |
96 | rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); | 96 | rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); |
97 | 97 | ||
98 | rtlpriv->dm.dm_initialgain_enable = 1; | 98 | rtlpriv->dm.dm_initialgain_enable = 1; |
@@ -253,6 +253,7 @@ static struct rtl_mod_params rtl8723be_mod_params = { | |||
253 | .inactiveps = true, | 253 | .inactiveps = true, |
254 | .swctrl_lps = false, | 254 | .swctrl_lps = false, |
255 | .fwctrl_lps = true, | 255 | .fwctrl_lps = true, |
256 | .msi_support = false, | ||
256 | .debug = DBG_EMERG, | 257 | .debug = DBG_EMERG, |
257 | }; | 258 | }; |
258 | 259 | ||
@@ -365,9 +366,11 @@ module_param_named(debug, rtl8723be_mod_params.debug, int, 0444); | |||
365 | module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444); | 366 | module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444); |
366 | module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444); | 367 | module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444); |
367 | module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); | 368 | module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); |
369 | module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444); | ||
368 | MODULE_PARM_DESC(swenc, "using hardware crypto (default 0 [hardware])\n"); | 370 | MODULE_PARM_DESC(swenc, "using hardware crypto (default 0 [hardware])\n"); |
369 | MODULE_PARM_DESC(ips, "using no link power save (default 1 is open)\n"); | 371 | MODULE_PARM_DESC(ips, "using no link power save (default 1 is open)\n"); |
370 | MODULE_PARM_DESC(fwlps, "using linked fw control power save (default 1 is open)\n"); | 372 | MODULE_PARM_DESC(fwlps, "using linked fw control power save (default 1 is open)\n"); |
373 | MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); | ||
371 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); | 374 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); |
372 | 375 | ||
373 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); | 376 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index 6965afdf572a..eef93d1ccc56 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -2030,6 +2030,10 @@ struct rtl_mod_params { | |||
2030 | 2030 | ||
2031 | /* default: 1 = using linked fw power save */ | 2031 | /* default: 1 = using linked fw power save */ |
2032 | bool fwctrl_lps; | 2032 | bool fwctrl_lps; |
2033 | |||
2034 | /* default: 0 = not using MSI interrupts mode */ | ||
2035 | /* submodules should set their own defalut value */ | ||
2036 | bool msi_support; | ||
2033 | }; | 2037 | }; |
2034 | 2038 | ||
2035 | struct rtl_hal_usbint_cfg { | 2039 | struct rtl_hal_usbint_cfg { |
diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c index db0105313745..c98630394a1a 100644 --- a/drivers/net/wireless/ti/wl1251/event.c +++ b/drivers/net/wireless/ti/wl1251/event.c | |||
@@ -124,11 +124,12 @@ static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox) | |||
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | 126 | ||
127 | if (wl->vif && vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { | 127 | if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { |
128 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); | 128 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); |
129 | 129 | ||
130 | /* indicate to the stack, that beacons have been lost */ | 130 | /* indicate to the stack, that beacons have been lost */ |
131 | ieee80211_beacon_loss(wl->vif); | 131 | if (wl->vif && wl->vif->type == NL80211_IFTYPE_STATION) |
132 | ieee80211_beacon_loss(wl->vif); | ||
132 | } | 133 | } |
133 | 134 | ||
134 | if (vector & REGAINED_BSS_EVENT_ID) { | 135 | if (vector & REGAINED_BSS_EVENT_ID) { |
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index 757e25784a8a..4e782f18ae34 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c | |||
@@ -550,6 +550,34 @@ static void wl1251_op_remove_interface(struct ieee80211_hw *hw, | |||
550 | mutex_unlock(&wl->mutex); | 550 | mutex_unlock(&wl->mutex); |
551 | } | 551 | } |
552 | 552 | ||
553 | static int wl1251_build_null_data(struct wl1251 *wl) | ||
554 | { | ||
555 | struct sk_buff *skb = NULL; | ||
556 | int size; | ||
557 | void *ptr; | ||
558 | int ret = -ENOMEM; | ||
559 | |||
560 | if (wl->bss_type == BSS_TYPE_IBSS) { | ||
561 | size = sizeof(struct wl12xx_null_data_template); | ||
562 | ptr = NULL; | ||
563 | } else { | ||
564 | skb = ieee80211_nullfunc_get(wl->hw, wl->vif); | ||
565 | if (!skb) | ||
566 | goto out; | ||
567 | size = skb->len; | ||
568 | ptr = skb->data; | ||
569 | } | ||
570 | |||
571 | ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, ptr, size); | ||
572 | |||
573 | out: | ||
574 | dev_kfree_skb(skb); | ||
575 | if (ret) | ||
576 | wl1251_warning("cmd buld null data failed: %d", ret); | ||
577 | |||
578 | return ret; | ||
579 | } | ||
580 | |||
553 | static int wl1251_build_qos_null_data(struct wl1251 *wl) | 581 | static int wl1251_build_qos_null_data(struct wl1251 *wl) |
554 | { | 582 | { |
555 | struct ieee80211_qos_hdr template; | 583 | struct ieee80211_qos_hdr template; |
@@ -687,16 +715,6 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed) | |||
687 | wl->power_level = conf->power_level; | 715 | wl->power_level = conf->power_level; |
688 | } | 716 | } |
689 | 717 | ||
690 | /* | ||
691 | * Tell stack that connection is lost because hw encryption isn't | ||
692 | * supported in monitor mode. | ||
693 | * This requires temporary enabling of the hw connection monitor flag | ||
694 | */ | ||
695 | if ((changed & IEEE80211_CONF_CHANGE_MONITOR) && wl->vif) { | ||
696 | wl->hw->flags |= IEEE80211_HW_CONNECTION_MONITOR; | ||
697 | ieee80211_connection_loss(wl->vif); | ||
698 | } | ||
699 | |||
700 | out_sleep: | 718 | out_sleep: |
701 | wl1251_ps_elp_sleep(wl); | 719 | wl1251_ps_elp_sleep(wl); |
702 | 720 | ||
@@ -1103,24 +1121,19 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1103 | wl->rssi_thold = bss_conf->cqm_rssi_thold; | 1121 | wl->rssi_thold = bss_conf->cqm_rssi_thold; |
1104 | } | 1122 | } |
1105 | 1123 | ||
1106 | if (changed & BSS_CHANGED_BSSID) { | 1124 | if ((changed & BSS_CHANGED_BSSID) && |
1125 | memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) { | ||
1107 | memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); | 1126 | memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); |
1108 | 1127 | ||
1109 | skb = ieee80211_nullfunc_get(wl->hw, wl->vif); | 1128 | if (!is_zero_ether_addr(wl->bssid)) { |
1110 | if (!skb) | 1129 | ret = wl1251_build_null_data(wl); |
1111 | goto out_sleep; | 1130 | if (ret < 0) |
1112 | 1131 | goto out_sleep; | |
1113 | ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, | ||
1114 | skb->data, skb->len); | ||
1115 | dev_kfree_skb(skb); | ||
1116 | if (ret < 0) | ||
1117 | goto out_sleep; | ||
1118 | 1132 | ||
1119 | ret = wl1251_build_qos_null_data(wl); | 1133 | ret = wl1251_build_qos_null_data(wl); |
1120 | if (ret < 0) | 1134 | if (ret < 0) |
1121 | goto out; | 1135 | goto out_sleep; |
1122 | 1136 | ||
1123 | if (wl->bss_type != BSS_TYPE_IBSS) { | ||
1124 | ret = wl1251_join(wl, wl->bss_type, wl->channel, | 1137 | ret = wl1251_join(wl, wl->bss_type, wl->channel, |
1125 | wl->beacon_int, wl->dtim_period); | 1138 | wl->beacon_int, wl->dtim_period); |
1126 | if (ret < 0) | 1139 | if (ret < 0) |
@@ -1129,9 +1142,6 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1129 | } | 1142 | } |
1130 | 1143 | ||
1131 | if (changed & BSS_CHANGED_ASSOC) { | 1144 | if (changed & BSS_CHANGED_ASSOC) { |
1132 | /* Disable temporary enabled hw connection monitor flag */ | ||
1133 | wl->hw->flags &= ~IEEE80211_HW_CONNECTION_MONITOR; | ||
1134 | |||
1135 | if (bss_conf->assoc) { | 1145 | if (bss_conf->assoc) { |
1136 | wl->beacon_int = bss_conf->beacon_int; | 1146 | wl->beacon_int = bss_conf->beacon_int; |
1137 | 1147 | ||
@@ -1216,8 +1226,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1216 | if (ret < 0) | 1226 | if (ret < 0) |
1217 | goto out_sleep; | 1227 | goto out_sleep; |
1218 | 1228 | ||
1219 | ret = wl1251_join(wl, wl->bss_type, wl->beacon_int, | 1229 | ret = wl1251_join(wl, wl->bss_type, wl->channel, |
1220 | wl->channel, wl->dtim_period); | 1230 | wl->beacon_int, wl->dtim_period); |
1221 | 1231 | ||
1222 | if (ret < 0) | 1232 | if (ret < 0) |
1223 | goto out_sleep; | 1233 | goto out_sleep; |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index ed88d3913483..077eb5b9cd74 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -5184,7 +5184,8 @@ out: | |||
5184 | mutex_unlock(&wl->mutex); | 5184 | mutex_unlock(&wl->mutex); |
5185 | } | 5185 | } |
5186 | 5186 | ||
5187 | static void wlcore_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 5187 | static void wlcore_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
5188 | u32 queues, bool drop) | ||
5188 | { | 5189 | { |
5189 | struct wl1271 *wl = hw->priv; | 5190 | struct wl1271 *wl = hw->priv; |
5190 | 5191 | ||
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 29ef2492951f..d3dd7bfdf3f1 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c | |||
@@ -217,7 +217,7 @@ static struct wl1271_if_operations sdio_ops = { | |||
217 | static int wl1271_probe(struct sdio_func *func, | 217 | static int wl1271_probe(struct sdio_func *func, |
218 | const struct sdio_device_id *id) | 218 | const struct sdio_device_id *id) |
219 | { | 219 | { |
220 | struct wlcore_platdev_data *pdev_data; | 220 | struct wlcore_platdev_data pdev_data; |
221 | struct wl12xx_sdio_glue *glue; | 221 | struct wl12xx_sdio_glue *glue; |
222 | struct resource res[1]; | 222 | struct resource res[1]; |
223 | mmc_pm_flag_t mmcflags; | 223 | mmc_pm_flag_t mmcflags; |
@@ -228,16 +228,13 @@ static int wl1271_probe(struct sdio_func *func, | |||
228 | if (func->num != 0x02) | 228 | if (func->num != 0x02) |
229 | return -ENODEV; | 229 | return -ENODEV; |
230 | 230 | ||
231 | pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); | 231 | memset(&pdev_data, 0x00, sizeof(pdev_data)); |
232 | if (!pdev_data) | 232 | pdev_data.if_ops = &sdio_ops; |
233 | goto out; | ||
234 | |||
235 | pdev_data->if_ops = &sdio_ops; | ||
236 | 233 | ||
237 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); | 234 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); |
238 | if (!glue) { | 235 | if (!glue) { |
239 | dev_err(&func->dev, "can't allocate glue\n"); | 236 | dev_err(&func->dev, "can't allocate glue\n"); |
240 | goto out_free_pdev_data; | 237 | goto out; |
241 | } | 238 | } |
242 | 239 | ||
243 | glue->dev = &func->dev; | 240 | glue->dev = &func->dev; |
@@ -248,9 +245,9 @@ static int wl1271_probe(struct sdio_func *func, | |||
248 | /* Use block mode for transferring over one block size of data */ | 245 | /* Use block mode for transferring over one block size of data */ |
249 | func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; | 246 | func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; |
250 | 247 | ||
251 | pdev_data->pdata = wl12xx_get_platform_data(); | 248 | pdev_data.pdata = wl12xx_get_platform_data(); |
252 | if (IS_ERR(pdev_data->pdata)) { | 249 | if (IS_ERR(pdev_data.pdata)) { |
253 | ret = PTR_ERR(pdev_data->pdata); | 250 | ret = PTR_ERR(pdev_data.pdata); |
254 | dev_err(glue->dev, "missing wlan platform data: %d\n", ret); | 251 | dev_err(glue->dev, "missing wlan platform data: %d\n", ret); |
255 | goto out_free_glue; | 252 | goto out_free_glue; |
256 | } | 253 | } |
@@ -260,7 +257,7 @@ static int wl1271_probe(struct sdio_func *func, | |||
260 | dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags); | 257 | dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags); |
261 | 258 | ||
262 | if (mmcflags & MMC_PM_KEEP_POWER) | 259 | if (mmcflags & MMC_PM_KEEP_POWER) |
263 | pdev_data->pdata->pwr_in_suspend = true; | 260 | pdev_data.pdata->pwr_in_suspend = true; |
264 | 261 | ||
265 | sdio_set_drvdata(func, glue); | 262 | sdio_set_drvdata(func, glue); |
266 | 263 | ||
@@ -289,7 +286,7 @@ static int wl1271_probe(struct sdio_func *func, | |||
289 | 286 | ||
290 | memset(res, 0x00, sizeof(res)); | 287 | memset(res, 0x00, sizeof(res)); |
291 | 288 | ||
292 | res[0].start = pdev_data->pdata->irq; | 289 | res[0].start = pdev_data.pdata->irq; |
293 | res[0].flags = IORESOURCE_IRQ; | 290 | res[0].flags = IORESOURCE_IRQ; |
294 | res[0].name = "irq"; | 291 | res[0].name = "irq"; |
295 | 292 | ||
@@ -299,8 +296,8 @@ static int wl1271_probe(struct sdio_func *func, | |||
299 | goto out_dev_put; | 296 | goto out_dev_put; |
300 | } | 297 | } |
301 | 298 | ||
302 | ret = platform_device_add_data(glue->core, pdev_data, | 299 | ret = platform_device_add_data(glue->core, &pdev_data, |
303 | sizeof(*pdev_data)); | 300 | sizeof(pdev_data)); |
304 | if (ret) { | 301 | if (ret) { |
305 | dev_err(glue->dev, "can't add platform data\n"); | 302 | dev_err(glue->dev, "can't add platform data\n"); |
306 | goto out_dev_put; | 303 | goto out_dev_put; |
@@ -319,9 +316,6 @@ out_dev_put: | |||
319 | out_free_glue: | 316 | out_free_glue: |
320 | kfree(glue); | 317 | kfree(glue); |
321 | 318 | ||
322 | out_free_pdev_data: | ||
323 | kfree(pdev_data); | ||
324 | |||
325 | out: | 319 | out: |
326 | return ret; | 320 | return ret; |
327 | } | 321 | } |
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index dbe826dd7c23..5f3a389dd74c 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c | |||
@@ -327,27 +327,25 @@ static struct wl1271_if_operations spi_ops = { | |||
327 | static int wl1271_probe(struct spi_device *spi) | 327 | static int wl1271_probe(struct spi_device *spi) |
328 | { | 328 | { |
329 | struct wl12xx_spi_glue *glue; | 329 | struct wl12xx_spi_glue *glue; |
330 | struct wlcore_platdev_data *pdev_data; | 330 | struct wlcore_platdev_data pdev_data; |
331 | struct resource res[1]; | 331 | struct resource res[1]; |
332 | int ret = -ENOMEM; | 332 | int ret = -ENOMEM; |
333 | 333 | ||
334 | pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); | 334 | memset(&pdev_data, 0x00, sizeof(pdev_data)); |
335 | if (!pdev_data) | ||
336 | goto out; | ||
337 | 335 | ||
338 | pdev_data->pdata = dev_get_platdata(&spi->dev); | 336 | pdev_data.pdata = dev_get_platdata(&spi->dev); |
339 | if (!pdev_data->pdata) { | 337 | if (!pdev_data.pdata) { |
340 | dev_err(&spi->dev, "no platform data\n"); | 338 | dev_err(&spi->dev, "no platform data\n"); |
341 | ret = -ENODEV; | 339 | ret = -ENODEV; |
342 | goto out_free_pdev_data; | 340 | goto out; |
343 | } | 341 | } |
344 | 342 | ||
345 | pdev_data->if_ops = &spi_ops; | 343 | pdev_data.if_ops = &spi_ops; |
346 | 344 | ||
347 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); | 345 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); |
348 | if (!glue) { | 346 | if (!glue) { |
349 | dev_err(&spi->dev, "can't allocate glue\n"); | 347 | dev_err(&spi->dev, "can't allocate glue\n"); |
350 | goto out_free_pdev_data; | 348 | goto out; |
351 | } | 349 | } |
352 | 350 | ||
353 | glue->dev = &spi->dev; | 351 | glue->dev = &spi->dev; |
@@ -385,8 +383,8 @@ static int wl1271_probe(struct spi_device *spi) | |||
385 | goto out_dev_put; | 383 | goto out_dev_put; |
386 | } | 384 | } |
387 | 385 | ||
388 | ret = platform_device_add_data(glue->core, pdev_data, | 386 | ret = platform_device_add_data(glue->core, &pdev_data, |
389 | sizeof(*pdev_data)); | 387 | sizeof(pdev_data)); |
390 | if (ret) { | 388 | if (ret) { |
391 | dev_err(glue->dev, "can't add platform data\n"); | 389 | dev_err(glue->dev, "can't add platform data\n"); |
392 | goto out_dev_put; | 390 | goto out_dev_put; |
@@ -406,9 +404,6 @@ out_dev_put: | |||
406 | out_free_glue: | 404 | out_free_glue: |
407 | kfree(glue); | 405 | kfree(glue); |
408 | 406 | ||
409 | out_free_pdev_data: | ||
410 | kfree(pdev_data); | ||
411 | |||
412 | out: | 407 | out: |
413 | return ret; | 408 | return ret; |
414 | } | 409 | } |
diff --git a/drivers/staging/rtl8821ae/core.c b/drivers/staging/rtl8821ae/core.c index ff3139b6da65..63ae2d1997d3 100644 --- a/drivers/staging/rtl8821ae/core.c +++ b/drivers/staging/rtl8821ae/core.c | |||
@@ -1414,23 +1414,15 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw) | |||
1414 | * before switch channel or power save, or tx buffer packet | 1414 | * before switch channel or power save, or tx buffer packet |
1415 | * maybe send after offchannel or rf sleep, this may cause | 1415 | * maybe send after offchannel or rf sleep, this may cause |
1416 | * dis-association by AP */ | 1416 | * dis-association by AP */ |
1417 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) | 1417 | static void rtl_op_flush(struct ieee80211_hw *hw, |
1418 | static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1418 | struct ieee80211_vif *vif, |
1419 | u32 queues, bool drop) | ||
1419 | { | 1420 | { |
1420 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1421 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1421 | 1422 | ||
1422 | if (rtlpriv->intf_ops->flush) | 1423 | if (rtlpriv->intf_ops->flush) |
1423 | rtlpriv->intf_ops->flush(hw, queues, drop); | 1424 | rtlpriv->intf_ops->flush(hw, queues, drop); |
1424 | } | 1425 | } |
1425 | #else | ||
1426 | static void rtl_op_flush(struct ieee80211_hw *hw, bool drop) | ||
1427 | { | ||
1428 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1429 | |||
1430 | if (rtlpriv->intf_ops->flush) | ||
1431 | rtlpriv->intf_ops->flush(hw, drop); | ||
1432 | } | ||
1433 | #endif | ||
1434 | 1426 | ||
1435 | const struct ieee80211_ops rtl_ops = { | 1427 | const struct ieee80211_ops rtl_ops = { |
1436 | .start = rtl_op_start, | 1428 | .start = rtl_op_start, |
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h index 8598f8eacb20..a495a959e8a7 100644 --- a/include/linux/ath9k_platform.h +++ b/include/linux/ath9k_platform.h | |||
@@ -36,6 +36,8 @@ struct ath9k_platform_data { | |||
36 | 36 | ||
37 | int (*get_mac_revision)(void); | 37 | int (*get_mac_revision)(void); |
38 | int (*external_reset)(void); | 38 | int (*external_reset)(void); |
39 | |||
40 | bool use_eeprom; | ||
39 | }; | 41 | }; |
40 | 42 | ||
41 | #endif /* _LINUX_ATH9K_PLATFORM_H */ | 43 | #endif /* _LINUX_ATH9K_PLATFORM_H */ |
diff --git a/include/linux/rfkill-gpio.h b/include/linux/rfkill-gpio.h index 4d09f6eab359..20bcb55498cd 100644 --- a/include/linux/rfkill-gpio.h +++ b/include/linux/rfkill-gpio.h | |||
@@ -27,21 +27,11 @@ | |||
27 | * struct rfkill_gpio_platform_data - platform data for rfkill gpio device. | 27 | * struct rfkill_gpio_platform_data - platform data for rfkill gpio device. |
28 | * for unused gpio's, the expected value is -1. | 28 | * for unused gpio's, the expected value is -1. |
29 | * @name: name for the gpio rf kill instance | 29 | * @name: name for the gpio rf kill instance |
30 | * @reset_gpio: GPIO which is used for reseting rfkill switch | ||
31 | * @shutdown_gpio: GPIO which is used for shutdown of rfkill switch | ||
32 | * @power_clk_name: [optional] name of clk to turn off while blocked | ||
33 | * @gpio_runtime_close: clean up platform specific gpio configuration | ||
34 | * @gpio_runtime_setup: set up platform specific gpio configuration | ||
35 | */ | 30 | */ |
36 | 31 | ||
37 | struct rfkill_gpio_platform_data { | 32 | struct rfkill_gpio_platform_data { |
38 | char *name; | 33 | char *name; |
39 | int reset_gpio; | ||
40 | int shutdown_gpio; | ||
41 | const char *power_clk_name; | ||
42 | enum rfkill_type type; | 34 | enum rfkill_type type; |
43 | void (*gpio_runtime_close)(struct platform_device *); | ||
44 | int (*gpio_runtime_setup)(struct platform_device *); | ||
45 | }; | 35 | }; |
46 | 36 | ||
47 | #endif /* __RFKILL_GPIO_H */ | 37 | #endif /* __RFKILL_GPIO_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index be150cf8cd43..4261a67682c0 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -367,6 +367,7 @@ enum { | |||
367 | #define HCI_ERROR_REMOTE_POWER_OFF 0x15 | 367 | #define HCI_ERROR_REMOTE_POWER_OFF 0x15 |
368 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 | 368 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 |
369 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 | 369 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 |
370 | #define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c | ||
370 | 371 | ||
371 | /* Flow control modes */ | 372 | /* Flow control modes */ |
372 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 | 373 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 5f8bc05694ac..d73f41855ada 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -68,6 +68,11 @@ struct discovery_state { | |||
68 | struct list_head unknown; /* Name state not known */ | 68 | struct list_head unknown; /* Name state not known */ |
69 | struct list_head resolve; /* Name needs to be resolved */ | 69 | struct list_head resolve; /* Name needs to be resolved */ |
70 | __u32 timestamp; | 70 | __u32 timestamp; |
71 | bdaddr_t last_adv_addr; | ||
72 | u8 last_adv_addr_type; | ||
73 | s8 last_adv_rssi; | ||
74 | u8 last_adv_data[HCI_MAX_AD_LENGTH]; | ||
75 | u8 last_adv_data_len; | ||
71 | }; | 76 | }; |
72 | 77 | ||
73 | struct hci_conn_hash { | 78 | struct hci_conn_hash { |
@@ -194,6 +199,7 @@ struct hci_dev { | |||
194 | __u16 le_scan_window; | 199 | __u16 le_scan_window; |
195 | __u16 le_conn_min_interval; | 200 | __u16 le_conn_min_interval; |
196 | __u16 le_conn_max_interval; | 201 | __u16 le_conn_max_interval; |
202 | __u16 discov_interleaved_timeout; | ||
197 | __u8 ssp_debug_mode; | 203 | __u8 ssp_debug_mode; |
198 | 204 | ||
199 | __u16 devid_source; | 205 | __u16 devid_source; |
@@ -1204,8 +1210,8 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); | |||
1204 | */ | 1210 | */ |
1205 | #define DISCOV_LE_SCAN_WIN 0x12 | 1211 | #define DISCOV_LE_SCAN_WIN 0x12 |
1206 | #define DISCOV_LE_SCAN_INT 0x12 | 1212 | #define DISCOV_LE_SCAN_INT 0x12 |
1207 | #define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240) | 1213 | #define DISCOV_LE_TIMEOUT 10240 /* msec */ |
1208 | #define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120) | 1214 | #define DISCOV_INTERLEAVED_TIMEOUT 5120 /* msec */ |
1209 | #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 | 1215 | #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 |
1210 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 | 1216 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 |
1211 | 1217 | ||
@@ -1265,7 +1271,8 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, | |||
1265 | u8 *randomizer256, u8 status); | 1271 | u8 *randomizer256, u8 status); |
1266 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1272 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1267 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, | 1273 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, |
1268 | u8 ssp, u8 *eir, u16 eir_len); | 1274 | u8 ssp, u8 *eir, u16 eir_len, u8 *scan_rsp, |
1275 | u8 scan_rsp_len); | ||
1269 | void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1276 | void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1270 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); | 1277 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); |
1271 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); | 1278 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f3539a15c411..f2c318655519 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -109,6 +109,13 @@ enum ieee80211_band { | |||
109 | * channel as the control or any of the secondary channels. | 109 | * channel as the control or any of the secondary channels. |
110 | * This may be due to the driver or due to regulatory bandwidth | 110 | * This may be due to the driver or due to regulatory bandwidth |
111 | * restrictions. | 111 | * restrictions. |
112 | * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY | ||
113 | * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT | ||
114 | * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted | ||
115 | * on this channel. | ||
116 | * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted | ||
117 | * on this channel. | ||
118 | * | ||
112 | */ | 119 | */ |
113 | enum ieee80211_channel_flags { | 120 | enum ieee80211_channel_flags { |
114 | IEEE80211_CHAN_DISABLED = 1<<0, | 121 | IEEE80211_CHAN_DISABLED = 1<<0, |
@@ -120,6 +127,10 @@ enum ieee80211_channel_flags { | |||
120 | IEEE80211_CHAN_NO_OFDM = 1<<6, | 127 | IEEE80211_CHAN_NO_OFDM = 1<<6, |
121 | IEEE80211_CHAN_NO_80MHZ = 1<<7, | 128 | IEEE80211_CHAN_NO_80MHZ = 1<<7, |
122 | IEEE80211_CHAN_NO_160MHZ = 1<<8, | 129 | IEEE80211_CHAN_NO_160MHZ = 1<<8, |
130 | IEEE80211_CHAN_INDOOR_ONLY = 1<<9, | ||
131 | IEEE80211_CHAN_GO_CONCURRENT = 1<<10, | ||
132 | IEEE80211_CHAN_NO_20MHZ = 1<<11, | ||
133 | IEEE80211_CHAN_NO_10MHZ = 1<<12, | ||
123 | }; | 134 | }; |
124 | 135 | ||
125 | #define IEEE80211_CHAN_NO_HT40 \ | 136 | #define IEEE80211_CHAN_NO_HT40 \ |
@@ -441,10 +452,13 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, | |||
441 | * cfg80211_chandef_dfs_required - checks if radar detection is required | 452 | * cfg80211_chandef_dfs_required - checks if radar detection is required |
442 | * @wiphy: the wiphy to validate against | 453 | * @wiphy: the wiphy to validate against |
443 | * @chandef: the channel definition to check | 454 | * @chandef: the channel definition to check |
444 | * Return: 1 if radar detection is required, 0 if it is not, < 0 on error | 455 | * @iftype: the interface type as specified in &enum nl80211_iftype |
456 | * Returns: | ||
457 | * 1 if radar detection is required, 0 if it is not, < 0 on error | ||
445 | */ | 458 | */ |
446 | int cfg80211_chandef_dfs_required(struct wiphy *wiphy, | 459 | int cfg80211_chandef_dfs_required(struct wiphy *wiphy, |
447 | const struct cfg80211_chan_def *chandef); | 460 | const struct cfg80211_chan_def *chandef, |
461 | enum nl80211_iftype); | ||
448 | 462 | ||
449 | /** | 463 | /** |
450 | * ieee80211_chandef_rate_flags - returns rate flags for a channel | 464 | * ieee80211_chandef_rate_flags - returns rate flags for a channel |
@@ -654,7 +668,6 @@ struct cfg80211_acl_data { | |||
654 | * @p2p_opp_ps: P2P opportunistic PS | 668 | * @p2p_opp_ps: P2P opportunistic PS |
655 | * @acl: ACL configuration used by the drivers which has support for | 669 | * @acl: ACL configuration used by the drivers which has support for |
656 | * MAC address based access control | 670 | * MAC address based access control |
657 | * @radar_required: set if radar detection is required | ||
658 | */ | 671 | */ |
659 | struct cfg80211_ap_settings { | 672 | struct cfg80211_ap_settings { |
660 | struct cfg80211_chan_def chandef; | 673 | struct cfg80211_chan_def chandef; |
@@ -672,7 +685,6 @@ struct cfg80211_ap_settings { | |||
672 | u8 p2p_ctwindow; | 685 | u8 p2p_ctwindow; |
673 | bool p2p_opp_ps; | 686 | bool p2p_opp_ps; |
674 | const struct cfg80211_acl_data *acl; | 687 | const struct cfg80211_acl_data *acl; |
675 | bool radar_required; | ||
676 | }; | 688 | }; |
677 | 689 | ||
678 | /** | 690 | /** |
@@ -2278,6 +2290,10 @@ struct cfg80211_qos_map { | |||
2278 | * @channel_switch: initiate channel-switch procedure (with CSA) | 2290 | * @channel_switch: initiate channel-switch procedure (with CSA) |
2279 | * | 2291 | * |
2280 | * @set_qos_map: Set QoS mapping information to the driver | 2292 | * @set_qos_map: Set QoS mapping information to the driver |
2293 | * | ||
2294 | * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the | ||
2295 | * given interface This is used e.g. for dynamic HT 20/40 MHz channel width | ||
2296 | * changes during the lifetime of the BSS. | ||
2281 | */ | 2297 | */ |
2282 | struct cfg80211_ops { | 2298 | struct cfg80211_ops { |
2283 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); | 2299 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
@@ -2521,9 +2537,13 @@ struct cfg80211_ops { | |||
2521 | int (*channel_switch)(struct wiphy *wiphy, | 2537 | int (*channel_switch)(struct wiphy *wiphy, |
2522 | struct net_device *dev, | 2538 | struct net_device *dev, |
2523 | struct cfg80211_csa_settings *params); | 2539 | struct cfg80211_csa_settings *params); |
2540 | |||
2524 | int (*set_qos_map)(struct wiphy *wiphy, | 2541 | int (*set_qos_map)(struct wiphy *wiphy, |
2525 | struct net_device *dev, | 2542 | struct net_device *dev, |
2526 | struct cfg80211_qos_map *qos_map); | 2543 | struct cfg80211_qos_map *qos_map); |
2544 | |||
2545 | int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, | ||
2546 | struct cfg80211_chan_def *chandef); | ||
2527 | }; | 2547 | }; |
2528 | 2548 | ||
2529 | /* | 2549 | /* |
@@ -3194,6 +3214,7 @@ struct cfg80211_cached_keys; | |||
3194 | * @ibss_dfs_possible: (private) IBSS may change to a DFS channel | 3214 | * @ibss_dfs_possible: (private) IBSS may change to a DFS channel |
3195 | * @event_list: (private) list for internal event processing | 3215 | * @event_list: (private) list for internal event processing |
3196 | * @event_lock: (private) lock for event list | 3216 | * @event_lock: (private) lock for event list |
3217 | * @owner_nlportid: (private) owner socket port ID | ||
3197 | */ | 3218 | */ |
3198 | struct wireless_dev { | 3219 | struct wireless_dev { |
3199 | struct wiphy *wiphy; | 3220 | struct wiphy *wiphy; |
@@ -3241,6 +3262,8 @@ struct wireless_dev { | |||
3241 | unsigned long cac_start_time; | 3262 | unsigned long cac_start_time; |
3242 | unsigned int cac_time_ms; | 3263 | unsigned int cac_time_ms; |
3243 | 3264 | ||
3265 | u32 owner_nlportid; | ||
3266 | |||
3244 | #ifdef CONFIG_CFG80211_WEXT | 3267 | #ifdef CONFIG_CFG80211_WEXT |
3245 | /* wext data */ | 3268 | /* wext data */ |
3246 | struct { | 3269 | struct { |
@@ -3600,7 +3623,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2); | |||
3600 | * default channel settings will be disregarded. If no rule is found for a | 3623 | * default channel settings will be disregarded. If no rule is found for a |
3601 | * channel on the regulatory domain the channel will be disabled. | 3624 | * channel on the regulatory domain the channel will be disabled. |
3602 | * Drivers using this for a wiphy should also set the wiphy flag | 3625 | * Drivers using this for a wiphy should also set the wiphy flag |
3603 | * WIPHY_FLAG_CUSTOM_REGULATORY or cfg80211 will set it for the wiphy | 3626 | * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy |
3604 | * that called this helper. | 3627 | * that called this helper. |
3605 | */ | 3628 | */ |
3606 | void wiphy_apply_custom_regulatory(struct wiphy *wiphy, | 3629 | void wiphy_apply_custom_regulatory(struct wiphy *wiphy, |
@@ -3669,6 +3692,18 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy); | |||
3669 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy); | 3692 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy); |
3670 | 3693 | ||
3671 | /** | 3694 | /** |
3695 | * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped | ||
3696 | * | ||
3697 | * @wiphy: the wiphy on which the scheduled scan stopped | ||
3698 | * | ||
3699 | * The driver can call this function to inform cfg80211 that the | ||
3700 | * scheduled scan had to be stopped, for whatever reason. The driver | ||
3701 | * is then called back via the sched_scan_stop operation when done. | ||
3702 | * This function should be called with rtnl locked. | ||
3703 | */ | ||
3704 | void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); | ||
3705 | |||
3706 | /** | ||
3672 | * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame | 3707 | * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame |
3673 | * | 3708 | * |
3674 | * @wiphy: the wiphy reporting the BSS | 3709 | * @wiphy: the wiphy reporting the BSS |
@@ -4531,12 +4566,14 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy, | |||
4531 | * cfg80211_reg_can_beacon - check if beaconing is allowed | 4566 | * cfg80211_reg_can_beacon - check if beaconing is allowed |
4532 | * @wiphy: the wiphy | 4567 | * @wiphy: the wiphy |
4533 | * @chandef: the channel definition | 4568 | * @chandef: the channel definition |
4569 | * @iftype: interface type | ||
4534 | * | 4570 | * |
4535 | * Return: %true if there is no secondary channel or the secondary channel(s) | 4571 | * Return: %true if there is no secondary channel or the secondary channel(s) |
4536 | * can be used for beaconing (i.e. is not a radar channel etc.) | 4572 | * can be used for beaconing (i.e. is not a radar channel etc.) |
4537 | */ | 4573 | */ |
4538 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | 4574 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, |
4539 | struct cfg80211_chan_def *chandef); | 4575 | struct cfg80211_chan_def *chandef, |
4576 | enum nl80211_iftype iftype); | ||
4540 | 4577 | ||
4541 | /* | 4578 | /* |
4542 | * cfg80211_ch_switch_notify - update wdev channel and notify userspace | 4579 | * cfg80211_ch_switch_notify - update wdev channel and notify userspace |
@@ -4682,6 +4719,55 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); | |||
4682 | */ | 4719 | */ |
4683 | unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); | 4720 | unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); |
4684 | 4721 | ||
4722 | /** | ||
4723 | * cfg80211_check_combinations - check interface combinations | ||
4724 | * | ||
4725 | * @wiphy: the wiphy | ||
4726 | * @num_different_channels: the number of different channels we want | ||
4727 | * to use for verification | ||
4728 | * @radar_detect: a bitmap where each bit corresponds to a channel | ||
4729 | * width where radar detection is needed, as in the definition of | ||
4730 | * &struct ieee80211_iface_combination.@radar_detect_widths | ||
4731 | * @iftype_num: array with the numbers of interfaces of each interface | ||
4732 | * type. The index is the interface type as specified in &enum | ||
4733 | * nl80211_iftype. | ||
4734 | * | ||
4735 | * This function can be called by the driver to check whether a | ||
4736 | * combination of interfaces and their types are allowed according to | ||
4737 | * the interface combinations. | ||
4738 | */ | ||
4739 | int cfg80211_check_combinations(struct wiphy *wiphy, | ||
4740 | const int num_different_channels, | ||
4741 | const u8 radar_detect, | ||
4742 | const int iftype_num[NUM_NL80211_IFTYPES]); | ||
4743 | |||
4744 | /** | ||
4745 | * cfg80211_iter_combinations - iterate over matching combinations | ||
4746 | * | ||
4747 | * @wiphy: the wiphy | ||
4748 | * @num_different_channels: the number of different channels we want | ||
4749 | * to use for verification | ||
4750 | * @radar_detect: a bitmap where each bit corresponds to a channel | ||
4751 | * width where radar detection is needed, as in the definition of | ||
4752 | * &struct ieee80211_iface_combination.@radar_detect_widths | ||
4753 | * @iftype_num: array with the numbers of interfaces of each interface | ||
4754 | * type. The index is the interface type as specified in &enum | ||
4755 | * nl80211_iftype. | ||
4756 | * @iter: function to call for each matching combination | ||
4757 | * @data: pointer to pass to iter function | ||
4758 | * | ||
4759 | * This function can be called by the driver to check what possible | ||
4760 | * combinations it fits in at a given moment, e.g. for channel switching | ||
4761 | * purposes. | ||
4762 | */ | ||
4763 | int cfg80211_iter_combinations(struct wiphy *wiphy, | ||
4764 | const int num_different_channels, | ||
4765 | const u8 radar_detect, | ||
4766 | const int iftype_num[NUM_NL80211_IFTYPES], | ||
4767 | void (*iter)(const struct ieee80211_iface_combination *c, | ||
4768 | void *data), | ||
4769 | void *data); | ||
4770 | |||
4685 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 4771 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
4686 | 4772 | ||
4687 | /* wiphy_printk helpers, similar to dev_printk */ | 4773 | /* wiphy_printk helpers, similar to dev_printk */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 8248e3909fdf..451c1bf00df9 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1202,14 +1202,18 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev); | |||
1202 | * fall back to software crypto. Note that this flag deals only with | 1202 | * fall back to software crypto. Note that this flag deals only with |
1203 | * RX, if your crypto engine can't deal with TX you can also set the | 1203 | * RX, if your crypto engine can't deal with TX you can also set the |
1204 | * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. | 1204 | * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. |
1205 | * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the | ||
1206 | * driver for a CCMP key to indicate that is requires IV generation | ||
1207 | * only for managment frames (MFP). | ||
1205 | */ | 1208 | */ |
1206 | enum ieee80211_key_flags { | 1209 | enum ieee80211_key_flags { |
1207 | IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, | 1210 | IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0), |
1208 | IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, | 1211 | IEEE80211_KEY_FLAG_GENERATE_IV = BIT(1), |
1209 | IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, | 1212 | IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(2), |
1210 | IEEE80211_KEY_FLAG_SW_MGMT_TX = 1<<4, | 1213 | IEEE80211_KEY_FLAG_PAIRWISE = BIT(3), |
1211 | IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, | 1214 | IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(4), |
1212 | IEEE80211_KEY_FLAG_RX_MGMT = 1<<6, | 1215 | IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(5), |
1216 | IEEE80211_KEY_FLAG_RX_MGMT = BIT(6), | ||
1213 | }; | 1217 | }; |
1214 | 1218 | ||
1215 | /** | 1219 | /** |
@@ -1555,6 +1559,12 @@ struct ieee80211_tx_control { | |||
1555 | * for a single active channel while using channel contexts. When support | 1559 | * for a single active channel while using channel contexts. When support |
1556 | * is not enabled the default action is to disconnect when getting the | 1560 | * is not enabled the default action is to disconnect when getting the |
1557 | * CSA frame. | 1561 | * CSA frame. |
1562 | * | ||
1563 | * @IEEE80211_HW_CHANGE_RUNNING_CHANCTX: The hardware can change a | ||
1564 | * channel context on-the-fly. This is needed for channel switch | ||
1565 | * on single-channel hardware. It can also be used as an | ||
1566 | * optimization in certain channel switch cases with | ||
1567 | * multi-channel. | ||
1558 | */ | 1568 | */ |
1559 | enum ieee80211_hw_flags { | 1569 | enum ieee80211_hw_flags { |
1560 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1570 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
@@ -1586,6 +1596,7 @@ enum ieee80211_hw_flags { | |||
1586 | IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, | 1596 | IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, |
1587 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, | 1597 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, |
1588 | IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, | 1598 | IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, |
1599 | IEEE80211_HW_CHANGE_RUNNING_CHANCTX = 1<<29, | ||
1589 | }; | 1600 | }; |
1590 | 1601 | ||
1591 | /** | 1602 | /** |
@@ -2609,6 +2620,7 @@ enum ieee80211_roc_type { | |||
2609 | * of queues to flush, which is useful if different virtual interfaces | 2620 | * of queues to flush, which is useful if different virtual interfaces |
2610 | * use different hardware queues; it may also indicate all queues. | 2621 | * use different hardware queues; it may also indicate all queues. |
2611 | * If the parameter @drop is set to %true, pending frames may be dropped. | 2622 | * If the parameter @drop is set to %true, pending frames may be dropped. |
2623 | * Note that vif can be NULL. | ||
2612 | * The callback can sleep. | 2624 | * The callback can sleep. |
2613 | * | 2625 | * |
2614 | * @channel_switch: Drivers that need (or want) to offload the channel | 2626 | * @channel_switch: Drivers that need (or want) to offload the channel |
@@ -2871,7 +2883,8 @@ struct ieee80211_ops { | |||
2871 | struct netlink_callback *cb, | 2883 | struct netlink_callback *cb, |
2872 | void *data, int len); | 2884 | void *data, int len); |
2873 | #endif | 2885 | #endif |
2874 | void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); | 2886 | void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2887 | u32 queues, bool drop); | ||
2875 | void (*channel_switch)(struct ieee80211_hw *hw, | 2888 | void (*channel_switch)(struct ieee80211_hw *hw, |
2876 | struct ieee80211_channel_switch *ch_switch); | 2889 | struct ieee80211_channel_switch *ch_switch); |
2877 | int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); | 2890 | int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); |
@@ -4576,7 +4589,9 @@ conf_is_ht40(struct ieee80211_conf *conf) | |||
4576 | static inline bool | 4589 | static inline bool |
4577 | conf_is_ht(struct ieee80211_conf *conf) | 4590 | conf_is_ht(struct ieee80211_conf *conf) |
4578 | { | 4591 | { |
4579 | return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT; | 4592 | return (conf->chandef.width != NL80211_CHAN_WIDTH_5) && |
4593 | (conf->chandef.width != NL80211_CHAN_WIDTH_10) && | ||
4594 | (conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT); | ||
4580 | } | 4595 | } |
4581 | 4596 | ||
4582 | static inline enum nl80211_iftype | 4597 | static inline enum nl80211_iftype |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h index 75fc1f5a948d..259992444e80 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h | |||
@@ -131,6 +131,11 @@ struct regulatory_request { | |||
131 | * all country IE information processed by the regulatory core. This will | 131 | * all country IE information processed by the regulatory core. This will |
132 | * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will | 132 | * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will |
133 | * be ignored. | 133 | * be ignored. |
134 | * @REGULATORY_ENABLE_RELAX_NO_IR: for devices that wish to allow the | ||
135 | * NO_IR relaxation, which enables transmissions on channels on which | ||
136 | * otherwise initiating radiation is not allowed. This will enable the | ||
137 | * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration | ||
138 | * option | ||
134 | */ | 139 | */ |
135 | enum ieee80211_regulatory_flags { | 140 | enum ieee80211_regulatory_flags { |
136 | REGULATORY_CUSTOM_REG = BIT(0), | 141 | REGULATORY_CUSTOM_REG = BIT(0), |
@@ -138,6 +143,7 @@ enum ieee80211_regulatory_flags { | |||
138 | REGULATORY_DISABLE_BEACON_HINTS = BIT(2), | 143 | REGULATORY_DISABLE_BEACON_HINTS = BIT(2), |
139 | REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), | 144 | REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), |
140 | REGULATORY_COUNTRY_IE_IGNORE = BIT(4), | 145 | REGULATORY_COUNTRY_IE_IGNORE = BIT(4), |
146 | REGULATORY_ENABLE_RELAX_NO_IR = BIT(5), | ||
141 | }; | 147 | }; |
142 | 148 | ||
143 | struct ieee80211_freq_range { | 149 | struct ieee80211_freq_range { |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 1ba9d626aa83..406010d4def0 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
@@ -1579,6 +1579,10 @@ enum nl80211_commands { | |||
1579 | * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. | 1579 | * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. |
1580 | * As specified in the &enum nl80211_tdls_peer_capability. | 1580 | * As specified in the &enum nl80211_tdls_peer_capability. |
1581 | * | 1581 | * |
1582 | * @NL80211_ATTR_IFACE_SOCKET_OWNER: flag attribute, if set during interface | ||
1583 | * creation then the new interface will be owned by the netlink socket | ||
1584 | * that created it and will be destroyed when the socket is closed | ||
1585 | * | ||
1582 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1586 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
1583 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1587 | * @__NL80211_ATTR_AFTER_LAST: internal use |
1584 | */ | 1588 | */ |
@@ -1914,6 +1918,8 @@ enum nl80211_attrs { | |||
1914 | 1918 | ||
1915 | NL80211_ATTR_TDLS_PEER_CAPABILITY, | 1919 | NL80211_ATTR_TDLS_PEER_CAPABILITY, |
1916 | 1920 | ||
1921 | NL80211_ATTR_IFACE_SOCKET_OWNER, | ||
1922 | |||
1917 | /* add attributes here, update the policy in nl80211.c */ | 1923 | /* add attributes here, update the policy in nl80211.c */ |
1918 | 1924 | ||
1919 | __NL80211_ATTR_AFTER_LAST, | 1925 | __NL80211_ATTR_AFTER_LAST, |
@@ -2336,9 +2342,34 @@ enum nl80211_band_attr { | |||
2336 | * using this channel as the primary or any of the secondary channels | 2342 | * using this channel as the primary or any of the secondary channels |
2337 | * isn't possible | 2343 | * isn't possible |
2338 | * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds. | 2344 | * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds. |
2345 | * @NL80211_FREQUENCY_ATTR_INDOOR_ONLY: Only indoor use is permitted on this | ||
2346 | * channel. A channel that has the INDOOR_ONLY attribute can only be | ||
2347 | * used when there is a clear assessment that the device is operating in | ||
2348 | * an indoor surroundings, i.e., it is connected to AC power (and not | ||
2349 | * through portable DC inverters) or is under the control of a master | ||
2350 | * that is acting as an AP and is connected to AC power. | ||
2351 | * @NL80211_FREQUENCY_ATTR_GO_CONCURRENT: GO operation is allowed on this | ||
2352 | * channel if it's connected concurrently to a BSS on the same channel on | ||
2353 | * the 2 GHz band or to a channel in the same UNII band (on the 5 GHz | ||
2354 | * band), and IEEE80211_CHAN_RADAR is not set. Instantiating a GO on a | ||
2355 | * channel that has the GO_CONCURRENT attribute set can be done when there | ||
2356 | * is a clear assessment that the device is operating under the guidance of | ||
2357 | * an authorized master, i.e., setting up a GO while the device is also | ||
2358 | * connected to an AP with DFS and radar detection on the UNII band (it is | ||
2359 | * up to user-space, i.e., wpa_supplicant to perform the required | ||
2360 | * verifications) | ||
2361 | * @NL80211_FREQUENCY_ATTR_NO_20MHZ: 20 MHz operation is not allowed | ||
2362 | * on this channel in current regulatory domain. | ||
2363 | * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed | ||
2364 | * on this channel in current regulatory domain. | ||
2339 | * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number | 2365 | * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number |
2340 | * currently defined | 2366 | * currently defined |
2341 | * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use | 2367 | * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use |
2368 | * | ||
2369 | * See https://apps.fcc.gov/eas/comments/GetPublishedDocument.html?id=327&tn=528122 | ||
2370 | * for more information on the FCC description of the relaxations allowed | ||
2371 | * by NL80211_FREQUENCY_ATTR_INDOOR_ONLY and | ||
2372 | * NL80211_FREQUENCY_ATTR_GO_CONCURRENT. | ||
2342 | */ | 2373 | */ |
2343 | enum nl80211_frequency_attr { | 2374 | enum nl80211_frequency_attr { |
2344 | __NL80211_FREQUENCY_ATTR_INVALID, | 2375 | __NL80211_FREQUENCY_ATTR_INVALID, |
@@ -2355,6 +2386,10 @@ enum nl80211_frequency_attr { | |||
2355 | NL80211_FREQUENCY_ATTR_NO_80MHZ, | 2386 | NL80211_FREQUENCY_ATTR_NO_80MHZ, |
2356 | NL80211_FREQUENCY_ATTR_NO_160MHZ, | 2387 | NL80211_FREQUENCY_ATTR_NO_160MHZ, |
2357 | NL80211_FREQUENCY_ATTR_DFS_CAC_TIME, | 2388 | NL80211_FREQUENCY_ATTR_DFS_CAC_TIME, |
2389 | NL80211_FREQUENCY_ATTR_INDOOR_ONLY, | ||
2390 | NL80211_FREQUENCY_ATTR_GO_CONCURRENT, | ||
2391 | NL80211_FREQUENCY_ATTR_NO_20MHZ, | ||
2392 | NL80211_FREQUENCY_ATTR_NO_10MHZ, | ||
2358 | 2393 | ||
2359 | /* keep last */ | 2394 | /* keep last */ |
2360 | __NL80211_FREQUENCY_ATTR_AFTER_LAST, | 2395 | __NL80211_FREQUENCY_ATTR_AFTER_LAST, |
@@ -2573,10 +2608,13 @@ enum nl80211_dfs_regions { | |||
2573 | * present has been registered with the wireless core that | 2608 | * present has been registered with the wireless core that |
2574 | * has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a | 2609 | * has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a |
2575 | * supported feature. | 2610 | * supported feature. |
2611 | * @NL80211_USER_REG_HINT_INDOOR: a user sent an hint indicating that the | ||
2612 | * platform is operating in an indoor environment. | ||
2576 | */ | 2613 | */ |
2577 | enum nl80211_user_reg_hint_type { | 2614 | enum nl80211_user_reg_hint_type { |
2578 | NL80211_USER_REG_HINT_USER = 0, | 2615 | NL80211_USER_REG_HINT_USER = 0, |
2579 | NL80211_USER_REG_HINT_CELL_BASE = 1, | 2616 | NL80211_USER_REG_HINT_CELL_BASE = 1, |
2617 | NL80211_USER_REG_HINT_INDOOR = 2, | ||
2580 | }; | 2618 | }; |
2581 | 2619 | ||
2582 | /** | 2620 | /** |
@@ -3891,6 +3929,9 @@ enum nl80211_ap_sme_features { | |||
3891 | * interface. An active monitor interface behaves like a normal monitor | 3929 | * interface. An active monitor interface behaves like a normal monitor |
3892 | * interface, but gets added to the driver. It ensures that incoming | 3930 | * interface, but gets added to the driver. It ensures that incoming |
3893 | * unicast packets directed at the configured interface address get ACKed. | 3931 | * unicast packets directed at the configured interface address get ACKed. |
3932 | * @NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE: This driver supports dynamic | ||
3933 | * channel bandwidth change (e.g., HT 20 <-> 40 MHz channel) during the | ||
3934 | * lifetime of a BSS. | ||
3894 | */ | 3935 | */ |
3895 | enum nl80211_feature_flags { | 3936 | enum nl80211_feature_flags { |
3896 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, | 3937 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, |
@@ -3911,6 +3952,7 @@ enum nl80211_feature_flags { | |||
3911 | NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, | 3952 | NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, |
3912 | NL80211_FEATURE_USERSPACE_MPM = 1 << 16, | 3953 | NL80211_FEATURE_USERSPACE_MPM = 1 << 16, |
3913 | NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17, | 3954 | NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17, |
3955 | NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = 1 << 18, | ||
3914 | }; | 3956 | }; |
3915 | 3957 | ||
3916 | /** | 3958 | /** |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index d958e2dca52f..095943c02d6e 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -367,9 +367,23 @@ static void le_conn_timeout(struct work_struct *work) | |||
367 | { | 367 | { |
368 | struct hci_conn *conn = container_of(work, struct hci_conn, | 368 | struct hci_conn *conn = container_of(work, struct hci_conn, |
369 | le_conn_timeout.work); | 369 | le_conn_timeout.work); |
370 | struct hci_dev *hdev = conn->hdev; | ||
370 | 371 | ||
371 | BT_DBG(""); | 372 | BT_DBG(""); |
372 | 373 | ||
374 | /* We could end up here due to having done directed advertising, | ||
375 | * so clean up the state if necessary. This should however only | ||
376 | * happen with broken hardware or if low duty cycle was used | ||
377 | * (which doesn't have a timeout of its own). | ||
378 | */ | ||
379 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) { | ||
380 | u8 enable = 0x00; | ||
381 | hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), | ||
382 | &enable); | ||
383 | hci_le_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT); | ||
384 | return; | ||
385 | } | ||
386 | |||
373 | hci_le_create_connection_cancel(conn); | 387 | hci_le_create_connection_cancel(conn); |
374 | } | 388 | } |
375 | 389 | ||
@@ -401,6 +415,10 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) | |||
401 | case ACL_LINK: | 415 | case ACL_LINK: |
402 | conn->pkt_type = hdev->pkt_type & ACL_PTYPE_MASK; | 416 | conn->pkt_type = hdev->pkt_type & ACL_PTYPE_MASK; |
403 | break; | 417 | break; |
418 | case LE_LINK: | ||
419 | /* conn->src should reflect the local identity address */ | ||
420 | hci_copy_identity_address(hdev, &conn->src, &conn->src_type); | ||
421 | break; | ||
404 | case SCO_LINK: | 422 | case SCO_LINK: |
405 | if (lmp_esco_capable(hdev)) | 423 | if (lmp_esco_capable(hdev)) |
406 | conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | | 424 | conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | |
@@ -545,6 +563,11 @@ void hci_le_conn_failed(struct hci_conn *conn, u8 status) | |||
545 | * favor of connection establishment, we should restart it. | 563 | * favor of connection establishment, we should restart it. |
546 | */ | 564 | */ |
547 | hci_update_background_scan(hdev); | 565 | hci_update_background_scan(hdev); |
566 | |||
567 | /* Re-enable advertising in case this was a failed connection | ||
568 | * attempt as a peripheral. | ||
569 | */ | ||
570 | mgmt_reenable_advertising(hdev); | ||
548 | } | 571 | } |
549 | 572 | ||
550 | static void create_le_conn_complete(struct hci_dev *hdev, u8 status) | 573 | static void create_le_conn_complete(struct hci_dev *hdev, u8 status) |
@@ -605,6 +628,45 @@ static void hci_req_add_le_create_conn(struct hci_request *req, | |||
605 | conn->state = BT_CONNECT; | 628 | conn->state = BT_CONNECT; |
606 | } | 629 | } |
607 | 630 | ||
631 | static void hci_req_directed_advertising(struct hci_request *req, | ||
632 | struct hci_conn *conn) | ||
633 | { | ||
634 | struct hci_dev *hdev = req->hdev; | ||
635 | struct hci_cp_le_set_adv_param cp; | ||
636 | u8 own_addr_type; | ||
637 | u8 enable; | ||
638 | |||
639 | enable = 0x00; | ||
640 | hci_req_add(req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), &enable); | ||
641 | |||
642 | /* Clear the HCI_ADVERTISING bit temporarily so that the | ||
643 | * hci_update_random_address knows that it's safe to go ahead | ||
644 | * and write a new random address. The flag will be set back on | ||
645 | * as soon as the SET_ADV_ENABLE HCI command completes. | ||
646 | */ | ||
647 | clear_bit(HCI_ADVERTISING, &hdev->dev_flags); | ||
648 | |||
649 | /* Set require_privacy to false so that the remote device has a | ||
650 | * chance of identifying us. | ||
651 | */ | ||
652 | if (hci_update_random_address(req, false, &own_addr_type) < 0) | ||
653 | return; | ||
654 | |||
655 | memset(&cp, 0, sizeof(cp)); | ||
656 | cp.type = LE_ADV_DIRECT_IND; | ||
657 | cp.own_address_type = own_addr_type; | ||
658 | cp.direct_addr_type = conn->dst_type; | ||
659 | bacpy(&cp.direct_addr, &conn->dst); | ||
660 | cp.channel_map = hdev->le_adv_channel_map; | ||
661 | |||
662 | hci_req_add(req, HCI_OP_LE_SET_ADV_PARAM, sizeof(cp), &cp); | ||
663 | |||
664 | enable = 0x01; | ||
665 | hci_req_add(req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), &enable); | ||
666 | |||
667 | conn->state = BT_CONNECT; | ||
668 | } | ||
669 | |||
608 | struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | 670 | struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, |
609 | u8 dst_type, u8 sec_level, u8 auth_type) | 671 | u8 dst_type, u8 sec_level, u8 auth_type) |
610 | { | 672 | { |
@@ -614,9 +676,6 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | |||
614 | struct hci_request req; | 676 | struct hci_request req; |
615 | int err; | 677 | int err; |
616 | 678 | ||
617 | if (test_bit(HCI_ADVERTISING, &hdev->flags)) | ||
618 | return ERR_PTR(-ENOTSUPP); | ||
619 | |||
620 | /* Some devices send ATT messages as soon as the physical link is | 679 | /* Some devices send ATT messages as soon as the physical link is |
621 | * established. To be able to handle these ATT messages, the user- | 680 | * established. To be able to handle these ATT messages, the user- |
622 | * space first establishes the connection and then starts the pairing | 681 | * space first establishes the connection and then starts the pairing |
@@ -664,13 +723,20 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | |||
664 | return ERR_PTR(-ENOMEM); | 723 | return ERR_PTR(-ENOMEM); |
665 | 724 | ||
666 | conn->dst_type = dst_type; | 725 | conn->dst_type = dst_type; |
667 | |||
668 | conn->out = true; | ||
669 | conn->link_mode |= HCI_LM_MASTER; | ||
670 | conn->sec_level = BT_SECURITY_LOW; | 726 | conn->sec_level = BT_SECURITY_LOW; |
671 | conn->pending_sec_level = sec_level; | 727 | conn->pending_sec_level = sec_level; |
672 | conn->auth_type = auth_type; | 728 | conn->auth_type = auth_type; |
673 | 729 | ||
730 | hci_req_init(&req, hdev); | ||
731 | |||
732 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) { | ||
733 | hci_req_directed_advertising(&req, conn); | ||
734 | goto create_conn; | ||
735 | } | ||
736 | |||
737 | conn->out = true; | ||
738 | conn->link_mode |= HCI_LM_MASTER; | ||
739 | |||
674 | params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); | 740 | params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); |
675 | if (params) { | 741 | if (params) { |
676 | conn->le_conn_min_interval = params->conn_min_interval; | 742 | conn->le_conn_min_interval = params->conn_min_interval; |
@@ -680,8 +746,6 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | |||
680 | conn->le_conn_max_interval = hdev->le_conn_max_interval; | 746 | conn->le_conn_max_interval = hdev->le_conn_max_interval; |
681 | } | 747 | } |
682 | 748 | ||
683 | hci_req_init(&req, hdev); | ||
684 | |||
685 | /* If controller is scanning, we stop it since some controllers are | 749 | /* If controller is scanning, we stop it since some controllers are |
686 | * not able to scan and connect at the same time. Also set the | 750 | * not able to scan and connect at the same time. Also set the |
687 | * HCI_LE_SCAN_INTERRUPTED flag so that the command complete | 751 | * HCI_LE_SCAN_INTERRUPTED flag so that the command complete |
@@ -695,6 +759,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | |||
695 | 759 | ||
696 | hci_req_add_le_create_conn(&req, conn); | 760 | hci_req_add_le_create_conn(&req, conn); |
697 | 761 | ||
762 | create_conn: | ||
698 | err = hci_req_run(&req, create_le_conn_complete); | 763 | err = hci_req_run(&req, create_le_conn_complete); |
699 | if (err) { | 764 | if (err) { |
700 | hci_conn_del(conn); | 765 | hci_conn_del(conn); |
@@ -819,14 +884,17 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
819 | if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { | 884 | if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { |
820 | struct hci_cp_auth_requested cp; | 885 | struct hci_cp_auth_requested cp; |
821 | 886 | ||
822 | /* encrypt must be pending if auth is also pending */ | ||
823 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | ||
824 | |||
825 | cp.handle = cpu_to_le16(conn->handle); | 887 | cp.handle = cpu_to_le16(conn->handle); |
826 | hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, | 888 | hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, |
827 | sizeof(cp), &cp); | 889 | sizeof(cp), &cp); |
890 | |||
891 | /* If we're already encrypted set the REAUTH_PEND flag, | ||
892 | * otherwise set the ENCRYPT_PEND. | ||
893 | */ | ||
828 | if (conn->key_type != 0xff) | 894 | if (conn->key_type != 0xff) |
829 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); | 895 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); |
896 | else | ||
897 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | ||
830 | } | 898 | } |
831 | 899 | ||
832 | return 0; | 900 | return 0; |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 1c6ffaa8902f..d31f144860d1 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -955,14 +955,9 @@ static ssize_t le_auto_conn_write(struct file *file, const char __user *data, | |||
955 | if (count < 3) | 955 | if (count < 3) |
956 | return -EINVAL; | 956 | return -EINVAL; |
957 | 957 | ||
958 | buf = kzalloc(count, GFP_KERNEL); | 958 | buf = memdup_user(data, count); |
959 | if (!buf) | 959 | if (IS_ERR(buf)) |
960 | return -ENOMEM; | 960 | return PTR_ERR(buf); |
961 | |||
962 | if (copy_from_user(buf, data, count)) { | ||
963 | err = -EFAULT; | ||
964 | goto done; | ||
965 | } | ||
966 | 961 | ||
967 | if (memcmp(buf, "add", 3) == 0) { | 962 | if (memcmp(buf, "add", 3) == 0) { |
968 | n = sscanf(&buf[4], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhu %hhu", | 963 | n = sscanf(&buf[4], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhu %hhu", |
@@ -1828,6 +1823,9 @@ static int __hci_init(struct hci_dev *hdev) | |||
1828 | &lowpan_debugfs_fops); | 1823 | &lowpan_debugfs_fops); |
1829 | debugfs_create_file("le_auto_conn", 0644, hdev->debugfs, hdev, | 1824 | debugfs_create_file("le_auto_conn", 0644, hdev->debugfs, hdev, |
1830 | &le_auto_conn_fops); | 1825 | &le_auto_conn_fops); |
1826 | debugfs_create_u16("discov_interleaved_timeout", 0644, | ||
1827 | hdev->debugfs, | ||
1828 | &hdev->discov_interleaved_timeout); | ||
1831 | } | 1829 | } |
1832 | 1830 | ||
1833 | return 0; | 1831 | return 0; |
@@ -2033,12 +2031,11 @@ bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, | |||
2033 | 2031 | ||
2034 | hci_remove_remote_oob_data(hdev, &data->bdaddr); | 2032 | hci_remove_remote_oob_data(hdev, &data->bdaddr); |
2035 | 2033 | ||
2036 | if (ssp) | 2034 | *ssp = data->ssp_mode; |
2037 | *ssp = data->ssp_mode; | ||
2038 | 2035 | ||
2039 | ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr); | 2036 | ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr); |
2040 | if (ie) { | 2037 | if (ie) { |
2041 | if (ie->data.ssp_mode && ssp) | 2038 | if (ie->data.ssp_mode) |
2042 | *ssp = true; | 2039 | *ssp = true; |
2043 | 2040 | ||
2044 | if (ie->name_state == NAME_NEEDED && | 2041 | if (ie->name_state == NAME_NEEDED && |
@@ -3791,6 +3788,7 @@ struct hci_dev *hci_alloc_dev(void) | |||
3791 | hdev->le_conn_max_interval = 0x0038; | 3788 | hdev->le_conn_max_interval = 0x0038; |
3792 | 3789 | ||
3793 | hdev->rpa_timeout = HCI_DEFAULT_RPA_TIMEOUT; | 3790 | hdev->rpa_timeout = HCI_DEFAULT_RPA_TIMEOUT; |
3791 | hdev->discov_interleaved_timeout = DISCOV_INTERLEAVED_TIMEOUT; | ||
3794 | 3792 | ||
3795 | mutex_init(&hdev->lock); | 3793 | mutex_init(&hdev->lock); |
3796 | mutex_init(&hdev->req_lock); | 3794 | mutex_init(&hdev->req_lock); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 49774912cb01..ca19fd4bbb8f 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -991,10 +991,25 @@ static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) | |||
991 | if (!sent) | 991 | if (!sent) |
992 | return; | 992 | return; |
993 | 993 | ||
994 | if (status) | ||
995 | return; | ||
996 | |||
994 | hci_dev_lock(hdev); | 997 | hci_dev_lock(hdev); |
995 | 998 | ||
996 | if (!status) | 999 | /* If we're doing connection initation as peripheral. Set a |
997 | mgmt_advertising(hdev, *sent); | 1000 | * timeout in case something goes wrong. |
1001 | */ | ||
1002 | if (*sent) { | ||
1003 | struct hci_conn *conn; | ||
1004 | |||
1005 | conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); | ||
1006 | if (conn) | ||
1007 | queue_delayed_work(hdev->workqueue, | ||
1008 | &conn->le_conn_timeout, | ||
1009 | HCI_LE_CONN_TIMEOUT); | ||
1010 | } | ||
1011 | |||
1012 | mgmt_advertising(hdev, *sent); | ||
998 | 1013 | ||
999 | hci_dev_unlock(hdev); | 1014 | hci_dev_unlock(hdev); |
1000 | } | 1015 | } |
@@ -1018,6 +1033,33 @@ static void hci_cc_le_set_scan_param(struct hci_dev *hdev, struct sk_buff *skb) | |||
1018 | hci_dev_unlock(hdev); | 1033 | hci_dev_unlock(hdev); |
1019 | } | 1034 | } |
1020 | 1035 | ||
1036 | static bool has_pending_adv_report(struct hci_dev *hdev) | ||
1037 | { | ||
1038 | struct discovery_state *d = &hdev->discovery; | ||
1039 | |||
1040 | return bacmp(&d->last_adv_addr, BDADDR_ANY); | ||
1041 | } | ||
1042 | |||
1043 | static void clear_pending_adv_report(struct hci_dev *hdev) | ||
1044 | { | ||
1045 | struct discovery_state *d = &hdev->discovery; | ||
1046 | |||
1047 | bacpy(&d->last_adv_addr, BDADDR_ANY); | ||
1048 | d->last_adv_data_len = 0; | ||
1049 | } | ||
1050 | |||
1051 | static void store_pending_adv_report(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
1052 | u8 bdaddr_type, s8 rssi, u8 *data, u8 len) | ||
1053 | { | ||
1054 | struct discovery_state *d = &hdev->discovery; | ||
1055 | |||
1056 | bacpy(&d->last_adv_addr, bdaddr); | ||
1057 | d->last_adv_addr_type = bdaddr_type; | ||
1058 | d->last_adv_rssi = rssi; | ||
1059 | memcpy(d->last_adv_data, data, len); | ||
1060 | d->last_adv_data_len = len; | ||
1061 | } | ||
1062 | |||
1021 | static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | 1063 | static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, |
1022 | struct sk_buff *skb) | 1064 | struct sk_buff *skb) |
1023 | { | 1065 | { |
@@ -1036,9 +1078,25 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1036 | switch (cp->enable) { | 1078 | switch (cp->enable) { |
1037 | case LE_SCAN_ENABLE: | 1079 | case LE_SCAN_ENABLE: |
1038 | set_bit(HCI_LE_SCAN, &hdev->dev_flags); | 1080 | set_bit(HCI_LE_SCAN, &hdev->dev_flags); |
1081 | if (hdev->le_scan_type == LE_SCAN_ACTIVE) | ||
1082 | clear_pending_adv_report(hdev); | ||
1039 | break; | 1083 | break; |
1040 | 1084 | ||
1041 | case LE_SCAN_DISABLE: | 1085 | case LE_SCAN_DISABLE: |
1086 | /* We do this here instead of when setting DISCOVERY_STOPPED | ||
1087 | * since the latter would potentially require waiting for | ||
1088 | * inquiry to stop too. | ||
1089 | */ | ||
1090 | if (has_pending_adv_report(hdev)) { | ||
1091 | struct discovery_state *d = &hdev->discovery; | ||
1092 | |||
1093 | mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, | ||
1094 | d->last_adv_addr_type, NULL, | ||
1095 | d->last_adv_rssi, 0, 1, | ||
1096 | d->last_adv_data, | ||
1097 | d->last_adv_data_len, NULL, 0); | ||
1098 | } | ||
1099 | |||
1042 | /* Cancel this timer so that we don't try to disable scanning | 1100 | /* Cancel this timer so that we don't try to disable scanning |
1043 | * when it's already disabled. | 1101 | * when it's already disabled. |
1044 | */ | 1102 | */ |
@@ -1827,7 +1885,7 @@ static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
1827 | name_known = hci_inquiry_cache_update(hdev, &data, false, &ssp); | 1885 | name_known = hci_inquiry_cache_update(hdev, &data, false, &ssp); |
1828 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, | 1886 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, |
1829 | info->dev_class, 0, !name_known, ssp, NULL, | 1887 | info->dev_class, 0, !name_known, ssp, NULL, |
1830 | 0); | 1888 | 0, NULL, 0); |
1831 | } | 1889 | } |
1832 | 1890 | ||
1833 | hci_dev_unlock(hdev); | 1891 | hci_dev_unlock(hdev); |
@@ -3102,7 +3160,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, | |||
3102 | false, &ssp); | 3160 | false, &ssp); |
3103 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, | 3161 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, |
3104 | info->dev_class, info->rssi, | 3162 | info->dev_class, info->rssi, |
3105 | !name_known, ssp, NULL, 0); | 3163 | !name_known, ssp, NULL, 0, NULL, 0); |
3106 | } | 3164 | } |
3107 | } else { | 3165 | } else { |
3108 | struct inquiry_info_with_rssi *info = (void *) (skb->data + 1); | 3166 | struct inquiry_info_with_rssi *info = (void *) (skb->data + 1); |
@@ -3120,7 +3178,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, | |||
3120 | false, &ssp); | 3178 | false, &ssp); |
3121 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, | 3179 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, |
3122 | info->dev_class, info->rssi, | 3180 | info->dev_class, info->rssi, |
3123 | !name_known, ssp, NULL, 0); | 3181 | !name_known, ssp, NULL, 0, NULL, 0); |
3124 | } | 3182 | } |
3125 | } | 3183 | } |
3126 | 3184 | ||
@@ -3309,7 +3367,7 @@ static void hci_extended_inquiry_result_evt(struct hci_dev *hdev, | |||
3309 | eir_len = eir_get_length(info->data, sizeof(info->data)); | 3367 | eir_len = eir_get_length(info->data, sizeof(info->data)); |
3310 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, | 3368 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, |
3311 | info->dev_class, info->rssi, !name_known, | 3369 | info->dev_class, info->rssi, !name_known, |
3312 | ssp, info->data, eir_len); | 3370 | ssp, info->data, eir_len, NULL, 0); |
3313 | } | 3371 | } |
3314 | 3372 | ||
3315 | hci_dev_unlock(hdev); | 3373 | hci_dev_unlock(hdev); |
@@ -3330,6 +3388,12 @@ static void hci_key_refresh_complete_evt(struct hci_dev *hdev, | |||
3330 | if (!conn) | 3388 | if (!conn) |
3331 | goto unlock; | 3389 | goto unlock; |
3332 | 3390 | ||
3391 | /* For BR/EDR the necessary steps are taken through the | ||
3392 | * auth_complete event. | ||
3393 | */ | ||
3394 | if (conn->type != LE_LINK) | ||
3395 | goto unlock; | ||
3396 | |||
3333 | if (!ev->status) | 3397 | if (!ev->status) |
3334 | conn->sec_level = conn->pending_sec_level; | 3398 | conn->sec_level = conn->pending_sec_level; |
3335 | 3399 | ||
@@ -3361,24 +3425,20 @@ unlock: | |||
3361 | 3425 | ||
3362 | static u8 hci_get_auth_req(struct hci_conn *conn) | 3426 | static u8 hci_get_auth_req(struct hci_conn *conn) |
3363 | { | 3427 | { |
3364 | /* If remote requests dedicated bonding follow that lead */ | ||
3365 | if (conn->remote_auth == HCI_AT_DEDICATED_BONDING || | ||
3366 | conn->remote_auth == HCI_AT_DEDICATED_BONDING_MITM) { | ||
3367 | /* If both remote and local IO capabilities allow MITM | ||
3368 | * protection then require it, otherwise don't */ | ||
3369 | if (conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT || | ||
3370 | conn->io_capability == HCI_IO_NO_INPUT_OUTPUT) | ||
3371 | return HCI_AT_DEDICATED_BONDING; | ||
3372 | else | ||
3373 | return HCI_AT_DEDICATED_BONDING_MITM; | ||
3374 | } | ||
3375 | |||
3376 | /* If remote requests no-bonding follow that lead */ | 3428 | /* If remote requests no-bonding follow that lead */ |
3377 | if (conn->remote_auth == HCI_AT_NO_BONDING || | 3429 | if (conn->remote_auth == HCI_AT_NO_BONDING || |
3378 | conn->remote_auth == HCI_AT_NO_BONDING_MITM) | 3430 | conn->remote_auth == HCI_AT_NO_BONDING_MITM) |
3379 | return conn->remote_auth | (conn->auth_type & 0x01); | 3431 | return conn->remote_auth | (conn->auth_type & 0x01); |
3380 | 3432 | ||
3381 | return conn->auth_type; | 3433 | /* If both remote and local have enough IO capabilities, require |
3434 | * MITM protection | ||
3435 | */ | ||
3436 | if (conn->remote_cap != HCI_IO_NO_INPUT_OUTPUT && | ||
3437 | conn->io_capability != HCI_IO_NO_INPUT_OUTPUT) | ||
3438 | return conn->remote_auth | 0x01; | ||
3439 | |||
3440 | /* No MITM protection possible so ignore remote requirement */ | ||
3441 | return (conn->remote_auth & ~0x01) | (conn->auth_type & 0x01); | ||
3382 | } | 3442 | } |
3383 | 3443 | ||
3384 | static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | 3444 | static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -3408,8 +3468,21 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3408 | * to DisplayYesNo as it is not supported by BT spec. */ | 3468 | * to DisplayYesNo as it is not supported by BT spec. */ |
3409 | cp.capability = (conn->io_capability == 0x04) ? | 3469 | cp.capability = (conn->io_capability == 0x04) ? |
3410 | HCI_IO_DISPLAY_YESNO : conn->io_capability; | 3470 | HCI_IO_DISPLAY_YESNO : conn->io_capability; |
3411 | conn->auth_type = hci_get_auth_req(conn); | 3471 | |
3412 | cp.authentication = conn->auth_type; | 3472 | /* If we are initiators, there is no remote information yet */ |
3473 | if (conn->remote_auth == 0xff) { | ||
3474 | cp.authentication = conn->auth_type; | ||
3475 | |||
3476 | /* Request MITM protection if our IO caps allow it | ||
3477 | * except for the no-bonding case | ||
3478 | */ | ||
3479 | if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && | ||
3480 | cp.authentication != HCI_AT_NO_BONDING) | ||
3481 | cp.authentication |= 0x01; | ||
3482 | } else { | ||
3483 | conn->auth_type = hci_get_auth_req(conn); | ||
3484 | cp.authentication = conn->auth_type; | ||
3485 | } | ||
3413 | 3486 | ||
3414 | if (hci_find_remote_oob_data(hdev, &conn->dst) && | 3487 | if (hci_find_remote_oob_data(hdev, &conn->dst) && |
3415 | (conn->out || test_bit(HCI_CONN_REMOTE_OOB, &conn->flags))) | 3488 | (conn->out || test_bit(HCI_CONN_REMOTE_OOB, &conn->flags))) |
@@ -3477,12 +3550,9 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
3477 | rem_mitm = (conn->remote_auth & 0x01); | 3550 | rem_mitm = (conn->remote_auth & 0x01); |
3478 | 3551 | ||
3479 | /* If we require MITM but the remote device can't provide that | 3552 | /* If we require MITM but the remote device can't provide that |
3480 | * (it has NoInputNoOutput) then reject the confirmation | 3553 | * (it has NoInputNoOutput) then reject the confirmation request |
3481 | * request. The only exception is when we're dedicated bonding | 3554 | */ |
3482 | * initiators (connect_cfm_cb set) since then we always have the MITM | 3555 | if (loc_mitm && conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) { |
3483 | * bit set. */ | ||
3484 | if (!conn->connect_cfm_cb && loc_mitm && | ||
3485 | conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) { | ||
3486 | BT_DBG("Rejecting request: remote device can't provide MITM"); | 3556 | BT_DBG("Rejecting request: remote device can't provide MITM"); |
3487 | hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, | 3557 | hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, |
3488 | sizeof(ev->bdaddr), &ev->bdaddr); | 3558 | sizeof(ev->bdaddr), &ev->bdaddr); |
@@ -3840,17 +3910,6 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3840 | 3910 | ||
3841 | conn->dst_type = ev->bdaddr_type; | 3911 | conn->dst_type = ev->bdaddr_type; |
3842 | 3912 | ||
3843 | /* The advertising parameters for own address type | ||
3844 | * define which source address and source address | ||
3845 | * type this connections has. | ||
3846 | */ | ||
3847 | if (bacmp(&conn->src, BDADDR_ANY)) { | ||
3848 | conn->src_type = ADDR_LE_DEV_PUBLIC; | ||
3849 | } else { | ||
3850 | bacpy(&conn->src, &hdev->static_addr); | ||
3851 | conn->src_type = ADDR_LE_DEV_RANDOM; | ||
3852 | } | ||
3853 | |||
3854 | if (ev->role == LE_CONN_ROLE_MASTER) { | 3913 | if (ev->role == LE_CONN_ROLE_MASTER) { |
3855 | conn->out = true; | 3914 | conn->out = true; |
3856 | conn->link_mode |= HCI_LM_MASTER; | 3915 | conn->link_mode |= HCI_LM_MASTER; |
@@ -3875,27 +3934,24 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3875 | &conn->init_addr, | 3934 | &conn->init_addr, |
3876 | &conn->init_addr_type); | 3935 | &conn->init_addr_type); |
3877 | } | 3936 | } |
3878 | } else { | ||
3879 | /* Set the responder (our side) address type based on | ||
3880 | * the advertising address type. | ||
3881 | */ | ||
3882 | conn->resp_addr_type = hdev->adv_addr_type; | ||
3883 | if (hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) | ||
3884 | bacpy(&conn->resp_addr, &hdev->random_addr); | ||
3885 | else | ||
3886 | bacpy(&conn->resp_addr, &hdev->bdaddr); | ||
3887 | |||
3888 | conn->init_addr_type = ev->bdaddr_type; | ||
3889 | bacpy(&conn->init_addr, &ev->bdaddr); | ||
3890 | } | 3937 | } |
3891 | } else { | 3938 | } else { |
3892 | cancel_delayed_work(&conn->le_conn_timeout); | 3939 | cancel_delayed_work(&conn->le_conn_timeout); |
3893 | } | 3940 | } |
3894 | 3941 | ||
3895 | /* Ensure that the hci_conn contains the identity address type | 3942 | if (!conn->out) { |
3896 | * regardless of which address the connection was made with. | 3943 | /* Set the responder (our side) address type based on |
3897 | */ | 3944 | * the advertising address type. |
3898 | hci_copy_identity_address(hdev, &conn->src, &conn->src_type); | 3945 | */ |
3946 | conn->resp_addr_type = hdev->adv_addr_type; | ||
3947 | if (hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) | ||
3948 | bacpy(&conn->resp_addr, &hdev->random_addr); | ||
3949 | else | ||
3950 | bacpy(&conn->resp_addr, &hdev->bdaddr); | ||
3951 | |||
3952 | conn->init_addr_type = ev->bdaddr_type; | ||
3953 | bacpy(&conn->init_addr, &ev->bdaddr); | ||
3954 | } | ||
3899 | 3955 | ||
3900 | /* Lookup the identity address from the stored connection | 3956 | /* Lookup the identity address from the stored connection |
3901 | * address and address type. | 3957 | * address and address type. |
@@ -3975,25 +4031,97 @@ static void check_pending_le_conn(struct hci_dev *hdev, bdaddr_t *addr, | |||
3975 | } | 4031 | } |
3976 | } | 4032 | } |
3977 | 4033 | ||
4034 | static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr, | ||
4035 | u8 bdaddr_type, s8 rssi, u8 *data, u8 len) | ||
4036 | { | ||
4037 | struct discovery_state *d = &hdev->discovery; | ||
4038 | bool match; | ||
4039 | |||
4040 | /* Passive scanning shouldn't trigger any device found events */ | ||
4041 | if (hdev->le_scan_type == LE_SCAN_PASSIVE) { | ||
4042 | if (type == LE_ADV_IND || type == LE_ADV_DIRECT_IND) | ||
4043 | check_pending_le_conn(hdev, bdaddr, bdaddr_type); | ||
4044 | return; | ||
4045 | } | ||
4046 | |||
4047 | /* If there's nothing pending either store the data from this | ||
4048 | * event or send an immediate device found event if the data | ||
4049 | * should not be stored for later. | ||
4050 | */ | ||
4051 | if (!has_pending_adv_report(hdev)) { | ||
4052 | /* If the report will trigger a SCAN_REQ store it for | ||
4053 | * later merging. | ||
4054 | */ | ||
4055 | if (type == LE_ADV_IND || type == LE_ADV_SCAN_IND) { | ||
4056 | store_pending_adv_report(hdev, bdaddr, bdaddr_type, | ||
4057 | rssi, data, len); | ||
4058 | return; | ||
4059 | } | ||
4060 | |||
4061 | mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, | ||
4062 | rssi, 0, 1, data, len, NULL, 0); | ||
4063 | return; | ||
4064 | } | ||
4065 | |||
4066 | /* Check if the pending report is for the same device as the new one */ | ||
4067 | match = (!bacmp(bdaddr, &d->last_adv_addr) && | ||
4068 | bdaddr_type == d->last_adv_addr_type); | ||
4069 | |||
4070 | /* If the pending data doesn't match this report or this isn't a | ||
4071 | * scan response (e.g. we got a duplicate ADV_IND) then force | ||
4072 | * sending of the pending data. | ||
4073 | */ | ||
4074 | if (type != LE_ADV_SCAN_RSP || !match) { | ||
4075 | /* Send out whatever is in the cache, but skip duplicates */ | ||
4076 | if (!match) | ||
4077 | mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, | ||
4078 | d->last_adv_addr_type, NULL, | ||
4079 | d->last_adv_rssi, 0, 1, | ||
4080 | d->last_adv_data, | ||
4081 | d->last_adv_data_len, NULL, 0); | ||
4082 | |||
4083 | /* If the new report will trigger a SCAN_REQ store it for | ||
4084 | * later merging. | ||
4085 | */ | ||
4086 | if (type == LE_ADV_IND || type == LE_ADV_SCAN_IND) { | ||
4087 | store_pending_adv_report(hdev, bdaddr, bdaddr_type, | ||
4088 | rssi, data, len); | ||
4089 | return; | ||
4090 | } | ||
4091 | |||
4092 | /* The advertising reports cannot be merged, so clear | ||
4093 | * the pending report and send out a device found event. | ||
4094 | */ | ||
4095 | clear_pending_adv_report(hdev); | ||
4096 | mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, | ||
4097 | rssi, 0, 1, data, len, NULL, 0); | ||
4098 | return; | ||
4099 | } | ||
4100 | |||
4101 | /* If we get here we've got a pending ADV_IND or ADV_SCAN_IND and | ||
4102 | * the new event is a SCAN_RSP. We can therefore proceed with | ||
4103 | * sending a merged device found event. | ||
4104 | */ | ||
4105 | mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, | ||
4106 | d->last_adv_addr_type, NULL, rssi, 0, 1, data, len, | ||
4107 | d->last_adv_data, d->last_adv_data_len); | ||
4108 | clear_pending_adv_report(hdev); | ||
4109 | } | ||
4110 | |||
3978 | static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) | 4111 | static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
3979 | { | 4112 | { |
3980 | u8 num_reports = skb->data[0]; | 4113 | u8 num_reports = skb->data[0]; |
3981 | void *ptr = &skb->data[1]; | 4114 | void *ptr = &skb->data[1]; |
3982 | s8 rssi; | ||
3983 | 4115 | ||
3984 | hci_dev_lock(hdev); | 4116 | hci_dev_lock(hdev); |
3985 | 4117 | ||
3986 | while (num_reports--) { | 4118 | while (num_reports--) { |
3987 | struct hci_ev_le_advertising_info *ev = ptr; | 4119 | struct hci_ev_le_advertising_info *ev = ptr; |
3988 | 4120 | s8 rssi; | |
3989 | if (ev->evt_type == LE_ADV_IND || | ||
3990 | ev->evt_type == LE_ADV_DIRECT_IND) | ||
3991 | check_pending_le_conn(hdev, &ev->bdaddr, | ||
3992 | ev->bdaddr_type); | ||
3993 | 4121 | ||
3994 | rssi = ev->data[ev->length]; | 4122 | rssi = ev->data[ev->length]; |
3995 | mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type, | 4123 | process_adv_report(hdev, ev->evt_type, &ev->bdaddr, |
3996 | NULL, rssi, 0, 1, ev->data, ev->length); | 4124 | ev->bdaddr_type, rssi, ev->data, ev->length); |
3997 | 4125 | ||
3998 | ptr += sizeof(*ev) + ev->length + 1; | 4126 | ptr += sizeof(*ev) + ev->length + 1; |
3999 | } | 4127 | } |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index b9a418e578e0..f608bffdb8b9 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -524,16 +524,7 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, | |||
524 | case HCISETRAW: | 524 | case HCISETRAW: |
525 | if (!capable(CAP_NET_ADMIN)) | 525 | if (!capable(CAP_NET_ADMIN)) |
526 | return -EPERM; | 526 | return -EPERM; |
527 | 527 | return -EOPNOTSUPP; | |
528 | if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) | ||
529 | return -EPERM; | ||
530 | |||
531 | if (arg) | ||
532 | set_bit(HCI_RAW, &hdev->flags); | ||
533 | else | ||
534 | clear_bit(HCI_RAW, &hdev->flags); | ||
535 | |||
536 | return 0; | ||
537 | 528 | ||
538 | case HCIGETCONNINFO: | 529 | case HCIGETCONNINFO: |
539 | return hci_get_conn_info(hdev, (void __user *) arg); | 530 | return hci_get_conn_info(hdev, (void __user *) arg); |
diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c index b3fbc73516c4..941ad7530eda 100644 --- a/net/bluetooth/lib.c +++ b/net/bluetooth/lib.c | |||
@@ -58,6 +58,7 @@ int bt_to_errno(__u16 code) | |||
58 | return EIO; | 58 | return EIO; |
59 | 59 | ||
60 | case 0x04: | 60 | case 0x04: |
61 | case 0x3c: | ||
61 | return EHOSTDOWN; | 62 | return EHOSTDOWN; |
62 | 63 | ||
63 | case 0x05: | 64 | case 0x05: |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index d2d4e0d5aed0..54abbce3a39e 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2850,10 +2850,7 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data, | |||
2850 | } | 2850 | } |
2851 | 2851 | ||
2852 | sec_level = BT_SECURITY_MEDIUM; | 2852 | sec_level = BT_SECURITY_MEDIUM; |
2853 | if (cp->io_cap == 0x03) | 2853 | auth_type = HCI_AT_DEDICATED_BONDING; |
2854 | auth_type = HCI_AT_DEDICATED_BONDING; | ||
2855 | else | ||
2856 | auth_type = HCI_AT_DEDICATED_BONDING_MITM; | ||
2857 | 2854 | ||
2858 | if (cp->addr.type == BDADDR_BREDR) { | 2855 | if (cp->addr.type == BDADDR_BREDR) { |
2859 | conn = hci_connect_acl(hdev, &cp->addr.bdaddr, sec_level, | 2856 | conn = hci_connect_acl(hdev, &cp->addr.bdaddr, sec_level, |
@@ -3351,6 +3348,8 @@ static int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status) | |||
3351 | 3348 | ||
3352 | static void start_discovery_complete(struct hci_dev *hdev, u8 status) | 3349 | static void start_discovery_complete(struct hci_dev *hdev, u8 status) |
3353 | { | 3350 | { |
3351 | unsigned long timeout = 0; | ||
3352 | |||
3354 | BT_DBG("status %d", status); | 3353 | BT_DBG("status %d", status); |
3355 | 3354 | ||
3356 | if (status) { | 3355 | if (status) { |
@@ -3366,13 +3365,11 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status) | |||
3366 | 3365 | ||
3367 | switch (hdev->discovery.type) { | 3366 | switch (hdev->discovery.type) { |
3368 | case DISCOV_TYPE_LE: | 3367 | case DISCOV_TYPE_LE: |
3369 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, | 3368 | timeout = msecs_to_jiffies(DISCOV_LE_TIMEOUT); |
3370 | DISCOV_LE_TIMEOUT); | ||
3371 | break; | 3369 | break; |
3372 | 3370 | ||
3373 | case DISCOV_TYPE_INTERLEAVED: | 3371 | case DISCOV_TYPE_INTERLEAVED: |
3374 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, | 3372 | timeout = msecs_to_jiffies(hdev->discov_interleaved_timeout); |
3375 | DISCOV_INTERLEAVED_TIMEOUT); | ||
3376 | break; | 3373 | break; |
3377 | 3374 | ||
3378 | case DISCOV_TYPE_BREDR: | 3375 | case DISCOV_TYPE_BREDR: |
@@ -3381,6 +3378,11 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status) | |||
3381 | default: | 3378 | default: |
3382 | BT_ERR("Invalid discovery type %d", hdev->discovery.type); | 3379 | BT_ERR("Invalid discovery type %d", hdev->discovery.type); |
3383 | } | 3380 | } |
3381 | |||
3382 | if (!timeout) | ||
3383 | return; | ||
3384 | |||
3385 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, timeout); | ||
3384 | } | 3386 | } |
3385 | 3387 | ||
3386 | static int start_discovery(struct sock *sk, struct hci_dev *hdev, | 3388 | static int start_discovery(struct sock *sk, struct hci_dev *hdev, |
@@ -5668,8 +5670,9 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, | |||
5668 | } | 5670 | } |
5669 | 5671 | ||
5670 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 5672 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
5671 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, u8 | 5673 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, |
5672 | ssp, u8 *eir, u16 eir_len) | 5674 | u8 ssp, u8 *eir, u16 eir_len, u8 *scan_rsp, |
5675 | u8 scan_rsp_len) | ||
5673 | { | 5676 | { |
5674 | char buf[512]; | 5677 | char buf[512]; |
5675 | struct mgmt_ev_device_found *ev = (void *) buf; | 5678 | struct mgmt_ev_device_found *ev = (void *) buf; |
@@ -5679,8 +5682,10 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | |||
5679 | if (!hci_discovery_active(hdev)) | 5682 | if (!hci_discovery_active(hdev)) |
5680 | return; | 5683 | return; |
5681 | 5684 | ||
5682 | /* Leave 5 bytes for a potential CoD field */ | 5685 | /* Make sure that the buffer is big enough. The 5 extra bytes |
5683 | if (sizeof(*ev) + eir_len + 5 > sizeof(buf)) | 5686 | * are for the potential CoD field. |
5687 | */ | ||
5688 | if (sizeof(*ev) + eir_len + scan_rsp_len + 5 > sizeof(buf)) | ||
5684 | return; | 5689 | return; |
5685 | 5690 | ||
5686 | memset(buf, 0, sizeof(buf)); | 5691 | memset(buf, 0, sizeof(buf)); |
@@ -5707,8 +5712,11 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | |||
5707 | eir_len = eir_append_data(ev->eir, eir_len, EIR_CLASS_OF_DEV, | 5712 | eir_len = eir_append_data(ev->eir, eir_len, EIR_CLASS_OF_DEV, |
5708 | dev_class, 3); | 5713 | dev_class, 3); |
5709 | 5714 | ||
5710 | ev->eir_len = cpu_to_le16(eir_len); | 5715 | if (scan_rsp_len > 0) |
5711 | ev_size = sizeof(*ev) + eir_len; | 5716 | memcpy(ev->eir + eir_len, scan_rsp, scan_rsp_len); |
5717 | |||
5718 | ev->eir_len = cpu_to_le16(eir_len + scan_rsp_len); | ||
5719 | ev_size = sizeof(*ev) + eir_len + scan_rsp_len; | ||
5712 | 5720 | ||
5713 | mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, ev_size, NULL); | 5721 | mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, ev_size, NULL); |
5714 | } | 5722 | } |
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c index 7c7df475a401..ec24378caaaf 100644 --- a/net/mac80211/aes_ccm.c +++ b/net/mac80211/aes_ccm.c | |||
@@ -23,12 +23,13 @@ void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, | |||
23 | u8 *data, size_t data_len, u8 *mic) | 23 | u8 *data, size_t data_len, u8 *mic) |
24 | { | 24 | { |
25 | struct scatterlist assoc, pt, ct[2]; | 25 | struct scatterlist assoc, pt, ct[2]; |
26 | struct { | ||
27 | struct aead_request req; | ||
28 | u8 priv[crypto_aead_reqsize(tfm)]; | ||
29 | } aead_req; | ||
30 | 26 | ||
31 | memset(&aead_req, 0, sizeof(aead_req)); | 27 | char aead_req_data[sizeof(struct aead_request) + |
28 | crypto_aead_reqsize(tfm)] | ||
29 | __aligned(__alignof__(struct aead_request)); | ||
30 | struct aead_request *aead_req = (void *) aead_req_data; | ||
31 | |||
32 | memset(aead_req, 0, sizeof(aead_req_data)); | ||
32 | 33 | ||
33 | sg_init_one(&pt, data, data_len); | 34 | sg_init_one(&pt, data, data_len); |
34 | sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad)); | 35 | sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad)); |
@@ -36,23 +37,23 @@ void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, | |||
36 | sg_set_buf(&ct[0], data, data_len); | 37 | sg_set_buf(&ct[0], data, data_len); |
37 | sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN); | 38 | sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN); |
38 | 39 | ||
39 | aead_request_set_tfm(&aead_req.req, tfm); | 40 | aead_request_set_tfm(aead_req, tfm); |
40 | aead_request_set_assoc(&aead_req.req, &assoc, assoc.length); | 41 | aead_request_set_assoc(aead_req, &assoc, assoc.length); |
41 | aead_request_set_crypt(&aead_req.req, &pt, ct, data_len, b_0); | 42 | aead_request_set_crypt(aead_req, &pt, ct, data_len, b_0); |
42 | 43 | ||
43 | crypto_aead_encrypt(&aead_req.req); | 44 | crypto_aead_encrypt(aead_req); |
44 | } | 45 | } |
45 | 46 | ||
46 | int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, | 47 | int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, |
47 | u8 *data, size_t data_len, u8 *mic) | 48 | u8 *data, size_t data_len, u8 *mic) |
48 | { | 49 | { |
49 | struct scatterlist assoc, pt, ct[2]; | 50 | struct scatterlist assoc, pt, ct[2]; |
50 | struct { | 51 | char aead_req_data[sizeof(struct aead_request) + |
51 | struct aead_request req; | 52 | crypto_aead_reqsize(tfm)] |
52 | u8 priv[crypto_aead_reqsize(tfm)]; | 53 | __aligned(__alignof__(struct aead_request)); |
53 | } aead_req; | 54 | struct aead_request *aead_req = (void *) aead_req_data; |
54 | 55 | ||
55 | memset(&aead_req, 0, sizeof(aead_req)); | 56 | memset(aead_req, 0, sizeof(aead_req_data)); |
56 | 57 | ||
57 | sg_init_one(&pt, data, data_len); | 58 | sg_init_one(&pt, data, data_len); |
58 | sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad)); | 59 | sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad)); |
@@ -60,12 +61,12 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, | |||
60 | sg_set_buf(&ct[0], data, data_len); | 61 | sg_set_buf(&ct[0], data, data_len); |
61 | sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN); | 62 | sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN); |
62 | 63 | ||
63 | aead_request_set_tfm(&aead_req.req, tfm); | 64 | aead_request_set_tfm(aead_req, tfm); |
64 | aead_request_set_assoc(&aead_req.req, &assoc, assoc.length); | 65 | aead_request_set_assoc(aead_req, &assoc, assoc.length); |
65 | aead_request_set_crypt(&aead_req.req, ct, &pt, | 66 | aead_request_set_crypt(aead_req, ct, &pt, |
66 | data_len + IEEE80211_CCMP_MIC_LEN, b_0); | 67 | data_len + IEEE80211_CCMP_MIC_LEN, b_0); |
67 | 68 | ||
68 | return crypto_aead_decrypt(&aead_req.req); | 69 | return crypto_aead_decrypt(aead_req); |
69 | } | 70 | } |
70 | 71 | ||
71 | struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[]) | 72 | struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[]) |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index aaa59d719592..7b8d3cf89574 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -109,6 +109,15 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
109 | static int ieee80211_start_p2p_device(struct wiphy *wiphy, | 109 | static int ieee80211_start_p2p_device(struct wiphy *wiphy, |
110 | struct wireless_dev *wdev) | 110 | struct wireless_dev *wdev) |
111 | { | 111 | { |
112 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); | ||
113 | int ret; | ||
114 | |||
115 | mutex_lock(&sdata->local->chanctx_mtx); | ||
116 | ret = ieee80211_check_combinations(sdata, NULL, 0, 0); | ||
117 | mutex_unlock(&sdata->local->chanctx_mtx); | ||
118 | if (ret < 0) | ||
119 | return ret; | ||
120 | |||
112 | return ieee80211_do_open(wdev, true); | 121 | return ieee80211_do_open(wdev, true); |
113 | } | 122 | } |
114 | 123 | ||
@@ -972,13 +981,13 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, | |||
972 | sdata->needed_rx_chains = sdata->local->rx_chains; | 981 | sdata->needed_rx_chains = sdata->local->rx_chains; |
973 | 982 | ||
974 | mutex_lock(&local->mtx); | 983 | mutex_lock(&local->mtx); |
975 | sdata->radar_required = params->radar_required; | ||
976 | err = ieee80211_vif_use_channel(sdata, ¶ms->chandef, | 984 | err = ieee80211_vif_use_channel(sdata, ¶ms->chandef, |
977 | IEEE80211_CHANCTX_SHARED); | 985 | IEEE80211_CHANCTX_SHARED); |
986 | if (!err) | ||
987 | ieee80211_vif_copy_chanctx_to_vlans(sdata, false); | ||
978 | mutex_unlock(&local->mtx); | 988 | mutex_unlock(&local->mtx); |
979 | if (err) | 989 | if (err) |
980 | return err; | 990 | return err; |
981 | ieee80211_vif_copy_chanctx_to_vlans(sdata, false); | ||
982 | 991 | ||
983 | /* | 992 | /* |
984 | * Apply control port protocol, this allows us to | 993 | * Apply control port protocol, this allows us to |
@@ -1131,8 +1140,8 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) | |||
1131 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf); | 1140 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf); |
1132 | skb_queue_purge(&sdata->u.ap.ps.bc_buf); | 1141 | skb_queue_purge(&sdata->u.ap.ps.bc_buf); |
1133 | 1142 | ||
1134 | ieee80211_vif_copy_chanctx_to_vlans(sdata, true); | ||
1135 | mutex_lock(&local->mtx); | 1143 | mutex_lock(&local->mtx); |
1144 | ieee80211_vif_copy_chanctx_to_vlans(sdata, true); | ||
1136 | ieee80211_vif_release_channel(sdata); | 1145 | ieee80211_vif_release_channel(sdata); |
1137 | mutex_unlock(&local->mtx); | 1146 | mutex_unlock(&local->mtx); |
1138 | 1147 | ||
@@ -1566,7 +1575,7 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
1566 | 1575 | ||
1567 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | 1576 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && |
1568 | sta->sdata->u.vlan.sta) { | 1577 | sta->sdata->u.vlan.sta) { |
1569 | rcu_assign_pointer(sta->sdata->u.vlan.sta, NULL); | 1578 | RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL); |
1570 | prev_4addr = true; | 1579 | prev_4addr = true; |
1571 | } | 1580 | } |
1572 | 1581 | ||
@@ -2930,7 +2939,6 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, | |||
2930 | /* whatever, but channel contexts should not complain about that one */ | 2939 | /* whatever, but channel contexts should not complain about that one */ |
2931 | sdata->smps_mode = IEEE80211_SMPS_OFF; | 2940 | sdata->smps_mode = IEEE80211_SMPS_OFF; |
2932 | sdata->needed_rx_chains = local->rx_chains; | 2941 | sdata->needed_rx_chains = local->rx_chains; |
2933 | sdata->radar_required = true; | ||
2934 | 2942 | ||
2935 | err = ieee80211_vif_use_channel(sdata, chandef, | 2943 | err = ieee80211_vif_use_channel(sdata, chandef, |
2936 | IEEE80211_CHANCTX_SHARED); | 2944 | IEEE80211_CHANCTX_SHARED); |
@@ -3217,7 +3225,7 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, | |||
3217 | { | 3225 | { |
3218 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 3226 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
3219 | struct ieee80211_local *local = sdata->local; | 3227 | struct ieee80211_local *local = sdata->local; |
3220 | struct ieee80211_chanctx_conf *chanctx_conf; | 3228 | struct ieee80211_chanctx_conf *conf; |
3221 | struct ieee80211_chanctx *chanctx; | 3229 | struct ieee80211_chanctx *chanctx; |
3222 | int err, num_chanctx, changed = 0; | 3230 | int err, num_chanctx, changed = 0; |
3223 | 3231 | ||
@@ -3233,23 +3241,24 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, | |||
3233 | &sdata->vif.bss_conf.chandef)) | 3241 | &sdata->vif.bss_conf.chandef)) |
3234 | return -EINVAL; | 3242 | return -EINVAL; |
3235 | 3243 | ||
3236 | rcu_read_lock(); | 3244 | mutex_lock(&local->chanctx_mtx); |
3237 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | 3245 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, |
3238 | if (!chanctx_conf) { | 3246 | lockdep_is_held(&local->chanctx_mtx)); |
3239 | rcu_read_unlock(); | 3247 | if (!conf) { |
3248 | mutex_unlock(&local->chanctx_mtx); | ||
3240 | return -EBUSY; | 3249 | return -EBUSY; |
3241 | } | 3250 | } |
3242 | 3251 | ||
3243 | /* don't handle for multi-VIF cases */ | 3252 | /* don't handle for multi-VIF cases */ |
3244 | chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, conf); | 3253 | chanctx = container_of(conf, struct ieee80211_chanctx, conf); |
3245 | if (chanctx->refcount > 1) { | 3254 | if (ieee80211_chanctx_refcount(local, chanctx) > 1) { |
3246 | rcu_read_unlock(); | 3255 | mutex_unlock(&local->chanctx_mtx); |
3247 | return -EBUSY; | 3256 | return -EBUSY; |
3248 | } | 3257 | } |
3249 | num_chanctx = 0; | 3258 | num_chanctx = 0; |
3250 | list_for_each_entry_rcu(chanctx, &local->chanctx_list, list) | 3259 | list_for_each_entry_rcu(chanctx, &local->chanctx_list, list) |
3251 | num_chanctx++; | 3260 | num_chanctx++; |
3252 | rcu_read_unlock(); | 3261 | mutex_unlock(&local->chanctx_mtx); |
3253 | 3262 | ||
3254 | if (num_chanctx > 1) | 3263 | if (num_chanctx > 1) |
3255 | return -EBUSY; | 3264 | return -EBUSY; |
@@ -3949,6 +3958,21 @@ static int ieee80211_set_qos_map(struct wiphy *wiphy, | |||
3949 | return 0; | 3958 | return 0; |
3950 | } | 3959 | } |
3951 | 3960 | ||
3961 | static int ieee80211_set_ap_chanwidth(struct wiphy *wiphy, | ||
3962 | struct net_device *dev, | ||
3963 | struct cfg80211_chan_def *chandef) | ||
3964 | { | ||
3965 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3966 | int ret; | ||
3967 | u32 changed = 0; | ||
3968 | |||
3969 | ret = ieee80211_vif_change_bandwidth(sdata, chandef, &changed); | ||
3970 | if (ret == 0) | ||
3971 | ieee80211_bss_info_change_notify(sdata, changed); | ||
3972 | |||
3973 | return ret; | ||
3974 | } | ||
3975 | |||
3952 | const struct cfg80211_ops mac80211_config_ops = { | 3976 | const struct cfg80211_ops mac80211_config_ops = { |
3953 | .add_virtual_intf = ieee80211_add_iface, | 3977 | .add_virtual_intf = ieee80211_add_iface, |
3954 | .del_virtual_intf = ieee80211_del_iface, | 3978 | .del_virtual_intf = ieee80211_del_iface, |
@@ -4029,4 +4053,5 @@ const struct cfg80211_ops mac80211_config_ops = { | |||
4029 | .start_radar_detection = ieee80211_start_radar_detection, | 4053 | .start_radar_detection = ieee80211_start_radar_detection, |
4030 | .channel_switch = ieee80211_channel_switch, | 4054 | .channel_switch = ieee80211_channel_switch, |
4031 | .set_qos_map = ieee80211_set_qos_map, | 4055 | .set_qos_map = ieee80211_set_qos_map, |
4056 | .set_ap_chanwidth = ieee80211_set_ap_chanwidth, | ||
4032 | }; | 4057 | }; |
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 75b5dd2c9267..48e6d6f010cd 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -9,6 +9,170 @@ | |||
9 | #include "ieee80211_i.h" | 9 | #include "ieee80211_i.h" |
10 | #include "driver-ops.h" | 10 | #include "driver-ops.h" |
11 | 11 | ||
12 | static int ieee80211_chanctx_num_assigned(struct ieee80211_local *local, | ||
13 | struct ieee80211_chanctx *ctx) | ||
14 | { | ||
15 | struct ieee80211_sub_if_data *sdata; | ||
16 | int num = 0; | ||
17 | |||
18 | lockdep_assert_held(&local->chanctx_mtx); | ||
19 | |||
20 | list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list) | ||
21 | num++; | ||
22 | |||
23 | return num; | ||
24 | } | ||
25 | |||
26 | static int ieee80211_chanctx_num_reserved(struct ieee80211_local *local, | ||
27 | struct ieee80211_chanctx *ctx) | ||
28 | { | ||
29 | struct ieee80211_sub_if_data *sdata; | ||
30 | int num = 0; | ||
31 | |||
32 | lockdep_assert_held(&local->chanctx_mtx); | ||
33 | |||
34 | list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list) | ||
35 | num++; | ||
36 | |||
37 | return num; | ||
38 | } | ||
39 | |||
40 | int ieee80211_chanctx_refcount(struct ieee80211_local *local, | ||
41 | struct ieee80211_chanctx *ctx) | ||
42 | { | ||
43 | return ieee80211_chanctx_num_assigned(local, ctx) + | ||
44 | ieee80211_chanctx_num_reserved(local, ctx); | ||
45 | } | ||
46 | |||
47 | static int ieee80211_num_chanctx(struct ieee80211_local *local) | ||
48 | { | ||
49 | struct ieee80211_chanctx *ctx; | ||
50 | int num = 0; | ||
51 | |||
52 | lockdep_assert_held(&local->chanctx_mtx); | ||
53 | |||
54 | list_for_each_entry(ctx, &local->chanctx_list, list) | ||
55 | num++; | ||
56 | |||
57 | return num; | ||
58 | } | ||
59 | |||
60 | static bool ieee80211_can_create_new_chanctx(struct ieee80211_local *local) | ||
61 | { | ||
62 | lockdep_assert_held(&local->chanctx_mtx); | ||
63 | return ieee80211_num_chanctx(local) < ieee80211_max_num_channels(local); | ||
64 | } | ||
65 | |||
66 | static const struct cfg80211_chan_def * | ||
67 | ieee80211_chanctx_reserved_chandef(struct ieee80211_local *local, | ||
68 | struct ieee80211_chanctx *ctx, | ||
69 | const struct cfg80211_chan_def *compat) | ||
70 | { | ||
71 | struct ieee80211_sub_if_data *sdata; | ||
72 | |||
73 | lockdep_assert_held(&local->chanctx_mtx); | ||
74 | |||
75 | list_for_each_entry(sdata, &ctx->reserved_vifs, | ||
76 | reserved_chanctx_list) { | ||
77 | if (!compat) | ||
78 | compat = &sdata->reserved_chandef; | ||
79 | |||
80 | compat = cfg80211_chandef_compatible(&sdata->reserved_chandef, | ||
81 | compat); | ||
82 | if (!compat) | ||
83 | break; | ||
84 | } | ||
85 | |||
86 | return compat; | ||
87 | } | ||
88 | |||
89 | static const struct cfg80211_chan_def * | ||
90 | ieee80211_chanctx_non_reserved_chandef(struct ieee80211_local *local, | ||
91 | struct ieee80211_chanctx *ctx, | ||
92 | const struct cfg80211_chan_def *compat) | ||
93 | { | ||
94 | struct ieee80211_sub_if_data *sdata; | ||
95 | |||
96 | lockdep_assert_held(&local->chanctx_mtx); | ||
97 | |||
98 | list_for_each_entry(sdata, &ctx->assigned_vifs, | ||
99 | assigned_chanctx_list) { | ||
100 | if (sdata->reserved_chanctx != NULL) | ||
101 | continue; | ||
102 | |||
103 | if (!compat) | ||
104 | compat = &sdata->vif.bss_conf.chandef; | ||
105 | |||
106 | compat = cfg80211_chandef_compatible( | ||
107 | &sdata->vif.bss_conf.chandef, compat); | ||
108 | if (!compat) | ||
109 | break; | ||
110 | } | ||
111 | |||
112 | return compat; | ||
113 | } | ||
114 | |||
115 | static const struct cfg80211_chan_def * | ||
116 | ieee80211_chanctx_combined_chandef(struct ieee80211_local *local, | ||
117 | struct ieee80211_chanctx *ctx, | ||
118 | const struct cfg80211_chan_def *compat) | ||
119 | { | ||
120 | lockdep_assert_held(&local->chanctx_mtx); | ||
121 | |||
122 | compat = ieee80211_chanctx_reserved_chandef(local, ctx, compat); | ||
123 | if (!compat) | ||
124 | return NULL; | ||
125 | |||
126 | compat = ieee80211_chanctx_non_reserved_chandef(local, ctx, compat); | ||
127 | if (!compat) | ||
128 | return NULL; | ||
129 | |||
130 | return compat; | ||
131 | } | ||
132 | |||
133 | static bool | ||
134 | ieee80211_chanctx_can_reserve_chandef(struct ieee80211_local *local, | ||
135 | struct ieee80211_chanctx *ctx, | ||
136 | const struct cfg80211_chan_def *def) | ||
137 | { | ||
138 | lockdep_assert_held(&local->chanctx_mtx); | ||
139 | |||
140 | if (ieee80211_chanctx_combined_chandef(local, ctx, def)) | ||
141 | return true; | ||
142 | |||
143 | if (!list_empty(&ctx->reserved_vifs) && | ||
144 | ieee80211_chanctx_reserved_chandef(local, ctx, def)) | ||
145 | return true; | ||
146 | |||
147 | return false; | ||
148 | } | ||
149 | |||
150 | static struct ieee80211_chanctx * | ||
151 | ieee80211_find_reservation_chanctx(struct ieee80211_local *local, | ||
152 | const struct cfg80211_chan_def *chandef, | ||
153 | enum ieee80211_chanctx_mode mode) | ||
154 | { | ||
155 | struct ieee80211_chanctx *ctx; | ||
156 | |||
157 | lockdep_assert_held(&local->chanctx_mtx); | ||
158 | |||
159 | if (mode == IEEE80211_CHANCTX_EXCLUSIVE) | ||
160 | return NULL; | ||
161 | |||
162 | list_for_each_entry(ctx, &local->chanctx_list, list) { | ||
163 | if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) | ||
164 | continue; | ||
165 | |||
166 | if (!ieee80211_chanctx_can_reserve_chandef(local, ctx, | ||
167 | chandef)) | ||
168 | continue; | ||
169 | |||
170 | return ctx; | ||
171 | } | ||
172 | |||
173 | return NULL; | ||
174 | } | ||
175 | |||
12 | static enum nl80211_chan_width ieee80211_get_sta_bw(struct ieee80211_sta *sta) | 176 | static enum nl80211_chan_width ieee80211_get_sta_bw(struct ieee80211_sta *sta) |
13 | { | 177 | { |
14 | switch (sta->bandwidth) { | 178 | switch (sta->bandwidth) { |
@@ -190,6 +354,11 @@ ieee80211_find_chanctx(struct ieee80211_local *local, | |||
190 | if (!compat) | 354 | if (!compat) |
191 | continue; | 355 | continue; |
192 | 356 | ||
357 | compat = ieee80211_chanctx_reserved_chandef(local, ctx, | ||
358 | compat); | ||
359 | if (!compat) | ||
360 | continue; | ||
361 | |||
193 | ieee80211_change_chanctx(local, ctx, compat); | 362 | ieee80211_change_chanctx(local, ctx, compat); |
194 | 363 | ||
195 | return ctx; | 364 | return ctx; |
@@ -217,62 +386,91 @@ static bool ieee80211_is_radar_required(struct ieee80211_local *local) | |||
217 | } | 386 | } |
218 | 387 | ||
219 | static struct ieee80211_chanctx * | 388 | static struct ieee80211_chanctx * |
220 | ieee80211_new_chanctx(struct ieee80211_local *local, | 389 | ieee80211_alloc_chanctx(struct ieee80211_local *local, |
221 | const struct cfg80211_chan_def *chandef, | 390 | const struct cfg80211_chan_def *chandef, |
222 | enum ieee80211_chanctx_mode mode) | 391 | enum ieee80211_chanctx_mode mode) |
223 | { | 392 | { |
224 | struct ieee80211_chanctx *ctx; | 393 | struct ieee80211_chanctx *ctx; |
225 | u32 changed; | ||
226 | int err; | ||
227 | 394 | ||
228 | lockdep_assert_held(&local->chanctx_mtx); | 395 | lockdep_assert_held(&local->chanctx_mtx); |
229 | 396 | ||
230 | ctx = kzalloc(sizeof(*ctx) + local->hw.chanctx_data_size, GFP_KERNEL); | 397 | ctx = kzalloc(sizeof(*ctx) + local->hw.chanctx_data_size, GFP_KERNEL); |
231 | if (!ctx) | 398 | if (!ctx) |
232 | return ERR_PTR(-ENOMEM); | 399 | return NULL; |
233 | 400 | ||
401 | INIT_LIST_HEAD(&ctx->assigned_vifs); | ||
402 | INIT_LIST_HEAD(&ctx->reserved_vifs); | ||
234 | ctx->conf.def = *chandef; | 403 | ctx->conf.def = *chandef; |
235 | ctx->conf.rx_chains_static = 1; | 404 | ctx->conf.rx_chains_static = 1; |
236 | ctx->conf.rx_chains_dynamic = 1; | 405 | ctx->conf.rx_chains_dynamic = 1; |
237 | ctx->mode = mode; | 406 | ctx->mode = mode; |
238 | ctx->conf.radar_enabled = ieee80211_is_radar_required(local); | 407 | ctx->conf.radar_enabled = ieee80211_is_radar_required(local); |
239 | ieee80211_recalc_chanctx_min_def(local, ctx); | 408 | ieee80211_recalc_chanctx_min_def(local, ctx); |
409 | |||
410 | return ctx; | ||
411 | } | ||
412 | |||
413 | static int ieee80211_add_chanctx(struct ieee80211_local *local, | ||
414 | struct ieee80211_chanctx *ctx) | ||
415 | { | ||
416 | u32 changed; | ||
417 | int err; | ||
418 | |||
419 | lockdep_assert_held(&local->mtx); | ||
420 | lockdep_assert_held(&local->chanctx_mtx); | ||
421 | |||
240 | if (!local->use_chanctx) | 422 | if (!local->use_chanctx) |
241 | local->hw.conf.radar_enabled = ctx->conf.radar_enabled; | 423 | local->hw.conf.radar_enabled = ctx->conf.radar_enabled; |
242 | 424 | ||
243 | /* we hold the mutex to prevent idle from changing */ | ||
244 | lockdep_assert_held(&local->mtx); | ||
245 | /* turn idle off *before* setting channel -- some drivers need that */ | 425 | /* turn idle off *before* setting channel -- some drivers need that */ |
246 | changed = ieee80211_idle_off(local); | 426 | changed = ieee80211_idle_off(local); |
247 | if (changed) | 427 | if (changed) |
248 | ieee80211_hw_config(local, changed); | 428 | ieee80211_hw_config(local, changed); |
249 | 429 | ||
250 | if (!local->use_chanctx) { | 430 | if (!local->use_chanctx) { |
251 | local->_oper_chandef = *chandef; | 431 | local->_oper_chandef = ctx->conf.def; |
252 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 432 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
253 | } else { | 433 | } else { |
254 | err = drv_add_chanctx(local, ctx); | 434 | err = drv_add_chanctx(local, ctx); |
255 | if (err) { | 435 | if (err) { |
256 | kfree(ctx); | ||
257 | ieee80211_recalc_idle(local); | 436 | ieee80211_recalc_idle(local); |
258 | return ERR_PTR(err); | 437 | return err; |
259 | } | 438 | } |
260 | } | 439 | } |
261 | 440 | ||
262 | /* and keep the mutex held until the new chanctx is on the list */ | 441 | return 0; |
263 | list_add_rcu(&ctx->list, &local->chanctx_list); | 442 | } |
443 | |||
444 | static struct ieee80211_chanctx * | ||
445 | ieee80211_new_chanctx(struct ieee80211_local *local, | ||
446 | const struct cfg80211_chan_def *chandef, | ||
447 | enum ieee80211_chanctx_mode mode) | ||
448 | { | ||
449 | struct ieee80211_chanctx *ctx; | ||
450 | int err; | ||
451 | |||
452 | lockdep_assert_held(&local->mtx); | ||
453 | lockdep_assert_held(&local->chanctx_mtx); | ||
264 | 454 | ||
455 | ctx = ieee80211_alloc_chanctx(local, chandef, mode); | ||
456 | if (!ctx) | ||
457 | return ERR_PTR(-ENOMEM); | ||
458 | |||
459 | err = ieee80211_add_chanctx(local, ctx); | ||
460 | if (err) { | ||
461 | kfree(ctx); | ||
462 | return ERR_PTR(err); | ||
463 | } | ||
464 | |||
465 | list_add_rcu(&ctx->list, &local->chanctx_list); | ||
265 | return ctx; | 466 | return ctx; |
266 | } | 467 | } |
267 | 468 | ||
268 | static void ieee80211_free_chanctx(struct ieee80211_local *local, | 469 | static void ieee80211_del_chanctx(struct ieee80211_local *local, |
269 | struct ieee80211_chanctx *ctx) | 470 | struct ieee80211_chanctx *ctx) |
270 | { | 471 | { |
271 | bool check_single_channel = false; | ||
272 | lockdep_assert_held(&local->chanctx_mtx); | 472 | lockdep_assert_held(&local->chanctx_mtx); |
273 | 473 | ||
274 | WARN_ON_ONCE(ctx->refcount != 0); | ||
275 | |||
276 | if (!local->use_chanctx) { | 474 | if (!local->use_chanctx) { |
277 | struct cfg80211_chan_def *chandef = &local->_oper_chandef; | 475 | struct cfg80211_chan_def *chandef = &local->_oper_chandef; |
278 | chandef->width = NL80211_CHAN_WIDTH_20_NOHT; | 476 | chandef->width = NL80211_CHAN_WIDTH_20_NOHT; |
@@ -282,8 +480,9 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local, | |||
282 | /* NOTE: Disabling radar is only valid here for | 480 | /* NOTE: Disabling radar is only valid here for |
283 | * single channel context. To be sure, check it ... | 481 | * single channel context. To be sure, check it ... |
284 | */ | 482 | */ |
285 | if (local->hw.conf.radar_enabled) | 483 | WARN_ON(local->hw.conf.radar_enabled && |
286 | check_single_channel = true; | 484 | !list_empty(&local->chanctx_list)); |
485 | |||
287 | local->hw.conf.radar_enabled = false; | 486 | local->hw.conf.radar_enabled = false; |
288 | 487 | ||
289 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 488 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
@@ -291,39 +490,19 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local, | |||
291 | drv_remove_chanctx(local, ctx); | 490 | drv_remove_chanctx(local, ctx); |
292 | } | 491 | } |
293 | 492 | ||
294 | list_del_rcu(&ctx->list); | ||
295 | kfree_rcu(ctx, rcu_head); | ||
296 | |||
297 | /* throw a warning if this wasn't the only channel context. */ | ||
298 | WARN_ON(check_single_channel && !list_empty(&local->chanctx_list)); | ||
299 | |||
300 | ieee80211_recalc_idle(local); | 493 | ieee80211_recalc_idle(local); |
301 | } | 494 | } |
302 | 495 | ||
303 | static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, | 496 | static void ieee80211_free_chanctx(struct ieee80211_local *local, |
304 | struct ieee80211_chanctx *ctx) | 497 | struct ieee80211_chanctx *ctx) |
305 | { | 498 | { |
306 | struct ieee80211_local *local = sdata->local; | ||
307 | int ret; | ||
308 | |||
309 | lockdep_assert_held(&local->chanctx_mtx); | 499 | lockdep_assert_held(&local->chanctx_mtx); |
310 | 500 | ||
311 | ret = drv_assign_vif_chanctx(local, sdata, ctx); | 501 | WARN_ON_ONCE(ieee80211_chanctx_refcount(local, ctx) != 0); |
312 | if (ret) | ||
313 | return ret; | ||
314 | |||
315 | rcu_assign_pointer(sdata->vif.chanctx_conf, &ctx->conf); | ||
316 | ctx->refcount++; | ||
317 | |||
318 | ieee80211_recalc_txpower(sdata); | ||
319 | ieee80211_recalc_chanctx_min_def(local, ctx); | ||
320 | sdata->vif.bss_conf.idle = false; | ||
321 | 502 | ||
322 | if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && | 503 | list_del_rcu(&ctx->list); |
323 | sdata->vif.type != NL80211_IFTYPE_MONITOR) | 504 | ieee80211_del_chanctx(local, ctx); |
324 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE); | 505 | kfree_rcu(ctx, rcu_head); |
325 | |||
326 | return 0; | ||
327 | } | 506 | } |
328 | 507 | ||
329 | static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, | 508 | static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, |
@@ -384,30 +563,58 @@ static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local, | |||
384 | drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RADAR); | 563 | drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RADAR); |
385 | } | 564 | } |
386 | 565 | ||
387 | static void ieee80211_unassign_vif_chanctx(struct ieee80211_sub_if_data *sdata, | 566 | static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, |
388 | struct ieee80211_chanctx *ctx) | 567 | struct ieee80211_chanctx *new_ctx) |
389 | { | 568 | { |
390 | struct ieee80211_local *local = sdata->local; | 569 | struct ieee80211_local *local = sdata->local; |
570 | struct ieee80211_chanctx_conf *conf; | ||
571 | struct ieee80211_chanctx *curr_ctx = NULL; | ||
572 | int ret = 0; | ||
391 | 573 | ||
392 | lockdep_assert_held(&local->chanctx_mtx); | 574 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, |
575 | lockdep_is_held(&local->chanctx_mtx)); | ||
393 | 576 | ||
394 | ctx->refcount--; | 577 | if (conf) { |
395 | rcu_assign_pointer(sdata->vif.chanctx_conf, NULL); | 578 | curr_ctx = container_of(conf, struct ieee80211_chanctx, conf); |
396 | 579 | ||
397 | sdata->vif.bss_conf.idle = true; | 580 | drv_unassign_vif_chanctx(local, sdata, curr_ctx); |
581 | conf = NULL; | ||
582 | list_del(&sdata->assigned_chanctx_list); | ||
583 | } | ||
398 | 584 | ||
399 | if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && | 585 | if (new_ctx) { |
400 | sdata->vif.type != NL80211_IFTYPE_MONITOR) | 586 | ret = drv_assign_vif_chanctx(local, sdata, new_ctx); |
401 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE); | 587 | if (ret) |
588 | goto out; | ||
402 | 589 | ||
403 | drv_unassign_vif_chanctx(local, sdata, ctx); | 590 | conf = &new_ctx->conf; |
591 | list_add(&sdata->assigned_chanctx_list, | ||
592 | &new_ctx->assigned_vifs); | ||
593 | } | ||
404 | 594 | ||
405 | if (ctx->refcount > 0) { | 595 | out: |
406 | ieee80211_recalc_chanctx_chantype(sdata->local, ctx); | 596 | rcu_assign_pointer(sdata->vif.chanctx_conf, conf); |
407 | ieee80211_recalc_smps_chanctx(local, ctx); | 597 | |
408 | ieee80211_recalc_radar_chanctx(local, ctx); | 598 | sdata->vif.bss_conf.idle = !conf; |
409 | ieee80211_recalc_chanctx_min_def(local, ctx); | 599 | |
600 | if (curr_ctx && ieee80211_chanctx_num_assigned(local, curr_ctx) > 0) { | ||
601 | ieee80211_recalc_chanctx_chantype(local, curr_ctx); | ||
602 | ieee80211_recalc_smps_chanctx(local, curr_ctx); | ||
603 | ieee80211_recalc_radar_chanctx(local, curr_ctx); | ||
604 | ieee80211_recalc_chanctx_min_def(local, curr_ctx); | ||
410 | } | 605 | } |
606 | |||
607 | if (new_ctx && ieee80211_chanctx_num_assigned(local, new_ctx) > 0) { | ||
608 | ieee80211_recalc_txpower(sdata); | ||
609 | ieee80211_recalc_chanctx_min_def(local, new_ctx); | ||
610 | } | ||
611 | |||
612 | if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && | ||
613 | sdata->vif.type != NL80211_IFTYPE_MONITOR) | ||
614 | ieee80211_bss_info_change_notify(sdata, | ||
615 | BSS_CHANGED_IDLE); | ||
616 | |||
617 | return ret; | ||
411 | } | 618 | } |
412 | 619 | ||
413 | static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata) | 620 | static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata) |
@@ -425,8 +632,11 @@ static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata) | |||
425 | 632 | ||
426 | ctx = container_of(conf, struct ieee80211_chanctx, conf); | 633 | ctx = container_of(conf, struct ieee80211_chanctx, conf); |
427 | 634 | ||
428 | ieee80211_unassign_vif_chanctx(sdata, ctx); | 635 | if (sdata->reserved_chanctx) |
429 | if (ctx->refcount == 0) | 636 | ieee80211_vif_unreserve_chanctx(sdata); |
637 | |||
638 | ieee80211_assign_vif_chanctx(sdata, NULL); | ||
639 | if (ieee80211_chanctx_refcount(local, ctx) == 0) | ||
430 | ieee80211_free_chanctx(local, ctx); | 640 | ieee80211_free_chanctx(local, ctx); |
431 | } | 641 | } |
432 | 642 | ||
@@ -526,6 +736,7 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, | |||
526 | { | 736 | { |
527 | struct ieee80211_local *local = sdata->local; | 737 | struct ieee80211_local *local = sdata->local; |
528 | struct ieee80211_chanctx *ctx; | 738 | struct ieee80211_chanctx *ctx; |
739 | u8 radar_detect_width = 0; | ||
529 | int ret; | 740 | int ret; |
530 | 741 | ||
531 | lockdep_assert_held(&local->mtx); | 742 | lockdep_assert_held(&local->mtx); |
@@ -533,6 +744,22 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, | |||
533 | WARN_ON(sdata->dev && netif_carrier_ok(sdata->dev)); | 744 | WARN_ON(sdata->dev && netif_carrier_ok(sdata->dev)); |
534 | 745 | ||
535 | mutex_lock(&local->chanctx_mtx); | 746 | mutex_lock(&local->chanctx_mtx); |
747 | |||
748 | ret = cfg80211_chandef_dfs_required(local->hw.wiphy, | ||
749 | chandef, | ||
750 | sdata->wdev.iftype); | ||
751 | if (ret < 0) | ||
752 | goto out; | ||
753 | if (ret > 0) | ||
754 | radar_detect_width = BIT(chandef->width); | ||
755 | |||
756 | sdata->radar_required = ret; | ||
757 | |||
758 | ret = ieee80211_check_combinations(sdata, chandef, mode, | ||
759 | radar_detect_width); | ||
760 | if (ret < 0) | ||
761 | goto out; | ||
762 | |||
536 | __ieee80211_vif_release_channel(sdata); | 763 | __ieee80211_vif_release_channel(sdata); |
537 | 764 | ||
538 | ctx = ieee80211_find_chanctx(local, chandef, mode); | 765 | ctx = ieee80211_find_chanctx(local, chandef, mode); |
@@ -548,7 +775,7 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, | |||
548 | ret = ieee80211_assign_vif_chanctx(sdata, ctx); | 775 | ret = ieee80211_assign_vif_chanctx(sdata, ctx); |
549 | if (ret) { | 776 | if (ret) { |
550 | /* if assign fails refcount stays the same */ | 777 | /* if assign fails refcount stays the same */ |
551 | if (ctx->refcount == 0) | 778 | if (ieee80211_chanctx_refcount(local, ctx) == 0) |
552 | ieee80211_free_chanctx(local, ctx); | 779 | ieee80211_free_chanctx(local, ctx); |
553 | goto out; | 780 | goto out; |
554 | } | 781 | } |
@@ -560,15 +787,47 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, | |||
560 | return ret; | 787 | return ret; |
561 | } | 788 | } |
562 | 789 | ||
790 | static int __ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, | ||
791 | struct ieee80211_chanctx *ctx, | ||
792 | u32 *changed) | ||
793 | { | ||
794 | struct ieee80211_local *local = sdata->local; | ||
795 | const struct cfg80211_chan_def *chandef = &sdata->csa_chandef; | ||
796 | u32 chanctx_changed = 0; | ||
797 | |||
798 | if (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, | ||
799 | IEEE80211_CHAN_DISABLED)) | ||
800 | return -EINVAL; | ||
801 | |||
802 | if (ieee80211_chanctx_refcount(local, ctx) != 1) | ||
803 | return -EINVAL; | ||
804 | |||
805 | if (sdata->vif.bss_conf.chandef.width != chandef->width) { | ||
806 | chanctx_changed = IEEE80211_CHANCTX_CHANGE_WIDTH; | ||
807 | *changed |= BSS_CHANGED_BANDWIDTH; | ||
808 | } | ||
809 | |||
810 | sdata->vif.bss_conf.chandef = *chandef; | ||
811 | ctx->conf.def = *chandef; | ||
812 | |||
813 | chanctx_changed |= IEEE80211_CHANCTX_CHANGE_CHANNEL; | ||
814 | drv_change_chanctx(local, ctx, chanctx_changed); | ||
815 | |||
816 | ieee80211_recalc_chanctx_chantype(local, ctx); | ||
817 | ieee80211_recalc_smps_chanctx(local, ctx); | ||
818 | ieee80211_recalc_radar_chanctx(local, ctx); | ||
819 | ieee80211_recalc_chanctx_min_def(local, ctx); | ||
820 | |||
821 | return 0; | ||
822 | } | ||
823 | |||
563 | int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, | 824 | int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, |
564 | u32 *changed) | 825 | u32 *changed) |
565 | { | 826 | { |
566 | struct ieee80211_local *local = sdata->local; | 827 | struct ieee80211_local *local = sdata->local; |
567 | struct ieee80211_chanctx_conf *conf; | 828 | struct ieee80211_chanctx_conf *conf; |
568 | struct ieee80211_chanctx *ctx; | 829 | struct ieee80211_chanctx *ctx; |
569 | const struct cfg80211_chan_def *chandef = &sdata->csa_chandef; | ||
570 | int ret; | 830 | int ret; |
571 | u32 chanctx_changed = 0; | ||
572 | 831 | ||
573 | lockdep_assert_held(&local->mtx); | 832 | lockdep_assert_held(&local->mtx); |
574 | 833 | ||
@@ -576,11 +835,94 @@ int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, | |||
576 | if (WARN_ON(!sdata->vif.csa_active)) | 835 | if (WARN_ON(!sdata->vif.csa_active)) |
577 | return -EINVAL; | 836 | return -EINVAL; |
578 | 837 | ||
579 | if (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, | 838 | mutex_lock(&local->chanctx_mtx); |
580 | IEEE80211_CHAN_DISABLED)) | 839 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, |
840 | lockdep_is_held(&local->chanctx_mtx)); | ||
841 | if (!conf) { | ||
842 | ret = -EINVAL; | ||
843 | goto out; | ||
844 | } | ||
845 | |||
846 | ctx = container_of(conf, struct ieee80211_chanctx, conf); | ||
847 | |||
848 | ret = __ieee80211_vif_change_channel(sdata, ctx, changed); | ||
849 | out: | ||
850 | mutex_unlock(&local->chanctx_mtx); | ||
851 | return ret; | ||
852 | } | ||
853 | |||
854 | static void | ||
855 | __ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, | ||
856 | bool clear) | ||
857 | { | ||
858 | struct ieee80211_local *local = sdata->local; | ||
859 | struct ieee80211_sub_if_data *vlan; | ||
860 | struct ieee80211_chanctx_conf *conf; | ||
861 | |||
862 | if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_AP)) | ||
863 | return; | ||
864 | |||
865 | lockdep_assert_held(&local->mtx); | ||
866 | |||
867 | /* Check that conf exists, even when clearing this function | ||
868 | * must be called with the AP's channel context still there | ||
869 | * as it would otherwise cause VLANs to have an invalid | ||
870 | * channel context pointer for a while, possibly pointing | ||
871 | * to a channel context that has already been freed. | ||
872 | */ | ||
873 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, | ||
874 | lockdep_is_held(&local->chanctx_mtx)); | ||
875 | WARN_ON(!conf); | ||
876 | |||
877 | if (clear) | ||
878 | conf = NULL; | ||
879 | |||
880 | list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) | ||
881 | rcu_assign_pointer(vlan->vif.chanctx_conf, conf); | ||
882 | } | ||
883 | |||
884 | void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, | ||
885 | bool clear) | ||
886 | { | ||
887 | struct ieee80211_local *local = sdata->local; | ||
888 | |||
889 | mutex_lock(&local->chanctx_mtx); | ||
890 | |||
891 | __ieee80211_vif_copy_chanctx_to_vlans(sdata, clear); | ||
892 | |||
893 | mutex_unlock(&local->chanctx_mtx); | ||
894 | } | ||
895 | |||
896 | int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata) | ||
897 | { | ||
898 | struct ieee80211_chanctx *ctx = sdata->reserved_chanctx; | ||
899 | |||
900 | lockdep_assert_held(&sdata->local->chanctx_mtx); | ||
901 | |||
902 | if (WARN_ON(!ctx)) | ||
581 | return -EINVAL; | 903 | return -EINVAL; |
582 | 904 | ||
905 | list_del(&sdata->reserved_chanctx_list); | ||
906 | sdata->reserved_chanctx = NULL; | ||
907 | |||
908 | if (ieee80211_chanctx_refcount(sdata->local, ctx) == 0) | ||
909 | ieee80211_free_chanctx(sdata->local, ctx); | ||
910 | |||
911 | return 0; | ||
912 | } | ||
913 | |||
914 | int ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata, | ||
915 | const struct cfg80211_chan_def *chandef, | ||
916 | enum ieee80211_chanctx_mode mode, | ||
917 | bool radar_required) | ||
918 | { | ||
919 | struct ieee80211_local *local = sdata->local; | ||
920 | struct ieee80211_chanctx_conf *conf; | ||
921 | struct ieee80211_chanctx *new_ctx, *curr_ctx; | ||
922 | int ret = 0; | ||
923 | |||
583 | mutex_lock(&local->chanctx_mtx); | 924 | mutex_lock(&local->chanctx_mtx); |
925 | |||
584 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, | 926 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, |
585 | lockdep_is_held(&local->chanctx_mtx)); | 927 | lockdep_is_held(&local->chanctx_mtx)); |
586 | if (!conf) { | 928 | if (!conf) { |
@@ -588,30 +930,108 @@ int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, | |||
588 | goto out; | 930 | goto out; |
589 | } | 931 | } |
590 | 932 | ||
591 | ctx = container_of(conf, struct ieee80211_chanctx, conf); | 933 | curr_ctx = container_of(conf, struct ieee80211_chanctx, conf); |
592 | if (ctx->refcount != 1) { | 934 | |
935 | new_ctx = ieee80211_find_reservation_chanctx(local, chandef, mode); | ||
936 | if (!new_ctx) { | ||
937 | if (ieee80211_chanctx_refcount(local, curr_ctx) == 1 && | ||
938 | (local->hw.flags & IEEE80211_HW_CHANGE_RUNNING_CHANCTX)) { | ||
939 | /* if we're the only users of the chanctx and | ||
940 | * the driver supports changing a running | ||
941 | * context, reserve our current context | ||
942 | */ | ||
943 | new_ctx = curr_ctx; | ||
944 | } else if (ieee80211_can_create_new_chanctx(local)) { | ||
945 | /* create a new context and reserve it */ | ||
946 | new_ctx = ieee80211_new_chanctx(local, chandef, mode); | ||
947 | if (IS_ERR(new_ctx)) { | ||
948 | ret = PTR_ERR(new_ctx); | ||
949 | goto out; | ||
950 | } | ||
951 | } else { | ||
952 | ret = -EBUSY; | ||
953 | goto out; | ||
954 | } | ||
955 | } | ||
956 | |||
957 | list_add(&sdata->reserved_chanctx_list, &new_ctx->reserved_vifs); | ||
958 | sdata->reserved_chanctx = new_ctx; | ||
959 | sdata->reserved_chandef = *chandef; | ||
960 | sdata->reserved_radar_required = radar_required; | ||
961 | out: | ||
962 | mutex_unlock(&local->chanctx_mtx); | ||
963 | return ret; | ||
964 | } | ||
965 | |||
966 | int ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata, | ||
967 | u32 *changed) | ||
968 | { | ||
969 | struct ieee80211_local *local = sdata->local; | ||
970 | struct ieee80211_chanctx *ctx; | ||
971 | struct ieee80211_chanctx *old_ctx; | ||
972 | struct ieee80211_chanctx_conf *conf; | ||
973 | int ret; | ||
974 | u32 tmp_changed = *changed; | ||
975 | |||
976 | /* TODO: need to recheck if the chandef is usable etc.? */ | ||
977 | |||
978 | lockdep_assert_held(&local->mtx); | ||
979 | |||
980 | mutex_lock(&local->chanctx_mtx); | ||
981 | |||
982 | ctx = sdata->reserved_chanctx; | ||
983 | if (WARN_ON(!ctx)) { | ||
593 | ret = -EINVAL; | 984 | ret = -EINVAL; |
594 | goto out; | 985 | goto out; |
595 | } | 986 | } |
596 | 987 | ||
597 | if (sdata->vif.bss_conf.chandef.width != chandef->width) { | 988 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, |
598 | chanctx_changed = IEEE80211_CHANCTX_CHANGE_WIDTH; | 989 | lockdep_is_held(&local->chanctx_mtx)); |
599 | *changed |= BSS_CHANGED_BANDWIDTH; | 990 | if (!conf) { |
991 | ret = -EINVAL; | ||
992 | goto out; | ||
600 | } | 993 | } |
601 | 994 | ||
602 | sdata->vif.bss_conf.chandef = *chandef; | 995 | old_ctx = container_of(conf, struct ieee80211_chanctx, conf); |
603 | ctx->conf.def = *chandef; | ||
604 | 996 | ||
605 | chanctx_changed |= IEEE80211_CHANCTX_CHANGE_CHANNEL; | 997 | if (sdata->vif.bss_conf.chandef.width != sdata->reserved_chandef.width) |
606 | drv_change_chanctx(local, ctx, chanctx_changed); | 998 | tmp_changed |= BSS_CHANGED_BANDWIDTH; |
999 | |||
1000 | sdata->vif.bss_conf.chandef = sdata->reserved_chandef; | ||
1001 | |||
1002 | /* unref our reservation */ | ||
1003 | sdata->reserved_chanctx = NULL; | ||
1004 | sdata->radar_required = sdata->reserved_radar_required; | ||
1005 | list_del(&sdata->reserved_chanctx_list); | ||
1006 | |||
1007 | if (old_ctx == ctx) { | ||
1008 | /* This is our own context, just change it */ | ||
1009 | ret = __ieee80211_vif_change_channel(sdata, old_ctx, | ||
1010 | &tmp_changed); | ||
1011 | if (ret) | ||
1012 | goto out; | ||
1013 | } else { | ||
1014 | ret = ieee80211_assign_vif_chanctx(sdata, ctx); | ||
1015 | if (ieee80211_chanctx_refcount(local, old_ctx) == 0) | ||
1016 | ieee80211_free_chanctx(local, old_ctx); | ||
1017 | if (ret) { | ||
1018 | /* if assign fails refcount stays the same */ | ||
1019 | if (ieee80211_chanctx_refcount(local, ctx) == 0) | ||
1020 | ieee80211_free_chanctx(local, ctx); | ||
1021 | goto out; | ||
1022 | } | ||
1023 | |||
1024 | if (sdata->vif.type == NL80211_IFTYPE_AP) | ||
1025 | __ieee80211_vif_copy_chanctx_to_vlans(sdata, false); | ||
1026 | } | ||
1027 | |||
1028 | *changed = tmp_changed; | ||
607 | 1029 | ||
608 | ieee80211_recalc_chanctx_chantype(local, ctx); | 1030 | ieee80211_recalc_chanctx_chantype(local, ctx); |
609 | ieee80211_recalc_smps_chanctx(local, ctx); | 1031 | ieee80211_recalc_smps_chanctx(local, ctx); |
610 | ieee80211_recalc_radar_chanctx(local, ctx); | 1032 | ieee80211_recalc_radar_chanctx(local, ctx); |
611 | ieee80211_recalc_chanctx_min_def(local, ctx); | 1033 | ieee80211_recalc_chanctx_min_def(local, ctx); |
612 | 1034 | out: | |
613 | ret = 0; | ||
614 | out: | ||
615 | mutex_unlock(&local->chanctx_mtx); | 1035 | mutex_unlock(&local->chanctx_mtx); |
616 | return ret; | 1036 | return ret; |
617 | } | 1037 | } |
@@ -695,40 +1115,6 @@ void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata) | |||
695 | mutex_unlock(&local->chanctx_mtx); | 1115 | mutex_unlock(&local->chanctx_mtx); |
696 | } | 1116 | } |
697 | 1117 | ||
698 | void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, | ||
699 | bool clear) | ||
700 | { | ||
701 | struct ieee80211_local *local = sdata->local; | ||
702 | struct ieee80211_sub_if_data *vlan; | ||
703 | struct ieee80211_chanctx_conf *conf; | ||
704 | |||
705 | ASSERT_RTNL(); | ||
706 | |||
707 | if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_AP)) | ||
708 | return; | ||
709 | |||
710 | mutex_lock(&local->chanctx_mtx); | ||
711 | |||
712 | /* | ||
713 | * Check that conf exists, even when clearing this function | ||
714 | * must be called with the AP's channel context still there | ||
715 | * as it would otherwise cause VLANs to have an invalid | ||
716 | * channel context pointer for a while, possibly pointing | ||
717 | * to a channel context that has already been freed. | ||
718 | */ | ||
719 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, | ||
720 | lockdep_is_held(&local->chanctx_mtx)); | ||
721 | WARN_ON(!conf); | ||
722 | |||
723 | if (clear) | ||
724 | conf = NULL; | ||
725 | |||
726 | list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) | ||
727 | rcu_assign_pointer(vlan->vif.chanctx_conf, conf); | ||
728 | |||
729 | mutex_unlock(&local->chanctx_mtx); | ||
730 | } | ||
731 | |||
732 | void ieee80211_iter_chan_contexts_atomic( | 1118 | void ieee80211_iter_chan_contexts_atomic( |
733 | struct ieee80211_hw *hw, | 1119 | struct ieee80211_hw *hw, |
734 | void (*iter)(struct ieee80211_hw *hw, | 1120 | void (*iter)(struct ieee80211_hw *hw, |
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index fa16e54980a1..0e963bc1ceac 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -128,7 +128,7 @@ static ssize_t sta_tx_latency_stat_write(struct file *file, | |||
128 | if (!strcmp(buf, TX_LATENCY_DISABLED)) { | 128 | if (!strcmp(buf, TX_LATENCY_DISABLED)) { |
129 | if (!tx_latency) | 129 | if (!tx_latency) |
130 | goto unlock; | 130 | goto unlock; |
131 | rcu_assign_pointer(local->tx_latency, NULL); | 131 | RCU_INIT_POINTER(local->tx_latency, NULL); |
132 | synchronize_rcu(); | 132 | synchronize_rcu(); |
133 | kfree(tx_latency); | 133 | kfree(tx_latency); |
134 | goto unlock; | 134 | goto unlock; |
diff --git a/net/mac80211/debugfs.h b/net/mac80211/debugfs.h index 214ed4ecd739..60c35afee29d 100644 --- a/net/mac80211/debugfs.h +++ b/net/mac80211/debugfs.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __MAC80211_DEBUGFS_H | 1 | #ifndef __MAC80211_DEBUGFS_H |
2 | #define __MAC80211_DEBUGFS_H | 2 | #define __MAC80211_DEBUGFS_H |
3 | 3 | ||
4 | #include "ieee80211_i.h" | ||
5 | |||
4 | #ifdef CONFIG_MAC80211_DEBUGFS | 6 | #ifdef CONFIG_MAC80211_DEBUGFS |
5 | void debugfs_hw_add(struct ieee80211_local *local); | 7 | void debugfs_hw_add(struct ieee80211_local *local); |
6 | int __printf(4, 5) mac80211_format_buffer(char __user *userbuf, size_t count, | 8 | int __printf(4, 5) mac80211_format_buffer(char __user *userbuf, size_t count, |
diff --git a/net/mac80211/debugfs_netdev.h b/net/mac80211/debugfs_netdev.h index 79025e79f4d6..9f5501a9a795 100644 --- a/net/mac80211/debugfs_netdev.h +++ b/net/mac80211/debugfs_netdev.h | |||
@@ -3,6 +3,8 @@ | |||
3 | #ifndef __IEEE80211_DEBUGFS_NETDEV_H | 3 | #ifndef __IEEE80211_DEBUGFS_NETDEV_H |
4 | #define __IEEE80211_DEBUGFS_NETDEV_H | 4 | #define __IEEE80211_DEBUGFS_NETDEV_H |
5 | 5 | ||
6 | #include "ieee80211_i.h" | ||
7 | |||
6 | #ifdef CONFIG_MAC80211_DEBUGFS | 8 | #ifdef CONFIG_MAC80211_DEBUGFS |
7 | void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata); | 9 | void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata); |
8 | void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata); | 10 | void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata); |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index fc689f5d971e..5331582a2c81 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -726,13 +726,19 @@ static inline void drv_rfkill_poll(struct ieee80211_local *local) | |||
726 | } | 726 | } |
727 | 727 | ||
728 | static inline void drv_flush(struct ieee80211_local *local, | 728 | static inline void drv_flush(struct ieee80211_local *local, |
729 | struct ieee80211_sub_if_data *sdata, | ||
729 | u32 queues, bool drop) | 730 | u32 queues, bool drop) |
730 | { | 731 | { |
732 | struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL; | ||
733 | |||
731 | might_sleep(); | 734 | might_sleep(); |
732 | 735 | ||
736 | if (sdata) | ||
737 | check_sdata_in_driver(sdata); | ||
738 | |||
733 | trace_drv_flush(local, queues, drop); | 739 | trace_drv_flush(local, queues, drop); |
734 | if (local->ops->flush) | 740 | if (local->ops->flush) |
735 | local->ops->flush(&local->hw, queues, drop); | 741 | local->ops->flush(&local->hw, vif, queues, drop); |
736 | trace_drv_return_void(local); | 742 | trace_drv_return_void(local); |
737 | } | 743 | } |
738 | 744 | ||
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index c150b68436d7..15702ff64a4c 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -31,6 +31,18 @@ static void __check_htcap_disable(struct ieee80211_ht_cap *ht_capa, | |||
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | static void __check_htcap_enable(struct ieee80211_ht_cap *ht_capa, | ||
35 | struct ieee80211_ht_cap *ht_capa_mask, | ||
36 | struct ieee80211_sta_ht_cap *ht_cap, | ||
37 | u16 flag) | ||
38 | { | ||
39 | __le16 le_flag = cpu_to_le16(flag); | ||
40 | |||
41 | if ((ht_capa_mask->cap_info & le_flag) && | ||
42 | (ht_capa->cap_info & le_flag)) | ||
43 | ht_cap->cap |= flag; | ||
44 | } | ||
45 | |||
34 | void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, | 46 | void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, |
35 | struct ieee80211_sta_ht_cap *ht_cap) | 47 | struct ieee80211_sta_ht_cap *ht_cap) |
36 | { | 48 | { |
@@ -59,7 +71,7 @@ void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, | |||
59 | smask = (u8 *)(&ht_capa_mask->mcs.rx_mask); | 71 | smask = (u8 *)(&ht_capa_mask->mcs.rx_mask); |
60 | 72 | ||
61 | /* NOTE: If you add more over-rides here, update register_hw | 73 | /* NOTE: If you add more over-rides here, update register_hw |
62 | * ht_capa_mod_msk logic in main.c as well. | 74 | * ht_capa_mod_mask logic in main.c as well. |
63 | * And, if this method can ever change ht_cap.ht_supported, fix | 75 | * And, if this method can ever change ht_cap.ht_supported, fix |
64 | * the check in ieee80211_add_ht_ie. | 76 | * the check in ieee80211_add_ht_ie. |
65 | */ | 77 | */ |
@@ -86,6 +98,14 @@ void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, | |||
86 | __check_htcap_disable(ht_capa, ht_capa_mask, ht_cap, | 98 | __check_htcap_disable(ht_capa, ht_capa_mask, ht_cap, |
87 | IEEE80211_HT_CAP_MAX_AMSDU); | 99 | IEEE80211_HT_CAP_MAX_AMSDU); |
88 | 100 | ||
101 | /* Allow user to disable LDPC */ | ||
102 | __check_htcap_disable(ht_capa, ht_capa_mask, ht_cap, | ||
103 | IEEE80211_HT_CAP_LDPC_CODING); | ||
104 | |||
105 | /* Allow user to enable 40 MHz intolerant bit. */ | ||
106 | __check_htcap_enable(ht_capa, ht_capa_mask, ht_cap, | ||
107 | IEEE80211_HT_CAP_40MHZ_INTOLERANT); | ||
108 | |||
89 | /* Allow user to decrease AMPDU factor */ | 109 | /* Allow user to decrease AMPDU factor */ |
90 | if (ht_capa_mask->ampdu_params_info & | 110 | if (ht_capa_mask->ampdu_params_info & |
91 | IEEE80211_HT_AMPDU_PARM_FACTOR) { | 111 | IEEE80211_HT_AMPDU_PARM_FACTOR) { |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 06d28787945b..ff4d4155a84d 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -228,7 +228,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
228 | struct beacon_data *presp; | 228 | struct beacon_data *presp; |
229 | enum nl80211_bss_scan_width scan_width; | 229 | enum nl80211_bss_scan_width scan_width; |
230 | bool have_higher_than_11mbit; | 230 | bool have_higher_than_11mbit; |
231 | bool radar_required = false; | 231 | bool radar_required; |
232 | int err; | 232 | int err; |
233 | 233 | ||
234 | sdata_assert_lock(sdata); | 234 | sdata_assert_lock(sdata); |
@@ -253,7 +253,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
253 | 253 | ||
254 | presp = rcu_dereference_protected(ifibss->presp, | 254 | presp = rcu_dereference_protected(ifibss->presp, |
255 | lockdep_is_held(&sdata->wdev.mtx)); | 255 | lockdep_is_held(&sdata->wdev.mtx)); |
256 | rcu_assign_pointer(ifibss->presp, NULL); | 256 | RCU_INIT_POINTER(ifibss->presp, NULL); |
257 | if (presp) | 257 | if (presp) |
258 | kfree_rcu(presp, rcu_head); | 258 | kfree_rcu(presp, rcu_head); |
259 | 259 | ||
@@ -262,7 +262,8 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
262 | /* make a copy of the chandef, it could be modified below. */ | 262 | /* make a copy of the chandef, it could be modified below. */ |
263 | chandef = *req_chandef; | 263 | chandef = *req_chandef; |
264 | chan = chandef.chan; | 264 | chan = chandef.chan; |
265 | if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) { | 265 | if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef, |
266 | NL80211_IFTYPE_ADHOC)) { | ||
266 | if (chandef.width == NL80211_CHAN_WIDTH_5 || | 267 | if (chandef.width == NL80211_CHAN_WIDTH_5 || |
267 | chandef.width == NL80211_CHAN_WIDTH_10 || | 268 | chandef.width == NL80211_CHAN_WIDTH_10 || |
268 | chandef.width == NL80211_CHAN_WIDTH_20_NOHT || | 269 | chandef.width == NL80211_CHAN_WIDTH_20_NOHT || |
@@ -274,7 +275,8 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
274 | chandef.width = NL80211_CHAN_WIDTH_20; | 275 | chandef.width = NL80211_CHAN_WIDTH_20; |
275 | chandef.center_freq1 = chan->center_freq; | 276 | chandef.center_freq1 = chan->center_freq; |
276 | /* check again for downgraded chandef */ | 277 | /* check again for downgraded chandef */ |
277 | if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) { | 278 | if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef, |
279 | NL80211_IFTYPE_ADHOC)) { | ||
278 | sdata_info(sdata, | 280 | sdata_info(sdata, |
279 | "Failed to join IBSS, beacons forbidden\n"); | 281 | "Failed to join IBSS, beacons forbidden\n"); |
280 | return; | 282 | return; |
@@ -282,21 +284,20 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
282 | } | 284 | } |
283 | 285 | ||
284 | err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, | 286 | err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, |
285 | &chandef); | 287 | &chandef, NL80211_IFTYPE_ADHOC); |
286 | if (err < 0) { | 288 | if (err < 0) { |
287 | sdata_info(sdata, | 289 | sdata_info(sdata, |
288 | "Failed to join IBSS, invalid chandef\n"); | 290 | "Failed to join IBSS, invalid chandef\n"); |
289 | return; | 291 | return; |
290 | } | 292 | } |
291 | if (err > 0) { | 293 | if (err > 0 && !ifibss->userspace_handles_dfs) { |
292 | if (!ifibss->userspace_handles_dfs) { | 294 | sdata_info(sdata, |
293 | sdata_info(sdata, | 295 | "Failed to join IBSS, DFS channel without control program\n"); |
294 | "Failed to join IBSS, DFS channel without control program\n"); | 296 | return; |
295 | return; | ||
296 | } | ||
297 | radar_required = true; | ||
298 | } | 297 | } |
299 | 298 | ||
299 | radar_required = err; | ||
300 | |||
300 | mutex_lock(&local->mtx); | 301 | mutex_lock(&local->mtx); |
301 | if (ieee80211_vif_use_channel(sdata, &chandef, | 302 | if (ieee80211_vif_use_channel(sdata, &chandef, |
302 | ifibss->fixed_channel ? | 303 | ifibss->fixed_channel ? |
@@ -775,7 +776,8 @@ static void ieee80211_ibss_csa_mark_radar(struct ieee80211_sub_if_data *sdata) | |||
775 | * unavailable. | 776 | * unavailable. |
776 | */ | 777 | */ |
777 | err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, | 778 | err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, |
778 | &ifibss->chandef); | 779 | &ifibss->chandef, |
780 | NL80211_IFTYPE_ADHOC); | ||
779 | if (err > 0) | 781 | if (err > 0) |
780 | cfg80211_radar_event(sdata->local->hw.wiphy, &ifibss->chandef, | 782 | cfg80211_radar_event(sdata->local->hw.wiphy, &ifibss->chandef, |
781 | GFP_ATOMIC); | 783 | GFP_ATOMIC); |
@@ -861,7 +863,8 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
861 | goto disconnect; | 863 | goto disconnect; |
862 | } | 864 | } |
863 | 865 | ||
864 | if (!cfg80211_reg_can_beacon(sdata->local->hw.wiphy, ¶ms.chandef)) { | 866 | if (!cfg80211_reg_can_beacon(sdata->local->hw.wiphy, ¶ms.chandef, |
867 | NL80211_IFTYPE_ADHOC)) { | ||
865 | sdata_info(sdata, | 868 | sdata_info(sdata, |
866 | "IBSS %pM switches to unsupported channel (%d MHz, width:%d, CF1/2: %d/%d MHz), disconnecting\n", | 869 | "IBSS %pM switches to unsupported channel (%d MHz, width:%d, CF1/2: %d/%d MHz), disconnecting\n", |
867 | ifibss->bssid, | 870 | ifibss->bssid, |
@@ -873,17 +876,17 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
873 | } | 876 | } |
874 | 877 | ||
875 | err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, | 878 | err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, |
876 | ¶ms.chandef); | 879 | ¶ms.chandef, |
880 | NL80211_IFTYPE_ADHOC); | ||
877 | if (err < 0) | 881 | if (err < 0) |
878 | goto disconnect; | 882 | goto disconnect; |
879 | if (err) { | 883 | if (err > 0 && !ifibss->userspace_handles_dfs) { |
880 | /* IBSS-DFS only allowed with a control program */ | 884 | /* IBSS-DFS only allowed with a control program */ |
881 | if (!ifibss->userspace_handles_dfs) | 885 | goto disconnect; |
882 | goto disconnect; | ||
883 | |||
884 | params.radar_required = true; | ||
885 | } | 886 | } |
886 | 887 | ||
888 | params.radar_required = err; | ||
889 | |||
887 | if (cfg80211_chandef_identical(¶ms.chandef, | 890 | if (cfg80211_chandef_identical(¶ms.chandef, |
888 | &sdata->vif.bss_conf.chandef)) { | 891 | &sdata->vif.bss_conf.chandef)) { |
889 | ibss_dbg(sdata, | 892 | ibss_dbg(sdata, |
@@ -1636,7 +1639,33 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1636 | u32 changed = 0; | 1639 | u32 changed = 0; |
1637 | u32 rate_flags; | 1640 | u32 rate_flags; |
1638 | struct ieee80211_supported_band *sband; | 1641 | struct ieee80211_supported_band *sband; |
1642 | enum ieee80211_chanctx_mode chanmode; | ||
1643 | struct ieee80211_local *local = sdata->local; | ||
1644 | int radar_detect_width = 0; | ||
1639 | int i; | 1645 | int i; |
1646 | int ret; | ||
1647 | |||
1648 | ret = cfg80211_chandef_dfs_required(local->hw.wiphy, | ||
1649 | ¶ms->chandef, | ||
1650 | sdata->wdev.iftype); | ||
1651 | if (ret < 0) | ||
1652 | return ret; | ||
1653 | |||
1654 | if (ret > 0) { | ||
1655 | if (!params->userspace_handles_dfs) | ||
1656 | return -EINVAL; | ||
1657 | radar_detect_width = BIT(params->chandef.width); | ||
1658 | } | ||
1659 | |||
1660 | chanmode = (params->channel_fixed && !ret) ? | ||
1661 | IEEE80211_CHANCTX_SHARED : IEEE80211_CHANCTX_EXCLUSIVE; | ||
1662 | |||
1663 | mutex_lock(&local->chanctx_mtx); | ||
1664 | ret = ieee80211_check_combinations(sdata, ¶ms->chandef, chanmode, | ||
1665 | radar_detect_width); | ||
1666 | mutex_unlock(&local->chanctx_mtx); | ||
1667 | if (ret < 0) | ||
1668 | return ret; | ||
1640 | 1669 | ||
1641 | if (params->bssid) { | 1670 | if (params->bssid) { |
1642 | memcpy(sdata->u.ibss.bssid, params->bssid, ETH_ALEN); | 1671 | memcpy(sdata->u.ibss.bssid, params->bssid, ETH_ALEN); |
@@ -1651,7 +1680,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1651 | 1680 | ||
1652 | /* fix basic_rates if channel does not support these rates */ | 1681 | /* fix basic_rates if channel does not support these rates */ |
1653 | rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef); | 1682 | rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef); |
1654 | sband = sdata->local->hw.wiphy->bands[params->chandef.chan->band]; | 1683 | sband = local->hw.wiphy->bands[params->chandef.chan->band]; |
1655 | for (i = 0; i < sband->n_bitrates; i++) { | 1684 | for (i = 0; i < sband->n_bitrates; i++) { |
1656 | if ((rate_flags & sband->bitrates[i].flags) != rate_flags) | 1685 | if ((rate_flags & sband->bitrates[i].flags) != rate_flags) |
1657 | sdata->u.ibss.basic_rates &= ~BIT(i); | 1686 | sdata->u.ibss.basic_rates &= ~BIT(i); |
@@ -1700,9 +1729,9 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1700 | ieee80211_bss_info_change_notify(sdata, changed); | 1729 | ieee80211_bss_info_change_notify(sdata, changed); |
1701 | 1730 | ||
1702 | sdata->smps_mode = IEEE80211_SMPS_OFF; | 1731 | sdata->smps_mode = IEEE80211_SMPS_OFF; |
1703 | sdata->needed_rx_chains = sdata->local->rx_chains; | 1732 | sdata->needed_rx_chains = local->rx_chains; |
1704 | 1733 | ||
1705 | ieee80211_queue_work(&sdata->local->hw, &sdata->work); | 1734 | ieee80211_queue_work(&local->hw, &sdata->work); |
1706 | 1735 | ||
1707 | return 0; | 1736 | return 0; |
1708 | } | 1737 | } |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 222c28b75315..b455f62d357a 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -260,7 +260,7 @@ struct ieee80211_if_ap { | |||
260 | 260 | ||
261 | /* to be used after channel switch. */ | 261 | /* to be used after channel switch. */ |
262 | struct cfg80211_beacon_data *next_beacon; | 262 | struct cfg80211_beacon_data *next_beacon; |
263 | struct list_head vlans; | 263 | struct list_head vlans; /* write-protected with RTNL and local->mtx */ |
264 | 264 | ||
265 | struct ps_data ps; | 265 | struct ps_data ps; |
266 | atomic_t num_mcast_sta; /* number of stations receiving multicast */ | 266 | atomic_t num_mcast_sta; /* number of stations receiving multicast */ |
@@ -276,7 +276,7 @@ struct ieee80211_if_wds { | |||
276 | }; | 276 | }; |
277 | 277 | ||
278 | struct ieee80211_if_vlan { | 278 | struct ieee80211_if_vlan { |
279 | struct list_head list; | 279 | struct list_head list; /* write-protected with RTNL and local->mtx */ |
280 | 280 | ||
281 | /* used for all tx if the VLAN is configured to 4-addr mode */ | 281 | /* used for all tx if the VLAN is configured to 4-addr mode */ |
282 | struct sta_info __rcu *sta; | 282 | struct sta_info __rcu *sta; |
@@ -691,8 +691,10 @@ struct ieee80211_chanctx { | |||
691 | struct list_head list; | 691 | struct list_head list; |
692 | struct rcu_head rcu_head; | 692 | struct rcu_head rcu_head; |
693 | 693 | ||
694 | struct list_head assigned_vifs; | ||
695 | struct list_head reserved_vifs; | ||
696 | |||
694 | enum ieee80211_chanctx_mode mode; | 697 | enum ieee80211_chanctx_mode mode; |
695 | int refcount; | ||
696 | bool driver_present; | 698 | bool driver_present; |
697 | 699 | ||
698 | struct ieee80211_chanctx_conf conf; | 700 | struct ieee80211_chanctx_conf conf; |
@@ -756,6 +758,14 @@ struct ieee80211_sub_if_data { | |||
756 | bool csa_radar_required; | 758 | bool csa_radar_required; |
757 | struct cfg80211_chan_def csa_chandef; | 759 | struct cfg80211_chan_def csa_chandef; |
758 | 760 | ||
761 | struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ | ||
762 | struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ | ||
763 | |||
764 | /* context reservation -- protected with chanctx_mtx */ | ||
765 | struct ieee80211_chanctx *reserved_chanctx; | ||
766 | struct cfg80211_chan_def reserved_chandef; | ||
767 | bool reserved_radar_required; | ||
768 | |||
759 | /* used to reconfigure hardware SM PS */ | 769 | /* used to reconfigure hardware SM PS */ |
760 | struct work_struct recalc_smps; | 770 | struct work_struct recalc_smps; |
761 | 771 | ||
@@ -1771,6 +1781,16 @@ ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, | |||
1771 | const struct cfg80211_chan_def *chandef, | 1781 | const struct cfg80211_chan_def *chandef, |
1772 | enum ieee80211_chanctx_mode mode); | 1782 | enum ieee80211_chanctx_mode mode); |
1773 | int __must_check | 1783 | int __must_check |
1784 | ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata, | ||
1785 | const struct cfg80211_chan_def *chandef, | ||
1786 | enum ieee80211_chanctx_mode mode, | ||
1787 | bool radar_required); | ||
1788 | int __must_check | ||
1789 | ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata, | ||
1790 | u32 *changed); | ||
1791 | int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata); | ||
1792 | |||
1793 | int __must_check | ||
1774 | ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata, | 1794 | ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata, |
1775 | const struct cfg80211_chan_def *chandef, | 1795 | const struct cfg80211_chan_def *chandef, |
1776 | u32 *changed); | 1796 | u32 *changed); |
@@ -1782,6 +1802,8 @@ void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata); | |||
1782 | void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata); | 1802 | void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata); |
1783 | void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, | 1803 | void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, |
1784 | bool clear); | 1804 | bool clear); |
1805 | int ieee80211_chanctx_refcount(struct ieee80211_local *local, | ||
1806 | struct ieee80211_chanctx *ctx); | ||
1785 | 1807 | ||
1786 | void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, | 1808 | void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, |
1787 | struct ieee80211_chanctx *chanctx); | 1809 | struct ieee80211_chanctx *chanctx); |
@@ -1805,6 +1827,11 @@ int ieee80211_cs_headroom(struct ieee80211_local *local, | |||
1805 | enum nl80211_iftype iftype); | 1827 | enum nl80211_iftype iftype); |
1806 | void ieee80211_recalc_dtim(struct ieee80211_local *local, | 1828 | void ieee80211_recalc_dtim(struct ieee80211_local *local, |
1807 | struct ieee80211_sub_if_data *sdata); | 1829 | struct ieee80211_sub_if_data *sdata); |
1830 | int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, | ||
1831 | const struct cfg80211_chan_def *chandef, | ||
1832 | enum ieee80211_chanctx_mode chanmode, | ||
1833 | u8 radar_detect); | ||
1834 | int ieee80211_max_num_channels(struct ieee80211_local *local); | ||
1808 | 1835 | ||
1809 | #ifdef CONFIG_MAC80211_NOINLINE | 1836 | #ifdef CONFIG_MAC80211_NOINLINE |
1810 | #define debug_noinline noinline | 1837 | #define debug_noinline noinline |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index b8d331e7d883..7fff3dcaac43 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -250,6 +250,7 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, | |||
250 | { | 250 | { |
251 | struct ieee80211_local *local = sdata->local; | 251 | struct ieee80211_local *local = sdata->local; |
252 | struct ieee80211_sub_if_data *nsdata; | 252 | struct ieee80211_sub_if_data *nsdata; |
253 | int ret; | ||
253 | 254 | ||
254 | ASSERT_RTNL(); | 255 | ASSERT_RTNL(); |
255 | 256 | ||
@@ -300,7 +301,10 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, | |||
300 | } | 301 | } |
301 | } | 302 | } |
302 | 303 | ||
303 | return 0; | 304 | mutex_lock(&local->chanctx_mtx); |
305 | ret = ieee80211_check_combinations(sdata, NULL, 0, 0); | ||
306 | mutex_unlock(&local->chanctx_mtx); | ||
307 | return ret; | ||
304 | } | 308 | } |
305 | 309 | ||
306 | static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata, | 310 | static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata, |
@@ -423,7 +427,7 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local) | |||
423 | mutex_unlock(&local->mtx); | 427 | mutex_unlock(&local->mtx); |
424 | if (ret) { | 428 | if (ret) { |
425 | mutex_lock(&local->iflist_mtx); | 429 | mutex_lock(&local->iflist_mtx); |
426 | rcu_assign_pointer(local->monitor_sdata, NULL); | 430 | RCU_INIT_POINTER(local->monitor_sdata, NULL); |
427 | mutex_unlock(&local->iflist_mtx); | 431 | mutex_unlock(&local->iflist_mtx); |
428 | synchronize_net(); | 432 | synchronize_net(); |
429 | drv_remove_interface(local, sdata); | 433 | drv_remove_interface(local, sdata); |
@@ -452,7 +456,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local) | |||
452 | return; | 456 | return; |
453 | } | 457 | } |
454 | 458 | ||
455 | rcu_assign_pointer(local->monitor_sdata, NULL); | 459 | RCU_INIT_POINTER(local->monitor_sdata, NULL); |
456 | mutex_unlock(&local->iflist_mtx); | 460 | mutex_unlock(&local->iflist_mtx); |
457 | 461 | ||
458 | synchronize_net(); | 462 | synchronize_net(); |
@@ -492,7 +496,9 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) | |||
492 | if (!sdata->bss) | 496 | if (!sdata->bss) |
493 | return -ENOLINK; | 497 | return -ENOLINK; |
494 | 498 | ||
499 | mutex_lock(&local->mtx); | ||
495 | list_add(&sdata->u.vlan.list, &sdata->bss->vlans); | 500 | list_add(&sdata->u.vlan.list, &sdata->bss->vlans); |
501 | mutex_unlock(&local->mtx); | ||
496 | 502 | ||
497 | master = container_of(sdata->bss, | 503 | master = container_of(sdata->bss, |
498 | struct ieee80211_sub_if_data, u.ap); | 504 | struct ieee80211_sub_if_data, u.ap); |
@@ -722,8 +728,11 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) | |||
722 | drv_stop(local); | 728 | drv_stop(local); |
723 | err_del_bss: | 729 | err_del_bss: |
724 | sdata->bss = NULL; | 730 | sdata->bss = NULL; |
725 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 731 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { |
732 | mutex_lock(&local->mtx); | ||
726 | list_del(&sdata->u.vlan.list); | 733 | list_del(&sdata->u.vlan.list); |
734 | mutex_unlock(&local->mtx); | ||
735 | } | ||
727 | /* might already be clear but that doesn't matter */ | 736 | /* might already be clear but that doesn't matter */ |
728 | clear_bit(SDATA_STATE_RUNNING, &sdata->state); | 737 | clear_bit(SDATA_STATE_RUNNING, &sdata->state); |
729 | return res; | 738 | return res; |
@@ -875,8 +884,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
875 | 884 | ||
876 | switch (sdata->vif.type) { | 885 | switch (sdata->vif.type) { |
877 | case NL80211_IFTYPE_AP_VLAN: | 886 | case NL80211_IFTYPE_AP_VLAN: |
887 | mutex_lock(&local->mtx); | ||
878 | list_del(&sdata->u.vlan.list); | 888 | list_del(&sdata->u.vlan.list); |
879 | rcu_assign_pointer(sdata->vif.chanctx_conf, NULL); | 889 | mutex_unlock(&local->mtx); |
890 | RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); | ||
880 | /* no need to tell driver */ | 891 | /* no need to tell driver */ |
881 | break; | 892 | break; |
882 | case NL80211_IFTYPE_MONITOR: | 893 | case NL80211_IFTYPE_MONITOR: |
@@ -895,7 +906,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
895 | break; | 906 | break; |
896 | case NL80211_IFTYPE_P2P_DEVICE: | 907 | case NL80211_IFTYPE_P2P_DEVICE: |
897 | /* relies on synchronize_rcu() below */ | 908 | /* relies on synchronize_rcu() below */ |
898 | rcu_assign_pointer(local->p2p_sdata, NULL); | 909 | RCU_INIT_POINTER(local->p2p_sdata, NULL); |
899 | /* fall through */ | 910 | /* fall through */ |
900 | default: | 911 | default: |
901 | cancel_work_sync(&sdata->work); | 912 | cancel_work_sync(&sdata->work); |
@@ -1280,6 +1291,8 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1280 | INIT_WORK(&sdata->work, ieee80211_iface_work); | 1291 | INIT_WORK(&sdata->work, ieee80211_iface_work); |
1281 | INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); | 1292 | INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); |
1282 | INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); | 1293 | INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); |
1294 | INIT_LIST_HEAD(&sdata->assigned_chanctx_list); | ||
1295 | INIT_LIST_HEAD(&sdata->reserved_chanctx_list); | ||
1283 | 1296 | ||
1284 | switch (type) { | 1297 | switch (type) { |
1285 | case NL80211_IFTYPE_P2P_GO: | 1298 | case NL80211_IFTYPE_P2P_GO: |
@@ -1774,20 +1787,19 @@ static int netdev_notify(struct notifier_block *nb, | |||
1774 | struct ieee80211_sub_if_data *sdata; | 1787 | struct ieee80211_sub_if_data *sdata; |
1775 | 1788 | ||
1776 | if (state != NETDEV_CHANGENAME) | 1789 | if (state != NETDEV_CHANGENAME) |
1777 | return 0; | 1790 | return NOTIFY_DONE; |
1778 | 1791 | ||
1779 | if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) | 1792 | if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) |
1780 | return 0; | 1793 | return NOTIFY_DONE; |
1781 | 1794 | ||
1782 | if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) | 1795 | if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) |
1783 | return 0; | 1796 | return NOTIFY_DONE; |
1784 | 1797 | ||
1785 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1798 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1786 | |||
1787 | memcpy(sdata->name, dev->name, IFNAMSIZ); | 1799 | memcpy(sdata->name, dev->name, IFNAMSIZ); |
1788 | |||
1789 | ieee80211_debugfs_rename_netdev(sdata); | 1800 | ieee80211_debugfs_rename_netdev(sdata); |
1790 | return 0; | 1801 | |
1802 | return NOTIFY_OK; | ||
1791 | } | 1803 | } |
1792 | 1804 | ||
1793 | static struct notifier_block mac80211_netdev_notifier = { | 1805 | static struct notifier_block mac80211_netdev_notifier = { |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 4c1bf61bc778..27b9364cdf17 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -340,7 +340,7 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, | |||
340 | 340 | ||
341 | sdata_unlock(sdata); | 341 | sdata_unlock(sdata); |
342 | 342 | ||
343 | return NOTIFY_DONE; | 343 | return NOTIFY_OK; |
344 | } | 344 | } |
345 | #endif | 345 | #endif |
346 | 346 | ||
@@ -371,7 +371,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, | |||
371 | 371 | ||
372 | drv_ipv6_addr_change(local, sdata, idev); | 372 | drv_ipv6_addr_change(local, sdata, idev); |
373 | 373 | ||
374 | return NOTIFY_DONE; | 374 | return NOTIFY_OK; |
375 | } | 375 | } |
376 | #endif | 376 | #endif |
377 | 377 | ||
@@ -446,7 +446,9 @@ static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = { | |||
446 | .cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40 | | 446 | .cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40 | |
447 | IEEE80211_HT_CAP_MAX_AMSDU | | 447 | IEEE80211_HT_CAP_MAX_AMSDU | |
448 | IEEE80211_HT_CAP_SGI_20 | | 448 | IEEE80211_HT_CAP_SGI_20 | |
449 | IEEE80211_HT_CAP_SGI_40), | 449 | IEEE80211_HT_CAP_SGI_40 | |
450 | IEEE80211_HT_CAP_LDPC_CODING | | ||
451 | IEEE80211_HT_CAP_40MHZ_INTOLERANT), | ||
450 | .mcs = { | 452 | .mcs = { |
451 | .rx_mask = { 0xff, 0xff, 0xff, 0xff, 0xff, | 453 | .rx_mask = { 0xff, 0xff, 0xff, 0xff, 0xff, |
452 | 0xff, 0xff, 0xff, 0xff, 0xff, }, | 454 | 0xff, 0xff, 0xff, 0xff, 0xff, }, |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index f70e9cd10552..b06ddc9519ce 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -366,20 +366,15 @@ int mesh_add_rsn_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) | |||
366 | return 0; | 366 | return 0; |
367 | 367 | ||
368 | /* find RSN IE */ | 368 | /* find RSN IE */ |
369 | data = ifmsh->ie; | 369 | data = cfg80211_find_ie(WLAN_EID_RSN, ifmsh->ie, ifmsh->ie_len); |
370 | while (data < ifmsh->ie + ifmsh->ie_len) { | 370 | if (!data) |
371 | if (*data == WLAN_EID_RSN) { | 371 | return 0; |
372 | len = data[1] + 2; | ||
373 | break; | ||
374 | } | ||
375 | data++; | ||
376 | } | ||
377 | 372 | ||
378 | if (len) { | 373 | len = data[1] + 2; |
379 | if (skb_tailroom(skb) < len) | 374 | |
380 | return -ENOMEM; | 375 | if (skb_tailroom(skb) < len) |
381 | memcpy(skb_put(skb, len), data, len); | 376 | return -ENOMEM; |
382 | } | 377 | memcpy(skb_put(skb, len), data, len); |
383 | 378 | ||
384 | return 0; | 379 | return 0; |
385 | } | 380 | } |
@@ -829,7 +824,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) | |||
829 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); | 824 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); |
830 | bcn = rcu_dereference_protected(ifmsh->beacon, | 825 | bcn = rcu_dereference_protected(ifmsh->beacon, |
831 | lockdep_is_held(&sdata->wdev.mtx)); | 826 | lockdep_is_held(&sdata->wdev.mtx)); |
832 | rcu_assign_pointer(ifmsh->beacon, NULL); | 827 | RCU_INIT_POINTER(ifmsh->beacon, NULL); |
833 | kfree_rcu(bcn, rcu_head); | 828 | kfree_rcu(bcn, rcu_head); |
834 | 829 | ||
835 | /* flush STAs and mpaths on this iface */ | 830 | /* flush STAs and mpaths on this iface */ |
@@ -903,14 +898,15 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, | |||
903 | } | 898 | } |
904 | 899 | ||
905 | err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, | 900 | err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy, |
906 | ¶ms.chandef); | 901 | ¶ms.chandef, |
902 | NL80211_IFTYPE_MESH_POINT); | ||
907 | if (err < 0) | 903 | if (err < 0) |
908 | return false; | 904 | return false; |
909 | if (err) { | 905 | if (err > 0) |
910 | params.radar_required = true; | ||
911 | /* TODO: DFS not (yet) supported */ | 906 | /* TODO: DFS not (yet) supported */ |
912 | return false; | 907 | return false; |
913 | } | 908 | |
909 | params.radar_required = err; | ||
914 | 910 | ||
915 | if (cfg80211_chandef_identical(¶ms.chandef, | 911 | if (cfg80211_chandef_identical(¶ms.chandef, |
916 | &sdata->vif.bss_conf.chandef)) { | 912 | &sdata->vif.bss_conf.chandef)) { |
@@ -1068,7 +1064,7 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata) | |||
1068 | 1064 | ||
1069 | /* Remove the CSA and MCSP elements from the beacon */ | 1065 | /* Remove the CSA and MCSP elements from the beacon */ |
1070 | tmp_csa_settings = rcu_dereference(ifmsh->csa); | 1066 | tmp_csa_settings = rcu_dereference(ifmsh->csa); |
1071 | rcu_assign_pointer(ifmsh->csa, NULL); | 1067 | RCU_INIT_POINTER(ifmsh->csa, NULL); |
1072 | if (tmp_csa_settings) | 1068 | if (tmp_csa_settings) |
1073 | kfree_rcu(tmp_csa_settings, rcu_head); | 1069 | kfree_rcu(tmp_csa_settings, rcu_head); |
1074 | ret = ieee80211_mesh_rebuild_beacon(sdata); | 1070 | ret = ieee80211_mesh_rebuild_beacon(sdata); |
@@ -1102,7 +1098,7 @@ int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata, | |||
1102 | ret = ieee80211_mesh_rebuild_beacon(sdata); | 1098 | ret = ieee80211_mesh_rebuild_beacon(sdata); |
1103 | if (ret) { | 1099 | if (ret) { |
1104 | tmp_csa_settings = rcu_dereference(ifmsh->csa); | 1100 | tmp_csa_settings = rcu_dereference(ifmsh->csa); |
1105 | rcu_assign_pointer(ifmsh->csa, NULL); | 1101 | RCU_INIT_POINTER(ifmsh->csa, NULL); |
1106 | kfree_rcu(tmp_csa_settings, rcu_head); | 1102 | kfree_rcu(tmp_csa_settings, rcu_head); |
1107 | return ret; | 1103 | return ret; |
1108 | } | 1104 | } |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index f9514685d45a..94758b9c9ed4 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -37,7 +37,7 @@ static inline u32 u32_field_get(const u8 *preq_elem, int offset, bool ae) | |||
37 | return get_unaligned_le32(preq_elem + offset); | 37 | return get_unaligned_le32(preq_elem + offset); |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline u32 u16_field_get(const u8 *preq_elem, int offset, bool ae) | 40 | static inline u16 u16_field_get(const u8 *preq_elem, int offset, bool ae) |
41 | { | 41 | { |
42 | if (ae) | 42 | if (ae) |
43 | offset += 6; | 43 | offset += 6; |
@@ -544,9 +544,10 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
544 | if (time_after(jiffies, ifmsh->last_sn_update + | 544 | if (time_after(jiffies, ifmsh->last_sn_update + |
545 | net_traversal_jiffies(sdata)) || | 545 | net_traversal_jiffies(sdata)) || |
546 | time_before(jiffies, ifmsh->last_sn_update)) { | 546 | time_before(jiffies, ifmsh->last_sn_update)) { |
547 | target_sn = ++ifmsh->sn; | 547 | ++ifmsh->sn; |
548 | ifmsh->last_sn_update = jiffies; | 548 | ifmsh->last_sn_update = jiffies; |
549 | } | 549 | } |
550 | target_sn = ifmsh->sn; | ||
550 | } else if (is_broadcast_ether_addr(target_addr) && | 551 | } else if (is_broadcast_ether_addr(target_addr) && |
551 | (target_flags & IEEE80211_PREQ_TO_FLAG)) { | 552 | (target_flags & IEEE80211_PREQ_TO_FLAG)) { |
552 | rcu_read_lock(); | 553 | rcu_read_lock(); |
diff --git a/net/mac80211/michael.h b/net/mac80211/michael.h index 3b848dad9587..0e4886f881f1 100644 --- a/net/mac80211/michael.h +++ b/net/mac80211/michael.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define MICHAEL_H | 11 | #define MICHAEL_H |
12 | 12 | ||
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/ieee80211.h> | ||
14 | 15 | ||
15 | #define MICHAEL_MIC_LEN 8 | 16 | #define MICHAEL_MIC_LEN 8 |
16 | 17 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index dee50aefd6e8..488826f188a7 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1089,7 +1089,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
1089 | } | 1089 | } |
1090 | chanctx = container_of(rcu_access_pointer(sdata->vif.chanctx_conf), | 1090 | chanctx = container_of(rcu_access_pointer(sdata->vif.chanctx_conf), |
1091 | struct ieee80211_chanctx, conf); | 1091 | struct ieee80211_chanctx, conf); |
1092 | if (chanctx->refcount > 1) { | 1092 | if (ieee80211_chanctx_refcount(local, chanctx) > 1) { |
1093 | sdata_info(sdata, | 1093 | sdata_info(sdata, |
1094 | "channel switch with multiple interfaces on the same channel, disconnecting\n"); | 1094 | "channel switch with multiple interfaces on the same channel, disconnecting\n"); |
1095 | ieee80211_queue_work(&local->hw, | 1095 | ieee80211_queue_work(&local->hw, |
@@ -3701,7 +3701,7 @@ int ieee80211_max_network_latency(struct notifier_block *nb, | |||
3701 | ieee80211_recalc_ps(local, latency_usec); | 3701 | ieee80211_recalc_ps(local, latency_usec); |
3702 | mutex_unlock(&local->iflist_mtx); | 3702 | mutex_unlock(&local->iflist_mtx); |
3703 | 3703 | ||
3704 | return 0; | 3704 | return NOTIFY_OK; |
3705 | } | 3705 | } |
3706 | 3706 | ||
3707 | static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata, | 3707 | static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata, |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 216c45b949e5..394e201cde6d 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -54,24 +54,25 @@ static struct sk_buff *remove_monitor_info(struct ieee80211_local *local, | |||
54 | return skb; | 54 | return skb; |
55 | } | 55 | } |
56 | 56 | ||
57 | static inline int should_drop_frame(struct sk_buff *skb, int present_fcs_len) | 57 | static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len) |
58 | { | 58 | { |
59 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 59 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
60 | struct ieee80211_hdr *hdr; | 60 | struct ieee80211_hdr *hdr = (void *)skb->data; |
61 | |||
62 | hdr = (void *)(skb->data); | ||
63 | 61 | ||
64 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | | 62 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | |
65 | RX_FLAG_FAILED_PLCP_CRC | | 63 | RX_FLAG_FAILED_PLCP_CRC | |
66 | RX_FLAG_AMPDU_IS_ZEROLEN)) | 64 | RX_FLAG_AMPDU_IS_ZEROLEN)) |
67 | return 1; | 65 | return true; |
66 | |||
68 | if (unlikely(skb->len < 16 + present_fcs_len)) | 67 | if (unlikely(skb->len < 16 + present_fcs_len)) |
69 | return 1; | 68 | return true; |
69 | |||
70 | if (ieee80211_is_ctl(hdr->frame_control) && | 70 | if (ieee80211_is_ctl(hdr->frame_control) && |
71 | !ieee80211_is_pspoll(hdr->frame_control) && | 71 | !ieee80211_is_pspoll(hdr->frame_control) && |
72 | !ieee80211_is_back_req(hdr->frame_control)) | 72 | !ieee80211_is_back_req(hdr->frame_control)) |
73 | return 1; | 73 | return true; |
74 | return 0; | 74 | |
75 | return false; | ||
75 | } | 76 | } |
76 | 77 | ||
77 | static int | 78 | static int |
@@ -1231,7 +1232,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1231 | if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid) && | 1232 | if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid) && |
1232 | test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { | 1233 | test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { |
1233 | sta->last_rx = jiffies; | 1234 | sta->last_rx = jiffies; |
1234 | if (ieee80211_is_data(hdr->frame_control)) { | 1235 | if (ieee80211_is_data(hdr->frame_control) && |
1236 | !is_multicast_ether_addr(hdr->addr1)) { | ||
1235 | sta->last_rx_rate_idx = status->rate_idx; | 1237 | sta->last_rx_rate_idx = status->rate_idx; |
1236 | sta->last_rx_rate_flag = status->flag; | 1238 | sta->last_rx_rate_flag = status->flag; |
1237 | sta->last_rx_rate_vht_flag = status->vht_flag; | 1239 | sta->last_rx_rate_vht_flag = status->vht_flag; |
@@ -3190,7 +3192,7 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, | |||
3190 | } | 3192 | } |
3191 | 3193 | ||
3192 | /* | 3194 | /* |
3193 | * This is the actual Rx frames handler. as it blongs to Rx path it must | 3195 | * This is the actual Rx frames handler. as it belongs to Rx path it must |
3194 | * be called with rcu_read_lock protection. | 3196 | * be called with rcu_read_lock protection. |
3195 | */ | 3197 | */ |
3196 | static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | 3198 | static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 3ce7f2c8539a..28185c8dc19a 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -309,7 +309,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | |||
309 | if (local->scan_req != local->int_scan_req) | 309 | if (local->scan_req != local->int_scan_req) |
310 | cfg80211_scan_done(local->scan_req, aborted); | 310 | cfg80211_scan_done(local->scan_req, aborted); |
311 | local->scan_req = NULL; | 311 | local->scan_req = NULL; |
312 | rcu_assign_pointer(local->scan_sdata, NULL); | 312 | RCU_INIT_POINTER(local->scan_sdata, NULL); |
313 | 313 | ||
314 | local->scanning = 0; | 314 | local->scanning = 0; |
315 | local->scan_chandef.chan = NULL; | 315 | local->scan_chandef.chan = NULL; |
@@ -559,7 +559,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, | |||
559 | ieee80211_recalc_idle(local); | 559 | ieee80211_recalc_idle(local); |
560 | 560 | ||
561 | local->scan_req = NULL; | 561 | local->scan_req = NULL; |
562 | rcu_assign_pointer(local->scan_sdata, NULL); | 562 | RCU_INIT_POINTER(local->scan_sdata, NULL); |
563 | } | 563 | } |
564 | 564 | ||
565 | return rc; | 565 | return rc; |
@@ -773,7 +773,7 @@ void ieee80211_scan_work(struct work_struct *work) | |||
773 | int rc; | 773 | int rc; |
774 | 774 | ||
775 | local->scan_req = NULL; | 775 | local->scan_req = NULL; |
776 | rcu_assign_pointer(local->scan_sdata, NULL); | 776 | RCU_INIT_POINTER(local->scan_sdata, NULL); |
777 | 777 | ||
778 | rc = __ieee80211_start_scan(sdata, req); | 778 | rc = __ieee80211_start_scan(sdata, req); |
779 | if (rc) { | 779 | if (rc) { |
@@ -1014,7 +1014,7 @@ out_free: | |||
1014 | 1014 | ||
1015 | if (ret) { | 1015 | if (ret) { |
1016 | /* Clean in case of failure after HW restart or upon resume. */ | 1016 | /* Clean in case of failure after HW restart or upon resume. */ |
1017 | rcu_assign_pointer(local->sched_scan_sdata, NULL); | 1017 | RCU_INIT_POINTER(local->sched_scan_sdata, NULL); |
1018 | local->sched_scan_req = NULL; | 1018 | local->sched_scan_req = NULL; |
1019 | } | 1019 | } |
1020 | 1020 | ||
@@ -1089,7 +1089,7 @@ void ieee80211_sched_scan_stopped_work(struct work_struct *work) | |||
1089 | return; | 1089 | return; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | rcu_assign_pointer(local->sched_scan_sdata, NULL); | 1092 | RCU_INIT_POINTER(local->sched_scan_sdata, NULL); |
1093 | 1093 | ||
1094 | /* If sched scan was aborted by the driver. */ | 1094 | /* If sched scan was aborted by the driver. */ |
1095 | local->sched_scan_req = NULL; | 1095 | local->sched_scan_req = NULL; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 137a192e64bc..632d372bb511 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -552,7 +552,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) | |||
552 | int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) | 552 | int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) |
553 | { | 553 | { |
554 | struct ieee80211_local *local = sta->local; | 554 | struct ieee80211_local *local = sta->local; |
555 | int err = 0; | 555 | int err; |
556 | 556 | ||
557 | might_sleep(); | 557 | might_sleep(); |
558 | 558 | ||
@@ -570,7 +570,6 @@ int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) | |||
570 | 570 | ||
571 | return 0; | 571 | return 0; |
572 | out_free: | 572 | out_free: |
573 | BUG_ON(!err); | ||
574 | sta_info_free(local, sta); | 573 | sta_info_free(local, sta); |
575 | return err; | 574 | return err; |
576 | } | 575 | } |
@@ -1148,7 +1147,8 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
1148 | atomic_dec(&ps->num_sta_ps); | 1147 | atomic_dec(&ps->num_sta_ps); |
1149 | 1148 | ||
1150 | /* This station just woke up and isn't aware of our SMPS state */ | 1149 | /* This station just woke up and isn't aware of our SMPS state */ |
1151 | if (!ieee80211_smps_is_restrictive(sta->known_smps_mode, | 1150 | if (!ieee80211_vif_is_mesh(&sdata->vif) && |
1151 | !ieee80211_smps_is_restrictive(sta->known_smps_mode, | ||
1152 | sdata->smps_mode) && | 1152 | sdata->smps_mode) && |
1153 | sta->known_smps_mode != sdata->bss->req_smps && | 1153 | sta->known_smps_mode != sdata->bss->req_smps && |
1154 | sta_info_tx_streams(sta) != 1) { | 1154 | sta_info_tx_streams(sta) != 1) { |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 00ba90b02ab2..60cb7a665976 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -314,10 +314,9 @@ ieee80211_add_tx_radiotap_header(struct ieee80211_local *local, | |||
314 | !is_multicast_ether_addr(hdr->addr1)) | 314 | !is_multicast_ether_addr(hdr->addr1)) |
315 | txflags |= IEEE80211_RADIOTAP_F_TX_FAIL; | 315 | txflags |= IEEE80211_RADIOTAP_F_TX_FAIL; |
316 | 316 | ||
317 | if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || | 317 | if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) |
318 | (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) | ||
319 | txflags |= IEEE80211_RADIOTAP_F_TX_CTS; | 318 | txflags |= IEEE80211_RADIOTAP_F_TX_CTS; |
320 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) | 319 | if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) |
321 | txflags |= IEEE80211_RADIOTAP_F_TX_RTS; | 320 | txflags |= IEEE80211_RADIOTAP_F_TX_RTS; |
322 | 321 | ||
323 | put_unaligned_le16(txflags, pos); | 322 | put_unaligned_le16(txflags, pos); |
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index a0b0aea76525..cec5b60487a4 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
@@ -21,10 +21,10 @@ | |||
21 | 21 | ||
22 | #define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \ | 22 | #define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \ |
23 | __field(bool, p2p) \ | 23 | __field(bool, p2p) \ |
24 | __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") | 24 | __string(vif_name, sdata->name) |
25 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ | 25 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ |
26 | __entry->p2p = sdata->vif.p2p; \ | 26 | __entry->p2p = sdata->vif.p2p; \ |
27 | __assign_str(vif_name, sdata->dev ? sdata->dev->name : sdata->name) | 27 | __assign_str(vif_name, sdata->name) |
28 | #define VIF_PR_FMT " vif:%s(%d%s)" | 28 | #define VIF_PR_FMT " vif:%s(%d%s)" |
29 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" | 29 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" |
30 | 30 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 275c94f995f7..c08bd4aca6bb 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -554,7 +554,7 @@ void ieee80211_flush_queues(struct ieee80211_local *local, | |||
554 | ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, | 554 | ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, |
555 | IEEE80211_QUEUE_STOP_REASON_FLUSH); | 555 | IEEE80211_QUEUE_STOP_REASON_FLUSH); |
556 | 556 | ||
557 | drv_flush(local, queues, false); | 557 | drv_flush(local, sdata, queues, false); |
558 | 558 | ||
559 | ieee80211_wake_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, | 559 | ieee80211_wake_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, |
560 | IEEE80211_QUEUE_STOP_REASON_FLUSH); | 560 | IEEE80211_QUEUE_STOP_REASON_FLUSH); |
@@ -1546,7 +1546,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1546 | WARN_ON(local->resuming); | 1546 | WARN_ON(local->resuming); |
1547 | res = drv_add_interface(local, sdata); | 1547 | res = drv_add_interface(local, sdata); |
1548 | if (WARN_ON(res)) { | 1548 | if (WARN_ON(res)) { |
1549 | rcu_assign_pointer(local->monitor_sdata, NULL); | 1549 | RCU_INIT_POINTER(local->monitor_sdata, NULL); |
1550 | synchronize_net(); | 1550 | synchronize_net(); |
1551 | kfree(sdata); | 1551 | kfree(sdata); |
1552 | } | 1552 | } |
@@ -1565,17 +1565,17 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1565 | list_for_each_entry(ctx, &local->chanctx_list, list) | 1565 | list_for_each_entry(ctx, &local->chanctx_list, list) |
1566 | WARN_ON(drv_add_chanctx(local, ctx)); | 1566 | WARN_ON(drv_add_chanctx(local, ctx)); |
1567 | mutex_unlock(&local->chanctx_mtx); | 1567 | mutex_unlock(&local->chanctx_mtx); |
1568 | } | ||
1569 | 1568 | ||
1570 | list_for_each_entry(sdata, &local->interfaces, list) { | 1569 | list_for_each_entry(sdata, &local->interfaces, list) { |
1571 | if (!ieee80211_sdata_running(sdata)) | 1570 | if (!ieee80211_sdata_running(sdata)) |
1572 | continue; | 1571 | continue; |
1573 | ieee80211_assign_chanctx(local, sdata); | 1572 | ieee80211_assign_chanctx(local, sdata); |
1574 | } | 1573 | } |
1575 | 1574 | ||
1576 | sdata = rtnl_dereference(local->monitor_sdata); | 1575 | sdata = rtnl_dereference(local->monitor_sdata); |
1577 | if (sdata && ieee80211_sdata_running(sdata)) | 1576 | if (sdata && ieee80211_sdata_running(sdata)) |
1578 | ieee80211_assign_chanctx(local, sdata); | 1577 | ieee80211_assign_chanctx(local, sdata); |
1578 | } | ||
1579 | 1579 | ||
1580 | /* add STAs back */ | 1580 | /* add STAs back */ |
1581 | mutex_lock(&local->sta_mtx); | 1581 | mutex_lock(&local->sta_mtx); |
@@ -1671,13 +1671,10 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1671 | } | 1671 | } |
1672 | break; | 1672 | break; |
1673 | case NL80211_IFTYPE_WDS: | 1673 | case NL80211_IFTYPE_WDS: |
1674 | break; | ||
1675 | case NL80211_IFTYPE_AP_VLAN: | 1674 | case NL80211_IFTYPE_AP_VLAN: |
1676 | case NL80211_IFTYPE_MONITOR: | 1675 | case NL80211_IFTYPE_MONITOR: |
1677 | /* ignore virtual */ | ||
1678 | break; | ||
1679 | case NL80211_IFTYPE_P2P_DEVICE: | 1676 | case NL80211_IFTYPE_P2P_DEVICE: |
1680 | changed = BSS_CHANGED_IDLE; | 1677 | /* nothing to do */ |
1681 | break; | 1678 | break; |
1682 | case NL80211_IFTYPE_UNSPECIFIED: | 1679 | case NL80211_IFTYPE_UNSPECIFIED: |
1683 | case NUM_NL80211_IFTYPES: | 1680 | case NUM_NL80211_IFTYPES: |
@@ -1780,7 +1777,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1780 | mutex_unlock(&local->mtx); | 1777 | mutex_unlock(&local->mtx); |
1781 | 1778 | ||
1782 | if (sched_scan_stopped) | 1779 | if (sched_scan_stopped) |
1783 | cfg80211_sched_scan_stopped(local->hw.wiphy); | 1780 | cfg80211_sched_scan_stopped_rtnl(local->hw.wiphy); |
1784 | 1781 | ||
1785 | /* | 1782 | /* |
1786 | * If this is for hw restart things are still running. | 1783 | * If this is for hw restart things are still running. |
@@ -2797,3 +2794,121 @@ void ieee80211_recalc_dtim(struct ieee80211_local *local, | |||
2797 | 2794 | ||
2798 | ps->dtim_count = dtim_count; | 2795 | ps->dtim_count = dtim_count; |
2799 | } | 2796 | } |
2797 | |||
2798 | int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, | ||
2799 | const struct cfg80211_chan_def *chandef, | ||
2800 | enum ieee80211_chanctx_mode chanmode, | ||
2801 | u8 radar_detect) | ||
2802 | { | ||
2803 | struct ieee80211_local *local = sdata->local; | ||
2804 | struct ieee80211_sub_if_data *sdata_iter; | ||
2805 | enum nl80211_iftype iftype = sdata->wdev.iftype; | ||
2806 | int num[NUM_NL80211_IFTYPES]; | ||
2807 | struct ieee80211_chanctx *ctx; | ||
2808 | int num_different_channels = 0; | ||
2809 | int total = 1; | ||
2810 | |||
2811 | lockdep_assert_held(&local->chanctx_mtx); | ||
2812 | |||
2813 | if (WARN_ON(hweight32(radar_detect) > 1)) | ||
2814 | return -EINVAL; | ||
2815 | |||
2816 | if (WARN_ON(chandef && chanmode == IEEE80211_CHANCTX_SHARED && | ||
2817 | !chandef->chan)) | ||
2818 | return -EINVAL; | ||
2819 | |||
2820 | if (chandef) | ||
2821 | num_different_channels = 1; | ||
2822 | |||
2823 | if (WARN_ON(iftype >= NUM_NL80211_IFTYPES)) | ||
2824 | return -EINVAL; | ||
2825 | |||
2826 | /* Always allow software iftypes */ | ||
2827 | if (local->hw.wiphy->software_iftypes & BIT(iftype)) { | ||
2828 | if (radar_detect) | ||
2829 | return -EINVAL; | ||
2830 | return 0; | ||
2831 | } | ||
2832 | |||
2833 | memset(num, 0, sizeof(num)); | ||
2834 | |||
2835 | if (iftype != NL80211_IFTYPE_UNSPECIFIED) | ||
2836 | num[iftype] = 1; | ||
2837 | |||
2838 | list_for_each_entry(ctx, &local->chanctx_list, list) { | ||
2839 | if (ctx->conf.radar_enabled) | ||
2840 | radar_detect |= BIT(ctx->conf.def.width); | ||
2841 | if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { | ||
2842 | num_different_channels++; | ||
2843 | continue; | ||
2844 | } | ||
2845 | if (chandef && chanmode == IEEE80211_CHANCTX_SHARED && | ||
2846 | cfg80211_chandef_compatible(chandef, | ||
2847 | &ctx->conf.def)) | ||
2848 | continue; | ||
2849 | num_different_channels++; | ||
2850 | } | ||
2851 | |||
2852 | list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) { | ||
2853 | struct wireless_dev *wdev_iter; | ||
2854 | |||
2855 | wdev_iter = &sdata_iter->wdev; | ||
2856 | |||
2857 | if (sdata_iter == sdata || | ||
2858 | rcu_access_pointer(sdata_iter->vif.chanctx_conf) == NULL || | ||
2859 | local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype)) | ||
2860 | continue; | ||
2861 | |||
2862 | num[wdev_iter->iftype]++; | ||
2863 | total++; | ||
2864 | } | ||
2865 | |||
2866 | if (total == 1 && !radar_detect) | ||
2867 | return 0; | ||
2868 | |||
2869 | return cfg80211_check_combinations(local->hw.wiphy, | ||
2870 | num_different_channels, | ||
2871 | radar_detect, num); | ||
2872 | } | ||
2873 | |||
2874 | static void | ||
2875 | ieee80211_iter_max_chans(const struct ieee80211_iface_combination *c, | ||
2876 | void *data) | ||
2877 | { | ||
2878 | u32 *max_num_different_channels = data; | ||
2879 | |||
2880 | *max_num_different_channels = max(*max_num_different_channels, | ||
2881 | c->num_different_channels); | ||
2882 | } | ||
2883 | |||
2884 | int ieee80211_max_num_channels(struct ieee80211_local *local) | ||
2885 | { | ||
2886 | struct ieee80211_sub_if_data *sdata; | ||
2887 | int num[NUM_NL80211_IFTYPES] = {}; | ||
2888 | struct ieee80211_chanctx *ctx; | ||
2889 | int num_different_channels = 0; | ||
2890 | u8 radar_detect = 0; | ||
2891 | u32 max_num_different_channels = 1; | ||
2892 | int err; | ||
2893 | |||
2894 | lockdep_assert_held(&local->chanctx_mtx); | ||
2895 | |||
2896 | list_for_each_entry(ctx, &local->chanctx_list, list) { | ||
2897 | num_different_channels++; | ||
2898 | |||
2899 | if (ctx->conf.radar_enabled) | ||
2900 | radar_detect |= BIT(ctx->conf.def.width); | ||
2901 | } | ||
2902 | |||
2903 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | ||
2904 | num[sdata->wdev.iftype]++; | ||
2905 | |||
2906 | err = cfg80211_iter_combinations(local->hw.wiphy, | ||
2907 | num_different_channels, radar_detect, | ||
2908 | num, ieee80211_iter_max_chans, | ||
2909 | &max_num_different_channels); | ||
2910 | if (err < 0) | ||
2911 | return err; | ||
2912 | |||
2913 | return max_num_different_channels; | ||
2914 | } | ||
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c index e9e36a256165..9265adfdabfc 100644 --- a/net/mac80211/vht.c +++ b/net/mac80211/vht.c | |||
@@ -129,9 +129,12 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, | |||
129 | if (!vht_cap_ie || !sband->vht_cap.vht_supported) | 129 | if (!vht_cap_ie || !sband->vht_cap.vht_supported) |
130 | return; | 130 | return; |
131 | 131 | ||
132 | /* A VHT STA must support 40 MHz */ | 132 | /* |
133 | if (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)) | 133 | * A VHT STA must support 40 MHz, but if we verify that here |
134 | return; | 134 | * then we break a few things - some APs (e.g. Netgear R6300v2 |
135 | * and others based on the BCM4360 chipset) will unset this | ||
136 | * capability bit when operating in 20 MHz. | ||
137 | */ | ||
135 | 138 | ||
136 | vht_cap->vht_supported = true; | 139 | vht_cap->vht_supported = true; |
137 | 140 | ||
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index b8600e3c29c8..9b3dcc201145 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -406,7 +406,10 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
406 | 406 | ||
407 | if (info->control.hw_key && | 407 | if (info->control.hw_key && |
408 | !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) && | 408 | !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) && |
409 | !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) { | 409 | !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && |
410 | !((info->control.hw_key->flags & | ||
411 | IEEE80211_KEY_FLAG_GENERATE_IV_MGMT) && | ||
412 | ieee80211_is_mgmt(hdr->frame_control))) { | ||
410 | /* | 413 | /* |
411 | * hwaccel has no need for preallocated room for CCMP | 414 | * hwaccel has no need for preallocated room for CCMP |
412 | * header or MIC fields | 415 | * header or MIC fields |
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index bd2a5b90400c..9c4a5eb91cbf 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c | |||
@@ -36,8 +36,6 @@ struct rfkill_gpio_data { | |||
36 | struct gpio_desc *shutdown_gpio; | 36 | struct gpio_desc *shutdown_gpio; |
37 | 37 | ||
38 | struct rfkill *rfkill_dev; | 38 | struct rfkill *rfkill_dev; |
39 | char *reset_name; | ||
40 | char *shutdown_name; | ||
41 | struct clk *clk; | 39 | struct clk *clk; |
42 | 40 | ||
43 | bool clk_enabled; | 41 | bool clk_enabled; |
@@ -87,10 +85,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
87 | { | 85 | { |
88 | struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; | 86 | struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; |
89 | struct rfkill_gpio_data *rfkill; | 87 | struct rfkill_gpio_data *rfkill; |
90 | const char *clk_name = NULL; | ||
91 | struct gpio_desc *gpio; | 88 | struct gpio_desc *gpio; |
92 | int ret; | 89 | int ret; |
93 | int len; | ||
94 | 90 | ||
95 | rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); | 91 | rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); |
96 | if (!rfkill) | 92 | if (!rfkill) |
@@ -101,28 +97,15 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
101 | if (ret) | 97 | if (ret) |
102 | return ret; | 98 | return ret; |
103 | } else if (pdata) { | 99 | } else if (pdata) { |
104 | clk_name = pdata->power_clk_name; | ||
105 | rfkill->name = pdata->name; | 100 | rfkill->name = pdata->name; |
106 | rfkill->type = pdata->type; | 101 | rfkill->type = pdata->type; |
107 | } else { | 102 | } else { |
108 | return -ENODEV; | 103 | return -ENODEV; |
109 | } | 104 | } |
110 | 105 | ||
111 | len = strlen(rfkill->name); | 106 | rfkill->clk = devm_clk_get(&pdev->dev, NULL); |
112 | rfkill->reset_name = devm_kzalloc(&pdev->dev, len + 7, GFP_KERNEL); | ||
113 | if (!rfkill->reset_name) | ||
114 | return -ENOMEM; | ||
115 | |||
116 | rfkill->shutdown_name = devm_kzalloc(&pdev->dev, len + 10, GFP_KERNEL); | ||
117 | if (!rfkill->shutdown_name) | ||
118 | return -ENOMEM; | ||
119 | |||
120 | snprintf(rfkill->reset_name, len + 6 , "%s_reset", rfkill->name); | ||
121 | snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", rfkill->name); | ||
122 | |||
123 | rfkill->clk = devm_clk_get(&pdev->dev, clk_name); | ||
124 | 107 | ||
125 | gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0); | 108 | gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0); |
126 | if (!IS_ERR(gpio)) { | 109 | if (!IS_ERR(gpio)) { |
127 | ret = gpiod_direction_output(gpio, 0); | 110 | ret = gpiod_direction_output(gpio, 0); |
128 | if (ret) | 111 | if (ret) |
@@ -130,7 +113,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
130 | rfkill->reset_gpio = gpio; | 113 | rfkill->reset_gpio = gpio; |
131 | } | 114 | } |
132 | 115 | ||
133 | gpio = devm_gpiod_get_index(&pdev->dev, rfkill->shutdown_name, 1); | 116 | gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1); |
134 | if (!IS_ERR(gpio)) { | 117 | if (!IS_ERR(gpio)) { |
135 | ret = gpiod_direction_output(gpio, 0); | 118 | ret = gpiod_direction_output(gpio, 0); |
136 | if (ret) | 119 | if (ret) |
@@ -146,14 +129,6 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
146 | return -EINVAL; | 129 | return -EINVAL; |
147 | } | 130 | } |
148 | 131 | ||
149 | if (pdata && pdata->gpio_runtime_setup) { | ||
150 | ret = pdata->gpio_runtime_setup(pdev); | ||
151 | if (ret) { | ||
152 | dev_err(&pdev->dev, "can't set up gpio\n"); | ||
153 | return ret; | ||
154 | } | ||
155 | } | ||
156 | |||
157 | rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev, | 132 | rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev, |
158 | rfkill->type, &rfkill_gpio_ops, | 133 | rfkill->type, &rfkill_gpio_ops, |
159 | rfkill); | 134 | rfkill); |
@@ -174,20 +149,23 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
174 | static int rfkill_gpio_remove(struct platform_device *pdev) | 149 | static int rfkill_gpio_remove(struct platform_device *pdev) |
175 | { | 150 | { |
176 | struct rfkill_gpio_data *rfkill = platform_get_drvdata(pdev); | 151 | struct rfkill_gpio_data *rfkill = platform_get_drvdata(pdev); |
177 | struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; | ||
178 | 152 | ||
179 | if (pdata && pdata->gpio_runtime_close) | ||
180 | pdata->gpio_runtime_close(pdev); | ||
181 | rfkill_unregister(rfkill->rfkill_dev); | 153 | rfkill_unregister(rfkill->rfkill_dev); |
182 | rfkill_destroy(rfkill->rfkill_dev); | 154 | rfkill_destroy(rfkill->rfkill_dev); |
183 | 155 | ||
184 | return 0; | 156 | return 0; |
185 | } | 157 | } |
186 | 158 | ||
159 | #ifdef CONFIG_ACPI | ||
187 | static const struct acpi_device_id rfkill_acpi_match[] = { | 160 | static const struct acpi_device_id rfkill_acpi_match[] = { |
161 | { "BCM2E1A", RFKILL_TYPE_BLUETOOTH }, | ||
162 | { "BCM2E39", RFKILL_TYPE_BLUETOOTH }, | ||
163 | { "BCM2E3D", RFKILL_TYPE_BLUETOOTH }, | ||
188 | { "BCM4752", RFKILL_TYPE_GPS }, | 164 | { "BCM4752", RFKILL_TYPE_GPS }, |
165 | { "LNV4752", RFKILL_TYPE_GPS }, | ||
189 | { }, | 166 | { }, |
190 | }; | 167 | }; |
168 | #endif | ||
191 | 169 | ||
192 | static struct platform_driver rfkill_gpio_driver = { | 170 | static struct platform_driver rfkill_gpio_driver = { |
193 | .probe = rfkill_gpio_probe, | 171 | .probe = rfkill_gpio_probe, |
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig index 16d08b399210..405f3c4cf70c 100644 --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig | |||
@@ -95,6 +95,43 @@ config CFG80211_CERTIFICATION_ONUS | |||
95 | you are a wireless researcher and are working in a controlled | 95 | you are a wireless researcher and are working in a controlled |
96 | and approved environment by your local regulatory agency. | 96 | and approved environment by your local regulatory agency. |
97 | 97 | ||
98 | config CFG80211_REG_CELLULAR_HINTS | ||
99 | bool "cfg80211 regulatory support for cellular base station hints" | ||
100 | depends on CFG80211_CERTIFICATION_ONUS | ||
101 | ---help--- | ||
102 | This option enables support for parsing regulatory hints | ||
103 | from cellular base stations. If enabled and at least one driver | ||
104 | claims support for parsing cellular base station hints the | ||
105 | regulatory core will allow and parse these regulatory hints. | ||
106 | The regulatory core will only apply these regulatory hints on | ||
107 | drivers that support this feature. You should only enable this | ||
108 | feature if you have tested and validated this feature on your | ||
109 | systems. | ||
110 | |||
111 | config CFG80211_REG_RELAX_NO_IR | ||
112 | bool "cfg80211 support for NO_IR relaxation" | ||
113 | depends on CFG80211_CERTIFICATION_ONUS | ||
114 | ---help--- | ||
115 | This option enables support for relaxation of the NO_IR flag for | ||
116 | situations that certain regulatory bodies have provided clarifications | ||
117 | on how relaxation can occur. This feature has an inherent dependency on | ||
118 | userspace features which must have been properly tested and as such is | ||
119 | not enabled by default. | ||
120 | |||
121 | A relaxation feature example is allowing the operation of a P2P group | ||
122 | owner (GO) on channels marked with NO_IR if there is an additional BSS | ||
123 | interface which associated to an AP which userspace assumes or confirms | ||
124 | to be an authorized master, i.e., with radar detection support and DFS | ||
125 | capabilities. However, note that in order to not create daisy chain | ||
126 | scenarios, this relaxation is not allowed in cases that the BSS client | ||
127 | is associated to P2P GO and in addition the P2P GO instantiated on | ||
128 | a channel due to this relaxation should not allow connection from | ||
129 | non P2P clients. | ||
130 | |||
131 | The regulatory core will apply these relaxations only for drivers that | ||
132 | support this feature by declaring the appropriate channel flags and | ||
133 | capabilities in their registration flow. | ||
134 | |||
98 | config CFG80211_DEFAULT_PS | 135 | config CFG80211_DEFAULT_PS |
99 | bool "enable powersave by default" | 136 | bool "enable powersave by default" |
100 | depends on CFG80211 | 137 | depends on CFG80211 |
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 9c9501a35fb5..84d686e2dbd0 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
@@ -326,28 +326,57 @@ static int cfg80211_get_chans_dfs_required(struct wiphy *wiphy, | |||
326 | 326 | ||
327 | 327 | ||
328 | int cfg80211_chandef_dfs_required(struct wiphy *wiphy, | 328 | int cfg80211_chandef_dfs_required(struct wiphy *wiphy, |
329 | const struct cfg80211_chan_def *chandef) | 329 | const struct cfg80211_chan_def *chandef, |
330 | enum nl80211_iftype iftype) | ||
330 | { | 331 | { |
331 | int width; | 332 | int width; |
332 | int r; | 333 | int ret; |
333 | 334 | ||
334 | if (WARN_ON(!cfg80211_chandef_valid(chandef))) | 335 | if (WARN_ON(!cfg80211_chandef_valid(chandef))) |
335 | return -EINVAL; | 336 | return -EINVAL; |
336 | 337 | ||
337 | width = cfg80211_chandef_get_width(chandef); | 338 | switch (iftype) { |
338 | if (width < 0) | 339 | case NL80211_IFTYPE_ADHOC: |
339 | return -EINVAL; | 340 | case NL80211_IFTYPE_AP: |
341 | case NL80211_IFTYPE_P2P_GO: | ||
342 | case NL80211_IFTYPE_MESH_POINT: | ||
343 | width = cfg80211_chandef_get_width(chandef); | ||
344 | if (width < 0) | ||
345 | return -EINVAL; | ||
340 | 346 | ||
341 | r = cfg80211_get_chans_dfs_required(wiphy, chandef->center_freq1, | 347 | ret = cfg80211_get_chans_dfs_required(wiphy, |
342 | width); | 348 | chandef->center_freq1, |
343 | if (r) | 349 | width); |
344 | return r; | 350 | if (ret < 0) |
351 | return ret; | ||
352 | else if (ret > 0) | ||
353 | return BIT(chandef->width); | ||
345 | 354 | ||
346 | if (!chandef->center_freq2) | 355 | if (!chandef->center_freq2) |
347 | return 0; | 356 | return 0; |
357 | |||
358 | ret = cfg80211_get_chans_dfs_required(wiphy, | ||
359 | chandef->center_freq2, | ||
360 | width); | ||
361 | if (ret < 0) | ||
362 | return ret; | ||
363 | else if (ret > 0) | ||
364 | return BIT(chandef->width); | ||
348 | 365 | ||
349 | return cfg80211_get_chans_dfs_required(wiphy, chandef->center_freq2, | 366 | break; |
350 | width); | 367 | case NL80211_IFTYPE_STATION: |
368 | case NL80211_IFTYPE_P2P_CLIENT: | ||
369 | case NL80211_IFTYPE_MONITOR: | ||
370 | case NL80211_IFTYPE_AP_VLAN: | ||
371 | case NL80211_IFTYPE_WDS: | ||
372 | case NL80211_IFTYPE_P2P_DEVICE: | ||
373 | case NL80211_IFTYPE_UNSPECIFIED: | ||
374 | break; | ||
375 | case NUM_NL80211_IFTYPES: | ||
376 | WARN_ON(1); | ||
377 | } | ||
378 | |||
379 | return 0; | ||
351 | } | 380 | } |
352 | EXPORT_SYMBOL(cfg80211_chandef_dfs_required); | 381 | EXPORT_SYMBOL(cfg80211_chandef_dfs_required); |
353 | 382 | ||
@@ -587,12 +616,14 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, | |||
587 | width = 5; | 616 | width = 5; |
588 | break; | 617 | break; |
589 | case NL80211_CHAN_WIDTH_10: | 618 | case NL80211_CHAN_WIDTH_10: |
619 | prohibited_flags |= IEEE80211_CHAN_NO_10MHZ; | ||
590 | width = 10; | 620 | width = 10; |
591 | break; | 621 | break; |
592 | case NL80211_CHAN_WIDTH_20: | 622 | case NL80211_CHAN_WIDTH_20: |
593 | if (!ht_cap->ht_supported) | 623 | if (!ht_cap->ht_supported) |
594 | return false; | 624 | return false; |
595 | case NL80211_CHAN_WIDTH_20_NOHT: | 625 | case NL80211_CHAN_WIDTH_20_NOHT: |
626 | prohibited_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
596 | width = 20; | 627 | width = 20; |
597 | break; | 628 | break; |
598 | case NL80211_CHAN_WIDTH_40: | 629 | case NL80211_CHAN_WIDTH_40: |
@@ -661,17 +692,112 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, | |||
661 | } | 692 | } |
662 | EXPORT_SYMBOL(cfg80211_chandef_usable); | 693 | EXPORT_SYMBOL(cfg80211_chandef_usable); |
663 | 694 | ||
695 | /* | ||
696 | * For GO only, check if the channel can be used under permissive conditions | ||
697 | * mandated by the some regulatory bodies, i.e., the channel is marked with | ||
698 | * IEEE80211_CHAN_GO_CONCURRENT and there is an additional station interface | ||
699 | * associated to an AP on the same channel or on the same UNII band | ||
700 | * (assuming that the AP is an authorized master). | ||
701 | * In addition allow the GO to operate on a channel on which indoor operation is | ||
702 | * allowed, iff we are currently operating in an indoor environment. | ||
703 | */ | ||
704 | static bool cfg80211_go_permissive_chan(struct cfg80211_registered_device *rdev, | ||
705 | struct ieee80211_channel *chan) | ||
706 | { | ||
707 | struct wireless_dev *wdev_iter; | ||
708 | struct wiphy *wiphy = wiphy_idx_to_wiphy(rdev->wiphy_idx); | ||
709 | |||
710 | ASSERT_RTNL(); | ||
711 | |||
712 | if (!config_enabled(CONFIG_CFG80211_REG_RELAX_NO_IR) || | ||
713 | !(wiphy->regulatory_flags & REGULATORY_ENABLE_RELAX_NO_IR)) | ||
714 | return false; | ||
715 | |||
716 | if (regulatory_indoor_allowed() && | ||
717 | (chan->flags & IEEE80211_CHAN_INDOOR_ONLY)) | ||
718 | return true; | ||
719 | |||
720 | if (!(chan->flags & IEEE80211_CHAN_GO_CONCURRENT)) | ||
721 | return false; | ||
722 | |||
723 | /* | ||
724 | * Generally, it is possible to rely on another device/driver to allow | ||
725 | * the GO concurrent relaxation, however, since the device can further | ||
726 | * enforce the relaxation (by doing a similar verifications as this), | ||
727 | * and thus fail the GO instantiation, consider only the interfaces of | ||
728 | * the current registered device. | ||
729 | */ | ||
730 | list_for_each_entry(wdev_iter, &rdev->wdev_list, list) { | ||
731 | struct ieee80211_channel *other_chan = NULL; | ||
732 | int r1, r2; | ||
733 | |||
734 | if (wdev_iter->iftype != NL80211_IFTYPE_STATION || | ||
735 | !netif_running(wdev_iter->netdev)) | ||
736 | continue; | ||
737 | |||
738 | wdev_lock(wdev_iter); | ||
739 | if (wdev_iter->current_bss) | ||
740 | other_chan = wdev_iter->current_bss->pub.channel; | ||
741 | wdev_unlock(wdev_iter); | ||
742 | |||
743 | if (!other_chan) | ||
744 | continue; | ||
745 | |||
746 | if (chan == other_chan) | ||
747 | return true; | ||
748 | |||
749 | if (chan->band != IEEE80211_BAND_5GHZ) | ||
750 | continue; | ||
751 | |||
752 | r1 = cfg80211_get_unii(chan->center_freq); | ||
753 | r2 = cfg80211_get_unii(other_chan->center_freq); | ||
754 | |||
755 | if (r1 != -EINVAL && r1 == r2) { | ||
756 | /* | ||
757 | * At some locations channels 149-165 are considered a | ||
758 | * bundle, but at other locations, e.g., Indonesia, | ||
759 | * channels 149-161 are considered a bundle while | ||
760 | * channel 165 is left out and considered to be in a | ||
761 | * different bundle. Thus, in case that there is a | ||
762 | * station interface connected to an AP on channel 165, | ||
763 | * it is assumed that channels 149-161 are allowed for | ||
764 | * GO operations. However, having a station interface | ||
765 | * connected to an AP on channels 149-161, does not | ||
766 | * allow GO operation on channel 165. | ||
767 | */ | ||
768 | if (chan->center_freq == 5825 && | ||
769 | other_chan->center_freq != 5825) | ||
770 | continue; | ||
771 | return true; | ||
772 | } | ||
773 | } | ||
774 | |||
775 | return false; | ||
776 | } | ||
777 | |||
664 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | 778 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, |
665 | struct cfg80211_chan_def *chandef) | 779 | struct cfg80211_chan_def *chandef, |
780 | enum nl80211_iftype iftype) | ||
666 | { | 781 | { |
782 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); | ||
667 | bool res; | 783 | bool res; |
668 | u32 prohibited_flags = IEEE80211_CHAN_DISABLED | | 784 | u32 prohibited_flags = IEEE80211_CHAN_DISABLED | |
669 | IEEE80211_CHAN_NO_IR | | ||
670 | IEEE80211_CHAN_RADAR; | 785 | IEEE80211_CHAN_RADAR; |
671 | 786 | ||
672 | trace_cfg80211_reg_can_beacon(wiphy, chandef); | 787 | trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype); |
673 | 788 | ||
674 | if (cfg80211_chandef_dfs_required(wiphy, chandef) > 0 && | 789 | /* |
790 | * Under certain conditions suggested by the some regulatory bodies | ||
791 | * a GO can operate on channels marked with IEEE80211_NO_IR | ||
792 | * so set this flag only if such relaxations are not enabled and | ||
793 | * the conditions are not met. | ||
794 | */ | ||
795 | if (iftype != NL80211_IFTYPE_P2P_GO || | ||
796 | !cfg80211_go_permissive_chan(rdev, chandef->chan)) | ||
797 | prohibited_flags |= IEEE80211_CHAN_NO_IR; | ||
798 | |||
799 | if (cfg80211_chandef_dfs_required(wiphy, chandef, | ||
800 | NL80211_IFTYPE_UNSPECIFIED) > 0 && | ||
675 | cfg80211_chandef_dfs_available(wiphy, chandef)) { | 801 | cfg80211_chandef_dfs_available(wiphy, chandef)) { |
676 | /* We can skip IEEE80211_CHAN_NO_IR if chandef dfs available */ | 802 | /* We can skip IEEE80211_CHAN_NO_IR if chandef dfs available */ |
677 | prohibited_flags = IEEE80211_CHAN_DISABLED; | 803 | prohibited_flags = IEEE80211_CHAN_DISABLED; |
@@ -701,6 +827,8 @@ cfg80211_get_chan_state(struct wireless_dev *wdev, | |||
701 | enum cfg80211_chan_mode *chanmode, | 827 | enum cfg80211_chan_mode *chanmode, |
702 | u8 *radar_detect) | 828 | u8 *radar_detect) |
703 | { | 829 | { |
830 | int ret; | ||
831 | |||
704 | *chan = NULL; | 832 | *chan = NULL; |
705 | *chanmode = CHAN_MODE_UNDEFINED; | 833 | *chanmode = CHAN_MODE_UNDEFINED; |
706 | 834 | ||
@@ -743,8 +871,11 @@ cfg80211_get_chan_state(struct wireless_dev *wdev, | |||
743 | *chan = wdev->chandef.chan; | 871 | *chan = wdev->chandef.chan; |
744 | *chanmode = CHAN_MODE_SHARED; | 872 | *chanmode = CHAN_MODE_SHARED; |
745 | 873 | ||
746 | if (cfg80211_chandef_dfs_required(wdev->wiphy, | 874 | ret = cfg80211_chandef_dfs_required(wdev->wiphy, |
747 | &wdev->chandef)) | 875 | &wdev->chandef, |
876 | wdev->iftype); | ||
877 | WARN_ON(ret < 0); | ||
878 | if (ret > 0) | ||
748 | *radar_detect |= BIT(wdev->chandef.width); | 879 | *radar_detect |= BIT(wdev->chandef.width); |
749 | } | 880 | } |
750 | return; | 881 | return; |
@@ -753,8 +884,11 @@ cfg80211_get_chan_state(struct wireless_dev *wdev, | |||
753 | *chan = wdev->chandef.chan; | 884 | *chan = wdev->chandef.chan; |
754 | *chanmode = CHAN_MODE_SHARED; | 885 | *chanmode = CHAN_MODE_SHARED; |
755 | 886 | ||
756 | if (cfg80211_chandef_dfs_required(wdev->wiphy, | 887 | ret = cfg80211_chandef_dfs_required(wdev->wiphy, |
757 | &wdev->chandef)) | 888 | &wdev->chandef, |
889 | wdev->iftype); | ||
890 | WARN_ON(ret < 0); | ||
891 | if (ret > 0) | ||
758 | *radar_detect |= BIT(wdev->chandef.width); | 892 | *radar_detect |= BIT(wdev->chandef.width); |
759 | } | 893 | } |
760 | return; | 894 | return; |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 086cddd03ba6..b3ff3697239a 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -69,7 +69,7 @@ struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx) | |||
69 | 69 | ||
70 | int get_wiphy_idx(struct wiphy *wiphy) | 70 | int get_wiphy_idx(struct wiphy *wiphy) |
71 | { | 71 | { |
72 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 72 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
73 | 73 | ||
74 | return rdev->wiphy_idx; | 74 | return rdev->wiphy_idx; |
75 | } | 75 | } |
@@ -260,6 +260,45 @@ static void cfg80211_event_work(struct work_struct *work) | |||
260 | rtnl_unlock(); | 260 | rtnl_unlock(); |
261 | } | 261 | } |
262 | 262 | ||
263 | void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev) | ||
264 | { | ||
265 | struct cfg80211_iface_destroy *item; | ||
266 | |||
267 | ASSERT_RTNL(); | ||
268 | |||
269 | spin_lock_irq(&rdev->destroy_list_lock); | ||
270 | while ((item = list_first_entry_or_null(&rdev->destroy_list, | ||
271 | struct cfg80211_iface_destroy, | ||
272 | list))) { | ||
273 | struct wireless_dev *wdev, *tmp; | ||
274 | u32 nlportid = item->nlportid; | ||
275 | |||
276 | list_del(&item->list); | ||
277 | kfree(item); | ||
278 | spin_unlock_irq(&rdev->destroy_list_lock); | ||
279 | |||
280 | list_for_each_entry_safe(wdev, tmp, &rdev->wdev_list, list) { | ||
281 | if (nlportid == wdev->owner_nlportid) | ||
282 | rdev_del_virtual_intf(rdev, wdev); | ||
283 | } | ||
284 | |||
285 | spin_lock_irq(&rdev->destroy_list_lock); | ||
286 | } | ||
287 | spin_unlock_irq(&rdev->destroy_list_lock); | ||
288 | } | ||
289 | |||
290 | static void cfg80211_destroy_iface_wk(struct work_struct *work) | ||
291 | { | ||
292 | struct cfg80211_registered_device *rdev; | ||
293 | |||
294 | rdev = container_of(work, struct cfg80211_registered_device, | ||
295 | destroy_work); | ||
296 | |||
297 | rtnl_lock(); | ||
298 | cfg80211_destroy_ifaces(rdev); | ||
299 | rtnl_unlock(); | ||
300 | } | ||
301 | |||
263 | /* exported functions */ | 302 | /* exported functions */ |
264 | 303 | ||
265 | struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv) | 304 | struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv) |
@@ -318,6 +357,10 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv) | |||
318 | rdev->wiphy.dev.class = &ieee80211_class; | 357 | rdev->wiphy.dev.class = &ieee80211_class; |
319 | rdev->wiphy.dev.platform_data = rdev; | 358 | rdev->wiphy.dev.platform_data = rdev; |
320 | 359 | ||
360 | INIT_LIST_HEAD(&rdev->destroy_list); | ||
361 | spin_lock_init(&rdev->destroy_list_lock); | ||
362 | INIT_WORK(&rdev->destroy_work, cfg80211_destroy_iface_wk); | ||
363 | |||
321 | #ifdef CONFIG_CFG80211_DEFAULT_PS | 364 | #ifdef CONFIG_CFG80211_DEFAULT_PS |
322 | rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; | 365 | rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; |
323 | #endif | 366 | #endif |
@@ -396,10 +439,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) | |||
396 | for (j = 0; j < c->n_limits; j++) { | 439 | for (j = 0; j < c->n_limits; j++) { |
397 | u16 types = c->limits[j].types; | 440 | u16 types = c->limits[j].types; |
398 | 441 | ||
399 | /* | 442 | /* interface types shouldn't overlap */ |
400 | * interface types shouldn't overlap, this is | ||
401 | * used in cfg80211_can_change_interface() | ||
402 | */ | ||
403 | if (WARN_ON(types & all_iftypes)) | 443 | if (WARN_ON(types & all_iftypes)) |
404 | return -EINVAL; | 444 | return -EINVAL; |
405 | all_iftypes |= types; | 445 | all_iftypes |= types; |
@@ -435,7 +475,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) | |||
435 | 475 | ||
436 | int wiphy_register(struct wiphy *wiphy) | 476 | int wiphy_register(struct wiphy *wiphy) |
437 | { | 477 | { |
438 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 478 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
439 | int res; | 479 | int res; |
440 | enum ieee80211_band band; | 480 | enum ieee80211_band band; |
441 | struct ieee80211_supported_band *sband; | 481 | struct ieee80211_supported_band *sband; |
@@ -616,7 +656,7 @@ EXPORT_SYMBOL(wiphy_register); | |||
616 | 656 | ||
617 | void wiphy_rfkill_start_polling(struct wiphy *wiphy) | 657 | void wiphy_rfkill_start_polling(struct wiphy *wiphy) |
618 | { | 658 | { |
619 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 659 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
620 | 660 | ||
621 | if (!rdev->ops->rfkill_poll) | 661 | if (!rdev->ops->rfkill_poll) |
622 | return; | 662 | return; |
@@ -627,7 +667,7 @@ EXPORT_SYMBOL(wiphy_rfkill_start_polling); | |||
627 | 667 | ||
628 | void wiphy_rfkill_stop_polling(struct wiphy *wiphy) | 668 | void wiphy_rfkill_stop_polling(struct wiphy *wiphy) |
629 | { | 669 | { |
630 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 670 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
631 | 671 | ||
632 | rfkill_pause_polling(rdev->rfkill); | 672 | rfkill_pause_polling(rdev->rfkill); |
633 | } | 673 | } |
@@ -635,7 +675,7 @@ EXPORT_SYMBOL(wiphy_rfkill_stop_polling); | |||
635 | 675 | ||
636 | void wiphy_unregister(struct wiphy *wiphy) | 676 | void wiphy_unregister(struct wiphy *wiphy) |
637 | { | 677 | { |
638 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 678 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
639 | 679 | ||
640 | wait_event(rdev->dev_wait, ({ | 680 | wait_event(rdev->dev_wait, ({ |
641 | int __count; | 681 | int __count; |
@@ -675,6 +715,7 @@ void wiphy_unregister(struct wiphy *wiphy) | |||
675 | cancel_work_sync(&rdev->conn_work); | 715 | cancel_work_sync(&rdev->conn_work); |
676 | flush_work(&rdev->event_work); | 716 | flush_work(&rdev->event_work); |
677 | cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); | 717 | cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); |
718 | flush_work(&rdev->destroy_work); | ||
678 | 719 | ||
679 | #ifdef CONFIG_PM | 720 | #ifdef CONFIG_PM |
680 | if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) | 721 | if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) |
@@ -707,7 +748,7 @@ EXPORT_SYMBOL(wiphy_free); | |||
707 | 748 | ||
708 | void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) | 749 | void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) |
709 | { | 750 | { |
710 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 751 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
711 | 752 | ||
712 | if (rfkill_set_hw_state(rdev->rfkill, blocked)) | 753 | if (rfkill_set_hw_state(rdev->rfkill, blocked)) |
713 | schedule_work(&rdev->rfkill_sync); | 754 | schedule_work(&rdev->rfkill_sync); |
@@ -716,7 +757,7 @@ EXPORT_SYMBOL(wiphy_rfkill_set_hw_state); | |||
716 | 757 | ||
717 | void cfg80211_unregister_wdev(struct wireless_dev *wdev) | 758 | void cfg80211_unregister_wdev(struct wireless_dev *wdev) |
718 | { | 759 | { |
719 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 760 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
720 | 761 | ||
721 | ASSERT_RTNL(); | 762 | ASSERT_RTNL(); |
722 | 763 | ||
@@ -796,12 +837,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | |||
796 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); | 837 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
797 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 838 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
798 | struct cfg80211_registered_device *rdev; | 839 | struct cfg80211_registered_device *rdev; |
799 | int ret; | ||
800 | 840 | ||
801 | if (!wdev) | 841 | if (!wdev) |
802 | return NOTIFY_DONE; | 842 | return NOTIFY_DONE; |
803 | 843 | ||
804 | rdev = wiphy_to_dev(wdev->wiphy); | 844 | rdev = wiphy_to_rdev(wdev->wiphy); |
805 | 845 | ||
806 | WARN_ON(wdev->iftype == NL80211_IFTYPE_UNSPECIFIED); | 846 | WARN_ON(wdev->iftype == NL80211_IFTYPE_UNSPECIFIED); |
807 | 847 | ||
@@ -959,13 +999,14 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | |||
959 | case NETDEV_PRE_UP: | 999 | case NETDEV_PRE_UP: |
960 | if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) | 1000 | if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) |
961 | return notifier_from_errno(-EOPNOTSUPP); | 1001 | return notifier_from_errno(-EOPNOTSUPP); |
962 | ret = cfg80211_can_add_interface(rdev, wdev->iftype); | 1002 | if (rfkill_blocked(rdev->rfkill)) |
963 | if (ret) | 1003 | return notifier_from_errno(-ERFKILL); |
964 | return notifier_from_errno(ret); | ||
965 | break; | 1004 | break; |
1005 | default: | ||
1006 | return NOTIFY_DONE; | ||
966 | } | 1007 | } |
967 | 1008 | ||
968 | return NOTIFY_DONE; | 1009 | return NOTIFY_OK; |
969 | } | 1010 | } |
970 | 1011 | ||
971 | static struct notifier_block cfg80211_netdev_notifier = { | 1012 | static struct notifier_block cfg80211_netdev_notifier = { |
diff --git a/net/wireless/core.h b/net/wireless/core.h index 5b1fdcadd469..681b8fa4355b 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -80,13 +80,17 @@ struct cfg80211_registered_device { | |||
80 | 80 | ||
81 | struct cfg80211_coalesce *coalesce; | 81 | struct cfg80211_coalesce *coalesce; |
82 | 82 | ||
83 | spinlock_t destroy_list_lock; | ||
84 | struct list_head destroy_list; | ||
85 | struct work_struct destroy_work; | ||
86 | |||
83 | /* must be last because of the way we do wiphy_priv(), | 87 | /* must be last because of the way we do wiphy_priv(), |
84 | * and it should at least be aligned to NETDEV_ALIGN */ | 88 | * and it should at least be aligned to NETDEV_ALIGN */ |
85 | struct wiphy wiphy __aligned(NETDEV_ALIGN); | 89 | struct wiphy wiphy __aligned(NETDEV_ALIGN); |
86 | }; | 90 | }; |
87 | 91 | ||
88 | static inline | 92 | static inline |
89 | struct cfg80211_registered_device *wiphy_to_dev(struct wiphy *wiphy) | 93 | struct cfg80211_registered_device *wiphy_to_rdev(struct wiphy *wiphy) |
90 | { | 94 | { |
91 | BUG_ON(!wiphy); | 95 | BUG_ON(!wiphy); |
92 | return container_of(wiphy, struct cfg80211_registered_device, wiphy); | 96 | return container_of(wiphy, struct cfg80211_registered_device, wiphy); |
@@ -232,6 +236,13 @@ struct cfg80211_beacon_registration { | |||
232 | u32 nlportid; | 236 | u32 nlportid; |
233 | }; | 237 | }; |
234 | 238 | ||
239 | struct cfg80211_iface_destroy { | ||
240 | struct list_head list; | ||
241 | u32 nlportid; | ||
242 | }; | ||
243 | |||
244 | void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev); | ||
245 | |||
235 | /* free object */ | 246 | /* free object */ |
236 | void cfg80211_dev_free(struct cfg80211_registered_device *rdev); | 247 | void cfg80211_dev_free(struct cfg80211_registered_device *rdev); |
237 | 248 | ||
@@ -240,8 +251,8 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, | |||
240 | 251 | ||
241 | void ieee80211_set_bitrate_flags(struct wiphy *wiphy); | 252 | void ieee80211_set_bitrate_flags(struct wiphy *wiphy); |
242 | 253 | ||
243 | void cfg80211_bss_expire(struct cfg80211_registered_device *dev); | 254 | void cfg80211_bss_expire(struct cfg80211_registered_device *rdev); |
244 | void cfg80211_bss_age(struct cfg80211_registered_device *dev, | 255 | void cfg80211_bss_age(struct cfg80211_registered_device *rdev, |
245 | unsigned long age_secs); | 256 | unsigned long age_secs); |
246 | 257 | ||
247 | /* IBSS */ | 258 | /* IBSS */ |
@@ -401,35 +412,6 @@ unsigned int | |||
401 | cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, | 412 | cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, |
402 | const struct cfg80211_chan_def *chandef); | 413 | const struct cfg80211_chan_def *chandef); |
403 | 414 | ||
404 | static inline int | ||
405 | cfg80211_can_change_interface(struct cfg80211_registered_device *rdev, | ||
406 | struct wireless_dev *wdev, | ||
407 | enum nl80211_iftype iftype) | ||
408 | { | ||
409 | return cfg80211_can_use_iftype_chan(rdev, wdev, iftype, NULL, | ||
410 | CHAN_MODE_UNDEFINED, 0); | ||
411 | } | ||
412 | |||
413 | static inline int | ||
414 | cfg80211_can_add_interface(struct cfg80211_registered_device *rdev, | ||
415 | enum nl80211_iftype iftype) | ||
416 | { | ||
417 | if (rfkill_blocked(rdev->rfkill)) | ||
418 | return -ERFKILL; | ||
419 | |||
420 | return cfg80211_can_change_interface(rdev, NULL, iftype); | ||
421 | } | ||
422 | |||
423 | static inline int | ||
424 | cfg80211_can_use_chan(struct cfg80211_registered_device *rdev, | ||
425 | struct wireless_dev *wdev, | ||
426 | struct ieee80211_channel *chan, | ||
427 | enum cfg80211_chan_mode chanmode) | ||
428 | { | ||
429 | return cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype, | ||
430 | chan, chanmode, 0); | ||
431 | } | ||
432 | |||
433 | static inline unsigned int elapsed_jiffies_msecs(unsigned long start) | 415 | static inline unsigned int elapsed_jiffies_msecs(unsigned long start) |
434 | { | 416 | { |
435 | unsigned long end = jiffies; | 417 | unsigned long end = jiffies; |
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c index e37862f1b127..d4860bfc020e 100644 --- a/net/wireless/ethtool.c +++ b/net/wireless/ethtool.c | |||
@@ -43,7 +43,7 @@ static void cfg80211_get_ringparam(struct net_device *dev, | |||
43 | struct ethtool_ringparam *rp) | 43 | struct ethtool_ringparam *rp) |
44 | { | 44 | { |
45 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 45 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
46 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 46 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
47 | 47 | ||
48 | memset(rp, 0, sizeof(*rp)); | 48 | memset(rp, 0, sizeof(*rp)); |
49 | 49 | ||
@@ -56,7 +56,7 @@ static int cfg80211_set_ringparam(struct net_device *dev, | |||
56 | struct ethtool_ringparam *rp) | 56 | struct ethtool_ringparam *rp) |
57 | { | 57 | { |
58 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 58 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
59 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 59 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
60 | 60 | ||
61 | if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0) | 61 | if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0) |
62 | return -EINVAL; | 62 | return -EINVAL; |
@@ -70,7 +70,7 @@ static int cfg80211_set_ringparam(struct net_device *dev, | |||
70 | static int cfg80211_get_sset_count(struct net_device *dev, int sset) | 70 | static int cfg80211_get_sset_count(struct net_device *dev, int sset) |
71 | { | 71 | { |
72 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 72 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
73 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 73 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
74 | if (rdev->ops->get_et_sset_count) | 74 | if (rdev->ops->get_et_sset_count) |
75 | return rdev_get_et_sset_count(rdev, dev, sset); | 75 | return rdev_get_et_sset_count(rdev, dev, sset); |
76 | return -EOPNOTSUPP; | 76 | return -EOPNOTSUPP; |
@@ -80,7 +80,7 @@ static void cfg80211_get_stats(struct net_device *dev, | |||
80 | struct ethtool_stats *stats, u64 *data) | 80 | struct ethtool_stats *stats, u64 *data) |
81 | { | 81 | { |
82 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 82 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
83 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 83 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
84 | if (rdev->ops->get_et_stats) | 84 | if (rdev->ops->get_et_stats) |
85 | rdev_get_et_stats(rdev, dev, stats, data); | 85 | rdev_get_et_stats(rdev, dev, stats, data); |
86 | } | 86 | } |
@@ -88,7 +88,7 @@ static void cfg80211_get_stats(struct net_device *dev, | |||
88 | static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data) | 88 | static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data) |
89 | { | 89 | { |
90 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 90 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
91 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 91 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
92 | if (rdev->ops->get_et_strings) | 92 | if (rdev->ops->get_et_strings) |
93 | rdev_get_et_strings(rdev, dev, sset, data); | 93 | rdev_get_et_strings(rdev, dev, sset, data); |
94 | } | 94 | } |
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index a6b5bdad039c..6b50588b709f 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -45,7 +45,7 @@ void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, | |||
45 | 45 | ||
46 | cfg80211_upload_connect_keys(wdev); | 46 | cfg80211_upload_connect_keys(wdev); |
47 | 47 | ||
48 | nl80211_send_ibss_bssid(wiphy_to_dev(wdev->wiphy), dev, bssid, | 48 | nl80211_send_ibss_bssid(wiphy_to_rdev(wdev->wiphy), dev, bssid, |
49 | GFP_KERNEL); | 49 | GFP_KERNEL); |
50 | #ifdef CONFIG_CFG80211_WEXT | 50 | #ifdef CONFIG_CFG80211_WEXT |
51 | memset(&wrqu, 0, sizeof(wrqu)); | 51 | memset(&wrqu, 0, sizeof(wrqu)); |
@@ -58,7 +58,7 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, | |||
58 | struct ieee80211_channel *channel, gfp_t gfp) | 58 | struct ieee80211_channel *channel, gfp_t gfp) |
59 | { | 59 | { |
60 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 60 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
61 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 61 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
62 | struct cfg80211_event *ev; | 62 | struct cfg80211_event *ev; |
63 | unsigned long flags; | 63 | unsigned long flags; |
64 | 64 | ||
@@ -88,8 +88,6 @@ static int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, | |||
88 | struct cfg80211_cached_keys *connkeys) | 88 | struct cfg80211_cached_keys *connkeys) |
89 | { | 89 | { |
90 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 90 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
91 | struct ieee80211_channel *check_chan; | ||
92 | u8 radar_detect_width = 0; | ||
93 | int err; | 91 | int err; |
94 | 92 | ||
95 | ASSERT_WDEV_LOCK(wdev); | 93 | ASSERT_WDEV_LOCK(wdev); |
@@ -126,28 +124,6 @@ static int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, | |||
126 | #ifdef CONFIG_CFG80211_WEXT | 124 | #ifdef CONFIG_CFG80211_WEXT |
127 | wdev->wext.ibss.chandef = params->chandef; | 125 | wdev->wext.ibss.chandef = params->chandef; |
128 | #endif | 126 | #endif |
129 | check_chan = params->chandef.chan; | ||
130 | if (params->userspace_handles_dfs) { | ||
131 | /* Check for radar even if the current channel is not | ||
132 | * a radar channel - it might decide to change to DFS | ||
133 | * channel later. | ||
134 | */ | ||
135 | radar_detect_width = BIT(params->chandef.width); | ||
136 | } | ||
137 | |||
138 | err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype, | ||
139 | check_chan, | ||
140 | (params->channel_fixed && | ||
141 | !radar_detect_width) | ||
142 | ? CHAN_MODE_SHARED | ||
143 | : CHAN_MODE_EXCLUSIVE, | ||
144 | radar_detect_width); | ||
145 | |||
146 | if (err) { | ||
147 | wdev->connect_keys = NULL; | ||
148 | return err; | ||
149 | } | ||
150 | |||
151 | err = rdev_join_ibss(rdev, dev, params); | 127 | err = rdev_join_ibss(rdev, dev, params); |
152 | if (err) { | 128 | if (err) { |
153 | wdev->connect_keys = NULL; | 129 | wdev->connect_keys = NULL; |
@@ -180,7 +156,7 @@ int cfg80211_join_ibss(struct cfg80211_registered_device *rdev, | |||
180 | static void __cfg80211_clear_ibss(struct net_device *dev, bool nowext) | 156 | static void __cfg80211_clear_ibss(struct net_device *dev, bool nowext) |
181 | { | 157 | { |
182 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 158 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
183 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 159 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
184 | int i; | 160 | int i; |
185 | 161 | ||
186 | ASSERT_WDEV_LOCK(wdev); | 162 | ASSERT_WDEV_LOCK(wdev); |
@@ -335,7 +311,7 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | |||
335 | struct iw_freq *wextfreq, char *extra) | 311 | struct iw_freq *wextfreq, char *extra) |
336 | { | 312 | { |
337 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 313 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
338 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 314 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
339 | struct ieee80211_channel *chan = NULL; | 315 | struct ieee80211_channel *chan = NULL; |
340 | int err, freq; | 316 | int err, freq; |
341 | 317 | ||
@@ -346,7 +322,7 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | |||
346 | if (!rdev->ops->join_ibss) | 322 | if (!rdev->ops->join_ibss) |
347 | return -EOPNOTSUPP; | 323 | return -EOPNOTSUPP; |
348 | 324 | ||
349 | freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); | 325 | freq = cfg80211_wext_freq(wextfreq); |
350 | if (freq < 0) | 326 | if (freq < 0) |
351 | return freq; | 327 | return freq; |
352 | 328 | ||
@@ -420,7 +396,7 @@ int cfg80211_ibss_wext_siwessid(struct net_device *dev, | |||
420 | struct iw_point *data, char *ssid) | 396 | struct iw_point *data, char *ssid) |
421 | { | 397 | { |
422 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 398 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
423 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 399 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
424 | size_t len = data->length; | 400 | size_t len = data->length; |
425 | int err; | 401 | int err; |
426 | 402 | ||
@@ -487,7 +463,7 @@ int cfg80211_ibss_wext_siwap(struct net_device *dev, | |||
487 | struct sockaddr *ap_addr, char *extra) | 463 | struct sockaddr *ap_addr, char *extra) |
488 | { | 464 | { |
489 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 465 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
490 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 466 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
491 | u8 *bssid = ap_addr->sa_data; | 467 | u8 *bssid = ap_addr->sa_data; |
492 | int err; | 468 | int err; |
493 | 469 | ||
@@ -505,6 +481,9 @@ int cfg80211_ibss_wext_siwap(struct net_device *dev, | |||
505 | if (is_zero_ether_addr(bssid) || is_broadcast_ether_addr(bssid)) | 481 | if (is_zero_ether_addr(bssid) || is_broadcast_ether_addr(bssid)) |
506 | bssid = NULL; | 482 | bssid = NULL; |
507 | 483 | ||
484 | if (bssid && !is_valid_ether_addr(bssid)) | ||
485 | return -EINVAL; | ||
486 | |||
508 | /* both automatic */ | 487 | /* both automatic */ |
509 | if (!bssid && !wdev->wext.ibss.bssid) | 488 | if (!bssid && !wdev->wext.ibss.bssid) |
510 | return 0; | 489 | return 0; |
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index 5af5cc6b2c4c..3ddfb7cd335e 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c | |||
@@ -99,7 +99,6 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, | |||
99 | const struct mesh_config *conf) | 99 | const struct mesh_config *conf) |
100 | { | 100 | { |
101 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 101 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
102 | u8 radar_detect_width = 0; | ||
103 | int err; | 102 | int err; |
104 | 103 | ||
105 | BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != IEEE80211_MAX_MESH_ID_LEN); | 104 | BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != IEEE80211_MAX_MESH_ID_LEN); |
@@ -175,22 +174,10 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, | |||
175 | scan_width); | 174 | scan_width); |
176 | } | 175 | } |
177 | 176 | ||
178 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef)) | 177 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef, |
178 | NL80211_IFTYPE_MESH_POINT)) | ||
179 | return -EINVAL; | 179 | return -EINVAL; |
180 | 180 | ||
181 | err = cfg80211_chandef_dfs_required(wdev->wiphy, &setup->chandef); | ||
182 | if (err < 0) | ||
183 | return err; | ||
184 | if (err) | ||
185 | radar_detect_width = BIT(setup->chandef.width); | ||
186 | |||
187 | err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype, | ||
188 | setup->chandef.chan, | ||
189 | CHAN_MODE_SHARED, | ||
190 | radar_detect_width); | ||
191 | if (err) | ||
192 | return err; | ||
193 | |||
194 | err = rdev_join_mesh(rdev, dev, conf, setup); | 181 | err = rdev_join_mesh(rdev, dev, conf, setup); |
195 | if (!err) { | 182 | if (!err) { |
196 | memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len); | 183 | memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len); |
@@ -236,17 +223,6 @@ int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev, | |||
236 | if (!netif_running(wdev->netdev)) | 223 | if (!netif_running(wdev->netdev)) |
237 | return -ENETDOWN; | 224 | return -ENETDOWN; |
238 | 225 | ||
239 | /* cfg80211_can_use_chan() calls | ||
240 | * cfg80211_can_use_iftype_chan() with no radar | ||
241 | * detection, so if we're trying to use a radar | ||
242 | * channel here, something is wrong. | ||
243 | */ | ||
244 | WARN_ON_ONCE(chandef->chan->flags & IEEE80211_CHAN_RADAR); | ||
245 | err = cfg80211_can_use_chan(rdev, wdev, chandef->chan, | ||
246 | CHAN_MODE_SHARED); | ||
247 | if (err) | ||
248 | return err; | ||
249 | |||
250 | err = rdev_libertas_set_mesh_channel(rdev, wdev->netdev, | 226 | err = rdev_libertas_set_mesh_channel(rdev, wdev->netdev, |
251 | chandef->chan); | 227 | chandef->chan); |
252 | if (!err) | 228 | if (!err) |
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index c52ff59a3e96..266766b8d80b 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -23,7 +23,7 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss, | |||
23 | { | 23 | { |
24 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 24 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
25 | struct wiphy *wiphy = wdev->wiphy; | 25 | struct wiphy *wiphy = wdev->wiphy; |
26 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 26 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
27 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; | 27 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; |
28 | u8 *ie = mgmt->u.assoc_resp.variable; | 28 | u8 *ie = mgmt->u.assoc_resp.variable; |
29 | int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); | 29 | int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); |
@@ -54,7 +54,7 @@ EXPORT_SYMBOL(cfg80211_rx_assoc_resp); | |||
54 | static void cfg80211_process_auth(struct wireless_dev *wdev, | 54 | static void cfg80211_process_auth(struct wireless_dev *wdev, |
55 | const u8 *buf, size_t len) | 55 | const u8 *buf, size_t len) |
56 | { | 56 | { |
57 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 57 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
58 | 58 | ||
59 | nl80211_send_rx_auth(rdev, wdev->netdev, buf, len, GFP_KERNEL); | 59 | nl80211_send_rx_auth(rdev, wdev->netdev, buf, len, GFP_KERNEL); |
60 | cfg80211_sme_rx_auth(wdev, buf, len); | 60 | cfg80211_sme_rx_auth(wdev, buf, len); |
@@ -63,7 +63,7 @@ static void cfg80211_process_auth(struct wireless_dev *wdev, | |||
63 | static void cfg80211_process_deauth(struct wireless_dev *wdev, | 63 | static void cfg80211_process_deauth(struct wireless_dev *wdev, |
64 | const u8 *buf, size_t len) | 64 | const u8 *buf, size_t len) |
65 | { | 65 | { |
66 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 66 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
67 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; | 67 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; |
68 | const u8 *bssid = mgmt->bssid; | 68 | const u8 *bssid = mgmt->bssid; |
69 | u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); | 69 | u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); |
@@ -82,7 +82,7 @@ static void cfg80211_process_deauth(struct wireless_dev *wdev, | |||
82 | static void cfg80211_process_disassoc(struct wireless_dev *wdev, | 82 | static void cfg80211_process_disassoc(struct wireless_dev *wdev, |
83 | const u8 *buf, size_t len) | 83 | const u8 *buf, size_t len) |
84 | { | 84 | { |
85 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 85 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
86 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; | 86 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; |
87 | const u8 *bssid = mgmt->bssid; | 87 | const u8 *bssid = mgmt->bssid; |
88 | u16 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 88 | u16 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
@@ -123,7 +123,7 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr) | |||
123 | { | 123 | { |
124 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 124 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
125 | struct wiphy *wiphy = wdev->wiphy; | 125 | struct wiphy *wiphy = wdev->wiphy; |
126 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 126 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
127 | 127 | ||
128 | trace_cfg80211_send_auth_timeout(dev, addr); | 128 | trace_cfg80211_send_auth_timeout(dev, addr); |
129 | 129 | ||
@@ -136,7 +136,7 @@ void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss) | |||
136 | { | 136 | { |
137 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 137 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
138 | struct wiphy *wiphy = wdev->wiphy; | 138 | struct wiphy *wiphy = wdev->wiphy; |
139 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 139 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
140 | 140 | ||
141 | trace_cfg80211_send_assoc_timeout(dev, bss->bssid); | 141 | trace_cfg80211_send_assoc_timeout(dev, bss->bssid); |
142 | 142 | ||
@@ -172,7 +172,7 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | |||
172 | const u8 *tsc, gfp_t gfp) | 172 | const u8 *tsc, gfp_t gfp) |
173 | { | 173 | { |
174 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 174 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
175 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 175 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
176 | #ifdef CONFIG_CFG80211_WEXT | 176 | #ifdef CONFIG_CFG80211_WEXT |
177 | union iwreq_data wrqu; | 177 | union iwreq_data wrqu; |
178 | char *buf = kmalloc(128, gfp); | 178 | char *buf = kmalloc(128, gfp); |
@@ -233,14 +233,8 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, | |||
233 | if (!req.bss) | 233 | if (!req.bss) |
234 | return -ENOENT; | 234 | return -ENOENT; |
235 | 235 | ||
236 | err = cfg80211_can_use_chan(rdev, wdev, req.bss->channel, | ||
237 | CHAN_MODE_SHARED); | ||
238 | if (err) | ||
239 | goto out; | ||
240 | |||
241 | err = rdev_auth(rdev, dev, &req); | 236 | err = rdev_auth(rdev, dev, &req); |
242 | 237 | ||
243 | out: | ||
244 | cfg80211_put_bss(&rdev->wiphy, req.bss); | 238 | cfg80211_put_bss(&rdev->wiphy, req.bss); |
245 | return err; | 239 | return err; |
246 | } | 240 | } |
@@ -306,16 +300,10 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, | |||
306 | if (!req->bss) | 300 | if (!req->bss) |
307 | return -ENOENT; | 301 | return -ENOENT; |
308 | 302 | ||
309 | err = cfg80211_can_use_chan(rdev, wdev, chan, CHAN_MODE_SHARED); | ||
310 | if (err) | ||
311 | goto out; | ||
312 | |||
313 | err = rdev_assoc(rdev, dev, req); | 303 | err = rdev_assoc(rdev, dev, req); |
314 | if (!err) | 304 | if (!err) |
315 | cfg80211_hold_bss(bss_from_pub(req->bss)); | 305 | cfg80211_hold_bss(bss_from_pub(req->bss)); |
316 | 306 | else | |
317 | out: | ||
318 | if (err) | ||
319 | cfg80211_put_bss(&rdev->wiphy, req->bss); | 307 | cfg80211_put_bss(&rdev->wiphy, req->bss); |
320 | 308 | ||
321 | return err; | 309 | return err; |
@@ -414,7 +402,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, | |||
414 | int match_len) | 402 | int match_len) |
415 | { | 403 | { |
416 | struct wiphy *wiphy = wdev->wiphy; | 404 | struct wiphy *wiphy = wdev->wiphy; |
417 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 405 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
418 | struct cfg80211_mgmt_registration *reg, *nreg; | 406 | struct cfg80211_mgmt_registration *reg, *nreg; |
419 | int err = 0; | 407 | int err = 0; |
420 | u16 mgmt_type; | 408 | u16 mgmt_type; |
@@ -473,7 +461,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, | |||
473 | void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid) | 461 | void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid) |
474 | { | 462 | { |
475 | struct wiphy *wiphy = wdev->wiphy; | 463 | struct wiphy *wiphy = wdev->wiphy; |
476 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 464 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
477 | struct cfg80211_mgmt_registration *reg, *tmp; | 465 | struct cfg80211_mgmt_registration *reg, *tmp; |
478 | 466 | ||
479 | spin_lock_bh(&wdev->mgmt_registrations_lock); | 467 | spin_lock_bh(&wdev->mgmt_registrations_lock); |
@@ -620,7 +608,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm, | |||
620 | const u8 *buf, size_t len, u32 flags, gfp_t gfp) | 608 | const u8 *buf, size_t len, u32 flags, gfp_t gfp) |
621 | { | 609 | { |
622 | struct wiphy *wiphy = wdev->wiphy; | 610 | struct wiphy *wiphy = wdev->wiphy; |
623 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 611 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
624 | struct cfg80211_mgmt_registration *reg; | 612 | struct cfg80211_mgmt_registration *reg; |
625 | const struct ieee80211_txrx_stypes *stypes = | 613 | const struct ieee80211_txrx_stypes *stypes = |
626 | &wiphy->mgmt_stypes[wdev->iftype]; | 614 | &wiphy->mgmt_stypes[wdev->iftype]; |
@@ -739,7 +727,7 @@ void cfg80211_radar_event(struct wiphy *wiphy, | |||
739 | struct cfg80211_chan_def *chandef, | 727 | struct cfg80211_chan_def *chandef, |
740 | gfp_t gfp) | 728 | gfp_t gfp) |
741 | { | 729 | { |
742 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 730 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
743 | unsigned long timeout; | 731 | unsigned long timeout; |
744 | 732 | ||
745 | trace_cfg80211_radar_event(wiphy, chandef); | 733 | trace_cfg80211_radar_event(wiphy, chandef); |
@@ -764,7 +752,7 @@ void cfg80211_cac_event(struct net_device *netdev, | |||
764 | { | 752 | { |
765 | struct wireless_dev *wdev = netdev->ieee80211_ptr; | 753 | struct wireless_dev *wdev = netdev->ieee80211_ptr; |
766 | struct wiphy *wiphy = wdev->wiphy; | 754 | struct wiphy *wiphy = wdev->wiphy; |
767 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 755 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
768 | unsigned long timeout; | 756 | unsigned long timeout; |
769 | 757 | ||
770 | trace_cfg80211_cac_event(netdev, event); | 758 | trace_cfg80211_cac_event(netdev, event); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 052c1bf8ffac..0f1b18f209d6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -168,8 +168,8 @@ __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr **attrs) | |||
168 | netdev = __dev_get_by_index(netns, ifindex); | 168 | netdev = __dev_get_by_index(netns, ifindex); |
169 | if (netdev) { | 169 | if (netdev) { |
170 | if (netdev->ieee80211_ptr) | 170 | if (netdev->ieee80211_ptr) |
171 | tmp = wiphy_to_dev( | 171 | tmp = wiphy_to_rdev( |
172 | netdev->ieee80211_ptr->wiphy); | 172 | netdev->ieee80211_ptr->wiphy); |
173 | else | 173 | else |
174 | tmp = NULL; | 174 | tmp = NULL; |
175 | 175 | ||
@@ -385,6 +385,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
385 | [NL80211_ATTR_MAC_HINT] = { .len = ETH_ALEN }, | 385 | [NL80211_ATTR_MAC_HINT] = { .len = ETH_ALEN }, |
386 | [NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 }, | 386 | [NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 }, |
387 | [NL80211_ATTR_TDLS_PEER_CAPABILITY] = { .type = NLA_U32 }, | 387 | [NL80211_ATTR_TDLS_PEER_CAPABILITY] = { .type = NLA_U32 }, |
388 | [NL80211_ATTR_IFACE_SOCKET_OWNER] = { .type = NLA_FLAG }, | ||
388 | }; | 389 | }; |
389 | 390 | ||
390 | /* policy for the key attributes */ | 391 | /* policy for the key attributes */ |
@@ -484,7 +485,7 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, | |||
484 | err = PTR_ERR(*wdev); | 485 | err = PTR_ERR(*wdev); |
485 | goto out_unlock; | 486 | goto out_unlock; |
486 | } | 487 | } |
487 | *rdev = wiphy_to_dev((*wdev)->wiphy); | 488 | *rdev = wiphy_to_rdev((*wdev)->wiphy); |
488 | /* 0 is the first index - add 1 to parse only once */ | 489 | /* 0 is the first index - add 1 to parse only once */ |
489 | cb->args[0] = (*rdev)->wiphy_idx + 1; | 490 | cb->args[0] = (*rdev)->wiphy_idx + 1; |
490 | cb->args[1] = (*wdev)->identifier; | 491 | cb->args[1] = (*wdev)->identifier; |
@@ -497,7 +498,7 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, | |||
497 | err = -ENODEV; | 498 | err = -ENODEV; |
498 | goto out_unlock; | 499 | goto out_unlock; |
499 | } | 500 | } |
500 | *rdev = wiphy_to_dev(wiphy); | 501 | *rdev = wiphy_to_rdev(wiphy); |
501 | *wdev = NULL; | 502 | *wdev = NULL; |
502 | 503 | ||
503 | list_for_each_entry(tmp, &(*rdev)->wdev_list, list) { | 504 | list_for_each_entry(tmp, &(*rdev)->wdev_list, list) { |
@@ -566,6 +567,13 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, | |||
566 | struct ieee80211_channel *chan, | 567 | struct ieee80211_channel *chan, |
567 | bool large) | 568 | bool large) |
568 | { | 569 | { |
570 | /* Some channels must be completely excluded from the | ||
571 | * list to protect old user-space tools from breaking | ||
572 | */ | ||
573 | if (!large && chan->flags & | ||
574 | (IEEE80211_CHAN_NO_10MHZ | IEEE80211_CHAN_NO_20MHZ)) | ||
575 | return 0; | ||
576 | |||
569 | if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_FREQ, | 577 | if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_FREQ, |
570 | chan->center_freq)) | 578 | chan->center_freq)) |
571 | goto nla_put_failure; | 579 | goto nla_put_failure; |
@@ -613,6 +621,18 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, | |||
613 | if ((chan->flags & IEEE80211_CHAN_NO_160MHZ) && | 621 | if ((chan->flags & IEEE80211_CHAN_NO_160MHZ) && |
614 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_160MHZ)) | 622 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_160MHZ)) |
615 | goto nla_put_failure; | 623 | goto nla_put_failure; |
624 | if ((chan->flags & IEEE80211_CHAN_INDOOR_ONLY) && | ||
625 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_INDOOR_ONLY)) | ||
626 | goto nla_put_failure; | ||
627 | if ((chan->flags & IEEE80211_CHAN_GO_CONCURRENT) && | ||
628 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_GO_CONCURRENT)) | ||
629 | goto nla_put_failure; | ||
630 | if ((chan->flags & IEEE80211_CHAN_NO_20MHZ) && | ||
631 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_20MHZ)) | ||
632 | goto nla_put_failure; | ||
633 | if ((chan->flags & IEEE80211_CHAN_NO_10MHZ) && | ||
634 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_10MHZ)) | ||
635 | goto nla_put_failure; | ||
616 | } | 636 | } |
617 | 637 | ||
618 | if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, | 638 | if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, |
@@ -1006,42 +1026,42 @@ static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev, | |||
1006 | } | 1026 | } |
1007 | 1027 | ||
1008 | static int nl80211_send_wowlan(struct sk_buff *msg, | 1028 | static int nl80211_send_wowlan(struct sk_buff *msg, |
1009 | struct cfg80211_registered_device *dev, | 1029 | struct cfg80211_registered_device *rdev, |
1010 | bool large) | 1030 | bool large) |
1011 | { | 1031 | { |
1012 | struct nlattr *nl_wowlan; | 1032 | struct nlattr *nl_wowlan; |
1013 | 1033 | ||
1014 | if (!dev->wiphy.wowlan) | 1034 | if (!rdev->wiphy.wowlan) |
1015 | return 0; | 1035 | return 0; |
1016 | 1036 | ||
1017 | nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED); | 1037 | nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED); |
1018 | if (!nl_wowlan) | 1038 | if (!nl_wowlan) |
1019 | return -ENOBUFS; | 1039 | return -ENOBUFS; |
1020 | 1040 | ||
1021 | if (((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_ANY) && | 1041 | if (((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_ANY) && |
1022 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) || | 1042 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) || |
1023 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_DISCONNECT) && | 1043 | ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_DISCONNECT) && |
1024 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) || | 1044 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) || |
1025 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT) && | 1045 | ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT) && |
1026 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) || | 1046 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) || |
1027 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) && | 1047 | ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) && |
1028 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) || | 1048 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) || |
1029 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && | 1049 | ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && |
1030 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) || | 1050 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) || |
1031 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) && | 1051 | ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) && |
1032 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) || | 1052 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) || |
1033 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) && | 1053 | ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) && |
1034 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) || | 1054 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) || |
1035 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE) && | 1055 | ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE) && |
1036 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE))) | 1056 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE))) |
1037 | return -ENOBUFS; | 1057 | return -ENOBUFS; |
1038 | 1058 | ||
1039 | if (dev->wiphy.wowlan->n_patterns) { | 1059 | if (rdev->wiphy.wowlan->n_patterns) { |
1040 | struct nl80211_pattern_support pat = { | 1060 | struct nl80211_pattern_support pat = { |
1041 | .max_patterns = dev->wiphy.wowlan->n_patterns, | 1061 | .max_patterns = rdev->wiphy.wowlan->n_patterns, |
1042 | .min_pattern_len = dev->wiphy.wowlan->pattern_min_len, | 1062 | .min_pattern_len = rdev->wiphy.wowlan->pattern_min_len, |
1043 | .max_pattern_len = dev->wiphy.wowlan->pattern_max_len, | 1063 | .max_pattern_len = rdev->wiphy.wowlan->pattern_max_len, |
1044 | .max_pkt_offset = dev->wiphy.wowlan->max_pkt_offset, | 1064 | .max_pkt_offset = rdev->wiphy.wowlan->max_pkt_offset, |
1045 | }; | 1065 | }; |
1046 | 1066 | ||
1047 | if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, | 1067 | if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, |
@@ -1049,7 +1069,7 @@ static int nl80211_send_wowlan(struct sk_buff *msg, | |||
1049 | return -ENOBUFS; | 1069 | return -ENOBUFS; |
1050 | } | 1070 | } |
1051 | 1071 | ||
1052 | if (large && nl80211_send_wowlan_tcp_caps(dev, msg)) | 1072 | if (large && nl80211_send_wowlan_tcp_caps(rdev, msg)) |
1053 | return -ENOBUFS; | 1073 | return -ENOBUFS; |
1054 | 1074 | ||
1055 | nla_nest_end(msg, nl_wowlan); | 1075 | nla_nest_end(msg, nl_wowlan); |
@@ -1059,19 +1079,19 @@ static int nl80211_send_wowlan(struct sk_buff *msg, | |||
1059 | #endif | 1079 | #endif |
1060 | 1080 | ||
1061 | static int nl80211_send_coalesce(struct sk_buff *msg, | 1081 | static int nl80211_send_coalesce(struct sk_buff *msg, |
1062 | struct cfg80211_registered_device *dev) | 1082 | struct cfg80211_registered_device *rdev) |
1063 | { | 1083 | { |
1064 | struct nl80211_coalesce_rule_support rule; | 1084 | struct nl80211_coalesce_rule_support rule; |
1065 | 1085 | ||
1066 | if (!dev->wiphy.coalesce) | 1086 | if (!rdev->wiphy.coalesce) |
1067 | return 0; | 1087 | return 0; |
1068 | 1088 | ||
1069 | rule.max_rules = dev->wiphy.coalesce->n_rules; | 1089 | rule.max_rules = rdev->wiphy.coalesce->n_rules; |
1070 | rule.max_delay = dev->wiphy.coalesce->max_delay; | 1090 | rule.max_delay = rdev->wiphy.coalesce->max_delay; |
1071 | rule.pat.max_patterns = dev->wiphy.coalesce->n_patterns; | 1091 | rule.pat.max_patterns = rdev->wiphy.coalesce->n_patterns; |
1072 | rule.pat.min_pattern_len = dev->wiphy.coalesce->pattern_min_len; | 1092 | rule.pat.min_pattern_len = rdev->wiphy.coalesce->pattern_min_len; |
1073 | rule.pat.max_pattern_len = dev->wiphy.coalesce->pattern_max_len; | 1093 | rule.pat.max_pattern_len = rdev->wiphy.coalesce->pattern_max_len; |
1074 | rule.pat.max_pkt_offset = dev->wiphy.coalesce->max_pkt_offset; | 1094 | rule.pat.max_pkt_offset = rdev->wiphy.coalesce->max_pkt_offset; |
1075 | 1095 | ||
1076 | if (nla_put(msg, NL80211_ATTR_COALESCE_RULE, sizeof(rule), &rule)) | 1096 | if (nla_put(msg, NL80211_ATTR_COALESCE_RULE, sizeof(rule), &rule)) |
1077 | return -ENOBUFS; | 1097 | return -ENOBUFS; |
@@ -1202,7 +1222,7 @@ struct nl80211_dump_wiphy_state { | |||
1202 | bool split; | 1222 | bool split; |
1203 | }; | 1223 | }; |
1204 | 1224 | ||
1205 | static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | 1225 | static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, |
1206 | struct sk_buff *msg, u32 portid, u32 seq, | 1226 | struct sk_buff *msg, u32 portid, u32 seq, |
1207 | int flags, struct nl80211_dump_wiphy_state *state) | 1227 | int flags, struct nl80211_dump_wiphy_state *state) |
1208 | { | 1228 | { |
@@ -1214,7 +1234,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1214 | struct ieee80211_channel *chan; | 1234 | struct ieee80211_channel *chan; |
1215 | int i; | 1235 | int i; |
1216 | const struct ieee80211_txrx_stypes *mgmt_stypes = | 1236 | const struct ieee80211_txrx_stypes *mgmt_stypes = |
1217 | dev->wiphy.mgmt_stypes; | 1237 | rdev->wiphy.mgmt_stypes; |
1218 | u32 features; | 1238 | u32 features; |
1219 | 1239 | ||
1220 | hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_WIPHY); | 1240 | hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_WIPHY); |
@@ -1224,9 +1244,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1224 | if (WARN_ON(!state)) | 1244 | if (WARN_ON(!state)) |
1225 | return -EINVAL; | 1245 | return -EINVAL; |
1226 | 1246 | ||
1227 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, dev->wiphy_idx) || | 1247 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || |
1228 | nla_put_string(msg, NL80211_ATTR_WIPHY_NAME, | 1248 | nla_put_string(msg, NL80211_ATTR_WIPHY_NAME, |
1229 | wiphy_name(&dev->wiphy)) || | 1249 | wiphy_name(&rdev->wiphy)) || |
1230 | nla_put_u32(msg, NL80211_ATTR_GENERATION, | 1250 | nla_put_u32(msg, NL80211_ATTR_GENERATION, |
1231 | cfg80211_rdev_list_generation)) | 1251 | cfg80211_rdev_list_generation)) |
1232 | goto nla_put_failure; | 1252 | goto nla_put_failure; |
@@ -1234,43 +1254,43 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1234 | switch (state->split_start) { | 1254 | switch (state->split_start) { |
1235 | case 0: | 1255 | case 0: |
1236 | if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, | 1256 | if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, |
1237 | dev->wiphy.retry_short) || | 1257 | rdev->wiphy.retry_short) || |
1238 | nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_LONG, | 1258 | nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_LONG, |
1239 | dev->wiphy.retry_long) || | 1259 | rdev->wiphy.retry_long) || |
1240 | nla_put_u32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, | 1260 | nla_put_u32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, |
1241 | dev->wiphy.frag_threshold) || | 1261 | rdev->wiphy.frag_threshold) || |
1242 | nla_put_u32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, | 1262 | nla_put_u32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, |
1243 | dev->wiphy.rts_threshold) || | 1263 | rdev->wiphy.rts_threshold) || |
1244 | nla_put_u8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, | 1264 | nla_put_u8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, |
1245 | dev->wiphy.coverage_class) || | 1265 | rdev->wiphy.coverage_class) || |
1246 | nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, | 1266 | nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, |
1247 | dev->wiphy.max_scan_ssids) || | 1267 | rdev->wiphy.max_scan_ssids) || |
1248 | nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, | 1268 | nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, |
1249 | dev->wiphy.max_sched_scan_ssids) || | 1269 | rdev->wiphy.max_sched_scan_ssids) || |
1250 | nla_put_u16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN, | 1270 | nla_put_u16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN, |
1251 | dev->wiphy.max_scan_ie_len) || | 1271 | rdev->wiphy.max_scan_ie_len) || |
1252 | nla_put_u16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, | 1272 | nla_put_u16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, |
1253 | dev->wiphy.max_sched_scan_ie_len) || | 1273 | rdev->wiphy.max_sched_scan_ie_len) || |
1254 | nla_put_u8(msg, NL80211_ATTR_MAX_MATCH_SETS, | 1274 | nla_put_u8(msg, NL80211_ATTR_MAX_MATCH_SETS, |
1255 | dev->wiphy.max_match_sets)) | 1275 | rdev->wiphy.max_match_sets)) |
1256 | goto nla_put_failure; | 1276 | goto nla_put_failure; |
1257 | 1277 | ||
1258 | if ((dev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) && | 1278 | if ((rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) && |
1259 | nla_put_flag(msg, NL80211_ATTR_SUPPORT_IBSS_RSN)) | 1279 | nla_put_flag(msg, NL80211_ATTR_SUPPORT_IBSS_RSN)) |
1260 | goto nla_put_failure; | 1280 | goto nla_put_failure; |
1261 | if ((dev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) && | 1281 | if ((rdev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) && |
1262 | nla_put_flag(msg, NL80211_ATTR_SUPPORT_MESH_AUTH)) | 1282 | nla_put_flag(msg, NL80211_ATTR_SUPPORT_MESH_AUTH)) |
1263 | goto nla_put_failure; | 1283 | goto nla_put_failure; |
1264 | if ((dev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) && | 1284 | if ((rdev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) && |
1265 | nla_put_flag(msg, NL80211_ATTR_SUPPORT_AP_UAPSD)) | 1285 | nla_put_flag(msg, NL80211_ATTR_SUPPORT_AP_UAPSD)) |
1266 | goto nla_put_failure; | 1286 | goto nla_put_failure; |
1267 | if ((dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) && | 1287 | if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) && |
1268 | nla_put_flag(msg, NL80211_ATTR_ROAM_SUPPORT)) | 1288 | nla_put_flag(msg, NL80211_ATTR_ROAM_SUPPORT)) |
1269 | goto nla_put_failure; | 1289 | goto nla_put_failure; |
1270 | if ((dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) && | 1290 | if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) && |
1271 | nla_put_flag(msg, NL80211_ATTR_TDLS_SUPPORT)) | 1291 | nla_put_flag(msg, NL80211_ATTR_TDLS_SUPPORT)) |
1272 | goto nla_put_failure; | 1292 | goto nla_put_failure; |
1273 | if ((dev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) && | 1293 | if ((rdev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) && |
1274 | nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP)) | 1294 | nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP)) |
1275 | goto nla_put_failure; | 1295 | goto nla_put_failure; |
1276 | state->split_start++; | 1296 | state->split_start++; |
@@ -1278,35 +1298,35 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1278 | break; | 1298 | break; |
1279 | case 1: | 1299 | case 1: |
1280 | if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES, | 1300 | if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES, |
1281 | sizeof(u32) * dev->wiphy.n_cipher_suites, | 1301 | sizeof(u32) * rdev->wiphy.n_cipher_suites, |
1282 | dev->wiphy.cipher_suites)) | 1302 | rdev->wiphy.cipher_suites)) |
1283 | goto nla_put_failure; | 1303 | goto nla_put_failure; |
1284 | 1304 | ||
1285 | if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, | 1305 | if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, |
1286 | dev->wiphy.max_num_pmkids)) | 1306 | rdev->wiphy.max_num_pmkids)) |
1287 | goto nla_put_failure; | 1307 | goto nla_put_failure; |
1288 | 1308 | ||
1289 | if ((dev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) && | 1309 | if ((rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) && |
1290 | nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE)) | 1310 | nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE)) |
1291 | goto nla_put_failure; | 1311 | goto nla_put_failure; |
1292 | 1312 | ||
1293 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, | 1313 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, |
1294 | dev->wiphy.available_antennas_tx) || | 1314 | rdev->wiphy.available_antennas_tx) || |
1295 | nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, | 1315 | nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, |
1296 | dev->wiphy.available_antennas_rx)) | 1316 | rdev->wiphy.available_antennas_rx)) |
1297 | goto nla_put_failure; | 1317 | goto nla_put_failure; |
1298 | 1318 | ||
1299 | if ((dev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) && | 1319 | if ((rdev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) && |
1300 | nla_put_u32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD, | 1320 | nla_put_u32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD, |
1301 | dev->wiphy.probe_resp_offload)) | 1321 | rdev->wiphy.probe_resp_offload)) |
1302 | goto nla_put_failure; | 1322 | goto nla_put_failure; |
1303 | 1323 | ||
1304 | if ((dev->wiphy.available_antennas_tx || | 1324 | if ((rdev->wiphy.available_antennas_tx || |
1305 | dev->wiphy.available_antennas_rx) && | 1325 | rdev->wiphy.available_antennas_rx) && |
1306 | dev->ops->get_antenna) { | 1326 | rdev->ops->get_antenna) { |
1307 | u32 tx_ant = 0, rx_ant = 0; | 1327 | u32 tx_ant = 0, rx_ant = 0; |
1308 | int res; | 1328 | int res; |
1309 | res = rdev_get_antenna(dev, &tx_ant, &rx_ant); | 1329 | res = rdev_get_antenna(rdev, &tx_ant, &rx_ant); |
1310 | if (!res) { | 1330 | if (!res) { |
1311 | if (nla_put_u32(msg, | 1331 | if (nla_put_u32(msg, |
1312 | NL80211_ATTR_WIPHY_ANTENNA_TX, | 1332 | NL80211_ATTR_WIPHY_ANTENNA_TX, |
@@ -1323,7 +1343,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1323 | break; | 1343 | break; |
1324 | case 2: | 1344 | case 2: |
1325 | if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES, | 1345 | if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES, |
1326 | dev->wiphy.interface_modes)) | 1346 | rdev->wiphy.interface_modes)) |
1327 | goto nla_put_failure; | 1347 | goto nla_put_failure; |
1328 | state->split_start++; | 1348 | state->split_start++; |
1329 | if (state->split) | 1349 | if (state->split) |
@@ -1337,7 +1357,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1337 | band < IEEE80211_NUM_BANDS; band++) { | 1357 | band < IEEE80211_NUM_BANDS; band++) { |
1338 | struct ieee80211_supported_band *sband; | 1358 | struct ieee80211_supported_band *sband; |
1339 | 1359 | ||
1340 | sband = dev->wiphy.bands[band]; | 1360 | sband = rdev->wiphy.bands[band]; |
1341 | 1361 | ||
1342 | if (!sband) | 1362 | if (!sband) |
1343 | continue; | 1363 | continue; |
@@ -1414,7 +1434,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1414 | i = 0; | 1434 | i = 0; |
1415 | #define CMD(op, n) \ | 1435 | #define CMD(op, n) \ |
1416 | do { \ | 1436 | do { \ |
1417 | if (dev->ops->op) { \ | 1437 | if (rdev->ops->op) { \ |
1418 | i++; \ | 1438 | i++; \ |
1419 | if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \ | 1439 | if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \ |
1420 | goto nla_put_failure; \ | 1440 | goto nla_put_failure; \ |
@@ -1438,32 +1458,32 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1438 | CMD(set_pmksa, SET_PMKSA); | 1458 | CMD(set_pmksa, SET_PMKSA); |
1439 | CMD(del_pmksa, DEL_PMKSA); | 1459 | CMD(del_pmksa, DEL_PMKSA); |
1440 | CMD(flush_pmksa, FLUSH_PMKSA); | 1460 | CMD(flush_pmksa, FLUSH_PMKSA); |
1441 | if (dev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) | 1461 | if (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) |
1442 | CMD(remain_on_channel, REMAIN_ON_CHANNEL); | 1462 | CMD(remain_on_channel, REMAIN_ON_CHANNEL); |
1443 | CMD(set_bitrate_mask, SET_TX_BITRATE_MASK); | 1463 | CMD(set_bitrate_mask, SET_TX_BITRATE_MASK); |
1444 | CMD(mgmt_tx, FRAME); | 1464 | CMD(mgmt_tx, FRAME); |
1445 | CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL); | 1465 | CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL); |
1446 | if (dev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { | 1466 | if (rdev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { |
1447 | i++; | 1467 | i++; |
1448 | if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS)) | 1468 | if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS)) |
1449 | goto nla_put_failure; | 1469 | goto nla_put_failure; |
1450 | } | 1470 | } |
1451 | if (dev->ops->set_monitor_channel || dev->ops->start_ap || | 1471 | if (rdev->ops->set_monitor_channel || rdev->ops->start_ap || |
1452 | dev->ops->join_mesh) { | 1472 | rdev->ops->join_mesh) { |
1453 | i++; | 1473 | i++; |
1454 | if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL)) | 1474 | if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL)) |
1455 | goto nla_put_failure; | 1475 | goto nla_put_failure; |
1456 | } | 1476 | } |
1457 | CMD(set_wds_peer, SET_WDS_PEER); | 1477 | CMD(set_wds_peer, SET_WDS_PEER); |
1458 | if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) { | 1478 | if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) { |
1459 | CMD(tdls_mgmt, TDLS_MGMT); | 1479 | CMD(tdls_mgmt, TDLS_MGMT); |
1460 | CMD(tdls_oper, TDLS_OPER); | 1480 | CMD(tdls_oper, TDLS_OPER); |
1461 | } | 1481 | } |
1462 | if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) | 1482 | if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) |
1463 | CMD(sched_scan_start, START_SCHED_SCAN); | 1483 | CMD(sched_scan_start, START_SCHED_SCAN); |
1464 | CMD(probe_client, PROBE_CLIENT); | 1484 | CMD(probe_client, PROBE_CLIENT); |
1465 | CMD(set_noack_map, SET_NOACK_MAP); | 1485 | CMD(set_noack_map, SET_NOACK_MAP); |
1466 | if (dev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) { | 1486 | if (rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) { |
1467 | i++; | 1487 | i++; |
1468 | if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS)) | 1488 | if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS)) |
1469 | goto nla_put_failure; | 1489 | goto nla_put_failure; |
@@ -1473,7 +1493,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1473 | if (state->split) { | 1493 | if (state->split) { |
1474 | CMD(crit_proto_start, CRIT_PROTOCOL_START); | 1494 | CMD(crit_proto_start, CRIT_PROTOCOL_START); |
1475 | CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); | 1495 | CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); |
1476 | if (dev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) | 1496 | if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) |
1477 | CMD(channel_switch, CHANNEL_SWITCH); | 1497 | CMD(channel_switch, CHANNEL_SWITCH); |
1478 | } | 1498 | } |
1479 | CMD(set_qos_map, SET_QOS_MAP); | 1499 | CMD(set_qos_map, SET_QOS_MAP); |
@@ -1484,13 +1504,13 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1484 | 1504 | ||
1485 | #undef CMD | 1505 | #undef CMD |
1486 | 1506 | ||
1487 | if (dev->ops->connect || dev->ops->auth) { | 1507 | if (rdev->ops->connect || rdev->ops->auth) { |
1488 | i++; | 1508 | i++; |
1489 | if (nla_put_u32(msg, i, NL80211_CMD_CONNECT)) | 1509 | if (nla_put_u32(msg, i, NL80211_CMD_CONNECT)) |
1490 | goto nla_put_failure; | 1510 | goto nla_put_failure; |
1491 | } | 1511 | } |
1492 | 1512 | ||
1493 | if (dev->ops->disconnect || dev->ops->deauth) { | 1513 | if (rdev->ops->disconnect || rdev->ops->deauth) { |
1494 | i++; | 1514 | i++; |
1495 | if (nla_put_u32(msg, i, NL80211_CMD_DISCONNECT)) | 1515 | if (nla_put_u32(msg, i, NL80211_CMD_DISCONNECT)) |
1496 | goto nla_put_failure; | 1516 | goto nla_put_failure; |
@@ -1501,14 +1521,14 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1501 | if (state->split) | 1521 | if (state->split) |
1502 | break; | 1522 | break; |
1503 | case 5: | 1523 | case 5: |
1504 | if (dev->ops->remain_on_channel && | 1524 | if (rdev->ops->remain_on_channel && |
1505 | (dev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) && | 1525 | (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) && |
1506 | nla_put_u32(msg, | 1526 | nla_put_u32(msg, |
1507 | NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, | 1527 | NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, |
1508 | dev->wiphy.max_remain_on_channel_duration)) | 1528 | rdev->wiphy.max_remain_on_channel_duration)) |
1509 | goto nla_put_failure; | 1529 | goto nla_put_failure; |
1510 | 1530 | ||
1511 | if ((dev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX) && | 1531 | if ((rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX) && |
1512 | nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK)) | 1532 | nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK)) |
1513 | goto nla_put_failure; | 1533 | goto nla_put_failure; |
1514 | 1534 | ||
@@ -1519,7 +1539,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1519 | break; | 1539 | break; |
1520 | case 6: | 1540 | case 6: |
1521 | #ifdef CONFIG_PM | 1541 | #ifdef CONFIG_PM |
1522 | if (nl80211_send_wowlan(msg, dev, state->split)) | 1542 | if (nl80211_send_wowlan(msg, rdev, state->split)) |
1523 | goto nla_put_failure; | 1543 | goto nla_put_failure; |
1524 | state->split_start++; | 1544 | state->split_start++; |
1525 | if (state->split) | 1545 | if (state->split) |
@@ -1529,10 +1549,10 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1529 | #endif | 1549 | #endif |
1530 | case 7: | 1550 | case 7: |
1531 | if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES, | 1551 | if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES, |
1532 | dev->wiphy.software_iftypes)) | 1552 | rdev->wiphy.software_iftypes)) |
1533 | goto nla_put_failure; | 1553 | goto nla_put_failure; |
1534 | 1554 | ||
1535 | if (nl80211_put_iface_combinations(&dev->wiphy, msg, | 1555 | if (nl80211_put_iface_combinations(&rdev->wiphy, msg, |
1536 | state->split)) | 1556 | state->split)) |
1537 | goto nla_put_failure; | 1557 | goto nla_put_failure; |
1538 | 1558 | ||
@@ -1540,12 +1560,12 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1540 | if (state->split) | 1560 | if (state->split) |
1541 | break; | 1561 | break; |
1542 | case 8: | 1562 | case 8: |
1543 | if ((dev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) && | 1563 | if ((rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) && |
1544 | nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME, | 1564 | nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME, |
1545 | dev->wiphy.ap_sme_capa)) | 1565 | rdev->wiphy.ap_sme_capa)) |
1546 | goto nla_put_failure; | 1566 | goto nla_put_failure; |
1547 | 1567 | ||
1548 | features = dev->wiphy.features; | 1568 | features = rdev->wiphy.features; |
1549 | /* | 1569 | /* |
1550 | * We can only add the per-channel limit information if the | 1570 | * We can only add the per-channel limit information if the |
1551 | * dump is split, otherwise it makes it too big. Therefore | 1571 | * dump is split, otherwise it makes it too big. Therefore |
@@ -1556,16 +1576,16 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1556 | if (nla_put_u32(msg, NL80211_ATTR_FEATURE_FLAGS, features)) | 1576 | if (nla_put_u32(msg, NL80211_ATTR_FEATURE_FLAGS, features)) |
1557 | goto nla_put_failure; | 1577 | goto nla_put_failure; |
1558 | 1578 | ||
1559 | if (dev->wiphy.ht_capa_mod_mask && | 1579 | if (rdev->wiphy.ht_capa_mod_mask && |
1560 | nla_put(msg, NL80211_ATTR_HT_CAPABILITY_MASK, | 1580 | nla_put(msg, NL80211_ATTR_HT_CAPABILITY_MASK, |
1561 | sizeof(*dev->wiphy.ht_capa_mod_mask), | 1581 | sizeof(*rdev->wiphy.ht_capa_mod_mask), |
1562 | dev->wiphy.ht_capa_mod_mask)) | 1582 | rdev->wiphy.ht_capa_mod_mask)) |
1563 | goto nla_put_failure; | 1583 | goto nla_put_failure; |
1564 | 1584 | ||
1565 | if (dev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME && | 1585 | if (rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME && |
1566 | dev->wiphy.max_acl_mac_addrs && | 1586 | rdev->wiphy.max_acl_mac_addrs && |
1567 | nla_put_u32(msg, NL80211_ATTR_MAC_ACL_MAX, | 1587 | nla_put_u32(msg, NL80211_ATTR_MAC_ACL_MAX, |
1568 | dev->wiphy.max_acl_mac_addrs)) | 1588 | rdev->wiphy.max_acl_mac_addrs)) |
1569 | goto nla_put_failure; | 1589 | goto nla_put_failure; |
1570 | 1590 | ||
1571 | /* | 1591 | /* |
@@ -1581,41 +1601,41 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1581 | state->split_start++; | 1601 | state->split_start++; |
1582 | break; | 1602 | break; |
1583 | case 9: | 1603 | case 9: |
1584 | if (dev->wiphy.extended_capabilities && | 1604 | if (rdev->wiphy.extended_capabilities && |
1585 | (nla_put(msg, NL80211_ATTR_EXT_CAPA, | 1605 | (nla_put(msg, NL80211_ATTR_EXT_CAPA, |
1586 | dev->wiphy.extended_capabilities_len, | 1606 | rdev->wiphy.extended_capabilities_len, |
1587 | dev->wiphy.extended_capabilities) || | 1607 | rdev->wiphy.extended_capabilities) || |
1588 | nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK, | 1608 | nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK, |
1589 | dev->wiphy.extended_capabilities_len, | 1609 | rdev->wiphy.extended_capabilities_len, |
1590 | dev->wiphy.extended_capabilities_mask))) | 1610 | rdev->wiphy.extended_capabilities_mask))) |
1591 | goto nla_put_failure; | 1611 | goto nla_put_failure; |
1592 | 1612 | ||
1593 | if (dev->wiphy.vht_capa_mod_mask && | 1613 | if (rdev->wiphy.vht_capa_mod_mask && |
1594 | nla_put(msg, NL80211_ATTR_VHT_CAPABILITY_MASK, | 1614 | nla_put(msg, NL80211_ATTR_VHT_CAPABILITY_MASK, |
1595 | sizeof(*dev->wiphy.vht_capa_mod_mask), | 1615 | sizeof(*rdev->wiphy.vht_capa_mod_mask), |
1596 | dev->wiphy.vht_capa_mod_mask)) | 1616 | rdev->wiphy.vht_capa_mod_mask)) |
1597 | goto nla_put_failure; | 1617 | goto nla_put_failure; |
1598 | 1618 | ||
1599 | state->split_start++; | 1619 | state->split_start++; |
1600 | break; | 1620 | break; |
1601 | case 10: | 1621 | case 10: |
1602 | if (nl80211_send_coalesce(msg, dev)) | 1622 | if (nl80211_send_coalesce(msg, rdev)) |
1603 | goto nla_put_failure; | 1623 | goto nla_put_failure; |
1604 | 1624 | ||
1605 | if ((dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ) && | 1625 | if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ) && |
1606 | (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) || | 1626 | (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) || |
1607 | nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ))) | 1627 | nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ))) |
1608 | goto nla_put_failure; | 1628 | goto nla_put_failure; |
1609 | 1629 | ||
1610 | if (dev->wiphy.max_ap_assoc_sta && | 1630 | if (rdev->wiphy.max_ap_assoc_sta && |
1611 | nla_put_u32(msg, NL80211_ATTR_MAX_AP_ASSOC_STA, | 1631 | nla_put_u32(msg, NL80211_ATTR_MAX_AP_ASSOC_STA, |
1612 | dev->wiphy.max_ap_assoc_sta)) | 1632 | rdev->wiphy.max_ap_assoc_sta)) |
1613 | goto nla_put_failure; | 1633 | goto nla_put_failure; |
1614 | 1634 | ||
1615 | state->split_start++; | 1635 | state->split_start++; |
1616 | break; | 1636 | break; |
1617 | case 11: | 1637 | case 11: |
1618 | if (dev->wiphy.n_vendor_commands) { | 1638 | if (rdev->wiphy.n_vendor_commands) { |
1619 | const struct nl80211_vendor_cmd_info *info; | 1639 | const struct nl80211_vendor_cmd_info *info; |
1620 | struct nlattr *nested; | 1640 | struct nlattr *nested; |
1621 | 1641 | ||
@@ -1623,15 +1643,15 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1623 | if (!nested) | 1643 | if (!nested) |
1624 | goto nla_put_failure; | 1644 | goto nla_put_failure; |
1625 | 1645 | ||
1626 | for (i = 0; i < dev->wiphy.n_vendor_commands; i++) { | 1646 | for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) { |
1627 | info = &dev->wiphy.vendor_commands[i].info; | 1647 | info = &rdev->wiphy.vendor_commands[i].info; |
1628 | if (nla_put(msg, i + 1, sizeof(*info), info)) | 1648 | if (nla_put(msg, i + 1, sizeof(*info), info)) |
1629 | goto nla_put_failure; | 1649 | goto nla_put_failure; |
1630 | } | 1650 | } |
1631 | nla_nest_end(msg, nested); | 1651 | nla_nest_end(msg, nested); |
1632 | } | 1652 | } |
1633 | 1653 | ||
1634 | if (dev->wiphy.n_vendor_events) { | 1654 | if (rdev->wiphy.n_vendor_events) { |
1635 | const struct nl80211_vendor_cmd_info *info; | 1655 | const struct nl80211_vendor_cmd_info *info; |
1636 | struct nlattr *nested; | 1656 | struct nlattr *nested; |
1637 | 1657 | ||
@@ -1640,8 +1660,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1640 | if (!nested) | 1660 | if (!nested) |
1641 | goto nla_put_failure; | 1661 | goto nla_put_failure; |
1642 | 1662 | ||
1643 | for (i = 0; i < dev->wiphy.n_vendor_events; i++) { | 1663 | for (i = 0; i < rdev->wiphy.n_vendor_events; i++) { |
1644 | info = &dev->wiphy.vendor_events[i]; | 1664 | info = &rdev->wiphy.vendor_events[i]; |
1645 | if (nla_put(msg, i + 1, sizeof(*info), info)) | 1665 | if (nla_put(msg, i + 1, sizeof(*info), info)) |
1646 | goto nla_put_failure; | 1666 | goto nla_put_failure; |
1647 | } | 1667 | } |
@@ -1684,7 +1704,7 @@ static int nl80211_dump_wiphy_parse(struct sk_buff *skb, | |||
1684 | if (!netdev) | 1704 | if (!netdev) |
1685 | return -ENODEV; | 1705 | return -ENODEV; |
1686 | if (netdev->ieee80211_ptr) { | 1706 | if (netdev->ieee80211_ptr) { |
1687 | rdev = wiphy_to_dev( | 1707 | rdev = wiphy_to_rdev( |
1688 | netdev->ieee80211_ptr->wiphy); | 1708 | netdev->ieee80211_ptr->wiphy); |
1689 | state->filter_wiphy = rdev->wiphy_idx; | 1709 | state->filter_wiphy = rdev->wiphy_idx; |
1690 | } | 1710 | } |
@@ -1697,7 +1717,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) | |||
1697 | { | 1717 | { |
1698 | int idx = 0, ret; | 1718 | int idx = 0, ret; |
1699 | struct nl80211_dump_wiphy_state *state = (void *)cb->args[0]; | 1719 | struct nl80211_dump_wiphy_state *state = (void *)cb->args[0]; |
1700 | struct cfg80211_registered_device *dev; | 1720 | struct cfg80211_registered_device *rdev; |
1701 | 1721 | ||
1702 | rtnl_lock(); | 1722 | rtnl_lock(); |
1703 | if (!state) { | 1723 | if (!state) { |
@@ -1716,17 +1736,17 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) | |||
1716 | cb->args[0] = (long)state; | 1736 | cb->args[0] = (long)state; |
1717 | } | 1737 | } |
1718 | 1738 | ||
1719 | list_for_each_entry(dev, &cfg80211_rdev_list, list) { | 1739 | list_for_each_entry(rdev, &cfg80211_rdev_list, list) { |
1720 | if (!net_eq(wiphy_net(&dev->wiphy), sock_net(skb->sk))) | 1740 | if (!net_eq(wiphy_net(&rdev->wiphy), sock_net(skb->sk))) |
1721 | continue; | 1741 | continue; |
1722 | if (++idx <= state->start) | 1742 | if (++idx <= state->start) |
1723 | continue; | 1743 | continue; |
1724 | if (state->filter_wiphy != -1 && | 1744 | if (state->filter_wiphy != -1 && |
1725 | state->filter_wiphy != dev->wiphy_idx) | 1745 | state->filter_wiphy != rdev->wiphy_idx) |
1726 | continue; | 1746 | continue; |
1727 | /* attempt to fit multiple wiphy data chunks into the skb */ | 1747 | /* attempt to fit multiple wiphy data chunks into the skb */ |
1728 | do { | 1748 | do { |
1729 | ret = nl80211_send_wiphy(dev, skb, | 1749 | ret = nl80211_send_wiphy(rdev, skb, |
1730 | NETLINK_CB(cb->skb).portid, | 1750 | NETLINK_CB(cb->skb).portid, |
1731 | cb->nlh->nlmsg_seq, | 1751 | cb->nlh->nlmsg_seq, |
1732 | NLM_F_MULTI, state); | 1752 | NLM_F_MULTI, state); |
@@ -1774,14 +1794,14 @@ static int nl80211_dump_wiphy_done(struct netlink_callback *cb) | |||
1774 | static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) | 1794 | static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) |
1775 | { | 1795 | { |
1776 | struct sk_buff *msg; | 1796 | struct sk_buff *msg; |
1777 | struct cfg80211_registered_device *dev = info->user_ptr[0]; | 1797 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
1778 | struct nl80211_dump_wiphy_state state = {}; | 1798 | struct nl80211_dump_wiphy_state state = {}; |
1779 | 1799 | ||
1780 | msg = nlmsg_new(4096, GFP_KERNEL); | 1800 | msg = nlmsg_new(4096, GFP_KERNEL); |
1781 | if (!msg) | 1801 | if (!msg) |
1782 | return -ENOMEM; | 1802 | return -ENOMEM; |
1783 | 1803 | ||
1784 | if (nl80211_send_wiphy(dev, msg, info->snd_portid, info->snd_seq, 0, | 1804 | if (nl80211_send_wiphy(rdev, msg, info->snd_portid, info->snd_seq, 0, |
1785 | &state) < 0) { | 1805 | &state) < 0) { |
1786 | nlmsg_free(msg); | 1806 | nlmsg_free(msg); |
1787 | return -ENOBUFS; | 1807 | return -ENOBUFS; |
@@ -1908,18 +1928,20 @@ static int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, | |||
1908 | } | 1928 | } |
1909 | 1929 | ||
1910 | static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, | 1930 | static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, |
1911 | struct wireless_dev *wdev, | 1931 | struct net_device *dev, |
1912 | struct genl_info *info) | 1932 | struct genl_info *info) |
1913 | { | 1933 | { |
1914 | struct cfg80211_chan_def chandef; | 1934 | struct cfg80211_chan_def chandef; |
1915 | int result; | 1935 | int result; |
1916 | enum nl80211_iftype iftype = NL80211_IFTYPE_MONITOR; | 1936 | enum nl80211_iftype iftype = NL80211_IFTYPE_MONITOR; |
1937 | struct wireless_dev *wdev = NULL; | ||
1917 | 1938 | ||
1918 | if (wdev) | 1939 | if (dev) |
1919 | iftype = wdev->iftype; | 1940 | wdev = dev->ieee80211_ptr; |
1920 | |||
1921 | if (!nl80211_can_set_dev_channel(wdev)) | 1941 | if (!nl80211_can_set_dev_channel(wdev)) |
1922 | return -EOPNOTSUPP; | 1942 | return -EOPNOTSUPP; |
1943 | if (wdev) | ||
1944 | iftype = wdev->iftype; | ||
1923 | 1945 | ||
1924 | result = nl80211_parse_chandef(rdev, info, &chandef); | 1946 | result = nl80211_parse_chandef(rdev, info, &chandef); |
1925 | if (result) | 1947 | if (result) |
@@ -1928,14 +1950,27 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, | |||
1928 | switch (iftype) { | 1950 | switch (iftype) { |
1929 | case NL80211_IFTYPE_AP: | 1951 | case NL80211_IFTYPE_AP: |
1930 | case NL80211_IFTYPE_P2P_GO: | 1952 | case NL80211_IFTYPE_P2P_GO: |
1931 | if (wdev->beacon_interval) { | 1953 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef, iftype)) { |
1932 | result = -EBUSY; | ||
1933 | break; | ||
1934 | } | ||
1935 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef)) { | ||
1936 | result = -EINVAL; | 1954 | result = -EINVAL; |
1937 | break; | 1955 | break; |
1938 | } | 1956 | } |
1957 | if (wdev->beacon_interval) { | ||
1958 | if (!dev || !rdev->ops->set_ap_chanwidth || | ||
1959 | !(rdev->wiphy.features & | ||
1960 | NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE)) { | ||
1961 | result = -EBUSY; | ||
1962 | break; | ||
1963 | } | ||
1964 | |||
1965 | /* Only allow dynamic channel width changes */ | ||
1966 | if (chandef.chan != wdev->preset_chandef.chan) { | ||
1967 | result = -EBUSY; | ||
1968 | break; | ||
1969 | } | ||
1970 | result = rdev_set_ap_chanwidth(rdev, dev, &chandef); | ||
1971 | if (result) | ||
1972 | break; | ||
1973 | } | ||
1939 | wdev->preset_chandef = chandef; | 1974 | wdev->preset_chandef = chandef; |
1940 | result = 0; | 1975 | result = 0; |
1941 | break; | 1976 | break; |
@@ -1957,7 +1992,7 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) | |||
1957 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 1992 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
1958 | struct net_device *netdev = info->user_ptr[1]; | 1993 | struct net_device *netdev = info->user_ptr[1]; |
1959 | 1994 | ||
1960 | return __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); | 1995 | return __nl80211_set_channel(rdev, netdev, info); |
1961 | } | 1996 | } |
1962 | 1997 | ||
1963 | static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) | 1998 | static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) |
@@ -2013,7 +2048,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
2013 | 2048 | ||
2014 | netdev = __dev_get_by_index(genl_info_net(info), ifindex); | 2049 | netdev = __dev_get_by_index(genl_info_net(info), ifindex); |
2015 | if (netdev && netdev->ieee80211_ptr) | 2050 | if (netdev && netdev->ieee80211_ptr) |
2016 | rdev = wiphy_to_dev(netdev->ieee80211_ptr->wiphy); | 2051 | rdev = wiphy_to_rdev(netdev->ieee80211_ptr->wiphy); |
2017 | else | 2052 | else |
2018 | netdev = NULL; | 2053 | netdev = NULL; |
2019 | } | 2054 | } |
@@ -2079,9 +2114,10 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
2079 | } | 2114 | } |
2080 | 2115 | ||
2081 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { | 2116 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { |
2082 | result = __nl80211_set_channel(rdev, | 2117 | result = __nl80211_set_channel( |
2083 | nl80211_can_set_dev_channel(wdev) ? wdev : NULL, | 2118 | rdev, |
2084 | info); | 2119 | nl80211_can_set_dev_channel(wdev) ? netdev : NULL, |
2120 | info); | ||
2085 | if (result) | 2121 | if (result) |
2086 | return result; | 2122 | return result; |
2087 | } | 2123 | } |
@@ -2229,7 +2265,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
2229 | static inline u64 wdev_id(struct wireless_dev *wdev) | 2265 | static inline u64 wdev_id(struct wireless_dev *wdev) |
2230 | { | 2266 | { |
2231 | return (u64)wdev->identifier | | 2267 | return (u64)wdev->identifier | |
2232 | ((u64)wiphy_to_dev(wdev->wiphy)->wiphy_idx << 32); | 2268 | ((u64)wiphy_to_rdev(wdev->wiphy)->wiphy_idx << 32); |
2233 | } | 2269 | } |
2234 | 2270 | ||
2235 | static int nl80211_send_chandef(struct sk_buff *msg, | 2271 | static int nl80211_send_chandef(struct sk_buff *msg, |
@@ -2355,7 +2391,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * | |||
2355 | static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) | 2391 | static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) |
2356 | { | 2392 | { |
2357 | struct sk_buff *msg; | 2393 | struct sk_buff *msg; |
2358 | struct cfg80211_registered_device *dev = info->user_ptr[0]; | 2394 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
2359 | struct wireless_dev *wdev = info->user_ptr[1]; | 2395 | struct wireless_dev *wdev = info->user_ptr[1]; |
2360 | 2396 | ||
2361 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 2397 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
@@ -2363,7 +2399,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) | |||
2363 | return -ENOMEM; | 2399 | return -ENOMEM; |
2364 | 2400 | ||
2365 | if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, | 2401 | if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, |
2366 | dev, wdev) < 0) { | 2402 | rdev, wdev) < 0) { |
2367 | nlmsg_free(msg); | 2403 | nlmsg_free(msg); |
2368 | return -ENOBUFS; | 2404 | return -ENOBUFS; |
2369 | } | 2405 | } |
@@ -2514,6 +2550,9 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2514 | enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED; | 2550 | enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED; |
2515 | u32 flags; | 2551 | u32 flags; |
2516 | 2552 | ||
2553 | /* to avoid failing a new interface creation due to pending removal */ | ||
2554 | cfg80211_destroy_ifaces(rdev); | ||
2555 | |||
2517 | memset(¶ms, 0, sizeof(params)); | 2556 | memset(¶ms, 0, sizeof(params)); |
2518 | 2557 | ||
2519 | if (!info->attrs[NL80211_ATTR_IFNAME]) | 2558 | if (!info->attrs[NL80211_ATTR_IFNAME]) |
@@ -2563,6 +2602,9 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2563 | return PTR_ERR(wdev); | 2602 | return PTR_ERR(wdev); |
2564 | } | 2603 | } |
2565 | 2604 | ||
2605 | if (info->attrs[NL80211_ATTR_IFACE_SOCKET_OWNER]) | ||
2606 | wdev->owner_nlportid = info->snd_portid; | ||
2607 | |||
2566 | switch (type) { | 2608 | switch (type) { |
2567 | case NL80211_IFTYPE_MESH_POINT: | 2609 | case NL80211_IFTYPE_MESH_POINT: |
2568 | if (!info->attrs[NL80211_ATTR_MESH_ID]) | 2610 | if (!info->attrs[NL80211_ATTR_MESH_ID]) |
@@ -3142,7 +3184,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) | |||
3142 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 3184 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
3143 | struct cfg80211_ap_settings params; | 3185 | struct cfg80211_ap_settings params; |
3144 | int err; | 3186 | int err; |
3145 | u8 radar_detect_width = 0; | ||
3146 | 3187 | ||
3147 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && | 3188 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && |
3148 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) | 3189 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) |
@@ -3258,24 +3299,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) | |||
3258 | } else if (!nl80211_get_ap_channel(rdev, ¶ms)) | 3299 | } else if (!nl80211_get_ap_channel(rdev, ¶ms)) |
3259 | return -EINVAL; | 3300 | return -EINVAL; |
3260 | 3301 | ||
3261 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef)) | 3302 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef, |
3303 | wdev->iftype)) | ||
3262 | return -EINVAL; | 3304 | return -EINVAL; |
3263 | 3305 | ||
3264 | err = cfg80211_chandef_dfs_required(wdev->wiphy, ¶ms.chandef); | ||
3265 | if (err < 0) | ||
3266 | return err; | ||
3267 | if (err) { | ||
3268 | radar_detect_width = BIT(params.chandef.width); | ||
3269 | params.radar_required = true; | ||
3270 | } | ||
3271 | |||
3272 | err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype, | ||
3273 | params.chandef.chan, | ||
3274 | CHAN_MODE_SHARED, | ||
3275 | radar_detect_width); | ||
3276 | if (err) | ||
3277 | return err; | ||
3278 | |||
3279 | if (info->attrs[NL80211_ATTR_ACL_POLICY]) { | 3306 | if (info->attrs[NL80211_ATTR_ACL_POLICY]) { |
3280 | params.acl = parse_acl_data(&rdev->wiphy, info); | 3307 | params.acl = parse_acl_data(&rdev->wiphy, info); |
3281 | if (IS_ERR(params.acl)) | 3308 | if (IS_ERR(params.acl)) |
@@ -3675,13 +3702,13 @@ static int nl80211_dump_station(struct sk_buff *skb, | |||
3675 | struct netlink_callback *cb) | 3702 | struct netlink_callback *cb) |
3676 | { | 3703 | { |
3677 | struct station_info sinfo; | 3704 | struct station_info sinfo; |
3678 | struct cfg80211_registered_device *dev; | 3705 | struct cfg80211_registered_device *rdev; |
3679 | struct wireless_dev *wdev; | 3706 | struct wireless_dev *wdev; |
3680 | u8 mac_addr[ETH_ALEN]; | 3707 | u8 mac_addr[ETH_ALEN]; |
3681 | int sta_idx = cb->args[2]; | 3708 | int sta_idx = cb->args[2]; |
3682 | int err; | 3709 | int err; |
3683 | 3710 | ||
3684 | err = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev); | 3711 | err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); |
3685 | if (err) | 3712 | if (err) |
3686 | return err; | 3713 | return err; |
3687 | 3714 | ||
@@ -3690,14 +3717,14 @@ static int nl80211_dump_station(struct sk_buff *skb, | |||
3690 | goto out_err; | 3717 | goto out_err; |
3691 | } | 3718 | } |
3692 | 3719 | ||
3693 | if (!dev->ops->dump_station) { | 3720 | if (!rdev->ops->dump_station) { |
3694 | err = -EOPNOTSUPP; | 3721 | err = -EOPNOTSUPP; |
3695 | goto out_err; | 3722 | goto out_err; |
3696 | } | 3723 | } |
3697 | 3724 | ||
3698 | while (1) { | 3725 | while (1) { |
3699 | memset(&sinfo, 0, sizeof(sinfo)); | 3726 | memset(&sinfo, 0, sizeof(sinfo)); |
3700 | err = rdev_dump_station(dev, wdev->netdev, sta_idx, | 3727 | err = rdev_dump_station(rdev, wdev->netdev, sta_idx, |
3701 | mac_addr, &sinfo); | 3728 | mac_addr, &sinfo); |
3702 | if (err == -ENOENT) | 3729 | if (err == -ENOENT) |
3703 | break; | 3730 | break; |
@@ -3707,7 +3734,7 @@ static int nl80211_dump_station(struct sk_buff *skb, | |||
3707 | if (nl80211_send_station(skb, | 3734 | if (nl80211_send_station(skb, |
3708 | NETLINK_CB(cb->skb).portid, | 3735 | NETLINK_CB(cb->skb).portid, |
3709 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 3736 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
3710 | dev, wdev->netdev, mac_addr, | 3737 | rdev, wdev->netdev, mac_addr, |
3711 | &sinfo) < 0) | 3738 | &sinfo) < 0) |
3712 | goto out; | 3739 | goto out; |
3713 | 3740 | ||
@@ -3719,7 +3746,7 @@ static int nl80211_dump_station(struct sk_buff *skb, | |||
3719 | cb->args[2] = sta_idx; | 3746 | cb->args[2] = sta_idx; |
3720 | err = skb->len; | 3747 | err = skb->len; |
3721 | out_err: | 3748 | out_err: |
3722 | nl80211_finish_wdev_dump(dev); | 3749 | nl80211_finish_wdev_dump(rdev); |
3723 | 3750 | ||
3724 | return err; | 3751 | return err; |
3725 | } | 3752 | } |
@@ -4380,18 +4407,18 @@ static int nl80211_dump_mpath(struct sk_buff *skb, | |||
4380 | struct netlink_callback *cb) | 4407 | struct netlink_callback *cb) |
4381 | { | 4408 | { |
4382 | struct mpath_info pinfo; | 4409 | struct mpath_info pinfo; |
4383 | struct cfg80211_registered_device *dev; | 4410 | struct cfg80211_registered_device *rdev; |
4384 | struct wireless_dev *wdev; | 4411 | struct wireless_dev *wdev; |
4385 | u8 dst[ETH_ALEN]; | 4412 | u8 dst[ETH_ALEN]; |
4386 | u8 next_hop[ETH_ALEN]; | 4413 | u8 next_hop[ETH_ALEN]; |
4387 | int path_idx = cb->args[2]; | 4414 | int path_idx = cb->args[2]; |
4388 | int err; | 4415 | int err; |
4389 | 4416 | ||
4390 | err = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev); | 4417 | err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); |
4391 | if (err) | 4418 | if (err) |
4392 | return err; | 4419 | return err; |
4393 | 4420 | ||
4394 | if (!dev->ops->dump_mpath) { | 4421 | if (!rdev->ops->dump_mpath) { |
4395 | err = -EOPNOTSUPP; | 4422 | err = -EOPNOTSUPP; |
4396 | goto out_err; | 4423 | goto out_err; |
4397 | } | 4424 | } |
@@ -4402,7 +4429,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb, | |||
4402 | } | 4429 | } |
4403 | 4430 | ||
4404 | while (1) { | 4431 | while (1) { |
4405 | err = rdev_dump_mpath(dev, wdev->netdev, path_idx, dst, | 4432 | err = rdev_dump_mpath(rdev, wdev->netdev, path_idx, dst, |
4406 | next_hop, &pinfo); | 4433 | next_hop, &pinfo); |
4407 | if (err == -ENOENT) | 4434 | if (err == -ENOENT) |
4408 | break; | 4435 | break; |
@@ -4423,7 +4450,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb, | |||
4423 | cb->args[2] = path_idx; | 4450 | cb->args[2] = path_idx; |
4424 | err = skb->len; | 4451 | err = skb->len; |
4425 | out_err: | 4452 | out_err: |
4426 | nl80211_finish_wdev_dump(dev); | 4453 | nl80211_finish_wdev_dump(rdev); |
4427 | return err; | 4454 | return err; |
4428 | } | 4455 | } |
4429 | 4456 | ||
@@ -4663,7 +4690,6 @@ static int parse_reg_rule(struct nlattr *tb[], | |||
4663 | 4690 | ||
4664 | static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) | 4691 | static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) |
4665 | { | 4692 | { |
4666 | int r; | ||
4667 | char *data = NULL; | 4693 | char *data = NULL; |
4668 | enum nl80211_user_reg_hint_type user_reg_hint_type; | 4694 | enum nl80211_user_reg_hint_type user_reg_hint_type; |
4669 | 4695 | ||
@@ -4676,11 +4702,6 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) | |||
4676 | if (unlikely(!rcu_access_pointer(cfg80211_regdomain))) | 4702 | if (unlikely(!rcu_access_pointer(cfg80211_regdomain))) |
4677 | return -EINPROGRESS; | 4703 | return -EINPROGRESS; |
4678 | 4704 | ||
4679 | if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) | ||
4680 | return -EINVAL; | ||
4681 | |||
4682 | data = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]); | ||
4683 | |||
4684 | if (info->attrs[NL80211_ATTR_USER_REG_HINT_TYPE]) | 4705 | if (info->attrs[NL80211_ATTR_USER_REG_HINT_TYPE]) |
4685 | user_reg_hint_type = | 4706 | user_reg_hint_type = |
4686 | nla_get_u32(info->attrs[NL80211_ATTR_USER_REG_HINT_TYPE]); | 4707 | nla_get_u32(info->attrs[NL80211_ATTR_USER_REG_HINT_TYPE]); |
@@ -4690,14 +4711,16 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) | |||
4690 | switch (user_reg_hint_type) { | 4711 | switch (user_reg_hint_type) { |
4691 | case NL80211_USER_REG_HINT_USER: | 4712 | case NL80211_USER_REG_HINT_USER: |
4692 | case NL80211_USER_REG_HINT_CELL_BASE: | 4713 | case NL80211_USER_REG_HINT_CELL_BASE: |
4693 | break; | 4714 | if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) |
4715 | return -EINVAL; | ||
4716 | |||
4717 | data = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]); | ||
4718 | return regulatory_hint_user(data, user_reg_hint_type); | ||
4719 | case NL80211_USER_REG_HINT_INDOOR: | ||
4720 | return regulatory_hint_indoor_user(); | ||
4694 | default: | 4721 | default: |
4695 | return -EINVAL; | 4722 | return -EINVAL; |
4696 | } | 4723 | } |
4697 | |||
4698 | r = regulatory_hint_user(data, user_reg_hint_type); | ||
4699 | |||
4700 | return r; | ||
4701 | } | 4724 | } |
4702 | 4725 | ||
4703 | static int nl80211_get_mesh_config(struct sk_buff *skb, | 4726 | static int nl80211_get_mesh_config(struct sk_buff *skb, |
@@ -5796,7 +5819,8 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, | |||
5796 | if (wdev->cac_started) | 5819 | if (wdev->cac_started) |
5797 | return -EBUSY; | 5820 | return -EBUSY; |
5798 | 5821 | ||
5799 | err = cfg80211_chandef_dfs_required(wdev->wiphy, &chandef); | 5822 | err = cfg80211_chandef_dfs_required(wdev->wiphy, &chandef, |
5823 | NL80211_IFTYPE_UNSPECIFIED); | ||
5800 | if (err < 0) | 5824 | if (err < 0) |
5801 | return err; | 5825 | return err; |
5802 | 5826 | ||
@@ -5809,12 +5833,6 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, | |||
5809 | if (!rdev->ops->start_radar_detection) | 5833 | if (!rdev->ops->start_radar_detection) |
5810 | return -EOPNOTSUPP; | 5834 | return -EOPNOTSUPP; |
5811 | 5835 | ||
5812 | err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype, | ||
5813 | chandef.chan, CHAN_MODE_SHARED, | ||
5814 | BIT(chandef.width)); | ||
5815 | if (err) | ||
5816 | return err; | ||
5817 | |||
5818 | cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, &chandef); | 5836 | cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, &chandef); |
5819 | if (WARN_ON(!cac_time_ms)) | 5837 | if (WARN_ON(!cac_time_ms)) |
5820 | cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; | 5838 | cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; |
@@ -5928,27 +5946,25 @@ skip_beacons: | |||
5928 | if (err) | 5946 | if (err) |
5929 | return err; | 5947 | return err; |
5930 | 5948 | ||
5931 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef)) | 5949 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef, |
5950 | wdev->iftype)) | ||
5932 | return -EINVAL; | 5951 | return -EINVAL; |
5933 | 5952 | ||
5934 | switch (dev->ieee80211_ptr->iftype) { | 5953 | err = cfg80211_chandef_dfs_required(wdev->wiphy, |
5935 | case NL80211_IFTYPE_AP: | 5954 | ¶ms.chandef, |
5936 | case NL80211_IFTYPE_P2P_GO: | 5955 | wdev->iftype); |
5937 | case NL80211_IFTYPE_ADHOC: | 5956 | if (err < 0) |
5938 | case NL80211_IFTYPE_MESH_POINT: | 5957 | return err; |
5939 | err = cfg80211_chandef_dfs_required(wdev->wiphy, | 5958 | |
5940 | ¶ms.chandef); | 5959 | if (err > 0) { |
5941 | if (err < 0) | 5960 | radar_detect_width = BIT(params.chandef.width); |
5942 | return err; | 5961 | params.radar_required = true; |
5943 | if (err) { | ||
5944 | radar_detect_width = BIT(params.chandef.width); | ||
5945 | params.radar_required = true; | ||
5946 | } | ||
5947 | break; | ||
5948 | default: | ||
5949 | break; | ||
5950 | } | 5962 | } |
5951 | 5963 | ||
5964 | /* TODO: I left this here for now. With channel switch, the | ||
5965 | * verification is a bit more complicated, because we only do | ||
5966 | * it later when the channel switch really happens. | ||
5967 | */ | ||
5952 | err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype, | 5968 | err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype, |
5953 | params.chandef.chan, | 5969 | params.chandef.chan, |
5954 | CHAN_MODE_SHARED, | 5970 | CHAN_MODE_SHARED, |
@@ -6175,12 +6191,12 @@ static int nl80211_dump_survey(struct sk_buff *skb, | |||
6175 | struct netlink_callback *cb) | 6191 | struct netlink_callback *cb) |
6176 | { | 6192 | { |
6177 | struct survey_info survey; | 6193 | struct survey_info survey; |
6178 | struct cfg80211_registered_device *dev; | 6194 | struct cfg80211_registered_device *rdev; |
6179 | struct wireless_dev *wdev; | 6195 | struct wireless_dev *wdev; |
6180 | int survey_idx = cb->args[2]; | 6196 | int survey_idx = cb->args[2]; |
6181 | int res; | 6197 | int res; |
6182 | 6198 | ||
6183 | res = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev); | 6199 | res = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); |
6184 | if (res) | 6200 | if (res) |
6185 | return res; | 6201 | return res; |
6186 | 6202 | ||
@@ -6189,7 +6205,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, | |||
6189 | goto out_err; | 6205 | goto out_err; |
6190 | } | 6206 | } |
6191 | 6207 | ||
6192 | if (!dev->ops->dump_survey) { | 6208 | if (!rdev->ops->dump_survey) { |
6193 | res = -EOPNOTSUPP; | 6209 | res = -EOPNOTSUPP; |
6194 | goto out_err; | 6210 | goto out_err; |
6195 | } | 6211 | } |
@@ -6197,7 +6213,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, | |||
6197 | while (1) { | 6213 | while (1) { |
6198 | struct ieee80211_channel *chan; | 6214 | struct ieee80211_channel *chan; |
6199 | 6215 | ||
6200 | res = rdev_dump_survey(dev, wdev->netdev, survey_idx, &survey); | 6216 | res = rdev_dump_survey(rdev, wdev->netdev, survey_idx, &survey); |
6201 | if (res == -ENOENT) | 6217 | if (res == -ENOENT) |
6202 | break; | 6218 | break; |
6203 | if (res) | 6219 | if (res) |
@@ -6209,7 +6225,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, | |||
6209 | goto out; | 6225 | goto out; |
6210 | } | 6226 | } |
6211 | 6227 | ||
6212 | chan = ieee80211_get_channel(&dev->wiphy, | 6228 | chan = ieee80211_get_channel(&rdev->wiphy, |
6213 | survey.channel->center_freq); | 6229 | survey.channel->center_freq); |
6214 | if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) { | 6230 | if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) { |
6215 | survey_idx++; | 6231 | survey_idx++; |
@@ -6228,7 +6244,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, | |||
6228 | cb->args[2] = survey_idx; | 6244 | cb->args[2] = survey_idx; |
6229 | res = skb->len; | 6245 | res = skb->len; |
6230 | out_err: | 6246 | out_err: |
6231 | nl80211_finish_wdev_dump(dev); | 6247 | nl80211_finish_wdev_dump(rdev); |
6232 | return res; | 6248 | return res; |
6233 | } | 6249 | } |
6234 | 6250 | ||
@@ -6704,7 +6720,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) | |||
6704 | if (err) | 6720 | if (err) |
6705 | return err; | 6721 | return err; |
6706 | 6722 | ||
6707 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &ibss.chandef)) | 6723 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &ibss.chandef, |
6724 | NL80211_IFTYPE_ADHOC)) | ||
6708 | return -EINVAL; | 6725 | return -EINVAL; |
6709 | 6726 | ||
6710 | switch (ibss.chandef.width) { | 6727 | switch (ibss.chandef.width) { |
@@ -6879,7 +6896,7 @@ struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, | |||
6879 | int vendor_event_idx, | 6896 | int vendor_event_idx, |
6880 | int approxlen, gfp_t gfp) | 6897 | int approxlen, gfp_t gfp) |
6881 | { | 6898 | { |
6882 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 6899 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
6883 | const struct nl80211_vendor_cmd_info *info; | 6900 | const struct nl80211_vendor_cmd_info *info; |
6884 | 6901 | ||
6885 | switch (cmd) { | 6902 | switch (cmd) { |
@@ -8981,9 +8998,8 @@ static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info) | |||
8981 | if (wdev->p2p_started) | 8998 | if (wdev->p2p_started) |
8982 | return 0; | 8999 | return 0; |
8983 | 9000 | ||
8984 | err = cfg80211_can_add_interface(rdev, wdev->iftype); | 9001 | if (rfkill_blocked(rdev->rfkill)) |
8985 | if (err) | 9002 | return -ERFKILL; |
8986 | return err; | ||
8987 | 9003 | ||
8988 | err = rdev_start_p2p_device(rdev, wdev); | 9004 | err = rdev_start_p2p_device(rdev, wdev); |
8989 | if (err) | 9005 | if (err) |
@@ -9192,7 +9208,7 @@ struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, | |||
9192 | enum nl80211_attrs attr, | 9208 | enum nl80211_attrs attr, |
9193 | int approxlen) | 9209 | int approxlen) |
9194 | { | 9210 | { |
9195 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 9211 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
9196 | 9212 | ||
9197 | if (WARN_ON(!rdev->cur_cmd_info)) | 9213 | if (WARN_ON(!rdev->cur_cmd_info)) |
9198 | return NULL; | 9214 | return NULL; |
@@ -9316,7 +9332,7 @@ static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, | |||
9316 | } | 9332 | } |
9317 | 9333 | ||
9318 | dev = wdev->netdev; | 9334 | dev = wdev->netdev; |
9319 | rdev = wiphy_to_dev(wdev->wiphy); | 9335 | rdev = wiphy_to_rdev(wdev->wiphy); |
9320 | 9336 | ||
9321 | if (ops->internal_flags & NL80211_FLAG_NEED_NETDEV) { | 9337 | if (ops->internal_flags & NL80211_FLAG_NEED_NETDEV) { |
9322 | if (!dev) { | 9338 | if (!dev) { |
@@ -10345,7 +10361,7 @@ void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, const u8 *buf, | |||
10345 | { | 10361 | { |
10346 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 10362 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
10347 | struct wiphy *wiphy = wdev->wiphy; | 10363 | struct wiphy *wiphy = wdev->wiphy; |
10348 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 10364 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
10349 | const struct ieee80211_mgmt *mgmt = (void *)buf; | 10365 | const struct ieee80211_mgmt *mgmt = (void *)buf; |
10350 | u32 cmd; | 10366 | u32 cmd; |
10351 | 10367 | ||
@@ -10567,7 +10583,7 @@ void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *addr, | |||
10567 | const u8* ie, u8 ie_len, gfp_t gfp) | 10583 | const u8* ie, u8 ie_len, gfp_t gfp) |
10568 | { | 10584 | { |
10569 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 10585 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
10570 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 10586 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
10571 | struct sk_buff *msg; | 10587 | struct sk_buff *msg; |
10572 | void *hdr; | 10588 | void *hdr; |
10573 | 10589 | ||
@@ -10747,7 +10763,7 @@ void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, | |||
10747 | unsigned int duration, gfp_t gfp) | 10763 | unsigned int duration, gfp_t gfp) |
10748 | { | 10764 | { |
10749 | struct wiphy *wiphy = wdev->wiphy; | 10765 | struct wiphy *wiphy = wdev->wiphy; |
10750 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 10766 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
10751 | 10767 | ||
10752 | trace_cfg80211_ready_on_channel(wdev, cookie, chan, duration); | 10768 | trace_cfg80211_ready_on_channel(wdev, cookie, chan, duration); |
10753 | nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL, | 10769 | nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL, |
@@ -10761,7 +10777,7 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, | |||
10761 | gfp_t gfp) | 10777 | gfp_t gfp) |
10762 | { | 10778 | { |
10763 | struct wiphy *wiphy = wdev->wiphy; | 10779 | struct wiphy *wiphy = wdev->wiphy; |
10764 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 10780 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
10765 | 10781 | ||
10766 | trace_cfg80211_ready_on_channel_expired(wdev, cookie, chan); | 10782 | trace_cfg80211_ready_on_channel_expired(wdev, cookie, chan); |
10767 | nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, | 10783 | nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, |
@@ -10773,7 +10789,7 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, | |||
10773 | struct station_info *sinfo, gfp_t gfp) | 10789 | struct station_info *sinfo, gfp_t gfp) |
10774 | { | 10790 | { |
10775 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 10791 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
10776 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 10792 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
10777 | struct sk_buff *msg; | 10793 | struct sk_buff *msg; |
10778 | 10794 | ||
10779 | trace_cfg80211_new_sta(dev, mac_addr, sinfo); | 10795 | trace_cfg80211_new_sta(dev, mac_addr, sinfo); |
@@ -10796,7 +10812,7 @@ EXPORT_SYMBOL(cfg80211_new_sta); | |||
10796 | void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp) | 10812 | void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp) |
10797 | { | 10813 | { |
10798 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 10814 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
10799 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 10815 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
10800 | struct sk_buff *msg; | 10816 | struct sk_buff *msg; |
10801 | void *hdr; | 10817 | void *hdr; |
10802 | 10818 | ||
@@ -10833,7 +10849,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, | |||
10833 | gfp_t gfp) | 10849 | gfp_t gfp) |
10834 | { | 10850 | { |
10835 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 10851 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
10836 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 10852 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
10837 | struct sk_buff *msg; | 10853 | struct sk_buff *msg; |
10838 | void *hdr; | 10854 | void *hdr; |
10839 | 10855 | ||
@@ -10868,7 +10884,7 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, | |||
10868 | const u8 *addr, gfp_t gfp) | 10884 | const u8 *addr, gfp_t gfp) |
10869 | { | 10885 | { |
10870 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 10886 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
10871 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 10887 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
10872 | struct sk_buff *msg; | 10888 | struct sk_buff *msg; |
10873 | void *hdr; | 10889 | void *hdr; |
10874 | u32 nlportid = ACCESS_ONCE(wdev->ap_unexpected_nlportid); | 10890 | u32 nlportid = ACCESS_ONCE(wdev->ap_unexpected_nlportid); |
@@ -10988,7 +11004,7 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, | |||
10988 | const u8 *buf, size_t len, bool ack, gfp_t gfp) | 11004 | const u8 *buf, size_t len, bool ack, gfp_t gfp) |
10989 | { | 11005 | { |
10990 | struct wiphy *wiphy = wdev->wiphy; | 11006 | struct wiphy *wiphy = wdev->wiphy; |
10991 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11007 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
10992 | struct net_device *netdev = wdev->netdev; | 11008 | struct net_device *netdev = wdev->netdev; |
10993 | struct sk_buff *msg; | 11009 | struct sk_buff *msg; |
10994 | void *hdr; | 11010 | void *hdr; |
@@ -11032,7 +11048,7 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, | |||
11032 | { | 11048 | { |
11033 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 11049 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
11034 | struct wiphy *wiphy = wdev->wiphy; | 11050 | struct wiphy *wiphy = wdev->wiphy; |
11035 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11051 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11036 | struct sk_buff *msg; | 11052 | struct sk_buff *msg; |
11037 | struct nlattr *pinfoattr; | 11053 | struct nlattr *pinfoattr; |
11038 | void *hdr; | 11054 | void *hdr; |
@@ -11124,7 +11140,7 @@ void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, | |||
11124 | { | 11140 | { |
11125 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 11141 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
11126 | struct wiphy *wiphy = wdev->wiphy; | 11142 | struct wiphy *wiphy = wdev->wiphy; |
11127 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11143 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11128 | 11144 | ||
11129 | trace_cfg80211_gtk_rekey_notify(dev, bssid); | 11145 | trace_cfg80211_gtk_rekey_notify(dev, bssid); |
11130 | nl80211_gtk_rekey_notify(rdev, dev, bssid, replay_ctr, gfp); | 11146 | nl80211_gtk_rekey_notify(rdev, dev, bssid, replay_ctr, gfp); |
@@ -11182,7 +11198,7 @@ void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, | |||
11182 | { | 11198 | { |
11183 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 11199 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
11184 | struct wiphy *wiphy = wdev->wiphy; | 11200 | struct wiphy *wiphy = wdev->wiphy; |
11185 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11201 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11186 | 11202 | ||
11187 | trace_cfg80211_pmksa_candidate_notify(dev, index, bssid, preauth); | 11203 | trace_cfg80211_pmksa_candidate_notify(dev, index, bssid, preauth); |
11188 | nl80211_pmksa_candidate_notify(rdev, dev, index, bssid, preauth, gfp); | 11204 | nl80211_pmksa_candidate_notify(rdev, dev, index, bssid, preauth, gfp); |
@@ -11229,7 +11245,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, | |||
11229 | { | 11245 | { |
11230 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 11246 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
11231 | struct wiphy *wiphy = wdev->wiphy; | 11247 | struct wiphy *wiphy = wdev->wiphy; |
11232 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11248 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11233 | 11249 | ||
11234 | ASSERT_WDEV_LOCK(wdev); | 11250 | ASSERT_WDEV_LOCK(wdev); |
11235 | 11251 | ||
@@ -11253,7 +11269,7 @@ void cfg80211_cqm_txe_notify(struct net_device *dev, | |||
11253 | { | 11269 | { |
11254 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 11270 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
11255 | struct wiphy *wiphy = wdev->wiphy; | 11271 | struct wiphy *wiphy = wdev->wiphy; |
11256 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11272 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11257 | struct sk_buff *msg; | 11273 | struct sk_buff *msg; |
11258 | struct nlattr *pinfoattr; | 11274 | struct nlattr *pinfoattr; |
11259 | void *hdr; | 11275 | void *hdr; |
@@ -11353,7 +11369,7 @@ void cfg80211_cqm_pktloss_notify(struct net_device *dev, | |||
11353 | { | 11369 | { |
11354 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 11370 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
11355 | struct wiphy *wiphy = wdev->wiphy; | 11371 | struct wiphy *wiphy = wdev->wiphy; |
11356 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11372 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11357 | struct sk_buff *msg; | 11373 | struct sk_buff *msg; |
11358 | struct nlattr *pinfoattr; | 11374 | struct nlattr *pinfoattr; |
11359 | void *hdr; | 11375 | void *hdr; |
@@ -11400,7 +11416,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, | |||
11400 | u64 cookie, bool acked, gfp_t gfp) | 11416 | u64 cookie, bool acked, gfp_t gfp) |
11401 | { | 11417 | { |
11402 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 11418 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
11403 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 11419 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
11404 | struct sk_buff *msg; | 11420 | struct sk_buff *msg; |
11405 | void *hdr; | 11421 | void *hdr; |
11406 | 11422 | ||
@@ -11440,7 +11456,7 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy, | |||
11440 | const u8 *frame, size_t len, | 11456 | const u8 *frame, size_t len, |
11441 | int freq, int sig_dbm) | 11457 | int freq, int sig_dbm) |
11442 | { | 11458 | { |
11443 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11459 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11444 | struct sk_buff *msg; | 11460 | struct sk_buff *msg; |
11445 | void *hdr; | 11461 | void *hdr; |
11446 | struct cfg80211_beacon_registration *reg; | 11462 | struct cfg80211_beacon_registration *reg; |
@@ -11487,7 +11503,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, | |||
11487 | struct cfg80211_wowlan_wakeup *wakeup, | 11503 | struct cfg80211_wowlan_wakeup *wakeup, |
11488 | gfp_t gfp) | 11504 | gfp_t gfp) |
11489 | { | 11505 | { |
11490 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 11506 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
11491 | struct sk_buff *msg; | 11507 | struct sk_buff *msg; |
11492 | void *hdr; | 11508 | void *hdr; |
11493 | int size = 200; | 11509 | int size = 200; |
@@ -11597,7 +11613,7 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, | |||
11597 | u16 reason_code, gfp_t gfp) | 11613 | u16 reason_code, gfp_t gfp) |
11598 | { | 11614 | { |
11599 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 11615 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
11600 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 11616 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
11601 | struct sk_buff *msg; | 11617 | struct sk_buff *msg; |
11602 | void *hdr; | 11618 | void *hdr; |
11603 | 11619 | ||
@@ -11649,9 +11665,15 @@ static int nl80211_netlink_notify(struct notifier_block * nb, | |||
11649 | rcu_read_lock(); | 11665 | rcu_read_lock(); |
11650 | 11666 | ||
11651 | list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) { | 11667 | list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) { |
11652 | list_for_each_entry_rcu(wdev, &rdev->wdev_list, list) | 11668 | bool schedule_destroy_work = false; |
11669 | |||
11670 | list_for_each_entry_rcu(wdev, &rdev->wdev_list, list) { | ||
11653 | cfg80211_mlme_unregister_socket(wdev, notify->portid); | 11671 | cfg80211_mlme_unregister_socket(wdev, notify->portid); |
11654 | 11672 | ||
11673 | if (wdev->owner_nlportid == notify->portid) | ||
11674 | schedule_destroy_work = true; | ||
11675 | } | ||
11676 | |||
11655 | spin_lock_bh(&rdev->beacon_registrations_lock); | 11677 | spin_lock_bh(&rdev->beacon_registrations_lock); |
11656 | list_for_each_entry_safe(reg, tmp, &rdev->beacon_registrations, | 11678 | list_for_each_entry_safe(reg, tmp, &rdev->beacon_registrations, |
11657 | list) { | 11679 | list) { |
@@ -11662,11 +11684,24 @@ static int nl80211_netlink_notify(struct notifier_block * nb, | |||
11662 | } | 11684 | } |
11663 | } | 11685 | } |
11664 | spin_unlock_bh(&rdev->beacon_registrations_lock); | 11686 | spin_unlock_bh(&rdev->beacon_registrations_lock); |
11687 | |||
11688 | if (schedule_destroy_work) { | ||
11689 | struct cfg80211_iface_destroy *destroy; | ||
11690 | |||
11691 | destroy = kzalloc(sizeof(*destroy), GFP_ATOMIC); | ||
11692 | if (destroy) { | ||
11693 | destroy->nlportid = notify->portid; | ||
11694 | spin_lock(&rdev->destroy_list_lock); | ||
11695 | list_add(&destroy->list, &rdev->destroy_list); | ||
11696 | spin_unlock(&rdev->destroy_list_lock); | ||
11697 | schedule_work(&rdev->destroy_work); | ||
11698 | } | ||
11699 | } | ||
11665 | } | 11700 | } |
11666 | 11701 | ||
11667 | rcu_read_unlock(); | 11702 | rcu_read_unlock(); |
11668 | 11703 | ||
11669 | return NOTIFY_DONE; | 11704 | return NOTIFY_OK; |
11670 | } | 11705 | } |
11671 | 11706 | ||
11672 | static struct notifier_block nl80211_netlink_notifier = { | 11707 | static struct notifier_block nl80211_netlink_notifier = { |
@@ -11677,7 +11712,7 @@ void cfg80211_ft_event(struct net_device *netdev, | |||
11677 | struct cfg80211_ft_event_params *ft_event) | 11712 | struct cfg80211_ft_event_params *ft_event) |
11678 | { | 11713 | { |
11679 | struct wiphy *wiphy = netdev->ieee80211_ptr->wiphy; | 11714 | struct wiphy *wiphy = netdev->ieee80211_ptr->wiphy; |
11680 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11715 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11681 | struct sk_buff *msg; | 11716 | struct sk_buff *msg; |
11682 | void *hdr; | 11717 | void *hdr; |
11683 | 11718 | ||
@@ -11724,7 +11759,7 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp) | |||
11724 | void *hdr; | 11759 | void *hdr; |
11725 | u32 nlportid; | 11760 | u32 nlportid; |
11726 | 11761 | ||
11727 | rdev = wiphy_to_dev(wdev->wiphy); | 11762 | rdev = wiphy_to_rdev(wdev->wiphy); |
11728 | if (!rdev->crit_proto_nlportid) | 11763 | if (!rdev->crit_proto_nlportid) |
11729 | return; | 11764 | return; |
11730 | 11765 | ||
@@ -11759,7 +11794,7 @@ EXPORT_SYMBOL(cfg80211_crit_proto_stopped); | |||
11759 | void nl80211_send_ap_stopped(struct wireless_dev *wdev) | 11794 | void nl80211_send_ap_stopped(struct wireless_dev *wdev) |
11760 | { | 11795 | { |
11761 | struct wiphy *wiphy = wdev->wiphy; | 11796 | struct wiphy *wiphy = wdev->wiphy; |
11762 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 11797 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
11763 | struct sk_buff *msg; | 11798 | struct sk_buff *msg; |
11764 | void *hdr; | 11799 | void *hdr; |
11765 | 11800 | ||
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index 74d97d33c938..00cdf73ba6c4 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h | |||
@@ -950,4 +950,17 @@ static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev, | |||
950 | return ret; | 950 | return ret; |
951 | } | 951 | } |
952 | 952 | ||
953 | static inline int | ||
954 | rdev_set_ap_chanwidth(struct cfg80211_registered_device *rdev, | ||
955 | struct net_device *dev, struct cfg80211_chan_def *chandef) | ||
956 | { | ||
957 | int ret; | ||
958 | |||
959 | trace_rdev_set_ap_chanwidth(&rdev->wiphy, dev, chandef); | ||
960 | ret = rdev->ops->set_ap_chanwidth(&rdev->wiphy, dev, chandef); | ||
961 | trace_rdev_return_int(&rdev->wiphy, ret); | ||
962 | |||
963 | return ret; | ||
964 | } | ||
965 | |||
953 | #endif /* __CFG80211_RDEV_OPS */ | 966 | #endif /* __CFG80211_RDEV_OPS */ |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index f59aaac586f8..e78f532aaa5b 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -65,11 +65,26 @@ | |||
65 | #define REG_DBG_PRINT(args...) | 65 | #define REG_DBG_PRINT(args...) |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | /** | ||
69 | * enum reg_request_treatment - regulatory request treatment | ||
70 | * | ||
71 | * @REG_REQ_OK: continue processing the regulatory request | ||
72 | * @REG_REQ_IGNORE: ignore the regulatory request | ||
73 | * @REG_REQ_INTERSECT: the regulatory domain resulting from this request should | ||
74 | * be intersected with the current one. | ||
75 | * @REG_REQ_ALREADY_SET: the regulatory request will not change the current | ||
76 | * regulatory settings, and no further processing is required. | ||
77 | * @REG_REQ_USER_HINT_HANDLED: a non alpha2 user hint was handled and no | ||
78 | * further processing is required, i.e., not need to update last_request | ||
79 | * etc. This should be used for user hints that do not provide an alpha2 | ||
80 | * but some other type of regulatory hint, i.e., indoor operation. | ||
81 | */ | ||
68 | enum reg_request_treatment { | 82 | enum reg_request_treatment { |
69 | REG_REQ_OK, | 83 | REG_REQ_OK, |
70 | REG_REQ_IGNORE, | 84 | REG_REQ_IGNORE, |
71 | REG_REQ_INTERSECT, | 85 | REG_REQ_INTERSECT, |
72 | REG_REQ_ALREADY_SET, | 86 | REG_REQ_ALREADY_SET, |
87 | REG_REQ_USER_HINT_HANDLED, | ||
73 | }; | 88 | }; |
74 | 89 | ||
75 | static struct regulatory_request core_request_world = { | 90 | static struct regulatory_request core_request_world = { |
@@ -106,6 +121,14 @@ const struct ieee80211_regdomain __rcu *cfg80211_regdomain; | |||
106 | */ | 121 | */ |
107 | static int reg_num_devs_support_basehint; | 122 | static int reg_num_devs_support_basehint; |
108 | 123 | ||
124 | /* | ||
125 | * State variable indicating if the platform on which the devices | ||
126 | * are attached is operating in an indoor environment. The state variable | ||
127 | * is relevant for all registered devices. | ||
128 | * (protected by RTNL) | ||
129 | */ | ||
130 | static bool reg_is_indoor; | ||
131 | |||
109 | static const struct ieee80211_regdomain *get_cfg80211_regdom(void) | 132 | static const struct ieee80211_regdomain *get_cfg80211_regdom(void) |
110 | { | 133 | { |
111 | return rtnl_dereference(cfg80211_regdomain); | 134 | return rtnl_dereference(cfg80211_regdomain); |
@@ -240,8 +263,16 @@ static char user_alpha2[2]; | |||
240 | module_param(ieee80211_regdom, charp, 0444); | 263 | module_param(ieee80211_regdom, charp, 0444); |
241 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); | 264 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); |
242 | 265 | ||
243 | static void reg_free_request(struct regulatory_request *lr) | 266 | static void reg_free_request(struct regulatory_request *request) |
244 | { | 267 | { |
268 | if (request != get_last_request()) | ||
269 | kfree(request); | ||
270 | } | ||
271 | |||
272 | static void reg_free_last_request(void) | ||
273 | { | ||
274 | struct regulatory_request *lr = get_last_request(); | ||
275 | |||
245 | if (lr != &core_request_world && lr) | 276 | if (lr != &core_request_world && lr) |
246 | kfree_rcu(lr, rcu_head); | 277 | kfree_rcu(lr, rcu_head); |
247 | } | 278 | } |
@@ -254,7 +285,7 @@ static void reg_update_last_request(struct regulatory_request *request) | |||
254 | if (lr == request) | 285 | if (lr == request) |
255 | return; | 286 | return; |
256 | 287 | ||
257 | reg_free_request(lr); | 288 | reg_free_last_request(); |
258 | rcu_assign_pointer(last_request, request); | 289 | rcu_assign_pointer(last_request, request); |
259 | } | 290 | } |
260 | 291 | ||
@@ -873,6 +904,8 @@ static u32 map_regdom_flags(u32 rd_flags) | |||
873 | channel_flags |= IEEE80211_CHAN_RADAR; | 904 | channel_flags |= IEEE80211_CHAN_RADAR; |
874 | if (rd_flags & NL80211_RRF_NO_OFDM) | 905 | if (rd_flags & NL80211_RRF_NO_OFDM) |
875 | channel_flags |= IEEE80211_CHAN_NO_OFDM; | 906 | channel_flags |= IEEE80211_CHAN_NO_OFDM; |
907 | if (rd_flags & NL80211_RRF_NO_OUTDOOR) | ||
908 | channel_flags |= IEEE80211_CHAN_INDOOR_ONLY; | ||
876 | return channel_flags; | 909 | return channel_flags; |
877 | } | 910 | } |
878 | 911 | ||
@@ -902,7 +935,7 @@ freq_reg_info_regd(struct wiphy *wiphy, u32 center_freq, | |||
902 | if (!band_rule_found) | 935 | if (!band_rule_found) |
903 | band_rule_found = freq_in_rule_band(fr, center_freq); | 936 | band_rule_found = freq_in_rule_band(fr, center_freq); |
904 | 937 | ||
905 | bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20)); | 938 | bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(5)); |
906 | 939 | ||
907 | if (band_rule_found && bw_fits) | 940 | if (band_rule_found && bw_fits) |
908 | return rr; | 941 | return rr; |
@@ -986,10 +1019,10 @@ static void chan_reg_rule_print_dbg(const struct ieee80211_regdomain *regd, | |||
986 | } | 1019 | } |
987 | #endif | 1020 | #endif |
988 | 1021 | ||
989 | /* | 1022 | /* Find an ieee80211_reg_rule such that a 5MHz channel with frequency |
990 | * Note that right now we assume the desired channel bandwidth | 1023 | * chan->center_freq fits there. |
991 | * is always 20 MHz for each individual channel (HT40 uses 20 MHz | 1024 | * If there is no such reg_rule, disable the channel, otherwise set the |
992 | * per channel, the primary and the extension channel). | 1025 | * flags corresponding to the bandwidths allowed in the particular reg_rule |
993 | */ | 1026 | */ |
994 | static void handle_channel(struct wiphy *wiphy, | 1027 | static void handle_channel(struct wiphy *wiphy, |
995 | enum nl80211_reg_initiator initiator, | 1028 | enum nl80211_reg_initiator initiator, |
@@ -1050,8 +1083,12 @@ static void handle_channel(struct wiphy *wiphy, | |||
1050 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 1083 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
1051 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); | 1084 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); |
1052 | 1085 | ||
1086 | if (max_bandwidth_khz < MHZ_TO_KHZ(10)) | ||
1087 | bw_flags = IEEE80211_CHAN_NO_10MHZ; | ||
1088 | if (max_bandwidth_khz < MHZ_TO_KHZ(20)) | ||
1089 | bw_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
1053 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) | 1090 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) |
1054 | bw_flags = IEEE80211_CHAN_NO_HT40; | 1091 | bw_flags |= IEEE80211_CHAN_NO_HT40; |
1055 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) | 1092 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) |
1056 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; | 1093 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; |
1057 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) | 1094 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) |
@@ -1071,6 +1108,13 @@ static void handle_channel(struct wiphy *wiphy, | |||
1071 | (int) MBI_TO_DBI(power_rule->max_antenna_gain); | 1108 | (int) MBI_TO_DBI(power_rule->max_antenna_gain); |
1072 | chan->max_reg_power = chan->max_power = chan->orig_mpwr = | 1109 | chan->max_reg_power = chan->max_power = chan->orig_mpwr = |
1073 | (int) MBM_TO_DBM(power_rule->max_eirp); | 1110 | (int) MBM_TO_DBM(power_rule->max_eirp); |
1111 | |||
1112 | if (chan->flags & IEEE80211_CHAN_RADAR) { | ||
1113 | chan->dfs_cac_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; | ||
1114 | if (reg_rule->dfs_cac_ms) | ||
1115 | chan->dfs_cac_ms = reg_rule->dfs_cac_ms; | ||
1116 | } | ||
1117 | |||
1074 | return; | 1118 | return; |
1075 | } | 1119 | } |
1076 | 1120 | ||
@@ -1126,12 +1170,19 @@ static bool reg_request_cell_base(struct regulatory_request *request) | |||
1126 | return request->user_reg_hint_type == NL80211_USER_REG_HINT_CELL_BASE; | 1170 | return request->user_reg_hint_type == NL80211_USER_REG_HINT_CELL_BASE; |
1127 | } | 1171 | } |
1128 | 1172 | ||
1173 | static bool reg_request_indoor(struct regulatory_request *request) | ||
1174 | { | ||
1175 | if (request->initiator != NL80211_REGDOM_SET_BY_USER) | ||
1176 | return false; | ||
1177 | return request->user_reg_hint_type == NL80211_USER_REG_HINT_INDOOR; | ||
1178 | } | ||
1179 | |||
1129 | bool reg_last_request_cell_base(void) | 1180 | bool reg_last_request_cell_base(void) |
1130 | { | 1181 | { |
1131 | return reg_request_cell_base(get_last_request()); | 1182 | return reg_request_cell_base(get_last_request()); |
1132 | } | 1183 | } |
1133 | 1184 | ||
1134 | #ifdef CONFIG_CFG80211_CERTIFICATION_ONUS | 1185 | #ifdef CONFIG_CFG80211_REG_CELLULAR_HINTS |
1135 | /* Core specific check */ | 1186 | /* Core specific check */ |
1136 | static enum reg_request_treatment | 1187 | static enum reg_request_treatment |
1137 | reg_ignore_cell_hint(struct regulatory_request *pending_request) | 1188 | reg_ignore_cell_hint(struct regulatory_request *pending_request) |
@@ -1471,8 +1522,12 @@ static void handle_channel_custom(struct wiphy *wiphy, | |||
1471 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 1522 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
1472 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); | 1523 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); |
1473 | 1524 | ||
1525 | if (max_bandwidth_khz < MHZ_TO_KHZ(10)) | ||
1526 | bw_flags = IEEE80211_CHAN_NO_10MHZ; | ||
1527 | if (max_bandwidth_khz < MHZ_TO_KHZ(20)) | ||
1528 | bw_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
1474 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) | 1529 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) |
1475 | bw_flags = IEEE80211_CHAN_NO_HT40; | 1530 | bw_flags |= IEEE80211_CHAN_NO_HT40; |
1476 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) | 1531 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) |
1477 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; | 1532 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; |
1478 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) | 1533 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) |
@@ -1568,6 +1623,11 @@ __reg_process_hint_user(struct regulatory_request *user_request) | |||
1568 | { | 1623 | { |
1569 | struct regulatory_request *lr = get_last_request(); | 1624 | struct regulatory_request *lr = get_last_request(); |
1570 | 1625 | ||
1626 | if (reg_request_indoor(user_request)) { | ||
1627 | reg_is_indoor = true; | ||
1628 | return REG_REQ_USER_HINT_HANDLED; | ||
1629 | } | ||
1630 | |||
1571 | if (reg_request_cell_base(user_request)) | 1631 | if (reg_request_cell_base(user_request)) |
1572 | return reg_ignore_cell_hint(user_request); | 1632 | return reg_ignore_cell_hint(user_request); |
1573 | 1633 | ||
@@ -1615,8 +1675,9 @@ reg_process_hint_user(struct regulatory_request *user_request) | |||
1615 | 1675 | ||
1616 | treatment = __reg_process_hint_user(user_request); | 1676 | treatment = __reg_process_hint_user(user_request); |
1617 | if (treatment == REG_REQ_IGNORE || | 1677 | if (treatment == REG_REQ_IGNORE || |
1618 | treatment == REG_REQ_ALREADY_SET) { | 1678 | treatment == REG_REQ_ALREADY_SET || |
1619 | kfree(user_request); | 1679 | treatment == REG_REQ_USER_HINT_HANDLED) { |
1680 | reg_free_request(user_request); | ||
1620 | return treatment; | 1681 | return treatment; |
1621 | } | 1682 | } |
1622 | 1683 | ||
@@ -1676,14 +1737,15 @@ reg_process_hint_driver(struct wiphy *wiphy, | |||
1676 | case REG_REQ_OK: | 1737 | case REG_REQ_OK: |
1677 | break; | 1738 | break; |
1678 | case REG_REQ_IGNORE: | 1739 | case REG_REQ_IGNORE: |
1679 | kfree(driver_request); | 1740 | case REG_REQ_USER_HINT_HANDLED: |
1741 | reg_free_request(driver_request); | ||
1680 | return treatment; | 1742 | return treatment; |
1681 | case REG_REQ_INTERSECT: | 1743 | case REG_REQ_INTERSECT: |
1682 | /* fall through */ | 1744 | /* fall through */ |
1683 | case REG_REQ_ALREADY_SET: | 1745 | case REG_REQ_ALREADY_SET: |
1684 | regd = reg_copy_regd(get_cfg80211_regdom()); | 1746 | regd = reg_copy_regd(get_cfg80211_regdom()); |
1685 | if (IS_ERR(regd)) { | 1747 | if (IS_ERR(regd)) { |
1686 | kfree(driver_request); | 1748 | reg_free_request(driver_request); |
1687 | return REG_REQ_IGNORE; | 1749 | return REG_REQ_IGNORE; |
1688 | } | 1750 | } |
1689 | rcu_assign_pointer(wiphy->regd, regd); | 1751 | rcu_assign_pointer(wiphy->regd, regd); |
@@ -1775,12 +1837,13 @@ reg_process_hint_country_ie(struct wiphy *wiphy, | |||
1775 | case REG_REQ_OK: | 1837 | case REG_REQ_OK: |
1776 | break; | 1838 | break; |
1777 | case REG_REQ_IGNORE: | 1839 | case REG_REQ_IGNORE: |
1840 | case REG_REQ_USER_HINT_HANDLED: | ||
1778 | /* fall through */ | 1841 | /* fall through */ |
1779 | case REG_REQ_ALREADY_SET: | 1842 | case REG_REQ_ALREADY_SET: |
1780 | kfree(country_ie_request); | 1843 | reg_free_request(country_ie_request); |
1781 | return treatment; | 1844 | return treatment; |
1782 | case REG_REQ_INTERSECT: | 1845 | case REG_REQ_INTERSECT: |
1783 | kfree(country_ie_request); | 1846 | reg_free_request(country_ie_request); |
1784 | /* | 1847 | /* |
1785 | * This doesn't happen yet, not sure we | 1848 | * This doesn't happen yet, not sure we |
1786 | * ever want to support it for this case. | 1849 | * ever want to support it for this case. |
@@ -1841,7 +1904,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
1841 | return; | 1904 | return; |
1842 | 1905 | ||
1843 | out_free: | 1906 | out_free: |
1844 | kfree(reg_request); | 1907 | reg_free_request(reg_request); |
1845 | } | 1908 | } |
1846 | 1909 | ||
1847 | /* | 1910 | /* |
@@ -1857,7 +1920,7 @@ static void reg_process_pending_hints(void) | |||
1857 | 1920 | ||
1858 | /* When last_request->processed becomes true this will be rescheduled */ | 1921 | /* When last_request->processed becomes true this will be rescheduled */ |
1859 | if (lr && !lr->processed) { | 1922 | if (lr && !lr->processed) { |
1860 | REG_DBG_PRINT("Pending regulatory request, waiting for it to be processed...\n"); | 1923 | reg_process_hint(lr); |
1861 | return; | 1924 | return; |
1862 | } | 1925 | } |
1863 | 1926 | ||
@@ -1967,6 +2030,22 @@ int regulatory_hint_user(const char *alpha2, | |||
1967 | return 0; | 2030 | return 0; |
1968 | } | 2031 | } |
1969 | 2032 | ||
2033 | int regulatory_hint_indoor_user(void) | ||
2034 | { | ||
2035 | struct regulatory_request *request; | ||
2036 | |||
2037 | request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); | ||
2038 | if (!request) | ||
2039 | return -ENOMEM; | ||
2040 | |||
2041 | request->wiphy_idx = WIPHY_IDX_INVALID; | ||
2042 | request->initiator = NL80211_REGDOM_SET_BY_USER; | ||
2043 | request->user_reg_hint_type = NL80211_USER_REG_HINT_INDOOR; | ||
2044 | queue_regulatory_request(request); | ||
2045 | |||
2046 | return 0; | ||
2047 | } | ||
2048 | |||
1970 | /* Driver hints */ | 2049 | /* Driver hints */ |
1971 | int regulatory_hint(struct wiphy *wiphy, const char *alpha2) | 2050 | int regulatory_hint(struct wiphy *wiphy, const char *alpha2) |
1972 | { | 2051 | { |
@@ -2134,6 +2213,8 @@ static void restore_regulatory_settings(bool reset_user) | |||
2134 | 2213 | ||
2135 | ASSERT_RTNL(); | 2214 | ASSERT_RTNL(); |
2136 | 2215 | ||
2216 | reg_is_indoor = false; | ||
2217 | |||
2137 | reset_regdomains(true, &world_regdom); | 2218 | reset_regdomains(true, &world_regdom); |
2138 | restore_alpha2(alpha2, reset_user); | 2219 | restore_alpha2(alpha2, reset_user); |
2139 | 2220 | ||
@@ -2594,7 +2675,7 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy) | |||
2594 | reg_num_devs_support_basehint--; | 2675 | reg_num_devs_support_basehint--; |
2595 | 2676 | ||
2596 | rcu_free_regdom(get_wiphy_regdom(wiphy)); | 2677 | rcu_free_regdom(get_wiphy_regdom(wiphy)); |
2597 | rcu_assign_pointer(wiphy->regd, NULL); | 2678 | RCU_INIT_POINTER(wiphy->regd, NULL); |
2598 | 2679 | ||
2599 | if (lr) | 2680 | if (lr) |
2600 | request_wiphy = wiphy_idx_to_wiphy(lr->wiphy_idx); | 2681 | request_wiphy = wiphy_idx_to_wiphy(lr->wiphy_idx); |
@@ -2614,6 +2695,40 @@ static void reg_timeout_work(struct work_struct *work) | |||
2614 | rtnl_unlock(); | 2695 | rtnl_unlock(); |
2615 | } | 2696 | } |
2616 | 2697 | ||
2698 | /* | ||
2699 | * See http://www.fcc.gov/document/5-ghz-unlicensed-spectrum-unii, for | ||
2700 | * UNII band definitions | ||
2701 | */ | ||
2702 | int cfg80211_get_unii(int freq) | ||
2703 | { | ||
2704 | /* UNII-1 */ | ||
2705 | if (freq >= 5150 && freq <= 5250) | ||
2706 | return 0; | ||
2707 | |||
2708 | /* UNII-2A */ | ||
2709 | if (freq > 5250 && freq <= 5350) | ||
2710 | return 1; | ||
2711 | |||
2712 | /* UNII-2B */ | ||
2713 | if (freq > 5350 && freq <= 5470) | ||
2714 | return 2; | ||
2715 | |||
2716 | /* UNII-2C */ | ||
2717 | if (freq > 5470 && freq <= 5725) | ||
2718 | return 3; | ||
2719 | |||
2720 | /* UNII-3 */ | ||
2721 | if (freq > 5725 && freq <= 5825) | ||
2722 | return 4; | ||
2723 | |||
2724 | return -EINVAL; | ||
2725 | } | ||
2726 | |||
2727 | bool regulatory_indoor_allowed(void) | ||
2728 | { | ||
2729 | return reg_is_indoor; | ||
2730 | } | ||
2731 | |||
2617 | int __init regulatory_init(void) | 2732 | int __init regulatory_init(void) |
2618 | { | 2733 | { |
2619 | int err = 0; | 2734 | int err = 0; |
diff --git a/net/wireless/reg.h b/net/wireless/reg.h index 37c180df34b7..5e48031ccb9a 100644 --- a/net/wireless/reg.h +++ b/net/wireless/reg.h | |||
@@ -25,6 +25,7 @@ enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy); | |||
25 | 25 | ||
26 | int regulatory_hint_user(const char *alpha2, | 26 | int regulatory_hint_user(const char *alpha2, |
27 | enum nl80211_user_reg_hint_type user_reg_hint_type); | 27 | enum nl80211_user_reg_hint_type user_reg_hint_type); |
28 | int regulatory_hint_indoor_user(void); | ||
28 | 29 | ||
29 | void wiphy_regulatory_register(struct wiphy *wiphy); | 30 | void wiphy_regulatory_register(struct wiphy *wiphy); |
30 | void wiphy_regulatory_deregister(struct wiphy *wiphy); | 31 | void wiphy_regulatory_deregister(struct wiphy *wiphy); |
@@ -104,4 +105,21 @@ void regulatory_hint_country_ie(struct wiphy *wiphy, | |||
104 | */ | 105 | */ |
105 | void regulatory_hint_disconnect(void); | 106 | void regulatory_hint_disconnect(void); |
106 | 107 | ||
108 | /** | ||
109 | * cfg80211_get_unii - get the U-NII band for the frequency | ||
110 | * @freq: the frequency for which we want to get the UNII band. | ||
111 | |||
112 | * Get a value specifying the U-NII band frequency belongs to. | ||
113 | * U-NII bands are defined by the FCC in C.F.R 47 part 15. | ||
114 | * | ||
115 | * Returns -EINVAL if freq is invalid, 0 for UNII-1, 1 for UNII-2A, | ||
116 | * 2 for UNII-2B, 3 for UNII-2C and 4 for UNII-3. | ||
117 | */ | ||
118 | int cfg80211_get_unii(int freq); | ||
119 | |||
120 | /** | ||
121 | * regulatory_indoor_allowed - is indoor operation allowed | ||
122 | */ | ||
123 | bool regulatory_indoor_allowed(void); | ||
124 | |||
107 | #endif /* __NET_WIRELESS_REG_H */ | 125 | #endif /* __NET_WIRELESS_REG_H */ |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 7d09a712cb1f..e7329bb6a323 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -81,10 +81,10 @@ static void bss_free(struct cfg80211_internal_bss *bss) | |||
81 | kfree(bss); | 81 | kfree(bss); |
82 | } | 82 | } |
83 | 83 | ||
84 | static inline void bss_ref_get(struct cfg80211_registered_device *dev, | 84 | static inline void bss_ref_get(struct cfg80211_registered_device *rdev, |
85 | struct cfg80211_internal_bss *bss) | 85 | struct cfg80211_internal_bss *bss) |
86 | { | 86 | { |
87 | lockdep_assert_held(&dev->bss_lock); | 87 | lockdep_assert_held(&rdev->bss_lock); |
88 | 88 | ||
89 | bss->refcount++; | 89 | bss->refcount++; |
90 | if (bss->pub.hidden_beacon_bss) { | 90 | if (bss->pub.hidden_beacon_bss) { |
@@ -95,10 +95,10 @@ static inline void bss_ref_get(struct cfg80211_registered_device *dev, | |||
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | static inline void bss_ref_put(struct cfg80211_registered_device *dev, | 98 | static inline void bss_ref_put(struct cfg80211_registered_device *rdev, |
99 | struct cfg80211_internal_bss *bss) | 99 | struct cfg80211_internal_bss *bss) |
100 | { | 100 | { |
101 | lockdep_assert_held(&dev->bss_lock); | 101 | lockdep_assert_held(&rdev->bss_lock); |
102 | 102 | ||
103 | if (bss->pub.hidden_beacon_bss) { | 103 | if (bss->pub.hidden_beacon_bss) { |
104 | struct cfg80211_internal_bss *hbss; | 104 | struct cfg80211_internal_bss *hbss; |
@@ -114,10 +114,10 @@ static inline void bss_ref_put(struct cfg80211_registered_device *dev, | |||
114 | bss_free(bss); | 114 | bss_free(bss); |
115 | } | 115 | } |
116 | 116 | ||
117 | static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, | 117 | static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *rdev, |
118 | struct cfg80211_internal_bss *bss) | 118 | struct cfg80211_internal_bss *bss) |
119 | { | 119 | { |
120 | lockdep_assert_held(&dev->bss_lock); | 120 | lockdep_assert_held(&rdev->bss_lock); |
121 | 121 | ||
122 | if (!list_empty(&bss->hidden_list)) { | 122 | if (!list_empty(&bss->hidden_list)) { |
123 | /* | 123 | /* |
@@ -134,31 +134,31 @@ static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, | |||
134 | } | 134 | } |
135 | 135 | ||
136 | list_del_init(&bss->list); | 136 | list_del_init(&bss->list); |
137 | rb_erase(&bss->rbn, &dev->bss_tree); | 137 | rb_erase(&bss->rbn, &rdev->bss_tree); |
138 | bss_ref_put(dev, bss); | 138 | bss_ref_put(rdev, bss); |
139 | return true; | 139 | return true; |
140 | } | 140 | } |
141 | 141 | ||
142 | static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev, | 142 | static void __cfg80211_bss_expire(struct cfg80211_registered_device *rdev, |
143 | unsigned long expire_time) | 143 | unsigned long expire_time) |
144 | { | 144 | { |
145 | struct cfg80211_internal_bss *bss, *tmp; | 145 | struct cfg80211_internal_bss *bss, *tmp; |
146 | bool expired = false; | 146 | bool expired = false; |
147 | 147 | ||
148 | lockdep_assert_held(&dev->bss_lock); | 148 | lockdep_assert_held(&rdev->bss_lock); |
149 | 149 | ||
150 | list_for_each_entry_safe(bss, tmp, &dev->bss_list, list) { | 150 | list_for_each_entry_safe(bss, tmp, &rdev->bss_list, list) { |
151 | if (atomic_read(&bss->hold)) | 151 | if (atomic_read(&bss->hold)) |
152 | continue; | 152 | continue; |
153 | if (!time_after(expire_time, bss->ts)) | 153 | if (!time_after(expire_time, bss->ts)) |
154 | continue; | 154 | continue; |
155 | 155 | ||
156 | if (__cfg80211_unlink_bss(dev, bss)) | 156 | if (__cfg80211_unlink_bss(rdev, bss)) |
157 | expired = true; | 157 | expired = true; |
158 | } | 158 | } |
159 | 159 | ||
160 | if (expired) | 160 | if (expired) |
161 | dev->bss_generation++; | 161 | rdev->bss_generation++; |
162 | } | 162 | } |
163 | 163 | ||
164 | void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, | 164 | void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, |
@@ -238,11 +238,11 @@ void __cfg80211_scan_done(struct work_struct *wk) | |||
238 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) | 238 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) |
239 | { | 239 | { |
240 | trace_cfg80211_scan_done(request, aborted); | 240 | trace_cfg80211_scan_done(request, aborted); |
241 | WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); | 241 | WARN_ON(request != wiphy_to_rdev(request->wiphy)->scan_req); |
242 | 242 | ||
243 | request->aborted = aborted; | 243 | request->aborted = aborted; |
244 | request->notified = true; | 244 | request->notified = true; |
245 | queue_work(cfg80211_wq, &wiphy_to_dev(request->wiphy)->scan_done_wk); | 245 | queue_work(cfg80211_wq, &wiphy_to_rdev(request->wiphy)->scan_done_wk); |
246 | } | 246 | } |
247 | EXPORT_SYMBOL(cfg80211_scan_done); | 247 | EXPORT_SYMBOL(cfg80211_scan_done); |
248 | 248 | ||
@@ -278,20 +278,28 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy) | |||
278 | { | 278 | { |
279 | trace_cfg80211_sched_scan_results(wiphy); | 279 | trace_cfg80211_sched_scan_results(wiphy); |
280 | /* ignore if we're not scanning */ | 280 | /* ignore if we're not scanning */ |
281 | if (wiphy_to_dev(wiphy)->sched_scan_req) | 281 | if (wiphy_to_rdev(wiphy)->sched_scan_req) |
282 | queue_work(cfg80211_wq, | 282 | queue_work(cfg80211_wq, |
283 | &wiphy_to_dev(wiphy)->sched_scan_results_wk); | 283 | &wiphy_to_rdev(wiphy)->sched_scan_results_wk); |
284 | } | 284 | } |
285 | EXPORT_SYMBOL(cfg80211_sched_scan_results); | 285 | EXPORT_SYMBOL(cfg80211_sched_scan_results); |
286 | 286 | ||
287 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy) | 287 | void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy) |
288 | { | 288 | { |
289 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 289 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
290 | |||
291 | ASSERT_RTNL(); | ||
290 | 292 | ||
291 | trace_cfg80211_sched_scan_stopped(wiphy); | 293 | trace_cfg80211_sched_scan_stopped(wiphy); |
292 | 294 | ||
293 | rtnl_lock(); | ||
294 | __cfg80211_stop_sched_scan(rdev, true); | 295 | __cfg80211_stop_sched_scan(rdev, true); |
296 | } | ||
297 | EXPORT_SYMBOL(cfg80211_sched_scan_stopped_rtnl); | ||
298 | |||
299 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy) | ||
300 | { | ||
301 | rtnl_lock(); | ||
302 | cfg80211_sched_scan_stopped_rtnl(wiphy); | ||
295 | rtnl_unlock(); | 303 | rtnl_unlock(); |
296 | } | 304 | } |
297 | EXPORT_SYMBOL(cfg80211_sched_scan_stopped); | 305 | EXPORT_SYMBOL(cfg80211_sched_scan_stopped); |
@@ -322,21 +330,21 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, | |||
322 | return 0; | 330 | return 0; |
323 | } | 331 | } |
324 | 332 | ||
325 | void cfg80211_bss_age(struct cfg80211_registered_device *dev, | 333 | void cfg80211_bss_age(struct cfg80211_registered_device *rdev, |
326 | unsigned long age_secs) | 334 | unsigned long age_secs) |
327 | { | 335 | { |
328 | struct cfg80211_internal_bss *bss; | 336 | struct cfg80211_internal_bss *bss; |
329 | unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC); | 337 | unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC); |
330 | 338 | ||
331 | spin_lock_bh(&dev->bss_lock); | 339 | spin_lock_bh(&rdev->bss_lock); |
332 | list_for_each_entry(bss, &dev->bss_list, list) | 340 | list_for_each_entry(bss, &rdev->bss_list, list) |
333 | bss->ts -= age_jiffies; | 341 | bss->ts -= age_jiffies; |
334 | spin_unlock_bh(&dev->bss_lock); | 342 | spin_unlock_bh(&rdev->bss_lock); |
335 | } | 343 | } |
336 | 344 | ||
337 | void cfg80211_bss_expire(struct cfg80211_registered_device *dev) | 345 | void cfg80211_bss_expire(struct cfg80211_registered_device *rdev) |
338 | { | 346 | { |
339 | __cfg80211_bss_expire(dev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE); | 347 | __cfg80211_bss_expire(rdev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE); |
340 | } | 348 | } |
341 | 349 | ||
342 | const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) | 350 | const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) |
@@ -526,32 +534,34 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | |||
526 | const u8 *ssid, size_t ssid_len, | 534 | const u8 *ssid, size_t ssid_len, |
527 | u16 capa_mask, u16 capa_val) | 535 | u16 capa_mask, u16 capa_val) |
528 | { | 536 | { |
529 | struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); | 537 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
530 | struct cfg80211_internal_bss *bss, *res = NULL; | 538 | struct cfg80211_internal_bss *bss, *res = NULL; |
531 | unsigned long now = jiffies; | 539 | unsigned long now = jiffies; |
532 | 540 | ||
533 | trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask, | 541 | trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask, |
534 | capa_val); | 542 | capa_val); |
535 | 543 | ||
536 | spin_lock_bh(&dev->bss_lock); | 544 | spin_lock_bh(&rdev->bss_lock); |
537 | 545 | ||
538 | list_for_each_entry(bss, &dev->bss_list, list) { | 546 | list_for_each_entry(bss, &rdev->bss_list, list) { |
539 | if ((bss->pub.capability & capa_mask) != capa_val) | 547 | if ((bss->pub.capability & capa_mask) != capa_val) |
540 | continue; | 548 | continue; |
541 | if (channel && bss->pub.channel != channel) | 549 | if (channel && bss->pub.channel != channel) |
542 | continue; | 550 | continue; |
551 | if (!is_valid_ether_addr(bss->pub.bssid)) | ||
552 | continue; | ||
543 | /* Don't get expired BSS structs */ | 553 | /* Don't get expired BSS structs */ |
544 | if (time_after(now, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE) && | 554 | if (time_after(now, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE) && |
545 | !atomic_read(&bss->hold)) | 555 | !atomic_read(&bss->hold)) |
546 | continue; | 556 | continue; |
547 | if (is_bss(&bss->pub, bssid, ssid, ssid_len)) { | 557 | if (is_bss(&bss->pub, bssid, ssid, ssid_len)) { |
548 | res = bss; | 558 | res = bss; |
549 | bss_ref_get(dev, res); | 559 | bss_ref_get(rdev, res); |
550 | break; | 560 | break; |
551 | } | 561 | } |
552 | } | 562 | } |
553 | 563 | ||
554 | spin_unlock_bh(&dev->bss_lock); | 564 | spin_unlock_bh(&rdev->bss_lock); |
555 | if (!res) | 565 | if (!res) |
556 | return NULL; | 566 | return NULL; |
557 | trace_cfg80211_return_bss(&res->pub); | 567 | trace_cfg80211_return_bss(&res->pub); |
@@ -559,10 +569,10 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | |||
559 | } | 569 | } |
560 | EXPORT_SYMBOL(cfg80211_get_bss); | 570 | EXPORT_SYMBOL(cfg80211_get_bss); |
561 | 571 | ||
562 | static void rb_insert_bss(struct cfg80211_registered_device *dev, | 572 | static void rb_insert_bss(struct cfg80211_registered_device *rdev, |
563 | struct cfg80211_internal_bss *bss) | 573 | struct cfg80211_internal_bss *bss) |
564 | { | 574 | { |
565 | struct rb_node **p = &dev->bss_tree.rb_node; | 575 | struct rb_node **p = &rdev->bss_tree.rb_node; |
566 | struct rb_node *parent = NULL; | 576 | struct rb_node *parent = NULL; |
567 | struct cfg80211_internal_bss *tbss; | 577 | struct cfg80211_internal_bss *tbss; |
568 | int cmp; | 578 | int cmp; |
@@ -585,15 +595,15 @@ static void rb_insert_bss(struct cfg80211_registered_device *dev, | |||
585 | } | 595 | } |
586 | 596 | ||
587 | rb_link_node(&bss->rbn, parent, p); | 597 | rb_link_node(&bss->rbn, parent, p); |
588 | rb_insert_color(&bss->rbn, &dev->bss_tree); | 598 | rb_insert_color(&bss->rbn, &rdev->bss_tree); |
589 | } | 599 | } |
590 | 600 | ||
591 | static struct cfg80211_internal_bss * | 601 | static struct cfg80211_internal_bss * |
592 | rb_find_bss(struct cfg80211_registered_device *dev, | 602 | rb_find_bss(struct cfg80211_registered_device *rdev, |
593 | struct cfg80211_internal_bss *res, | 603 | struct cfg80211_internal_bss *res, |
594 | enum bss_compare_mode mode) | 604 | enum bss_compare_mode mode) |
595 | { | 605 | { |
596 | struct rb_node *n = dev->bss_tree.rb_node; | 606 | struct rb_node *n = rdev->bss_tree.rb_node; |
597 | struct cfg80211_internal_bss *bss; | 607 | struct cfg80211_internal_bss *bss; |
598 | int r; | 608 | int r; |
599 | 609 | ||
@@ -612,7 +622,7 @@ rb_find_bss(struct cfg80211_registered_device *dev, | |||
612 | return NULL; | 622 | return NULL; |
613 | } | 623 | } |
614 | 624 | ||
615 | static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, | 625 | static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev, |
616 | struct cfg80211_internal_bss *new) | 626 | struct cfg80211_internal_bss *new) |
617 | { | 627 | { |
618 | const struct cfg80211_bss_ies *ies; | 628 | const struct cfg80211_bss_ies *ies; |
@@ -642,7 +652,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, | |||
642 | 652 | ||
643 | /* This is the bad part ... */ | 653 | /* This is the bad part ... */ |
644 | 654 | ||
645 | list_for_each_entry(bss, &dev->bss_list, list) { | 655 | list_for_each_entry(bss, &rdev->bss_list, list) { |
646 | if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid)) | 656 | if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid)) |
647 | continue; | 657 | continue; |
648 | if (bss->pub.channel != new->pub.channel) | 658 | if (bss->pub.channel != new->pub.channel) |
@@ -676,7 +686,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, | |||
676 | 686 | ||
677 | /* Returned bss is reference counted and must be cleaned up appropriately. */ | 687 | /* Returned bss is reference counted and must be cleaned up appropriately. */ |
678 | static struct cfg80211_internal_bss * | 688 | static struct cfg80211_internal_bss * |
679 | cfg80211_bss_update(struct cfg80211_registered_device *dev, | 689 | cfg80211_bss_update(struct cfg80211_registered_device *rdev, |
680 | struct cfg80211_internal_bss *tmp, | 690 | struct cfg80211_internal_bss *tmp, |
681 | bool signal_valid) | 691 | bool signal_valid) |
682 | { | 692 | { |
@@ -687,14 +697,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
687 | 697 | ||
688 | tmp->ts = jiffies; | 698 | tmp->ts = jiffies; |
689 | 699 | ||
690 | spin_lock_bh(&dev->bss_lock); | 700 | spin_lock_bh(&rdev->bss_lock); |
691 | 701 | ||
692 | if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) { | 702 | if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) { |
693 | spin_unlock_bh(&dev->bss_lock); | 703 | spin_unlock_bh(&rdev->bss_lock); |
694 | return NULL; | 704 | return NULL; |
695 | } | 705 | } |
696 | 706 | ||
697 | found = rb_find_bss(dev, tmp, BSS_CMP_REGULAR); | 707 | found = rb_find_bss(rdev, tmp, BSS_CMP_REGULAR); |
698 | 708 | ||
699 | if (found) { | 709 | if (found) { |
700 | /* Update IEs */ | 710 | /* Update IEs */ |
@@ -781,7 +791,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
781 | * is allocated on the stack since it's not needed in the | 791 | * is allocated on the stack since it's not needed in the |
782 | * more common case of an update | 792 | * more common case of an update |
783 | */ | 793 | */ |
784 | new = kzalloc(sizeof(*new) + dev->wiphy.bss_priv_size, | 794 | new = kzalloc(sizeof(*new) + rdev->wiphy.bss_priv_size, |
785 | GFP_ATOMIC); | 795 | GFP_ATOMIC); |
786 | if (!new) { | 796 | if (!new) { |
787 | ies = (void *)rcu_dereference(tmp->pub.beacon_ies); | 797 | ies = (void *)rcu_dereference(tmp->pub.beacon_ies); |
@@ -797,9 +807,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
797 | INIT_LIST_HEAD(&new->hidden_list); | 807 | INIT_LIST_HEAD(&new->hidden_list); |
798 | 808 | ||
799 | if (rcu_access_pointer(tmp->pub.proberesp_ies)) { | 809 | if (rcu_access_pointer(tmp->pub.proberesp_ies)) { |
800 | hidden = rb_find_bss(dev, tmp, BSS_CMP_HIDE_ZLEN); | 810 | hidden = rb_find_bss(rdev, tmp, BSS_CMP_HIDE_ZLEN); |
801 | if (!hidden) | 811 | if (!hidden) |
802 | hidden = rb_find_bss(dev, tmp, | 812 | hidden = rb_find_bss(rdev, tmp, |
803 | BSS_CMP_HIDE_NUL); | 813 | BSS_CMP_HIDE_NUL); |
804 | if (hidden) { | 814 | if (hidden) { |
805 | new->pub.hidden_beacon_bss = &hidden->pub; | 815 | new->pub.hidden_beacon_bss = &hidden->pub; |
@@ -816,24 +826,24 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
816 | * expensive search for any probe responses that should | 826 | * expensive search for any probe responses that should |
817 | * be grouped with this beacon for updates ... | 827 | * be grouped with this beacon for updates ... |
818 | */ | 828 | */ |
819 | if (!cfg80211_combine_bsses(dev, new)) { | 829 | if (!cfg80211_combine_bsses(rdev, new)) { |
820 | kfree(new); | 830 | kfree(new); |
821 | goto drop; | 831 | goto drop; |
822 | } | 832 | } |
823 | } | 833 | } |
824 | 834 | ||
825 | list_add_tail(&new->list, &dev->bss_list); | 835 | list_add_tail(&new->list, &rdev->bss_list); |
826 | rb_insert_bss(dev, new); | 836 | rb_insert_bss(rdev, new); |
827 | found = new; | 837 | found = new; |
828 | } | 838 | } |
829 | 839 | ||
830 | dev->bss_generation++; | 840 | rdev->bss_generation++; |
831 | bss_ref_get(dev, found); | 841 | bss_ref_get(rdev, found); |
832 | spin_unlock_bh(&dev->bss_lock); | 842 | spin_unlock_bh(&rdev->bss_lock); |
833 | 843 | ||
834 | return found; | 844 | return found; |
835 | drop: | 845 | drop: |
836 | spin_unlock_bh(&dev->bss_lock); | 846 | spin_unlock_bh(&rdev->bss_lock); |
837 | return NULL; | 847 | return NULL; |
838 | } | 848 | } |
839 | 849 | ||
@@ -917,7 +927,7 @@ cfg80211_inform_bss_width(struct wiphy *wiphy, | |||
917 | rcu_assign_pointer(tmp.pub.beacon_ies, ies); | 927 | rcu_assign_pointer(tmp.pub.beacon_ies, ies); |
918 | rcu_assign_pointer(tmp.pub.ies, ies); | 928 | rcu_assign_pointer(tmp.pub.ies, ies); |
919 | 929 | ||
920 | res = cfg80211_bss_update(wiphy_to_dev(wiphy), &tmp, | 930 | res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, |
921 | rx_channel == channel); | 931 | rx_channel == channel); |
922 | if (!res) | 932 | if (!res) |
923 | return NULL; | 933 | return NULL; |
@@ -989,7 +999,7 @@ cfg80211_inform_bss_width_frame(struct wiphy *wiphy, | |||
989 | tmp.pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); | 999 | tmp.pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); |
990 | tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); | 1000 | tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); |
991 | 1001 | ||
992 | res = cfg80211_bss_update(wiphy_to_dev(wiphy), &tmp, | 1002 | res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, |
993 | rx_channel == channel); | 1003 | rx_channel == channel); |
994 | if (!res) | 1004 | if (!res) |
995 | return NULL; | 1005 | return NULL; |
@@ -1005,7 +1015,7 @@ EXPORT_SYMBOL(cfg80211_inform_bss_width_frame); | |||
1005 | 1015 | ||
1006 | void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | 1016 | void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) |
1007 | { | 1017 | { |
1008 | struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); | 1018 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
1009 | struct cfg80211_internal_bss *bss; | 1019 | struct cfg80211_internal_bss *bss; |
1010 | 1020 | ||
1011 | if (!pub) | 1021 | if (!pub) |
@@ -1013,15 +1023,15 @@ void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | |||
1013 | 1023 | ||
1014 | bss = container_of(pub, struct cfg80211_internal_bss, pub); | 1024 | bss = container_of(pub, struct cfg80211_internal_bss, pub); |
1015 | 1025 | ||
1016 | spin_lock_bh(&dev->bss_lock); | 1026 | spin_lock_bh(&rdev->bss_lock); |
1017 | bss_ref_get(dev, bss); | 1027 | bss_ref_get(rdev, bss); |
1018 | spin_unlock_bh(&dev->bss_lock); | 1028 | spin_unlock_bh(&rdev->bss_lock); |
1019 | } | 1029 | } |
1020 | EXPORT_SYMBOL(cfg80211_ref_bss); | 1030 | EXPORT_SYMBOL(cfg80211_ref_bss); |
1021 | 1031 | ||
1022 | void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | 1032 | void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) |
1023 | { | 1033 | { |
1024 | struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); | 1034 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
1025 | struct cfg80211_internal_bss *bss; | 1035 | struct cfg80211_internal_bss *bss; |
1026 | 1036 | ||
1027 | if (!pub) | 1037 | if (!pub) |
@@ -1029,15 +1039,15 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | |||
1029 | 1039 | ||
1030 | bss = container_of(pub, struct cfg80211_internal_bss, pub); | 1040 | bss = container_of(pub, struct cfg80211_internal_bss, pub); |
1031 | 1041 | ||
1032 | spin_lock_bh(&dev->bss_lock); | 1042 | spin_lock_bh(&rdev->bss_lock); |
1033 | bss_ref_put(dev, bss); | 1043 | bss_ref_put(rdev, bss); |
1034 | spin_unlock_bh(&dev->bss_lock); | 1044 | spin_unlock_bh(&rdev->bss_lock); |
1035 | } | 1045 | } |
1036 | EXPORT_SYMBOL(cfg80211_put_bss); | 1046 | EXPORT_SYMBOL(cfg80211_put_bss); |
1037 | 1047 | ||
1038 | void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | 1048 | void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) |
1039 | { | 1049 | { |
1040 | struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); | 1050 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
1041 | struct cfg80211_internal_bss *bss; | 1051 | struct cfg80211_internal_bss *bss; |
1042 | 1052 | ||
1043 | if (WARN_ON(!pub)) | 1053 | if (WARN_ON(!pub)) |
@@ -1045,12 +1055,12 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | |||
1045 | 1055 | ||
1046 | bss = container_of(pub, struct cfg80211_internal_bss, pub); | 1056 | bss = container_of(pub, struct cfg80211_internal_bss, pub); |
1047 | 1057 | ||
1048 | spin_lock_bh(&dev->bss_lock); | 1058 | spin_lock_bh(&rdev->bss_lock); |
1049 | if (!list_empty(&bss->list)) { | 1059 | if (!list_empty(&bss->list)) { |
1050 | if (__cfg80211_unlink_bss(dev, bss)) | 1060 | if (__cfg80211_unlink_bss(rdev, bss)) |
1051 | dev->bss_generation++; | 1061 | rdev->bss_generation++; |
1052 | } | 1062 | } |
1053 | spin_unlock_bh(&dev->bss_lock); | 1063 | spin_unlock_bh(&rdev->bss_lock); |
1054 | } | 1064 | } |
1055 | EXPORT_SYMBOL(cfg80211_unlink_bss); | 1065 | EXPORT_SYMBOL(cfg80211_unlink_bss); |
1056 | 1066 | ||
@@ -1067,7 +1077,7 @@ cfg80211_get_dev_from_ifindex(struct net *net, int ifindex) | |||
1067 | if (!dev) | 1077 | if (!dev) |
1068 | return ERR_PTR(-ENODEV); | 1078 | return ERR_PTR(-ENODEV); |
1069 | if (dev->ieee80211_ptr) | 1079 | if (dev->ieee80211_ptr) |
1070 | rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy); | 1080 | rdev = wiphy_to_rdev(dev->ieee80211_ptr->wiphy); |
1071 | else | 1081 | else |
1072 | rdev = ERR_PTR(-ENODEV); | 1082 | rdev = ERR_PTR(-ENODEV); |
1073 | dev_put(dev); | 1083 | dev_put(dev); |
@@ -1147,7 +1157,11 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
1147 | int k; | 1157 | int k; |
1148 | int wiphy_freq = wiphy->bands[band]->channels[j].center_freq; | 1158 | int wiphy_freq = wiphy->bands[band]->channels[j].center_freq; |
1149 | for (k = 0; k < wreq->num_channels; k++) { | 1159 | for (k = 0; k < wreq->num_channels; k++) { |
1150 | int wext_freq = cfg80211_wext_freq(wiphy, &wreq->channel_list[k]); | 1160 | struct iw_freq *freq = |
1161 | &wreq->channel_list[k]; | ||
1162 | int wext_freq = | ||
1163 | cfg80211_wext_freq(freq); | ||
1164 | |||
1151 | if (wext_freq == wiphy_freq) | 1165 | if (wext_freq == wiphy_freq) |
1152 | goto wext_freq_found; | 1166 | goto wext_freq_found; |
1153 | } | 1167 | } |
@@ -1459,7 +1473,7 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info, | |||
1459 | } | 1473 | } |
1460 | 1474 | ||
1461 | 1475 | ||
1462 | static int ieee80211_scan_results(struct cfg80211_registered_device *dev, | 1476 | static int ieee80211_scan_results(struct cfg80211_registered_device *rdev, |
1463 | struct iw_request_info *info, | 1477 | struct iw_request_info *info, |
1464 | char *buf, size_t len) | 1478 | char *buf, size_t len) |
1465 | { | 1479 | { |
@@ -1467,18 +1481,18 @@ static int ieee80211_scan_results(struct cfg80211_registered_device *dev, | |||
1467 | char *end_buf = buf + len; | 1481 | char *end_buf = buf + len; |
1468 | struct cfg80211_internal_bss *bss; | 1482 | struct cfg80211_internal_bss *bss; |
1469 | 1483 | ||
1470 | spin_lock_bh(&dev->bss_lock); | 1484 | spin_lock_bh(&rdev->bss_lock); |
1471 | cfg80211_bss_expire(dev); | 1485 | cfg80211_bss_expire(rdev); |
1472 | 1486 | ||
1473 | list_for_each_entry(bss, &dev->bss_list, list) { | 1487 | list_for_each_entry(bss, &rdev->bss_list, list) { |
1474 | if (buf + len - current_ev <= IW_EV_ADDR_LEN) { | 1488 | if (buf + len - current_ev <= IW_EV_ADDR_LEN) { |
1475 | spin_unlock_bh(&dev->bss_lock); | 1489 | spin_unlock_bh(&rdev->bss_lock); |
1476 | return -E2BIG; | 1490 | return -E2BIG; |
1477 | } | 1491 | } |
1478 | current_ev = ieee80211_bss(&dev->wiphy, info, bss, | 1492 | current_ev = ieee80211_bss(&rdev->wiphy, info, bss, |
1479 | current_ev, end_buf); | 1493 | current_ev, end_buf); |
1480 | } | 1494 | } |
1481 | spin_unlock_bh(&dev->bss_lock); | 1495 | spin_unlock_bh(&rdev->bss_lock); |
1482 | return current_ev - buf; | 1496 | return current_ev - buf; |
1483 | } | 1497 | } |
1484 | 1498 | ||
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index acdcb4a81817..0c0844b585d1 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -59,7 +59,7 @@ static void cfg80211_sme_free(struct wireless_dev *wdev) | |||
59 | 59 | ||
60 | static int cfg80211_conn_scan(struct wireless_dev *wdev) | 60 | static int cfg80211_conn_scan(struct wireless_dev *wdev) |
61 | { | 61 | { |
62 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 62 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
63 | struct cfg80211_scan_request *request; | 63 | struct cfg80211_scan_request *request; |
64 | int n_channels, err; | 64 | int n_channels, err; |
65 | 65 | ||
@@ -130,7 +130,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev) | |||
130 | 130 | ||
131 | static int cfg80211_conn_do_work(struct wireless_dev *wdev) | 131 | static int cfg80211_conn_do_work(struct wireless_dev *wdev) |
132 | { | 132 | { |
133 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 133 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
134 | struct cfg80211_connect_params *params; | 134 | struct cfg80211_connect_params *params; |
135 | struct cfg80211_assoc_request req = {}; | 135 | struct cfg80211_assoc_request req = {}; |
136 | int err; | 136 | int err; |
@@ -234,7 +234,6 @@ void cfg80211_conn_work(struct work_struct *work) | |||
234 | NULL, 0, NULL, 0, | 234 | NULL, 0, NULL, 0, |
235 | WLAN_STATUS_UNSPECIFIED_FAILURE, | 235 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
236 | false, NULL); | 236 | false, NULL); |
237 | cfg80211_sme_free(wdev); | ||
238 | } | 237 | } |
239 | wdev_unlock(wdev); | 238 | wdev_unlock(wdev); |
240 | } | 239 | } |
@@ -245,7 +244,7 @@ void cfg80211_conn_work(struct work_struct *work) | |||
245 | /* Returned bss is reference counted and must be cleaned up appropriately. */ | 244 | /* Returned bss is reference counted and must be cleaned up appropriately. */ |
246 | static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev) | 245 | static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev) |
247 | { | 246 | { |
248 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 247 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
249 | struct cfg80211_bss *bss; | 248 | struct cfg80211_bss *bss; |
250 | u16 capa = WLAN_CAPABILITY_ESS; | 249 | u16 capa = WLAN_CAPABILITY_ESS; |
251 | 250 | ||
@@ -275,7 +274,7 @@ static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev) | |||
275 | static void __cfg80211_sme_scan_done(struct net_device *dev) | 274 | static void __cfg80211_sme_scan_done(struct net_device *dev) |
276 | { | 275 | { |
277 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 276 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
278 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 277 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
279 | struct cfg80211_bss *bss; | 278 | struct cfg80211_bss *bss; |
280 | 279 | ||
281 | ASSERT_WDEV_LOCK(wdev); | 280 | ASSERT_WDEV_LOCK(wdev); |
@@ -306,7 +305,7 @@ void cfg80211_sme_scan_done(struct net_device *dev) | |||
306 | void cfg80211_sme_rx_auth(struct wireless_dev *wdev, const u8 *buf, size_t len) | 305 | void cfg80211_sme_rx_auth(struct wireless_dev *wdev, const u8 *buf, size_t len) |
307 | { | 306 | { |
308 | struct wiphy *wiphy = wdev->wiphy; | 307 | struct wiphy *wiphy = wdev->wiphy; |
309 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 308 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
310 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; | 309 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; |
311 | u16 status_code = le16_to_cpu(mgmt->u.auth.status_code); | 310 | u16 status_code = le16_to_cpu(mgmt->u.auth.status_code); |
312 | 311 | ||
@@ -352,7 +351,7 @@ void cfg80211_sme_rx_auth(struct wireless_dev *wdev, const u8 *buf, size_t len) | |||
352 | 351 | ||
353 | bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status) | 352 | bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status) |
354 | { | 353 | { |
355 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 354 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
356 | 355 | ||
357 | if (!wdev->conn) | 356 | if (!wdev->conn) |
358 | return false; | 357 | return false; |
@@ -386,7 +385,7 @@ void cfg80211_sme_deauth(struct wireless_dev *wdev) | |||
386 | 385 | ||
387 | void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) | 386 | void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) |
388 | { | 387 | { |
389 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 388 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
390 | 389 | ||
391 | if (!wdev->conn) | 390 | if (!wdev->conn) |
392 | return; | 391 | return; |
@@ -397,7 +396,7 @@ void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) | |||
397 | 396 | ||
398 | void cfg80211_sme_disassoc(struct wireless_dev *wdev) | 397 | void cfg80211_sme_disassoc(struct wireless_dev *wdev) |
399 | { | 398 | { |
400 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 399 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
401 | 400 | ||
402 | if (!wdev->conn) | 401 | if (!wdev->conn) |
403 | return; | 402 | return; |
@@ -408,7 +407,7 @@ void cfg80211_sme_disassoc(struct wireless_dev *wdev) | |||
408 | 407 | ||
409 | void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev) | 408 | void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev) |
410 | { | 409 | { |
411 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 410 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
412 | 411 | ||
413 | if (!wdev->conn) | 412 | if (!wdev->conn) |
414 | return; | 413 | return; |
@@ -421,7 +420,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, | |||
421 | struct cfg80211_connect_params *connect, | 420 | struct cfg80211_connect_params *connect, |
422 | const u8 *prev_bssid) | 421 | const u8 *prev_bssid) |
423 | { | 422 | { |
424 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 423 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
425 | struct cfg80211_bss *bss; | 424 | struct cfg80211_bss *bss; |
426 | int err; | 425 | int err; |
427 | 426 | ||
@@ -468,7 +467,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, | |||
468 | } | 467 | } |
469 | 468 | ||
470 | wdev->conn->params.ssid = wdev->ssid; | 469 | wdev->conn->params.ssid = wdev->ssid; |
471 | wdev->conn->params.ssid_len = connect->ssid_len; | 470 | wdev->conn->params.ssid_len = wdev->ssid_len; |
472 | 471 | ||
473 | /* see if we have the bss already */ | 472 | /* see if we have the bss already */ |
474 | bss = cfg80211_get_conn_bss(wdev); | 473 | bss = cfg80211_get_conn_bss(wdev); |
@@ -480,7 +479,6 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, | |||
480 | 479 | ||
481 | /* we're good if we have a matching bss struct */ | 480 | /* we're good if we have a matching bss struct */ |
482 | if (bss) { | 481 | if (bss) { |
483 | wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT; | ||
484 | err = cfg80211_conn_do_work(wdev); | 482 | err = cfg80211_conn_do_work(wdev); |
485 | cfg80211_put_bss(wdev->wiphy, bss); | 483 | cfg80211_put_bss(wdev->wiphy, bss); |
486 | } else { | 484 | } else { |
@@ -506,7 +504,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, | |||
506 | 504 | ||
507 | static int cfg80211_sme_disconnect(struct wireless_dev *wdev, u16 reason) | 505 | static int cfg80211_sme_disconnect(struct wireless_dev *wdev, u16 reason) |
508 | { | 506 | { |
509 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 507 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
510 | int err; | 508 | int err; |
511 | 509 | ||
512 | if (!wdev->conn) | 510 | if (!wdev->conn) |
@@ -594,7 +592,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
594 | return; | 592 | return; |
595 | } | 593 | } |
596 | 594 | ||
597 | nl80211_send_connect_result(wiphy_to_dev(wdev->wiphy), dev, | 595 | nl80211_send_connect_result(wiphy_to_rdev(wdev->wiphy), dev, |
598 | bssid, req_ie, req_ie_len, | 596 | bssid, req_ie, req_ie_len, |
599 | resp_ie, resp_ie_len, | 597 | resp_ie, resp_ie_len, |
600 | status, GFP_KERNEL); | 598 | status, GFP_KERNEL); |
@@ -625,7 +623,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
625 | #endif | 623 | #endif |
626 | 624 | ||
627 | if (!bss && (status == WLAN_STATUS_SUCCESS)) { | 625 | if (!bss && (status == WLAN_STATUS_SUCCESS)) { |
628 | WARN_ON_ONCE(!wiphy_to_dev(wdev->wiphy)->ops->connect); | 626 | WARN_ON_ONCE(!wiphy_to_rdev(wdev->wiphy)->ops->connect); |
629 | bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, | 627 | bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, |
630 | wdev->ssid, wdev->ssid_len, | 628 | wdev->ssid, wdev->ssid_len, |
631 | WLAN_CAPABILITY_ESS, | 629 | WLAN_CAPABILITY_ESS, |
@@ -648,6 +646,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
648 | cfg80211_unhold_bss(bss_from_pub(bss)); | 646 | cfg80211_unhold_bss(bss_from_pub(bss)); |
649 | cfg80211_put_bss(wdev->wiphy, bss); | 647 | cfg80211_put_bss(wdev->wiphy, bss); |
650 | } | 648 | } |
649 | cfg80211_sme_free(wdev); | ||
651 | return; | 650 | return; |
652 | } | 651 | } |
653 | 652 | ||
@@ -687,7 +686,7 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
687 | u16 status, gfp_t gfp) | 686 | u16 status, gfp_t gfp) |
688 | { | 687 | { |
689 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 688 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
690 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 689 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
691 | struct cfg80211_event *ev; | 690 | struct cfg80211_event *ev; |
692 | unsigned long flags; | 691 | unsigned long flags; |
693 | 692 | ||
@@ -742,7 +741,8 @@ void __cfg80211_roamed(struct wireless_dev *wdev, | |||
742 | cfg80211_hold_bss(bss_from_pub(bss)); | 741 | cfg80211_hold_bss(bss_from_pub(bss)); |
743 | wdev->current_bss = bss_from_pub(bss); | 742 | wdev->current_bss = bss_from_pub(bss); |
744 | 743 | ||
745 | nl80211_send_roamed(wiphy_to_dev(wdev->wiphy), wdev->netdev, bss->bssid, | 744 | nl80211_send_roamed(wiphy_to_rdev(wdev->wiphy), |
745 | wdev->netdev, bss->bssid, | ||
746 | req_ie, req_ie_len, resp_ie, resp_ie_len, | 746 | req_ie, req_ie_len, resp_ie, resp_ie_len, |
747 | GFP_KERNEL); | 747 | GFP_KERNEL); |
748 | 748 | ||
@@ -801,7 +801,7 @@ void cfg80211_roamed_bss(struct net_device *dev, | |||
801 | size_t resp_ie_len, gfp_t gfp) | 801 | size_t resp_ie_len, gfp_t gfp) |
802 | { | 802 | { |
803 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 803 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
804 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 804 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
805 | struct cfg80211_event *ev; | 805 | struct cfg80211_event *ev; |
806 | unsigned long flags; | 806 | unsigned long flags; |
807 | 807 | ||
@@ -834,7 +834,7 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, | |||
834 | size_t ie_len, u16 reason, bool from_ap) | 834 | size_t ie_len, u16 reason, bool from_ap) |
835 | { | 835 | { |
836 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 836 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
837 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 837 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
838 | int i; | 838 | int i; |
839 | #ifdef CONFIG_CFG80211_WEXT | 839 | #ifdef CONFIG_CFG80211_WEXT |
840 | union iwreq_data wrqu; | 840 | union iwreq_data wrqu; |
@@ -880,7 +880,7 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason, | |||
880 | u8 *ie, size_t ie_len, gfp_t gfp) | 880 | u8 *ie, size_t ie_len, gfp_t gfp) |
881 | { | 881 | { |
882 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 882 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
883 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 883 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
884 | struct cfg80211_event *ev; | 884 | struct cfg80211_event *ev; |
885 | unsigned long flags; | 885 | unsigned long flags; |
886 | 886 | ||
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index aabccf13e07b..f3c13ff4d04c 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -1919,6 +1919,24 @@ TRACE_EVENT(rdev_set_qos_map, | |||
1919 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->num_des) | 1919 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->num_des) |
1920 | ); | 1920 | ); |
1921 | 1921 | ||
1922 | TRACE_EVENT(rdev_set_ap_chanwidth, | ||
1923 | TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, | ||
1924 | struct cfg80211_chan_def *chandef), | ||
1925 | TP_ARGS(wiphy, netdev, chandef), | ||
1926 | TP_STRUCT__entry( | ||
1927 | WIPHY_ENTRY | ||
1928 | NETDEV_ENTRY | ||
1929 | CHAN_DEF_ENTRY | ||
1930 | ), | ||
1931 | TP_fast_assign( | ||
1932 | WIPHY_ASSIGN; | ||
1933 | NETDEV_ASSIGN; | ||
1934 | CHAN_DEF_ASSIGN(chandef); | ||
1935 | ), | ||
1936 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT, | ||
1937 | WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG) | ||
1938 | ); | ||
1939 | |||
1922 | /************************************************************* | 1940 | /************************************************************* |
1923 | * cfg80211 exported functions traces * | 1941 | * cfg80211 exported functions traces * |
1924 | *************************************************************/ | 1942 | *************************************************************/ |
@@ -2193,18 +2211,21 @@ TRACE_EVENT(cfg80211_cqm_rssi_notify, | |||
2193 | ); | 2211 | ); |
2194 | 2212 | ||
2195 | TRACE_EVENT(cfg80211_reg_can_beacon, | 2213 | TRACE_EVENT(cfg80211_reg_can_beacon, |
2196 | TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), | 2214 | TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, |
2197 | TP_ARGS(wiphy, chandef), | 2215 | enum nl80211_iftype iftype), |
2216 | TP_ARGS(wiphy, chandef, iftype), | ||
2198 | TP_STRUCT__entry( | 2217 | TP_STRUCT__entry( |
2199 | WIPHY_ENTRY | 2218 | WIPHY_ENTRY |
2200 | CHAN_DEF_ENTRY | 2219 | CHAN_DEF_ENTRY |
2220 | __field(enum nl80211_iftype, iftype) | ||
2201 | ), | 2221 | ), |
2202 | TP_fast_assign( | 2222 | TP_fast_assign( |
2203 | WIPHY_ASSIGN; | 2223 | WIPHY_ASSIGN; |
2204 | CHAN_DEF_ASSIGN(chandef); | 2224 | CHAN_DEF_ASSIGN(chandef); |
2225 | __entry->iftype = iftype; | ||
2205 | ), | 2226 | ), |
2206 | TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, | 2227 | TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", iftype=%d", |
2207 | WIPHY_PR_ARG, CHAN_DEF_PR_ARG) | 2228 | WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->iftype) |
2208 | ); | 2229 | ); |
2209 | 2230 | ||
2210 | TRACE_EVENT(cfg80211_chandef_dfs_required, | 2231 | TRACE_EVENT(cfg80211_chandef_dfs_required, |
diff --git a/net/wireless/util.c b/net/wireless/util.c index e5872ff2c27c..7c47fa07b276 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -770,7 +770,7 @@ EXPORT_SYMBOL(ieee80211_bss_get_ie); | |||
770 | 770 | ||
771 | void cfg80211_upload_connect_keys(struct wireless_dev *wdev) | 771 | void cfg80211_upload_connect_keys(struct wireless_dev *wdev) |
772 | { | 772 | { |
773 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 773 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
774 | struct net_device *dev = wdev->netdev; | 774 | struct net_device *dev = wdev->netdev; |
775 | int i; | 775 | int i; |
776 | 776 | ||
@@ -888,11 +888,6 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
888 | return -EBUSY; | 888 | return -EBUSY; |
889 | 889 | ||
890 | if (ntype != otype && netif_running(dev)) { | 890 | if (ntype != otype && netif_running(dev)) { |
891 | err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr, | ||
892 | ntype); | ||
893 | if (err) | ||
894 | return err; | ||
895 | |||
896 | dev->ieee80211_ptr->use_4addr = false; | 891 | dev->ieee80211_ptr->use_4addr = false; |
897 | dev->ieee80211_ptr->mesh_id_up_len = 0; | 892 | dev->ieee80211_ptr->mesh_id_up_len = 0; |
898 | wdev_lock(dev->ieee80211_ptr); | 893 | wdev_lock(dev->ieee80211_ptr); |
@@ -1268,6 +1263,106 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev, | |||
1268 | return res; | 1263 | return res; |
1269 | } | 1264 | } |
1270 | 1265 | ||
1266 | int cfg80211_iter_combinations(struct wiphy *wiphy, | ||
1267 | const int num_different_channels, | ||
1268 | const u8 radar_detect, | ||
1269 | const int iftype_num[NUM_NL80211_IFTYPES], | ||
1270 | void (*iter)(const struct ieee80211_iface_combination *c, | ||
1271 | void *data), | ||
1272 | void *data) | ||
1273 | { | ||
1274 | int i, j, iftype; | ||
1275 | int num_interfaces = 0; | ||
1276 | u32 used_iftypes = 0; | ||
1277 | |||
1278 | for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { | ||
1279 | num_interfaces += iftype_num[iftype]; | ||
1280 | if (iftype_num[iftype] > 0 && | ||
1281 | !(wiphy->software_iftypes & BIT(iftype))) | ||
1282 | used_iftypes |= BIT(iftype); | ||
1283 | } | ||
1284 | |||
1285 | for (i = 0; i < wiphy->n_iface_combinations; i++) { | ||
1286 | const struct ieee80211_iface_combination *c; | ||
1287 | struct ieee80211_iface_limit *limits; | ||
1288 | u32 all_iftypes = 0; | ||
1289 | |||
1290 | c = &wiphy->iface_combinations[i]; | ||
1291 | |||
1292 | if (num_interfaces > c->max_interfaces) | ||
1293 | continue; | ||
1294 | if (num_different_channels > c->num_different_channels) | ||
1295 | continue; | ||
1296 | |||
1297 | limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits, | ||
1298 | GFP_KERNEL); | ||
1299 | if (!limits) | ||
1300 | return -ENOMEM; | ||
1301 | |||
1302 | for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { | ||
1303 | if (wiphy->software_iftypes & BIT(iftype)) | ||
1304 | continue; | ||
1305 | for (j = 0; j < c->n_limits; j++) { | ||
1306 | all_iftypes |= limits[j].types; | ||
1307 | if (!(limits[j].types & BIT(iftype))) | ||
1308 | continue; | ||
1309 | if (limits[j].max < iftype_num[iftype]) | ||
1310 | goto cont; | ||
1311 | limits[j].max -= iftype_num[iftype]; | ||
1312 | } | ||
1313 | } | ||
1314 | |||
1315 | if (radar_detect != (c->radar_detect_widths & radar_detect)) | ||
1316 | goto cont; | ||
1317 | |||
1318 | /* Finally check that all iftypes that we're currently | ||
1319 | * using are actually part of this combination. If they | ||
1320 | * aren't then we can't use this combination and have | ||
1321 | * to continue to the next. | ||
1322 | */ | ||
1323 | if ((all_iftypes & used_iftypes) != used_iftypes) | ||
1324 | goto cont; | ||
1325 | |||
1326 | /* This combination covered all interface types and | ||
1327 | * supported the requested numbers, so we're good. | ||
1328 | */ | ||
1329 | |||
1330 | (*iter)(c, data); | ||
1331 | cont: | ||
1332 | kfree(limits); | ||
1333 | } | ||
1334 | |||
1335 | return 0; | ||
1336 | } | ||
1337 | EXPORT_SYMBOL(cfg80211_iter_combinations); | ||
1338 | |||
1339 | static void | ||
1340 | cfg80211_iter_sum_ifcombs(const struct ieee80211_iface_combination *c, | ||
1341 | void *data) | ||
1342 | { | ||
1343 | int *num = data; | ||
1344 | (*num)++; | ||
1345 | } | ||
1346 | |||
1347 | int cfg80211_check_combinations(struct wiphy *wiphy, | ||
1348 | const int num_different_channels, | ||
1349 | const u8 radar_detect, | ||
1350 | const int iftype_num[NUM_NL80211_IFTYPES]) | ||
1351 | { | ||
1352 | int err, num = 0; | ||
1353 | |||
1354 | err = cfg80211_iter_combinations(wiphy, num_different_channels, | ||
1355 | radar_detect, iftype_num, | ||
1356 | cfg80211_iter_sum_ifcombs, &num); | ||
1357 | if (err) | ||
1358 | return err; | ||
1359 | if (num == 0) | ||
1360 | return -EBUSY; | ||
1361 | |||
1362 | return 0; | ||
1363 | } | ||
1364 | EXPORT_SYMBOL(cfg80211_check_combinations); | ||
1365 | |||
1271 | int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, | 1366 | int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, |
1272 | struct wireless_dev *wdev, | 1367 | struct wireless_dev *wdev, |
1273 | enum nl80211_iftype iftype, | 1368 | enum nl80211_iftype iftype, |
@@ -1276,7 +1371,6 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, | |||
1276 | u8 radar_detect) | 1371 | u8 radar_detect) |
1277 | { | 1372 | { |
1278 | struct wireless_dev *wdev_iter; | 1373 | struct wireless_dev *wdev_iter; |
1279 | u32 used_iftypes = BIT(iftype); | ||
1280 | int num[NUM_NL80211_IFTYPES]; | 1374 | int num[NUM_NL80211_IFTYPES]; |
1281 | struct ieee80211_channel | 1375 | struct ieee80211_channel |
1282 | *used_channels[CFG80211_MAX_NUM_DIFFERENT_CHANNELS]; | 1376 | *used_channels[CFG80211_MAX_NUM_DIFFERENT_CHANNELS]; |
@@ -1284,7 +1378,7 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, | |||
1284 | enum cfg80211_chan_mode chmode; | 1378 | enum cfg80211_chan_mode chmode; |
1285 | int num_different_channels = 0; | 1379 | int num_different_channels = 0; |
1286 | int total = 1; | 1380 | int total = 1; |
1287 | int i, j; | 1381 | int i; |
1288 | 1382 | ||
1289 | ASSERT_RTNL(); | 1383 | ASSERT_RTNL(); |
1290 | 1384 | ||
@@ -1306,6 +1400,11 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, | |||
1306 | 1400 | ||
1307 | num[iftype] = 1; | 1401 | num[iftype] = 1; |
1308 | 1402 | ||
1403 | /* TODO: We'll probably not need this anymore, since this | ||
1404 | * should only be called with CHAN_MODE_UNDEFINED. There are | ||
1405 | * still a couple of pending calls where other chanmodes are | ||
1406 | * used, but we should get rid of them. | ||
1407 | */ | ||
1309 | switch (chanmode) { | 1408 | switch (chanmode) { |
1310 | case CHAN_MODE_UNDEFINED: | 1409 | case CHAN_MODE_UNDEFINED: |
1311 | break; | 1410 | break; |
@@ -1369,65 +1468,13 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, | |||
1369 | 1468 | ||
1370 | num[wdev_iter->iftype]++; | 1469 | num[wdev_iter->iftype]++; |
1371 | total++; | 1470 | total++; |
1372 | used_iftypes |= BIT(wdev_iter->iftype); | ||
1373 | } | 1471 | } |
1374 | 1472 | ||
1375 | if (total == 1 && !radar_detect) | 1473 | if (total == 1 && !radar_detect) |
1376 | return 0; | 1474 | return 0; |
1377 | 1475 | ||
1378 | for (i = 0; i < rdev->wiphy.n_iface_combinations; i++) { | 1476 | return cfg80211_check_combinations(&rdev->wiphy, num_different_channels, |
1379 | const struct ieee80211_iface_combination *c; | 1477 | radar_detect, num); |
1380 | struct ieee80211_iface_limit *limits; | ||
1381 | u32 all_iftypes = 0; | ||
1382 | |||
1383 | c = &rdev->wiphy.iface_combinations[i]; | ||
1384 | |||
1385 | if (total > c->max_interfaces) | ||
1386 | continue; | ||
1387 | if (num_different_channels > c->num_different_channels) | ||
1388 | continue; | ||
1389 | |||
1390 | limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits, | ||
1391 | GFP_KERNEL); | ||
1392 | if (!limits) | ||
1393 | return -ENOMEM; | ||
1394 | |||
1395 | for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { | ||
1396 | if (rdev->wiphy.software_iftypes & BIT(iftype)) | ||
1397 | continue; | ||
1398 | for (j = 0; j < c->n_limits; j++) { | ||
1399 | all_iftypes |= limits[j].types; | ||
1400 | if (!(limits[j].types & BIT(iftype))) | ||
1401 | continue; | ||
1402 | if (limits[j].max < num[iftype]) | ||
1403 | goto cont; | ||
1404 | limits[j].max -= num[iftype]; | ||
1405 | } | ||
1406 | } | ||
1407 | |||
1408 | if (radar_detect && !(c->radar_detect_widths & radar_detect)) | ||
1409 | goto cont; | ||
1410 | |||
1411 | /* | ||
1412 | * Finally check that all iftypes that we're currently | ||
1413 | * using are actually part of this combination. If they | ||
1414 | * aren't then we can't use this combination and have | ||
1415 | * to continue to the next. | ||
1416 | */ | ||
1417 | if ((all_iftypes & used_iftypes) != used_iftypes) | ||
1418 | goto cont; | ||
1419 | |||
1420 | /* | ||
1421 | * This combination covered all interface types and | ||
1422 | * supported the requested numbers, so we're good. | ||
1423 | */ | ||
1424 | kfree(limits); | ||
1425 | return 0; | ||
1426 | cont: | ||
1427 | kfree(limits); | ||
1428 | } | ||
1429 | |||
1430 | return -EBUSY; | ||
1431 | } | 1478 | } |
1432 | 1479 | ||
1433 | int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, | 1480 | int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, |
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 5661a54ac7ee..11120bb14162 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -73,7 +73,7 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, | |||
73 | struct vif_params vifparams; | 73 | struct vif_params vifparams; |
74 | enum nl80211_iftype type; | 74 | enum nl80211_iftype type; |
75 | 75 | ||
76 | rdev = wiphy_to_dev(wdev->wiphy); | 76 | rdev = wiphy_to_rdev(wdev->wiphy); |
77 | 77 | ||
78 | switch (*mode) { | 78 | switch (*mode) { |
79 | case IW_MODE_INFRA: | 79 | case IW_MODE_INFRA: |
@@ -253,12 +253,12 @@ EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange); | |||
253 | 253 | ||
254 | /** | 254 | /** |
255 | * cfg80211_wext_freq - get wext frequency for non-"auto" | 255 | * cfg80211_wext_freq - get wext frequency for non-"auto" |
256 | * @wiphy: the wiphy | 256 | * @dev: the net device |
257 | * @freq: the wext freq encoding | 257 | * @freq: the wext freq encoding |
258 | * | 258 | * |
259 | * Returns a frequency, or a negative error code, or 0 for auto. | 259 | * Returns a frequency, or a negative error code, or 0 for auto. |
260 | */ | 260 | */ |
261 | int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq) | 261 | int cfg80211_wext_freq(struct iw_freq *freq) |
262 | { | 262 | { |
263 | /* | 263 | /* |
264 | * Parse frequency - return 0 for auto and | 264 | * Parse frequency - return 0 for auto and |
@@ -286,7 +286,7 @@ int cfg80211_wext_siwrts(struct net_device *dev, | |||
286 | struct iw_param *rts, char *extra) | 286 | struct iw_param *rts, char *extra) |
287 | { | 287 | { |
288 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 288 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
289 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 289 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
290 | u32 orts = wdev->wiphy->rts_threshold; | 290 | u32 orts = wdev->wiphy->rts_threshold; |
291 | int err; | 291 | int err; |
292 | 292 | ||
@@ -324,7 +324,7 @@ int cfg80211_wext_siwfrag(struct net_device *dev, | |||
324 | struct iw_param *frag, char *extra) | 324 | struct iw_param *frag, char *extra) |
325 | { | 325 | { |
326 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 326 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
327 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 327 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
328 | u32 ofrag = wdev->wiphy->frag_threshold; | 328 | u32 ofrag = wdev->wiphy->frag_threshold; |
329 | int err; | 329 | int err; |
330 | 330 | ||
@@ -364,7 +364,7 @@ static int cfg80211_wext_siwretry(struct net_device *dev, | |||
364 | struct iw_param *retry, char *extra) | 364 | struct iw_param *retry, char *extra) |
365 | { | 365 | { |
366 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 366 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
367 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 367 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
368 | u32 changed = 0; | 368 | u32 changed = 0; |
369 | u8 olong = wdev->wiphy->retry_long; | 369 | u8 olong = wdev->wiphy->retry_long; |
370 | u8 oshort = wdev->wiphy->retry_short; | 370 | u8 oshort = wdev->wiphy->retry_short; |
@@ -587,7 +587,7 @@ static int cfg80211_wext_siwencode(struct net_device *dev, | |||
587 | struct iw_point *erq, char *keybuf) | 587 | struct iw_point *erq, char *keybuf) |
588 | { | 588 | { |
589 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 589 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
590 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 590 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
591 | int idx, err; | 591 | int idx, err; |
592 | bool remove = false; | 592 | bool remove = false; |
593 | struct key_params params; | 593 | struct key_params params; |
@@ -647,7 +647,7 @@ static int cfg80211_wext_siwencodeext(struct net_device *dev, | |||
647 | struct iw_point *erq, char *extra) | 647 | struct iw_point *erq, char *extra) |
648 | { | 648 | { |
649 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 649 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
650 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 650 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
651 | struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; | 651 | struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; |
652 | const u8 *addr; | 652 | const u8 *addr; |
653 | int idx; | 653 | int idx; |
@@ -775,7 +775,7 @@ static int cfg80211_wext_siwfreq(struct net_device *dev, | |||
775 | struct iw_freq *wextfreq, char *extra) | 775 | struct iw_freq *wextfreq, char *extra) |
776 | { | 776 | { |
777 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 777 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
778 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 778 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
779 | struct cfg80211_chan_def chandef = { | 779 | struct cfg80211_chan_def chandef = { |
780 | .width = NL80211_CHAN_WIDTH_20_NOHT, | 780 | .width = NL80211_CHAN_WIDTH_20_NOHT, |
781 | }; | 781 | }; |
@@ -787,7 +787,7 @@ static int cfg80211_wext_siwfreq(struct net_device *dev, | |||
787 | case NL80211_IFTYPE_ADHOC: | 787 | case NL80211_IFTYPE_ADHOC: |
788 | return cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra); | 788 | return cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra); |
789 | case NL80211_IFTYPE_MONITOR: | 789 | case NL80211_IFTYPE_MONITOR: |
790 | freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); | 790 | freq = cfg80211_wext_freq(wextfreq); |
791 | if (freq < 0) | 791 | if (freq < 0) |
792 | return freq; | 792 | return freq; |
793 | if (freq == 0) | 793 | if (freq == 0) |
@@ -798,7 +798,7 @@ static int cfg80211_wext_siwfreq(struct net_device *dev, | |||
798 | return -EINVAL; | 798 | return -EINVAL; |
799 | return cfg80211_set_monitor_channel(rdev, &chandef); | 799 | return cfg80211_set_monitor_channel(rdev, &chandef); |
800 | case NL80211_IFTYPE_MESH_POINT: | 800 | case NL80211_IFTYPE_MESH_POINT: |
801 | freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); | 801 | freq = cfg80211_wext_freq(wextfreq); |
802 | if (freq < 0) | 802 | if (freq < 0) |
803 | return freq; | 803 | return freq; |
804 | if (freq == 0) | 804 | if (freq == 0) |
@@ -818,7 +818,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev, | |||
818 | struct iw_freq *freq, char *extra) | 818 | struct iw_freq *freq, char *extra) |
819 | { | 819 | { |
820 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 820 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
821 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 821 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
822 | struct cfg80211_chan_def chandef; | 822 | struct cfg80211_chan_def chandef; |
823 | int ret; | 823 | int ret; |
824 | 824 | ||
@@ -847,7 +847,7 @@ static int cfg80211_wext_siwtxpower(struct net_device *dev, | |||
847 | union iwreq_data *data, char *extra) | 847 | union iwreq_data *data, char *extra) |
848 | { | 848 | { |
849 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 849 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
850 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 850 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
851 | enum nl80211_tx_power_setting type; | 851 | enum nl80211_tx_power_setting type; |
852 | int dbm = 0; | 852 | int dbm = 0; |
853 | 853 | ||
@@ -899,7 +899,7 @@ static int cfg80211_wext_giwtxpower(struct net_device *dev, | |||
899 | union iwreq_data *data, char *extra) | 899 | union iwreq_data *data, char *extra) |
900 | { | 900 | { |
901 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 901 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
902 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 902 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
903 | int err, val; | 903 | int err, val; |
904 | 904 | ||
905 | if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) | 905 | if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) |
@@ -1119,7 +1119,7 @@ static int cfg80211_wext_siwpower(struct net_device *dev, | |||
1119 | struct iw_param *wrq, char *extra) | 1119 | struct iw_param *wrq, char *extra) |
1120 | { | 1120 | { |
1121 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 1121 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
1122 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 1122 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
1123 | bool ps = wdev->ps; | 1123 | bool ps = wdev->ps; |
1124 | int timeout = wdev->ps_timeout; | 1124 | int timeout = wdev->ps_timeout; |
1125 | int err; | 1125 | int err; |
@@ -1177,7 +1177,7 @@ static int cfg80211_wds_wext_siwap(struct net_device *dev, | |||
1177 | struct sockaddr *addr, char *extra) | 1177 | struct sockaddr *addr, char *extra) |
1178 | { | 1178 | { |
1179 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 1179 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
1180 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 1180 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
1181 | int err; | 1181 | int err; |
1182 | 1182 | ||
1183 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_WDS)) | 1183 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_WDS)) |
@@ -1221,7 +1221,7 @@ static int cfg80211_wext_siwrate(struct net_device *dev, | |||
1221 | struct iw_param *rate, char *extra) | 1221 | struct iw_param *rate, char *extra) |
1222 | { | 1222 | { |
1223 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 1223 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
1224 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 1224 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
1225 | struct cfg80211_bitrate_mask mask; | 1225 | struct cfg80211_bitrate_mask mask; |
1226 | u32 fixed, maxrate; | 1226 | u32 fixed, maxrate; |
1227 | struct ieee80211_supported_band *sband; | 1227 | struct ieee80211_supported_band *sband; |
@@ -1272,7 +1272,7 @@ static int cfg80211_wext_giwrate(struct net_device *dev, | |||
1272 | struct iw_param *rate, char *extra) | 1272 | struct iw_param *rate, char *extra) |
1273 | { | 1273 | { |
1274 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 1274 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
1275 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 1275 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
1276 | /* we are under RTNL - globally locked - so can use a static struct */ | 1276 | /* we are under RTNL - globally locked - so can use a static struct */ |
1277 | static struct station_info sinfo; | 1277 | static struct station_info sinfo; |
1278 | u8 addr[ETH_ALEN]; | 1278 | u8 addr[ETH_ALEN]; |
@@ -1310,7 +1310,7 @@ static int cfg80211_wext_giwrate(struct net_device *dev, | |||
1310 | static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) | 1310 | static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) |
1311 | { | 1311 | { |
1312 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 1312 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
1313 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 1313 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
1314 | /* we are under RTNL - globally locked - so can use static structs */ | 1314 | /* we are under RTNL - globally locked - so can use static structs */ |
1315 | static struct iw_statistics wstats; | 1315 | static struct iw_statistics wstats; |
1316 | static struct station_info sinfo; | 1316 | static struct station_info sinfo; |
@@ -1449,7 +1449,7 @@ static int cfg80211_wext_siwpmksa(struct net_device *dev, | |||
1449 | struct iw_point *data, char *extra) | 1449 | struct iw_point *data, char *extra) |
1450 | { | 1450 | { |
1451 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 1451 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
1452 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 1452 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
1453 | struct cfg80211_pmksa cfg_pmksa; | 1453 | struct cfg80211_pmksa cfg_pmksa; |
1454 | struct iw_pmksa *pmksa = (struct iw_pmksa *)extra; | 1454 | struct iw_pmksa *pmksa = (struct iw_pmksa *)extra; |
1455 | 1455 | ||
diff --git a/net/wireless/wext-compat.h b/net/wireless/wext-compat.h index 5d766b0118e8..ebcacca2f731 100644 --- a/net/wireless/wext-compat.h +++ b/net/wireless/wext-compat.h | |||
@@ -50,7 +50,7 @@ int cfg80211_wext_siwgenie(struct net_device *dev, | |||
50 | struct iw_point *data, char *extra); | 50 | struct iw_point *data, char *extra); |
51 | 51 | ||
52 | 52 | ||
53 | int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq); | 53 | int cfg80211_wext_freq(struct iw_freq *freq); |
54 | 54 | ||
55 | 55 | ||
56 | extern const struct iw_handler_def cfg80211_wext_handler; | 56 | extern const struct iw_handler_def cfg80211_wext_handler; |
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index 86c331a65664..c7e5c8eb4f24 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -67,7 +67,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
67 | struct iw_freq *wextfreq, char *extra) | 67 | struct iw_freq *wextfreq, char *extra) |
68 | { | 68 | { |
69 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 69 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
70 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 70 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
71 | struct ieee80211_channel *chan = NULL; | 71 | struct ieee80211_channel *chan = NULL; |
72 | int err, freq; | 72 | int err, freq; |
73 | 73 | ||
@@ -75,7 +75,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
75 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) | 75 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) |
76 | return -EINVAL; | 76 | return -EINVAL; |
77 | 77 | ||
78 | freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); | 78 | freq = cfg80211_wext_freq(wextfreq); |
79 | if (freq < 0) | 79 | if (freq < 0) |
80 | return freq; | 80 | return freq; |
81 | 81 | ||
@@ -169,7 +169,7 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, | |||
169 | struct iw_point *data, char *ssid) | 169 | struct iw_point *data, char *ssid) |
170 | { | 170 | { |
171 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 171 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
172 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 172 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
173 | size_t len = data->length; | 173 | size_t len = data->length; |
174 | int err; | 174 | int err; |
175 | 175 | ||
@@ -260,7 +260,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, | |||
260 | struct sockaddr *ap_addr, char *extra) | 260 | struct sockaddr *ap_addr, char *extra) |
261 | { | 261 | { |
262 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 262 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
263 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 263 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
264 | u8 *bssid = ap_addr->sa_data; | 264 | u8 *bssid = ap_addr->sa_data; |
265 | int err; | 265 | int err; |
266 | 266 | ||
@@ -333,7 +333,7 @@ int cfg80211_wext_siwgenie(struct net_device *dev, | |||
333 | struct iw_point *data, char *extra) | 333 | struct iw_point *data, char *extra) |
334 | { | 334 | { |
335 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 335 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
336 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 336 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
337 | u8 *ie = extra; | 337 | u8 *ie = extra; |
338 | int ie_len = data->length, err; | 338 | int ie_len = data->length, err; |
339 | 339 | ||
@@ -390,7 +390,7 @@ int cfg80211_wext_siwmlme(struct net_device *dev, | |||
390 | if (!wdev) | 390 | if (!wdev) |
391 | return -EOPNOTSUPP; | 391 | return -EOPNOTSUPP; |
392 | 392 | ||
393 | rdev = wiphy_to_dev(wdev->wiphy); | 393 | rdev = wiphy_to_rdev(wdev->wiphy); |
394 | 394 | ||
395 | if (wdev->iftype != NL80211_IFTYPE_STATION) | 395 | if (wdev->iftype != NL80211_IFTYPE_STATION) |
396 | return -EINVAL; | 396 | return -EINVAL; |