diff options
334 files changed, 6736 insertions, 3455 deletions
diff --git a/Documentation/DocBook/80211.tmpl b/Documentation/DocBook/80211.tmpl index 49267ea97568..f403ec3c5c9a 100644 --- a/Documentation/DocBook/80211.tmpl +++ b/Documentation/DocBook/80211.tmpl | |||
@@ -325,6 +325,7 @@ | |||
325 | <title>functions/definitions</title> | 325 | <title>functions/definitions</title> |
326 | !Finclude/net/mac80211.h ieee80211_rx_status | 326 | !Finclude/net/mac80211.h ieee80211_rx_status |
327 | !Finclude/net/mac80211.h mac80211_rx_flags | 327 | !Finclude/net/mac80211.h mac80211_rx_flags |
328 | !Finclude/net/mac80211.h mac80211_tx_info_flags | ||
328 | !Finclude/net/mac80211.h mac80211_tx_control_flags | 329 | !Finclude/net/mac80211.h mac80211_tx_control_flags |
329 | !Finclude/net/mac80211.h mac80211_rate_control_flags | 330 | !Finclude/net/mac80211.h mac80211_rate_control_flags |
330 | !Finclude/net/mac80211.h ieee80211_tx_rate | 331 | !Finclude/net/mac80211.h ieee80211_tx_rate |
diff --git a/MAINTAINERS b/MAINTAINERS index b2887c5424d1..705bb96bc37e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -5792,7 +5792,7 @@ M: Aloisio Almeida Jr <aloisio.almeida@openbossa.org> | |||
5792 | M: Samuel Ortiz <sameo@linux.intel.com> | 5792 | M: Samuel Ortiz <sameo@linux.intel.com> |
5793 | L: linux-wireless@vger.kernel.org | 5793 | L: linux-wireless@vger.kernel.org |
5794 | L: linux-nfc@lists.01.org (moderated for non-subscribers) | 5794 | L: linux-nfc@lists.01.org (moderated for non-subscribers) |
5795 | S: Maintained | 5795 | S: Supported |
5796 | F: net/nfc/ | 5796 | F: net/nfc/ |
5797 | F: include/net/nfc/ | 5797 | F: include/net/nfc/ |
5798 | F: include/uapi/linux/nfc.h | 5798 | F: include/uapi/linux/nfc.h |
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c index cf7a476a519f..c9fd6943ce45 100644 --- a/drivers/bcma/driver_pci.c +++ b/drivers/bcma/driver_pci.c | |||
@@ -31,7 +31,7 @@ static void bcma_pcie_write(struct bcma_drv_pci *pc, u32 address, u32 data) | |||
31 | pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_DATA, data); | 31 | pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_DATA, data); |
32 | } | 32 | } |
33 | 33 | ||
34 | static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy) | 34 | static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u16 phy) |
35 | { | 35 | { |
36 | u32 v; | 36 | u32 v; |
37 | int i; | 37 | int i; |
@@ -55,7 +55,7 @@ static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy) | |||
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u8 device, u8 address) | 58 | static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u16 device, u8 address) |
59 | { | 59 | { |
60 | int max_retries = 10; | 60 | int max_retries = 10; |
61 | u16 ret = 0; | 61 | u16 ret = 0; |
@@ -98,7 +98,7 @@ static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u8 device, u8 address) | |||
98 | return ret; | 98 | return ret; |
99 | } | 99 | } |
100 | 100 | ||
101 | static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u8 device, | 101 | static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u16 device, |
102 | u8 address, u16 data) | 102 | u8 address, u16 data) |
103 | { | 103 | { |
104 | int max_retries = 10; | 104 | int max_retries = 10; |
@@ -137,6 +137,13 @@ static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u8 device, | |||
137 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0); | 137 | pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0); |
138 | } | 138 | } |
139 | 139 | ||
140 | static u16 bcma_pcie_mdio_writeread(struct bcma_drv_pci *pc, u16 device, | ||
141 | u8 address, u16 data) | ||
142 | { | ||
143 | bcma_pcie_mdio_write(pc, device, address, data); | ||
144 | return bcma_pcie_mdio_read(pc, device, address); | ||
145 | } | ||
146 | |||
140 | /************************************************** | 147 | /************************************************** |
141 | * Workarounds. | 148 | * Workarounds. |
142 | **************************************************/ | 149 | **************************************************/ |
@@ -203,6 +210,25 @@ static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) | |||
203 | } | 210 | } |
204 | } | 211 | } |
205 | 212 | ||
213 | static void bcma_core_pci_power_save(struct bcma_drv_pci *pc, bool up) | ||
214 | { | ||
215 | u16 data; | ||
216 | |||
217 | if (pc->core->id.rev >= 15 && pc->core->id.rev <= 20) { | ||
218 | data = up ? 0x74 : 0x7C; | ||
219 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
220 | BCMA_CORE_PCI_MDIO_BLK1_MGMT1, 0x7F64); | ||
221 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
222 | BCMA_CORE_PCI_MDIO_BLK1_MGMT3, data); | ||
223 | } else if (pc->core->id.rev >= 21 && pc->core->id.rev <= 22) { | ||
224 | data = up ? 0x75 : 0x7D; | ||
225 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
226 | BCMA_CORE_PCI_MDIO_BLK1_MGMT1, 0x7E65); | ||
227 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
228 | BCMA_CORE_PCI_MDIO_BLK1_MGMT3, data); | ||
229 | } | ||
230 | } | ||
231 | |||
206 | /************************************************** | 232 | /************************************************** |
207 | * Init. | 233 | * Init. |
208 | **************************************************/ | 234 | **************************************************/ |
@@ -262,7 +288,7 @@ out: | |||
262 | } | 288 | } |
263 | EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl); | 289 | EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl); |
264 | 290 | ||
265 | void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) | 291 | static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) |
266 | { | 292 | { |
267 | u32 w; | 293 | u32 w; |
268 | 294 | ||
@@ -274,4 +300,33 @@ void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) | |||
274 | bcma_pcie_write(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG, w); | 300 | bcma_pcie_write(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG, w); |
275 | bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG); | 301 | bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG); |
276 | } | 302 | } |
277 | EXPORT_SYMBOL_GPL(bcma_core_pci_extend_L1timer); | 303 | |
304 | void bcma_core_pci_up(struct bcma_bus *bus) | ||
305 | { | ||
306 | struct bcma_drv_pci *pc; | ||
307 | |||
308 | if (bus->hosttype != BCMA_HOSTTYPE_PCI) | ||
309 | return; | ||
310 | |||
311 | pc = &bus->drv_pci[0]; | ||
312 | |||
313 | bcma_core_pci_power_save(pc, true); | ||
314 | |||
315 | bcma_core_pci_extend_L1timer(pc, true); | ||
316 | } | ||
317 | EXPORT_SYMBOL_GPL(bcma_core_pci_up); | ||
318 | |||
319 | void bcma_core_pci_down(struct bcma_bus *bus) | ||
320 | { | ||
321 | struct bcma_drv_pci *pc; | ||
322 | |||
323 | if (bus->hosttype != BCMA_HOSTTYPE_PCI) | ||
324 | return; | ||
325 | |||
326 | pc = &bus->drv_pci[0]; | ||
327 | |||
328 | bcma_core_pci_extend_L1timer(pc, false); | ||
329 | |||
330 | bcma_core_pci_power_save(pc, false); | ||
331 | } | ||
332 | EXPORT_SYMBOL_GPL(bcma_core_pci_down); | ||
diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c index 30629a3d44cc..c3d7b03c2fdc 100644 --- a/drivers/bcma/driver_pci_host.c +++ b/drivers/bcma/driver_pci_host.c | |||
@@ -581,6 +581,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, bcma_core_pci_fixup_addresses); | |||
581 | int bcma_core_pci_plat_dev_init(struct pci_dev *dev) | 581 | int bcma_core_pci_plat_dev_init(struct pci_dev *dev) |
582 | { | 582 | { |
583 | struct bcma_drv_pci_host *pc_host; | 583 | struct bcma_drv_pci_host *pc_host; |
584 | int readrq; | ||
584 | 585 | ||
585 | if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) { | 586 | if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) { |
586 | /* This is not a device on the PCI-core bridge. */ | 587 | /* This is not a device on the PCI-core bridge. */ |
@@ -595,6 +596,11 @@ int bcma_core_pci_plat_dev_init(struct pci_dev *dev) | |||
595 | dev->irq = bcma_core_irq(pc_host->pdev->core); | 596 | dev->irq = bcma_core_irq(pc_host->pdev->core); |
596 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); | 597 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); |
597 | 598 | ||
599 | readrq = pcie_get_readrq(dev); | ||
600 | if (readrq > 128) { | ||
601 | pr_info("change PCIe max read request size from %i to 128\n", readrq); | ||
602 | pcie_set_readrq(dev, 128); | ||
603 | } | ||
598 | return 0; | 604 | return 0; |
599 | } | 605 | } |
600 | EXPORT_SYMBOL(bcma_core_pci_plat_dev_init); | 606 | EXPORT_SYMBOL(bcma_core_pci_plat_dev_init); |
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c index db2c3c305df8..023d35e3c7a7 100644 --- a/drivers/bluetooth/btmrvl_debugfs.c +++ b/drivers/bluetooth/btmrvl_debugfs.c | |||
@@ -43,7 +43,7 @@ static ssize_t btmrvl_hscfgcmd_write(struct file *file, | |||
43 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) | 43 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
44 | return -EFAULT; | 44 | return -EFAULT; |
45 | 45 | ||
46 | ret = strict_strtol(buf, 10, &result); | 46 | ret = kstrtol(buf, 10, &result); |
47 | if (ret) | 47 | if (ret) |
48 | return ret; | 48 | return ret; |
49 | 49 | ||
@@ -89,7 +89,7 @@ static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf, | |||
89 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) | 89 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
90 | return -EFAULT; | 90 | return -EFAULT; |
91 | 91 | ||
92 | ret = strict_strtol(buf, 10, &result); | 92 | ret = kstrtol(buf, 10, &result); |
93 | if (ret) | 93 | if (ret) |
94 | return ret; | 94 | return ret; |
95 | 95 | ||
@@ -135,7 +135,7 @@ static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf, | |||
135 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) | 135 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
136 | return -EFAULT; | 136 | return -EFAULT; |
137 | 137 | ||
138 | ret = strict_strtol(buf, 10, &result); | 138 | ret = kstrtol(buf, 10, &result); |
139 | if (ret) | 139 | if (ret) |
140 | return ret; | 140 | return ret; |
141 | 141 | ||
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index 75c262694632..00da6df9f71e 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c | |||
@@ -486,7 +486,7 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card) | |||
486 | if (firmwarelen - offset < txlen) | 486 | if (firmwarelen - offset < txlen) |
487 | txlen = firmwarelen - offset; | 487 | txlen = firmwarelen - offset; |
488 | 488 | ||
489 | tx_blocks = (txlen + blksz_dl - 1) / blksz_dl; | 489 | tx_blocks = DIV_ROUND_UP(txlen, blksz_dl); |
490 | 490 | ||
491 | memcpy(fwbuf, &firmware[offset], txlen); | 491 | memcpy(fwbuf, &firmware[offset], txlen); |
492 | } | 492 | } |
@@ -873,7 +873,7 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv, | |||
873 | } | 873 | } |
874 | 874 | ||
875 | blksz = SDIO_BLOCK_SIZE; | 875 | blksz = SDIO_BLOCK_SIZE; |
876 | buf_block_len = (nb + blksz - 1) / blksz; | 876 | buf_block_len = DIV_ROUND_UP(nb, blksz); |
877 | 877 | ||
878 | sdio_claim_host(card->func); | 878 | sdio_claim_host(card->func); |
879 | 879 | ||
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 90102652c82a..0d8f427ade93 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2514,17 +2514,13 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, | |||
2514 | */ | 2514 | */ |
2515 | void bond_3ad_update_lacp_rate(struct bonding *bond) | 2515 | void bond_3ad_update_lacp_rate(struct bonding *bond) |
2516 | { | 2516 | { |
2517 | struct slave *slave; | ||
2518 | struct port *port = NULL; | 2517 | struct port *port = NULL; |
2518 | struct slave *slave; | ||
2519 | int lacp_fast; | 2519 | int lacp_fast; |
2520 | 2520 | ||
2521 | write_lock_bh(&bond->lock); | ||
2522 | lacp_fast = bond->params.lacp_fast; | 2521 | lacp_fast = bond->params.lacp_fast; |
2523 | |||
2524 | bond_for_each_slave(bond, slave) { | 2522 | bond_for_each_slave(bond, slave) { |
2525 | port = &(SLAVE_AD_INFO(slave).port); | 2523 | port = &(SLAVE_AD_INFO(slave).port); |
2526 | if (port->slave == NULL) | ||
2527 | continue; | ||
2528 | __get_state_machine_lock(port); | 2524 | __get_state_machine_lock(port); |
2529 | if (lacp_fast) | 2525 | if (lacp_fast) |
2530 | port->actor_oper_port_state |= AD_STATE_LACP_TIMEOUT; | 2526 | port->actor_oper_port_state |= AD_STATE_LACP_TIMEOUT; |
@@ -2532,6 +2528,4 @@ void bond_3ad_update_lacp_rate(struct bonding *bond) | |||
2532 | port->actor_oper_port_state &= ~AD_STATE_LACP_TIMEOUT; | 2528 | port->actor_oper_port_state &= ~AD_STATE_LACP_TIMEOUT; |
2533 | __release_state_machine_lock(port); | 2529 | __release_state_machine_lock(port); |
2534 | } | 2530 | } |
2535 | |||
2536 | write_unlock_bh(&bond->lock); | ||
2537 | } | 2531 | } |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 018235263596..91f179d5135c 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -512,7 +512,7 @@ static void rlb_update_client(struct rlb_client_info *client_info) | |||
512 | 512 | ||
513 | skb->dev = client_info->slave->dev; | 513 | skb->dev = client_info->slave->dev; |
514 | 514 | ||
515 | if (client_info->tag) { | 515 | if (client_info->vlan_id) { |
516 | skb = vlan_put_tag(skb, htons(ETH_P_8021Q), client_info->vlan_id); | 516 | skb = vlan_put_tag(skb, htons(ETH_P_8021Q), client_info->vlan_id); |
517 | if (!skb) { | 517 | if (!skb) { |
518 | pr_err("%s: Error: failed to insert VLAN tag\n", | 518 | pr_err("%s: Error: failed to insert VLAN tag\n", |
@@ -694,10 +694,8 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon | |||
694 | client_info->ntt = 0; | 694 | client_info->ntt = 0; |
695 | } | 695 | } |
696 | 696 | ||
697 | if (bond_vlan_used(bond)) { | 697 | if (!vlan_get_tag(skb, &client_info->vlan_id)) |
698 | if (!vlan_get_tag(skb, &client_info->vlan_id)) | 698 | client_info->vlan_id = 0; |
699 | client_info->tag = 1; | ||
700 | } | ||
701 | 699 | ||
702 | if (!client_info->assigned) { | 700 | if (!client_info->assigned) { |
703 | u32 prev_tbl_head = bond_info->rx_hashtbl_used_head; | 701 | u32 prev_tbl_head = bond_info->rx_hashtbl_used_head; |
@@ -803,7 +801,7 @@ static void rlb_init_table_entry_dst(struct rlb_client_info *entry) | |||
803 | entry->used_prev = RLB_NULL_INDEX; | 801 | entry->used_prev = RLB_NULL_INDEX; |
804 | entry->assigned = 0; | 802 | entry->assigned = 0; |
805 | entry->slave = NULL; | 803 | entry->slave = NULL; |
806 | entry->tag = 0; | 804 | entry->vlan_id = 0; |
807 | } | 805 | } |
808 | static void rlb_init_table_entry_src(struct rlb_client_info *entry) | 806 | static void rlb_init_table_entry_src(struct rlb_client_info *entry) |
809 | { | 807 | { |
@@ -960,7 +958,7 @@ static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id) | |||
960 | struct rlb_client_info *curr = &(bond_info->rx_hashtbl[curr_index]); | 958 | struct rlb_client_info *curr = &(bond_info->rx_hashtbl[curr_index]); |
961 | u32 next_index = bond_info->rx_hashtbl[curr_index].used_next; | 959 | u32 next_index = bond_info->rx_hashtbl[curr_index].used_next; |
962 | 960 | ||
963 | if (curr->tag && (curr->vlan_id == vlan_id)) | 961 | if (curr->vlan_id == vlan_id) |
964 | rlb_delete_table_entry(bond, curr_index); | 962 | rlb_delete_table_entry(bond, curr_index); |
965 | 963 | ||
966 | curr_index = next_index; | 964 | curr_index = next_index; |
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h index e02c9c558c41..28d8e4c7dc06 100644 --- a/drivers/net/bonding/bond_alb.h +++ b/drivers/net/bonding/bond_alb.h | |||
@@ -125,7 +125,6 @@ struct rlb_client_info { | |||
125 | u8 assigned; /* checking whether this entry is assigned */ | 125 | u8 assigned; /* checking whether this entry is assigned */ |
126 | u8 ntt; /* flag - need to transmit client info */ | 126 | u8 ntt; /* flag - need to transmit client info */ |
127 | struct slave *slave; /* the slave assigned to this client */ | 127 | struct slave *slave; /* the slave assigned to this client */ |
128 | u8 tag; /* flag - need to tag skb */ | ||
129 | unsigned short vlan_id; /* VLAN tag associated with IP address */ | 128 | unsigned short vlan_id; /* VLAN tag associated with IP address */ |
130 | }; | 129 | }; |
131 | 130 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index c50679f0a6b6..39e5b1c7ffe2 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -828,7 +828,6 @@ static bool bond_should_notify_peers(struct bonding *bond) | |||
828 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) | 828 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) |
829 | return false; | 829 | return false; |
830 | 830 | ||
831 | bond->send_peer_notif--; | ||
832 | return true; | 831 | return true; |
833 | } | 832 | } |
834 | 833 | ||
@@ -1085,18 +1084,16 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev) | |||
1085 | /*---------------------------------- IOCTL ----------------------------------*/ | 1084 | /*---------------------------------- IOCTL ----------------------------------*/ |
1086 | 1085 | ||
1087 | static netdev_features_t bond_fix_features(struct net_device *dev, | 1086 | static netdev_features_t bond_fix_features(struct net_device *dev, |
1088 | netdev_features_t features) | 1087 | netdev_features_t features) |
1089 | { | 1088 | { |
1090 | struct slave *slave; | ||
1091 | struct bonding *bond = netdev_priv(dev); | 1089 | struct bonding *bond = netdev_priv(dev); |
1092 | netdev_features_t mask; | 1090 | netdev_features_t mask; |
1093 | 1091 | struct slave *slave; | |
1094 | read_lock(&bond->lock); | ||
1095 | 1092 | ||
1096 | if (list_empty(&bond->slave_list)) { | 1093 | if (list_empty(&bond->slave_list)) { |
1097 | /* Disable adding VLANs to empty bond. But why? --mq */ | 1094 | /* Disable adding VLANs to empty bond. But why? --mq */ |
1098 | features |= NETIF_F_VLAN_CHALLENGED; | 1095 | features |= NETIF_F_VLAN_CHALLENGED; |
1099 | goto out; | 1096 | return features; |
1100 | } | 1097 | } |
1101 | 1098 | ||
1102 | mask = features; | 1099 | mask = features; |
@@ -1110,8 +1107,6 @@ static netdev_features_t bond_fix_features(struct net_device *dev, | |||
1110 | } | 1107 | } |
1111 | features = netdev_add_tso_features(features, mask); | 1108 | features = netdev_add_tso_features(features, mask); |
1112 | 1109 | ||
1113 | out: | ||
1114 | read_unlock(&bond->lock); | ||
1115 | return features; | 1110 | return features; |
1116 | } | 1111 | } |
1117 | 1112 | ||
@@ -1121,15 +1116,13 @@ out: | |||
1121 | 1116 | ||
1122 | static void bond_compute_features(struct bonding *bond) | 1117 | static void bond_compute_features(struct bonding *bond) |
1123 | { | 1118 | { |
1124 | struct slave *slave; | 1119 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; |
1125 | struct net_device *bond_dev = bond->dev; | ||
1126 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; | 1120 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; |
1127 | unsigned short max_hard_header_len = ETH_HLEN; | 1121 | unsigned short max_hard_header_len = ETH_HLEN; |
1128 | unsigned int gso_max_size = GSO_MAX_SIZE; | 1122 | unsigned int gso_max_size = GSO_MAX_SIZE; |
1123 | struct net_device *bond_dev = bond->dev; | ||
1129 | u16 gso_max_segs = GSO_MAX_SEGS; | 1124 | u16 gso_max_segs = GSO_MAX_SEGS; |
1130 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; | 1125 | struct slave *slave; |
1131 | |||
1132 | read_lock(&bond->lock); | ||
1133 | 1126 | ||
1134 | if (list_empty(&bond->slave_list)) | 1127 | if (list_empty(&bond->slave_list)) |
1135 | goto done; | 1128 | goto done; |
@@ -1155,8 +1148,6 @@ done: | |||
1155 | flags = bond_dev->priv_flags & ~IFF_XMIT_DST_RELEASE; | 1148 | flags = bond_dev->priv_flags & ~IFF_XMIT_DST_RELEASE; |
1156 | bond_dev->priv_flags = flags | dst_release_flag; | 1149 | bond_dev->priv_flags = flags | dst_release_flag; |
1157 | 1150 | ||
1158 | read_unlock(&bond->lock); | ||
1159 | |||
1160 | netdev_change_features(bond_dev); | 1151 | netdev_change_features(bond_dev); |
1161 | } | 1152 | } |
1162 | 1153 | ||
@@ -2259,12 +2250,8 @@ re_arm: | |||
2259 | read_unlock(&bond->lock); | 2250 | read_unlock(&bond->lock); |
2260 | 2251 | ||
2261 | if (should_notify_peers) { | 2252 | if (should_notify_peers) { |
2262 | if (!rtnl_trylock()) { | 2253 | if (!rtnl_trylock()) |
2263 | read_lock(&bond->lock); | ||
2264 | bond->send_peer_notif++; | ||
2265 | read_unlock(&bond->lock); | ||
2266 | return; | 2254 | return; |
2267 | } | ||
2268 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); | 2255 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); |
2269 | rtnl_unlock(); | 2256 | rtnl_unlock(); |
2270 | } | 2257 | } |
@@ -2876,12 +2863,8 @@ re_arm: | |||
2876 | read_unlock(&bond->lock); | 2863 | read_unlock(&bond->lock); |
2877 | 2864 | ||
2878 | if (should_notify_peers) { | 2865 | if (should_notify_peers) { |
2879 | if (!rtnl_trylock()) { | 2866 | if (!rtnl_trylock()) |
2880 | read_lock(&bond->lock); | ||
2881 | bond->send_peer_notif++; | ||
2882 | read_unlock(&bond->lock); | ||
2883 | return; | 2867 | return; |
2884 | } | ||
2885 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); | 2868 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); |
2886 | rtnl_unlock(); | 2869 | rtnl_unlock(); |
2887 | } | 2870 | } |
@@ -2916,6 +2899,10 @@ static int bond_master_netdev_event(unsigned long event, | |||
2916 | case NETDEV_REGISTER: | 2899 | case NETDEV_REGISTER: |
2917 | bond_create_proc_entry(event_bond); | 2900 | bond_create_proc_entry(event_bond); |
2918 | break; | 2901 | break; |
2902 | case NETDEV_NOTIFY_PEERS: | ||
2903 | if (event_bond->send_peer_notif) | ||
2904 | event_bond->send_peer_notif--; | ||
2905 | break; | ||
2919 | default: | 2906 | default: |
2920 | break; | 2907 | break; |
2921 | } | 2908 | } |
@@ -3213,17 +3200,10 @@ static int bond_close(struct net_device *bond_dev) | |||
3213 | { | 3200 | { |
3214 | struct bonding *bond = netdev_priv(bond_dev); | 3201 | struct bonding *bond = netdev_priv(bond_dev); |
3215 | 3202 | ||
3216 | write_lock_bh(&bond->lock); | ||
3217 | bond->send_peer_notif = 0; | ||
3218 | write_unlock_bh(&bond->lock); | ||
3219 | |||
3220 | bond_work_cancel_all(bond); | 3203 | bond_work_cancel_all(bond); |
3221 | if (bond_is_lb(bond)) { | 3204 | bond->send_peer_notif = 0; |
3222 | /* Must be called only after all | 3205 | if (bond_is_lb(bond)) |
3223 | * slaves have been released | ||
3224 | */ | ||
3225 | bond_alb_deinitialize(bond); | 3206 | bond_alb_deinitialize(bond); |
3226 | } | ||
3227 | bond->recv_probe = NULL; | 3207 | bond->recv_probe = NULL; |
3228 | 3208 | ||
3229 | return 0; | 3209 | return 0; |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 0f539de640dc..ce4677668e2c 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -852,8 +852,11 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
852 | struct device_attribute *attr, | 852 | struct device_attribute *attr, |
853 | const char *buf, size_t count) | 853 | const char *buf, size_t count) |
854 | { | 854 | { |
855 | int new_value, ret = count; | ||
856 | struct bonding *bond = to_bond(d); | 855 | struct bonding *bond = to_bond(d); |
856 | int new_value, ret = count; | ||
857 | |||
858 | if (!rtnl_trylock()) | ||
859 | return restart_syscall(); | ||
857 | 860 | ||
858 | if (bond->dev->flags & IFF_UP) { | 861 | if (bond->dev->flags & IFF_UP) { |
859 | pr_err("%s: Unable to update LACP rate because interface is up.\n", | 862 | pr_err("%s: Unable to update LACP rate because interface is up.\n", |
@@ -883,6 +886,8 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
883 | ret = -EINVAL; | 886 | ret = -EINVAL; |
884 | } | 887 | } |
885 | out: | 888 | out: |
889 | rtnl_unlock(); | ||
890 | |||
886 | return ret; | 891 | return ret; |
887 | } | 892 | } |
888 | static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, | 893 | static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 4abc925823e1..f7ab16185f68 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -261,24 +261,6 @@ struct bonding { | |||
261 | #endif /* CONFIG_DEBUG_FS */ | 261 | #endif /* CONFIG_DEBUG_FS */ |
262 | }; | 262 | }; |
263 | 263 | ||
264 | /* if we hold rtnl_lock() - call vlan_uses_dev() */ | ||
265 | static inline bool bond_vlan_used(struct bonding *bond) | ||
266 | { | ||
267 | struct net_device *upper; | ||
268 | struct list_head *iter; | ||
269 | |||
270 | rcu_read_lock(); | ||
271 | netdev_for_each_upper_dev_rcu(bond->dev, upper, iter) { | ||
272 | if (upper->priv_flags & IFF_802_1Q_VLAN) { | ||
273 | rcu_read_unlock(); | ||
274 | return true; | ||
275 | } | ||
276 | } | ||
277 | rcu_read_unlock(); | ||
278 | |||
279 | return false; | ||
280 | } | ||
281 | |||
282 | #define bond_slave_get_rcu(dev) \ | 264 | #define bond_slave_get_rcu(dev) \ |
283 | ((struct slave *) rcu_dereference(dev->rx_handler_data)) | 265 | ((struct slave *) rcu_dereference(dev->rx_handler_data)) |
284 | 266 | ||
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 34dea95d58db..88a6a5810ec6 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c | |||
@@ -347,7 +347,9 @@ static int ldisc_open(struct tty_struct *tty) | |||
347 | /* release devices to avoid name collision */ | 347 | /* release devices to avoid name collision */ |
348 | ser_release(NULL); | 348 | ser_release(NULL); |
349 | 349 | ||
350 | sprintf(name, "cf%s", tty->name); | 350 | result = snprintf(name, sizeof(name), "cf%s", tty->name); |
351 | if (result >= IFNAMSIZ) | ||
352 | return -EINVAL; | ||
351 | dev = alloc_netdev(sizeof(*ser), name, caifdev_setup); | 353 | dev = alloc_netdev(sizeof(*ser), name, caifdev_setup); |
352 | if (!dev) | 354 | if (!dev) |
353 | return -ENOMEM; | 355 | return -ENOMEM; |
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index 5b0ee8ef5885..e59b3a392af6 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c | |||
@@ -40,6 +40,7 @@ struct mpc5xxx_can_data { | |||
40 | unsigned int type; | 40 | unsigned int type; |
41 | u32 (*get_clock)(struct platform_device *ofdev, const char *clock_name, | 41 | u32 (*get_clock)(struct platform_device *ofdev, const char *clock_name, |
42 | int *mscan_clksrc); | 42 | int *mscan_clksrc); |
43 | void (*put_clock)(struct platform_device *ofdev); | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | #ifdef CONFIG_PPC_MPC52xx | 46 | #ifdef CONFIG_PPC_MPC52xx |
@@ -148,7 +149,10 @@ static u32 mpc512x_can_get_clock(struct platform_device *ofdev, | |||
148 | goto exit_put; | 149 | goto exit_put; |
149 | } | 150 | } |
150 | 151 | ||
151 | /* Determine the MSCAN device index from the physical address */ | 152 | /* Determine the MSCAN device index from the peripheral's |
153 | * physical address. Register address offsets against the | ||
154 | * IMMR base are: 0x1300, 0x1380, 0x2300, 0x2380 | ||
155 | */ | ||
152 | pval = of_get_property(ofdev->dev.of_node, "reg", &plen); | 156 | pval = of_get_property(ofdev->dev.of_node, "reg", &plen); |
153 | BUG_ON(!pval || plen < sizeof(*pval)); | 157 | BUG_ON(!pval || plen < sizeof(*pval)); |
154 | clockidx = (*pval & 0x80) ? 1 : 0; | 158 | clockidx = (*pval & 0x80) ? 1 : 0; |
@@ -177,7 +181,7 @@ static u32 mpc512x_can_get_clock(struct platform_device *ofdev, | |||
177 | clockdiv = 1; | 181 | clockdiv = 1; |
178 | 182 | ||
179 | if (!clock_name || !strcmp(clock_name, "sys")) { | 183 | if (!clock_name || !strcmp(clock_name, "sys")) { |
180 | sys_clk = clk_get(&ofdev->dev, "sys_clk"); | 184 | sys_clk = devm_clk_get(&ofdev->dev, "sys_clk"); |
181 | if (IS_ERR(sys_clk)) { | 185 | if (IS_ERR(sys_clk)) { |
182 | dev_err(&ofdev->dev, "couldn't get sys_clk\n"); | 186 | dev_err(&ofdev->dev, "couldn't get sys_clk\n"); |
183 | goto exit_unmap; | 187 | goto exit_unmap; |
@@ -200,7 +204,7 @@ static u32 mpc512x_can_get_clock(struct platform_device *ofdev, | |||
200 | } | 204 | } |
201 | 205 | ||
202 | if (clocksrc < 0) { | 206 | if (clocksrc < 0) { |
203 | ref_clk = clk_get(&ofdev->dev, "ref_clk"); | 207 | ref_clk = devm_clk_get(&ofdev->dev, "ref_clk"); |
204 | if (IS_ERR(ref_clk)) { | 208 | if (IS_ERR(ref_clk)) { |
205 | dev_err(&ofdev->dev, "couldn't get ref_clk\n"); | 209 | dev_err(&ofdev->dev, "couldn't get ref_clk\n"); |
206 | goto exit_unmap; | 210 | goto exit_unmap; |
@@ -277,6 +281,8 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) | |||
277 | dev = alloc_mscandev(); | 281 | dev = alloc_mscandev(); |
278 | if (!dev) | 282 | if (!dev) |
279 | goto exit_dispose_irq; | 283 | goto exit_dispose_irq; |
284 | platform_set_drvdata(ofdev, dev); | ||
285 | SET_NETDEV_DEV(dev, &ofdev->dev); | ||
280 | 286 | ||
281 | priv = netdev_priv(dev); | 287 | priv = netdev_priv(dev); |
282 | priv->reg_base = base; | 288 | priv->reg_base = base; |
@@ -293,8 +299,6 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) | |||
293 | goto exit_free_mscan; | 299 | goto exit_free_mscan; |
294 | } | 300 | } |
295 | 301 | ||
296 | SET_NETDEV_DEV(dev, &ofdev->dev); | ||
297 | |||
298 | err = register_mscandev(dev, mscan_clksrc); | 302 | err = register_mscandev(dev, mscan_clksrc); |
299 | if (err) { | 303 | if (err) { |
300 | dev_err(&ofdev->dev, "registering %s failed (err=%d)\n", | 304 | dev_err(&ofdev->dev, "registering %s failed (err=%d)\n", |
@@ -302,8 +306,6 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) | |||
302 | goto exit_free_mscan; | 306 | goto exit_free_mscan; |
303 | } | 307 | } |
304 | 308 | ||
305 | platform_set_drvdata(ofdev, dev); | ||
306 | |||
307 | dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n", | 309 | dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n", |
308 | priv->reg_base, dev->irq, priv->can.clock.freq); | 310 | priv->reg_base, dev->irq, priv->can.clock.freq); |
309 | 311 | ||
@@ -321,10 +323,17 @@ exit_unmap_mem: | |||
321 | 323 | ||
322 | static int mpc5xxx_can_remove(struct platform_device *ofdev) | 324 | static int mpc5xxx_can_remove(struct platform_device *ofdev) |
323 | { | 325 | { |
326 | const struct of_device_id *match; | ||
327 | const struct mpc5xxx_can_data *data; | ||
324 | struct net_device *dev = platform_get_drvdata(ofdev); | 328 | struct net_device *dev = platform_get_drvdata(ofdev); |
325 | struct mscan_priv *priv = netdev_priv(dev); | 329 | struct mscan_priv *priv = netdev_priv(dev); |
326 | 330 | ||
331 | match = of_match_device(mpc5xxx_can_table, &ofdev->dev); | ||
332 | data = match ? match->data : NULL; | ||
333 | |||
327 | unregister_mscandev(dev); | 334 | unregister_mscandev(dev); |
335 | if (data && data->put_clock) | ||
336 | data->put_clock(ofdev); | ||
328 | iounmap(priv->reg_base); | 337 | iounmap(priv->reg_base); |
329 | irq_dispose_mapping(dev->irq); | 338 | irq_dispose_mapping(dev->irq); |
330 | free_candev(dev); | 339 | free_candev(dev); |
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c index e6b40954e204..a955ec8c4b97 100644 --- a/drivers/net/can/mscan/mscan.c +++ b/drivers/net/can/mscan/mscan.c | |||
@@ -573,10 +573,21 @@ static int mscan_open(struct net_device *dev) | |||
573 | struct mscan_priv *priv = netdev_priv(dev); | 573 | struct mscan_priv *priv = netdev_priv(dev); |
574 | struct mscan_regs __iomem *regs = priv->reg_base; | 574 | struct mscan_regs __iomem *regs = priv->reg_base; |
575 | 575 | ||
576 | if (priv->clk_ipg) { | ||
577 | ret = clk_prepare_enable(priv->clk_ipg); | ||
578 | if (ret) | ||
579 | goto exit_retcode; | ||
580 | } | ||
581 | if (priv->clk_can) { | ||
582 | ret = clk_prepare_enable(priv->clk_can); | ||
583 | if (ret) | ||
584 | goto exit_dis_ipg_clock; | ||
585 | } | ||
586 | |||
576 | /* common open */ | 587 | /* common open */ |
577 | ret = open_candev(dev); | 588 | ret = open_candev(dev); |
578 | if (ret) | 589 | if (ret) |
579 | return ret; | 590 | goto exit_dis_can_clock; |
580 | 591 | ||
581 | napi_enable(&priv->napi); | 592 | napi_enable(&priv->napi); |
582 | 593 | ||
@@ -604,6 +615,13 @@ exit_free_irq: | |||
604 | exit_napi_disable: | 615 | exit_napi_disable: |
605 | napi_disable(&priv->napi); | 616 | napi_disable(&priv->napi); |
606 | close_candev(dev); | 617 | close_candev(dev); |
618 | exit_dis_can_clock: | ||
619 | if (priv->clk_can) | ||
620 | clk_disable_unprepare(priv->clk_can); | ||
621 | exit_dis_ipg_clock: | ||
622 | if (priv->clk_ipg) | ||
623 | clk_disable_unprepare(priv->clk_ipg); | ||
624 | exit_retcode: | ||
607 | return ret; | 625 | return ret; |
608 | } | 626 | } |
609 | 627 | ||
@@ -621,6 +639,11 @@ static int mscan_close(struct net_device *dev) | |||
621 | close_candev(dev); | 639 | close_candev(dev); |
622 | free_irq(dev->irq, dev); | 640 | free_irq(dev->irq, dev); |
623 | 641 | ||
642 | if (priv->clk_can) | ||
643 | clk_disable_unprepare(priv->clk_can); | ||
644 | if (priv->clk_ipg) | ||
645 | clk_disable_unprepare(priv->clk_ipg); | ||
646 | |||
624 | return 0; | 647 | return 0; |
625 | } | 648 | } |
626 | 649 | ||
diff --git a/drivers/net/can/mscan/mscan.h b/drivers/net/can/mscan/mscan.h index af2ed8baf0a3..9c24d60a23b1 100644 --- a/drivers/net/can/mscan/mscan.h +++ b/drivers/net/can/mscan/mscan.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #ifndef __MSCAN_H__ | 21 | #ifndef __MSCAN_H__ |
22 | #define __MSCAN_H__ | 22 | #define __MSCAN_H__ |
23 | 23 | ||
24 | #include <linux/clk.h> | ||
24 | #include <linux/types.h> | 25 | #include <linux/types.h> |
25 | 26 | ||
26 | /* MSCAN control register 0 (CANCTL0) bits */ | 27 | /* MSCAN control register 0 (CANCTL0) bits */ |
@@ -283,6 +284,8 @@ struct mscan_priv { | |||
283 | unsigned int type; /* MSCAN type variants */ | 284 | unsigned int type; /* MSCAN type variants */ |
284 | unsigned long flags; | 285 | unsigned long flags; |
285 | void __iomem *reg_base; /* ioremap'ed address to registers */ | 286 | void __iomem *reg_base; /* ioremap'ed address to registers */ |
287 | struct clk *clk_ipg; /* clock for registers */ | ||
288 | struct clk *clk_can; /* clock for bitrates */ | ||
286 | u8 shadow_statflg; | 289 | u8 shadow_statflg; |
287 | u8 shadow_canrier; | 290 | u8 shadow_canrier; |
288 | u8 cur_pri; | 291 | u8 cur_pri; |
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 4f8a5357cedc..8142480d9770 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -1184,6 +1184,7 @@ error: | |||
1184 | static int cnic_alloc_bnx2x_context(struct cnic_dev *dev) | 1184 | static int cnic_alloc_bnx2x_context(struct cnic_dev *dev) |
1185 | { | 1185 | { |
1186 | struct cnic_local *cp = dev->cnic_priv; | 1186 | struct cnic_local *cp = dev->cnic_priv; |
1187 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
1187 | int ctx_blk_size = cp->ethdev->ctx_blk_size; | 1188 | int ctx_blk_size = cp->ethdev->ctx_blk_size; |
1188 | int total_mem, blks, i; | 1189 | int total_mem, blks, i; |
1189 | 1190 | ||
@@ -1201,7 +1202,7 @@ static int cnic_alloc_bnx2x_context(struct cnic_dev *dev) | |||
1201 | 1202 | ||
1202 | cp->ctx_blks = blks; | 1203 | cp->ctx_blks = blks; |
1203 | cp->ctx_blk_size = ctx_blk_size; | 1204 | cp->ctx_blk_size = ctx_blk_size; |
1204 | if (!BNX2X_CHIP_IS_57710(cp->chip_id)) | 1205 | if (!CHIP_IS_E1(bp)) |
1205 | cp->ctx_align = 0; | 1206 | cp->ctx_align = 0; |
1206 | else | 1207 | else |
1207 | cp->ctx_align = ctx_blk_size; | 1208 | cp->ctx_align = ctx_blk_size; |
@@ -1231,6 +1232,7 @@ static int cnic_alloc_bnx2x_context(struct cnic_dev *dev) | |||
1231 | static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | 1232 | static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) |
1232 | { | 1233 | { |
1233 | struct cnic_local *cp = dev->cnic_priv; | 1234 | struct cnic_local *cp = dev->cnic_priv; |
1235 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
1234 | struct cnic_eth_dev *ethdev = cp->ethdev; | 1236 | struct cnic_eth_dev *ethdev = cp->ethdev; |
1235 | u32 start_cid = ethdev->starting_cid; | 1237 | u32 start_cid = ethdev->starting_cid; |
1236 | int i, j, n, ret, pages; | 1238 | int i, j, n, ret, pages; |
@@ -1240,7 +1242,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | |||
1240 | cp->iscsi_start_cid = start_cid; | 1242 | cp->iscsi_start_cid = start_cid; |
1241 | cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; | 1243 | cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; |
1242 | 1244 | ||
1243 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { | 1245 | if (BNX2X_CHIP_IS_E2_PLUS(bp)) { |
1244 | cp->max_cid_space += dev->max_fcoe_conn; | 1246 | cp->max_cid_space += dev->max_fcoe_conn; |
1245 | cp->fcoe_init_cid = ethdev->fcoe_init_cid; | 1247 | cp->fcoe_init_cid = ethdev->fcoe_init_cid; |
1246 | if (!cp->fcoe_init_cid) | 1248 | if (!cp->fcoe_init_cid) |
@@ -1288,7 +1290,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | |||
1288 | if (ret) | 1290 | if (ret) |
1289 | goto error; | 1291 | goto error; |
1290 | 1292 | ||
1291 | if (CNIC_SUPPORTS_FCOE(cp)) { | 1293 | if (CNIC_SUPPORTS_FCOE(bp)) { |
1292 | ret = cnic_alloc_kcq(dev, &cp->kcq2, true); | 1294 | ret = cnic_alloc_kcq(dev, &cp->kcq2, true); |
1293 | if (ret) | 1295 | if (ret) |
1294 | goto error; | 1296 | goto error; |
@@ -1382,6 +1384,7 @@ static int cnic_submit_kwqe_16(struct cnic_dev *dev, u32 cmd, u32 cid, | |||
1382 | u32 type, union l5cm_specific_data *l5_data) | 1384 | u32 type, union l5cm_specific_data *l5_data) |
1383 | { | 1385 | { |
1384 | struct cnic_local *cp = dev->cnic_priv; | 1386 | struct cnic_local *cp = dev->cnic_priv; |
1387 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
1385 | struct l5cm_spe kwqe; | 1388 | struct l5cm_spe kwqe; |
1386 | struct kwqe_16 *kwq[1]; | 1389 | struct kwqe_16 *kwq[1]; |
1387 | u16 type_16; | 1390 | u16 type_16; |
@@ -1389,10 +1392,10 @@ static int cnic_submit_kwqe_16(struct cnic_dev *dev, u32 cmd, u32 cid, | |||
1389 | 1392 | ||
1390 | kwqe.hdr.conn_and_cmd_data = | 1393 | kwqe.hdr.conn_and_cmd_data = |
1391 | cpu_to_le32(((cmd << SPE_HDR_CMD_ID_SHIFT) | | 1394 | cpu_to_le32(((cmd << SPE_HDR_CMD_ID_SHIFT) | |
1392 | BNX2X_HW_CID(cp, cid))); | 1395 | BNX2X_HW_CID(bp, cid))); |
1393 | 1396 | ||
1394 | type_16 = (type << SPE_HDR_CONN_TYPE_SHIFT) & SPE_HDR_CONN_TYPE; | 1397 | type_16 = (type << SPE_HDR_CONN_TYPE_SHIFT) & SPE_HDR_CONN_TYPE; |
1395 | type_16 |= (cp->pfid << SPE_HDR_FUNCTION_ID_SHIFT) & | 1398 | type_16 |= (bp->pfid << SPE_HDR_FUNCTION_ID_SHIFT) & |
1396 | SPE_HDR_FUNCTION_ID; | 1399 | SPE_HDR_FUNCTION_ID; |
1397 | 1400 | ||
1398 | kwqe.hdr.type = cpu_to_le16(type_16); | 1401 | kwqe.hdr.type = cpu_to_le16(type_16); |
@@ -1430,7 +1433,6 @@ static void cnic_reply_bnx2x_kcqes(struct cnic_dev *dev, int ulp_type, | |||
1430 | static void cnic_bnx2x_set_tcp_options(struct cnic_dev *dev, int time_stamps, | 1433 | static void cnic_bnx2x_set_tcp_options(struct cnic_dev *dev, int time_stamps, |
1431 | int en_tcp_dack) | 1434 | int en_tcp_dack) |
1432 | { | 1435 | { |
1433 | struct cnic_local *cp = dev->cnic_priv; | ||
1434 | struct bnx2x *bp = netdev_priv(dev->netdev); | 1436 | struct bnx2x *bp = netdev_priv(dev->netdev); |
1435 | u8 xstorm_flags = XSTORM_L5CM_TCP_FLAGS_WND_SCL_EN; | 1437 | u8 xstorm_flags = XSTORM_L5CM_TCP_FLAGS_WND_SCL_EN; |
1436 | u16 tstorm_flags = 0; | 1438 | u16 tstorm_flags = 0; |
@@ -1443,10 +1445,10 @@ static void cnic_bnx2x_set_tcp_options(struct cnic_dev *dev, int time_stamps, | |||
1443 | tstorm_flags |= TSTORM_L5CM_TCP_FLAGS_DELAYED_ACK_EN; | 1445 | tstorm_flags |= TSTORM_L5CM_TCP_FLAGS_DELAYED_ACK_EN; |
1444 | 1446 | ||
1445 | CNIC_WR8(dev, BAR_XSTRORM_INTMEM + | 1447 | CNIC_WR8(dev, BAR_XSTRORM_INTMEM + |
1446 | XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(cp->pfid), xstorm_flags); | 1448 | XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(bp->pfid), xstorm_flags); |
1447 | 1449 | ||
1448 | CNIC_WR16(dev, BAR_TSTRORM_INTMEM + | 1450 | CNIC_WR16(dev, BAR_TSTRORM_INTMEM + |
1449 | TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(cp->pfid), tstorm_flags); | 1451 | TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(bp->pfid), tstorm_flags); |
1450 | } | 1452 | } |
1451 | 1453 | ||
1452 | static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | 1454 | static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) |
@@ -1455,7 +1457,7 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1455 | struct bnx2x *bp = netdev_priv(dev->netdev); | 1457 | struct bnx2x *bp = netdev_priv(dev->netdev); |
1456 | struct iscsi_kwqe_init1 *req1 = (struct iscsi_kwqe_init1 *) kwqe; | 1458 | struct iscsi_kwqe_init1 *req1 = (struct iscsi_kwqe_init1 *) kwqe; |
1457 | int hq_bds, pages; | 1459 | int hq_bds, pages; |
1458 | u32 pfid = cp->pfid; | 1460 | u32 pfid = bp->pfid; |
1459 | 1461 | ||
1460 | cp->num_iscsi_tasks = req1->num_tasks_per_conn; | 1462 | cp->num_iscsi_tasks = req1->num_tasks_per_conn; |
1461 | cp->num_ccells = req1->num_ccells_per_conn; | 1463 | cp->num_ccells = req1->num_ccells_per_conn; |
@@ -1538,9 +1540,8 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1538 | static int cnic_bnx2x_iscsi_init2(struct cnic_dev *dev, struct kwqe *kwqe) | 1540 | static int cnic_bnx2x_iscsi_init2(struct cnic_dev *dev, struct kwqe *kwqe) |
1539 | { | 1541 | { |
1540 | struct iscsi_kwqe_init2 *req2 = (struct iscsi_kwqe_init2 *) kwqe; | 1542 | struct iscsi_kwqe_init2 *req2 = (struct iscsi_kwqe_init2 *) kwqe; |
1541 | struct cnic_local *cp = dev->cnic_priv; | ||
1542 | struct bnx2x *bp = netdev_priv(dev->netdev); | 1543 | struct bnx2x *bp = netdev_priv(dev->netdev); |
1543 | u32 pfid = cp->pfid; | 1544 | u32 pfid = bp->pfid; |
1544 | struct iscsi_kcqe kcqe; | 1545 | struct iscsi_kcqe kcqe; |
1545 | struct kcqe *cqes[1]; | 1546 | struct kcqe *cqes[1]; |
1546 | 1547 | ||
@@ -1679,6 +1680,7 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1679 | u32 num) | 1680 | u32 num) |
1680 | { | 1681 | { |
1681 | struct cnic_local *cp = dev->cnic_priv; | 1682 | struct cnic_local *cp = dev->cnic_priv; |
1683 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
1682 | struct iscsi_kwqe_conn_offload1 *req1 = | 1684 | struct iscsi_kwqe_conn_offload1 *req1 = |
1683 | (struct iscsi_kwqe_conn_offload1 *) wqes[0]; | 1685 | (struct iscsi_kwqe_conn_offload1 *) wqes[0]; |
1684 | struct iscsi_kwqe_conn_offload2 *req2 = | 1686 | struct iscsi_kwqe_conn_offload2 *req2 = |
@@ -1687,11 +1689,11 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1687 | struct cnic_context *ctx = &cp->ctx_tbl[req1->iscsi_conn_id]; | 1689 | struct cnic_context *ctx = &cp->ctx_tbl[req1->iscsi_conn_id]; |
1688 | struct cnic_iscsi *iscsi = ctx->proto.iscsi; | 1690 | struct cnic_iscsi *iscsi = ctx->proto.iscsi; |
1689 | u32 cid = ctx->cid; | 1691 | u32 cid = ctx->cid; |
1690 | u32 hw_cid = BNX2X_HW_CID(cp, cid); | 1692 | u32 hw_cid = BNX2X_HW_CID(bp, cid); |
1691 | struct iscsi_context *ictx; | 1693 | struct iscsi_context *ictx; |
1692 | struct regpair context_addr; | 1694 | struct regpair context_addr; |
1693 | int i, j, n = 2, n_max; | 1695 | int i, j, n = 2, n_max; |
1694 | u8 port = CNIC_PORT(cp); | 1696 | u8 port = BP_PORT(bp); |
1695 | 1697 | ||
1696 | ctx->ctx_flags = 0; | 1698 | ctx->ctx_flags = 0; |
1697 | if (!req2->num_additional_wqes) | 1699 | if (!req2->num_additional_wqes) |
@@ -1745,8 +1747,8 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1745 | XSTORM_ISCSI_CONTEXT_FLAGS_B_INITIAL_R2T; | 1747 | XSTORM_ISCSI_CONTEXT_FLAGS_B_INITIAL_R2T; |
1746 | ictx->xstorm_st_context.common.ethernet.reserved_vlan_type = | 1748 | ictx->xstorm_st_context.common.ethernet.reserved_vlan_type = |
1747 | ETH_P_8021Q; | 1749 | ETH_P_8021Q; |
1748 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) && | 1750 | if (BNX2X_CHIP_IS_E2_PLUS(bp) && |
1749 | cp->port_mode == CHIP_2_PORT_MODE) { | 1751 | bp->common.chip_port_mode == CHIP_2_PORT_MODE) { |
1750 | 1752 | ||
1751 | port = 0; | 1753 | port = 0; |
1752 | } | 1754 | } |
@@ -1867,6 +1869,7 @@ static int cnic_bnx2x_iscsi_ofld1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1867 | struct iscsi_kwqe_conn_offload1 *req1; | 1869 | struct iscsi_kwqe_conn_offload1 *req1; |
1868 | struct iscsi_kwqe_conn_offload2 *req2; | 1870 | struct iscsi_kwqe_conn_offload2 *req2; |
1869 | struct cnic_local *cp = dev->cnic_priv; | 1871 | struct cnic_local *cp = dev->cnic_priv; |
1872 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
1870 | struct cnic_context *ctx; | 1873 | struct cnic_context *ctx; |
1871 | struct iscsi_kcqe kcqe; | 1874 | struct iscsi_kcqe kcqe; |
1872 | struct kcqe *cqes[1]; | 1875 | struct kcqe *cqes[1]; |
@@ -1920,7 +1923,7 @@ static int cnic_bnx2x_iscsi_ofld1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1920 | } | 1923 | } |
1921 | 1924 | ||
1922 | kcqe.completion_status = ISCSI_KCQE_COMPLETION_STATUS_SUCCESS; | 1925 | kcqe.completion_status = ISCSI_KCQE_COMPLETION_STATUS_SUCCESS; |
1923 | kcqe.iscsi_conn_context_id = BNX2X_HW_CID(cp, cp->ctx_tbl[l5_cid].cid); | 1926 | kcqe.iscsi_conn_context_id = BNX2X_HW_CID(bp, cp->ctx_tbl[l5_cid].cid); |
1924 | 1927 | ||
1925 | done: | 1928 | done: |
1926 | cqes[0] = (struct kcqe *) &kcqe; | 1929 | cqes[0] = (struct kcqe *) &kcqe; |
@@ -1956,6 +1959,7 @@ static int cnic_bnx2x_iscsi_update(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1956 | static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid) | 1959 | static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid) |
1957 | { | 1960 | { |
1958 | struct cnic_local *cp = dev->cnic_priv; | 1961 | struct cnic_local *cp = dev->cnic_priv; |
1962 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
1959 | struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; | 1963 | struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; |
1960 | union l5cm_specific_data l5_data; | 1964 | union l5cm_specific_data l5_data; |
1961 | int ret; | 1965 | int ret; |
@@ -1964,7 +1968,7 @@ static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid) | |||
1964 | init_waitqueue_head(&ctx->waitq); | 1968 | init_waitqueue_head(&ctx->waitq); |
1965 | ctx->wait_cond = 0; | 1969 | ctx->wait_cond = 0; |
1966 | memset(&l5_data, 0, sizeof(l5_data)); | 1970 | memset(&l5_data, 0, sizeof(l5_data)); |
1967 | hw_cid = BNX2X_HW_CID(cp, ctx->cid); | 1971 | hw_cid = BNX2X_HW_CID(bp, ctx->cid); |
1968 | 1972 | ||
1969 | ret = cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_COMMON_CFC_DEL, | 1973 | ret = cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_COMMON_CFC_DEL, |
1970 | hw_cid, NONE_CONNECTION_TYPE, &l5_data); | 1974 | hw_cid, NONE_CONNECTION_TYPE, &l5_data); |
@@ -2072,9 +2076,8 @@ static void cnic_init_storm_conn_bufs(struct cnic_dev *dev, | |||
2072 | 2076 | ||
2073 | static void cnic_init_bnx2x_mac(struct cnic_dev *dev) | 2077 | static void cnic_init_bnx2x_mac(struct cnic_dev *dev) |
2074 | { | 2078 | { |
2075 | struct cnic_local *cp = dev->cnic_priv; | ||
2076 | struct bnx2x *bp = netdev_priv(dev->netdev); | 2079 | struct bnx2x *bp = netdev_priv(dev->netdev); |
2077 | u32 pfid = cp->pfid; | 2080 | u32 pfid = bp->pfid; |
2078 | u8 *mac = dev->mac_addr; | 2081 | u8 *mac = dev->mac_addr; |
2079 | 2082 | ||
2080 | CNIC_WR8(dev, BAR_XSTRORM_INTMEM + | 2083 | CNIC_WR8(dev, BAR_XSTRORM_INTMEM + |
@@ -2180,7 +2183,7 @@ static int cnic_bnx2x_connect(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2180 | cnic_init_storm_conn_bufs(dev, kwqe1, kwqe3, conn_buf); | 2183 | cnic_init_storm_conn_bufs(dev, kwqe1, kwqe3, conn_buf); |
2181 | 2184 | ||
2182 | CNIC_WR16(dev, BAR_XSTRORM_INTMEM + | 2185 | CNIC_WR16(dev, BAR_XSTRORM_INTMEM + |
2183 | XSTORM_ISCSI_LOCAL_VLAN_OFFSET(cp->pfid), csk->vlan_id); | 2186 | XSTORM_ISCSI_LOCAL_VLAN_OFFSET(bp->pfid), csk->vlan_id); |
2184 | 2187 | ||
2185 | ret = cnic_submit_kwqe_16(dev, L5CM_RAMROD_CMD_ID_TCP_CONNECT, | 2188 | ret = cnic_submit_kwqe_16(dev, L5CM_RAMROD_CMD_ID_TCP_CONNECT, |
2186 | kwqe1->cid, ISCSI_CONNECTION_TYPE, &l5_data); | 2189 | kwqe1->cid, ISCSI_CONNECTION_TYPE, &l5_data); |
@@ -2249,11 +2252,12 @@ static int cnic_bnx2x_fcoe_stat(struct cnic_dev *dev, struct kwqe *kwqe) | |||
2249 | struct fcoe_stat_ramrod_params *fcoe_stat; | 2252 | struct fcoe_stat_ramrod_params *fcoe_stat; |
2250 | union l5cm_specific_data l5_data; | 2253 | union l5cm_specific_data l5_data; |
2251 | struct cnic_local *cp = dev->cnic_priv; | 2254 | struct cnic_local *cp = dev->cnic_priv; |
2255 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
2252 | int ret; | 2256 | int ret; |
2253 | u32 cid; | 2257 | u32 cid; |
2254 | 2258 | ||
2255 | req = (struct fcoe_kwqe_stat *) kwqe; | 2259 | req = (struct fcoe_kwqe_stat *) kwqe; |
2256 | cid = BNX2X_HW_CID(cp, cp->fcoe_init_cid); | 2260 | cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); |
2257 | 2261 | ||
2258 | fcoe_stat = cnic_get_kwqe_16_data(cp, BNX2X_FCOE_L5_CID_BASE, &l5_data); | 2262 | fcoe_stat = cnic_get_kwqe_16_data(cp, BNX2X_FCOE_L5_CID_BASE, &l5_data); |
2259 | if (!fcoe_stat) | 2263 | if (!fcoe_stat) |
@@ -2272,6 +2276,7 @@ static int cnic_bnx2x_fcoe_init1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2272 | { | 2276 | { |
2273 | int ret; | 2277 | int ret; |
2274 | struct cnic_local *cp = dev->cnic_priv; | 2278 | struct cnic_local *cp = dev->cnic_priv; |
2279 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
2275 | u32 cid; | 2280 | u32 cid; |
2276 | struct fcoe_init_ramrod_params *fcoe_init; | 2281 | struct fcoe_init_ramrod_params *fcoe_init; |
2277 | struct fcoe_kwqe_init1 *req1; | 2282 | struct fcoe_kwqe_init1 *req1; |
@@ -2316,7 +2321,7 @@ static int cnic_bnx2x_fcoe_init1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2316 | fcoe_init->sb_id = HC_INDEX_FCOE_EQ_CONS; | 2321 | fcoe_init->sb_id = HC_INDEX_FCOE_EQ_CONS; |
2317 | cp->kcq2.sw_prod_idx = 0; | 2322 | cp->kcq2.sw_prod_idx = 0; |
2318 | 2323 | ||
2319 | cid = BNX2X_HW_CID(cp, cp->fcoe_init_cid); | 2324 | cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); |
2320 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_INIT_FUNC, cid, | 2325 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_INIT_FUNC, cid, |
2321 | FCOE_CONNECTION_TYPE, &l5_data); | 2326 | FCOE_CONNECTION_TYPE, &l5_data); |
2322 | *work = 3; | 2327 | *work = 3; |
@@ -2329,6 +2334,7 @@ static int cnic_bnx2x_fcoe_ofld1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2329 | int ret = 0; | 2334 | int ret = 0; |
2330 | u32 cid = -1, l5_cid; | 2335 | u32 cid = -1, l5_cid; |
2331 | struct cnic_local *cp = dev->cnic_priv; | 2336 | struct cnic_local *cp = dev->cnic_priv; |
2337 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
2332 | struct fcoe_kwqe_conn_offload1 *req1; | 2338 | struct fcoe_kwqe_conn_offload1 *req1; |
2333 | struct fcoe_kwqe_conn_offload2 *req2; | 2339 | struct fcoe_kwqe_conn_offload2 *req2; |
2334 | struct fcoe_kwqe_conn_offload3 *req3; | 2340 | struct fcoe_kwqe_conn_offload3 *req3; |
@@ -2371,7 +2377,7 @@ static int cnic_bnx2x_fcoe_ofld1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2371 | 2377 | ||
2372 | fctx = cnic_get_bnx2x_ctx(dev, cid, 1, &ctx_addr); | 2378 | fctx = cnic_get_bnx2x_ctx(dev, cid, 1, &ctx_addr); |
2373 | if (fctx) { | 2379 | if (fctx) { |
2374 | u32 hw_cid = BNX2X_HW_CID(cp, cid); | 2380 | u32 hw_cid = BNX2X_HW_CID(bp, cid); |
2375 | u32 val; | 2381 | u32 val; |
2376 | 2382 | ||
2377 | val = CDU_RSRVD_VALUE_TYPE_A(hw_cid, CDU_REGION_NUMBER_XCM_AG, | 2383 | val = CDU_RSRVD_VALUE_TYPE_A(hw_cid, CDU_REGION_NUMBER_XCM_AG, |
@@ -2395,7 +2401,7 @@ static int cnic_bnx2x_fcoe_ofld1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2395 | memcpy(&fcoe_offload->offload_kwqe3, req3, sizeof(*req3)); | 2401 | memcpy(&fcoe_offload->offload_kwqe3, req3, sizeof(*req3)); |
2396 | memcpy(&fcoe_offload->offload_kwqe4, req4, sizeof(*req4)); | 2402 | memcpy(&fcoe_offload->offload_kwqe4, req4, sizeof(*req4)); |
2397 | 2403 | ||
2398 | cid = BNX2X_HW_CID(cp, cid); | 2404 | cid = BNX2X_HW_CID(bp, cid); |
2399 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_OFFLOAD_CONN, cid, | 2405 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_OFFLOAD_CONN, cid, |
2400 | FCOE_CONNECTION_TYPE, &l5_data); | 2406 | FCOE_CONNECTION_TYPE, &l5_data); |
2401 | if (!ret) | 2407 | if (!ret) |
@@ -2553,13 +2559,14 @@ static int cnic_bnx2x_fcoe_fw_destroy(struct cnic_dev *dev, struct kwqe *kwqe) | |||
2553 | struct fcoe_kwqe_destroy *req; | 2559 | struct fcoe_kwqe_destroy *req; |
2554 | union l5cm_specific_data l5_data; | 2560 | union l5cm_specific_data l5_data; |
2555 | struct cnic_local *cp = dev->cnic_priv; | 2561 | struct cnic_local *cp = dev->cnic_priv; |
2562 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
2556 | int ret; | 2563 | int ret; |
2557 | u32 cid; | 2564 | u32 cid; |
2558 | 2565 | ||
2559 | cnic_bnx2x_delete_wait(dev, MAX_ISCSI_TBL_SZ); | 2566 | cnic_bnx2x_delete_wait(dev, MAX_ISCSI_TBL_SZ); |
2560 | 2567 | ||
2561 | req = (struct fcoe_kwqe_destroy *) kwqe; | 2568 | req = (struct fcoe_kwqe_destroy *) kwqe; |
2562 | cid = BNX2X_HW_CID(cp, cp->fcoe_init_cid); | 2569 | cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); |
2563 | 2570 | ||
2564 | memset(&l5_data, 0, sizeof(l5_data)); | 2571 | memset(&l5_data, 0, sizeof(l5_data)); |
2565 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_DESTROY_FUNC, cid, | 2572 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_DESTROY_FUNC, cid, |
@@ -2716,7 +2723,7 @@ static int cnic_submit_bnx2x_iscsi_kwqes(struct cnic_dev *dev, | |||
2716 | static int cnic_submit_bnx2x_fcoe_kwqes(struct cnic_dev *dev, | 2723 | static int cnic_submit_bnx2x_fcoe_kwqes(struct cnic_dev *dev, |
2717 | struct kwqe *wqes[], u32 num_wqes) | 2724 | struct kwqe *wqes[], u32 num_wqes) |
2718 | { | 2725 | { |
2719 | struct cnic_local *cp = dev->cnic_priv; | 2726 | struct bnx2x *bp = netdev_priv(dev->netdev); |
2720 | int i, work, ret; | 2727 | int i, work, ret; |
2721 | u32 opcode; | 2728 | u32 opcode; |
2722 | struct kwqe *kwqe; | 2729 | struct kwqe *kwqe; |
@@ -2724,7 +2731,7 @@ static int cnic_submit_bnx2x_fcoe_kwqes(struct cnic_dev *dev, | |||
2724 | if (!test_bit(CNIC_F_CNIC_UP, &dev->flags)) | 2731 | if (!test_bit(CNIC_F_CNIC_UP, &dev->flags)) |
2725 | return -EAGAIN; /* bnx2 is down */ | 2732 | return -EAGAIN; /* bnx2 is down */ |
2726 | 2733 | ||
2727 | if (!BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) | 2734 | if (!BNX2X_CHIP_IS_E2_PLUS(bp)) |
2728 | return -EINVAL; | 2735 | return -EINVAL; |
2729 | 2736 | ||
2730 | for (i = 0; i < num_wqes; ) { | 2737 | for (i = 0; i < num_wqes; ) { |
@@ -3040,8 +3047,8 @@ static irqreturn_t cnic_irq(int irq, void *dev_instance) | |||
3040 | static inline void cnic_ack_bnx2x_int(struct cnic_dev *dev, u8 id, u8 storm, | 3047 | static inline void cnic_ack_bnx2x_int(struct cnic_dev *dev, u8 id, u8 storm, |
3041 | u16 index, u8 op, u8 update) | 3048 | u16 index, u8 op, u8 update) |
3042 | { | 3049 | { |
3043 | struct cnic_local *cp = dev->cnic_priv; | 3050 | struct bnx2x *bp = netdev_priv(dev->netdev); |
3044 | u32 hc_addr = (HC_REG_COMMAND_REG + CNIC_PORT(cp) * 32 + | 3051 | u32 hc_addr = (HC_REG_COMMAND_REG + BP_PORT(bp) * 32 + |
3045 | COMMAND_REG_INT_ACK); | 3052 | COMMAND_REG_INT_ACK); |
3046 | struct igu_ack_register igu_ack; | 3053 | struct igu_ack_register igu_ack; |
3047 | 3054 | ||
@@ -4218,10 +4225,9 @@ static void cnic_cm_stop_bnx2x_hw(struct cnic_dev *dev) | |||
4218 | 4225 | ||
4219 | static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev) | 4226 | static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev) |
4220 | { | 4227 | { |
4221 | struct cnic_local *cp = dev->cnic_priv; | ||
4222 | struct bnx2x *bp = netdev_priv(dev->netdev); | 4228 | struct bnx2x *bp = netdev_priv(dev->netdev); |
4223 | u32 pfid = cp->pfid; | 4229 | u32 pfid = bp->pfid; |
4224 | u32 port = CNIC_PORT(cp); | 4230 | u32 port = BP_PORT(bp); |
4225 | 4231 | ||
4226 | cnic_init_bnx2x_mac(dev); | 4232 | cnic_init_bnx2x_mac(dev); |
4227 | cnic_bnx2x_set_tcp_options(dev, 0, 1); | 4233 | cnic_bnx2x_set_tcp_options(dev, 0, 1); |
@@ -4902,6 +4908,7 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev, | |||
4902 | struct client_init_ramrod_data *data) | 4908 | struct client_init_ramrod_data *data) |
4903 | { | 4909 | { |
4904 | struct cnic_local *cp = dev->cnic_priv; | 4910 | struct cnic_local *cp = dev->cnic_priv; |
4911 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
4905 | struct cnic_uio_dev *udev = cp->udev; | 4912 | struct cnic_uio_dev *udev = cp->udev; |
4906 | union eth_tx_bd_types *txbd = (union eth_tx_bd_types *) udev->l2_ring; | 4913 | union eth_tx_bd_types *txbd = (union eth_tx_bd_types *) udev->l2_ring; |
4907 | dma_addr_t buf_map, ring_map = udev->l2_ring_map; | 4914 | dma_addr_t buf_map, ring_map = udev->l2_ring_map; |
@@ -4930,7 +4937,7 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev, | |||
4930 | start_bd->general_data &= ~ETH_TX_START_BD_PARSE_NBDS; | 4937 | start_bd->general_data &= ~ETH_TX_START_BD_PARSE_NBDS; |
4931 | start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT); | 4938 | start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT); |
4932 | 4939 | ||
4933 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) | 4940 | if (BNX2X_CHIP_IS_E2_PLUS(bp)) |
4934 | pbd_e2->parsing_data = (UNICAST_ADDRESS << | 4941 | pbd_e2->parsing_data = (UNICAST_ADDRESS << |
4935 | ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT); | 4942 | ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT); |
4936 | else | 4943 | else |
@@ -4967,6 +4974,7 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
4967 | struct client_init_ramrod_data *data) | 4974 | struct client_init_ramrod_data *data) |
4968 | { | 4975 | { |
4969 | struct cnic_local *cp = dev->cnic_priv; | 4976 | struct cnic_local *cp = dev->cnic_priv; |
4977 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
4970 | struct cnic_uio_dev *udev = cp->udev; | 4978 | struct cnic_uio_dev *udev = cp->udev; |
4971 | struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (udev->l2_ring + | 4979 | struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (udev->l2_ring + |
4972 | BNX2_PAGE_SIZE); | 4980 | BNX2_PAGE_SIZE); |
@@ -4975,7 +4983,7 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
4975 | struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; | 4983 | struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; |
4976 | int i; | 4984 | int i; |
4977 | u32 cli = cp->ethdev->iscsi_l2_client_id; | 4985 | u32 cli = cp->ethdev->iscsi_l2_client_id; |
4978 | int cl_qzone_id = BNX2X_CL_QZONE_ID(cp, cli); | 4986 | int cl_qzone_id = BNX2X_CL_QZONE_ID(bp, cli); |
4979 | u32 val; | 4987 | u32 val; |
4980 | dma_addr_t ring_map = udev->l2_ring_map; | 4988 | dma_addr_t ring_map = udev->l2_ring_map; |
4981 | 4989 | ||
@@ -4984,7 +4992,7 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
4984 | data->general.activate_flg = 1; | 4992 | data->general.activate_flg = 1; |
4985 | data->general.sp_client_id = cli; | 4993 | data->general.sp_client_id = cli; |
4986 | data->general.mtu = cpu_to_le16(cp->l2_single_buf_size - 14); | 4994 | data->general.mtu = cpu_to_le16(cp->l2_single_buf_size - 14); |
4987 | data->general.func_id = cp->pfid; | 4995 | data->general.func_id = bp->pfid; |
4988 | 4996 | ||
4989 | for (i = 0; i < BNX2X_MAX_RX_DESC_CNT; i++, rxbd++) { | 4997 | for (i = 0; i < BNX2X_MAX_RX_DESC_CNT; i++, rxbd++) { |
4990 | dma_addr_t buf_map; | 4998 | dma_addr_t buf_map; |
@@ -5034,13 +5042,13 @@ static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) | |||
5034 | { | 5042 | { |
5035 | struct cnic_local *cp = dev->cnic_priv; | 5043 | struct cnic_local *cp = dev->cnic_priv; |
5036 | struct bnx2x *bp = netdev_priv(dev->netdev); | 5044 | struct bnx2x *bp = netdev_priv(dev->netdev); |
5037 | u32 pfid = cp->pfid; | 5045 | u32 pfid = bp->pfid; |
5038 | 5046 | ||
5039 | cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + | 5047 | cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + |
5040 | CSTORM_ISCSI_EQ_PROD_OFFSET(pfid, 0); | 5048 | CSTORM_ISCSI_EQ_PROD_OFFSET(pfid, 0); |
5041 | cp->kcq1.sw_prod_idx = 0; | 5049 | cp->kcq1.sw_prod_idx = 0; |
5042 | 5050 | ||
5043 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { | 5051 | if (BNX2X_CHIP_IS_E2_PLUS(bp)) { |
5044 | struct host_hc_status_block_e2 *sb = cp->status_blk.gen; | 5052 | struct host_hc_status_block_e2 *sb = cp->status_blk.gen; |
5045 | 5053 | ||
5046 | cp->kcq1.hw_prod_idx_ptr = | 5054 | cp->kcq1.hw_prod_idx_ptr = |
@@ -5056,7 +5064,7 @@ static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) | |||
5056 | &sb->sb.running_index[SM_RX_ID]; | 5064 | &sb->sb.running_index[SM_RX_ID]; |
5057 | } | 5065 | } |
5058 | 5066 | ||
5059 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { | 5067 | if (BNX2X_CHIP_IS_E2_PLUS(bp)) { |
5060 | struct host_hc_status_block_e2 *sb = cp->status_blk.gen; | 5068 | struct host_hc_status_block_e2 *sb = cp->status_blk.gen; |
5061 | 5069 | ||
5062 | cp->kcq2.io_addr = BAR_USTRORM_INTMEM + | 5070 | cp->kcq2.io_addr = BAR_USTRORM_INTMEM + |
@@ -5078,12 +5086,10 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev) | |||
5078 | u32 pfid; | 5086 | u32 pfid; |
5079 | 5087 | ||
5080 | dev->stats_addr = ethdev->addr_drv_info_to_mcp; | 5088 | dev->stats_addr = ethdev->addr_drv_info_to_mcp; |
5081 | cp->port_mode = bp->common.chip_port_mode; | ||
5082 | cp->pfid = bp->pfid; | ||
5083 | cp->func = bp->pf_num; | 5089 | cp->func = bp->pf_num; |
5084 | 5090 | ||
5085 | func = CNIC_FUNC(cp); | 5091 | func = CNIC_FUNC(cp); |
5086 | pfid = cp->pfid; | 5092 | pfid = bp->pfid; |
5087 | 5093 | ||
5088 | ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ, | 5094 | ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ, |
5089 | cp->iscsi_start_cid, 0); | 5095 | cp->iscsi_start_cid, 0); |
@@ -5091,7 +5097,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev) | |||
5091 | if (ret) | 5097 | if (ret) |
5092 | return -ENOMEM; | 5098 | return -ENOMEM; |
5093 | 5099 | ||
5094 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { | 5100 | if (BNX2X_CHIP_IS_E2_PLUS(bp)) { |
5095 | ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl, dev->max_fcoe_conn, | 5101 | ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl, dev->max_fcoe_conn, |
5096 | cp->fcoe_start_cid, 0); | 5102 | cp->fcoe_start_cid, 0); |
5097 | 5103 | ||
@@ -5173,12 +5179,12 @@ static void cnic_init_rings(struct cnic_dev *dev) | |||
5173 | rx_prods.cqe_prod = BNX2X_MAX_RCQ_DESC_CNT; | 5179 | rx_prods.cqe_prod = BNX2X_MAX_RCQ_DESC_CNT; |
5174 | barrier(); | 5180 | barrier(); |
5175 | 5181 | ||
5176 | cl_qzone_id = BNX2X_CL_QZONE_ID(cp, cli); | 5182 | cl_qzone_id = BNX2X_CL_QZONE_ID(bp, cli); |
5177 | 5183 | ||
5178 | off = BAR_USTRORM_INTMEM + | 5184 | off = BAR_USTRORM_INTMEM + |
5179 | (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) ? | 5185 | (BNX2X_CHIP_IS_E2_PLUS(bp) ? |
5180 | USTORM_RX_PRODS_E2_OFFSET(cl_qzone_id) : | 5186 | USTORM_RX_PRODS_E2_OFFSET(cl_qzone_id) : |
5181 | USTORM_RX_PRODS_E1X_OFFSET(CNIC_PORT(cp), cli)); | 5187 | USTORM_RX_PRODS_E1X_OFFSET(BP_PORT(bp), cli)); |
5182 | 5188 | ||
5183 | for (i = 0; i < sizeof(struct ustorm_eth_rx_producers) / 4; i++) | 5189 | for (i = 0; i < sizeof(struct ustorm_eth_rx_producers) / 4; i++) |
5184 | CNIC_WR(dev, off + i * 4, ((u32 *) &rx_prods)[i]); | 5190 | CNIC_WR(dev, off + i * 4, ((u32 *) &rx_prods)[i]); |
@@ -5365,7 +5371,7 @@ static void cnic_stop_bnx2x_hw(struct cnic_dev *dev) | |||
5365 | 5371 | ||
5366 | cnic_free_irq(dev); | 5372 | cnic_free_irq(dev); |
5367 | 5373 | ||
5368 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { | 5374 | if (BNX2X_CHIP_IS_E2_PLUS(bp)) { |
5369 | idx_off = offsetof(struct hc_status_block_e2, index_values) + | 5375 | idx_off = offsetof(struct hc_status_block_e2, index_values) + |
5370 | (hc_index * sizeof(u16)); | 5376 | (hc_index * sizeof(u16)); |
5371 | 5377 | ||
@@ -5382,7 +5388,7 @@ static void cnic_stop_bnx2x_hw(struct cnic_dev *dev) | |||
5382 | 5388 | ||
5383 | *cp->kcq1.hw_prod_idx_ptr = 0; | 5389 | *cp->kcq1.hw_prod_idx_ptr = 0; |
5384 | CNIC_WR(dev, BAR_CSTRORM_INTMEM + | 5390 | CNIC_WR(dev, BAR_CSTRORM_INTMEM + |
5385 | CSTORM_ISCSI_EQ_CONS_OFFSET(cp->pfid, 0), 0); | 5391 | CSTORM_ISCSI_EQ_CONS_OFFSET(bp->pfid, 0), 0); |
5386 | CNIC_WR16(dev, cp->kcq1.io_addr, 0); | 5392 | CNIC_WR16(dev, cp->kcq1.io_addr, 0); |
5387 | cnic_free_resc(dev); | 5393 | cnic_free_resc(dev); |
5388 | } | 5394 | } |
@@ -5556,7 +5562,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) | |||
5556 | 5562 | ||
5557 | if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI)) | 5563 | if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI)) |
5558 | cdev->max_iscsi_conn = ethdev->max_iscsi_conn; | 5564 | cdev->max_iscsi_conn = ethdev->max_iscsi_conn; |
5559 | if (CNIC_SUPPORTS_FCOE(cp)) { | 5565 | if (CNIC_SUPPORTS_FCOE(bp)) { |
5560 | cdev->max_fcoe_conn = ethdev->max_fcoe_conn; | 5566 | cdev->max_fcoe_conn = ethdev->max_fcoe_conn; |
5561 | cdev->max_fcoe_exchanges = ethdev->max_fcoe_exchanges; | 5567 | cdev->max_fcoe_exchanges = ethdev->max_fcoe_exchanges; |
5562 | } | 5568 | } |
@@ -5576,7 +5582,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) | |||
5576 | cp->stop_cm = cnic_cm_stop_bnx2x_hw; | 5582 | cp->stop_cm = cnic_cm_stop_bnx2x_hw; |
5577 | cp->enable_int = cnic_enable_bnx2x_int; | 5583 | cp->enable_int = cnic_enable_bnx2x_int; |
5578 | cp->disable_int_sync = cnic_disable_bnx2x_int_sync; | 5584 | cp->disable_int_sync = cnic_disable_bnx2x_int_sync; |
5579 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { | 5585 | if (BNX2X_CHIP_IS_E2_PLUS(bp)) { |
5580 | cp->ack_int = cnic_ack_bnx2x_e2_msix; | 5586 | cp->ack_int = cnic_ack_bnx2x_e2_msix; |
5581 | cp->arm_int = cnic_arm_bnx2x_e2_msix; | 5587 | cp->arm_int = cnic_arm_bnx2x_e2_msix; |
5582 | } else { | 5588 | } else { |
diff --git a/drivers/net/ethernet/broadcom/cnic.h b/drivers/net/ethernet/broadcom/cnic.h index e7a247473596..0121a5d55192 100644 --- a/drivers/net/ethernet/broadcom/cnic.h +++ b/drivers/net/ethernet/broadcom/cnic.h | |||
@@ -303,8 +303,6 @@ struct cnic_local { | |||
303 | 303 | ||
304 | u32 chip_id; | 304 | u32 chip_id; |
305 | int func; | 305 | int func; |
306 | u32 pfid; | ||
307 | u8 port_mode; | ||
308 | 306 | ||
309 | u32 shmem_base; | 307 | u32 shmem_base; |
310 | 308 | ||
@@ -364,47 +362,7 @@ struct bnx2x_bd_chain_next { | |||
364 | 362 | ||
365 | #define BNX2X_FCOE_L5_CID_BASE MAX_ISCSI_TBL_SZ | 363 | #define BNX2X_FCOE_L5_CID_BASE MAX_ISCSI_TBL_SZ |
366 | 364 | ||
367 | #define BNX2X_CHIP_NUM_57710 0x164e | 365 | #define BNX2X_CHIP_IS_E2_PLUS(bp) (CHIP_IS_E2(bp) || CHIP_IS_E3(bp)) |
368 | #define BNX2X_CHIP_NUM_57711 0x164f | ||
369 | #define BNX2X_CHIP_NUM_57711E 0x1650 | ||
370 | #define BNX2X_CHIP_NUM_57712 0x1662 | ||
371 | #define BNX2X_CHIP_NUM_57712E 0x1663 | ||
372 | #define BNX2X_CHIP_NUM_57713 0x1651 | ||
373 | #define BNX2X_CHIP_NUM_57713E 0x1652 | ||
374 | #define BNX2X_CHIP_NUM_57800 0x168a | ||
375 | #define BNX2X_CHIP_NUM_57810 0x168e | ||
376 | #define BNX2X_CHIP_NUM_57840 0x168d | ||
377 | |||
378 | #define BNX2X_CHIP_NUM(x) (x >> 16) | ||
379 | #define BNX2X_CHIP_IS_57710(x) \ | ||
380 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57710) | ||
381 | #define BNX2X_CHIP_IS_57711(x) \ | ||
382 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57711) | ||
383 | #define BNX2X_CHIP_IS_57711E(x) \ | ||
384 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57711E) | ||
385 | #define BNX2X_CHIP_IS_E1H(x) \ | ||
386 | (BNX2X_CHIP_IS_57711(x) || BNX2X_CHIP_IS_57711E(x)) | ||
387 | #define BNX2X_CHIP_IS_57712(x) \ | ||
388 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57712) | ||
389 | #define BNX2X_CHIP_IS_57712E(x) \ | ||
390 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57712E) | ||
391 | #define BNX2X_CHIP_IS_57713(x) \ | ||
392 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57713) | ||
393 | #define BNX2X_CHIP_IS_57713E(x) \ | ||
394 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57713E) | ||
395 | #define BNX2X_CHIP_IS_57800(x) \ | ||
396 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57800) | ||
397 | #define BNX2X_CHIP_IS_57810(x) \ | ||
398 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57810) | ||
399 | #define BNX2X_CHIP_IS_57840(x) \ | ||
400 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57840) | ||
401 | #define BNX2X_CHIP_IS_E2(x) \ | ||
402 | (BNX2X_CHIP_IS_57712(x) || BNX2X_CHIP_IS_57712E(x) || \ | ||
403 | BNX2X_CHIP_IS_57713(x) || BNX2X_CHIP_IS_57713E(x)) | ||
404 | #define BNX2X_CHIP_IS_E3(x) \ | ||
405 | (BNX2X_CHIP_IS_57800(x) || BNX2X_CHIP_IS_57810(x) || \ | ||
406 | BNX2X_CHIP_IS_57840(x)) | ||
407 | #define BNX2X_CHIP_IS_E2_PLUS(x) (BNX2X_CHIP_IS_E2(x) || BNX2X_CHIP_IS_E3(x)) | ||
408 | 366 | ||
409 | #define BNX2X_RX_DESC_CNT (BNX2_PAGE_SIZE / \ | 367 | #define BNX2X_RX_DESC_CNT (BNX2_PAGE_SIZE / \ |
410 | sizeof(struct eth_rx_bd)) | 368 | sizeof(struct eth_rx_bd)) |
@@ -439,31 +397,26 @@ struct bnx2x_bd_chain_next { | |||
439 | #define ETH_MAX_RX_CLIENTS_E2 ETH_MAX_RX_CLIENTS_E1H | 397 | #define ETH_MAX_RX_CLIENTS_E2 ETH_MAX_RX_CLIENTS_E1H |
440 | #endif | 398 | #endif |
441 | 399 | ||
442 | #define CNIC_PORT(cp) ((cp)->pfid & 1) | ||
443 | #define CNIC_FUNC(cp) ((cp)->func) | 400 | #define CNIC_FUNC(cp) ((cp)->func) |
444 | #define CNIC_PATH(cp) (!BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) ? \ | ||
445 | 0 : (CNIC_FUNC(cp) & 1)) | ||
446 | #define CNIC_E1HVN(cp) ((cp)->pfid >> 1) | ||
447 | 401 | ||
448 | #define BNX2X_HW_CID(cp, x) ((CNIC_PORT(cp) << 23) | \ | 402 | #define BNX2X_HW_CID(bp, x) ((BP_PORT(bp) << 23) | \ |
449 | (CNIC_E1HVN(cp) << 17) | (x)) | 403 | (BP_VN(bp) << 17) | (x)) |
450 | 404 | ||
451 | #define BNX2X_SW_CID(x) (x & 0x1ffff) | 405 | #define BNX2X_SW_CID(x) (x & 0x1ffff) |
452 | 406 | ||
453 | #define BNX2X_CL_QZONE_ID(cp, cli) \ | 407 | #define BNX2X_CL_QZONE_ID(bp, cli) \ |
454 | (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) ? cli : \ | 408 | (BNX2X_CHIP_IS_E2_PLUS(bp) ? cli : \ |
455 | cli + (CNIC_PORT(cp) * ETH_MAX_RX_CLIENTS_E1H)) | 409 | cli + (BP_PORT(bp) * ETH_MAX_RX_CLIENTS_E1H)) |
456 | 410 | ||
457 | #ifndef MAX_STAT_COUNTER_ID | 411 | #ifndef MAX_STAT_COUNTER_ID |
458 | #define MAX_STAT_COUNTER_ID \ | 412 | #define MAX_STAT_COUNTER_ID \ |
459 | (BNX2X_CHIP_IS_E1H((cp)->chip_id) ? MAX_STAT_COUNTER_ID_E1H : \ | 413 | (CHIP_IS_E1H(bp) ? MAX_STAT_COUNTER_ID_E1H : \ |
460 | ((BNX2X_CHIP_IS_E2_PLUS((cp)->chip_id)) ? MAX_STAT_COUNTER_ID_E2 :\ | 414 | ((BNX2X_CHIP_IS_E2_PLUS(bp)) ? MAX_STAT_COUNTER_ID_E2 : \ |
461 | MAX_STAT_COUNTER_ID_E1)) | 415 | MAX_STAT_COUNTER_ID_E1)) |
462 | #endif | 416 | #endif |
463 | 417 | ||
464 | #define CNIC_SUPPORTS_FCOE(cp) \ | 418 | #define CNIC_SUPPORTS_FCOE(cp) \ |
465 | (BNX2X_CHIP_IS_E2_PLUS((cp)->chip_id) && \ | 419 | (BNX2X_CHIP_IS_E2_PLUS(bp) && !NO_FCOE(bp)) |
466 | !((cp)->ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE)) | ||
467 | 420 | ||
468 | #define CNIC_RAMROD_TMO (HZ / 4) | 421 | #define CNIC_RAMROD_TMO (HZ / 4) |
469 | 422 | ||
diff --git a/drivers/net/ethernet/broadcom/cnic_if.h b/drivers/net/ethernet/broadcom/cnic_if.h index 95aff7642b85..0658b43e148c 100644 --- a/drivers/net/ethernet/broadcom/cnic_if.h +++ b/drivers/net/ethernet/broadcom/cnic_if.h | |||
@@ -14,8 +14,8 @@ | |||
14 | 14 | ||
15 | #include "bnx2x/bnx2x_mfw_req.h" | 15 | #include "bnx2x/bnx2x_mfw_req.h" |
16 | 16 | ||
17 | #define CNIC_MODULE_VERSION "2.5.17" | 17 | #define CNIC_MODULE_VERSION "2.5.18" |
18 | #define CNIC_MODULE_RELDATE "July 28, 2013" | 18 | #define CNIC_MODULE_RELDATE "Sept 01, 2013" |
19 | 19 | ||
20 | #define CNIC_ULP_RDMA 0 | 20 | #define CNIC_ULP_RDMA 0 |
21 | #define CNIC_ULP_ISCSI 1 | 21 | #define CNIC_ULP_ISCSI 1 |
diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c index 4c830030fb06..2db6c573cec7 100644 --- a/drivers/net/ethernet/dec/tulip/de4x5.c +++ b/drivers/net/ethernet/dec/tulip/de4x5.c | |||
@@ -2319,7 +2319,7 @@ static void de4x5_pci_remove(struct pci_dev *pdev) | |||
2319 | struct net_device *dev; | 2319 | struct net_device *dev; |
2320 | u_long iobase; | 2320 | u_long iobase; |
2321 | 2321 | ||
2322 | dev = dev_get_drvdata(&pdev->dev); | 2322 | dev = pci_get_drvdata(pdev); |
2323 | iobase = dev->base_addr; | 2323 | iobase = dev->base_addr; |
2324 | 2324 | ||
2325 | unregister_netdev (dev); | 2325 | unregister_netdev (dev); |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 52c9085ba5a1..1ab5dab11eff 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -2876,7 +2876,7 @@ int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom) | |||
2876 | } | 2876 | } |
2877 | 2877 | ||
2878 | int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, | 2878 | int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, |
2879 | u32 domain, u16 intf_id) | 2879 | u32 domain, u16 intf_id, u16 hsw_mode) |
2880 | { | 2880 | { |
2881 | struct be_mcc_wrb *wrb; | 2881 | struct be_mcc_wrb *wrb; |
2882 | struct be_cmd_req_set_hsw_config *req; | 2882 | struct be_cmd_req_set_hsw_config *req; |
@@ -2903,6 +2903,13 @@ int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, | |||
2903 | AMAP_SET_BITS(struct amap_set_hsw_context, pvid_valid, ctxt, 1); | 2903 | AMAP_SET_BITS(struct amap_set_hsw_context, pvid_valid, ctxt, 1); |
2904 | AMAP_SET_BITS(struct amap_set_hsw_context, pvid, ctxt, pvid); | 2904 | AMAP_SET_BITS(struct amap_set_hsw_context, pvid, ctxt, pvid); |
2905 | } | 2905 | } |
2906 | if (!BEx_chip(adapter) && hsw_mode) { | ||
2907 | AMAP_SET_BITS(struct amap_set_hsw_context, interface_id, | ||
2908 | ctxt, adapter->hba_port_num); | ||
2909 | AMAP_SET_BITS(struct amap_set_hsw_context, pport, ctxt, 1); | ||
2910 | AMAP_SET_BITS(struct amap_set_hsw_context, port_fwd_type, | ||
2911 | ctxt, hsw_mode); | ||
2912 | } | ||
2906 | 2913 | ||
2907 | be_dws_cpu_to_le(req->context, sizeof(req->context)); | 2914 | be_dws_cpu_to_le(req->context, sizeof(req->context)); |
2908 | status = be_mcc_notify_wait(adapter); | 2915 | status = be_mcc_notify_wait(adapter); |
@@ -2914,7 +2921,7 @@ err: | |||
2914 | 2921 | ||
2915 | /* Get Hyper switch config */ | 2922 | /* Get Hyper switch config */ |
2916 | int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, | 2923 | int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, |
2917 | u32 domain, u16 intf_id) | 2924 | u32 domain, u16 intf_id, u8 *mode) |
2918 | { | 2925 | { |
2919 | struct be_mcc_wrb *wrb; | 2926 | struct be_mcc_wrb *wrb; |
2920 | struct be_cmd_req_get_hsw_config *req; | 2927 | struct be_cmd_req_get_hsw_config *req; |
@@ -2937,9 +2944,15 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, | |||
2937 | OPCODE_COMMON_GET_HSW_CONFIG, sizeof(*req), wrb, NULL); | 2944 | OPCODE_COMMON_GET_HSW_CONFIG, sizeof(*req), wrb, NULL); |
2938 | 2945 | ||
2939 | req->hdr.domain = domain; | 2946 | req->hdr.domain = domain; |
2940 | AMAP_SET_BITS(struct amap_get_hsw_req_context, interface_id, ctxt, | 2947 | AMAP_SET_BITS(struct amap_get_hsw_req_context, interface_id, |
2941 | intf_id); | 2948 | ctxt, intf_id); |
2942 | AMAP_SET_BITS(struct amap_get_hsw_req_context, pvid_valid, ctxt, 1); | 2949 | AMAP_SET_BITS(struct amap_get_hsw_req_context, pvid_valid, ctxt, 1); |
2950 | |||
2951 | if (!BEx_chip(adapter)) { | ||
2952 | AMAP_SET_BITS(struct amap_get_hsw_req_context, interface_id, | ||
2953 | ctxt, adapter->hba_port_num); | ||
2954 | AMAP_SET_BITS(struct amap_get_hsw_req_context, pport, ctxt, 1); | ||
2955 | } | ||
2943 | be_dws_cpu_to_le(req->context, sizeof(req->context)); | 2956 | be_dws_cpu_to_le(req->context, sizeof(req->context)); |
2944 | 2957 | ||
2945 | status = be_mcc_notify_wait(adapter); | 2958 | status = be_mcc_notify_wait(adapter); |
@@ -2950,7 +2963,11 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, | |||
2950 | sizeof(resp->context)); | 2963 | sizeof(resp->context)); |
2951 | vid = AMAP_GET_BITS(struct amap_get_hsw_resp_context, | 2964 | vid = AMAP_GET_BITS(struct amap_get_hsw_resp_context, |
2952 | pvid, &resp->context); | 2965 | pvid, &resp->context); |
2953 | *pvid = le16_to_cpu(vid); | 2966 | if (pvid) |
2967 | *pvid = le16_to_cpu(vid); | ||
2968 | if (mode) | ||
2969 | *mode = AMAP_GET_BITS(struct amap_get_hsw_resp_context, | ||
2970 | port_fwd_type, &resp->context); | ||
2954 | } | 2971 | } |
2955 | 2972 | ||
2956 | err: | 2973 | err: |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 52f3d4ca0056..d026226db88c 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -1533,12 +1533,17 @@ struct be_cmd_req_set_mac_list { | |||
1533 | } __packed; | 1533 | } __packed; |
1534 | 1534 | ||
1535 | /*********************** HSW Config ***********************/ | 1535 | /*********************** HSW Config ***********************/ |
1536 | #define PORT_FWD_TYPE_VEPA 0x3 | ||
1537 | #define PORT_FWD_TYPE_VEB 0x2 | ||
1538 | |||
1536 | struct amap_set_hsw_context { | 1539 | struct amap_set_hsw_context { |
1537 | u8 interface_id[16]; | 1540 | u8 interface_id[16]; |
1538 | u8 rsvd0[14]; | 1541 | u8 rsvd0[14]; |
1539 | u8 pvid_valid; | 1542 | u8 pvid_valid; |
1540 | u8 rsvd1; | 1543 | u8 pport; |
1541 | u8 rsvd2[16]; | 1544 | u8 rsvd1[6]; |
1545 | u8 port_fwd_type[3]; | ||
1546 | u8 rsvd2[7]; | ||
1542 | u8 pvid[16]; | 1547 | u8 pvid[16]; |
1543 | u8 rsvd3[32]; | 1548 | u8 rsvd3[32]; |
1544 | u8 rsvd4[32]; | 1549 | u8 rsvd4[32]; |
@@ -1563,7 +1568,9 @@ struct amap_get_hsw_req_context { | |||
1563 | } __packed; | 1568 | } __packed; |
1564 | 1569 | ||
1565 | struct amap_get_hsw_resp_context { | 1570 | struct amap_get_hsw_resp_context { |
1566 | u8 rsvd1[16]; | 1571 | u8 rsvd0[6]; |
1572 | u8 port_fwd_type[3]; | ||
1573 | u8 rsvd1[7]; | ||
1567 | u8 pvid[16]; | 1574 | u8 pvid[16]; |
1568 | u8 rsvd2[32]; | 1575 | u8 rsvd2[32]; |
1569 | u8 rsvd3[32]; | 1576 | u8 rsvd3[32]; |
@@ -1965,9 +1972,9 @@ extern int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, | |||
1965 | extern int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, | 1972 | extern int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, |
1966 | u32 dom); | 1973 | u32 dom); |
1967 | extern int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, | 1974 | extern int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, |
1968 | u32 domain, u16 intf_id); | 1975 | u32 domain, u16 intf_id, u16 hsw_mode); |
1969 | extern int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, | 1976 | extern int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, |
1970 | u32 domain, u16 intf_id); | 1977 | u32 domain, u16 intf_id, u8 *mode); |
1971 | extern int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter); | 1978 | extern int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter); |
1972 | extern int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter, | 1979 | extern int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter, |
1973 | struct be_dma_mem *cmd); | 1980 | struct be_dma_mem *cmd); |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 39e0a7697a81..e104db7fcf27 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "be_cmds.h" | 21 | #include "be_cmds.h" |
22 | #include <asm/div64.h> | 22 | #include <asm/div64.h> |
23 | #include <linux/aer.h> | 23 | #include <linux/aer.h> |
24 | #include <linux/if_bridge.h> | ||
24 | 25 | ||
25 | MODULE_VERSION(DRV_VER); | 26 | MODULE_VERSION(DRV_VER); |
26 | MODULE_DEVICE_TABLE(pci, be_dev_ids); | 27 | MODULE_DEVICE_TABLE(pci, be_dev_ids); |
@@ -1212,14 +1213,14 @@ static int be_set_vf_vlan(struct net_device *netdev, | |||
1212 | adapter->vf_cfg[vf].vlan_tag = vlan; | 1213 | adapter->vf_cfg[vf].vlan_tag = vlan; |
1213 | 1214 | ||
1214 | status = be_cmd_set_hsw_config(adapter, vlan, | 1215 | status = be_cmd_set_hsw_config(adapter, vlan, |
1215 | vf + 1, adapter->vf_cfg[vf].if_handle); | 1216 | vf + 1, adapter->vf_cfg[vf].if_handle, 0); |
1216 | } | 1217 | } |
1217 | } else { | 1218 | } else { |
1218 | /* Reset Transparent Vlan Tagging. */ | 1219 | /* Reset Transparent Vlan Tagging. */ |
1219 | adapter->vf_cfg[vf].vlan_tag = 0; | 1220 | adapter->vf_cfg[vf].vlan_tag = 0; |
1220 | vlan = adapter->vf_cfg[vf].def_vid; | 1221 | vlan = adapter->vf_cfg[vf].def_vid; |
1221 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, | 1222 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, |
1222 | adapter->vf_cfg[vf].if_handle); | 1223 | adapter->vf_cfg[vf].if_handle, 0); |
1223 | } | 1224 | } |
1224 | 1225 | ||
1225 | 1226 | ||
@@ -2917,7 +2918,7 @@ static int be_vf_setup(struct be_adapter *adapter) | |||
2917 | vf_cfg->tx_rate = lnk_speed; | 2918 | vf_cfg->tx_rate = lnk_speed; |
2918 | 2919 | ||
2919 | status = be_cmd_get_hsw_config(adapter, &def_vlan, | 2920 | status = be_cmd_get_hsw_config(adapter, &def_vlan, |
2920 | vf + 1, vf_cfg->if_handle); | 2921 | vf + 1, vf_cfg->if_handle, NULL); |
2921 | if (status) | 2922 | if (status) |
2922 | goto err; | 2923 | goto err; |
2923 | vf_cfg->def_vid = def_vlan; | 2924 | vf_cfg->def_vid = def_vlan; |
@@ -3795,6 +3796,74 @@ fw_exit: | |||
3795 | return status; | 3796 | return status; |
3796 | } | 3797 | } |
3797 | 3798 | ||
3799 | static int be_ndo_bridge_setlink(struct net_device *dev, | ||
3800 | struct nlmsghdr *nlh) | ||
3801 | { | ||
3802 | struct be_adapter *adapter = netdev_priv(dev); | ||
3803 | struct nlattr *attr, *br_spec; | ||
3804 | int rem; | ||
3805 | int status = 0; | ||
3806 | u16 mode = 0; | ||
3807 | |||
3808 | if (!sriov_enabled(adapter)) | ||
3809 | return -EOPNOTSUPP; | ||
3810 | |||
3811 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); | ||
3812 | |||
3813 | nla_for_each_nested(attr, br_spec, rem) { | ||
3814 | if (nla_type(attr) != IFLA_BRIDGE_MODE) | ||
3815 | continue; | ||
3816 | |||
3817 | mode = nla_get_u16(attr); | ||
3818 | if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) | ||
3819 | return -EINVAL; | ||
3820 | |||
3821 | status = be_cmd_set_hsw_config(adapter, 0, 0, | ||
3822 | adapter->if_handle, | ||
3823 | mode == BRIDGE_MODE_VEPA ? | ||
3824 | PORT_FWD_TYPE_VEPA : | ||
3825 | PORT_FWD_TYPE_VEB); | ||
3826 | if (status) | ||
3827 | goto err; | ||
3828 | |||
3829 | dev_info(&adapter->pdev->dev, "enabled switch mode: %s\n", | ||
3830 | mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); | ||
3831 | |||
3832 | return status; | ||
3833 | } | ||
3834 | err: | ||
3835 | dev_err(&adapter->pdev->dev, "Failed to set switch mode %s\n", | ||
3836 | mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); | ||
3837 | |||
3838 | return status; | ||
3839 | } | ||
3840 | |||
3841 | static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, | ||
3842 | struct net_device *dev, | ||
3843 | u32 filter_mask) | ||
3844 | { | ||
3845 | struct be_adapter *adapter = netdev_priv(dev); | ||
3846 | int status = 0; | ||
3847 | u8 hsw_mode; | ||
3848 | |||
3849 | if (!sriov_enabled(adapter)) | ||
3850 | return 0; | ||
3851 | |||
3852 | /* BE and Lancer chips support VEB mode only */ | ||
3853 | if (BEx_chip(adapter) || lancer_chip(adapter)) { | ||
3854 | hsw_mode = PORT_FWD_TYPE_VEB; | ||
3855 | } else { | ||
3856 | status = be_cmd_get_hsw_config(adapter, NULL, 0, | ||
3857 | adapter->if_handle, &hsw_mode); | ||
3858 | if (status) | ||
3859 | return 0; | ||
3860 | } | ||
3861 | |||
3862 | return ndo_dflt_bridge_getlink(skb, pid, seq, dev, | ||
3863 | hsw_mode == PORT_FWD_TYPE_VEPA ? | ||
3864 | BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB); | ||
3865 | } | ||
3866 | |||
3798 | static const struct net_device_ops be_netdev_ops = { | 3867 | static const struct net_device_ops be_netdev_ops = { |
3799 | .ndo_open = be_open, | 3868 | .ndo_open = be_open, |
3800 | .ndo_stop = be_close, | 3869 | .ndo_stop = be_close, |
@@ -3813,6 +3882,8 @@ static const struct net_device_ops be_netdev_ops = { | |||
3813 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3882 | #ifdef CONFIG_NET_POLL_CONTROLLER |
3814 | .ndo_poll_controller = be_netpoll, | 3883 | .ndo_poll_controller = be_netpoll, |
3815 | #endif | 3884 | #endif |
3885 | .ndo_bridge_setlink = be_ndo_bridge_setlink, | ||
3886 | .ndo_bridge_getlink = be_ndo_bridge_getlink, | ||
3816 | }; | 3887 | }; |
3817 | 3888 | ||
3818 | static void be_netdev_init(struct net_device *netdev) | 3889 | static void be_netdev_init(struct net_device *netdev) |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index b2c91dcd245f..c4eaadeb572f 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -2092,7 +2092,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2092 | int do_tstamp, do_csum, do_vlan; | 2092 | int do_tstamp, do_csum, do_vlan; |
2093 | u32 bufaddr; | 2093 | u32 bufaddr; |
2094 | unsigned long flags; | 2094 | unsigned long flags; |
2095 | unsigned int nr_frags, nr_txbds, length, fcb_len = 0; | 2095 | unsigned int nr_frags, nr_txbds, bytes_sent, fcb_len = 0; |
2096 | 2096 | ||
2097 | rq = skb->queue_mapping; | 2097 | rq = skb->queue_mapping; |
2098 | tx_queue = priv->tx_queue[rq]; | 2098 | tx_queue = priv->tx_queue[rq]; |
@@ -2147,7 +2147,10 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2147 | } | 2147 | } |
2148 | 2148 | ||
2149 | /* Update transmit stats */ | 2149 | /* Update transmit stats */ |
2150 | tx_queue->stats.tx_bytes += skb->len; | 2150 | bytes_sent = skb->len; |
2151 | tx_queue->stats.tx_bytes += bytes_sent; | ||
2152 | /* keep Tx bytes on wire for BQL accounting */ | ||
2153 | GFAR_CB(skb)->bytes_sent = bytes_sent; | ||
2151 | tx_queue->stats.tx_packets++; | 2154 | tx_queue->stats.tx_packets++; |
2152 | 2155 | ||
2153 | txbdp = txbdp_start = tx_queue->cur_tx; | 2156 | txbdp = txbdp_start = tx_queue->cur_tx; |
@@ -2167,12 +2170,13 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2167 | } else { | 2170 | } else { |
2168 | /* Place the fragment addresses and lengths into the TxBDs */ | 2171 | /* Place the fragment addresses and lengths into the TxBDs */ |
2169 | for (i = 0; i < nr_frags; i++) { | 2172 | for (i = 0; i < nr_frags; i++) { |
2173 | unsigned int frag_len; | ||
2170 | /* Point at the next BD, wrapping as needed */ | 2174 | /* Point at the next BD, wrapping as needed */ |
2171 | txbdp = next_txbd(txbdp, base, tx_queue->tx_ring_size); | 2175 | txbdp = next_txbd(txbdp, base, tx_queue->tx_ring_size); |
2172 | 2176 | ||
2173 | length = skb_shinfo(skb)->frags[i].size; | 2177 | frag_len = skb_shinfo(skb)->frags[i].size; |
2174 | 2178 | ||
2175 | lstatus = txbdp->lstatus | length | | 2179 | lstatus = txbdp->lstatus | frag_len | |
2176 | BD_LFLAG(TXBD_READY); | 2180 | BD_LFLAG(TXBD_READY); |
2177 | 2181 | ||
2178 | /* Handle the last BD specially */ | 2182 | /* Handle the last BD specially */ |
@@ -2182,7 +2186,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2182 | bufaddr = skb_frag_dma_map(priv->dev, | 2186 | bufaddr = skb_frag_dma_map(priv->dev, |
2183 | &skb_shinfo(skb)->frags[i], | 2187 | &skb_shinfo(skb)->frags[i], |
2184 | 0, | 2188 | 0, |
2185 | length, | 2189 | frag_len, |
2186 | DMA_TO_DEVICE); | 2190 | DMA_TO_DEVICE); |
2187 | 2191 | ||
2188 | /* set the TxBD length and buffer pointer */ | 2192 | /* set the TxBD length and buffer pointer */ |
@@ -2250,7 +2254,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2250 | lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb); | 2254 | lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb); |
2251 | } | 2255 | } |
2252 | 2256 | ||
2253 | netdev_tx_sent_queue(txq, skb->len); | 2257 | netdev_tx_sent_queue(txq, bytes_sent); |
2254 | 2258 | ||
2255 | /* We can work in parallel with gfar_clean_tx_ring(), except | 2259 | /* We can work in parallel with gfar_clean_tx_ring(), except |
2256 | * when modifying num_txbdfree. Note that we didn't grab the lock | 2260 | * when modifying num_txbdfree. Note that we didn't grab the lock |
@@ -2570,7 +2574,7 @@ static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) | |||
2570 | bdp = next_txbd(bdp, base, tx_ring_size); | 2574 | bdp = next_txbd(bdp, base, tx_ring_size); |
2571 | } | 2575 | } |
2572 | 2576 | ||
2573 | bytes_sent += skb->len; | 2577 | bytes_sent += GFAR_CB(skb)->bytes_sent; |
2574 | 2578 | ||
2575 | dev_kfree_skb_any(skb); | 2579 | dev_kfree_skb_any(skb); |
2576 | 2580 | ||
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h index 46f56f36118f..04112b98ff5d 100644 --- a/drivers/net/ethernet/freescale/gianfar.h +++ b/drivers/net/ethernet/freescale/gianfar.h | |||
@@ -575,7 +575,7 @@ struct rxfcb { | |||
575 | }; | 575 | }; |
576 | 576 | ||
577 | struct gianfar_skb_cb { | 577 | struct gianfar_skb_cb { |
578 | int alignamount; | 578 | unsigned int bytes_sent; /* bytes-on-wire (i.e. no FCB) */ |
579 | }; | 579 | }; |
580 | 580 | ||
581 | #define GFAR_CB(skb) ((struct gianfar_skb_cb *)((skb)->cb)) | 581 | #define GFAR_CB(skb) ((struct gianfar_skb_cb *)((skb)->cb)) |
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 2d3b064d6924..6b5c7222342c 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c | |||
@@ -2312,7 +2312,7 @@ static int emac_check_deps(struct emac_instance *dev, | |||
2312 | if (deps[i].ofdev == NULL) | 2312 | if (deps[i].ofdev == NULL) |
2313 | continue; | 2313 | continue; |
2314 | if (deps[i].drvdata == NULL) | 2314 | if (deps[i].drvdata == NULL) |
2315 | deps[i].drvdata = dev_get_drvdata(&deps[i].ofdev->dev); | 2315 | deps[i].drvdata = platform_get_drvdata(deps[i].ofdev); |
2316 | if (deps[i].drvdata != NULL) | 2316 | if (deps[i].drvdata != NULL) |
2317 | there++; | 2317 | there++; |
2318 | } | 2318 | } |
@@ -2799,9 +2799,9 @@ static int emac_probe(struct platform_device *ofdev) | |||
2799 | /* display more info about what's missing ? */ | 2799 | /* display more info about what's missing ? */ |
2800 | goto err_reg_unmap; | 2800 | goto err_reg_unmap; |
2801 | } | 2801 | } |
2802 | dev->mal = dev_get_drvdata(&dev->mal_dev->dev); | 2802 | dev->mal = platform_get_drvdata(dev->mal_dev); |
2803 | if (dev->mdio_dev != NULL) | 2803 | if (dev->mdio_dev != NULL) |
2804 | dev->mdio_instance = dev_get_drvdata(&dev->mdio_dev->dev); | 2804 | dev->mdio_instance = platform_get_drvdata(dev->mdio_dev); |
2805 | 2805 | ||
2806 | /* Register with MAL */ | 2806 | /* Register with MAL */ |
2807 | dev->commac.ops = &emac_commac_ops; | 2807 | dev->commac.ops = &emac_commac_ops; |
@@ -2892,7 +2892,7 @@ static int emac_probe(struct platform_device *ofdev) | |||
2892 | * fully initialized | 2892 | * fully initialized |
2893 | */ | 2893 | */ |
2894 | wmb(); | 2894 | wmb(); |
2895 | dev_set_drvdata(&ofdev->dev, dev); | 2895 | platform_set_drvdata(ofdev, dev); |
2896 | 2896 | ||
2897 | /* There's a new kid in town ! Let's tell everybody */ | 2897 | /* There's a new kid in town ! Let's tell everybody */ |
2898 | wake_up_all(&emac_probe_wait); | 2898 | wake_up_all(&emac_probe_wait); |
@@ -2951,7 +2951,7 @@ static int emac_probe(struct platform_device *ofdev) | |||
2951 | 2951 | ||
2952 | static int emac_remove(struct platform_device *ofdev) | 2952 | static int emac_remove(struct platform_device *ofdev) |
2953 | { | 2953 | { |
2954 | struct emac_instance *dev = dev_get_drvdata(&ofdev->dev); | 2954 | struct emac_instance *dev = platform_get_drvdata(ofdev); |
2955 | 2955 | ||
2956 | DBG(dev, "remove" NL); | 2956 | DBG(dev, "remove" NL); |
2957 | 2957 | ||
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 70fd55968844..5d41aee69d16 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
@@ -106,7 +106,7 @@ struct ibmveth_stat ibmveth_stats[] = { | |||
106 | /* simple methods of getting data from the current rxq entry */ | 106 | /* simple methods of getting data from the current rxq entry */ |
107 | static inline u32 ibmveth_rxq_flags(struct ibmveth_adapter *adapter) | 107 | static inline u32 ibmveth_rxq_flags(struct ibmveth_adapter *adapter) |
108 | { | 108 | { |
109 | return adapter->rx_queue.queue_addr[adapter->rx_queue.index].flags_off; | 109 | return be32_to_cpu(adapter->rx_queue.queue_addr[adapter->rx_queue.index].flags_off); |
110 | } | 110 | } |
111 | 111 | ||
112 | static inline int ibmveth_rxq_toggle(struct ibmveth_adapter *adapter) | 112 | static inline int ibmveth_rxq_toggle(struct ibmveth_adapter *adapter) |
@@ -132,7 +132,7 @@ static inline int ibmveth_rxq_frame_offset(struct ibmveth_adapter *adapter) | |||
132 | 132 | ||
133 | static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter) | 133 | static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter) |
134 | { | 134 | { |
135 | return adapter->rx_queue.queue_addr[adapter->rx_queue.index].length; | 135 | return be32_to_cpu(adapter->rx_queue.queue_addr[adapter->rx_queue.index].length); |
136 | } | 136 | } |
137 | 137 | ||
138 | static inline int ibmveth_rxq_csum_good(struct ibmveth_adapter *adapter) | 138 | static inline int ibmveth_rxq_csum_good(struct ibmveth_adapter *adapter) |
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h index 43a794fab9ff..84066bafe057 100644 --- a/drivers/net/ethernet/ibm/ibmveth.h +++ b/drivers/net/ethernet/ibm/ibmveth.h | |||
@@ -164,14 +164,26 @@ struct ibmveth_adapter { | |||
164 | u64 tx_send_failed; | 164 | u64 tx_send_failed; |
165 | }; | 165 | }; |
166 | 166 | ||
167 | /* | ||
168 | * We pass struct ibmveth_buf_desc_fields to the hypervisor in registers, | ||
169 | * so we don't need to byteswap the two elements. However since we use | ||
170 | * a union (ibmveth_buf_desc) to convert from the struct to a u64 we | ||
171 | * do end up with endian specific ordering of the elements and that | ||
172 | * needs correcting. | ||
173 | */ | ||
167 | struct ibmveth_buf_desc_fields { | 174 | struct ibmveth_buf_desc_fields { |
175 | #ifdef __BIG_ENDIAN | ||
176 | u32 flags_len; | ||
177 | u32 address; | ||
178 | #else | ||
179 | u32 address; | ||
168 | u32 flags_len; | 180 | u32 flags_len; |
181 | #endif | ||
169 | #define IBMVETH_BUF_VALID 0x80000000 | 182 | #define IBMVETH_BUF_VALID 0x80000000 |
170 | #define IBMVETH_BUF_TOGGLE 0x40000000 | 183 | #define IBMVETH_BUF_TOGGLE 0x40000000 |
171 | #define IBMVETH_BUF_NO_CSUM 0x02000000 | 184 | #define IBMVETH_BUF_NO_CSUM 0x02000000 |
172 | #define IBMVETH_BUF_CSUM_GOOD 0x01000000 | 185 | #define IBMVETH_BUF_CSUM_GOOD 0x01000000 |
173 | #define IBMVETH_BUF_LEN_MASK 0x00FFFFFF | 186 | #define IBMVETH_BUF_LEN_MASK 0x00FFFFFF |
174 | u32 address; | ||
175 | }; | 187 | }; |
176 | 188 | ||
177 | union ibmveth_buf_desc { | 189 | union ibmveth_buf_desc { |
@@ -180,7 +192,7 @@ union ibmveth_buf_desc { | |||
180 | }; | 192 | }; |
181 | 193 | ||
182 | struct ibmveth_rx_q_entry { | 194 | struct ibmveth_rx_q_entry { |
183 | u32 flags_off; | 195 | __be32 flags_off; |
184 | #define IBMVETH_RXQ_TOGGLE 0x80000000 | 196 | #define IBMVETH_RXQ_TOGGLE 0x80000000 |
185 | #define IBMVETH_RXQ_TOGGLE_SHIFT 31 | 197 | #define IBMVETH_RXQ_TOGGLE_SHIFT 31 |
186 | #define IBMVETH_RXQ_VALID 0x40000000 | 198 | #define IBMVETH_RXQ_VALID 0x40000000 |
@@ -188,7 +200,8 @@ struct ibmveth_rx_q_entry { | |||
188 | #define IBMVETH_RXQ_CSUM_GOOD 0x01000000 | 200 | #define IBMVETH_RXQ_CSUM_GOOD 0x01000000 |
189 | #define IBMVETH_RXQ_OFF_MASK 0x0000FFFF | 201 | #define IBMVETH_RXQ_OFF_MASK 0x0000FFFF |
190 | 202 | ||
191 | u32 length; | 203 | __be32 length; |
204 | /* correlator is only used by the OS, no need to byte swap */ | ||
192 | u64 correlator; | 205 | u64 correlator; |
193 | }; | 206 | }; |
194 | 207 | ||
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 1f5166ad6bb5..59a62bbfb371 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -488,8 +488,8 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, | |||
488 | * source pruning. | 488 | * source pruning. |
489 | */ | 489 | */ |
490 | if ((skb->pkt_type & (PACKET_BROADCAST | PACKET_MULTICAST)) && | 490 | if ((skb->pkt_type & (PACKET_BROADCAST | PACKET_MULTICAST)) && |
491 | !(compare_ether_addr(adapter->netdev->dev_addr, | 491 | ether_addr_equal(adapter->netdev->dev_addr, |
492 | eth_hdr(skb)->h_source))) { | 492 | eth_hdr(skb)->h_source)) { |
493 | dev_kfree_skb_irq(skb); | 493 | dev_kfree_skb_irq(skb); |
494 | goto next_desc; | 494 | goto next_desc; |
495 | } | 495 | } |
diff --git a/drivers/net/ethernet/netx-eth.c b/drivers/net/ethernet/netx-eth.c index 235fd51100aa..e6f0a4366f90 100644 --- a/drivers/net/ethernet/netx-eth.c +++ b/drivers/net/ethernet/netx-eth.c | |||
@@ -390,7 +390,7 @@ static int netx_eth_drv_probe(struct platform_device *pdev) | |||
390 | 390 | ||
391 | priv = netdev_priv(ndev); | 391 | priv = netdev_priv(ndev); |
392 | 392 | ||
393 | pdata = (struct netxeth_platform_data *)dev_get_platdata(&pdev->dev); | 393 | pdata = dev_get_platdata(&pdev->dev); |
394 | priv->xc = request_xc(pdata->xcno, &pdev->dev); | 394 | priv->xc = request_xc(pdata->xcno, &pdev->dev); |
395 | if (!priv->xc) { | 395 | if (!priv->xc) { |
396 | dev_err(&pdev->dev, "unable to request xc engine\n"); | 396 | dev_err(&pdev->dev, "unable to request xc engine\n"); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c index 2e10e7922cfe..d62d5ce432ec 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | |||
@@ -248,7 +248,7 @@ static inline void __qlcnic_init_dcbnl_ops(struct qlcnic_adapter *adapter) | |||
248 | adapter->netdev->dcbnl_ops = &qlcnic_dcbnl_ops; | 248 | adapter->netdev->dcbnl_ops = &qlcnic_dcbnl_ops; |
249 | } | 249 | } |
250 | 250 | ||
251 | void qlcnic_set_dcb_ops(struct qlcnic_adapter *adapter) | 251 | static void qlcnic_set_dcb_ops(struct qlcnic_adapter *adapter) |
252 | { | 252 | { |
253 | if (qlcnic_82xx_check(adapter)) | 253 | if (qlcnic_82xx_check(adapter)) |
254 | adapter->dcb->ops = &qlcnic_82xx_dcb_ops; | 254 | adapter->dcb->ops = &qlcnic_82xx_dcb_ops; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 332aa71798f6..4d7ad0074d1c 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -1709,7 +1709,7 @@ qlcnic_set_dump(struct net_device *netdev, struct ethtool_dump *val) | |||
1709 | qlcnic_dev_request_reset(adapter, val->flag); | 1709 | qlcnic_dev_request_reset(adapter, val->flag); |
1710 | adapter->flags &= ~QLCNIC_FW_RESET_OWNER; | 1710 | adapter->flags &= ~QLCNIC_FW_RESET_OWNER; |
1711 | break; | 1711 | break; |
1712 | ; | 1712 | |
1713 | case QLCNIC_SET_QUIESCENT: | 1713 | case QLCNIC_SET_QUIESCENT: |
1714 | case QLCNIC_RESET_QUIESCENT: | 1714 | case QLCNIC_RESET_QUIESCENT: |
1715 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); | 1715 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index a9bc651e9ffa..330d9a8774ad 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -1652,14 +1652,14 @@ int qlcnic_sriov_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) | |||
1652 | if (!is_valid_ether_addr(mac) || vf >= num_vfs) | 1652 | if (!is_valid_ether_addr(mac) || vf >= num_vfs) |
1653 | return -EINVAL; | 1653 | return -EINVAL; |
1654 | 1654 | ||
1655 | if (!compare_ether_addr(adapter->mac_addr, mac)) { | 1655 | if (ether_addr_equal(adapter->mac_addr, mac)) { |
1656 | netdev_err(netdev, "MAC address is already in use by the PF\n"); | 1656 | netdev_err(netdev, "MAC address is already in use by the PF\n"); |
1657 | return -EINVAL; | 1657 | return -EINVAL; |
1658 | } | 1658 | } |
1659 | 1659 | ||
1660 | for (i = 0; i < num_vfs; i++) { | 1660 | for (i = 0; i < num_vfs; i++) { |
1661 | vf_info = &sriov->vf_info[i]; | 1661 | vf_info = &sriov->vf_info[i]; |
1662 | if (!compare_ether_addr(vf_info->vp->mac, mac)) { | 1662 | if (ether_addr_equal(vf_info->vp->mac, mac)) { |
1663 | netdev_err(netdev, | 1663 | netdev_err(netdev, |
1664 | "MAC address is already in use by VF %d\n", | 1664 | "MAC address is already in use by VF %d\n", |
1665 | i); | 1665 | i); |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 06d8f62626e4..474c8a86a2af 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -416,6 +416,7 @@ static struct sh_eth_cpu_data r8a7790_data = { | |||
416 | .tpauser = 1, | 416 | .tpauser = 1, |
417 | .hw_swap = 1, | 417 | .hw_swap = 1, |
418 | .rmiimode = 1, | 418 | .rmiimode = 1, |
419 | .shift_rd0 = 1, | ||
419 | }; | 420 | }; |
420 | 421 | ||
421 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) | 422 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) |
@@ -1342,6 +1343,9 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1342 | mdp->rx_skbuff[entry] = NULL; | 1343 | mdp->rx_skbuff[entry] = NULL; |
1343 | if (mdp->cd->rpadir) | 1344 | if (mdp->cd->rpadir) |
1344 | skb_reserve(skb, NET_IP_ALIGN); | 1345 | skb_reserve(skb, NET_IP_ALIGN); |
1346 | dma_sync_single_for_cpu(&ndev->dev, rxdesc->addr, | ||
1347 | mdp->rx_buf_sz, | ||
1348 | DMA_FROM_DEVICE); | ||
1345 | skb_put(skb, pkt_len); | 1349 | skb_put(skb, pkt_len); |
1346 | skb->protocol = eth_type_trans(skb, ndev); | 1350 | skb->protocol = eth_type_trans(skb, ndev); |
1347 | netif_rx(skb); | 1351 | netif_rx(skb); |
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index c67e683a36e1..e37b587b3860 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c | |||
@@ -2798,7 +2798,7 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe) | |||
2798 | goto err_out_free_coherent; | 2798 | goto err_out_free_coherent; |
2799 | } | 2799 | } |
2800 | 2800 | ||
2801 | dev_set_drvdata(&op->dev, hp); | 2801 | platform_set_drvdata(op, hp); |
2802 | 2802 | ||
2803 | if (qfe_slot != -1) | 2803 | if (qfe_slot != -1) |
2804 | printk(KERN_INFO "%s: Quattro HME slot %d (SBUS) 10/100baseT Ethernet ", | 2804 | printk(KERN_INFO "%s: Quattro HME slot %d (SBUS) 10/100baseT Ethernet ", |
@@ -3111,7 +3111,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, | |||
3111 | goto err_out_iounmap; | 3111 | goto err_out_iounmap; |
3112 | } | 3112 | } |
3113 | 3113 | ||
3114 | dev_set_drvdata(&pdev->dev, hp); | 3114 | pci_set_drvdata(pdev, hp); |
3115 | 3115 | ||
3116 | if (!qfe_slot) { | 3116 | if (!qfe_slot) { |
3117 | struct pci_dev *qpdev = qp->quattro_dev; | 3117 | struct pci_dev *qpdev = qp->quattro_dev; |
@@ -3159,7 +3159,7 @@ err_out: | |||
3159 | 3159 | ||
3160 | static void happy_meal_pci_remove(struct pci_dev *pdev) | 3160 | static void happy_meal_pci_remove(struct pci_dev *pdev) |
3161 | { | 3161 | { |
3162 | struct happy_meal *hp = dev_get_drvdata(&pdev->dev); | 3162 | struct happy_meal *hp = pci_get_drvdata(pdev); |
3163 | struct net_device *net_dev = hp->dev; | 3163 | struct net_device *net_dev = hp->dev; |
3164 | 3164 | ||
3165 | unregister_netdev(net_dev); | 3165 | unregister_netdev(net_dev); |
@@ -3171,7 +3171,7 @@ static void happy_meal_pci_remove(struct pci_dev *pdev) | |||
3171 | 3171 | ||
3172 | free_netdev(net_dev); | 3172 | free_netdev(net_dev); |
3173 | 3173 | ||
3174 | dev_set_drvdata(&pdev->dev, NULL); | 3174 | pci_set_drvdata(pdev, NULL); |
3175 | } | 3175 | } |
3176 | 3176 | ||
3177 | static DEFINE_PCI_DEVICE_TABLE(happymeal_pci_ids) = { | 3177 | static DEFINE_PCI_DEVICE_TABLE(happymeal_pci_ids) = { |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 5d2a719fc688..949076f4e6ae 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
@@ -544,7 +544,7 @@ static inline bool filter_packet(struct net_device *dev, void *buf) | |||
544 | /* Filter out packets that aren't for us. */ | 544 | /* Filter out packets that aren't for us. */ |
545 | if (!(dev->flags & IFF_PROMISC) && | 545 | if (!(dev->flags & IFF_PROMISC) && |
546 | !is_multicast_ether_addr(buf) && | 546 | !is_multicast_ether_addr(buf) && |
547 | compare_ether_addr(dev->dev_addr, buf) != 0) | 547 | !ether_addr_equal(dev->dev_addr, buf)) |
548 | return true; | 548 | return true; |
549 | 549 | ||
550 | return false; | 550 | return false; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 201ef1712ef5..64dfaa303dcc 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -823,7 +823,7 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | |||
823 | if (port->count) | 823 | if (port->count) |
824 | return -EINVAL; | 824 | return -EINVAL; |
825 | port->passthru = true; | 825 | port->passthru = true; |
826 | memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN); | 826 | eth_hw_addr_inherit(dev, lowerdev); |
827 | } | 827 | } |
828 | 828 | ||
829 | err = netdev_upper_dev_link(lowerdev, dev); | 829 | err = netdev_upper_dev_link(lowerdev, dev); |
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 4822aafe638b..dcb21347c670 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -102,6 +102,7 @@ struct netconsole_target { | |||
102 | struct config_item item; | 102 | struct config_item item; |
103 | #endif | 103 | #endif |
104 | int enabled; | 104 | int enabled; |
105 | struct mutex mutex; | ||
105 | struct netpoll np; | 106 | struct netpoll np; |
106 | }; | 107 | }; |
107 | 108 | ||
@@ -181,6 +182,7 @@ static struct netconsole_target *alloc_param_target(char *target_config) | |||
181 | strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ); | 182 | strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ); |
182 | nt->np.local_port = 6665; | 183 | nt->np.local_port = 6665; |
183 | nt->np.remote_port = 6666; | 184 | nt->np.remote_port = 6666; |
185 | mutex_init(&nt->mutex); | ||
184 | memset(nt->np.remote_mac, 0xff, ETH_ALEN); | 186 | memset(nt->np.remote_mac, 0xff, ETH_ALEN); |
185 | 187 | ||
186 | /* Parse parameters and setup netpoll */ | 188 | /* Parse parameters and setup netpoll */ |
@@ -322,6 +324,7 @@ static ssize_t store_enabled(struct netconsole_target *nt, | |||
322 | return -EINVAL; | 324 | return -EINVAL; |
323 | } | 325 | } |
324 | 326 | ||
327 | mutex_lock(&nt->mutex); | ||
325 | if (enabled) { /* 1 */ | 328 | if (enabled) { /* 1 */ |
326 | 329 | ||
327 | /* | 330 | /* |
@@ -331,8 +334,10 @@ static ssize_t store_enabled(struct netconsole_target *nt, | |||
331 | netpoll_print_options(&nt->np); | 334 | netpoll_print_options(&nt->np); |
332 | 335 | ||
333 | err = netpoll_setup(&nt->np); | 336 | err = netpoll_setup(&nt->np); |
334 | if (err) | 337 | if (err) { |
338 | mutex_unlock(&nt->mutex); | ||
335 | return err; | 339 | return err; |
340 | } | ||
336 | 341 | ||
337 | printk(KERN_INFO "netconsole: network logging started\n"); | 342 | printk(KERN_INFO "netconsole: network logging started\n"); |
338 | 343 | ||
@@ -341,6 +346,7 @@ static ssize_t store_enabled(struct netconsole_target *nt, | |||
341 | } | 346 | } |
342 | 347 | ||
343 | nt->enabled = enabled; | 348 | nt->enabled = enabled; |
349 | mutex_unlock(&nt->mutex); | ||
344 | 350 | ||
345 | return strnlen(buf, count); | 351 | return strnlen(buf, count); |
346 | } | 352 | } |
@@ -597,6 +603,7 @@ static struct config_item *make_netconsole_target(struct config_group *group, | |||
597 | strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ); | 603 | strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ); |
598 | nt->np.local_port = 6665; | 604 | nt->np.local_port = 6665; |
599 | nt->np.remote_port = 6666; | 605 | nt->np.remote_port = 6666; |
606 | mutex_init(&nt->mutex); | ||
600 | memset(nt->np.remote_mac, 0xff, ETH_ALEN); | 607 | memset(nt->np.remote_mac, 0xff, ETH_ALEN); |
601 | 608 | ||
602 | /* Initialize the config_item member */ | 609 | /* Initialize the config_item member */ |
@@ -682,7 +689,11 @@ restart: | |||
682 | * we might sleep in __netpoll_cleanup() | 689 | * we might sleep in __netpoll_cleanup() |
683 | */ | 690 | */ |
684 | spin_unlock_irqrestore(&target_list_lock, flags); | 691 | spin_unlock_irqrestore(&target_list_lock, flags); |
692 | |||
693 | mutex_lock(&nt->mutex); | ||
685 | __netpoll_cleanup(&nt->np); | 694 | __netpoll_cleanup(&nt->np); |
695 | mutex_unlock(&nt->mutex); | ||
696 | |||
686 | spin_lock_irqsave(&target_list_lock, flags); | 697 | spin_lock_irqsave(&target_list_lock, flags); |
687 | dev_put(nt->np.dev); | 698 | dev_put(nt->np.dev); |
688 | nt->np.dev = NULL; | 699 | nt->np.dev = NULL; |
diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c index 7f18f80e87c9..6aee02ed97ac 100644 --- a/drivers/net/phy/mdio-octeon.c +++ b/drivers/net/phy/mdio-octeon.c | |||
@@ -244,7 +244,7 @@ static int octeon_mdiobus_remove(struct platform_device *pdev) | |||
244 | struct octeon_mdiobus *bus; | 244 | struct octeon_mdiobus *bus; |
245 | union cvmx_smix_en smi_en; | 245 | union cvmx_smix_en smi_en; |
246 | 246 | ||
247 | bus = dev_get_drvdata(&pdev->dev); | 247 | bus = platform_get_drvdata(pdev); |
248 | 248 | ||
249 | mdiobus_unregister(bus->mii_bus); | 249 | mdiobus_unregister(bus->mii_bus); |
250 | mdiobus_free(bus->mii_bus); | 250 | mdiobus_free(bus->mii_bus); |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 9ccccd40c410..50e43e64d51d 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -1974,7 +1974,7 @@ static void team_setup_by_port(struct net_device *dev, | |||
1974 | dev->addr_len = port_dev->addr_len; | 1974 | dev->addr_len = port_dev->addr_len; |
1975 | dev->mtu = port_dev->mtu; | 1975 | dev->mtu = port_dev->mtu; |
1976 | memcpy(dev->broadcast, port_dev->broadcast, port_dev->addr_len); | 1976 | memcpy(dev->broadcast, port_dev->broadcast, port_dev->addr_len); |
1977 | memcpy(dev->dev_addr, port_dev->dev_addr, port_dev->addr_len); | 1977 | eth_hw_addr_inherit(dev, port_dev); |
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | static int team_dev_type_check_change(struct net_device *dev, | 1980 | static int team_dev_type_check_change(struct net_device *dev, |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index d84bfd4109a4..40db31233313 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -268,6 +268,14 @@ config USB_NET_DM9601 | |||
268 | This option adds support for Davicom DM9601 based USB 1.1 | 268 | This option adds support for Davicom DM9601 based USB 1.1 |
269 | 10/100 Ethernet adapters. | 269 | 10/100 Ethernet adapters. |
270 | 270 | ||
271 | config USB_NET_SR9700 | ||
272 | tristate "CoreChip-sz SR9700 based USB 1.1 10/100 ethernet devices" | ||
273 | depends on USB_USBNET | ||
274 | select CRC32 | ||
275 | help | ||
276 | This option adds support for CoreChip-sz SR9700 based USB 1.1 | ||
277 | 10/100 Ethernet adapters. | ||
278 | |||
271 | config USB_NET_SMSC75XX | 279 | config USB_NET_SMSC75XX |
272 | tristate "SMSC LAN75XX based USB 2.0 gigabit ethernet devices" | 280 | tristate "SMSC LAN75XX based USB 2.0 gigabit ethernet devices" |
273 | depends on USB_USBNET | 281 | depends on USB_USBNET |
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile index e8171784529d..8b342cf992fd 100644 --- a/drivers/net/usb/Makefile +++ b/drivers/net/usb/Makefile | |||
@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o | |||
14 | obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o r815x.o | 14 | obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o r815x.o |
15 | obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o | 15 | obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o |
16 | obj-$(CONFIG_USB_NET_DM9601) += dm9601.o | 16 | obj-$(CONFIG_USB_NET_DM9601) += dm9601.o |
17 | obj-$(CONFIG_USB_NET_SR9700) += sr9700.o | ||
17 | obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o | 18 | obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o |
18 | obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o | 19 | obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o |
19 | obj-$(CONFIG_USB_NET_GL620A) += gl620a.o | 20 | obj-$(CONFIG_USB_NET_GL620A) += gl620a.o |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 606eba2872bd..3a8131582e75 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -323,7 +323,7 @@ next_desc: | |||
323 | /* Never use the same address on both ends of the link, even | 323 | /* Never use the same address on both ends of the link, even |
324 | * if the buggy firmware told us to. | 324 | * if the buggy firmware told us to. |
325 | */ | 325 | */ |
326 | if (!compare_ether_addr(dev->net->dev_addr, default_modem_addr)) | 326 | if (ether_addr_equal(dev->net->dev_addr, default_modem_addr)) |
327 | eth_hw_addr_random(dev->net); | 327 | eth_hw_addr_random(dev->net); |
328 | 328 | ||
329 | /* make MAC addr easily distinguishable from an IP header */ | 329 | /* make MAC addr easily distinguishable from an IP header */ |
diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c new file mode 100644 index 000000000000..7ec3e0ee0783 --- /dev/null +++ b/drivers/net/usb/sr9700.c | |||
@@ -0,0 +1,560 @@ | |||
1 | /* | ||
2 | * CoreChip-sz SR9700 one chip USB 1.1 Ethernet Devices | ||
3 | * | ||
4 | * Author : Liu Junliang <liujunliang_ljl@163.com> | ||
5 | * | ||
6 | * Based on dm9601.c | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public License | ||
9 | * version 2. This program is licensed "as is" without any warranty of any | ||
10 | * kind, whether express or implied. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/stddef.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/netdevice.h> | ||
18 | #include <linux/etherdevice.h> | ||
19 | #include <linux/ethtool.h> | ||
20 | #include <linux/mii.h> | ||
21 | #include <linux/usb.h> | ||
22 | #include <linux/crc32.h> | ||
23 | #include <linux/usb/usbnet.h> | ||
24 | |||
25 | #include "sr9700.h" | ||
26 | |||
27 | static int sr_read(struct usbnet *dev, u8 reg, u16 length, void *data) | ||
28 | { | ||
29 | int err; | ||
30 | |||
31 | err = usbnet_read_cmd(dev, SR_RD_REGS, SR_REQ_RD_REG, 0, reg, data, | ||
32 | length); | ||
33 | if ((err != length) && (err >= 0)) | ||
34 | err = -EINVAL; | ||
35 | return err; | ||
36 | } | ||
37 | |||
38 | static int sr_write(struct usbnet *dev, u8 reg, u16 length, void *data) | ||
39 | { | ||
40 | int err; | ||
41 | |||
42 | err = usbnet_write_cmd(dev, SR_WR_REGS, SR_REQ_WR_REG, 0, reg, data, | ||
43 | length); | ||
44 | if ((err >= 0) && (err < length)) | ||
45 | err = -EINVAL; | ||
46 | return err; | ||
47 | } | ||
48 | |||
49 | static int sr_read_reg(struct usbnet *dev, u8 reg, u8 *value) | ||
50 | { | ||
51 | return sr_read(dev, reg, 1, value); | ||
52 | } | ||
53 | |||
54 | static int sr_write_reg(struct usbnet *dev, u8 reg, u8 value) | ||
55 | { | ||
56 | return usbnet_write_cmd(dev, SR_WR_REGS, SR_REQ_WR_REG, | ||
57 | value, reg, NULL, 0); | ||
58 | } | ||
59 | |||
60 | static void sr_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) | ||
61 | { | ||
62 | usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG, | ||
63 | 0, reg, data, length); | ||
64 | } | ||
65 | |||
66 | static void sr_write_reg_async(struct usbnet *dev, u8 reg, u8 value) | ||
67 | { | ||
68 | usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG, | ||
69 | value, reg, NULL, 0); | ||
70 | } | ||
71 | |||
72 | static int wait_phy_eeprom_ready(struct usbnet *dev, int phy) | ||
73 | { | ||
74 | int i; | ||
75 | |||
76 | for (i = 0; i < SR_SHARE_TIMEOUT; i++) { | ||
77 | u8 tmp = 0; | ||
78 | int ret; | ||
79 | |||
80 | udelay(1); | ||
81 | ret = sr_read_reg(dev, EPCR, &tmp); | ||
82 | if (ret < 0) | ||
83 | return ret; | ||
84 | |||
85 | /* ready */ | ||
86 | if (!(tmp & EPCR_ERRE)) | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | netdev_err(dev->net, "%s write timed out!\n", phy ? "phy" : "eeprom"); | ||
91 | |||
92 | return -EIO; | ||
93 | } | ||
94 | |||
95 | static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg, | ||
96 | __le16 *value) | ||
97 | { | ||
98 | int ret; | ||
99 | |||
100 | mutex_lock(&dev->phy_mutex); | ||
101 | |||
102 | sr_write_reg(dev, EPAR, phy ? (reg | EPAR_PHY_ADR) : reg); | ||
103 | sr_write_reg(dev, EPCR, phy ? (EPCR_EPOS | EPCR_ERPRR) : EPCR_ERPRR); | ||
104 | |||
105 | ret = wait_phy_eeprom_ready(dev, phy); | ||
106 | if (ret < 0) | ||
107 | goto out_unlock; | ||
108 | |||
109 | sr_write_reg(dev, EPCR, 0x0); | ||
110 | ret = sr_read(dev, EPDR, 2, value); | ||
111 | |||
112 | netdev_dbg(dev->net, "read shared %d 0x%02x returned 0x%04x, %d\n", | ||
113 | phy, reg, *value, ret); | ||
114 | |||
115 | out_unlock: | ||
116 | mutex_unlock(&dev->phy_mutex); | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | static int sr_share_write_word(struct usbnet *dev, int phy, u8 reg, | ||
121 | __le16 value) | ||
122 | { | ||
123 | int ret; | ||
124 | |||
125 | mutex_lock(&dev->phy_mutex); | ||
126 | |||
127 | ret = sr_write(dev, EPDR, 2, &value); | ||
128 | if (ret < 0) | ||
129 | goto out_unlock; | ||
130 | |||
131 | sr_write_reg(dev, EPAR, phy ? (reg | EPAR_PHY_ADR) : reg); | ||
132 | sr_write_reg(dev, EPCR, phy ? (EPCR_WEP | EPCR_EPOS | EPCR_ERPRW) : | ||
133 | (EPCR_WEP | EPCR_ERPRW)); | ||
134 | |||
135 | ret = wait_phy_eeprom_ready(dev, phy); | ||
136 | if (ret < 0) | ||
137 | goto out_unlock; | ||
138 | |||
139 | sr_write_reg(dev, EPCR, 0x0); | ||
140 | |||
141 | out_unlock: | ||
142 | mutex_unlock(&dev->phy_mutex); | ||
143 | return ret; | ||
144 | } | ||
145 | |||
146 | static int sr_read_eeprom_word(struct usbnet *dev, u8 offset, void *value) | ||
147 | { | ||
148 | return sr_share_read_word(dev, 0, offset, value); | ||
149 | } | ||
150 | |||
151 | static int sr9700_get_eeprom_len(struct net_device *netdev) | ||
152 | { | ||
153 | return SR_EEPROM_LEN; | ||
154 | } | ||
155 | |||
156 | static int sr9700_get_eeprom(struct net_device *netdev, | ||
157 | struct ethtool_eeprom *eeprom, u8 *data) | ||
158 | { | ||
159 | struct usbnet *dev = netdev_priv(netdev); | ||
160 | __le16 *buf = (__le16 *)data; | ||
161 | int ret = 0; | ||
162 | int i; | ||
163 | |||
164 | /* access is 16bit */ | ||
165 | if ((eeprom->offset & 0x01) || (eeprom->len & 0x01)) | ||
166 | return -EINVAL; | ||
167 | |||
168 | for (i = 0; i < eeprom->len / 2; i++) { | ||
169 | ret = sr_read_eeprom_word(dev, eeprom->offset / 2 + i, buf + i); | ||
170 | if (ret < 0) | ||
171 | break; | ||
172 | } | ||
173 | |||
174 | return ret; | ||
175 | } | ||
176 | |||
177 | static int sr_mdio_read(struct net_device *netdev, int phy_id, int loc) | ||
178 | { | ||
179 | struct usbnet *dev = netdev_priv(netdev); | ||
180 | __le16 res; | ||
181 | int rc = 0; | ||
182 | |||
183 | if (phy_id) { | ||
184 | netdev_dbg(netdev, "Only internal phy supported\n"); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | /* Access NSR_LINKST bit for link status instead of MII_BMSR */ | ||
189 | if (loc == MII_BMSR) { | ||
190 | u8 value; | ||
191 | |||
192 | sr_read_reg(dev, NSR, &value); | ||
193 | if (value & NSR_LINKST) | ||
194 | rc = 1; | ||
195 | } | ||
196 | sr_share_read_word(dev, 1, loc, &res); | ||
197 | if (rc == 1) | ||
198 | res = le16_to_cpu(res) | BMSR_LSTATUS; | ||
199 | else | ||
200 | res = le16_to_cpu(res) & ~BMSR_LSTATUS; | ||
201 | |||
202 | netdev_dbg(netdev, "sr_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n", | ||
203 | phy_id, loc, res); | ||
204 | |||
205 | return res; | ||
206 | } | ||
207 | |||
208 | static void sr_mdio_write(struct net_device *netdev, int phy_id, int loc, | ||
209 | int val) | ||
210 | { | ||
211 | struct usbnet *dev = netdev_priv(netdev); | ||
212 | __le16 res = cpu_to_le16(val); | ||
213 | |||
214 | if (phy_id) { | ||
215 | netdev_dbg(netdev, "Only internal phy supported\n"); | ||
216 | return; | ||
217 | } | ||
218 | |||
219 | netdev_dbg(netdev, "sr_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x\n", | ||
220 | phy_id, loc, val); | ||
221 | |||
222 | sr_share_write_word(dev, 1, loc, res); | ||
223 | } | ||
224 | |||
225 | static u32 sr9700_get_link(struct net_device *netdev) | ||
226 | { | ||
227 | struct usbnet *dev = netdev_priv(netdev); | ||
228 | u8 value = 0; | ||
229 | int rc = 0; | ||
230 | |||
231 | /* Get the Link Status directly */ | ||
232 | sr_read_reg(dev, NSR, &value); | ||
233 | if (value & NSR_LINKST) | ||
234 | rc = 1; | ||
235 | |||
236 | return rc; | ||
237 | } | ||
238 | |||
239 | static int sr9700_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) | ||
240 | { | ||
241 | struct usbnet *dev = netdev_priv(netdev); | ||
242 | |||
243 | return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); | ||
244 | } | ||
245 | |||
246 | static const struct ethtool_ops sr9700_ethtool_ops = { | ||
247 | .get_drvinfo = usbnet_get_drvinfo, | ||
248 | .get_link = sr9700_get_link, | ||
249 | .get_msglevel = usbnet_get_msglevel, | ||
250 | .set_msglevel = usbnet_set_msglevel, | ||
251 | .get_eeprom_len = sr9700_get_eeprom_len, | ||
252 | .get_eeprom = sr9700_get_eeprom, | ||
253 | .get_settings = usbnet_get_settings, | ||
254 | .set_settings = usbnet_set_settings, | ||
255 | .nway_reset = usbnet_nway_reset, | ||
256 | }; | ||
257 | |||
258 | static void sr9700_set_multicast(struct net_device *netdev) | ||
259 | { | ||
260 | struct usbnet *dev = netdev_priv(netdev); | ||
261 | /* We use the 20 byte dev->data for our 8 byte filter buffer | ||
262 | * to avoid allocating memory that is tricky to free later | ||
263 | */ | ||
264 | u8 *hashes = (u8 *)&dev->data; | ||
265 | /* rx_ctl setting : enable, disable_long, disable_crc */ | ||
266 | u8 rx_ctl = RCR_RXEN | RCR_DIS_CRC | RCR_DIS_LONG; | ||
267 | |||
268 | memset(hashes, 0x00, SR_MCAST_SIZE); | ||
269 | /* broadcast address */ | ||
270 | hashes[SR_MCAST_SIZE - 1] |= SR_MCAST_ADDR_FLAG; | ||
271 | if (netdev->flags & IFF_PROMISC) { | ||
272 | rx_ctl |= RCR_PRMSC; | ||
273 | } else if (netdev->flags & IFF_ALLMULTI || | ||
274 | netdev_mc_count(netdev) > SR_MCAST_MAX) { | ||
275 | rx_ctl |= RCR_RUNT; | ||
276 | } else if (!netdev_mc_empty(netdev)) { | ||
277 | struct netdev_hw_addr *ha; | ||
278 | |||
279 | netdev_for_each_mc_addr(ha, netdev) { | ||
280 | u32 crc = ether_crc(ETH_ALEN, ha->addr) >> 26; | ||
281 | hashes[crc >> 3] |= 1 << (crc & 0x7); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | sr_write_async(dev, MAR, SR_MCAST_SIZE, hashes); | ||
286 | sr_write_reg_async(dev, RCR, rx_ctl); | ||
287 | } | ||
288 | |||
289 | static int sr9700_set_mac_address(struct net_device *netdev, void *p) | ||
290 | { | ||
291 | struct usbnet *dev = netdev_priv(netdev); | ||
292 | struct sockaddr *addr = p; | ||
293 | |||
294 | if (!is_valid_ether_addr(addr->sa_data)) { | ||
295 | netdev_err(netdev, "not setting invalid mac address %pM\n", | ||
296 | addr->sa_data); | ||
297 | return -EINVAL; | ||
298 | } | ||
299 | |||
300 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | ||
301 | sr_write_async(dev, PAR, 6, netdev->dev_addr); | ||
302 | |||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | static const struct net_device_ops sr9700_netdev_ops = { | ||
307 | .ndo_open = usbnet_open, | ||
308 | .ndo_stop = usbnet_stop, | ||
309 | .ndo_start_xmit = usbnet_start_xmit, | ||
310 | .ndo_tx_timeout = usbnet_tx_timeout, | ||
311 | .ndo_change_mtu = usbnet_change_mtu, | ||
312 | .ndo_validate_addr = eth_validate_addr, | ||
313 | .ndo_do_ioctl = sr9700_ioctl, | ||
314 | .ndo_set_rx_mode = sr9700_set_multicast, | ||
315 | .ndo_set_mac_address = sr9700_set_mac_address, | ||
316 | }; | ||
317 | |||
318 | static int sr9700_bind(struct usbnet *dev, struct usb_interface *intf) | ||
319 | { | ||
320 | struct net_device *netdev; | ||
321 | struct mii_if_info *mii; | ||
322 | int ret; | ||
323 | |||
324 | ret = usbnet_get_endpoints(dev, intf); | ||
325 | if (ret) | ||
326 | goto out; | ||
327 | |||
328 | netdev = dev->net; | ||
329 | |||
330 | netdev->netdev_ops = &sr9700_netdev_ops; | ||
331 | netdev->ethtool_ops = &sr9700_ethtool_ops; | ||
332 | netdev->hard_header_len += SR_TX_OVERHEAD; | ||
333 | dev->hard_mtu = netdev->mtu + netdev->hard_header_len; | ||
334 | /* bulkin buffer is preferably not less than 3K */ | ||
335 | dev->rx_urb_size = 3072; | ||
336 | |||
337 | mii = &dev->mii; | ||
338 | mii->dev = netdev; | ||
339 | mii->mdio_read = sr_mdio_read; | ||
340 | mii->mdio_write = sr_mdio_write; | ||
341 | mii->phy_id_mask = 0x1f; | ||
342 | mii->reg_num_mask = 0x1f; | ||
343 | |||
344 | sr_write_reg(dev, NCR, NCR_RST); | ||
345 | udelay(20); | ||
346 | |||
347 | /* read MAC | ||
348 | * After Chip Power on, the Chip will reload the MAC from | ||
349 | * EEPROM automatically to PAR. In case there is no EEPROM externally, | ||
350 | * a default MAC address is stored in PAR for making chip work properly. | ||
351 | */ | ||
352 | if (sr_read(dev, PAR, ETH_ALEN, netdev->dev_addr) < 0) { | ||
353 | netdev_err(netdev, "Error reading MAC address\n"); | ||
354 | ret = -ENODEV; | ||
355 | goto out; | ||
356 | } | ||
357 | |||
358 | /* power up and reset phy */ | ||
359 | sr_write_reg(dev, PRR, PRR_PHY_RST); | ||
360 | /* at least 10ms, here 20ms for safe */ | ||
361 | mdelay(20); | ||
362 | sr_write_reg(dev, PRR, 0); | ||
363 | /* at least 1ms, here 2ms for reading right register */ | ||
364 | udelay(2 * 1000); | ||
365 | |||
366 | /* receive broadcast packets */ | ||
367 | sr9700_set_multicast(netdev); | ||
368 | |||
369 | sr_mdio_write(netdev, mii->phy_id, MII_BMCR, BMCR_RESET); | ||
370 | sr_mdio_write(netdev, mii->phy_id, MII_ADVERTISE, ADVERTISE_ALL | | ||
371 | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); | ||
372 | mii_nway_restart(mii); | ||
373 | |||
374 | out: | ||
375 | return ret; | ||
376 | } | ||
377 | |||
378 | static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
379 | { | ||
380 | struct sk_buff *sr_skb; | ||
381 | int len; | ||
382 | |||
383 | /* skb content (packets) format : | ||
384 | * p0 p1 p2 ...... pm | ||
385 | * / \ | ||
386 | * / \ | ||
387 | * / \ | ||
388 | * / \ | ||
389 | * p0b0 p0b1 p0b2 p0b3 ...... p0b(n-4) p0b(n-3)...p0bn | ||
390 | * | ||
391 | * p0 : packet 0 | ||
392 | * p0b0 : packet 0 byte 0 | ||
393 | * | ||
394 | * b0: rx status | ||
395 | * b1: packet length (incl crc) low | ||
396 | * b2: packet length (incl crc) high | ||
397 | * b3..n-4: packet data | ||
398 | * bn-3..bn: ethernet packet crc | ||
399 | */ | ||
400 | if (unlikely(skb->len < SR_RX_OVERHEAD)) { | ||
401 | netdev_err(dev->net, "unexpected tiny rx frame\n"); | ||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | /* one skb may contains multiple packets */ | ||
406 | while (skb->len > SR_RX_OVERHEAD) { | ||
407 | if (skb->data[0] != 0x40) | ||
408 | return 0; | ||
409 | |||
410 | /* ignore the CRC length */ | ||
411 | len = (skb->data[1] | (skb->data[2] << 8)) - 4; | ||
412 | |||
413 | if (len > ETH_FRAME_LEN) | ||
414 | return 0; | ||
415 | |||
416 | /* the last packet of current skb */ | ||
417 | if (skb->len == (len + SR_RX_OVERHEAD)) { | ||
418 | skb_pull(skb, 3); | ||
419 | skb->len = len; | ||
420 | skb_set_tail_pointer(skb, len); | ||
421 | skb->truesize = len + sizeof(struct sk_buff); | ||
422 | return 2; | ||
423 | } | ||
424 | |||
425 | /* skb_clone is used for address align */ | ||
426 | sr_skb = skb_clone(skb, GFP_ATOMIC); | ||
427 | if (!sr_skb) | ||
428 | return 0; | ||
429 | |||
430 | sr_skb->len = len; | ||
431 | sr_skb->data = skb->data + 3; | ||
432 | skb_set_tail_pointer(sr_skb, len); | ||
433 | sr_skb->truesize = len + sizeof(struct sk_buff); | ||
434 | usbnet_skb_return(dev, sr_skb); | ||
435 | |||
436 | skb_pull(skb, len + SR_RX_OVERHEAD); | ||
437 | }; | ||
438 | |||
439 | return 0; | ||
440 | } | ||
441 | |||
442 | static struct sk_buff *sr9700_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | ||
443 | gfp_t flags) | ||
444 | { | ||
445 | int len; | ||
446 | |||
447 | /* SR9700 can only send out one ethernet packet at once. | ||
448 | * | ||
449 | * b0 b1 b2 b3 ...... b(n-4) b(n-3)...bn | ||
450 | * | ||
451 | * b0: rx status | ||
452 | * b1: packet length (incl crc) low | ||
453 | * b2: packet length (incl crc) high | ||
454 | * b3..n-4: packet data | ||
455 | * bn-3..bn: ethernet packet crc | ||
456 | */ | ||
457 | |||
458 | len = skb->len; | ||
459 | |||
460 | if (skb_headroom(skb) < SR_TX_OVERHEAD) { | ||
461 | struct sk_buff *skb2; | ||
462 | |||
463 | skb2 = skb_copy_expand(skb, SR_TX_OVERHEAD, 0, flags); | ||
464 | dev_kfree_skb_any(skb); | ||
465 | skb = skb2; | ||
466 | if (!skb) | ||
467 | return NULL; | ||
468 | } | ||
469 | |||
470 | __skb_push(skb, SR_TX_OVERHEAD); | ||
471 | |||
472 | /* usbnet adds padding if length is a multiple of packet size | ||
473 | * if so, adjust length value in header | ||
474 | */ | ||
475 | if ((skb->len % dev->maxpacket) == 0) | ||
476 | len++; | ||
477 | |||
478 | skb->data[0] = len; | ||
479 | skb->data[1] = len >> 8; | ||
480 | |||
481 | return skb; | ||
482 | } | ||
483 | |||
484 | static void sr9700_status(struct usbnet *dev, struct urb *urb) | ||
485 | { | ||
486 | int link; | ||
487 | u8 *buf; | ||
488 | |||
489 | /* format: | ||
490 | b0: net status | ||
491 | b1: tx status 1 | ||
492 | b2: tx status 2 | ||
493 | b3: rx status | ||
494 | b4: rx overflow | ||
495 | b5: rx count | ||
496 | b6: tx count | ||
497 | b7: gpr | ||
498 | */ | ||
499 | |||
500 | if (urb->actual_length < 8) | ||
501 | return; | ||
502 | |||
503 | buf = urb->transfer_buffer; | ||
504 | |||
505 | link = !!(buf[0] & 0x40); | ||
506 | if (netif_carrier_ok(dev->net) != link) { | ||
507 | usbnet_link_change(dev, link, 1); | ||
508 | netdev_dbg(dev->net, "Link Status is: %d\n", link); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | static int sr9700_link_reset(struct usbnet *dev) | ||
513 | { | ||
514 | struct ethtool_cmd ecmd; | ||
515 | |||
516 | mii_check_media(&dev->mii, 1, 1); | ||
517 | mii_ethtool_gset(&dev->mii, &ecmd); | ||
518 | |||
519 | netdev_dbg(dev->net, "link_reset() speed: %d duplex: %d\n", | ||
520 | ecmd.speed, ecmd.duplex); | ||
521 | |||
522 | return 0; | ||
523 | } | ||
524 | |||
525 | static const struct driver_info sr9700_driver_info = { | ||
526 | .description = "CoreChip SR9700 USB Ethernet", | ||
527 | .flags = FLAG_ETHER, | ||
528 | .bind = sr9700_bind, | ||
529 | .rx_fixup = sr9700_rx_fixup, | ||
530 | .tx_fixup = sr9700_tx_fixup, | ||
531 | .status = sr9700_status, | ||
532 | .link_reset = sr9700_link_reset, | ||
533 | .reset = sr9700_link_reset, | ||
534 | }; | ||
535 | |||
536 | static const struct usb_device_id products[] = { | ||
537 | { | ||
538 | USB_DEVICE(0x0fe6, 0x9700), /* SR9700 device */ | ||
539 | .driver_info = (unsigned long)&sr9700_driver_info, | ||
540 | }, | ||
541 | {}, /* END */ | ||
542 | }; | ||
543 | |||
544 | MODULE_DEVICE_TABLE(usb, products); | ||
545 | |||
546 | static struct usb_driver sr9700_usb_driver = { | ||
547 | .name = "sr9700", | ||
548 | .id_table = products, | ||
549 | .probe = usbnet_probe, | ||
550 | .disconnect = usbnet_disconnect, | ||
551 | .suspend = usbnet_suspend, | ||
552 | .resume = usbnet_resume, | ||
553 | .disable_hub_initiated_lpm = 1, | ||
554 | }; | ||
555 | |||
556 | module_usb_driver(sr9700_usb_driver); | ||
557 | |||
558 | MODULE_AUTHOR("liujl <liujunliang_ljl@163.com>"); | ||
559 | MODULE_DESCRIPTION("SR9700 one chip USB 1.1 USB to Ethernet device from http://www.corechip-sz.com/"); | ||
560 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/usb/sr9700.h b/drivers/net/usb/sr9700.h new file mode 100644 index 000000000000..fd687c575e74 --- /dev/null +++ b/drivers/net/usb/sr9700.h | |||
@@ -0,0 +1,173 @@ | |||
1 | /* | ||
2 | * CoreChip-sz SR9700 one chip USB 1.1 Ethernet Devices | ||
3 | * | ||
4 | * Author : Liu Junliang <liujunliang_ljl@163.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 as published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef _SR9700_H | ||
12 | #define _SR9700_H | ||
13 | |||
14 | /* sr9700 spec. register table on Linux platform */ | ||
15 | |||
16 | /* Network Control Reg */ | ||
17 | #define NCR 0x00 | ||
18 | #define NCR_RST (1 << 0) | ||
19 | #define NCR_LBK (3 << 1) | ||
20 | #define NCR_FDX (1 << 3) | ||
21 | #define NCR_WAKEEN (1 << 6) | ||
22 | /* Network Status Reg */ | ||
23 | #define NSR 0x01 | ||
24 | #define NSR_RXRDY (1 << 0) | ||
25 | #define NSR_RXOV (1 << 1) | ||
26 | #define NSR_TX1END (1 << 2) | ||
27 | #define NSR_TX2END (1 << 3) | ||
28 | #define NSR_TXFULL (1 << 4) | ||
29 | #define NSR_WAKEST (1 << 5) | ||
30 | #define NSR_LINKST (1 << 6) | ||
31 | #define NSR_SPEED (1 << 7) | ||
32 | /* Tx Control Reg */ | ||
33 | #define TCR 0x02 | ||
34 | #define TCR_CRC_DIS (1 << 1) | ||
35 | #define TCR_PAD_DIS (1 << 2) | ||
36 | #define TCR_LC_CARE (1 << 3) | ||
37 | #define TCR_CRS_CARE (1 << 4) | ||
38 | #define TCR_EXCECM (1 << 5) | ||
39 | #define TCR_LF_EN (1 << 6) | ||
40 | /* Tx Status Reg for Packet Index 1 */ | ||
41 | #define TSR1 0x03 | ||
42 | #define TSR1_EC (1 << 2) | ||
43 | #define TSR1_COL (1 << 3) | ||
44 | #define TSR1_LC (1 << 4) | ||
45 | #define TSR1_NC (1 << 5) | ||
46 | #define TSR1_LOC (1 << 6) | ||
47 | #define TSR1_TLF (1 << 7) | ||
48 | /* Tx Status Reg for Packet Index 2 */ | ||
49 | #define TSR2 0x04 | ||
50 | #define TSR2_EC (1 << 2) | ||
51 | #define TSR2_COL (1 << 3) | ||
52 | #define TSR2_LC (1 << 4) | ||
53 | #define TSR2_NC (1 << 5) | ||
54 | #define TSR2_LOC (1 << 6) | ||
55 | #define TSR2_TLF (1 << 7) | ||
56 | /* Rx Control Reg*/ | ||
57 | #define RCR 0x05 | ||
58 | #define RCR_RXEN (1 << 0) | ||
59 | #define RCR_PRMSC (1 << 1) | ||
60 | #define RCR_RUNT (1 << 2) | ||
61 | #define RCR_ALL (1 << 3) | ||
62 | #define RCR_DIS_CRC (1 << 4) | ||
63 | #define RCR_DIS_LONG (1 << 5) | ||
64 | /* Rx Status Reg */ | ||
65 | #define RSR 0x06 | ||
66 | #define RSR_AE (1 << 2) | ||
67 | #define RSR_MF (1 << 6) | ||
68 | #define RSR_RF (1 << 7) | ||
69 | /* Rx Overflow Counter Reg */ | ||
70 | #define ROCR 0x07 | ||
71 | #define ROCR_ROC (0x7F << 0) | ||
72 | #define ROCR_RXFU (1 << 7) | ||
73 | /* Back Pressure Threshold Reg */ | ||
74 | #define BPTR 0x08 | ||
75 | #define BPTR_JPT (0x0F << 0) | ||
76 | #define BPTR_BPHW (0x0F << 4) | ||
77 | /* Flow Control Threshold Reg */ | ||
78 | #define FCTR 0x09 | ||
79 | #define FCTR_LWOT (0x0F << 0) | ||
80 | #define FCTR_HWOT (0x0F << 4) | ||
81 | /* rx/tx Flow Control Reg */ | ||
82 | #define FCR 0x0A | ||
83 | #define FCR_FLCE (1 << 0) | ||
84 | #define FCR_BKPA (1 << 4) | ||
85 | #define FCR_TXPEN (1 << 5) | ||
86 | #define FCR_TXPF (1 << 6) | ||
87 | #define FCR_TXP0 (1 << 7) | ||
88 | /* Eeprom & Phy Control Reg */ | ||
89 | #define EPCR 0x0B | ||
90 | #define EPCR_ERRE (1 << 0) | ||
91 | #define EPCR_ERPRW (1 << 1) | ||
92 | #define EPCR_ERPRR (1 << 2) | ||
93 | #define EPCR_EPOS (1 << 3) | ||
94 | #define EPCR_WEP (1 << 4) | ||
95 | /* Eeprom & Phy Address Reg */ | ||
96 | #define EPAR 0x0C | ||
97 | #define EPAR_EROA (0x3F << 0) | ||
98 | #define EPAR_PHY_ADR_MASK (0x03 << 6) | ||
99 | #define EPAR_PHY_ADR (0x01 << 6) | ||
100 | /* Eeprom & Phy Data Reg */ | ||
101 | #define EPDR 0x0D /* 0x0D ~ 0x0E for Data Reg Low & High */ | ||
102 | /* Wakeup Control Reg */ | ||
103 | #define WCR 0x0F | ||
104 | #define WCR_MAGICST (1 << 0) | ||
105 | #define WCR_LINKST (1 << 2) | ||
106 | #define WCR_MAGICEN (1 << 3) | ||
107 | #define WCR_LINKEN (1 << 5) | ||
108 | /* Physical Address Reg */ | ||
109 | #define PAR 0x10 /* 0x10 ~ 0x15 6 bytes for PAR */ | ||
110 | /* Multicast Address Reg */ | ||
111 | #define MAR 0x16 /* 0x16 ~ 0x1D 8 bytes for MAR */ | ||
112 | /* 0x1e unused */ | ||
113 | /* Phy Reset Reg */ | ||
114 | #define PRR 0x1F | ||
115 | #define PRR_PHY_RST (1 << 0) | ||
116 | /* Tx sdram Write Pointer Address Low */ | ||
117 | #define TWPAL 0x20 | ||
118 | /* Tx sdram Write Pointer Address High */ | ||
119 | #define TWPAH 0x21 | ||
120 | /* Tx sdram Read Pointer Address Low */ | ||
121 | #define TRPAL 0x22 | ||
122 | /* Tx sdram Read Pointer Address High */ | ||
123 | #define TRPAH 0x23 | ||
124 | /* Rx sdram Write Pointer Address Low */ | ||
125 | #define RWPAL 0x24 | ||
126 | /* Rx sdram Write Pointer Address High */ | ||
127 | #define RWPAH 0x25 | ||
128 | /* Rx sdram Read Pointer Address Low */ | ||
129 | #define RRPAL 0x26 | ||
130 | /* Rx sdram Read Pointer Address High */ | ||
131 | #define RRPAH 0x27 | ||
132 | /* Vendor ID register */ | ||
133 | #define VID 0x28 /* 0x28 ~ 0x29 2 bytes for VID */ | ||
134 | /* Product ID register */ | ||
135 | #define PID 0x2A /* 0x2A ~ 0x2B 2 bytes for PID */ | ||
136 | /* CHIP Revision register */ | ||
137 | #define CHIPR 0x2C | ||
138 | /* 0x2D --> 0xEF unused */ | ||
139 | /* USB Device Address */ | ||
140 | #define USBDA 0xF0 | ||
141 | #define USBDA_USBFA (0x7F << 0) | ||
142 | /* RX packet Counter Reg */ | ||
143 | #define RXC 0xF1 | ||
144 | /* Tx packet Counter & USB Status Reg */ | ||
145 | #define TXC_USBS 0xF2 | ||
146 | #define TXC_USBS_TXC0 (1 << 0) | ||
147 | #define TXC_USBS_TXC1 (1 << 1) | ||
148 | #define TXC_USBS_TXC2 (1 << 2) | ||
149 | #define TXC_USBS_EP1RDY (1 << 5) | ||
150 | #define TXC_USBS_SUSFLAG (1 << 6) | ||
151 | #define TXC_USBS_RXFAULT (1 << 7) | ||
152 | /* USB Control register */ | ||
153 | #define USBC 0xF4 | ||
154 | #define USBC_EP3NAK (1 << 4) | ||
155 | #define USBC_EP3ACK (1 << 5) | ||
156 | |||
157 | /* Register access commands and flags */ | ||
158 | #define SR_RD_REGS 0x00 | ||
159 | #define SR_WR_REGS 0x01 | ||
160 | #define SR_WR_REG 0x03 | ||
161 | #define SR_REQ_RD_REG (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE) | ||
162 | #define SR_REQ_WR_REG (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE) | ||
163 | |||
164 | /* parameters */ | ||
165 | #define SR_SHARE_TIMEOUT 1000 | ||
166 | #define SR_EEPROM_LEN 256 | ||
167 | #define SR_MCAST_SIZE 8 | ||
168 | #define SR_MCAST_ADDR_FLAG 0x80 | ||
169 | #define SR_MCAST_MAX 64 | ||
170 | #define SR_TX_OVERHEAD 2 /* 2bytes header */ | ||
171 | #define SR_RX_OVERHEAD 7 /* 3bytes header + 4crc tail */ | ||
172 | |||
173 | #endif /* _SR9700_H */ | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f21600277583..defec2b3c5a4 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -1538,6 +1538,8 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1538 | dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); | 1538 | dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); |
1539 | /* (!csum && gso) case will be fixed by register_netdev() */ | 1539 | /* (!csum && gso) case will be fixed by register_netdev() */ |
1540 | } | 1540 | } |
1541 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) | ||
1542 | dev->features |= NETIF_F_RXCSUM; | ||
1541 | 1543 | ||
1542 | dev->vlan_features = dev->features; | 1544 | dev->vlan_features = dev->features; |
1543 | 1545 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 6b560f373fc3..ebda3a1c2f31 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -478,7 +478,7 @@ static struct vxlan_fdb *__vxlan_find_mac(struct vxlan_dev *vxlan, | |||
478 | struct vxlan_fdb *f; | 478 | struct vxlan_fdb *f; |
479 | 479 | ||
480 | hlist_for_each_entry_rcu(f, head, hlist) { | 480 | hlist_for_each_entry_rcu(f, head, hlist) { |
481 | if (compare_ether_addr(mac, f->eth_addr) == 0) | 481 | if (ether_addr_equal(mac, f->eth_addr)) |
482 | return f; | 482 | return f; |
483 | } | 483 | } |
484 | 484 | ||
@@ -1049,8 +1049,7 @@ static void vxlan_rcv(struct vxlan_sock *vs, | |||
1049 | skb->protocol = eth_type_trans(skb, vxlan->dev); | 1049 | skb->protocol = eth_type_trans(skb, vxlan->dev); |
1050 | 1050 | ||
1051 | /* Ignore packet loops (and multicast echo) */ | 1051 | /* Ignore packet loops (and multicast echo) */ |
1052 | if (compare_ether_addr(eth_hdr(skb)->h_source, | 1052 | if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr)) |
1053 | vxlan->dev->dev_addr) == 0) | ||
1054 | goto drop; | 1053 | goto drop; |
1055 | 1054 | ||
1056 | /* Re-examine inner Ethernet packet */ | 1055 | /* Re-examine inner Ethernet packet */ |
@@ -1320,7 +1319,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) | |||
1320 | if (n) { | 1319 | if (n) { |
1321 | bool diff; | 1320 | bool diff; |
1322 | 1321 | ||
1323 | diff = compare_ether_addr(eth_hdr(skb)->h_dest, n->ha) != 0; | 1322 | diff = !ether_addr_equal(eth_hdr(skb)->h_dest, n->ha); |
1324 | if (diff) { | 1323 | if (diff) { |
1325 | memcpy(eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, | 1324 | memcpy(eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, |
1326 | dev->addr_len); | 1325 | dev->addr_len); |
@@ -1381,7 +1380,7 @@ static int handle_offloads(struct sk_buff *skb) | |||
1381 | } | 1380 | } |
1382 | 1381 | ||
1383 | #if IS_ENABLED(CONFIG_IPV6) | 1382 | #if IS_ENABLED(CONFIG_IPV6) |
1384 | static int vxlan6_xmit_skb(struct net *net, struct vxlan_sock *vs, | 1383 | static int vxlan6_xmit_skb(struct vxlan_sock *vs, |
1385 | struct dst_entry *dst, struct sk_buff *skb, | 1384 | struct dst_entry *dst, struct sk_buff *skb, |
1386 | struct net_device *dev, struct in6_addr *saddr, | 1385 | struct net_device *dev, struct in6_addr *saddr, |
1387 | struct in6_addr *daddr, __u8 prio, __u8 ttl, | 1386 | struct in6_addr *daddr, __u8 prio, __u8 ttl, |
@@ -1398,6 +1397,8 @@ static int vxlan6_xmit_skb(struct net *net, struct vxlan_sock *vs, | |||
1398 | skb->encapsulation = 1; | 1397 | skb->encapsulation = 1; |
1399 | } | 1398 | } |
1400 | 1399 | ||
1400 | skb_scrub_packet(skb, false); | ||
1401 | |||
1401 | min_headroom = LL_RESERVED_SPACE(dst->dev) + dst->header_len | 1402 | min_headroom = LL_RESERVED_SPACE(dst->dev) + dst->header_len |
1402 | + VXLAN_HLEN + sizeof(struct ipv6hdr) | 1403 | + VXLAN_HLEN + sizeof(struct ipv6hdr) |
1403 | + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0); | 1404 | + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0); |
@@ -1433,7 +1434,6 @@ static int vxlan6_xmit_skb(struct net *net, struct vxlan_sock *vs, | |||
1433 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 1434 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
1434 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | | 1435 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | |
1435 | IPSKB_REROUTED); | 1436 | IPSKB_REROUTED); |
1436 | skb_dst_drop(skb); | ||
1437 | skb_dst_set(skb, dst); | 1437 | skb_dst_set(skb, dst); |
1438 | 1438 | ||
1439 | if (!skb_is_gso(skb) && !(dst->dev->features & NETIF_F_IPV6_CSUM)) { | 1439 | if (!skb_is_gso(skb) && !(dst->dev->features & NETIF_F_IPV6_CSUM)) { |
@@ -1476,7 +1476,7 @@ static int vxlan6_xmit_skb(struct net *net, struct vxlan_sock *vs, | |||
1476 | } | 1476 | } |
1477 | #endif | 1477 | #endif |
1478 | 1478 | ||
1479 | int vxlan_xmit_skb(struct net *net, struct vxlan_sock *vs, | 1479 | int vxlan_xmit_skb(struct vxlan_sock *vs, |
1480 | struct rtable *rt, struct sk_buff *skb, | 1480 | struct rtable *rt, struct sk_buff *skb, |
1481 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, | 1481 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, |
1482 | __be16 src_port, __be16 dst_port, __be32 vni) | 1482 | __be16 src_port, __be16 dst_port, __be32 vni) |
@@ -1529,8 +1529,8 @@ int vxlan_xmit_skb(struct net *net, struct vxlan_sock *vs, | |||
1529 | if (err) | 1529 | if (err) |
1530 | return err; | 1530 | return err; |
1531 | 1531 | ||
1532 | return iptunnel_xmit(net, rt, skb, src, dst, | 1532 | return iptunnel_xmit(rt, skb, src, dst, IPPROTO_UDP, tos, ttl, df, |
1533 | IPPROTO_UDP, tos, ttl, df); | 1533 | false); |
1534 | } | 1534 | } |
1535 | EXPORT_SYMBOL_GPL(vxlan_xmit_skb); | 1535 | EXPORT_SYMBOL_GPL(vxlan_xmit_skb); |
1536 | 1536 | ||
@@ -1653,7 +1653,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | |||
1653 | tos = ip_tunnel_ecn_encap(tos, old_iph, skb); | 1653 | tos = ip_tunnel_ecn_encap(tos, old_iph, skb); |
1654 | ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); | 1654 | ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); |
1655 | 1655 | ||
1656 | err = vxlan_xmit_skb(dev_net(dev), vxlan->vn_sock, rt, skb, | 1656 | err = vxlan_xmit_skb(vxlan->vn_sock, rt, skb, |
1657 | fl4.saddr, dst->sin.sin_addr.s_addr, | 1657 | fl4.saddr, dst->sin.sin_addr.s_addr, |
1658 | tos, ttl, df, src_port, dst_port, | 1658 | tos, ttl, df, src_port, dst_port, |
1659 | htonl(vni << 8)); | 1659 | htonl(vni << 8)); |
@@ -1705,7 +1705,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | |||
1705 | 1705 | ||
1706 | ttl = ttl ? : ip6_dst_hoplimit(ndst); | 1706 | ttl = ttl ? : ip6_dst_hoplimit(ndst); |
1707 | 1707 | ||
1708 | err = vxlan6_xmit_skb(dev_net(dev), vxlan->vn_sock, ndst, skb, | 1708 | err = vxlan6_xmit_skb(vxlan->vn_sock, ndst, skb, |
1709 | dev, &fl6.saddr, &fl6.daddr, 0, ttl, | 1709 | dev, &fl6.saddr, &fl6.daddr, 0, ttl, |
1710 | src_port, dst_port, htonl(vni << 8)); | 1710 | src_port, dst_port, htonl(vni << 8)); |
1711 | #endif | 1711 | #endif |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index d0adbaf86186..7fe19648f10e 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -2693,7 +2693,7 @@ static struct net_device *init_wifidev(struct airo_info *ai, | |||
2693 | dev->base_addr = ethdev->base_addr; | 2693 | dev->base_addr = ethdev->base_addr; |
2694 | dev->wireless_data = ethdev->wireless_data; | 2694 | dev->wireless_data = ethdev->wireless_data; |
2695 | SET_NETDEV_DEV(dev, ethdev->dev.parent); | 2695 | SET_NETDEV_DEV(dev, ethdev->dev.parent); |
2696 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); | 2696 | eth_hw_addr_inherit(dev, ethdev); |
2697 | err = register_netdev(dev); | 2697 | err = register_netdev(dev); |
2698 | if (err<0) { | 2698 | if (err<0) { |
2699 | free_netdev(dev); | 2699 | free_netdev(dev); |
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c index b40792900bd5..f8b969f518f8 100644 --- a/drivers/net/wireless/ath/ath10k/ce.c +++ b/drivers/net/wireless/ath/ath10k/ce.c | |||
@@ -637,6 +637,7 @@ static int ath10k_ce_completed_send_next_nolock(struct ce_state *ce_state, | |||
637 | ath10k_pci_wake(ar); | 637 | ath10k_pci_wake(ar); |
638 | src_ring->hw_index = | 638 | src_ring->hw_index = |
639 | ath10k_ce_src_ring_read_index_get(ar, ctrl_addr); | 639 | ath10k_ce_src_ring_read_index_get(ar, ctrl_addr); |
640 | src_ring->hw_index &= nentries_mask; | ||
640 | ath10k_pci_sleep(ar); | 641 | ath10k_pci_sleep(ar); |
641 | } | 642 | } |
642 | read_index = src_ring->hw_index; | 643 | read_index = src_ring->hw_index; |
@@ -950,10 +951,12 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar, | |||
950 | 951 | ||
951 | ath10k_pci_wake(ar); | 952 | ath10k_pci_wake(ar); |
952 | src_ring->sw_index = ath10k_ce_src_ring_read_index_get(ar, ctrl_addr); | 953 | src_ring->sw_index = ath10k_ce_src_ring_read_index_get(ar, ctrl_addr); |
954 | src_ring->sw_index &= src_ring->nentries_mask; | ||
953 | src_ring->hw_index = src_ring->sw_index; | 955 | src_ring->hw_index = src_ring->sw_index; |
954 | 956 | ||
955 | src_ring->write_index = | 957 | src_ring->write_index = |
956 | ath10k_ce_src_ring_write_index_get(ar, ctrl_addr); | 958 | ath10k_ce_src_ring_write_index_get(ar, ctrl_addr); |
959 | src_ring->write_index &= src_ring->nentries_mask; | ||
957 | ath10k_pci_sleep(ar); | 960 | ath10k_pci_sleep(ar); |
958 | 961 | ||
959 | src_ring->per_transfer_context = (void **)ptr; | 962 | src_ring->per_transfer_context = (void **)ptr; |
@@ -1035,8 +1038,10 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar, | |||
1035 | 1038 | ||
1036 | ath10k_pci_wake(ar); | 1039 | ath10k_pci_wake(ar); |
1037 | dest_ring->sw_index = ath10k_ce_dest_ring_read_index_get(ar, ctrl_addr); | 1040 | dest_ring->sw_index = ath10k_ce_dest_ring_read_index_get(ar, ctrl_addr); |
1041 | dest_ring->sw_index &= dest_ring->nentries_mask; | ||
1038 | dest_ring->write_index = | 1042 | dest_ring->write_index = |
1039 | ath10k_ce_dest_ring_write_index_get(ar, ctrl_addr); | 1043 | ath10k_ce_dest_ring_write_index_get(ar, ctrl_addr); |
1044 | dest_ring->write_index &= dest_ring->nentries_mask; | ||
1040 | ath10k_pci_sleep(ar); | 1045 | ath10k_pci_sleep(ar); |
1041 | 1046 | ||
1042 | dest_ring->per_transfer_context = (void **)ptr; | 1047 | dest_ring->per_transfer_context = (void **)ptr; |
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 9f21ecb239d7..e4bba563ed42 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #define ATH10K_SCAN_ID 0 | 38 | #define ATH10K_SCAN_ID 0 |
39 | #define WMI_READY_TIMEOUT (5 * HZ) | 39 | #define WMI_READY_TIMEOUT (5 * HZ) |
40 | #define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ) | 40 | #define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ) |
41 | #define ATH10K_NUM_CHANS 38 | ||
41 | 42 | ||
42 | /* Antenna noise floor */ | 43 | /* Antenna noise floor */ |
43 | #define ATH10K_DEFAULT_NOISE_FLOOR -95 | 44 | #define ATH10K_DEFAULT_NOISE_FLOOR -95 |
@@ -285,6 +286,7 @@ struct ath10k { | |||
285 | u32 hw_max_tx_power; | 286 | u32 hw_max_tx_power; |
286 | u32 ht_cap_info; | 287 | u32 ht_cap_info; |
287 | u32 vht_cap_info; | 288 | u32 vht_cap_info; |
289 | u32 num_rf_chains; | ||
288 | 290 | ||
289 | struct targetdef *targetdef; | 291 | struct targetdef *targetdef; |
290 | struct hostdef *hostdef; | 292 | struct hostdef *hostdef; |
@@ -374,6 +376,12 @@ struct ath10k { | |||
374 | 376 | ||
375 | struct work_struct restart_work; | 377 | struct work_struct restart_work; |
376 | 378 | ||
379 | /* cycle count is reported twice for each visited channel during scan. | ||
380 | * access protected by data_lock */ | ||
381 | u32 survey_last_rx_clear_count; | ||
382 | u32 survey_last_cycle_count; | ||
383 | struct survey_info survey[ATH10K_NUM_CHANS]; | ||
384 | |||
377 | #ifdef CONFIG_ATH10K_DEBUGFS | 385 | #ifdef CONFIG_ATH10K_DEBUGFS |
378 | struct ath10k_debug debug; | 386 | struct ath10k_debug debug; |
379 | #endif | 387 | #endif |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 04f08d946479..e784c40b904b 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
@@ -804,6 +804,37 @@ static bool ath10k_htt_rx_has_fcs_err(struct sk_buff *skb) | |||
804 | return false; | 804 | return false; |
805 | } | 805 | } |
806 | 806 | ||
807 | static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb) | ||
808 | { | ||
809 | struct htt_rx_desc *rxd; | ||
810 | u32 flags, info; | ||
811 | bool is_ip4, is_ip6; | ||
812 | bool is_tcp, is_udp; | ||
813 | bool ip_csum_ok, tcpudp_csum_ok; | ||
814 | |||
815 | rxd = (void *)skb->data - sizeof(*rxd); | ||
816 | flags = __le32_to_cpu(rxd->attention.flags); | ||
817 | info = __le32_to_cpu(rxd->msdu_start.info1); | ||
818 | |||
819 | is_ip4 = !!(info & RX_MSDU_START_INFO1_IPV4_PROTO); | ||
820 | is_ip6 = !!(info & RX_MSDU_START_INFO1_IPV6_PROTO); | ||
821 | is_tcp = !!(info & RX_MSDU_START_INFO1_TCP_PROTO); | ||
822 | is_udp = !!(info & RX_MSDU_START_INFO1_UDP_PROTO); | ||
823 | ip_csum_ok = !(flags & RX_ATTENTION_FLAGS_IP_CHKSUM_FAIL); | ||
824 | tcpudp_csum_ok = !(flags & RX_ATTENTION_FLAGS_TCP_UDP_CHKSUM_FAIL); | ||
825 | |||
826 | if (!is_ip4 && !is_ip6) | ||
827 | return CHECKSUM_NONE; | ||
828 | if (!is_tcp && !is_udp) | ||
829 | return CHECKSUM_NONE; | ||
830 | if (!ip_csum_ok) | ||
831 | return CHECKSUM_NONE; | ||
832 | if (!tcpudp_csum_ok) | ||
833 | return CHECKSUM_NONE; | ||
834 | |||
835 | return CHECKSUM_UNNECESSARY; | ||
836 | } | ||
837 | |||
807 | static void ath10k_htt_rx_handler(struct ath10k_htt *htt, | 838 | static void ath10k_htt_rx_handler(struct ath10k_htt *htt, |
808 | struct htt_rx_indication *rx) | 839 | struct htt_rx_indication *rx) |
809 | { | 840 | { |
@@ -815,6 +846,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt, | |||
815 | u8 *fw_desc; | 846 | u8 *fw_desc; |
816 | int i, j; | 847 | int i, j; |
817 | int ret; | 848 | int ret; |
849 | int ip_summed; | ||
818 | 850 | ||
819 | memset(&info, 0, sizeof(info)); | 851 | memset(&info, 0, sizeof(info)); |
820 | 852 | ||
@@ -889,6 +921,11 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt, | |||
889 | continue; | 921 | continue; |
890 | } | 922 | } |
891 | 923 | ||
924 | /* The skb is not yet processed and it may be | ||
925 | * reallocated. Since the offload is in the original | ||
926 | * skb extract the checksum now and assign it later */ | ||
927 | ip_summed = ath10k_htt_rx_get_csum_state(msdu_head); | ||
928 | |||
892 | info.skb = msdu_head; | 929 | info.skb = msdu_head; |
893 | info.fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head); | 930 | info.fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head); |
894 | info.signal = ATH10K_DEFAULT_NOISE_FLOOR; | 931 | info.signal = ATH10K_DEFAULT_NOISE_FLOOR; |
@@ -914,6 +951,8 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt, | |||
914 | if (ath10k_htt_rx_hdr_is_amsdu((void *)info.skb->data)) | 951 | if (ath10k_htt_rx_hdr_is_amsdu((void *)info.skb->data)) |
915 | ath10k_dbg(ATH10K_DBG_HTT, "htt mpdu is amsdu\n"); | 952 | ath10k_dbg(ATH10K_DBG_HTT, "htt mpdu is amsdu\n"); |
916 | 953 | ||
954 | info.skb->ip_summed = ip_summed; | ||
955 | |||
917 | ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt mpdu: ", | 956 | ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt mpdu: ", |
918 | info.skb->data, info.skb->len); | 957 | info.skb->data, info.skb->len); |
919 | ath10k_process_rx(htt->ar, &info); | 958 | ath10k_process_rx(htt->ar, &info); |
@@ -980,6 +1019,7 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt, | |||
980 | info.status = HTT_RX_IND_MPDU_STATUS_OK; | 1019 | info.status = HTT_RX_IND_MPDU_STATUS_OK; |
981 | info.encrypt_type = MS(__le32_to_cpu(rxd->mpdu_start.info0), | 1020 | info.encrypt_type = MS(__le32_to_cpu(rxd->mpdu_start.info0), |
982 | RX_MPDU_START_INFO0_ENCRYPT_TYPE); | 1021 | RX_MPDU_START_INFO0_ENCRYPT_TYPE); |
1022 | info.skb->ip_summed = ath10k_htt_rx_get_csum_state(info.skb); | ||
983 | 1023 | ||
984 | if (tkip_mic_err) { | 1024 | if (tkip_mic_err) { |
985 | ath10k_warn("tkip mic error\n"); | 1025 | ath10k_warn("tkip mic error\n"); |
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index dc3f3e8de32b..656c2546b294 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c | |||
@@ -465,6 +465,8 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) | |||
465 | flags1 = 0; | 465 | flags1 = 0; |
466 | flags1 |= SM((u16)vdev_id, HTT_DATA_TX_DESC_FLAGS1_VDEV_ID); | 466 | flags1 |= SM((u16)vdev_id, HTT_DATA_TX_DESC_FLAGS1_VDEV_ID); |
467 | flags1 |= SM((u16)tid, HTT_DATA_TX_DESC_FLAGS1_EXT_TID); | 467 | flags1 |= SM((u16)tid, HTT_DATA_TX_DESC_FLAGS1_EXT_TID); |
468 | flags1 |= HTT_DATA_TX_DESC_FLAGS1_CKSUM_L3_OFFLOAD; | ||
469 | flags1 |= HTT_DATA_TX_DESC_FLAGS1_CKSUM_L4_OFFLOAD; | ||
468 | 470 | ||
469 | frags_paddr = ATH10K_SKB_CB(txfrag)->paddr; | 471 | frags_paddr = ATH10K_SKB_CB(txfrag)->paddr; |
470 | 472 | ||
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index d0a776124f13..cf2ba4d850c9 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c | |||
@@ -1406,9 +1406,9 @@ static void ath10k_tx_h_qos_workaround(struct ieee80211_hw *hw, | |||
1406 | return; | 1406 | return; |
1407 | 1407 | ||
1408 | qos_ctl = ieee80211_get_qos_ctl(hdr); | 1408 | qos_ctl = ieee80211_get_qos_ctl(hdr); |
1409 | memmove(qos_ctl, qos_ctl + IEEE80211_QOS_CTL_LEN, | 1409 | memmove(skb->data + IEEE80211_QOS_CTL_LEN, |
1410 | skb->len - ieee80211_hdrlen(hdr->frame_control)); | 1410 | skb->data, (void *)qos_ctl - (void *)skb->data); |
1411 | skb_trim(skb, skb->len - IEEE80211_QOS_CTL_LEN); | 1411 | skb_pull(skb, IEEE80211_QOS_CTL_LEN); |
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | static void ath10k_tx_h_update_wep_key(struct sk_buff *skb) | 1414 | static void ath10k_tx_h_update_wep_key(struct sk_buff *skb) |
@@ -1925,6 +1925,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
1925 | 1925 | ||
1926 | mutex_lock(&ar->conf_mutex); | 1926 | mutex_lock(&ar->conf_mutex); |
1927 | 1927 | ||
1928 | memset(arvif, 0, sizeof(*arvif)); | ||
1929 | |||
1928 | arvif->ar = ar; | 1930 | arvif->ar = ar; |
1929 | arvif->vif = vif; | 1931 | arvif->vif = vif; |
1930 | 1932 | ||
@@ -2338,6 +2340,8 @@ static int ath10k_hw_scan(struct ieee80211_hw *hw, | |||
2338 | arg.ssids[i].len = req->ssids[i].ssid_len; | 2340 | arg.ssids[i].len = req->ssids[i].ssid_len; |
2339 | arg.ssids[i].ssid = req->ssids[i].ssid; | 2341 | arg.ssids[i].ssid = req->ssids[i].ssid; |
2340 | } | 2342 | } |
2343 | } else { | ||
2344 | arg.scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; | ||
2341 | } | 2345 | } |
2342 | 2346 | ||
2343 | if (req->n_channels) { | 2347 | if (req->n_channels) { |
@@ -2934,6 +2938,41 @@ static void ath10k_restart_complete(struct ieee80211_hw *hw) | |||
2934 | mutex_unlock(&ar->conf_mutex); | 2938 | mutex_unlock(&ar->conf_mutex); |
2935 | } | 2939 | } |
2936 | 2940 | ||
2941 | static int ath10k_get_survey(struct ieee80211_hw *hw, int idx, | ||
2942 | struct survey_info *survey) | ||
2943 | { | ||
2944 | struct ath10k *ar = hw->priv; | ||
2945 | struct ieee80211_supported_band *sband; | ||
2946 | struct survey_info *ar_survey = &ar->survey[idx]; | ||
2947 | int ret = 0; | ||
2948 | |||
2949 | mutex_lock(&ar->conf_mutex); | ||
2950 | |||
2951 | sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ]; | ||
2952 | if (sband && idx >= sband->n_channels) { | ||
2953 | idx -= sband->n_channels; | ||
2954 | sband = NULL; | ||
2955 | } | ||
2956 | |||
2957 | if (!sband) | ||
2958 | sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ]; | ||
2959 | |||
2960 | if (!sband || idx >= sband->n_channels) { | ||
2961 | ret = -ENOENT; | ||
2962 | goto exit; | ||
2963 | } | ||
2964 | |||
2965 | spin_lock_bh(&ar->data_lock); | ||
2966 | memcpy(survey, ar_survey, sizeof(*survey)); | ||
2967 | spin_unlock_bh(&ar->data_lock); | ||
2968 | |||
2969 | survey->channel = &sband->channels[idx]; | ||
2970 | |||
2971 | exit: | ||
2972 | mutex_unlock(&ar->conf_mutex); | ||
2973 | return ret; | ||
2974 | } | ||
2975 | |||
2937 | static const struct ieee80211_ops ath10k_ops = { | 2976 | static const struct ieee80211_ops ath10k_ops = { |
2938 | .tx = ath10k_tx, | 2977 | .tx = ath10k_tx, |
2939 | .start = ath10k_start, | 2978 | .start = ath10k_start, |
@@ -2955,6 +2994,7 @@ static const struct ieee80211_ops ath10k_ops = { | |||
2955 | .flush = ath10k_flush, | 2994 | .flush = ath10k_flush, |
2956 | .tx_last_beacon = ath10k_tx_last_beacon, | 2995 | .tx_last_beacon = ath10k_tx_last_beacon, |
2957 | .restart_complete = ath10k_restart_complete, | 2996 | .restart_complete = ath10k_restart_complete, |
2997 | .get_survey = ath10k_get_survey, | ||
2958 | #ifdef CONFIG_PM | 2998 | #ifdef CONFIG_PM |
2959 | .suspend = ath10k_suspend, | 2999 | .suspend = ath10k_suspend, |
2960 | .resume = ath10k_resume, | 3000 | .resume = ath10k_resume, |
@@ -3076,9 +3116,15 @@ static const struct ieee80211_iface_limit ath10k_if_limits[] = { | |||
3076 | .max = 8, | 3116 | .max = 8, |
3077 | .types = BIT(NL80211_IFTYPE_STATION) | 3117 | .types = BIT(NL80211_IFTYPE_STATION) |
3078 | | BIT(NL80211_IFTYPE_P2P_CLIENT) | 3118 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
3079 | | BIT(NL80211_IFTYPE_P2P_GO) | 3119 | }, |
3080 | | BIT(NL80211_IFTYPE_AP) | 3120 | { |
3081 | } | 3121 | .max = 3, |
3122 | .types = BIT(NL80211_IFTYPE_P2P_GO) | ||
3123 | }, | ||
3124 | { | ||
3125 | .max = 7, | ||
3126 | .types = BIT(NL80211_IFTYPE_AP) | ||
3127 | }, | ||
3082 | }; | 3128 | }; |
3083 | 3129 | ||
3084 | static const struct ieee80211_iface_combination ath10k_if_comb = { | 3130 | static const struct ieee80211_iface_combination ath10k_if_comb = { |
@@ -3093,19 +3139,18 @@ static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar) | |||
3093 | { | 3139 | { |
3094 | struct ieee80211_sta_vht_cap vht_cap = {0}; | 3140 | struct ieee80211_sta_vht_cap vht_cap = {0}; |
3095 | u16 mcs_map; | 3141 | u16 mcs_map; |
3142 | int i; | ||
3096 | 3143 | ||
3097 | vht_cap.vht_supported = 1; | 3144 | vht_cap.vht_supported = 1; |
3098 | vht_cap.cap = ar->vht_cap_info; | 3145 | vht_cap.cap = ar->vht_cap_info; |
3099 | 3146 | ||
3100 | /* FIXME: check dynamically how many streams board supports */ | 3147 | mcs_map = 0; |
3101 | mcs_map = IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 | | 3148 | for (i = 0; i < 8; i++) { |
3102 | IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 | | 3149 | if (i < ar->num_rf_chains) |
3103 | IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 | | 3150 | mcs_map |= IEEE80211_VHT_MCS_SUPPORT_0_9 << (i*2); |
3104 | IEEE80211_VHT_MCS_NOT_SUPPORTED << 6 | | 3151 | else |
3105 | IEEE80211_VHT_MCS_NOT_SUPPORTED << 8 | | 3152 | mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i*2); |
3106 | IEEE80211_VHT_MCS_NOT_SUPPORTED << 10 | | 3153 | } |
3107 | IEEE80211_VHT_MCS_NOT_SUPPORTED << 12 | | ||
3108 | IEEE80211_VHT_MCS_NOT_SUPPORTED << 14; | ||
3109 | 3154 | ||
3110 | vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map); | 3155 | vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map); |
3111 | vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map); | 3156 | vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map); |
@@ -3168,7 +3213,7 @@ static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar) | |||
3168 | if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK) | 3213 | if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK) |
3169 | ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU; | 3214 | ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU; |
3170 | 3215 | ||
3171 | for (i = 0; i < WMI_MAX_SPATIAL_STREAM; i++) | 3216 | for (i = 0; i < ar->num_rf_chains; i++) |
3172 | ht_cap.mcs.rx_mask[i] = 0xFF; | 3217 | ht_cap.mcs.rx_mask[i] = 0xFF; |
3173 | 3218 | ||
3174 | ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; | 3219 | ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; |
@@ -3310,6 +3355,8 @@ int ath10k_mac_register(struct ath10k *ar) | |||
3310 | ar->hw->wiphy->iface_combinations = &ath10k_if_comb; | 3355 | ar->hw->wiphy->iface_combinations = &ath10k_if_comb; |
3311 | ar->hw->wiphy->n_iface_combinations = 1; | 3356 | ar->hw->wiphy->n_iface_combinations = 1; |
3312 | 3357 | ||
3358 | ar->hw->netdev_features = NETIF_F_HW_CSUM; | ||
3359 | |||
3313 | ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, | 3360 | ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, |
3314 | ath10k_reg_notifier); | 3361 | ath10k_reg_notifier); |
3315 | if (ret) { | 3362 | if (ret) { |
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index c71b488eba9f..e2f9ef50b1bd 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "ce.h" | 32 | #include "ce.h" |
33 | #include "pci.h" | 33 | #include "pci.h" |
34 | 34 | ||
35 | unsigned int ath10k_target_ps; | 35 | static unsigned int ath10k_target_ps; |
36 | module_param(ath10k_target_ps, uint, 0644); | 36 | module_param(ath10k_target_ps, uint, 0644); |
37 | MODULE_PARM_DESC(ath10k_target_ps, "Enable ath10k Target (SoC) PS option"); | 37 | MODULE_PARM_DESC(ath10k_target_ps, "Enable ath10k Target (SoC) PS option"); |
38 | 38 | ||
@@ -56,6 +56,8 @@ static void ath10k_pci_rx_pipe_cleanup(struct hif_ce_pipe_info *pipe_info); | |||
56 | static void ath10k_pci_stop_ce(struct ath10k *ar); | 56 | static void ath10k_pci_stop_ce(struct ath10k *ar); |
57 | static void ath10k_pci_device_reset(struct ath10k *ar); | 57 | static void ath10k_pci_device_reset(struct ath10k *ar); |
58 | static int ath10k_pci_reset_target(struct ath10k *ar); | 58 | static int ath10k_pci_reset_target(struct ath10k *ar); |
59 | static int ath10k_pci_start_intr(struct ath10k *ar); | ||
60 | static void ath10k_pci_stop_intr(struct ath10k *ar); | ||
59 | 61 | ||
60 | static const struct ce_attr host_ce_config_wlan[] = { | 62 | static const struct ce_attr host_ce_config_wlan[] = { |
61 | /* host->target HTC control and raw streams */ | 63 | /* host->target HTC control and raw streams */ |
@@ -1254,10 +1256,25 @@ static void ath10k_pci_ce_deinit(struct ath10k *ar) | |||
1254 | } | 1256 | } |
1255 | } | 1257 | } |
1256 | 1258 | ||
1259 | static void ath10k_pci_disable_irqs(struct ath10k *ar) | ||
1260 | { | ||
1261 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
1262 | int i; | ||
1263 | |||
1264 | for (i = 0; i < max(1, ar_pci->num_msi_intrs); i++) | ||
1265 | disable_irq(ar_pci->pdev->irq + i); | ||
1266 | } | ||
1267 | |||
1257 | static void ath10k_pci_hif_stop(struct ath10k *ar) | 1268 | static void ath10k_pci_hif_stop(struct ath10k *ar) |
1258 | { | 1269 | { |
1270 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
1271 | |||
1259 | ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__); | 1272 | ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__); |
1260 | 1273 | ||
1274 | /* Irqs are never explicitly re-enabled. They are implicitly re-enabled | ||
1275 | * by ath10k_pci_start_intr(). */ | ||
1276 | ath10k_pci_disable_irqs(ar); | ||
1277 | |||
1261 | ath10k_pci_stop_ce(ar); | 1278 | ath10k_pci_stop_ce(ar); |
1262 | 1279 | ||
1263 | /* At this point, asynchronous threads are stopped, the target should | 1280 | /* At this point, asynchronous threads are stopped, the target should |
@@ -1267,6 +1284,8 @@ static void ath10k_pci_hif_stop(struct ath10k *ar) | |||
1267 | ath10k_pci_process_ce(ar); | 1284 | ath10k_pci_process_ce(ar); |
1268 | ath10k_pci_cleanup_ce(ar); | 1285 | ath10k_pci_cleanup_ce(ar); |
1269 | ath10k_pci_buffer_cleanup(ar); | 1286 | ath10k_pci_buffer_cleanup(ar); |
1287 | |||
1288 | ar_pci->started = 0; | ||
1270 | } | 1289 | } |
1271 | 1290 | ||
1272 | static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar, | 1291 | static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar, |
@@ -1740,8 +1759,15 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar) | |||
1740 | 1759 | ||
1741 | static int ath10k_pci_hif_power_up(struct ath10k *ar) | 1760 | static int ath10k_pci_hif_power_up(struct ath10k *ar) |
1742 | { | 1761 | { |
1762 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
1743 | int ret; | 1763 | int ret; |
1744 | 1764 | ||
1765 | ret = ath10k_pci_start_intr(ar); | ||
1766 | if (ret) { | ||
1767 | ath10k_err("could not start interrupt handling (%d)\n", ret); | ||
1768 | goto err; | ||
1769 | } | ||
1770 | |||
1745 | /* | 1771 | /* |
1746 | * Bring the target up cleanly. | 1772 | * Bring the target up cleanly. |
1747 | * | 1773 | * |
@@ -1756,15 +1782,11 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) | |||
1756 | 1782 | ||
1757 | ret = ath10k_pci_reset_target(ar); | 1783 | ret = ath10k_pci_reset_target(ar); |
1758 | if (ret) | 1784 | if (ret) |
1759 | goto err; | 1785 | goto err_irq; |
1760 | 1786 | ||
1761 | if (ath10k_target_ps) { | 1787 | if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features)) |
1762 | ath10k_dbg(ATH10K_DBG_PCI, "on-chip power save enabled\n"); | ||
1763 | } else { | ||
1764 | /* Force AWAKE forever */ | 1788 | /* Force AWAKE forever */ |
1765 | ath10k_dbg(ATH10K_DBG_PCI, "on-chip power save disabled\n"); | ||
1766 | ath10k_do_pci_wake(ar); | 1789 | ath10k_do_pci_wake(ar); |
1767 | } | ||
1768 | 1790 | ||
1769 | ret = ath10k_pci_ce_init(ar); | 1791 | ret = ath10k_pci_ce_init(ar); |
1770 | if (ret) | 1792 | if (ret) |
@@ -1785,16 +1807,22 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) | |||
1785 | err_ce: | 1807 | err_ce: |
1786 | ath10k_pci_ce_deinit(ar); | 1808 | ath10k_pci_ce_deinit(ar); |
1787 | err_ps: | 1809 | err_ps: |
1788 | if (!ath10k_target_ps) | 1810 | if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features)) |
1789 | ath10k_do_pci_sleep(ar); | 1811 | ath10k_do_pci_sleep(ar); |
1812 | err_irq: | ||
1813 | ath10k_pci_stop_intr(ar); | ||
1790 | err: | 1814 | err: |
1791 | return ret; | 1815 | return ret; |
1792 | } | 1816 | } |
1793 | 1817 | ||
1794 | static void ath10k_pci_hif_power_down(struct ath10k *ar) | 1818 | static void ath10k_pci_hif_power_down(struct ath10k *ar) |
1795 | { | 1819 | { |
1820 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
1821 | |||
1822 | ath10k_pci_stop_intr(ar); | ||
1823 | |||
1796 | ath10k_pci_ce_deinit(ar); | 1824 | ath10k_pci_ce_deinit(ar); |
1797 | if (!ath10k_target_ps) | 1825 | if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features)) |
1798 | ath10k_do_pci_sleep(ar); | 1826 | ath10k_do_pci_sleep(ar); |
1799 | } | 1827 | } |
1800 | 1828 | ||
@@ -1990,8 +2018,13 @@ static int ath10k_pci_start_intr_msix(struct ath10k *ar, int num) | |||
1990 | ret = request_irq(ar_pci->pdev->irq + MSI_ASSIGN_FW, | 2018 | ret = request_irq(ar_pci->pdev->irq + MSI_ASSIGN_FW, |
1991 | ath10k_pci_msi_fw_handler, | 2019 | ath10k_pci_msi_fw_handler, |
1992 | IRQF_SHARED, "ath10k_pci", ar); | 2020 | IRQF_SHARED, "ath10k_pci", ar); |
1993 | if (ret) | 2021 | if (ret) { |
2022 | ath10k_warn("request_irq(%d) failed %d\n", | ||
2023 | ar_pci->pdev->irq + MSI_ASSIGN_FW, ret); | ||
2024 | |||
2025 | pci_disable_msi(ar_pci->pdev); | ||
1994 | return ret; | 2026 | return ret; |
2027 | } | ||
1995 | 2028 | ||
1996 | for (i = MSI_ASSIGN_CE_INITIAL; i <= MSI_ASSIGN_CE_MAX; i++) { | 2029 | for (i = MSI_ASSIGN_CE_INITIAL; i <= MSI_ASSIGN_CE_MAX; i++) { |
1997 | ret = request_irq(ar_pci->pdev->irq + i, | 2030 | ret = request_irq(ar_pci->pdev->irq + i, |
@@ -2239,6 +2272,9 @@ static void ath10k_pci_dump_features(struct ath10k_pci *ar_pci) | |||
2239 | case ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND: | 2272 | case ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND: |
2240 | ath10k_dbg(ATH10K_DBG_PCI, "QCA988X_1.0 workaround enabled\n"); | 2273 | ath10k_dbg(ATH10K_DBG_PCI, "QCA988X_1.0 workaround enabled\n"); |
2241 | break; | 2274 | break; |
2275 | case ATH10K_PCI_FEATURE_SOC_POWER_SAVE: | ||
2276 | ath10k_dbg(ATH10K_DBG_PCI, "QCA98XX SoC power save enabled\n"); | ||
2277 | break; | ||
2242 | } | 2278 | } |
2243 | } | 2279 | } |
2244 | } | 2280 | } |
@@ -2274,6 +2310,9 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
2274 | goto err_ar_pci; | 2310 | goto err_ar_pci; |
2275 | } | 2311 | } |
2276 | 2312 | ||
2313 | if (ath10k_target_ps) | ||
2314 | set_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features); | ||
2315 | |||
2277 | ath10k_pci_dump_features(ar_pci); | 2316 | ath10k_pci_dump_features(ar_pci); |
2278 | 2317 | ||
2279 | ar = ath10k_core_create(ar_pci, ar_pci->dev, &ath10k_pci_hif_ops); | 2318 | ar = ath10k_core_create(ar_pci, ar_pci->dev, &ath10k_pci_hif_ops); |
@@ -2358,22 +2397,14 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
2358 | 2397 | ||
2359 | ar_pci->cacheline_sz = dma_get_cache_alignment(); | 2398 | ar_pci->cacheline_sz = dma_get_cache_alignment(); |
2360 | 2399 | ||
2361 | ret = ath10k_pci_start_intr(ar); | ||
2362 | if (ret) { | ||
2363 | ath10k_err("could not start interrupt handling (%d)\n", ret); | ||
2364 | goto err_iomap; | ||
2365 | } | ||
2366 | |||
2367 | ret = ath10k_core_register(ar); | 2400 | ret = ath10k_core_register(ar); |
2368 | if (ret) { | 2401 | if (ret) { |
2369 | ath10k_err("could not register driver core (%d)\n", ret); | 2402 | ath10k_err("could not register driver core (%d)\n", ret); |
2370 | goto err_intr; | 2403 | goto err_iomap; |
2371 | } | 2404 | } |
2372 | 2405 | ||
2373 | return 0; | 2406 | return 0; |
2374 | 2407 | ||
2375 | err_intr: | ||
2376 | ath10k_pci_stop_intr(ar); | ||
2377 | err_iomap: | 2408 | err_iomap: |
2378 | pci_iounmap(pdev, mem); | 2409 | pci_iounmap(pdev, mem); |
2379 | err_master: | 2410 | err_master: |
@@ -2410,7 +2441,6 @@ static void ath10k_pci_remove(struct pci_dev *pdev) | |||
2410 | tasklet_kill(&ar_pci->msi_fw_err); | 2441 | tasklet_kill(&ar_pci->msi_fw_err); |
2411 | 2442 | ||
2412 | ath10k_core_unregister(ar); | 2443 | ath10k_core_unregister(ar); |
2413 | ath10k_pci_stop_intr(ar); | ||
2414 | 2444 | ||
2415 | pci_set_drvdata(pdev, NULL); | 2445 | pci_set_drvdata(pdev, NULL); |
2416 | pci_iounmap(pdev, ar_pci->mem); | 2446 | pci_iounmap(pdev, ar_pci->mem); |
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h index d3a2e6cc9179..871bb339d56d 100644 --- a/drivers/net/wireless/ath/ath10k/pci.h +++ b/drivers/net/wireless/ath/ath10k/pci.h | |||
@@ -153,6 +153,7 @@ struct service_to_pipe { | |||
153 | enum ath10k_pci_features { | 153 | enum ath10k_pci_features { |
154 | ATH10K_PCI_FEATURE_MSI_X = 0, | 154 | ATH10K_PCI_FEATURE_MSI_X = 0, |
155 | ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND = 1, | 155 | ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND = 1, |
156 | ATH10K_PCI_FEATURE_SOC_POWER_SAVE = 2, | ||
156 | 157 | ||
157 | /* keep last */ | 158 | /* keep last */ |
158 | ATH10K_PCI_FEATURE_COUNT | 159 | ATH10K_PCI_FEATURE_COUNT |
@@ -335,20 +336,22 @@ static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset) | |||
335 | return ioread32(ar_pci->mem + offset); | 336 | return ioread32(ar_pci->mem + offset); |
336 | } | 337 | } |
337 | 338 | ||
338 | extern unsigned int ath10k_target_ps; | ||
339 | |||
340 | void ath10k_do_pci_wake(struct ath10k *ar); | 339 | void ath10k_do_pci_wake(struct ath10k *ar); |
341 | void ath10k_do_pci_sleep(struct ath10k *ar); | 340 | void ath10k_do_pci_sleep(struct ath10k *ar); |
342 | 341 | ||
343 | static inline void ath10k_pci_wake(struct ath10k *ar) | 342 | static inline void ath10k_pci_wake(struct ath10k *ar) |
344 | { | 343 | { |
345 | if (ath10k_target_ps) | 344 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
345 | |||
346 | if (test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features)) | ||
346 | ath10k_do_pci_wake(ar); | 347 | ath10k_do_pci_wake(ar); |
347 | } | 348 | } |
348 | 349 | ||
349 | static inline void ath10k_pci_sleep(struct ath10k *ar) | 350 | static inline void ath10k_pci_sleep(struct ath10k *ar) |
350 | { | 351 | { |
351 | if (ath10k_target_ps) | 352 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
353 | |||
354 | if (test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features)) | ||
352 | ath10k_do_pci_sleep(ar); | 355 | ath10k_do_pci_sleep(ar); |
353 | } | 356 | } |
354 | 357 | ||
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 5e4246015cdc..55f90c761868 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c | |||
@@ -390,9 +390,82 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) | |||
390 | return 0; | 390 | return 0; |
391 | } | 391 | } |
392 | 392 | ||
393 | static int freq_to_idx(struct ath10k *ar, int freq) | ||
394 | { | ||
395 | struct ieee80211_supported_band *sband; | ||
396 | int band, ch, idx = 0; | ||
397 | |||
398 | for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) { | ||
399 | sband = ar->hw->wiphy->bands[band]; | ||
400 | if (!sband) | ||
401 | continue; | ||
402 | |||
403 | for (ch = 0; ch < sband->n_channels; ch++, idx++) | ||
404 | if (sband->channels[ch].center_freq == freq) | ||
405 | goto exit; | ||
406 | } | ||
407 | |||
408 | exit: | ||
409 | return idx; | ||
410 | } | ||
411 | |||
393 | static void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb) | 412 | static void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb) |
394 | { | 413 | { |
395 | ath10k_dbg(ATH10K_DBG_WMI, "WMI_CHAN_INFO_EVENTID\n"); | 414 | struct wmi_chan_info_event *ev; |
415 | struct survey_info *survey; | ||
416 | u32 err_code, freq, cmd_flags, noise_floor, rx_clear_count, cycle_count; | ||
417 | int idx; | ||
418 | |||
419 | ev = (struct wmi_chan_info_event *)skb->data; | ||
420 | |||
421 | err_code = __le32_to_cpu(ev->err_code); | ||
422 | freq = __le32_to_cpu(ev->freq); | ||
423 | cmd_flags = __le32_to_cpu(ev->cmd_flags); | ||
424 | noise_floor = __le32_to_cpu(ev->noise_floor); | ||
425 | rx_clear_count = __le32_to_cpu(ev->rx_clear_count); | ||
426 | cycle_count = __le32_to_cpu(ev->cycle_count); | ||
427 | |||
428 | ath10k_dbg(ATH10K_DBG_WMI, | ||
429 | "chan info err_code %d freq %d cmd_flags %d noise_floor %d rx_clear_count %d cycle_count %d\n", | ||
430 | err_code, freq, cmd_flags, noise_floor, rx_clear_count, | ||
431 | cycle_count); | ||
432 | |||
433 | spin_lock_bh(&ar->data_lock); | ||
434 | |||
435 | if (!ar->scan.in_progress) { | ||
436 | ath10k_warn("chan info event without a scan request?\n"); | ||
437 | goto exit; | ||
438 | } | ||
439 | |||
440 | idx = freq_to_idx(ar, freq); | ||
441 | if (idx >= ARRAY_SIZE(ar->survey)) { | ||
442 | ath10k_warn("chan info: invalid frequency %d (idx %d out of bounds)\n", | ||
443 | freq, idx); | ||
444 | goto exit; | ||
445 | } | ||
446 | |||
447 | if (cmd_flags & WMI_CHAN_INFO_FLAG_COMPLETE) { | ||
448 | /* During scanning chan info is reported twice for each | ||
449 | * visited channel. The reported cycle count is global | ||
450 | * and per-channel cycle count must be calculated */ | ||
451 | |||
452 | cycle_count -= ar->survey_last_cycle_count; | ||
453 | rx_clear_count -= ar->survey_last_rx_clear_count; | ||
454 | |||
455 | survey = &ar->survey[idx]; | ||
456 | survey->channel_time = WMI_CHAN_INFO_MSEC(cycle_count); | ||
457 | survey->channel_time_rx = WMI_CHAN_INFO_MSEC(rx_clear_count); | ||
458 | survey->noise = noise_floor; | ||
459 | survey->filled = SURVEY_INFO_CHANNEL_TIME | | ||
460 | SURVEY_INFO_CHANNEL_TIME_RX | | ||
461 | SURVEY_INFO_NOISE_DBM; | ||
462 | } | ||
463 | |||
464 | ar->survey_last_rx_clear_count = rx_clear_count; | ||
465 | ar->survey_last_cycle_count = cycle_count; | ||
466 | |||
467 | exit: | ||
468 | spin_unlock_bh(&ar->data_lock); | ||
396 | } | 469 | } |
397 | 470 | ||
398 | static void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb) | 471 | static void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb) |
@@ -868,6 +941,13 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, | |||
868 | (__le32_to_cpu(ev->sw_version_1) & 0xffff0000) >> 16; | 941 | (__le32_to_cpu(ev->sw_version_1) & 0xffff0000) >> 16; |
869 | ar->fw_version_build = (__le32_to_cpu(ev->sw_version_1) & 0x0000ffff); | 942 | ar->fw_version_build = (__le32_to_cpu(ev->sw_version_1) & 0x0000ffff); |
870 | ar->phy_capability = __le32_to_cpu(ev->phy_capability); | 943 | ar->phy_capability = __le32_to_cpu(ev->phy_capability); |
944 | ar->num_rf_chains = __le32_to_cpu(ev->num_rf_chains); | ||
945 | |||
946 | if (ar->num_rf_chains > WMI_MAX_SPATIAL_STREAM) { | ||
947 | ath10k_warn("hardware advertises support for more spatial streams than it should (%d > %d)\n", | ||
948 | ar->num_rf_chains, WMI_MAX_SPATIAL_STREAM); | ||
949 | ar->num_rf_chains = WMI_MAX_SPATIAL_STREAM; | ||
950 | } | ||
871 | 951 | ||
872 | ar->ath_common.regulatory.current_rd = | 952 | ar->ath_common.regulatory.current_rd = |
873 | __le32_to_cpu(ev->hal_reg_capabilities.eeprom_rd); | 953 | __le32_to_cpu(ev->hal_reg_capabilities.eeprom_rd); |
@@ -892,7 +972,7 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, | |||
892 | } | 972 | } |
893 | 973 | ||
894 | ath10k_dbg(ATH10K_DBG_WMI, | 974 | ath10k_dbg(ATH10K_DBG_WMI, |
895 | "wmi event service ready sw_ver 0x%08x sw_ver1 0x%08x abi_ver %u phy_cap 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_msc 0x%08x sys_cap_info 0x%08x mem_reqs %u\n", | 975 | "wmi event service ready sw_ver 0x%08x sw_ver1 0x%08x abi_ver %u phy_cap 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_msc 0x%08x sys_cap_info 0x%08x mem_reqs %u num_rf_chains %u\n", |
896 | __le32_to_cpu(ev->sw_version), | 976 | __le32_to_cpu(ev->sw_version), |
897 | __le32_to_cpu(ev->sw_version_1), | 977 | __le32_to_cpu(ev->sw_version_1), |
898 | __le32_to_cpu(ev->abi_version), | 978 | __le32_to_cpu(ev->abi_version), |
@@ -901,7 +981,8 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, | |||
901 | __le32_to_cpu(ev->vht_cap_info), | 981 | __le32_to_cpu(ev->vht_cap_info), |
902 | __le32_to_cpu(ev->vht_supp_mcs), | 982 | __le32_to_cpu(ev->vht_supp_mcs), |
903 | __le32_to_cpu(ev->sys_cap_info), | 983 | __le32_to_cpu(ev->sys_cap_info), |
904 | __le32_to_cpu(ev->num_mem_reqs)); | 984 | __le32_to_cpu(ev->num_mem_reqs), |
985 | __le32_to_cpu(ev->num_rf_chains)); | ||
905 | 986 | ||
906 | complete(&ar->wmi.service_ready); | 987 | complete(&ar->wmi.service_ready); |
907 | } | 988 | } |
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index da3b2bc4c88a..2c5a4f8daf2e 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h | |||
@@ -2931,6 +2931,11 @@ struct wmi_chan_info_event { | |||
2931 | __le32 cycle_count; | 2931 | __le32 cycle_count; |
2932 | } __packed; | 2932 | } __packed; |
2933 | 2933 | ||
2934 | #define WMI_CHAN_INFO_FLAG_COMPLETE BIT(0) | ||
2935 | |||
2936 | /* FIXME: empirically extrapolated */ | ||
2937 | #define WMI_CHAN_INFO_MSEC(x) ((x) / 76595) | ||
2938 | |||
2934 | /* Beacon filter wmi command info */ | 2939 | /* Beacon filter wmi command info */ |
2935 | #define BCN_FLT_MAX_SUPPORTED_IES 256 | 2940 | #define BCN_FLT_MAX_SUPPORTED_IES 256 |
2936 | #define BCN_FLT_MAX_ELEMS_IE_LIST (BCN_FLT_MAX_SUPPORTED_IES / 32) | 2941 | #define BCN_FLT_MAX_ELEMS_IE_LIST (BCN_FLT_MAX_SUPPORTED_IES / 32) |
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index 2d691b8b95b9..74bd54d6aceb 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/average.h> | 29 | #include <linux/average.h> |
30 | #include <linux/leds.h> | 30 | #include <linux/leds.h> |
31 | #include <net/mac80211.h> | 31 | #include <net/mac80211.h> |
32 | #include <net/cfg80211.h> | ||
32 | 33 | ||
33 | /* RX/TX descriptor hw structs | 34 | /* RX/TX descriptor hw structs |
34 | * TODO: Driver part should only see sw structs */ | 35 | * TODO: Driver part should only see sw structs */ |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index ce67ab791eae..48161edec8de 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/etherdevice.h> | 56 | #include <linux/etherdevice.h> |
57 | #include <linux/nl80211.h> | 57 | #include <linux/nl80211.h> |
58 | 58 | ||
59 | #include <net/cfg80211.h> | ||
59 | #include <net/ieee80211_radiotap.h> | 60 | #include <net/ieee80211_radiotap.h> |
60 | 61 | ||
61 | #include <asm/unaligned.h> | 62 | #include <asm/unaligned.h> |
@@ -165,28 +166,36 @@ static const struct ieee80211_rate ath5k_rates[] = { | |||
165 | .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | 166 | .flags = IEEE80211_RATE_SHORT_PREAMBLE }, |
166 | { .bitrate = 60, | 167 | { .bitrate = 60, |
167 | .hw_value = ATH5K_RATE_CODE_6M, | 168 | .hw_value = ATH5K_RATE_CODE_6M, |
168 | .flags = 0 }, | 169 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
170 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
169 | { .bitrate = 90, | 171 | { .bitrate = 90, |
170 | .hw_value = ATH5K_RATE_CODE_9M, | 172 | .hw_value = ATH5K_RATE_CODE_9M, |
171 | .flags = 0 }, | 173 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
174 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
172 | { .bitrate = 120, | 175 | { .bitrate = 120, |
173 | .hw_value = ATH5K_RATE_CODE_12M, | 176 | .hw_value = ATH5K_RATE_CODE_12M, |
174 | .flags = 0 }, | 177 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
178 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
175 | { .bitrate = 180, | 179 | { .bitrate = 180, |
176 | .hw_value = ATH5K_RATE_CODE_18M, | 180 | .hw_value = ATH5K_RATE_CODE_18M, |
177 | .flags = 0 }, | 181 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
182 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
178 | { .bitrate = 240, | 183 | { .bitrate = 240, |
179 | .hw_value = ATH5K_RATE_CODE_24M, | 184 | .hw_value = ATH5K_RATE_CODE_24M, |
180 | .flags = 0 }, | 185 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
186 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
181 | { .bitrate = 360, | 187 | { .bitrate = 360, |
182 | .hw_value = ATH5K_RATE_CODE_36M, | 188 | .hw_value = ATH5K_RATE_CODE_36M, |
183 | .flags = 0 }, | 189 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
190 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
184 | { .bitrate = 480, | 191 | { .bitrate = 480, |
185 | .hw_value = ATH5K_RATE_CODE_48M, | 192 | .hw_value = ATH5K_RATE_CODE_48M, |
186 | .flags = 0 }, | 193 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
194 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
187 | { .bitrate = 540, | 195 | { .bitrate = 540, |
188 | .hw_value = ATH5K_RATE_CODE_54M, | 196 | .hw_value = ATH5K_RATE_CODE_54M, |
189 | .flags = 0 }, | 197 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
198 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
190 | }; | 199 | }; |
191 | 200 | ||
192 | static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp) | 201 | static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp) |
@@ -435,11 +444,27 @@ ath5k_setup_bands(struct ieee80211_hw *hw) | |||
435 | * Called with ah->lock. | 444 | * Called with ah->lock. |
436 | */ | 445 | */ |
437 | int | 446 | int |
438 | ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan) | 447 | ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef) |
439 | { | 448 | { |
440 | ATH5K_DBG(ah, ATH5K_DEBUG_RESET, | 449 | ATH5K_DBG(ah, ATH5K_DEBUG_RESET, |
441 | "channel set, resetting (%u -> %u MHz)\n", | 450 | "channel set, resetting (%u -> %u MHz)\n", |
442 | ah->curchan->center_freq, chan->center_freq); | 451 | ah->curchan->center_freq, chandef->chan->center_freq); |
452 | |||
453 | switch (chandef->width) { | ||
454 | case NL80211_CHAN_WIDTH_20: | ||
455 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
456 | ah->ah_bwmode = AR5K_BWMODE_DEFAULT; | ||
457 | break; | ||
458 | case NL80211_CHAN_WIDTH_5: | ||
459 | ah->ah_bwmode = AR5K_BWMODE_5MHZ; | ||
460 | break; | ||
461 | case NL80211_CHAN_WIDTH_10: | ||
462 | ah->ah_bwmode = AR5K_BWMODE_10MHZ; | ||
463 | break; | ||
464 | default: | ||
465 | WARN_ON(1); | ||
466 | return -EINVAL; | ||
467 | } | ||
443 | 468 | ||
444 | /* | 469 | /* |
445 | * To switch channels clear any pending DMA operations; | 470 | * To switch channels clear any pending DMA operations; |
@@ -447,7 +472,7 @@ ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan) | |||
447 | * hardware at the new frequency, and then re-enable | 472 | * hardware at the new frequency, and then re-enable |
448 | * the relevant bits of the h/w. | 473 | * the relevant bits of the h/w. |
449 | */ | 474 | */ |
450 | return ath5k_reset(ah, chan, true); | 475 | return ath5k_reset(ah, chandef->chan, true); |
451 | } | 476 | } |
452 | 477 | ||
453 | void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) | 478 | void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) |
@@ -1400,6 +1425,16 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb, | |||
1400 | 1425 | ||
1401 | rxs->rate_idx = ath5k_hw_to_driver_rix(ah, rs->rs_rate); | 1426 | rxs->rate_idx = ath5k_hw_to_driver_rix(ah, rs->rs_rate); |
1402 | rxs->flag |= ath5k_rx_decrypted(ah, skb, rs); | 1427 | rxs->flag |= ath5k_rx_decrypted(ah, skb, rs); |
1428 | switch (ah->ah_bwmode) { | ||
1429 | case AR5K_BWMODE_5MHZ: | ||
1430 | rxs->flag |= RX_FLAG_5MHZ; | ||
1431 | break; | ||
1432 | case AR5K_BWMODE_10MHZ: | ||
1433 | rxs->flag |= RX_FLAG_10MHZ; | ||
1434 | break; | ||
1435 | default: | ||
1436 | break; | ||
1437 | } | ||
1403 | 1438 | ||
1404 | if (rxs->rate_idx >= 0 && rs->rs_rate == | 1439 | if (rxs->rate_idx >= 0 && rs->rs_rate == |
1405 | ah->sbands[ah->curchan->band].bitrates[rxs->rate_idx].hw_value_short) | 1440 | ah->sbands[ah->curchan->band].bitrates[rxs->rate_idx].hw_value_short) |
@@ -2507,6 +2542,8 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops) | |||
2507 | /* SW support for IBSS_RSN is provided by mac80211 */ | 2542 | /* SW support for IBSS_RSN is provided by mac80211 */ |
2508 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 2543 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
2509 | 2544 | ||
2545 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ; | ||
2546 | |||
2510 | /* both antennas can be configured as RX or TX */ | 2547 | /* both antennas can be configured as RX or TX */ |
2511 | hw->wiphy->available_antennas_tx = 0x3; | 2548 | hw->wiphy->available_antennas_tx = 0x3; |
2512 | hw->wiphy->available_antennas_rx = 0x3; | 2549 | hw->wiphy->available_antennas_rx = 0x3; |
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h index ca9a83ceeee1..97469d0fbad7 100644 --- a/drivers/net/wireless/ath/ath5k/base.h +++ b/drivers/net/wireless/ath/ath5k/base.h | |||
@@ -101,7 +101,7 @@ void ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable); | |||
101 | 101 | ||
102 | void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah, | 102 | void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah, |
103 | struct ieee80211_vif *vif); | 103 | struct ieee80211_vif *vif); |
104 | int ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan); | 104 | int ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef); |
105 | void ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); | 105 | void ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); |
106 | void ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); | 106 | void ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); |
107 | void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, | 107 | void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, |
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index 9d00dab666a8..b8d031ae63c2 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c | |||
@@ -245,9 +245,11 @@ static ssize_t write_file_beacon(struct file *file, | |||
245 | struct ath5k_hw *ah = file->private_data; | 245 | struct ath5k_hw *ah = file->private_data; |
246 | char buf[20]; | 246 | char buf[20]; |
247 | 247 | ||
248 | if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) | 248 | count = min_t(size_t, count, sizeof(buf) - 1); |
249 | if (copy_from_user(buf, userbuf, count)) | ||
249 | return -EFAULT; | 250 | return -EFAULT; |
250 | 251 | ||
252 | buf[count] = '\0'; | ||
251 | if (strncmp(buf, "disable", 7) == 0) { | 253 | if (strncmp(buf, "disable", 7) == 0) { |
252 | AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE); | 254 | AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE); |
253 | pr_info("debugfs disable beacons\n"); | 255 | pr_info("debugfs disable beacons\n"); |
@@ -345,9 +347,11 @@ static ssize_t write_file_debug(struct file *file, | |||
345 | unsigned int i; | 347 | unsigned int i; |
346 | char buf[20]; | 348 | char buf[20]; |
347 | 349 | ||
348 | if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) | 350 | count = min_t(size_t, count, sizeof(buf) - 1); |
351 | if (copy_from_user(buf, userbuf, count)) | ||
349 | return -EFAULT; | 352 | return -EFAULT; |
350 | 353 | ||
354 | buf[count] = '\0'; | ||
351 | for (i = 0; i < ARRAY_SIZE(dbg_info); i++) { | 355 | for (i = 0; i < ARRAY_SIZE(dbg_info); i++) { |
352 | if (strncmp(buf, dbg_info[i].name, | 356 | if (strncmp(buf, dbg_info[i].name, |
353 | strlen(dbg_info[i].name)) == 0) { | 357 | strlen(dbg_info[i].name)) == 0) { |
@@ -448,9 +452,11 @@ static ssize_t write_file_antenna(struct file *file, | |||
448 | unsigned int i; | 452 | unsigned int i; |
449 | char buf[20]; | 453 | char buf[20]; |
450 | 454 | ||
451 | if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) | 455 | count = min_t(size_t, count, sizeof(buf) - 1); |
456 | if (copy_from_user(buf, userbuf, count)) | ||
452 | return -EFAULT; | 457 | return -EFAULT; |
453 | 458 | ||
459 | buf[count] = '\0'; | ||
454 | if (strncmp(buf, "diversity", 9) == 0) { | 460 | if (strncmp(buf, "diversity", 9) == 0) { |
455 | ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_DEFAULT); | 461 | ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_DEFAULT); |
456 | pr_info("debug: enable diversity\n"); | 462 | pr_info("debug: enable diversity\n"); |
@@ -619,9 +625,11 @@ static ssize_t write_file_frameerrors(struct file *file, | |||
619 | struct ath5k_statistics *st = &ah->stats; | 625 | struct ath5k_statistics *st = &ah->stats; |
620 | char buf[20]; | 626 | char buf[20]; |
621 | 627 | ||
622 | if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) | 628 | count = min_t(size_t, count, sizeof(buf) - 1); |
629 | if (copy_from_user(buf, userbuf, count)) | ||
623 | return -EFAULT; | 630 | return -EFAULT; |
624 | 631 | ||
632 | buf[count] = '\0'; | ||
625 | if (strncmp(buf, "clear", 5) == 0) { | 633 | if (strncmp(buf, "clear", 5) == 0) { |
626 | st->rxerr_crc = 0; | 634 | st->rxerr_crc = 0; |
627 | st->rxerr_phy = 0; | 635 | st->rxerr_phy = 0; |
@@ -766,9 +774,11 @@ static ssize_t write_file_ani(struct file *file, | |||
766 | struct ath5k_hw *ah = file->private_data; | 774 | struct ath5k_hw *ah = file->private_data; |
767 | char buf[20]; | 775 | char buf[20]; |
768 | 776 | ||
769 | if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) | 777 | count = min_t(size_t, count, sizeof(buf) - 1); |
778 | if (copy_from_user(buf, userbuf, count)) | ||
770 | return -EFAULT; | 779 | return -EFAULT; |
771 | 780 | ||
781 | buf[count] = '\0'; | ||
772 | if (strncmp(buf, "sens-low", 8) == 0) { | 782 | if (strncmp(buf, "sens-low", 8) == 0) { |
773 | ath5k_ani_init(ah, ATH5K_ANI_MODE_MANUAL_HIGH); | 783 | ath5k_ani_init(ah, ATH5K_ANI_MODE_MANUAL_HIGH); |
774 | } else if (strncmp(buf, "sens-high", 9) == 0) { | 784 | } else if (strncmp(buf, "sens-high", 9) == 0) { |
@@ -862,9 +872,11 @@ static ssize_t write_file_queue(struct file *file, | |||
862 | struct ath5k_hw *ah = file->private_data; | 872 | struct ath5k_hw *ah = file->private_data; |
863 | char buf[20]; | 873 | char buf[20]; |
864 | 874 | ||
865 | if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) | 875 | count = min_t(size_t, count, sizeof(buf) - 1); |
876 | if (copy_from_user(buf, userbuf, count)) | ||
866 | return -EFAULT; | 877 | return -EFAULT; |
867 | 878 | ||
879 | buf[count] = '\0'; | ||
868 | if (strncmp(buf, "start", 5) == 0) | 880 | if (strncmp(buf, "start", 5) == 0) |
869 | ieee80211_wake_queues(ah->hw); | 881 | ieee80211_wake_queues(ah->hw); |
870 | else if (strncmp(buf, "stop", 4) == 0) | 882 | else if (strncmp(buf, "stop", 4) == 0) |
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index 40825d43322e..4ee01f654235 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | |||
@@ -202,7 +202,7 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed) | |||
202 | mutex_lock(&ah->lock); | 202 | mutex_lock(&ah->lock); |
203 | 203 | ||
204 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 204 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { |
205 | ret = ath5k_chan_set(ah, conf->chandef.chan); | 205 | ret = ath5k_chan_set(ah, &conf->chandef); |
206 | if (ret < 0) | 206 | if (ret < 0) |
207 | goto unlock; | 207 | goto unlock; |
208 | } | 208 | } |
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c index 1f16b4227d8f..c60d36aa13e2 100644 --- a/drivers/net/wireless/ath/ath5k/pcu.c +++ b/drivers/net/wireless/ath/ath5k/pcu.c | |||
@@ -144,11 +144,13 @@ ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum ieee80211_band band, | |||
144 | sifs = AR5K_INIT_SIFS_HALF_RATE; | 144 | sifs = AR5K_INIT_SIFS_HALF_RATE; |
145 | preamble *= 2; | 145 | preamble *= 2; |
146 | sym_time *= 2; | 146 | sym_time *= 2; |
147 | bitrate = DIV_ROUND_UP(bitrate, 2); | ||
147 | break; | 148 | break; |
148 | case AR5K_BWMODE_5MHZ: | 149 | case AR5K_BWMODE_5MHZ: |
149 | sifs = AR5K_INIT_SIFS_QUARTER_RATE; | 150 | sifs = AR5K_INIT_SIFS_QUARTER_RATE; |
150 | preamble *= 4; | 151 | preamble *= 4; |
151 | sym_time *= 4; | 152 | sym_time *= 4; |
153 | bitrate = DIV_ROUND_UP(bitrate, 4); | ||
152 | break; | 154 | break; |
153 | default: | 155 | default: |
154 | sifs = AR5K_INIT_SIFS_DEFAULT_BG; | 156 | sifs = AR5K_INIT_SIFS_DEFAULT_BG; |
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c index 65fe929529a8..0583c69d26db 100644 --- a/drivers/net/wireless/ath/ath5k/qcu.c +++ b/drivers/net/wireless/ath/ath5k/qcu.c | |||
@@ -566,9 +566,11 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time) | |||
566 | { | 566 | { |
567 | struct ieee80211_channel *channel = ah->ah_current_channel; | 567 | struct ieee80211_channel *channel = ah->ah_current_channel; |
568 | enum ieee80211_band band; | 568 | enum ieee80211_band band; |
569 | struct ieee80211_supported_band *sband; | ||
569 | struct ieee80211_rate *rate; | 570 | struct ieee80211_rate *rate; |
570 | u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock; | 571 | u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock; |
571 | u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time); | 572 | u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time); |
573 | u32 rate_flags, i; | ||
572 | 574 | ||
573 | if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX) | 575 | if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX) |
574 | return -EINVAL; | 576 | return -EINVAL; |
@@ -605,7 +607,28 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time) | |||
605 | else | 607 | else |
606 | band = IEEE80211_BAND_2GHZ; | 608 | band = IEEE80211_BAND_2GHZ; |
607 | 609 | ||
608 | rate = &ah->sbands[band].bitrates[0]; | 610 | switch (ah->ah_bwmode) { |
611 | case AR5K_BWMODE_5MHZ: | ||
612 | rate_flags = IEEE80211_RATE_SUPPORTS_5MHZ; | ||
613 | break; | ||
614 | case AR5K_BWMODE_10MHZ: | ||
615 | rate_flags = IEEE80211_RATE_SUPPORTS_10MHZ; | ||
616 | break; | ||
617 | default: | ||
618 | rate_flags = 0; | ||
619 | break; | ||
620 | } | ||
621 | sband = &ah->sbands[band]; | ||
622 | rate = NULL; | ||
623 | for (i = 0; i < sband->n_bitrates; i++) { | ||
624 | if ((rate_flags & sband->bitrates[i].flags) != rate_flags) | ||
625 | continue; | ||
626 | rate = &sband->bitrates[i]; | ||
627 | break; | ||
628 | } | ||
629 | if (WARN_ON(!rate)) | ||
630 | return -EINVAL; | ||
631 | |||
609 | ack_tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, false); | 632 | ack_tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, false); |
610 | 633 | ||
611 | /* ack_tx_time includes an SIFS already */ | 634 | /* ack_tx_time includes an SIFS already */ |
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 6a67881f94d6..4f316bdcbab5 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -1836,6 +1836,9 @@ void ath6kl_stop_txrx(struct ath6kl *ar) | |||
1836 | 1836 | ||
1837 | clear_bit(WMI_READY, &ar->flag); | 1837 | clear_bit(WMI_READY, &ar->flag); |
1838 | 1838 | ||
1839 | if (ar->fw_recovery.enable) | ||
1840 | del_timer_sync(&ar->fw_recovery.hb_timer); | ||
1841 | |||
1839 | /* | 1842 | /* |
1840 | * After wmi_shudown all WMI events will be dropped. We | 1843 | * After wmi_shudown all WMI events will be dropped. We |
1841 | * need to cleanup the buffers allocated in AP mode and | 1844 | * need to cleanup the buffers allocated in AP mode and |
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index d4fcfcad57d0..5839fc23bdc7 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c | |||
@@ -29,6 +29,9 @@ struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 *node_addr) | |||
29 | struct ath6kl_sta *conn = NULL; | 29 | struct ath6kl_sta *conn = NULL; |
30 | u8 i, max_conn; | 30 | u8 i, max_conn; |
31 | 31 | ||
32 | if (is_zero_ether_addr(node_addr)) | ||
33 | return NULL; | ||
34 | |||
32 | max_conn = (vif->nw_type == AP_NETWORK) ? AP_MAX_NUM_STA : 0; | 35 | max_conn = (vif->nw_type == AP_NETWORK) ? AP_MAX_NUM_STA : 0; |
33 | 36 | ||
34 | for (i = 0; i < max_conn; i++) { | 37 | for (i = 0; i < max_conn; i++) { |
diff --git a/drivers/net/wireless/ath/ath6kl/testmode.c b/drivers/net/wireless/ath/ath6kl/testmode.c index acc9aa832f76..d67170ea1038 100644 --- a/drivers/net/wireless/ath/ath6kl/testmode.c +++ b/drivers/net/wireless/ath/ath6kl/testmode.c | |||
@@ -66,7 +66,8 @@ nla_put_failure: | |||
66 | ath6kl_warn("nla_put failed on testmode rx skb!\n"); | 66 | ath6kl_warn("nla_put failed on testmode rx skb!\n"); |
67 | } | 67 | } |
68 | 68 | ||
69 | int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len) | 69 | int ath6kl_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, |
70 | void *data, int len) | ||
70 | { | 71 | { |
71 | struct ath6kl *ar = wiphy_priv(wiphy); | 72 | struct ath6kl *ar = wiphy_priv(wiphy); |
72 | struct nlattr *tb[ATH6KL_TM_ATTR_MAX + 1]; | 73 | struct nlattr *tb[ATH6KL_TM_ATTR_MAX + 1]; |
diff --git a/drivers/net/wireless/ath/ath6kl/testmode.h b/drivers/net/wireless/ath/ath6kl/testmode.h index fe651d6707df..9fbcdec3e208 100644 --- a/drivers/net/wireless/ath/ath6kl/testmode.h +++ b/drivers/net/wireless/ath/ath6kl/testmode.h | |||
@@ -20,7 +20,8 @@ | |||
20 | #ifdef CONFIG_NL80211_TESTMODE | 20 | #ifdef CONFIG_NL80211_TESTMODE |
21 | 21 | ||
22 | void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, size_t buf_len); | 22 | void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, size_t buf_len); |
23 | int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len); | 23 | int ath6kl_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, |
24 | void *data, int len); | ||
24 | 25 | ||
25 | #else | 26 | #else |
26 | 27 | ||
@@ -29,7 +30,9 @@ static inline void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, | |||
29 | { | 30 | { |
30 | } | 31 | } |
31 | 32 | ||
32 | static inline int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len) | 33 | static inline int ath6kl_tm_cmd(struct wiphy *wiphy, |
34 | struct wireless_dev *wdev, | ||
35 | void *data, int len) | ||
33 | { | 36 | { |
34 | return 0; | 37 | return 0; |
35 | } | 38 | } |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 87aefb4c4c23..546d5da0b894 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -568,8 +568,8 @@ static int ath6kl_wmi_rx_probe_req_event_rx(struct wmi *wmi, u8 *datap, int len, | |||
568 | dlen, freq, vif->probe_req_report); | 568 | dlen, freq, vif->probe_req_report); |
569 | 569 | ||
570 | if (vif->probe_req_report || vif->nw_type == AP_NETWORK) | 570 | if (vif->probe_req_report || vif->nw_type == AP_NETWORK) |
571 | cfg80211_rx_mgmt(&vif->wdev, freq, 0, | 571 | cfg80211_rx_mgmt(&vif->wdev, freq, 0, ev->data, dlen, 0, |
572 | ev->data, dlen, GFP_ATOMIC); | 572 | GFP_ATOMIC); |
573 | 573 | ||
574 | return 0; | 574 | return 0; |
575 | } | 575 | } |
@@ -608,8 +608,7 @@ static int ath6kl_wmi_rx_action_event_rx(struct wmi *wmi, u8 *datap, int len, | |||
608 | return -EINVAL; | 608 | return -EINVAL; |
609 | } | 609 | } |
610 | ath6kl_dbg(ATH6KL_DBG_WMI, "rx_action: len=%u freq=%u\n", dlen, freq); | 610 | ath6kl_dbg(ATH6KL_DBG_WMI, "rx_action: len=%u freq=%u\n", dlen, freq); |
611 | cfg80211_rx_mgmt(&vif->wdev, freq, 0, | 611 | cfg80211_rx_mgmt(&vif->wdev, freq, 0, ev->data, dlen, 0, GFP_ATOMIC); |
612 | ev->data, dlen, GFP_ATOMIC); | ||
613 | 612 | ||
614 | return 0; | 613 | return 0; |
615 | } | 614 | } |
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig index c91bc6111c23..7944c25c9a43 100644 --- a/drivers/net/wireless/ath/ath9k/Kconfig +++ b/drivers/net/wireless/ath/ath9k/Kconfig | |||
@@ -56,7 +56,7 @@ config ATH9K_AHB | |||
56 | 56 | ||
57 | config ATH9K_DEBUGFS | 57 | config ATH9K_DEBUGFS |
58 | bool "Atheros ath9k debugging" | 58 | bool "Atheros ath9k debugging" |
59 | depends on ATH9K | 59 | depends on ATH9K && DEBUG_FS |
60 | select MAC80211_DEBUGFS | 60 | select MAC80211_DEBUGFS |
61 | select RELAY | 61 | select RELAY |
62 | ---help--- | 62 | ---help--- |
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index 4994bea809eb..be466b0ef7a7 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -319,9 +319,6 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) | |||
319 | ah->ani_function = 0; | 319 | ah->ani_function = 0; |
320 | } | 320 | } |
321 | 321 | ||
322 | /* always allow mode (on/off) to be controlled */ | ||
323 | ah->ani_function |= ATH9K_ANI_MODE; | ||
324 | |||
325 | ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL, | 322 | ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL, |
326 | aniState->ofdmNoiseImmunityLevel); | 323 | aniState->ofdmNoiseImmunityLevel); |
327 | cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL, | 324 | cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL, |
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h index b54a3fb01883..21e7b83c3f6a 100644 --- a/drivers/net/wireless/ath/ath9k/ani.h +++ b/drivers/net/wireless/ath/ath9k/ani.h | |||
@@ -48,15 +48,10 @@ | |||
48 | /* values here are relative to the INI */ | 48 | /* values here are relative to the INI */ |
49 | 49 | ||
50 | enum ath9k_ani_cmd { | 50 | enum ath9k_ani_cmd { |
51 | ATH9K_ANI_PRESENT = 0x1, | 51 | ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x1, |
52 | ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2, | 52 | ATH9K_ANI_FIRSTEP_LEVEL = 0x2, |
53 | ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4, | 53 | ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x4, |
54 | ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8, | 54 | ATH9K_ANI_MRC_CCK = 0x8, |
55 | ATH9K_ANI_FIRSTEP_LEVEL = 0x10, | ||
56 | ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20, | ||
57 | ATH9K_ANI_MODE = 0x40, | ||
58 | ATH9K_ANI_PHYERR_RESET = 0x80, | ||
59 | ATH9K_ANI_MRC_CCK = 0x100, | ||
60 | ATH9K_ANI_ALL = 0xfff | 55 | ATH9K_ANI_ALL = 0xfff |
61 | }; | 56 | }; |
62 | 57 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index 1576d58291d4..08656473c63e 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -1160,8 +1160,6 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
1160 | */ | 1160 | */ |
1161 | WARN_ON(1); | 1161 | WARN_ON(1); |
1162 | break; | 1162 | break; |
1163 | case ATH9K_ANI_PRESENT: | ||
1164 | break; | ||
1165 | default: | 1163 | default: |
1166 | ath_dbg(common, ANI, "invalid cmd %u\n", cmd); | 1164 | ath_dbg(common, ANI, "invalid cmd %u\n", cmd); |
1167 | return false; | 1165 | return false; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c index 8dc2d089cdef..fb61b081d172 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c | |||
@@ -269,13 +269,12 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah, | |||
269 | if (ah->config.pcie_waen & AR_WA_D3_L1_DISABLE) | 269 | if (ah->config.pcie_waen & AR_WA_D3_L1_DISABLE) |
270 | val |= AR_WA_D3_L1_DISABLE; | 270 | val |= AR_WA_D3_L1_DISABLE; |
271 | } else { | 271 | } else { |
272 | if (((AR_SREV_9285(ah) || | 272 | if (AR_SREV_9285(ah) || AR_SREV_9271(ah) || AR_SREV_9287(ah)) { |
273 | AR_SREV_9271(ah) || | 273 | if (AR9285_WA_DEFAULT & AR_WA_D3_L1_DISABLE) |
274 | AR_SREV_9287(ah)) && | 274 | val |= AR_WA_D3_L1_DISABLE; |
275 | (AR9285_WA_DEFAULT & AR_WA_D3_L1_DISABLE)) || | 275 | } else if (AR_SREV_9280(ah)) { |
276 | (AR_SREV_9280(ah) && | 276 | if (AR9280_WA_DEFAULT & AR_WA_D3_L1_DISABLE) |
277 | (AR9280_WA_DEFAULT & AR_WA_D3_L1_DISABLE))) { | 277 | val |= AR_WA_D3_L1_DISABLE; |
278 | val |= AR_WA_D3_L1_DISABLE; | ||
279 | } | 278 | } |
280 | } | 279 | } |
281 | 280 | ||
@@ -297,24 +296,18 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah, | |||
297 | } else { | 296 | } else { |
298 | if (ah->config.pcie_waen) { | 297 | if (ah->config.pcie_waen) { |
299 | val = ah->config.pcie_waen; | 298 | val = ah->config.pcie_waen; |
300 | if (!power_off) | 299 | val &= (~AR_WA_D3_L1_DISABLE); |
301 | val &= (~AR_WA_D3_L1_DISABLE); | ||
302 | } else { | 300 | } else { |
303 | if (AR_SREV_9285(ah) || | 301 | if (AR_SREV_9285(ah) || AR_SREV_9271(ah) || AR_SREV_9287(ah)) { |
304 | AR_SREV_9271(ah) || | ||
305 | AR_SREV_9287(ah)) { | ||
306 | val = AR9285_WA_DEFAULT; | 302 | val = AR9285_WA_DEFAULT; |
307 | if (!power_off) | 303 | val &= (~AR_WA_D3_L1_DISABLE); |
308 | val &= (~AR_WA_D3_L1_DISABLE); | 304 | } else if (AR_SREV_9280(ah)) { |
309 | } | ||
310 | else if (AR_SREV_9280(ah)) { | ||
311 | /* | 305 | /* |
312 | * For AR9280 chips, bit 22 of 0x4004 | 306 | * For AR9280 chips, bit 22 of 0x4004 |
313 | * needs to be set. | 307 | * needs to be set. |
314 | */ | 308 | */ |
315 | val = AR9280_WA_DEFAULT; | 309 | val = AR9280_WA_DEFAULT; |
316 | if (!power_off) | 310 | val &= (~AR_WA_D3_L1_DISABLE); |
317 | val &= (~AR_WA_D3_L1_DISABLE); | ||
318 | } else { | 311 | } else { |
319 | val = AR_WA_DEFAULT; | 312 | val = AR_WA_DEFAULT; |
320 | } | 313 | } |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index abdc7ee87413..f4864807e15b 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -3615,8 +3615,8 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz) | |||
3615 | 3615 | ||
3616 | value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz); | 3616 | value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz); |
3617 | if (AR_SREV_9485(ah) && common->bt_ant_diversity) { | 3617 | if (AR_SREV_9485(ah) && common->bt_ant_diversity) { |
3618 | regval &= ~AR_SWITCH_TABLE_COM2_ALL; | 3618 | value &= ~AR_SWITCH_TABLE_COM2_ALL; |
3619 | regval |= ah->config.ant_ctrl_comm2g_switch_enable; | 3619 | value |= ah->config.ant_ctrl_comm2g_switch_enable; |
3620 | 3620 | ||
3621 | } | 3621 | } |
3622 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value); | 3622 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value); |
@@ -3825,6 +3825,11 @@ static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan) | |||
3825 | else | 3825 | else |
3826 | value = ar9003_hw_atten_chain_get_margin(ah, i, chan); | 3826 | value = ar9003_hw_atten_chain_get_margin(ah, i, chan); |
3827 | 3827 | ||
3828 | if (ah->config.alt_mingainidx) | ||
3829 | REG_RMW_FIELD(ah, AR_PHY_EXT_ATTEN_CTL_0, | ||
3830 | AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN, | ||
3831 | value); | ||
3832 | |||
3828 | REG_RMW_FIELD(ah, ext_atten_reg[i], | 3833 | REG_RMW_FIELD(ah, ext_atten_reg[i], |
3829 | AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN, | 3834 | AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN, |
3830 | value); | 3835 | value); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c index d402cb32283f..608bb4824e2a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c | |||
@@ -153,7 +153,7 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah) | |||
153 | if (!ah->is_clk_25mhz) | 153 | if (!ah->is_clk_25mhz) |
154 | INIT_INI_ARRAY(&ah->iniAdditional, | 154 | INIT_INI_ARRAY(&ah->iniAdditional, |
155 | ar9340_1p0_radio_core_40M); | 155 | ar9340_1p0_radio_core_40M); |
156 | } else if (AR_SREV_9485_11(ah)) { | 156 | } else if (AR_SREV_9485_11_OR_LATER(ah)) { |
157 | /* mac */ | 157 | /* mac */ |
158 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], | 158 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], |
159 | ar9485_1_1_mac_core); | 159 | ar9485_1_1_mac_core); |
@@ -424,7 +424,7 @@ static void ar9003_tx_gain_table_mode0(struct ath_hw *ah) | |||
424 | else if (AR_SREV_9340(ah)) | 424 | else if (AR_SREV_9340(ah)) |
425 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 425 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
426 | ar9340Modes_lowest_ob_db_tx_gain_table_1p0); | 426 | ar9340Modes_lowest_ob_db_tx_gain_table_1p0); |
427 | else if (AR_SREV_9485_11(ah)) | 427 | else if (AR_SREV_9485_11_OR_LATER(ah)) |
428 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 428 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
429 | ar9485_modes_lowest_ob_db_tx_gain_1_1); | 429 | ar9485_modes_lowest_ob_db_tx_gain_1_1); |
430 | else if (AR_SREV_9550(ah)) | 430 | else if (AR_SREV_9550(ah)) |
@@ -458,7 +458,7 @@ static void ar9003_tx_gain_table_mode1(struct ath_hw *ah) | |||
458 | else if (AR_SREV_9340(ah)) | 458 | else if (AR_SREV_9340(ah)) |
459 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 459 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
460 | ar9340Modes_high_ob_db_tx_gain_table_1p0); | 460 | ar9340Modes_high_ob_db_tx_gain_table_1p0); |
461 | else if (AR_SREV_9485_11(ah)) | 461 | else if (AR_SREV_9485_11_OR_LATER(ah)) |
462 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 462 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
463 | ar9485Modes_high_ob_db_tx_gain_1_1); | 463 | ar9485Modes_high_ob_db_tx_gain_1_1); |
464 | else if (AR_SREV_9580(ah)) | 464 | else if (AR_SREV_9580(ah)) |
@@ -492,7 +492,7 @@ static void ar9003_tx_gain_table_mode2(struct ath_hw *ah) | |||
492 | else if (AR_SREV_9340(ah)) | 492 | else if (AR_SREV_9340(ah)) |
493 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 493 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
494 | ar9340Modes_low_ob_db_tx_gain_table_1p0); | 494 | ar9340Modes_low_ob_db_tx_gain_table_1p0); |
495 | else if (AR_SREV_9485_11(ah)) | 495 | else if (AR_SREV_9485_11_OR_LATER(ah)) |
496 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 496 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
497 | ar9485Modes_low_ob_db_tx_gain_1_1); | 497 | ar9485Modes_low_ob_db_tx_gain_1_1); |
498 | else if (AR_SREV_9580(ah)) | 498 | else if (AR_SREV_9580(ah)) |
@@ -517,7 +517,7 @@ static void ar9003_tx_gain_table_mode3(struct ath_hw *ah) | |||
517 | else if (AR_SREV_9340(ah)) | 517 | else if (AR_SREV_9340(ah)) |
518 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 518 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
519 | ar9340Modes_high_power_tx_gain_table_1p0); | 519 | ar9340Modes_high_power_tx_gain_table_1p0); |
520 | else if (AR_SREV_9485_11(ah)) | 520 | else if (AR_SREV_9485_11_OR_LATER(ah)) |
521 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 521 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
522 | ar9485Modes_high_power_tx_gain_1_1); | 522 | ar9485Modes_high_power_tx_gain_1_1); |
523 | else if (AR_SREV_9580(ah)) | 523 | else if (AR_SREV_9580(ah)) |
@@ -552,7 +552,7 @@ static void ar9003_tx_gain_table_mode4(struct ath_hw *ah) | |||
552 | 552 | ||
553 | static void ar9003_tx_gain_table_mode5(struct ath_hw *ah) | 553 | static void ar9003_tx_gain_table_mode5(struct ath_hw *ah) |
554 | { | 554 | { |
555 | if (AR_SREV_9485_11(ah)) | 555 | if (AR_SREV_9485_11_OR_LATER(ah)) |
556 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 556 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
557 | ar9485Modes_green_ob_db_tx_gain_1_1); | 557 | ar9485Modes_green_ob_db_tx_gain_1_1); |
558 | else if (AR_SREV_9340(ah)) | 558 | else if (AR_SREV_9340(ah)) |
@@ -571,7 +571,7 @@ static void ar9003_tx_gain_table_mode6(struct ath_hw *ah) | |||
571 | if (AR_SREV_9340(ah)) | 571 | if (AR_SREV_9340(ah)) |
572 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 572 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
573 | ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0); | 573 | ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0); |
574 | else if (AR_SREV_9485_11(ah)) | 574 | else if (AR_SREV_9485_11_OR_LATER(ah)) |
575 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 575 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
576 | ar9485Modes_green_spur_ob_db_tx_gain_1_1); | 576 | ar9485Modes_green_spur_ob_db_tx_gain_1_1); |
577 | else if (AR_SREV_9580(ah)) | 577 | else if (AR_SREV_9580(ah)) |
@@ -611,7 +611,7 @@ static void ar9003_rx_gain_table_mode0(struct ath_hw *ah) | |||
611 | else if (AR_SREV_9340(ah)) | 611 | else if (AR_SREV_9340(ah)) |
612 | INIT_INI_ARRAY(&ah->iniModesRxGain, | 612 | INIT_INI_ARRAY(&ah->iniModesRxGain, |
613 | ar9340Common_rx_gain_table_1p0); | 613 | ar9340Common_rx_gain_table_1p0); |
614 | else if (AR_SREV_9485_11(ah)) | 614 | else if (AR_SREV_9485_11_OR_LATER(ah)) |
615 | INIT_INI_ARRAY(&ah->iniModesRxGain, | 615 | INIT_INI_ARRAY(&ah->iniModesRxGain, |
616 | ar9485_common_rx_gain_1_1); | 616 | ar9485_common_rx_gain_1_1); |
617 | else if (AR_SREV_9550(ah)) { | 617 | else if (AR_SREV_9550(ah)) { |
@@ -644,7 +644,7 @@ static void ar9003_rx_gain_table_mode1(struct ath_hw *ah) | |||
644 | else if (AR_SREV_9340(ah)) | 644 | else if (AR_SREV_9340(ah)) |
645 | INIT_INI_ARRAY(&ah->iniModesRxGain, | 645 | INIT_INI_ARRAY(&ah->iniModesRxGain, |
646 | ar9340Common_wo_xlna_rx_gain_table_1p0); | 646 | ar9340Common_wo_xlna_rx_gain_table_1p0); |
647 | else if (AR_SREV_9485_11(ah)) | 647 | else if (AR_SREV_9485_11_OR_LATER(ah)) |
648 | INIT_INI_ARRAY(&ah->iniModesRxGain, | 648 | INIT_INI_ARRAY(&ah->iniModesRxGain, |
649 | ar9485Common_wo_xlna_rx_gain_1_1); | 649 | ar9485Common_wo_xlna_rx_gain_1_1); |
650 | else if (AR_SREV_9462_21(ah)) | 650 | else if (AR_SREV_9462_21(ah)) |
@@ -745,16 +745,25 @@ static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah) | |||
745 | static void ar9003_hw_configpcipowersave(struct ath_hw *ah, | 745 | static void ar9003_hw_configpcipowersave(struct ath_hw *ah, |
746 | bool power_off) | 746 | bool power_off) |
747 | { | 747 | { |
748 | /* | ||
749 | * Increase L1 Entry Latency. Some WB222 boards don't have | ||
750 | * this change in eeprom/OTP. | ||
751 | * | ||
752 | */ | ||
753 | if (AR_SREV_9462(ah)) { | ||
754 | u32 val = ah->config.aspm_l1_fix; | ||
755 | if ((val & 0xff000000) == 0x17000000) { | ||
756 | val &= 0x00ffffff; | ||
757 | val |= 0x27000000; | ||
758 | REG_WRITE(ah, 0x570c, val); | ||
759 | } | ||
760 | } | ||
761 | |||
748 | /* Nothing to do on restore for 11N */ | 762 | /* Nothing to do on restore for 11N */ |
749 | if (!power_off /* !restore */) { | 763 | if (!power_off /* !restore */) { |
750 | /* set bit 19 to allow forcing of pcie core into L1 state */ | 764 | /* set bit 19 to allow forcing of pcie core into L1 state */ |
751 | REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); | 765 | REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); |
752 | 766 | REG_WRITE(ah, AR_WA, ah->WARegVal); | |
753 | /* Several PCIe massages to ensure proper behaviour */ | ||
754 | if (ah->config.pcie_waen) | ||
755 | REG_WRITE(ah, AR_WA, ah->config.pcie_waen); | ||
756 | else | ||
757 | REG_WRITE(ah, AR_WA, ah->WARegVal); | ||
758 | } | 767 | } |
759 | 768 | ||
760 | /* | 769 | /* |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c index 5163abd3937c..f6c5c1b50471 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c | |||
@@ -491,6 +491,7 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs, | |||
491 | rxs->rs_rate = MS(rxsp->status1, AR_RxRate); | 491 | rxs->rs_rate = MS(rxsp->status1, AR_RxRate); |
492 | rxs->rs_more = (rxsp->status2 & AR_RxMore) ? 1 : 0; | 492 | rxs->rs_more = (rxsp->status2 & AR_RxMore) ? 1 : 0; |
493 | 493 | ||
494 | rxs->rs_firstaggr = (rxsp->status11 & AR_RxFirstAggr) ? 1 : 0; | ||
494 | rxs->rs_isaggr = (rxsp->status11 & AR_RxAggr) ? 1 : 0; | 495 | rxs->rs_isaggr = (rxsp->status11 & AR_RxAggr) ? 1 : 0; |
495 | rxs->rs_moreaggr = (rxsp->status11 & AR_RxMoreAggr) ? 1 : 0; | 496 | rxs->rs_moreaggr = (rxsp->status11 & AR_RxMoreAggr) ? 1 : 0; |
496 | rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7); | 497 | rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 39c37309f39e..e897648d3233 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -1172,6 +1172,10 @@ skip_ws_det: | |||
1172 | * is_on == 0 means MRC CCK is OFF (more noise imm) | 1172 | * is_on == 0 means MRC CCK is OFF (more noise imm) |
1173 | */ | 1173 | */ |
1174 | bool is_on = param ? 1 : 0; | 1174 | bool is_on = param ? 1 : 0; |
1175 | |||
1176 | if (ah->caps.rx_chainmask == 1) | ||
1177 | break; | ||
1178 | |||
1175 | REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, | 1179 | REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, |
1176 | AR_PHY_MRC_CCK_ENABLE, is_on); | 1180 | AR_PHY_MRC_CCK_ENABLE, is_on); |
1177 | REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, | 1181 | REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, |
@@ -1189,8 +1193,6 @@ skip_ws_det: | |||
1189 | } | 1193 | } |
1190 | break; | 1194 | break; |
1191 | } | 1195 | } |
1192 | case ATH9K_ANI_PRESENT: | ||
1193 | break; | ||
1194 | default: | 1196 | default: |
1195 | ath_dbg(common, ANI, "invalid cmd %u\n", cmd); | 1197 | ath_dbg(common, ANI, "invalid cmd %u\n", cmd); |
1196 | return false; | 1198 | return false; |
@@ -1445,7 +1447,7 @@ static void ar9003_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable) | |||
1445 | regval |= (ant_div_ctl1 & 0x3f) << AR_ANT_DIV_CTRL_ALL_S; | 1447 | regval |= (ant_div_ctl1 & 0x3f) << AR_ANT_DIV_CTRL_ALL_S; |
1446 | REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); | 1448 | REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); |
1447 | 1449 | ||
1448 | if (AR_SREV_9485_11(ah)) { | 1450 | if (AR_SREV_9485_11_OR_LATER(ah)) { |
1449 | /* | 1451 | /* |
1450 | * Enable LNA diversity. | 1452 | * Enable LNA diversity. |
1451 | */ | 1453 | */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h index 23c019d0d9aa..6fd752321e36 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h | |||
@@ -148,6 +148,8 @@ | |||
148 | #define AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S 28 | 148 | #define AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S 28 |
149 | #define AR_PHY_EXT_CCA_THRESH62 0x007F0000 | 149 | #define AR_PHY_EXT_CCA_THRESH62 0x007F0000 |
150 | #define AR_PHY_EXT_CCA_THRESH62_S 16 | 150 | #define AR_PHY_EXT_CCA_THRESH62_S 16 |
151 | #define AR_PHY_EXTCHN_PWRTHR1_ANT_DIV_ALT_ANT_MINGAINIDX 0x0000FF00 | ||
152 | #define AR_PHY_EXTCHN_PWRTHR1_ANT_DIV_ALT_ANT_MINGAINIDX_S 8 | ||
151 | #define AR_PHY_EXT_MINCCA_PWR 0x01FF0000 | 153 | #define AR_PHY_EXT_MINCCA_PWR 0x01FF0000 |
152 | #define AR_PHY_EXT_MINCCA_PWR_S 16 | 154 | #define AR_PHY_EXT_MINCCA_PWR_S 16 |
153 | #define AR_PHY_EXT_CYCPWR_THR1 0x0000FE00L | 155 | #define AR_PHY_EXT_CYCPWR_THR1 0x0000FE00L |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 505c615ada1b..2ee35f677c0e 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -72,17 +72,12 @@ struct ath_config { | |||
72 | /*************************/ | 72 | /*************************/ |
73 | 73 | ||
74 | #define ATH_TXBUF_RESET(_bf) do { \ | 74 | #define ATH_TXBUF_RESET(_bf) do { \ |
75 | (_bf)->bf_stale = false; \ | ||
76 | (_bf)->bf_lastbf = NULL; \ | 75 | (_bf)->bf_lastbf = NULL; \ |
77 | (_bf)->bf_next = NULL; \ | 76 | (_bf)->bf_next = NULL; \ |
78 | memset(&((_bf)->bf_state), 0, \ | 77 | memset(&((_bf)->bf_state), 0, \ |
79 | sizeof(struct ath_buf_state)); \ | 78 | sizeof(struct ath_buf_state)); \ |
80 | } while (0) | 79 | } while (0) |
81 | 80 | ||
82 | #define ATH_RXBUF_RESET(_bf) do { \ | ||
83 | (_bf)->bf_stale = false; \ | ||
84 | } while (0) | ||
85 | |||
86 | /** | 81 | /** |
87 | * enum buffer_type - Buffer type flags | 82 | * enum buffer_type - Buffer type flags |
88 | * | 83 | * |
@@ -196,10 +191,10 @@ struct ath_txq { | |||
196 | 191 | ||
197 | struct ath_atx_ac { | 192 | struct ath_atx_ac { |
198 | struct ath_txq *txq; | 193 | struct ath_txq *txq; |
199 | int sched; | ||
200 | struct list_head list; | 194 | struct list_head list; |
201 | struct list_head tid_q; | 195 | struct list_head tid_q; |
202 | bool clear_ps_filter; | 196 | bool clear_ps_filter; |
197 | bool sched; | ||
203 | }; | 198 | }; |
204 | 199 | ||
205 | struct ath_frame_info { | 200 | struct ath_frame_info { |
@@ -216,6 +211,7 @@ struct ath_buf_state { | |||
216 | u8 bf_type; | 211 | u8 bf_type; |
217 | u8 bfs_paprd; | 212 | u8 bfs_paprd; |
218 | u8 ndelim; | 213 | u8 ndelim; |
214 | bool stale; | ||
219 | u16 seqno; | 215 | u16 seqno; |
220 | unsigned long bfs_paprd_timestamp; | 216 | unsigned long bfs_paprd_timestamp; |
221 | }; | 217 | }; |
@@ -229,7 +225,6 @@ struct ath_buf { | |||
229 | void *bf_desc; /* virtual addr of desc */ | 225 | void *bf_desc; /* virtual addr of desc */ |
230 | dma_addr_t bf_daddr; /* physical addr of desc */ | 226 | dma_addr_t bf_daddr; /* physical addr of desc */ |
231 | dma_addr_t bf_buf_addr; /* physical addr of data buffer, for DMA */ | 227 | dma_addr_t bf_buf_addr; /* physical addr of data buffer, for DMA */ |
232 | bool bf_stale; | ||
233 | struct ieee80211_tx_rate rates[4]; | 228 | struct ieee80211_tx_rate rates[4]; |
234 | struct ath_buf_state bf_state; | 229 | struct ath_buf_state bf_state; |
235 | }; | 230 | }; |
@@ -241,13 +236,14 @@ struct ath_atx_tid { | |||
241 | struct ath_node *an; | 236 | struct ath_node *an; |
242 | struct ath_atx_ac *ac; | 237 | struct ath_atx_ac *ac; |
243 | unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)]; | 238 | unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)]; |
244 | int bar_index; | ||
245 | u16 seq_start; | 239 | u16 seq_start; |
246 | u16 seq_next; | 240 | u16 seq_next; |
247 | u16 baw_size; | 241 | u16 baw_size; |
248 | int tidno; | 242 | u8 tidno; |
249 | int baw_head; /* first un-acked tx buffer */ | 243 | int baw_head; /* first un-acked tx buffer */ |
250 | int baw_tail; /* next unused tx buffer slot */ | 244 | int baw_tail; /* next unused tx buffer slot */ |
245 | |||
246 | s8 bar_index; | ||
251 | bool sched; | 247 | bool sched; |
252 | bool paused; | 248 | bool paused; |
253 | bool active; | 249 | bool active; |
@@ -259,17 +255,13 @@ struct ath_node { | |||
259 | struct ieee80211_vif *vif; /* interface with which we're associated */ | 255 | struct ieee80211_vif *vif; /* interface with which we're associated */ |
260 | struct ath_atx_tid tid[IEEE80211_NUM_TIDS]; | 256 | struct ath_atx_tid tid[IEEE80211_NUM_TIDS]; |
261 | struct ath_atx_ac ac[IEEE80211_NUM_ACS]; | 257 | struct ath_atx_ac ac[IEEE80211_NUM_ACS]; |
262 | int ps_key; | ||
263 | 258 | ||
264 | u16 maxampdu; | 259 | u16 maxampdu; |
265 | u8 mpdudensity; | 260 | u8 mpdudensity; |
261 | s8 ps_key; | ||
266 | 262 | ||
267 | bool sleeping; | 263 | bool sleeping; |
268 | bool no_ps_filter; | 264 | bool no_ps_filter; |
269 | |||
270 | #if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) | ||
271 | struct dentry *node_stat; | ||
272 | #endif | ||
273 | }; | 265 | }; |
274 | 266 | ||
275 | struct ath_tx_control { | 267 | struct ath_tx_control { |
@@ -315,6 +307,7 @@ struct ath_rx { | |||
315 | struct ath_descdma rxdma; | 307 | struct ath_descdma rxdma; |
316 | struct ath_rx_edma rx_edma[ATH9K_RX_QUEUE_MAX]; | 308 | struct ath_rx_edma rx_edma[ATH9K_RX_QUEUE_MAX]; |
317 | 309 | ||
310 | struct ath_buf *buf_hold; | ||
318 | struct sk_buff *frag; | 311 | struct sk_buff *frag; |
319 | 312 | ||
320 | u32 ampdu_ref; | 313 | u32 ampdu_ref; |
@@ -427,6 +420,7 @@ void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif); | |||
427 | void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif); | 420 | void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif); |
428 | void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif); | 421 | void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif); |
429 | void ath9k_set_beacon(struct ath_softc *sc); | 422 | void ath9k_set_beacon(struct ath_softc *sc); |
423 | bool ath9k_csa_is_finished(struct ath_softc *sc); | ||
430 | 424 | ||
431 | /*******************/ | 425 | /*******************/ |
432 | /* Link Monitoring */ | 426 | /* Link Monitoring */ |
@@ -637,6 +631,7 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs); | |||
637 | #define ATH9K_PCI_CUS217 0x0004 | 631 | #define ATH9K_PCI_CUS217 0x0004 |
638 | #define ATH9K_PCI_WOW 0x0008 | 632 | #define ATH9K_PCI_WOW 0x0008 |
639 | #define ATH9K_PCI_BT_ANT_DIV 0x0010 | 633 | #define ATH9K_PCI_BT_ANT_DIV 0x0010 |
634 | #define ATH9K_PCI_D3_L1_WAR 0x0020 | ||
640 | 635 | ||
641 | /* | 636 | /* |
642 | * Default cache line size, in bytes. | 637 | * Default cache line size, in bytes. |
@@ -763,6 +758,7 @@ struct ath_softc { | |||
763 | #endif | 758 | #endif |
764 | 759 | ||
765 | struct ath_descdma txsdma; | 760 | struct ath_descdma txsdma; |
761 | struct ieee80211_vif *csa_vif; | ||
766 | 762 | ||
767 | struct ath_ant_comb ant_comb; | 763 | struct ath_ant_comb ant_comb; |
768 | u8 ant_tx, ant_rx; | 764 | u8 ant_tx, ant_rx; |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index 1a17732bb089..b5c16b3a37b9 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -291,6 +291,23 @@ void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif) | |||
291 | (unsigned long long)tsfadjust, avp->av_bslot); | 291 | (unsigned long long)tsfadjust, avp->av_bslot); |
292 | } | 292 | } |
293 | 293 | ||
294 | bool ath9k_csa_is_finished(struct ath_softc *sc) | ||
295 | { | ||
296 | struct ieee80211_vif *vif; | ||
297 | |||
298 | vif = sc->csa_vif; | ||
299 | if (!vif || !vif->csa_active) | ||
300 | return false; | ||
301 | |||
302 | if (!ieee80211_csa_is_complete(vif)) | ||
303 | return false; | ||
304 | |||
305 | ieee80211_csa_finish(vif); | ||
306 | |||
307 | sc->csa_vif = NULL; | ||
308 | return true; | ||
309 | } | ||
310 | |||
294 | void ath9k_beacon_tasklet(unsigned long data) | 311 | void ath9k_beacon_tasklet(unsigned long data) |
295 | { | 312 | { |
296 | struct ath_softc *sc = (struct ath_softc *)data; | 313 | struct ath_softc *sc = (struct ath_softc *)data; |
@@ -336,6 +353,10 @@ void ath9k_beacon_tasklet(unsigned long data) | |||
336 | return; | 353 | return; |
337 | } | 354 | } |
338 | 355 | ||
356 | /* EDMA devices check that in the tx completion function. */ | ||
357 | if (!edma && ath9k_csa_is_finished(sc)) | ||
358 | return; | ||
359 | |||
339 | slot = ath9k_beacon_choose_slot(sc); | 360 | slot = ath9k_beacon_choose_slot(sc); |
340 | vif = sc->beacon.bslot[slot]; | 361 | vif = sc->beacon.bslot[slot]; |
341 | 362 | ||
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index 344fdde1d7a3..d3063c21e16c 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -49,37 +49,40 @@ int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb) | |||
49 | } | 49 | } |
50 | EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype); | 50 | EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype); |
51 | 51 | ||
52 | static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan, | 52 | static u32 ath9k_get_extchanmode(struct cfg80211_chan_def *chandef) |
53 | enum nl80211_channel_type channel_type) | ||
54 | { | 53 | { |
55 | u32 chanmode = 0; | 54 | u32 chanmode = 0; |
56 | 55 | ||
57 | switch (chan->band) { | 56 | switch (chandef->chan->band) { |
58 | case IEEE80211_BAND_2GHZ: | 57 | case IEEE80211_BAND_2GHZ: |
59 | switch (channel_type) { | 58 | switch (chandef->width) { |
60 | case NL80211_CHAN_NO_HT: | 59 | case NL80211_CHAN_WIDTH_20_NOHT: |
61 | case NL80211_CHAN_HT20: | 60 | case NL80211_CHAN_WIDTH_20: |
62 | chanmode = CHANNEL_G_HT20; | 61 | chanmode = CHANNEL_G_HT20; |
63 | break; | 62 | break; |
64 | case NL80211_CHAN_HT40PLUS: | 63 | case NL80211_CHAN_WIDTH_40: |
65 | chanmode = CHANNEL_G_HT40PLUS; | 64 | if (chandef->center_freq1 > chandef->chan->center_freq) |
65 | chanmode = CHANNEL_G_HT40PLUS; | ||
66 | else | ||
67 | chanmode = CHANNEL_G_HT40MINUS; | ||
66 | break; | 68 | break; |
67 | case NL80211_CHAN_HT40MINUS: | 69 | default: |
68 | chanmode = CHANNEL_G_HT40MINUS; | ||
69 | break; | 70 | break; |
70 | } | 71 | } |
71 | break; | 72 | break; |
72 | case IEEE80211_BAND_5GHZ: | 73 | case IEEE80211_BAND_5GHZ: |
73 | switch (channel_type) { | 74 | switch (chandef->width) { |
74 | case NL80211_CHAN_NO_HT: | 75 | case NL80211_CHAN_WIDTH_20_NOHT: |
75 | case NL80211_CHAN_HT20: | 76 | case NL80211_CHAN_WIDTH_20: |
76 | chanmode = CHANNEL_A_HT20; | 77 | chanmode = CHANNEL_A_HT20; |
77 | break; | 78 | break; |
78 | case NL80211_CHAN_HT40PLUS: | 79 | case NL80211_CHAN_WIDTH_40: |
79 | chanmode = CHANNEL_A_HT40PLUS; | 80 | if (chandef->center_freq1 > chandef->chan->center_freq) |
81 | chanmode = CHANNEL_A_HT40PLUS; | ||
82 | else | ||
83 | chanmode = CHANNEL_A_HT40MINUS; | ||
80 | break; | 84 | break; |
81 | case NL80211_CHAN_HT40MINUS: | 85 | default: |
82 | chanmode = CHANNEL_A_HT40MINUS; | ||
83 | break; | 86 | break; |
84 | } | 87 | } |
85 | break; | 88 | break; |
@@ -94,13 +97,12 @@ static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan, | |||
94 | * Update internal channel flags. | 97 | * Update internal channel flags. |
95 | */ | 98 | */ |
96 | void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, | 99 | void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, |
97 | struct ieee80211_channel *chan, | 100 | struct cfg80211_chan_def *chandef) |
98 | enum nl80211_channel_type channel_type) | ||
99 | { | 101 | { |
100 | ichan->channel = chan->center_freq; | 102 | ichan->channel = chandef->chan->center_freq; |
101 | ichan->chan = chan; | 103 | ichan->chan = chandef->chan; |
102 | 104 | ||
103 | if (chan->band == IEEE80211_BAND_2GHZ) { | 105 | if (chandef->chan->band == IEEE80211_BAND_2GHZ) { |
104 | ichan->chanmode = CHANNEL_G; | 106 | ichan->chanmode = CHANNEL_G; |
105 | ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM; | 107 | ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM; |
106 | } else { | 108 | } else { |
@@ -108,8 +110,22 @@ void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, | |||
108 | ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM; | 110 | ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM; |
109 | } | 111 | } |
110 | 112 | ||
111 | if (channel_type != NL80211_CHAN_NO_HT) | 113 | switch (chandef->width) { |
112 | ichan->chanmode = ath9k_get_extchanmode(chan, channel_type); | 114 | case NL80211_CHAN_WIDTH_5: |
115 | ichan->channelFlags |= CHANNEL_QUARTER; | ||
116 | break; | ||
117 | case NL80211_CHAN_WIDTH_10: | ||
118 | ichan->channelFlags |= CHANNEL_HALF; | ||
119 | break; | ||
120 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
121 | break; | ||
122 | case NL80211_CHAN_WIDTH_20: | ||
123 | case NL80211_CHAN_WIDTH_40: | ||
124 | ichan->chanmode = ath9k_get_extchanmode(chandef); | ||
125 | break; | ||
126 | default: | ||
127 | WARN_ON(1); | ||
128 | } | ||
113 | } | 129 | } |
114 | EXPORT_SYMBOL(ath9k_cmn_update_ichannel); | 130 | EXPORT_SYMBOL(ath9k_cmn_update_ichannel); |
115 | 131 | ||
@@ -125,8 +141,7 @@ struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, | |||
125 | 141 | ||
126 | chan_idx = curchan->hw_value; | 142 | chan_idx = curchan->hw_value; |
127 | channel = &ah->channels[chan_idx]; | 143 | channel = &ah->channels[chan_idx]; |
128 | ath9k_cmn_update_ichannel(channel, curchan, | 144 | ath9k_cmn_update_ichannel(channel, &hw->conf.chandef); |
129 | cfg80211_get_chandef_type(&hw->conf.chandef)); | ||
130 | 145 | ||
131 | return channel; | 146 | return channel; |
132 | } | 147 | } |
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h index 207d06995b15..e039bcbfbd79 100644 --- a/drivers/net/wireless/ath/ath9k/common.h +++ b/drivers/net/wireless/ath/ath9k/common.h | |||
@@ -44,8 +44,7 @@ | |||
44 | 44 | ||
45 | int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); | 45 | int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); |
46 | void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, | 46 | void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, |
47 | struct ieee80211_channel *chan, | 47 | struct cfg80211_chan_def *chandef); |
48 | enum nl80211_channel_type channel_type); | ||
49 | struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, | 48 | struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, |
50 | struct ath_hw *ah); | 49 | struct ath_hw *ah); |
51 | int ath9k_cmn_count_streams(unsigned int chainmask, int max); | 50 | int ath9k_cmn_count_streams(unsigned int chainmask, int max); |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index c10cec5650c6..c088744a6bfb 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -88,90 +88,6 @@ static const struct file_operations fops_debug = { | |||
88 | 88 | ||
89 | #define DMA_BUF_LEN 1024 | 89 | #define DMA_BUF_LEN 1024 |
90 | 90 | ||
91 | static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf, | ||
92 | size_t count, loff_t *ppos) | ||
93 | { | ||
94 | struct ath_softc *sc = file->private_data; | ||
95 | struct ath_hw *ah = sc->sc_ah; | ||
96 | char buf[32]; | ||
97 | unsigned int len; | ||
98 | |||
99 | len = sprintf(buf, "0x%08x\n", ah->txchainmask); | ||
100 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
101 | } | ||
102 | |||
103 | static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf, | ||
104 | size_t count, loff_t *ppos) | ||
105 | { | ||
106 | struct ath_softc *sc = file->private_data; | ||
107 | struct ath_hw *ah = sc->sc_ah; | ||
108 | unsigned long mask; | ||
109 | char buf[32]; | ||
110 | ssize_t len; | ||
111 | |||
112 | len = min(count, sizeof(buf) - 1); | ||
113 | if (copy_from_user(buf, user_buf, len)) | ||
114 | return -EFAULT; | ||
115 | |||
116 | buf[len] = '\0'; | ||
117 | if (kstrtoul(buf, 0, &mask)) | ||
118 | return -EINVAL; | ||
119 | |||
120 | ah->txchainmask = mask; | ||
121 | ah->caps.tx_chainmask = mask; | ||
122 | return count; | ||
123 | } | ||
124 | |||
125 | static const struct file_operations fops_tx_chainmask = { | ||
126 | .read = read_file_tx_chainmask, | ||
127 | .write = write_file_tx_chainmask, | ||
128 | .open = simple_open, | ||
129 | .owner = THIS_MODULE, | ||
130 | .llseek = default_llseek, | ||
131 | }; | ||
132 | |||
133 | |||
134 | static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf, | ||
135 | size_t count, loff_t *ppos) | ||
136 | { | ||
137 | struct ath_softc *sc = file->private_data; | ||
138 | struct ath_hw *ah = sc->sc_ah; | ||
139 | char buf[32]; | ||
140 | unsigned int len; | ||
141 | |||
142 | len = sprintf(buf, "0x%08x\n", ah->rxchainmask); | ||
143 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
144 | } | ||
145 | |||
146 | static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf, | ||
147 | size_t count, loff_t *ppos) | ||
148 | { | ||
149 | struct ath_softc *sc = file->private_data; | ||
150 | struct ath_hw *ah = sc->sc_ah; | ||
151 | unsigned long mask; | ||
152 | char buf[32]; | ||
153 | ssize_t len; | ||
154 | |||
155 | len = min(count, sizeof(buf) - 1); | ||
156 | if (copy_from_user(buf, user_buf, len)) | ||
157 | return -EFAULT; | ||
158 | |||
159 | buf[len] = '\0'; | ||
160 | if (kstrtoul(buf, 0, &mask)) | ||
161 | return -EINVAL; | ||
162 | |||
163 | ah->rxchainmask = mask; | ||
164 | ah->caps.rx_chainmask = mask; | ||
165 | return count; | ||
166 | } | ||
167 | |||
168 | static const struct file_operations fops_rx_chainmask = { | ||
169 | .read = read_file_rx_chainmask, | ||
170 | .write = write_file_rx_chainmask, | ||
171 | .open = simple_open, | ||
172 | .owner = THIS_MODULE, | ||
173 | .llseek = default_llseek, | ||
174 | }; | ||
175 | 91 | ||
176 | static ssize_t read_file_ani(struct file *file, char __user *user_buf, | 92 | static ssize_t read_file_ani(struct file *file, char __user *user_buf, |
177 | size_t count, loff_t *ppos) | 93 | size_t count, loff_t *ppos) |
@@ -1725,17 +1641,7 @@ void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, | |||
1725 | struct dentry *dir) | 1641 | struct dentry *dir) |
1726 | { | 1642 | { |
1727 | struct ath_node *an = (struct ath_node *)sta->drv_priv; | 1643 | struct ath_node *an = (struct ath_node *)sta->drv_priv; |
1728 | an->node_stat = debugfs_create_file("node_stat", S_IRUGO, | 1644 | debugfs_create_file("node_stat", S_IRUGO, dir, an, &fops_node_stat); |
1729 | dir, an, &fops_node_stat); | ||
1730 | } | ||
1731 | |||
1732 | void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw, | ||
1733 | struct ieee80211_vif *vif, | ||
1734 | struct ieee80211_sta *sta, | ||
1735 | struct dentry *dir) | ||
1736 | { | ||
1737 | struct ath_node *an = (struct ath_node *)sta->drv_priv; | ||
1738 | debugfs_remove(an->node_stat); | ||
1739 | } | 1645 | } |
1740 | 1646 | ||
1741 | /* Ethtool support for get-stats */ | 1647 | /* Ethtool support for get-stats */ |
@@ -1906,10 +1812,10 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1906 | &fops_reset); | 1812 | &fops_reset); |
1907 | debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, | 1813 | debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, |
1908 | &fops_recv); | 1814 | &fops_recv); |
1909 | debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, | 1815 | debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy, |
1910 | sc->debug.debugfs_phy, sc, &fops_rx_chainmask); | 1816 | &ah->rxchainmask); |
1911 | debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, | 1817 | debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy, |
1912 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask); | 1818 | &ah->txchainmask); |
1913 | debugfs_create_file("ani", S_IRUSR | S_IWUSR, | 1819 | debugfs_create_file("ani", S_IRUSR | S_IWUSR, |
1914 | sc->debug.debugfs_phy, sc, &fops_ani); | 1820 | sc->debug.debugfs_phy, sc, &fops_ani); |
1915 | debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1821 | debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index 01c5c6a22e1b..6e1556fa2f3e 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
@@ -292,10 +292,6 @@ void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, | |||
292 | struct ieee80211_vif *vif, | 292 | struct ieee80211_vif *vif, |
293 | struct ieee80211_sta *sta, | 293 | struct ieee80211_sta *sta, |
294 | struct dentry *dir); | 294 | struct dentry *dir); |
295 | void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw, | ||
296 | struct ieee80211_vif *vif, | ||
297 | struct ieee80211_sta *sta, | ||
298 | struct dentry *dir); | ||
299 | void ath_debug_send_fft_sample(struct ath_softc *sc, | 295 | void ath_debug_send_fft_sample(struct ath_softc *sc, |
300 | struct fft_sample_tlv *fft_sample); | 296 | struct fft_sample_tlv *fft_sample); |
301 | void ath9k_debug_stat_ant(struct ath_softc *sc, | 297 | void ath9k_debug_stat_ant(struct ath_softc *sc, |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 5205a3625e84..6d5d716adc1b 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -115,10 +115,10 @@ static int hif_usb_send_regout(struct hif_device_usb *hif_dev, | |||
115 | cmd->skb = skb; | 115 | cmd->skb = skb; |
116 | cmd->hif_dev = hif_dev; | 116 | cmd->hif_dev = hif_dev; |
117 | 117 | ||
118 | usb_fill_bulk_urb(urb, hif_dev->udev, | 118 | usb_fill_int_urb(urb, hif_dev->udev, |
119 | usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE), | 119 | usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE), |
120 | skb->data, skb->len, | 120 | skb->data, skb->len, |
121 | hif_usb_regout_cb, cmd); | 121 | hif_usb_regout_cb, cmd, 1); |
122 | 122 | ||
123 | usb_anchor_urb(urb, &hif_dev->regout_submitted); | 123 | usb_anchor_urb(urb, &hif_dev->regout_submitted); |
124 | ret = usb_submit_urb(urb, GFP_KERNEL); | 124 | ret = usb_submit_urb(urb, GFP_KERNEL); |
@@ -723,11 +723,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb) | |||
723 | return; | 723 | return; |
724 | } | 724 | } |
725 | 725 | ||
726 | usb_fill_bulk_urb(urb, hif_dev->udev, | 726 | usb_fill_int_urb(urb, hif_dev->udev, |
727 | usb_rcvbulkpipe(hif_dev->udev, | 727 | usb_rcvintpipe(hif_dev->udev, |
728 | USB_REG_IN_PIPE), | 728 | USB_REG_IN_PIPE), |
729 | nskb->data, MAX_REG_IN_BUF_SIZE, | 729 | nskb->data, MAX_REG_IN_BUF_SIZE, |
730 | ath9k_hif_usb_reg_in_cb, nskb); | 730 | ath9k_hif_usb_reg_in_cb, nskb, 1); |
731 | } | 731 | } |
732 | 732 | ||
733 | resubmit: | 733 | resubmit: |
@@ -909,11 +909,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) | |||
909 | goto err_skb; | 909 | goto err_skb; |
910 | } | 910 | } |
911 | 911 | ||
912 | usb_fill_bulk_urb(urb, hif_dev->udev, | 912 | usb_fill_int_urb(urb, hif_dev->udev, |
913 | usb_rcvbulkpipe(hif_dev->udev, | 913 | usb_rcvintpipe(hif_dev->udev, |
914 | USB_REG_IN_PIPE), | 914 | USB_REG_IN_PIPE), |
915 | skb->data, MAX_REG_IN_BUF_SIZE, | 915 | skb->data, MAX_REG_IN_BUF_SIZE, |
916 | ath9k_hif_usb_reg_in_cb, skb); | 916 | ath9k_hif_usb_reg_in_cb, skb, 1); |
917 | 917 | ||
918 | /* Anchor URB */ | 918 | /* Anchor URB */ |
919 | usb_anchor_urb(urb, &hif_dev->reg_in_submitted); | 919 | usb_anchor_urb(urb, &hif_dev->reg_in_submitted); |
@@ -1031,9 +1031,7 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) | |||
1031 | 1031 | ||
1032 | static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) | 1032 | static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) |
1033 | { | 1033 | { |
1034 | struct usb_host_interface *alt = &hif_dev->interface->altsetting[0]; | 1034 | int ret; |
1035 | struct usb_endpoint_descriptor *endp; | ||
1036 | int ret, idx; | ||
1037 | 1035 | ||
1038 | ret = ath9k_hif_usb_download_fw(hif_dev); | 1036 | ret = ath9k_hif_usb_download_fw(hif_dev); |
1039 | if (ret) { | 1037 | if (ret) { |
@@ -1043,20 +1041,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) | |||
1043 | return ret; | 1041 | return ret; |
1044 | } | 1042 | } |
1045 | 1043 | ||
1046 | /* On downloading the firmware to the target, the USB descriptor of EP4 | ||
1047 | * is 'patched' to change the type of the endpoint to Bulk. This will | ||
1048 | * bring down CPU usage during the scan period. | ||
1049 | */ | ||
1050 | for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) { | ||
1051 | endp = &alt->endpoint[idx].desc; | ||
1052 | if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
1053 | == USB_ENDPOINT_XFER_INT) { | ||
1054 | endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK; | ||
1055 | endp->bmAttributes |= USB_ENDPOINT_XFER_BULK; | ||
1056 | endp->bInterval = 0; | ||
1057 | } | ||
1058 | } | ||
1059 | |||
1060 | /* Alloc URBs */ | 1044 | /* Alloc URBs */ |
1061 | ret = ath9k_hif_usb_alloc_urbs(hif_dev); | 1045 | ret = ath9k_hif_usb_alloc_urbs(hif_dev); |
1062 | if (ret) { | 1046 | if (ret) { |
@@ -1268,7 +1252,7 @@ static void ath9k_hif_usb_reboot(struct usb_device *udev) | |||
1268 | if (!buf) | 1252 | if (!buf) |
1269 | return; | 1253 | return; |
1270 | 1254 | ||
1271 | ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE), | 1255 | ret = usb_interrupt_msg(udev, usb_sndintpipe(udev, USB_REG_OUT_PIPE), |
1272 | buf, 4, NULL, HZ); | 1256 | buf, 4, NULL, HZ); |
1273 | if (ret) | 1257 | if (ret) |
1274 | dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n"); | 1258 | dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n"); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 5c1bec18c9e3..d44258172c0f 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -1203,16 +1203,13 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1203 | 1203 | ||
1204 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) { | 1204 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) { |
1205 | struct ieee80211_channel *curchan = hw->conf.chandef.chan; | 1205 | struct ieee80211_channel *curchan = hw->conf.chandef.chan; |
1206 | enum nl80211_channel_type channel_type = | ||
1207 | cfg80211_get_chandef_type(&hw->conf.chandef); | ||
1208 | int pos = curchan->hw_value; | 1206 | int pos = curchan->hw_value; |
1209 | 1207 | ||
1210 | ath_dbg(common, CONFIG, "Set channel: %d MHz\n", | 1208 | ath_dbg(common, CONFIG, "Set channel: %d MHz\n", |
1211 | curchan->center_freq); | 1209 | curchan->center_freq); |
1212 | 1210 | ||
1213 | ath9k_cmn_update_ichannel(&priv->ah->channels[pos], | 1211 | ath9k_cmn_update_ichannel(&priv->ah->channels[pos], |
1214 | hw->conf.chandef.chan, | 1212 | &hw->conf.chandef); |
1215 | channel_type); | ||
1216 | 1213 | ||
1217 | if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { | 1214 | if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { |
1218 | ath_err(common, "Unable to set channel\n"); | 1215 | ath_err(common, "Unable to set channel\n"); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index e602c9519709..c028df76b564 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -448,6 +448,7 @@ static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv, | |||
448 | struct ieee80211_conf *cur_conf = &priv->hw->conf; | 448 | struct ieee80211_conf *cur_conf = &priv->hw->conf; |
449 | bool txok; | 449 | bool txok; |
450 | int slot; | 450 | int slot; |
451 | int hdrlen, padsize; | ||
451 | 452 | ||
452 | slot = strip_drv_header(priv, skb); | 453 | slot = strip_drv_header(priv, skb); |
453 | if (slot < 0) { | 454 | if (slot < 0) { |
@@ -504,6 +505,15 @@ send_mac80211: | |||
504 | 505 | ||
505 | ath9k_htc_tx_clear_slot(priv, slot); | 506 | ath9k_htc_tx_clear_slot(priv, slot); |
506 | 507 | ||
508 | /* Remove padding before handing frame back to mac80211 */ | ||
509 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | ||
510 | |||
511 | padsize = hdrlen & 3; | ||
512 | if (padsize && skb->len > hdrlen + padsize) { | ||
513 | memmove(skb->data + padsize, skb->data, hdrlen); | ||
514 | skb_pull(skb, padsize); | ||
515 | } | ||
516 | |||
507 | /* Send status to mac80211 */ | 517 | /* Send status to mac80211 */ |
508 | ieee80211_tx_status(priv->hw, skb); | 518 | ieee80211_tx_status(priv->hw, skb); |
509 | } | 519 | } |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 151443bddbde..ecc6ec4a1edb 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -450,7 +450,6 @@ static void ath9k_hw_init_config(struct ath_hw *ah) | |||
450 | ah->config.ack_6mb = 0x0; | 450 | ah->config.ack_6mb = 0x0; |
451 | ah->config.cwm_ignore_extcca = 0; | 451 | ah->config.cwm_ignore_extcca = 0; |
452 | ah->config.pcie_clock_req = 0; | 452 | ah->config.pcie_clock_req = 0; |
453 | ah->config.pcie_waen = 0; | ||
454 | ah->config.analog_shiftreg = 1; | 453 | ah->config.analog_shiftreg = 1; |
455 | 454 | ||
456 | for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { | 455 | for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { |
@@ -575,18 +574,17 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
575 | * We need to do this to avoid RMW of this register. We cannot | 574 | * We need to do this to avoid RMW of this register. We cannot |
576 | * read the reg when chip is asleep. | 575 | * read the reg when chip is asleep. |
577 | */ | 576 | */ |
578 | ah->WARegVal = REG_READ(ah, AR_WA); | 577 | if (AR_SREV_9300_20_OR_LATER(ah)) { |
579 | ah->WARegVal |= (AR_WA_D3_L1_DISABLE | | 578 | ah->WARegVal = REG_READ(ah, AR_WA); |
580 | AR_WA_ASPM_TIMER_BASED_DISABLE); | 579 | ah->WARegVal |= (AR_WA_D3_L1_DISABLE | |
580 | AR_WA_ASPM_TIMER_BASED_DISABLE); | ||
581 | } | ||
581 | 582 | ||
582 | if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { | 583 | if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { |
583 | ath_err(common, "Couldn't reset chip\n"); | 584 | ath_err(common, "Couldn't reset chip\n"); |
584 | return -EIO; | 585 | return -EIO; |
585 | } | 586 | } |
586 | 587 | ||
587 | if (AR_SREV_9462(ah)) | ||
588 | ah->WARegVal &= ~AR_WA_D3_L1_DISABLE; | ||
589 | |||
590 | if (AR_SREV_9565(ah)) { | 588 | if (AR_SREV_9565(ah)) { |
591 | ah->WARegVal |= AR_WA_BIT22; | 589 | ah->WARegVal |= AR_WA_BIT22; |
592 | REG_WRITE(ah, AR_WA, ah->WARegVal); | 590 | REG_WRITE(ah, AR_WA, ah->WARegVal); |
@@ -656,8 +654,6 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
656 | ath9k_hw_init_cal_settings(ah); | 654 | ath9k_hw_init_cal_settings(ah); |
657 | 655 | ||
658 | ah->ani_function = ATH9K_ANI_ALL; | 656 | ah->ani_function = ATH9K_ANI_ALL; |
659 | if (AR_SREV_9280_20_OR_LATER(ah) && !AR_SREV_9300_20_OR_LATER(ah)) | ||
660 | ah->ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL; | ||
661 | if (!AR_SREV_9300_20_OR_LATER(ah)) | 657 | if (!AR_SREV_9300_20_OR_LATER(ah)) |
662 | ah->ani_function &= ~ATH9K_ANI_MRC_CCK; | 658 | ah->ani_function &= ~ATH9K_ANI_MRC_CCK; |
663 | 659 | ||
@@ -1069,7 +1065,7 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1069 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) | 1065 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) |
1070 | tx_lat += 11; | 1066 | tx_lat += 11; |
1071 | 1067 | ||
1072 | sifstime *= 2; | 1068 | sifstime = 32; |
1073 | ack_offset = 16; | 1069 | ack_offset = 16; |
1074 | slottime = 13; | 1070 | slottime = 13; |
1075 | } else if (IS_CHAN_QUARTER_RATE(chan)) { | 1071 | } else if (IS_CHAN_QUARTER_RATE(chan)) { |
@@ -1079,7 +1075,7 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1079 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) | 1075 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) |
1080 | tx_lat += 22; | 1076 | tx_lat += 22; |
1081 | 1077 | ||
1082 | sifstime *= 4; | 1078 | sifstime = 64; |
1083 | ack_offset = 32; | 1079 | ack_offset = 32; |
1084 | slottime = 21; | 1080 | slottime = 21; |
1085 | } else { | 1081 | } else { |
@@ -1116,7 +1112,6 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1116 | ctstimeout += 48 - sifstime - ah->slottime; | 1112 | ctstimeout += 48 - sifstime - ah->slottime; |
1117 | } | 1113 | } |
1118 | 1114 | ||
1119 | |||
1120 | ath9k_hw_set_sifs_time(ah, sifstime); | 1115 | ath9k_hw_set_sifs_time(ah, sifstime); |
1121 | ath9k_hw_setslottime(ah, slottime); | 1116 | ath9k_hw_setslottime(ah, slottime); |
1122 | ath9k_hw_set_ack_timeout(ah, acktimeout); | 1117 | ath9k_hw_set_ack_timeout(ah, acktimeout); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 64ff8e61c243..69a907b55a73 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -311,9 +311,11 @@ struct ath9k_ops_config { | |||
311 | u16 ani_poll_interval; /* ANI poll interval in ms */ | 311 | u16 ani_poll_interval; /* ANI poll interval in ms */ |
312 | 312 | ||
313 | /* Platform specific config */ | 313 | /* Platform specific config */ |
314 | u32 aspm_l1_fix; | ||
314 | u32 xlna_gpio; | 315 | u32 xlna_gpio; |
315 | u32 ant_ctrl_comm2g_switch_enable; | 316 | u32 ant_ctrl_comm2g_switch_enable; |
316 | bool xatten_margin_cfg; | 317 | bool xatten_margin_cfg; |
318 | bool alt_mingainidx; | ||
317 | }; | 319 | }; |
318 | 320 | ||
319 | enum ath9k_int { | 321 | enum ath9k_int { |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 3b56c2e7efe7..9a1f349f9260 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -146,14 +146,22 @@ static struct ieee80211_rate ath9k_legacy_rates[] = { | |||
146 | RATE(20, 0x1a, IEEE80211_RATE_SHORT_PREAMBLE), | 146 | RATE(20, 0x1a, IEEE80211_RATE_SHORT_PREAMBLE), |
147 | RATE(55, 0x19, IEEE80211_RATE_SHORT_PREAMBLE), | 147 | RATE(55, 0x19, IEEE80211_RATE_SHORT_PREAMBLE), |
148 | RATE(110, 0x18, IEEE80211_RATE_SHORT_PREAMBLE), | 148 | RATE(110, 0x18, IEEE80211_RATE_SHORT_PREAMBLE), |
149 | RATE(60, 0x0b, 0), | 149 | RATE(60, 0x0b, (IEEE80211_RATE_SUPPORTS_5MHZ | |
150 | RATE(90, 0x0f, 0), | 150 | IEEE80211_RATE_SUPPORTS_10MHZ)), |
151 | RATE(120, 0x0a, 0), | 151 | RATE(90, 0x0f, (IEEE80211_RATE_SUPPORTS_5MHZ | |
152 | RATE(180, 0x0e, 0), | 152 | IEEE80211_RATE_SUPPORTS_10MHZ)), |
153 | RATE(240, 0x09, 0), | 153 | RATE(120, 0x0a, (IEEE80211_RATE_SUPPORTS_5MHZ | |
154 | RATE(360, 0x0d, 0), | 154 | IEEE80211_RATE_SUPPORTS_10MHZ)), |
155 | RATE(480, 0x08, 0), | 155 | RATE(180, 0x0e, (IEEE80211_RATE_SUPPORTS_5MHZ | |
156 | RATE(540, 0x0c, 0), | 156 | IEEE80211_RATE_SUPPORTS_10MHZ)), |
157 | RATE(240, 0x09, (IEEE80211_RATE_SUPPORTS_5MHZ | | ||
158 | IEEE80211_RATE_SUPPORTS_10MHZ)), | ||
159 | RATE(360, 0x0d, (IEEE80211_RATE_SUPPORTS_5MHZ | | ||
160 | IEEE80211_RATE_SUPPORTS_10MHZ)), | ||
161 | RATE(480, 0x08, (IEEE80211_RATE_SUPPORTS_5MHZ | | ||
162 | IEEE80211_RATE_SUPPORTS_10MHZ)), | ||
163 | RATE(540, 0x0c, (IEEE80211_RATE_SUPPORTS_5MHZ | | ||
164 | IEEE80211_RATE_SUPPORTS_10MHZ)), | ||
157 | }; | 165 | }; |
158 | 166 | ||
159 | #ifdef CONFIG_MAC80211_LEDS | 167 | #ifdef CONFIG_MAC80211_LEDS |
@@ -526,6 +534,7 @@ static void ath9k_init_platform(struct ath_softc *sc) | |||
526 | ATH9K_PCI_CUS230)) { | 534 | ATH9K_PCI_CUS230)) { |
527 | ah->config.xlna_gpio = 9; | 535 | ah->config.xlna_gpio = 9; |
528 | ah->config.xatten_margin_cfg = true; | 536 | ah->config.xatten_margin_cfg = true; |
537 | ah->config.alt_mingainidx = true; | ||
529 | ah->config.ant_ctrl_comm2g_switch_enable = 0x000BBB88; | 538 | ah->config.ant_ctrl_comm2g_switch_enable = 0x000BBB88; |
530 | sc->ant_comb.low_rssi_thresh = 20; | 539 | sc->ant_comb.low_rssi_thresh = 20; |
531 | sc->ant_comb.fast_div_bias = 3; | 540 | sc->ant_comb.fast_div_bias = 3; |
@@ -542,6 +551,11 @@ static void ath9k_init_platform(struct ath_softc *sc) | |||
542 | pCap->hw_caps |= ATH9K_HW_CAP_BT_ANT_DIV; | 551 | pCap->hw_caps |= ATH9K_HW_CAP_BT_ANT_DIV; |
543 | ath_info(common, "Set BT/WLAN RX diversity capability\n"); | 552 | ath_info(common, "Set BT/WLAN RX diversity capability\n"); |
544 | } | 553 | } |
554 | |||
555 | if (sc->driver_data & ATH9K_PCI_D3_L1_WAR) { | ||
556 | ah->config.pcie_waen = 0x0040473b; | ||
557 | ath_info(common, "Enable WAR for ASPM D3/L1\n"); | ||
558 | } | ||
545 | } | 559 | } |
546 | 560 | ||
547 | static void ath9k_eeprom_request_cb(const struct firmware *eeprom_blob, | 561 | static void ath9k_eeprom_request_cb(const struct firmware *eeprom_blob, |
@@ -726,13 +740,15 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band) | |||
726 | struct ieee80211_supported_band *sband; | 740 | struct ieee80211_supported_band *sband; |
727 | struct ieee80211_channel *chan; | 741 | struct ieee80211_channel *chan; |
728 | struct ath_hw *ah = sc->sc_ah; | 742 | struct ath_hw *ah = sc->sc_ah; |
743 | struct cfg80211_chan_def chandef; | ||
729 | int i; | 744 | int i; |
730 | 745 | ||
731 | sband = &sc->sbands[band]; | 746 | sband = &sc->sbands[band]; |
732 | for (i = 0; i < sband->n_channels; i++) { | 747 | for (i = 0; i < sband->n_channels; i++) { |
733 | chan = &sband->channels[i]; | 748 | chan = &sband->channels[i]; |
734 | ah->curchan = &ah->channels[chan->hw_value]; | 749 | ah->curchan = &ah->channels[chan->hw_value]; |
735 | ath9k_cmn_update_ichannel(ah->curchan, chan, NL80211_CHAN_HT20); | 750 | cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20); |
751 | ath9k_cmn_update_ichannel(ah->curchan, &chandef); | ||
736 | ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true); | 752 | ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true); |
737 | } | 753 | } |
738 | } | 754 | } |
@@ -818,7 +834,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
818 | IEEE80211_HW_PS_NULLFUNC_STACK | | 834 | IEEE80211_HW_PS_NULLFUNC_STACK | |
819 | IEEE80211_HW_SPECTRUM_MGMT | | 835 | IEEE80211_HW_SPECTRUM_MGMT | |
820 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | | 836 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | |
821 | IEEE80211_HW_SUPPORTS_RC_TABLE; | 837 | IEEE80211_HW_SUPPORTS_RC_TABLE | |
838 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES; | ||
822 | 839 | ||
823 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { | 840 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { |
824 | hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; | 841 | hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; |
@@ -850,6 +867,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
850 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 867 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
851 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; | 868 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; |
852 | hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; | 869 | hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; |
870 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ; | ||
871 | hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; | ||
853 | 872 | ||
854 | #ifdef CONFIG_PM_SLEEP | 873 | #ifdef CONFIG_PM_SLEEP |
855 | if ((ah->caps.hw_caps & ATH9K_HW_WOW_DEVICE_CAPABLE) && | 874 | if ((ah->caps.hw_caps & ATH9K_HW_WOW_DEVICE_CAPABLE) && |
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c index fff5d3ccc663..2f831db396ac 100644 --- a/drivers/net/wireless/ath/ath9k/link.c +++ b/drivers/net/wireless/ath/ath9k/link.c | |||
@@ -41,7 +41,7 @@ void ath_tx_complete_poll_work(struct work_struct *work) | |||
41 | txq->axq_tx_inprogress = true; | 41 | txq->axq_tx_inprogress = true; |
42 | } | 42 | } |
43 | } | 43 | } |
44 | ath_txq_unlock_complete(sc, txq); | 44 | ath_txq_unlock(sc, txq); |
45 | } | 45 | } |
46 | 46 | ||
47 | if (needreset) { | 47 | if (needreset) { |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 2ef05ebffbcf..a3eff0986a3f 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -583,9 +583,9 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, | |||
583 | rs->rs_rate = MS(ads.ds_rxstatus0, AR_RxRate); | 583 | rs->rs_rate = MS(ads.ds_rxstatus0, AR_RxRate); |
584 | rs->rs_more = (ads.ds_rxstatus1 & AR_RxMore) ? 1 : 0; | 584 | rs->rs_more = (ads.ds_rxstatus1 & AR_RxMore) ? 1 : 0; |
585 | 585 | ||
586 | rs->rs_firstaggr = (ads.ds_rxstatus8 & AR_RxFirstAggr) ? 1 : 0; | ||
586 | rs->rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ? 1 : 0; | 587 | rs->rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ? 1 : 0; |
587 | rs->rs_moreaggr = | 588 | rs->rs_moreaggr = (ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0; |
588 | (ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0; | ||
589 | rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna); | 589 | rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna); |
590 | 590 | ||
591 | /* directly mapped flags for ieee80211_rx_status */ | 591 | /* directly mapped flags for ieee80211_rx_status */ |
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index b02dfce964b4..bfccaceed44e 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h | |||
@@ -140,6 +140,7 @@ struct ath_rx_status { | |||
140 | int8_t rs_rssi_ext1; | 140 | int8_t rs_rssi_ext1; |
141 | int8_t rs_rssi_ext2; | 141 | int8_t rs_rssi_ext2; |
142 | u8 rs_isaggr; | 142 | u8 rs_isaggr; |
143 | u8 rs_firstaggr; | ||
143 | u8 rs_moreaggr; | 144 | u8 rs_moreaggr; |
144 | u8 rs_num_delims; | 145 | u8 rs_num_delims; |
145 | u8 rs_flags; | 146 | u8 rs_flags; |
@@ -569,6 +570,7 @@ struct ar5416_desc { | |||
569 | #define AR_RxAggr 0x00020000 | 570 | #define AR_RxAggr 0x00020000 |
570 | #define AR_PostDelimCRCErr 0x00040000 | 571 | #define AR_PostDelimCRCErr 0x00040000 |
571 | #define AR_RxStatusRsvd71 0x3ff80000 | 572 | #define AR_RxStatusRsvd71 0x3ff80000 |
573 | #define AR_RxFirstAggr 0x20000000 | ||
572 | #define AR_DecryptBusyErr 0x40000000 | 574 | #define AR_DecryptBusyErr 0x40000000 |
573 | #define AR_KeyMiss 0x80000000 | 575 | #define AR_KeyMiss 0x80000000 |
574 | 576 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 911744f5c43c..e4f65900132d 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -173,8 +173,7 @@ static void ath_restart_work(struct ath_softc *sc) | |||
173 | { | 173 | { |
174 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); | 174 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
175 | 175 | ||
176 | if (AR_SREV_9340(sc->sc_ah) || AR_SREV_9485(sc->sc_ah) || | 176 | if (AR_SREV_9340(sc->sc_ah) || AR_SREV_9330(sc->sc_ah)) |
177 | AR_SREV_9550(sc->sc_ah)) | ||
178 | ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, | 177 | ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, |
179 | msecs_to_jiffies(ATH_PLL_WORK_INTERVAL)); | 178 | msecs_to_jiffies(ATH_PLL_WORK_INTERVAL)); |
180 | 179 | ||
@@ -1032,6 +1031,9 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1032 | if (ath9k_uses_beacons(vif->type)) | 1031 | if (ath9k_uses_beacons(vif->type)) |
1033 | ath9k_beacon_remove_slot(sc, vif); | 1032 | ath9k_beacon_remove_slot(sc, vif); |
1034 | 1033 | ||
1034 | if (sc->csa_vif == vif) | ||
1035 | sc->csa_vif = NULL; | ||
1036 | |||
1035 | ath9k_ps_wakeup(sc); | 1037 | ath9k_ps_wakeup(sc); |
1036 | ath9k_calculate_summary_state(hw, NULL); | 1038 | ath9k_calculate_summary_state(hw, NULL); |
1037 | ath9k_ps_restore(sc); | 1039 | ath9k_ps_restore(sc); |
@@ -1201,8 +1203,6 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1201 | 1203 | ||
1202 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) { | 1204 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) { |
1203 | struct ieee80211_channel *curchan = hw->conf.chandef.chan; | 1205 | struct ieee80211_channel *curchan = hw->conf.chandef.chan; |
1204 | enum nl80211_channel_type channel_type = | ||
1205 | cfg80211_get_chandef_type(&conf->chandef); | ||
1206 | int pos = curchan->hw_value; | 1206 | int pos = curchan->hw_value; |
1207 | int old_pos = -1; | 1207 | int old_pos = -1; |
1208 | unsigned long flags; | 1208 | unsigned long flags; |
@@ -1210,8 +1210,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1210 | if (ah->curchan) | 1210 | if (ah->curchan) |
1211 | old_pos = ah->curchan - &ah->channels[0]; | 1211 | old_pos = ah->curchan - &ah->channels[0]; |
1212 | 1212 | ||
1213 | ath_dbg(common, CONFIG, "Set channel: %d MHz type: %d\n", | 1213 | ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n", |
1214 | curchan->center_freq, channel_type); | 1214 | curchan->center_freq, hw->conf.chandef.width); |
1215 | 1215 | ||
1216 | /* update survey stats for the old channel before switching */ | 1216 | /* update survey stats for the old channel before switching */ |
1217 | spin_lock_irqsave(&common->cc_lock, flags); | 1217 | spin_lock_irqsave(&common->cc_lock, flags); |
@@ -1219,7 +1219,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1219 | spin_unlock_irqrestore(&common->cc_lock, flags); | 1219 | spin_unlock_irqrestore(&common->cc_lock, flags); |
1220 | 1220 | ||
1221 | ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos], | 1221 | ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos], |
1222 | curchan, channel_type); | 1222 | &conf->chandef); |
1223 | 1223 | ||
1224 | /* | 1224 | /* |
1225 | * If the operating channel changes, change the survey in-use flags | 1225 | * If the operating channel changes, change the survey in-use flags |
@@ -2320,6 +2320,19 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) | |||
2320 | clear_bit(SC_OP_SCANNING, &sc->sc_flags); | 2320 | clear_bit(SC_OP_SCANNING, &sc->sc_flags); |
2321 | } | 2321 | } |
2322 | 2322 | ||
2323 | static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw, | ||
2324 | struct ieee80211_vif *vif, | ||
2325 | struct cfg80211_chan_def *chandef) | ||
2326 | { | ||
2327 | struct ath_softc *sc = hw->priv; | ||
2328 | |||
2329 | /* mac80211 does not support CSA in multi-if cases (yet) */ | ||
2330 | if (WARN_ON(sc->csa_vif)) | ||
2331 | return; | ||
2332 | |||
2333 | sc->csa_vif = vif; | ||
2334 | } | ||
2335 | |||
2323 | struct ieee80211_ops ath9k_ops = { | 2336 | struct ieee80211_ops ath9k_ops = { |
2324 | .tx = ath9k_tx, | 2337 | .tx = ath9k_tx, |
2325 | .start = ath9k_start, | 2338 | .start = ath9k_start, |
@@ -2364,8 +2377,8 @@ struct ieee80211_ops ath9k_ops = { | |||
2364 | 2377 | ||
2365 | #if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) | 2378 | #if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) |
2366 | .sta_add_debugfs = ath9k_sta_add_debugfs, | 2379 | .sta_add_debugfs = ath9k_sta_add_debugfs, |
2367 | .sta_remove_debugfs = ath9k_sta_remove_debugfs, | ||
2368 | #endif | 2380 | #endif |
2369 | .sw_scan_start = ath9k_sw_scan_start, | 2381 | .sw_scan_start = ath9k_sw_scan_start, |
2370 | .sw_scan_complete = ath9k_sw_scan_complete, | 2382 | .sw_scan_complete = ath9k_sw_scan_complete, |
2383 | .channel_switch_beacon = ath9k_channel_switch_beacon, | ||
2371 | }; | 2384 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 76e8c359bbf8..d089a7cf01c4 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -30,6 +30,52 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = { | |||
30 | { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */ | 30 | { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */ |
31 | { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */ | 31 | { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */ |
32 | 32 | ||
33 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
34 | 0x002A, | ||
35 | PCI_VENDOR_ID_AZWAVE, | ||
36 | 0x1C71), | ||
37 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
38 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
39 | 0x002A, | ||
40 | PCI_VENDOR_ID_FOXCONN, | ||
41 | 0xE01F), | ||
42 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
43 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
44 | 0x002A, | ||
45 | 0x11AD, /* LITEON */ | ||
46 | 0x6632), | ||
47 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
48 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
49 | 0x002A, | ||
50 | 0x11AD, /* LITEON */ | ||
51 | 0x6642), | ||
52 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
53 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
54 | 0x002A, | ||
55 | PCI_VENDOR_ID_QMI, | ||
56 | 0x0306), | ||
57 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
58 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
59 | 0x002A, | ||
60 | 0x185F, /* WNC */ | ||
61 | 0x309D), | ||
62 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
63 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
64 | 0x002A, | ||
65 | 0x10CF, /* Fujitsu */ | ||
66 | 0x147C), | ||
67 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
68 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
69 | 0x002A, | ||
70 | 0x10CF, /* Fujitsu */ | ||
71 | 0x147D), | ||
72 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
73 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
74 | 0x002A, | ||
75 | 0x10CF, /* Fujitsu */ | ||
76 | 0x1536), | ||
77 | .driver_data = ATH9K_PCI_D3_L1_WAR }, | ||
78 | |||
33 | /* AR9285 card for Asus */ | 79 | /* AR9285 card for Asus */ |
34 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | 80 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, |
35 | 0x002B, | 81 | 0x002B, |
@@ -59,6 +105,11 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = { | |||
59 | PCI_VENDOR_ID_AZWAVE, | 105 | PCI_VENDOR_ID_AZWAVE, |
60 | 0x2126), | 106 | 0x2126), |
61 | .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV }, | 107 | .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV }, |
108 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | ||
109 | 0x0032, | ||
110 | PCI_VENDOR_ID_AZWAVE, | ||
111 | 0x126A), | ||
112 | .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV }, | ||
62 | 113 | ||
63 | /* PCI-E CUS230 */ | 114 | /* PCI-E CUS230 */ |
64 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, | 115 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, |
@@ -309,6 +360,22 @@ static void ath_pci_aspm_init(struct ath_common *common) | |||
309 | return; | 360 | return; |
310 | } | 361 | } |
311 | 362 | ||
363 | /* | ||
364 | * 0x70c - Ack Frequency Register. | ||
365 | * | ||
366 | * Bits 27:29 - DEFAULT_L1_ENTRANCE_LATENCY. | ||
367 | * | ||
368 | * 000 : 1 us | ||
369 | * 001 : 2 us | ||
370 | * 010 : 4 us | ||
371 | * 011 : 8 us | ||
372 | * 100 : 16 us | ||
373 | * 101 : 32 us | ||
374 | * 110/111 : 64 us | ||
375 | */ | ||
376 | if (AR_SREV_9462(ah)) | ||
377 | pci_read_config_dword(pdev, 0x70c, &ah->config.aspm_l1_fix); | ||
378 | |||
312 | pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm); | 379 | pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm); |
313 | if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) { | 380 | if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) { |
314 | ah->aspm_enabled = true; | 381 | ah->aspm_enabled = true; |
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index a3c4ca0c94bf..d3d7c51fa6c8 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -1282,9 +1282,14 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
1282 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1282 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1283 | struct ath_rate_priv *ath_rc_priv = priv_sta; | 1283 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1284 | int i, j = 0; | 1284 | int i, j = 0; |
1285 | u32 rate_flags = ieee80211_chandef_rate_flags(&sc->hw->conf.chandef); | ||
1285 | 1286 | ||
1286 | for (i = 0; i < sband->n_bitrates; i++) { | 1287 | for (i = 0; i < sband->n_bitrates; i++) { |
1287 | if (sta->supp_rates[sband->band] & BIT(i)) { | 1288 | if (sta->supp_rates[sband->band] & BIT(i)) { |
1289 | if ((rate_flags & sband->bitrates[i].flags) | ||
1290 | != rate_flags) | ||
1291 | continue; | ||
1292 | |||
1288 | ath_rc_priv->neg_rates.rs_rates[j] | 1293 | ath_rc_priv->neg_rates.rs_rates[j] |
1289 | = (sband->bitrates[i].bitrate * 2) / 10; | 1294 | = (sband->bitrates[i].bitrate * 2) / 10; |
1290 | j++; | 1295 | j++; |
@@ -1326,8 +1331,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, | |||
1326 | ath_rc_init(sc, priv_sta); | 1331 | ath_rc_init(sc, priv_sta); |
1327 | 1332 | ||
1328 | ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG, | 1333 | ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG, |
1329 | "Operating HT Bandwidth changed to: %d\n", | 1334 | "Operating Bandwidth changed to: %d\n", |
1330 | cfg80211_get_chandef_type(&sc->hw->conf.chandef)); | 1335 | sc->hw->conf.chandef.width); |
1331 | } | 1336 | } |
1332 | } | 1337 | } |
1333 | 1338 | ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 62dff97c1ae4..4ee472a5a4e4 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -42,8 +42,6 @@ static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf) | |||
42 | struct ath_desc *ds; | 42 | struct ath_desc *ds; |
43 | struct sk_buff *skb; | 43 | struct sk_buff *skb; |
44 | 44 | ||
45 | ATH_RXBUF_RESET(bf); | ||
46 | |||
47 | ds = bf->bf_desc; | 45 | ds = bf->bf_desc; |
48 | ds->ds_link = 0; /* link to null */ | 46 | ds->ds_link = 0; /* link to null */ |
49 | ds->ds_data = bf->bf_buf_addr; | 47 | ds->ds_data = bf->bf_buf_addr; |
@@ -70,6 +68,14 @@ static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf) | |||
70 | sc->rx.rxlink = &ds->ds_link; | 68 | sc->rx.rxlink = &ds->ds_link; |
71 | } | 69 | } |
72 | 70 | ||
71 | static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_buf *bf) | ||
72 | { | ||
73 | if (sc->rx.buf_hold) | ||
74 | ath_rx_buf_link(sc, sc->rx.buf_hold); | ||
75 | |||
76 | sc->rx.buf_hold = bf; | ||
77 | } | ||
78 | |||
73 | static void ath_setdefantenna(struct ath_softc *sc, u32 antenna) | 79 | static void ath_setdefantenna(struct ath_softc *sc, u32 antenna) |
74 | { | 80 | { |
75 | /* XXX block beacon interrupts */ | 81 | /* XXX block beacon interrupts */ |
@@ -117,7 +123,6 @@ static bool ath_rx_edma_buf_link(struct ath_softc *sc, | |||
117 | 123 | ||
118 | skb = bf->bf_mpdu; | 124 | skb = bf->bf_mpdu; |
119 | 125 | ||
120 | ATH_RXBUF_RESET(bf); | ||
121 | memset(skb->data, 0, ah->caps.rx_status_len); | 126 | memset(skb->data, 0, ah->caps.rx_status_len); |
122 | dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, | 127 | dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, |
123 | ah->caps.rx_status_len, DMA_TO_DEVICE); | 128 | ah->caps.rx_status_len, DMA_TO_DEVICE); |
@@ -185,7 +190,7 @@ static void ath_rx_edma_cleanup(struct ath_softc *sc) | |||
185 | 190 | ||
186 | static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size) | 191 | static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size) |
187 | { | 192 | { |
188 | skb_queue_head_init(&rx_edma->rx_fifo); | 193 | __skb_queue_head_init(&rx_edma->rx_fifo); |
189 | rx_edma->rx_fifo_hwsize = size; | 194 | rx_edma->rx_fifo_hwsize = size; |
190 | } | 195 | } |
191 | 196 | ||
@@ -432,6 +437,7 @@ int ath_startrecv(struct ath_softc *sc) | |||
432 | if (list_empty(&sc->rx.rxbuf)) | 437 | if (list_empty(&sc->rx.rxbuf)) |
433 | goto start_recv; | 438 | goto start_recv; |
434 | 439 | ||
440 | sc->rx.buf_hold = NULL; | ||
435 | sc->rx.rxlink = NULL; | 441 | sc->rx.rxlink = NULL; |
436 | list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) { | 442 | list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) { |
437 | ath_rx_buf_link(sc, bf); | 443 | ath_rx_buf_link(sc, bf); |
@@ -677,6 +683,9 @@ static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc, | |||
677 | } | 683 | } |
678 | 684 | ||
679 | bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); | 685 | bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); |
686 | if (bf == sc->rx.buf_hold) | ||
687 | return NULL; | ||
688 | |||
680 | ds = bf->bf_desc; | 689 | ds = bf->bf_desc; |
681 | 690 | ||
682 | /* | 691 | /* |
@@ -755,7 +764,6 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
755 | bool is_mc, is_valid_tkip, strip_mic, mic_error; | 764 | bool is_mc, is_valid_tkip, strip_mic, mic_error; |
756 | struct ath_hw *ah = common->ah; | 765 | struct ath_hw *ah = common->ah; |
757 | __le16 fc; | 766 | __le16 fc; |
758 | u8 rx_status_len = ah->caps.rx_status_len; | ||
759 | 767 | ||
760 | fc = hdr->frame_control; | 768 | fc = hdr->frame_control; |
761 | 769 | ||
@@ -777,25 +785,6 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
777 | !test_bit(rx_stats->rs_keyix, common->ccmp_keymap)) | 785 | !test_bit(rx_stats->rs_keyix, common->ccmp_keymap)) |
778 | rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; | 786 | rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; |
779 | 787 | ||
780 | if (!rx_stats->rs_datalen) { | ||
781 | RX_STAT_INC(rx_len_err); | ||
782 | return false; | ||
783 | } | ||
784 | |||
785 | /* | ||
786 | * rs_status follows rs_datalen so if rs_datalen is too large | ||
787 | * we can take a hint that hardware corrupted it, so ignore | ||
788 | * those frames. | ||
789 | */ | ||
790 | if (rx_stats->rs_datalen > (common->rx_bufsize - rx_status_len)) { | ||
791 | RX_STAT_INC(rx_len_err); | ||
792 | return false; | ||
793 | } | ||
794 | |||
795 | /* Only use error bits from the last fragment */ | ||
796 | if (rx_stats->rs_more) | ||
797 | return true; | ||
798 | |||
799 | mic_error = is_valid_tkip && !ieee80211_is_ctl(fc) && | 788 | mic_error = is_valid_tkip && !ieee80211_is_ctl(fc) && |
800 | !ieee80211_has_morefrags(fc) && | 789 | !ieee80211_has_morefrags(fc) && |
801 | !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && | 790 | !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && |
@@ -814,8 +803,6 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
814 | rxs->flag |= RX_FLAG_FAILED_FCS_CRC; | 803 | rxs->flag |= RX_FLAG_FAILED_FCS_CRC; |
815 | mic_error = false; | 804 | mic_error = false; |
816 | } | 805 | } |
817 | if (rx_stats->rs_status & ATH9K_RXERR_PHY) | ||
818 | return false; | ||
819 | 806 | ||
820 | if ((rx_stats->rs_status & ATH9K_RXERR_DECRYPT) || | 807 | if ((rx_stats->rs_status & ATH9K_RXERR_DECRYPT) || |
821 | (!is_mc && (rx_stats->rs_status & ATH9K_RXERR_KEYMISS))) { | 808 | (!is_mc && (rx_stats->rs_status & ATH9K_RXERR_KEYMISS))) { |
@@ -865,6 +852,17 @@ static int ath9k_process_rate(struct ath_common *common, | |||
865 | band = hw->conf.chandef.chan->band; | 852 | band = hw->conf.chandef.chan->band; |
866 | sband = hw->wiphy->bands[band]; | 853 | sband = hw->wiphy->bands[band]; |
867 | 854 | ||
855 | switch (hw->conf.chandef.width) { | ||
856 | case NL80211_CHAN_WIDTH_5: | ||
857 | rxs->flag |= RX_FLAG_5MHZ; | ||
858 | break; | ||
859 | case NL80211_CHAN_WIDTH_10: | ||
860 | rxs->flag |= RX_FLAG_10MHZ; | ||
861 | break; | ||
862 | default: | ||
863 | break; | ||
864 | } | ||
865 | |||
868 | if (rx_stats->rs_rate & 0x80) { | 866 | if (rx_stats->rs_rate & 0x80) { |
869 | /* HT rate */ | 867 | /* HT rate */ |
870 | rxs->flag |= RX_FLAG_HT; | 868 | rxs->flag |= RX_FLAG_HT; |
@@ -898,129 +896,65 @@ static int ath9k_process_rate(struct ath_common *common, | |||
898 | 896 | ||
899 | static void ath9k_process_rssi(struct ath_common *common, | 897 | static void ath9k_process_rssi(struct ath_common *common, |
900 | struct ieee80211_hw *hw, | 898 | struct ieee80211_hw *hw, |
901 | struct ieee80211_hdr *hdr, | 899 | struct ath_rx_status *rx_stats, |
902 | struct ath_rx_status *rx_stats) | 900 | struct ieee80211_rx_status *rxs) |
903 | { | 901 | { |
904 | struct ath_softc *sc = hw->priv; | 902 | struct ath_softc *sc = hw->priv; |
905 | struct ath_hw *ah = common->ah; | 903 | struct ath_hw *ah = common->ah; |
906 | int last_rssi; | 904 | int last_rssi; |
907 | int rssi = rx_stats->rs_rssi; | 905 | int rssi = rx_stats->rs_rssi; |
908 | 906 | ||
909 | if (!rx_stats->is_mybeacon || | 907 | /* |
910 | ((ah->opmode != NL80211_IFTYPE_STATION) && | 908 | * RSSI is not available for subframes in an A-MPDU. |
911 | (ah->opmode != NL80211_IFTYPE_ADHOC))) | 909 | */ |
910 | if (rx_stats->rs_moreaggr) { | ||
911 | rxs->flag |= RX_FLAG_NO_SIGNAL_VAL; | ||
912 | return; | 912 | return; |
913 | 913 | } | |
914 | if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr) | ||
915 | ATH_RSSI_LPF(sc->last_rssi, rx_stats->rs_rssi); | ||
916 | |||
917 | last_rssi = sc->last_rssi; | ||
918 | if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) | ||
919 | rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER); | ||
920 | if (rssi < 0) | ||
921 | rssi = 0; | ||
922 | |||
923 | /* Update Beacon RSSI, this is used by ANI. */ | ||
924 | ah->stats.avgbrssi = rssi; | ||
925 | } | ||
926 | |||
927 | /* | ||
928 | * For Decrypt or Demic errors, we only mark packet status here and always push | ||
929 | * up the frame up to let mac80211 handle the actual error case, be it no | ||
930 | * decryption key or real decryption error. This let us keep statistics there. | ||
931 | */ | ||
932 | static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | ||
933 | struct ieee80211_hdr *hdr, | ||
934 | struct ath_rx_status *rx_stats, | ||
935 | struct ieee80211_rx_status *rx_status, | ||
936 | bool *decrypt_error) | ||
937 | { | ||
938 | struct ieee80211_hw *hw = sc->hw; | ||
939 | struct ath_hw *ah = sc->sc_ah; | ||
940 | struct ath_common *common = ath9k_hw_common(ah); | ||
941 | bool discard_current = sc->rx.discard_next; | ||
942 | |||
943 | sc->rx.discard_next = rx_stats->rs_more; | ||
944 | if (discard_current) | ||
945 | return -EINVAL; | ||
946 | 914 | ||
947 | /* | 915 | /* |
948 | * everything but the rate is checked here, the rate check is done | 916 | * Check if the RSSI for the last subframe in an A-MPDU |
949 | * separately to avoid doing two lookups for a rate for each frame. | 917 | * or an unaggregated frame is valid. |
950 | */ | 918 | */ |
951 | if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error)) | 919 | if (rx_stats->rs_rssi == ATH9K_RSSI_BAD) { |
952 | return -EINVAL; | 920 | rxs->flag |= RX_FLAG_NO_SIGNAL_VAL; |
953 | 921 | return; | |
954 | /* Only use status info from the last fragment */ | 922 | } |
955 | if (rx_stats->rs_more) | ||
956 | return 0; | ||
957 | 923 | ||
958 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) | 924 | /* |
959 | return -EINVAL; | 925 | * Update Beacon RSSI, this is used by ANI. |
926 | */ | ||
927 | if (rx_stats->is_mybeacon && | ||
928 | ((ah->opmode == NL80211_IFTYPE_STATION) || | ||
929 | (ah->opmode == NL80211_IFTYPE_ADHOC))) { | ||
930 | ATH_RSSI_LPF(sc->last_rssi, rx_stats->rs_rssi); | ||
931 | last_rssi = sc->last_rssi; | ||
960 | 932 | ||
961 | ath9k_process_rssi(common, hw, hdr, rx_stats); | 933 | if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) |
934 | rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER); | ||
935 | if (rssi < 0) | ||
936 | rssi = 0; | ||
962 | 937 | ||
963 | rx_status->band = hw->conf.chandef.chan->band; | 938 | ah->stats.avgbrssi = rssi; |
964 | rx_status->freq = hw->conf.chandef.chan->center_freq; | 939 | } |
965 | rx_status->signal = ah->noise + rx_stats->rs_rssi; | ||
966 | rx_status->antenna = rx_stats->rs_antenna; | ||
967 | rx_status->flag |= RX_FLAG_MACTIME_END; | ||
968 | if (rx_stats->rs_moreaggr) | ||
969 | rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; | ||
970 | 940 | ||
971 | sc->rx.discard_next = false; | 941 | rxs->signal = ah->noise + rx_stats->rs_rssi; |
972 | return 0; | ||
973 | } | 942 | } |
974 | 943 | ||
975 | static void ath9k_rx_skb_postprocess(struct ath_common *common, | 944 | static void ath9k_process_tsf(struct ath_rx_status *rs, |
976 | struct sk_buff *skb, | 945 | struct ieee80211_rx_status *rxs, |
977 | struct ath_rx_status *rx_stats, | 946 | u64 tsf) |
978 | struct ieee80211_rx_status *rxs, | ||
979 | bool decrypt_error) | ||
980 | { | 947 | { |
981 | struct ath_hw *ah = common->ah; | 948 | u32 tsf_lower = tsf & 0xffffffff; |
982 | struct ieee80211_hdr *hdr; | ||
983 | int hdrlen, padpos, padsize; | ||
984 | u8 keyix; | ||
985 | __le16 fc; | ||
986 | |||
987 | /* see if any padding is done by the hw and remove it */ | ||
988 | hdr = (struct ieee80211_hdr *) skb->data; | ||
989 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | ||
990 | fc = hdr->frame_control; | ||
991 | padpos = ieee80211_hdrlen(fc); | ||
992 | |||
993 | /* The MAC header is padded to have 32-bit boundary if the | ||
994 | * packet payload is non-zero. The general calculation for | ||
995 | * padsize would take into account odd header lengths: | ||
996 | * padsize = (4 - padpos % 4) % 4; However, since only | ||
997 | * even-length headers are used, padding can only be 0 or 2 | ||
998 | * bytes and we can optimize this a bit. In addition, we must | ||
999 | * not try to remove padding from short control frames that do | ||
1000 | * not have payload. */ | ||
1001 | padsize = padpos & 3; | ||
1002 | if (padsize && skb->len>=padpos+padsize+FCS_LEN) { | ||
1003 | memmove(skb->data + padsize, skb->data, padpos); | ||
1004 | skb_pull(skb, padsize); | ||
1005 | } | ||
1006 | |||
1007 | keyix = rx_stats->rs_keyix; | ||
1008 | 949 | ||
1009 | if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error && | 950 | rxs->mactime = (tsf & ~0xffffffffULL) | rs->rs_tstamp; |
1010 | ieee80211_has_protected(fc)) { | 951 | if (rs->rs_tstamp > tsf_lower && |
1011 | rxs->flag |= RX_FLAG_DECRYPTED; | 952 | unlikely(rs->rs_tstamp - tsf_lower > 0x10000000)) |
1012 | } else if (ieee80211_has_protected(fc) | 953 | rxs->mactime -= 0x100000000ULL; |
1013 | && !decrypt_error && skb->len >= hdrlen + 4) { | ||
1014 | keyix = skb->data[hdrlen + 3] >> 6; | ||
1015 | 954 | ||
1016 | if (test_bit(keyix, common->keymap)) | 955 | if (rs->rs_tstamp < tsf_lower && |
1017 | rxs->flag |= RX_FLAG_DECRYPTED; | 956 | unlikely(tsf_lower - rs->rs_tstamp > 0x10000000)) |
1018 | } | 957 | rxs->mactime += 0x100000000ULL; |
1019 | if (ah->sw_mgmt_crypto && | ||
1020 | (rxs->flag & RX_FLAG_DECRYPTED) && | ||
1021 | ieee80211_is_mgmt(fc)) | ||
1022 | /* Use software decrypt for management frames. */ | ||
1023 | rxs->flag &= ~RX_FLAG_DECRYPTED; | ||
1024 | } | 958 | } |
1025 | 959 | ||
1026 | #ifdef CONFIG_ATH9K_DEBUGFS | 960 | #ifdef CONFIG_ATH9K_DEBUGFS |
@@ -1133,6 +1067,234 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, | |||
1133 | #endif | 1067 | #endif |
1134 | } | 1068 | } |
1135 | 1069 | ||
1070 | static bool ath9k_is_mybeacon(struct ath_softc *sc, struct ieee80211_hdr *hdr) | ||
1071 | { | ||
1072 | struct ath_hw *ah = sc->sc_ah; | ||
1073 | struct ath_common *common = ath9k_hw_common(ah); | ||
1074 | |||
1075 | if (ieee80211_is_beacon(hdr->frame_control)) { | ||
1076 | RX_STAT_INC(rx_beacons); | ||
1077 | if (!is_zero_ether_addr(common->curbssid) && | ||
1078 | ether_addr_equal(hdr->addr3, common->curbssid)) | ||
1079 | return true; | ||
1080 | } | ||
1081 | |||
1082 | return false; | ||
1083 | } | ||
1084 | |||
1085 | /* | ||
1086 | * For Decrypt or Demic errors, we only mark packet status here and always push | ||
1087 | * up the frame up to let mac80211 handle the actual error case, be it no | ||
1088 | * decryption key or real decryption error. This let us keep statistics there. | ||
1089 | */ | ||
1090 | static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | ||
1091 | struct sk_buff *skb, | ||
1092 | struct ath_rx_status *rx_stats, | ||
1093 | struct ieee80211_rx_status *rx_status, | ||
1094 | bool *decrypt_error, u64 tsf) | ||
1095 | { | ||
1096 | struct ieee80211_hw *hw = sc->hw; | ||
1097 | struct ath_hw *ah = sc->sc_ah; | ||
1098 | struct ath_common *common = ath9k_hw_common(ah); | ||
1099 | struct ieee80211_hdr *hdr; | ||
1100 | bool discard_current = sc->rx.discard_next; | ||
1101 | int ret = 0; | ||
1102 | |||
1103 | /* | ||
1104 | * Discard corrupt descriptors which are marked in | ||
1105 | * ath_get_next_rx_buf(). | ||
1106 | */ | ||
1107 | sc->rx.discard_next = rx_stats->rs_more; | ||
1108 | if (discard_current) | ||
1109 | return -EINVAL; | ||
1110 | |||
1111 | /* | ||
1112 | * Discard zero-length packets. | ||
1113 | */ | ||
1114 | if (!rx_stats->rs_datalen) { | ||
1115 | RX_STAT_INC(rx_len_err); | ||
1116 | return -EINVAL; | ||
1117 | } | ||
1118 | |||
1119 | /* | ||
1120 | * rs_status follows rs_datalen so if rs_datalen is too large | ||
1121 | * we can take a hint that hardware corrupted it, so ignore | ||
1122 | * those frames. | ||
1123 | */ | ||
1124 | if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) { | ||
1125 | RX_STAT_INC(rx_len_err); | ||
1126 | return -EINVAL; | ||
1127 | } | ||
1128 | |||
1129 | /* Only use status info from the last fragment */ | ||
1130 | if (rx_stats->rs_more) | ||
1131 | return 0; | ||
1132 | |||
1133 | /* | ||
1134 | * Return immediately if the RX descriptor has been marked | ||
1135 | * as corrupt based on the various error bits. | ||
1136 | * | ||
1137 | * This is different from the other corrupt descriptor | ||
1138 | * condition handled above. | ||
1139 | */ | ||
1140 | if (rx_stats->rs_status & ATH9K_RXERR_CORRUPT_DESC) { | ||
1141 | ret = -EINVAL; | ||
1142 | goto exit; | ||
1143 | } | ||
1144 | |||
1145 | hdr = (struct ieee80211_hdr *) (skb->data + ah->caps.rx_status_len); | ||
1146 | |||
1147 | ath9k_process_tsf(rx_stats, rx_status, tsf); | ||
1148 | ath_debug_stat_rx(sc, rx_stats); | ||
1149 | |||
1150 | /* | ||
1151 | * Process PHY errors and return so that the packet | ||
1152 | * can be dropped. | ||
1153 | */ | ||
1154 | if (rx_stats->rs_status & ATH9K_RXERR_PHY) { | ||
1155 | ath9k_dfs_process_phyerr(sc, hdr, rx_stats, rx_status->mactime); | ||
1156 | if (ath_process_fft(sc, hdr, rx_stats, rx_status->mactime)) | ||
1157 | RX_STAT_INC(rx_spectral); | ||
1158 | |||
1159 | ret = -EINVAL; | ||
1160 | goto exit; | ||
1161 | } | ||
1162 | |||
1163 | /* | ||
1164 | * everything but the rate is checked here, the rate check is done | ||
1165 | * separately to avoid doing two lookups for a rate for each frame. | ||
1166 | */ | ||
1167 | if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error)) { | ||
1168 | ret = -EINVAL; | ||
1169 | goto exit; | ||
1170 | } | ||
1171 | |||
1172 | rx_stats->is_mybeacon = ath9k_is_mybeacon(sc, hdr); | ||
1173 | if (rx_stats->is_mybeacon) { | ||
1174 | sc->hw_busy_count = 0; | ||
1175 | ath_start_rx_poll(sc, 3); | ||
1176 | } | ||
1177 | |||
1178 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) { | ||
1179 | ret =-EINVAL; | ||
1180 | goto exit; | ||
1181 | } | ||
1182 | |||
1183 | ath9k_process_rssi(common, hw, rx_stats, rx_status); | ||
1184 | |||
1185 | rx_status->band = hw->conf.chandef.chan->band; | ||
1186 | rx_status->freq = hw->conf.chandef.chan->center_freq; | ||
1187 | rx_status->antenna = rx_stats->rs_antenna; | ||
1188 | rx_status->flag |= RX_FLAG_MACTIME_END; | ||
1189 | |||
1190 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT | ||
1191 | if (ieee80211_is_data_present(hdr->frame_control) && | ||
1192 | !ieee80211_is_qos_nullfunc(hdr->frame_control)) | ||
1193 | sc->rx.num_pkts++; | ||
1194 | #endif | ||
1195 | |||
1196 | exit: | ||
1197 | sc->rx.discard_next = false; | ||
1198 | return ret; | ||
1199 | } | ||
1200 | |||
1201 | static void ath9k_rx_skb_postprocess(struct ath_common *common, | ||
1202 | struct sk_buff *skb, | ||
1203 | struct ath_rx_status *rx_stats, | ||
1204 | struct ieee80211_rx_status *rxs, | ||
1205 | bool decrypt_error) | ||
1206 | { | ||
1207 | struct ath_hw *ah = common->ah; | ||
1208 | struct ieee80211_hdr *hdr; | ||
1209 | int hdrlen, padpos, padsize; | ||
1210 | u8 keyix; | ||
1211 | __le16 fc; | ||
1212 | |||
1213 | /* see if any padding is done by the hw and remove it */ | ||
1214 | hdr = (struct ieee80211_hdr *) skb->data; | ||
1215 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | ||
1216 | fc = hdr->frame_control; | ||
1217 | padpos = ieee80211_hdrlen(fc); | ||
1218 | |||
1219 | /* The MAC header is padded to have 32-bit boundary if the | ||
1220 | * packet payload is non-zero. The general calculation for | ||
1221 | * padsize would take into account odd header lengths: | ||
1222 | * padsize = (4 - padpos % 4) % 4; However, since only | ||
1223 | * even-length headers are used, padding can only be 0 or 2 | ||
1224 | * bytes and we can optimize this a bit. In addition, we must | ||
1225 | * not try to remove padding from short control frames that do | ||
1226 | * not have payload. */ | ||
1227 | padsize = padpos & 3; | ||
1228 | if (padsize && skb->len>=padpos+padsize+FCS_LEN) { | ||
1229 | memmove(skb->data + padsize, skb->data, padpos); | ||
1230 | skb_pull(skb, padsize); | ||
1231 | } | ||
1232 | |||
1233 | keyix = rx_stats->rs_keyix; | ||
1234 | |||
1235 | if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error && | ||
1236 | ieee80211_has_protected(fc)) { | ||
1237 | rxs->flag |= RX_FLAG_DECRYPTED; | ||
1238 | } else if (ieee80211_has_protected(fc) | ||
1239 | && !decrypt_error && skb->len >= hdrlen + 4) { | ||
1240 | keyix = skb->data[hdrlen + 3] >> 6; | ||
1241 | |||
1242 | if (test_bit(keyix, common->keymap)) | ||
1243 | rxs->flag |= RX_FLAG_DECRYPTED; | ||
1244 | } | ||
1245 | if (ah->sw_mgmt_crypto && | ||
1246 | (rxs->flag & RX_FLAG_DECRYPTED) && | ||
1247 | ieee80211_is_mgmt(fc)) | ||
1248 | /* Use software decrypt for management frames. */ | ||
1249 | rxs->flag &= ~RX_FLAG_DECRYPTED; | ||
1250 | } | ||
1251 | |||
1252 | /* | ||
1253 | * Run the LNA combining algorithm only in these cases: | ||
1254 | * | ||
1255 | * Standalone WLAN cards with both LNA/Antenna diversity | ||
1256 | * enabled in the EEPROM. | ||
1257 | * | ||
1258 | * WLAN+BT cards which are in the supported card list | ||
1259 | * in ath_pci_id_table and the user has loaded the | ||
1260 | * driver with "bt_ant_diversity" set to true. | ||
1261 | */ | ||
1262 | static void ath9k_antenna_check(struct ath_softc *sc, | ||
1263 | struct ath_rx_status *rs) | ||
1264 | { | ||
1265 | struct ath_hw *ah = sc->sc_ah; | ||
1266 | struct ath9k_hw_capabilities *pCap = &ah->caps; | ||
1267 | struct ath_common *common = ath9k_hw_common(ah); | ||
1268 | |||
1269 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)) | ||
1270 | return; | ||
1271 | |||
1272 | /* | ||
1273 | * All MPDUs in an aggregate will use the same LNA | ||
1274 | * as the first MPDU. | ||
1275 | */ | ||
1276 | if (rs->rs_isaggr && !rs->rs_firstaggr) | ||
1277 | return; | ||
1278 | |||
1279 | /* | ||
1280 | * Change the default rx antenna if rx diversity | ||
1281 | * chooses the other antenna 3 times in a row. | ||
1282 | */ | ||
1283 | if (sc->rx.defant != rs->rs_antenna) { | ||
1284 | if (++sc->rx.rxotherant >= 3) | ||
1285 | ath_setdefantenna(sc, rs->rs_antenna); | ||
1286 | } else { | ||
1287 | sc->rx.rxotherant = 0; | ||
1288 | } | ||
1289 | |||
1290 | if (pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV) { | ||
1291 | if (common->bt_ant_diversity) | ||
1292 | ath_ant_comb_scan(sc, rs); | ||
1293 | } else { | ||
1294 | ath_ant_comb_scan(sc, rs); | ||
1295 | } | ||
1296 | } | ||
1297 | |||
1136 | static void ath9k_apply_ampdu_details(struct ath_softc *sc, | 1298 | static void ath9k_apply_ampdu_details(struct ath_softc *sc, |
1137 | struct ath_rx_status *rs, struct ieee80211_rx_status *rxs) | 1299 | struct ath_rx_status *rs, struct ieee80211_rx_status *rxs) |
1138 | { | 1300 | { |
@@ -1157,18 +1319,14 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1157 | struct sk_buff *skb = NULL, *requeue_skb, *hdr_skb; | 1319 | struct sk_buff *skb = NULL, *requeue_skb, *hdr_skb; |
1158 | struct ieee80211_rx_status *rxs; | 1320 | struct ieee80211_rx_status *rxs; |
1159 | struct ath_hw *ah = sc->sc_ah; | 1321 | struct ath_hw *ah = sc->sc_ah; |
1160 | struct ath9k_hw_capabilities *pCap = &ah->caps; | ||
1161 | struct ath_common *common = ath9k_hw_common(ah); | 1322 | struct ath_common *common = ath9k_hw_common(ah); |
1162 | struct ieee80211_hw *hw = sc->hw; | 1323 | struct ieee80211_hw *hw = sc->hw; |
1163 | struct ieee80211_hdr *hdr; | ||
1164 | int retval; | 1324 | int retval; |
1165 | struct ath_rx_status rs; | 1325 | struct ath_rx_status rs; |
1166 | enum ath9k_rx_qtype qtype; | 1326 | enum ath9k_rx_qtype qtype; |
1167 | bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); | 1327 | bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); |
1168 | int dma_type; | 1328 | int dma_type; |
1169 | u8 rx_status_len = ah->caps.rx_status_len; | ||
1170 | u64 tsf = 0; | 1329 | u64 tsf = 0; |
1171 | u32 tsf_lower = 0; | ||
1172 | unsigned long flags; | 1330 | unsigned long flags; |
1173 | dma_addr_t new_buf_addr; | 1331 | dma_addr_t new_buf_addr; |
1174 | 1332 | ||
@@ -1180,7 +1338,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1180 | qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; | 1338 | qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; |
1181 | 1339 | ||
1182 | tsf = ath9k_hw_gettsf64(ah); | 1340 | tsf = ath9k_hw_gettsf64(ah); |
1183 | tsf_lower = tsf & 0xffffffff; | ||
1184 | 1341 | ||
1185 | do { | 1342 | do { |
1186 | bool decrypt_error = false; | 1343 | bool decrypt_error = false; |
@@ -1207,55 +1364,14 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1207 | else | 1364 | else |
1208 | hdr_skb = skb; | 1365 | hdr_skb = skb; |
1209 | 1366 | ||
1210 | hdr = (struct ieee80211_hdr *) (hdr_skb->data + rx_status_len); | ||
1211 | rxs = IEEE80211_SKB_RXCB(hdr_skb); | 1367 | rxs = IEEE80211_SKB_RXCB(hdr_skb); |
1212 | if (ieee80211_is_beacon(hdr->frame_control)) { | ||
1213 | RX_STAT_INC(rx_beacons); | ||
1214 | if (!is_zero_ether_addr(common->curbssid) && | ||
1215 | ether_addr_equal(hdr->addr3, common->curbssid)) | ||
1216 | rs.is_mybeacon = true; | ||
1217 | else | ||
1218 | rs.is_mybeacon = false; | ||
1219 | } | ||
1220 | else | ||
1221 | rs.is_mybeacon = false; | ||
1222 | |||
1223 | if (ieee80211_is_data_present(hdr->frame_control) && | ||
1224 | !ieee80211_is_qos_nullfunc(hdr->frame_control)) | ||
1225 | sc->rx.num_pkts++; | ||
1226 | |||
1227 | ath_debug_stat_rx(sc, &rs); | ||
1228 | |||
1229 | memset(rxs, 0, sizeof(struct ieee80211_rx_status)); | 1368 | memset(rxs, 0, sizeof(struct ieee80211_rx_status)); |
1230 | 1369 | ||
1231 | rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp; | 1370 | retval = ath9k_rx_skb_preprocess(sc, hdr_skb, &rs, rxs, |
1232 | if (rs.rs_tstamp > tsf_lower && | 1371 | &decrypt_error, tsf); |
1233 | unlikely(rs.rs_tstamp - tsf_lower > 0x10000000)) | ||
1234 | rxs->mactime -= 0x100000000ULL; | ||
1235 | |||
1236 | if (rs.rs_tstamp < tsf_lower && | ||
1237 | unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) | ||
1238 | rxs->mactime += 0x100000000ULL; | ||
1239 | |||
1240 | if (rs.rs_phyerr == ATH9K_PHYERR_RADAR) | ||
1241 | ath9k_dfs_process_phyerr(sc, hdr, &rs, rxs->mactime); | ||
1242 | |||
1243 | if (rs.rs_status & ATH9K_RXERR_PHY) { | ||
1244 | if (ath_process_fft(sc, hdr, &rs, rxs->mactime)) { | ||
1245 | RX_STAT_INC(rx_spectral); | ||
1246 | goto requeue_drop_frag; | ||
1247 | } | ||
1248 | } | ||
1249 | |||
1250 | retval = ath9k_rx_skb_preprocess(sc, hdr, &rs, rxs, | ||
1251 | &decrypt_error); | ||
1252 | if (retval) | 1372 | if (retval) |
1253 | goto requeue_drop_frag; | 1373 | goto requeue_drop_frag; |
1254 | 1374 | ||
1255 | if (rs.is_mybeacon) { | ||
1256 | sc->hw_busy_count = 0; | ||
1257 | ath_start_rx_poll(sc, 3); | ||
1258 | } | ||
1259 | /* Ensure we always have an skb to requeue once we are done | 1375 | /* Ensure we always have an skb to requeue once we are done |
1260 | * processing the current buffer's skb */ | 1376 | * processing the current buffer's skb */ |
1261 | requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC); | 1377 | requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC); |
@@ -1309,8 +1425,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1309 | sc->rx.frag = skb; | 1425 | sc->rx.frag = skb; |
1310 | goto requeue; | 1426 | goto requeue; |
1311 | } | 1427 | } |
1312 | if (rs.rs_status & ATH9K_RXERR_CORRUPT_DESC) | ||
1313 | goto requeue_drop_frag; | ||
1314 | 1428 | ||
1315 | if (sc->rx.frag) { | 1429 | if (sc->rx.frag) { |
1316 | int space = skb->len - skb_tailroom(hdr_skb); | 1430 | int space = skb->len - skb_tailroom(hdr_skb); |
@@ -1340,35 +1454,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1340 | ath_rx_ps(sc, skb, rs.is_mybeacon); | 1454 | ath_rx_ps(sc, skb, rs.is_mybeacon); |
1341 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | 1455 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
1342 | 1456 | ||
1343 | /* | 1457 | ath9k_antenna_check(sc, &rs); |
1344 | * Run the LNA combining algorithm only in these cases: | ||
1345 | * | ||
1346 | * Standalone WLAN cards with both LNA/Antenna diversity | ||
1347 | * enabled in the EEPROM. | ||
1348 | * | ||
1349 | * WLAN+BT cards which are in the supported card list | ||
1350 | * in ath_pci_id_table and the user has loaded the | ||
1351 | * driver with "bt_ant_diversity" set to true. | ||
1352 | */ | ||
1353 | if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) { | ||
1354 | /* | ||
1355 | * Change the default rx antenna if rx diversity | ||
1356 | * chooses the other antenna 3 times in a row. | ||
1357 | */ | ||
1358 | if (sc->rx.defant != rs.rs_antenna) { | ||
1359 | if (++sc->rx.rxotherant >= 3) | ||
1360 | ath_setdefantenna(sc, rs.rs_antenna); | ||
1361 | } else { | ||
1362 | sc->rx.rxotherant = 0; | ||
1363 | } | ||
1364 | |||
1365 | if (pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV) { | ||
1366 | if (common->bt_ant_diversity) | ||
1367 | ath_ant_comb_scan(sc, &rs); | ||
1368 | } else { | ||
1369 | ath_ant_comb_scan(sc, &rs); | ||
1370 | } | ||
1371 | } | ||
1372 | 1458 | ||
1373 | ath9k_apply_ampdu_details(sc, &rs, rxs); | 1459 | ath9k_apply_ampdu_details(sc, &rs, rxs); |
1374 | 1460 | ||
@@ -1387,7 +1473,7 @@ requeue: | |||
1387 | if (edma) { | 1473 | if (edma) { |
1388 | ath_rx_edma_buf_link(sc, qtype); | 1474 | ath_rx_edma_buf_link(sc, qtype); |
1389 | } else { | 1475 | } else { |
1390 | ath_rx_buf_link(sc, bf); | 1476 | ath_rx_buf_relink(sc, bf); |
1391 | ath9k_hw_rxena(ah); | 1477 | ath9k_hw_rxena(ah); |
1392 | } | 1478 | } |
1393 | } while (1); | 1479 | } while (1); |
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index 5af97442ac37..a13b2d143d9e 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -893,9 +893,9 @@ | |||
893 | 893 | ||
894 | #define AR_SREV_9485(_ah) \ | 894 | #define AR_SREV_9485(_ah) \ |
895 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485)) | 895 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485)) |
896 | #define AR_SREV_9485_11(_ah) \ | 896 | #define AR_SREV_9485_11_OR_LATER(_ah) \ |
897 | (AR_SREV_9485(_ah) && \ | 897 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485) && \ |
898 | ((_ah)->hw_version.macRev == AR_SREV_REVISION_9485_11)) | 898 | ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9485_11)) |
899 | #define AR_SREV_9485_OR_LATER(_ah) \ | 899 | #define AR_SREV_9485_OR_LATER(_ah) \ |
900 | (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485)) | 900 | (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485)) |
901 | 901 | ||
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index d8dfb3ec818a..35b515fe3ffa 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -312,12 +312,6 @@ static void ath_tx_addto_baw(struct ath_softc *sc, struct ath_atx_tid *tid, | |||
312 | } | 312 | } |
313 | } | 313 | } |
314 | 314 | ||
315 | /* | ||
316 | * TODO: For frame(s) that are in the retry state, we will reuse the | ||
317 | * sequence number(s) without setting the retry bit. The | ||
318 | * alternative is to give up on these and BAR the receiver's window | ||
319 | * forward. | ||
320 | */ | ||
321 | static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, | 315 | static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, |
322 | struct ath_atx_tid *tid) | 316 | struct ath_atx_tid *tid) |
323 | 317 | ||
@@ -341,14 +335,8 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, | |||
341 | } | 335 | } |
342 | 336 | ||
343 | list_add_tail(&bf->list, &bf_head); | 337 | list_add_tail(&bf->list, &bf_head); |
344 | |||
345 | ath_tx_update_baw(sc, tid, bf->bf_state.seqno); | ||
346 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); | 338 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); |
347 | } | 339 | } |
348 | |||
349 | tid->seq_next = tid->seq_start; | ||
350 | tid->baw_tail = tid->baw_head; | ||
351 | tid->bar_index = -1; | ||
352 | } | 340 | } |
353 | 341 | ||
354 | static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq, | 342 | static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq, |
@@ -493,7 +481,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
493 | while (bf) { | 481 | while (bf) { |
494 | bf_next = bf->bf_next; | 482 | bf_next = bf->bf_next; |
495 | 483 | ||
496 | if (!bf->bf_stale || bf_next != NULL) | 484 | if (!bf->bf_state.stale || bf_next != NULL) |
497 | list_move_tail(&bf->list, &bf_head); | 485 | list_move_tail(&bf->list, &bf_head); |
498 | 486 | ||
499 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0); | 487 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0); |
@@ -586,7 +574,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
586 | * not a holding desc. | 574 | * not a holding desc. |
587 | */ | 575 | */ |
588 | INIT_LIST_HEAD(&bf_head); | 576 | INIT_LIST_HEAD(&bf_head); |
589 | if (bf_next != NULL || !bf_last->bf_stale) | 577 | if (bf_next != NULL || !bf_last->bf_state.stale) |
590 | list_move_tail(&bf->list, &bf_head); | 578 | list_move_tail(&bf->list, &bf_head); |
591 | 579 | ||
592 | if (!txpending) { | 580 | if (!txpending) { |
@@ -610,7 +598,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
610 | ieee80211_sta_eosp(sta); | 598 | ieee80211_sta_eosp(sta); |
611 | } | 599 | } |
612 | /* retry the un-acked ones */ | 600 | /* retry the un-acked ones */ |
613 | if (bf->bf_next == NULL && bf_last->bf_stale) { | 601 | if (bf->bf_next == NULL && bf_last->bf_state.stale) { |
614 | struct ath_buf *tbf; | 602 | struct ath_buf *tbf; |
615 | 603 | ||
616 | tbf = ath_clone_txbuf(sc, bf_last); | 604 | tbf = ath_clone_txbuf(sc, bf_last); |
@@ -900,6 +888,8 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, | |||
900 | bf = fi->bf; | 888 | bf = fi->bf; |
901 | if (!fi->bf) | 889 | if (!fi->bf) |
902 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); | 890 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
891 | else | ||
892 | bf->bf_state.stale = false; | ||
903 | 893 | ||
904 | if (!bf) { | 894 | if (!bf) { |
905 | __skb_unlink(skb, *q); | 895 | __skb_unlink(skb, *q); |
@@ -1734,7 +1724,7 @@ static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq, | |||
1734 | while (!list_empty(list)) { | 1724 | while (!list_empty(list)) { |
1735 | bf = list_first_entry(list, struct ath_buf, list); | 1725 | bf = list_first_entry(list, struct ath_buf, list); |
1736 | 1726 | ||
1737 | if (bf->bf_stale) { | 1727 | if (bf->bf_state.stale) { |
1738 | list_del(&bf->list); | 1728 | list_del(&bf->list); |
1739 | 1729 | ||
1740 | ath_tx_return_buffer(sc, bf); | 1730 | ath_tx_return_buffer(sc, bf); |
@@ -2490,7 +2480,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2490 | * it with the STALE flag. | 2480 | * it with the STALE flag. |
2491 | */ | 2481 | */ |
2492 | bf_held = NULL; | 2482 | bf_held = NULL; |
2493 | if (bf->bf_stale) { | 2483 | if (bf->bf_state.stale) { |
2494 | bf_held = bf; | 2484 | bf_held = bf; |
2495 | if (list_is_last(&bf_held->list, &txq->axq_q)) | 2485 | if (list_is_last(&bf_held->list, &txq->axq_q)) |
2496 | break; | 2486 | break; |
@@ -2514,7 +2504,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2514 | * however leave the last descriptor back as the holding | 2504 | * however leave the last descriptor back as the holding |
2515 | * descriptor for hw. | 2505 | * descriptor for hw. |
2516 | */ | 2506 | */ |
2517 | lastbf->bf_stale = true; | 2507 | lastbf->bf_state.stale = true; |
2518 | INIT_LIST_HEAD(&bf_head); | 2508 | INIT_LIST_HEAD(&bf_head); |
2519 | if (!list_is_singular(&lastbf->list)) | 2509 | if (!list_is_singular(&lastbf->list)) |
2520 | list_cut_position(&bf_head, | 2510 | list_cut_position(&bf_head, |
@@ -2569,6 +2559,8 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) | |||
2569 | if (ts.qid == sc->beacon.beaconq) { | 2559 | if (ts.qid == sc->beacon.beaconq) { |
2570 | sc->beacon.tx_processed = true; | 2560 | sc->beacon.tx_processed = true; |
2571 | sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); | 2561 | sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); |
2562 | |||
2563 | ath9k_csa_is_finished(sc); | ||
2572 | continue; | 2564 | continue; |
2573 | } | 2565 | } |
2574 | 2566 | ||
@@ -2585,7 +2577,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) | |||
2585 | } | 2577 | } |
2586 | 2578 | ||
2587 | bf = list_first_entry(fifo_list, struct ath_buf, list); | 2579 | bf = list_first_entry(fifo_list, struct ath_buf, list); |
2588 | if (bf->bf_stale) { | 2580 | if (bf->bf_state.stale) { |
2589 | list_del(&bf->list); | 2581 | list_del(&bf->list); |
2590 | ath_tx_return_buffer(sc, bf); | 2582 | ath_tx_return_buffer(sc, bf); |
2591 | bf = list_first_entry(fifo_list, struct ath_buf, list); | 2583 | bf = list_first_entry(fifo_list, struct ath_buf, list); |
@@ -2607,7 +2599,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) | |||
2607 | ath_tx_txqaddbuf(sc, txq, &bf_q, true); | 2599 | ath_tx_txqaddbuf(sc, txq, &bf_q, true); |
2608 | } | 2600 | } |
2609 | } else { | 2601 | } else { |
2610 | lastbf->bf_stale = true; | 2602 | lastbf->bf_state.stale = true; |
2611 | if (bf != lastbf) | 2603 | if (bf != lastbf) |
2612 | list_cut_position(&bf_head, fifo_list, | 2604 | list_cut_position(&bf_head, fifo_list, |
2613 | lastbf->list.prev); | 2605 | lastbf->list.prev); |
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 4a33c6e39ca2..349fa22a921a 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c | |||
@@ -1860,7 +1860,8 @@ void *carl9170_alloc(size_t priv_size) | |||
1860 | IEEE80211_HW_PS_NULLFUNC_STACK | | 1860 | IEEE80211_HW_PS_NULLFUNC_STACK | |
1861 | IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC | | 1861 | IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC | |
1862 | IEEE80211_HW_SUPPORTS_RC_TABLE | | 1862 | IEEE80211_HW_SUPPORTS_RC_TABLE | |
1863 | IEEE80211_HW_SIGNAL_DBM; | 1863 | IEEE80211_HW_SIGNAL_DBM | |
1864 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES; | ||
1864 | 1865 | ||
1865 | if (!modparam_noht) { | 1866 | if (!modparam_noht) { |
1866 | /* | 1867 | /* |
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c index 4684dd989496..e935f61c7fad 100644 --- a/drivers/net/wireless/ath/carl9170/rx.c +++ b/drivers/net/wireless/ath/carl9170/rx.c | |||
@@ -602,8 +602,8 @@ static void carl9170_ba_check(struct ar9170 *ar, void *data, unsigned int len) | |||
602 | 602 | ||
603 | if (bar->start_seq_num == entry_bar->start_seq_num && | 603 | if (bar->start_seq_num == entry_bar->start_seq_num && |
604 | TID_CHECK(bar->control, entry_bar->control) && | 604 | TID_CHECK(bar->control, entry_bar->control) && |
605 | compare_ether_addr(bar->ra, entry_bar->ta) == 0 && | 605 | ether_addr_equal(bar->ra, entry_bar->ta) && |
606 | compare_ether_addr(bar->ta, entry_bar->ra) == 0) { | 606 | ether_addr_equal(bar->ta, entry_bar->ra)) { |
607 | struct ieee80211_tx_info *tx_info; | 607 | struct ieee80211_tx_info *tx_info; |
608 | 608 | ||
609 | tx_info = IEEE80211_SKB_CB(entry_skb); | 609 | tx_info = IEEE80211_SKB_CB(entry_skb); |
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index ea1abeb18e5b..d505b2676a73 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c | |||
@@ -416,13 +416,13 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil, | |||
416 | */ | 416 | */ |
417 | if (d->dma.status & RX_DMA_STATUS_L4_IDENT) { | 417 | if (d->dma.status & RX_DMA_STATUS_L4_IDENT) { |
418 | /* L4 protocol identified, csum calculated */ | 418 | /* L4 protocol identified, csum calculated */ |
419 | if ((d->dma.error & RX_DMA_ERROR_L4_ERR) == 0) { | 419 | if ((d->dma.error & RX_DMA_ERROR_L4_ERR) == 0) |
420 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 420 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
421 | } else { | 421 | /* If HW reports bad checksum, let IP stack re-check it |
422 | wil_err(wil, "Incorrect checksum reported\n"); | 422 | * For example, HW don't understand Microsoft IP stack that |
423 | kfree_skb(skb); | 423 | * mis-calculates TCP checksum - if it should be 0x0, |
424 | return NULL; | 424 | * it writes 0xffff in violation of RFC 1624 |
425 | } | 425 | */ |
426 | } | 426 | } |
427 | 427 | ||
428 | ds_bits = wil_rxdesc_ds_bits(d); | 428 | ds_bits = wil_rxdesc_ds_bits(d); |
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 5220f158b8f5..063963ee422a 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c | |||
@@ -339,7 +339,7 @@ static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int id, void *d, int len) | |||
339 | } | 339 | } |
340 | } else { | 340 | } else { |
341 | cfg80211_rx_mgmt(wil->wdev, freq, signal, | 341 | cfg80211_rx_mgmt(wil->wdev, freq, signal, |
342 | (void *)rx_mgmt_frame, d_len, GFP_KERNEL); | 342 | (void *)rx_mgmt_frame, d_len, 0, GFP_KERNEL); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 0e933bb71543..ccd24f0acb8d 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -4645,6 +4645,19 @@ static void b43_wireless_core_exit(struct b43_wldev *dev) | |||
4645 | b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN, | 4645 | b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN, |
4646 | B43_MACCTL_PSM_JMP0); | 4646 | B43_MACCTL_PSM_JMP0); |
4647 | 4647 | ||
4648 | switch (dev->dev->bus_type) { | ||
4649 | #ifdef CONFIG_B43_BCMA | ||
4650 | case B43_BUS_BCMA: | ||
4651 | bcma_core_pci_down(dev->dev->bdev->bus); | ||
4652 | break; | ||
4653 | #endif | ||
4654 | #ifdef CONFIG_B43_SSB | ||
4655 | case B43_BUS_SSB: | ||
4656 | /* TODO */ | ||
4657 | break; | ||
4658 | #endif | ||
4659 | } | ||
4660 | |||
4648 | b43_dma_free(dev); | 4661 | b43_dma_free(dev); |
4649 | b43_pio_free(dev); | 4662 | b43_pio_free(dev); |
4650 | b43_chip_exit(dev); | 4663 | b43_chip_exit(dev); |
@@ -4684,6 +4697,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev) | |||
4684 | case B43_BUS_BCMA: | 4697 | case B43_BUS_BCMA: |
4685 | bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0], | 4698 | bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0], |
4686 | dev->dev->bdev, true); | 4699 | dev->dev->bdev, true); |
4700 | bcma_core_pci_up(dev->dev->bdev->bus); | ||
4687 | break; | 4701 | break; |
4688 | #endif | 4702 | #endif |
4689 | #ifdef CONFIG_B43_SSB | 4703 | #ifdef CONFIG_B43_SSB |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c index e3f3c48f86d4..e13b1a65c65f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | |||
@@ -592,6 +592,7 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | |||
592 | uint flags, u8 *buf, uint nbytes) | 592 | uint flags, u8 *buf, uint nbytes) |
593 | { | 593 | { |
594 | struct sk_buff *mypkt; | 594 | struct sk_buff *mypkt; |
595 | struct sk_buff_head pktq; | ||
595 | int err; | 596 | int err; |
596 | 597 | ||
597 | mypkt = brcmu_pkt_buf_get_skb(nbytes); | 598 | mypkt = brcmu_pkt_buf_get_skb(nbytes); |
@@ -602,7 +603,10 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | |||
602 | } | 603 | } |
603 | 604 | ||
604 | memcpy(mypkt->data, buf, nbytes); | 605 | memcpy(mypkt->data, buf, nbytes); |
605 | err = brcmf_sdcard_send_pkt(sdiodev, addr, fn, flags, mypkt); | 606 | __skb_queue_head_init(&pktq); |
607 | __skb_queue_tail(&pktq, mypkt); | ||
608 | err = brcmf_sdcard_send_pkt(sdiodev, addr, fn, flags, &pktq); | ||
609 | __skb_dequeue_tail(&pktq); | ||
606 | 610 | ||
607 | brcmu_pkt_buf_free_skb(mypkt); | 611 | brcmu_pkt_buf_free_skb(mypkt); |
608 | return err; | 612 | return err; |
@@ -611,22 +615,18 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | |||
611 | 615 | ||
612 | int | 616 | int |
613 | brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | 617 | brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, |
614 | uint flags, struct sk_buff *pkt) | 618 | uint flags, struct sk_buff_head *pktq) |
615 | { | 619 | { |
616 | uint width; | 620 | uint width; |
617 | int err = 0; | 621 | int err = 0; |
618 | struct sk_buff_head pkt_list; | ||
619 | 622 | ||
620 | brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", | 623 | brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", |
621 | fn, addr, pkt->len); | 624 | fn, addr, pktq->qlen); |
622 | 625 | ||
623 | width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; | 626 | width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; |
624 | brcmf_sdio_addrprep(sdiodev, width, &addr); | 627 | brcmf_sdio_addrprep(sdiodev, width, &addr); |
625 | 628 | ||
626 | skb_queue_head_init(&pkt_list); | 629 | err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, pktq); |
627 | skb_queue_tail(&pkt_list, pkt); | ||
628 | err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, &pkt_list); | ||
629 | skb_dequeue_tail(&pkt_list); | ||
630 | 630 | ||
631 | return err; | 631 | return err; |
632 | } | 632 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 289e386f01f6..64f4a2bc8dde 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
@@ -350,7 +350,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, | |||
350 | 350 | ||
351 | sdiodev->bus_if = bus_if; | 351 | sdiodev->bus_if = bus_if; |
352 | bus_if->bus_priv.sdio = sdiodev; | 352 | bus_if->bus_priv.sdio = sdiodev; |
353 | bus_if->align = BRCMF_SDALIGN; | ||
354 | dev_set_drvdata(&func->dev, bus_if); | 353 | dev_set_drvdata(&func->dev, bus_if); |
355 | dev_set_drvdata(&sdiodev->func[1]->dev, bus_if); | 354 | dev_set_drvdata(&sdiodev->func[1]->dev, bus_if); |
356 | sdiodev->dev = &sdiodev->func[1]->dev; | 355 | sdiodev->dev = &sdiodev->func[1]->dev; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h index 86cbfe2c7c6c..2eb9e642c9bf 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h | |||
@@ -194,6 +194,8 @@ | |||
194 | #define BRCMF_E_IF_DEL 2 | 194 | #define BRCMF_E_IF_DEL 2 |
195 | #define BRCMF_E_IF_CHANGE 3 | 195 | #define BRCMF_E_IF_CHANGE 3 |
196 | 196 | ||
197 | #define BRCMF_E_IF_FLAG_NOIF 1 | ||
198 | |||
197 | #define BRCMF_E_IF_ROLE_STA 0 | 199 | #define BRCMF_E_IF_ROLE_STA 0 |
198 | #define BRCMF_E_IF_ROLE_AP 1 | 200 | #define BRCMF_E_IF_ROLE_AP 1 |
199 | #define BRCMF_E_IF_ROLE_WDS 2 | 201 | #define BRCMF_E_IF_ROLE_WDS 2 |
@@ -209,6 +211,8 @@ | |||
209 | #define BRCMF_DCMD_MEDLEN 1536 | 211 | #define BRCMF_DCMD_MEDLEN 1536 |
210 | #define BRCMF_DCMD_MAXLEN 8192 | 212 | #define BRCMF_DCMD_MAXLEN 8192 |
211 | 213 | ||
214 | #define BRCMF_AMPDU_RX_REORDER_MAXFLOWS 256 | ||
215 | |||
212 | /* Pattern matching filter. Specifies an offset within received packets to | 216 | /* Pattern matching filter. Specifies an offset within received packets to |
213 | * start matching, the pattern to match, the size of the pattern, and a bitmask | 217 | * start matching, the pattern to match, the size of the pattern, and a bitmask |
214 | * that indicates which bits within the pattern should be matched. | 218 | * that indicates which bits within the pattern should be matched. |
@@ -505,6 +509,25 @@ struct brcmf_dcmd { | |||
505 | uint needed; /* bytes needed (optional) */ | 509 | uint needed; /* bytes needed (optional) */ |
506 | }; | 510 | }; |
507 | 511 | ||
512 | /** | ||
513 | * struct brcmf_ampdu_rx_reorder - AMPDU receive reorder info | ||
514 | * | ||
515 | * @pktslots: dynamic allocated array for ordering AMPDU packets. | ||
516 | * @flow_id: AMPDU flow identifier. | ||
517 | * @cur_idx: last AMPDU index from firmware. | ||
518 | * @exp_idx: expected next AMPDU index. | ||
519 | * @max_idx: maximum amount of packets per AMPDU. | ||
520 | * @pend_pkts: number of packets currently in @pktslots. | ||
521 | */ | ||
522 | struct brcmf_ampdu_rx_reorder { | ||
523 | struct sk_buff **pktslots; | ||
524 | u8 flow_id; | ||
525 | u8 cur_idx; | ||
526 | u8 exp_idx; | ||
527 | u8 max_idx; | ||
528 | u8 pend_pkts; | ||
529 | }; | ||
530 | |||
508 | /* Forward decls for struct brcmf_pub (see below) */ | 531 | /* Forward decls for struct brcmf_pub (see below) */ |
509 | struct brcmf_proto; /* device communication protocol info */ | 532 | struct brcmf_proto; /* device communication protocol info */ |
510 | struct brcmf_cfg80211_dev; /* cfg80211 device info */ | 533 | struct brcmf_cfg80211_dev; /* cfg80211 device info */ |
@@ -536,9 +559,10 @@ struct brcmf_pub { | |||
536 | 559 | ||
537 | struct brcmf_fweh_info fweh; | 560 | struct brcmf_fweh_info fweh; |
538 | 561 | ||
539 | bool fw_signals; | ||
540 | struct brcmf_fws_info *fws; | 562 | struct brcmf_fws_info *fws; |
541 | spinlock_t fws_spinlock; | 563 | |
564 | struct brcmf_ampdu_rx_reorder | ||
565 | *reorder_flows[BRCMF_AMPDU_RX_REORDER_MAXFLOWS]; | ||
542 | #ifdef DEBUG | 566 | #ifdef DEBUG |
543 | struct dentry *dbgfs_dir; | 567 | struct dentry *dbgfs_dir; |
544 | #endif | 568 | #endif |
@@ -604,6 +628,9 @@ struct brcmf_if { | |||
604 | wait_queue_head_t pend_8021x_wait; | 628 | wait_queue_head_t pend_8021x_wait; |
605 | }; | 629 | }; |
606 | 630 | ||
631 | struct brcmf_skb_reorder_data { | ||
632 | u8 *reorder; | ||
633 | }; | ||
607 | 634 | ||
608 | extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); | 635 | extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); |
609 | 636 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h index 080395f49fa5..f7c1985844e4 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | |||
@@ -36,7 +36,11 @@ struct brcmf_bus_dcmd { | |||
36 | * | 36 | * |
37 | * @init: prepare for communication with dongle. | 37 | * @init: prepare for communication with dongle. |
38 | * @stop: clear pending frames, disable data flow. | 38 | * @stop: clear pending frames, disable data flow. |
39 | * @txdata: send a data frame to the dongle (callee disposes skb). | 39 | * @txdata: send a data frame to the dongle. When the data |
40 | * has been transferred, the common driver must be | ||
41 | * notified using brcmf_txcomplete(). The common | ||
42 | * driver calls this function with interrupts | ||
43 | * disabled. | ||
40 | * @txctl: transmit a control request message to dongle. | 44 | * @txctl: transmit a control request message to dongle. |
41 | * @rxctl: receive a control response message from dongle. | 45 | * @rxctl: receive a control response message from dongle. |
42 | * @gettxq: obtain a reference of bus transmit queue (optional). | 46 | * @gettxq: obtain a reference of bus transmit queue (optional). |
@@ -65,7 +69,6 @@ struct brcmf_bus_ops { | |||
65 | * @maxctl: maximum size for rxctl request message. | 69 | * @maxctl: maximum size for rxctl request message. |
66 | * @tx_realloc: number of tx packets realloced for headroom. | 70 | * @tx_realloc: number of tx packets realloced for headroom. |
67 | * @dstats: dongle-based statistical data. | 71 | * @dstats: dongle-based statistical data. |
68 | * @align: alignment requirement for the bus. | ||
69 | * @dcmd_list: bus/device specific dongle initialization commands. | 72 | * @dcmd_list: bus/device specific dongle initialization commands. |
70 | * @chip: device identifier of the dongle chip. | 73 | * @chip: device identifier of the dongle chip. |
71 | * @chiprev: revision of the dongle chip. | 74 | * @chiprev: revision of the dongle chip. |
@@ -80,7 +83,6 @@ struct brcmf_bus { | |||
80 | enum brcmf_bus_state state; | 83 | enum brcmf_bus_state state; |
81 | uint maxctl; | 84 | uint maxctl; |
82 | unsigned long tx_realloc; | 85 | unsigned long tx_realloc; |
83 | u8 align; | ||
84 | u32 chip; | 86 | u32 chip; |
85 | u32 chiprev; | 87 | u32 chiprev; |
86 | struct list_head dcmd_list; | 88 | struct list_head dcmd_list; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 80099016d21f..e067aec1fbf1 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -38,6 +38,19 @@ MODULE_LICENSE("Dual BSD/GPL"); | |||
38 | 38 | ||
39 | #define MAX_WAIT_FOR_8021X_TX 50 /* msecs */ | 39 | #define MAX_WAIT_FOR_8021X_TX 50 /* msecs */ |
40 | 40 | ||
41 | /* AMPDU rx reordering definitions */ | ||
42 | #define BRCMF_RXREORDER_FLOWID_OFFSET 0 | ||
43 | #define BRCMF_RXREORDER_MAXIDX_OFFSET 2 | ||
44 | #define BRCMF_RXREORDER_FLAGS_OFFSET 4 | ||
45 | #define BRCMF_RXREORDER_CURIDX_OFFSET 6 | ||
46 | #define BRCMF_RXREORDER_EXPIDX_OFFSET 8 | ||
47 | |||
48 | #define BRCMF_RXREORDER_DEL_FLOW 0x01 | ||
49 | #define BRCMF_RXREORDER_FLUSH_ALL 0x02 | ||
50 | #define BRCMF_RXREORDER_CURIDX_VALID 0x04 | ||
51 | #define BRCMF_RXREORDER_EXPIDX_VALID 0x08 | ||
52 | #define BRCMF_RXREORDER_NEW_HOLE 0x10 | ||
53 | |||
41 | /* Error bits */ | 54 | /* Error bits */ |
42 | int brcmf_msg_level; | 55 | int brcmf_msg_level; |
43 | module_param_named(debug, brcmf_msg_level, int, S_IRUSR | S_IWUSR); | 56 | module_param_named(debug, brcmf_msg_level, int, S_IRUSR | S_IWUSR); |
@@ -265,17 +278,234 @@ void brcmf_txflowblock(struct device *dev, bool state) | |||
265 | { | 278 | { |
266 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); | 279 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
267 | struct brcmf_pub *drvr = bus_if->drvr; | 280 | struct brcmf_pub *drvr = bus_if->drvr; |
268 | int i; | ||
269 | 281 | ||
270 | brcmf_dbg(TRACE, "Enter\n"); | 282 | brcmf_dbg(TRACE, "Enter\n"); |
271 | 283 | ||
272 | if (brcmf_fws_fc_active(drvr->fws)) { | 284 | brcmf_fws_bus_blocked(drvr, state); |
273 | brcmf_fws_bus_blocked(drvr, state); | 285 | } |
286 | |||
287 | static void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb) | ||
288 | { | ||
289 | skb->dev = ifp->ndev; | ||
290 | skb->protocol = eth_type_trans(skb, skb->dev); | ||
291 | |||
292 | if (skb->pkt_type == PACKET_MULTICAST) | ||
293 | ifp->stats.multicast++; | ||
294 | |||
295 | /* Process special event packets */ | ||
296 | brcmf_fweh_process_skb(ifp->drvr, skb); | ||
297 | |||
298 | if (!(ifp->ndev->flags & IFF_UP)) { | ||
299 | brcmu_pkt_buf_free_skb(skb); | ||
300 | return; | ||
301 | } | ||
302 | |||
303 | ifp->stats.rx_bytes += skb->len; | ||
304 | ifp->stats.rx_packets++; | ||
305 | |||
306 | brcmf_dbg(DATA, "rx proto=0x%X\n", ntohs(skb->protocol)); | ||
307 | if (in_interrupt()) | ||
308 | netif_rx(skb); | ||
309 | else | ||
310 | /* If the receive is not processed inside an ISR, | ||
311 | * the softirqd must be woken explicitly to service | ||
312 | * the NET_RX_SOFTIRQ. This is handled by netif_rx_ni(). | ||
313 | */ | ||
314 | netif_rx_ni(skb); | ||
315 | } | ||
316 | |||
317 | static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi, | ||
318 | u8 start, u8 end, | ||
319 | struct sk_buff_head *skb_list) | ||
320 | { | ||
321 | /* initialize return list */ | ||
322 | __skb_queue_head_init(skb_list); | ||
323 | |||
324 | if (rfi->pend_pkts == 0) { | ||
325 | brcmf_dbg(INFO, "no packets in reorder queue\n"); | ||
326 | return; | ||
327 | } | ||
328 | |||
329 | do { | ||
330 | if (rfi->pktslots[start]) { | ||
331 | __skb_queue_tail(skb_list, rfi->pktslots[start]); | ||
332 | rfi->pktslots[start] = NULL; | ||
333 | } | ||
334 | start++; | ||
335 | if (start > rfi->max_idx) | ||
336 | start = 0; | ||
337 | } while (start != end); | ||
338 | rfi->pend_pkts -= skb_queue_len(skb_list); | ||
339 | } | ||
340 | |||
341 | static void brcmf_rxreorder_process_info(struct brcmf_if *ifp, u8 *reorder_data, | ||
342 | struct sk_buff *pkt) | ||
343 | { | ||
344 | u8 flow_id, max_idx, cur_idx, exp_idx, end_idx; | ||
345 | struct brcmf_ampdu_rx_reorder *rfi; | ||
346 | struct sk_buff_head reorder_list; | ||
347 | struct sk_buff *pnext; | ||
348 | u8 flags; | ||
349 | u32 buf_size; | ||
350 | |||
351 | flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET]; | ||
352 | flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET]; | ||
353 | |||
354 | /* validate flags and flow id */ | ||
355 | if (flags == 0xFF) { | ||
356 | brcmf_err("invalid flags...so ignore this packet\n"); | ||
357 | brcmf_netif_rx(ifp, pkt); | ||
358 | return; | ||
359 | } | ||
360 | |||
361 | rfi = ifp->drvr->reorder_flows[flow_id]; | ||
362 | if (flags & BRCMF_RXREORDER_DEL_FLOW) { | ||
363 | brcmf_dbg(INFO, "flow-%d: delete\n", | ||
364 | flow_id); | ||
365 | |||
366 | if (rfi == NULL) { | ||
367 | brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n", | ||
368 | flow_id); | ||
369 | brcmf_netif_rx(ifp, pkt); | ||
370 | return; | ||
371 | } | ||
372 | |||
373 | brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx, | ||
374 | &reorder_list); | ||
375 | /* add the last packet */ | ||
376 | __skb_queue_tail(&reorder_list, pkt); | ||
377 | kfree(rfi); | ||
378 | ifp->drvr->reorder_flows[flow_id] = NULL; | ||
379 | goto netif_rx; | ||
380 | } | ||
381 | /* from here on we need a flow reorder instance */ | ||
382 | if (rfi == NULL) { | ||
383 | buf_size = sizeof(*rfi); | ||
384 | max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET]; | ||
385 | |||
386 | buf_size += (max_idx + 1) * sizeof(pkt); | ||
387 | |||
388 | /* allocate space for flow reorder info */ | ||
389 | brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n", | ||
390 | flow_id, max_idx); | ||
391 | rfi = kzalloc(buf_size, GFP_ATOMIC); | ||
392 | if (rfi == NULL) { | ||
393 | brcmf_err("failed to alloc buffer\n"); | ||
394 | brcmf_netif_rx(ifp, pkt); | ||
395 | return; | ||
396 | } | ||
397 | |||
398 | ifp->drvr->reorder_flows[flow_id] = rfi; | ||
399 | rfi->pktslots = (struct sk_buff **)(rfi+1); | ||
400 | rfi->max_idx = max_idx; | ||
401 | } | ||
402 | if (flags & BRCMF_RXREORDER_NEW_HOLE) { | ||
403 | if (rfi->pend_pkts) { | ||
404 | brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, | ||
405 | rfi->exp_idx, | ||
406 | &reorder_list); | ||
407 | WARN_ON(rfi->pend_pkts); | ||
408 | } else { | ||
409 | __skb_queue_head_init(&reorder_list); | ||
410 | } | ||
411 | rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET]; | ||
412 | rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET]; | ||
413 | rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET]; | ||
414 | rfi->pktslots[rfi->cur_idx] = pkt; | ||
415 | rfi->pend_pkts++; | ||
416 | brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n", | ||
417 | flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts); | ||
418 | } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) { | ||
419 | cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET]; | ||
420 | exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET]; | ||
421 | |||
422 | if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) { | ||
423 | /* still in the current hole */ | ||
424 | /* enqueue the current on the buffer chain */ | ||
425 | if (rfi->pktslots[cur_idx] != NULL) { | ||
426 | brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n"); | ||
427 | brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]); | ||
428 | rfi->pktslots[cur_idx] = NULL; | ||
429 | } | ||
430 | rfi->pktslots[cur_idx] = pkt; | ||
431 | rfi->pend_pkts++; | ||
432 | rfi->cur_idx = cur_idx; | ||
433 | brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n", | ||
434 | flow_id, cur_idx, exp_idx, rfi->pend_pkts); | ||
435 | |||
436 | /* can return now as there is no reorder | ||
437 | * list to process. | ||
438 | */ | ||
439 | return; | ||
440 | } | ||
441 | if (rfi->exp_idx == cur_idx) { | ||
442 | if (rfi->pktslots[cur_idx] != NULL) { | ||
443 | brcmf_dbg(INFO, "error buffer pending..free it\n"); | ||
444 | brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]); | ||
445 | rfi->pktslots[cur_idx] = NULL; | ||
446 | } | ||
447 | rfi->pktslots[cur_idx] = pkt; | ||
448 | rfi->pend_pkts++; | ||
449 | |||
450 | /* got the expected one. flush from current to expected | ||
451 | * and update expected | ||
452 | */ | ||
453 | brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n", | ||
454 | flow_id, cur_idx, exp_idx, rfi->pend_pkts); | ||
455 | |||
456 | rfi->cur_idx = cur_idx; | ||
457 | rfi->exp_idx = exp_idx; | ||
458 | |||
459 | brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx, | ||
460 | &reorder_list); | ||
461 | brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n", | ||
462 | flow_id, skb_queue_len(&reorder_list), | ||
463 | rfi->pend_pkts); | ||
464 | } else { | ||
465 | u8 end_idx; | ||
466 | |||
467 | brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n", | ||
468 | flow_id, flags, rfi->cur_idx, rfi->exp_idx, | ||
469 | cur_idx, exp_idx); | ||
470 | if (flags & BRCMF_RXREORDER_FLUSH_ALL) | ||
471 | end_idx = rfi->exp_idx; | ||
472 | else | ||
473 | end_idx = exp_idx; | ||
474 | |||
475 | /* flush pkts first */ | ||
476 | brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx, | ||
477 | &reorder_list); | ||
478 | |||
479 | if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) { | ||
480 | __skb_queue_tail(&reorder_list, pkt); | ||
481 | } else { | ||
482 | rfi->pktslots[cur_idx] = pkt; | ||
483 | rfi->pend_pkts++; | ||
484 | } | ||
485 | rfi->exp_idx = exp_idx; | ||
486 | rfi->cur_idx = cur_idx; | ||
487 | } | ||
274 | } else { | 488 | } else { |
275 | for (i = 0; i < BRCMF_MAX_IFS; i++) | 489 | /* explicity window move updating the expected index */ |
276 | brcmf_txflowblock_if(drvr->iflist[i], | 490 | exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET]; |
277 | BRCMF_NETIF_STOP_REASON_BLOCK_BUS, | 491 | |
278 | state); | 492 | brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n", |
493 | flow_id, flags, rfi->exp_idx, exp_idx); | ||
494 | if (flags & BRCMF_RXREORDER_FLUSH_ALL) | ||
495 | end_idx = rfi->exp_idx; | ||
496 | else | ||
497 | end_idx = exp_idx; | ||
498 | |||
499 | brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx, | ||
500 | &reorder_list); | ||
501 | __skb_queue_tail(&reorder_list, pkt); | ||
502 | /* set the new expected idx */ | ||
503 | rfi->exp_idx = exp_idx; | ||
504 | } | ||
505 | netif_rx: | ||
506 | skb_queue_walk_safe(&reorder_list, pkt, pnext) { | ||
507 | __skb_unlink(pkt, &reorder_list); | ||
508 | brcmf_netif_rx(ifp, pkt); | ||
279 | } | 509 | } |
280 | } | 510 | } |
281 | 511 | ||
@@ -285,16 +515,18 @@ void brcmf_rx_frames(struct device *dev, struct sk_buff_head *skb_list) | |||
285 | struct brcmf_if *ifp; | 515 | struct brcmf_if *ifp; |
286 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); | 516 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
287 | struct brcmf_pub *drvr = bus_if->drvr; | 517 | struct brcmf_pub *drvr = bus_if->drvr; |
518 | struct brcmf_skb_reorder_data *rd; | ||
288 | u8 ifidx; | 519 | u8 ifidx; |
289 | int ret; | 520 | int ret; |
290 | 521 | ||
291 | brcmf_dbg(DATA, "Enter\n"); | 522 | brcmf_dbg(DATA, "Enter: %s: count=%u\n", dev_name(dev), |
523 | skb_queue_len(skb_list)); | ||
292 | 524 | ||
293 | skb_queue_walk_safe(skb_list, skb, pnext) { | 525 | skb_queue_walk_safe(skb_list, skb, pnext) { |
294 | skb_unlink(skb, skb_list); | 526 | skb_unlink(skb, skb_list); |
295 | 527 | ||
296 | /* process and remove protocol-specific header */ | 528 | /* process and remove protocol-specific header */ |
297 | ret = brcmf_proto_hdrpull(drvr, drvr->fw_signals, &ifidx, skb); | 529 | ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb); |
298 | ifp = drvr->iflist[ifidx]; | 530 | ifp = drvr->iflist[ifidx]; |
299 | 531 | ||
300 | if (ret || !ifp || !ifp->ndev) { | 532 | if (ret || !ifp || !ifp->ndev) { |
@@ -304,31 +536,11 @@ void brcmf_rx_frames(struct device *dev, struct sk_buff_head *skb_list) | |||
304 | continue; | 536 | continue; |
305 | } | 537 | } |
306 | 538 | ||
307 | skb->dev = ifp->ndev; | 539 | rd = (struct brcmf_skb_reorder_data *)skb->cb; |
308 | skb->protocol = eth_type_trans(skb, skb->dev); | 540 | if (rd->reorder) |
309 | 541 | brcmf_rxreorder_process_info(ifp, rd->reorder, skb); | |
310 | if (skb->pkt_type == PACKET_MULTICAST) | ||
311 | ifp->stats.multicast++; | ||
312 | |||
313 | /* Process special event packets */ | ||
314 | brcmf_fweh_process_skb(drvr, skb); | ||
315 | |||
316 | if (!(ifp->ndev->flags & IFF_UP)) { | ||
317 | brcmu_pkt_buf_free_skb(skb); | ||
318 | continue; | ||
319 | } | ||
320 | |||
321 | ifp->stats.rx_bytes += skb->len; | ||
322 | ifp->stats.rx_packets++; | ||
323 | |||
324 | if (in_interrupt()) | ||
325 | netif_rx(skb); | ||
326 | else | 542 | else |
327 | /* If the receive is not processed inside an ISR, | 543 | brcmf_netif_rx(ifp, skb); |
328 | * the softirqd must be woken explicitly to service the | ||
329 | * NET_RX_SOFTIRQ. This is handled by netif_rx_ni(). | ||
330 | */ | ||
331 | netif_rx_ni(skb); | ||
332 | } | 544 | } |
333 | } | 545 | } |
334 | 546 | ||
@@ -889,7 +1101,6 @@ int brcmf_bus_start(struct device *dev) | |||
889 | if (ret < 0) | 1101 | if (ret < 0) |
890 | goto fail; | 1102 | goto fail; |
891 | 1103 | ||
892 | drvr->fw_signals = true; | ||
893 | ret = brcmf_fws_init(drvr); | 1104 | ret = brcmf_fws_init(drvr); |
894 | if (ret < 0) | 1105 | if (ret < 0) |
895 | goto fail; | 1106 | goto fail; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 264111968320..1aa75d5951b8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -201,13 +201,6 @@ struct rte_console { | |||
201 | #define SFC_CRC4WOOS (1 << 2) /* CRC error for write out of sync */ | 201 | #define SFC_CRC4WOOS (1 << 2) /* CRC error for write out of sync */ |
202 | #define SFC_ABORTALL (1 << 3) /* Abort all in-progress frames */ | 202 | #define SFC_ABORTALL (1 << 3) /* Abort all in-progress frames */ |
203 | 203 | ||
204 | /* HW frame tag */ | ||
205 | #define SDPCM_FRAMETAG_LEN 4 /* 2 bytes len, 2 bytes check val */ | ||
206 | |||
207 | /* Total length of frame header for dongle protocol */ | ||
208 | #define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN) | ||
209 | #define SDPCM_RESERVE (SDPCM_HDRLEN + BRCMF_SDALIGN) | ||
210 | |||
211 | /* | 204 | /* |
212 | * Software allocation of To SB Mailbox resources | 205 | * Software allocation of To SB Mailbox resources |
213 | */ | 206 | */ |
@@ -250,38 +243,6 @@ struct rte_console { | |||
250 | /* Current protocol version */ | 243 | /* Current protocol version */ |
251 | #define SDPCM_PROT_VERSION 4 | 244 | #define SDPCM_PROT_VERSION 4 |
252 | 245 | ||
253 | /* SW frame header */ | ||
254 | #define SDPCM_PACKET_SEQUENCE(p) (((u8 *)p)[0] & 0xff) | ||
255 | |||
256 | #define SDPCM_CHANNEL_MASK 0x00000f00 | ||
257 | #define SDPCM_CHANNEL_SHIFT 8 | ||
258 | #define SDPCM_PACKET_CHANNEL(p) (((u8 *)p)[1] & 0x0f) | ||
259 | |||
260 | #define SDPCM_NEXTLEN_OFFSET 2 | ||
261 | |||
262 | /* Data Offset from SOF (HW Tag, SW Tag, Pad) */ | ||
263 | #define SDPCM_DOFFSET_OFFSET 3 /* Data Offset */ | ||
264 | #define SDPCM_DOFFSET_VALUE(p) (((u8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff) | ||
265 | #define SDPCM_DOFFSET_MASK 0xff000000 | ||
266 | #define SDPCM_DOFFSET_SHIFT 24 | ||
267 | #define SDPCM_FCMASK_OFFSET 4 /* Flow control */ | ||
268 | #define SDPCM_FCMASK_VALUE(p) (((u8 *)p)[SDPCM_FCMASK_OFFSET] & 0xff) | ||
269 | #define SDPCM_WINDOW_OFFSET 5 /* Credit based fc */ | ||
270 | #define SDPCM_WINDOW_VALUE(p) (((u8 *)p)[SDPCM_WINDOW_OFFSET] & 0xff) | ||
271 | |||
272 | #define SDPCM_SWHEADER_LEN 8 /* SW header is 64 bits */ | ||
273 | |||
274 | /* logical channel numbers */ | ||
275 | #define SDPCM_CONTROL_CHANNEL 0 /* Control channel Id */ | ||
276 | #define SDPCM_EVENT_CHANNEL 1 /* Asyc Event Indication Channel Id */ | ||
277 | #define SDPCM_DATA_CHANNEL 2 /* Data Xmit/Recv Channel Id */ | ||
278 | #define SDPCM_GLOM_CHANNEL 3 /* For coalesced packets */ | ||
279 | #define SDPCM_TEST_CHANNEL 15 /* Reserved for test/debug packets */ | ||
280 | |||
281 | #define SDPCM_SEQUENCE_WRAP 256 /* wrap-around val for 8bit frame seq */ | ||
282 | |||
283 | #define SDPCM_GLOMDESC(p) (((u8 *)p)[1] & 0x80) | ||
284 | |||
285 | /* | 246 | /* |
286 | * Shared structure between dongle and the host. | 247 | * Shared structure between dongle and the host. |
287 | * The structure contains pointers to trap or assert information. | 248 | * The structure contains pointers to trap or assert information. |
@@ -396,8 +357,8 @@ struct sdpcm_shared_le { | |||
396 | __le32 brpt_addr; | 357 | __le32 brpt_addr; |
397 | }; | 358 | }; |
398 | 359 | ||
399 | /* SDIO read frame info */ | 360 | /* dongle SDIO bus specific header info */ |
400 | struct brcmf_sdio_read { | 361 | struct brcmf_sdio_hdrinfo { |
401 | u8 seq_num; | 362 | u8 seq_num; |
402 | u8 channel; | 363 | u8 channel; |
403 | u16 len; | 364 | u16 len; |
@@ -431,7 +392,7 @@ struct brcmf_sdio { | |||
431 | u8 hdrbuf[MAX_HDR_READ + BRCMF_SDALIGN]; | 392 | u8 hdrbuf[MAX_HDR_READ + BRCMF_SDALIGN]; |
432 | u8 *rxhdr; /* Header of current rx frame (in hdrbuf) */ | 393 | u8 *rxhdr; /* Header of current rx frame (in hdrbuf) */ |
433 | u8 rx_seq; /* Receive sequence number (expected) */ | 394 | u8 rx_seq; /* Receive sequence number (expected) */ |
434 | struct brcmf_sdio_read cur_read; | 395 | struct brcmf_sdio_hdrinfo cur_read; |
435 | /* info of current read frame */ | 396 | /* info of current read frame */ |
436 | bool rxskip; /* Skip receive (awaiting NAK ACK) */ | 397 | bool rxskip; /* Skip receive (awaiting NAK ACK) */ |
437 | bool rxpending; /* Data frame pending in dongle */ | 398 | bool rxpending; /* Data frame pending in dongle */ |
@@ -500,6 +461,8 @@ struct brcmf_sdio { | |||
500 | struct brcmf_sdio_count sdcnt; | 461 | struct brcmf_sdio_count sdcnt; |
501 | bool sr_enabled; /* SaveRestore enabled */ | 462 | bool sr_enabled; /* SaveRestore enabled */ |
502 | bool sleeping; /* SDIO bus sleeping */ | 463 | bool sleeping; /* SDIO bus sleeping */ |
464 | |||
465 | u8 tx_hdrlen; /* sdio bus header length for tx packet */ | ||
503 | }; | 466 | }; |
504 | 467 | ||
505 | /* clkstate */ | 468 | /* clkstate */ |
@@ -510,7 +473,6 @@ struct brcmf_sdio { | |||
510 | 473 | ||
511 | #ifdef DEBUG | 474 | #ifdef DEBUG |
512 | static int qcount[NUMPRIO]; | 475 | static int qcount[NUMPRIO]; |
513 | static int tx_packets[NUMPRIO]; | ||
514 | #endif /* DEBUG */ | 476 | #endif /* DEBUG */ |
515 | 477 | ||
516 | #define DEFAULT_SDIO_DRIVE_STRENGTH 6 /* in milliamps */ | 478 | #define DEFAULT_SDIO_DRIVE_STRENGTH 6 /* in milliamps */ |
@@ -1043,18 +1005,63 @@ static void brcmf_sdbrcm_free_glom(struct brcmf_sdio *bus) | |||
1043 | } | 1005 | } |
1044 | } | 1006 | } |
1045 | 1007 | ||
1046 | static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | 1008 | /** |
1047 | struct brcmf_sdio_read *rd, | 1009 | * brcmfmac sdio bus specific header |
1048 | enum brcmf_sdio_frmtype type) | 1010 | * This is the lowest layer header wrapped on the packets transmitted between |
1011 | * host and WiFi dongle which contains information needed for SDIO core and | ||
1012 | * firmware | ||
1013 | * | ||
1014 | * It consists of 2 parts: hw header and software header | ||
1015 | * hardware header (frame tag) - 4 bytes | ||
1016 | * Byte 0~1: Frame length | ||
1017 | * Byte 2~3: Checksum, bit-wise inverse of frame length | ||
1018 | * software header - 8 bytes | ||
1019 | * Byte 0: Rx/Tx sequence number | ||
1020 | * Byte 1: 4 MSB Channel number, 4 LSB arbitrary flag | ||
1021 | * Byte 2: Length of next data frame, reserved for Tx | ||
1022 | * Byte 3: Data offset | ||
1023 | * Byte 4: Flow control bits, reserved for Tx | ||
1024 | * Byte 5: Maximum Sequence number allowed by firmware for Tx, N/A for Tx packet | ||
1025 | * Byte 6~7: Reserved | ||
1026 | */ | ||
1027 | #define SDPCM_HWHDR_LEN 4 | ||
1028 | #define SDPCM_SWHDR_LEN 8 | ||
1029 | #define SDPCM_HDRLEN (SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN) | ||
1030 | /* software header */ | ||
1031 | #define SDPCM_SEQ_MASK 0x000000ff | ||
1032 | #define SDPCM_SEQ_WRAP 256 | ||
1033 | #define SDPCM_CHANNEL_MASK 0x00000f00 | ||
1034 | #define SDPCM_CHANNEL_SHIFT 8 | ||
1035 | #define SDPCM_CONTROL_CHANNEL 0 /* Control */ | ||
1036 | #define SDPCM_EVENT_CHANNEL 1 /* Asyc Event Indication */ | ||
1037 | #define SDPCM_DATA_CHANNEL 2 /* Data Xmit/Recv */ | ||
1038 | #define SDPCM_GLOM_CHANNEL 3 /* Coalesced packets */ | ||
1039 | #define SDPCM_TEST_CHANNEL 15 /* Test/debug packets */ | ||
1040 | #define SDPCM_GLOMDESC(p) (((u8 *)p)[1] & 0x80) | ||
1041 | #define SDPCM_NEXTLEN_MASK 0x00ff0000 | ||
1042 | #define SDPCM_NEXTLEN_SHIFT 16 | ||
1043 | #define SDPCM_DOFFSET_MASK 0xff000000 | ||
1044 | #define SDPCM_DOFFSET_SHIFT 24 | ||
1045 | #define SDPCM_FCMASK_MASK 0x000000ff | ||
1046 | #define SDPCM_WINDOW_MASK 0x0000ff00 | ||
1047 | #define SDPCM_WINDOW_SHIFT 8 | ||
1048 | |||
1049 | static inline u8 brcmf_sdio_getdatoffset(u8 *swheader) | ||
1050 | { | ||
1051 | u32 hdrvalue; | ||
1052 | hdrvalue = *(u32 *)swheader; | ||
1053 | return (u8)((hdrvalue & SDPCM_DOFFSET_MASK) >> SDPCM_DOFFSET_SHIFT); | ||
1054 | } | ||
1055 | |||
1056 | static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header, | ||
1057 | struct brcmf_sdio_hdrinfo *rd, | ||
1058 | enum brcmf_sdio_frmtype type) | ||
1049 | { | 1059 | { |
1050 | u16 len, checksum; | 1060 | u16 len, checksum; |
1051 | u8 rx_seq, fc, tx_seq_max; | 1061 | u8 rx_seq, fc, tx_seq_max; |
1062 | u32 swheader; | ||
1052 | 1063 | ||
1053 | /* | 1064 | /* hw header */ |
1054 | * 4 bytes hardware header (frame tag) | ||
1055 | * Byte 0~1: Frame length | ||
1056 | * Byte 2~3: Checksum, bit-wise inverse of frame length | ||
1057 | */ | ||
1058 | len = get_unaligned_le16(header); | 1065 | len = get_unaligned_le16(header); |
1059 | checksum = get_unaligned_le16(header + sizeof(u16)); | 1066 | checksum = get_unaligned_le16(header + sizeof(u16)); |
1060 | /* All zero means no more to read */ | 1067 | /* All zero means no more to read */ |
@@ -1083,24 +1090,16 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1083 | } | 1090 | } |
1084 | rd->len = len; | 1091 | rd->len = len; |
1085 | 1092 | ||
1086 | /* | 1093 | /* software header */ |
1087 | * 8 bytes hardware header | 1094 | header += SDPCM_HWHDR_LEN; |
1088 | * Byte 0: Rx sequence number | 1095 | swheader = le32_to_cpu(*(__le32 *)header); |
1089 | * Byte 1: 4 MSB Channel number, 4 LSB arbitrary flag | 1096 | if (type == BRCMF_SDIO_FT_SUPER && SDPCM_GLOMDESC(header)) { |
1090 | * Byte 2: Length of next data frame | ||
1091 | * Byte 3: Data offset | ||
1092 | * Byte 4: Flow control bits | ||
1093 | * Byte 5: Maximum Sequence number allow for Tx | ||
1094 | * Byte 6~7: Reserved | ||
1095 | */ | ||
1096 | if (type == BRCMF_SDIO_FT_SUPER && | ||
1097 | SDPCM_GLOMDESC(&header[SDPCM_FRAMETAG_LEN])) { | ||
1098 | brcmf_err("Glom descriptor found in superframe head\n"); | 1097 | brcmf_err("Glom descriptor found in superframe head\n"); |
1099 | rd->len = 0; | 1098 | rd->len = 0; |
1100 | return -EINVAL; | 1099 | return -EINVAL; |
1101 | } | 1100 | } |
1102 | rx_seq = SDPCM_PACKET_SEQUENCE(&header[SDPCM_FRAMETAG_LEN]); | 1101 | rx_seq = (u8)(swheader & SDPCM_SEQ_MASK); |
1103 | rd->channel = SDPCM_PACKET_CHANNEL(&header[SDPCM_FRAMETAG_LEN]); | 1102 | rd->channel = (swheader & SDPCM_CHANNEL_MASK) >> SDPCM_CHANNEL_SHIFT; |
1104 | if (len > MAX_RX_DATASZ && rd->channel != SDPCM_CONTROL_CHANNEL && | 1103 | if (len > MAX_RX_DATASZ && rd->channel != SDPCM_CONTROL_CHANNEL && |
1105 | type != BRCMF_SDIO_FT_SUPER) { | 1104 | type != BRCMF_SDIO_FT_SUPER) { |
1106 | brcmf_err("HW header length too long\n"); | 1105 | brcmf_err("HW header length too long\n"); |
@@ -1120,7 +1119,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1120 | rd->len = 0; | 1119 | rd->len = 0; |
1121 | return -EINVAL; | 1120 | return -EINVAL; |
1122 | } | 1121 | } |
1123 | rd->dat_offset = SDPCM_DOFFSET_VALUE(&header[SDPCM_FRAMETAG_LEN]); | 1122 | rd->dat_offset = brcmf_sdio_getdatoffset(header); |
1124 | if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) { | 1123 | if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) { |
1125 | brcmf_err("seq %d: bad data offset\n", rx_seq); | 1124 | brcmf_err("seq %d: bad data offset\n", rx_seq); |
1126 | bus->sdcnt.rx_badhdr++; | 1125 | bus->sdcnt.rx_badhdr++; |
@@ -1137,14 +1136,15 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1137 | /* no need to check the reset for subframe */ | 1136 | /* no need to check the reset for subframe */ |
1138 | if (type == BRCMF_SDIO_FT_SUB) | 1137 | if (type == BRCMF_SDIO_FT_SUB) |
1139 | return 0; | 1138 | return 0; |
1140 | rd->len_nxtfrm = header[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET]; | 1139 | rd->len_nxtfrm = (swheader & SDPCM_NEXTLEN_MASK) >> SDPCM_NEXTLEN_SHIFT; |
1141 | if (rd->len_nxtfrm << 4 > MAX_RX_DATASZ) { | 1140 | if (rd->len_nxtfrm << 4 > MAX_RX_DATASZ) { |
1142 | /* only warm for NON glom packet */ | 1141 | /* only warm for NON glom packet */ |
1143 | if (rd->channel != SDPCM_GLOM_CHANNEL) | 1142 | if (rd->channel != SDPCM_GLOM_CHANNEL) |
1144 | brcmf_err("seq %d: next length error\n", rx_seq); | 1143 | brcmf_err("seq %d: next length error\n", rx_seq); |
1145 | rd->len_nxtfrm = 0; | 1144 | rd->len_nxtfrm = 0; |
1146 | } | 1145 | } |
1147 | fc = SDPCM_FCMASK_VALUE(&header[SDPCM_FRAMETAG_LEN]); | 1146 | swheader = le32_to_cpu(*(__le32 *)(header + 4)); |
1147 | fc = swheader & SDPCM_FCMASK_MASK; | ||
1148 | if (bus->flowcontrol != fc) { | 1148 | if (bus->flowcontrol != fc) { |
1149 | if (~bus->flowcontrol & fc) | 1149 | if (~bus->flowcontrol & fc) |
1150 | bus->sdcnt.fc_xoff++; | 1150 | bus->sdcnt.fc_xoff++; |
@@ -1153,7 +1153,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1153 | bus->sdcnt.fc_rcvd++; | 1153 | bus->sdcnt.fc_rcvd++; |
1154 | bus->flowcontrol = fc; | 1154 | bus->flowcontrol = fc; |
1155 | } | 1155 | } |
1156 | tx_seq_max = SDPCM_WINDOW_VALUE(&header[SDPCM_FRAMETAG_LEN]); | 1156 | tx_seq_max = (swheader & SDPCM_WINDOW_MASK) >> SDPCM_WINDOW_SHIFT; |
1157 | if ((u8)(tx_seq_max - bus->tx_seq) > 0x40) { | 1157 | if ((u8)(tx_seq_max - bus->tx_seq) > 0x40) { |
1158 | brcmf_err("seq %d: max tx seq number error\n", rx_seq); | 1158 | brcmf_err("seq %d: max tx seq number error\n", rx_seq); |
1159 | tx_seq_max = bus->tx_seq + 2; | 1159 | tx_seq_max = bus->tx_seq + 2; |
@@ -1163,18 +1163,40 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1163 | return 0; | 1163 | return 0; |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | static inline void brcmf_sdio_update_hwhdr(u8 *header, u16 frm_length) | ||
1167 | { | ||
1168 | *(__le16 *)header = cpu_to_le16(frm_length); | ||
1169 | *(((__le16 *)header) + 1) = cpu_to_le16(~frm_length); | ||
1170 | } | ||
1171 | |||
1172 | static void brcmf_sdio_hdpack(struct brcmf_sdio *bus, u8 *header, | ||
1173 | struct brcmf_sdio_hdrinfo *hd_info) | ||
1174 | { | ||
1175 | u32 sw_header; | ||
1176 | |||
1177 | brcmf_sdio_update_hwhdr(header, hd_info->len); | ||
1178 | |||
1179 | sw_header = bus->tx_seq; | ||
1180 | sw_header |= (hd_info->channel << SDPCM_CHANNEL_SHIFT) & | ||
1181 | SDPCM_CHANNEL_MASK; | ||
1182 | sw_header |= (hd_info->dat_offset << SDPCM_DOFFSET_SHIFT) & | ||
1183 | SDPCM_DOFFSET_MASK; | ||
1184 | *(((__le32 *)header) + 1) = cpu_to_le32(sw_header); | ||
1185 | *(((__le32 *)header) + 2) = 0; | ||
1186 | } | ||
1187 | |||
1166 | static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | 1188 | static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) |
1167 | { | 1189 | { |
1168 | u16 dlen, totlen; | 1190 | u16 dlen, totlen; |
1169 | u8 *dptr, num = 0; | 1191 | u8 *dptr, num = 0; |
1170 | 1192 | u32 align = 0; | |
1171 | u16 sublen; | 1193 | u16 sublen; |
1172 | struct sk_buff *pfirst, *pnext; | 1194 | struct sk_buff *pfirst, *pnext; |
1173 | 1195 | ||
1174 | int errcode; | 1196 | int errcode; |
1175 | u8 doff, sfdoff; | 1197 | u8 doff, sfdoff; |
1176 | 1198 | ||
1177 | struct brcmf_sdio_read rd_new; | 1199 | struct brcmf_sdio_hdrinfo rd_new; |
1178 | 1200 | ||
1179 | /* If packets, issue read(s) and send up packet chain */ | 1201 | /* If packets, issue read(s) and send up packet chain */ |
1180 | /* Return sequence numbers consumed? */ | 1202 | /* Return sequence numbers consumed? */ |
@@ -1182,6 +1204,11 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1182 | brcmf_dbg(SDIO, "start: glomd %p glom %p\n", | 1204 | brcmf_dbg(SDIO, "start: glomd %p glom %p\n", |
1183 | bus->glomd, skb_peek(&bus->glom)); | 1205 | bus->glomd, skb_peek(&bus->glom)); |
1184 | 1206 | ||
1207 | if (bus->sdiodev->pdata) | ||
1208 | align = bus->sdiodev->pdata->sd_sgentry_align; | ||
1209 | if (align < 4) | ||
1210 | align = 4; | ||
1211 | |||
1185 | /* If there's a descriptor, generate the packet chain */ | 1212 | /* If there's a descriptor, generate the packet chain */ |
1186 | if (bus->glomd) { | 1213 | if (bus->glomd) { |
1187 | pfirst = pnext = NULL; | 1214 | pfirst = pnext = NULL; |
@@ -1205,9 +1232,9 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1205 | pnext = NULL; | 1232 | pnext = NULL; |
1206 | break; | 1233 | break; |
1207 | } | 1234 | } |
1208 | if (sublen % BRCMF_SDALIGN) { | 1235 | if (sublen % align) { |
1209 | brcmf_err("sublen %d not multiple of %d\n", | 1236 | brcmf_err("sublen %d not multiple of %d\n", |
1210 | sublen, BRCMF_SDALIGN); | 1237 | sublen, align); |
1211 | } | 1238 | } |
1212 | totlen += sublen; | 1239 | totlen += sublen; |
1213 | 1240 | ||
@@ -1220,7 +1247,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1220 | } | 1247 | } |
1221 | 1248 | ||
1222 | /* Allocate/chain packet for next subframe */ | 1249 | /* Allocate/chain packet for next subframe */ |
1223 | pnext = brcmu_pkt_buf_get_skb(sublen + BRCMF_SDALIGN); | 1250 | pnext = brcmu_pkt_buf_get_skb(sublen + align); |
1224 | if (pnext == NULL) { | 1251 | if (pnext == NULL) { |
1225 | brcmf_err("bcm_pkt_buf_get_skb failed, num %d len %d\n", | 1252 | brcmf_err("bcm_pkt_buf_get_skb failed, num %d len %d\n", |
1226 | num, sublen); | 1253 | num, sublen); |
@@ -1229,7 +1256,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1229 | skb_queue_tail(&bus->glom, pnext); | 1256 | skb_queue_tail(&bus->glom, pnext); |
1230 | 1257 | ||
1231 | /* Adhere to start alignment requirements */ | 1258 | /* Adhere to start alignment requirements */ |
1232 | pkt_align(pnext, sublen, BRCMF_SDALIGN); | 1259 | pkt_align(pnext, sublen, align); |
1233 | } | 1260 | } |
1234 | 1261 | ||
1235 | /* If all allocations succeeded, save packet chain | 1262 | /* If all allocations succeeded, save packet chain |
@@ -1305,8 +1332,8 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1305 | rd_new.seq_num = rxseq; | 1332 | rd_new.seq_num = rxseq; |
1306 | rd_new.len = dlen; | 1333 | rd_new.len = dlen; |
1307 | sdio_claim_host(bus->sdiodev->func[1]); | 1334 | sdio_claim_host(bus->sdiodev->func[1]); |
1308 | errcode = brcmf_sdio_hdparser(bus, pfirst->data, &rd_new, | 1335 | errcode = brcmf_sdio_hdparse(bus, pfirst->data, &rd_new, |
1309 | BRCMF_SDIO_FT_SUPER); | 1336 | BRCMF_SDIO_FT_SUPER); |
1310 | sdio_release_host(bus->sdiodev->func[1]); | 1337 | sdio_release_host(bus->sdiodev->func[1]); |
1311 | bus->cur_read.len = rd_new.len_nxtfrm << 4; | 1338 | bus->cur_read.len = rd_new.len_nxtfrm << 4; |
1312 | 1339 | ||
@@ -1324,8 +1351,8 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1324 | rd_new.len = pnext->len; | 1351 | rd_new.len = pnext->len; |
1325 | rd_new.seq_num = rxseq++; | 1352 | rd_new.seq_num = rxseq++; |
1326 | sdio_claim_host(bus->sdiodev->func[1]); | 1353 | sdio_claim_host(bus->sdiodev->func[1]); |
1327 | errcode = brcmf_sdio_hdparser(bus, pnext->data, &rd_new, | 1354 | errcode = brcmf_sdio_hdparse(bus, pnext->data, &rd_new, |
1328 | BRCMF_SDIO_FT_SUB); | 1355 | BRCMF_SDIO_FT_SUB); |
1329 | sdio_release_host(bus->sdiodev->func[1]); | 1356 | sdio_release_host(bus->sdiodev->func[1]); |
1330 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), | 1357 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), |
1331 | pnext->data, 32, "subframe:\n"); | 1358 | pnext->data, 32, "subframe:\n"); |
@@ -1357,7 +1384,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1357 | skb_queue_walk_safe(&bus->glom, pfirst, pnext) { | 1384 | skb_queue_walk_safe(&bus->glom, pfirst, pnext) { |
1358 | dptr = (u8 *) (pfirst->data); | 1385 | dptr = (u8 *) (pfirst->data); |
1359 | sublen = get_unaligned_le16(dptr); | 1386 | sublen = get_unaligned_le16(dptr); |
1360 | doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); | 1387 | doff = brcmf_sdio_getdatoffset(&dptr[SDPCM_HWHDR_LEN]); |
1361 | 1388 | ||
1362 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(), | 1389 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(), |
1363 | dptr, pfirst->len, | 1390 | dptr, pfirst->len, |
@@ -1535,7 +1562,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) | |||
1535 | uint rxleft = 0; /* Remaining number of frames allowed */ | 1562 | uint rxleft = 0; /* Remaining number of frames allowed */ |
1536 | int ret; /* Return code from calls */ | 1563 | int ret; /* Return code from calls */ |
1537 | uint rxcount = 0; /* Total frames read */ | 1564 | uint rxcount = 0; /* Total frames read */ |
1538 | struct brcmf_sdio_read *rd = &bus->cur_read, rd_new; | 1565 | struct brcmf_sdio_hdrinfo *rd = &bus->cur_read, rd_new; |
1539 | u8 head_read = 0; | 1566 | u8 head_read = 0; |
1540 | 1567 | ||
1541 | brcmf_dbg(TRACE, "Enter\n"); | 1568 | brcmf_dbg(TRACE, "Enter\n"); |
@@ -1583,8 +1610,8 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) | |||
1583 | bus->rxhdr, SDPCM_HDRLEN, | 1610 | bus->rxhdr, SDPCM_HDRLEN, |
1584 | "RxHdr:\n"); | 1611 | "RxHdr:\n"); |
1585 | 1612 | ||
1586 | if (brcmf_sdio_hdparser(bus, bus->rxhdr, rd, | 1613 | if (brcmf_sdio_hdparse(bus, bus->rxhdr, rd, |
1587 | BRCMF_SDIO_FT_NORMAL)) { | 1614 | BRCMF_SDIO_FT_NORMAL)) { |
1588 | sdio_release_host(bus->sdiodev->func[1]); | 1615 | sdio_release_host(bus->sdiodev->func[1]); |
1589 | if (!bus->rxpending) | 1616 | if (!bus->rxpending) |
1590 | break; | 1617 | break; |
@@ -1648,8 +1675,8 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) | |||
1648 | memcpy(bus->rxhdr, pkt->data, SDPCM_HDRLEN); | 1675 | memcpy(bus->rxhdr, pkt->data, SDPCM_HDRLEN); |
1649 | rd_new.seq_num = rd->seq_num; | 1676 | rd_new.seq_num = rd->seq_num; |
1650 | sdio_claim_host(bus->sdiodev->func[1]); | 1677 | sdio_claim_host(bus->sdiodev->func[1]); |
1651 | if (brcmf_sdio_hdparser(bus, bus->rxhdr, &rd_new, | 1678 | if (brcmf_sdio_hdparse(bus, bus->rxhdr, &rd_new, |
1652 | BRCMF_SDIO_FT_NORMAL)) { | 1679 | BRCMF_SDIO_FT_NORMAL)) { |
1653 | rd->len = 0; | 1680 | rd->len = 0; |
1654 | brcmu_pkt_buf_free_skb(pkt); | 1681 | brcmu_pkt_buf_free_skb(pkt); |
1655 | } | 1682 | } |
@@ -1693,7 +1720,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) | |||
1693 | 1720 | ||
1694 | /* Save superframe descriptor and allocate packet frame */ | 1721 | /* Save superframe descriptor and allocate packet frame */ |
1695 | if (rd->channel == SDPCM_GLOM_CHANNEL) { | 1722 | if (rd->channel == SDPCM_GLOM_CHANNEL) { |
1696 | if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_FRAMETAG_LEN])) { | 1723 | if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_HWHDR_LEN])) { |
1697 | brcmf_dbg(GLOM, "glom descriptor, %d bytes:\n", | 1724 | brcmf_dbg(GLOM, "glom descriptor, %d bytes:\n", |
1698 | rd->len); | 1725 | rd->len); |
1699 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), | 1726 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), |
@@ -1759,85 +1786,168 @@ brcmf_sdbrcm_wait_event_wakeup(struct brcmf_sdio *bus) | |||
1759 | return; | 1786 | return; |
1760 | } | 1787 | } |
1761 | 1788 | ||
1789 | /* flag marking a dummy skb added for DMA alignment requirement */ | ||
1790 | #define DUMMY_SKB_FLAG 0x10000 | ||
1791 | /* bit mask of data length chopped from the previous packet */ | ||
1792 | #define DUMMY_SKB_CHOP_LEN_MASK 0xffff | ||
1793 | /** | ||
1794 | * brcmf_sdio_txpkt_prep - packet preparation for transmit | ||
1795 | * @bus: brcmf_sdio structure pointer | ||
1796 | * @pktq: packet list pointer | ||
1797 | * @chan: virtual channel to transmit the packet | ||
1798 | * | ||
1799 | * Processes to be applied to the packet | ||
1800 | * - Align data buffer pointer | ||
1801 | * - Align data buffer length | ||
1802 | * - Prepare header | ||
1803 | * Return: negative value if there is error | ||
1804 | */ | ||
1805 | static int | ||
1806 | brcmf_sdio_txpkt_prep(struct brcmf_sdio *bus, struct sk_buff_head *pktq, | ||
1807 | uint chan) | ||
1808 | { | ||
1809 | u16 head_pad, tail_pad, tail_chop, head_align, sg_align; | ||
1810 | int ntail; | ||
1811 | struct sk_buff *pkt_next, *pkt_new; | ||
1812 | u8 *dat_buf; | ||
1813 | unsigned blksize = bus->sdiodev->func[SDIO_FUNC_2]->cur_blksize; | ||
1814 | struct brcmf_sdio_hdrinfo hd_info = {0}; | ||
1815 | |||
1816 | /* SDIO ADMA requires at least 32 bit alignment */ | ||
1817 | head_align = 4; | ||
1818 | sg_align = 4; | ||
1819 | if (bus->sdiodev->pdata) { | ||
1820 | head_align = bus->sdiodev->pdata->sd_head_align > 4 ? | ||
1821 | bus->sdiodev->pdata->sd_head_align : 4; | ||
1822 | sg_align = bus->sdiodev->pdata->sd_sgentry_align > 4 ? | ||
1823 | bus->sdiodev->pdata->sd_sgentry_align : 4; | ||
1824 | } | ||
1825 | /* sg entry alignment should be a divisor of block size */ | ||
1826 | WARN_ON(blksize % sg_align); | ||
1827 | |||
1828 | pkt_next = pktq->next; | ||
1829 | dat_buf = (u8 *)(pkt_next->data); | ||
1830 | |||
1831 | /* Check head padding */ | ||
1832 | head_pad = ((unsigned long)dat_buf % head_align); | ||
1833 | if (head_pad) { | ||
1834 | if (skb_headroom(pkt_next) < head_pad) { | ||
1835 | bus->sdiodev->bus_if->tx_realloc++; | ||
1836 | head_pad = 0; | ||
1837 | if (skb_cow(pkt_next, head_pad)) | ||
1838 | return -ENOMEM; | ||
1839 | } | ||
1840 | skb_push(pkt_next, head_pad); | ||
1841 | dat_buf = (u8 *)(pkt_next->data); | ||
1842 | memset(dat_buf, 0, head_pad + bus->tx_hdrlen); | ||
1843 | } | ||
1844 | |||
1845 | /* Check tail padding */ | ||
1846 | pkt_new = NULL; | ||
1847 | tail_chop = pkt_next->len % sg_align; | ||
1848 | tail_pad = sg_align - tail_chop; | ||
1849 | tail_pad += blksize - (pkt_next->len + tail_pad) % blksize; | ||
1850 | if (skb_tailroom(pkt_next) < tail_pad && pkt_next->len > blksize) { | ||
1851 | pkt_new = brcmu_pkt_buf_get_skb(tail_pad + tail_chop); | ||
1852 | if (pkt_new == NULL) | ||
1853 | return -ENOMEM; | ||
1854 | memcpy(pkt_new->data, | ||
1855 | pkt_next->data + pkt_next->len - tail_chop, | ||
1856 | tail_chop); | ||
1857 | *(u32 *)(pkt_new->cb) = DUMMY_SKB_FLAG + tail_chop; | ||
1858 | skb_trim(pkt_next, pkt_next->len - tail_chop); | ||
1859 | __skb_queue_after(pktq, pkt_next, pkt_new); | ||
1860 | } else { | ||
1861 | ntail = pkt_next->data_len + tail_pad - | ||
1862 | (pkt_next->end - pkt_next->tail); | ||
1863 | if (skb_cloned(pkt_next) || ntail > 0) | ||
1864 | if (pskb_expand_head(pkt_next, 0, ntail, GFP_ATOMIC)) | ||
1865 | return -ENOMEM; | ||
1866 | if (skb_linearize(pkt_next)) | ||
1867 | return -ENOMEM; | ||
1868 | dat_buf = (u8 *)(pkt_next->data); | ||
1869 | __skb_put(pkt_next, tail_pad); | ||
1870 | } | ||
1871 | |||
1872 | /* Now prep the header */ | ||
1873 | if (pkt_new) | ||
1874 | hd_info.len = pkt_next->len + tail_chop; | ||
1875 | else | ||
1876 | hd_info.len = pkt_next->len - tail_pad; | ||
1877 | hd_info.channel = chan; | ||
1878 | hd_info.dat_offset = head_pad + bus->tx_hdrlen; | ||
1879 | brcmf_sdio_hdpack(bus, dat_buf, &hd_info); | ||
1880 | |||
1881 | if (BRCMF_BYTES_ON() && | ||
1882 | ((BRCMF_CTL_ON() && chan == SDPCM_CONTROL_CHANNEL) || | ||
1883 | (BRCMF_DATA_ON() && chan != SDPCM_CONTROL_CHANNEL))) | ||
1884 | brcmf_dbg_hex_dump(true, pkt_next, hd_info.len, "Tx Frame:\n"); | ||
1885 | else if (BRCMF_HDRS_ON()) | ||
1886 | brcmf_dbg_hex_dump(true, pkt_next, head_pad + bus->tx_hdrlen, | ||
1887 | "Tx Header:\n"); | ||
1888 | |||
1889 | return 0; | ||
1890 | } | ||
1891 | |||
1892 | /** | ||
1893 | * brcmf_sdio_txpkt_postp - packet post processing for transmit | ||
1894 | * @bus: brcmf_sdio structure pointer | ||
1895 | * @pktq: packet list pointer | ||
1896 | * | ||
1897 | * Processes to be applied to the packet | ||
1898 | * - Remove head padding | ||
1899 | * - Remove tail padding | ||
1900 | */ | ||
1901 | static void | ||
1902 | brcmf_sdio_txpkt_postp(struct brcmf_sdio *bus, struct sk_buff_head *pktq) | ||
1903 | { | ||
1904 | u8 *hdr; | ||
1905 | u32 dat_offset; | ||
1906 | u32 dummy_flags, chop_len; | ||
1907 | struct sk_buff *pkt_next, *tmp, *pkt_prev; | ||
1908 | |||
1909 | skb_queue_walk_safe(pktq, pkt_next, tmp) { | ||
1910 | dummy_flags = *(u32 *)(pkt_next->cb); | ||
1911 | if (dummy_flags & DUMMY_SKB_FLAG) { | ||
1912 | chop_len = dummy_flags & DUMMY_SKB_CHOP_LEN_MASK; | ||
1913 | if (chop_len) { | ||
1914 | pkt_prev = pkt_next->prev; | ||
1915 | memcpy(pkt_prev->data + pkt_prev->len, | ||
1916 | pkt_next->data, chop_len); | ||
1917 | skb_put(pkt_prev, chop_len); | ||
1918 | } | ||
1919 | __skb_unlink(pkt_next, pktq); | ||
1920 | brcmu_pkt_buf_free_skb(pkt_next); | ||
1921 | } else { | ||
1922 | hdr = pkt_next->data + SDPCM_HWHDR_LEN; | ||
1923 | dat_offset = le32_to_cpu(*(__le32 *)hdr); | ||
1924 | dat_offset = (dat_offset & SDPCM_DOFFSET_MASK) >> | ||
1925 | SDPCM_DOFFSET_SHIFT; | ||
1926 | skb_pull(pkt_next, dat_offset); | ||
1927 | } | ||
1928 | } | ||
1929 | } | ||
1930 | |||
1762 | /* Writes a HW/SW header into the packet and sends it. */ | 1931 | /* Writes a HW/SW header into the packet and sends it. */ |
1763 | /* Assumes: (a) header space already there, (b) caller holds lock */ | 1932 | /* Assumes: (a) header space already there, (b) caller holds lock */ |
1764 | static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt, | 1933 | static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt, |
1765 | uint chan) | 1934 | uint chan) |
1766 | { | 1935 | { |
1767 | int ret; | 1936 | int ret; |
1768 | u8 *frame; | ||
1769 | u16 len, pad = 0; | ||
1770 | u32 swheader; | ||
1771 | int i; | 1937 | int i; |
1938 | struct sk_buff_head localq; | ||
1772 | 1939 | ||
1773 | brcmf_dbg(TRACE, "Enter\n"); | 1940 | brcmf_dbg(TRACE, "Enter\n"); |
1774 | 1941 | ||
1775 | frame = (u8 *) (pkt->data); | 1942 | __skb_queue_head_init(&localq); |
1776 | 1943 | __skb_queue_tail(&localq, pkt); | |
1777 | /* Add alignment padding, allocate new packet if needed */ | 1944 | ret = brcmf_sdio_txpkt_prep(bus, &localq, chan); |
1778 | pad = ((unsigned long)frame % BRCMF_SDALIGN); | 1945 | if (ret) |
1779 | if (pad) { | 1946 | goto done; |
1780 | if (skb_headroom(pkt) < pad) { | ||
1781 | brcmf_dbg(INFO, "insufficient headroom %d for %d pad\n", | ||
1782 | skb_headroom(pkt), pad); | ||
1783 | bus->sdiodev->bus_if->tx_realloc++; | ||
1784 | ret = skb_cow(pkt, BRCMF_SDALIGN); | ||
1785 | if (ret) | ||
1786 | goto done; | ||
1787 | pad = ((unsigned long)frame % BRCMF_SDALIGN); | ||
1788 | } | ||
1789 | skb_push(pkt, pad); | ||
1790 | frame = (u8 *) (pkt->data); | ||
1791 | memset(frame, 0, pad + SDPCM_HDRLEN); | ||
1792 | } | ||
1793 | /* precondition: pad < BRCMF_SDALIGN */ | ||
1794 | |||
1795 | /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ | ||
1796 | len = (u16) (pkt->len); | ||
1797 | *(__le16 *) frame = cpu_to_le16(len); | ||
1798 | *(((__le16 *) frame) + 1) = cpu_to_le16(~len); | ||
1799 | |||
1800 | /* Software tag: channel, sequence number, data offset */ | ||
1801 | swheader = | ||
1802 | ((chan << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK) | bus->tx_seq | | ||
1803 | (((pad + | ||
1804 | SDPCM_HDRLEN) << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK); | ||
1805 | |||
1806 | *(((__le32 *) frame) + 1) = cpu_to_le32(swheader); | ||
1807 | *(((__le32 *) frame) + 2) = 0; | ||
1808 | |||
1809 | #ifdef DEBUG | ||
1810 | tx_packets[pkt->priority]++; | ||
1811 | #endif | ||
1812 | |||
1813 | brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && | ||
1814 | ((BRCMF_CTL_ON() && chan == SDPCM_CONTROL_CHANNEL) || | ||
1815 | (BRCMF_DATA_ON() && chan != SDPCM_CONTROL_CHANNEL)), | ||
1816 | frame, len, "Tx Frame:\n"); | ||
1817 | brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() && | ||
1818 | ((BRCMF_CTL_ON() && | ||
1819 | chan == SDPCM_CONTROL_CHANNEL) || | ||
1820 | (BRCMF_DATA_ON() && | ||
1821 | chan != SDPCM_CONTROL_CHANNEL))) && | ||
1822 | BRCMF_HDRS_ON(), | ||
1823 | frame, min_t(u16, len, 16), "TxHdr:\n"); | ||
1824 | |||
1825 | /* Raise len to next SDIO block to eliminate tail command */ | ||
1826 | if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { | ||
1827 | u16 pad = bus->blocksize - (len % bus->blocksize); | ||
1828 | if ((pad <= bus->roundup) && (pad < bus->blocksize)) | ||
1829 | len += pad; | ||
1830 | } else if (len % BRCMF_SDALIGN) { | ||
1831 | len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN); | ||
1832 | } | ||
1833 | |||
1834 | /* Some controllers have trouble with odd bytes -- round to even */ | ||
1835 | if (len & (ALIGNMENT - 1)) | ||
1836 | len = roundup(len, ALIGNMENT); | ||
1837 | 1947 | ||
1838 | sdio_claim_host(bus->sdiodev->func[1]); | 1948 | sdio_claim_host(bus->sdiodev->func[1]); |
1839 | ret = brcmf_sdcard_send_pkt(bus->sdiodev, bus->sdiodev->sbwad, | 1949 | ret = brcmf_sdcard_send_pkt(bus->sdiodev, bus->sdiodev->sbwad, |
1840 | SDIO_FUNC_2, F2SYNC, pkt); | 1950 | SDIO_FUNC_2, F2SYNC, &localq); |
1841 | bus->sdcnt.f2txdata++; | 1951 | bus->sdcnt.f2txdata++; |
1842 | 1952 | ||
1843 | if (ret < 0) { | 1953 | if (ret < 0) { |
@@ -1865,11 +1975,11 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt, | |||
1865 | } | 1975 | } |
1866 | sdio_release_host(bus->sdiodev->func[1]); | 1976 | sdio_release_host(bus->sdiodev->func[1]); |
1867 | if (ret == 0) | 1977 | if (ret == 0) |
1868 | bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; | 1978 | bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQ_WRAP; |
1869 | 1979 | ||
1870 | done: | 1980 | done: |
1871 | /* restore pkt buffer pointer before calling tx complete routine */ | 1981 | brcmf_sdio_txpkt_postp(bus, &localq); |
1872 | skb_pull(pkt, SDPCM_HDRLEN + pad); | 1982 | __skb_dequeue_tail(&localq); |
1873 | brcmf_txcomplete(bus->sdiodev->dev, pkt, ret == 0); | 1983 | brcmf_txcomplete(bus->sdiodev->dev, pkt, ret == 0); |
1874 | return ret; | 1984 | return ret; |
1875 | } | 1985 | } |
@@ -1880,7 +1990,6 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) | |||
1880 | u32 intstatus = 0; | 1990 | u32 intstatus = 0; |
1881 | int ret = 0, prec_out; | 1991 | int ret = 0, prec_out; |
1882 | uint cnt = 0; | 1992 | uint cnt = 0; |
1883 | uint datalen; | ||
1884 | u8 tx_prec_map; | 1993 | u8 tx_prec_map; |
1885 | 1994 | ||
1886 | brcmf_dbg(TRACE, "Enter\n"); | 1995 | brcmf_dbg(TRACE, "Enter\n"); |
@@ -1896,7 +2005,6 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) | |||
1896 | break; | 2005 | break; |
1897 | } | 2006 | } |
1898 | spin_unlock_bh(&bus->txqlock); | 2007 | spin_unlock_bh(&bus->txqlock); |
1899 | datalen = pkt->len - SDPCM_HDRLEN; | ||
1900 | 2008 | ||
1901 | ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL); | 2009 | ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL); |
1902 | 2010 | ||
@@ -2221,7 +2329,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) | |||
2221 | } | 2329 | } |
2222 | 2330 | ||
2223 | } else { | 2331 | } else { |
2224 | bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; | 2332 | bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQ_WRAP; |
2225 | } | 2333 | } |
2226 | sdio_release_host(bus->sdiodev->func[1]); | 2334 | sdio_release_host(bus->sdiodev->func[1]); |
2227 | bus->ctrl_frame_stat = false; | 2335 | bus->ctrl_frame_stat = false; |
@@ -2276,13 +2384,14 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) | |||
2276 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); | 2384 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
2277 | struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; | 2385 | struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; |
2278 | struct brcmf_sdio *bus = sdiodev->bus; | 2386 | struct brcmf_sdio *bus = sdiodev->bus; |
2387 | ulong flags; | ||
2279 | 2388 | ||
2280 | brcmf_dbg(TRACE, "Enter\n"); | 2389 | brcmf_dbg(TRACE, "Enter\n"); |
2281 | 2390 | ||
2282 | datalen = pkt->len; | 2391 | datalen = pkt->len; |
2283 | 2392 | ||
2284 | /* Add space for the header */ | 2393 | /* Add space for the header */ |
2285 | skb_push(pkt, SDPCM_HDRLEN); | 2394 | skb_push(pkt, bus->tx_hdrlen); |
2286 | /* precondition: IS_ALIGNED((unsigned long)(pkt->data), 2) */ | 2395 | /* precondition: IS_ALIGNED((unsigned long)(pkt->data), 2) */ |
2287 | 2396 | ||
2288 | prec = prio2prec((pkt->priority & PRIOMASK)); | 2397 | prec = prio2prec((pkt->priority & PRIOMASK)); |
@@ -2293,10 +2402,9 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) | |||
2293 | bus->sdcnt.fcqueued++; | 2402 | bus->sdcnt.fcqueued++; |
2294 | 2403 | ||
2295 | /* Priority based enq */ | 2404 | /* Priority based enq */ |
2296 | spin_lock_bh(&bus->txqlock); | 2405 | spin_lock_irqsave(&bus->txqlock, flags); |
2297 | if (!brcmf_c_prec_enq(bus->sdiodev->dev, &bus->txq, pkt, prec)) { | 2406 | if (!brcmf_c_prec_enq(bus->sdiodev->dev, &bus->txq, pkt, prec)) { |
2298 | skb_pull(pkt, SDPCM_HDRLEN); | 2407 | skb_pull(pkt, bus->tx_hdrlen); |
2299 | brcmf_txcomplete(bus->sdiodev->dev, pkt, false); | ||
2300 | brcmf_err("out of bus->txq !!!\n"); | 2408 | brcmf_err("out of bus->txq !!!\n"); |
2301 | ret = -ENOSR; | 2409 | ret = -ENOSR; |
2302 | } else { | 2410 | } else { |
@@ -2307,7 +2415,7 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) | |||
2307 | bus->txoff = true; | 2415 | bus->txoff = true; |
2308 | brcmf_txflowblock(bus->sdiodev->dev, true); | 2416 | brcmf_txflowblock(bus->sdiodev->dev, true); |
2309 | } | 2417 | } |
2310 | spin_unlock_bh(&bus->txqlock); | 2418 | spin_unlock_irqrestore(&bus->txqlock, flags); |
2311 | 2419 | ||
2312 | #ifdef DEBUG | 2420 | #ifdef DEBUG |
2313 | if (pktq_plen(&bus->txq, prec) > qcount[prec]) | 2421 | if (pktq_plen(&bus->txq, prec) > qcount[prec]) |
@@ -2436,7 +2544,7 @@ static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len) | |||
2436 | return ret; | 2544 | return ret; |
2437 | } | 2545 | } |
2438 | 2546 | ||
2439 | bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; | 2547 | bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQ_WRAP; |
2440 | 2548 | ||
2441 | return ret; | 2549 | return ret; |
2442 | } | 2550 | } |
@@ -2446,19 +2554,19 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) | |||
2446 | { | 2554 | { |
2447 | u8 *frame; | 2555 | u8 *frame; |
2448 | u16 len; | 2556 | u16 len; |
2449 | u32 swheader; | ||
2450 | uint retries = 0; | 2557 | uint retries = 0; |
2451 | u8 doff = 0; | 2558 | u8 doff = 0; |
2452 | int ret = -1; | 2559 | int ret = -1; |
2453 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); | 2560 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
2454 | struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; | 2561 | struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; |
2455 | struct brcmf_sdio *bus = sdiodev->bus; | 2562 | struct brcmf_sdio *bus = sdiodev->bus; |
2563 | struct brcmf_sdio_hdrinfo hd_info = {0}; | ||
2456 | 2564 | ||
2457 | brcmf_dbg(TRACE, "Enter\n"); | 2565 | brcmf_dbg(TRACE, "Enter\n"); |
2458 | 2566 | ||
2459 | /* Back the pointer to make a room for bus header */ | 2567 | /* Back the pointer to make a room for bus header */ |
2460 | frame = msg - SDPCM_HDRLEN; | 2568 | frame = msg - bus->tx_hdrlen; |
2461 | len = (msglen += SDPCM_HDRLEN); | 2569 | len = (msglen += bus->tx_hdrlen); |
2462 | 2570 | ||
2463 | /* Add alignment padding (optional for ctl frames) */ | 2571 | /* Add alignment padding (optional for ctl frames) */ |
2464 | doff = ((unsigned long)frame % BRCMF_SDALIGN); | 2572 | doff = ((unsigned long)frame % BRCMF_SDALIGN); |
@@ -2466,10 +2574,10 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) | |||
2466 | frame -= doff; | 2574 | frame -= doff; |
2467 | len += doff; | 2575 | len += doff; |
2468 | msglen += doff; | 2576 | msglen += doff; |
2469 | memset(frame, 0, doff + SDPCM_HDRLEN); | 2577 | memset(frame, 0, doff + bus->tx_hdrlen); |
2470 | } | 2578 | } |
2471 | /* precondition: doff < BRCMF_SDALIGN */ | 2579 | /* precondition: doff < BRCMF_SDALIGN */ |
2472 | doff += SDPCM_HDRLEN; | 2580 | doff += bus->tx_hdrlen; |
2473 | 2581 | ||
2474 | /* Round send length to next SDIO block */ | 2582 | /* Round send length to next SDIO block */ |
2475 | if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { | 2583 | if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { |
@@ -2491,18 +2599,10 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) | |||
2491 | brcmf_sdbrcm_bus_sleep(bus, false, false); | 2599 | brcmf_sdbrcm_bus_sleep(bus, false, false); |
2492 | sdio_release_host(bus->sdiodev->func[1]); | 2600 | sdio_release_host(bus->sdiodev->func[1]); |
2493 | 2601 | ||
2494 | /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ | 2602 | hd_info.len = (u16)msglen; |
2495 | *(__le16 *) frame = cpu_to_le16((u16) msglen); | 2603 | hd_info.channel = SDPCM_CONTROL_CHANNEL; |
2496 | *(((__le16 *) frame) + 1) = cpu_to_le16(~msglen); | 2604 | hd_info.dat_offset = doff; |
2497 | 2605 | brcmf_sdio_hdpack(bus, frame, &hd_info); | |
2498 | /* Software tag: channel, sequence number, data offset */ | ||
2499 | swheader = | ||
2500 | ((SDPCM_CONTROL_CHANNEL << SDPCM_CHANNEL_SHIFT) & | ||
2501 | SDPCM_CHANNEL_MASK) | ||
2502 | | bus->tx_seq | ((doff << SDPCM_DOFFSET_SHIFT) & | ||
2503 | SDPCM_DOFFSET_MASK); | ||
2504 | put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN); | ||
2505 | put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); | ||
2506 | 2606 | ||
2507 | if (!data_ok(bus)) { | 2607 | if (!data_ok(bus)) { |
2508 | brcmf_dbg(INFO, "No bus credit bus->tx_max %d, bus->tx_seq %d\n", | 2608 | brcmf_dbg(INFO, "No bus credit bus->tx_max %d, bus->tx_seq %d\n", |
@@ -3733,7 +3833,7 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3733 | struct brcmf_sdio *bus; | 3833 | struct brcmf_sdio *bus; |
3734 | struct brcmf_bus_dcmd *dlst; | 3834 | struct brcmf_bus_dcmd *dlst; |
3735 | u32 dngl_txglom; | 3835 | u32 dngl_txglom; |
3736 | u32 dngl_txglomalign; | 3836 | u32 txglomalign = 0; |
3737 | u8 idx; | 3837 | u8 idx; |
3738 | 3838 | ||
3739 | brcmf_dbg(TRACE, "Enter\n"); | 3839 | brcmf_dbg(TRACE, "Enter\n"); |
@@ -3752,7 +3852,7 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3752 | bus->txbound = BRCMF_TXBOUND; | 3852 | bus->txbound = BRCMF_TXBOUND; |
3753 | bus->rxbound = BRCMF_RXBOUND; | 3853 | bus->rxbound = BRCMF_RXBOUND; |
3754 | bus->txminmax = BRCMF_TXMINMAX; | 3854 | bus->txminmax = BRCMF_TXMINMAX; |
3755 | bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1; | 3855 | bus->tx_seq = SDPCM_SEQ_WRAP - 1; |
3756 | 3856 | ||
3757 | INIT_WORK(&bus->datawork, brcmf_sdio_dataworker); | 3857 | INIT_WORK(&bus->datawork, brcmf_sdio_dataworker); |
3758 | bus->brcmf_wq = create_singlethread_workqueue("brcmf_wq"); | 3858 | bus->brcmf_wq = create_singlethread_workqueue("brcmf_wq"); |
@@ -3794,8 +3894,11 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3794 | bus->sdiodev->bus_if->chip = bus->ci->chip; | 3894 | bus->sdiodev->bus_if->chip = bus->ci->chip; |
3795 | bus->sdiodev->bus_if->chiprev = bus->ci->chiprev; | 3895 | bus->sdiodev->bus_if->chiprev = bus->ci->chiprev; |
3796 | 3896 | ||
3797 | /* Attach to the brcmf/OS/network interface */ | 3897 | /* default sdio bus header length for tx packet */ |
3798 | ret = brcmf_attach(SDPCM_RESERVE, bus->sdiodev->dev); | 3898 | bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN; |
3899 | |||
3900 | /* Attach to the common layer, reserve hdr space */ | ||
3901 | ret = brcmf_attach(bus->tx_hdrlen, bus->sdiodev->dev); | ||
3799 | if (ret != 0) { | 3902 | if (ret != 0) { |
3800 | brcmf_err("brcmf_attach failed\n"); | 3903 | brcmf_err("brcmf_attach failed\n"); |
3801 | goto fail; | 3904 | goto fail; |
@@ -3827,9 +3930,13 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3827 | dlst->param_len = sizeof(u32); | 3930 | dlst->param_len = sizeof(u32); |
3828 | } else { | 3931 | } else { |
3829 | /* otherwise, set txglomalign */ | 3932 | /* otherwise, set txglomalign */ |
3830 | dngl_txglomalign = bus->sdiodev->bus_if->align; | 3933 | if (sdiodev->pdata) |
3934 | txglomalign = sdiodev->pdata->sd_sgentry_align; | ||
3935 | /* SDIO ADMA requires at least 32 bit alignment */ | ||
3936 | if (txglomalign < 4) | ||
3937 | txglomalign = 4; | ||
3831 | dlst->name = "bus:txglomalign"; | 3938 | dlst->name = "bus:txglomalign"; |
3832 | dlst->param = (char *)&dngl_txglomalign; | 3939 | dlst->param = (char *)&txglomalign; |
3833 | dlst->param_len = sizeof(u32); | 3940 | dlst->param_len = sizeof(u32); |
3834 | } | 3941 | } |
3835 | list_add(&dlst->list, &bus->sdiodev->bus_if->dcmd_list); | 3942 | list_add(&dlst->list, &bus->sdiodev->bus_if->dcmd_list); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index 83ee53a7c76e..fad77dd2a3a5 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c | |||
@@ -185,6 +185,10 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
185 | ifevent->action, ifevent->ifidx, ifevent->bssidx, | 185 | ifevent->action, ifevent->ifidx, ifevent->bssidx, |
186 | ifevent->flags, ifevent->role); | 186 | ifevent->flags, ifevent->role); |
187 | 187 | ||
188 | if (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) { | ||
189 | brcmf_dbg(EVENT, "event can be ignored\n"); | ||
190 | return; | ||
191 | } | ||
188 | if (ifevent->ifidx >= BRCMF_MAX_IFS) { | 192 | if (ifevent->ifidx >= BRCMF_MAX_IFS) { |
189 | brcmf_err("invalid interface index: %u\n", | 193 | brcmf_err("invalid interface index: %u\n", |
190 | ifevent->ifidx); | 194 | ifevent->ifidx); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h index 665ef69e974b..ecabb04f33c3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h | |||
@@ -69,4 +69,25 @@ struct brcmf_fil_bss_enable_le { | |||
69 | __le32 enable; | 69 | __le32 enable; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | /** | ||
73 | * struct tdls_iovar - common structure for tdls iovars. | ||
74 | * | ||
75 | * @ea: ether address of peer station. | ||
76 | * @mode: mode value depending on specific tdls iovar. | ||
77 | * @chanspec: channel specification. | ||
78 | * @pad: unused (for future use). | ||
79 | */ | ||
80 | struct brcmf_tdls_iovar_le { | ||
81 | u8 ea[ETH_ALEN]; /* Station address */ | ||
82 | u8 mode; /* mode: depends on iovar */ | ||
83 | __le16 chanspec; | ||
84 | __le32 pad; /* future */ | ||
85 | }; | ||
86 | |||
87 | enum brcmf_tdls_manual_ep_ops { | ||
88 | BRCMF_TDLS_MANUAL_EP_CREATE = 1, | ||
89 | BRCMF_TDLS_MANUAL_EP_DELETE = 3, | ||
90 | BRCMF_TDLS_MANUAL_EP_DISCOVERY = 6 | ||
91 | }; | ||
92 | |||
72 | #endif /* FWIL_TYPES_H_ */ | 93 | #endif /* FWIL_TYPES_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c index 29b1f24c2d0f..82f9140f3d35 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | |||
@@ -422,9 +422,12 @@ struct brcmf_fws_macdesc_table { | |||
422 | 422 | ||
423 | struct brcmf_fws_info { | 423 | struct brcmf_fws_info { |
424 | struct brcmf_pub *drvr; | 424 | struct brcmf_pub *drvr; |
425 | spinlock_t spinlock; | ||
426 | ulong flags; | ||
425 | struct brcmf_fws_stats stats; | 427 | struct brcmf_fws_stats stats; |
426 | struct brcmf_fws_hanger hanger; | 428 | struct brcmf_fws_hanger hanger; |
427 | enum brcmf_fws_fcmode fcmode; | 429 | enum brcmf_fws_fcmode fcmode; |
430 | bool fw_signals; | ||
428 | bool bcmc_credit_check; | 431 | bool bcmc_credit_check; |
429 | struct brcmf_fws_macdesc_table desc; | 432 | struct brcmf_fws_macdesc_table desc; |
430 | struct workqueue_struct *fws_wq; | 433 | struct workqueue_struct *fws_wq; |
@@ -483,6 +486,18 @@ static int brcmf_fws_get_tlv_len(struct brcmf_fws_info *fws, | |||
483 | } | 486 | } |
484 | #undef BRCMF_FWS_TLV_DEF | 487 | #undef BRCMF_FWS_TLV_DEF |
485 | 488 | ||
489 | static void brcmf_fws_lock(struct brcmf_fws_info *fws) | ||
490 | __acquires(&fws->spinlock) | ||
491 | { | ||
492 | spin_lock_irqsave(&fws->spinlock, fws->flags); | ||
493 | } | ||
494 | |||
495 | static void brcmf_fws_unlock(struct brcmf_fws_info *fws) | ||
496 | __releases(&fws->spinlock) | ||
497 | { | ||
498 | spin_unlock_irqrestore(&fws->spinlock, fws->flags); | ||
499 | } | ||
500 | |||
486 | static bool brcmf_fws_ifidx_match(struct sk_buff *skb, void *arg) | 501 | static bool brcmf_fws_ifidx_match(struct sk_buff *skb, void *arg) |
487 | { | 502 | { |
488 | u32 ifidx = brcmf_skb_if_flags_get_field(skb, INDEX); | 503 | u32 ifidx = brcmf_skb_if_flags_get_field(skb, INDEX); |
@@ -869,8 +884,11 @@ static bool brcmf_fws_tim_update(struct brcmf_fws_info *fws, | |||
869 | skcb->state = BRCMF_FWS_SKBSTATE_TIM; | 884 | skcb->state = BRCMF_FWS_SKBSTATE_TIM; |
870 | bus = fws->drvr->bus_if; | 885 | bus = fws->drvr->bus_if; |
871 | err = brcmf_fws_hdrpush(fws, skb); | 886 | err = brcmf_fws_hdrpush(fws, skb); |
872 | if (err == 0) | 887 | if (err == 0) { |
888 | brcmf_fws_unlock(fws); | ||
873 | err = brcmf_bus_txdata(bus, skb); | 889 | err = brcmf_bus_txdata(bus, skb); |
890 | brcmf_fws_lock(fws); | ||
891 | } | ||
874 | if (err) | 892 | if (err) |
875 | brcmu_pkt_buf_free_skb(skb); | 893 | brcmu_pkt_buf_free_skb(skb); |
876 | return true; | 894 | return true; |
@@ -905,26 +923,10 @@ static int brcmf_fws_rssi_indicate(struct brcmf_fws_info *fws, s8 rssi) | |||
905 | return 0; | 923 | return 0; |
906 | } | 924 | } |
907 | 925 | ||
908 | /* using macro so sparse checking does not complain | ||
909 | * about locking imbalance. | ||
910 | */ | ||
911 | #define brcmf_fws_lock(drvr, flags) \ | ||
912 | do { \ | ||
913 | flags = 0; \ | ||
914 | spin_lock_irqsave(&((drvr)->fws_spinlock), (flags)); \ | ||
915 | } while (0) | ||
916 | |||
917 | /* using macro so sparse checking does not complain | ||
918 | * about locking imbalance. | ||
919 | */ | ||
920 | #define brcmf_fws_unlock(drvr, flags) \ | ||
921 | spin_unlock_irqrestore(&((drvr)->fws_spinlock), (flags)) | ||
922 | |||
923 | static | 926 | static |
924 | int brcmf_fws_macdesc_indicate(struct brcmf_fws_info *fws, u8 type, u8 *data) | 927 | int brcmf_fws_macdesc_indicate(struct brcmf_fws_info *fws, u8 type, u8 *data) |
925 | { | 928 | { |
926 | struct brcmf_fws_mac_descriptor *entry, *existing; | 929 | struct brcmf_fws_mac_descriptor *entry, *existing; |
927 | ulong flags; | ||
928 | u8 mac_handle; | 930 | u8 mac_handle; |
929 | u8 ifidx; | 931 | u8 ifidx; |
930 | u8 *addr; | 932 | u8 *addr; |
@@ -938,10 +940,10 @@ int brcmf_fws_macdesc_indicate(struct brcmf_fws_info *fws, u8 type, u8 *data) | |||
938 | if (entry->occupied) { | 940 | if (entry->occupied) { |
939 | brcmf_dbg(TRACE, "deleting %s mac %pM\n", | 941 | brcmf_dbg(TRACE, "deleting %s mac %pM\n", |
940 | entry->name, addr); | 942 | entry->name, addr); |
941 | brcmf_fws_lock(fws->drvr, flags); | 943 | brcmf_fws_lock(fws); |
942 | brcmf_fws_macdesc_cleanup(fws, entry, -1); | 944 | brcmf_fws_macdesc_cleanup(fws, entry, -1); |
943 | brcmf_fws_macdesc_deinit(entry); | 945 | brcmf_fws_macdesc_deinit(entry); |
944 | brcmf_fws_unlock(fws->drvr, flags); | 946 | brcmf_fws_unlock(fws); |
945 | } else | 947 | } else |
946 | fws->stats.mac_update_failed++; | 948 | fws->stats.mac_update_failed++; |
947 | return 0; | 949 | return 0; |
@@ -950,13 +952,13 @@ int brcmf_fws_macdesc_indicate(struct brcmf_fws_info *fws, u8 type, u8 *data) | |||
950 | existing = brcmf_fws_macdesc_lookup(fws, addr); | 952 | existing = brcmf_fws_macdesc_lookup(fws, addr); |
951 | if (IS_ERR(existing)) { | 953 | if (IS_ERR(existing)) { |
952 | if (!entry->occupied) { | 954 | if (!entry->occupied) { |
953 | brcmf_fws_lock(fws->drvr, flags); | 955 | brcmf_fws_lock(fws); |
954 | entry->mac_handle = mac_handle; | 956 | entry->mac_handle = mac_handle; |
955 | brcmf_fws_macdesc_init(entry, addr, ifidx); | 957 | brcmf_fws_macdesc_init(entry, addr, ifidx); |
956 | brcmf_fws_macdesc_set_name(fws, entry); | 958 | brcmf_fws_macdesc_set_name(fws, entry); |
957 | brcmu_pktq_init(&entry->psq, BRCMF_FWS_PSQ_PREC_COUNT, | 959 | brcmu_pktq_init(&entry->psq, BRCMF_FWS_PSQ_PREC_COUNT, |
958 | BRCMF_FWS_PSQ_LEN); | 960 | BRCMF_FWS_PSQ_LEN); |
959 | brcmf_fws_unlock(fws->drvr, flags); | 961 | brcmf_fws_unlock(fws); |
960 | brcmf_dbg(TRACE, "add %s mac %pM\n", entry->name, addr); | 962 | brcmf_dbg(TRACE, "add %s mac %pM\n", entry->name, addr); |
961 | } else { | 963 | } else { |
962 | fws->stats.mac_update_failed++; | 964 | fws->stats.mac_update_failed++; |
@@ -964,13 +966,13 @@ int brcmf_fws_macdesc_indicate(struct brcmf_fws_info *fws, u8 type, u8 *data) | |||
964 | } else { | 966 | } else { |
965 | if (entry != existing) { | 967 | if (entry != existing) { |
966 | brcmf_dbg(TRACE, "copy mac %s\n", existing->name); | 968 | brcmf_dbg(TRACE, "copy mac %s\n", existing->name); |
967 | brcmf_fws_lock(fws->drvr, flags); | 969 | brcmf_fws_lock(fws); |
968 | memcpy(entry, existing, | 970 | memcpy(entry, existing, |
969 | offsetof(struct brcmf_fws_mac_descriptor, psq)); | 971 | offsetof(struct brcmf_fws_mac_descriptor, psq)); |
970 | entry->mac_handle = mac_handle; | 972 | entry->mac_handle = mac_handle; |
971 | brcmf_fws_macdesc_deinit(existing); | 973 | brcmf_fws_macdesc_deinit(existing); |
972 | brcmf_fws_macdesc_set_name(fws, entry); | 974 | brcmf_fws_macdesc_set_name(fws, entry); |
973 | brcmf_fws_unlock(fws->drvr, flags); | 975 | brcmf_fws_unlock(fws); |
974 | brcmf_dbg(TRACE, "relocate %s mac %pM\n", entry->name, | 976 | brcmf_dbg(TRACE, "relocate %s mac %pM\n", entry->name, |
975 | addr); | 977 | addr); |
976 | } else { | 978 | } else { |
@@ -986,7 +988,6 @@ static int brcmf_fws_macdesc_state_indicate(struct brcmf_fws_info *fws, | |||
986 | u8 type, u8 *data) | 988 | u8 type, u8 *data) |
987 | { | 989 | { |
988 | struct brcmf_fws_mac_descriptor *entry; | 990 | struct brcmf_fws_mac_descriptor *entry; |
989 | ulong flags; | ||
990 | u8 mac_handle; | 991 | u8 mac_handle; |
991 | int ret; | 992 | int ret; |
992 | 993 | ||
@@ -996,7 +997,7 @@ static int brcmf_fws_macdesc_state_indicate(struct brcmf_fws_info *fws, | |||
996 | fws->stats.mac_ps_update_failed++; | 997 | fws->stats.mac_ps_update_failed++; |
997 | return -ESRCH; | 998 | return -ESRCH; |
998 | } | 999 | } |
999 | brcmf_fws_lock(fws->drvr, flags); | 1000 | brcmf_fws_lock(fws); |
1000 | /* a state update should wipe old credits */ | 1001 | /* a state update should wipe old credits */ |
1001 | entry->requested_credit = 0; | 1002 | entry->requested_credit = 0; |
1002 | entry->requested_packet = 0; | 1003 | entry->requested_packet = 0; |
@@ -1011,7 +1012,7 @@ static int brcmf_fws_macdesc_state_indicate(struct brcmf_fws_info *fws, | |||
1011 | brcmf_fws_tim_update(fws, entry, BRCMF_FWS_FIFO_AC_VO, true); | 1012 | brcmf_fws_tim_update(fws, entry, BRCMF_FWS_FIFO_AC_VO, true); |
1012 | ret = BRCMF_FWS_RET_OK_NOSCHEDULE; | 1013 | ret = BRCMF_FWS_RET_OK_NOSCHEDULE; |
1013 | } | 1014 | } |
1014 | brcmf_fws_unlock(fws->drvr, flags); | 1015 | brcmf_fws_unlock(fws); |
1015 | return ret; | 1016 | return ret; |
1016 | } | 1017 | } |
1017 | 1018 | ||
@@ -1019,7 +1020,6 @@ static int brcmf_fws_interface_state_indicate(struct brcmf_fws_info *fws, | |||
1019 | u8 type, u8 *data) | 1020 | u8 type, u8 *data) |
1020 | { | 1021 | { |
1021 | struct brcmf_fws_mac_descriptor *entry; | 1022 | struct brcmf_fws_mac_descriptor *entry; |
1022 | ulong flags; | ||
1023 | u8 ifidx; | 1023 | u8 ifidx; |
1024 | int ret; | 1024 | int ret; |
1025 | 1025 | ||
@@ -1038,7 +1038,7 @@ static int brcmf_fws_interface_state_indicate(struct brcmf_fws_info *fws, | |||
1038 | 1038 | ||
1039 | brcmf_dbg(TRACE, "%s (%d): %s\n", brcmf_fws_get_tlv_name(type), type, | 1039 | brcmf_dbg(TRACE, "%s (%d): %s\n", brcmf_fws_get_tlv_name(type), type, |
1040 | entry->name); | 1040 | entry->name); |
1041 | brcmf_fws_lock(fws->drvr, flags); | 1041 | brcmf_fws_lock(fws); |
1042 | switch (type) { | 1042 | switch (type) { |
1043 | case BRCMF_FWS_TYPE_INTERFACE_OPEN: | 1043 | case BRCMF_FWS_TYPE_INTERFACE_OPEN: |
1044 | entry->state = BRCMF_FWS_STATE_OPEN; | 1044 | entry->state = BRCMF_FWS_STATE_OPEN; |
@@ -1050,10 +1050,10 @@ static int brcmf_fws_interface_state_indicate(struct brcmf_fws_info *fws, | |||
1050 | break; | 1050 | break; |
1051 | default: | 1051 | default: |
1052 | ret = -EINVAL; | 1052 | ret = -EINVAL; |
1053 | brcmf_fws_unlock(fws->drvr, flags); | 1053 | brcmf_fws_unlock(fws); |
1054 | goto fail; | 1054 | goto fail; |
1055 | } | 1055 | } |
1056 | brcmf_fws_unlock(fws->drvr, flags); | 1056 | brcmf_fws_unlock(fws); |
1057 | return ret; | 1057 | return ret; |
1058 | 1058 | ||
1059 | fail: | 1059 | fail: |
@@ -1065,7 +1065,6 @@ static int brcmf_fws_request_indicate(struct brcmf_fws_info *fws, u8 type, | |||
1065 | u8 *data) | 1065 | u8 *data) |
1066 | { | 1066 | { |
1067 | struct brcmf_fws_mac_descriptor *entry; | 1067 | struct brcmf_fws_mac_descriptor *entry; |
1068 | ulong flags; | ||
1069 | 1068 | ||
1070 | entry = &fws->desc.nodes[data[1] & 0x1F]; | 1069 | entry = &fws->desc.nodes[data[1] & 0x1F]; |
1071 | if (!entry->occupied) { | 1070 | if (!entry->occupied) { |
@@ -1079,14 +1078,14 @@ static int brcmf_fws_request_indicate(struct brcmf_fws_info *fws, u8 type, | |||
1079 | brcmf_dbg(TRACE, "%s (%d): %s cnt %d bmp %d\n", | 1078 | brcmf_dbg(TRACE, "%s (%d): %s cnt %d bmp %d\n", |
1080 | brcmf_fws_get_tlv_name(type), type, entry->name, | 1079 | brcmf_fws_get_tlv_name(type), type, entry->name, |
1081 | data[0], data[2]); | 1080 | data[0], data[2]); |
1082 | brcmf_fws_lock(fws->drvr, flags); | 1081 | brcmf_fws_lock(fws); |
1083 | if (type == BRCMF_FWS_TYPE_MAC_REQUEST_CREDIT) | 1082 | if (type == BRCMF_FWS_TYPE_MAC_REQUEST_CREDIT) |
1084 | entry->requested_credit = data[0]; | 1083 | entry->requested_credit = data[0]; |
1085 | else | 1084 | else |
1086 | entry->requested_packet = data[0]; | 1085 | entry->requested_packet = data[0]; |
1087 | 1086 | ||
1088 | entry->ac_bitmap = data[2]; | 1087 | entry->ac_bitmap = data[2]; |
1089 | brcmf_fws_unlock(fws->drvr, flags); | 1088 | brcmf_fws_unlock(fws); |
1090 | return BRCMF_FWS_RET_OK_SCHEDULE; | 1089 | return BRCMF_FWS_RET_OK_SCHEDULE; |
1091 | } | 1090 | } |
1092 | 1091 | ||
@@ -1160,7 +1159,8 @@ static void brcmf_fws_return_credits(struct brcmf_fws_info *fws, | |||
1160 | static void brcmf_fws_schedule_deq(struct brcmf_fws_info *fws) | 1159 | static void brcmf_fws_schedule_deq(struct brcmf_fws_info *fws) |
1161 | { | 1160 | { |
1162 | /* only schedule dequeue when there are credits for delayed traffic */ | 1161 | /* only schedule dequeue when there are credits for delayed traffic */ |
1163 | if (fws->fifo_credit_map & fws->fifo_delay_map) | 1162 | if ((fws->fifo_credit_map & fws->fifo_delay_map) || |
1163 | (!brcmf_fws_fc_active(fws) && fws->fifo_delay_map)) | ||
1164 | queue_work(fws->fws_wq, &fws->fws_dequeue_work); | 1164 | queue_work(fws->fws_wq, &fws->fws_dequeue_work); |
1165 | } | 1165 | } |
1166 | 1166 | ||
@@ -1383,7 +1383,6 @@ brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, | |||
1383 | static int brcmf_fws_fifocreditback_indicate(struct brcmf_fws_info *fws, | 1383 | static int brcmf_fws_fifocreditback_indicate(struct brcmf_fws_info *fws, |
1384 | u8 *data) | 1384 | u8 *data) |
1385 | { | 1385 | { |
1386 | ulong flags; | ||
1387 | int i; | 1386 | int i; |
1388 | 1387 | ||
1389 | if (fws->fcmode != BRCMF_FWS_FCMODE_EXPLICIT_CREDIT) { | 1388 | if (fws->fcmode != BRCMF_FWS_FCMODE_EXPLICIT_CREDIT) { |
@@ -1392,19 +1391,18 @@ static int brcmf_fws_fifocreditback_indicate(struct brcmf_fws_info *fws, | |||
1392 | } | 1391 | } |
1393 | 1392 | ||
1394 | brcmf_dbg(DATA, "enter: data %pM\n", data); | 1393 | brcmf_dbg(DATA, "enter: data %pM\n", data); |
1395 | brcmf_fws_lock(fws->drvr, flags); | 1394 | brcmf_fws_lock(fws); |
1396 | for (i = 0; i < BRCMF_FWS_FIFO_COUNT; i++) | 1395 | for (i = 0; i < BRCMF_FWS_FIFO_COUNT; i++) |
1397 | brcmf_fws_return_credits(fws, i, data[i]); | 1396 | brcmf_fws_return_credits(fws, i, data[i]); |
1398 | 1397 | ||
1399 | brcmf_dbg(DATA, "map: credit %x delay %x\n", fws->fifo_credit_map, | 1398 | brcmf_dbg(DATA, "map: credit %x delay %x\n", fws->fifo_credit_map, |
1400 | fws->fifo_delay_map); | 1399 | fws->fifo_delay_map); |
1401 | brcmf_fws_unlock(fws->drvr, flags); | 1400 | brcmf_fws_unlock(fws); |
1402 | return BRCMF_FWS_RET_OK_SCHEDULE; | 1401 | return BRCMF_FWS_RET_OK_SCHEDULE; |
1403 | } | 1402 | } |
1404 | 1403 | ||
1405 | static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 *data) | 1404 | static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 *data) |
1406 | { | 1405 | { |
1407 | ulong lflags; | ||
1408 | __le32 status_le; | 1406 | __le32 status_le; |
1409 | u32 status; | 1407 | u32 status; |
1410 | u32 hslot; | 1408 | u32 hslot; |
@@ -1418,9 +1416,9 @@ static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 *data) | |||
1418 | hslot = brcmf_txstatus_get_field(status, HSLOT); | 1416 | hslot = brcmf_txstatus_get_field(status, HSLOT); |
1419 | genbit = brcmf_txstatus_get_field(status, GENERATION); | 1417 | genbit = brcmf_txstatus_get_field(status, GENERATION); |
1420 | 1418 | ||
1421 | brcmf_fws_lock(fws->drvr, lflags); | 1419 | brcmf_fws_lock(fws); |
1422 | brcmf_fws_txs_process(fws, flags, hslot, genbit); | 1420 | brcmf_fws_txs_process(fws, flags, hslot, genbit); |
1423 | brcmf_fws_unlock(fws->drvr, lflags); | 1421 | brcmf_fws_unlock(fws); |
1424 | return BRCMF_FWS_RET_OK_NOSCHEDULE; | 1422 | return BRCMF_FWS_RET_OK_NOSCHEDULE; |
1425 | } | 1423 | } |
1426 | 1424 | ||
@@ -1440,7 +1438,6 @@ static int brcmf_fws_notify_credit_map(struct brcmf_if *ifp, | |||
1440 | { | 1438 | { |
1441 | struct brcmf_fws_info *fws = ifp->drvr->fws; | 1439 | struct brcmf_fws_info *fws = ifp->drvr->fws; |
1442 | int i; | 1440 | int i; |
1443 | ulong flags; | ||
1444 | u8 *credits = data; | 1441 | u8 *credits = data; |
1445 | 1442 | ||
1446 | if (e->datalen < BRCMF_FWS_FIFO_COUNT) { | 1443 | if (e->datalen < BRCMF_FWS_FIFO_COUNT) { |
@@ -1453,7 +1450,7 @@ static int brcmf_fws_notify_credit_map(struct brcmf_if *ifp, | |||
1453 | fws->creditmap_received = true; | 1450 | fws->creditmap_received = true; |
1454 | 1451 | ||
1455 | brcmf_dbg(TRACE, "enter: credits %pM\n", credits); | 1452 | brcmf_dbg(TRACE, "enter: credits %pM\n", credits); |
1456 | brcmf_fws_lock(ifp->drvr, flags); | 1453 | brcmf_fws_lock(fws); |
1457 | for (i = 0; i < ARRAY_SIZE(fws->fifo_credit); i++) { | 1454 | for (i = 0; i < ARRAY_SIZE(fws->fifo_credit); i++) { |
1458 | if (*credits) | 1455 | if (*credits) |
1459 | fws->fifo_credit_map |= 1 << i; | 1456 | fws->fifo_credit_map |= 1 << i; |
@@ -1462,7 +1459,7 @@ static int brcmf_fws_notify_credit_map(struct brcmf_if *ifp, | |||
1462 | fws->fifo_credit[i] = *credits++; | 1459 | fws->fifo_credit[i] = *credits++; |
1463 | } | 1460 | } |
1464 | brcmf_fws_schedule_deq(fws); | 1461 | brcmf_fws_schedule_deq(fws); |
1465 | brcmf_fws_unlock(ifp->drvr, flags); | 1462 | brcmf_fws_unlock(fws); |
1466 | return 0; | 1463 | return 0; |
1467 | } | 1464 | } |
1468 | 1465 | ||
@@ -1471,18 +1468,18 @@ static int brcmf_fws_notify_bcmc_credit_support(struct brcmf_if *ifp, | |||
1471 | void *data) | 1468 | void *data) |
1472 | { | 1469 | { |
1473 | struct brcmf_fws_info *fws = ifp->drvr->fws; | 1470 | struct brcmf_fws_info *fws = ifp->drvr->fws; |
1474 | ulong flags; | ||
1475 | 1471 | ||
1476 | brcmf_fws_lock(ifp->drvr, flags); | 1472 | brcmf_fws_lock(fws); |
1477 | if (fws) | 1473 | if (fws) |
1478 | fws->bcmc_credit_check = true; | 1474 | fws->bcmc_credit_check = true; |
1479 | brcmf_fws_unlock(ifp->drvr, flags); | 1475 | brcmf_fws_unlock(fws); |
1480 | return 0; | 1476 | return 0; |
1481 | } | 1477 | } |
1482 | 1478 | ||
1483 | int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len, | 1479 | int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len, |
1484 | struct sk_buff *skb) | 1480 | struct sk_buff *skb) |
1485 | { | 1481 | { |
1482 | struct brcmf_skb_reorder_data *rd; | ||
1486 | struct brcmf_fws_info *fws = drvr->fws; | 1483 | struct brcmf_fws_info *fws = drvr->fws; |
1487 | u8 *signal_data; | 1484 | u8 *signal_data; |
1488 | s16 data_len; | 1485 | s16 data_len; |
@@ -1497,8 +1494,10 @@ int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len, | |||
1497 | 1494 | ||
1498 | WARN_ON(signal_len > skb->len); | 1495 | WARN_ON(signal_len > skb->len); |
1499 | 1496 | ||
1497 | if (!signal_len) | ||
1498 | return 0; | ||
1500 | /* if flow control disabled, skip to packet data and leave */ | 1499 | /* if flow control disabled, skip to packet data and leave */ |
1501 | if (!signal_len || !drvr->fw_signals) { | 1500 | if (!fws->fw_signals) { |
1502 | skb_pull(skb, signal_len); | 1501 | skb_pull(skb, signal_len); |
1503 | return 0; | 1502 | return 0; |
1504 | } | 1503 | } |
@@ -1536,9 +1535,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len, | |||
1536 | 1535 | ||
1537 | err = BRCMF_FWS_RET_OK_NOSCHEDULE; | 1536 | err = BRCMF_FWS_RET_OK_NOSCHEDULE; |
1538 | switch (type) { | 1537 | switch (type) { |
1539 | case BRCMF_FWS_TYPE_HOST_REORDER_RXPKTS: | ||
1540 | case BRCMF_FWS_TYPE_COMP_TXSTATUS: | 1538 | case BRCMF_FWS_TYPE_COMP_TXSTATUS: |
1541 | break; | 1539 | break; |
1540 | case BRCMF_FWS_TYPE_HOST_REORDER_RXPKTS: | ||
1541 | rd = (struct brcmf_skb_reorder_data *)skb->cb; | ||
1542 | rd->reorder = data; | ||
1543 | break; | ||
1542 | case BRCMF_FWS_TYPE_MACDESC_ADD: | 1544 | case BRCMF_FWS_TYPE_MACDESC_ADD: |
1543 | case BRCMF_FWS_TYPE_MACDESC_DEL: | 1545 | case BRCMF_FWS_TYPE_MACDESC_DEL: |
1544 | brcmf_fws_macdesc_indicate(fws, type, data); | 1546 | brcmf_fws_macdesc_indicate(fws, type, data); |
@@ -1694,17 +1696,22 @@ static int brcmf_fws_commit_skb(struct brcmf_fws_info *fws, int fifo, | |||
1694 | return PTR_ERR(entry); | 1696 | return PTR_ERR(entry); |
1695 | 1697 | ||
1696 | brcmf_fws_precommit_skb(fws, fifo, skb); | 1698 | brcmf_fws_precommit_skb(fws, fifo, skb); |
1699 | entry->transit_count++; | ||
1700 | if (entry->suppressed) | ||
1701 | entry->suppr_transit_count++; | ||
1702 | brcmf_fws_unlock(fws); | ||
1697 | rc = brcmf_bus_txdata(bus, skb); | 1703 | rc = brcmf_bus_txdata(bus, skb); |
1704 | brcmf_fws_lock(fws); | ||
1698 | brcmf_dbg(DATA, "%s flags %X htod %X bus_tx %d\n", entry->name, | 1705 | brcmf_dbg(DATA, "%s flags %X htod %X bus_tx %d\n", entry->name, |
1699 | skcb->if_flags, skcb->htod, rc); | 1706 | skcb->if_flags, skcb->htod, rc); |
1700 | if (rc < 0) { | 1707 | if (rc < 0) { |
1708 | entry->transit_count--; | ||
1709 | if (entry->suppressed) | ||
1710 | entry->suppr_transit_count--; | ||
1701 | brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb); | 1711 | brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb); |
1702 | goto rollback; | 1712 | goto rollback; |
1703 | } | 1713 | } |
1704 | 1714 | ||
1705 | entry->transit_count++; | ||
1706 | if (entry->suppressed) | ||
1707 | entry->suppr_transit_count++; | ||
1708 | fws->stats.pkt2bus++; | 1715 | fws->stats.pkt2bus++; |
1709 | fws->stats.send_pkts[fifo]++; | 1716 | fws->stats.send_pkts[fifo]++; |
1710 | if (brcmf_skb_if_flags_get_field(skb, REQUESTED)) | 1717 | if (brcmf_skb_if_flags_get_field(skb, REQUESTED)) |
@@ -1741,11 +1748,11 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1741 | struct brcmf_fws_info *fws = drvr->fws; | 1748 | struct brcmf_fws_info *fws = drvr->fws; |
1742 | struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb); | 1749 | struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb); |
1743 | struct ethhdr *eh = (struct ethhdr *)(skb->data); | 1750 | struct ethhdr *eh = (struct ethhdr *)(skb->data); |
1744 | ulong flags; | ||
1745 | int fifo = BRCMF_FWS_FIFO_BCMC; | 1751 | int fifo = BRCMF_FWS_FIFO_BCMC; |
1746 | bool multicast = is_multicast_ether_addr(eh->h_dest); | 1752 | bool multicast = is_multicast_ether_addr(eh->h_dest); |
1747 | bool pae = eh->h_proto == htons(ETH_P_PAE); | 1753 | bool pae = eh->h_proto == htons(ETH_P_PAE); |
1748 | 1754 | ||
1755 | brcmf_dbg(DATA, "tx proto=0x%X\n", ntohs(eh->h_proto)); | ||
1749 | /* determine the priority */ | 1756 | /* determine the priority */ |
1750 | if (!skb->priority) | 1757 | if (!skb->priority) |
1751 | skb->priority = cfg80211_classify8021d(skb); | 1758 | skb->priority = cfg80211_classify8021d(skb); |
@@ -1754,14 +1761,6 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1754 | if (pae) | 1761 | if (pae) |
1755 | atomic_inc(&ifp->pend_8021x_cnt); | 1762 | atomic_inc(&ifp->pend_8021x_cnt); |
1756 | 1763 | ||
1757 | if (!brcmf_fws_fc_active(fws)) { | ||
1758 | /* If the protocol uses a data header, apply it */ | ||
1759 | brcmf_proto_hdrpush(drvr, ifp->ifidx, 0, skb); | ||
1760 | |||
1761 | /* Use bus module to send data frame */ | ||
1762 | return brcmf_bus_txdata(drvr->bus_if, skb); | ||
1763 | } | ||
1764 | |||
1765 | /* set control buffer information */ | 1764 | /* set control buffer information */ |
1766 | skcb->if_flags = 0; | 1765 | skcb->if_flags = 0; |
1767 | skcb->state = BRCMF_FWS_SKBSTATE_NEW; | 1766 | skcb->state = BRCMF_FWS_SKBSTATE_NEW; |
@@ -1769,7 +1768,7 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1769 | if (!multicast) | 1768 | if (!multicast) |
1770 | fifo = brcmf_fws_prio2fifo[skb->priority]; | 1769 | fifo = brcmf_fws_prio2fifo[skb->priority]; |
1771 | 1770 | ||
1772 | brcmf_fws_lock(drvr, flags); | 1771 | brcmf_fws_lock(fws); |
1773 | if (fifo != BRCMF_FWS_FIFO_AC_BE && fifo < BRCMF_FWS_FIFO_BCMC) | 1772 | if (fifo != BRCMF_FWS_FIFO_AC_BE && fifo < BRCMF_FWS_FIFO_BCMC) |
1774 | fws->borrow_defer_timestamp = jiffies + | 1773 | fws->borrow_defer_timestamp = jiffies + |
1775 | BRCMF_FWS_BORROW_DEFER_PERIOD; | 1774 | BRCMF_FWS_BORROW_DEFER_PERIOD; |
@@ -1789,7 +1788,7 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1789 | } | 1788 | } |
1790 | brcmu_pkt_buf_free_skb(skb); | 1789 | brcmu_pkt_buf_free_skb(skb); |
1791 | } | 1790 | } |
1792 | brcmf_fws_unlock(drvr, flags); | 1791 | brcmf_fws_unlock(fws); |
1793 | return 0; | 1792 | return 0; |
1794 | } | 1793 | } |
1795 | 1794 | ||
@@ -1809,7 +1808,7 @@ void brcmf_fws_add_interface(struct brcmf_if *ifp) | |||
1809 | struct brcmf_fws_info *fws = ifp->drvr->fws; | 1808 | struct brcmf_fws_info *fws = ifp->drvr->fws; |
1810 | struct brcmf_fws_mac_descriptor *entry; | 1809 | struct brcmf_fws_mac_descriptor *entry; |
1811 | 1810 | ||
1812 | if (!ifp->ndev || !ifp->drvr->fw_signals) | 1811 | if (!ifp->ndev) |
1813 | return; | 1812 | return; |
1814 | 1813 | ||
1815 | entry = &fws->desc.iface[ifp->ifidx]; | 1814 | entry = &fws->desc.iface[ifp->ifidx]; |
@@ -1824,31 +1823,54 @@ void brcmf_fws_add_interface(struct brcmf_if *ifp) | |||
1824 | void brcmf_fws_del_interface(struct brcmf_if *ifp) | 1823 | void brcmf_fws_del_interface(struct brcmf_if *ifp) |
1825 | { | 1824 | { |
1826 | struct brcmf_fws_mac_descriptor *entry = ifp->fws_desc; | 1825 | struct brcmf_fws_mac_descriptor *entry = ifp->fws_desc; |
1827 | ulong flags; | ||
1828 | 1826 | ||
1829 | if (!entry) | 1827 | if (!entry) |
1830 | return; | 1828 | return; |
1831 | 1829 | ||
1832 | brcmf_fws_lock(ifp->drvr, flags); | 1830 | brcmf_fws_lock(ifp->drvr->fws); |
1833 | ifp->fws_desc = NULL; | 1831 | ifp->fws_desc = NULL; |
1834 | brcmf_dbg(TRACE, "deleting %s\n", entry->name); | 1832 | brcmf_dbg(TRACE, "deleting %s\n", entry->name); |
1835 | brcmf_fws_macdesc_deinit(entry); | 1833 | brcmf_fws_macdesc_deinit(entry); |
1836 | brcmf_fws_cleanup(ifp->drvr->fws, ifp->ifidx); | 1834 | brcmf_fws_cleanup(ifp->drvr->fws, ifp->ifidx); |
1837 | brcmf_fws_unlock(ifp->drvr, flags); | 1835 | brcmf_fws_unlock(ifp->drvr->fws); |
1838 | } | 1836 | } |
1839 | 1837 | ||
1840 | static void brcmf_fws_dequeue_worker(struct work_struct *worker) | 1838 | static void brcmf_fws_dequeue_worker(struct work_struct *worker) |
1841 | { | 1839 | { |
1842 | struct brcmf_fws_info *fws; | 1840 | struct brcmf_fws_info *fws; |
1841 | struct brcmf_pub *drvr; | ||
1843 | struct sk_buff *skb; | 1842 | struct sk_buff *skb; |
1844 | ulong flags; | ||
1845 | int fifo; | 1843 | int fifo; |
1844 | u32 hslot; | ||
1845 | u32 ifidx; | ||
1846 | int ret; | ||
1846 | 1847 | ||
1847 | fws = container_of(worker, struct brcmf_fws_info, fws_dequeue_work); | 1848 | fws = container_of(worker, struct brcmf_fws_info, fws_dequeue_work); |
1849 | drvr = fws->drvr; | ||
1848 | 1850 | ||
1849 | brcmf_fws_lock(fws->drvr, flags); | 1851 | brcmf_fws_lock(fws); |
1850 | for (fifo = BRCMF_FWS_FIFO_BCMC; fifo >= 0 && !fws->bus_flow_blocked; | 1852 | for (fifo = BRCMF_FWS_FIFO_BCMC; fifo >= 0 && !fws->bus_flow_blocked; |
1851 | fifo--) { | 1853 | fifo--) { |
1854 | if (!brcmf_fws_fc_active(fws)) { | ||
1855 | while ((skb = brcmf_fws_deq(fws, fifo)) != NULL) { | ||
1856 | hslot = brcmf_skb_htod_tag_get_field(skb, | ||
1857 | HSLOT); | ||
1858 | brcmf_fws_hanger_poppkt(&fws->hanger, hslot, | ||
1859 | &skb, true); | ||
1860 | ifidx = brcmf_skb_if_flags_get_field(skb, | ||
1861 | INDEX); | ||
1862 | brcmf_proto_hdrpush(drvr, ifidx, 0, skb); | ||
1863 | /* Use bus module to send data frame */ | ||
1864 | brcmf_fws_unlock(fws); | ||
1865 | ret = brcmf_bus_txdata(drvr->bus_if, skb); | ||
1866 | brcmf_fws_lock(fws); | ||
1867 | if (ret < 0) | ||
1868 | brcmf_txfinalize(drvr, skb, false); | ||
1869 | if (fws->bus_flow_blocked) | ||
1870 | break; | ||
1871 | } | ||
1872 | continue; | ||
1873 | } | ||
1852 | while ((fws->fifo_credit[fifo]) || ((!fws->bcmc_credit_check) && | 1874 | while ((fws->fifo_credit[fifo]) || ((!fws->bcmc_credit_check) && |
1853 | (fifo == BRCMF_FWS_FIFO_BCMC))) { | 1875 | (fifo == BRCMF_FWS_FIFO_BCMC))) { |
1854 | skb = brcmf_fws_deq(fws, fifo); | 1876 | skb = brcmf_fws_deq(fws, fifo); |
@@ -1876,42 +1898,43 @@ static void brcmf_fws_dequeue_worker(struct work_struct *worker) | |||
1876 | } | 1898 | } |
1877 | } | 1899 | } |
1878 | } | 1900 | } |
1879 | brcmf_fws_unlock(fws->drvr, flags); | 1901 | brcmf_fws_unlock(fws); |
1880 | } | 1902 | } |
1881 | 1903 | ||
1882 | int brcmf_fws_init(struct brcmf_pub *drvr) | 1904 | int brcmf_fws_init(struct brcmf_pub *drvr) |
1883 | { | 1905 | { |
1906 | struct brcmf_fws_info *fws; | ||
1884 | u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS; | 1907 | u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS; |
1885 | int rc; | 1908 | int rc; |
1886 | 1909 | ||
1887 | if (!drvr->fw_signals) | ||
1888 | return 0; | ||
1889 | |||
1890 | spin_lock_init(&drvr->fws_spinlock); | ||
1891 | |||
1892 | drvr->fws = kzalloc(sizeof(*(drvr->fws)), GFP_KERNEL); | 1910 | drvr->fws = kzalloc(sizeof(*(drvr->fws)), GFP_KERNEL); |
1893 | if (!drvr->fws) { | 1911 | if (!drvr->fws) { |
1894 | rc = -ENOMEM; | 1912 | rc = -ENOMEM; |
1895 | goto fail; | 1913 | goto fail; |
1896 | } | 1914 | } |
1897 | 1915 | ||
1916 | fws = drvr->fws; | ||
1917 | |||
1918 | spin_lock_init(&fws->spinlock); | ||
1919 | |||
1898 | /* set linkage back */ | 1920 | /* set linkage back */ |
1899 | drvr->fws->drvr = drvr; | 1921 | fws->drvr = drvr; |
1900 | drvr->fws->fcmode = fcmode; | 1922 | fws->fcmode = fcmode; |
1901 | 1923 | ||
1902 | drvr->fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); | 1924 | fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); |
1903 | if (drvr->fws->fws_wq == NULL) { | 1925 | if (fws->fws_wq == NULL) { |
1904 | brcmf_err("workqueue creation failed\n"); | 1926 | brcmf_err("workqueue creation failed\n"); |
1905 | rc = -EBADF; | 1927 | rc = -EBADF; |
1906 | goto fail; | 1928 | goto fail; |
1907 | } | 1929 | } |
1908 | INIT_WORK(&drvr->fws->fws_dequeue_work, brcmf_fws_dequeue_worker); | 1930 | INIT_WORK(&fws->fws_dequeue_work, brcmf_fws_dequeue_worker); |
1909 | 1931 | ||
1910 | /* enable firmware signalling if fcmode active */ | 1932 | /* enable firmware signalling if fcmode active */ |
1911 | if (drvr->fws->fcmode != BRCMF_FWS_FCMODE_NONE) | 1933 | if (fws->fcmode != BRCMF_FWS_FCMODE_NONE) |
1912 | tlv |= BRCMF_FWS_FLAGS_XONXOFF_SIGNALS | | 1934 | tlv |= BRCMF_FWS_FLAGS_XONXOFF_SIGNALS | |
1913 | BRCMF_FWS_FLAGS_CREDIT_STATUS_SIGNALS | | 1935 | BRCMF_FWS_FLAGS_CREDIT_STATUS_SIGNALS | |
1914 | BRCMF_FWS_FLAGS_HOST_PROPTXSTATUS_ACTIVE; | 1936 | BRCMF_FWS_FLAGS_HOST_PROPTXSTATUS_ACTIVE | |
1937 | BRCMF_FWS_FLAGS_HOST_RXREORDER_ACTIVE; | ||
1915 | 1938 | ||
1916 | rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP, | 1939 | rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP, |
1917 | brcmf_fws_notify_credit_map); | 1940 | brcmf_fws_notify_credit_map); |
@@ -1927,31 +1950,33 @@ int brcmf_fws_init(struct brcmf_pub *drvr) | |||
1927 | goto fail; | 1950 | goto fail; |
1928 | } | 1951 | } |
1929 | 1952 | ||
1930 | /* setting the iovar may fail if feature is unsupported | 1953 | /* Setting the iovar may fail if feature is unsupported |
1931 | * so leave the rc as is so driver initialization can | 1954 | * so leave the rc as is so driver initialization can |
1932 | * continue. | 1955 | * continue. Set mode back to none indicating not enabled. |
1933 | */ | 1956 | */ |
1957 | fws->fw_signals = true; | ||
1934 | if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) { | 1958 | if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) { |
1935 | brcmf_err("failed to set bdcv2 tlv signaling\n"); | 1959 | brcmf_err("failed to set bdcv2 tlv signaling\n"); |
1936 | goto fail_event; | 1960 | fws->fcmode = BRCMF_FWS_FCMODE_NONE; |
1961 | fws->fw_signals = false; | ||
1937 | } | 1962 | } |
1938 | 1963 | ||
1939 | brcmf_fws_hanger_init(&drvr->fws->hanger); | 1964 | if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1)) |
1940 | brcmf_fws_macdesc_init(&drvr->fws->desc.other, NULL, 0); | 1965 | brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n"); |
1941 | brcmf_fws_macdesc_set_name(drvr->fws, &drvr->fws->desc.other); | 1966 | |
1942 | brcmu_pktq_init(&drvr->fws->desc.other.psq, BRCMF_FWS_PSQ_PREC_COUNT, | 1967 | brcmf_fws_hanger_init(&fws->hanger); |
1968 | brcmf_fws_macdesc_init(&fws->desc.other, NULL, 0); | ||
1969 | brcmf_fws_macdesc_set_name(fws, &fws->desc.other); | ||
1970 | brcmu_pktq_init(&fws->desc.other.psq, BRCMF_FWS_PSQ_PREC_COUNT, | ||
1943 | BRCMF_FWS_PSQ_LEN); | 1971 | BRCMF_FWS_PSQ_LEN); |
1944 | 1972 | ||
1945 | /* create debugfs file for statistics */ | 1973 | /* create debugfs file for statistics */ |
1946 | brcmf_debugfs_create_fws_stats(drvr, &drvr->fws->stats); | 1974 | brcmf_debugfs_create_fws_stats(drvr, &fws->stats); |
1947 | 1975 | ||
1948 | brcmf_dbg(INFO, "%s bdcv2 tlv signaling [%x]\n", | 1976 | brcmf_dbg(INFO, "%s bdcv2 tlv signaling [%x]\n", |
1949 | drvr->fw_signals ? "enabled" : "disabled", tlv); | 1977 | fws->fw_signals ? "enabled" : "disabled", tlv); |
1950 | return 0; | 1978 | return 0; |
1951 | 1979 | ||
1952 | fail_event: | ||
1953 | brcmf_fweh_unregister(drvr, BRCMF_E_BCMC_CREDIT_SUPPORT); | ||
1954 | brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP); | ||
1955 | fail: | 1980 | fail: |
1956 | brcmf_fws_deinit(drvr); | 1981 | brcmf_fws_deinit(drvr); |
1957 | return rc; | 1982 | return rc; |
@@ -1960,24 +1985,18 @@ fail: | |||
1960 | void brcmf_fws_deinit(struct brcmf_pub *drvr) | 1985 | void brcmf_fws_deinit(struct brcmf_pub *drvr) |
1961 | { | 1986 | { |
1962 | struct brcmf_fws_info *fws = drvr->fws; | 1987 | struct brcmf_fws_info *fws = drvr->fws; |
1963 | ulong flags; | ||
1964 | 1988 | ||
1965 | if (!fws) | 1989 | if (!fws) |
1966 | return; | 1990 | return; |
1967 | 1991 | ||
1968 | /* disable firmware signalling entirely | ||
1969 | * to avoid using the workqueue. | ||
1970 | */ | ||
1971 | drvr->fw_signals = false; | ||
1972 | |||
1973 | if (drvr->fws->fws_wq) | 1992 | if (drvr->fws->fws_wq) |
1974 | destroy_workqueue(drvr->fws->fws_wq); | 1993 | destroy_workqueue(drvr->fws->fws_wq); |
1975 | 1994 | ||
1976 | /* cleanup */ | 1995 | /* cleanup */ |
1977 | brcmf_fws_lock(drvr, flags); | 1996 | brcmf_fws_lock(fws); |
1978 | brcmf_fws_cleanup(fws, -1); | 1997 | brcmf_fws_cleanup(fws, -1); |
1979 | drvr->fws = NULL; | 1998 | drvr->fws = NULL; |
1980 | brcmf_fws_unlock(drvr, flags); | 1999 | brcmf_fws_unlock(fws); |
1981 | 2000 | ||
1982 | /* free top structure */ | 2001 | /* free top structure */ |
1983 | kfree(fws); | 2002 | kfree(fws); |
@@ -1985,7 +2004,7 @@ void brcmf_fws_deinit(struct brcmf_pub *drvr) | |||
1985 | 2004 | ||
1986 | bool brcmf_fws_fc_active(struct brcmf_fws_info *fws) | 2005 | bool brcmf_fws_fc_active(struct brcmf_fws_info *fws) |
1987 | { | 2006 | { |
1988 | if (!fws) | 2007 | if (!fws->creditmap_received) |
1989 | return false; | 2008 | return false; |
1990 | 2009 | ||
1991 | return fws->fcmode != BRCMF_FWS_FCMODE_NONE; | 2010 | return fws->fcmode != BRCMF_FWS_FCMODE_NONE; |
@@ -1993,17 +2012,16 @@ bool brcmf_fws_fc_active(struct brcmf_fws_info *fws) | |||
1993 | 2012 | ||
1994 | void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb) | 2013 | void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb) |
1995 | { | 2014 | { |
1996 | ulong flags; | ||
1997 | u32 hslot; | 2015 | u32 hslot; |
1998 | 2016 | ||
1999 | if (brcmf_skbcb(skb)->state == BRCMF_FWS_SKBSTATE_TIM) { | 2017 | if (brcmf_skbcb(skb)->state == BRCMF_FWS_SKBSTATE_TIM) { |
2000 | brcmu_pkt_buf_free_skb(skb); | 2018 | brcmu_pkt_buf_free_skb(skb); |
2001 | return; | 2019 | return; |
2002 | } | 2020 | } |
2003 | brcmf_fws_lock(fws->drvr, flags); | 2021 | brcmf_fws_lock(fws); |
2004 | hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); | 2022 | hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); |
2005 | brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0); | 2023 | brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0); |
2006 | brcmf_fws_unlock(fws->drvr, flags); | 2024 | brcmf_fws_unlock(fws); |
2007 | } | 2025 | } |
2008 | 2026 | ||
2009 | void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked) | 2027 | void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c index 79555f006d53..d7a974532909 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c | |||
@@ -1430,7 +1430,7 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp, | |||
1430 | IEEE80211_BAND_5GHZ); | 1430 | IEEE80211_BAND_5GHZ); |
1431 | 1431 | ||
1432 | wdev = &ifp->vif->wdev; | 1432 | wdev = &ifp->vif->wdev; |
1433 | cfg80211_rx_mgmt(wdev, freq, 0, (u8 *)mgmt_frame, mgmt_frame_len, | 1433 | cfg80211_rx_mgmt(wdev, freq, 0, (u8 *)mgmt_frame, mgmt_frame_len, 0, |
1434 | GFP_ATOMIC); | 1434 | GFP_ATOMIC); |
1435 | 1435 | ||
1436 | kfree(mgmt_frame); | 1436 | kfree(mgmt_frame); |
@@ -1895,7 +1895,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp, | |||
1895 | IEEE80211_BAND_2GHZ : | 1895 | IEEE80211_BAND_2GHZ : |
1896 | IEEE80211_BAND_5GHZ); | 1896 | IEEE80211_BAND_5GHZ); |
1897 | 1897 | ||
1898 | cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, | 1898 | cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, 0, |
1899 | GFP_ATOMIC); | 1899 | GFP_ATOMIC); |
1900 | 1900 | ||
1901 | brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n", | 1901 | brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n", |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h index 09786a539950..2b5407f002e5 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h | |||
@@ -208,7 +208,7 @@ extern int brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, | |||
208 | */ | 208 | */ |
209 | extern int | 209 | extern int |
210 | brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | 210 | brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, |
211 | uint flags, struct sk_buff *pkt); | 211 | uint flags, struct sk_buff_head *pktq); |
212 | extern int | 212 | extern int |
213 | brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | 213 | brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, |
214 | uint flags, u8 *buf, uint nbytes); | 214 | uint flags, u8 *buf, uint nbytes); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 322cadc51ded..39e01a7c8556 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -614,7 +614,6 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) | |||
614 | return 0; | 614 | return 0; |
615 | 615 | ||
616 | fail: | 616 | fail: |
617 | brcmf_txcomplete(dev, skb, false); | ||
618 | return ret; | 617 | return ret; |
619 | } | 618 | } |
620 | 619 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index c3dfea3f307d..571f013cebbb 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -3155,7 +3155,9 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy, | |||
3155 | } | 3155 | } |
3156 | 3156 | ||
3157 | #ifdef CONFIG_NL80211_TESTMODE | 3157 | #ifdef CONFIG_NL80211_TESTMODE |
3158 | static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) | 3158 | static int brcmf_cfg80211_testmode(struct wiphy *wiphy, |
3159 | struct wireless_dev *wdev, | ||
3160 | void *data, int len) | ||
3159 | { | 3161 | { |
3160 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); | 3162 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); |
3161 | struct net_device *ndev = cfg_to_ndev(cfg); | 3163 | struct net_device *ndev = cfg_to_ndev(cfg); |
@@ -4126,6 +4128,53 @@ static void brcmf_cfg80211_crit_proto_stop(struct wiphy *wiphy, | |||
4126 | clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); | 4128 | clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); |
4127 | } | 4129 | } |
4128 | 4130 | ||
4131 | static int brcmf_convert_nl80211_tdls_oper(enum nl80211_tdls_operation oper) | ||
4132 | { | ||
4133 | int ret; | ||
4134 | |||
4135 | switch (oper) { | ||
4136 | case NL80211_TDLS_DISCOVERY_REQ: | ||
4137 | ret = BRCMF_TDLS_MANUAL_EP_DISCOVERY; | ||
4138 | break; | ||
4139 | case NL80211_TDLS_SETUP: | ||
4140 | ret = BRCMF_TDLS_MANUAL_EP_CREATE; | ||
4141 | break; | ||
4142 | case NL80211_TDLS_TEARDOWN: | ||
4143 | ret = BRCMF_TDLS_MANUAL_EP_DELETE; | ||
4144 | break; | ||
4145 | default: | ||
4146 | brcmf_err("unsupported operation: %d\n", oper); | ||
4147 | ret = -EOPNOTSUPP; | ||
4148 | } | ||
4149 | return ret; | ||
4150 | } | ||
4151 | |||
4152 | static int brcmf_cfg80211_tdls_oper(struct wiphy *wiphy, | ||
4153 | struct net_device *ndev, u8 *peer, | ||
4154 | enum nl80211_tdls_operation oper) | ||
4155 | { | ||
4156 | struct brcmf_if *ifp; | ||
4157 | struct brcmf_tdls_iovar_le info; | ||
4158 | int ret = 0; | ||
4159 | |||
4160 | ret = brcmf_convert_nl80211_tdls_oper(oper); | ||
4161 | if (ret < 0) | ||
4162 | return ret; | ||
4163 | |||
4164 | ifp = netdev_priv(ndev); | ||
4165 | memset(&info, 0, sizeof(info)); | ||
4166 | info.mode = (u8)ret; | ||
4167 | if (peer) | ||
4168 | memcpy(info.ea, peer, ETH_ALEN); | ||
4169 | |||
4170 | ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint", | ||
4171 | &info, sizeof(info)); | ||
4172 | if (ret < 0) | ||
4173 | brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret); | ||
4174 | |||
4175 | return ret; | ||
4176 | } | ||
4177 | |||
4129 | static struct cfg80211_ops wl_cfg80211_ops = { | 4178 | static struct cfg80211_ops wl_cfg80211_ops = { |
4130 | .add_virtual_intf = brcmf_cfg80211_add_iface, | 4179 | .add_virtual_intf = brcmf_cfg80211_add_iface, |
4131 | .del_virtual_intf = brcmf_cfg80211_del_iface, | 4180 | .del_virtual_intf = brcmf_cfg80211_del_iface, |
@@ -4164,6 +4213,7 @@ static struct cfg80211_ops wl_cfg80211_ops = { | |||
4164 | .stop_p2p_device = brcmf_p2p_stop_device, | 4213 | .stop_p2p_device = brcmf_p2p_stop_device, |
4165 | .crit_proto_start = brcmf_cfg80211_crit_proto_start, | 4214 | .crit_proto_start = brcmf_cfg80211_crit_proto_start, |
4166 | .crit_proto_stop = brcmf_cfg80211_crit_proto_stop, | 4215 | .crit_proto_stop = brcmf_cfg80211_crit_proto_stop, |
4216 | .tdls_oper = brcmf_cfg80211_tdls_oper, | ||
4167 | CFG80211_TESTMODE_CMD(brcmf_cfg80211_testmode) | 4217 | CFG80211_TESTMODE_CMD(brcmf_cfg80211_testmode) |
4168 | }; | 4218 | }; |
4169 | 4219 | ||
@@ -4285,7 +4335,8 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) | |||
4285 | wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites); | 4335 | wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites); |
4286 | wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT | | 4336 | wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT | |
4287 | WIPHY_FLAG_OFFCHAN_TX | | 4337 | WIPHY_FLAG_OFFCHAN_TX | |
4288 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; | 4338 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | |
4339 | WIPHY_FLAG_SUPPORTS_TDLS; | ||
4289 | wiphy->mgmt_stypes = brcmf_txrx_stypes; | 4340 | wiphy->mgmt_stypes = brcmf_txrx_stypes; |
4290 | wiphy->max_remain_on_channel_duration = 5000; | 4341 | wiphy->max_remain_on_channel_duration = 5000; |
4291 | brcmf_wiphy_pno_params(wiphy); | 4342 | brcmf_wiphy_pno_params(wiphy); |
@@ -4906,6 +4957,12 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, | |||
4906 | goto cfg80211_p2p_attach_out; | 4957 | goto cfg80211_p2p_attach_out; |
4907 | } | 4958 | } |
4908 | 4959 | ||
4960 | err = brcmf_fil_iovar_int_set(ifp, "tdls_enable", 1); | ||
4961 | if (err) { | ||
4962 | brcmf_dbg(INFO, "TDLS not enabled (%d)\n", err); | ||
4963 | wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_TDLS; | ||
4964 | } | ||
4965 | |||
4909 | err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, | 4966 | err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, |
4910 | &io_type); | 4967 | &io_type); |
4911 | if (err) { | 4968 | if (err) { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c index e4fd1ee3d690..53365977bfd6 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | |||
@@ -679,27 +679,6 @@ bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode) | |||
679 | return mode == BCMA_CLKMODE_FAST; | 679 | return mode == BCMA_CLKMODE_FAST; |
680 | } | 680 | } |
681 | 681 | ||
682 | void ai_pci_up(struct si_pub *sih) | ||
683 | { | ||
684 | struct si_info *sii; | ||
685 | |||
686 | sii = container_of(sih, struct si_info, pub); | ||
687 | |||
688 | if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | ||
689 | bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], true); | ||
690 | } | ||
691 | |||
692 | /* Unconfigure and/or apply various WARs when going down */ | ||
693 | void ai_pci_down(struct si_pub *sih) | ||
694 | { | ||
695 | struct si_info *sii; | ||
696 | |||
697 | sii = container_of(sih, struct si_info, pub); | ||
698 | |||
699 | if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | ||
700 | bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], false); | ||
701 | } | ||
702 | |||
703 | /* Enable BT-COEX & Ex-PA for 4313 */ | 682 | /* Enable BT-COEX & Ex-PA for 4313 */ |
704 | void ai_epa_4313war(struct si_pub *sih) | 683 | void ai_epa_4313war(struct si_pub *sih) |
705 | { | 684 | { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h index 89562c1fbf49..a8a267b5b87a 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | |||
@@ -183,9 +183,6 @@ extern u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih); | |||
183 | extern bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode); | 183 | extern bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode); |
184 | extern bool ai_deviceremoved(struct si_pub *sih); | 184 | extern bool ai_deviceremoved(struct si_pub *sih); |
185 | 185 | ||
186 | extern void ai_pci_down(struct si_pub *sih); | ||
187 | extern void ai_pci_up(struct si_pub *sih); | ||
188 | |||
189 | /* Enable Ex-PA for 4313 */ | 186 | /* Enable Ex-PA for 4313 */ |
190 | extern void ai_epa_4313war(struct si_pub *sih); | 187 | extern void ai_epa_4313war(struct si_pub *sih); |
191 | 188 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c index 1860c572b3c4..4fb9635d3919 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c | |||
@@ -1015,9 +1015,10 @@ static bool dma64_txidle(struct dma_info *di) | |||
1015 | 1015 | ||
1016 | /* | 1016 | /* |
1017 | * post receive buffers | 1017 | * post receive buffers |
1018 | * return false is refill failed completely and ring is empty this will stall | 1018 | * Return false if refill failed completely or dma mapping failed. The ring |
1019 | * the rx dma and user might want to call rxfill again asap. This unlikely | 1019 | * is empty, which will stall the rx dma and user might want to call rxfill |
1020 | * happens on memory-rich NIC, but often on memory-constrained dongle | 1020 | * again asap. This is unlikely to happen on a memory-rich NIC, but often on |
1021 | * memory-constrained dongle. | ||
1021 | */ | 1022 | */ |
1022 | bool dma_rxfill(struct dma_pub *pub) | 1023 | bool dma_rxfill(struct dma_pub *pub) |
1023 | { | 1024 | { |
@@ -1078,6 +1079,8 @@ bool dma_rxfill(struct dma_pub *pub) | |||
1078 | 1079 | ||
1079 | pa = dma_map_single(di->dmadev, p->data, di->rxbufsize, | 1080 | pa = dma_map_single(di->dmadev, p->data, di->rxbufsize, |
1080 | DMA_FROM_DEVICE); | 1081 | DMA_FROM_DEVICE); |
1082 | if (dma_mapping_error(di->dmadev, pa)) | ||
1083 | return false; | ||
1081 | 1084 | ||
1082 | /* save the free packet pointer */ | 1085 | /* save the free packet pointer */ |
1083 | di->rxp[rxout] = p; | 1086 | di->rxp[rxout] = p; |
@@ -1284,7 +1287,11 @@ static void dma_txenq(struct dma_info *di, struct sk_buff *p) | |||
1284 | 1287 | ||
1285 | /* get physical address of buffer start */ | 1288 | /* get physical address of buffer start */ |
1286 | pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE); | 1289 | pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE); |
1287 | 1290 | /* if mapping failed, free skb */ | |
1291 | if (dma_mapping_error(di->dmadev, pa)) { | ||
1292 | brcmu_pkt_buf_free_skb(p); | ||
1293 | return; | ||
1294 | } | ||
1288 | /* With a DMA segment list, Descriptor table is filled | 1295 | /* With a DMA segment list, Descriptor table is filled |
1289 | * using the segment list instead of looping over | 1296 | * using the segment list instead of looping over |
1290 | * buffers in multi-chain DMA. Therefore, EOF for SGLIST | 1297 | * buffers in multi-chain DMA. Therefore, EOF for SGLIST |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 7ca10bf4a4d3..4608e0eb1493 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
@@ -4652,7 +4652,9 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core, | |||
4652 | wlc->band->phyrev = wlc_hw->band->phyrev; | 4652 | wlc->band->phyrev = wlc_hw->band->phyrev; |
4653 | wlc->band->radioid = wlc_hw->band->radioid; | 4653 | wlc->band->radioid = wlc_hw->band->radioid; |
4654 | wlc->band->radiorev = wlc_hw->band->radiorev; | 4654 | wlc->band->radiorev = wlc_hw->band->radiorev; |
4655 | 4655 | brcms_dbg_info(core, "wl%d: phy %u/%u radio %x/%u\n", unit, | |
4656 | wlc->band->phytype, wlc->band->phyrev, | ||
4657 | wlc->band->radioid, wlc->band->radiorev); | ||
4656 | /* default contention windows size limits */ | 4658 | /* default contention windows size limits */ |
4657 | wlc_hw->band->CWmin = APHY_CWMIN; | 4659 | wlc_hw->band->CWmin = APHY_CWMIN; |
4658 | wlc_hw->band->CWmax = PHY_CWMAX; | 4660 | wlc_hw->band->CWmax = PHY_CWMAX; |
@@ -4667,7 +4669,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core, | |||
4667 | brcms_c_coredisable(wlc_hw); | 4669 | brcms_c_coredisable(wlc_hw); |
4668 | 4670 | ||
4669 | /* Match driver "down" state */ | 4671 | /* Match driver "down" state */ |
4670 | ai_pci_down(wlc_hw->sih); | 4672 | bcma_core_pci_down(wlc_hw->d11core->bus); |
4671 | 4673 | ||
4672 | /* turn off pll and xtal to match driver "down" state */ | 4674 | /* turn off pll and xtal to match driver "down" state */ |
4673 | brcms_b_xtal(wlc_hw, OFF); | 4675 | brcms_b_xtal(wlc_hw, OFF); |
@@ -5010,12 +5012,12 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) | |||
5010 | */ | 5012 | */ |
5011 | if (brcms_b_radio_read_hwdisabled(wlc_hw)) { | 5013 | if (brcms_b_radio_read_hwdisabled(wlc_hw)) { |
5012 | /* put SB PCI in down state again */ | 5014 | /* put SB PCI in down state again */ |
5013 | ai_pci_down(wlc_hw->sih); | 5015 | bcma_core_pci_down(wlc_hw->d11core->bus); |
5014 | brcms_b_xtal(wlc_hw, OFF); | 5016 | brcms_b_xtal(wlc_hw, OFF); |
5015 | return -ENOMEDIUM; | 5017 | return -ENOMEDIUM; |
5016 | } | 5018 | } |
5017 | 5019 | ||
5018 | ai_pci_up(wlc_hw->sih); | 5020 | bcma_core_pci_up(wlc_hw->d11core->bus); |
5019 | 5021 | ||
5020 | /* reset the d11 core */ | 5022 | /* reset the d11 core */ |
5021 | brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); | 5023 | brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); |
@@ -5212,7 +5214,7 @@ static int brcms_b_down_finish(struct brcms_hardware *wlc_hw) | |||
5212 | 5214 | ||
5213 | /* turn off primary xtal and pll */ | 5215 | /* turn off primary xtal and pll */ |
5214 | if (!wlc_hw->noreset) { | 5216 | if (!wlc_hw->noreset) { |
5215 | ai_pci_down(wlc_hw->sih); | 5217 | bcma_core_pci_down(wlc_hw->d11core->bus); |
5216 | brcms_b_xtal(wlc_hw, OFF); | 5218 | brcms_b_xtal(wlc_hw, OFF); |
5217 | } | 5219 | } |
5218 | } | 5220 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c index 3d6b16ce4687..b2d6d6da3daf 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | |||
@@ -1137,8 +1137,9 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi, | |||
1137 | gain0_15 = ((biq1 & 0xf) << 12) | | 1137 | gain0_15 = ((biq1 & 0xf) << 12) | |
1138 | ((tia & 0xf) << 8) | | 1138 | ((tia & 0xf) << 8) | |
1139 | ((lna2 & 0x3) << 6) | | 1139 | ((lna2 & 0x3) << 6) | |
1140 | ((lna2 & | 1140 | ((lna2 & 0x3) << 4) | |
1141 | 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0); | 1141 | ((lna1 & 0x3) << 2) | |
1142 | ((lna1 & 0x3) << 0); | ||
1142 | 1143 | ||
1143 | mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); | 1144 | mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); |
1144 | mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); | 1145 | mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); |
@@ -1328,6 +1329,43 @@ static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples) | |||
1328 | return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; | 1329 | return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; |
1329 | } | 1330 | } |
1330 | 1331 | ||
1332 | static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain, | ||
1333 | u16 tia_gain, u16 lna2_gain) | ||
1334 | { | ||
1335 | u32 i_thresh_l, q_thresh_l; | ||
1336 | u32 i_thresh_h, q_thresh_h; | ||
1337 | struct lcnphy_iq_est iq_est_h, iq_est_l; | ||
1338 | |||
1339 | wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain, | ||
1340 | lna2_gain, 0); | ||
1341 | |||
1342 | wlc_lcnphy_rx_gain_override_enable(pi, true); | ||
1343 | wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); | ||
1344 | udelay(500); | ||
1345 | write_radio_reg(pi, RADIO_2064_REG112, 0); | ||
1346 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) | ||
1347 | return false; | ||
1348 | |||
1349 | wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); | ||
1350 | udelay(500); | ||
1351 | write_radio_reg(pi, RADIO_2064_REG112, 0); | ||
1352 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) | ||
1353 | return false; | ||
1354 | |||
1355 | i_thresh_l = (iq_est_l.i_pwr << 1); | ||
1356 | i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr; | ||
1357 | |||
1358 | q_thresh_l = (iq_est_l.q_pwr << 1); | ||
1359 | q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr; | ||
1360 | if ((iq_est_h.i_pwr > i_thresh_l) && | ||
1361 | (iq_est_h.i_pwr < i_thresh_h) && | ||
1362 | (iq_est_h.q_pwr > q_thresh_l) && | ||
1363 | (iq_est_h.q_pwr < q_thresh_h)) | ||
1364 | return true; | ||
1365 | |||
1366 | return false; | ||
1367 | } | ||
1368 | |||
1331 | static bool | 1369 | static bool |
1332 | wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | 1370 | wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, |
1333 | const struct lcnphy_rx_iqcomp *iqcomp, | 1371 | const struct lcnphy_rx_iqcomp *iqcomp, |
@@ -1342,8 +1380,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | |||
1342 | RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, | 1380 | RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, |
1343 | rfoverride3_old, rfoverride3val_old, rfoverride4_old, | 1381 | rfoverride3_old, rfoverride3val_old, rfoverride4_old, |
1344 | rfoverride4val_old, afectrlovr_old, afectrlovrval_old; | 1382 | rfoverride4val_old, afectrlovr_old, afectrlovrval_old; |
1345 | int tia_gain; | 1383 | int tia_gain, lna2_gain, biq1_gain; |
1346 | u32 received_power, rx_pwr_threshold; | 1384 | bool set_gain; |
1347 | u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; | 1385 | u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; |
1348 | u16 values_to_save[11]; | 1386 | u16 values_to_save[11]; |
1349 | s16 *ptr; | 1387 | s16 *ptr; |
@@ -1368,126 +1406,125 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | |||
1368 | goto cal_done; | 1406 | goto cal_done; |
1369 | } | 1407 | } |
1370 | 1408 | ||
1371 | if (module == 1) { | 1409 | WARN_ON(module != 1); |
1410 | tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); | ||
1411 | wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); | ||
1372 | 1412 | ||
1373 | tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); | 1413 | for (i = 0; i < 11; i++) |
1374 | wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); | 1414 | values_to_save[i] = |
1415 | read_radio_reg(pi, rxiq_cal_rf_reg[i]); | ||
1416 | Core1TxControl_old = read_phy_reg(pi, 0x631); | ||
1417 | |||
1418 | or_phy_reg(pi, 0x631, 0x0015); | ||
1419 | |||
1420 | RFOverride0_old = read_phy_reg(pi, 0x44c); | ||
1421 | RFOverrideVal0_old = read_phy_reg(pi, 0x44d); | ||
1422 | rfoverride2_old = read_phy_reg(pi, 0x4b0); | ||
1423 | rfoverride2val_old = read_phy_reg(pi, 0x4b1); | ||
1424 | rfoverride3_old = read_phy_reg(pi, 0x4f9); | ||
1425 | rfoverride3val_old = read_phy_reg(pi, 0x4fa); | ||
1426 | rfoverride4_old = read_phy_reg(pi, 0x938); | ||
1427 | rfoverride4val_old = read_phy_reg(pi, 0x939); | ||
1428 | afectrlovr_old = read_phy_reg(pi, 0x43b); | ||
1429 | afectrlovrval_old = read_phy_reg(pi, 0x43c); | ||
1430 | old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); | ||
1431 | old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); | ||
1375 | 1432 | ||
1376 | for (i = 0; i < 11; i++) | 1433 | tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); |
1377 | values_to_save[i] = | 1434 | if (tx_gain_override_old) { |
1378 | read_radio_reg(pi, rxiq_cal_rf_reg[i]); | 1435 | wlc_lcnphy_get_tx_gain(pi, &old_gains); |
1379 | Core1TxControl_old = read_phy_reg(pi, 0x631); | 1436 | tx_gain_index_old = pi_lcn->lcnphy_current_index; |
1380 | 1437 | } | |
1381 | or_phy_reg(pi, 0x631, 0x0015); | ||
1382 | |||
1383 | RFOverride0_old = read_phy_reg(pi, 0x44c); | ||
1384 | RFOverrideVal0_old = read_phy_reg(pi, 0x44d); | ||
1385 | rfoverride2_old = read_phy_reg(pi, 0x4b0); | ||
1386 | rfoverride2val_old = read_phy_reg(pi, 0x4b1); | ||
1387 | rfoverride3_old = read_phy_reg(pi, 0x4f9); | ||
1388 | rfoverride3val_old = read_phy_reg(pi, 0x4fa); | ||
1389 | rfoverride4_old = read_phy_reg(pi, 0x938); | ||
1390 | rfoverride4val_old = read_phy_reg(pi, 0x939); | ||
1391 | afectrlovr_old = read_phy_reg(pi, 0x43b); | ||
1392 | afectrlovrval_old = read_phy_reg(pi, 0x43c); | ||
1393 | old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); | ||
1394 | old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); | ||
1395 | |||
1396 | tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); | ||
1397 | if (tx_gain_override_old) { | ||
1398 | wlc_lcnphy_get_tx_gain(pi, &old_gains); | ||
1399 | tx_gain_index_old = pi_lcn->lcnphy_current_index; | ||
1400 | } | ||
1401 | 1438 | ||
1402 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); | 1439 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); |
1403 | 1440 | ||
1404 | mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); | 1441 | mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); |
1405 | mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); | 1442 | mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); |
1406 | 1443 | ||
1407 | mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); | 1444 | mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); |
1408 | mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); | 1445 | mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); |
1409 | 1446 | ||
1410 | write_radio_reg(pi, RADIO_2064_REG116, 0x06); | 1447 | write_radio_reg(pi, RADIO_2064_REG116, 0x06); |
1411 | write_radio_reg(pi, RADIO_2064_REG12C, 0x07); | 1448 | write_radio_reg(pi, RADIO_2064_REG12C, 0x07); |
1412 | write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); | 1449 | write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); |
1413 | write_radio_reg(pi, RADIO_2064_REG098, 0x03); | 1450 | write_radio_reg(pi, RADIO_2064_REG098, 0x03); |
1414 | write_radio_reg(pi, RADIO_2064_REG00B, 0x7); | 1451 | write_radio_reg(pi, RADIO_2064_REG00B, 0x7); |
1415 | mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); | 1452 | mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); |
1416 | write_radio_reg(pi, RADIO_2064_REG01D, 0x01); | 1453 | write_radio_reg(pi, RADIO_2064_REG01D, 0x01); |
1417 | write_radio_reg(pi, RADIO_2064_REG114, 0x01); | 1454 | write_radio_reg(pi, RADIO_2064_REG114, 0x01); |
1418 | write_radio_reg(pi, RADIO_2064_REG02E, 0x10); | 1455 | write_radio_reg(pi, RADIO_2064_REG02E, 0x10); |
1419 | write_radio_reg(pi, RADIO_2064_REG12A, 0x08); | 1456 | write_radio_reg(pi, RADIO_2064_REG12A, 0x08); |
1420 | 1457 | ||
1421 | mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); | 1458 | mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); |
1422 | mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); | 1459 | mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); |
1423 | mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); | 1460 | mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); |
1424 | mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); | 1461 | mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); |
1425 | mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); | 1462 | mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); |
1426 | mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); | 1463 | mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); |
1427 | mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); | 1464 | mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); |
1428 | mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); | 1465 | mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); |
1429 | mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); | 1466 | mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); |
1430 | mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); | 1467 | mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); |
1431 | |||
1432 | mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); | ||
1433 | mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); | ||
1434 | |||
1435 | wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0); | ||
1436 | write_phy_reg(pi, 0x6da, 0xffff); | ||
1437 | or_phy_reg(pi, 0x6db, 0x3); | ||
1438 | wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); | ||
1439 | wlc_lcnphy_rx_gain_override_enable(pi, true); | ||
1440 | |||
1441 | tia_gain = 8; | ||
1442 | rx_pwr_threshold = 950; | ||
1443 | while (tia_gain > 0) { | ||
1444 | tia_gain -= 1; | ||
1445 | wlc_lcnphy_set_rx_gain_by_distribution(pi, | ||
1446 | 0, 0, 2, 2, | ||
1447 | (u16) | ||
1448 | tia_gain, 1, 0); | ||
1449 | udelay(500); | ||
1450 | 1468 | ||
1451 | received_power = | 1469 | mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); |
1452 | wlc_lcnphy_measure_digital_power(pi, 2000); | 1470 | mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); |
1453 | if (received_power < rx_pwr_threshold) | ||
1454 | break; | ||
1455 | } | ||
1456 | result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff); | ||
1457 | 1471 | ||
1458 | wlc_lcnphy_stop_tx_tone(pi); | 1472 | write_phy_reg(pi, 0x6da, 0xffff); |
1473 | or_phy_reg(pi, 0x6db, 0x3); | ||
1474 | |||
1475 | wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); | ||
1476 | for (lna2_gain = 3; lna2_gain >= 0; lna2_gain--) { | ||
1477 | for (tia_gain = 4; tia_gain >= 0; tia_gain--) { | ||
1478 | for (biq1_gain = 6; biq1_gain >= 0; biq1_gain--) { | ||
1479 | set_gain = wlc_lcnphy_rx_iq_cal_gain(pi, | ||
1480 | (u16) | ||
1481 | biq1_gain, | ||
1482 | (u16) | ||
1483 | tia_gain, | ||
1484 | (u16) | ||
1485 | lna2_gain); | ||
1486 | if (!set_gain) | ||
1487 | continue; | ||
1488 | |||
1489 | result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024); | ||
1490 | goto stop_tone; | ||
1491 | } | ||
1492 | } | ||
1493 | } | ||
1459 | 1494 | ||
1460 | write_phy_reg(pi, 0x631, Core1TxControl_old); | 1495 | stop_tone: |
1496 | wlc_lcnphy_stop_tx_tone(pi); | ||
1461 | 1497 | ||
1462 | write_phy_reg(pi, 0x44c, RFOverrideVal0_old); | 1498 | write_phy_reg(pi, 0x631, Core1TxControl_old); |
1463 | write_phy_reg(pi, 0x44d, RFOverrideVal0_old); | 1499 | |
1464 | write_phy_reg(pi, 0x4b0, rfoverride2_old); | 1500 | write_phy_reg(pi, 0x44c, RFOverrideVal0_old); |
1465 | write_phy_reg(pi, 0x4b1, rfoverride2val_old); | 1501 | write_phy_reg(pi, 0x44d, RFOverrideVal0_old); |
1466 | write_phy_reg(pi, 0x4f9, rfoverride3_old); | 1502 | write_phy_reg(pi, 0x4b0, rfoverride2_old); |
1467 | write_phy_reg(pi, 0x4fa, rfoverride3val_old); | 1503 | write_phy_reg(pi, 0x4b1, rfoverride2val_old); |
1468 | write_phy_reg(pi, 0x938, rfoverride4_old); | 1504 | write_phy_reg(pi, 0x4f9, rfoverride3_old); |
1469 | write_phy_reg(pi, 0x939, rfoverride4val_old); | 1505 | write_phy_reg(pi, 0x4fa, rfoverride3val_old); |
1470 | write_phy_reg(pi, 0x43b, afectrlovr_old); | 1506 | write_phy_reg(pi, 0x938, rfoverride4_old); |
1471 | write_phy_reg(pi, 0x43c, afectrlovrval_old); | 1507 | write_phy_reg(pi, 0x939, rfoverride4val_old); |
1472 | write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); | 1508 | write_phy_reg(pi, 0x43b, afectrlovr_old); |
1473 | write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); | 1509 | write_phy_reg(pi, 0x43c, afectrlovrval_old); |
1510 | write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); | ||
1511 | write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); | ||
1474 | 1512 | ||
1475 | wlc_lcnphy_clear_trsw_override(pi); | 1513 | wlc_lcnphy_clear_trsw_override(pi); |
1476 | 1514 | ||
1477 | mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); | 1515 | mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); |
1478 | 1516 | ||
1479 | for (i = 0; i < 11; i++) | 1517 | for (i = 0; i < 11; i++) |
1480 | write_radio_reg(pi, rxiq_cal_rf_reg[i], | 1518 | write_radio_reg(pi, rxiq_cal_rf_reg[i], |
1481 | values_to_save[i]); | 1519 | values_to_save[i]); |
1482 | 1520 | ||
1483 | if (tx_gain_override_old) | 1521 | if (tx_gain_override_old) |
1484 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); | 1522 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); |
1485 | else | 1523 | else |
1486 | wlc_lcnphy_disable_tx_gain_override(pi); | 1524 | wlc_lcnphy_disable_tx_gain_override(pi); |
1487 | 1525 | ||
1488 | wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); | 1526 | wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); |
1489 | wlc_lcnphy_rx_gain_override_enable(pi, false); | 1527 | wlc_lcnphy_rx_gain_override_enable(pi, false); |
1490 | } | ||
1491 | 1528 | ||
1492 | cal_done: | 1529 | cal_done: |
1493 | kfree(ptr); | 1530 | kfree(ptr); |
@@ -1789,6 +1826,19 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel) | |||
1789 | write_radio_reg(pi, RADIO_2064_REG038, 3); | 1826 | write_radio_reg(pi, RADIO_2064_REG038, 3); |
1790 | write_radio_reg(pi, RADIO_2064_REG091, 7); | 1827 | write_radio_reg(pi, RADIO_2064_REG091, 7); |
1791 | } | 1828 | } |
1829 | |||
1830 | if (!(pi->sh->boardflags & BFL_FEM)) { | ||
1831 | static const u8 reg038[14] = { | ||
1832 | 0xd, 0xe, 0xd, 0xd, 0xd, 0xc, 0xa, | ||
1833 | 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0 | ||
1834 | }; | ||
1835 | |||
1836 | write_radio_reg(pi, RADIO_2064_REG02A, 0xf); | ||
1837 | write_radio_reg(pi, RADIO_2064_REG091, 0x3); | ||
1838 | write_radio_reg(pi, RADIO_2064_REG038, 0x3); | ||
1839 | |||
1840 | write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]); | ||
1841 | } | ||
1792 | } | 1842 | } |
1793 | 1843 | ||
1794 | static int | 1844 | static int |
@@ -1983,6 +2033,16 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos) | |||
1983 | } else { | 2033 | } else { |
1984 | mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); | 2034 | mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); |
1985 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); | 2035 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); |
2036 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0); | ||
2037 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2); | ||
2038 | mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0); | ||
2039 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4); | ||
2040 | mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); | ||
2041 | mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77); | ||
2042 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1); | ||
2043 | mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7); | ||
2044 | mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1); | ||
2045 | mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4); | ||
1986 | } | 2046 | } |
1987 | } else { | 2047 | } else { |
1988 | mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); | 2048 | mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); |
@@ -2069,13 +2129,23 @@ static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi) | |||
2069 | (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); | 2129 | (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); |
2070 | 2130 | ||
2071 | mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); | 2131 | mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); |
2132 | mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0)); | ||
2072 | } | 2133 | } |
2073 | 2134 | ||
2074 | static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | 2135 | static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) |
2075 | { | 2136 | { |
2076 | struct phytbl_info tab; | 2137 | struct phytbl_info tab; |
2077 | u32 rfseq, ind; | 2138 | u32 rfseq, ind; |
2139 | enum lcnphy_tssi_mode mode; | ||
2140 | u8 tssi_sel; | ||
2078 | 2141 | ||
2142 | if (pi->sh->boardflags & BFL_FEM) { | ||
2143 | tssi_sel = 0x1; | ||
2144 | mode = LCNPHY_TSSI_EXT; | ||
2145 | } else { | ||
2146 | tssi_sel = 0xe; | ||
2147 | mode = LCNPHY_TSSI_POST_PA; | ||
2148 | } | ||
2079 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; | 2149 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; |
2080 | tab.tbl_width = 32; | 2150 | tab.tbl_width = 32; |
2081 | tab.tbl_ptr = &ind; | 2151 | tab.tbl_ptr = &ind; |
@@ -2096,7 +2166,7 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2096 | 2166 | ||
2097 | mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); | 2167 | mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); |
2098 | 2168 | ||
2099 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); | 2169 | wlc_lcnphy_set_tssi_mux(pi, mode); |
2100 | mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); | 2170 | mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); |
2101 | 2171 | ||
2102 | mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); | 2172 | mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); |
@@ -2132,9 +2202,10 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2132 | mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); | 2202 | mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); |
2133 | 2203 | ||
2134 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { | 2204 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { |
2135 | mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe); | 2205 | mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel); |
2136 | mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); | 2206 | mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); |
2137 | } else { | 2207 | } else { |
2208 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1); | ||
2138 | mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); | 2209 | mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); |
2139 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); | 2210 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); |
2140 | } | 2211 | } |
@@ -2181,6 +2252,10 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2181 | 2252 | ||
2182 | mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); | 2253 | mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); |
2183 | 2254 | ||
2255 | mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0); | ||
2256 | mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); | ||
2257 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); | ||
2258 | |||
2184 | wlc_lcnphy_pwrctrl_rssiparams(pi); | 2259 | wlc_lcnphy_pwrctrl_rssiparams(pi); |
2185 | } | 2260 | } |
2186 | 2261 | ||
@@ -2799,6 +2874,8 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2799 | read_radio_reg(pi, RADIO_2064_REG007) & 1; | 2874 | read_radio_reg(pi, RADIO_2064_REG007) & 1; |
2800 | u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; | 2875 | u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; |
2801 | u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; | 2876 | u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; |
2877 | u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi); | ||
2878 | |||
2802 | idleTssi = read_phy_reg(pi, 0x4ab); | 2879 | idleTssi = read_phy_reg(pi, 0x4ab); |
2803 | suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & | 2880 | suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & |
2804 | MCTL_EN_MAC)); | 2881 | MCTL_EN_MAC)); |
@@ -2816,6 +2893,12 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2816 | mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); | 2893 | mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); |
2817 | mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); | 2894 | mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); |
2818 | wlc_lcnphy_tssi_setup(pi); | 2895 | wlc_lcnphy_tssi_setup(pi); |
2896 | |||
2897 | mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0)); | ||
2898 | mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6)); | ||
2899 | |||
2900 | wlc_lcnphy_set_bbmult(pi, 0x0); | ||
2901 | |||
2819 | wlc_phy_do_dummy_tx(pi, true, OFF); | 2902 | wlc_phy_do_dummy_tx(pi, true, OFF); |
2820 | idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) | 2903 | idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) |
2821 | >> 0); | 2904 | >> 0); |
@@ -2837,6 +2920,7 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2837 | 2920 | ||
2838 | mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); | 2921 | mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); |
2839 | 2922 | ||
2923 | wlc_lcnphy_set_bbmult(pi, SAVE_bbmult); | ||
2840 | wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); | 2924 | wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); |
2841 | wlc_lcnphy_set_tx_gain(pi, &old_gains); | 2925 | wlc_lcnphy_set_tx_gain(pi, &old_gains); |
2842 | wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); | 2926 | wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); |
@@ -3050,6 +3134,11 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi) | |||
3050 | wlc_lcnphy_write_table(pi, &tab); | 3134 | wlc_lcnphy_write_table(pi, &tab); |
3051 | tab.tbl_offset++; | 3135 | tab.tbl_offset++; |
3052 | } | 3136 | } |
3137 | mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0); | ||
3138 | mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0); | ||
3139 | mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8); | ||
3140 | mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4); | ||
3141 | mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2); | ||
3053 | 3142 | ||
3054 | mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); | 3143 | mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); |
3055 | 3144 | ||
@@ -3851,7 +3940,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) | |||
3851 | target_gains.pad_gain = 21; | 3940 | target_gains.pad_gain = 21; |
3852 | target_gains.dac_gain = 0; | 3941 | target_gains.dac_gain = 0; |
3853 | wlc_lcnphy_set_tx_gain(pi, &target_gains); | 3942 | wlc_lcnphy_set_tx_gain(pi, &target_gains); |
3854 | wlc_lcnphy_set_tx_pwr_by_index(pi, 16); | ||
3855 | 3943 | ||
3856 | if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { | 3944 | if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { |
3857 | 3945 | ||
@@ -3862,6 +3950,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) | |||
3862 | lcnphy_recal ? LCNPHY_CAL_RECAL : | 3950 | lcnphy_recal ? LCNPHY_CAL_RECAL : |
3863 | LCNPHY_CAL_FULL), false); | 3951 | LCNPHY_CAL_FULL), false); |
3864 | } else { | 3952 | } else { |
3953 | wlc_lcnphy_set_tx_pwr_by_index(pi, 16); | ||
3865 | wlc_lcnphy_tx_iqlo_soft_cal_full(pi); | 3954 | wlc_lcnphy_tx_iqlo_soft_cal_full(pi); |
3866 | } | 3955 | } |
3867 | 3956 | ||
@@ -4283,20 +4372,20 @@ wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi, | |||
4283 | u16 pa_gain; | 4372 | u16 pa_gain; |
4284 | u16 gm_gain; | 4373 | u16 gm_gain; |
4285 | 4374 | ||
4286 | if (CHSPEC_IS5G(pi->radio_chanspec)) | ||
4287 | pa_gain = 0x70; | ||
4288 | else | ||
4289 | pa_gain = 0x70; | ||
4290 | |||
4291 | if (pi->sh->boardflags & BFL_FEM) | 4375 | if (pi->sh->boardflags & BFL_FEM) |
4292 | pa_gain = 0x10; | 4376 | pa_gain = 0x10; |
4377 | else | ||
4378 | pa_gain = 0x60; | ||
4293 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; | 4379 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; |
4294 | tab.tbl_width = 32; | 4380 | tab.tbl_width = 32; |
4295 | tab.tbl_len = 1; | 4381 | tab.tbl_len = 1; |
4296 | tab.tbl_ptr = &val; | 4382 | tab.tbl_ptr = &val; |
4297 | 4383 | ||
4384 | /* fixed gm_gain value for iPA */ | ||
4385 | gm_gain = 15; | ||
4298 | for (j = 0; j < 128; j++) { | 4386 | for (j = 0; j < 128; j++) { |
4299 | gm_gain = gain_table[j].gm; | 4387 | if (pi->sh->boardflags & BFL_FEM) |
4388 | gm_gain = gain_table[j].gm; | ||
4300 | val = (((u32) pa_gain << 24) | | 4389 | val = (((u32) pa_gain << 24) | |
4301 | (gain_table[j].pad << 16) | | 4390 | (gain_table[j].pad << 16) | |
4302 | (gain_table[j].pga << 8) | gm_gain); | 4391 | (gain_table[j].pga << 8) | gm_gain); |
@@ -4507,7 +4596,10 @@ static void wlc_radio_2064_init(struct brcms_phy *pi) | |||
4507 | 4596 | ||
4508 | write_phy_reg(pi, 0x4ea, 0x4688); | 4597 | write_phy_reg(pi, 0x4ea, 0x4688); |
4509 | 4598 | ||
4510 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); | 4599 | if (pi->sh->boardflags & BFL_FEM) |
4600 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); | ||
4601 | else | ||
4602 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0); | ||
4511 | 4603 | ||
4512 | mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); | 4604 | mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); |
4513 | 4605 | ||
@@ -4518,6 +4610,13 @@ static void wlc_radio_2064_init(struct brcms_phy *pi) | |||
4518 | wlc_lcnphy_rcal(pi); | 4610 | wlc_lcnphy_rcal(pi); |
4519 | 4611 | ||
4520 | wlc_lcnphy_rc_cal(pi); | 4612 | wlc_lcnphy_rc_cal(pi); |
4613 | |||
4614 | if (!(pi->sh->boardflags & BFL_FEM)) { | ||
4615 | write_radio_reg(pi, RADIO_2064_REG032, 0x6f); | ||
4616 | write_radio_reg(pi, RADIO_2064_REG033, 0x19); | ||
4617 | write_radio_reg(pi, RADIO_2064_REG039, 0xe); | ||
4618 | } | ||
4619 | |||
4521 | } | 4620 | } |
4522 | 4621 | ||
4523 | static void wlc_lcnphy_radio_init(struct brcms_phy *pi) | 4622 | static void wlc_lcnphy_radio_init(struct brcms_phy *pi) |
@@ -4530,6 +4629,7 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi) | |||
4530 | uint idx; | 4629 | uint idx; |
4531 | u8 phybw40; | 4630 | u8 phybw40; |
4532 | struct phytbl_info tab; | 4631 | struct phytbl_info tab; |
4632 | const struct phytbl_info *tb; | ||
4533 | u32 val; | 4633 | u32 val; |
4534 | 4634 | ||
4535 | phybw40 = CHSPEC_IS40(pi->radio_chanspec); | 4635 | phybw40 = CHSPEC_IS40(pi->radio_chanspec); |
@@ -4547,22 +4647,20 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi) | |||
4547 | wlc_lcnphy_write_table(pi, &tab); | 4647 | wlc_lcnphy_write_table(pi, &tab); |
4548 | } | 4648 | } |
4549 | 4649 | ||
4550 | tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; | 4650 | if (!(pi->sh->boardflags & BFL_FEM)) { |
4551 | tab.tbl_width = 16; | 4651 | tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; |
4552 | tab.tbl_ptr = &val; | 4652 | tab.tbl_width = 16; |
4553 | tab.tbl_len = 1; | 4653 | tab.tbl_ptr = &val; |
4554 | 4654 | tab.tbl_len = 1; | |
4555 | val = 114; | ||
4556 | tab.tbl_offset = 0; | ||
4557 | wlc_lcnphy_write_table(pi, &tab); | ||
4558 | 4655 | ||
4559 | val = 130; | 4656 | val = 150; |
4560 | tab.tbl_offset = 1; | 4657 | tab.tbl_offset = 0; |
4561 | wlc_lcnphy_write_table(pi, &tab); | 4658 | wlc_lcnphy_write_table(pi, &tab); |
4562 | 4659 | ||
4563 | val = 6; | 4660 | val = 220; |
4564 | tab.tbl_offset = 8; | 4661 | tab.tbl_offset = 1; |
4565 | wlc_lcnphy_write_table(pi, &tab); | 4662 | wlc_lcnphy_write_table(pi, &tab); |
4663 | } | ||
4566 | 4664 | ||
4567 | if (CHSPEC_IS2G(pi->radio_chanspec)) { | 4665 | if (CHSPEC_IS2G(pi->radio_chanspec)) { |
4568 | if (pi->sh->boardflags & BFL_FEM) | 4666 | if (pi->sh->boardflags & BFL_FEM) |
@@ -4576,7 +4674,6 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi) | |||
4576 | } | 4674 | } |
4577 | 4675 | ||
4578 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { | 4676 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { |
4579 | const struct phytbl_info *tb; | ||
4580 | int l; | 4677 | int l; |
4581 | 4678 | ||
4582 | if (CHSPEC_IS2G(pi->radio_chanspec)) { | 4679 | if (CHSPEC_IS2G(pi->radio_chanspec)) { |
@@ -4597,21 +4694,22 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi) | |||
4597 | wlc_lcnphy_write_table(pi, &tb[idx]); | 4694 | wlc_lcnphy_write_table(pi, &tb[idx]); |
4598 | } | 4695 | } |
4599 | 4696 | ||
4600 | if ((pi->sh->boardflags & BFL_FEM) | 4697 | if (pi->sh->boardflags & BFL_FEM) { |
4601 | && !(pi->sh->boardflags & BFL_FEM_BT)) | 4698 | if (pi->sh->boardflags & BFL_FEM_BT) { |
4602 | wlc_lcnphy_write_table(pi, &dot11lcn_sw_ctrl_tbl_info_4313_epa); | 4699 | if (pi->sh->boardrev < 0x1250) |
4603 | else if (pi->sh->boardflags & BFL_FEM_BT) { | 4700 | tb = &dot11lcn_sw_ctrl_tbl_info_4313_bt_epa; |
4604 | if (pi->sh->boardrev < 0x1250) | 4701 | else |
4605 | wlc_lcnphy_write_table( | 4702 | tb = &dot11lcn_sw_ctrl_tbl_info_4313_bt_epa_p250; |
4606 | pi, | 4703 | } else { |
4607 | &dot11lcn_sw_ctrl_tbl_info_4313_bt_epa); | 4704 | tb = &dot11lcn_sw_ctrl_tbl_info_4313_epa; |
4705 | } | ||
4706 | } else { | ||
4707 | if (pi->sh->boardflags & BFL_FEM_BT) | ||
4708 | tb = &dot11lcn_sw_ctrl_tbl_info_4313_bt_ipa; | ||
4608 | else | 4709 | else |
4609 | wlc_lcnphy_write_table( | 4710 | tb = &dot11lcn_sw_ctrl_tbl_info_4313; |
4610 | pi, | 4711 | } |
4611 | &dot11lcn_sw_ctrl_tbl_info_4313_bt_epa_p250); | 4712 | wlc_lcnphy_write_table(pi, tb); |
4612 | } else | ||
4613 | wlc_lcnphy_write_table(pi, &dot11lcn_sw_ctrl_tbl_info_4313); | ||
4614 | |||
4615 | wlc_lcnphy_load_rfpower(pi); | 4713 | wlc_lcnphy_load_rfpower(pi); |
4616 | 4714 | ||
4617 | wlc_lcnphy_clear_papd_comptable(pi); | 4715 | wlc_lcnphy_clear_papd_comptable(pi); |
@@ -4955,6 +5053,8 @@ void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec) | |||
4955 | wlc_lcnphy_load_tx_iir_filter(pi, true, 3); | 5053 | wlc_lcnphy_load_tx_iir_filter(pi, true, 3); |
4956 | 5054 | ||
4957 | mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); | 5055 | mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); |
5056 | if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi)) | ||
5057 | wlc_lcnphy_tssi_setup(pi); | ||
4958 | } | 5058 | } |
4959 | 5059 | ||
4960 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi) | 5060 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi) |
@@ -4993,8 +5093,7 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) | |||
4993 | if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) | 5093 | if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) |
4994 | return false; | 5094 | return false; |
4995 | 5095 | ||
4996 | if ((pi->sh->boardflags & BFL_FEM) && | 5096 | if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { |
4997 | (LCNREV_IS(pi->pubpi.phy_rev, 1))) { | ||
4998 | if (pi_lcn->lcnphy_tempsense_option == 3) { | 5097 | if (pi_lcn->lcnphy_tempsense_option == 3) { |
4999 | pi->hwpwrctrl = true; | 5098 | pi->hwpwrctrl = true; |
5000 | pi->hwpwrctrl_capable = true; | 5099 | pi->hwpwrctrl_capable = true; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c index 622c01ca72c5..d7fa312214f3 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c | |||
@@ -1507,117 +1507,103 @@ static const u32 dot11lcn_gain_tbl_5G[] = { | |||
1507 | 1507 | ||
1508 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev0[] = { | 1508 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev0[] = { |
1509 | {&dot11lcn_gain_tbl_rev0, | 1509 | {&dot11lcn_gain_tbl_rev0, |
1510 | sizeof(dot11lcn_gain_tbl_rev0) / sizeof(dot11lcn_gain_tbl_rev0[0]), 18, | 1510 | ARRAY_SIZE(dot11lcn_gain_tbl_rev0), 18, |
1511 | 0, 32} | 1511 | 0, 32} |
1512 | , | 1512 | , |
1513 | {&dot11lcn_aux_gain_idx_tbl_rev0, | 1513 | {&dot11lcn_aux_gain_idx_tbl_rev0, |
1514 | sizeof(dot11lcn_aux_gain_idx_tbl_rev0) / | 1514 | ARRAY_SIZE(dot11lcn_aux_gain_idx_tbl_rev0), 14, 0, 16} |
1515 | sizeof(dot11lcn_aux_gain_idx_tbl_rev0[0]), 14, 0, 16} | ||
1516 | , | 1515 | , |
1517 | {&dot11lcn_gain_idx_tbl_rev0, | 1516 | {&dot11lcn_gain_idx_tbl_rev0, |
1518 | sizeof(dot11lcn_gain_idx_tbl_rev0) / | 1517 | ARRAY_SIZE(dot11lcn_gain_idx_tbl_rev0), 13, 0, 32} |
1519 | sizeof(dot11lcn_gain_idx_tbl_rev0[0]), 13, 0, 32} | ||
1520 | , | 1518 | , |
1521 | }; | 1519 | }; |
1522 | 1520 | ||
1523 | static const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev1[] = { | 1521 | static const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev1[] = { |
1524 | {&dot11lcn_gain_tbl_rev1, | 1522 | {&dot11lcn_gain_tbl_rev1, |
1525 | sizeof(dot11lcn_gain_tbl_rev1) / sizeof(dot11lcn_gain_tbl_rev1[0]), 18, | 1523 | ARRAY_SIZE(dot11lcn_gain_tbl_rev1), 18, |
1526 | 0, 32} | 1524 | 0, 32} |
1527 | , | 1525 | , |
1528 | {&dot11lcn_aux_gain_idx_tbl_rev0, | 1526 | {&dot11lcn_aux_gain_idx_tbl_rev0, |
1529 | sizeof(dot11lcn_aux_gain_idx_tbl_rev0) / | 1527 | ARRAY_SIZE(dot11lcn_aux_gain_idx_tbl_rev0), 14, 0, 16} |
1530 | sizeof(dot11lcn_aux_gain_idx_tbl_rev0[0]), 14, 0, 16} | ||
1531 | , | 1528 | , |
1532 | {&dot11lcn_gain_idx_tbl_rev0, | 1529 | {&dot11lcn_gain_idx_tbl_rev0, |
1533 | sizeof(dot11lcn_gain_idx_tbl_rev0) / | 1530 | ARRAY_SIZE(dot11lcn_gain_idx_tbl_rev0), 13, 0, 32} |
1534 | sizeof(dot11lcn_gain_idx_tbl_rev0[0]), 13, 0, 32} | ||
1535 | , | 1531 | , |
1536 | }; | 1532 | }; |
1537 | 1533 | ||
1538 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_2G_rev2[] = { | 1534 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_2G_rev2[] = { |
1539 | {&dot11lcn_gain_tbl_2G, | 1535 | {&dot11lcn_gain_tbl_2G, |
1540 | sizeof(dot11lcn_gain_tbl_2G) / sizeof(dot11lcn_gain_tbl_2G[0]), 18, 0, | 1536 | ARRAY_SIZE(dot11lcn_gain_tbl_2G), 18, 0, |
1541 | 32} | 1537 | 32} |
1542 | , | 1538 | , |
1543 | {&dot11lcn_aux_gain_idx_tbl_2G, | 1539 | {&dot11lcn_aux_gain_idx_tbl_2G, |
1544 | sizeof(dot11lcn_aux_gain_idx_tbl_2G) / | 1540 | ARRAY_SIZE(dot11lcn_aux_gain_idx_tbl_2G), 14, 0, 16} |
1545 | sizeof(dot11lcn_aux_gain_idx_tbl_2G[0]), 14, 0, 16} | ||
1546 | , | 1541 | , |
1547 | {&dot11lcn_gain_idx_tbl_2G, | 1542 | {&dot11lcn_gain_idx_tbl_2G, |
1548 | sizeof(dot11lcn_gain_idx_tbl_2G) / sizeof(dot11lcn_gain_idx_tbl_2G[0]), | 1543 | ARRAY_SIZE(dot11lcn_gain_idx_tbl_2G), |
1549 | 13, 0, 32} | 1544 | 13, 0, 32} |
1550 | , | 1545 | , |
1551 | {&dot11lcn_gain_val_tbl_2G, | 1546 | {&dot11lcn_gain_val_tbl_2G, |
1552 | sizeof(dot11lcn_gain_val_tbl_2G) / sizeof(dot11lcn_gain_val_tbl_2G[0]), | 1547 | ARRAY_SIZE(dot11lcn_gain_val_tbl_2G), |
1553 | 17, 0, 8} | 1548 | 17, 0, 8} |
1554 | }; | 1549 | }; |
1555 | 1550 | ||
1556 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_5G_rev2[] = { | 1551 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_5G_rev2[] = { |
1557 | {&dot11lcn_gain_tbl_5G, | 1552 | {&dot11lcn_gain_tbl_5G, |
1558 | sizeof(dot11lcn_gain_tbl_5G) / sizeof(dot11lcn_gain_tbl_5G[0]), 18, 0, | 1553 | ARRAY_SIZE(dot11lcn_gain_tbl_5G), 18, 0, |
1559 | 32} | 1554 | 32} |
1560 | , | 1555 | , |
1561 | {&dot11lcn_aux_gain_idx_tbl_5G, | 1556 | {&dot11lcn_aux_gain_idx_tbl_5G, |
1562 | sizeof(dot11lcn_aux_gain_idx_tbl_5G) / | 1557 | ARRAY_SIZE(dot11lcn_aux_gain_idx_tbl_5G), 14, 0, 16} |
1563 | sizeof(dot11lcn_aux_gain_idx_tbl_5G[0]), 14, 0, 16} | ||
1564 | , | 1558 | , |
1565 | {&dot11lcn_gain_idx_tbl_5G, | 1559 | {&dot11lcn_gain_idx_tbl_5G, |
1566 | sizeof(dot11lcn_gain_idx_tbl_5G) / sizeof(dot11lcn_gain_idx_tbl_5G[0]), | 1560 | ARRAY_SIZE(dot11lcn_gain_idx_tbl_5G), |
1567 | 13, 0, 32} | 1561 | 13, 0, 32} |
1568 | , | 1562 | , |
1569 | {&dot11lcn_gain_val_tbl_5G, | 1563 | {&dot11lcn_gain_val_tbl_5G, |
1570 | sizeof(dot11lcn_gain_val_tbl_5G) / sizeof(dot11lcn_gain_val_tbl_5G[0]), | 1564 | ARRAY_SIZE(dot11lcn_gain_val_tbl_5G), |
1571 | 17, 0, 8} | 1565 | 17, 0, 8} |
1572 | }; | 1566 | }; |
1573 | 1567 | ||
1574 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_2G_rev2[] = { | 1568 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_2G_rev2[] = { |
1575 | {&dot11lcn_gain_tbl_extlna_2G, | 1569 | {&dot11lcn_gain_tbl_extlna_2G, |
1576 | sizeof(dot11lcn_gain_tbl_extlna_2G) / | 1570 | ARRAY_SIZE(dot11lcn_gain_tbl_extlna_2G), 18, 0, 32} |
1577 | sizeof(dot11lcn_gain_tbl_extlna_2G[0]), 18, 0, 32} | ||
1578 | , | 1571 | , |
1579 | {&dot11lcn_aux_gain_idx_tbl_extlna_2G, | 1572 | {&dot11lcn_aux_gain_idx_tbl_extlna_2G, |
1580 | sizeof(dot11lcn_aux_gain_idx_tbl_extlna_2G) / | 1573 | ARRAY_SIZE(dot11lcn_aux_gain_idx_tbl_extlna_2G), 14, 0, 16} |
1581 | sizeof(dot11lcn_aux_gain_idx_tbl_extlna_2G[0]), 14, 0, 16} | ||
1582 | , | 1574 | , |
1583 | {&dot11lcn_gain_idx_tbl_extlna_2G, | 1575 | {&dot11lcn_gain_idx_tbl_extlna_2G, |
1584 | sizeof(dot11lcn_gain_idx_tbl_extlna_2G) / | 1576 | ARRAY_SIZE(dot11lcn_gain_idx_tbl_extlna_2G), 13, 0, 32} |
1585 | sizeof(dot11lcn_gain_idx_tbl_extlna_2G[0]), 13, 0, 32} | ||
1586 | , | 1577 | , |
1587 | {&dot11lcn_gain_val_tbl_extlna_2G, | 1578 | {&dot11lcn_gain_val_tbl_extlna_2G, |
1588 | sizeof(dot11lcn_gain_val_tbl_extlna_2G) / | 1579 | ARRAY_SIZE(dot11lcn_gain_val_tbl_extlna_2G), 17, 0, 8} |
1589 | sizeof(dot11lcn_gain_val_tbl_extlna_2G[0]), 17, 0, 8} | ||
1590 | }; | 1580 | }; |
1591 | 1581 | ||
1592 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_5G_rev2[] = { | 1582 | const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_5G_rev2[] = { |
1593 | {&dot11lcn_gain_tbl_5G, | 1583 | {&dot11lcn_gain_tbl_5G, |
1594 | sizeof(dot11lcn_gain_tbl_5G) / sizeof(dot11lcn_gain_tbl_5G[0]), 18, 0, | 1584 | ARRAY_SIZE(dot11lcn_gain_tbl_5G), 18, 0, |
1595 | 32} | 1585 | 32} |
1596 | , | 1586 | , |
1597 | {&dot11lcn_aux_gain_idx_tbl_5G, | 1587 | {&dot11lcn_aux_gain_idx_tbl_5G, |
1598 | sizeof(dot11lcn_aux_gain_idx_tbl_5G) / | 1588 | ARRAY_SIZE(dot11lcn_aux_gain_idx_tbl_5G), 14, 0, 16} |
1599 | sizeof(dot11lcn_aux_gain_idx_tbl_5G[0]), 14, 0, 16} | ||
1600 | , | 1589 | , |
1601 | {&dot11lcn_gain_idx_tbl_5G, | 1590 | {&dot11lcn_gain_idx_tbl_5G, |
1602 | sizeof(dot11lcn_gain_idx_tbl_5G) / sizeof(dot11lcn_gain_idx_tbl_5G[0]), | 1591 | ARRAY_SIZE(dot11lcn_gain_idx_tbl_5G), |
1603 | 13, 0, 32} | 1592 | 13, 0, 32} |
1604 | , | 1593 | , |
1605 | {&dot11lcn_gain_val_tbl_5G, | 1594 | {&dot11lcn_gain_val_tbl_5G, |
1606 | sizeof(dot11lcn_gain_val_tbl_5G) / sizeof(dot11lcn_gain_val_tbl_5G[0]), | 1595 | ARRAY_SIZE(dot11lcn_gain_val_tbl_5G), |
1607 | 17, 0, 8} | 1596 | 17, 0, 8} |
1608 | }; | 1597 | }; |
1609 | 1598 | ||
1610 | const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 = | 1599 | const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 = |
1611 | sizeof(dot11lcnphytbl_rx_gain_info_rev0) / | 1600 | ARRAY_SIZE(dot11lcnphytbl_rx_gain_info_rev0); |
1612 | sizeof(dot11lcnphytbl_rx_gain_info_rev0[0]); | ||
1613 | 1601 | ||
1614 | const u32 dot11lcnphytbl_rx_gain_info_2G_rev2_sz = | 1602 | const u32 dot11lcnphytbl_rx_gain_info_2G_rev2_sz = |
1615 | sizeof(dot11lcnphytbl_rx_gain_info_2G_rev2) / | 1603 | ARRAY_SIZE(dot11lcnphytbl_rx_gain_info_2G_rev2); |
1616 | sizeof(dot11lcnphytbl_rx_gain_info_2G_rev2[0]); | ||
1617 | 1604 | ||
1618 | const u32 dot11lcnphytbl_rx_gain_info_5G_rev2_sz = | 1605 | const u32 dot11lcnphytbl_rx_gain_info_5G_rev2_sz = |
1619 | sizeof(dot11lcnphytbl_rx_gain_info_5G_rev2) / | 1606 | ARRAY_SIZE(dot11lcnphytbl_rx_gain_info_5G_rev2); |
1620 | sizeof(dot11lcnphytbl_rx_gain_info_5G_rev2[0]); | ||
1621 | 1607 | ||
1622 | static const u16 dot11lcn_min_sig_sq_tbl_rev0[] = { | 1608 | static const u16 dot11lcn_min_sig_sq_tbl_rev0[] = { |
1623 | 0x014d, | 1609 | 0x014d, |
@@ -2058,6 +2044,73 @@ static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { | |||
2058 | 0x0005, | 2044 | 0x0005, |
2059 | }; | 2045 | }; |
2060 | 2046 | ||
2047 | static const u16 dot11lcn_sw_ctrl_tbl_4313_ipa_rev0_combo[] = { | ||
2048 | 0x0005, | ||
2049 | 0x0006, | ||
2050 | 0x0009, | ||
2051 | 0x000a, | ||
2052 | 0x0005, | ||
2053 | 0x0006, | ||
2054 | 0x0009, | ||
2055 | 0x000a, | ||
2056 | 0x0005, | ||
2057 | 0x0006, | ||
2058 | 0x0009, | ||
2059 | 0x000a, | ||
2060 | 0x0005, | ||
2061 | 0x0006, | ||
2062 | 0x0009, | ||
2063 | 0x000a, | ||
2064 | 0x0005, | ||
2065 | 0x0006, | ||
2066 | 0x0009, | ||
2067 | 0x000a, | ||
2068 | 0x0005, | ||
2069 | 0x0006, | ||
2070 | 0x0009, | ||
2071 | 0x000a, | ||
2072 | 0x0005, | ||
2073 | 0x0006, | ||
2074 | 0x0009, | ||
2075 | 0x000a, | ||
2076 | 0x0005, | ||
2077 | 0x0006, | ||
2078 | 0x0009, | ||
2079 | 0x000a, | ||
2080 | 0x0005, | ||
2081 | 0x0006, | ||
2082 | 0x0009, | ||
2083 | 0x000a, | ||
2084 | 0x0005, | ||
2085 | 0x0006, | ||
2086 | 0x0009, | ||
2087 | 0x000a, | ||
2088 | 0x0005, | ||
2089 | 0x0006, | ||
2090 | 0x0009, | ||
2091 | 0x000a, | ||
2092 | 0x0005, | ||
2093 | 0x0006, | ||
2094 | 0x0009, | ||
2095 | 0x000a, | ||
2096 | 0x0005, | ||
2097 | 0x0006, | ||
2098 | 0x0009, | ||
2099 | 0x000a, | ||
2100 | 0x0005, | ||
2101 | 0x0006, | ||
2102 | 0x0009, | ||
2103 | 0x000a, | ||
2104 | 0x0005, | ||
2105 | 0x0006, | ||
2106 | 0x0009, | ||
2107 | 0x000a, | ||
2108 | 0x0005, | ||
2109 | 0x0006, | ||
2110 | 0x0009, | ||
2111 | 0x000a, | ||
2112 | }; | ||
2113 | |||
2061 | static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { | 2114 | static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { |
2062 | 0x0004, | 2115 | 0x0004, |
2063 | 0x0004, | 2116 | 0x0004, |
@@ -2771,89 +2824,79 @@ static const u32 dot11lcn_papd_compdelta_tbl_rev0[] = { | |||
2771 | 2824 | ||
2772 | const struct phytbl_info dot11lcnphytbl_info_rev0[] = { | 2825 | const struct phytbl_info dot11lcnphytbl_info_rev0[] = { |
2773 | {&dot11lcn_min_sig_sq_tbl_rev0, | 2826 | {&dot11lcn_min_sig_sq_tbl_rev0, |
2774 | sizeof(dot11lcn_min_sig_sq_tbl_rev0) / | 2827 | ARRAY_SIZE(dot11lcn_min_sig_sq_tbl_rev0), 2, 0, 16} |
2775 | sizeof(dot11lcn_min_sig_sq_tbl_rev0[0]), 2, 0, 16} | ||
2776 | , | 2828 | , |
2777 | {&dot11lcn_noise_scale_tbl_rev0, | 2829 | {&dot11lcn_noise_scale_tbl_rev0, |
2778 | sizeof(dot11lcn_noise_scale_tbl_rev0) / | 2830 | ARRAY_SIZE(dot11lcn_noise_scale_tbl_rev0), 1, 0, 16} |
2779 | sizeof(dot11lcn_noise_scale_tbl_rev0[0]), 1, 0, 16} | ||
2780 | , | 2831 | , |
2781 | {&dot11lcn_fltr_ctrl_tbl_rev0, | 2832 | {&dot11lcn_fltr_ctrl_tbl_rev0, |
2782 | sizeof(dot11lcn_fltr_ctrl_tbl_rev0) / | 2833 | ARRAY_SIZE(dot11lcn_fltr_ctrl_tbl_rev0), 11, 0, 32} |
2783 | sizeof(dot11lcn_fltr_ctrl_tbl_rev0[0]), 11, 0, 32} | ||
2784 | , | 2834 | , |
2785 | {&dot11lcn_ps_ctrl_tbl_rev0, | 2835 | {&dot11lcn_ps_ctrl_tbl_rev0, |
2786 | sizeof(dot11lcn_ps_ctrl_tbl_rev0) / | 2836 | ARRAY_SIZE(dot11lcn_ps_ctrl_tbl_rev0), 12, 0, 32} |
2787 | sizeof(dot11lcn_ps_ctrl_tbl_rev0[0]), 12, 0, 32} | ||
2788 | , | 2837 | , |
2789 | {&dot11lcn_gain_idx_tbl_rev0, | 2838 | {&dot11lcn_gain_idx_tbl_rev0, |
2790 | sizeof(dot11lcn_gain_idx_tbl_rev0) / | 2839 | ARRAY_SIZE(dot11lcn_gain_idx_tbl_rev0), 13, 0, 32} |
2791 | sizeof(dot11lcn_gain_idx_tbl_rev0[0]), 13, 0, 32} | ||
2792 | , | 2840 | , |
2793 | {&dot11lcn_aux_gain_idx_tbl_rev0, | 2841 | {&dot11lcn_aux_gain_idx_tbl_rev0, |
2794 | sizeof(dot11lcn_aux_gain_idx_tbl_rev0) / | 2842 | ARRAY_SIZE(dot11lcn_aux_gain_idx_tbl_rev0), 14, 0, 16} |
2795 | sizeof(dot11lcn_aux_gain_idx_tbl_rev0[0]), 14, 0, 16} | ||
2796 | , | 2843 | , |
2797 | {&dot11lcn_sw_ctrl_tbl_rev0, | 2844 | {&dot11lcn_sw_ctrl_tbl_rev0, |
2798 | sizeof(dot11lcn_sw_ctrl_tbl_rev0) / | 2845 | ARRAY_SIZE(dot11lcn_sw_ctrl_tbl_rev0), 15, 0, 16} |
2799 | sizeof(dot11lcn_sw_ctrl_tbl_rev0[0]), 15, 0, 16} | ||
2800 | , | 2846 | , |
2801 | {&dot11lcn_nf_table_rev0, | 2847 | {&dot11lcn_nf_table_rev0, |
2802 | sizeof(dot11lcn_nf_table_rev0) / sizeof(dot11lcn_nf_table_rev0[0]), 16, | 2848 | ARRAY_SIZE(dot11lcn_nf_table_rev0), 16, |
2803 | 0, 8} | 2849 | 0, 8} |
2804 | , | 2850 | , |
2805 | {&dot11lcn_gain_val_tbl_rev0, | 2851 | {&dot11lcn_gain_val_tbl_rev0, |
2806 | sizeof(dot11lcn_gain_val_tbl_rev0) / | 2852 | ARRAY_SIZE(dot11lcn_gain_val_tbl_rev0), 17, 0, 8} |
2807 | sizeof(dot11lcn_gain_val_tbl_rev0[0]), 17, 0, 8} | ||
2808 | , | 2853 | , |
2809 | {&dot11lcn_gain_tbl_rev0, | 2854 | {&dot11lcn_gain_tbl_rev0, |
2810 | sizeof(dot11lcn_gain_tbl_rev0) / sizeof(dot11lcn_gain_tbl_rev0[0]), 18, | 2855 | ARRAY_SIZE(dot11lcn_gain_tbl_rev0), 18, |
2811 | 0, 32} | 2856 | 0, 32} |
2812 | , | 2857 | , |
2813 | {&dot11lcn_spur_tbl_rev0, | 2858 | {&dot11lcn_spur_tbl_rev0, |
2814 | sizeof(dot11lcn_spur_tbl_rev0) / sizeof(dot11lcn_spur_tbl_rev0[0]), 20, | 2859 | ARRAY_SIZE(dot11lcn_spur_tbl_rev0), 20, |
2815 | 0, 8} | 2860 | 0, 8} |
2816 | , | 2861 | , |
2817 | {&dot11lcn_unsup_mcs_tbl_rev0, | 2862 | {&dot11lcn_unsup_mcs_tbl_rev0, |
2818 | sizeof(dot11lcn_unsup_mcs_tbl_rev0) / | 2863 | ARRAY_SIZE(dot11lcn_unsup_mcs_tbl_rev0), 23, 0, 16} |
2819 | sizeof(dot11lcn_unsup_mcs_tbl_rev0[0]), 23, 0, 16} | ||
2820 | , | 2864 | , |
2821 | {&dot11lcn_iq_local_tbl_rev0, | 2865 | {&dot11lcn_iq_local_tbl_rev0, |
2822 | sizeof(dot11lcn_iq_local_tbl_rev0) / | 2866 | ARRAY_SIZE(dot11lcn_iq_local_tbl_rev0), 0, 0, 16} |
2823 | sizeof(dot11lcn_iq_local_tbl_rev0[0]), 0, 0, 16} | ||
2824 | , | 2867 | , |
2825 | {&dot11lcn_papd_compdelta_tbl_rev0, | 2868 | {&dot11lcn_papd_compdelta_tbl_rev0, |
2826 | sizeof(dot11lcn_papd_compdelta_tbl_rev0) / | 2869 | ARRAY_SIZE(dot11lcn_papd_compdelta_tbl_rev0), 24, 0, 32} |
2827 | sizeof(dot11lcn_papd_compdelta_tbl_rev0[0]), 24, 0, 32} | ||
2828 | , | 2870 | , |
2829 | }; | 2871 | }; |
2830 | 2872 | ||
2831 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313 = { | 2873 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313 = { |
2832 | &dot11lcn_sw_ctrl_tbl_4313_rev0, | 2874 | &dot11lcn_sw_ctrl_tbl_4313_rev0, |
2833 | sizeof(dot11lcn_sw_ctrl_tbl_4313_rev0) / | 2875 | ARRAY_SIZE(dot11lcn_sw_ctrl_tbl_4313_rev0), 15, 0, 16 |
2834 | sizeof(dot11lcn_sw_ctrl_tbl_4313_rev0[0]), 15, 0, 16 | 2876 | }; |
2877 | |||
2878 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_ipa = { | ||
2879 | &dot11lcn_sw_ctrl_tbl_4313_ipa_rev0_combo, | ||
2880 | ARRAY_SIZE(dot11lcn_sw_ctrl_tbl_4313_ipa_rev0_combo), 15, 0, 16 | ||
2835 | }; | 2881 | }; |
2836 | 2882 | ||
2837 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa = { | 2883 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa = { |
2838 | &dot11lcn_sw_ctrl_tbl_4313_epa_rev0, | 2884 | &dot11lcn_sw_ctrl_tbl_4313_epa_rev0, |
2839 | sizeof(dot11lcn_sw_ctrl_tbl_4313_epa_rev0) / | 2885 | ARRAY_SIZE(dot11lcn_sw_ctrl_tbl_4313_epa_rev0), 15, 0, 16 |
2840 | sizeof(dot11lcn_sw_ctrl_tbl_4313_epa_rev0[0]), 15, 0, 16 | ||
2841 | }; | 2886 | }; |
2842 | 2887 | ||
2843 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa = { | 2888 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa = { |
2844 | &dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo, | 2889 | &dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo, |
2845 | sizeof(dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo) / | 2890 | ARRAY_SIZE(dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo), 15, 0, 16 |
2846 | sizeof(dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo[0]), 15, 0, 16 | ||
2847 | }; | 2891 | }; |
2848 | 2892 | ||
2849 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa_p250 = { | 2893 | const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa_p250 = { |
2850 | &dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0, | 2894 | &dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0, |
2851 | sizeof(dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0) / | 2895 | ARRAY_SIZE(dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0), 15, 0, 16 |
2852 | sizeof(dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0[0]), 15, 0, 16 | ||
2853 | }; | 2896 | }; |
2854 | 2897 | ||
2855 | const u32 dot11lcnphytbl_info_sz_rev0 = | 2898 | const u32 dot11lcnphytbl_info_sz_rev0 = |
2856 | sizeof(dot11lcnphytbl_info_rev0) / sizeof(dot11lcnphytbl_info_rev0[0]); | 2899 | ARRAY_SIZE(dot11lcnphytbl_info_rev0); |
2857 | 2900 | ||
2858 | const struct lcnphy_tx_gain_tbl_entry | 2901 | const struct lcnphy_tx_gain_tbl_entry |
2859 | dot11lcnphy_2GHz_extPA_gaintable_rev0[128] = { | 2902 | dot11lcnphy_2GHz_extPA_gaintable_rev0[128] = { |
@@ -2988,134 +3031,134 @@ dot11lcnphy_2GHz_extPA_gaintable_rev0[128] = { | |||
2988 | }; | 3031 | }; |
2989 | 3032 | ||
2990 | const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_2GHz_gaintable_rev0[128] = { | 3033 | const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_2GHz_gaintable_rev0[128] = { |
2991 | {7, 0, 31, 0, 72}, | 3034 | {15, 0, 31, 0, 72}, |
2992 | {7, 0, 31, 0, 70}, | 3035 | {15, 0, 31, 0, 70}, |
2993 | {7, 0, 31, 0, 68}, | 3036 | {15, 0, 31, 0, 68}, |
2994 | {7, 0, 30, 0, 67}, | 3037 | {15, 0, 30, 0, 68}, |
2995 | {7, 0, 29, 0, 68}, | 3038 | {15, 0, 29, 0, 69}, |
2996 | {7, 0, 28, 0, 68}, | 3039 | {15, 0, 28, 0, 69}, |
2997 | {7, 0, 27, 0, 69}, | 3040 | {15, 0, 27, 0, 70}, |
2998 | {7, 0, 26, 0, 70}, | 3041 | {15, 0, 26, 0, 70}, |
2999 | {7, 0, 25, 0, 70}, | 3042 | {15, 0, 25, 0, 71}, |
3000 | {7, 0, 24, 0, 71}, | 3043 | {15, 0, 24, 0, 72}, |
3001 | {7, 0, 23, 0, 72}, | 3044 | {15, 0, 23, 0, 73}, |
3002 | {7, 0, 23, 0, 70}, | 3045 | {15, 0, 23, 0, 71}, |
3003 | {7, 0, 22, 0, 71}, | 3046 | {15, 0, 22, 0, 72}, |
3004 | {7, 0, 21, 0, 72}, | 3047 | {15, 0, 21, 0, 73}, |
3005 | {7, 0, 21, 0, 70}, | 3048 | {15, 0, 21, 0, 71}, |
3006 | {7, 0, 21, 0, 68}, | 3049 | {15, 0, 21, 0, 69}, |
3007 | {7, 0, 21, 0, 66}, | 3050 | {15, 0, 21, 0, 67}, |
3008 | {7, 0, 21, 0, 64}, | 3051 | {15, 0, 21, 0, 65}, |
3009 | {7, 0, 21, 0, 63}, | 3052 | {15, 0, 21, 0, 63}, |
3010 | {7, 0, 20, 0, 64}, | 3053 | {15, 0, 20, 0, 65}, |
3011 | {7, 0, 19, 0, 65}, | 3054 | {15, 0, 19, 0, 66}, |
3012 | {7, 0, 19, 0, 64}, | 3055 | {15, 0, 19, 0, 64}, |
3013 | {7, 0, 18, 0, 65}, | 3056 | {15, 0, 18, 0, 66}, |
3014 | {7, 0, 18, 0, 64}, | 3057 | {15, 0, 18, 0, 64}, |
3015 | {7, 0, 17, 0, 65}, | 3058 | {15, 0, 17, 0, 66}, |
3016 | {7, 0, 17, 0, 64}, | 3059 | {15, 0, 17, 0, 64}, |
3017 | {7, 0, 16, 0, 65}, | 3060 | {15, 0, 16, 0, 66}, |
3018 | {7, 0, 16, 0, 64}, | 3061 | {15, 0, 16, 0, 64}, |
3019 | {7, 0, 16, 0, 62}, | 3062 | {15, 0, 16, 0, 62}, |
3020 | {7, 0, 16, 0, 60}, | 3063 | {15, 0, 16, 0, 61}, |
3021 | {7, 0, 16, 0, 58}, | 3064 | {15, 0, 16, 0, 59}, |
3022 | {7, 0, 15, 0, 61}, | 3065 | {15, 0, 15, 0, 61}, |
3023 | {7, 0, 15, 0, 59}, | 3066 | {15, 0, 15, 0, 59}, |
3024 | {7, 0, 14, 0, 61}, | 3067 | {15, 0, 14, 0, 62}, |
3025 | {7, 0, 14, 0, 60}, | 3068 | {15, 0, 14, 0, 60}, |
3026 | {7, 0, 14, 0, 58}, | 3069 | {15, 0, 14, 0, 58}, |
3027 | {7, 0, 13, 0, 60}, | 3070 | {15, 0, 13, 0, 61}, |
3028 | {7, 0, 13, 0, 59}, | 3071 | {15, 0, 13, 0, 59}, |
3029 | {7, 0, 12, 0, 62}, | 3072 | {15, 0, 12, 0, 62}, |
3030 | {7, 0, 12, 0, 60}, | 3073 | {15, 0, 12, 0, 61}, |
3031 | {7, 0, 12, 0, 58}, | 3074 | {15, 0, 12, 0, 59}, |
3032 | {7, 0, 11, 0, 62}, | 3075 | {15, 0, 11, 0, 62}, |
3033 | {7, 0, 11, 0, 60}, | 3076 | {15, 0, 11, 0, 61}, |
3034 | {7, 0, 11, 0, 59}, | 3077 | {15, 0, 11, 0, 59}, |
3035 | {7, 0, 11, 0, 57}, | 3078 | {15, 0, 11, 0, 57}, |
3036 | {7, 0, 10, 0, 61}, | 3079 | {15, 0, 10, 0, 61}, |
3037 | {7, 0, 10, 0, 59}, | 3080 | {15, 0, 10, 0, 59}, |
3038 | {7, 0, 10, 0, 57}, | 3081 | {15, 0, 10, 0, 58}, |
3039 | {7, 0, 9, 0, 62}, | 3082 | {15, 0, 9, 0, 62}, |
3040 | {7, 0, 9, 0, 60}, | 3083 | {15, 0, 9, 0, 61}, |
3041 | {7, 0, 9, 0, 58}, | 3084 | {15, 0, 9, 0, 59}, |
3042 | {7, 0, 9, 0, 57}, | 3085 | {15, 0, 9, 0, 57}, |
3043 | {7, 0, 8, 0, 62}, | 3086 | {15, 0, 8, 0, 62}, |
3044 | {7, 0, 8, 0, 60}, | 3087 | {15, 0, 8, 0, 61}, |
3045 | {7, 0, 8, 0, 58}, | 3088 | {15, 0, 8, 0, 59}, |
3046 | {7, 0, 8, 0, 57}, | 3089 | {15, 0, 8, 0, 57}, |
3047 | {7, 0, 8, 0, 55}, | 3090 | {15, 0, 8, 0, 56}, |
3048 | {7, 0, 7, 0, 61}, | 3091 | {15, 0, 8, 0, 54}, |
3092 | {15, 0, 8, 0, 53}, | ||
3093 | {15, 0, 8, 0, 51}, | ||
3094 | {15, 0, 8, 0, 50}, | ||
3095 | {7, 0, 7, 0, 69}, | ||
3096 | {7, 0, 7, 0, 67}, | ||
3097 | {7, 0, 7, 0, 65}, | ||
3098 | {7, 0, 7, 0, 64}, | ||
3099 | {7, 0, 7, 0, 62}, | ||
3049 | {7, 0, 7, 0, 60}, | 3100 | {7, 0, 7, 0, 60}, |
3050 | {7, 0, 7, 0, 58}, | 3101 | {7, 0, 7, 0, 58}, |
3051 | {7, 0, 7, 0, 56}, | 3102 | {7, 0, 7, 0, 57}, |
3052 | {7, 0, 7, 0, 55}, | 3103 | {7, 0, 7, 0, 55}, |
3053 | {7, 0, 6, 0, 62}, | 3104 | {7, 0, 6, 0, 62}, |
3054 | {7, 0, 6, 0, 60}, | 3105 | {7, 0, 6, 0, 61}, |
3055 | {7, 0, 6, 0, 58}, | 3106 | {7, 0, 6, 0, 59}, |
3056 | {7, 0, 6, 0, 57}, | 3107 | {7, 0, 6, 0, 57}, |
3057 | {7, 0, 6, 0, 55}, | 3108 | {7, 0, 6, 0, 56}, |
3058 | {7, 0, 6, 0, 54}, | 3109 | {7, 0, 6, 0, 54}, |
3059 | {7, 0, 6, 0, 52}, | 3110 | {7, 0, 6, 0, 53}, |
3060 | {7, 0, 5, 0, 61}, | 3111 | {7, 0, 5, 0, 61}, |
3061 | {7, 0, 5, 0, 59}, | 3112 | {7, 0, 5, 0, 60}, |
3062 | {7, 0, 5, 0, 57}, | 3113 | {7, 0, 5, 0, 58}, |
3063 | {7, 0, 5, 0, 56}, | 3114 | {7, 0, 5, 0, 56}, |
3064 | {7, 0, 5, 0, 54}, | 3115 | {7, 0, 5, 0, 55}, |
3065 | {7, 0, 5, 0, 53}, | 3116 | {7, 0, 5, 0, 53}, |
3066 | {7, 0, 5, 0, 51}, | 3117 | {7, 0, 5, 0, 52}, |
3067 | {7, 0, 4, 0, 62}, | 3118 | {7, 0, 5, 0, 50}, |
3068 | {7, 0, 4, 0, 60}, | 3119 | {7, 0, 5, 0, 49}, |
3069 | {7, 0, 4, 0, 58}, | 3120 | {7, 0, 5, 0, 47}, |
3070 | {7, 0, 4, 0, 57}, | 3121 | {7, 0, 4, 0, 57}, |
3071 | {7, 0, 4, 0, 55}, | 3122 | {7, 0, 4, 0, 56}, |
3072 | {7, 0, 4, 0, 54}, | 3123 | {7, 0, 4, 0, 54}, |
3073 | {7, 0, 4, 0, 52}, | 3124 | {7, 0, 4, 0, 53}, |
3074 | {7, 0, 4, 0, 51}, | 3125 | {7, 0, 4, 0, 51}, |
3075 | {7, 0, 4, 0, 49}, | 3126 | {7, 0, 4, 0, 50}, |
3076 | {7, 0, 4, 0, 48}, | 3127 | {7, 0, 4, 0, 48}, |
3128 | {7, 0, 4, 0, 47}, | ||
3077 | {7, 0, 4, 0, 46}, | 3129 | {7, 0, 4, 0, 46}, |
3078 | {7, 0, 3, 0, 60}, | 3130 | {7, 0, 4, 0, 44}, |
3079 | {7, 0, 3, 0, 58}, | 3131 | {7, 0, 4, 0, 43}, |
3080 | {7, 0, 3, 0, 57}, | 3132 | {7, 0, 4, 0, 42}, |
3081 | {7, 0, 3, 0, 55}, | 3133 | {7, 0, 4, 0, 41}, |
3082 | {7, 0, 3, 0, 54}, | 3134 | {7, 0, 4, 0, 40}, |
3083 | {7, 0, 3, 0, 52}, | ||
3084 | {7, 0, 3, 0, 51}, | 3135 | {7, 0, 3, 0, 51}, |
3085 | {7, 0, 3, 0, 49}, | 3136 | {7, 0, 3, 0, 50}, |
3086 | {7, 0, 3, 0, 48}, | 3137 | {7, 0, 3, 0, 48}, |
3138 | {7, 0, 3, 0, 47}, | ||
3087 | {7, 0, 3, 0, 46}, | 3139 | {7, 0, 3, 0, 46}, |
3088 | {7, 0, 3, 0, 45}, | ||
3089 | {7, 0, 3, 0, 44}, | 3140 | {7, 0, 3, 0, 44}, |
3090 | {7, 0, 3, 0, 43}, | 3141 | {7, 0, 3, 0, 43}, |
3142 | {7, 0, 3, 0, 42}, | ||
3091 | {7, 0, 3, 0, 41}, | 3143 | {7, 0, 3, 0, 41}, |
3092 | {7, 0, 2, 0, 61}, | 3144 | {3, 0, 3, 0, 56}, |
3093 | {7, 0, 2, 0, 59}, | 3145 | {3, 0, 3, 0, 54}, |
3094 | {7, 0, 2, 0, 57}, | 3146 | {3, 0, 3, 0, 53}, |
3095 | {7, 0, 2, 0, 56}, | 3147 | {3, 0, 3, 0, 51}, |
3096 | {7, 0, 2, 0, 54}, | 3148 | {3, 0, 3, 0, 50}, |
3097 | {7, 0, 2, 0, 53}, | 3149 | {3, 0, 3, 0, 48}, |
3098 | {7, 0, 2, 0, 51}, | 3150 | {3, 0, 3, 0, 47}, |
3099 | {7, 0, 2, 0, 50}, | 3151 | {3, 0, 3, 0, 46}, |
3100 | {7, 0, 2, 0, 48}, | 3152 | {3, 0, 3, 0, 44}, |
3101 | {7, 0, 2, 0, 47}, | 3153 | {3, 0, 3, 0, 43}, |
3102 | {7, 0, 2, 0, 46}, | 3154 | {3, 0, 3, 0, 42}, |
3103 | {7, 0, 2, 0, 44}, | 3155 | {3, 0, 3, 0, 41}, |
3104 | {7, 0, 2, 0, 43}, | 3156 | {3, 0, 3, 0, 39}, |
3105 | {7, 0, 2, 0, 42}, | 3157 | {3, 0, 3, 0, 38}, |
3106 | {7, 0, 2, 0, 41}, | 3158 | {3, 0, 3, 0, 37}, |
3107 | {7, 0, 2, 0, 39}, | 3159 | {3, 0, 3, 0, 36}, |
3108 | {7, 0, 2, 0, 38}, | 3160 | {3, 0, 3, 0, 35}, |
3109 | {7, 0, 2, 0, 37}, | 3161 | {3, 0, 3, 0, 34}, |
3110 | {7, 0, 2, 0, 36}, | ||
3111 | {7, 0, 2, 0, 35}, | ||
3112 | {7, 0, 2, 0, 34}, | ||
3113 | {7, 0, 2, 0, 33}, | ||
3114 | {7, 0, 2, 0, 32}, | ||
3115 | {7, 0, 1, 0, 63}, | ||
3116 | {7, 0, 1, 0, 61}, | ||
3117 | {7, 0, 1, 0, 59}, | ||
3118 | {7, 0, 1, 0, 57}, | ||
3119 | }; | 3162 | }; |
3120 | 3163 | ||
3121 | const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_5GHz_gaintable_rev0[128] = { | 3164 | const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_5GHz_gaintable_rev0[128] = { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.h index 5f75e16bf5a7..489422a36085 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.h | |||
@@ -20,6 +20,7 @@ | |||
20 | extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev0[]; | 20 | extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev0[]; |
21 | extern const u32 dot11lcnphytbl_rx_gain_info_sz_rev0; | 21 | extern const u32 dot11lcnphytbl_rx_gain_info_sz_rev0; |
22 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313; | 22 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313; |
23 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_ipa; | ||
23 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa; | 24 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa; |
24 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa_combo; | 25 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa_combo; |
25 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa; | 26 | extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa; |
diff --git a/drivers/net/wireless/cw1200/bh.c b/drivers/net/wireless/cw1200/bh.c index c1ec2a4dd8c0..92d299aa257c 100644 --- a/drivers/net/wireless/cw1200/bh.c +++ b/drivers/net/wireless/cw1200/bh.c | |||
@@ -465,8 +465,8 @@ static int cw1200_bh(void *arg) | |||
465 | (rx || tx || term || suspend || priv->bh_error); | 465 | (rx || tx || term || suspend || priv->bh_error); |
466 | }), status); | 466 | }), status); |
467 | 467 | ||
468 | pr_debug("[BH] - rx: %d, tx: %d, term: %d, suspend: %d, status: %ld\n", | 468 | pr_debug("[BH] - rx: %d, tx: %d, term: %d, bh_err: %d, suspend: %d, status: %ld\n", |
469 | rx, tx, term, suspend, status); | 469 | rx, tx, term, suspend, priv->bh_error, status); |
470 | 470 | ||
471 | /* Did an error occur? */ | 471 | /* Did an error occur? */ |
472 | if ((status < 0 && status != -ERESTARTSYS) || | 472 | if ((status < 0 && status != -ERESTARTSYS) || |
diff --git a/drivers/net/wireless/cw1200/main.c b/drivers/net/wireless/cw1200/main.c index 3724e739cbf4..090f01577dd2 100644 --- a/drivers/net/wireless/cw1200/main.c +++ b/drivers/net/wireless/cw1200/main.c | |||
@@ -507,7 +507,7 @@ u32 cw1200_dpll_from_clk(u16 clk_khz) | |||
507 | case 0xCB20: /* 52000 KHz */ | 507 | case 0xCB20: /* 52000 KHz */ |
508 | return 0x07627091; | 508 | return 0x07627091; |
509 | default: | 509 | default: |
510 | pr_err("Unknown Refclk freq (0x%04x), using 2600KHz\n", | 510 | pr_err("Unknown Refclk freq (0x%04x), using 26000KHz\n", |
511 | clk_khz); | 511 | clk_khz); |
512 | return 0x0EC4F121; | 512 | return 0x0EC4F121; |
513 | } | 513 | } |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 6307a4e36c85..c275dc1623fe 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -1425,7 +1425,7 @@ static int prism2_hw_init2(struct net_device *dev, int initial) | |||
1425 | } | 1425 | } |
1426 | list_for_each(ptr, &local->hostap_interfaces) { | 1426 | list_for_each(ptr, &local->hostap_interfaces) { |
1427 | iface = list_entry(ptr, struct hostap_interface, list); | 1427 | iface = list_entry(ptr, struct hostap_interface, list); |
1428 | memcpy(iface->dev->dev_addr, dev->dev_addr, ETH_ALEN); | 1428 | eth_hw_addr_inherit(iface->dev, dev); |
1429 | } | 1429 | } |
1430 | } else if (local->fw_ap) | 1430 | } else if (local->fw_ap) |
1431 | prism2_check_sta_fw_version(local); | 1431 | prism2_check_sta_fw_version(local); |
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index e4f56ad26cd8..a1257c92afc4 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c | |||
@@ -66,7 +66,7 @@ struct net_device * hostap_add_interface(struct local_info *local, | |||
66 | list_add(&iface->list, &local->hostap_interfaces); | 66 | list_add(&iface->list, &local->hostap_interfaces); |
67 | 67 | ||
68 | mdev = local->dev; | 68 | mdev = local->dev; |
69 | memcpy(dev->dev_addr, mdev->dev_addr, ETH_ALEN); | 69 | eth_hw_addr_inherit(dev, mdev); |
70 | dev->base_addr = mdev->base_addr; | 70 | dev->base_addr = mdev->base_addr; |
71 | dev->irq = mdev->irq; | 71 | dev->irq = mdev->irq; |
72 | dev->mem_start = mdev->mem_start; | 72 | dev->mem_start = mdev->mem_start; |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index b411ab905284..5ab50a5b48b1 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -4470,9 +4470,9 @@ il4965_irq_tasklet(struct il_priv *il) | |||
4470 | set_bit(S_RFKILL, &il->status); | 4470 | set_bit(S_RFKILL, &il->status); |
4471 | } else { | 4471 | } else { |
4472 | clear_bit(S_RFKILL, &il->status); | 4472 | clear_bit(S_RFKILL, &il->status); |
4473 | wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill); | ||
4474 | il_force_reset(il, true); | 4473 | il_force_reset(il, true); |
4475 | } | 4474 | } |
4475 | wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill); | ||
4476 | 4476 | ||
4477 | handled |= CSR_INT_BIT_RF_KILL; | 4477 | handled |= CSR_INT_BIT_RF_KILL; |
4478 | } | 4478 | } |
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index e5c133ee7901..3eb2102ce236 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -22,6 +22,8 @@ config IWLWIFI | |||
22 | Intel Wireless WiFi Link 6150BGN 2 Adapter | 22 | Intel Wireless WiFi Link 6150BGN 2 Adapter |
23 | Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN) | 23 | Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN) |
24 | Intel 2000 Series Wi-Fi Adapters | 24 | Intel 2000 Series Wi-Fi Adapters |
25 | Intel 7260 Wi-Fi Adapter | ||
26 | Intel 3160 Wi-Fi Adapter | ||
25 | 27 | ||
26 | 28 | ||
27 | This driver uses the kernel's mac80211 subsystem. | 29 | This driver uses the kernel's mac80211 subsystem. |
@@ -46,17 +48,16 @@ config IWLDVM | |||
46 | depends on IWLWIFI | 48 | depends on IWLWIFI |
47 | default IWLWIFI | 49 | default IWLWIFI |
48 | help | 50 | help |
49 | This is the driver supporting the DVM firmware which is | 51 | This is the driver that supports the DVM firmware which is |
50 | currently the only firmware available for existing devices. | 52 | used by most existing devices (with the exception of 7260 |
53 | and 3160). | ||
51 | 54 | ||
52 | config IWLMVM | 55 | config IWLMVM |
53 | tristate "Intel Wireless WiFi MVM Firmware support" | 56 | tristate "Intel Wireless WiFi MVM Firmware support" |
54 | depends on IWLWIFI | 57 | depends on IWLWIFI |
55 | help | 58 | help |
56 | This is the driver supporting the MVM firmware which is | 59 | This is the driver that supports the MVM firmware which is |
57 | currently only available for 7000 series devices. | 60 | currently only available for 7260 and 3160 devices. |
58 | |||
59 | Say yes if you have such a device. | ||
60 | 61 | ||
61 | # don't call it _MODULE -- will confuse Kconfig/fixdep/... | 62 | # don't call it _MODULE -- will confuse Kconfig/fixdep/... |
62 | config IWLWIFI_OPMODE_MODULAR | 63 | config IWLWIFI_OPMODE_MODULAR |
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index 3db0bbb1d123..da442b81370a 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
@@ -87,7 +87,7 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, | |||
87 | priv->lib->bt_params->advanced_bt_coexist && | 87 | priv->lib->bt_params->advanced_bt_coexist && |
88 | (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) || | 88 | (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) || |
89 | ieee80211_is_reassoc_req(fc) || | 89 | ieee80211_is_reassoc_req(fc) || |
90 | skb->protocol == cpu_to_be16(ETH_P_PAE))) | 90 | info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) |
91 | tx_flags |= TX_CMD_FLG_IGNORE_BT; | 91 | tx_flags |= TX_CMD_FLG_IGNORE_BT; |
92 | 92 | ||
93 | 93 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index 7edb8519c8a4..b2bb32a781dd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -145,6 +145,7 @@ do { \ | |||
145 | #define IWL_DL_RX 0x01000000 | 145 | #define IWL_DL_RX 0x01000000 |
146 | #define IWL_DL_ISR 0x02000000 | 146 | #define IWL_DL_ISR 0x02000000 |
147 | #define IWL_DL_HT 0x04000000 | 147 | #define IWL_DL_HT 0x04000000 |
148 | #define IWL_DL_EXTERNAL 0x08000000 | ||
148 | /* 0xF0000000 - 0x10000000 */ | 149 | /* 0xF0000000 - 0x10000000 */ |
149 | #define IWL_DL_11H 0x10000000 | 150 | #define IWL_DL_11H 0x10000000 |
150 | #define IWL_DL_STATS 0x20000000 | 151 | #define IWL_DL_STATS 0x20000000 |
@@ -153,6 +154,7 @@ do { \ | |||
153 | 154 | ||
154 | #define IWL_DEBUG_INFO(p, f, a...) IWL_DEBUG(p, IWL_DL_INFO, f, ## a) | 155 | #define IWL_DEBUG_INFO(p, f, a...) IWL_DEBUG(p, IWL_DL_INFO, f, ## a) |
155 | #define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a) | 156 | #define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a) |
157 | #define IWL_DEBUG_EXTERNAL(p, f, a...) IWL_DEBUG(p, IWL_DL_EXTERNAL, f, ## a) | ||
156 | #define IWL_DEBUG_TEMP(p, f, a...) IWL_DEBUG(p, IWL_DL_TEMP, f, ## a) | 158 | #define IWL_DEBUG_TEMP(p, f, a...) IWL_DEBUG(p, IWL_DL_TEMP, f, ## a) |
157 | #define IWL_DEBUG_SCAN(p, f, a...) IWL_DEBUG(p, IWL_DL_SCAN, f, ## a) | 159 | #define IWL_DEBUG_SCAN(p, f, a...) IWL_DEBUG(p, IWL_DL_SCAN, f, ## a) |
158 | #define IWL_DEBUG_RX(p, f, a...) IWL_DEBUG(p, IWL_DL_RX, f, ## a) | 160 | #define IWL_DEBUG_RX(p, f, a...) IWL_DEBUG(p, IWL_DL_RX, f, ## a) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h index 4491c1c72cc7..684c416d3493 100644 --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h | |||
@@ -33,10 +33,11 @@ | |||
33 | static inline bool iwl_trace_data(struct sk_buff *skb) | 33 | static inline bool iwl_trace_data(struct sk_buff *skb) |
34 | { | 34 | { |
35 | struct ieee80211_hdr *hdr = (void *)skb->data; | 35 | struct ieee80211_hdr *hdr = (void *)skb->data; |
36 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
36 | 37 | ||
37 | if (ieee80211_is_data(hdr->frame_control)) | 38 | if (!ieee80211_is_data(hdr->frame_control)) |
38 | return skb->protocol != cpu_to_be16(ETH_P_PAE); | 39 | return false; |
39 | return false; | 40 | return !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO); |
40 | } | 41 | } |
41 | 42 | ||
42 | static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans, | 43 | static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index d0162d426f88..99e1da3123c9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
@@ -843,7 +843,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | |||
843 | int i; | 843 | int i; |
844 | bool load_module = false; | 844 | bool load_module = false; |
845 | 845 | ||
846 | fw->ucode_capa.max_probe_length = 200; | 846 | fw->ucode_capa.max_probe_length = IWL_DEFAULT_MAX_PROBE_LENGTH; |
847 | fw->ucode_capa.standard_phy_calibration_size = | 847 | fw->ucode_capa.standard_phy_calibration_size = |
848 | IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE; | 848 | IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE; |
849 | 849 | ||
@@ -1032,8 +1032,10 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans, | |||
1032 | int ret; | 1032 | int ret; |
1033 | 1033 | ||
1034 | drv = kzalloc(sizeof(*drv), GFP_KERNEL); | 1034 | drv = kzalloc(sizeof(*drv), GFP_KERNEL); |
1035 | if (!drv) | 1035 | if (!drv) { |
1036 | return NULL; | 1036 | ret = -ENOMEM; |
1037 | goto err; | ||
1038 | } | ||
1037 | 1039 | ||
1038 | drv->trans = trans; | 1040 | drv->trans = trans; |
1039 | drv->dev = trans->dev; | 1041 | drv->dev = trans->dev; |
@@ -1078,7 +1080,7 @@ err_free_dbgfs: | |||
1078 | err_free_drv: | 1080 | err_free_drv: |
1079 | #endif | 1081 | #endif |
1080 | kfree(drv); | 1082 | kfree(drv); |
1081 | 1083 | err: | |
1082 | return ERR_PTR(ret); | 1084 | return ERR_PTR(ret); |
1083 | } | 1085 | } |
1084 | 1086 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index bd335f0c40d1..a1223680bc70 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
@@ -76,6 +76,7 @@ | |||
76 | * @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS | 76 | * @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS |
77 | * @IWL_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD | 77 | * @IWL_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD |
78 | * @IWL_UCODE_TLV_FLAGS_RX_ENERGY_API: supports rx signal strength api | 78 | * @IWL_UCODE_TLV_FLAGS_RX_ENERGY_API: supports rx signal strength api |
79 | * @IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2: using the new time event API. | ||
79 | * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six | 80 | * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six |
80 | * (rather than two) IPv6 addresses | 81 | * (rather than two) IPv6 addresses |
81 | * @IWL_UCODE_TLV_FLAGS_BF_UPDATED: new beacon filtering API | 82 | * @IWL_UCODE_TLV_FLAGS_BF_UPDATED: new beacon filtering API |
@@ -88,6 +89,7 @@ enum iwl_ucode_tlv_flag { | |||
88 | IWL_UCODE_TLV_FLAGS_DW_BC_TABLE = BIT(4), | 89 | IWL_UCODE_TLV_FLAGS_DW_BC_TABLE = BIT(4), |
89 | IWL_UCODE_TLV_FLAGS_UAPSD = BIT(6), | 90 | IWL_UCODE_TLV_FLAGS_UAPSD = BIT(6), |
90 | IWL_UCODE_TLV_FLAGS_RX_ENERGY_API = BIT(8), | 91 | IWL_UCODE_TLV_FLAGS_RX_ENERGY_API = BIT(8), |
92 | IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2 = BIT(9), | ||
91 | IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS = BIT(10), | 93 | IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS = BIT(10), |
92 | IWL_UCODE_TLV_FLAGS_BF_UPDATED = BIT(11), | 94 | IWL_UCODE_TLV_FLAGS_BF_UPDATED = BIT(11), |
93 | }; | 95 | }; |
@@ -97,6 +99,9 @@ enum iwl_ucode_tlv_flag { | |||
97 | #define IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE 19 | 99 | #define IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE 19 |
98 | #define IWL_MAX_PHY_CALIBRATE_TBL_SIZE 253 | 100 | #define IWL_MAX_PHY_CALIBRATE_TBL_SIZE 253 |
99 | 101 | ||
102 | /* The default max probe length if not specified by the firmware file */ | ||
103 | #define IWL_DEFAULT_MAX_PROBE_LENGTH 200 | ||
104 | |||
100 | /** | 105 | /** |
101 | * enum iwl_ucode_type | 106 | * enum iwl_ucode_type |
102 | * | 107 | * |
diff --git a/drivers/net/wireless/iwlwifi/mvm/constants.h b/drivers/net/wireless/iwlwifi/mvm/constants.h index 64656e0c8f91..2bf29f7992ee 100644 --- a/drivers/net/wireless/iwlwifi/mvm/constants.h +++ b/drivers/net/wireless/iwlwifi/mvm/constants.h | |||
@@ -67,5 +67,14 @@ | |||
67 | #define IWL_MVM_DEFAULT_PS_RX_DATA_TIMEOUT (100 * USEC_PER_MSEC) | 67 | #define IWL_MVM_DEFAULT_PS_RX_DATA_TIMEOUT (100 * USEC_PER_MSEC) |
68 | #define IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT (10 * USEC_PER_MSEC) | 68 | #define IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT (10 * USEC_PER_MSEC) |
69 | #define IWL_MVM_WOWLAN_PS_RX_DATA_TIMEOUT (10 * USEC_PER_MSEC) | 69 | #define IWL_MVM_WOWLAN_PS_RX_DATA_TIMEOUT (10 * USEC_PER_MSEC) |
70 | #define IWL_MVM_UAPSD_RX_DATA_TIMEOUT (50 * USEC_PER_MSEC) | ||
71 | #define IWL_MVM_UAPSD_TX_DATA_TIMEOUT (50 * USEC_PER_MSEC) | ||
72 | #define IWL_MVM_PS_HEAVY_TX_THLD_PACKETS 20 | ||
73 | #define IWL_MVM_PS_HEAVY_RX_THLD_PACKETS 20 | ||
74 | #define IWL_MVM_PS_HEAVY_TX_THLD_PERCENT 50 | ||
75 | #define IWL_MVM_PS_HEAVY_RX_THLD_PERCENT 50 | ||
76 | #define IWL_MVM_PS_SNOOZE_INTERVAL 25 | ||
77 | #define IWL_MVM_PS_SNOOZE_WINDOW 50 | ||
78 | #define IWL_MVM_WOWLAN_PS_SNOOZE_WINDOW 25 | ||
70 | 79 | ||
71 | #endif /* __MVM_CONSTANTS_H */ | 80 | #endif /* __MVM_CONSTANTS_H */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index d0d7a20266e6..417639f77b01 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c | |||
@@ -1109,73 +1109,16 @@ int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | |||
1109 | return __iwl_mvm_suspend(hw, wowlan, false); | 1109 | return __iwl_mvm_suspend(hw, wowlan, false); |
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | static void iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | 1112 | static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, |
1113 | struct ieee80211_vif *vif) | 1113 | struct ieee80211_vif *vif, |
1114 | struct iwl_wowlan_status *status) | ||
1114 | { | 1115 | { |
1115 | u32 base = mvm->error_event_table; | 1116 | struct sk_buff *pkt = NULL; |
1116 | struct error_table_start { | ||
1117 | /* cf. struct iwl_error_event_table */ | ||
1118 | u32 valid; | ||
1119 | u32 error_id; | ||
1120 | } err_info; | ||
1121 | struct cfg80211_wowlan_wakeup wakeup = { | 1117 | struct cfg80211_wowlan_wakeup wakeup = { |
1122 | .pattern_idx = -1, | 1118 | .pattern_idx = -1, |
1123 | }; | 1119 | }; |
1124 | struct cfg80211_wowlan_wakeup *wakeup_report = &wakeup; | 1120 | struct cfg80211_wowlan_wakeup *wakeup_report = &wakeup; |
1125 | struct iwl_host_cmd cmd = { | 1121 | u32 reasons = le32_to_cpu(status->wakeup_reasons); |
1126 | .id = WOWLAN_GET_STATUSES, | ||
1127 | .flags = CMD_SYNC | CMD_WANT_SKB, | ||
1128 | }; | ||
1129 | struct iwl_wowlan_status *status; | ||
1130 | u32 reasons; | ||
1131 | int ret, len; | ||
1132 | struct sk_buff *pkt = NULL; | ||
1133 | |||
1134 | iwl_trans_read_mem_bytes(mvm->trans, base, | ||
1135 | &err_info, sizeof(err_info)); | ||
1136 | |||
1137 | if (err_info.valid) { | ||
1138 | IWL_INFO(mvm, "error table is valid (%d)\n", | ||
1139 | err_info.valid); | ||
1140 | if (err_info.error_id == RF_KILL_INDICATOR_FOR_WOWLAN) { | ||
1141 | wakeup.rfkill_release = true; | ||
1142 | ieee80211_report_wowlan_wakeup(vif, &wakeup, | ||
1143 | GFP_KERNEL); | ||
1144 | } | ||
1145 | return; | ||
1146 | } | ||
1147 | |||
1148 | /* only for tracing for now */ | ||
1149 | ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, CMD_SYNC, 0, NULL); | ||
1150 | if (ret) | ||
1151 | IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); | ||
1152 | |||
1153 | ret = iwl_mvm_send_cmd(mvm, &cmd); | ||
1154 | if (ret) { | ||
1155 | IWL_ERR(mvm, "failed to query status (%d)\n", ret); | ||
1156 | return; | ||
1157 | } | ||
1158 | |||
1159 | /* RF-kill already asserted again... */ | ||
1160 | if (!cmd.resp_pkt) | ||
1161 | return; | ||
1162 | |||
1163 | len = le32_to_cpu(cmd.resp_pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; | ||
1164 | if (len - sizeof(struct iwl_cmd_header) < sizeof(*status)) { | ||
1165 | IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); | ||
1166 | goto out; | ||
1167 | } | ||
1168 | |||
1169 | status = (void *)cmd.resp_pkt->data; | ||
1170 | |||
1171 | if (len - sizeof(struct iwl_cmd_header) != | ||
1172 | sizeof(*status) + | ||
1173 | ALIGN(le32_to_cpu(status->wake_packet_bufsize), 4)) { | ||
1174 | IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); | ||
1175 | goto out; | ||
1176 | } | ||
1177 | |||
1178 | reasons = le32_to_cpu(status->wakeup_reasons); | ||
1179 | 1122 | ||
1180 | if (reasons == IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS) { | 1123 | if (reasons == IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS) { |
1181 | wakeup_report = NULL; | 1124 | wakeup_report = NULL; |
@@ -1238,6 +1181,12 @@ static void iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1238 | pktsize -= hdrlen; | 1181 | pktsize -= hdrlen; |
1239 | 1182 | ||
1240 | if (ieee80211_has_protected(hdr->frame_control)) { | 1183 | if (ieee80211_has_protected(hdr->frame_control)) { |
1184 | /* | ||
1185 | * This is unlocked and using gtk_i(c)vlen, | ||
1186 | * but since everything is under RTNL still | ||
1187 | * that's not really a problem - changing | ||
1188 | * it would be difficult. | ||
1189 | */ | ||
1241 | if (is_multicast_ether_addr(hdr->addr1)) { | 1190 | if (is_multicast_ether_addr(hdr->addr1)) { |
1242 | ivlen = mvm->gtk_ivlen; | 1191 | ivlen = mvm->gtk_ivlen; |
1243 | icvlen += mvm->gtk_icvlen; | 1192 | icvlen += mvm->gtk_icvlen; |
@@ -1288,9 +1237,82 @@ static void iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1288 | report: | 1237 | report: |
1289 | ieee80211_report_wowlan_wakeup(vif, wakeup_report, GFP_KERNEL); | 1238 | ieee80211_report_wowlan_wakeup(vif, wakeup_report, GFP_KERNEL); |
1290 | kfree_skb(pkt); | 1239 | kfree_skb(pkt); |
1240 | } | ||
1291 | 1241 | ||
1292 | out: | 1242 | /* releases the MVM mutex */ |
1243 | static void iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | ||
1244 | struct ieee80211_vif *vif) | ||
1245 | { | ||
1246 | u32 base = mvm->error_event_table; | ||
1247 | struct error_table_start { | ||
1248 | /* cf. struct iwl_error_event_table */ | ||
1249 | u32 valid; | ||
1250 | u32 error_id; | ||
1251 | } err_info; | ||
1252 | struct iwl_host_cmd cmd = { | ||
1253 | .id = WOWLAN_GET_STATUSES, | ||
1254 | .flags = CMD_SYNC | CMD_WANT_SKB, | ||
1255 | }; | ||
1256 | struct iwl_wowlan_status *status; | ||
1257 | int ret, len; | ||
1258 | |||
1259 | iwl_trans_read_mem_bytes(mvm->trans, base, | ||
1260 | &err_info, sizeof(err_info)); | ||
1261 | |||
1262 | if (err_info.valid) { | ||
1263 | IWL_INFO(mvm, "error table is valid (%d)\n", | ||
1264 | err_info.valid); | ||
1265 | if (err_info.error_id == RF_KILL_INDICATOR_FOR_WOWLAN) { | ||
1266 | struct cfg80211_wowlan_wakeup wakeup = { | ||
1267 | .rfkill_release = true, | ||
1268 | }; | ||
1269 | ieee80211_report_wowlan_wakeup(vif, &wakeup, | ||
1270 | GFP_KERNEL); | ||
1271 | } | ||
1272 | goto out_unlock; | ||
1273 | } | ||
1274 | |||
1275 | /* only for tracing for now */ | ||
1276 | ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, CMD_SYNC, 0, NULL); | ||
1277 | if (ret) | ||
1278 | IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); | ||
1279 | |||
1280 | ret = iwl_mvm_send_cmd(mvm, &cmd); | ||
1281 | if (ret) { | ||
1282 | IWL_ERR(mvm, "failed to query status (%d)\n", ret); | ||
1283 | goto out_unlock; | ||
1284 | } | ||
1285 | |||
1286 | /* RF-kill already asserted again... */ | ||
1287 | if (!cmd.resp_pkt) | ||
1288 | goto out_unlock; | ||
1289 | |||
1290 | len = le32_to_cpu(cmd.resp_pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; | ||
1291 | if (len - sizeof(struct iwl_cmd_header) < sizeof(*status)) { | ||
1292 | IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); | ||
1293 | goto out_free_resp; | ||
1294 | } | ||
1295 | |||
1296 | status = (void *)cmd.resp_pkt->data; | ||
1297 | |||
1298 | if (len - sizeof(struct iwl_cmd_header) != | ||
1299 | sizeof(*status) + | ||
1300 | ALIGN(le32_to_cpu(status->wake_packet_bufsize), 4)) { | ||
1301 | IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); | ||
1302 | goto out_free_resp; | ||
1303 | } | ||
1304 | |||
1305 | /* now we have all the data we need, unlock to avoid mac80211 issues */ | ||
1306 | mutex_unlock(&mvm->mutex); | ||
1307 | |||
1308 | iwl_mvm_report_wakeup_reasons(mvm, vif, status); | ||
1309 | iwl_free_resp(&cmd); | ||
1310 | return; | ||
1311 | |||
1312 | out_free_resp: | ||
1293 | iwl_free_resp(&cmd); | 1313 | iwl_free_resp(&cmd); |
1314 | out_unlock: | ||
1315 | mutex_unlock(&mvm->mutex); | ||
1294 | } | 1316 | } |
1295 | 1317 | ||
1296 | static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm) | 1318 | static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm) |
@@ -1347,10 +1369,13 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) | |||
1347 | iwl_mvm_read_d3_sram(mvm); | 1369 | iwl_mvm_read_d3_sram(mvm); |
1348 | 1370 | ||
1349 | iwl_mvm_query_wakeup_reasons(mvm, vif); | 1371 | iwl_mvm_query_wakeup_reasons(mvm, vif); |
1372 | /* has unlocked the mutex, so skip that */ | ||
1373 | goto out; | ||
1350 | 1374 | ||
1351 | out_unlock: | 1375 | out_unlock: |
1352 | mutex_unlock(&mvm->mutex); | 1376 | mutex_unlock(&mvm->mutex); |
1353 | 1377 | ||
1378 | out: | ||
1354 | if (!test && vif) | 1379 | if (!test && vif) |
1355 | ieee80211_resume_disconnect(vif); | 1380 | ieee80211_resume_disconnect(vif); |
1356 | 1381 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index cc157734eb21..aac81b8984b0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
@@ -352,6 +352,10 @@ static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm, | |||
352 | IWL_DEBUG_POWER(mvm, "lprx_rssi_threshold=%d\n", val); | 352 | IWL_DEBUG_POWER(mvm, "lprx_rssi_threshold=%d\n", val); |
353 | dbgfs_pm->lprx_rssi_threshold = val; | 353 | dbgfs_pm->lprx_rssi_threshold = val; |
354 | break; | 354 | break; |
355 | case MVM_DEBUGFS_PM_SNOOZE_ENABLE: | ||
356 | IWL_DEBUG_POWER(mvm, "snooze_enable=%d\n", val); | ||
357 | dbgfs_pm->snooze_ena = val; | ||
358 | break; | ||
355 | } | 359 | } |
356 | } | 360 | } |
357 | 361 | ||
@@ -405,6 +409,10 @@ static ssize_t iwl_dbgfs_pm_params_write(struct file *file, | |||
405 | POWER_LPRX_RSSI_THRESHOLD_MIN) | 409 | POWER_LPRX_RSSI_THRESHOLD_MIN) |
406 | return -EINVAL; | 410 | return -EINVAL; |
407 | param = MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD; | 411 | param = MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD; |
412 | } else if (!strncmp("snooze_enable=", buf, 14)) { | ||
413 | if (sscanf(buf + 14, "%d", &val) != 1) | ||
414 | return -EINVAL; | ||
415 | param = MVM_DEBUGFS_PM_SNOOZE_ENABLE; | ||
408 | } else { | 416 | } else { |
409 | return -EINVAL; | 417 | return -EINVAL; |
410 | } | 418 | } |
@@ -424,7 +432,7 @@ static ssize_t iwl_dbgfs_pm_params_read(struct file *file, | |||
424 | struct ieee80211_vif *vif = file->private_data; | 432 | struct ieee80211_vif *vif = file->private_data; |
425 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 433 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
426 | struct iwl_mvm *mvm = mvmvif->dbgfs_data; | 434 | struct iwl_mvm *mvm = mvmvif->dbgfs_data; |
427 | char buf[256]; | 435 | char buf[512]; |
428 | int bufsz = sizeof(buf); | 436 | int bufsz = sizeof(buf); |
429 | int pos; | 437 | int pos; |
430 | 438 | ||
@@ -895,10 +903,7 @@ static ssize_t iwl_dbgfs_bf_params_write(struct file *file, | |||
895 | if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value) { | 903 | if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value) { |
896 | ret = iwl_mvm_disable_beacon_filter(mvm, vif); | 904 | ret = iwl_mvm_disable_beacon_filter(mvm, vif); |
897 | } else { | 905 | } else { |
898 | if (mvmvif->bf_enabled) | 906 | ret = iwl_mvm_enable_beacon_filter(mvm, vif); |
899 | ret = iwl_mvm_enable_beacon_filter(mvm, vif); | ||
900 | else | ||
901 | ret = iwl_mvm_disable_beacon_filter(mvm, vif); | ||
902 | } | 907 | } |
903 | mutex_unlock(&mvm->mutex); | 908 | mutex_unlock(&mvm->mutex); |
904 | 909 | ||
@@ -923,7 +928,7 @@ static ssize_t iwl_dbgfs_bf_params_read(struct file *file, | |||
923 | }; | 928 | }; |
924 | 929 | ||
925 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); | 930 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); |
926 | if (mvmvif->bf_enabled) | 931 | if (mvmvif->bf_data.bf_enabled) |
927 | cmd.bf_enable_beacon_filter = cpu_to_le32(1); | 932 | cmd.bf_enable_beacon_filter = cpu_to_le32(1); |
928 | else | 933 | else |
929 | cmd.bf_enable_beacon_filter = 0; | 934 | cmd.bf_enable_beacon_filter = 0; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h index 060e630b3d82..8e7ab41079ca 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h | |||
@@ -155,8 +155,12 @@ struct iwl_powertable_cmd { | |||
155 | * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled. | 155 | * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled. |
156 | * Default: 80dbm | 156 | * Default: 80dbm |
157 | * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set | 157 | * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set |
158 | * @snooze_interval: TBD | 158 | * @snooze_interval: Maximum time between attempts to retrieve buffered data |
159 | * @snooze_window: TBD | 159 | * from the AP [msec] |
160 | * @snooze_window: A window of time in which PBW snoozing insures that all | ||
161 | * packets received. It is also the minimum time from last | ||
162 | * received unicast RX packet, before client stops snoozing | ||
163 | * for data. [msec] | ||
160 | * @snooze_step: TBD | 164 | * @snooze_step: TBD |
161 | * @qndp_tid: TID client shall use for uAPSD QNDP triggers | 165 | * @qndp_tid: TID client shall use for uAPSD QNDP triggers |
162 | * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for | 166 | * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for |
@@ -164,10 +168,10 @@ struct iwl_powertable_cmd { | |||
164 | * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values. | 168 | * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values. |
165 | * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct | 169 | * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct |
166 | * values. | 170 | * values. |
167 | * @heavy_traffic_thr_tx_pkts: TX threshold measured in number of packets | 171 | * @heavy_tx_thld_packets: TX threshold measured in number of packets |
168 | * @heavy_traffic_thr_rx_pkts: RX threshold measured in number of packets | 172 | * @heavy_rx_thld_packets: RX threshold measured in number of packets |
169 | * @heavy_traffic_thr_tx_load: TX threshold measured in load's percentage | 173 | * @heavy_tx_thld_percentage: TX threshold measured in load's percentage |
170 | * @heavy_traffic_thr_rx_load: RX threshold measured in load's percentage | 174 | * @heavy_rx_thld_percentage: RX threshold measured in load's percentage |
171 | * @limited_ps_threshold: | 175 | * @limited_ps_threshold: |
172 | */ | 176 | */ |
173 | struct iwl_mac_power_cmd { | 177 | struct iwl_mac_power_cmd { |
@@ -189,10 +193,10 @@ struct iwl_mac_power_cmd { | |||
189 | u8 qndp_tid; | 193 | u8 qndp_tid; |
190 | u8 uapsd_ac_flags; | 194 | u8 uapsd_ac_flags; |
191 | u8 uapsd_max_sp; | 195 | u8 uapsd_max_sp; |
192 | u8 heavy_traffic_threshold_tx_packets; | 196 | u8 heavy_tx_thld_packets; |
193 | u8 heavy_traffic_threshold_rx_packets; | 197 | u8 heavy_rx_thld_packets; |
194 | u8 heavy_traffic_threshold_tx_percentage; | 198 | u8 heavy_tx_thld_percentage; |
195 | u8 heavy_traffic_threshold_rx_percentage; | 199 | u8 heavy_rx_thld_percentage; |
196 | u8 limited_ps_threshold; | 200 | u8 limited_ps_threshold; |
197 | u8 reserved; | 201 | u8 reserved; |
198 | } __packed; | 202 | } __packed; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 55854a309f94..66264cc5a016 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -499,71 +499,199 @@ enum iwl_time_event_type { | |||
499 | TE_MAX | 499 | TE_MAX |
500 | }; /* MAC_EVENT_TYPE_API_E_VER_1 */ | 500 | }; /* MAC_EVENT_TYPE_API_E_VER_1 */ |
501 | 501 | ||
502 | |||
503 | |||
504 | /* Time event - defines for command API v1 */ | ||
505 | |||
506 | /* | ||
507 | * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed. | ||
508 | * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only | ||
509 | * the first fragment is scheduled. | ||
510 | * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only | ||
511 | * the first 2 fragments are scheduled. | ||
512 | * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any | ||
513 | * number of fragments are valid. | ||
514 | * | ||
515 | * Other than the constant defined above, specifying a fragmentation value 'x' | ||
516 | * means that the event can be fragmented but only the first 'x' will be | ||
517 | * scheduled. | ||
518 | */ | ||
519 | enum { | ||
520 | TE_V1_FRAG_NONE = 0, | ||
521 | TE_V1_FRAG_SINGLE = 1, | ||
522 | TE_V1_FRAG_DUAL = 2, | ||
523 | TE_V1_FRAG_ENDLESS = 0xffffffff | ||
524 | }; | ||
525 | |||
526 | /* If a Time Event can be fragmented, this is the max number of fragments */ | ||
527 | #define TE_V1_FRAG_MAX_MSK 0x0fffffff | ||
528 | /* Repeat the time event endlessly (until removed) */ | ||
529 | #define TE_V1_REPEAT_ENDLESS 0xffffffff | ||
530 | /* If a Time Event has bounded repetitions, this is the maximal value */ | ||
531 | #define TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff | ||
532 | |||
502 | /* Time Event dependencies: none, on another TE, or in a specific time */ | 533 | /* Time Event dependencies: none, on another TE, or in a specific time */ |
503 | enum { | 534 | enum { |
504 | TE_INDEPENDENT = 0, | 535 | TE_V1_INDEPENDENT = 0, |
505 | TE_DEP_OTHER = 1, | 536 | TE_V1_DEP_OTHER = BIT(0), |
506 | TE_DEP_TSF = 2, | 537 | TE_V1_DEP_TSF = BIT(1), |
507 | TE_EVENT_SOCIOPATHIC = 4, | 538 | TE_V1_EVENT_SOCIOPATHIC = BIT(2), |
508 | }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */ | 539 | }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */ |
540 | |||
509 | /* | 541 | /* |
542 | * @TE_V1_NOTIF_NONE: no notifications | ||
543 | * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start | ||
544 | * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end | ||
545 | * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use | ||
546 | * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use. | ||
547 | * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start | ||
548 | * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end | ||
549 | * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use. | ||
550 | * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use. | ||
551 | * | ||
510 | * Supported Time event notifications configuration. | 552 | * Supported Time event notifications configuration. |
511 | * A notification (both event and fragment) includes a status indicating weather | 553 | * A notification (both event and fragment) includes a status indicating weather |
512 | * the FW was able to schedule the event or not. For fragment start/end | 554 | * the FW was able to schedule the event or not. For fragment start/end |
513 | * notification the status is always success. There is no start/end fragment | 555 | * notification the status is always success. There is no start/end fragment |
514 | * notification for monolithic events. | 556 | * notification for monolithic events. |
515 | * | ||
516 | * @TE_NOTIF_NONE: no notifications | ||
517 | * @TE_NOTIF_HOST_EVENT_START: request/receive notification on event start | ||
518 | * @TE_NOTIF_HOST_EVENT_END:request/receive notification on event end | ||
519 | * @TE_NOTIF_INTERNAL_EVENT_START: internal FW use | ||
520 | * @TE_NOTIF_INTERNAL_EVENT_END: internal FW use. | ||
521 | * @TE_NOTIF_HOST_FRAG_START: request/receive notification on frag start | ||
522 | * @TE_NOTIF_HOST_FRAG_END:request/receive notification on frag end | ||
523 | * @TE_NOTIF_INTERNAL_FRAG_START: internal FW use. | ||
524 | * @TE_NOTIF_INTERNAL_FRAG_END: internal FW use. | ||
525 | */ | 557 | */ |
526 | enum { | 558 | enum { |
527 | TE_NOTIF_NONE = 0, | 559 | TE_V1_NOTIF_NONE = 0, |
528 | TE_NOTIF_HOST_EVENT_START = 0x1, | 560 | TE_V1_NOTIF_HOST_EVENT_START = BIT(0), |
529 | TE_NOTIF_HOST_EVENT_END = 0x2, | 561 | TE_V1_NOTIF_HOST_EVENT_END = BIT(1), |
530 | TE_NOTIF_INTERNAL_EVENT_START = 0x4, | 562 | TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2), |
531 | TE_NOTIF_INTERNAL_EVENT_END = 0x8, | 563 | TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3), |
532 | TE_NOTIF_HOST_FRAG_START = 0x10, | 564 | TE_V1_NOTIF_HOST_FRAG_START = BIT(4), |
533 | TE_NOTIF_HOST_FRAG_END = 0x20, | 565 | TE_V1_NOTIF_HOST_FRAG_END = BIT(5), |
534 | TE_NOTIF_INTERNAL_FRAG_START = 0x40, | 566 | TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6), |
535 | TE_NOTIF_INTERNAL_FRAG_END = 0x80 | 567 | TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7), |
536 | }; /* MAC_EVENT_ACTION_API_E_VER_2 */ | 568 | }; /* MAC_EVENT_ACTION_API_E_VER_2 */ |
537 | 569 | ||
570 | |||
571 | /** | ||
572 | * struct iwl_time_event_cmd_api_v1 - configuring Time Events | ||
573 | * with struct MAC_TIME_EVENT_DATA_API_S_VER_1 (see also | ||
574 | * with version 2. determined by IWL_UCODE_TLV_FLAGS) | ||
575 | * ( TIME_EVENT_CMD = 0x29 ) | ||
576 | * @id_and_color: ID and color of the relevant MAC | ||
577 | * @action: action to perform, one of FW_CTXT_ACTION_* | ||
578 | * @id: this field has two meanings, depending on the action: | ||
579 | * If the action is ADD, then it means the type of event to add. | ||
580 | * For all other actions it is the unique event ID assigned when the | ||
581 | * event was added by the FW. | ||
582 | * @apply_time: When to start the Time Event (in GP2) | ||
583 | * @max_delay: maximum delay to event's start (apply time), in TU | ||
584 | * @depends_on: the unique ID of the event we depend on (if any) | ||
585 | * @interval: interval between repetitions, in TU | ||
586 | * @interval_reciprocal: 2^32 / interval | ||
587 | * @duration: duration of event in TU | ||
588 | * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS | ||
589 | * @dep_policy: one of TE_V1_INDEPENDENT, TE_V1_DEP_OTHER, TE_V1_DEP_TSF | ||
590 | * and TE_V1_EVENT_SOCIOPATHIC | ||
591 | * @is_present: 0 or 1, are we present or absent during the Time Event | ||
592 | * @max_frags: maximal number of fragments the Time Event can be divided to | ||
593 | * @notify: notifications using TE_V1_NOTIF_* (whom to notify when) | ||
594 | */ | ||
595 | struct iwl_time_event_cmd_v1 { | ||
596 | /* COMMON_INDEX_HDR_API_S_VER_1 */ | ||
597 | __le32 id_and_color; | ||
598 | __le32 action; | ||
599 | __le32 id; | ||
600 | /* MAC_TIME_EVENT_DATA_API_S_VER_1 */ | ||
601 | __le32 apply_time; | ||
602 | __le32 max_delay; | ||
603 | __le32 dep_policy; | ||
604 | __le32 depends_on; | ||
605 | __le32 is_present; | ||
606 | __le32 max_frags; | ||
607 | __le32 interval; | ||
608 | __le32 interval_reciprocal; | ||
609 | __le32 duration; | ||
610 | __le32 repeat; | ||
611 | __le32 notify; | ||
612 | } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_1 */ | ||
613 | |||
614 | |||
615 | /* Time event - defines for command API v2 */ | ||
616 | |||
538 | /* | 617 | /* |
539 | * @TE_FRAG_NONE: fragmentation of the time event is NOT allowed. | 618 | * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed. |
540 | * @TE_FRAG_SINGLE: fragmentation of the time event is allowed, but only | 619 | * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only |
541 | * the first fragment is scheduled. | 620 | * the first fragment is scheduled. |
542 | * @TE_FRAG_DUAL: fragmentation of the time event is allowed, but only | 621 | * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only |
543 | * the first 2 fragments are scheduled. | 622 | * the first 2 fragments are scheduled. |
544 | * @TE_FRAG_ENDLESS: fragmentation of the time event is allowed, and any number | 623 | * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any |
545 | * of fragments are valid. | 624 | * number of fragments are valid. |
546 | * | 625 | * |
547 | * Other than the constant defined above, specifying a fragmentation value 'x' | 626 | * Other than the constant defined above, specifying a fragmentation value 'x' |
548 | * means that the event can be fragmented but only the first 'x' will be | 627 | * means that the event can be fragmented but only the first 'x' will be |
549 | * scheduled. | 628 | * scheduled. |
550 | */ | 629 | */ |
551 | enum { | 630 | enum { |
552 | TE_FRAG_NONE = 0, | 631 | TE_V2_FRAG_NONE = 0, |
553 | TE_FRAG_SINGLE = 1, | 632 | TE_V2_FRAG_SINGLE = 1, |
554 | TE_FRAG_DUAL = 2, | 633 | TE_V2_FRAG_DUAL = 2, |
555 | TE_FRAG_ENDLESS = 0xffffffff | 634 | TE_V2_FRAG_MAX = 0xfe, |
635 | TE_V2_FRAG_ENDLESS = 0xff | ||
556 | }; | 636 | }; |
557 | 637 | ||
558 | /* Repeat the time event endlessly (until removed) */ | 638 | /* Repeat the time event endlessly (until removed) */ |
559 | #define TE_REPEAT_ENDLESS (0xffffffff) | 639 | #define TE_V2_REPEAT_ENDLESS 0xff |
560 | /* If a Time Event has bounded repetitions, this is the maximal value */ | 640 | /* If a Time Event has bounded repetitions, this is the maximal value */ |
561 | #define TE_REPEAT_MAX_MSK (0x0fffffff) | 641 | #define TE_V2_REPEAT_MAX 0xfe |
562 | /* If a Time Event can be fragmented, this is the max number of fragments */ | 642 | |
563 | #define TE_FRAG_MAX_MSK (0x0fffffff) | 643 | #define TE_V2_PLACEMENT_POS 12 |
644 | #define TE_V2_ABSENCE_POS 15 | ||
645 | |||
646 | /* Time event policy values (for time event cmd api v2) | ||
647 | * A notification (both event and fragment) includes a status indicating weather | ||
648 | * the FW was able to schedule the event or not. For fragment start/end | ||
649 | * notification the status is always success. There is no start/end fragment | ||
650 | * notification for monolithic events. | ||
651 | * | ||
652 | * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable | ||
653 | * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start | ||
654 | * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end | ||
655 | * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use | ||
656 | * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use. | ||
657 | * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start | ||
658 | * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end | ||
659 | * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use. | ||
660 | * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use. | ||
661 | * @TE_V2_DEP_OTHER: depends on another time event | ||
662 | * @TE_V2_DEP_TSF: depends on a specific time | ||
663 | * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC | ||
664 | * @TE_V2_ABSENCE: are we present or absent during the Time Event. | ||
665 | */ | ||
666 | enum { | ||
667 | TE_V2_DEFAULT_POLICY = 0x0, | ||
668 | |||
669 | /* notifications (event start/stop, fragment start/stop) */ | ||
670 | TE_V2_NOTIF_HOST_EVENT_START = BIT(0), | ||
671 | TE_V2_NOTIF_HOST_EVENT_END = BIT(1), | ||
672 | TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2), | ||
673 | TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3), | ||
674 | |||
675 | TE_V2_NOTIF_HOST_FRAG_START = BIT(4), | ||
676 | TE_V2_NOTIF_HOST_FRAG_END = BIT(5), | ||
677 | TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6), | ||
678 | TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7), | ||
679 | |||
680 | TE_V2_NOTIF_MSK = 0xff, | ||
681 | |||
682 | /* placement characteristics */ | ||
683 | TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS), | ||
684 | TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1), | ||
685 | TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2), | ||
686 | |||
687 | /* are we present or absent during the Time Event. */ | ||
688 | TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS), | ||
689 | }; | ||
564 | 690 | ||
565 | /** | 691 | /** |
566 | * struct iwl_time_event_cmd - configuring Time Events | 692 | * struct iwl_time_event_cmd_api_v2 - configuring Time Events |
693 | * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also | ||
694 | * with version 1. determined by IWL_UCODE_TLV_FLAGS) | ||
567 | * ( TIME_EVENT_CMD = 0x29 ) | 695 | * ( TIME_EVENT_CMD = 0x29 ) |
568 | * @id_and_color: ID and color of the relevant MAC | 696 | * @id_and_color: ID and color of the relevant MAC |
569 | * @action: action to perform, one of FW_CTXT_ACTION_* | 697 | * @action: action to perform, one of FW_CTXT_ACTION_* |
@@ -575,32 +703,30 @@ enum { | |||
575 | * @max_delay: maximum delay to event's start (apply time), in TU | 703 | * @max_delay: maximum delay to event's start (apply time), in TU |
576 | * @depends_on: the unique ID of the event we depend on (if any) | 704 | * @depends_on: the unique ID of the event we depend on (if any) |
577 | * @interval: interval between repetitions, in TU | 705 | * @interval: interval between repetitions, in TU |
578 | * @interval_reciprocal: 2^32 / interval | ||
579 | * @duration: duration of event in TU | 706 | * @duration: duration of event in TU |
580 | * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS | 707 | * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS |
581 | * @dep_policy: one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF | ||
582 | * @is_present: 0 or 1, are we present or absent during the Time Event | ||
583 | * @max_frags: maximal number of fragments the Time Event can be divided to | 708 | * @max_frags: maximal number of fragments the Time Event can be divided to |
584 | * @notify: notifications using TE_NOTIF_* (whom to notify when) | 709 | * @policy: defines whether uCode shall notify the host or other uCode modules |
710 | * on event and/or fragment start and/or end | ||
711 | * using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF | ||
712 | * TE_EVENT_SOCIOPATHIC | ||
713 | * using TE_ABSENCE and using TE_NOTIF_* | ||
585 | */ | 714 | */ |
586 | struct iwl_time_event_cmd { | 715 | struct iwl_time_event_cmd_v2 { |
587 | /* COMMON_INDEX_HDR_API_S_VER_1 */ | 716 | /* COMMON_INDEX_HDR_API_S_VER_1 */ |
588 | __le32 id_and_color; | 717 | __le32 id_and_color; |
589 | __le32 action; | 718 | __le32 action; |
590 | __le32 id; | 719 | __le32 id; |
591 | /* MAC_TIME_EVENT_DATA_API_S_VER_1 */ | 720 | /* MAC_TIME_EVENT_DATA_API_S_VER_2 */ |
592 | __le32 apply_time; | 721 | __le32 apply_time; |
593 | __le32 max_delay; | 722 | __le32 max_delay; |
594 | __le32 dep_policy; | ||
595 | __le32 depends_on; | 723 | __le32 depends_on; |
596 | __le32 is_present; | ||
597 | __le32 max_frags; | ||
598 | __le32 interval; | 724 | __le32 interval; |
599 | __le32 interval_reciprocal; | ||
600 | __le32 duration; | 725 | __le32 duration; |
601 | __le32 repeat; | 726 | u8 repeat; |
602 | __le32 notify; | 727 | u8 max_frags; |
603 | } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_1 */ | 728 | __le16 policy; |
729 | } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */ | ||
604 | 730 | ||
605 | /** | 731 | /** |
606 | * struct iwl_time_event_resp - response structure to iwl_time_event_cmd | 732 | * struct iwl_time_event_resp - response structure to iwl_time_event_cmd |
@@ -1195,7 +1321,7 @@ struct mvm_statistics_general { | |||
1195 | struct mvm_statistics_general_common common; | 1321 | struct mvm_statistics_general_common common; |
1196 | __le32 beacon_filtered; | 1322 | __le32 beacon_filtered; |
1197 | __le32 missed_beacons; | 1323 | __le32 missed_beacons; |
1198 | __s8 beacon_filter_everage_energy; | 1324 | __s8 beacon_filter_average_energy; |
1199 | __s8 beacon_filter_reason; | 1325 | __s8 beacon_filter_reason; |
1200 | __s8 beacon_filter_current_energy; | 1326 | __s8 beacon_filter_current_energy; |
1201 | __s8 beacon_filter_reserved; | 1327 | __s8 beacon_filter_reserved; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 995f0250105e..9833cdf6177c 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -155,7 +155,8 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
155 | IEEE80211_HW_TIMING_BEACON_ONLY | | 155 | IEEE80211_HW_TIMING_BEACON_ONLY | |
156 | IEEE80211_HW_CONNECTION_MONITOR | | 156 | IEEE80211_HW_CONNECTION_MONITOR | |
157 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | | 157 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | |
158 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; | 158 | IEEE80211_HW_SUPPORTS_STATIC_SMPS | |
159 | IEEE80211_HW_SUPPORTS_UAPSD; | ||
159 | 160 | ||
160 | hw->queues = IWL_MVM_FIRST_AGG_QUEUE; | 161 | hw->queues = IWL_MVM_FIRST_AGG_QUEUE; |
161 | hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE; | 162 | hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE; |
@@ -190,6 +191,8 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
190 | 191 | ||
191 | hw->wiphy->max_remain_on_channel_duration = 10000; | 192 | hw->wiphy->max_remain_on_channel_duration = 10000; |
192 | hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; | 193 | hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; |
194 | hw->uapsd_queues = IWL_UAPSD_AC_INFO; | ||
195 | hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; | ||
193 | 196 | ||
194 | /* Extract MAC address */ | 197 | /* Extract MAC address */ |
195 | memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN); | 198 | memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN); |
@@ -577,7 +580,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, | |||
577 | vif->type == NL80211_IFTYPE_STATION && !vif->p2p && | 580 | vif->type == NL80211_IFTYPE_STATION && !vif->p2p && |
578 | mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BF_UPDATED){ | 581 | mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BF_UPDATED){ |
579 | mvm->bf_allowed_vif = mvmvif; | 582 | mvm->bf_allowed_vif = mvmvif; |
580 | vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER; | 583 | vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | |
584 | IEEE80211_VIF_SUPPORTS_CQM_RSSI; | ||
581 | } | 585 | } |
582 | 586 | ||
583 | /* | 587 | /* |
@@ -617,7 +621,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, | |||
617 | out_free_bf: | 621 | out_free_bf: |
618 | if (mvm->bf_allowed_vif == mvmvif) { | 622 | if (mvm->bf_allowed_vif == mvmvif) { |
619 | mvm->bf_allowed_vif = NULL; | 623 | mvm->bf_allowed_vif = NULL; |
620 | vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER; | 624 | vif->driver_flags &= ~(IEEE80211_VIF_BEACON_FILTER | |
625 | IEEE80211_VIF_SUPPORTS_CQM_RSSI); | ||
621 | } | 626 | } |
622 | out_remove_mac: | 627 | out_remove_mac: |
623 | mvmvif->phy_ctxt = NULL; | 628 | mvmvif->phy_ctxt = NULL; |
@@ -683,7 +688,8 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw, | |||
683 | 688 | ||
684 | if (mvm->bf_allowed_vif == mvmvif) { | 689 | if (mvm->bf_allowed_vif == mvmvif) { |
685 | mvm->bf_allowed_vif = NULL; | 690 | mvm->bf_allowed_vif = NULL; |
686 | vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER; | 691 | vif->driver_flags &= ~(IEEE80211_VIF_BEACON_FILTER | |
692 | IEEE80211_VIF_SUPPORTS_CQM_RSSI); | ||
687 | } | 693 | } |
688 | 694 | ||
689 | iwl_mvm_vif_dbgfs_clean(mvm, vif); | 695 | iwl_mvm_vif_dbgfs_clean(mvm, vif); |
@@ -801,6 +807,10 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
801 | if (ret) | 807 | if (ret) |
802 | IWL_ERR(mvm, "failed to update quotas\n"); | 808 | IWL_ERR(mvm, "failed to update quotas\n"); |
803 | } | 809 | } |
810 | |||
811 | /* reset rssi values */ | ||
812 | mvmvif->bf_data.ave_beacon_signal = 0; | ||
813 | |||
804 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD)) { | 814 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD)) { |
805 | /* Workaround for FW bug, otherwise FW disables device | 815 | /* Workaround for FW bug, otherwise FW disables device |
806 | * power save upon disassociation | 816 | * power save upon disassociation |
@@ -817,7 +827,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
817 | */ | 827 | */ |
818 | iwl_mvm_remove_time_event(mvm, mvmvif, | 828 | iwl_mvm_remove_time_event(mvm, mvmvif, |
819 | &mvmvif->time_event_data); | 829 | &mvmvif->time_event_data); |
820 | } else if (changes & BSS_CHANGED_PS) { | 830 | } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_QOS)) { |
821 | ret = iwl_mvm_power_update_mode(mvm, vif); | 831 | ret = iwl_mvm_power_update_mode(mvm, vif); |
822 | if (ret) | 832 | if (ret) |
823 | IWL_ERR(mvm, "failed to update power mode\n"); | 833 | IWL_ERR(mvm, "failed to update power mode\n"); |
@@ -827,6 +837,15 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
827 | bss_conf->txpower); | 837 | bss_conf->txpower); |
828 | iwl_mvm_set_tx_power(mvm, vif, bss_conf->txpower); | 838 | iwl_mvm_set_tx_power(mvm, vif, bss_conf->txpower); |
829 | } | 839 | } |
840 | |||
841 | if (changes & BSS_CHANGED_CQM) { | ||
842 | IWL_DEBUG_MAC80211(mvm, "cqm info_changed"); | ||
843 | /* reset cqm events tracking */ | ||
844 | mvmvif->bf_data.last_cqm_event = 0; | ||
845 | ret = iwl_mvm_update_beacon_filter(mvm, vif); | ||
846 | if (ret) | ||
847 | IWL_ERR(mvm, "failed to update CQM thresholds\n"); | ||
848 | } | ||
830 | } | 849 | } |
831 | 850 | ||
832 | static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | 851 | static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 4173bb57585f..b0389279cc1e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -153,6 +153,11 @@ enum iwl_power_scheme { | |||
153 | }; | 153 | }; |
154 | 154 | ||
155 | #define IWL_CONN_MAX_LISTEN_INTERVAL 70 | 155 | #define IWL_CONN_MAX_LISTEN_INTERVAL 70 |
156 | #define IWL_UAPSD_AC_INFO (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |\ | ||
157 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |\ | ||
158 | IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |\ | ||
159 | IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) | ||
160 | #define IWL_UAPSD_MAX_SP IEEE80211_WMM_IE_STA_QOSINFO_SP_2 | ||
156 | 161 | ||
157 | struct iwl_mvm_power_ops { | 162 | struct iwl_mvm_power_ops { |
158 | int (*power_update_mode)(struct iwl_mvm *mvm, | 163 | int (*power_update_mode)(struct iwl_mvm *mvm, |
@@ -175,6 +180,7 @@ enum iwl_dbgfs_pm_mask { | |||
175 | MVM_DEBUGFS_PM_DISABLE_POWER_OFF = BIT(5), | 180 | MVM_DEBUGFS_PM_DISABLE_POWER_OFF = BIT(5), |
176 | MVM_DEBUGFS_PM_LPRX_ENA = BIT(6), | 181 | MVM_DEBUGFS_PM_LPRX_ENA = BIT(6), |
177 | MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7), | 182 | MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7), |
183 | MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8), | ||
178 | }; | 184 | }; |
179 | 185 | ||
180 | struct iwl_dbgfs_pm { | 186 | struct iwl_dbgfs_pm { |
@@ -186,6 +192,7 @@ struct iwl_dbgfs_pm { | |||
186 | bool disable_power_off; | 192 | bool disable_power_off; |
187 | bool lprx_ena; | 193 | bool lprx_ena; |
188 | u32 lprx_rssi_threshold; | 194 | u32 lprx_rssi_threshold; |
195 | bool snooze_ena; | ||
189 | int mask; | 196 | int mask; |
190 | }; | 197 | }; |
191 | 198 | ||
@@ -228,6 +235,21 @@ enum iwl_mvm_smps_type_request { | |||
228 | }; | 235 | }; |
229 | 236 | ||
230 | /** | 237 | /** |
238 | * struct iwl_mvm_vif_bf_data - beacon filtering related data | ||
239 | * @bf_enabled: indicates if beacon filtering is enabled | ||
240 | * @ba_enabled: indicated if beacon abort is enabled | ||
241 | * @last_beacon_signal: last beacon rssi signal in dbm | ||
242 | * @ave_beacon_signal: average beacon signal | ||
243 | * @last_cqm_event: rssi of the last cqm event | ||
244 | */ | ||
245 | struct iwl_mvm_vif_bf_data { | ||
246 | bool bf_enabled; | ||
247 | bool ba_enabled; | ||
248 | s8 ave_beacon_signal; | ||
249 | s8 last_cqm_event; | ||
250 | }; | ||
251 | |||
252 | /** | ||
231 | * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context | 253 | * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context |
232 | * @id: between 0 and 3 | 254 | * @id: between 0 and 3 |
233 | * @color: to solve races upon MAC addition and removal | 255 | * @color: to solve races upon MAC addition and removal |
@@ -252,8 +274,7 @@ struct iwl_mvm_vif { | |||
252 | bool uploaded; | 274 | bool uploaded; |
253 | bool ap_active; | 275 | bool ap_active; |
254 | bool monitor_active; | 276 | bool monitor_active; |
255 | /* indicate whether beacon filtering is enabled */ | 277 | struct iwl_mvm_vif_bf_data bf_data; |
256 | bool bf_enabled; | ||
257 | 278 | ||
258 | u32 ap_beacon_time; | 279 | u32 ap_beacon_time; |
259 | 280 | ||
@@ -754,6 +775,8 @@ int iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm, | |||
754 | struct iwl_beacon_filter_cmd *cmd); | 775 | struct iwl_beacon_filter_cmd *cmd); |
755 | int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, | 776 | int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, |
756 | struct ieee80211_vif *vif, bool enable); | 777 | struct ieee80211_vif *vif, bool enable); |
778 | int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm, | ||
779 | struct ieee80211_vif *vif); | ||
757 | 780 | ||
758 | /* SMPS */ | 781 | /* SMPS */ |
759 | void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 782 | void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c index 4e7c9f245846..21407a353a3b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/power.c +++ b/drivers/net/wireless/iwlwifi/mvm/power.c | |||
@@ -110,6 +110,23 @@ int iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm, | |||
110 | return ret; | 110 | return ret; |
111 | } | 111 | } |
112 | 112 | ||
113 | static | ||
114 | void iwl_mvm_beacon_filter_set_cqm_params(struct iwl_mvm *mvm, | ||
115 | struct ieee80211_vif *vif, | ||
116 | struct iwl_beacon_filter_cmd *cmd) | ||
117 | { | ||
118 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
119 | |||
120 | if (vif->bss_conf.cqm_rssi_thold) { | ||
121 | cmd->bf_energy_delta = | ||
122 | cpu_to_le32(vif->bss_conf.cqm_rssi_hyst); | ||
123 | /* fw uses an absolute value for this */ | ||
124 | cmd->bf_roaming_state = | ||
125 | cpu_to_le32(-vif->bss_conf.cqm_rssi_thold); | ||
126 | } | ||
127 | cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->bf_data.ba_enabled); | ||
128 | } | ||
129 | |||
113 | int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, | 130 | int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, |
114 | struct ieee80211_vif *vif, bool enable) | 131 | struct ieee80211_vif *vif, bool enable) |
115 | { | 132 | { |
@@ -120,12 +137,14 @@ int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, | |||
120 | .ba_enable_beacon_abort = cpu_to_le32(enable), | 137 | .ba_enable_beacon_abort = cpu_to_le32(enable), |
121 | }; | 138 | }; |
122 | 139 | ||
123 | if (!mvmvif->bf_enabled) | 140 | if (!mvmvif->bf_data.bf_enabled) |
124 | return 0; | 141 | return 0; |
125 | 142 | ||
126 | if (mvm->cur_ucode == IWL_UCODE_WOWLAN) | 143 | if (mvm->cur_ucode == IWL_UCODE_WOWLAN) |
127 | cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3); | 144 | cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3); |
128 | 145 | ||
146 | mvmvif->bf_data.ba_enabled = enable; | ||
147 | iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, &cmd); | ||
129 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); | 148 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); |
130 | return iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); | 149 | return iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); |
131 | } | 150 | } |
@@ -140,17 +159,30 @@ static void iwl_mvm_power_log(struct iwl_mvm *mvm, | |||
140 | IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n", | 159 | IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n", |
141 | le16_to_cpu(cmd->keep_alive_seconds)); | 160 | le16_to_cpu(cmd->keep_alive_seconds)); |
142 | 161 | ||
143 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)) { | 162 | if (!(cmd->flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK))) { |
144 | IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n", | 163 | IWL_DEBUG_POWER(mvm, "Disable power management\n"); |
145 | le32_to_cpu(cmd->rx_data_timeout)); | 164 | return; |
146 | IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n", | 165 | } |
147 | le32_to_cpu(cmd->tx_data_timeout)); | 166 | |
148 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK)) | 167 | IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n", |
149 | IWL_DEBUG_POWER(mvm, "DTIM periods to skip = %u\n", | 168 | le32_to_cpu(cmd->rx_data_timeout)); |
150 | cmd->skip_dtim_periods); | 169 | IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n", |
151 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK)) | 170 | le32_to_cpu(cmd->tx_data_timeout)); |
152 | IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n", | 171 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK)) |
153 | cmd->lprx_rssi_threshold); | 172 | IWL_DEBUG_POWER(mvm, "DTIM periods to skip = %u\n", |
173 | cmd->skip_dtim_periods); | ||
174 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK)) | ||
175 | IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n", | ||
176 | cmd->lprx_rssi_threshold); | ||
177 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) { | ||
178 | IWL_DEBUG_POWER(mvm, "uAPSD enabled\n"); | ||
179 | IWL_DEBUG_POWER(mvm, "Rx timeout (uAPSD) = %u usec\n", | ||
180 | le32_to_cpu(cmd->rx_data_timeout_uapsd)); | ||
181 | IWL_DEBUG_POWER(mvm, "Tx timeout (uAPSD) = %u usec\n", | ||
182 | le32_to_cpu(cmd->tx_data_timeout_uapsd)); | ||
183 | IWL_DEBUG_POWER(mvm, "QNDP TID = %d\n", cmd->qndp_tid); | ||
184 | IWL_DEBUG_POWER(mvm, "ACs flags = 0x%x\n", cmd->uapsd_ac_flags); | ||
185 | IWL_DEBUG_POWER(mvm, "Max SP = %d\n", cmd->uapsd_max_sp); | ||
154 | } | 186 | } |
155 | } | 187 | } |
156 | 188 | ||
@@ -166,6 +198,8 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
166 | bool radar_detect = false; | 198 | bool radar_detect = false; |
167 | struct iwl_mvm_vif *mvmvif __maybe_unused = | 199 | struct iwl_mvm_vif *mvmvif __maybe_unused = |
168 | iwl_mvm_vif_from_mac80211(vif); | 200 | iwl_mvm_vif_from_mac80211(vif); |
201 | enum ieee80211_ac_numbers ac; | ||
202 | bool tid_found = false; | ||
169 | 203 | ||
170 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, | 204 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, |
171 | mvmvif->color)); | 205 | mvmvif->color)); |
@@ -235,6 +269,63 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
235 | cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT); | 269 | cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT); |
236 | } | 270 | } |
237 | 271 | ||
272 | for (ac = IEEE80211_AC_VO; ac <= IEEE80211_AC_BK; ac++) { | ||
273 | if (!mvmvif->queue_params[ac].uapsd) | ||
274 | continue; | ||
275 | |||
276 | cmd->flags |= cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK); | ||
277 | cmd->uapsd_ac_flags |= BIT(ac); | ||
278 | |||
279 | /* QNDP TID - the highest TID with no admission control */ | ||
280 | if (!tid_found && !mvmvif->queue_params[ac].acm) { | ||
281 | tid_found = true; | ||
282 | switch (ac) { | ||
283 | case IEEE80211_AC_VO: | ||
284 | cmd->qndp_tid = 6; | ||
285 | break; | ||
286 | case IEEE80211_AC_VI: | ||
287 | cmd->qndp_tid = 5; | ||
288 | break; | ||
289 | case IEEE80211_AC_BE: | ||
290 | cmd->qndp_tid = 0; | ||
291 | break; | ||
292 | case IEEE80211_AC_BK: | ||
293 | cmd->qndp_tid = 1; | ||
294 | break; | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | |||
299 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) { | ||
300 | cmd->rx_data_timeout_uapsd = | ||
301 | cpu_to_le32(IWL_MVM_UAPSD_RX_DATA_TIMEOUT); | ||
302 | cmd->tx_data_timeout_uapsd = | ||
303 | cpu_to_le32(IWL_MVM_UAPSD_TX_DATA_TIMEOUT); | ||
304 | |||
305 | if (cmd->uapsd_ac_flags == (BIT(IEEE80211_AC_VO) | | ||
306 | BIT(IEEE80211_AC_VI) | | ||
307 | BIT(IEEE80211_AC_BE) | | ||
308 | BIT(IEEE80211_AC_BK))) { | ||
309 | cmd->flags |= cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK); | ||
310 | cmd->snooze_interval = | ||
311 | cpu_to_le16(IWL_MVM_PS_SNOOZE_INTERVAL); | ||
312 | cmd->snooze_window = | ||
313 | (mvm->cur_ucode == IWL_UCODE_WOWLAN) ? | ||
314 | cpu_to_le16(IWL_MVM_WOWLAN_PS_SNOOZE_WINDOW) : | ||
315 | cpu_to_le16(IWL_MVM_PS_SNOOZE_WINDOW); | ||
316 | } | ||
317 | |||
318 | cmd->uapsd_max_sp = IWL_UAPSD_MAX_SP; | ||
319 | cmd->heavy_tx_thld_packets = | ||
320 | IWL_MVM_PS_HEAVY_TX_THLD_PACKETS; | ||
321 | cmd->heavy_rx_thld_packets = | ||
322 | IWL_MVM_PS_HEAVY_RX_THLD_PACKETS; | ||
323 | cmd->heavy_tx_thld_percentage = | ||
324 | IWL_MVM_PS_HEAVY_TX_THLD_PERCENT; | ||
325 | cmd->heavy_rx_thld_percentage = | ||
326 | IWL_MVM_PS_HEAVY_RX_THLD_PERCENT; | ||
327 | } | ||
328 | |||
238 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 329 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
239 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_KEEP_ALIVE) | 330 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_KEEP_ALIVE) |
240 | cmd->keep_alive_seconds = | 331 | cmd->keep_alive_seconds = |
@@ -263,6 +354,14 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
263 | } | 354 | } |
264 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD) | 355 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD) |
265 | cmd->lprx_rssi_threshold = mvmvif->dbgfs_pm.lprx_rssi_threshold; | 356 | cmd->lprx_rssi_threshold = mvmvif->dbgfs_pm.lprx_rssi_threshold; |
357 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SNOOZE_ENABLE) { | ||
358 | if (mvmvif->dbgfs_pm.snooze_ena) | ||
359 | cmd->flags |= | ||
360 | cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK); | ||
361 | else | ||
362 | cmd->flags &= | ||
363 | cpu_to_le16(~POWER_FLAGS_SNOOZE_ENA_MSK); | ||
364 | } | ||
266 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | 365 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
267 | } | 366 | } |
268 | 367 | ||
@@ -342,8 +441,6 @@ static int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, | |||
342 | (cmd.flags & | 441 | (cmd.flags & |
343 | cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK)) ? | 442 | cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK)) ? |
344 | 0 : 1); | 443 | 0 : 1); |
345 | pos += scnprintf(buf+pos, bufsz-pos, "skip_dtim_periods = %d\n", | ||
346 | cmd.skip_dtim_periods); | ||
347 | pos += scnprintf(buf+pos, bufsz-pos, "power_scheme = %d\n", | 444 | pos += scnprintf(buf+pos, bufsz-pos, "power_scheme = %d\n", |
348 | iwlmvm_mod_params.power_scheme); | 445 | iwlmvm_mod_params.power_scheme); |
349 | pos += scnprintf(buf+pos, bufsz-pos, "flags = 0x%x\n", | 446 | pos += scnprintf(buf+pos, bufsz-pos, "flags = 0x%x\n", |
@@ -356,14 +453,64 @@ static int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, | |||
356 | (cmd.flags & | 453 | (cmd.flags & |
357 | cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK)) ? | 454 | cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK)) ? |
358 | 1 : 0); | 455 | 1 : 0); |
359 | pos += scnprintf(buf+pos, bufsz-pos, "rx_data_timeout = %d\n", | 456 | pos += scnprintf(buf+pos, bufsz-pos, "skip_dtim_periods = %d\n", |
360 | le32_to_cpu(cmd.rx_data_timeout)); | 457 | cmd.skip_dtim_periods); |
361 | pos += scnprintf(buf+pos, bufsz-pos, "tx_data_timeout = %d\n", | 458 | if (!(cmd.flags & |
362 | le32_to_cpu(cmd.tx_data_timeout)); | 459 | cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK))) { |
460 | pos += scnprintf(buf+pos, bufsz-pos, | ||
461 | "rx_data_timeout = %d\n", | ||
462 | le32_to_cpu(cmd.rx_data_timeout)); | ||
463 | pos += scnprintf(buf+pos, bufsz-pos, | ||
464 | "tx_data_timeout = %d\n", | ||
465 | le32_to_cpu(cmd.tx_data_timeout)); | ||
466 | } | ||
363 | if (cmd.flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK)) | 467 | if (cmd.flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK)) |
364 | pos += scnprintf(buf+pos, bufsz-pos, | 468 | pos += scnprintf(buf+pos, bufsz-pos, |
365 | "lprx_rssi_threshold = %d\n", | 469 | "lprx_rssi_threshold = %d\n", |
366 | cmd.lprx_rssi_threshold); | 470 | cmd.lprx_rssi_threshold); |
471 | if (cmd.flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) { | ||
472 | pos += | ||
473 | scnprintf(buf+pos, bufsz-pos, | ||
474 | "rx_data_timeout_uapsd = %d\n", | ||
475 | le32_to_cpu(cmd.rx_data_timeout_uapsd)); | ||
476 | pos += | ||
477 | scnprintf(buf+pos, bufsz-pos, | ||
478 | "tx_data_timeout_uapsd = %d\n", | ||
479 | le32_to_cpu(cmd.tx_data_timeout_uapsd)); | ||
480 | pos += scnprintf(buf+pos, bufsz-pos, "qndp_tid = %d\n", | ||
481 | cmd.qndp_tid); | ||
482 | pos += scnprintf(buf+pos, bufsz-pos, | ||
483 | "uapsd_ac_flags = 0x%x\n", | ||
484 | cmd.uapsd_ac_flags); | ||
485 | pos += scnprintf(buf+pos, bufsz-pos, | ||
486 | "uapsd_max_sp = %d\n", | ||
487 | cmd.uapsd_max_sp); | ||
488 | pos += scnprintf(buf+pos, bufsz-pos, | ||
489 | "heavy_tx_thld_packets = %d\n", | ||
490 | cmd.heavy_tx_thld_packets); | ||
491 | pos += scnprintf(buf+pos, bufsz-pos, | ||
492 | "heavy_rx_thld_packets = %d\n", | ||
493 | cmd.heavy_rx_thld_packets); | ||
494 | pos += scnprintf(buf+pos, bufsz-pos, | ||
495 | "heavy_tx_thld_percentage = %d\n", | ||
496 | cmd.heavy_tx_thld_percentage); | ||
497 | pos += scnprintf(buf+pos, bufsz-pos, | ||
498 | "heavy_rx_thld_percentage = %d\n", | ||
499 | cmd.heavy_rx_thld_percentage); | ||
500 | pos += | ||
501 | scnprintf(buf+pos, bufsz-pos, "snooze_enable = %d\n", | ||
502 | (cmd.flags & | ||
503 | cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) ? | ||
504 | 1 : 0); | ||
505 | } | ||
506 | if (cmd.flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) { | ||
507 | pos += scnprintf(buf+pos, bufsz-pos, | ||
508 | "snooze_interval = %d\n", | ||
509 | cmd.snooze_interval); | ||
510 | pos += scnprintf(buf+pos, bufsz-pos, | ||
511 | "snooze_window = %d\n", | ||
512 | cmd.snooze_window); | ||
513 | } | ||
367 | } | 514 | } |
368 | return pos; | 515 | return pos; |
369 | } | 516 | } |
@@ -417,11 +564,12 @@ int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, | |||
417 | vif->type != NL80211_IFTYPE_STATION || vif->p2p) | 564 | vif->type != NL80211_IFTYPE_STATION || vif->p2p) |
418 | return 0; | 565 | return 0; |
419 | 566 | ||
567 | iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, &cmd); | ||
420 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); | 568 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); |
421 | ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); | 569 | ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); |
422 | 570 | ||
423 | if (!ret) | 571 | if (!ret) |
424 | mvmvif->bf_enabled = true; | 572 | mvmvif->bf_data.bf_enabled = true; |
425 | 573 | ||
426 | return ret; | 574 | return ret; |
427 | } | 575 | } |
@@ -440,11 +588,22 @@ int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, | |||
440 | ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); | 588 | ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); |
441 | 589 | ||
442 | if (!ret) | 590 | if (!ret) |
443 | mvmvif->bf_enabled = false; | 591 | mvmvif->bf_data.bf_enabled = false; |
444 | 592 | ||
445 | return ret; | 593 | return ret; |
446 | } | 594 | } |
447 | 595 | ||
596 | int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm, | ||
597 | struct ieee80211_vif *vif) | ||
598 | { | ||
599 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
600 | |||
601 | if (!mvmvif->bf_data.bf_enabled) | ||
602 | return 0; | ||
603 | |||
604 | return iwl_mvm_enable_beacon_filter(mvm, vif); | ||
605 | } | ||
606 | |||
448 | const struct iwl_mvm_power_ops pm_mac_ops = { | 607 | const struct iwl_mvm_power_ops pm_mac_ops = { |
449 | .power_update_mode = iwl_mvm_power_mac_update_mode, | 608 | .power_update_mode = iwl_mvm_power_mac_update_mode, |
450 | .power_disable = iwl_mvm_power_mac_disable, | 609 | .power_disable = iwl_mvm_power_mac_disable, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index c47a635b56ff..4ffaa3fa153f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
@@ -82,41 +82,35 @@ static const u8 ant_toggle_lookup[] = { | |||
82 | [ANT_ABC] = ANT_ABC, | 82 | [ANT_ABC] = ANT_ABC, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ | 85 | #define IWL_DECLARE_RATE_INFO(r, s, rp, rn) \ |
86 | [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ | 86 | [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ |
87 | IWL_RATE_SISO_##s##M_PLCP, \ | 87 | IWL_RATE_SISO_##s##M_PLCP, \ |
88 | IWL_RATE_MIMO2_##s##M_PLCP,\ | 88 | IWL_RATE_MIMO2_##s##M_PLCP,\ |
89 | IWL_RATE_MIMO3_##s##M_PLCP,\ | ||
90 | IWL_RATE_##r##M_IEEE, \ | ||
91 | IWL_RATE_##ip##M_INDEX, \ | ||
92 | IWL_RATE_##in##M_INDEX, \ | ||
93 | IWL_RATE_##rp##M_INDEX, \ | 89 | IWL_RATE_##rp##M_INDEX, \ |
94 | IWL_RATE_##rn##M_INDEX, \ | 90 | IWL_RATE_##rn##M_INDEX } |
95 | IWL_RATE_##pp##M_INDEX, \ | ||
96 | IWL_RATE_##np##M_INDEX } | ||
97 | 91 | ||
98 | /* | 92 | /* |
99 | * Parameter order: | 93 | * Parameter order: |
100 | * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate | 94 | * rate, ht rate, prev rate, next rate |
101 | * | 95 | * |
102 | * If there isn't a valid next or previous rate then INV is used which | 96 | * If there isn't a valid next or previous rate then INV is used which |
103 | * maps to IWL_RATE_INVALID | 97 | * maps to IWL_RATE_INVALID |
104 | * | 98 | * |
105 | */ | 99 | */ |
106 | static const struct iwl_rs_rate_info iwl_rates[IWL_RATE_COUNT] = { | 100 | static const struct iwl_rs_rate_info iwl_rates[IWL_RATE_COUNT] = { |
107 | IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ | 101 | IWL_DECLARE_RATE_INFO(1, INV, INV, 2), /* 1mbps */ |
108 | IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ | 102 | IWL_DECLARE_RATE_INFO(2, INV, 1, 5), /* 2mbps */ |
109 | IWL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ | 103 | IWL_DECLARE_RATE_INFO(5, INV, 2, 11), /*5.5mbps */ |
110 | IWL_DECLARE_RATE_INFO(11, INV, 9, 12, 9, 12, 5, 18), /* 11mbps */ | 104 | IWL_DECLARE_RATE_INFO(11, INV, 9, 12), /* 11mbps */ |
111 | IWL_DECLARE_RATE_INFO(6, 6, 5, 9, 5, 11, 5, 11), /* 6mbps */ | 105 | IWL_DECLARE_RATE_INFO(6, 6, 5, 11), /* 6mbps */ |
112 | IWL_DECLARE_RATE_INFO(9, 6, 6, 11, 6, 11, 5, 11), /* 9mbps */ | 106 | IWL_DECLARE_RATE_INFO(9, 6, 6, 11), /* 9mbps */ |
113 | IWL_DECLARE_RATE_INFO(12, 12, 11, 18, 11, 18, 11, 18), /* 12mbps */ | 107 | IWL_DECLARE_RATE_INFO(12, 12, 11, 18), /* 12mbps */ |
114 | IWL_DECLARE_RATE_INFO(18, 18, 12, 24, 12, 24, 11, 24), /* 18mbps */ | 108 | IWL_DECLARE_RATE_INFO(18, 18, 12, 24), /* 18mbps */ |
115 | IWL_DECLARE_RATE_INFO(24, 24, 18, 36, 18, 36, 18, 36), /* 24mbps */ | 109 | IWL_DECLARE_RATE_INFO(24, 24, 18, 36), /* 24mbps */ |
116 | IWL_DECLARE_RATE_INFO(36, 36, 24, 48, 24, 48, 24, 48), /* 36mbps */ | 110 | IWL_DECLARE_RATE_INFO(36, 36, 24, 48), /* 36mbps */ |
117 | IWL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */ | 111 | IWL_DECLARE_RATE_INFO(48, 48, 36, 54), /* 48mbps */ |
118 | IWL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */ | 112 | IWL_DECLARE_RATE_INFO(54, 54, 48, INV), /* 54mbps */ |
119 | IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ | 113 | IWL_DECLARE_RATE_INFO(60, 60, 48, INV), /* 60mbps */ |
120 | /* FIXME:RS: ^^ should be INV (legacy) */ | 114 | /* FIXME:RS: ^^ should be INV (legacy) */ |
121 | }; | 115 | }; |
122 | 116 | ||
@@ -134,9 +128,8 @@ static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) | |||
134 | if (rate_n_flags & RATE_MCS_HT_MSK) { | 128 | if (rate_n_flags & RATE_MCS_HT_MSK) { |
135 | idx = rs_extract_rate(rate_n_flags); | 129 | idx = rs_extract_rate(rate_n_flags); |
136 | 130 | ||
137 | if (idx >= IWL_RATE_MIMO3_6M_PLCP) | 131 | WARN_ON_ONCE(idx >= IWL_RATE_MIMO3_6M_PLCP); |
138 | idx = idx - IWL_RATE_MIMO3_6M_PLCP; | 132 | if (idx >= IWL_RATE_MIMO2_6M_PLCP) |
139 | else if (idx >= IWL_RATE_MIMO2_6M_PLCP) | ||
140 | idx = idx - IWL_RATE_MIMO2_6M_PLCP; | 133 | idx = idx - IWL_RATE_MIMO2_6M_PLCP; |
141 | 134 | ||
142 | idx += IWL_FIRST_OFDM_RATE; | 135 | idx += IWL_FIRST_OFDM_RATE; |
@@ -168,10 +161,10 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search); | |||
168 | 161 | ||
169 | #ifdef CONFIG_MAC80211_DEBUGFS | 162 | #ifdef CONFIG_MAC80211_DEBUGFS |
170 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, | 163 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, |
171 | u32 *rate_n_flags, int index); | 164 | u32 *rate_n_flags); |
172 | #else | 165 | #else |
173 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, | 166 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, |
174 | u32 *rate_n_flags, int index) | 167 | u32 *rate_n_flags) |
175 | {} | 168 | {} |
176 | #endif | 169 | #endif |
177 | 170 | ||
@@ -218,20 +211,6 @@ static s32 expected_tpt_mimo2_40MHz[4][IWL_RATE_COUNT] = { | |||
218 | {0, 0, 0, 0, 186, 0, 329, 439, 527, 667, 764, 803, 838}, /* AGG+SGI */ | 211 | {0, 0, 0, 0, 186, 0, 329, 439, 527, 667, 764, 803, 838}, /* AGG+SGI */ |
219 | }; | 212 | }; |
220 | 213 | ||
221 | static s32 expected_tpt_mimo3_20MHz[4][IWL_RATE_COUNT] = { | ||
222 | {0, 0, 0, 0, 99, 0, 153, 186, 208, 239, 256, 263, 268}, /* Norm */ | ||
223 | {0, 0, 0, 0, 106, 0, 162, 194, 215, 246, 262, 268, 273}, /* SGI */ | ||
224 | {0, 0, 0, 0, 134, 0, 249, 346, 431, 574, 685, 732, 775}, /* AGG */ | ||
225 | {0, 0, 0, 0, 148, 0, 272, 376, 465, 614, 727, 775, 818}, /* AGG+SGI */ | ||
226 | }; | ||
227 | |||
228 | static s32 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = { | ||
229 | {0, 0, 0, 0, 152, 0, 211, 239, 255, 279, 290, 294, 297}, /* Norm */ | ||
230 | {0, 0, 0, 0, 160, 0, 219, 245, 261, 284, 294, 297, 300}, /* SGI */ | ||
231 | {0, 0, 0, 0, 254, 0, 443, 584, 695, 868, 984, 1030, 1070}, /* AGG */ | ||
232 | {0, 0, 0, 0, 277, 0, 478, 624, 737, 911, 1026, 1070, 1109}, /* AGG+SGI */ | ||
233 | }; | ||
234 | |||
235 | /* mbps, mcs */ | 214 | /* mbps, mcs */ |
236 | static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { | 215 | static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { |
237 | { "1", "BPSK DSSS"}, | 216 | { "1", "BPSK DSSS"}, |
@@ -279,7 +258,6 @@ static void rs_program_fix_rate(struct iwl_mvm *mvm, | |||
279 | lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ | 258 | lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ |
280 | lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ | 259 | lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ |
281 | lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ | 260 | lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ |
282 | lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ | ||
283 | 261 | ||
284 | IWL_DEBUG_RATE(mvm, "sta_id %d rate 0x%X\n", | 262 | IWL_DEBUG_RATE(mvm, "sta_id %d rate 0x%X\n", |
285 | lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); | 263 | lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); |
@@ -459,7 +437,7 @@ static u32 rate_n_flags_from_tbl(struct iwl_mvm *mvm, | |||
459 | else if (is_mimo2(tbl->lq_type)) | 437 | else if (is_mimo2(tbl->lq_type)) |
460 | rate_n_flags |= iwl_rates[index].plcp_mimo2; | 438 | rate_n_flags |= iwl_rates[index].plcp_mimo2; |
461 | else | 439 | else |
462 | rate_n_flags |= iwl_rates[index].plcp_mimo3; | 440 | WARN_ON_ONCE(1); |
463 | } else { | 441 | } else { |
464 | IWL_ERR(mvm, "Invalid tbl->lq_type %d\n", tbl->lq_type); | 442 | IWL_ERR(mvm, "Invalid tbl->lq_type %d\n", tbl->lq_type); |
465 | } | 443 | } |
@@ -497,7 +475,7 @@ static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags, | |||
497 | u8 num_of_ant = get_num_of_ant_from_rate(rate_n_flags); | 475 | u8 num_of_ant = get_num_of_ant_from_rate(rate_n_flags); |
498 | u8 mcs; | 476 | u8 mcs; |
499 | 477 | ||
500 | memset(tbl, 0, sizeof(struct iwl_scale_tbl_info)); | 478 | memset(tbl, 0, offsetof(struct iwl_scale_tbl_info, win)); |
501 | *rate_idx = iwl_hwrate_to_plcp_idx(rate_n_flags); | 479 | *rate_idx = iwl_hwrate_to_plcp_idx(rate_n_flags); |
502 | 480 | ||
503 | if (*rate_idx == IWL_RATE_INVALID) { | 481 | if (*rate_idx == IWL_RATE_INVALID) { |
@@ -536,12 +514,8 @@ static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags, | |||
536 | } else if (mcs <= IWL_RATE_MIMO2_60M_PLCP) { | 514 | } else if (mcs <= IWL_RATE_MIMO2_60M_PLCP) { |
537 | if (num_of_ant == 2) | 515 | if (num_of_ant == 2) |
538 | tbl->lq_type = LQ_MIMO2; | 516 | tbl->lq_type = LQ_MIMO2; |
539 | /* MIMO3 */ | ||
540 | } else { | 517 | } else { |
541 | if (num_of_ant == 3) { | 518 | WARN_ON_ONCE(num_of_ant == 3); |
542 | tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; | ||
543 | tbl->lq_type = LQ_MIMO3; | ||
544 | } | ||
545 | } | 519 | } |
546 | } | 520 | } |
547 | return 0; | 521 | return 0; |
@@ -607,10 +581,10 @@ static u16 rs_get_supported_rates(struct iwl_lq_sta *lq_sta, | |||
607 | } else { | 581 | } else { |
608 | if (is_siso(rate_type)) | 582 | if (is_siso(rate_type)) |
609 | return lq_sta->active_siso_rate; | 583 | return lq_sta->active_siso_rate; |
610 | else if (is_mimo2(rate_type)) | 584 | else { |
585 | WARN_ON_ONCE(!is_mimo2(rate_type)); | ||
611 | return lq_sta->active_mimo2_rate; | 586 | return lq_sta->active_mimo2_rate; |
612 | else | 587 | } |
613 | return lq_sta->active_mimo3_rate; | ||
614 | } | 588 | } |
615 | } | 589 | } |
616 | 590 | ||
@@ -985,7 +959,7 @@ static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, | |||
985 | } | 959 | } |
986 | 960 | ||
987 | /* Choose among many HT tables depending on number of streams | 961 | /* Choose among many HT tables depending on number of streams |
988 | * (SISO/MIMO2/MIMO3), channel width (20/40), SGI, and aggregation | 962 | * (SISO/MIMO2), channel width (20/40), SGI, and aggregation |
989 | * status */ | 963 | * status */ |
990 | if (is_siso(tbl->lq_type) && !tbl->is_ht40) | 964 | if (is_siso(tbl->lq_type) && !tbl->is_ht40) |
991 | ht_tbl_pointer = expected_tpt_siso20MHz; | 965 | ht_tbl_pointer = expected_tpt_siso20MHz; |
@@ -993,12 +967,10 @@ static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, | |||
993 | ht_tbl_pointer = expected_tpt_siso40MHz; | 967 | ht_tbl_pointer = expected_tpt_siso40MHz; |
994 | else if (is_mimo2(tbl->lq_type) && !tbl->is_ht40) | 968 | else if (is_mimo2(tbl->lq_type) && !tbl->is_ht40) |
995 | ht_tbl_pointer = expected_tpt_mimo2_20MHz; | 969 | ht_tbl_pointer = expected_tpt_mimo2_20MHz; |
996 | else if (is_mimo2(tbl->lq_type)) | 970 | else { |
971 | WARN_ON_ONCE(!is_mimo2(tbl->lq_type)); | ||
997 | ht_tbl_pointer = expected_tpt_mimo2_40MHz; | 972 | ht_tbl_pointer = expected_tpt_mimo2_40MHz; |
998 | else if (is_mimo3(tbl->lq_type) && !tbl->is_ht40) | 973 | } |
999 | ht_tbl_pointer = expected_tpt_mimo3_20MHz; | ||
1000 | else /* if (is_mimo3(tbl->lq_type)) <-- must be true */ | ||
1001 | ht_tbl_pointer = expected_tpt_mimo3_40MHz; | ||
1002 | 974 | ||
1003 | if (!tbl->is_SGI && !lq_sta->is_agg) /* Normal */ | 975 | if (!tbl->is_SGI && !lq_sta->is_agg) /* Normal */ |
1004 | tbl->expected_tpt = ht_tbl_pointer[0]; | 976 | tbl->expected_tpt = ht_tbl_pointer[0]; |
@@ -1170,58 +1142,6 @@ static int rs_switch_to_mimo2(struct iwl_mvm *mvm, | |||
1170 | } | 1142 | } |
1171 | 1143 | ||
1172 | /* | 1144 | /* |
1173 | * Set up search table for MIMO3 | ||
1174 | */ | ||
1175 | static int rs_switch_to_mimo3(struct iwl_mvm *mvm, | ||
1176 | struct iwl_lq_sta *lq_sta, | ||
1177 | struct ieee80211_sta *sta, | ||
1178 | struct iwl_scale_tbl_info *tbl, int index) | ||
1179 | { | ||
1180 | u16 rate_mask; | ||
1181 | s32 rate; | ||
1182 | s8 is_green = lq_sta->is_green; | ||
1183 | |||
1184 | if (!sta->ht_cap.ht_supported) | ||
1185 | return -1; | ||
1186 | |||
1187 | if (sta->smps_mode == IEEE80211_SMPS_STATIC) | ||
1188 | return -1; | ||
1189 | |||
1190 | /* Need both Tx chains/antennas to support MIMO */ | ||
1191 | if (num_of_ant(iwl_fw_valid_tx_ant(mvm->fw)) < 3) | ||
1192 | return -1; | ||
1193 | |||
1194 | IWL_DEBUG_RATE(mvm, "LQ: try to switch to MIMO3\n"); | ||
1195 | |||
1196 | tbl->lq_type = LQ_MIMO3; | ||
1197 | tbl->action = 0; | ||
1198 | tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; | ||
1199 | rate_mask = lq_sta->active_mimo3_rate; | ||
1200 | |||
1201 | if (iwl_is_ht40_tx_allowed(sta)) | ||
1202 | tbl->is_ht40 = 1; | ||
1203 | else | ||
1204 | tbl->is_ht40 = 0; | ||
1205 | |||
1206 | rs_set_expected_tpt_table(lq_sta, tbl); | ||
1207 | |||
1208 | rate = rs_get_best_rate(mvm, lq_sta, tbl, rate_mask, index); | ||
1209 | |||
1210 | IWL_DEBUG_RATE(mvm, "LQ: MIMO3 best rate %d mask %X\n", | ||
1211 | rate, rate_mask); | ||
1212 | if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { | ||
1213 | IWL_DEBUG_RATE(mvm, "Can't switch with index %d rate mask %x\n", | ||
1214 | rate, rate_mask); | ||
1215 | return -1; | ||
1216 | } | ||
1217 | tbl->current_rate = rate_n_flags_from_tbl(mvm, tbl, rate, is_green); | ||
1218 | |||
1219 | IWL_DEBUG_RATE(mvm, "LQ: Switch to new mcs %X index is green %X\n", | ||
1220 | tbl->current_rate, is_green); | ||
1221 | return 0; | ||
1222 | } | ||
1223 | |||
1224 | /* | ||
1225 | * Set up search table for SISO | 1145 | * Set up search table for SISO |
1226 | */ | 1146 | */ |
1227 | static int rs_switch_to_siso(struct iwl_mvm *mvm, | 1147 | static int rs_switch_to_siso(struct iwl_mvm *mvm, |
@@ -1330,21 +1250,14 @@ static int rs_move_legacy_other(struct iwl_mvm *mvm, | |||
1330 | } | 1250 | } |
1331 | 1251 | ||
1332 | break; | 1252 | break; |
1333 | case IWL_LEGACY_SWITCH_MIMO2_AB: | 1253 | case IWL_LEGACY_SWITCH_MIMO2: |
1334 | case IWL_LEGACY_SWITCH_MIMO2_AC: | ||
1335 | case IWL_LEGACY_SWITCH_MIMO2_BC: | ||
1336 | IWL_DEBUG_RATE(mvm, "LQ: Legacy switch to MIMO2\n"); | 1254 | IWL_DEBUG_RATE(mvm, "LQ: Legacy switch to MIMO2\n"); |
1337 | 1255 | ||
1338 | /* Set up search table to try MIMO */ | 1256 | /* Set up search table to try MIMO */ |
1339 | memcpy(search_tbl, tbl, sz); | 1257 | memcpy(search_tbl, tbl, sz); |
1340 | search_tbl->is_SGI = 0; | 1258 | search_tbl->is_SGI = 0; |
1341 | 1259 | ||
1342 | if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AB) | 1260 | search_tbl->ant_type = ANT_AB; |
1343 | search_tbl->ant_type = ANT_AB; | ||
1344 | else if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AC) | ||
1345 | search_tbl->ant_type = ANT_AC; | ||
1346 | else | ||
1347 | search_tbl->ant_type = ANT_BC; | ||
1348 | 1261 | ||
1349 | if (!rs_is_valid_ant(valid_tx_ant, | 1262 | if (!rs_is_valid_ant(valid_tx_ant, |
1350 | search_tbl->ant_type)) | 1263 | search_tbl->ant_type)) |
@@ -1357,30 +1270,11 @@ static int rs_move_legacy_other(struct iwl_mvm *mvm, | |||
1357 | goto out; | 1270 | goto out; |
1358 | } | 1271 | } |
1359 | break; | 1272 | break; |
1360 | 1273 | default: | |
1361 | case IWL_LEGACY_SWITCH_MIMO3_ABC: | 1274 | WARN_ON_ONCE(1); |
1362 | IWL_DEBUG_RATE(mvm, "LQ: Legacy switch to MIMO3\n"); | ||
1363 | |||
1364 | /* Set up search table to try MIMO3 */ | ||
1365 | memcpy(search_tbl, tbl, sz); | ||
1366 | search_tbl->is_SGI = 0; | ||
1367 | |||
1368 | search_tbl->ant_type = ANT_ABC; | ||
1369 | |||
1370 | if (!rs_is_valid_ant(valid_tx_ant, | ||
1371 | search_tbl->ant_type)) | ||
1372 | break; | ||
1373 | |||
1374 | ret = rs_switch_to_mimo3(mvm, lq_sta, sta, | ||
1375 | search_tbl, index); | ||
1376 | if (!ret) { | ||
1377 | lq_sta->action_counter = 0; | ||
1378 | goto out; | ||
1379 | } | ||
1380 | break; | ||
1381 | } | 1275 | } |
1382 | tbl->action++; | 1276 | tbl->action++; |
1383 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) | 1277 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO2) |
1384 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; | 1278 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; |
1385 | 1279 | ||
1386 | if (tbl->action == start_action) | 1280 | if (tbl->action == start_action) |
@@ -1392,7 +1286,7 @@ static int rs_move_legacy_other(struct iwl_mvm *mvm, | |||
1392 | out: | 1286 | out: |
1393 | lq_sta->search_better_tbl = 1; | 1287 | lq_sta->search_better_tbl = 1; |
1394 | tbl->action++; | 1288 | tbl->action++; |
1395 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) | 1289 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO2) |
1396 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; | 1290 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; |
1397 | if (update_search_tbl_counter) | 1291 | if (update_search_tbl_counter) |
1398 | search_tbl->action = tbl->action; | 1292 | search_tbl->action = tbl->action; |
@@ -1427,7 +1321,7 @@ static int rs_move_siso_to_other(struct iwl_mvm *mvm, | |||
1427 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | 1321 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: |
1428 | /* avoid antenna B unless MIMO */ | 1322 | /* avoid antenna B unless MIMO */ |
1429 | if (tbl->action == IWL_SISO_SWITCH_ANTENNA2) | 1323 | if (tbl->action == IWL_SISO_SWITCH_ANTENNA2) |
1430 | tbl->action = IWL_SISO_SWITCH_MIMO2_AB; | 1324 | tbl->action = IWL_SISO_SWITCH_MIMO2; |
1431 | break; | 1325 | break; |
1432 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: | 1326 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: |
1433 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: | 1327 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: |
@@ -1469,19 +1363,12 @@ static int rs_move_siso_to_other(struct iwl_mvm *mvm, | |||
1469 | goto out; | 1363 | goto out; |
1470 | } | 1364 | } |
1471 | break; | 1365 | break; |
1472 | case IWL_SISO_SWITCH_MIMO2_AB: | 1366 | case IWL_SISO_SWITCH_MIMO2: |
1473 | case IWL_SISO_SWITCH_MIMO2_AC: | ||
1474 | case IWL_SISO_SWITCH_MIMO2_BC: | ||
1475 | IWL_DEBUG_RATE(mvm, "LQ: SISO switch to MIMO2\n"); | 1367 | IWL_DEBUG_RATE(mvm, "LQ: SISO switch to MIMO2\n"); |
1476 | memcpy(search_tbl, tbl, sz); | 1368 | memcpy(search_tbl, tbl, sz); |
1477 | search_tbl->is_SGI = 0; | 1369 | search_tbl->is_SGI = 0; |
1478 | 1370 | ||
1479 | if (tbl->action == IWL_SISO_SWITCH_MIMO2_AB) | 1371 | search_tbl->ant_type = ANT_AB; |
1480 | search_tbl->ant_type = ANT_AB; | ||
1481 | else if (tbl->action == IWL_SISO_SWITCH_MIMO2_AC) | ||
1482 | search_tbl->ant_type = ANT_AC; | ||
1483 | else | ||
1484 | search_tbl->ant_type = ANT_BC; | ||
1485 | 1372 | ||
1486 | if (!rs_is_valid_ant(valid_tx_ant, | 1373 | if (!rs_is_valid_ant(valid_tx_ant, |
1487 | search_tbl->ant_type)) | 1374 | search_tbl->ant_type)) |
@@ -1522,24 +1409,11 @@ static int rs_move_siso_to_other(struct iwl_mvm *mvm, | |||
1522 | index, is_green); | 1409 | index, is_green); |
1523 | update_search_tbl_counter = 1; | 1410 | update_search_tbl_counter = 1; |
1524 | goto out; | 1411 | goto out; |
1525 | case IWL_SISO_SWITCH_MIMO3_ABC: | 1412 | default: |
1526 | IWL_DEBUG_RATE(mvm, "LQ: SISO switch to MIMO3\n"); | 1413 | WARN_ON_ONCE(1); |
1527 | memcpy(search_tbl, tbl, sz); | ||
1528 | search_tbl->is_SGI = 0; | ||
1529 | search_tbl->ant_type = ANT_ABC; | ||
1530 | |||
1531 | if (!rs_is_valid_ant(valid_tx_ant, | ||
1532 | search_tbl->ant_type)) | ||
1533 | break; | ||
1534 | |||
1535 | ret = rs_switch_to_mimo3(mvm, lq_sta, sta, | ||
1536 | search_tbl, index); | ||
1537 | if (!ret) | ||
1538 | goto out; | ||
1539 | break; | ||
1540 | } | 1414 | } |
1541 | tbl->action++; | 1415 | tbl->action++; |
1542 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) | 1416 | if (tbl->action > IWL_SISO_SWITCH_GI) |
1543 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | 1417 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; |
1544 | 1418 | ||
1545 | if (tbl->action == start_action) | 1419 | if (tbl->action == start_action) |
@@ -1551,7 +1425,7 @@ static int rs_move_siso_to_other(struct iwl_mvm *mvm, | |||
1551 | out: | 1425 | out: |
1552 | lq_sta->search_better_tbl = 1; | 1426 | lq_sta->search_better_tbl = 1; |
1553 | tbl->action++; | 1427 | tbl->action++; |
1554 | if (tbl->action > IWL_SISO_SWITCH_MIMO3_ABC) | 1428 | if (tbl->action > IWL_SISO_SWITCH_GI) |
1555 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | 1429 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; |
1556 | if (update_search_tbl_counter) | 1430 | if (update_search_tbl_counter) |
1557 | search_tbl->action = tbl->action; | 1431 | search_tbl->action = tbl->action; |
@@ -1592,8 +1466,7 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm, | |||
1592 | break; | 1466 | break; |
1593 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | 1467 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: |
1594 | /* avoid antenna B unless MIMO */ | 1468 | /* avoid antenna B unless MIMO */ |
1595 | if (tbl->action == IWL_MIMO2_SWITCH_SISO_B || | 1469 | if (tbl->action == IWL_MIMO2_SWITCH_SISO_B) |
1596 | tbl->action == IWL_MIMO2_SWITCH_SISO_C) | ||
1597 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; | 1470 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; |
1598 | break; | 1471 | break; |
1599 | default: | 1472 | default: |
@@ -1626,7 +1499,6 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm, | |||
1626 | break; | 1499 | break; |
1627 | case IWL_MIMO2_SWITCH_SISO_A: | 1500 | case IWL_MIMO2_SWITCH_SISO_A: |
1628 | case IWL_MIMO2_SWITCH_SISO_B: | 1501 | case IWL_MIMO2_SWITCH_SISO_B: |
1629 | case IWL_MIMO2_SWITCH_SISO_C: | ||
1630 | IWL_DEBUG_RATE(mvm, "LQ: MIMO2 switch to SISO\n"); | 1502 | IWL_DEBUG_RATE(mvm, "LQ: MIMO2 switch to SISO\n"); |
1631 | 1503 | ||
1632 | /* Set up new search table for SISO */ | 1504 | /* Set up new search table for SISO */ |
@@ -1634,10 +1506,8 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm, | |||
1634 | 1506 | ||
1635 | if (tbl->action == IWL_MIMO2_SWITCH_SISO_A) | 1507 | if (tbl->action == IWL_MIMO2_SWITCH_SISO_A) |
1636 | search_tbl->ant_type = ANT_A; | 1508 | search_tbl->ant_type = ANT_A; |
1637 | else if (tbl->action == IWL_MIMO2_SWITCH_SISO_B) | 1509 | else /* tbl->action == IWL_MIMO2_SWITCH_SISO_B */ |
1638 | search_tbl->ant_type = ANT_B; | 1510 | search_tbl->ant_type = ANT_B; |
1639 | else | ||
1640 | search_tbl->ant_type = ANT_C; | ||
1641 | 1511 | ||
1642 | if (!rs_is_valid_ant(valid_tx_ant, | 1512 | if (!rs_is_valid_ant(valid_tx_ant, |
1643 | search_tbl->ant_type)) | 1513 | search_tbl->ant_type)) |
@@ -1680,26 +1550,11 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm, | |||
1680 | index, is_green); | 1550 | index, is_green); |
1681 | update_search_tbl_counter = 1; | 1551 | update_search_tbl_counter = 1; |
1682 | goto out; | 1552 | goto out; |
1683 | 1553 | default: | |
1684 | case IWL_MIMO2_SWITCH_MIMO3_ABC: | 1554 | WARN_ON_ONCE(1); |
1685 | IWL_DEBUG_RATE(mvm, "LQ: MIMO2 switch to MIMO3\n"); | ||
1686 | memcpy(search_tbl, tbl, sz); | ||
1687 | search_tbl->is_SGI = 0; | ||
1688 | search_tbl->ant_type = ANT_ABC; | ||
1689 | |||
1690 | if (!rs_is_valid_ant(valid_tx_ant, | ||
1691 | search_tbl->ant_type)) | ||
1692 | break; | ||
1693 | |||
1694 | ret = rs_switch_to_mimo3(mvm, lq_sta, sta, | ||
1695 | search_tbl, index); | ||
1696 | if (!ret) | ||
1697 | goto out; | ||
1698 | |||
1699 | break; | ||
1700 | } | 1555 | } |
1701 | tbl->action++; | 1556 | tbl->action++; |
1702 | if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) | 1557 | if (tbl->action > IWL_MIMO2_SWITCH_GI) |
1703 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; | 1558 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; |
1704 | 1559 | ||
1705 | if (tbl->action == start_action) | 1560 | if (tbl->action == start_action) |
@@ -1710,7 +1565,7 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm, | |||
1710 | out: | 1565 | out: |
1711 | lq_sta->search_better_tbl = 1; | 1566 | lq_sta->search_better_tbl = 1; |
1712 | tbl->action++; | 1567 | tbl->action++; |
1713 | if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) | 1568 | if (tbl->action > IWL_MIMO2_SWITCH_GI) |
1714 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; | 1569 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; |
1715 | if (update_search_tbl_counter) | 1570 | if (update_search_tbl_counter) |
1716 | search_tbl->action = tbl->action; | 1571 | search_tbl->action = tbl->action; |
@@ -1719,171 +1574,6 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm, | |||
1719 | } | 1574 | } |
1720 | 1575 | ||
1721 | /* | 1576 | /* |
1722 | * Try to switch to new modulation mode from MIMO3 | ||
1723 | */ | ||
1724 | static int rs_move_mimo3_to_other(struct iwl_mvm *mvm, | ||
1725 | struct iwl_lq_sta *lq_sta, | ||
1726 | struct ieee80211_sta *sta, int index) | ||
1727 | { | ||
1728 | s8 is_green = lq_sta->is_green; | ||
1729 | struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | ||
1730 | struct iwl_scale_tbl_info *search_tbl = | ||
1731 | &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); | ||
1732 | struct iwl_rate_scale_data *window = &(tbl->win[index]); | ||
1733 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | ||
1734 | u32 sz = (sizeof(struct iwl_scale_tbl_info) - | ||
1735 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); | ||
1736 | u8 start_action; | ||
1737 | u8 valid_tx_ant = iwl_fw_valid_tx_ant(mvm->fw); | ||
1738 | u8 tx_chains_num = num_of_ant(valid_tx_ant); | ||
1739 | int ret; | ||
1740 | u8 update_search_tbl_counter = 0; | ||
1741 | |||
1742 | switch (BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)) { | ||
1743 | case IWL_BT_COEX_TRAFFIC_LOAD_NONE: | ||
1744 | /* nothing */ | ||
1745 | break; | ||
1746 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: | ||
1747 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: | ||
1748 | /* avoid antenna B and MIMO */ | ||
1749 | if (tbl->action != IWL_MIMO3_SWITCH_SISO_A) | ||
1750 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; | ||
1751 | break; | ||
1752 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | ||
1753 | /* avoid antenna B unless MIMO */ | ||
1754 | if (tbl->action == IWL_MIMO3_SWITCH_SISO_B || | ||
1755 | tbl->action == IWL_MIMO3_SWITCH_SISO_C) | ||
1756 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; | ||
1757 | break; | ||
1758 | default: | ||
1759 | IWL_ERR(mvm, "Invalid BT load %d", | ||
1760 | BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)); | ||
1761 | break; | ||
1762 | } | ||
1763 | |||
1764 | start_action = tbl->action; | ||
1765 | while (1) { | ||
1766 | lq_sta->action_counter++; | ||
1767 | switch (tbl->action) { | ||
1768 | case IWL_MIMO3_SWITCH_ANTENNA1: | ||
1769 | case IWL_MIMO3_SWITCH_ANTENNA2: | ||
1770 | IWL_DEBUG_RATE(mvm, "LQ: MIMO3 toggle Antennas\n"); | ||
1771 | |||
1772 | if (tx_chains_num <= 3) | ||
1773 | break; | ||
1774 | |||
1775 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | ||
1776 | break; | ||
1777 | |||
1778 | memcpy(search_tbl, tbl, sz); | ||
1779 | if (rs_toggle_antenna(valid_tx_ant, | ||
1780 | &search_tbl->current_rate, | ||
1781 | search_tbl)) | ||
1782 | goto out; | ||
1783 | break; | ||
1784 | case IWL_MIMO3_SWITCH_SISO_A: | ||
1785 | case IWL_MIMO3_SWITCH_SISO_B: | ||
1786 | case IWL_MIMO3_SWITCH_SISO_C: | ||
1787 | IWL_DEBUG_RATE(mvm, "LQ: MIMO3 switch to SISO\n"); | ||
1788 | |||
1789 | /* Set up new search table for SISO */ | ||
1790 | memcpy(search_tbl, tbl, sz); | ||
1791 | |||
1792 | if (tbl->action == IWL_MIMO3_SWITCH_SISO_A) | ||
1793 | search_tbl->ant_type = ANT_A; | ||
1794 | else if (tbl->action == IWL_MIMO3_SWITCH_SISO_B) | ||
1795 | search_tbl->ant_type = ANT_B; | ||
1796 | else | ||
1797 | search_tbl->ant_type = ANT_C; | ||
1798 | |||
1799 | if (!rs_is_valid_ant(valid_tx_ant, | ||
1800 | search_tbl->ant_type)) | ||
1801 | break; | ||
1802 | |||
1803 | ret = rs_switch_to_siso(mvm, lq_sta, sta, | ||
1804 | search_tbl, index); | ||
1805 | if (!ret) | ||
1806 | goto out; | ||
1807 | |||
1808 | break; | ||
1809 | |||
1810 | case IWL_MIMO3_SWITCH_MIMO2_AB: | ||
1811 | case IWL_MIMO3_SWITCH_MIMO2_AC: | ||
1812 | case IWL_MIMO3_SWITCH_MIMO2_BC: | ||
1813 | IWL_DEBUG_RATE(mvm, "LQ: MIMO3 switch to MIMO2\n"); | ||
1814 | |||
1815 | memcpy(search_tbl, tbl, sz); | ||
1816 | search_tbl->is_SGI = 0; | ||
1817 | if (tbl->action == IWL_MIMO3_SWITCH_MIMO2_AB) | ||
1818 | search_tbl->ant_type = ANT_AB; | ||
1819 | else if (tbl->action == IWL_MIMO3_SWITCH_MIMO2_AC) | ||
1820 | search_tbl->ant_type = ANT_AC; | ||
1821 | else | ||
1822 | search_tbl->ant_type = ANT_BC; | ||
1823 | |||
1824 | if (!rs_is_valid_ant(valid_tx_ant, | ||
1825 | search_tbl->ant_type)) | ||
1826 | break; | ||
1827 | |||
1828 | ret = rs_switch_to_mimo2(mvm, lq_sta, sta, | ||
1829 | search_tbl, index); | ||
1830 | if (!ret) | ||
1831 | goto out; | ||
1832 | |||
1833 | break; | ||
1834 | |||
1835 | case IWL_MIMO3_SWITCH_GI: | ||
1836 | if (!tbl->is_ht40 && !(ht_cap->cap & | ||
1837 | IEEE80211_HT_CAP_SGI_20)) | ||
1838 | break; | ||
1839 | if (tbl->is_ht40 && !(ht_cap->cap & | ||
1840 | IEEE80211_HT_CAP_SGI_40)) | ||
1841 | break; | ||
1842 | |||
1843 | IWL_DEBUG_RATE(mvm, "LQ: MIMO3 toggle SGI/NGI\n"); | ||
1844 | |||
1845 | /* Set up new search table for MIMO */ | ||
1846 | memcpy(search_tbl, tbl, sz); | ||
1847 | search_tbl->is_SGI = !tbl->is_SGI; | ||
1848 | rs_set_expected_tpt_table(lq_sta, search_tbl); | ||
1849 | /* | ||
1850 | * If active table already uses the fastest possible | ||
1851 | * modulation (dual stream with short guard interval), | ||
1852 | * and it's working well, there's no need to look | ||
1853 | * for a better type of modulation! | ||
1854 | */ | ||
1855 | if (tbl->is_SGI) { | ||
1856 | s32 tpt = lq_sta->last_tpt / 100; | ||
1857 | if (tpt >= search_tbl->expected_tpt[index]) | ||
1858 | break; | ||
1859 | } | ||
1860 | search_tbl->current_rate = | ||
1861 | rate_n_flags_from_tbl(mvm, search_tbl, | ||
1862 | index, is_green); | ||
1863 | update_search_tbl_counter = 1; | ||
1864 | goto out; | ||
1865 | } | ||
1866 | tbl->action++; | ||
1867 | if (tbl->action > IWL_MIMO3_SWITCH_GI) | ||
1868 | tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; | ||
1869 | |||
1870 | if (tbl->action == start_action) | ||
1871 | break; | ||
1872 | } | ||
1873 | search_tbl->lq_type = LQ_NONE; | ||
1874 | return 0; | ||
1875 | out: | ||
1876 | lq_sta->search_better_tbl = 1; | ||
1877 | tbl->action++; | ||
1878 | if (tbl->action > IWL_MIMO3_SWITCH_GI) | ||
1879 | tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; | ||
1880 | if (update_search_tbl_counter) | ||
1881 | search_tbl->action = tbl->action; | ||
1882 | |||
1883 | return 0; | ||
1884 | } | ||
1885 | |||
1886 | /* | ||
1887 | * Check whether we should continue using same modulation mode, or | 1577 | * Check whether we should continue using same modulation mode, or |
1888 | * begin search for a new mode, based on: | 1578 | * begin search for a new mode, based on: |
1889 | * 1) # tx successes or failures while using this mode | 1579 | * 1) # tx successes or failures while using this mode |
@@ -2289,8 +1979,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, | |||
2289 | scale_action = 0; | 1979 | scale_action = 0; |
2290 | 1980 | ||
2291 | if ((BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD) >= | 1981 | if ((BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD) >= |
2292 | IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && | 1982 | IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && (is_mimo(tbl->lq_type))) { |
2293 | (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) { | ||
2294 | if (lq_sta->last_bt_traffic > | 1983 | if (lq_sta->last_bt_traffic > |
2295 | BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)) { | 1984 | BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)) { |
2296 | /* | 1985 | /* |
@@ -2307,8 +1996,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, | |||
2307 | BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD); | 1996 | BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD); |
2308 | 1997 | ||
2309 | if ((BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD) >= | 1998 | if ((BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD) >= |
2310 | IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && | 1999 | IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && is_mimo(tbl->lq_type)) { |
2311 | (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) { | ||
2312 | /* search for a new modulation */ | 2000 | /* search for a new modulation */ |
2313 | rs_stay_in_table(lq_sta, true); | 2001 | rs_stay_in_table(lq_sta, true); |
2314 | goto lq_update; | 2002 | goto lq_update; |
@@ -2368,7 +2056,7 @@ lq_update: | |||
2368 | else if (is_mimo2(tbl->lq_type)) | 2056 | else if (is_mimo2(tbl->lq_type)) |
2369 | rs_move_mimo2_to_other(mvm, lq_sta, sta, index); | 2057 | rs_move_mimo2_to_other(mvm, lq_sta, sta, index); |
2370 | else | 2058 | else |
2371 | rs_move_mimo3_to_other(mvm, lq_sta, sta, index); | 2059 | WARN_ON_ONCE(1); |
2372 | 2060 | ||
2373 | /* If new "search" mode was selected, set up in uCode table */ | 2061 | /* If new "search" mode was selected, set up in uCode table */ |
2374 | if (lq_sta->search_better_tbl) { | 2062 | if (lq_sta->search_better_tbl) { |
@@ -2533,11 +2221,10 @@ static void rs_get_rate(void *mvm_r, struct ieee80211_sta *sta, void *mvm_sta, | |||
2533 | rate_idx -= IWL_FIRST_OFDM_RATE; | 2221 | rate_idx -= IWL_FIRST_OFDM_RATE; |
2534 | /* 6M and 9M shared same MCS index */ | 2222 | /* 6M and 9M shared same MCS index */ |
2535 | rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0; | 2223 | rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0; |
2224 | WARN_ON_ONCE(rs_extract_rate(lq_sta->last_rate_n_flags) >= | ||
2225 | IWL_RATE_MIMO3_6M_PLCP); | ||
2536 | if (rs_extract_rate(lq_sta->last_rate_n_flags) >= | 2226 | if (rs_extract_rate(lq_sta->last_rate_n_flags) >= |
2537 | IWL_RATE_MIMO3_6M_PLCP) | 2227 | IWL_RATE_MIMO2_6M_PLCP) |
2538 | rate_idx = rate_idx + (2 * MCS_INDEX_PER_STREAM); | ||
2539 | else if (rs_extract_rate(lq_sta->last_rate_n_flags) >= | ||
2540 | IWL_RATE_MIMO2_6M_PLCP) | ||
2541 | rate_idx = rate_idx + MCS_INDEX_PER_STREAM; | 2228 | rate_idx = rate_idx + MCS_INDEX_PER_STREAM; |
2542 | info->control.rates[0].flags = IEEE80211_TX_RC_MCS; | 2229 | info->control.rates[0].flags = IEEE80211_TX_RC_MCS; |
2543 | if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK) | 2230 | if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK) |
@@ -2636,16 +2323,10 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
2636 | lq_sta->active_mimo2_rate &= ~((u16)0x2); | 2323 | lq_sta->active_mimo2_rate &= ~((u16)0x2); |
2637 | lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; | 2324 | lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; |
2638 | 2325 | ||
2639 | lq_sta->active_mimo3_rate = ht_cap->mcs.rx_mask[2] << 1; | ||
2640 | lq_sta->active_mimo3_rate |= ht_cap->mcs.rx_mask[2] & 0x1; | ||
2641 | lq_sta->active_mimo3_rate &= ~((u16)0x2); | ||
2642 | lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE; | ||
2643 | |||
2644 | IWL_DEBUG_RATE(mvm, | 2326 | IWL_DEBUG_RATE(mvm, |
2645 | "SISO-RATE=%X MIMO2-RATE=%X MIMO3-RATE=%X\n", | 2327 | "SISO-RATE=%X MIMO2-RATE=%X\n", |
2646 | lq_sta->active_siso_rate, | 2328 | lq_sta->active_siso_rate, |
2647 | lq_sta->active_mimo2_rate, | 2329 | lq_sta->active_mimo2_rate); |
2648 | lq_sta->active_mimo3_rate); | ||
2649 | 2330 | ||
2650 | /* These values will be overridden later */ | 2331 | /* These values will be overridden later */ |
2651 | lq_sta->lq.single_stream_ant_msk = | 2332 | lq_sta->lq.single_stream_ant_msk = |
@@ -2689,7 +2370,7 @@ static void rs_fill_link_cmd(struct iwl_mvm *mvm, | |||
2689 | struct iwl_lq_cmd *lq_cmd = &lq_sta->lq; | 2370 | struct iwl_lq_cmd *lq_cmd = &lq_sta->lq; |
2690 | 2371 | ||
2691 | /* Override starting rate (index 0) if needed for debug purposes */ | 2372 | /* Override starting rate (index 0) if needed for debug purposes */ |
2692 | rs_dbgfs_set_mcs(lq_sta, &new_rate, index); | 2373 | rs_dbgfs_set_mcs(lq_sta, &new_rate); |
2693 | 2374 | ||
2694 | /* Interpret new_rate (rate_n_flags) */ | 2375 | /* Interpret new_rate (rate_n_flags) */ |
2695 | rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, | 2376 | rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, |
@@ -2736,7 +2417,7 @@ static void rs_fill_link_cmd(struct iwl_mvm *mvm, | |||
2736 | } | 2417 | } |
2737 | 2418 | ||
2738 | /* Override next rate if needed for debug purposes */ | 2419 | /* Override next rate if needed for debug purposes */ |
2739 | rs_dbgfs_set_mcs(lq_sta, &new_rate, index); | 2420 | rs_dbgfs_set_mcs(lq_sta, &new_rate); |
2740 | 2421 | ||
2741 | /* Fill next table entry */ | 2422 | /* Fill next table entry */ |
2742 | lq_cmd->rs_table[index] = | 2423 | lq_cmd->rs_table[index] = |
@@ -2778,7 +2459,7 @@ static void rs_fill_link_cmd(struct iwl_mvm *mvm, | |||
2778 | use_ht_possible = 0; | 2459 | use_ht_possible = 0; |
2779 | 2460 | ||
2780 | /* Override next rate if needed for debug purposes */ | 2461 | /* Override next rate if needed for debug purposes */ |
2781 | rs_dbgfs_set_mcs(lq_sta, &new_rate, index); | 2462 | rs_dbgfs_set_mcs(lq_sta, &new_rate); |
2782 | 2463 | ||
2783 | /* Fill next table entry */ | 2464 | /* Fill next table entry */ |
2784 | lq_cmd->rs_table[index] = cpu_to_le32(new_rate); | 2465 | lq_cmd->rs_table[index] = cpu_to_le32(new_rate); |
@@ -2823,7 +2504,7 @@ static void rs_free_sta(void *mvm_r, struct ieee80211_sta *sta, | |||
2823 | 2504 | ||
2824 | #ifdef CONFIG_MAC80211_DEBUGFS | 2505 | #ifdef CONFIG_MAC80211_DEBUGFS |
2825 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, | 2506 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, |
2826 | u32 *rate_n_flags, int index) | 2507 | u32 *rate_n_flags) |
2827 | { | 2508 | { |
2828 | struct iwl_mvm *mvm; | 2509 | struct iwl_mvm *mvm; |
2829 | u8 valid_tx_ant; | 2510 | u8 valid_tx_ant; |
@@ -2908,8 +2589,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2908 | (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); | 2589 | (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); |
2909 | if (is_Ht(tbl->lq_type)) { | 2590 | if (is_Ht(tbl->lq_type)) { |
2910 | desc += sprintf(buff+desc, " %s", | 2591 | desc += sprintf(buff+desc, " %s", |
2911 | (is_siso(tbl->lq_type)) ? "SISO" : | 2592 | (is_siso(tbl->lq_type)) ? "SISO" : "MIMO2"); |
2912 | ((is_mimo2(tbl->lq_type)) ? "MIMO2" : "MIMO3")); | ||
2913 | desc += sprintf(buff+desc, " %s", | 2593 | desc += sprintf(buff+desc, " %s", |
2914 | (tbl->is_ht40) ? "40MHz" : "20MHz"); | 2594 | (tbl->is_ht40) ? "40MHz" : "20MHz"); |
2915 | desc += sprintf(buff+desc, " %s %s %s\n", | 2595 | desc += sprintf(buff+desc, " %s %s %s\n", |
@@ -3009,32 +2689,6 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | |||
3009 | .llseek = default_llseek, | 2689 | .llseek = default_llseek, |
3010 | }; | 2690 | }; |
3011 | 2691 | ||
3012 | static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, | ||
3013 | char __user *user_buf, size_t count, loff_t *ppos) | ||
3014 | { | ||
3015 | struct iwl_lq_sta *lq_sta = file->private_data; | ||
3016 | struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; | ||
3017 | char buff[120]; | ||
3018 | int desc = 0; | ||
3019 | |||
3020 | if (is_Ht(tbl->lq_type)) | ||
3021 | desc += sprintf(buff+desc, | ||
3022 | "Bit Rate= %d Mb/s\n", | ||
3023 | tbl->expected_tpt[lq_sta->last_txrate_idx]); | ||
3024 | else | ||
3025 | desc += sprintf(buff+desc, | ||
3026 | "Bit Rate= %d Mb/s\n", | ||
3027 | iwl_rates[lq_sta->last_txrate_idx].ieee >> 1); | ||
3028 | |||
3029 | return simple_read_from_buffer(user_buf, count, ppos, buff, desc); | ||
3030 | } | ||
3031 | |||
3032 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { | ||
3033 | .read = rs_sta_dbgfs_rate_scale_data_read, | ||
3034 | .open = simple_open, | ||
3035 | .llseek = default_llseek, | ||
3036 | }; | ||
3037 | |||
3038 | static void rs_add_debugfs(void *mvm, void *mvm_sta, struct dentry *dir) | 2692 | static void rs_add_debugfs(void *mvm, void *mvm_sta, struct dentry *dir) |
3039 | { | 2693 | { |
3040 | struct iwl_lq_sta *lq_sta = mvm_sta; | 2694 | struct iwl_lq_sta *lq_sta = mvm_sta; |
@@ -3044,9 +2698,6 @@ static void rs_add_debugfs(void *mvm, void *mvm_sta, struct dentry *dir) | |||
3044 | lq_sta->rs_sta_dbgfs_stats_table_file = | 2698 | lq_sta->rs_sta_dbgfs_stats_table_file = |
3045 | debugfs_create_file("rate_stats_table", S_IRUSR, dir, | 2699 | debugfs_create_file("rate_stats_table", S_IRUSR, dir, |
3046 | lq_sta, &rs_sta_dbgfs_stats_table_ops); | 2700 | lq_sta, &rs_sta_dbgfs_stats_table_ops); |
3047 | lq_sta->rs_sta_dbgfs_rate_scale_data_file = | ||
3048 | debugfs_create_file("rate_scale_data", S_IRUSR, dir, | ||
3049 | lq_sta, &rs_sta_dbgfs_rate_scale_data_ops); | ||
3050 | lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = | 2701 | lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = |
3051 | debugfs_create_u8("tx_agg_tid_enable", S_IRUSR | S_IWUSR, dir, | 2702 | debugfs_create_u8("tx_agg_tid_enable", S_IRUSR | S_IWUSR, dir, |
3052 | &lq_sta->tx_agg_tid_en); | 2703 | &lq_sta->tx_agg_tid_en); |
@@ -3057,7 +2708,6 @@ static void rs_remove_debugfs(void *mvm, void *mvm_sta) | |||
3057 | struct iwl_lq_sta *lq_sta = mvm_sta; | 2708 | struct iwl_lq_sta *lq_sta = mvm_sta; |
3058 | debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); | 2709 | debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); |
3059 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); | 2710 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); |
3060 | debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); | ||
3061 | debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); | 2711 | debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); |
3062 | } | 2712 | } |
3063 | #endif | 2713 | #endif |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h index 4a99a4d200ac..335cf1682902 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.h +++ b/drivers/net/wireless/iwlwifi/mvm/rs.h | |||
@@ -38,14 +38,8 @@ struct iwl_rs_rate_info { | |||
38 | u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ | 38 | u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ |
39 | u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ | 39 | u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ |
40 | u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ | 40 | u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ |
41 | u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */ | ||
42 | u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ | ||
43 | u8 prev_ieee; /* previous rate in IEEE speeds */ | ||
44 | u8 next_ieee; /* next rate in IEEE speeds */ | ||
45 | u8 prev_rs; /* previous rate used in rs algo */ | 41 | u8 prev_rs; /* previous rate used in rs algo */ |
46 | u8 next_rs; /* next rate used in rs algo */ | 42 | u8 next_rs; /* next rate used in rs algo */ |
47 | u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ | ||
48 | u8 next_rs_tgg; /* next rate used in TGG rs algo */ | ||
49 | }; | 43 | }; |
50 | 44 | ||
51 | #define IWL_RATE_60M_PLCP 3 | 45 | #define IWL_RATE_60M_PLCP 3 |
@@ -120,23 +114,6 @@ enum { | |||
120 | IWL_RATE_MIMO3_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, | 114 | IWL_RATE_MIMO3_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, |
121 | }; | 115 | }; |
122 | 116 | ||
123 | /* MAC header values for bit rates */ | ||
124 | enum { | ||
125 | IWL_RATE_6M_IEEE = 12, | ||
126 | IWL_RATE_9M_IEEE = 18, | ||
127 | IWL_RATE_12M_IEEE = 24, | ||
128 | IWL_RATE_18M_IEEE = 36, | ||
129 | IWL_RATE_24M_IEEE = 48, | ||
130 | IWL_RATE_36M_IEEE = 72, | ||
131 | IWL_RATE_48M_IEEE = 96, | ||
132 | IWL_RATE_54M_IEEE = 108, | ||
133 | IWL_RATE_60M_IEEE = 120, | ||
134 | IWL_RATE_1M_IEEE = 2, | ||
135 | IWL_RATE_2M_IEEE = 4, | ||
136 | IWL_RATE_5M_IEEE = 11, | ||
137 | IWL_RATE_11M_IEEE = 22, | ||
138 | }; | ||
139 | |||
140 | #define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) | 117 | #define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) |
141 | 118 | ||
142 | #define IWL_INVALID_VALUE -1 | 119 | #define IWL_INVALID_VALUE -1 |
@@ -165,47 +142,22 @@ enum { | |||
165 | #define IWL_LEGACY_SWITCH_ANTENNA1 0 | 142 | #define IWL_LEGACY_SWITCH_ANTENNA1 0 |
166 | #define IWL_LEGACY_SWITCH_ANTENNA2 1 | 143 | #define IWL_LEGACY_SWITCH_ANTENNA2 1 |
167 | #define IWL_LEGACY_SWITCH_SISO 2 | 144 | #define IWL_LEGACY_SWITCH_SISO 2 |
168 | #define IWL_LEGACY_SWITCH_MIMO2_AB 3 | 145 | #define IWL_LEGACY_SWITCH_MIMO2 3 |
169 | #define IWL_LEGACY_SWITCH_MIMO2_AC 4 | ||
170 | #define IWL_LEGACY_SWITCH_MIMO2_BC 5 | ||
171 | #define IWL_LEGACY_SWITCH_MIMO3_ABC 6 | ||
172 | 146 | ||
173 | /* possible actions when in siso mode */ | 147 | /* possible actions when in siso mode */ |
174 | #define IWL_SISO_SWITCH_ANTENNA1 0 | 148 | #define IWL_SISO_SWITCH_ANTENNA1 0 |
175 | #define IWL_SISO_SWITCH_ANTENNA2 1 | 149 | #define IWL_SISO_SWITCH_ANTENNA2 1 |
176 | #define IWL_SISO_SWITCH_MIMO2_AB 2 | 150 | #define IWL_SISO_SWITCH_MIMO2 2 |
177 | #define IWL_SISO_SWITCH_MIMO2_AC 3 | 151 | #define IWL_SISO_SWITCH_GI 3 |
178 | #define IWL_SISO_SWITCH_MIMO2_BC 4 | ||
179 | #define IWL_SISO_SWITCH_GI 5 | ||
180 | #define IWL_SISO_SWITCH_MIMO3_ABC 6 | ||
181 | |||
182 | 152 | ||
183 | /* possible actions when in mimo mode */ | 153 | /* possible actions when in mimo mode */ |
184 | #define IWL_MIMO2_SWITCH_ANTENNA1 0 | 154 | #define IWL_MIMO2_SWITCH_ANTENNA1 0 |
185 | #define IWL_MIMO2_SWITCH_ANTENNA2 1 | 155 | #define IWL_MIMO2_SWITCH_ANTENNA2 1 |
186 | #define IWL_MIMO2_SWITCH_SISO_A 2 | 156 | #define IWL_MIMO2_SWITCH_SISO_A 2 |
187 | #define IWL_MIMO2_SWITCH_SISO_B 3 | 157 | #define IWL_MIMO2_SWITCH_SISO_B 3 |
188 | #define IWL_MIMO2_SWITCH_SISO_C 4 | 158 | #define IWL_MIMO2_SWITCH_GI 4 |
189 | #define IWL_MIMO2_SWITCH_GI 5 | ||
190 | #define IWL_MIMO2_SWITCH_MIMO3_ABC 6 | ||
191 | |||
192 | |||
193 | /* possible actions when in mimo3 mode */ | ||
194 | #define IWL_MIMO3_SWITCH_ANTENNA1 0 | ||
195 | #define IWL_MIMO3_SWITCH_ANTENNA2 1 | ||
196 | #define IWL_MIMO3_SWITCH_SISO_A 2 | ||
197 | #define IWL_MIMO3_SWITCH_SISO_B 3 | ||
198 | #define IWL_MIMO3_SWITCH_SISO_C 4 | ||
199 | #define IWL_MIMO3_SWITCH_MIMO2_AB 5 | ||
200 | #define IWL_MIMO3_SWITCH_MIMO2_AC 6 | ||
201 | #define IWL_MIMO3_SWITCH_MIMO2_BC 7 | ||
202 | #define IWL_MIMO3_SWITCH_GI 8 | ||
203 | |||
204 | |||
205 | #define IWL_MAX_11N_MIMO3_SEARCH IWL_MIMO3_SWITCH_GI | ||
206 | #define IWL_MAX_SEARCH IWL_MIMO2_SWITCH_MIMO3_ABC | ||
207 | 159 | ||
208 | /*FIXME:RS:add possible actions for MIMO3*/ | 160 | #define IWL_MAX_SEARCH IWL_MIMO2_SWITCH_GI |
209 | 161 | ||
210 | #define IWL_ACTION_LIMIT 3 /* # possible actions */ | 162 | #define IWL_ACTION_LIMIT 3 /* # possible actions */ |
211 | 163 | ||
@@ -240,15 +192,13 @@ enum iwl_table_type { | |||
240 | LQ_A, | 192 | LQ_A, |
241 | LQ_SISO, /* high-throughput types */ | 193 | LQ_SISO, /* high-throughput types */ |
242 | LQ_MIMO2, | 194 | LQ_MIMO2, |
243 | LQ_MIMO3, | ||
244 | LQ_MAX, | 195 | LQ_MAX, |
245 | }; | 196 | }; |
246 | 197 | ||
247 | #define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A)) | 198 | #define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A)) |
248 | #define is_siso(tbl) ((tbl) == LQ_SISO) | 199 | #define is_siso(tbl) ((tbl) == LQ_SISO) |
249 | #define is_mimo2(tbl) ((tbl) == LQ_MIMO2) | 200 | #define is_mimo2(tbl) ((tbl) == LQ_MIMO2) |
250 | #define is_mimo3(tbl) ((tbl) == LQ_MIMO3) | 201 | #define is_mimo(tbl) is_mimo2(tbl) |
251 | #define is_mimo(tbl) (is_mimo2(tbl) || is_mimo3(tbl)) | ||
252 | #define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl)) | 202 | #define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl)) |
253 | #define is_a_band(tbl) ((tbl) == LQ_A) | 203 | #define is_a_band(tbl) ((tbl) == LQ_A) |
254 | #define is_g_and(tbl) ((tbl) == LQ_G) | 204 | #define is_g_and(tbl) ((tbl) == LQ_G) |
@@ -320,7 +270,6 @@ struct iwl_lq_sta { | |||
320 | u16 active_legacy_rate; | 270 | u16 active_legacy_rate; |
321 | u16 active_siso_rate; | 271 | u16 active_siso_rate; |
322 | u16 active_mimo2_rate; | 272 | u16 active_mimo2_rate; |
323 | u16 active_mimo3_rate; | ||
324 | s8 max_rate_idx; /* Max rate set by user */ | 273 | s8 max_rate_idx; /* Max rate set by user */ |
325 | u8 missed_rate_counter; | 274 | u8 missed_rate_counter; |
326 | 275 | ||
@@ -330,7 +279,6 @@ struct iwl_lq_sta { | |||
330 | #ifdef CONFIG_MAC80211_DEBUGFS | 279 | #ifdef CONFIG_MAC80211_DEBUGFS |
331 | struct dentry *rs_sta_dbgfs_scale_table_file; | 280 | struct dentry *rs_sta_dbgfs_scale_table_file; |
332 | struct dentry *rs_sta_dbgfs_stats_table_file; | 281 | struct dentry *rs_sta_dbgfs_stats_table_file; |
333 | struct dentry *rs_sta_dbgfs_rate_scale_data_file; | ||
334 | struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; | 282 | struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; |
335 | u32 dbg_fixed_rate; | 283 | u32 dbg_fixed_rate; |
336 | #endif | 284 | #endif |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c index ee6547d22287..2a8cb5a60535 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/iwlwifi/mvm/rx.c | |||
@@ -396,11 +396,62 @@ static void iwl_mvm_update_rx_statistics(struct iwl_mvm *mvm, | |||
396 | memcpy(&mvm->rx_stats, &stats->rx, sizeof(struct mvm_statistics_rx)); | 396 | memcpy(&mvm->rx_stats, &stats->rx, sizeof(struct mvm_statistics_rx)); |
397 | } | 397 | } |
398 | 398 | ||
399 | struct iwl_mvm_stat_data { | ||
400 | struct iwl_notif_statistics *stats; | ||
401 | struct iwl_mvm *mvm; | ||
402 | }; | ||
403 | |||
404 | static void iwl_mvm_stat_iterator(void *_data, u8 *mac, | ||
405 | struct ieee80211_vif *vif) | ||
406 | { | ||
407 | struct iwl_mvm_stat_data *data = _data; | ||
408 | struct iwl_notif_statistics *stats = data->stats; | ||
409 | struct iwl_mvm *mvm = data->mvm; | ||
410 | int sig = -stats->general.beacon_filter_average_energy; | ||
411 | int last_event; | ||
412 | int thold = vif->bss_conf.cqm_rssi_thold; | ||
413 | int hyst = vif->bss_conf.cqm_rssi_hyst; | ||
414 | u16 id = le32_to_cpu(stats->rx.general.mac_id); | ||
415 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
416 | |||
417 | if (mvmvif->id != id) | ||
418 | return; | ||
419 | |||
420 | if (vif->type != NL80211_IFTYPE_STATION) | ||
421 | return; | ||
422 | |||
423 | mvmvif->bf_data.ave_beacon_signal = sig; | ||
424 | |||
425 | if (!(vif->driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) | ||
426 | return; | ||
427 | |||
428 | /* CQM Notification */ | ||
429 | last_event = mvmvif->bf_data.last_cqm_event; | ||
430 | if (thold && sig < thold && (last_event == 0 || | ||
431 | sig < last_event - hyst)) { | ||
432 | mvmvif->bf_data.last_cqm_event = sig; | ||
433 | IWL_DEBUG_RX(mvm, "cqm_iterator cqm low %d\n", | ||
434 | sig); | ||
435 | ieee80211_cqm_rssi_notify( | ||
436 | vif, | ||
437 | NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, | ||
438 | GFP_KERNEL); | ||
439 | } else if (sig > thold && | ||
440 | (last_event == 0 || sig > last_event + hyst)) { | ||
441 | mvmvif->bf_data.last_cqm_event = sig; | ||
442 | IWL_DEBUG_RX(mvm, "cqm_iterator cqm high %d\n", | ||
443 | sig); | ||
444 | ieee80211_cqm_rssi_notify( | ||
445 | vif, | ||
446 | NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, | ||
447 | GFP_KERNEL); | ||
448 | } | ||
449 | } | ||
450 | |||
399 | /* | 451 | /* |
400 | * iwl_mvm_rx_statistics - STATISTICS_NOTIFICATION handler | 452 | * iwl_mvm_rx_statistics - STATISTICS_NOTIFICATION handler |
401 | * | 453 | * |
402 | * TODO: This handler is implemented partially. | 454 | * TODO: This handler is implemented partially. |
403 | * It only gets the NIC's temperature. | ||
404 | */ | 455 | */ |
405 | int iwl_mvm_rx_statistics(struct iwl_mvm *mvm, | 456 | int iwl_mvm_rx_statistics(struct iwl_mvm *mvm, |
406 | struct iwl_rx_cmd_buffer *rxb, | 457 | struct iwl_rx_cmd_buffer *rxb, |
@@ -409,6 +460,10 @@ int iwl_mvm_rx_statistics(struct iwl_mvm *mvm, | |||
409 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 460 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
410 | struct iwl_notif_statistics *stats = (void *)&pkt->data; | 461 | struct iwl_notif_statistics *stats = (void *)&pkt->data; |
411 | struct mvm_statistics_general_common *common = &stats->general.common; | 462 | struct mvm_statistics_general_common *common = &stats->general.common; |
463 | struct iwl_mvm_stat_data data = { | ||
464 | .stats = stats, | ||
465 | .mvm = mvm, | ||
466 | }; | ||
412 | 467 | ||
413 | if (mvm->temperature != le32_to_cpu(common->temperature)) { | 468 | if (mvm->temperature != le32_to_cpu(common->temperature)) { |
414 | mvm->temperature = le32_to_cpu(common->temperature); | 469 | mvm->temperature = le32_to_cpu(common->temperature); |
@@ -416,5 +471,9 @@ int iwl_mvm_rx_statistics(struct iwl_mvm *mvm, | |||
416 | } | 471 | } |
417 | iwl_mvm_update_rx_statistics(mvm, stats); | 472 | iwl_mvm_update_rx_statistics(mvm, stats); |
418 | 473 | ||
474 | ieee80211_iterate_active_interfaces(mvm->hw, | ||
475 | IEEE80211_IFACE_ITER_NORMAL, | ||
476 | iwl_mvm_stat_iterator, | ||
477 | &data); | ||
419 | return 0; | 478 | return 0; |
420 | } | 479 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index 7fd6fbfbc1b3..c17b74c31398 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
@@ -73,7 +73,6 @@ | |||
73 | #include "iwl-prph.h" | 73 | #include "iwl-prph.h" |
74 | 74 | ||
75 | /* A TimeUnit is 1024 microsecond */ | 75 | /* A TimeUnit is 1024 microsecond */ |
76 | #define TU_TO_JIFFIES(_tu) (usecs_to_jiffies((_tu) * 1024)) | ||
77 | #define MSEC_TO_TU(_msec) (_msec*1000/1024) | 76 | #define MSEC_TO_TU(_msec) (_msec*1000/1024) |
78 | 77 | ||
79 | /* | 78 | /* |
@@ -185,7 +184,7 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm, | |||
185 | } | 184 | } |
186 | } | 185 | } |
187 | 186 | ||
188 | if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_END) { | 187 | if (le32_to_cpu(notif->action) & TE_V2_NOTIF_HOST_EVENT_END) { |
189 | IWL_DEBUG_TE(mvm, | 188 | IWL_DEBUG_TE(mvm, |
190 | "TE ended - current time %lu, estimated end %lu\n", | 189 | "TE ended - current time %lu, estimated end %lu\n", |
191 | jiffies, te_data->end_jiffies); | 190 | jiffies, te_data->end_jiffies); |
@@ -202,10 +201,9 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm, | |||
202 | iwl_mvm_te_check_disconnect(mvm, te_data->vif, | 201 | iwl_mvm_te_check_disconnect(mvm, te_data->vif, |
203 | "No assocation and the time event is over already..."); | 202 | "No assocation and the time event is over already..."); |
204 | iwl_mvm_te_clear_data(mvm, te_data); | 203 | iwl_mvm_te_clear_data(mvm, te_data); |
205 | } else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) { | 204 | } else if (le32_to_cpu(notif->action) & TE_V2_NOTIF_HOST_EVENT_START) { |
206 | te_data->running = true; | 205 | te_data->running = true; |
207 | te_data->end_jiffies = jiffies + | 206 | te_data->end_jiffies = TU_TO_EXP_TIME(te_data->duration); |
208 | TU_TO_JIFFIES(te_data->duration); | ||
209 | 207 | ||
210 | if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { | 208 | if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { |
211 | set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); | 209 | set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); |
@@ -270,10 +268,67 @@ static bool iwl_mvm_time_event_response(struct iwl_notif_wait_data *notif_wait, | |||
270 | return true; | 268 | return true; |
271 | } | 269 | } |
272 | 270 | ||
271 | /* used to convert from time event API v2 to v1 */ | ||
272 | #define TE_V2_DEP_POLICY_MSK (TE_V2_DEP_OTHER | TE_V2_DEP_TSF |\ | ||
273 | TE_V2_EVENT_SOCIOPATHIC) | ||
274 | static inline u16 te_v2_get_notify(__le16 policy) | ||
275 | { | ||
276 | return le16_to_cpu(policy) & TE_V2_NOTIF_MSK; | ||
277 | } | ||
278 | |||
279 | static inline u16 te_v2_get_dep_policy(__le16 policy) | ||
280 | { | ||
281 | return (le16_to_cpu(policy) & TE_V2_DEP_POLICY_MSK) >> | ||
282 | TE_V2_PLACEMENT_POS; | ||
283 | } | ||
284 | |||
285 | static inline u16 te_v2_get_absence(__le16 policy) | ||
286 | { | ||
287 | return (le16_to_cpu(policy) & TE_V2_ABSENCE) >> TE_V2_ABSENCE_POS; | ||
288 | } | ||
289 | |||
290 | static void iwl_mvm_te_v2_to_v1(const struct iwl_time_event_cmd_v2 *cmd_v2, | ||
291 | struct iwl_time_event_cmd_v1 *cmd_v1) | ||
292 | { | ||
293 | cmd_v1->id_and_color = cmd_v2->id_and_color; | ||
294 | cmd_v1->action = cmd_v2->action; | ||
295 | cmd_v1->id = cmd_v2->id; | ||
296 | cmd_v1->apply_time = cmd_v2->apply_time; | ||
297 | cmd_v1->max_delay = cmd_v2->max_delay; | ||
298 | cmd_v1->depends_on = cmd_v2->depends_on; | ||
299 | cmd_v1->interval = cmd_v2->interval; | ||
300 | cmd_v1->duration = cmd_v2->duration; | ||
301 | if (cmd_v2->repeat == TE_V2_REPEAT_ENDLESS) | ||
302 | cmd_v1->repeat = cpu_to_le32(TE_V1_REPEAT_ENDLESS); | ||
303 | else | ||
304 | cmd_v1->repeat = cpu_to_le32(cmd_v2->repeat); | ||
305 | cmd_v1->max_frags = cpu_to_le32(cmd_v2->max_frags); | ||
306 | cmd_v1->interval_reciprocal = 0; /* unused */ | ||
307 | |||
308 | cmd_v1->dep_policy = cpu_to_le32(te_v2_get_dep_policy(cmd_v2->policy)); | ||
309 | cmd_v1->is_present = cpu_to_le32(!te_v2_get_absence(cmd_v2->policy)); | ||
310 | cmd_v1->notify = cpu_to_le32(te_v2_get_notify(cmd_v2->policy)); | ||
311 | } | ||
312 | |||
313 | static int iwl_mvm_send_time_event_cmd(struct iwl_mvm *mvm, | ||
314 | const struct iwl_time_event_cmd_v2 *cmd) | ||
315 | { | ||
316 | struct iwl_time_event_cmd_v1 cmd_v1; | ||
317 | |||
318 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2) | ||
319 | return iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, | ||
320 | sizeof(*cmd), cmd); | ||
321 | |||
322 | iwl_mvm_te_v2_to_v1(cmd, &cmd_v1); | ||
323 | return iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, | ||
324 | sizeof(cmd_v1), &cmd_v1); | ||
325 | } | ||
326 | |||
327 | |||
273 | static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, | 328 | static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, |
274 | struct ieee80211_vif *vif, | 329 | struct ieee80211_vif *vif, |
275 | struct iwl_mvm_time_event_data *te_data, | 330 | struct iwl_mvm_time_event_data *te_data, |
276 | struct iwl_time_event_cmd *te_cmd) | 331 | struct iwl_time_event_cmd_v2 *te_cmd) |
277 | { | 332 | { |
278 | static const u8 time_event_response[] = { TIME_EVENT_CMD }; | 333 | static const u8 time_event_response[] = { TIME_EVENT_CMD }; |
279 | struct iwl_notification_wait wait_time_event; | 334 | struct iwl_notification_wait wait_time_event; |
@@ -309,8 +364,7 @@ static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, | |||
309 | ARRAY_SIZE(time_event_response), | 364 | ARRAY_SIZE(time_event_response), |
310 | iwl_mvm_time_event_response, te_data); | 365 | iwl_mvm_time_event_response, te_data); |
311 | 366 | ||
312 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, | 367 | ret = iwl_mvm_send_time_event_cmd(mvm, te_cmd); |
313 | sizeof(*te_cmd), te_cmd); | ||
314 | if (ret) { | 368 | if (ret) { |
315 | IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); | 369 | IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); |
316 | iwl_remove_notification(&mvm->notif_wait, &wait_time_event); | 370 | iwl_remove_notification(&mvm->notif_wait, &wait_time_event); |
@@ -337,13 +391,12 @@ void iwl_mvm_protect_session(struct iwl_mvm *mvm, | |||
337 | { | 391 | { |
338 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 392 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
339 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; | 393 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; |
340 | struct iwl_time_event_cmd time_cmd = {}; | 394 | struct iwl_time_event_cmd_v2 time_cmd = {}; |
341 | 395 | ||
342 | lockdep_assert_held(&mvm->mutex); | 396 | lockdep_assert_held(&mvm->mutex); |
343 | 397 | ||
344 | if (te_data->running && | 398 | if (te_data->running && |
345 | time_after(te_data->end_jiffies, | 399 | time_after(te_data->end_jiffies, TU_TO_EXP_TIME(min_duration))) { |
346 | jiffies + TU_TO_JIFFIES(min_duration))) { | ||
347 | IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n", | 400 | IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n", |
348 | jiffies_to_msecs(te_data->end_jiffies - jiffies)); | 401 | jiffies_to_msecs(te_data->end_jiffies - jiffies)); |
349 | return; | 402 | return; |
@@ -372,17 +425,14 @@ void iwl_mvm_protect_session(struct iwl_mvm *mvm, | |||
372 | time_cmd.apply_time = | 425 | time_cmd.apply_time = |
373 | cpu_to_le32(iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG)); | 426 | cpu_to_le32(iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG)); |
374 | 427 | ||
375 | time_cmd.dep_policy = TE_INDEPENDENT; | 428 | time_cmd.max_frags = TE_V2_FRAG_NONE; |
376 | time_cmd.is_present = cpu_to_le32(1); | ||
377 | time_cmd.max_frags = cpu_to_le32(TE_FRAG_NONE); | ||
378 | time_cmd.max_delay = cpu_to_le32(500); | 429 | time_cmd.max_delay = cpu_to_le32(500); |
379 | /* TODO: why do we need to interval = bi if it is not periodic? */ | 430 | /* TODO: why do we need to interval = bi if it is not periodic? */ |
380 | time_cmd.interval = cpu_to_le32(1); | 431 | time_cmd.interval = cpu_to_le32(1); |
381 | time_cmd.interval_reciprocal = cpu_to_le32(iwl_mvm_reciprocal(1)); | ||
382 | time_cmd.duration = cpu_to_le32(duration); | 432 | time_cmd.duration = cpu_to_le32(duration); |
383 | time_cmd.repeat = cpu_to_le32(1); | 433 | time_cmd.repeat = 1; |
384 | time_cmd.notify = cpu_to_le32(TE_NOTIF_HOST_EVENT_START | | 434 | time_cmd.policy = cpu_to_le16(TE_V2_NOTIF_HOST_EVENT_START | |
385 | TE_NOTIF_HOST_EVENT_END); | 435 | TE_V2_NOTIF_HOST_EVENT_END); |
386 | 436 | ||
387 | iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); | 437 | iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); |
388 | } | 438 | } |
@@ -396,7 +446,7 @@ void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, | |||
396 | struct iwl_mvm_vif *mvmvif, | 446 | struct iwl_mvm_vif *mvmvif, |
397 | struct iwl_mvm_time_event_data *te_data) | 447 | struct iwl_mvm_time_event_data *te_data) |
398 | { | 448 | { |
399 | struct iwl_time_event_cmd time_cmd = {}; | 449 | struct iwl_time_event_cmd_v2 time_cmd = {}; |
400 | u32 id, uid; | 450 | u32 id, uid; |
401 | int ret; | 451 | int ret; |
402 | 452 | ||
@@ -433,8 +483,7 @@ void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, | |||
433 | cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); | 483 | cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); |
434 | 484 | ||
435 | IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); | 485 | IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); |
436 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, | 486 | ret = iwl_mvm_send_time_event_cmd(mvm, &time_cmd); |
437 | sizeof(time_cmd), &time_cmd); | ||
438 | if (WARN_ON(ret)) | 487 | if (WARN_ON(ret)) |
439 | return; | 488 | return; |
440 | } | 489 | } |
@@ -454,7 +503,7 @@ int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
454 | { | 503 | { |
455 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 504 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
456 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; | 505 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; |
457 | struct iwl_time_event_cmd time_cmd = {}; | 506 | struct iwl_time_event_cmd_v2 time_cmd = {}; |
458 | 507 | ||
459 | lockdep_assert_held(&mvm->mutex); | 508 | lockdep_assert_held(&mvm->mutex); |
460 | if (te_data->running) { | 509 | if (te_data->running) { |
@@ -485,8 +534,6 @@ int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
485 | } | 534 | } |
486 | 535 | ||
487 | time_cmd.apply_time = cpu_to_le32(0); | 536 | time_cmd.apply_time = cpu_to_le32(0); |
488 | time_cmd.dep_policy = cpu_to_le32(TE_INDEPENDENT); | ||
489 | time_cmd.is_present = cpu_to_le32(1); | ||
490 | time_cmd.interval = cpu_to_le32(1); | 537 | time_cmd.interval = cpu_to_le32(1); |
491 | 538 | ||
492 | /* | 539 | /* |
@@ -495,12 +542,12 @@ int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
495 | * scheduled. To improve the chances of it being scheduled, allow them | 542 | * scheduled. To improve the chances of it being scheduled, allow them |
496 | * to be fragmented, and in addition allow them to be delayed. | 543 | * to be fragmented, and in addition allow them to be delayed. |
497 | */ | 544 | */ |
498 | time_cmd.max_frags = cpu_to_le32(MSEC_TO_TU(duration)/20); | 545 | time_cmd.max_frags = min(MSEC_TO_TU(duration)/50, TE_V2_FRAG_ENDLESS); |
499 | time_cmd.max_delay = cpu_to_le32(MSEC_TO_TU(duration/2)); | 546 | time_cmd.max_delay = cpu_to_le32(MSEC_TO_TU(duration/2)); |
500 | time_cmd.duration = cpu_to_le32(MSEC_TO_TU(duration)); | 547 | time_cmd.duration = cpu_to_le32(MSEC_TO_TU(duration)); |
501 | time_cmd.repeat = cpu_to_le32(1); | 548 | time_cmd.repeat = 1; |
502 | time_cmd.notify = cpu_to_le32(TE_NOTIF_HOST_EVENT_START | | 549 | time_cmd.policy = cpu_to_le16(TE_V2_NOTIF_HOST_EVENT_START | |
503 | TE_NOTIF_HOST_EVENT_END); | 550 | TE_V2_NOTIF_HOST_EVENT_END); |
504 | 551 | ||
505 | return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); | 552 | return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); |
506 | } | 553 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index f68ef9dd6a70..e05440d90319 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -91,11 +91,10 @@ static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
91 | tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR; | 91 | tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR; |
92 | 92 | ||
93 | /* High prio packet (wrt. BT coex) if it is EAPOL, MCAST or MGMT */ | 93 | /* High prio packet (wrt. BT coex) if it is EAPOL, MCAST or MGMT */ |
94 | if (info->band == IEEE80211_BAND_2GHZ && | 94 | if (info->band == IEEE80211_BAND_2GHZ && |
95 | (skb->protocol == cpu_to_be16(ETH_P_PAE) || | 95 | (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO || |
96 | is_multicast_ether_addr(hdr->addr1) || | 96 | is_multicast_ether_addr(hdr->addr1) || |
97 | ieee80211_is_back_req(fc) || | 97 | ieee80211_is_back_req(fc) || ieee80211_is_mgmt(fc))) |
98 | ieee80211_is_mgmt(fc))) | ||
99 | tx_flags |= TX_CMD_FLG_BT_DIS; | 98 | tx_flags |= TX_CMD_FLG_BT_DIS; |
100 | 99 | ||
101 | if (ieee80211_has_morefrags(fc)) | 100 | if (ieee80211_has_morefrags(fc)) |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 158669ee4ce5..dc02cb9792af 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -325,15 +325,15 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
325 | int ret; | 325 | int ret; |
326 | 326 | ||
327 | iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); | 327 | iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); |
328 | if (iwl_trans == NULL) | 328 | if (IS_ERR(iwl_trans)) |
329 | return -ENOMEM; | 329 | return PTR_ERR(iwl_trans); |
330 | 330 | ||
331 | pci_set_drvdata(pdev, iwl_trans); | 331 | pci_set_drvdata(pdev, iwl_trans); |
332 | 332 | ||
333 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); | 333 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); |
334 | trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); | 334 | trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); |
335 | 335 | ||
336 | if (IS_ERR_OR_NULL(trans_pcie->drv)) { | 336 | if (IS_ERR(trans_pcie->drv)) { |
337 | ret = PTR_ERR(trans_pcie->drv); | 337 | ret = PTR_ERR(trans_pcie->drv); |
338 | goto out_free_trans; | 338 | goto out_free_trans; |
339 | } | 339 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index 5fdb4eea146d..3f237b42eb36 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -112,15 +112,16 @@ | |||
112 | */ | 112 | */ |
113 | static int iwl_rxq_space(const struct iwl_rxq *rxq) | 113 | static int iwl_rxq_space(const struct iwl_rxq *rxq) |
114 | { | 114 | { |
115 | int s = rxq->read - rxq->write; | 115 | /* Make sure RX_QUEUE_SIZE is a power of 2 */ |
116 | 116 | BUILD_BUG_ON(RX_QUEUE_SIZE & (RX_QUEUE_SIZE - 1)); | |
117 | if (s <= 0) | 117 | |
118 | s += RX_QUEUE_SIZE; | 118 | /* |
119 | /* keep some buffer to not confuse full and empty queue */ | 119 | * There can be up to (RX_QUEUE_SIZE - 1) free slots, to avoid ambiguity |
120 | s -= 2; | 120 | * between empty and completely full queues. |
121 | if (s < 0) | 121 | * The following is equivalent to modulo by RX_QUEUE_SIZE and is well |
122 | s = 0; | 122 | * defined for negative dividends. |
123 | return s; | 123 | */ |
124 | return (rxq->read - rxq->write - 1) & (RX_QUEUE_SIZE - 1); | ||
124 | } | 125 | } |
125 | 126 | ||
126 | /* | 127 | /* |
@@ -1120,6 +1121,7 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data) | |||
1120 | struct iwl_trans *trans = data; | 1121 | struct iwl_trans *trans = data; |
1121 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 1122 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
1122 | u32 inta, inta_mask; | 1123 | u32 inta, inta_mask; |
1124 | irqreturn_t ret = IRQ_NONE; | ||
1123 | 1125 | ||
1124 | lockdep_assert_held(&trans_pcie->irq_lock); | 1126 | lockdep_assert_held(&trans_pcie->irq_lock); |
1125 | 1127 | ||
@@ -1168,10 +1170,8 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data) | |||
1168 | /* the thread will service interrupts and re-enable them */ | 1170 | /* the thread will service interrupts and re-enable them */ |
1169 | if (likely(inta)) | 1171 | if (likely(inta)) |
1170 | return IRQ_WAKE_THREAD; | 1172 | return IRQ_WAKE_THREAD; |
1171 | else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && | 1173 | |
1172 | !trans_pcie->inta) | 1174 | ret = IRQ_HANDLED; |
1173 | iwl_enable_interrupts(trans); | ||
1174 | return IRQ_HANDLED; | ||
1175 | 1175 | ||
1176 | none: | 1176 | none: |
1177 | /* re-enable interrupts here since we don't have anything to service. */ | 1177 | /* re-enable interrupts here since we don't have anything to service. */ |
@@ -1180,7 +1180,7 @@ none: | |||
1180 | !trans_pcie->inta) | 1180 | !trans_pcie->inta) |
1181 | iwl_enable_interrupts(trans); | 1181 | iwl_enable_interrupts(trans); |
1182 | 1182 | ||
1183 | return IRQ_NONE; | 1183 | return ret; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | /* interrupt handler using ict table, with this interrupt driver will | 1186 | /* interrupt handler using ict table, with this interrupt driver will |
@@ -1199,6 +1199,7 @@ irqreturn_t iwl_pcie_isr_ict(int irq, void *data) | |||
1199 | u32 val = 0; | 1199 | u32 val = 0; |
1200 | u32 read; | 1200 | u32 read; |
1201 | unsigned long flags; | 1201 | unsigned long flags; |
1202 | irqreturn_t ret = IRQ_NONE; | ||
1202 | 1203 | ||
1203 | if (!trans) | 1204 | if (!trans) |
1204 | return IRQ_NONE; | 1205 | return IRQ_NONE; |
@@ -1211,7 +1212,7 @@ irqreturn_t iwl_pcie_isr_ict(int irq, void *data) | |||
1211 | * use legacy interrupt. | 1212 | * use legacy interrupt. |
1212 | */ | 1213 | */ |
1213 | if (unlikely(!trans_pcie->use_ict)) { | 1214 | if (unlikely(!trans_pcie->use_ict)) { |
1214 | irqreturn_t ret = iwl_pcie_isr(irq, data); | 1215 | ret = iwl_pcie_isr(irq, data); |
1215 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | 1216 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); |
1216 | return ret; | 1217 | return ret; |
1217 | } | 1218 | } |
@@ -1280,17 +1281,9 @@ irqreturn_t iwl_pcie_isr_ict(int irq, void *data) | |||
1280 | if (likely(inta)) { | 1281 | if (likely(inta)) { |
1281 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | 1282 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); |
1282 | return IRQ_WAKE_THREAD; | 1283 | return IRQ_WAKE_THREAD; |
1283 | } else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && | ||
1284 | !trans_pcie->inta) { | ||
1285 | /* Allow interrupt if was disabled by this handler and | ||
1286 | * no tasklet was schedules, We should not enable interrupt, | ||
1287 | * tasklet will enable it. | ||
1288 | */ | ||
1289 | iwl_enable_interrupts(trans); | ||
1290 | } | 1284 | } |
1291 | 1285 | ||
1292 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | 1286 | ret = IRQ_HANDLED; |
1293 | return IRQ_HANDLED; | ||
1294 | 1287 | ||
1295 | none: | 1288 | none: |
1296 | /* re-enable interrupts here since we don't have anything to service. | 1289 | /* re-enable interrupts here since we don't have anything to service. |
@@ -1301,5 +1294,5 @@ irqreturn_t iwl_pcie_isr_ict(int irq, void *data) | |||
1301 | iwl_enable_interrupts(trans); | 1294 | iwl_enable_interrupts(trans); |
1302 | 1295 | ||
1303 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | 1296 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); |
1304 | return IRQ_NONE; | 1297 | return ret; |
1305 | } | 1298 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index eca44299c512..bad95d28d50d 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -1386,9 +1386,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
1386 | 1386 | ||
1387 | trans = kzalloc(sizeof(struct iwl_trans) + | 1387 | trans = kzalloc(sizeof(struct iwl_trans) + |
1388 | sizeof(struct iwl_trans_pcie), GFP_KERNEL); | 1388 | sizeof(struct iwl_trans_pcie), GFP_KERNEL); |
1389 | 1389 | if (!trans) { | |
1390 | if (!trans) | 1390 | err = -ENOMEM; |
1391 | return NULL; | 1391 | goto out; |
1392 | } | ||
1392 | 1393 | ||
1393 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 1394 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
1394 | 1395 | ||
@@ -1411,15 +1412,9 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
1411 | PCIE_LINK_STATE_CLKPM); | 1412 | PCIE_LINK_STATE_CLKPM); |
1412 | } | 1413 | } |
1413 | 1414 | ||
1414 | if (pci_enable_device(pdev)) { | 1415 | err = pci_enable_device(pdev); |
1415 | err = -ENODEV; | 1416 | if (err) |
1416 | goto out_no_pci; | 1417 | goto out_no_pci; |
1417 | } | ||
1418 | |||
1419 | /* W/A - seems to solve weird behavior. We need to remove this if we | ||
1420 | * don't want to stay in L1 all the time. This wastes a lot of power */ | ||
1421 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | | ||
1422 | PCIE_LINK_STATE_CLKPM); | ||
1423 | 1418 | ||
1424 | pci_set_master(pdev); | 1419 | pci_set_master(pdev); |
1425 | 1420 | ||
@@ -1488,17 +1483,20 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
1488 | SLAB_HWCACHE_ALIGN, | 1483 | SLAB_HWCACHE_ALIGN, |
1489 | NULL); | 1484 | NULL); |
1490 | 1485 | ||
1491 | if (!trans->dev_cmd_pool) | 1486 | if (!trans->dev_cmd_pool) { |
1487 | err = -ENOMEM; | ||
1492 | goto out_pci_disable_msi; | 1488 | goto out_pci_disable_msi; |
1489 | } | ||
1493 | 1490 | ||
1494 | trans_pcie->inta_mask = CSR_INI_SET_MASK; | 1491 | trans_pcie->inta_mask = CSR_INI_SET_MASK; |
1495 | 1492 | ||
1496 | if (iwl_pcie_alloc_ict(trans)) | 1493 | if (iwl_pcie_alloc_ict(trans)) |
1497 | goto out_free_cmd_pool; | 1494 | goto out_free_cmd_pool; |
1498 | 1495 | ||
1499 | if (request_threaded_irq(pdev->irq, iwl_pcie_isr_ict, | 1496 | err = request_threaded_irq(pdev->irq, iwl_pcie_isr_ict, |
1500 | iwl_pcie_irq_handler, | 1497 | iwl_pcie_irq_handler, |
1501 | IRQF_SHARED, DRV_NAME, trans)) { | 1498 | IRQF_SHARED, DRV_NAME, trans); |
1499 | if (err) { | ||
1502 | IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq); | 1500 | IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq); |
1503 | goto out_free_ict; | 1501 | goto out_free_ict; |
1504 | } | 1502 | } |
@@ -1517,5 +1515,6 @@ out_pci_disable_device: | |||
1517 | pci_disable_device(pdev); | 1515 | pci_disable_device(pdev); |
1518 | out_no_pci: | 1516 | out_no_pci: |
1519 | kfree(trans); | 1517 | kfree(trans); |
1520 | return NULL; | 1518 | out: |
1519 | return ERR_PTR(err); | ||
1521 | } | 1520 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 011167c22da8..f45eb29c2ede 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -65,18 +65,30 @@ | |||
65 | ***************************************************/ | 65 | ***************************************************/ |
66 | static int iwl_queue_space(const struct iwl_queue *q) | 66 | static int iwl_queue_space(const struct iwl_queue *q) |
67 | { | 67 | { |
68 | int s = q->read_ptr - q->write_ptr; | 68 | unsigned int max; |
69 | 69 | unsigned int used; | |
70 | if (q->read_ptr > q->write_ptr) | 70 | |
71 | s -= q->n_bd; | 71 | /* |
72 | 72 | * To avoid ambiguity between empty and completely full queues, there | |
73 | if (s <= 0) | 73 | * should always be less than q->n_bd elements in the queue. |
74 | s += q->n_window; | 74 | * If q->n_window is smaller than q->n_bd, there is no need to reserve |
75 | /* keep some reserve to not confuse empty and full situations */ | 75 | * any queue entries for this purpose. |
76 | s -= 2; | 76 | */ |
77 | if (s < 0) | 77 | if (q->n_window < q->n_bd) |
78 | s = 0; | 78 | max = q->n_window; |
79 | return s; | 79 | else |
80 | max = q->n_bd - 1; | ||
81 | |||
82 | /* | ||
83 | * q->n_bd is a power of 2, so the following is equivalent to modulo by | ||
84 | * q->n_bd and is well defined for negative dividends. | ||
85 | */ | ||
86 | used = (q->write_ptr - q->read_ptr) & (q->n_bd - 1); | ||
87 | |||
88 | if (WARN_ON(used > max)) | ||
89 | return 0; | ||
90 | |||
91 | return max - used; | ||
80 | } | 92 | } |
81 | 93 | ||
82 | /* | 94 | /* |
@@ -826,7 +838,7 @@ static int iwl_pcie_tx_alloc(struct iwl_trans *trans) | |||
826 | sizeof(struct iwl_txq), GFP_KERNEL); | 838 | sizeof(struct iwl_txq), GFP_KERNEL); |
827 | if (!trans_pcie->txq) { | 839 | if (!trans_pcie->txq) { |
828 | IWL_ERR(trans, "Not enough memory for txq\n"); | 840 | IWL_ERR(trans, "Not enough memory for txq\n"); |
829 | ret = ENOMEM; | 841 | ret = -ENOMEM; |
830 | goto error; | 842 | goto error; |
831 | } | 843 | } |
832 | 844 | ||
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index efae07e05c80..6fef746345bc 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
@@ -1017,7 +1017,7 @@ static int lbs_add_mesh(struct lbs_private *priv) | |||
1017 | 1017 | ||
1018 | mesh_dev->netdev_ops = &mesh_netdev_ops; | 1018 | mesh_dev->netdev_ops = &mesh_netdev_ops; |
1019 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; | 1019 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; |
1020 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN); | 1020 | eth_hw_addr_inherit(mesh_dev, priv->dev); |
1021 | 1021 | ||
1022 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); | 1022 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); |
1023 | 1023 | ||
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 7b2a6229eedb..2cd3f54e1efa 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -1364,6 +1364,7 @@ static const struct nla_policy hwsim_testmode_policy[HWSIM_TM_ATTR_MAX + 1] = { | |||
1364 | static int hwsim_fops_ps_write(void *dat, u64 val); | 1364 | static int hwsim_fops_ps_write(void *dat, u64 val); |
1365 | 1365 | ||
1366 | static int mac80211_hwsim_testmode_cmd(struct ieee80211_hw *hw, | 1366 | static int mac80211_hwsim_testmode_cmd(struct ieee80211_hw *hw, |
1367 | struct ieee80211_vif *vif, | ||
1367 | void *data, int len) | 1368 | void *data, int len) |
1368 | { | 1369 | { |
1369 | struct mac80211_hwsim_data *hwsim = hw->priv; | 1370 | struct mac80211_hwsim_data *hwsim = hw->priv; |
@@ -2527,8 +2528,10 @@ static int __init init_mac80211_hwsim(void) | |||
2527 | } | 2528 | } |
2528 | 2529 | ||
2529 | hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); | 2530 | hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); |
2530 | if (hwsim_mon == NULL) | 2531 | if (hwsim_mon == NULL) { |
2532 | err = -ENOMEM; | ||
2531 | goto failed; | 2533 | goto failed; |
2534 | } | ||
2532 | 2535 | ||
2533 | rtnl_lock(); | 2536 | rtnl_lock(); |
2534 | 2537 | ||
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c index 41e9d25a2d8e..0b803c05cab3 100644 --- a/drivers/net/wireless/mwifiex/11n.c +++ b/drivers/net/wireless/mwifiex/11n.c | |||
@@ -292,6 +292,7 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv, | |||
292 | struct mwifiex_ie_types_extcap *ext_cap; | 292 | struct mwifiex_ie_types_extcap *ext_cap; |
293 | int ret_len = 0; | 293 | int ret_len = 0; |
294 | struct ieee80211_supported_band *sband; | 294 | struct ieee80211_supported_band *sband; |
295 | struct ieee_types_header *hdr; | ||
295 | u8 radio_type; | 296 | u8 radio_type; |
296 | 297 | ||
297 | if (!buffer || !*buffer) | 298 | if (!buffer || !*buffer) |
@@ -388,17 +389,24 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv, | |||
388 | } | 389 | } |
389 | 390 | ||
390 | if (bss_desc->bcn_ext_cap) { | 391 | if (bss_desc->bcn_ext_cap) { |
392 | hdr = (void *)bss_desc->bcn_ext_cap; | ||
391 | ext_cap = (struct mwifiex_ie_types_extcap *) *buffer; | 393 | ext_cap = (struct mwifiex_ie_types_extcap *) *buffer; |
392 | memset(ext_cap, 0, sizeof(struct mwifiex_ie_types_extcap)); | 394 | memset(ext_cap, 0, sizeof(struct mwifiex_ie_types_extcap)); |
393 | ext_cap->header.type = cpu_to_le16(WLAN_EID_EXT_CAPABILITY); | 395 | ext_cap->header.type = cpu_to_le16(WLAN_EID_EXT_CAPABILITY); |
394 | ext_cap->header.len = cpu_to_le16(sizeof(ext_cap->ext_cap)); | 396 | ext_cap->header.len = cpu_to_le16(hdr->len); |
395 | 397 | ||
396 | memcpy((u8 *)ext_cap + sizeof(struct mwifiex_ie_types_header), | 398 | memcpy((u8 *)ext_cap->ext_capab, |
397 | bss_desc->bcn_ext_cap + sizeof(struct ieee_types_header), | 399 | bss_desc->bcn_ext_cap + sizeof(struct ieee_types_header), |
398 | le16_to_cpu(ext_cap->header.len)); | 400 | le16_to_cpu(ext_cap->header.len)); |
399 | 401 | ||
400 | *buffer += sizeof(struct mwifiex_ie_types_extcap); | 402 | if (hdr->len > 3 && |
401 | ret_len += sizeof(struct mwifiex_ie_types_extcap); | 403 | ext_cap->ext_capab[3] & WLAN_EXT_CAPA4_INTERWORKING_ENABLED) |
404 | priv->hs2_enabled = true; | ||
405 | else | ||
406 | priv->hs2_enabled = false; | ||
407 | |||
408 | *buffer += sizeof(struct mwifiex_ie_types_extcap) + hdr->len; | ||
409 | ret_len += sizeof(struct mwifiex_ie_types_extcap) + hdr->len; | ||
402 | } | 410 | } |
403 | 411 | ||
404 | return ret_len; | 412 | return ret_len; |
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index 8f9f54231a1c..21c688264708 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
@@ -69,7 +69,8 @@ mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr, | |||
69 | memcpy(&tx_header->eth803_hdr, skb_src->data, dt_offset); | 69 | memcpy(&tx_header->eth803_hdr, skb_src->data, dt_offset); |
70 | 70 | ||
71 | /* Copy SNAP header */ | 71 | /* Copy SNAP header */ |
72 | snap.snap_type = *(u16 *) ((u8 *)skb_src->data + dt_offset); | 72 | snap.snap_type = |
73 | le16_to_cpu(*(__le16 *) ((u8 *)skb_src->data + dt_offset)); | ||
73 | dt_offset += sizeof(u16); | 74 | dt_offset += sizeof(u16); |
74 | 75 | ||
75 | memcpy(&tx_header->rfc1042_hdr, &snap, sizeof(struct rfc_1042_hdr)); | 76 | memcpy(&tx_header->rfc1042_hdr, &snap, sizeof(struct rfc_1042_hdr)); |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index ca149aea1517..fbad00a5abc8 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1508,6 +1508,7 @@ mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, | |||
1508 | " reason code %d\n", priv->cfg_bssid, reason_code); | 1508 | " reason code %d\n", priv->cfg_bssid, reason_code); |
1509 | 1509 | ||
1510 | memset(priv->cfg_bssid, 0, ETH_ALEN); | 1510 | memset(priv->cfg_bssid, 0, ETH_ALEN); |
1511 | priv->hs2_enabled = false; | ||
1511 | 1512 | ||
1512 | return 0; | 1513 | return 0; |
1513 | } | 1514 | } |
diff --git a/drivers/net/wireless/mwifiex/decl.h b/drivers/net/wireless/mwifiex/decl.h index a5993475daef..5c85d7803d00 100644 --- a/drivers/net/wireless/mwifiex/decl.h +++ b/drivers/net/wireless/mwifiex/decl.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
27 | #include <linux/timer.h> | 27 | #include <linux/timer.h> |
28 | #include <linux/ieee80211.h> | 28 | #include <linux/ieee80211.h> |
29 | #include <uapi/linux/if_arp.h> | ||
29 | #include <net/mac80211.h> | 30 | #include <net/mac80211.h> |
30 | 31 | ||
31 | 32 | ||
@@ -152,4 +153,12 @@ struct mwifiex_types_wmm_info { | |||
152 | u8 reserved; | 153 | u8 reserved; |
153 | struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_NUM_ACS]; | 154 | struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_NUM_ACS]; |
154 | } __packed; | 155 | } __packed; |
156 | |||
157 | struct mwifiex_arp_eth_header { | ||
158 | struct arphdr hdr; | ||
159 | u8 ar_sha[ETH_ALEN]; | ||
160 | u8 ar_sip[4]; | ||
161 | u8 ar_tha[ETH_ALEN]; | ||
162 | u8 ar_tip[4]; | ||
163 | } __packed; | ||
155 | #endif /* !_MWIFIEX_DECL_H_ */ | 164 | #endif /* !_MWIFIEX_DECL_H_ */ |
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index c9ad1c0d338d..f80f30b6160e 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -1330,7 +1330,7 @@ struct mwifiex_ie_types_2040bssco { | |||
1330 | 1330 | ||
1331 | struct mwifiex_ie_types_extcap { | 1331 | struct mwifiex_ie_types_extcap { |
1332 | struct mwifiex_ie_types_header header; | 1332 | struct mwifiex_ie_types_header header; |
1333 | u8 ext_cap; | 1333 | u8 ext_capab[0]; |
1334 | } __packed; | 1334 | } __packed; |
1335 | 1335 | ||
1336 | struct host_cmd_ds_mac_reg_access { | 1336 | struct host_cmd_ds_mac_reg_access { |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index e021a581a143..6499117fce43 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -136,6 +136,7 @@ int mwifiex_init_priv(struct mwifiex_private *priv) | |||
136 | priv->csa_chan = 0; | 136 | priv->csa_chan = 0; |
137 | priv->csa_expire_time = 0; | 137 | priv->csa_expire_time = 0; |
138 | priv->del_list_idx = 0; | 138 | priv->del_list_idx = 0; |
139 | priv->hs2_enabled = false; | ||
139 | 140 | ||
140 | return mwifiex_add_bss_prio_tbl(priv); | 141 | return mwifiex_add_bss_prio_tbl(priv); |
141 | } | 142 | } |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 3402bffdd016..fd778337deee 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -477,20 +477,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) | |||
477 | dev_err(adapter->dev, "cannot create default STA interface\n"); | 477 | dev_err(adapter->dev, "cannot create default STA interface\n"); |
478 | goto err_add_intf; | 478 | goto err_add_intf; |
479 | } | 479 | } |
480 | |||
481 | /* Create AP interface by default */ | ||
482 | if (!mwifiex_add_virtual_intf(adapter->wiphy, "uap%d", | ||
483 | NL80211_IFTYPE_AP, NULL, NULL)) { | ||
484 | dev_err(adapter->dev, "cannot create default AP interface\n"); | ||
485 | goto err_add_intf; | ||
486 | } | ||
487 | |||
488 | /* Create P2P interface by default */ | ||
489 | if (!mwifiex_add_virtual_intf(adapter->wiphy, "p2p%d", | ||
490 | NL80211_IFTYPE_P2P_CLIENT, NULL, NULL)) { | ||
491 | dev_err(adapter->dev, "cannot create default P2P interface\n"); | ||
492 | goto err_add_intf; | ||
493 | } | ||
494 | rtnl_unlock(); | 480 | rtnl_unlock(); |
495 | 481 | ||
496 | mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); | 482 | mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index d2e5ccd891da..1d72f13adb9d 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -516,6 +516,7 @@ struct mwifiex_private { | |||
516 | u8 csa_chan; | 516 | u8 csa_chan; |
517 | unsigned long csa_expire_time; | 517 | unsigned long csa_expire_time; |
518 | u8 del_list_idx; | 518 | u8 del_list_idx; |
519 | bool hs2_enabled; | ||
519 | }; | 520 | }; |
520 | 521 | ||
521 | enum mwifiex_ba_status { | 522 | enum mwifiex_ba_status { |
@@ -1025,7 +1026,7 @@ mwifiex_netdev_get_priv(struct net_device *dev) | |||
1025 | */ | 1026 | */ |
1026 | static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff *skb) | 1027 | static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff *skb) |
1027 | { | 1028 | { |
1028 | return (*(u32 *)skb->data == PKT_TYPE_MGMT); | 1029 | return (le32_to_cpu(*(__le32 *)skb->data) == PKT_TYPE_MGMT); |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | /* This function retrieves channel closed for operation by Channel | 1032 | /* This function retrieves channel closed for operation by Channel |
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index 0e2070f72fed..1576104e3d95 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c | |||
@@ -1062,7 +1062,7 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter, | |||
1062 | 1062 | ||
1063 | case MWIFIEX_TYPE_EVENT: | 1063 | case MWIFIEX_TYPE_EVENT: |
1064 | dev_dbg(adapter->dev, "info: --- Rx: Event ---\n"); | 1064 | dev_dbg(adapter->dev, "info: --- Rx: Event ---\n"); |
1065 | adapter->event_cause = *(u32 *) skb->data; | 1065 | adapter->event_cause = le32_to_cpu(*(__le32 *) skb->data); |
1066 | 1066 | ||
1067 | if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE)) | 1067 | if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE)) |
1068 | memcpy(adapter->event_body, | 1068 | memcpy(adapter->event_body, |
@@ -1207,8 +1207,8 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter, | |||
1207 | for (pind = 0; pind < card->mpa_rx.pkt_cnt; pind++) { | 1207 | for (pind = 0; pind < card->mpa_rx.pkt_cnt; pind++) { |
1208 | 1208 | ||
1209 | /* get curr PKT len & type */ | 1209 | /* get curr PKT len & type */ |
1210 | pkt_len = *(u16 *) &curr_ptr[0]; | 1210 | pkt_len = le16_to_cpu(*(__le16 *) &curr_ptr[0]); |
1211 | pkt_type = *(u16 *) &curr_ptr[2]; | 1211 | pkt_type = le16_to_cpu(*(__le16 *) &curr_ptr[2]); |
1212 | 1212 | ||
1213 | /* copy pkt to deaggr buf */ | 1213 | /* copy pkt to deaggr buf */ |
1214 | skb_deaggr = card->mpa_rx.skb_arr[pind]; | 1214 | skb_deaggr = card->mpa_rx.skb_arr[pind]; |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index 6a814eb2671a..58a6013712d2 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -280,7 +280,7 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, | |||
280 | 280 | ||
281 | tlv_buf = ((u8 *)rate_cfg) + | 281 | tlv_buf = ((u8 *)rate_cfg) + |
282 | sizeof(struct host_cmd_ds_tx_rate_cfg); | 282 | sizeof(struct host_cmd_ds_tx_rate_cfg); |
283 | tlv_buf_len = *(u16 *) (tlv_buf + sizeof(u16)); | 283 | tlv_buf_len = le16_to_cpu(*(__le16 *) (tlv_buf + sizeof(u16))); |
284 | 284 | ||
285 | while (tlv_buf && tlv_buf_len > 0) { | 285 | while (tlv_buf && tlv_buf_len > 0) { |
286 | tlv = (*tlv_buf); | 286 | tlv = (*tlv_buf); |
diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c index b5c109504393..bb22664923ef 100644 --- a/drivers/net/wireless/mwifiex/sta_rx.c +++ b/drivers/net/wireless/mwifiex/sta_rx.c | |||
@@ -17,6 +17,8 @@ | |||
17 | * this warranty disclaimer. | 17 | * this warranty disclaimer. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <uapi/linux/ipv6.h> | ||
21 | #include <net/ndisc.h> | ||
20 | #include "decl.h" | 22 | #include "decl.h" |
21 | #include "ioctl.h" | 23 | #include "ioctl.h" |
22 | #include "util.h" | 24 | #include "util.h" |
@@ -25,6 +27,46 @@ | |||
25 | #include "11n_aggr.h" | 27 | #include "11n_aggr.h" |
26 | #include "11n_rxreorder.h" | 28 | #include "11n_rxreorder.h" |
27 | 29 | ||
30 | /* This function checks if a frame is IPv4 ARP or IPv6 Neighbour advertisement | ||
31 | * frame. If frame has both source and destination mac address as same, this | ||
32 | * function drops such gratuitous frames. | ||
33 | */ | ||
34 | static bool | ||
35 | mwifiex_discard_gratuitous_arp(struct mwifiex_private *priv, | ||
36 | struct sk_buff *skb) | ||
37 | { | ||
38 | const struct mwifiex_arp_eth_header *arp; | ||
39 | struct ethhdr *eth_hdr; | ||
40 | struct ipv6hdr *ipv6; | ||
41 | struct icmp6hdr *icmpv6; | ||
42 | |||
43 | eth_hdr = (struct ethhdr *)skb->data; | ||
44 | switch (ntohs(eth_hdr->h_proto)) { | ||
45 | case ETH_P_ARP: | ||
46 | arp = (void *)(skb->data + sizeof(struct ethhdr)); | ||
47 | if (arp->hdr.ar_op == htons(ARPOP_REPLY) || | ||
48 | arp->hdr.ar_op == htons(ARPOP_REQUEST)) { | ||
49 | if (!memcmp(arp->ar_sip, arp->ar_tip, 4)) | ||
50 | return true; | ||
51 | } | ||
52 | break; | ||
53 | case ETH_P_IPV6: | ||
54 | ipv6 = (void *)(skb->data + sizeof(struct ethhdr)); | ||
55 | icmpv6 = (void *)(skb->data + sizeof(struct ethhdr) + | ||
56 | sizeof(struct ipv6hdr)); | ||
57 | if (NDISC_NEIGHBOUR_ADVERTISEMENT == icmpv6->icmp6_type) { | ||
58 | if (!memcmp(&ipv6->saddr, &ipv6->daddr, | ||
59 | sizeof(struct in6_addr))) | ||
60 | return true; | ||
61 | } | ||
62 | break; | ||
63 | default: | ||
64 | break; | ||
65 | } | ||
66 | |||
67 | return false; | ||
68 | } | ||
69 | |||
28 | /* | 70 | /* |
29 | * This function processes the received packet and forwards it | 71 | * This function processes the received packet and forwards it |
30 | * to kernel/upper layer. | 72 | * to kernel/upper layer. |
@@ -90,6 +132,13 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, | |||
90 | either the reconstructed EthII frame or the 802.2/llc/snap frame */ | 132 | either the reconstructed EthII frame or the 802.2/llc/snap frame */ |
91 | skb_pull(skb, hdr_chop); | 133 | skb_pull(skb, hdr_chop); |
92 | 134 | ||
135 | if (priv->hs2_enabled && | ||
136 | mwifiex_discard_gratuitous_arp(priv, skb)) { | ||
137 | dev_dbg(priv->adapter->dev, "Bypassed Gratuitous ARP\n"); | ||
138 | dev_kfree_skb_any(skb); | ||
139 | return 0; | ||
140 | } | ||
141 | |||
93 | priv->rxpd_rate = local_rx_pd->rx_rate; | 142 | priv->rxpd_rate = local_rx_pd->rx_rate; |
94 | 143 | ||
95 | priv->rxpd_htinfo = local_rx_pd->ht_info; | 144 | priv->rxpd_htinfo = local_rx_pd->ht_info; |
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index fca98b5d7de4..2472d4b7f00e 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c | |||
@@ -24,9 +24,9 @@ | |||
24 | 24 | ||
25 | static const char usbdriver_name[] = "usb8797"; | 25 | static const char usbdriver_name[] = "usb8797"; |
26 | 26 | ||
27 | static u8 user_rmmod; | ||
28 | static struct mwifiex_if_ops usb_ops; | 27 | static struct mwifiex_if_ops usb_ops; |
29 | static struct semaphore add_remove_card_sem; | 28 | static struct semaphore add_remove_card_sem; |
29 | static struct usb_card_rec *usb_card; | ||
30 | 30 | ||
31 | static struct usb_device_id mwifiex_usb_table[] = { | 31 | static struct usb_device_id mwifiex_usb_table[] = { |
32 | {USB_DEVICE(USB8797_VID, USB8797_PID_1)}, | 32 | {USB_DEVICE(USB8797_VID, USB8797_PID_1)}, |
@@ -350,6 +350,7 @@ static int mwifiex_usb_probe(struct usb_interface *intf, | |||
350 | 350 | ||
351 | card->udev = udev; | 351 | card->udev = udev; |
352 | card->intf = intf; | 352 | card->intf = intf; |
353 | usb_card = card; | ||
353 | 354 | ||
354 | pr_debug("info: bcdUSB=%#x Device Class=%#x SubClass=%#x Protocol=%#x\n", | 355 | pr_debug("info: bcdUSB=%#x Device Class=%#x SubClass=%#x Protocol=%#x\n", |
355 | udev->descriptor.bcdUSB, udev->descriptor.bDeviceClass, | 356 | udev->descriptor.bcdUSB, udev->descriptor.bDeviceClass, |
@@ -532,7 +533,6 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf) | |||
532 | { | 533 | { |
533 | struct usb_card_rec *card = usb_get_intfdata(intf); | 534 | struct usb_card_rec *card = usb_get_intfdata(intf); |
534 | struct mwifiex_adapter *adapter; | 535 | struct mwifiex_adapter *adapter; |
535 | int i; | ||
536 | 536 | ||
537 | if (!card || !card->adapter) { | 537 | if (!card || !card->adapter) { |
538 | pr_err("%s: card or card->adapter is NULL\n", __func__); | 538 | pr_err("%s: card or card->adapter is NULL\n", __func__); |
@@ -543,27 +543,6 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf) | |||
543 | if (!adapter->priv_num) | 543 | if (!adapter->priv_num) |
544 | return; | 544 | return; |
545 | 545 | ||
546 | /* In case driver is removed when asynchronous FW downloading is | ||
547 | * in progress | ||
548 | */ | ||
549 | wait_for_completion(&adapter->fw_load); | ||
550 | |||
551 | if (user_rmmod) { | ||
552 | #ifdef CONFIG_PM | ||
553 | if (adapter->is_suspended) | ||
554 | mwifiex_usb_resume(intf); | ||
555 | #endif | ||
556 | for (i = 0; i < adapter->priv_num; i++) | ||
557 | if ((GET_BSS_ROLE(adapter->priv[i]) == | ||
558 | MWIFIEX_BSS_ROLE_STA) && | ||
559 | adapter->priv[i]->media_connected) | ||
560 | mwifiex_deauthenticate(adapter->priv[i], NULL); | ||
561 | |||
562 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, | ||
563 | MWIFIEX_BSS_ROLE_ANY), | ||
564 | MWIFIEX_FUNC_SHUTDOWN); | ||
565 | } | ||
566 | |||
567 | mwifiex_usb_free(card); | 546 | mwifiex_usb_free(card); |
568 | 547 | ||
569 | dev_dbg(adapter->dev, "%s: removing card\n", __func__); | 548 | dev_dbg(adapter->dev, "%s: removing card\n", __func__); |
@@ -1032,8 +1011,29 @@ static void mwifiex_usb_cleanup_module(void) | |||
1032 | if (!down_interruptible(&add_remove_card_sem)) | 1011 | if (!down_interruptible(&add_remove_card_sem)) |
1033 | up(&add_remove_card_sem); | 1012 | up(&add_remove_card_sem); |
1034 | 1013 | ||
1035 | /* set the flag as user is removing this module */ | 1014 | if (usb_card) { |
1036 | user_rmmod = 1; | 1015 | struct mwifiex_adapter *adapter = usb_card->adapter; |
1016 | int i; | ||
1017 | |||
1018 | /* In case driver is removed when asynchronous FW downloading is | ||
1019 | * in progress | ||
1020 | */ | ||
1021 | wait_for_completion(&adapter->fw_load); | ||
1022 | |||
1023 | #ifdef CONFIG_PM | ||
1024 | if (adapter->is_suspended) | ||
1025 | mwifiex_usb_resume(usb_card->intf); | ||
1026 | #endif | ||
1027 | for (i = 0; i < adapter->priv_num; i++) | ||
1028 | if ((GET_BSS_ROLE(adapter->priv[i]) == | ||
1029 | MWIFIEX_BSS_ROLE_STA) && | ||
1030 | adapter->priv[i]->media_connected) | ||
1031 | mwifiex_deauthenticate(adapter->priv[i], NULL); | ||
1032 | |||
1033 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, | ||
1034 | MWIFIEX_BSS_ROLE_ANY), | ||
1035 | MWIFIEX_FUNC_SHUTDOWN); | ||
1036 | } | ||
1037 | 1037 | ||
1038 | usb_deregister(&mwifiex_usb_driver); | 1038 | usb_deregister(&mwifiex_usb_driver); |
1039 | } | 1039 | } |
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c index e57ac0dd3ab5..5d9e150f4111 100644 --- a/drivers/net/wireless/mwifiex/util.c +++ b/drivers/net/wireless/mwifiex/util.c | |||
@@ -171,8 +171,8 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv, | |||
171 | rx_pd->rx_pkt_length = cpu_to_le16(pkt_len); | 171 | rx_pd->rx_pkt_length = cpu_to_le16(pkt_len); |
172 | 172 | ||
173 | cfg80211_rx_mgmt(priv->wdev, priv->roc_cfg.chan.center_freq, | 173 | cfg80211_rx_mgmt(priv->wdev, priv->roc_cfg.chan.center_freq, |
174 | CAL_RSSI(rx_pd->snr, rx_pd->nf), | 174 | CAL_RSSI(rx_pd->snr, rx_pd->nf), skb->data, pkt_len, |
175 | skb->data, pkt_len, GFP_ATOMIC); | 175 | 0, GFP_ATOMIC); |
176 | 176 | ||
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index a3132414ac9f..fa33b5edf931 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -2019,11 +2019,13 @@ struct mac_iveiv_entry { | |||
2019 | #define HW_BEACON_BASE6 0x5dc0 | 2019 | #define HW_BEACON_BASE6 0x5dc0 |
2020 | #define HW_BEACON_BASE7 0x5bc0 | 2020 | #define HW_BEACON_BASE7 0x5bc0 |
2021 | 2021 | ||
2022 | #define HW_BEACON_OFFSET(__index) \ | 2022 | #define HW_BEACON_BASE(__index) \ |
2023 | (((__index) < 4) ? (HW_BEACON_BASE0 + (__index * 0x0200)) : \ | 2023 | (((__index) < 4) ? (HW_BEACON_BASE0 + (__index * 0x0200)) : \ |
2024 | (((__index) < 6) ? (HW_BEACON_BASE4 + ((__index - 4) * 0x0200)) : \ | 2024 | (((__index) < 6) ? (HW_BEACON_BASE4 + ((__index - 4) * 0x0200)) : \ |
2025 | (HW_BEACON_BASE6 - ((__index - 6) * 0x0200)))) | 2025 | (HW_BEACON_BASE6 - ((__index - 6) * 0x0200)))) |
2026 | 2026 | ||
2027 | #define BEACON_BASE_TO_OFFSET(_base) (((_base) - 0x4000) / 64) | ||
2028 | |||
2027 | /* | 2029 | /* |
2028 | * BBP registers. | 2030 | * BBP registers. |
2029 | * The wordsize of the BBP is 8 bits. | 2031 | * The wordsize of the BBP is 8 bits. |
@@ -2794,6 +2796,7 @@ enum rt2800_eeprom_word { | |||
2794 | #define MCU_RADAR 0x60 | 2796 | #define MCU_RADAR 0x60 |
2795 | #define MCU_BOOT_SIGNAL 0x72 | 2797 | #define MCU_BOOT_SIGNAL 0x72 |
2796 | #define MCU_ANT_SELECT 0X73 | 2798 | #define MCU_ANT_SELECT 0X73 |
2799 | #define MCU_FREQ_OFFSET 0x74 | ||
2797 | #define MCU_BBP_SIGNAL 0x80 | 2800 | #define MCU_BBP_SIGNAL 0x80 |
2798 | #define MCU_POWER_SAVE 0x83 | 2801 | #define MCU_POWER_SAVE 0x83 |
2799 | #define MCU_BAND_SELECT 0x91 | 2802 | #define MCU_BAND_SELECT 0x91 |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index dedc3d4ae365..95e6e61c3de0 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -521,6 +521,29 @@ void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev) | |||
521 | } | 521 | } |
522 | EXPORT_SYMBOL_GPL(rt2800_disable_wpdma); | 522 | EXPORT_SYMBOL_GPL(rt2800_disable_wpdma); |
523 | 523 | ||
524 | void rt2800_get_txwi_rxwi_size(struct rt2x00_dev *rt2x00dev, | ||
525 | unsigned short *txwi_size, | ||
526 | unsigned short *rxwi_size) | ||
527 | { | ||
528 | switch (rt2x00dev->chip.rt) { | ||
529 | case RT3593: | ||
530 | *txwi_size = TXWI_DESC_SIZE_4WORDS; | ||
531 | *rxwi_size = RXWI_DESC_SIZE_5WORDS; | ||
532 | break; | ||
533 | |||
534 | case RT5592: | ||
535 | *txwi_size = TXWI_DESC_SIZE_5WORDS; | ||
536 | *rxwi_size = RXWI_DESC_SIZE_6WORDS; | ||
537 | break; | ||
538 | |||
539 | default: | ||
540 | *txwi_size = TXWI_DESC_SIZE_4WORDS; | ||
541 | *rxwi_size = RXWI_DESC_SIZE_4WORDS; | ||
542 | break; | ||
543 | } | ||
544 | } | ||
545 | EXPORT_SYMBOL_GPL(rt2800_get_txwi_rxwi_size); | ||
546 | |||
524 | static bool rt2800_check_firmware_crc(const u8 *data, const size_t len) | 547 | static bool rt2800_check_firmware_crc(const u8 *data, const size_t len) |
525 | { | 548 | { |
526 | u16 fw_crc; | 549 | u16 fw_crc; |
@@ -917,6 +940,18 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi) | |||
917 | } | 940 | } |
918 | EXPORT_SYMBOL_GPL(rt2800_txdone_entry); | 941 | EXPORT_SYMBOL_GPL(rt2800_txdone_entry); |
919 | 942 | ||
943 | static unsigned int rt2800_hw_beacon_base(struct rt2x00_dev *rt2x00dev, | ||
944 | unsigned int index) | ||
945 | { | ||
946 | return HW_BEACON_BASE(index); | ||
947 | } | ||
948 | |||
949 | static inline u8 rt2800_get_beacon_offset(struct rt2x00_dev *rt2x00dev, | ||
950 | unsigned int index) | ||
951 | { | ||
952 | return BEACON_BASE_TO_OFFSET(rt2800_hw_beacon_base(rt2x00dev, index)); | ||
953 | } | ||
954 | |||
920 | void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | 955 | void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) |
921 | { | 956 | { |
922 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 957 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
@@ -969,7 +1004,8 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | |||
969 | return; | 1004 | return; |
970 | } | 1005 | } |
971 | 1006 | ||
972 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 1007 | beacon_base = rt2800_hw_beacon_base(rt2x00dev, entry->entry_idx); |
1008 | |||
973 | rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data, | 1009 | rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data, |
974 | entry->skb->len + padding_len); | 1010 | entry->skb->len + padding_len); |
975 | 1011 | ||
@@ -988,10 +1024,13 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | |||
988 | EXPORT_SYMBOL_GPL(rt2800_write_beacon); | 1024 | EXPORT_SYMBOL_GPL(rt2800_write_beacon); |
989 | 1025 | ||
990 | static inline void rt2800_clear_beacon_register(struct rt2x00_dev *rt2x00dev, | 1026 | static inline void rt2800_clear_beacon_register(struct rt2x00_dev *rt2x00dev, |
991 | unsigned int beacon_base) | 1027 | unsigned int index) |
992 | { | 1028 | { |
993 | int i; | 1029 | int i; |
994 | const int txwi_desc_size = rt2x00dev->bcn->winfo_size; | 1030 | const int txwi_desc_size = rt2x00dev->bcn->winfo_size; |
1031 | unsigned int beacon_base; | ||
1032 | |||
1033 | beacon_base = rt2800_hw_beacon_base(rt2x00dev, index); | ||
995 | 1034 | ||
996 | /* | 1035 | /* |
997 | * For the Beacon base registers we only need to clear | 1036 | * For the Beacon base registers we only need to clear |
@@ -1018,8 +1057,7 @@ void rt2800_clear_beacon(struct queue_entry *entry) | |||
1018 | /* | 1057 | /* |
1019 | * Clear beacon. | 1058 | * Clear beacon. |
1020 | */ | 1059 | */ |
1021 | rt2800_clear_beacon_register(rt2x00dev, | 1060 | rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx); |
1022 | HW_BEACON_OFFSET(entry->entry_idx)); | ||
1023 | 1061 | ||
1024 | /* | 1062 | /* |
1025 | * Enabled beaconing again. | 1063 | * Enabled beaconing again. |
@@ -1850,6 +1888,43 @@ static void rt2800_config_lna_gain(struct rt2x00_dev *rt2x00dev, | |||
1850 | rt2x00dev->lna_gain = lna_gain; | 1888 | rt2x00dev->lna_gain = lna_gain; |
1851 | } | 1889 | } |
1852 | 1890 | ||
1891 | #define FREQ_OFFSET_BOUND 0x5f | ||
1892 | |||
1893 | static void rt2800_adjust_freq_offset(struct rt2x00_dev *rt2x00dev) | ||
1894 | { | ||
1895 | u8 freq_offset, prev_freq_offset; | ||
1896 | u8 rfcsr, prev_rfcsr; | ||
1897 | |||
1898 | freq_offset = rt2x00_get_field8(rt2x00dev->freq_offset, RFCSR17_CODE); | ||
1899 | freq_offset = min_t(u8, freq_offset, FREQ_OFFSET_BOUND); | ||
1900 | |||
1901 | rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); | ||
1902 | prev_rfcsr = rfcsr; | ||
1903 | |||
1904 | rt2x00_set_field8(&rfcsr, RFCSR17_CODE, freq_offset); | ||
1905 | if (rfcsr == prev_rfcsr) | ||
1906 | return; | ||
1907 | |||
1908 | if (rt2x00_is_usb(rt2x00dev)) { | ||
1909 | rt2800_mcu_request(rt2x00dev, MCU_FREQ_OFFSET, 0xff, | ||
1910 | freq_offset, prev_rfcsr); | ||
1911 | return; | ||
1912 | } | ||
1913 | |||
1914 | prev_freq_offset = rt2x00_get_field8(prev_rfcsr, RFCSR17_CODE); | ||
1915 | while (prev_freq_offset != freq_offset) { | ||
1916 | if (prev_freq_offset < freq_offset) | ||
1917 | prev_freq_offset++; | ||
1918 | else | ||
1919 | prev_freq_offset--; | ||
1920 | |||
1921 | rt2x00_set_field8(&rfcsr, RFCSR17_CODE, prev_freq_offset); | ||
1922 | rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); | ||
1923 | |||
1924 | usleep_range(1000, 1500); | ||
1925 | } | ||
1926 | } | ||
1927 | |||
1853 | static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev, | 1928 | static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev, |
1854 | struct ieee80211_conf *conf, | 1929 | struct ieee80211_conf *conf, |
1855 | struct rf_channel *rf, | 1930 | struct rf_channel *rf, |
@@ -2298,7 +2373,7 @@ static void rt2800_config_channel_rf3053(struct rt2x00_dev *rt2x00dev, | |||
2298 | } | 2373 | } |
2299 | rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); | 2374 | rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); |
2300 | 2375 | ||
2301 | /* TODO: frequency calibration? */ | 2376 | rt2800_adjust_freq_offset(rt2x00dev); |
2302 | 2377 | ||
2303 | if (conf_is_ht40(conf)) { | 2378 | if (conf_is_ht40(conf)) { |
2304 | txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40, | 2379 | txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40, |
@@ -2467,19 +2542,6 @@ static void rt2800_config_channel_rf3053(struct rt2x00_dev *rt2x00dev, | |||
2467 | 2542 | ||
2468 | #define POWER_BOUND 0x27 | 2543 | #define POWER_BOUND 0x27 |
2469 | #define POWER_BOUND_5G 0x2b | 2544 | #define POWER_BOUND_5G 0x2b |
2470 | #define FREQ_OFFSET_BOUND 0x5f | ||
2471 | |||
2472 | static void rt2800_adjust_freq_offset(struct rt2x00_dev *rt2x00dev) | ||
2473 | { | ||
2474 | u8 rfcsr; | ||
2475 | |||
2476 | rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); | ||
2477 | if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND) | ||
2478 | rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND); | ||
2479 | else | ||
2480 | rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset); | ||
2481 | rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); | ||
2482 | } | ||
2483 | 2545 | ||
2484 | static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev, | 2546 | static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev, |
2485 | struct ieee80211_conf *conf, | 2547 | struct ieee80211_conf *conf, |
@@ -3346,6 +3408,13 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev) | |||
3346 | int i; | 3408 | int i; |
3347 | 3409 | ||
3348 | /* | 3410 | /* |
3411 | * First check if temperature compensation is supported. | ||
3412 | */ | ||
3413 | rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); | ||
3414 | if (!rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_TX_ALC)) | ||
3415 | return 0; | ||
3416 | |||
3417 | /* | ||
3349 | * Read TSSI boundaries for temperature compensation from | 3418 | * Read TSSI boundaries for temperature compensation from |
3350 | * the EEPROM. | 3419 | * the EEPROM. |
3351 | * | 3420 | * |
@@ -4418,17 +4487,25 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
4418 | return ret; | 4487 | return ret; |
4419 | 4488 | ||
4420 | rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®); | 4489 | rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®); |
4421 | rt2x00_set_field32(®, BCN_OFFSET0_BCN0, 0xe0); /* 0x3800 */ | 4490 | rt2x00_set_field32(®, BCN_OFFSET0_BCN0, |
4422 | rt2x00_set_field32(®, BCN_OFFSET0_BCN1, 0xe8); /* 0x3a00 */ | 4491 | rt2800_get_beacon_offset(rt2x00dev, 0)); |
4423 | rt2x00_set_field32(®, BCN_OFFSET0_BCN2, 0xf0); /* 0x3c00 */ | 4492 | rt2x00_set_field32(®, BCN_OFFSET0_BCN1, |
4424 | rt2x00_set_field32(®, BCN_OFFSET0_BCN3, 0xf8); /* 0x3e00 */ | 4493 | rt2800_get_beacon_offset(rt2x00dev, 1)); |
4494 | rt2x00_set_field32(®, BCN_OFFSET0_BCN2, | ||
4495 | rt2800_get_beacon_offset(rt2x00dev, 2)); | ||
4496 | rt2x00_set_field32(®, BCN_OFFSET0_BCN3, | ||
4497 | rt2800_get_beacon_offset(rt2x00dev, 3)); | ||
4425 | rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg); | 4498 | rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg); |
4426 | 4499 | ||
4427 | rt2800_register_read(rt2x00dev, BCN_OFFSET1, ®); | 4500 | rt2800_register_read(rt2x00dev, BCN_OFFSET1, ®); |
4428 | rt2x00_set_field32(®, BCN_OFFSET1_BCN4, 0xc8); /* 0x3200 */ | 4501 | rt2x00_set_field32(®, BCN_OFFSET1_BCN4, |
4429 | rt2x00_set_field32(®, BCN_OFFSET1_BCN5, 0xd0); /* 0x3400 */ | 4502 | rt2800_get_beacon_offset(rt2x00dev, 4)); |
4430 | rt2x00_set_field32(®, BCN_OFFSET1_BCN6, 0x77); /* 0x1dc0 */ | 4503 | rt2x00_set_field32(®, BCN_OFFSET1_BCN5, |
4431 | rt2x00_set_field32(®, BCN_OFFSET1_BCN7, 0x6f); /* 0x1bc0 */ | 4504 | rt2800_get_beacon_offset(rt2x00dev, 5)); |
4505 | rt2x00_set_field32(®, BCN_OFFSET1_BCN6, | ||
4506 | rt2800_get_beacon_offset(rt2x00dev, 6)); | ||
4507 | rt2x00_set_field32(®, BCN_OFFSET1_BCN7, | ||
4508 | rt2800_get_beacon_offset(rt2x00dev, 7)); | ||
4432 | rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg); | 4509 | rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg); |
4433 | 4510 | ||
4434 | rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f); | 4511 | rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f); |
@@ -4780,14 +4857,8 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
4780 | /* | 4857 | /* |
4781 | * Clear all beacons | 4858 | * Clear all beacons |
4782 | */ | 4859 | */ |
4783 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE0); | 4860 | for (i = 0; i < 8; i++) |
4784 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE1); | 4861 | rt2800_clear_beacon_register(rt2x00dev, i); |
4785 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE2); | ||
4786 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE3); | ||
4787 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE4); | ||
4788 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE5); | ||
4789 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE6); | ||
4790 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE7); | ||
4791 | 4862 | ||
4792 | if (rt2x00_is_usb(rt2x00dev)) { | 4863 | if (rt2x00_is_usb(rt2x00dev)) { |
4793 | rt2800_register_read(rt2x00dev, US_CYC_CNT, ®); | 4864 | rt2800_register_read(rt2x00dev, US_CYC_CNT, ®); |
@@ -7418,7 +7489,8 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
7418 | IEEE80211_HW_SUPPORTS_PS | | 7489 | IEEE80211_HW_SUPPORTS_PS | |
7419 | IEEE80211_HW_PS_NULLFUNC_STACK | | 7490 | IEEE80211_HW_PS_NULLFUNC_STACK | |
7420 | IEEE80211_HW_AMPDU_AGGREGATION | | 7491 | IEEE80211_HW_AMPDU_AGGREGATION | |
7421 | IEEE80211_HW_REPORTS_TX_ACK_STATUS; | 7492 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | |
7493 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES; | ||
7422 | 7494 | ||
7423 | /* | 7495 | /* |
7424 | * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices | 7496 | * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h index 6ec739466db4..a94ba447e63c 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -226,4 +226,8 @@ int rt2800_get_survey(struct ieee80211_hw *hw, int idx, | |||
226 | struct survey_info *survey); | 226 | struct survey_info *survey); |
227 | void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev); | 227 | void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev); |
228 | 228 | ||
229 | void rt2800_get_txwi_rxwi_size(struct rt2x00_dev *rt2x00dev, | ||
230 | unsigned short *txwi_size, | ||
231 | unsigned short *rxwi_size); | ||
232 | |||
229 | #endif /* RT2800LIB_H */ | 233 | #endif /* RT2800LIB_H */ |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 00055627eb8d..f8f2abbfbb65 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -507,9 +507,13 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev) | |||
507 | rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); | 507 | rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); |
508 | 508 | ||
509 | if (rt2x00_is_pcie(rt2x00dev) && | 509 | if (rt2x00_is_pcie(rt2x00dev) && |
510 | (rt2x00_rt(rt2x00dev, RT3572) || | 510 | (rt2x00_rt(rt2x00dev, RT3090) || |
511 | rt2x00_rt(rt2x00dev, RT3390) || | ||
512 | rt2x00_rt(rt2x00dev, RT3572) || | ||
513 | rt2x00_rt(rt2x00dev, RT3593) || | ||
511 | rt2x00_rt(rt2x00dev, RT5390) || | 514 | rt2x00_rt(rt2x00dev, RT5390) || |
512 | rt2x00_rt(rt2x00dev, RT5392))) { | 515 | rt2x00_rt(rt2x00dev, RT5392) || |
516 | rt2x00_rt(rt2x00dev, RT5592))) { | ||
513 | rt2x00mmio_register_read(rt2x00dev, AUX_CTRL, ®); | 517 | rt2x00mmio_register_read(rt2x00dev, AUX_CTRL, ®); |
514 | rt2x00_set_field32(®, AUX_CTRL_FORCE_PCIE_CLK, 1); | 518 | rt2x00_set_field32(®, AUX_CTRL_FORCE_PCIE_CLK, 1); |
515 | rt2x00_set_field32(®, AUX_CTRL_WAKE_PCIE_EN, 1); | 519 | rt2x00_set_field32(®, AUX_CTRL_WAKE_PCIE_EN, 1); |
@@ -1189,12 +1193,17 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { | |||
1189 | 1193 | ||
1190 | static void rt2800pci_queue_init(struct data_queue *queue) | 1194 | static void rt2800pci_queue_init(struct data_queue *queue) |
1191 | { | 1195 | { |
1196 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1197 | unsigned short txwi_size, rxwi_size; | ||
1198 | |||
1199 | rt2800_get_txwi_rxwi_size(rt2x00dev, &txwi_size, &rxwi_size); | ||
1200 | |||
1192 | switch (queue->qid) { | 1201 | switch (queue->qid) { |
1193 | case QID_RX: | 1202 | case QID_RX: |
1194 | queue->limit = 128; | 1203 | queue->limit = 128; |
1195 | queue->data_size = AGGREGATION_SIZE; | 1204 | queue->data_size = AGGREGATION_SIZE; |
1196 | queue->desc_size = RXD_DESC_SIZE; | 1205 | queue->desc_size = RXD_DESC_SIZE; |
1197 | queue->winfo_size = RXWI_DESC_SIZE_4WORDS; | 1206 | queue->winfo_size = rxwi_size; |
1198 | queue->priv_size = sizeof(struct queue_entry_priv_mmio); | 1207 | queue->priv_size = sizeof(struct queue_entry_priv_mmio); |
1199 | break; | 1208 | break; |
1200 | 1209 | ||
@@ -1205,7 +1214,7 @@ static void rt2800pci_queue_init(struct data_queue *queue) | |||
1205 | queue->limit = 64; | 1214 | queue->limit = 64; |
1206 | queue->data_size = AGGREGATION_SIZE; | 1215 | queue->data_size = AGGREGATION_SIZE; |
1207 | queue->desc_size = TXD_DESC_SIZE; | 1216 | queue->desc_size = TXD_DESC_SIZE; |
1208 | queue->winfo_size = TXWI_DESC_SIZE_4WORDS; | 1217 | queue->winfo_size = txwi_size; |
1209 | queue->priv_size = sizeof(struct queue_entry_priv_mmio); | 1218 | queue->priv_size = sizeof(struct queue_entry_priv_mmio); |
1210 | break; | 1219 | break; |
1211 | 1220 | ||
@@ -1213,7 +1222,7 @@ static void rt2800pci_queue_init(struct data_queue *queue) | |||
1213 | queue->limit = 8; | 1222 | queue->limit = 8; |
1214 | queue->data_size = 0; /* No DMA required for beacons */ | 1223 | queue->data_size = 0; /* No DMA required for beacons */ |
1215 | queue->desc_size = TXD_DESC_SIZE; | 1224 | queue->desc_size = TXD_DESC_SIZE; |
1216 | queue->winfo_size = TXWI_DESC_SIZE_4WORDS; | 1225 | queue->winfo_size = txwi_size; |
1217 | queue->priv_size = sizeof(struct queue_entry_priv_mmio); | 1226 | queue->priv_size = sizeof(struct queue_entry_priv_mmio); |
1218 | break; | 1227 | break; |
1219 | 1228 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index fc9efdfca8f2..96961b9a395c 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -854,16 +854,7 @@ static void rt2800usb_queue_init(struct data_queue *queue) | |||
854 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | 854 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; |
855 | unsigned short txwi_size, rxwi_size; | 855 | unsigned short txwi_size, rxwi_size; |
856 | 856 | ||
857 | if (rt2x00_rt(rt2x00dev, RT3593)) { | 857 | rt2800_get_txwi_rxwi_size(rt2x00dev, &txwi_size, &rxwi_size); |
858 | txwi_size = TXWI_DESC_SIZE_4WORDS; | ||
859 | rxwi_size = RXWI_DESC_SIZE_5WORDS; | ||
860 | } else if (rt2x00_rt(rt2x00dev, RT5592)) { | ||
861 | txwi_size = TXWI_DESC_SIZE_5WORDS; | ||
862 | rxwi_size = RXWI_DESC_SIZE_6WORDS; | ||
863 | } else { | ||
864 | txwi_size = TXWI_DESC_SIZE_4WORDS; | ||
865 | rxwi_size = RXWI_DESC_SIZE_4WORDS; | ||
866 | } | ||
867 | 858 | ||
868 | switch (queue->qid) { | 859 | switch (queue->qid) { |
869 | case QID_RX: | 860 | case QID_RX: |
@@ -980,6 +971,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
980 | { USB_DEVICE(0x0411, 0x016f) }, | 971 | { USB_DEVICE(0x0411, 0x016f) }, |
981 | { USB_DEVICE(0x0411, 0x01a2) }, | 972 | { USB_DEVICE(0x0411, 0x01a2) }, |
982 | { USB_DEVICE(0x0411, 0x01ee) }, | 973 | { USB_DEVICE(0x0411, 0x01ee) }, |
974 | { USB_DEVICE(0x0411, 0x01a8) }, | ||
983 | /* Corega */ | 975 | /* Corega */ |
984 | { USB_DEVICE(0x07aa, 0x002f) }, | 976 | { USB_DEVICE(0x07aa, 0x002f) }, |
985 | { USB_DEVICE(0x07aa, 0x003c) }, | 977 | { USB_DEVICE(0x07aa, 0x003c) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index b16521e6bf4a..712eea9d398f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -566,10 +566,10 @@ static void rt2x00lib_rxdone_check_ba(struct rt2x00_dev *rt2x00dev, | |||
566 | 566 | ||
567 | #undef TID_CHECK | 567 | #undef TID_CHECK |
568 | 568 | ||
569 | if (compare_ether_addr(ba->ra, entry->ta)) | 569 | if (!ether_addr_equal(ba->ra, entry->ta)) |
570 | continue; | 570 | continue; |
571 | 571 | ||
572 | if (compare_ether_addr(ba->ta, entry->ra)) | 572 | if (!ether_addr_equal(ba->ta, entry->ra)) |
573 | continue; | 573 | continue; |
574 | 574 | ||
575 | /* Mark BAR since we received the according BA */ | 575 | /* Mark BAR since we received the according BA */ |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 91a04e2b8ece..fc207b268e4f 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c | |||
@@ -3,10 +3,10 @@ | |||
3 | * Linux device driver for RTL8180 / RTL8185 | 3 | * Linux device driver for RTL8180 / RTL8185 |
4 | * | 4 | * |
5 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> | 5 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> |
6 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 6 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
7 | * | 7 | * |
8 | * Based on the r8180 driver, which is: | 8 | * Based on the r8180 driver, which is: |
9 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 9 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
10 | * | 10 | * |
11 | * Thanks to Realtek for their support! | 11 | * Thanks to Realtek for their support! |
12 | * | 12 | * |
@@ -32,7 +32,7 @@ | |||
32 | #include "grf5101.h" | 32 | #include "grf5101.h" |
33 | 33 | ||
34 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); | 34 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); |
35 | MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); | 35 | MODULE_AUTHOR("Andrea Merello <andrea.merello@gmail.com>"); |
36 | MODULE_DESCRIPTION("RTL8180 / RTL8185 PCI wireless driver"); | 36 | MODULE_DESCRIPTION("RTL8180 / RTL8185 PCI wireless driver"); |
37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
38 | 38 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8180/grf5101.c b/drivers/net/wireless/rtl818x/rtl8180/grf5101.c index 077ff92cc139..dc845693f321 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/grf5101.c +++ b/drivers/net/wireless/rtl818x/rtl8180/grf5101.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Radio tuning for GCT GRF5101 on RTL8180 | 3 | * Radio tuning for GCT GRF5101 on RTL8180 |
4 | * | 4 | * |
5 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 5 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
6 | * | 6 | * |
7 | * Code from the BSD driver and the rtl8181 project have been | 7 | * Code from the BSD driver and the rtl8181 project have been |
8 | * very useful to understand certain things | 8 | * very useful to understand certain things |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/grf5101.h b/drivers/net/wireless/rtl818x/rtl8180/grf5101.h index 76647111bcff..4d80a2785123 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/grf5101.h +++ b/drivers/net/wireless/rtl818x/rtl8180/grf5101.h | |||
@@ -4,7 +4,7 @@ | |||
4 | /* | 4 | /* |
5 | * Radio tuning for GCT GRF5101 on RTL8180 | 5 | * Radio tuning for GCT GRF5101 on RTL8180 |
6 | * | 6 | * |
7 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 7 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
8 | * | 8 | * |
9 | * Code from the BSD driver and the rtl8181 project have been | 9 | * Code from the BSD driver and the rtl8181 project have been |
10 | * very useful to understand certain things | 10 | * very useful to understand certain things |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/max2820.c b/drivers/net/wireless/rtl818x/rtl8180/max2820.c index 4715000c94dd..a63c443c3c6f 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/max2820.c +++ b/drivers/net/wireless/rtl818x/rtl8180/max2820.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Radio tuning for Maxim max2820 on RTL8180 | 2 | * Radio tuning for Maxim max2820 on RTL8180 |
3 | * | 3 | * |
4 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 4 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
5 | * | 5 | * |
6 | * Code from the BSD driver and the rtl8181 project have been | 6 | * Code from the BSD driver and the rtl8181 project have been |
7 | * very useful to understand certain things | 7 | * very useful to understand certain things |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/max2820.h b/drivers/net/wireless/rtl818x/rtl8180/max2820.h index 61cf6d1e7d57..8e982b72b690 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/max2820.h +++ b/drivers/net/wireless/rtl818x/rtl8180/max2820.h | |||
@@ -4,7 +4,7 @@ | |||
4 | /* | 4 | /* |
5 | * Radio tuning for Maxim max2820 on RTL8180 | 5 | * Radio tuning for Maxim max2820 on RTL8180 |
6 | * | 6 | * |
7 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 7 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
8 | * | 8 | * |
9 | * Code from the BSD driver and the rtl8181 project have been | 9 | * Code from the BSD driver and the rtl8181 project have been |
10 | * very useful to understand certain things | 10 | * very useful to understand certain things |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c index cc2a5412c1f0..ee638d0749d6 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c +++ b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c | |||
@@ -3,10 +3,10 @@ | |||
3 | * Radio tuning for RTL8225 on RTL8180 | 3 | * Radio tuning for RTL8225 on RTL8180 |
4 | * | 4 | * |
5 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> | 5 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> |
6 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 6 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
7 | * | 7 | * |
8 | * Based on the r8180 driver, which is: | 8 | * Based on the r8180 driver, which is: |
9 | * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 9 | * Copyright 2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
10 | * | 10 | * |
11 | * Thanks to Realtek for their support! | 11 | * Thanks to Realtek for their support! |
12 | * | 12 | * |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/sa2400.c b/drivers/net/wireless/rtl818x/rtl8180/sa2400.c index b3ec40f6bd23..7614d9ccc729 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/sa2400.c +++ b/drivers/net/wireless/rtl818x/rtl8180/sa2400.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Radio tuning for Philips SA2400 on RTL8180 | 3 | * Radio tuning for Philips SA2400 on RTL8180 |
4 | * | 4 | * |
5 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 5 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
6 | * | 6 | * |
7 | * Code from the BSD driver and the rtl8181 project have been | 7 | * Code from the BSD driver and the rtl8181 project have been |
8 | * very useful to understand certain things | 8 | * very useful to understand certain things |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/sa2400.h b/drivers/net/wireless/rtl818x/rtl8180/sa2400.h index a4aaa0d413f1..fb0093f35148 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/sa2400.h +++ b/drivers/net/wireless/rtl818x/rtl8180/sa2400.h | |||
@@ -4,7 +4,7 @@ | |||
4 | /* | 4 | /* |
5 | * Radio tuning for Philips SA2400 on RTL8180 | 5 | * Radio tuning for Philips SA2400 on RTL8180 |
6 | * | 6 | * |
7 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 7 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
8 | * | 8 | * |
9 | * Code from the BSD driver and the rtl8181 project have been | 9 | * Code from the BSD driver and the rtl8181 project have been |
10 | * very useful to understand certain things | 10 | * very useful to understand certain things |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index f49220e234b0..841fb9dfc9da 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c | |||
@@ -2,10 +2,10 @@ | |||
2 | * Linux device driver for RTL8187 | 2 | * Linux device driver for RTL8187 |
3 | * | 3 | * |
4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> | 4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> |
5 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 5 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
6 | * | 6 | * |
7 | * Based on the r8187 driver, which is: | 7 | * Based on the r8187 driver, which is: |
8 | * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 8 | * Copyright 2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
9 | * | 9 | * |
10 | * The driver was extended to the RTL8187B in 2008 by: | 10 | * The driver was extended to the RTL8187B in 2008 by: |
11 | * Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 11 | * Herton Ronaldo Krzesinski <herton@mandriva.com.br> |
@@ -37,7 +37,7 @@ | |||
37 | #include "rfkill.h" | 37 | #include "rfkill.h" |
38 | 38 | ||
39 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); | 39 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); |
40 | MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); | 40 | MODULE_AUTHOR("Andrea Merello <andrea.merello@gmail.com>"); |
41 | MODULE_AUTHOR("Herton Ronaldo Krzesinski <herton@mandriva.com.br>"); | 41 | MODULE_AUTHOR("Herton Ronaldo Krzesinski <herton@mandriva.com.br>"); |
42 | MODULE_AUTHOR("Hin-Tak Leung <htl10@users.sourceforge.net>"); | 42 | MODULE_AUTHOR("Hin-Tak Leung <htl10@users.sourceforge.net>"); |
43 | MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); | 43 | MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h index e19a20a8e955..56aee067f324 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h +++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h | |||
@@ -2,10 +2,10 @@ | |||
2 | * Definitions for RTL8187 hardware | 2 | * Definitions for RTL8187 hardware |
3 | * | 3 | * |
4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> | 4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> |
5 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 5 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
6 | * | 6 | * |
7 | * Based on the r8187 driver, which is: | 7 | * Based on the r8187 driver, which is: |
8 | * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 8 | * Copyright 2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c index f0bf35fedbaf..a26193a04447 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c +++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c | |||
@@ -2,10 +2,10 @@ | |||
2 | * Radio tuning for RTL8225 on RTL8187 | 2 | * Radio tuning for RTL8225 on RTL8187 |
3 | * | 3 | * |
4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> | 4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> |
5 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 5 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
6 | * | 6 | * |
7 | * Based on the r8187 driver, which is: | 7 | * Based on the r8187 driver, which is: |
8 | * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 8 | * Copyright 2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
9 | * | 9 | * |
10 | * Magic delays, register offsets, and phy value tables below are | 10 | * Magic delays, register offsets, and phy value tables below are |
11 | * taken from the original r8187 driver sources. Thanks to Realtek | 11 | * taken from the original r8187 driver sources. Thanks to Realtek |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h index 20c5b6ead0f6..141afb09a5b4 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h +++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h | |||
@@ -2,10 +2,10 @@ | |||
2 | * Radio tuning definitions for RTL8225 on RTL8187 | 2 | * Radio tuning definitions for RTL8225 on RTL8187 |
3 | * | 3 | * |
4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> | 4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> |
5 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 5 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
6 | * | 6 | * |
7 | * Based on the r8187 driver, which is: | 7 | * Based on the r8187 driver, which is: |
8 | * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 8 | * Copyright 2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/drivers/net/wireless/rtl818x/rtl818x.h b/drivers/net/wireless/rtl818x/rtl818x.h index 1615f63b02f6..ce23dfd42381 100644 --- a/drivers/net/wireless/rtl818x/rtl818x.h +++ b/drivers/net/wireless/rtl818x/rtl818x.h | |||
@@ -2,10 +2,10 @@ | |||
2 | * Definitions for RTL818x hardware | 2 | * Definitions for RTL818x hardware |
3 | * | 3 | * |
4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> | 4 | * Copyright 2007 Michael Wu <flamingice@sourmilk.net> |
5 | * Copyright 2007 Andrea Merello <andreamrl@tiscali.it> | 5 | * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> |
6 | * | 6 | * |
7 | * Based on the r8187 driver, which is: | 7 | * Based on the r8187 driver, which is: |
8 | * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 8 | * Copyright 2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 7651f5acc14b..8bb4a9a01a18 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -1304,7 +1304,7 @@ void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1304 | return; | 1304 | return; |
1305 | 1305 | ||
1306 | /* and only beacons from the associated BSSID, please */ | 1306 | /* and only beacons from the associated BSSID, please */ |
1307 | if (compare_ether_addr(hdr->addr3, rtlpriv->mac80211.bssid)) | 1307 | if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid)) |
1308 | return; | 1308 | return; |
1309 | 1309 | ||
1310 | rtlpriv->link_info.bcn_rx_inperiod++; | 1310 | rtlpriv->link_info.bcn_rx_inperiod++; |
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index 298b615964e8..0d81f766fd0f 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c | |||
@@ -688,7 +688,7 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data, | |||
688 | find_p2p_ie = true; | 688 | find_p2p_ie = true; |
689 | /*to find noa ie*/ | 689 | /*to find noa ie*/ |
690 | while (ie + 1 < end) { | 690 | while (ie + 1 < end) { |
691 | noa_len = READEF2BYTE(&ie[1]); | 691 | noa_len = READEF2BYTE((__le16 *)&ie[1]); |
692 | if (ie + 3 + ie[1] > end) | 692 | if (ie + 3 + ie[1] > end) |
693 | return; | 693 | return; |
694 | 694 | ||
@@ -717,13 +717,13 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data, | |||
717 | READEF1BYTE(ie+index); | 717 | READEF1BYTE(ie+index); |
718 | index += 1; | 718 | index += 1; |
719 | p2pinfo->noa_duration[i] = | 719 | p2pinfo->noa_duration[i] = |
720 | READEF4BYTE(ie+index); | 720 | READEF4BYTE((__le32 *)ie+index); |
721 | index += 4; | 721 | index += 4; |
722 | p2pinfo->noa_interval[i] = | 722 | p2pinfo->noa_interval[i] = |
723 | READEF4BYTE(ie+index); | 723 | READEF4BYTE((__le32 *)ie+index); |
724 | index += 4; | 724 | index += 4; |
725 | p2pinfo->noa_start_time[i] = | 725 | p2pinfo->noa_start_time[i] = |
726 | READEF4BYTE(ie+index); | 726 | READEF4BYTE((__le32 *)ie+index); |
727 | index += 4; | 727 | index += 4; |
728 | } | 728 | } |
729 | 729 | ||
@@ -780,7 +780,7 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data, | |||
780 | RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "action frame find P2P IE.\n"); | 780 | RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "action frame find P2P IE.\n"); |
781 | /*to find noa ie*/ | 781 | /*to find noa ie*/ |
782 | while (ie + 1 < end) { | 782 | while (ie + 1 < end) { |
783 | noa_len = READEF2BYTE(&ie[1]); | 783 | noa_len = READEF2BYTE((__le16 *)&ie[1]); |
784 | if (ie + 3 + ie[1] > end) | 784 | if (ie + 3 + ie[1] > end) |
785 | return; | 785 | return; |
786 | 786 | ||
@@ -809,13 +809,13 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data, | |||
809 | READEF1BYTE(ie+index); | 809 | READEF1BYTE(ie+index); |
810 | index += 1; | 810 | index += 1; |
811 | p2pinfo->noa_duration[i] = | 811 | p2pinfo->noa_duration[i] = |
812 | READEF4BYTE(ie+index); | 812 | READEF4BYTE((__le32 *)ie+index); |
813 | index += 4; | 813 | index += 4; |
814 | p2pinfo->noa_interval[i] = | 814 | p2pinfo->noa_interval[i] = |
815 | READEF4BYTE(ie+index); | 815 | READEF4BYTE((__le32 *)ie+index); |
816 | index += 4; | 816 | index += 4; |
817 | p2pinfo->noa_start_time[i] = | 817 | p2pinfo->noa_start_time[i] = |
818 | READEF4BYTE(ie+index); | 818 | READEF4BYTE((__le32 *)ie+index); |
819 | index += 4; | 819 | index += 4; |
820 | } | 820 | } |
821 | 821 | ||
@@ -923,7 +923,7 @@ void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len) | |||
923 | return; | 923 | return; |
924 | 924 | ||
925 | /* and only beacons from the associated BSSID, please */ | 925 | /* and only beacons from the associated BSSID, please */ |
926 | if (compare_ether_addr(hdr->addr3, rtlpriv->mac80211.bssid)) | 926 | if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid)) |
927 | return; | 927 | return; |
928 | 928 | ||
929 | /* check if this really is a beacon */ | 929 | /* check if this really is a beacon */ |
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c index a8871d66d56a..68685a898257 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | |||
@@ -305,13 +305,14 @@ static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw, | |||
305 | psaddr = ieee80211_get_SA(hdr); | 305 | psaddr = ieee80211_get_SA(hdr); |
306 | memcpy(pstatus->psaddr, psaddr, ETH_ALEN); | 306 | memcpy(pstatus->psaddr, psaddr, ETH_ALEN); |
307 | 307 | ||
308 | addr = (!compare_ether_addr(mac->bssid, (ufc & IEEE80211_FCTL_TODS) ? | 308 | addr = ether_addr_equal(mac->bssid, |
309 | hdr->addr1 : (ufc & IEEE80211_FCTL_FROMDS) ? | 309 | (ufc & IEEE80211_FCTL_TODS) ? hdr->addr1 : |
310 | hdr->addr2 : hdr->addr3)); | 310 | (ufc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : |
311 | hdr->addr3); | ||
311 | match_bssid = ((IEEE80211_FTYPE_CTL != type) && (!pstatus->hwerror) && | 312 | match_bssid = ((IEEE80211_FTYPE_CTL != type) && (!pstatus->hwerror) && |
312 | (!pstatus->crc) && (!pstatus->icv)) && addr; | 313 | (!pstatus->crc) && (!pstatus->icv)) && addr; |
313 | 314 | ||
314 | addr = (!compare_ether_addr(praddr, rtlefuse->dev_addr)); | 315 | addr = ether_addr_equal(praddr, rtlefuse->dev_addr); |
315 | packet_toself = match_bssid && addr; | 316 | packet_toself = match_bssid && addr; |
316 | 317 | ||
317 | if (ieee80211_is_beacon(fc)) | 318 | if (ieee80211_is_beacon(fc)) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c index c72758d8f4ed..bcd82a1020a5 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c | |||
@@ -255,16 +255,16 @@ static void _rtl8723ae_translate_rx_signal_stuff(struct ieee80211_hw *hw, | |||
255 | type = WLAN_FC_GET_TYPE(fc); | 255 | type = WLAN_FC_GET_TYPE(fc); |
256 | praddr = hdr->addr1; | 256 | praddr = hdr->addr1; |
257 | 257 | ||
258 | packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && | 258 | packet_matchbssid = |
259 | (!compare_ether_addr(mac->bssid, | 259 | ((IEEE80211_FTYPE_CTL != type) && |
260 | (le16_to_cpu(fc) & IEEE80211_FCTL_TODS) ? | 260 | ether_addr_equal(mac->bssid, |
261 | hdr->addr1 : (le16_to_cpu(fc) & | 261 | (le16_to_cpu(fc) & IEEE80211_FCTL_TODS) ? hdr->addr1 : |
262 | IEEE80211_FCTL_FROMDS) ? | 262 | (le16_to_cpu(fc) & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : |
263 | hdr->addr2 : hdr->addr3)) && (!pstatus->hwerror) && | 263 | hdr->addr3) && |
264 | (!pstatus->crc) && (!pstatus->icv)); | 264 | (!pstatus->hwerror) && (!pstatus->crc) && (!pstatus->icv)); |
265 | 265 | ||
266 | packet_toself = packet_matchbssid && | 266 | packet_toself = (packet_matchbssid && |
267 | (!compare_ether_addr(praddr, rtlefuse->dev_addr)); | 267 | ether_addr_equal(praddr, rtlefuse->dev_addr)); |
268 | 268 | ||
269 | if (ieee80211_is_beacon(fc)) | 269 | if (ieee80211_is_beacon(fc)) |
270 | packet_beacon = true; | 270 | packet_beacon = true; |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index d1b19c38a907..38995f90040d 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -5623,7 +5623,8 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) | |||
5623 | wl->hw->wiphy->max_remain_on_channel_duration = 5000; | 5623 | wl->hw->wiphy->max_remain_on_channel_duration = 5000; |
5624 | 5624 | ||
5625 | wl->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD | | 5625 | wl->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD | |
5626 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; | 5626 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | |
5627 | WIPHY_FLAG_SUPPORTS_SCHED_SCAN; | ||
5627 | 5628 | ||
5628 | /* make sure all our channels fit in the scanned_ch bitmask */ | 5629 | /* make sure all our channels fit in the scanned_ch bitmask */ |
5629 | BUILD_BUG_ON(ARRAY_SIZE(wl1271_channels) + | 5630 | BUILD_BUG_ON(ARRAY_SIZE(wl1271_channels) + |
diff --git a/drivers/net/wireless/ti/wlcore/testmode.c b/drivers/net/wireless/ti/wlcore/testmode.c index f3442762d884..527590f2adfb 100644 --- a/drivers/net/wireless/ti/wlcore/testmode.c +++ b/drivers/net/wireless/ti/wlcore/testmode.c | |||
@@ -356,7 +356,8 @@ out: | |||
356 | return ret; | 356 | return ret; |
357 | } | 357 | } |
358 | 358 | ||
359 | int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len) | 359 | int wl1271_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
360 | void *data, int len) | ||
360 | { | 361 | { |
361 | struct wl1271 *wl = hw->priv; | 362 | struct wl1271 *wl = hw->priv; |
362 | struct nlattr *tb[WL1271_TM_ATTR_MAX + 1]; | 363 | struct nlattr *tb[WL1271_TM_ATTR_MAX + 1]; |
diff --git a/drivers/net/wireless/ti/wlcore/testmode.h b/drivers/net/wireless/ti/wlcore/testmode.h index 8071654259ea..61d8434d859a 100644 --- a/drivers/net/wireless/ti/wlcore/testmode.h +++ b/drivers/net/wireless/ti/wlcore/testmode.h | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <net/mac80211.h> | 27 | #include <net/mac80211.h> |
28 | 28 | ||
29 | int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len); | 29 | int wl1271_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
30 | void *data, int len); | ||
30 | 31 | ||
31 | #endif /* __WL1271_TESTMODE_H__ */ | 32 | #endif /* __WL1271_TESTMODE_H__ */ |
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index b8ba1f925e75..d39c4178c33a 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c | |||
@@ -75,8 +75,10 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw) | |||
75 | len = fw_entry->size; | 75 | len = fw_entry->size; |
76 | 76 | ||
77 | buf = kmalloc(1024, GFP_ATOMIC); | 77 | buf = kmalloc(1024, GFP_ATOMIC); |
78 | if (!buf) | 78 | if (!buf) { |
79 | err = -ENOMEM; | ||
79 | goto exit; | 80 | goto exit; |
81 | } | ||
80 | 82 | ||
81 | while (len > 0) { | 83 | while (len > 0) { |
82 | int translen = (len > 1024) ? 1024 : len; | 84 | int translen = (len > 1024) ? 1024 : len; |
@@ -1764,8 +1766,10 @@ static int zd1201_probe(struct usb_interface *interface, | |||
1764 | zd->endp_out2 = 2; | 1766 | zd->endp_out2 = 2; |
1765 | zd->rx_urb = usb_alloc_urb(0, GFP_KERNEL); | 1767 | zd->rx_urb = usb_alloc_urb(0, GFP_KERNEL); |
1766 | zd->tx_urb = usb_alloc_urb(0, GFP_KERNEL); | 1768 | zd->tx_urb = usb_alloc_urb(0, GFP_KERNEL); |
1767 | if (!zd->rx_urb || !zd->tx_urb) | 1769 | if (!zd->rx_urb || !zd->tx_urb) { |
1770 | err = -ENOMEM; | ||
1768 | goto err_zd; | 1771 | goto err_zd; |
1772 | } | ||
1769 | 1773 | ||
1770 | mdelay(100); | 1774 | mdelay(100); |
1771 | err = zd1201_drvr_start(zd); | 1775 | err = zd1201_drvr_start(zd); |
diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c index c5c30fb1d7bf..9a53f13c88df 100644 --- a/drivers/nfc/nfcsim.c +++ b/drivers/nfc/nfcsim.c | |||
@@ -60,7 +60,7 @@ struct nfcsim { | |||
60 | static struct nfcsim *dev0; | 60 | static struct nfcsim *dev0; |
61 | static struct nfcsim *dev1; | 61 | static struct nfcsim *dev1; |
62 | 62 | ||
63 | struct workqueue_struct *wq; | 63 | static struct workqueue_struct *wq; |
64 | 64 | ||
65 | static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown) | 65 | static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown) |
66 | { | 66 | { |
@@ -481,7 +481,7 @@ static void nfcsim_free_device(struct nfcsim *dev) | |||
481 | kfree(dev); | 481 | kfree(dev); |
482 | } | 482 | } |
483 | 483 | ||
484 | int __init nfcsim_init(void) | 484 | static int __init nfcsim_init(void) |
485 | { | 485 | { |
486 | int rc; | 486 | int rc; |
487 | 487 | ||
@@ -522,7 +522,7 @@ exit: | |||
522 | return rc; | 522 | return rc; |
523 | } | 523 | } |
524 | 524 | ||
525 | void __exit nfcsim_exit(void) | 525 | static void __exit nfcsim_exit(void) |
526 | { | 526 | { |
527 | nfcsim_cleanup_dev(dev0, 1); | 527 | nfcsim_cleanup_dev(dev0, 1); |
528 | nfcsim_cleanup_dev(dev1, 1); | 528 | nfcsim_cleanup_dev(dev1, 1); |
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index daf92ac209f8..5df730be88a3 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c | |||
@@ -83,12 +83,20 @@ MODULE_DEVICE_TABLE(usb, pn533_table); | |||
83 | 83 | ||
84 | /* How much time we spend listening for initiators */ | 84 | /* How much time we spend listening for initiators */ |
85 | #define PN533_LISTEN_TIME 2 | 85 | #define PN533_LISTEN_TIME 2 |
86 | /* Delay between each poll frame (ms) */ | ||
87 | #define PN533_POLL_INTERVAL 10 | ||
86 | 88 | ||
87 | /* Standard pn533 frame definitions */ | 89 | /* Standard pn533 frame definitions (standard and extended)*/ |
88 | #define PN533_STD_FRAME_HEADER_LEN (sizeof(struct pn533_std_frame) \ | 90 | #define PN533_STD_FRAME_HEADER_LEN (sizeof(struct pn533_std_frame) \ |
89 | + 2) /* data[0] TFI, data[1] CC */ | 91 | + 2) /* data[0] TFI, data[1] CC */ |
90 | #define PN533_STD_FRAME_TAIL_LEN 2 /* data[len] DCS, data[len + 1] postamble*/ | 92 | #define PN533_STD_FRAME_TAIL_LEN 2 /* data[len] DCS, data[len + 1] postamble*/ |
91 | 93 | ||
94 | #define PN533_EXT_FRAME_HEADER_LEN (sizeof(struct pn533_ext_frame) \ | ||
95 | + 2) /* data[0] TFI, data[1] CC */ | ||
96 | |||
97 | #define PN533_CMD_DATAEXCH_DATA_MAXLEN 262 | ||
98 | #define PN533_CMD_DATAFRAME_MAXLEN 240 /* max data length (send) */ | ||
99 | |||
92 | /* | 100 | /* |
93 | * Max extended frame payload len, excluding TFI and CC | 101 | * Max extended frame payload len, excluding TFI and CC |
94 | * which are already in PN533_FRAME_HEADER_LEN. | 102 | * which are already in PN533_FRAME_HEADER_LEN. |
@@ -99,6 +107,10 @@ MODULE_DEVICE_TABLE(usb, pn533_table); | |||
99 | Postamble (1) */ | 107 | Postamble (1) */ |
100 | #define PN533_STD_FRAME_CHECKSUM(f) (f->data[f->datalen]) | 108 | #define PN533_STD_FRAME_CHECKSUM(f) (f->data[f->datalen]) |
101 | #define PN533_STD_FRAME_POSTAMBLE(f) (f->data[f->datalen + 1]) | 109 | #define PN533_STD_FRAME_POSTAMBLE(f) (f->data[f->datalen + 1]) |
110 | /* Half start code (3), LEN (4) should be 0xffff for extended frame */ | ||
111 | #define PN533_STD_IS_EXTENDED(hdr) ((hdr)->datalen == 0xFF \ | ||
112 | && (hdr)->datalen_checksum == 0xFF) | ||
113 | #define PN533_EXT_FRAME_CHECKSUM(f) (f->data[be16_to_cpu(f->datalen)]) | ||
102 | 114 | ||
103 | /* start of frame */ | 115 | /* start of frame */ |
104 | #define PN533_STD_FRAME_SOF 0x00FF | 116 | #define PN533_STD_FRAME_SOF 0x00FF |
@@ -124,7 +136,7 @@ MODULE_DEVICE_TABLE(usb, pn533_table); | |||
124 | #define PN533_ACR122_RDR_TO_PC_ESCAPE 0x83 | 136 | #define PN533_ACR122_RDR_TO_PC_ESCAPE 0x83 |
125 | 137 | ||
126 | /* PN533 Commands */ | 138 | /* PN533 Commands */ |
127 | #define PN533_STD_FRAME_CMD(f) (f->data[1]) | 139 | #define PN533_FRAME_CMD(f) (f->data[1]) |
128 | 140 | ||
129 | #define PN533_CMD_GET_FIRMWARE_VERSION 0x02 | 141 | #define PN533_CMD_GET_FIRMWARE_VERSION 0x02 |
130 | #define PN533_CMD_RF_CONFIGURATION 0x32 | 142 | #define PN533_CMD_RF_CONFIGURATION 0x32 |
@@ -168,8 +180,9 @@ struct pn533_fw_version { | |||
168 | #define PN533_CFGITEM_MAX_RETRIES 0x05 | 180 | #define PN533_CFGITEM_MAX_RETRIES 0x05 |
169 | #define PN533_CFGITEM_PASORI 0x82 | 181 | #define PN533_CFGITEM_PASORI 0x82 |
170 | 182 | ||
171 | #define PN533_CFGITEM_RF_FIELD_ON 0x1 | 183 | #define PN533_CFGITEM_RF_FIELD_AUTO_RFCA 0x2 |
172 | #define PN533_CFGITEM_RF_FIELD_OFF 0x0 | 184 | #define PN533_CFGITEM_RF_FIELD_ON 0x1 |
185 | #define PN533_CFGITEM_RF_FIELD_OFF 0x0 | ||
173 | 186 | ||
174 | #define PN533_CONFIG_TIMING_102 0xb | 187 | #define PN533_CONFIG_TIMING_102 0xb |
175 | #define PN533_CONFIG_TIMING_204 0xc | 188 | #define PN533_CONFIG_TIMING_204 0xc |
@@ -257,7 +270,7 @@ static const struct pn533_poll_modulations poll_mod[] = { | |||
257 | .initiator_data.felica = { | 270 | .initiator_data.felica = { |
258 | .opcode = PN533_FELICA_OPC_SENSF_REQ, | 271 | .opcode = PN533_FELICA_OPC_SENSF_REQ, |
259 | .sc = PN533_FELICA_SENSF_SC_ALL, | 272 | .sc = PN533_FELICA_SENSF_SC_ALL, |
260 | .rc = PN533_FELICA_SENSF_RC_NO_SYSTEM_CODE, | 273 | .rc = PN533_FELICA_SENSF_RC_SYSTEM_CODE, |
261 | .tsn = 0x03, | 274 | .tsn = 0x03, |
262 | }, | 275 | }, |
263 | }, | 276 | }, |
@@ -270,7 +283,7 @@ static const struct pn533_poll_modulations poll_mod[] = { | |||
270 | .initiator_data.felica = { | 283 | .initiator_data.felica = { |
271 | .opcode = PN533_FELICA_OPC_SENSF_REQ, | 284 | .opcode = PN533_FELICA_OPC_SENSF_REQ, |
272 | .sc = PN533_FELICA_SENSF_SC_ALL, | 285 | .sc = PN533_FELICA_SENSF_SC_ALL, |
273 | .rc = PN533_FELICA_SENSF_RC_NO_SYSTEM_CODE, | 286 | .rc = PN533_FELICA_SENSF_RC_SYSTEM_CODE, |
274 | .tsn = 0x03, | 287 | .tsn = 0x03, |
275 | }, | 288 | }, |
276 | }, | 289 | }, |
@@ -352,13 +365,16 @@ struct pn533 { | |||
352 | struct urb *in_urb; | 365 | struct urb *in_urb; |
353 | 366 | ||
354 | struct sk_buff_head resp_q; | 367 | struct sk_buff_head resp_q; |
368 | struct sk_buff_head fragment_skb; | ||
355 | 369 | ||
356 | struct workqueue_struct *wq; | 370 | struct workqueue_struct *wq; |
357 | struct work_struct cmd_work; | 371 | struct work_struct cmd_work; |
358 | struct work_struct cmd_complete_work; | 372 | struct work_struct cmd_complete_work; |
359 | struct work_struct poll_work; | 373 | struct delayed_work poll_work; |
360 | struct work_struct mi_work; | 374 | struct work_struct mi_rx_work; |
375 | struct work_struct mi_tx_work; | ||
361 | struct work_struct tg_work; | 376 | struct work_struct tg_work; |
377 | struct work_struct rf_work; | ||
362 | 378 | ||
363 | struct list_head cmd_queue; | 379 | struct list_head cmd_queue; |
364 | struct pn533_cmd *cmd; | 380 | struct pn533_cmd *cmd; |
@@ -366,6 +382,7 @@ struct pn533 { | |||
366 | struct mutex cmd_lock; /* protects cmd queue */ | 382 | struct mutex cmd_lock; /* protects cmd queue */ |
367 | 383 | ||
368 | void *cmd_complete_mi_arg; | 384 | void *cmd_complete_mi_arg; |
385 | void *cmd_complete_dep_arg; | ||
369 | 386 | ||
370 | struct pn533_poll_modulations *poll_mod_active[PN533_POLL_MOD_MAX + 1]; | 387 | struct pn533_poll_modulations *poll_mod_active[PN533_POLL_MOD_MAX + 1]; |
371 | u8 poll_mod_count; | 388 | u8 poll_mod_count; |
@@ -404,6 +421,15 @@ struct pn533_std_frame { | |||
404 | u8 data[]; | 421 | u8 data[]; |
405 | } __packed; | 422 | } __packed; |
406 | 423 | ||
424 | struct pn533_ext_frame { /* Extended Information frame */ | ||
425 | u8 preamble; | ||
426 | __be16 start_frame; | ||
427 | __be16 eif_flag; /* fixed to 0xFFFF */ | ||
428 | __be16 datalen; | ||
429 | u8 datalen_checksum; | ||
430 | u8 data[]; | ||
431 | } __packed; | ||
432 | |||
407 | struct pn533_frame_ops { | 433 | struct pn533_frame_ops { |
408 | void (*tx_frame_init)(void *frame, u8 cmd_code); | 434 | void (*tx_frame_init)(void *frame, u8 cmd_code); |
409 | void (*tx_frame_finish)(void *frame); | 435 | void (*tx_frame_finish)(void *frame); |
@@ -411,7 +437,7 @@ struct pn533_frame_ops { | |||
411 | int tx_header_len; | 437 | int tx_header_len; |
412 | int tx_tail_len; | 438 | int tx_tail_len; |
413 | 439 | ||
414 | bool (*rx_is_frame_valid)(void *frame); | 440 | bool (*rx_is_frame_valid)(void *frame, struct pn533 *dev); |
415 | int (*rx_frame_size)(void *frame); | 441 | int (*rx_frame_size)(void *frame); |
416 | int rx_header_len; | 442 | int rx_header_len; |
417 | int rx_tail_len; | 443 | int rx_tail_len; |
@@ -486,7 +512,7 @@ static void pn533_acr122_tx_update_payload_len(void *_frame, int len) | |||
486 | frame->datalen += len; | 512 | frame->datalen += len; |
487 | } | 513 | } |
488 | 514 | ||
489 | static bool pn533_acr122_is_rx_frame_valid(void *_frame) | 515 | static bool pn533_acr122_is_rx_frame_valid(void *_frame, struct pn533 *dev) |
490 | { | 516 | { |
491 | struct pn533_acr122_rx_frame *frame = _frame; | 517 | struct pn533_acr122_rx_frame *frame = _frame; |
492 | 518 | ||
@@ -511,7 +537,7 @@ static u8 pn533_acr122_get_cmd_code(void *frame) | |||
511 | { | 537 | { |
512 | struct pn533_acr122_rx_frame *f = frame; | 538 | struct pn533_acr122_rx_frame *f = frame; |
513 | 539 | ||
514 | return PN533_STD_FRAME_CMD(f); | 540 | return PN533_FRAME_CMD(f); |
515 | } | 541 | } |
516 | 542 | ||
517 | static struct pn533_frame_ops pn533_acr122_frame_ops = { | 543 | static struct pn533_frame_ops pn533_acr122_frame_ops = { |
@@ -530,6 +556,12 @@ static struct pn533_frame_ops pn533_acr122_frame_ops = { | |||
530 | .get_cmd_code = pn533_acr122_get_cmd_code, | 556 | .get_cmd_code = pn533_acr122_get_cmd_code, |
531 | }; | 557 | }; |
532 | 558 | ||
559 | /* The rule: value(high byte) + value(low byte) + checksum = 0 */ | ||
560 | static inline u8 pn533_ext_checksum(u16 value) | ||
561 | { | ||
562 | return ~(u8)(((value & 0xFF00) >> 8) + (u8)(value & 0xFF)) + 1; | ||
563 | } | ||
564 | |||
533 | /* The rule: value + checksum = 0 */ | 565 | /* The rule: value + checksum = 0 */ |
534 | static inline u8 pn533_std_checksum(u8 value) | 566 | static inline u8 pn533_std_checksum(u8 value) |
535 | { | 567 | { |
@@ -555,7 +587,7 @@ static void pn533_std_tx_frame_init(void *_frame, u8 cmd_code) | |||
555 | frame->preamble = 0; | 587 | frame->preamble = 0; |
556 | frame->start_frame = cpu_to_be16(PN533_STD_FRAME_SOF); | 588 | frame->start_frame = cpu_to_be16(PN533_STD_FRAME_SOF); |
557 | PN533_STD_FRAME_IDENTIFIER(frame) = PN533_STD_FRAME_DIR_OUT; | 589 | PN533_STD_FRAME_IDENTIFIER(frame) = PN533_STD_FRAME_DIR_OUT; |
558 | PN533_STD_FRAME_CMD(frame) = cmd_code; | 590 | PN533_FRAME_CMD(frame) = cmd_code; |
559 | frame->datalen = 2; | 591 | frame->datalen = 2; |
560 | } | 592 | } |
561 | 593 | ||
@@ -578,21 +610,41 @@ static void pn533_std_tx_update_payload_len(void *_frame, int len) | |||
578 | frame->datalen += len; | 610 | frame->datalen += len; |
579 | } | 611 | } |
580 | 612 | ||
581 | static bool pn533_std_rx_frame_is_valid(void *_frame) | 613 | static bool pn533_std_rx_frame_is_valid(void *_frame, struct pn533 *dev) |
582 | { | 614 | { |
583 | u8 checksum; | 615 | u8 checksum; |
584 | struct pn533_std_frame *frame = _frame; | 616 | struct pn533_std_frame *stdf = _frame; |
585 | 617 | ||
586 | if (frame->start_frame != cpu_to_be16(PN533_STD_FRAME_SOF)) | 618 | if (stdf->start_frame != cpu_to_be16(PN533_STD_FRAME_SOF)) |
587 | return false; | 619 | return false; |
588 | 620 | ||
589 | checksum = pn533_std_checksum(frame->datalen); | 621 | if (likely(!PN533_STD_IS_EXTENDED(stdf))) { |
590 | if (checksum != frame->datalen_checksum) | 622 | /* Standard frame code */ |
591 | return false; | 623 | dev->ops->rx_header_len = PN533_STD_FRAME_HEADER_LEN; |
592 | 624 | ||
593 | checksum = pn533_std_data_checksum(frame->data, frame->datalen); | 625 | checksum = pn533_std_checksum(stdf->datalen); |
594 | if (checksum != PN533_STD_FRAME_CHECKSUM(frame)) | 626 | if (checksum != stdf->datalen_checksum) |
595 | return false; | 627 | return false; |
628 | |||
629 | checksum = pn533_std_data_checksum(stdf->data, stdf->datalen); | ||
630 | if (checksum != PN533_STD_FRAME_CHECKSUM(stdf)) | ||
631 | return false; | ||
632 | } else { | ||
633 | /* Extended */ | ||
634 | struct pn533_ext_frame *eif = _frame; | ||
635 | |||
636 | dev->ops->rx_header_len = PN533_EXT_FRAME_HEADER_LEN; | ||
637 | |||
638 | checksum = pn533_ext_checksum(be16_to_cpu(eif->datalen)); | ||
639 | if (checksum != eif->datalen_checksum) | ||
640 | return false; | ||
641 | |||
642 | /* check data checksum */ | ||
643 | checksum = pn533_std_data_checksum(eif->data, | ||
644 | be16_to_cpu(eif->datalen)); | ||
645 | if (checksum != PN533_EXT_FRAME_CHECKSUM(eif)) | ||
646 | return false; | ||
647 | } | ||
596 | 648 | ||
597 | return true; | 649 | return true; |
598 | } | 650 | } |
@@ -612,6 +664,14 @@ static inline int pn533_std_rx_frame_size(void *frame) | |||
612 | { | 664 | { |
613 | struct pn533_std_frame *f = frame; | 665 | struct pn533_std_frame *f = frame; |
614 | 666 | ||
667 | /* check for Extended Information frame */ | ||
668 | if (PN533_STD_IS_EXTENDED(f)) { | ||
669 | struct pn533_ext_frame *eif = frame; | ||
670 | |||
671 | return sizeof(struct pn533_ext_frame) | ||
672 | + be16_to_cpu(eif->datalen) + PN533_STD_FRAME_TAIL_LEN; | ||
673 | } | ||
674 | |||
615 | return sizeof(struct pn533_std_frame) + f->datalen + | 675 | return sizeof(struct pn533_std_frame) + f->datalen + |
616 | PN533_STD_FRAME_TAIL_LEN; | 676 | PN533_STD_FRAME_TAIL_LEN; |
617 | } | 677 | } |
@@ -619,8 +679,12 @@ static inline int pn533_std_rx_frame_size(void *frame) | |||
619 | static u8 pn533_std_get_cmd_code(void *frame) | 679 | static u8 pn533_std_get_cmd_code(void *frame) |
620 | { | 680 | { |
621 | struct pn533_std_frame *f = frame; | 681 | struct pn533_std_frame *f = frame; |
682 | struct pn533_ext_frame *eif = frame; | ||
622 | 683 | ||
623 | return PN533_STD_FRAME_CMD(f); | 684 | if (PN533_STD_IS_EXTENDED(f)) |
685 | return PN533_FRAME_CMD(eif); | ||
686 | else | ||
687 | return PN533_FRAME_CMD(f); | ||
624 | } | 688 | } |
625 | 689 | ||
626 | static struct pn533_frame_ops pn533_std_frame_ops = { | 690 | static struct pn533_frame_ops pn533_std_frame_ops = { |
@@ -675,7 +739,7 @@ static void pn533_recv_response(struct urb *urb) | |||
675 | print_hex_dump_debug("PN533 RX: ", DUMP_PREFIX_NONE, 16, 1, in_frame, | 739 | print_hex_dump_debug("PN533 RX: ", DUMP_PREFIX_NONE, 16, 1, in_frame, |
676 | dev->ops->rx_frame_size(in_frame), false); | 740 | dev->ops->rx_frame_size(in_frame), false); |
677 | 741 | ||
678 | if (!dev->ops->rx_is_frame_valid(in_frame)) { | 742 | if (!dev->ops->rx_is_frame_valid(in_frame, dev)) { |
679 | nfc_dev_err(&dev->interface->dev, "Received an invalid frame"); | 743 | nfc_dev_err(&dev->interface->dev, "Received an invalid frame"); |
680 | cmd->status = -EIO; | 744 | cmd->status = -EIO; |
681 | goto sched_wq; | 745 | goto sched_wq; |
@@ -1657,7 +1721,56 @@ static void pn533_listen_mode_timer(unsigned long data) | |||
1657 | 1721 | ||
1658 | pn533_poll_next_mod(dev); | 1722 | pn533_poll_next_mod(dev); |
1659 | 1723 | ||
1660 | queue_work(dev->wq, &dev->poll_work); | 1724 | queue_delayed_work(dev->wq, &dev->poll_work, |
1725 | msecs_to_jiffies(PN533_POLL_INTERVAL)); | ||
1726 | } | ||
1727 | |||
1728 | static int pn533_rf_complete(struct pn533 *dev, void *arg, | ||
1729 | struct sk_buff *resp) | ||
1730 | { | ||
1731 | int rc = 0; | ||
1732 | |||
1733 | nfc_dev_dbg(&dev->interface->dev, "%s", __func__); | ||
1734 | |||
1735 | if (IS_ERR(resp)) { | ||
1736 | rc = PTR_ERR(resp); | ||
1737 | |||
1738 | nfc_dev_err(&dev->interface->dev, "%s RF setting error %d", | ||
1739 | __func__, rc); | ||
1740 | |||
1741 | return rc; | ||
1742 | } | ||
1743 | |||
1744 | queue_delayed_work(dev->wq, &dev->poll_work, | ||
1745 | msecs_to_jiffies(PN533_POLL_INTERVAL)); | ||
1746 | |||
1747 | dev_kfree_skb(resp); | ||
1748 | return rc; | ||
1749 | } | ||
1750 | |||
1751 | static void pn533_wq_rf(struct work_struct *work) | ||
1752 | { | ||
1753 | struct pn533 *dev = container_of(work, struct pn533, rf_work); | ||
1754 | struct sk_buff *skb; | ||
1755 | int rc; | ||
1756 | |||
1757 | nfc_dev_dbg(&dev->interface->dev, "%s", __func__); | ||
1758 | |||
1759 | skb = pn533_alloc_skb(dev, 2); | ||
1760 | if (!skb) | ||
1761 | return; | ||
1762 | |||
1763 | *skb_put(skb, 1) = PN533_CFGITEM_RF_FIELD; | ||
1764 | *skb_put(skb, 1) = PN533_CFGITEM_RF_FIELD_AUTO_RFCA; | ||
1765 | |||
1766 | rc = pn533_send_cmd_async(dev, PN533_CMD_RF_CONFIGURATION, skb, | ||
1767 | pn533_rf_complete, NULL); | ||
1768 | if (rc < 0) { | ||
1769 | dev_kfree_skb(skb); | ||
1770 | nfc_dev_err(&dev->interface->dev, "RF setting error %d", rc); | ||
1771 | } | ||
1772 | |||
1773 | return; | ||
1661 | } | 1774 | } |
1662 | 1775 | ||
1663 | static int pn533_poll_complete(struct pn533 *dev, void *arg, | 1776 | static int pn533_poll_complete(struct pn533 *dev, void *arg, |
@@ -1705,7 +1818,8 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg, | |||
1705 | } | 1818 | } |
1706 | 1819 | ||
1707 | pn533_poll_next_mod(dev); | 1820 | pn533_poll_next_mod(dev); |
1708 | queue_work(dev->wq, &dev->poll_work); | 1821 | /* Not target found, turn radio off */ |
1822 | queue_work(dev->wq, &dev->rf_work); | ||
1709 | 1823 | ||
1710 | done: | 1824 | done: |
1711 | dev_kfree_skb(resp); | 1825 | dev_kfree_skb(resp); |
@@ -1770,7 +1884,7 @@ static int pn533_send_poll_frame(struct pn533 *dev) | |||
1770 | 1884 | ||
1771 | static void pn533_wq_poll(struct work_struct *work) | 1885 | static void pn533_wq_poll(struct work_struct *work) |
1772 | { | 1886 | { |
1773 | struct pn533 *dev = container_of(work, struct pn533, poll_work); | 1887 | struct pn533 *dev = container_of(work, struct pn533, poll_work.work); |
1774 | struct pn533_poll_modulations *cur_mod; | 1888 | struct pn533_poll_modulations *cur_mod; |
1775 | int rc; | 1889 | int rc; |
1776 | 1890 | ||
@@ -1799,6 +1913,7 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev, | |||
1799 | u32 im_protocols, u32 tm_protocols) | 1913 | u32 im_protocols, u32 tm_protocols) |
1800 | { | 1914 | { |
1801 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); | 1915 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); |
1916 | u8 rand_mod; | ||
1802 | 1917 | ||
1803 | nfc_dev_dbg(&dev->interface->dev, | 1918 | nfc_dev_dbg(&dev->interface->dev, |
1804 | "%s: im protocols 0x%x tm protocols 0x%x", | 1919 | "%s: im protocols 0x%x tm protocols 0x%x", |
@@ -1822,11 +1937,15 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev, | |||
1822 | tm_protocols = 0; | 1937 | tm_protocols = 0; |
1823 | } | 1938 | } |
1824 | 1939 | ||
1825 | dev->poll_mod_curr = 0; | ||
1826 | pn533_poll_create_mod_list(dev, im_protocols, tm_protocols); | 1940 | pn533_poll_create_mod_list(dev, im_protocols, tm_protocols); |
1827 | dev->poll_protocols = im_protocols; | 1941 | dev->poll_protocols = im_protocols; |
1828 | dev->listen_protocols = tm_protocols; | 1942 | dev->listen_protocols = tm_protocols; |
1829 | 1943 | ||
1944 | /* Do not always start polling from the same modulation */ | ||
1945 | get_random_bytes(&rand_mod, sizeof(rand_mod)); | ||
1946 | rand_mod %= dev->poll_mod_count; | ||
1947 | dev->poll_mod_curr = rand_mod; | ||
1948 | |||
1830 | return pn533_send_poll_frame(dev); | 1949 | return pn533_send_poll_frame(dev); |
1831 | } | 1950 | } |
1832 | 1951 | ||
@@ -1845,6 +1964,7 @@ static void pn533_stop_poll(struct nfc_dev *nfc_dev) | |||
1845 | } | 1964 | } |
1846 | 1965 | ||
1847 | pn533_abort_cmd(dev, GFP_KERNEL); | 1966 | pn533_abort_cmd(dev, GFP_KERNEL); |
1967 | flush_delayed_work(&dev->poll_work); | ||
1848 | pn533_poll_reset_mod_list(dev); | 1968 | pn533_poll_reset_mod_list(dev); |
1849 | } | 1969 | } |
1850 | 1970 | ||
@@ -2037,28 +2157,15 @@ error: | |||
2037 | return rc; | 2157 | return rc; |
2038 | } | 2158 | } |
2039 | 2159 | ||
2040 | static int pn533_mod_to_baud(struct pn533 *dev) | 2160 | static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf); |
2041 | { | ||
2042 | switch (dev->poll_mod_curr) { | ||
2043 | case PN533_POLL_MOD_106KBPS_A: | ||
2044 | return 0; | ||
2045 | case PN533_POLL_MOD_212KBPS_FELICA: | ||
2046 | return 1; | ||
2047 | case PN533_POLL_MOD_424KBPS_FELICA: | ||
2048 | return 2; | ||
2049 | default: | ||
2050 | return -EINVAL; | ||
2051 | } | ||
2052 | } | ||
2053 | |||
2054 | #define PASSIVE_DATA_LEN 5 | 2161 | #define PASSIVE_DATA_LEN 5 |
2055 | static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, | 2162 | static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, |
2056 | u8 comm_mode, u8 *gb, size_t gb_len) | 2163 | u8 comm_mode, u8 *gb, size_t gb_len) |
2057 | { | 2164 | { |
2058 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); | 2165 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); |
2059 | struct sk_buff *skb; | 2166 | struct sk_buff *skb; |
2060 | int rc, baud, skb_len; | 2167 | int rc, skb_len; |
2061 | u8 *next, *arg; | 2168 | u8 *next, *arg, nfcid3[NFC_NFCID3_MAXSIZE]; |
2062 | 2169 | ||
2063 | u8 passive_data[PASSIVE_DATA_LEN] = {0x00, 0xff, 0xff, 0x00, 0x3}; | 2170 | u8 passive_data[PASSIVE_DATA_LEN] = {0x00, 0xff, 0xff, 0x00, 0x3}; |
2064 | 2171 | ||
@@ -2076,41 +2183,39 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, | |||
2076 | return -EBUSY; | 2183 | return -EBUSY; |
2077 | } | 2184 | } |
2078 | 2185 | ||
2079 | baud = pn533_mod_to_baud(dev); | ||
2080 | if (baud < 0) { | ||
2081 | nfc_dev_err(&dev->interface->dev, | ||
2082 | "Invalid curr modulation %d", dev->poll_mod_curr); | ||
2083 | return baud; | ||
2084 | } | ||
2085 | |||
2086 | skb_len = 3 + gb_len; /* ActPass + BR + Next */ | 2186 | skb_len = 3 + gb_len; /* ActPass + BR + Next */ |
2087 | if (comm_mode == NFC_COMM_PASSIVE) | 2187 | skb_len += PASSIVE_DATA_LEN; |
2088 | skb_len += PASSIVE_DATA_LEN; | ||
2089 | 2188 | ||
2090 | if (target && target->nfcid2_len) | 2189 | /* NFCID3 */ |
2091 | skb_len += NFC_NFCID3_MAXSIZE; | 2190 | skb_len += NFC_NFCID3_MAXSIZE; |
2191 | if (target && !target->nfcid2_len) { | ||
2192 | nfcid3[0] = 0x1; | ||
2193 | nfcid3[1] = 0xfe; | ||
2194 | get_random_bytes(nfcid3 + 2, 6); | ||
2195 | } | ||
2092 | 2196 | ||
2093 | skb = pn533_alloc_skb(dev, skb_len); | 2197 | skb = pn533_alloc_skb(dev, skb_len); |
2094 | if (!skb) | 2198 | if (!skb) |
2095 | return -ENOMEM; | 2199 | return -ENOMEM; |
2096 | 2200 | ||
2097 | *skb_put(skb, 1) = !comm_mode; /* ActPass */ | 2201 | *skb_put(skb, 1) = !comm_mode; /* ActPass */ |
2098 | *skb_put(skb, 1) = baud; /* Baud rate */ | 2202 | *skb_put(skb, 1) = 0x02; /* 424 kbps */ |
2099 | 2203 | ||
2100 | next = skb_put(skb, 1); /* Next */ | 2204 | next = skb_put(skb, 1); /* Next */ |
2101 | *next = 0; | 2205 | *next = 0; |
2102 | 2206 | ||
2103 | if (comm_mode == NFC_COMM_PASSIVE && baud > 0) { | 2207 | /* Copy passive data */ |
2104 | memcpy(skb_put(skb, PASSIVE_DATA_LEN), passive_data, | 2208 | memcpy(skb_put(skb, PASSIVE_DATA_LEN), passive_data, PASSIVE_DATA_LEN); |
2105 | PASSIVE_DATA_LEN); | 2209 | *next |= 1; |
2106 | *next |= 1; | ||
2107 | } | ||
2108 | 2210 | ||
2109 | if (target && target->nfcid2_len) { | 2211 | /* Copy NFCID3 (which is NFCID2 from SENSF_RES) */ |
2212 | if (target && target->nfcid2_len) | ||
2110 | memcpy(skb_put(skb, NFC_NFCID3_MAXSIZE), target->nfcid2, | 2213 | memcpy(skb_put(skb, NFC_NFCID3_MAXSIZE), target->nfcid2, |
2111 | target->nfcid2_len); | 2214 | target->nfcid2_len); |
2112 | *next |= 2; | 2215 | else |
2113 | } | 2216 | memcpy(skb_put(skb, NFC_NFCID3_MAXSIZE), nfcid3, |
2217 | NFC_NFCID3_MAXSIZE); | ||
2218 | *next |= 2; | ||
2114 | 2219 | ||
2115 | if (gb != NULL && gb_len > 0) { | 2220 | if (gb != NULL && gb_len > 0) { |
2116 | memcpy(skb_put(skb, gb_len), gb, gb_len); | 2221 | memcpy(skb_put(skb, gb_len), gb, gb_len); |
@@ -2127,6 +2232,8 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, | |||
2127 | 2232 | ||
2128 | *arg = !comm_mode; | 2233 | *arg = !comm_mode; |
2129 | 2234 | ||
2235 | pn533_rf_field(dev->nfc_dev, 0); | ||
2236 | |||
2130 | rc = pn533_send_cmd_async(dev, PN533_CMD_IN_JUMP_FOR_DEP, skb, | 2237 | rc = pn533_send_cmd_async(dev, PN533_CMD_IN_JUMP_FOR_DEP, skb, |
2131 | pn533_in_dep_link_up_complete, arg); | 2238 | pn533_in_dep_link_up_complete, arg); |
2132 | 2239 | ||
@@ -2232,7 +2339,15 @@ static int pn533_data_exchange_complete(struct pn533 *dev, void *_arg, | |||
2232 | 2339 | ||
2233 | if (mi) { | 2340 | if (mi) { |
2234 | dev->cmd_complete_mi_arg = arg; | 2341 | dev->cmd_complete_mi_arg = arg; |
2235 | queue_work(dev->wq, &dev->mi_work); | 2342 | queue_work(dev->wq, &dev->mi_rx_work); |
2343 | return -EINPROGRESS; | ||
2344 | } | ||
2345 | |||
2346 | /* Prepare for the next round */ | ||
2347 | if (skb_queue_len(&dev->fragment_skb) > 0) { | ||
2348 | dev->cmd_complete_dep_arg = arg; | ||
2349 | queue_work(dev->wq, &dev->mi_tx_work); | ||
2350 | |||
2236 | return -EINPROGRESS; | 2351 | return -EINPROGRESS; |
2237 | } | 2352 | } |
2238 | 2353 | ||
@@ -2253,6 +2368,50 @@ _error: | |||
2253 | return rc; | 2368 | return rc; |
2254 | } | 2369 | } |
2255 | 2370 | ||
2371 | /* Split the Tx skb into small chunks */ | ||
2372 | static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb) | ||
2373 | { | ||
2374 | struct sk_buff *frag; | ||
2375 | int frag_size; | ||
2376 | |||
2377 | do { | ||
2378 | /* Remaining size */ | ||
2379 | if (skb->len > PN533_CMD_DATAFRAME_MAXLEN) | ||
2380 | frag_size = PN533_CMD_DATAFRAME_MAXLEN; | ||
2381 | else | ||
2382 | frag_size = skb->len; | ||
2383 | |||
2384 | /* Allocate and reserve */ | ||
2385 | frag = pn533_alloc_skb(dev, frag_size); | ||
2386 | if (!frag) { | ||
2387 | skb_queue_purge(&dev->fragment_skb); | ||
2388 | break; | ||
2389 | } | ||
2390 | |||
2391 | /* Reserve the TG/MI byte */ | ||
2392 | skb_reserve(frag, 1); | ||
2393 | |||
2394 | /* MI + TG */ | ||
2395 | if (frag_size == PN533_CMD_DATAFRAME_MAXLEN) | ||
2396 | *skb_push(frag, sizeof(u8)) = (PN533_CMD_MI_MASK | 1); | ||
2397 | else | ||
2398 | *skb_push(frag, sizeof(u8)) = 1; /* TG */ | ||
2399 | |||
2400 | memcpy(skb_put(frag, frag_size), skb->data, frag_size); | ||
2401 | |||
2402 | /* Reduce the size of incoming buffer */ | ||
2403 | skb_pull(skb, frag_size); | ||
2404 | |||
2405 | /* Add this to skb_queue */ | ||
2406 | skb_queue_tail(&dev->fragment_skb, frag); | ||
2407 | |||
2408 | } while (skb->len > 0); | ||
2409 | |||
2410 | dev_kfree_skb(skb); | ||
2411 | |||
2412 | return skb_queue_len(&dev->fragment_skb); | ||
2413 | } | ||
2414 | |||
2256 | static int pn533_transceive(struct nfc_dev *nfc_dev, | 2415 | static int pn533_transceive(struct nfc_dev *nfc_dev, |
2257 | struct nfc_target *target, struct sk_buff *skb, | 2416 | struct nfc_target *target, struct sk_buff *skb, |
2258 | data_exchange_cb_t cb, void *cb_context) | 2417 | data_exchange_cb_t cb, void *cb_context) |
@@ -2263,15 +2422,6 @@ static int pn533_transceive(struct nfc_dev *nfc_dev, | |||
2263 | 2422 | ||
2264 | nfc_dev_dbg(&dev->interface->dev, "%s", __func__); | 2423 | nfc_dev_dbg(&dev->interface->dev, "%s", __func__); |
2265 | 2424 | ||
2266 | if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) { | ||
2267 | /* TODO: Implement support to multi-part data exchange */ | ||
2268 | nfc_dev_err(&dev->interface->dev, | ||
2269 | "Data length greater than the max allowed: %d", | ||
2270 | PN533_CMD_DATAEXCH_DATA_MAXLEN); | ||
2271 | rc = -ENOSYS; | ||
2272 | goto error; | ||
2273 | } | ||
2274 | |||
2275 | if (!dev->tgt_active_prot) { | 2425 | if (!dev->tgt_active_prot) { |
2276 | nfc_dev_err(&dev->interface->dev, | 2426 | nfc_dev_err(&dev->interface->dev, |
2277 | "Can't exchange data if there is no active target"); | 2427 | "Can't exchange data if there is no active target"); |
@@ -2299,7 +2449,20 @@ static int pn533_transceive(struct nfc_dev *nfc_dev, | |||
2299 | break; | 2449 | break; |
2300 | } | 2450 | } |
2301 | default: | 2451 | default: |
2302 | *skb_push(skb, sizeof(u8)) = 1; /*TG*/ | 2452 | /* jumbo frame ? */ |
2453 | if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) { | ||
2454 | rc = pn533_fill_fragment_skbs(dev, skb); | ||
2455 | if (rc <= 0) | ||
2456 | goto error; | ||
2457 | |||
2458 | skb = skb_dequeue(&dev->fragment_skb); | ||
2459 | if (!skb) { | ||
2460 | rc = -EIO; | ||
2461 | goto error; | ||
2462 | } | ||
2463 | } else { | ||
2464 | *skb_push(skb, sizeof(u8)) = 1; /* TG */ | ||
2465 | } | ||
2303 | 2466 | ||
2304 | rc = pn533_send_data_async(dev, PN533_CMD_IN_DATA_EXCHANGE, | 2467 | rc = pn533_send_data_async(dev, PN533_CMD_IN_DATA_EXCHANGE, |
2305 | skb, pn533_data_exchange_complete, | 2468 | skb, pn533_data_exchange_complete, |
@@ -2370,7 +2533,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb) | |||
2370 | 2533 | ||
2371 | static void pn533_wq_mi_recv(struct work_struct *work) | 2534 | static void pn533_wq_mi_recv(struct work_struct *work) |
2372 | { | 2535 | { |
2373 | struct pn533 *dev = container_of(work, struct pn533, mi_work); | 2536 | struct pn533 *dev = container_of(work, struct pn533, mi_rx_work); |
2374 | 2537 | ||
2375 | struct sk_buff *skb; | 2538 | struct sk_buff *skb; |
2376 | int rc; | 2539 | int rc; |
@@ -2418,6 +2581,61 @@ error: | |||
2418 | queue_work(dev->wq, &dev->cmd_work); | 2581 | queue_work(dev->wq, &dev->cmd_work); |
2419 | } | 2582 | } |
2420 | 2583 | ||
2584 | static void pn533_wq_mi_send(struct work_struct *work) | ||
2585 | { | ||
2586 | struct pn533 *dev = container_of(work, struct pn533, mi_tx_work); | ||
2587 | struct sk_buff *skb; | ||
2588 | int rc; | ||
2589 | |||
2590 | nfc_dev_dbg(&dev->interface->dev, "%s", __func__); | ||
2591 | |||
2592 | /* Grab the first skb in the queue */ | ||
2593 | skb = skb_dequeue(&dev->fragment_skb); | ||
2594 | |||
2595 | if (skb == NULL) { /* No more data */ | ||
2596 | /* Reset the queue for future use */ | ||
2597 | skb_queue_head_init(&dev->fragment_skb); | ||
2598 | goto error; | ||
2599 | } | ||
2600 | |||
2601 | switch (dev->device_type) { | ||
2602 | case PN533_DEVICE_PASORI: | ||
2603 | if (dev->tgt_active_prot != NFC_PROTO_FELICA) { | ||
2604 | rc = -EIO; | ||
2605 | break; | ||
2606 | } | ||
2607 | |||
2608 | rc = pn533_send_cmd_direct_async(dev, PN533_CMD_IN_COMM_THRU, | ||
2609 | skb, | ||
2610 | pn533_data_exchange_complete, | ||
2611 | dev->cmd_complete_dep_arg); | ||
2612 | |||
2613 | break; | ||
2614 | |||
2615 | default: | ||
2616 | /* Still some fragments? */ | ||
2617 | rc = pn533_send_cmd_direct_async(dev,PN533_CMD_IN_DATA_EXCHANGE, | ||
2618 | skb, | ||
2619 | pn533_data_exchange_complete, | ||
2620 | dev->cmd_complete_dep_arg); | ||
2621 | |||
2622 | break; | ||
2623 | } | ||
2624 | |||
2625 | if (rc == 0) /* success */ | ||
2626 | return; | ||
2627 | |||
2628 | nfc_dev_err(&dev->interface->dev, | ||
2629 | "Error %d when trying to perform data_exchange", rc); | ||
2630 | |||
2631 | dev_kfree_skb(skb); | ||
2632 | kfree(dev->cmd_complete_dep_arg); | ||
2633 | |||
2634 | error: | ||
2635 | pn533_send_ack(dev, GFP_KERNEL); | ||
2636 | queue_work(dev->wq, &dev->cmd_work); | ||
2637 | } | ||
2638 | |||
2421 | static int pn533_set_configuration(struct pn533 *dev, u8 cfgitem, u8 *cfgdata, | 2639 | static int pn533_set_configuration(struct pn533 *dev, u8 cfgitem, u8 *cfgdata, |
2422 | u8 cfgdata_len) | 2640 | u8 cfgdata_len) |
2423 | { | 2641 | { |
@@ -2562,6 +2780,8 @@ static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf) | |||
2562 | u8 rf_field = !!rf; | 2780 | u8 rf_field = !!rf; |
2563 | int rc; | 2781 | int rc; |
2564 | 2782 | ||
2783 | rf_field |= PN533_CFGITEM_RF_FIELD_AUTO_RFCA; | ||
2784 | |||
2565 | rc = pn533_set_configuration(dev, PN533_CFGITEM_RF_FIELD, | 2785 | rc = pn533_set_configuration(dev, PN533_CFGITEM_RF_FIELD, |
2566 | (u8 *)&rf_field, 1); | 2786 | (u8 *)&rf_field, 1); |
2567 | if (rc) { | 2787 | if (rc) { |
@@ -2605,17 +2825,6 @@ static int pn533_setup(struct pn533 *dev) | |||
2605 | 2825 | ||
2606 | switch (dev->device_type) { | 2826 | switch (dev->device_type) { |
2607 | case PN533_DEVICE_STD: | 2827 | case PN533_DEVICE_STD: |
2608 | max_retries.mx_rty_atr = PN533_CONFIG_MAX_RETRIES_ENDLESS; | ||
2609 | max_retries.mx_rty_psl = 2; | ||
2610 | max_retries.mx_rty_passive_act = | ||
2611 | PN533_CONFIG_MAX_RETRIES_NO_RETRY; | ||
2612 | |||
2613 | timing.rfu = PN533_CONFIG_TIMING_102; | ||
2614 | timing.atr_res_timeout = PN533_CONFIG_TIMING_204; | ||
2615 | timing.dep_timeout = PN533_CONFIG_TIMING_409; | ||
2616 | |||
2617 | break; | ||
2618 | |||
2619 | case PN533_DEVICE_PASORI: | 2828 | case PN533_DEVICE_PASORI: |
2620 | case PN533_DEVICE_ACR122U: | 2829 | case PN533_DEVICE_ACR122U: |
2621 | max_retries.mx_rty_atr = 0x2; | 2830 | max_retries.mx_rty_atr = 0x2; |
@@ -2729,9 +2938,11 @@ static int pn533_probe(struct usb_interface *interface, | |||
2729 | 2938 | ||
2730 | INIT_WORK(&dev->cmd_work, pn533_wq_cmd); | 2939 | INIT_WORK(&dev->cmd_work, pn533_wq_cmd); |
2731 | INIT_WORK(&dev->cmd_complete_work, pn533_wq_cmd_complete); | 2940 | INIT_WORK(&dev->cmd_complete_work, pn533_wq_cmd_complete); |
2732 | INIT_WORK(&dev->mi_work, pn533_wq_mi_recv); | 2941 | INIT_WORK(&dev->mi_rx_work, pn533_wq_mi_recv); |
2942 | INIT_WORK(&dev->mi_tx_work, pn533_wq_mi_send); | ||
2733 | INIT_WORK(&dev->tg_work, pn533_wq_tg_get_data); | 2943 | INIT_WORK(&dev->tg_work, pn533_wq_tg_get_data); |
2734 | INIT_WORK(&dev->poll_work, pn533_wq_poll); | 2944 | INIT_DELAYED_WORK(&dev->poll_work, pn533_wq_poll); |
2945 | INIT_WORK(&dev->rf_work, pn533_wq_rf); | ||
2735 | dev->wq = alloc_ordered_workqueue("pn533", 0); | 2946 | dev->wq = alloc_ordered_workqueue("pn533", 0); |
2736 | if (dev->wq == NULL) | 2947 | if (dev->wq == NULL) |
2737 | goto error; | 2948 | goto error; |
@@ -2741,6 +2952,7 @@ static int pn533_probe(struct usb_interface *interface, | |||
2741 | dev->listen_timer.function = pn533_listen_mode_timer; | 2952 | dev->listen_timer.function = pn533_listen_mode_timer; |
2742 | 2953 | ||
2743 | skb_queue_head_init(&dev->resp_q); | 2954 | skb_queue_head_init(&dev->resp_q); |
2955 | skb_queue_head_init(&dev->fragment_skb); | ||
2744 | 2956 | ||
2745 | INIT_LIST_HEAD(&dev->cmd_queue); | 2957 | INIT_LIST_HEAD(&dev->cmd_queue); |
2746 | 2958 | ||
@@ -2842,6 +3054,7 @@ static void pn533_disconnect(struct usb_interface *interface) | |||
2842 | usb_kill_urb(dev->in_urb); | 3054 | usb_kill_urb(dev->in_urb); |
2843 | usb_kill_urb(dev->out_urb); | 3055 | usb_kill_urb(dev->out_urb); |
2844 | 3056 | ||
3057 | flush_delayed_work(&dev->poll_work); | ||
2845 | destroy_workqueue(dev->wq); | 3058 | destroy_workqueue(dev->wq); |
2846 | 3059 | ||
2847 | skb_queue_purge(&dev->resp_q); | 3060 | skb_queue_purge(&dev->resp_q); |
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index 8cf64c19f022..01e27d4bdd0d 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c | |||
@@ -25,11 +25,14 @@ | |||
25 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | 28 | #include <linux/nfc.h> | |
29 | #include <linux/firmware.h> | ||
30 | #include <linux/unaligned/access_ok.h> | ||
29 | #include <linux/platform_data/pn544.h> | 31 | #include <linux/platform_data/pn544.h> |
30 | 32 | ||
31 | #include <net/nfc/hci.h> | 33 | #include <net/nfc/hci.h> |
32 | #include <net/nfc/llc.h> | 34 | #include <net/nfc/llc.h> |
35 | #include <net/nfc/nfc.h> | ||
33 | 36 | ||
34 | #include "pn544.h" | 37 | #include "pn544.h" |
35 | 38 | ||
@@ -55,6 +58,58 @@ MODULE_DEVICE_TABLE(i2c, pn544_hci_i2c_id_table); | |||
55 | 58 | ||
56 | #define PN544_HCI_I2C_DRIVER_NAME "pn544_hci_i2c" | 59 | #define PN544_HCI_I2C_DRIVER_NAME "pn544_hci_i2c" |
57 | 60 | ||
61 | #define PN544_FW_CMD_WRITE 0x08 | ||
62 | #define PN544_FW_CMD_CHECK 0x06 | ||
63 | |||
64 | struct pn544_i2c_fw_frame_write { | ||
65 | u8 cmd; | ||
66 | u16 be_length; | ||
67 | u8 be_dest_addr[3]; | ||
68 | u16 be_datalen; | ||
69 | u8 data[]; | ||
70 | } __packed; | ||
71 | |||
72 | struct pn544_i2c_fw_frame_check { | ||
73 | u8 cmd; | ||
74 | u16 be_length; | ||
75 | u8 be_start_addr[3]; | ||
76 | u16 be_datalen; | ||
77 | u16 be_crc; | ||
78 | } __packed; | ||
79 | |||
80 | struct pn544_i2c_fw_frame_response { | ||
81 | u8 status; | ||
82 | u16 be_length; | ||
83 | } __packed; | ||
84 | |||
85 | struct pn544_i2c_fw_blob { | ||
86 | u32 be_size; | ||
87 | u32 be_destaddr; | ||
88 | u8 data[]; | ||
89 | }; | ||
90 | |||
91 | #define PN544_FW_CMD_RESULT_TIMEOUT 0x01 | ||
92 | #define PN544_FW_CMD_RESULT_BAD_CRC 0x02 | ||
93 | #define PN544_FW_CMD_RESULT_ACCESS_DENIED 0x08 | ||
94 | #define PN544_FW_CMD_RESULT_PROTOCOL_ERROR 0x0B | ||
95 | #define PN544_FW_CMD_RESULT_INVALID_PARAMETER 0x11 | ||
96 | #define PN544_FW_CMD_RESULT_INVALID_LENGTH 0x18 | ||
97 | #define PN544_FW_CMD_RESULT_WRITE_FAILED 0x74 | ||
98 | |||
99 | #define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) | ||
100 | |||
101 | #define PN544_FW_WRITE_BUFFER_MAX_LEN 0x9f7 | ||
102 | #define PN544_FW_I2C_MAX_PAYLOAD PN544_HCI_I2C_LLC_MAX_SIZE | ||
103 | #define PN544_FW_I2C_WRITE_FRAME_HEADER_LEN 8 | ||
104 | #define PN544_FW_I2C_WRITE_DATA_MAX_LEN MIN((PN544_FW_I2C_MAX_PAYLOAD -\ | ||
105 | PN544_FW_I2C_WRITE_FRAME_HEADER_LEN),\ | ||
106 | PN544_FW_WRITE_BUFFER_MAX_LEN) | ||
107 | |||
108 | #define FW_WORK_STATE_IDLE 1 | ||
109 | #define FW_WORK_STATE_START 2 | ||
110 | #define FW_WORK_STATE_WAIT_WRITE_ANSWER 3 | ||
111 | #define FW_WORK_STATE_WAIT_CHECK_ANSWER 4 | ||
112 | |||
58 | struct pn544_i2c_phy { | 113 | struct pn544_i2c_phy { |
59 | struct i2c_client *i2c_dev; | 114 | struct i2c_client *i2c_dev; |
60 | struct nfc_hci_dev *hdev; | 115 | struct nfc_hci_dev *hdev; |
@@ -64,7 +119,18 @@ struct pn544_i2c_phy { | |||
64 | unsigned int gpio_fw; | 119 | unsigned int gpio_fw; |
65 | unsigned int en_polarity; | 120 | unsigned int en_polarity; |
66 | 121 | ||
122 | struct work_struct fw_work; | ||
123 | int fw_work_state; | ||
124 | char firmware_name[NFC_FIRMWARE_NAME_MAXSIZE + 1]; | ||
125 | const struct firmware *fw; | ||
126 | u32 fw_blob_dest_addr; | ||
127 | size_t fw_blob_size; | ||
128 | const u8 *fw_blob_data; | ||
129 | size_t fw_written; | ||
130 | int fw_cmd_result; | ||
131 | |||
67 | int powered; | 132 | int powered; |
133 | int run_mode; | ||
68 | 134 | ||
69 | int hard_fault; /* | 135 | int hard_fault; /* |
70 | * < 0 if hardware error occured (e.g. i2c err) | 136 | * < 0 if hardware error occured (e.g. i2c err) |
@@ -122,15 +188,22 @@ out: | |||
122 | gpio_set_value(phy->gpio_en, !phy->en_polarity); | 188 | gpio_set_value(phy->gpio_en, !phy->en_polarity); |
123 | } | 189 | } |
124 | 190 | ||
191 | static void pn544_hci_i2c_enable_mode(struct pn544_i2c_phy *phy, int run_mode) | ||
192 | { | ||
193 | gpio_set_value(phy->gpio_fw, run_mode == PN544_FW_MODE ? 1 : 0); | ||
194 | gpio_set_value(phy->gpio_en, phy->en_polarity); | ||
195 | usleep_range(10000, 15000); | ||
196 | |||
197 | phy->run_mode = run_mode; | ||
198 | } | ||
199 | |||
125 | static int pn544_hci_i2c_enable(void *phy_id) | 200 | static int pn544_hci_i2c_enable(void *phy_id) |
126 | { | 201 | { |
127 | struct pn544_i2c_phy *phy = phy_id; | 202 | struct pn544_i2c_phy *phy = phy_id; |
128 | 203 | ||
129 | pr_info(DRIVER_DESC ": %s\n", __func__); | 204 | pr_info(DRIVER_DESC ": %s\n", __func__); |
130 | 205 | ||
131 | gpio_set_value(phy->gpio_fw, 0); | 206 | pn544_hci_i2c_enable_mode(phy, PN544_HCI_MODE); |
132 | gpio_set_value(phy->gpio_en, phy->en_polarity); | ||
133 | usleep_range(10000, 15000); | ||
134 | 207 | ||
135 | phy->powered = 1; | 208 | phy->powered = 1; |
136 | 209 | ||
@@ -305,6 +378,42 @@ flush: | |||
305 | return r; | 378 | return r; |
306 | } | 379 | } |
307 | 380 | ||
381 | static int pn544_hci_i2c_fw_read_status(struct pn544_i2c_phy *phy) | ||
382 | { | ||
383 | int r; | ||
384 | struct pn544_i2c_fw_frame_response response; | ||
385 | struct i2c_client *client = phy->i2c_dev; | ||
386 | |||
387 | r = i2c_master_recv(client, (char *) &response, sizeof(response)); | ||
388 | if (r != sizeof(response)) { | ||
389 | dev_err(&client->dev, "cannot read fw status\n"); | ||
390 | return -EIO; | ||
391 | } | ||
392 | |||
393 | usleep_range(3000, 6000); | ||
394 | |||
395 | switch (response.status) { | ||
396 | case 0: | ||
397 | return 0; | ||
398 | case PN544_FW_CMD_RESULT_TIMEOUT: | ||
399 | return -ETIMEDOUT; | ||
400 | case PN544_FW_CMD_RESULT_BAD_CRC: | ||
401 | return -ENODATA; | ||
402 | case PN544_FW_CMD_RESULT_ACCESS_DENIED: | ||
403 | return -EACCES; | ||
404 | case PN544_FW_CMD_RESULT_PROTOCOL_ERROR: | ||
405 | return -EPROTO; | ||
406 | case PN544_FW_CMD_RESULT_INVALID_PARAMETER: | ||
407 | return -EINVAL; | ||
408 | case PN544_FW_CMD_RESULT_INVALID_LENGTH: | ||
409 | return -EBADMSG; | ||
410 | case PN544_FW_CMD_RESULT_WRITE_FAILED: | ||
411 | return -EIO; | ||
412 | default: | ||
413 | return -EIO; | ||
414 | } | ||
415 | } | ||
416 | |||
308 | /* | 417 | /* |
309 | * Reads an shdlc frame from the chip. This is not as straightforward as it | 418 | * Reads an shdlc frame from the chip. This is not as straightforward as it |
310 | * seems. There are cases where we could loose the frame start synchronization. | 419 | * seems. There are cases where we could loose the frame start synchronization. |
@@ -339,19 +448,23 @@ static irqreturn_t pn544_hci_i2c_irq_thread_fn(int irq, void *phy_id) | |||
339 | if (phy->hard_fault != 0) | 448 | if (phy->hard_fault != 0) |
340 | return IRQ_HANDLED; | 449 | return IRQ_HANDLED; |
341 | 450 | ||
342 | r = pn544_hci_i2c_read(phy, &skb); | 451 | if (phy->run_mode == PN544_FW_MODE) { |
343 | if (r == -EREMOTEIO) { | 452 | phy->fw_cmd_result = pn544_hci_i2c_fw_read_status(phy); |
344 | phy->hard_fault = r; | 453 | schedule_work(&phy->fw_work); |
454 | } else { | ||
455 | r = pn544_hci_i2c_read(phy, &skb); | ||
456 | if (r == -EREMOTEIO) { | ||
457 | phy->hard_fault = r; | ||
345 | 458 | ||
346 | nfc_hci_recv_frame(phy->hdev, NULL); | 459 | nfc_hci_recv_frame(phy->hdev, NULL); |
347 | 460 | ||
348 | return IRQ_HANDLED; | 461 | return IRQ_HANDLED; |
349 | } else if ((r == -ENOMEM) || (r == -EBADMSG)) { | 462 | } else if ((r == -ENOMEM) || (r == -EBADMSG)) { |
350 | return IRQ_HANDLED; | 463 | return IRQ_HANDLED; |
351 | } | 464 | } |
352 | |||
353 | nfc_hci_recv_frame(phy->hdev, skb); | ||
354 | 465 | ||
466 | nfc_hci_recv_frame(phy->hdev, skb); | ||
467 | } | ||
355 | return IRQ_HANDLED; | 468 | return IRQ_HANDLED; |
356 | } | 469 | } |
357 | 470 | ||
@@ -361,6 +474,215 @@ static struct nfc_phy_ops i2c_phy_ops = { | |||
361 | .disable = pn544_hci_i2c_disable, | 474 | .disable = pn544_hci_i2c_disable, |
362 | }; | 475 | }; |
363 | 476 | ||
477 | static int pn544_hci_i2c_fw_download(void *phy_id, const char *firmware_name) | ||
478 | { | ||
479 | struct pn544_i2c_phy *phy = phy_id; | ||
480 | |||
481 | pr_info(DRIVER_DESC ": Starting Firmware Download (%s)\n", | ||
482 | firmware_name); | ||
483 | |||
484 | strcpy(phy->firmware_name, firmware_name); | ||
485 | |||
486 | phy->fw_work_state = FW_WORK_STATE_START; | ||
487 | |||
488 | schedule_work(&phy->fw_work); | ||
489 | |||
490 | return 0; | ||
491 | } | ||
492 | |||
493 | static void pn544_hci_i2c_fw_work_complete(struct pn544_i2c_phy *phy, | ||
494 | int result) | ||
495 | { | ||
496 | pr_info(DRIVER_DESC ": Firmware Download Complete, result=%d\n", result); | ||
497 | |||
498 | pn544_hci_i2c_disable(phy); | ||
499 | |||
500 | phy->fw_work_state = FW_WORK_STATE_IDLE; | ||
501 | |||
502 | if (phy->fw) { | ||
503 | release_firmware(phy->fw); | ||
504 | phy->fw = NULL; | ||
505 | } | ||
506 | |||
507 | nfc_fw_download_done(phy->hdev->ndev, phy->firmware_name, (u32) -result); | ||
508 | } | ||
509 | |||
510 | static int pn544_hci_i2c_fw_write_cmd(struct i2c_client *client, u32 dest_addr, | ||
511 | const u8 *data, u16 datalen) | ||
512 | { | ||
513 | u8 frame[PN544_FW_I2C_MAX_PAYLOAD]; | ||
514 | struct pn544_i2c_fw_frame_write *framep; | ||
515 | u16 params_len; | ||
516 | int framelen; | ||
517 | int r; | ||
518 | |||
519 | if (datalen > PN544_FW_I2C_WRITE_DATA_MAX_LEN) | ||
520 | datalen = PN544_FW_I2C_WRITE_DATA_MAX_LEN; | ||
521 | |||
522 | framep = (struct pn544_i2c_fw_frame_write *) frame; | ||
523 | |||
524 | params_len = sizeof(framep->be_dest_addr) + | ||
525 | sizeof(framep->be_datalen) + datalen; | ||
526 | framelen = params_len + sizeof(framep->cmd) + | ||
527 | sizeof(framep->be_length); | ||
528 | |||
529 | framep->cmd = PN544_FW_CMD_WRITE; | ||
530 | |||
531 | put_unaligned_be16(params_len, &framep->be_length); | ||
532 | |||
533 | framep->be_dest_addr[0] = (dest_addr & 0xff0000) >> 16; | ||
534 | framep->be_dest_addr[1] = (dest_addr & 0xff00) >> 8; | ||
535 | framep->be_dest_addr[2] = dest_addr & 0xff; | ||
536 | |||
537 | put_unaligned_be16(datalen, &framep->be_datalen); | ||
538 | |||
539 | memcpy(framep->data, data, datalen); | ||
540 | |||
541 | r = i2c_master_send(client, frame, framelen); | ||
542 | |||
543 | if (r == framelen) | ||
544 | return datalen; | ||
545 | else if (r < 0) | ||
546 | return r; | ||
547 | else | ||
548 | return -EIO; | ||
549 | } | ||
550 | |||
551 | static int pn544_hci_i2c_fw_check_cmd(struct i2c_client *client, u32 start_addr, | ||
552 | const u8 *data, u16 datalen) | ||
553 | { | ||
554 | struct pn544_i2c_fw_frame_check frame; | ||
555 | int r; | ||
556 | u16 crc; | ||
557 | |||
558 | /* calculate local crc for the data we want to check */ | ||
559 | crc = crc_ccitt(0xffff, data, datalen); | ||
560 | |||
561 | frame.cmd = PN544_FW_CMD_CHECK; | ||
562 | |||
563 | put_unaligned_be16(sizeof(frame.be_start_addr) + | ||
564 | sizeof(frame.be_datalen) + sizeof(frame.be_crc), | ||
565 | &frame.be_length); | ||
566 | |||
567 | /* tell the chip the memory region to which our crc applies */ | ||
568 | frame.be_start_addr[0] = (start_addr & 0xff0000) >> 16; | ||
569 | frame.be_start_addr[1] = (start_addr & 0xff00) >> 8; | ||
570 | frame.be_start_addr[2] = start_addr & 0xff; | ||
571 | |||
572 | put_unaligned_be16(datalen, &frame.be_datalen); | ||
573 | |||
574 | /* | ||
575 | * and give our local crc. Chip will calculate its own crc for the | ||
576 | * region and compare with ours. | ||
577 | */ | ||
578 | put_unaligned_be16(crc, &frame.be_crc); | ||
579 | |||
580 | r = i2c_master_send(client, (const char *) &frame, sizeof(frame)); | ||
581 | |||
582 | if (r == sizeof(frame)) | ||
583 | return 0; | ||
584 | else if (r < 0) | ||
585 | return r; | ||
586 | else | ||
587 | return -EIO; | ||
588 | } | ||
589 | |||
590 | static int pn544_hci_i2c_fw_write_chunk(struct pn544_i2c_phy *phy) | ||
591 | { | ||
592 | int r; | ||
593 | |||
594 | r = pn544_hci_i2c_fw_write_cmd(phy->i2c_dev, | ||
595 | phy->fw_blob_dest_addr + phy->fw_written, | ||
596 | phy->fw_blob_data + phy->fw_written, | ||
597 | phy->fw_blob_size - phy->fw_written); | ||
598 | if (r < 0) | ||
599 | return r; | ||
600 | |||
601 | phy->fw_written += r; | ||
602 | phy->fw_work_state = FW_WORK_STATE_WAIT_WRITE_ANSWER; | ||
603 | |||
604 | return 0; | ||
605 | } | ||
606 | |||
607 | static void pn544_hci_i2c_fw_work(struct work_struct *work) | ||
608 | { | ||
609 | struct pn544_i2c_phy *phy = container_of(work, struct pn544_i2c_phy, | ||
610 | fw_work); | ||
611 | int r; | ||
612 | struct pn544_i2c_fw_blob *blob; | ||
613 | |||
614 | switch (phy->fw_work_state) { | ||
615 | case FW_WORK_STATE_START: | ||
616 | pn544_hci_i2c_enable_mode(phy, PN544_FW_MODE); | ||
617 | |||
618 | r = request_firmware(&phy->fw, phy->firmware_name, | ||
619 | &phy->i2c_dev->dev); | ||
620 | if (r < 0) | ||
621 | goto exit_state_start; | ||
622 | |||
623 | blob = (struct pn544_i2c_fw_blob *) phy->fw->data; | ||
624 | phy->fw_blob_size = get_unaligned_be32(&blob->be_size); | ||
625 | phy->fw_blob_dest_addr = get_unaligned_be32(&blob->be_destaddr); | ||
626 | phy->fw_blob_data = blob->data; | ||
627 | |||
628 | phy->fw_written = 0; | ||
629 | r = pn544_hci_i2c_fw_write_chunk(phy); | ||
630 | |||
631 | exit_state_start: | ||
632 | if (r < 0) | ||
633 | pn544_hci_i2c_fw_work_complete(phy, r); | ||
634 | break; | ||
635 | |||
636 | case FW_WORK_STATE_WAIT_WRITE_ANSWER: | ||
637 | r = phy->fw_cmd_result; | ||
638 | if (r < 0) | ||
639 | goto exit_state_wait_write_answer; | ||
640 | |||
641 | if (phy->fw_written == phy->fw_blob_size) { | ||
642 | r = pn544_hci_i2c_fw_check_cmd(phy->i2c_dev, | ||
643 | phy->fw_blob_dest_addr, | ||
644 | phy->fw_blob_data, | ||
645 | phy->fw_blob_size); | ||
646 | if (r < 0) | ||
647 | goto exit_state_wait_write_answer; | ||
648 | phy->fw_work_state = FW_WORK_STATE_WAIT_CHECK_ANSWER; | ||
649 | break; | ||
650 | } | ||
651 | |||
652 | r = pn544_hci_i2c_fw_write_chunk(phy); | ||
653 | |||
654 | exit_state_wait_write_answer: | ||
655 | if (r < 0) | ||
656 | pn544_hci_i2c_fw_work_complete(phy, r); | ||
657 | break; | ||
658 | |||
659 | case FW_WORK_STATE_WAIT_CHECK_ANSWER: | ||
660 | r = phy->fw_cmd_result; | ||
661 | if (r < 0) | ||
662 | goto exit_state_wait_check_answer; | ||
663 | |||
664 | blob = (struct pn544_i2c_fw_blob *) (phy->fw_blob_data + | ||
665 | phy->fw_blob_size); | ||
666 | phy->fw_blob_size = get_unaligned_be32(&blob->be_size); | ||
667 | if (phy->fw_blob_size != 0) { | ||
668 | phy->fw_blob_dest_addr = | ||
669 | get_unaligned_be32(&blob->be_destaddr); | ||
670 | phy->fw_blob_data = blob->data; | ||
671 | |||
672 | phy->fw_written = 0; | ||
673 | r = pn544_hci_i2c_fw_write_chunk(phy); | ||
674 | } | ||
675 | |||
676 | exit_state_wait_check_answer: | ||
677 | if (r < 0 || phy->fw_blob_size == 0) | ||
678 | pn544_hci_i2c_fw_work_complete(phy, r); | ||
679 | break; | ||
680 | |||
681 | default: | ||
682 | break; | ||
683 | } | ||
684 | } | ||
685 | |||
364 | static int pn544_hci_i2c_probe(struct i2c_client *client, | 686 | static int pn544_hci_i2c_probe(struct i2c_client *client, |
365 | const struct i2c_device_id *id) | 687 | const struct i2c_device_id *id) |
366 | { | 688 | { |
@@ -384,6 +706,9 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, | |||
384 | return -ENOMEM; | 706 | return -ENOMEM; |
385 | } | 707 | } |
386 | 708 | ||
709 | INIT_WORK(&phy->fw_work, pn544_hci_i2c_fw_work); | ||
710 | phy->fw_work_state = FW_WORK_STATE_IDLE; | ||
711 | |||
387 | phy->i2c_dev = client; | 712 | phy->i2c_dev = client; |
388 | i2c_set_clientdata(client, phy); | 713 | i2c_set_clientdata(client, phy); |
389 | 714 | ||
@@ -420,7 +745,8 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, | |||
420 | 745 | ||
421 | r = pn544_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME, | 746 | r = pn544_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME, |
422 | PN544_I2C_FRAME_HEADROOM, PN544_I2C_FRAME_TAILROOM, | 747 | PN544_I2C_FRAME_HEADROOM, PN544_I2C_FRAME_TAILROOM, |
423 | PN544_HCI_I2C_LLC_MAX_PAYLOAD, &phy->hdev); | 748 | PN544_HCI_I2C_LLC_MAX_PAYLOAD, |
749 | pn544_hci_i2c_fw_download, &phy->hdev); | ||
424 | if (r < 0) | 750 | if (r < 0) |
425 | goto err_hci; | 751 | goto err_hci; |
426 | 752 | ||
@@ -443,6 +769,10 @@ static int pn544_hci_i2c_remove(struct i2c_client *client) | |||
443 | 769 | ||
444 | dev_dbg(&client->dev, "%s\n", __func__); | 770 | dev_dbg(&client->dev, "%s\n", __func__); |
445 | 771 | ||
772 | cancel_work_sync(&phy->fw_work); | ||
773 | if (phy->fw_work_state != FW_WORK_STATE_IDLE) | ||
774 | pn544_hci_i2c_fw_work_complete(phy, -ENODEV); | ||
775 | |||
446 | pn544_hci_remove(phy->hdev); | 776 | pn544_hci_remove(phy->hdev); |
447 | 777 | ||
448 | if (phy->powered) | 778 | if (phy->powered) |
diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c index b5d3d18179eb..ee67de50c36f 100644 --- a/drivers/nfc/pn544/mei.c +++ b/drivers/nfc/pn544/mei.c | |||
@@ -45,7 +45,7 @@ static int pn544_mei_probe(struct mei_cl_device *device, | |||
45 | 45 | ||
46 | r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME, | 46 | r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME, |
47 | MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, | 47 | MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, |
48 | &phy->hdev); | 48 | NULL, &phy->hdev); |
49 | if (r < 0) { | 49 | if (r < 0) { |
50 | nfc_mei_phy_free(phy); | 50 | nfc_mei_phy_free(phy); |
51 | 51 | ||
diff --git a/drivers/nfc/pn544/pn544.c b/drivers/nfc/pn544/pn544.c index 0d17da7675b7..078e62feba17 100644 --- a/drivers/nfc/pn544/pn544.c +++ b/drivers/nfc/pn544/pn544.c | |||
@@ -31,9 +31,6 @@ | |||
31 | /* Timing restrictions (ms) */ | 31 | /* Timing restrictions (ms) */ |
32 | #define PN544_HCI_RESETVEN_TIME 30 | 32 | #define PN544_HCI_RESETVEN_TIME 30 |
33 | 33 | ||
34 | #define HCI_MODE 0 | ||
35 | #define FW_MODE 1 | ||
36 | |||
37 | enum pn544_state { | 34 | enum pn544_state { |
38 | PN544_ST_COLD, | 35 | PN544_ST_COLD, |
39 | PN544_ST_FW_READY, | 36 | PN544_ST_FW_READY, |
@@ -130,6 +127,8 @@ struct pn544_hci_info { | |||
130 | int async_cb_type; | 127 | int async_cb_type; |
131 | data_exchange_cb_t async_cb; | 128 | data_exchange_cb_t async_cb; |
132 | void *async_cb_context; | 129 | void *async_cb_context; |
130 | |||
131 | fw_download_t fw_download; | ||
133 | }; | 132 | }; |
134 | 133 | ||
135 | static int pn544_hci_open(struct nfc_hci_dev *hdev) | 134 | static int pn544_hci_open(struct nfc_hci_dev *hdev) |
@@ -782,6 +781,17 @@ exit: | |||
782 | return r; | 781 | return r; |
783 | } | 782 | } |
784 | 783 | ||
784 | static int pn544_hci_fw_download(struct nfc_hci_dev *hdev, | ||
785 | const char *firmware_name) | ||
786 | { | ||
787 | struct pn544_hci_info *info = nfc_hci_get_clientdata(hdev); | ||
788 | |||
789 | if (info->fw_download == NULL) | ||
790 | return -ENOTSUPP; | ||
791 | |||
792 | return info->fw_download(info->phy_id, firmware_name); | ||
793 | } | ||
794 | |||
785 | static struct nfc_hci_ops pn544_hci_ops = { | 795 | static struct nfc_hci_ops pn544_hci_ops = { |
786 | .open = pn544_hci_open, | 796 | .open = pn544_hci_open, |
787 | .close = pn544_hci_close, | 797 | .close = pn544_hci_close, |
@@ -796,11 +806,12 @@ static struct nfc_hci_ops pn544_hci_ops = { | |||
796 | .tm_send = pn544_hci_tm_send, | 806 | .tm_send = pn544_hci_tm_send, |
797 | .check_presence = pn544_hci_check_presence, | 807 | .check_presence = pn544_hci_check_presence, |
798 | .event_received = pn544_hci_event_received, | 808 | .event_received = pn544_hci_event_received, |
809 | .fw_download = pn544_hci_fw_download, | ||
799 | }; | 810 | }; |
800 | 811 | ||
801 | int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, | 812 | int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, |
802 | int phy_headroom, int phy_tailroom, int phy_payload, | 813 | int phy_headroom, int phy_tailroom, int phy_payload, |
803 | struct nfc_hci_dev **hdev) | 814 | fw_download_t fw_download, struct nfc_hci_dev **hdev) |
804 | { | 815 | { |
805 | struct pn544_hci_info *info; | 816 | struct pn544_hci_info *info; |
806 | u32 protocols; | 817 | u32 protocols; |
@@ -816,6 +827,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, | |||
816 | 827 | ||
817 | info->phy_ops = phy_ops; | 828 | info->phy_ops = phy_ops; |
818 | info->phy_id = phy_id; | 829 | info->phy_id = phy_id; |
830 | info->fw_download = fw_download; | ||
819 | info->state = PN544_ST_COLD; | 831 | info->state = PN544_ST_COLD; |
820 | mutex_init(&info->info_lock); | 832 | mutex_init(&info->info_lock); |
821 | 833 | ||
diff --git a/drivers/nfc/pn544/pn544.h b/drivers/nfc/pn544/pn544.h index f47c6454914b..01020e585443 100644 --- a/drivers/nfc/pn544/pn544.h +++ b/drivers/nfc/pn544/pn544.h | |||
@@ -24,9 +24,14 @@ | |||
24 | 24 | ||
25 | #define DRIVER_DESC "HCI NFC driver for PN544" | 25 | #define DRIVER_DESC "HCI NFC driver for PN544" |
26 | 26 | ||
27 | #define PN544_HCI_MODE 0 | ||
28 | #define PN544_FW_MODE 1 | ||
29 | |||
30 | typedef int (*fw_download_t)(void *context, const char *firmware_name); | ||
31 | |||
27 | int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, | 32 | int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, |
28 | int phy_headroom, int phy_tailroom, int phy_payload, | 33 | int phy_headroom, int phy_tailroom, int phy_payload, |
29 | struct nfc_hci_dev **hdev); | 34 | fw_download_t fw_download, struct nfc_hci_dev **hdev); |
30 | void pn544_hci_remove(struct nfc_hci_dev *hdev); | 35 | void pn544_hci_remove(struct nfc_hci_dev *hdev); |
31 | 36 | ||
32 | #endif /* __LOCAL_PN544_H_ */ | 37 | #endif /* __LOCAL_PN544_H_ */ |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h index 8fc9f588b056..7f015499cfae 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h | |||
@@ -14,7 +14,7 @@ | |||
14 | * Copyright (c) 2004, Intel Corporation | 14 | * Copyright (c) 2004, Intel Corporation |
15 | * | 15 | * |
16 | * Modified for Realtek's wi-fi cards by Andrea Merello | 16 | * Modified for Realtek's wi-fi cards by Andrea Merello |
17 | * <andreamrl@tiscali.it> | 17 | * <andrea.merello@gmail.com> |
18 | * | 18 | * |
19 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
20 | * it under the terms of the GNU General Public License version 2 as | 20 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c index d5df0d691fcc..10b22100dd3a 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c | |||
@@ -14,7 +14,7 @@ | |||
14 | ****************************************************************************** | 14 | ****************************************************************************** |
15 | 15 | ||
16 | Few modifications for Realtek's Wi-Fi drivers by | 16 | Few modifications for Realtek's Wi-Fi drivers by |
17 | Andrea Merello <andreamrl@tiscali.it> | 17 | Andrea Merello <andrea.merello@gmail.com> |
18 | 18 | ||
19 | A special thanks goes to Realtek for their support ! | 19 | A special thanks goes to Realtek for their support ! |
20 | 20 | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 00f9af06aca5..b65db542e1ab 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* IEEE 802.11 SoftMAC layer | 1 | /* IEEE 802.11 SoftMAC layer |
2 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 2 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
3 | * | 3 | * |
4 | * Mostly extracted from the rtl8180-sa2400 driver for the | 4 | * Mostly extracted from the rtl8180-sa2400 driver for the |
5 | * in-kernel generic ieee802.11 stack. | 5 | * in-kernel generic ieee802.11 stack. |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c index d9add5305e29..e5282068e3de 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* IEEE 802.11 SoftMAC layer | 1 | /* IEEE 802.11 SoftMAC layer |
2 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 2 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
3 | * | 3 | * |
4 | * Mostly extracted from the rtl8180-sa2400 driver for the | 4 | * Mostly extracted from the rtl8180-sa2400 driver for the |
5 | * in-kernel generic ieee802.11 stack. | 5 | * in-kernel generic ieee802.11 stack. |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c index 89ed86ef0d15..b3466530cf94 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c | |||
@@ -25,7 +25,7 @@ | |||
25 | ****************************************************************************** | 25 | ****************************************************************************** |
26 | 26 | ||
27 | Few modifications for Realtek's Wi-Fi drivers by | 27 | Few modifications for Realtek's Wi-Fi drivers by |
28 | Andrea Merello <andreamrl@tiscali.it> | 28 | Andrea Merello <andrea.merello@gmail.com> |
29 | 29 | ||
30 | A special thanks goes to Realtek for their support ! | 30 | A special thanks goes to Realtek for their support ! |
31 | 31 | ||
diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index edacc8001640..d052f4a9a839 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This is part of rtl8180 OpenSource driver. | 2 | This is part of rtl8180 OpenSource driver. |
3 | Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 3 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
4 | Released under the terms of GPL (General Public Licence) | 4 | Released under the terms of GPL (General Public Licence) |
5 | 5 | ||
6 | Parts of this driver are based on the GPL part of the | 6 | Parts of this driver are based on the GPL part of the |
diff --git a/drivers/staging/rtl8187se/r8180_93cx6.h b/drivers/staging/rtl8187se/r8180_93cx6.h index 79e7391ac881..b52b5b0610ab 100644 --- a/drivers/staging/rtl8187se/r8180_93cx6.h +++ b/drivers/staging/rtl8187se/r8180_93cx6.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This is part of rtl8180 OpenSource driver | 2 | This is part of rtl8180 OpenSource driver |
3 | Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 3 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
4 | Released under the terms of GPL (General Public Licence) | 4 | Released under the terms of GPL (General Public Licence) |
5 | 5 | ||
6 | Parts of this driver are based on the GPL part of the official realtek driver | 6 | Parts of this driver are based on the GPL part of the official realtek driver |
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index ca691550436a..fd2bfeadd54c 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This is part of rtl818x pci OpenSource driver - v 0.1 | 2 | This is part of rtl818x pci OpenSource driver - v 0.1 |
3 | Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 3 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
4 | Released under the terms of GPL (General Public License) | 4 | Released under the terms of GPL (General Public License) |
5 | 5 | ||
6 | Parts of this driver are based on the GPL part of the official | 6 | Parts of this driver are based on the GPL part of the official |
@@ -70,7 +70,7 @@ static int hwwep; | |||
70 | 70 | ||
71 | MODULE_LICENSE("GPL"); | 71 | MODULE_LICENSE("GPL"); |
72 | MODULE_DEVICE_TABLE(pci, rtl8180_pci_id_tbl); | 72 | MODULE_DEVICE_TABLE(pci, rtl8180_pci_id_tbl); |
73 | MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); | 73 | MODULE_AUTHOR("Andrea Merello <andrea.merello@gmail.com>"); |
74 | MODULE_DESCRIPTION("Linux driver for Realtek RTL8187SE WiFi cards"); | 74 | MODULE_DESCRIPTION("Linux driver for Realtek RTL8187SE WiFi cards"); |
75 | 75 | ||
76 | module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO|S_IWUSR); | 76 | module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO|S_IWUSR); |
diff --git a/drivers/staging/rtl8187se/r8180_hw.h b/drivers/staging/rtl8187se/r8180_hw.h index 533938123a97..92c05af557cf 100644 --- a/drivers/staging/rtl8187se/r8180_hw.h +++ b/drivers/staging/rtl8187se/r8180_hw.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This is part of rtl8180 OpenSource driver. | 2 | This is part of rtl8180 OpenSource driver. |
3 | Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 3 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
4 | Released under the terms of GPL (General Public Licence) | 4 | Released under the terms of GPL (General Public Licence) |
5 | 5 | ||
6 | Parts of this driver are based on the GPL part of the | 6 | Parts of this driver are based on the GPL part of the |
diff --git a/drivers/staging/rtl8187se/r8180_rtl8225.h b/drivers/staging/rtl8187se/r8180_rtl8225.h index c6f2128e755c..c94ca0794a5d 100644 --- a/drivers/staging/rtl8187se/r8180_rtl8225.h +++ b/drivers/staging/rtl8187se/r8180_rtl8225.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | This is part of the rtl8180-sa2400 driver | 2 | This is part of the rtl8180-sa2400 driver |
3 | released under the GPL (See file COPYING for details). | 3 | released under the GPL (See file COPYING for details). |
4 | Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 4 | Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
5 | 5 | ||
6 | This files contains programming code for the rtl8225 | 6 | This files contains programming code for the rtl8225 |
7 | radio frontend. | 7 | radio frontend. |
diff --git a/drivers/staging/rtl8187se/r8180_rtl8225z2.c b/drivers/staging/rtl8187se/r8180_rtl8225z2.c index c592f7936ddb..9ae96b7852f3 100644 --- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c +++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This is part of the rtl8180-sa2400 driver | 2 | * This is part of the rtl8180-sa2400 driver |
3 | * released under the GPL (See file COPYING for details). | 3 | * released under the GPL (See file COPYING for details). |
4 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 4 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
5 | * | 5 | * |
6 | * This files contains programming code for the rtl8225 | 6 | * This files contains programming code for the rtl8225 |
7 | * radio frontend. | 7 | * radio frontend. |
diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c index 156b75882290..dab787542c45 100644 --- a/drivers/staging/rtl8187se/r8180_wx.c +++ b/drivers/staging/rtl8187se/r8180_wx.c | |||
@@ -2,7 +2,7 @@ | |||
2 | This file contains wireless extension handlers. | 2 | This file contains wireless extension handlers. |
3 | 3 | ||
4 | This is part of rtl8180 OpenSource driver. | 4 | This is part of rtl8180 OpenSource driver. |
5 | Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 5 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
6 | Released under the terms of GPL (General Public Licence) | 6 | Released under the terms of GPL (General Public Licence) |
7 | 7 | ||
8 | Parts of this driver are based on the GPL part | 8 | Parts of this driver are based on the GPL part |
diff --git a/drivers/staging/rtl8187se/r8180_wx.h b/drivers/staging/rtl8187se/r8180_wx.h index 408191403112..d471520ac772 100644 --- a/drivers/staging/rtl8187se/r8180_wx.h +++ b/drivers/staging/rtl8187se/r8180_wx.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This is part of rtl8180 OpenSource driver - v 0.3 | 2 | This is part of rtl8180 OpenSource driver - v 0.3 |
3 | Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> | 3 | Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> |
4 | Released under the terms of GPL (General Public Licence) | 4 | Released under the terms of GPL (General Public Licence) |
5 | 5 | ||
6 | Parts of this driver are based on the GPL part of the official realtek driver | 6 | Parts of this driver are based on the GPL part of the official realtek driver |
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 50c7bb773984..74fbd70d5838 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index b9b3b52f9120..dbe0e1c87056 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index baf3b6342e44..fa5603a562c3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h index fa607f98b172..7d075d3cbe62 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 2b6c61c5d3d8..8d45c8dbfa83 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 87d4d349c890..9de1dc3e584b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c index c1ccff4a8321..a6778e0853c7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h index 9452e1683a72..adea2b4c7a44 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c index 0cfb3ecaadee..529ea54d1683 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c index 5abbee37cdca..2ad92eee50c2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h index 28c7da677a80..356aec437963 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index c9a7c563b682..a8c2ade4f435 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index df79d6c4ca03..962f2e5b8bf8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 3485ef1dfab1..05ef49f24cd9 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h | |||
@@ -14,7 +14,7 @@ | |||
14 | * Copyright (c) 2004, Intel Corporation | 14 | * Copyright (c) 2004, Intel Corporation |
15 | * | 15 | * |
16 | * Modified for Realtek's wi-fi cards by Andrea Merello | 16 | * Modified for Realtek's wi-fi cards by Andrea Merello |
17 | * <andreamrl@tiscali.it> | 17 | * <andrea.merello@gmail.com> |
18 | * | 18 | * |
19 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
20 | * it under the terms of the GNU General Public License version 2 as | 20 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/drivers/staging/rtl8192e/rtllib_debug.h b/drivers/staging/rtl8192e/rtllib_debug.h index 2bfc1155f505..c59f67b26363 100644 --- a/drivers/staging/rtl8192e/rtllib_debug.h +++ b/drivers/staging/rtl8192e/rtllib_debug.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | 2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * Based on the r8180 driver, which is: | 4 | * Based on the r8180 driver, which is: |
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 5 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index e75364e3eb43..96aa3a2fb7e1 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c | |||
@@ -14,7 +14,7 @@ | |||
14 | ****************************************************************************** | 14 | ****************************************************************************** |
15 | 15 | ||
16 | Few modifications for Realtek's Wi-Fi drivers by | 16 | Few modifications for Realtek's Wi-Fi drivers by |
17 | Andrea Merello <andreamrl@tiscali.it> | 17 | Andrea Merello <andrea.merello@gmail.com> |
18 | 18 | ||
19 | A special thanks goes to Realtek for their support ! | 19 | A special thanks goes to Realtek for their support ! |
20 | 20 | ||
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index aefffac556a6..0cbf6f5593a3 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* IEEE 802.11 SoftMAC layer | 1 | /* IEEE 802.11 SoftMAC layer |
2 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 2 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
3 | * | 3 | * |
4 | * Mostly extracted from the rtl8180-sa2400 driver for the | 4 | * Mostly extracted from the rtl8180-sa2400 driver for the |
5 | * in-kernel generic ieee802.11 stack. | 5 | * in-kernel generic ieee802.11 stack. |
diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 740cf85e9d5b..e6af8cfab12b 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* IEEE 802.11 SoftMAC layer | 1 | /* IEEE 802.11 SoftMAC layer |
2 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 2 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
3 | * | 3 | * |
4 | * Mostly extracted from the rtl8180-sa2400 driver for the | 4 | * Mostly extracted from the rtl8180-sa2400 driver for the |
5 | * in-kernel generic ieee802.11 stack. | 5 | * in-kernel generic ieee802.11 stack. |
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 759d7c7d78e5..1cc6a9d5e8a3 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c | |||
@@ -25,7 +25,7 @@ | |||
25 | ****************************************************************************** | 25 | ****************************************************************************** |
26 | 26 | ||
27 | Few modifications for Realtek's Wi-Fi drivers by | 27 | Few modifications for Realtek's Wi-Fi drivers by |
28 | Andrea Merello <andreamrl@tiscali.it> | 28 | Andrea Merello <andrea.merello@gmail.com> |
29 | 29 | ||
30 | A special thanks goes to Realtek for their support ! | 30 | A special thanks goes to Realtek for their support ! |
31 | 31 | ||
diff --git a/drivers/staging/rtl8192u/authors b/drivers/staging/rtl8192u/authors index b08bbae39e72..0fab11228b48 100644 --- a/drivers/staging/rtl8192u/authors +++ b/drivers/staging/rtl8192u/authors | |||
@@ -1 +1 @@ | |||
Andrea Merello <andreamrl@tiscali.it> | Andrea Merello <andrea.merello@gmail.com> | ||
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index c9f3bb363be4..bc64f05a7e6a 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h | |||
@@ -14,7 +14,7 @@ | |||
14 | * Copyright (c) 2004, Intel Corporation | 14 | * Copyright (c) 2004, Intel Corporation |
15 | * | 15 | * |
16 | * Modified for Realtek's wi-fi cards by Andrea Merello | 16 | * Modified for Realtek's wi-fi cards by Andrea Merello |
17 | * <andreamrl@tiscali.it> | 17 | * <andrea.merello@gmail.com> |
18 | * | 18 | * |
19 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
20 | * it under the terms of the GNU General Public License version 2 as | 20 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index a6b18409103b..59900bfa1c18 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | |||
@@ -14,7 +14,7 @@ | |||
14 | ****************************************************************************** | 14 | ****************************************************************************** |
15 | 15 | ||
16 | Few modifications for Realtek's Wi-Fi drivers by | 16 | Few modifications for Realtek's Wi-Fi drivers by |
17 | Andrea Merello <andreamrl@tiscali.it> | 17 | Andrea Merello <andrea.merello@gmail.com> |
18 | 18 | ||
19 | A special thanks goes to Realtek for their support ! | 19 | A special thanks goes to Realtek for their support ! |
20 | 20 | ||
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 8a0075db9253..5fd696926ee3 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* IEEE 802.11 SoftMAC layer | 1 | /* IEEE 802.11 SoftMAC layer |
2 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 2 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
3 | * | 3 | * |
4 | * Mostly extracted from the rtl8180-sa2400 driver for the | 4 | * Mostly extracted from the rtl8180-sa2400 driver for the |
5 | * in-kernel generic ieee802.11 stack. | 5 | * in-kernel generic ieee802.11 stack. |
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index 60746b8b1eb0..7b7d929f1536 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* IEEE 802.11 SoftMAC layer | 1 | /* IEEE 802.11 SoftMAC layer |
2 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 2 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
3 | * | 3 | * |
4 | * Mostly extracted from the rtl8180-sa2400 driver for the | 4 | * Mostly extracted from the rtl8180-sa2400 driver for the |
5 | * in-kernel generic ieee802.11 stack. | 5 | * in-kernel generic ieee802.11 stack. |
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 995504207fc6..a7bcc64ff226 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | |||
@@ -25,7 +25,7 @@ | |||
25 | ****************************************************************************** | 25 | ****************************************************************************** |
26 | 26 | ||
27 | Few modifications for Realtek's Wi-Fi drivers by | 27 | Few modifications for Realtek's Wi-Fi drivers by |
28 | Andrea Merello <andreamrl@tiscali.it> | 28 | Andrea Merello <andrea.merello@gmail.com> |
29 | 29 | ||
30 | A special thanks goes to Realtek for their support ! | 30 | A special thanks goes to Realtek for their support ! |
31 | 31 | ||
diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index d2199986d132..c61729b727ef 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c | |||
@@ -3,7 +3,7 @@ | |||
3 | memory is addressed by 16 bits words. | 3 | memory is addressed by 16 bits words. |
4 | 4 | ||
5 | This is part of rtl8180 OpenSource driver. | 5 | This is part of rtl8180 OpenSource driver. |
6 | Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> | 6 | Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> |
7 | Released under the terms of GPL (General Public Licence) | 7 | Released under the terms of GPL (General Public Licence) |
8 | 8 | ||
9 | Parts of this driver are based on the GPL part of the | 9 | Parts of this driver are based on the GPL part of the |
diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h b/drivers/staging/rtl8192u/r8180_93cx6.h index 5cea51e1142e..ee55dbffe32c 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.h +++ b/drivers/staging/rtl8192u/r8180_93cx6.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This is part of rtl8187 OpenSource driver | 2 | This is part of rtl8187 OpenSource driver |
3 | Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 3 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
4 | Released under the terms of GPL (General Public Licence) | 4 | Released under the terms of GPL (General Public Licence) |
5 | 5 | ||
6 | Parts of this driver are based on the GPL part of the official realtek driver | 6 | Parts of this driver are based on the GPL part of the official realtek driver |
diff --git a/drivers/staging/rtl8192u/r8180_pm.c b/drivers/staging/rtl8192u/r8180_pm.c index 0c58d0ed502a..999968d41720 100644 --- a/drivers/staging/rtl8192u/r8180_pm.c +++ b/drivers/staging/rtl8192u/r8180_pm.c | |||
@@ -5,7 +5,7 @@ | |||
5 | does not do anything useful. | 5 | does not do anything useful. |
6 | 6 | ||
7 | This is part of rtl8180 OpenSource driver. | 7 | This is part of rtl8180 OpenSource driver. |
8 | Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> | 8 | Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> |
9 | Released under the terms of GPL (General Public Licence) | 9 | Released under the terms of GPL (General Public Licence) |
10 | */ | 10 | */ |
11 | 11 | ||
diff --git a/drivers/staging/rtl8192u/r8180_pm.h b/drivers/staging/rtl8192u/r8180_pm.h index 52d6fba99deb..4be63da0b781 100644 --- a/drivers/staging/rtl8192u/r8180_pm.h +++ b/drivers/staging/rtl8192u/r8180_pm.h | |||
@@ -5,7 +5,7 @@ | |||
5 | does not do anything useful. | 5 | does not do anything useful. |
6 | 6 | ||
7 | This is part of rtl8180 OpenSource driver. | 7 | This is part of rtl8180 OpenSource driver. |
8 | Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> | 8 | Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> |
9 | Released under the terms of GPL (General Public Licence) | 9 | Released under the terms of GPL (General Public Licence) |
10 | 10 | ||
11 | */ | 11 | */ |
diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index b64dd662761a..592e7807fa42 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | This is part of the rtl8180-sa2400 driver | 2 | This is part of the rtl8180-sa2400 driver |
3 | released under the GPL (See file COPYING for details). | 3 | released under the GPL (See file COPYING for details). |
4 | Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> | 4 | Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> |
5 | 5 | ||
6 | This files contains programming code for the rtl8256 | 6 | This files contains programming code for the rtl8256 |
7 | radio frontend. | 7 | radio frontend. |
diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 338e7bc237c3..b484ee128c13 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * This is part of rtl8187 OpenSource driver. | 2 | * This is part of rtl8187 OpenSource driver. |
3 | * Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 3 | * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
4 | * Released under the terms of GPL (General Public Licence) | 4 | * Released under the terms of GPL (General Public Licence) |
5 | * | 5 | * |
6 | * Parts of this driver are based on the GPL part of the | 6 | * Parts of this driver are based on the GPL part of the |
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 14c14c24ac50..cd0946db025c 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Linux device driver for RTL8192U | 3 | * Linux device driver for RTL8192U |
4 | * | 4 | * |
5 | * Based on the r8187 driver, which is: | 5 | * Based on the r8187 driver, which is: |
6 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | 6 | * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms of version 2 of the GNU General Public License as | 8 | * under the terms of version 2 of the GNU General Public License as |
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h index 7e612aa56fa4..dd07a735b537 100644 --- a/drivers/staging/rtl8192u/r8192U_hw.h +++ b/drivers/staging/rtl8192u/r8192U_hw.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This is part of rtl8187 OpenSource driver. | 2 | This is part of rtl8187 OpenSource driver. |
3 | Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 3 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
4 | Released under the terms of GPL (General Public Licence) | 4 | Released under the terms of GPL (General Public Licence) |
5 | 5 | ||
6 | Parts of this driver are based on the GPL part of the | 6 | Parts of this driver are based on the GPL part of the |
diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 3e2576347d29..61f6620213e2 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c | |||
@@ -2,7 +2,7 @@ | |||
2 | This file contains wireless extension handlers. | 2 | This file contains wireless extension handlers. |
3 | 3 | ||
4 | This is part of rtl8180 OpenSource driver. | 4 | This is part of rtl8180 OpenSource driver. |
5 | Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> | 5 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
6 | Released under the terms of GPL (General Public Licence) | 6 | Released under the terms of GPL (General Public Licence) |
7 | 7 | ||
8 | Parts of this driver are based on the GPL part | 8 | Parts of this driver are based on the GPL part |
diff --git a/drivers/staging/rtl8192u/r8192U_wx.h b/drivers/staging/rtl8192u/r8192U_wx.h index 9f6b10505426..ae7a617740a3 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.h +++ b/drivers/staging/rtl8192u/r8192U_wx.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This is part of rtl8180 OpenSource driver - v 0.3 | 2 | This is part of rtl8180 OpenSource driver - v 0.3 |
3 | Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> | 3 | Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> |
4 | Released under the terms of GPL (General Public Licence) | 4 | Released under the terms of GPL (General Public Licence) |
5 | 5 | ||
6 | Parts of this driver are based on the GPL part of the official realtek driver | 6 | Parts of this driver are based on the GPL part of the official realtek driver |
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index 57a08c5771f2..8acff44a9e75 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c | |||
@@ -86,7 +86,7 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) | |||
86 | 86 | ||
87 | apdev_priv = netdev_priv(pDevice->apdev); | 87 | apdev_priv = netdev_priv(pDevice->apdev); |
88 | *apdev_priv = *pDevice; | 88 | *apdev_priv = *pDevice; |
89 | memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN); | 89 | eth_hw_addr_inherit(pDevice->apdev, dev); |
90 | 90 | ||
91 | pDevice->apdev->netdev_ops = &apdev_netdev_ops; | 91 | pDevice->apdev->netdev_ops = &apdev_netdev_ops; |
92 | 92 | ||
diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c index 46e0e41e7e60..b5cd2e44e53d 100644 --- a/drivers/staging/vt6655/ioctl.c +++ b/drivers/staging/vt6655/ioctl.c | |||
@@ -460,7 +460,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) | |||
460 | } | 460 | } |
461 | if (sValue.dwValue == 1) { | 461 | if (sValue.dwValue == 1) { |
462 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); | 462 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); |
463 | memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, ETH_ALEN); | 463 | eth_hw_addr_inherit(pDevice->wpadev, pDevice->dev); |
464 | pDevice->bWPADEVUp = true; | 464 | pDevice->bWPADEVUp = true; |
465 | } else { | 465 | } else { |
466 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n"); | 466 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n"); |
diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index 869f62c678e6..e8d9ecd2913a 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c | |||
@@ -96,7 +96,7 @@ static int wpa_init_wpadev(PSDevice pDevice) | |||
96 | 96 | ||
97 | wpadev_priv = netdev_priv(pDevice->wpadev); | 97 | wpadev_priv = netdev_priv(pDevice->wpadev); |
98 | *wpadev_priv = *pDevice; | 98 | *wpadev_priv = *pDevice; |
99 | memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, ETH_ALEN); | 99 | eth_hw_addr_inherit(pDevice->wpadev, dev); |
100 | pDevice->wpadev->base_addr = dev->base_addr; | 100 | pDevice->wpadev->base_addr = dev->base_addr; |
101 | pDevice->wpadev->irq = dev->irq; | 101 | pDevice->wpadev->irq = dev->irq; |
102 | pDevice->wpadev->mem_start = dev->mem_start; | 102 | pDevice->wpadev->mem_start = dev->mem_start; |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 969a85960e9f..831eb4fd197d 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -276,12 +276,12 @@ static void copy_iovec_hdr(const struct iovec *from, struct iovec *to, | |||
276 | * of used idx. Once lower device DMA done contiguously, we will signal KVM | 276 | * of used idx. Once lower device DMA done contiguously, we will signal KVM |
277 | * guest used idx. | 277 | * guest used idx. |
278 | */ | 278 | */ |
279 | static int vhost_zerocopy_signal_used(struct vhost_net *net, | 279 | static void vhost_zerocopy_signal_used(struct vhost_net *net, |
280 | struct vhost_virtqueue *vq) | 280 | struct vhost_virtqueue *vq) |
281 | { | 281 | { |
282 | struct vhost_net_virtqueue *nvq = | 282 | struct vhost_net_virtqueue *nvq = |
283 | container_of(vq, struct vhost_net_virtqueue, vq); | 283 | container_of(vq, struct vhost_net_virtqueue, vq); |
284 | int i; | 284 | int i, add; |
285 | int j = 0; | 285 | int j = 0; |
286 | 286 | ||
287 | for (i = nvq->done_idx; i != nvq->upend_idx; i = (i + 1) % UIO_MAXIOV) { | 287 | for (i = nvq->done_idx; i != nvq->upend_idx; i = (i + 1) % UIO_MAXIOV) { |
@@ -289,15 +289,17 @@ static int vhost_zerocopy_signal_used(struct vhost_net *net, | |||
289 | vhost_net_tx_err(net); | 289 | vhost_net_tx_err(net); |
290 | if (VHOST_DMA_IS_DONE(vq->heads[i].len)) { | 290 | if (VHOST_DMA_IS_DONE(vq->heads[i].len)) { |
291 | vq->heads[i].len = VHOST_DMA_CLEAR_LEN; | 291 | vq->heads[i].len = VHOST_DMA_CLEAR_LEN; |
292 | vhost_add_used_and_signal(vq->dev, vq, | ||
293 | vq->heads[i].id, 0); | ||
294 | ++j; | 292 | ++j; |
295 | } else | 293 | } else |
296 | break; | 294 | break; |
297 | } | 295 | } |
298 | if (j) | 296 | while (j) { |
299 | nvq->done_idx = i; | 297 | add = min(UIO_MAXIOV - nvq->done_idx, j); |
300 | return j; | 298 | vhost_add_used_and_signal_n(vq->dev, vq, |
299 | &vq->heads[nvq->done_idx], add); | ||
300 | nvq->done_idx = (nvq->done_idx + add) % UIO_MAXIOV; | ||
301 | j -= add; | ||
302 | } | ||
301 | } | 303 | } |
302 | 304 | ||
303 | static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success) | 305 | static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success) |
@@ -306,6 +308,11 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success) | |||
306 | struct vhost_virtqueue *vq = ubufs->vq; | 308 | struct vhost_virtqueue *vq = ubufs->vq; |
307 | int cnt = atomic_read(&ubufs->kref.refcount); | 309 | int cnt = atomic_read(&ubufs->kref.refcount); |
308 | 310 | ||
311 | /* set len to mark this desc buffers done DMA */ | ||
312 | vq->heads[ubuf->desc].len = success ? | ||
313 | VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN; | ||
314 | vhost_net_ubuf_put(ubufs); | ||
315 | |||
309 | /* | 316 | /* |
310 | * Trigger polling thread if guest stopped submitting new buffers: | 317 | * Trigger polling thread if guest stopped submitting new buffers: |
311 | * in this case, the refcount after decrement will eventually reach 1 | 318 | * in this case, the refcount after decrement will eventually reach 1 |
@@ -316,10 +323,6 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success) | |||
316 | */ | 323 | */ |
317 | if (cnt <= 2 || !(cnt % 16)) | 324 | if (cnt <= 2 || !(cnt % 16)) |
318 | vhost_poll_queue(&vq->poll); | 325 | vhost_poll_queue(&vq->poll); |
319 | /* set len to mark this desc buffers done DMA */ | ||
320 | vq->heads[ubuf->desc].len = success ? | ||
321 | VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN; | ||
322 | vhost_net_ubuf_put(ubufs); | ||
323 | } | 326 | } |
324 | 327 | ||
325 | /* Expects to be always run from workqueue - which acts as | 328 | /* Expects to be always run from workqueue - which acts as |
@@ -360,6 +363,13 @@ static void handle_tx(struct vhost_net *net) | |||
360 | if (zcopy) | 363 | if (zcopy) |
361 | vhost_zerocopy_signal_used(net, vq); | 364 | vhost_zerocopy_signal_used(net, vq); |
362 | 365 | ||
366 | /* If more outstanding DMAs, queue the work. | ||
367 | * Handle upend_idx wrap around | ||
368 | */ | ||
369 | if (unlikely((nvq->upend_idx + vq->num - VHOST_MAX_PEND) | ||
370 | % UIO_MAXIOV == nvq->done_idx)) | ||
371 | break; | ||
372 | |||
363 | head = vhost_get_vq_desc(&net->dev, vq, vq->iov, | 373 | head = vhost_get_vq_desc(&net->dev, vq, vq->iov, |
364 | ARRAY_SIZE(vq->iov), | 374 | ARRAY_SIZE(vq->iov), |
365 | &out, &in, | 375 | &out, &in, |
@@ -369,17 +379,6 @@ static void handle_tx(struct vhost_net *net) | |||
369 | break; | 379 | break; |
370 | /* Nothing new? Wait for eventfd to tell us they refilled. */ | 380 | /* Nothing new? Wait for eventfd to tell us they refilled. */ |
371 | if (head == vq->num) { | 381 | if (head == vq->num) { |
372 | int num_pends; | ||
373 | |||
374 | /* If more outstanding DMAs, queue the work. | ||
375 | * Handle upend_idx wrap around | ||
376 | */ | ||
377 | num_pends = likely(nvq->upend_idx >= nvq->done_idx) ? | ||
378 | (nvq->upend_idx - nvq->done_idx) : | ||
379 | (nvq->upend_idx + UIO_MAXIOV - | ||
380 | nvq->done_idx); | ||
381 | if (unlikely(num_pends > VHOST_MAX_PEND)) | ||
382 | break; | ||
383 | if (unlikely(vhost_enable_notify(&net->dev, vq))) { | 382 | if (unlikely(vhost_enable_notify(&net->dev, vq))) { |
384 | vhost_disable_notify(&net->dev, vq); | 383 | vhost_disable_notify(&net->dev, vq); |
385 | continue; | 384 | continue; |
@@ -402,43 +401,36 @@ static void handle_tx(struct vhost_net *net) | |||
402 | iov_length(nvq->hdr, s), hdr_size); | 401 | iov_length(nvq->hdr, s), hdr_size); |
403 | break; | 402 | break; |
404 | } | 403 | } |
405 | zcopy_used = zcopy && (len >= VHOST_GOODCOPY_LEN || | 404 | |
406 | nvq->upend_idx != nvq->done_idx); | 405 | zcopy_used = zcopy && len >= VHOST_GOODCOPY_LEN |
406 | && (nvq->upend_idx + 1) % UIO_MAXIOV != | ||
407 | nvq->done_idx | ||
408 | && vhost_net_tx_select_zcopy(net); | ||
407 | 409 | ||
408 | /* use msg_control to pass vhost zerocopy ubuf info to skb */ | 410 | /* use msg_control to pass vhost zerocopy ubuf info to skb */ |
409 | if (zcopy_used) { | 411 | if (zcopy_used) { |
412 | struct ubuf_info *ubuf; | ||
413 | ubuf = nvq->ubuf_info + nvq->upend_idx; | ||
414 | |||
410 | vq->heads[nvq->upend_idx].id = head; | 415 | vq->heads[nvq->upend_idx].id = head; |
411 | if (!vhost_net_tx_select_zcopy(net) || | 416 | vq->heads[nvq->upend_idx].len = VHOST_DMA_IN_PROGRESS; |
412 | len < VHOST_GOODCOPY_LEN) { | 417 | ubuf->callback = vhost_zerocopy_callback; |
413 | /* copy don't need to wait for DMA done */ | 418 | ubuf->ctx = nvq->ubufs; |
414 | vq->heads[nvq->upend_idx].len = | 419 | ubuf->desc = nvq->upend_idx; |
415 | VHOST_DMA_DONE_LEN; | 420 | msg.msg_control = ubuf; |
416 | msg.msg_control = NULL; | 421 | msg.msg_controllen = sizeof(ubuf); |
417 | msg.msg_controllen = 0; | 422 | ubufs = nvq->ubufs; |
418 | ubufs = NULL; | 423 | kref_get(&ubufs->kref); |
419 | } else { | ||
420 | struct ubuf_info *ubuf; | ||
421 | ubuf = nvq->ubuf_info + nvq->upend_idx; | ||
422 | |||
423 | vq->heads[nvq->upend_idx].len = | ||
424 | VHOST_DMA_IN_PROGRESS; | ||
425 | ubuf->callback = vhost_zerocopy_callback; | ||
426 | ubuf->ctx = nvq->ubufs; | ||
427 | ubuf->desc = nvq->upend_idx; | ||
428 | msg.msg_control = ubuf; | ||
429 | msg.msg_controllen = sizeof(ubuf); | ||
430 | ubufs = nvq->ubufs; | ||
431 | kref_get(&ubufs->kref); | ||
432 | } | ||
433 | nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV; | 424 | nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV; |
434 | } else | 425 | } else { |
435 | msg.msg_control = NULL; | 426 | msg.msg_control = NULL; |
427 | ubufs = NULL; | ||
428 | } | ||
436 | /* TODO: Check specific error and bomb out unless ENOBUFS? */ | 429 | /* TODO: Check specific error and bomb out unless ENOBUFS? */ |
437 | err = sock->ops->sendmsg(NULL, sock, &msg, len); | 430 | err = sock->ops->sendmsg(NULL, sock, &msg, len); |
438 | if (unlikely(err < 0)) { | 431 | if (unlikely(err < 0)) { |
439 | if (zcopy_used) { | 432 | if (zcopy_used) { |
440 | if (ubufs) | 433 | vhost_net_ubuf_put(ubufs); |
441 | vhost_net_ubuf_put(ubufs); | ||
442 | nvq->upend_idx = ((unsigned)nvq->upend_idx - 1) | 434 | nvq->upend_idx = ((unsigned)nvq->upend_idx - 1) |
443 | % UIO_MAXIOV; | 435 | % UIO_MAXIOV; |
444 | } | 436 | } |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 448efe01f18a..9a9502a4aa50 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -1332,48 +1332,9 @@ EXPORT_SYMBOL_GPL(vhost_discard_vq_desc); | |||
1332 | * want to notify the guest, using eventfd. */ | 1332 | * want to notify the guest, using eventfd. */ |
1333 | int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) | 1333 | int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) |
1334 | { | 1334 | { |
1335 | struct vring_used_elem __user *used; | 1335 | struct vring_used_elem heads = { head, len }; |
1336 | 1336 | ||
1337 | /* The virtqueue contains a ring of used buffers. Get a pointer to the | 1337 | return vhost_add_used_n(vq, &heads, 1); |
1338 | * next entry in that used ring. */ | ||
1339 | used = &vq->used->ring[vq->last_used_idx % vq->num]; | ||
1340 | if (__put_user(head, &used->id)) { | ||
1341 | vq_err(vq, "Failed to write used id"); | ||
1342 | return -EFAULT; | ||
1343 | } | ||
1344 | if (__put_user(len, &used->len)) { | ||
1345 | vq_err(vq, "Failed to write used len"); | ||
1346 | return -EFAULT; | ||
1347 | } | ||
1348 | /* Make sure buffer is written before we update index. */ | ||
1349 | smp_wmb(); | ||
1350 | if (__put_user(vq->last_used_idx + 1, &vq->used->idx)) { | ||
1351 | vq_err(vq, "Failed to increment used idx"); | ||
1352 | return -EFAULT; | ||
1353 | } | ||
1354 | if (unlikely(vq->log_used)) { | ||
1355 | /* Make sure data is seen before log. */ | ||
1356 | smp_wmb(); | ||
1357 | /* Log used ring entry write. */ | ||
1358 | log_write(vq->log_base, | ||
1359 | vq->log_addr + | ||
1360 | ((void __user *)used - (void __user *)vq->used), | ||
1361 | sizeof *used); | ||
1362 | /* Log used index update. */ | ||
1363 | log_write(vq->log_base, | ||
1364 | vq->log_addr + offsetof(struct vring_used, idx), | ||
1365 | sizeof vq->used->idx); | ||
1366 | if (vq->log_ctx) | ||
1367 | eventfd_signal(vq->log_ctx, 1); | ||
1368 | } | ||
1369 | vq->last_used_idx++; | ||
1370 | /* If the driver never bothers to signal in a very long while, | ||
1371 | * used index might wrap around. If that happens, invalidate | ||
1372 | * signalled_used index we stored. TODO: make sure driver | ||
1373 | * signals at least once in 2^16 and remove this. */ | ||
1374 | if (unlikely(vq->last_used_idx == vq->signalled_used)) | ||
1375 | vq->signalled_used_valid = false; | ||
1376 | return 0; | ||
1377 | } | 1338 | } |
1378 | EXPORT_SYMBOL_GPL(vhost_add_used); | 1339 | EXPORT_SYMBOL_GPL(vhost_add_used); |
1379 | 1340 | ||
@@ -1387,7 +1348,16 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq, | |||
1387 | 1348 | ||
1388 | start = vq->last_used_idx % vq->num; | 1349 | start = vq->last_used_idx % vq->num; |
1389 | used = vq->used->ring + start; | 1350 | used = vq->used->ring + start; |
1390 | if (__copy_to_user(used, heads, count * sizeof *used)) { | 1351 | if (count == 1) { |
1352 | if (__put_user(heads[0].id, &used->id)) { | ||
1353 | vq_err(vq, "Failed to write used id"); | ||
1354 | return -EFAULT; | ||
1355 | } | ||
1356 | if (__put_user(heads[0].len, &used->len)) { | ||
1357 | vq_err(vq, "Failed to write used len"); | ||
1358 | return -EFAULT; | ||
1359 | } | ||
1360 | } else if (__copy_to_user(used, heads, count * sizeof *used)) { | ||
1391 | vq_err(vq, "Failed to write used"); | 1361 | vq_err(vq, "Failed to write used"); |
1392 | return -EFAULT; | 1362 | return -EFAULT; |
1393 | } | 1363 | } |
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h index 424760f01b9d..d66033f418c9 100644 --- a/include/linux/bcma/bcma_driver_pci.h +++ b/include/linux/bcma/bcma_driver_pci.h | |||
@@ -181,10 +181,31 @@ struct pci_dev; | |||
181 | 181 | ||
182 | #define BCMA_CORE_PCI_CFG_DEVCTRL 0xd8 | 182 | #define BCMA_CORE_PCI_CFG_DEVCTRL 0xd8 |
183 | 183 | ||
184 | #define BCMA_CORE_PCI_ | ||
185 | |||
186 | /* MDIO devices (SERDES modules) */ | ||
187 | #define BCMA_CORE_PCI_MDIO_IEEE0 0x000 | ||
188 | #define BCMA_CORE_PCI_MDIO_IEEE1 0x001 | ||
189 | #define BCMA_CORE_PCI_MDIO_BLK0 0x800 | ||
190 | #define BCMA_CORE_PCI_MDIO_BLK1 0x801 | ||
191 | #define BCMA_CORE_PCI_MDIO_BLK1_MGMT0 0x16 | ||
192 | #define BCMA_CORE_PCI_MDIO_BLK1_MGMT1 0x17 | ||
193 | #define BCMA_CORE_PCI_MDIO_BLK1_MGMT2 0x18 | ||
194 | #define BCMA_CORE_PCI_MDIO_BLK1_MGMT3 0x19 | ||
195 | #define BCMA_CORE_PCI_MDIO_BLK1_MGMT4 0x1A | ||
196 | #define BCMA_CORE_PCI_MDIO_BLK2 0x802 | ||
197 | #define BCMA_CORE_PCI_MDIO_BLK3 0x803 | ||
198 | #define BCMA_CORE_PCI_MDIO_BLK4 0x804 | ||
199 | #define BCMA_CORE_PCI_MDIO_TXPLL 0x808 /* TXPLL register block idx */ | ||
200 | #define BCMA_CORE_PCI_MDIO_TXCTRL0 0x820 | ||
201 | #define BCMA_CORE_PCI_MDIO_SERDESID 0x831 | ||
202 | #define BCMA_CORE_PCI_MDIO_RXCTRL0 0x840 | ||
203 | |||
184 | /* PCIE Root Capability Register bits (Host mode only) */ | 204 | /* PCIE Root Capability Register bits (Host mode only) */ |
185 | #define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 | 205 | #define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 |
186 | 206 | ||
187 | struct bcma_drv_pci; | 207 | struct bcma_drv_pci; |
208 | struct bcma_bus; | ||
188 | 209 | ||
189 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | 210 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE |
190 | struct bcma_drv_pci_host { | 211 | struct bcma_drv_pci_host { |
@@ -219,7 +240,8 @@ struct bcma_drv_pci { | |||
219 | extern void bcma_core_pci_init(struct bcma_drv_pci *pc); | 240 | extern void bcma_core_pci_init(struct bcma_drv_pci *pc); |
220 | extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, | 241 | extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, |
221 | struct bcma_device *core, bool enable); | 242 | struct bcma_device *core, bool enable); |
222 | extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend); | 243 | extern void bcma_core_pci_up(struct bcma_bus *bus); |
244 | extern void bcma_core_pci_down(struct bcma_bus *bus); | ||
223 | 245 | ||
224 | extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); | 246 | extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); |
225 | extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); | 247 | extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index c623861964e4..d8b512496e50 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -199,6 +199,21 @@ static inline void eth_hw_addr_random(struct net_device *dev) | |||
199 | } | 199 | } |
200 | 200 | ||
201 | /** | 201 | /** |
202 | * eth_hw_addr_inherit - Copy dev_addr from another net_device | ||
203 | * @dst: pointer to net_device to copy dev_addr to | ||
204 | * @src: pointer to net_device to copy dev_addr from | ||
205 | * | ||
206 | * Copy the Ethernet address from one net_device to another along with | ||
207 | * the address attributes (addr_assign_type). | ||
208 | */ | ||
209 | static inline void eth_hw_addr_inherit(struct net_device *dst, | ||
210 | struct net_device *src) | ||
211 | { | ||
212 | dst->addr_assign_type = src->addr_assign_type; | ||
213 | memcpy(dst->dev_addr, src->dev_addr, ETH_ALEN); | ||
214 | } | ||
215 | |||
216 | /** | ||
202 | * compare_ether_addr - Compare two Ethernet addresses | 217 | * compare_ether_addr - Compare two Ethernet addresses |
203 | * @addr1: Pointer to a six-byte array containing the Ethernet address | 218 | * @addr1: Pointer to a six-byte array containing the Ethernet address |
204 | * @addr2: Pointer other six-byte array containing the Ethernet address | 219 | * @addr2: Pointer other six-byte array containing the Ethernet address |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 8def09e55f0c..a5b598a79bec 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -2289,4 +2289,8 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim, | |||
2289 | return !!(tim->virtual_map[index] & mask); | 2289 | return !!(tim->virtual_map[index] & mask); |
2290 | } | 2290 | } |
2291 | 2291 | ||
2292 | /* convert time units */ | ||
2293 | #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) | ||
2294 | #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) | ||
2295 | |||
2292 | #endif /* LINUX_IEEE80211_H */ | 2296 | #endif /* LINUX_IEEE80211_H */ |
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h index b7174998c24a..e75dcbf2b230 100644 --- a/include/linux/platform_data/brcmfmac-sdio.h +++ b/include/linux/platform_data/brcmfmac-sdio.h | |||
@@ -94,6 +94,10 @@ void __init brcmfmac_init_pdata(void) | |||
94 | * Set this to true if the SDIO host controller has higher align requirement | 94 | * Set this to true if the SDIO host controller has higher align requirement |
95 | * than 32 bytes for each scatterlist item. | 95 | * than 32 bytes for each scatterlist item. |
96 | * | 96 | * |
97 | * sd_head_align: alignment requirement for start of data buffer | ||
98 | * | ||
99 | * sd_sgentry_align: length alignment requirement for each sg entry | ||
100 | * | ||
97 | * power_on: This function is called by the brcmfmac when the module gets | 101 | * power_on: This function is called by the brcmfmac when the module gets |
98 | * loaded. This can be particularly useful for low power devices. The platform | 102 | * loaded. This can be particularly useful for low power devices. The platform |
99 | * spcific routine may for example decide to power up the complete device. | 103 | * spcific routine may for example decide to power up the complete device. |
@@ -121,6 +125,8 @@ struct brcmfmac_sdio_platform_data { | |||
121 | unsigned int oob_irq_nr; | 125 | unsigned int oob_irq_nr; |
122 | unsigned long oob_irq_flags; | 126 | unsigned long oob_irq_flags; |
123 | bool broken_sg_support; | 127 | bool broken_sg_support; |
128 | unsigned short sd_head_align; | ||
129 | unsigned short sd_sgentry_align; | ||
124 | void (*power_on)(void); | 130 | void (*power_on)(void); |
125 | void (*power_off)(void); | 131 | void (*power_off)(void); |
126 | void (*reset)(void); | 132 | void (*reset)(void); |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5ac96f31d546..2ddb48d9312c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1905,8 +1905,8 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, | |||
1905 | return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC); | 1905 | return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC); |
1906 | } | 1906 | } |
1907 | 1907 | ||
1908 | /* | 1908 | /** |
1909 | * __skb_alloc_page - allocate pages for ps-rx on a skb and preserve pfmemalloc data | 1909 | * __skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data |
1910 | * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX | 1910 | * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX |
1911 | * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used | 1911 | * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used |
1912 | * @order: size of the allocation | 1912 | * @order: size of the allocation |
@@ -2392,7 +2392,7 @@ extern void skb_split(struct sk_buff *skb, | |||
2392 | struct sk_buff *skb1, const u32 len); | 2392 | struct sk_buff *skb1, const u32 len); |
2393 | extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, | 2393 | extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, |
2394 | int shiftlen); | 2394 | int shiftlen); |
2395 | extern void skb_scrub_packet(struct sk_buff *skb); | 2395 | extern void skb_scrub_packet(struct sk_buff *skb, bool xnet); |
2396 | 2396 | ||
2397 | extern struct sk_buff *skb_segment(struct sk_buff *skb, | 2397 | extern struct sk_buff *skb_segment(struct sk_buff *skb, |
2398 | netdev_features_t features); | 2398 | netdev_features_t features); |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 10eb9b389014..10d43d8c7037 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -107,6 +107,14 @@ struct bt_power { | |||
107 | */ | 107 | */ |
108 | #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 | 108 | #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 |
109 | 109 | ||
110 | #define BT_VOICE 11 | ||
111 | struct bt_voice { | ||
112 | __u16 setting; | ||
113 | }; | ||
114 | |||
115 | #define BT_VOICE_TRANSPARENT 0x0003 | ||
116 | #define BT_VOICE_CVSD_16BIT 0x0060 | ||
117 | |||
110 | __printf(1, 2) | 118 | __printf(1, 2) |
111 | int bt_info(const char *fmt, ...); | 119 | int bt_info(const char *fmt, ...); |
112 | __printf(1, 2) | 120 | __printf(1, 2) |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 3c592cf473da..aaeaf0938ec0 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -238,6 +238,7 @@ enum { | |||
238 | #define LMP_CVSD 0x01 | 238 | #define LMP_CVSD 0x01 |
239 | #define LMP_PSCHEME 0x02 | 239 | #define LMP_PSCHEME 0x02 |
240 | #define LMP_PCONTROL 0x04 | 240 | #define LMP_PCONTROL 0x04 |
241 | #define LMP_TRANSPARENT 0x08 | ||
241 | 242 | ||
242 | #define LMP_RSSI_INQ 0x40 | 243 | #define LMP_RSSI_INQ 0x40 |
243 | #define LMP_ESCO 0x80 | 244 | #define LMP_ESCO 0x80 |
@@ -296,6 +297,12 @@ enum { | |||
296 | #define HCI_AT_GENERAL_BONDING 0x04 | 297 | #define HCI_AT_GENERAL_BONDING 0x04 |
297 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 | 298 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 |
298 | 299 | ||
300 | /* I/O capabilities */ | ||
301 | #define HCI_IO_DISPLAY_ONLY 0x00 | ||
302 | #define HCI_IO_DISPLAY_YESNO 0x01 | ||
303 | #define HCI_IO_KEYBOARD_ONLY 0x02 | ||
304 | #define HCI_IO_NO_INPUT_OUTPUT 0x03 | ||
305 | |||
299 | /* Link Key types */ | 306 | /* Link Key types */ |
300 | #define HCI_LK_COMBINATION 0x00 | 307 | #define HCI_LK_COMBINATION 0x00 |
301 | #define HCI_LK_LOCAL_UNIT 0x01 | 308 | #define HCI_LK_LOCAL_UNIT 0x01 |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index f77885ea78c2..3ede820d328f 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -320,6 +320,7 @@ struct hci_conn { | |||
320 | __u32 passkey_notify; | 320 | __u32 passkey_notify; |
321 | __u8 passkey_entered; | 321 | __u8 passkey_entered; |
322 | __u16 disc_timeout; | 322 | __u16 disc_timeout; |
323 | __u16 setting; | ||
323 | unsigned long flags; | 324 | unsigned long flags; |
324 | 325 | ||
325 | __u8 remote_cap; | 326 | __u8 remote_cap; |
@@ -569,7 +570,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | |||
569 | } | 570 | } |
570 | 571 | ||
571 | void hci_disconnect(struct hci_conn *conn, __u8 reason); | 572 | void hci_disconnect(struct hci_conn *conn, __u8 reason); |
572 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); | 573 | bool hci_setup_sync(struct hci_conn *conn, __u16 handle); |
573 | void hci_sco_setup(struct hci_conn *conn, __u8 status); | 574 | void hci_sco_setup(struct hci_conn *conn, __u8 status); |
574 | 575 | ||
575 | struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); | 576 | struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); |
@@ -584,6 +585,8 @@ struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); | |||
584 | 585 | ||
585 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, | 586 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, |
586 | __u8 dst_type, __u8 sec_level, __u8 auth_type); | 587 | __u8 dst_type, __u8 sec_level, __u8 auth_type); |
588 | struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, | ||
589 | __u16 setting); | ||
587 | int hci_conn_check_link_mode(struct hci_conn *conn); | 590 | int hci_conn_check_link_mode(struct hci_conn *conn); |
588 | int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); | 591 | int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); |
589 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); | 592 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); |
@@ -797,6 +800,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
797 | #define lmp_lsto_capable(dev) ((dev)->features[0][7] & LMP_LSTO) | 800 | #define lmp_lsto_capable(dev) ((dev)->features[0][7] & LMP_LSTO) |
798 | #define lmp_inq_tx_pwr_capable(dev) ((dev)->features[0][7] & LMP_INQ_TX_PWR) | 801 | #define lmp_inq_tx_pwr_capable(dev) ((dev)->features[0][7] & LMP_INQ_TX_PWR) |
799 | #define lmp_ext_feat_capable(dev) ((dev)->features[0][7] & LMP_EXTFEATURES) | 802 | #define lmp_ext_feat_capable(dev) ((dev)->features[0][7] & LMP_EXTFEATURES) |
803 | #define lmp_transp_capable(dev) ((dev)->features[0][2] & LMP_TRANSPARENT) | ||
800 | 804 | ||
801 | /* ----- Extended LMP capabilities ----- */ | 805 | /* ----- Extended LMP capabilities ----- */ |
802 | #define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) | 806 | #define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) |
@@ -1213,4 +1217,8 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], | |||
1213 | 1217 | ||
1214 | u8 bdaddr_to_le(u8 bdaddr_type); | 1218 | u8 bdaddr_to_le(u8 bdaddr_type); |
1215 | 1219 | ||
1220 | #define SCO_AIRMODE_MASK 0x0003 | ||
1221 | #define SCO_AIRMODE_CVSD 0x0000 | ||
1222 | #define SCO_AIRMODE_TRANSP 0x0003 | ||
1223 | |||
1216 | #endif /* __HCI_CORE_H */ | 1224 | #endif /* __HCI_CORE_H */ |
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h index 1e35c43657c8..e252a31ee6b6 100644 --- a/include/net/bluetooth/sco.h +++ b/include/net/bluetooth/sco.h | |||
@@ -73,6 +73,7 @@ struct sco_conn { | |||
73 | struct sco_pinfo { | 73 | struct sco_pinfo { |
74 | struct bt_sock bt; | 74 | struct bt_sock bt; |
75 | __u32 flags; | 75 | __u32 flags; |
76 | __u16 setting; | ||
76 | struct sco_conn *conn; | 77 | struct sco_conn *conn; |
77 | }; | 78 | }; |
78 | 79 | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 635e396b25b2..cb710913d5c8 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -2081,7 +2081,7 @@ struct cfg80211_update_ft_ies_params { | |||
2081 | * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management | 2081 | * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management |
2082 | * frame on another channel | 2082 | * frame on another channel |
2083 | * | 2083 | * |
2084 | * @testmode_cmd: run a test mode command | 2084 | * @testmode_cmd: run a test mode command; @wdev may be %NULL |
2085 | * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be | 2085 | * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be |
2086 | * used by the function, but 0 and 1 must not be touched. Additionally, | 2086 | * used by the function, but 0 and 1 must not be touched. Additionally, |
2087 | * return error codes other than -ENOBUFS and -ENOENT will terminate the | 2087 | * return error codes other than -ENOBUFS and -ENOENT will terminate the |
@@ -2290,7 +2290,8 @@ struct cfg80211_ops { | |||
2290 | void (*rfkill_poll)(struct wiphy *wiphy); | 2290 | void (*rfkill_poll)(struct wiphy *wiphy); |
2291 | 2291 | ||
2292 | #ifdef CONFIG_NL80211_TESTMODE | 2292 | #ifdef CONFIG_NL80211_TESTMODE |
2293 | int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); | 2293 | int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, |
2294 | void *data, int len); | ||
2294 | int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, | 2295 | int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, |
2295 | struct netlink_callback *cb, | 2296 | struct netlink_callback *cb, |
2296 | void *data, int len); | 2297 | void *data, int len); |
@@ -4055,6 +4056,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, | |||
4055 | * @sig_dbm: signal strength in mBm, or 0 if unknown | 4056 | * @sig_dbm: signal strength in mBm, or 0 if unknown |
4056 | * @buf: Management frame (header + body) | 4057 | * @buf: Management frame (header + body) |
4057 | * @len: length of the frame data | 4058 | * @len: length of the frame data |
4059 | * @flags: flags, as defined in enum nl80211_rxmgmt_flags | ||
4058 | * @gfp: context flags | 4060 | * @gfp: context flags |
4059 | * | 4061 | * |
4060 | * This function is called whenever an Action frame is received for a station | 4062 | * This function is called whenever an Action frame is received for a station |
@@ -4066,7 +4068,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, | |||
4066 | * driver is responsible for rejecting the frame. | 4068 | * driver is responsible for rejecting the frame. |
4067 | */ | 4069 | */ |
4068 | bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, | 4070 | bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, |
4069 | const u8 *buf, size_t len, gfp_t gfp); | 4071 | const u8 *buf, size_t len, u32 flags, gfp_t gfp); |
4070 | 4072 | ||
4071 | /** | 4073 | /** |
4072 | * cfg80211_mgmt_tx_status - notification of TX status for management frame | 4074 | * cfg80211_mgmt_tx_status - notification of TX status for management frame |
diff --git a/include/net/dst.h b/include/net/dst.h index 1f8fd109e225..3bc4865f8267 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -311,11 +311,13 @@ static inline void skb_dst_force(struct sk_buff *skb) | |||
311 | * __skb_tunnel_rx - prepare skb for rx reinsert | 311 | * __skb_tunnel_rx - prepare skb for rx reinsert |
312 | * @skb: buffer | 312 | * @skb: buffer |
313 | * @dev: tunnel device | 313 | * @dev: tunnel device |
314 | * @net: netns for packet i/o | ||
314 | * | 315 | * |
315 | * After decapsulation, packet is going to re-enter (netif_rx()) our stack, | 316 | * After decapsulation, packet is going to re-enter (netif_rx()) our stack, |
316 | * so make some cleanups. (no accounting done) | 317 | * so make some cleanups. (no accounting done) |
317 | */ | 318 | */ |
318 | static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) | 319 | static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev, |
320 | struct net *net) | ||
319 | { | 321 | { |
320 | skb->dev = dev; | 322 | skb->dev = dev; |
321 | 323 | ||
@@ -327,8 +329,7 @@ static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) | |||
327 | if (!skb->l4_rxhash) | 329 | if (!skb->l4_rxhash) |
328 | skb->rxhash = 0; | 330 | skb->rxhash = 0; |
329 | skb_set_queue_mapping(skb, 0); | 331 | skb_set_queue_mapping(skb, 0); |
330 | skb_dst_drop(skb); | 332 | skb_scrub_packet(skb, !net_eq(net, dev_net(dev))); |
331 | nf_reset(skb); | ||
332 | } | 333 | } |
333 | 334 | ||
334 | /** | 335 | /** |
@@ -340,12 +341,13 @@ static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) | |||
340 | * so make some cleanups, and perform accounting. | 341 | * so make some cleanups, and perform accounting. |
341 | * Note: this accounting is not SMP safe. | 342 | * Note: this accounting is not SMP safe. |
342 | */ | 343 | */ |
343 | static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) | 344 | static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev, |
345 | struct net *net) | ||
344 | { | 346 | { |
345 | /* TODO : stats should be SMP safe */ | 347 | /* TODO : stats should be SMP safe */ |
346 | dev->stats.rx_packets++; | 348 | dev->stats.rx_packets++; |
347 | dev->stats.rx_bytes += skb->len; | 349 | dev->stats.rx_bytes += skb->len; |
348 | __skb_tunnel_rx(skb, dev); | 350 | __skb_tunnel_rx(skb, dev, net); |
349 | } | 351 | } |
350 | 352 | ||
351 | /* Children define the path of the packet through the | 353 | /* Children define the path of the packet through the |
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index 2265b0bf97e5..6d1549c4893c 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h | |||
@@ -75,7 +75,6 @@ static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
75 | struct net_device_stats *stats = &dev->stats; | 75 | struct net_device_stats *stats = &dev->stats; |
76 | int pkt_len, err; | 76 | int pkt_len, err; |
77 | 77 | ||
78 | nf_reset(skb); | ||
79 | pkt_len = skb->len; | 78 | pkt_len = skb->len; |
80 | err = ip6_local_out(skb); | 79 | err = ip6_local_out(skb); |
81 | 80 | ||
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 0ce316bb3c65..a0a4a100f5c9 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
@@ -146,10 +146,9 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, | |||
146 | } | 146 | } |
147 | 147 | ||
148 | int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); | 148 | int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); |
149 | int iptunnel_xmit(struct net *net, struct rtable *rt, | 149 | int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, |
150 | struct sk_buff *skb, | ||
151 | __be32 src, __be32 dst, __u8 proto, | 150 | __be32 src, __be32 dst, __u8 proto, |
152 | __u8 tos, __u8 ttl, __be16 df); | 151 | __u8 tos, __u8 ttl, __be16 df, bool xnet); |
153 | 152 | ||
154 | static inline void iptunnel_xmit_stats(int err, | 153 | static inline void iptunnel_xmit_stats(int err, |
155 | struct net_device_stats *err_stats, | 154 | struct net_device_stats *err_stats, |
diff --git a/include/net/llc_if.h b/include/net/llc_if.h index b595a004d31b..f0cb909b60eb 100644 --- a/include/net/llc_if.h +++ b/include/net/llc_if.h | |||
@@ -62,36 +62,6 @@ | |||
62 | #define LLC_STATUS_CONFLICT 7 /* disconnect conn */ | 62 | #define LLC_STATUS_CONFLICT 7 /* disconnect conn */ |
63 | #define LLC_STATUS_RESET_DONE 8 /* */ | 63 | #define LLC_STATUS_RESET_DONE 8 /* */ |
64 | 64 | ||
65 | /** | ||
66 | * llc_mac_null - determines if a address is a null mac address | ||
67 | * @mac: Mac address to test if null. | ||
68 | * | ||
69 | * Determines if a given address is a null mac address. Returns 0 if the | ||
70 | * address is not a null mac, 1 if the address is a null mac. | ||
71 | */ | ||
72 | static inline int llc_mac_null(const u8 *mac) | ||
73 | { | ||
74 | return is_zero_ether_addr(mac); | ||
75 | } | ||
76 | |||
77 | static inline int llc_mac_multicast(const u8 *mac) | ||
78 | { | ||
79 | return is_multicast_ether_addr(mac); | ||
80 | } | ||
81 | /** | ||
82 | * llc_mac_match - determines if two mac addresses are the same | ||
83 | * @mac1: First mac address to compare. | ||
84 | * @mac2: Second mac address to compare. | ||
85 | * | ||
86 | * Determines if two given mac address are the same. Returns 0 if there | ||
87 | * is not a complete match up to len, 1 if a complete match up to len is | ||
88 | * found. | ||
89 | */ | ||
90 | static inline int llc_mac_match(const u8 *mac1, const u8 *mac2) | ||
91 | { | ||
92 | return !compare_ether_addr(mac1, mac2); | ||
93 | } | ||
94 | |||
95 | extern int llc_establish_connection(struct sock *sk, u8 *lmac, | 65 | extern int llc_establish_connection(struct sock *sk, u8 *lmac, |
96 | u8 *dmac, u8 dsap); | 66 | u8 *dmac, u8 dsap); |
97 | extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb); | 67 | extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb); |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index ab94dbc331a0..cc6035f1a2f1 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -375,7 +375,7 @@ struct ieee80211_bss_conf { | |||
375 | }; | 375 | }; |
376 | 376 | ||
377 | /** | 377 | /** |
378 | * enum mac80211_tx_control_flags - flags to describe transmission information/status | 378 | * enum mac80211_tx_info_flags - flags to describe transmission information/status |
379 | * | 379 | * |
380 | * These flags are used with the @flags member of &ieee80211_tx_info. | 380 | * These flags are used with the @flags member of &ieee80211_tx_info. |
381 | * | 381 | * |
@@ -471,7 +471,7 @@ struct ieee80211_bss_conf { | |||
471 | * Note: If you have to add new flags to the enumeration, then don't | 471 | * Note: If you have to add new flags to the enumeration, then don't |
472 | * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. | 472 | * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. |
473 | */ | 473 | */ |
474 | enum mac80211_tx_control_flags { | 474 | enum mac80211_tx_info_flags { |
475 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), | 475 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
476 | IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1), | 476 | IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1), |
477 | IEEE80211_TX_CTL_NO_ACK = BIT(2), | 477 | IEEE80211_TX_CTL_NO_ACK = BIT(2), |
@@ -507,6 +507,18 @@ enum mac80211_tx_control_flags { | |||
507 | 507 | ||
508 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 | 508 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 |
509 | 509 | ||
510 | /** | ||
511 | * enum mac80211_tx_control_flags - flags to describe transmit control | ||
512 | * | ||
513 | * @IEEE80211_TX_CTRL_PORT_CTRL_PROTO: this frame is a port control | ||
514 | * protocol frame (e.g. EAP) | ||
515 | * | ||
516 | * These flags are used in tx_info->control.flags. | ||
517 | */ | ||
518 | enum mac80211_tx_control_flags { | ||
519 | IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0), | ||
520 | }; | ||
521 | |||
510 | /* | 522 | /* |
511 | * This definition is used as a mask to clear all temporary flags, which are | 523 | * This definition is used as a mask to clear all temporary flags, which are |
512 | * set by the tx handlers for each transmission attempt by the mac80211 stack. | 524 | * set by the tx handlers for each transmission attempt by the mac80211 stack. |
@@ -680,7 +692,8 @@ struct ieee80211_tx_info { | |||
680 | /* NB: vif can be NULL for injected frames */ | 692 | /* NB: vif can be NULL for injected frames */ |
681 | struct ieee80211_vif *vif; | 693 | struct ieee80211_vif *vif; |
682 | struct ieee80211_key_conf *hw_key; | 694 | struct ieee80211_key_conf *hw_key; |
683 | /* 8 bytes free */ | 695 | u32 flags; |
696 | /* 4 bytes free */ | ||
684 | } control; | 697 | } control; |
685 | struct { | 698 | struct { |
686 | struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; | 699 | struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; |
@@ -1508,6 +1521,7 @@ enum ieee80211_hw_flags { | |||
1508 | IEEE80211_HW_SUPPORTS_RC_TABLE = 1<<24, | 1521 | IEEE80211_HW_SUPPORTS_RC_TABLE = 1<<24, |
1509 | IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, | 1522 | IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, |
1510 | IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, | 1523 | IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, |
1524 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, | ||
1511 | }; | 1525 | }; |
1512 | 1526 | ||
1513 | /** | 1527 | /** |
@@ -2503,8 +2517,8 @@ enum ieee80211_roc_type { | |||
2503 | * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout | 2517 | * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout |
2504 | * accordingly. This callback is not required and may sleep. | 2518 | * accordingly. This callback is not required and may sleep. |
2505 | * | 2519 | * |
2506 | * @testmode_cmd: Implement a cfg80211 test mode command. | 2520 | * @testmode_cmd: Implement a cfg80211 test mode command. The passed @vif may |
2507 | * The callback can sleep. | 2521 | * be %NULL. The callback can sleep. |
2508 | * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. | 2522 | * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. |
2509 | * | 2523 | * |
2510 | * @flush: Flush all pending frames from the hardware queue, making sure | 2524 | * @flush: Flush all pending frames from the hardware queue, making sure |
@@ -2765,7 +2779,8 @@ struct ieee80211_ops { | |||
2765 | void (*rfkill_poll)(struct ieee80211_hw *hw); | 2779 | void (*rfkill_poll)(struct ieee80211_hw *hw); |
2766 | void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); | 2780 | void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); |
2767 | #ifdef CONFIG_NL80211_TESTMODE | 2781 | #ifdef CONFIG_NL80211_TESTMODE |
2768 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); | 2782 | int (*testmode_cmd)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2783 | void *data, int len); | ||
2769 | int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb, | 2784 | int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb, |
2770 | struct netlink_callback *cb, | 2785 | struct netlink_callback *cb, |
2771 | void *data, int len); | 2786 | void *data, int len); |
@@ -3674,6 +3689,89 @@ void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, | |||
3674 | int tid, struct ieee80211_key_seq *seq); | 3689 | int tid, struct ieee80211_key_seq *seq); |
3675 | 3690 | ||
3676 | /** | 3691 | /** |
3692 | * ieee80211_set_key_tx_seq - set key TX sequence counter | ||
3693 | * | ||
3694 | * @keyconf: the parameter passed with the set key | ||
3695 | * @seq: new sequence data | ||
3696 | * | ||
3697 | * This function allows a driver to set the current TX IV/PNs for the | ||
3698 | * given key. This is useful when resuming from WoWLAN sleep and the | ||
3699 | * device may have transmitted frames using the PTK, e.g. replies to | ||
3700 | * ARP requests. | ||
3701 | * | ||
3702 | * Note that this function may only be called when no TX processing | ||
3703 | * can be done concurrently. | ||
3704 | */ | ||
3705 | void ieee80211_set_key_tx_seq(struct ieee80211_key_conf *keyconf, | ||
3706 | struct ieee80211_key_seq *seq); | ||
3707 | |||
3708 | /** | ||
3709 | * ieee80211_set_key_rx_seq - set key RX sequence counter | ||
3710 | * | ||
3711 | * @keyconf: the parameter passed with the set key | ||
3712 | * @tid: The TID, or -1 for the management frame value (CCMP only); | ||
3713 | * the value on TID 0 is also used for non-QoS frames. For | ||
3714 | * CMAC, only TID 0 is valid. | ||
3715 | * @seq: new sequence data | ||
3716 | * | ||
3717 | * This function allows a driver to set the current RX IV/PNs for the | ||
3718 | * given key. This is useful when resuming from WoWLAN sleep and GTK | ||
3719 | * rekey may have been done while suspended. It should not be called | ||
3720 | * if IV checking is done by the device and not by mac80211. | ||
3721 | * | ||
3722 | * Note that this function may only be called when no RX processing | ||
3723 | * can be done concurrently. | ||
3724 | */ | ||
3725 | void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf, | ||
3726 | int tid, struct ieee80211_key_seq *seq); | ||
3727 | |||
3728 | /** | ||
3729 | * ieee80211_remove_key - remove the given key | ||
3730 | * @keyconf: the parameter passed with the set key | ||
3731 | * | ||
3732 | * Remove the given key. If the key was uploaded to the hardware at the | ||
3733 | * time this function is called, it is not deleted in the hardware but | ||
3734 | * instead assumed to have been removed already. | ||
3735 | * | ||
3736 | * Note that due to locking considerations this function can (currently) | ||
3737 | * only be called during key iteration (ieee80211_iter_keys().) | ||
3738 | */ | ||
3739 | void ieee80211_remove_key(struct ieee80211_key_conf *keyconf); | ||
3740 | |||
3741 | /** | ||
3742 | * ieee80211_gtk_rekey_add - add a GTK key from rekeying during WoWLAN | ||
3743 | * @vif: the virtual interface to add the key on | ||
3744 | * @keyconf: new key data | ||
3745 | * | ||
3746 | * When GTK rekeying was done while the system was suspended, (a) new | ||
3747 | * key(s) will be available. These will be needed by mac80211 for proper | ||
3748 | * RX processing, so this function allows setting them. | ||
3749 | * | ||
3750 | * The function returns the newly allocated key structure, which will | ||
3751 | * have similar contents to the passed key configuration but point to | ||
3752 | * mac80211-owned memory. In case of errors, the function returns an | ||
3753 | * ERR_PTR(), use IS_ERR() etc. | ||
3754 | * | ||
3755 | * Note that this function assumes the key isn't added to hardware | ||
3756 | * acceleration, so no TX will be done with the key. Since it's a GTK | ||
3757 | * on managed (station) networks, this is true anyway. If the driver | ||
3758 | * calls this function from the resume callback and subsequently uses | ||
3759 | * the return code 1 to reconfigure the device, this key will be part | ||
3760 | * of the reconfiguration. | ||
3761 | * | ||
3762 | * Note that the driver should also call ieee80211_set_key_rx_seq() | ||
3763 | * for the new key for each TID to set up sequence counters properly. | ||
3764 | * | ||
3765 | * IMPORTANT: If this replaces a key that is present in the hardware, | ||
3766 | * then it will attempt to remove it during this call. In many cases | ||
3767 | * this isn't what you want, so call ieee80211_remove_key() first for | ||
3768 | * the key that's being replaced. | ||
3769 | */ | ||
3770 | struct ieee80211_key_conf * | ||
3771 | ieee80211_gtk_rekey_add(struct ieee80211_vif *vif, | ||
3772 | struct ieee80211_key_conf *keyconf); | ||
3773 | |||
3774 | /** | ||
3677 | * ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying | 3775 | * ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying |
3678 | * @vif: virtual interface the rekeying was done on | 3776 | * @vif: virtual interface the rekeying was done on |
3679 | * @bssid: The BSSID of the AP, for checking association | 3777 | * @bssid: The BSSID of the AP, for checking association |
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 5f286b726bb6..f68ee68e4e3e 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h | |||
@@ -224,6 +224,9 @@ int nfc_set_remote_general_bytes(struct nfc_dev *dev, | |||
224 | u8 *gt, u8 gt_len); | 224 | u8 *gt, u8 gt_len); |
225 | u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, size_t *gb_len); | 225 | u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, size_t *gb_len); |
226 | 226 | ||
227 | int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name, | ||
228 | u32 result); | ||
229 | |||
227 | int nfc_targets_found(struct nfc_dev *dev, | 230 | int nfc_targets_found(struct nfc_dev *dev, |
228 | struct nfc_target *targets, int ntargets); | 231 | struct nfc_target *targets, int ntargets); |
229 | int nfc_target_lost(struct nfc_dev *dev, u32 target_idx); | 232 | int nfc_target_lost(struct nfc_dev *dev, u32 target_idx); |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 6a6a88db462d..b1aa324c5e65 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -371,8 +371,8 @@ extern void tcp_delack_timer_handler(struct sock *sk); | |||
371 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 371 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
372 | extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | 372 | extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, |
373 | const struct tcphdr *th, unsigned int len); | 373 | const struct tcphdr *th, unsigned int len); |
374 | extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | 374 | extern void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
375 | const struct tcphdr *th, unsigned int len); | 375 | const struct tcphdr *th, unsigned int len); |
376 | extern void tcp_rcv_space_adjust(struct sock *sk); | 376 | extern void tcp_rcv_space_adjust(struct sock *sk); |
377 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); | 377 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); |
378 | extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); | 378 | extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); |
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index d2b88cafa7a2..e09c40b68027 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h | |||
@@ -29,7 +29,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, | |||
29 | 29 | ||
30 | void vxlan_sock_release(struct vxlan_sock *vs); | 30 | void vxlan_sock_release(struct vxlan_sock *vs); |
31 | 31 | ||
32 | int vxlan_xmit_skb(struct net *net, struct vxlan_sock *vs, | 32 | int vxlan_xmit_skb(struct vxlan_sock *vs, |
33 | struct rtable *rt, struct sk_buff *skb, | 33 | struct rtable *rt, struct sk_buff *skb, |
34 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, | 34 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, |
35 | __be16 src_port, __be16 dst_port, __be32 vni); | 35 | __be16 src_port, __be16 dst_port, __be32 vni); |
diff --git a/include/uapi/linux/can/gw.h b/include/uapi/linux/can/gw.h index ae07bec74f4b..4e27c82b564a 100644 --- a/include/uapi/linux/can/gw.h +++ b/include/uapi/linux/can/gw.h | |||
@@ -45,6 +45,7 @@ enum { | |||
45 | CGW_DST_IF, /* ifindex of destination network interface */ | 45 | CGW_DST_IF, /* ifindex of destination network interface */ |
46 | CGW_FILTER, /* specify struct can_filter on source CAN device */ | 46 | CGW_FILTER, /* specify struct can_filter on source CAN device */ |
47 | CGW_DELETED, /* number of deleted CAN frames (see max_hops param) */ | 47 | CGW_DELETED, /* number of deleted CAN frames (see max_hops param) */ |
48 | CGW_LIM_HOPS, /* limit the number of hops of this specific rule */ | ||
48 | __CGW_MAX | 49 | __CGW_MAX |
49 | }; | 50 | }; |
50 | 51 | ||
@@ -116,13 +117,19 @@ enum { | |||
116 | * Sets a CAN receive filter for the gateway job specified by the | 117 | * Sets a CAN receive filter for the gateway job specified by the |
117 | * struct can_filter described in include/linux/can.h | 118 | * struct can_filter described in include/linux/can.h |
118 | * | 119 | * |
119 | * CGW_MOD_XXX (length 17 bytes): | 120 | * CGW_MOD_(AND|OR|XOR|SET) (length 17 bytes): |
120 | * Specifies a modification that's done to a received CAN frame before it is | 121 | * Specifies a modification that's done to a received CAN frame before it is |
121 | * send out to the destination interface. | 122 | * send out to the destination interface. |
122 | * | 123 | * |
123 | * <struct can_frame> data used as operator | 124 | * <struct can_frame> data used as operator |
124 | * <u8> affected CAN frame elements | 125 | * <u8> affected CAN frame elements |
125 | * | 126 | * |
127 | * CGW_LIM_HOPS (length 1 byte): | ||
128 | * Limit the number of hops of this specific rule. Usually the received CAN | ||
129 | * frame can be processed as much as 'max_hops' times (which is given at module | ||
130 | * load time of the can-gw module). This value is used to reduce the number of | ||
131 | * possible hops for this gateway rule to a value smaller then max_hops. | ||
132 | * | ||
126 | * CGW_CS_XOR (length 4 bytes): | 133 | * CGW_CS_XOR (length 4 bytes): |
127 | * Set a simple XOR checksum starting with an initial value into | 134 | * Set a simple XOR checksum starting with an initial value into |
128 | * data[result-idx] using data[start-idx] .. data[end-idx] | 135 | * data[result-idx] using data[start-idx] .. data[end-idx] |
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h index 8137dd8d2adf..29bed72a4ac4 100644 --- a/include/uapi/linux/nfc.h +++ b/include/uapi/linux/nfc.h | |||
@@ -71,6 +71,20 @@ | |||
71 | * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. | 71 | * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. |
72 | * @NFC_CMD_FW_DOWNLOAD: Request to Load/flash firmware, or event to inform | 72 | * @NFC_CMD_FW_DOWNLOAD: Request to Load/flash firmware, or event to inform |
73 | * that some firmware was loaded | 73 | * that some firmware was loaded |
74 | * @NFC_EVENT_SE_ADDED: Event emitted when a new secure element is discovered. | ||
75 | * This typically will be sent whenever a new NFC controller with either | ||
76 | * an embedded SE or an UICC one connected to it through SWP. | ||
77 | * @NFC_EVENT_SE_REMOVED: Event emitted when a secure element is removed from | ||
78 | * the system, as a consequence of e.g. an NFC controller being unplugged. | ||
79 | * @NFC_EVENT_SE_CONNECTIVITY: This event is emitted whenever a secure element | ||
80 | * is requesting connectivity access. For example a UICC SE may need to | ||
81 | * talk with a sleeping modem and will notify this need by sending this | ||
82 | * event. It is then up to userspace to decide if it will wake the modem | ||
83 | * up or not. | ||
84 | * @NFC_EVENT_SE_TRANSACTION: This event is sent when an application running on | ||
85 | * a specific SE notifies us about the end of a transaction. The parameter | ||
86 | * for this event is the application ID (AID). | ||
87 | * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller. | ||
74 | */ | 88 | */ |
75 | enum nfc_commands { | 89 | enum nfc_commands { |
76 | NFC_CMD_UNSPEC, | 90 | NFC_CMD_UNSPEC, |
@@ -97,6 +111,9 @@ enum nfc_commands { | |||
97 | NFC_CMD_FW_DOWNLOAD, | 111 | NFC_CMD_FW_DOWNLOAD, |
98 | NFC_EVENT_SE_ADDED, | 112 | NFC_EVENT_SE_ADDED, |
99 | NFC_EVENT_SE_REMOVED, | 113 | NFC_EVENT_SE_REMOVED, |
114 | NFC_EVENT_SE_CONNECTIVITY, | ||
115 | NFC_EVENT_SE_TRANSACTION, | ||
116 | NFC_CMD_GET_SE, | ||
100 | /* private: internal use only */ | 117 | /* private: internal use only */ |
101 | __NFC_CMD_AFTER_LAST | 118 | __NFC_CMD_AFTER_LAST |
102 | }; | 119 | }; |
@@ -129,6 +146,7 @@ enum nfc_commands { | |||
129 | * @NFC_ATTR_FIRMWARE_NAME: Free format firmware version | 146 | * @NFC_ATTR_FIRMWARE_NAME: Free format firmware version |
130 | * @NFC_ATTR_SE_INDEX: Secure element index | 147 | * @NFC_ATTR_SE_INDEX: Secure element index |
131 | * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) | 148 | * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) |
149 | * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status | ||
132 | */ | 150 | */ |
133 | enum nfc_attrs { | 151 | enum nfc_attrs { |
134 | NFC_ATTR_UNSPEC, | 152 | NFC_ATTR_UNSPEC, |
@@ -154,6 +172,8 @@ enum nfc_attrs { | |||
154 | NFC_ATTR_FIRMWARE_NAME, | 172 | NFC_ATTR_FIRMWARE_NAME, |
155 | NFC_ATTR_SE_INDEX, | 173 | NFC_ATTR_SE_INDEX, |
156 | NFC_ATTR_SE_TYPE, | 174 | NFC_ATTR_SE_TYPE, |
175 | NFC_ATTR_SE_AID, | ||
176 | NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, | ||
157 | /* private: internal use only */ | 177 | /* private: internal use only */ |
158 | __NFC_ATTR_AFTER_LAST | 178 | __NFC_ATTR_AFTER_LAST |
159 | }; | 179 | }; |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 1f42bc3dcb9c..fde2c021b26d 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
@@ -1493,6 +1493,9 @@ enum nl80211_commands { | |||
1493 | * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter | 1493 | * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter |
1494 | * field in the probe response (%NL80211_ATTR_PROBE_RESP). | 1494 | * field in the probe response (%NL80211_ATTR_PROBE_RESP). |
1495 | * | 1495 | * |
1496 | * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32. | ||
1497 | * As specified in the &enum nl80211_rxmgmt_flags. | ||
1498 | * | ||
1496 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1499 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
1497 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1500 | * @__NL80211_ATTR_AFTER_LAST: internal use |
1498 | */ | 1501 | */ |
@@ -1801,6 +1804,8 @@ enum nl80211_attrs { | |||
1801 | NL80211_ATTR_CSA_C_OFF_BEACON, | 1804 | NL80211_ATTR_CSA_C_OFF_BEACON, |
1802 | NL80211_ATTR_CSA_C_OFF_PRESP, | 1805 | NL80211_ATTR_CSA_C_OFF_PRESP, |
1803 | 1806 | ||
1807 | NL80211_ATTR_RXMGMT_FLAGS, | ||
1808 | |||
1804 | /* add attributes here, update the policy in nl80211.c */ | 1809 | /* add attributes here, update the policy in nl80211.c */ |
1805 | 1810 | ||
1806 | __NL80211_ATTR_AFTER_LAST, | 1811 | __NL80211_ATTR_AFTER_LAST, |
@@ -3901,4 +3906,15 @@ enum nl80211_crit_proto_id { | |||
3901 | /* maximum duration for critical protocol measures */ | 3906 | /* maximum duration for critical protocol measures */ |
3902 | #define NL80211_CRIT_PROTO_MAX_DURATION 5000 /* msec */ | 3907 | #define NL80211_CRIT_PROTO_MAX_DURATION 5000 /* msec */ |
3903 | 3908 | ||
3909 | /** | ||
3910 | * enum nl80211_rxmgmt_flags - flags for received management frame. | ||
3911 | * | ||
3912 | * Used by cfg80211_rx_mgmt() | ||
3913 | * | ||
3914 | * @NL80211_RXMGMT_FLAG_ANSWERED: frame was answered by device/driver. | ||
3915 | */ | ||
3916 | enum nl80211_rxmgmt_flags { | ||
3917 | NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0, | ||
3918 | }; | ||
3919 | |||
3904 | #endif /* __LINUX_NL80211_H */ | 3920 | #endif /* __LINUX_NL80211_H */ |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 9ab8a7ed99c0..09bf1c38805b 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -582,7 +582,7 @@ static int vlan_dev_init(struct net_device *dev) | |||
582 | dev->dev_id = real_dev->dev_id; | 582 | dev->dev_id = real_dev->dev_id; |
583 | 583 | ||
584 | if (is_zero_ether_addr(dev->dev_addr)) | 584 | if (is_zero_ether_addr(dev->dev_addr)) |
585 | memcpy(dev->dev_addr, real_dev->dev_addr, dev->addr_len); | 585 | eth_hw_addr_inherit(dev, real_dev); |
586 | if (is_zero_ether_addr(dev->broadcast)) | 586 | if (is_zero_ether_addr(dev->broadcast)) |
587 | memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len); | 587 | memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len); |
588 | 588 | ||
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 5d00f23b4621..24675523930f 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -254,7 +254,7 @@ static inline void batadv_dbg(int type __always_unused, | |||
254 | 254 | ||
255 | /* returns 1 if they are the same ethernet addr | 255 | /* returns 1 if they are the same ethernet addr |
256 | * | 256 | * |
257 | * note: can't use compare_ether_addr() as it requires aligned memory | 257 | * note: can't use ether_addr_equal() as it requires aligned memory |
258 | */ | 258 | */ |
259 | static inline int batadv_compare_eth(const void *data1, const void *data2) | 259 | static inline int batadv_compare_eth(const void *data1, const void *data2) |
260 | { | 260 | { |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 6c7f36379722..f0817121ec5e 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -31,6 +31,24 @@ | |||
31 | #include <net/bluetooth/a2mp.h> | 31 | #include <net/bluetooth/a2mp.h> |
32 | #include <net/bluetooth/smp.h> | 32 | #include <net/bluetooth/smp.h> |
33 | 33 | ||
34 | struct sco_param { | ||
35 | u16 pkt_type; | ||
36 | u16 max_latency; | ||
37 | }; | ||
38 | |||
39 | static const struct sco_param sco_param_cvsd[] = { | ||
40 | { EDR_ESCO_MASK & ~ESCO_2EV3, 0x000a }, /* S3 */ | ||
41 | { EDR_ESCO_MASK & ~ESCO_2EV3, 0x0007 }, /* S2 */ | ||
42 | { EDR_ESCO_MASK | ESCO_EV3, 0x0007 }, /* S1 */ | ||
43 | { EDR_ESCO_MASK | ESCO_HV3, 0xffff }, /* D1 */ | ||
44 | { EDR_ESCO_MASK | ESCO_HV1, 0xffff }, /* D0 */ | ||
45 | }; | ||
46 | |||
47 | static const struct sco_param sco_param_wideband[] = { | ||
48 | { EDR_ESCO_MASK & ~ESCO_2EV3, 0x000d }, /* T2 */ | ||
49 | { EDR_ESCO_MASK | ESCO_EV3, 0x0008 }, /* T1 */ | ||
50 | }; | ||
51 | |||
34 | static void hci_le_create_connection(struct hci_conn *conn) | 52 | static void hci_le_create_connection(struct hci_conn *conn) |
35 | { | 53 | { |
36 | struct hci_dev *hdev = conn->hdev; | 54 | struct hci_dev *hdev = conn->hdev; |
@@ -172,10 +190,11 @@ static void hci_add_sco(struct hci_conn *conn, __u16 handle) | |||
172 | hci_send_cmd(hdev, HCI_OP_ADD_SCO, sizeof(cp), &cp); | 190 | hci_send_cmd(hdev, HCI_OP_ADD_SCO, sizeof(cp), &cp); |
173 | } | 191 | } |
174 | 192 | ||
175 | void hci_setup_sync(struct hci_conn *conn, __u16 handle) | 193 | bool hci_setup_sync(struct hci_conn *conn, __u16 handle) |
176 | { | 194 | { |
177 | struct hci_dev *hdev = conn->hdev; | 195 | struct hci_dev *hdev = conn->hdev; |
178 | struct hci_cp_setup_sync_conn cp; | 196 | struct hci_cp_setup_sync_conn cp; |
197 | const struct sco_param *param; | ||
179 | 198 | ||
180 | BT_DBG("hcon %p", conn); | 199 | BT_DBG("hcon %p", conn); |
181 | 200 | ||
@@ -185,15 +204,35 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle) | |||
185 | conn->attempt++; | 204 | conn->attempt++; |
186 | 205 | ||
187 | cp.handle = cpu_to_le16(handle); | 206 | cp.handle = cpu_to_le16(handle); |
188 | cp.pkt_type = cpu_to_le16(conn->pkt_type); | ||
189 | 207 | ||
190 | cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); | 208 | cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); |
191 | cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); | 209 | cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); |
192 | cp.max_latency = __constant_cpu_to_le16(0xffff); | 210 | cp.voice_setting = cpu_to_le16(conn->setting); |
193 | cp.voice_setting = cpu_to_le16(hdev->voice_setting); | 211 | |
194 | cp.retrans_effort = 0xff; | 212 | switch (conn->setting & SCO_AIRMODE_MASK) { |
213 | case SCO_AIRMODE_TRANSP: | ||
214 | if (conn->attempt > ARRAY_SIZE(sco_param_wideband)) | ||
215 | return false; | ||
216 | cp.retrans_effort = 0x02; | ||
217 | param = &sco_param_wideband[conn->attempt - 1]; | ||
218 | break; | ||
219 | case SCO_AIRMODE_CVSD: | ||
220 | if (conn->attempt > ARRAY_SIZE(sco_param_cvsd)) | ||
221 | return false; | ||
222 | cp.retrans_effort = 0x01; | ||
223 | param = &sco_param_cvsd[conn->attempt - 1]; | ||
224 | break; | ||
225 | default: | ||
226 | return false; | ||
227 | } | ||
195 | 228 | ||
196 | hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp); | 229 | cp.pkt_type = __cpu_to_le16(param->pkt_type); |
230 | cp.max_latency = __cpu_to_le16(param->max_latency); | ||
231 | |||
232 | if (hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp) < 0) | ||
233 | return false; | ||
234 | |||
235 | return true; | ||
197 | } | 236 | } |
198 | 237 | ||
199 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | 238 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, |
@@ -560,13 +599,13 @@ static struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst, | |||
560 | return acl; | 599 | return acl; |
561 | } | 600 | } |
562 | 601 | ||
563 | static struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, | 602 | struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, |
564 | bdaddr_t *dst, u8 sec_level, u8 auth_type) | 603 | __u16 setting) |
565 | { | 604 | { |
566 | struct hci_conn *acl; | 605 | struct hci_conn *acl; |
567 | struct hci_conn *sco; | 606 | struct hci_conn *sco; |
568 | 607 | ||
569 | acl = hci_connect_acl(hdev, dst, sec_level, auth_type); | 608 | acl = hci_connect_acl(hdev, dst, BT_SECURITY_LOW, HCI_AT_NO_BONDING); |
570 | if (IS_ERR(acl)) | 609 | if (IS_ERR(acl)) |
571 | return acl; | 610 | return acl; |
572 | 611 | ||
@@ -584,6 +623,8 @@ static struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, | |||
584 | 623 | ||
585 | hci_conn_hold(sco); | 624 | hci_conn_hold(sco); |
586 | 625 | ||
626 | sco->setting = setting; | ||
627 | |||
587 | if (acl->state == BT_CONNECTED && | 628 | if (acl->state == BT_CONNECTED && |
588 | (sco->state == BT_OPEN || sco->state == BT_CLOSED)) { | 629 | (sco->state == BT_OPEN || sco->state == BT_CLOSED)) { |
589 | set_bit(HCI_CONN_POWER_SAVE, &acl->flags); | 630 | set_bit(HCI_CONN_POWER_SAVE, &acl->flags); |
@@ -612,9 +653,6 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, | |||
612 | return hci_connect_le(hdev, dst, dst_type, sec_level, auth_type); | 653 | return hci_connect_le(hdev, dst, dst_type, sec_level, auth_type); |
613 | case ACL_LINK: | 654 | case ACL_LINK: |
614 | return hci_connect_acl(hdev, dst, sec_level, auth_type); | 655 | return hci_connect_acl(hdev, dst, sec_level, auth_type); |
615 | case SCO_LINK: | ||
616 | case ESCO_LINK: | ||
617 | return hci_connect_sco(hdev, type, dst, sec_level, auth_type); | ||
618 | } | 656 | } |
619 | 657 | ||
620 | return ERR_PTR(-EINVAL); | 658 | return ERR_PTR(-EINVAL); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index cc27297da5a9..634debab4d54 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -454,6 +454,18 @@ static void hci_setup_event_mask(struct hci_request *req) | |||
454 | events[4] |= 0x04; /* Read Remote Extended Features Complete */ | 454 | events[4] |= 0x04; /* Read Remote Extended Features Complete */ |
455 | events[5] |= 0x08; /* Synchronous Connection Complete */ | 455 | events[5] |= 0x08; /* Synchronous Connection Complete */ |
456 | events[5] |= 0x10; /* Synchronous Connection Changed */ | 456 | events[5] |= 0x10; /* Synchronous Connection Changed */ |
457 | } else { | ||
458 | /* Use a different default for LE-only devices */ | ||
459 | memset(events, 0, sizeof(events)); | ||
460 | events[0] |= 0x10; /* Disconnection Complete */ | ||
461 | events[0] |= 0x80; /* Encryption Change */ | ||
462 | events[1] |= 0x08; /* Read Remote Version Information Complete */ | ||
463 | events[1] |= 0x20; /* Command Complete */ | ||
464 | events[1] |= 0x40; /* Command Status */ | ||
465 | events[1] |= 0x80; /* Hardware Error */ | ||
466 | events[2] |= 0x04; /* Number of Completed Packets */ | ||
467 | events[3] |= 0x02; /* Data Buffer Overflow */ | ||
468 | events[5] |= 0x80; /* Encryption Key Refresh Complete */ | ||
457 | } | 469 | } |
458 | 470 | ||
459 | if (lmp_inq_rssi_capable(hdev)) | 471 | if (lmp_inq_rssi_capable(hdev)) |
@@ -608,7 +620,7 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt) | |||
608 | * as supported send it. If not supported assume that the controller | 620 | * as supported send it. If not supported assume that the controller |
609 | * does not have actual support for stored link keys which makes this | 621 | * does not have actual support for stored link keys which makes this |
610 | * command redundant anyway. | 622 | * command redundant anyway. |
611 | */ | 623 | */ |
612 | if (hdev->commands[6] & 0x80) { | 624 | if (hdev->commands[6] & 0x80) { |
613 | struct hci_cp_delete_stored_link_key cp; | 625 | struct hci_cp_delete_stored_link_key cp; |
614 | 626 | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 0437200d92f4..94aab73f89d4 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -2904,15 +2904,16 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, | |||
2904 | hci_conn_add_sysfs(conn); | 2904 | hci_conn_add_sysfs(conn); |
2905 | break; | 2905 | break; |
2906 | 2906 | ||
2907 | case 0x0d: /* Connection Rejected due to Limited Resources */ | ||
2907 | case 0x11: /* Unsupported Feature or Parameter Value */ | 2908 | case 0x11: /* Unsupported Feature or Parameter Value */ |
2908 | case 0x1c: /* SCO interval rejected */ | 2909 | case 0x1c: /* SCO interval rejected */ |
2909 | case 0x1a: /* Unsupported Remote Feature */ | 2910 | case 0x1a: /* Unsupported Remote Feature */ |
2910 | case 0x1f: /* Unspecified error */ | 2911 | case 0x1f: /* Unspecified error */ |
2911 | if (conn->out && conn->attempt < 2) { | 2912 | if (conn->out) { |
2912 | conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | | 2913 | conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | |
2913 | (hdev->esco_type & EDR_ESCO_MASK); | 2914 | (hdev->esco_type & EDR_ESCO_MASK); |
2914 | hci_setup_sync(conn, conn->link->handle); | 2915 | if (hci_setup_sync(conn, conn->link->handle)) |
2915 | goto unlock; | 2916 | goto unlock; |
2916 | } | 2917 | } |
2917 | /* fall through */ | 2918 | /* fall through */ |
2918 | 2919 | ||
@@ -3024,17 +3025,20 @@ unlock: | |||
3024 | static u8 hci_get_auth_req(struct hci_conn *conn) | 3025 | static u8 hci_get_auth_req(struct hci_conn *conn) |
3025 | { | 3026 | { |
3026 | /* If remote requests dedicated bonding follow that lead */ | 3027 | /* If remote requests dedicated bonding follow that lead */ |
3027 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) { | 3028 | if (conn->remote_auth == HCI_AT_DEDICATED_BONDING || |
3029 | conn->remote_auth == HCI_AT_DEDICATED_BONDING_MITM) { | ||
3028 | /* If both remote and local IO capabilities allow MITM | 3030 | /* If both remote and local IO capabilities allow MITM |
3029 | * protection then require it, otherwise don't */ | 3031 | * protection then require it, otherwise don't */ |
3030 | if (conn->remote_cap == 0x03 || conn->io_capability == 0x03) | 3032 | if (conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT || |
3031 | return 0x02; | 3033 | conn->io_capability == HCI_IO_NO_INPUT_OUTPUT) |
3034 | return HCI_AT_DEDICATED_BONDING; | ||
3032 | else | 3035 | else |
3033 | return 0x03; | 3036 | return HCI_AT_DEDICATED_BONDING_MITM; |
3034 | } | 3037 | } |
3035 | 3038 | ||
3036 | /* If remote requests no-bonding follow that lead */ | 3039 | /* If remote requests no-bonding follow that lead */ |
3037 | if (conn->remote_auth == 0x00 || conn->remote_auth == 0x01) | 3040 | if (conn->remote_auth == HCI_AT_NO_BONDING || |
3041 | conn->remote_auth == HCI_AT_NO_BONDING_MITM) | ||
3038 | return conn->remote_auth | (conn->auth_type & 0x01); | 3042 | return conn->remote_auth | (conn->auth_type & 0x01); |
3039 | 3043 | ||
3040 | return conn->auth_type; | 3044 | return conn->auth_type; |
@@ -3066,7 +3070,7 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3066 | /* Change the IO capability from KeyboardDisplay | 3070 | /* Change the IO capability from KeyboardDisplay |
3067 | * to DisplayYesNo as it is not supported by BT spec. */ | 3071 | * to DisplayYesNo as it is not supported by BT spec. */ |
3068 | cp.capability = (conn->io_capability == 0x04) ? | 3072 | cp.capability = (conn->io_capability == 0x04) ? |
3069 | 0x01 : conn->io_capability; | 3073 | HCI_IO_DISPLAY_YESNO : conn->io_capability; |
3070 | conn->auth_type = hci_get_auth_req(conn); | 3074 | conn->auth_type = hci_get_auth_req(conn); |
3071 | cp.authentication = conn->auth_type; | 3075 | cp.authentication = conn->auth_type; |
3072 | 3076 | ||
@@ -3140,7 +3144,8 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
3140 | * request. The only exception is when we're dedicated bonding | 3144 | * request. The only exception is when we're dedicated bonding |
3141 | * initiators (connect_cfm_cb set) since then we always have the MITM | 3145 | * initiators (connect_cfm_cb set) since then we always have the MITM |
3142 | * bit set. */ | 3146 | * bit set. */ |
3143 | if (!conn->connect_cfm_cb && loc_mitm && conn->remote_cap == 0x03) { | 3147 | if (!conn->connect_cfm_cb && loc_mitm && |
3148 | conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) { | ||
3144 | BT_DBG("Rejecting request: remote device can't provide MITM"); | 3149 | BT_DBG("Rejecting request: remote device can't provide MITM"); |
3145 | hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, | 3150 | hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, |
3146 | sizeof(ev->bdaddr), &ev->bdaddr); | 3151 | sizeof(ev->bdaddr), &ev->bdaddr); |
@@ -3148,8 +3153,8 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
3148 | } | 3153 | } |
3149 | 3154 | ||
3150 | /* If no side requires MITM protection; auto-accept */ | 3155 | /* If no side requires MITM protection; auto-accept */ |
3151 | if ((!loc_mitm || conn->remote_cap == 0x03) && | 3156 | if ((!loc_mitm || conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) && |
3152 | (!rem_mitm || conn->io_capability == 0x03)) { | 3157 | (!rem_mitm || conn->io_capability == HCI_IO_NO_INPUT_OUTPUT)) { |
3153 | 3158 | ||
3154 | /* If we're not the initiators request authorization to | 3159 | /* If we're not the initiators request authorization to |
3155 | * proceed from user space (mgmt_user_confirm with | 3160 | * proceed from user space (mgmt_user_confirm with |
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 0c699cdc3696..13863de433a4 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -238,6 +238,31 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep | |||
238 | return hidp_send_intr_message(session, hdr, buf, rsize); | 238 | return hidp_send_intr_message(session, hdr, buf, rsize); |
239 | } | 239 | } |
240 | 240 | ||
241 | static int hidp_hidinput_event(struct input_dev *dev, unsigned int type, | ||
242 | unsigned int code, int value) | ||
243 | { | ||
244 | struct hid_device *hid = input_get_drvdata(dev); | ||
245 | struct hidp_session *session = hid->driver_data; | ||
246 | struct hid_field *field; | ||
247 | int offset; | ||
248 | |||
249 | BT_DBG("session %p type %d code %d value %d", | ||
250 | session, type, code, value); | ||
251 | |||
252 | if (type != EV_LED) | ||
253 | return -1; | ||
254 | |||
255 | offset = hidinput_find_field(hid, type, code, &field); | ||
256 | if (offset == -1) { | ||
257 | hid_warn(dev, "event field not found\n"); | ||
258 | return -1; | ||
259 | } | ||
260 | |||
261 | hid_set_field(field, offset, value); | ||
262 | |||
263 | return hidp_send_report(session, field->report); | ||
264 | } | ||
265 | |||
241 | static int hidp_get_raw_report(struct hid_device *hid, | 266 | static int hidp_get_raw_report(struct hid_device *hid, |
242 | unsigned char report_number, | 267 | unsigned char report_number, |
243 | unsigned char *data, size_t count, | 268 | unsigned char *data, size_t count, |
@@ -678,20 +703,6 @@ static int hidp_parse(struct hid_device *hid) | |||
678 | 703 | ||
679 | static int hidp_start(struct hid_device *hid) | 704 | static int hidp_start(struct hid_device *hid) |
680 | { | 705 | { |
681 | struct hidp_session *session = hid->driver_data; | ||
682 | struct hid_report *report; | ||
683 | |||
684 | if (hid->quirks & HID_QUIRK_NO_INIT_REPORTS) | ||
685 | return 0; | ||
686 | |||
687 | list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT]. | ||
688 | report_list, list) | ||
689 | hidp_send_report(session, report); | ||
690 | |||
691 | list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT]. | ||
692 | report_list, list) | ||
693 | hidp_send_report(session, report); | ||
694 | |||
695 | return 0; | 706 | return 0; |
696 | } | 707 | } |
697 | 708 | ||
@@ -711,6 +722,7 @@ static struct hid_ll_driver hidp_hid_driver = { | |||
711 | .stop = hidp_stop, | 722 | .stop = hidp_stop, |
712 | .open = hidp_open, | 723 | .open = hidp_open, |
713 | .close = hidp_close, | 724 | .close = hidp_close, |
725 | .hidinput_input_event = hidp_hidinput_event, | ||
714 | }; | 726 | }; |
715 | 727 | ||
716 | /* This function sets up the hid device. It does not add it | 728 | /* This function sets up the hid device. It does not add it |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 8c3499bec893..b3bb7bca8e60 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1415,8 +1415,9 @@ static void l2cap_conn_ready(struct l2cap_conn *conn) | |||
1415 | sk->sk_state_change(sk); | 1415 | sk->sk_state_change(sk); |
1416 | release_sock(sk); | 1416 | release_sock(sk); |
1417 | 1417 | ||
1418 | } else if (chan->state == BT_CONNECT) | 1418 | } else if (chan->state == BT_CONNECT) { |
1419 | l2cap_do_start(chan); | 1419 | l2cap_do_start(chan); |
1420 | } | ||
1420 | 1421 | ||
1421 | l2cap_chan_unlock(chan); | 1422 | l2cap_chan_unlock(chan); |
1422 | } | 1423 | } |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index b6e44ad6cca6..6d126faf145f 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -58,7 +58,6 @@ struct rfcomm_dev { | |||
58 | uint modem_status; | 58 | uint modem_status; |
59 | 59 | ||
60 | struct rfcomm_dlc *dlc; | 60 | struct rfcomm_dlc *dlc; |
61 | wait_queue_head_t wait; | ||
62 | 61 | ||
63 | struct device *tty_dev; | 62 | struct device *tty_dev; |
64 | 63 | ||
@@ -76,13 +75,6 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig); | |||
76 | 75 | ||
77 | /* ---- Device functions ---- */ | 76 | /* ---- Device functions ---- */ |
78 | 77 | ||
79 | /* | ||
80 | * The reason this isn't actually a race, as you no doubt have a little voice | ||
81 | * screaming at you in your head, is that the refcount should never actually | ||
82 | * reach zero unless the device has already been taken off the list, in | ||
83 | * rfcomm_dev_del(). And if that's not true, we'll hit the BUG() in | ||
84 | * rfcomm_dev_destruct() anyway. | ||
85 | */ | ||
86 | static void rfcomm_dev_destruct(struct tty_port *port) | 78 | static void rfcomm_dev_destruct(struct tty_port *port) |
87 | { | 79 | { |
88 | struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port); | 80 | struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port); |
@@ -90,10 +82,9 @@ static void rfcomm_dev_destruct(struct tty_port *port) | |||
90 | 82 | ||
91 | BT_DBG("dev %p dlc %p", dev, dlc); | 83 | BT_DBG("dev %p dlc %p", dev, dlc); |
92 | 84 | ||
93 | /* Refcount should only hit zero when called from rfcomm_dev_del() | 85 | spin_lock(&rfcomm_dev_lock); |
94 | which will have taken us off the list. Everything else are | 86 | list_del(&dev->list); |
95 | refcounting bugs. */ | 87 | spin_unlock(&rfcomm_dev_lock); |
96 | BUG_ON(!list_empty(&dev->list)); | ||
97 | 88 | ||
98 | rfcomm_dlc_lock(dlc); | 89 | rfcomm_dlc_lock(dlc); |
99 | /* Detach DLC if it's owned by this dev */ | 90 | /* Detach DLC if it's owned by this dev */ |
@@ -112,8 +103,39 @@ static void rfcomm_dev_destruct(struct tty_port *port) | |||
112 | module_put(THIS_MODULE); | 103 | module_put(THIS_MODULE); |
113 | } | 104 | } |
114 | 105 | ||
106 | /* device-specific initialization: open the dlc */ | ||
107 | static int rfcomm_dev_activate(struct tty_port *port, struct tty_struct *tty) | ||
108 | { | ||
109 | struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port); | ||
110 | |||
111 | return rfcomm_dlc_open(dev->dlc, &dev->src, &dev->dst, dev->channel); | ||
112 | } | ||
113 | |||
114 | /* we block the open until the dlc->state becomes BT_CONNECTED */ | ||
115 | static int rfcomm_dev_carrier_raised(struct tty_port *port) | ||
116 | { | ||
117 | struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port); | ||
118 | |||
119 | return (dev->dlc->state == BT_CONNECTED); | ||
120 | } | ||
121 | |||
122 | /* device-specific cleanup: close the dlc */ | ||
123 | static void rfcomm_dev_shutdown(struct tty_port *port) | ||
124 | { | ||
125 | struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port); | ||
126 | |||
127 | if (dev->tty_dev->parent) | ||
128 | device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST); | ||
129 | |||
130 | /* close the dlc */ | ||
131 | rfcomm_dlc_close(dev->dlc, 0); | ||
132 | } | ||
133 | |||
115 | static const struct tty_port_operations rfcomm_port_ops = { | 134 | static const struct tty_port_operations rfcomm_port_ops = { |
116 | .destruct = rfcomm_dev_destruct, | 135 | .destruct = rfcomm_dev_destruct, |
136 | .activate = rfcomm_dev_activate, | ||
137 | .shutdown = rfcomm_dev_shutdown, | ||
138 | .carrier_raised = rfcomm_dev_carrier_raised, | ||
117 | }; | 139 | }; |
118 | 140 | ||
119 | static struct rfcomm_dev *__rfcomm_dev_get(int id) | 141 | static struct rfcomm_dev *__rfcomm_dev_get(int id) |
@@ -236,7 +258,6 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | |||
236 | 258 | ||
237 | tty_port_init(&dev->port); | 259 | tty_port_init(&dev->port); |
238 | dev->port.ops = &rfcomm_port_ops; | 260 | dev->port.ops = &rfcomm_port_ops; |
239 | init_waitqueue_head(&dev->wait); | ||
240 | 261 | ||
241 | skb_queue_head_init(&dev->pending); | 262 | skb_queue_head_init(&dev->pending); |
242 | 263 | ||
@@ -282,7 +303,9 @@ out: | |||
282 | dev->id, NULL); | 303 | dev->id, NULL); |
283 | if (IS_ERR(dev->tty_dev)) { | 304 | if (IS_ERR(dev->tty_dev)) { |
284 | err = PTR_ERR(dev->tty_dev); | 305 | err = PTR_ERR(dev->tty_dev); |
306 | spin_lock(&rfcomm_dev_lock); | ||
285 | list_del(&dev->list); | 307 | list_del(&dev->list); |
308 | spin_unlock(&rfcomm_dev_lock); | ||
286 | goto free; | 309 | goto free; |
287 | } | 310 | } |
288 | 311 | ||
@@ -301,27 +324,6 @@ free: | |||
301 | return err; | 324 | return err; |
302 | } | 325 | } |
303 | 326 | ||
304 | static void rfcomm_dev_del(struct rfcomm_dev *dev) | ||
305 | { | ||
306 | unsigned long flags; | ||
307 | BT_DBG("dev %p", dev); | ||
308 | |||
309 | BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)); | ||
310 | |||
311 | spin_lock_irqsave(&dev->port.lock, flags); | ||
312 | if (dev->port.count > 0) { | ||
313 | spin_unlock_irqrestore(&dev->port.lock, flags); | ||
314 | return; | ||
315 | } | ||
316 | spin_unlock_irqrestore(&dev->port.lock, flags); | ||
317 | |||
318 | spin_lock(&rfcomm_dev_lock); | ||
319 | list_del_init(&dev->list); | ||
320 | spin_unlock(&rfcomm_dev_lock); | ||
321 | |||
322 | tty_port_put(&dev->port); | ||
323 | } | ||
324 | |||
325 | /* ---- Send buffer ---- */ | 327 | /* ---- Send buffer ---- */ |
326 | static inline unsigned int rfcomm_room(struct rfcomm_dlc *dlc) | 328 | static inline unsigned int rfcomm_room(struct rfcomm_dlc *dlc) |
327 | { | 329 | { |
@@ -333,10 +335,9 @@ static inline unsigned int rfcomm_room(struct rfcomm_dlc *dlc) | |||
333 | static void rfcomm_wfree(struct sk_buff *skb) | 335 | static void rfcomm_wfree(struct sk_buff *skb) |
334 | { | 336 | { |
335 | struct rfcomm_dev *dev = (void *) skb->sk; | 337 | struct rfcomm_dev *dev = (void *) skb->sk; |
336 | struct tty_struct *tty = dev->port.tty; | ||
337 | atomic_sub(skb->truesize, &dev->wmem_alloc); | 338 | atomic_sub(skb->truesize, &dev->wmem_alloc); |
338 | if (test_bit(RFCOMM_TTY_ATTACHED, &dev->flags) && tty) | 339 | if (test_bit(RFCOMM_TTY_ATTACHED, &dev->flags)) |
339 | tty_wakeup(tty); | 340 | tty_port_tty_wakeup(&dev->port); |
340 | tty_port_put(&dev->port); | 341 | tty_port_put(&dev->port); |
341 | } | 342 | } |
342 | 343 | ||
@@ -410,6 +411,7 @@ static int rfcomm_release_dev(void __user *arg) | |||
410 | { | 411 | { |
411 | struct rfcomm_dev_req req; | 412 | struct rfcomm_dev_req req; |
412 | struct rfcomm_dev *dev; | 413 | struct rfcomm_dev *dev; |
414 | struct tty_struct *tty; | ||
413 | 415 | ||
414 | if (copy_from_user(&req, arg, sizeof(req))) | 416 | if (copy_from_user(&req, arg, sizeof(req))) |
415 | return -EFAULT; | 417 | return -EFAULT; |
@@ -429,11 +431,15 @@ static int rfcomm_release_dev(void __user *arg) | |||
429 | rfcomm_dlc_close(dev->dlc, 0); | 431 | rfcomm_dlc_close(dev->dlc, 0); |
430 | 432 | ||
431 | /* Shut down TTY synchronously before freeing rfcomm_dev */ | 433 | /* Shut down TTY synchronously before freeing rfcomm_dev */ |
432 | if (dev->port.tty) | 434 | tty = tty_port_tty_get(&dev->port); |
433 | tty_vhangup(dev->port.tty); | 435 | if (tty) { |
436 | tty_vhangup(tty); | ||
437 | tty_kref_put(tty); | ||
438 | } | ||
439 | |||
440 | if (!test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)) | ||
441 | tty_port_put(&dev->port); | ||
434 | 442 | ||
435 | if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) | ||
436 | rfcomm_dev_del(dev); | ||
437 | tty_port_put(&dev->port); | 443 | tty_port_put(&dev->port); |
438 | return 0; | 444 | return 0; |
439 | } | 445 | } |
@@ -563,16 +569,21 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb) | |||
563 | static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) | 569 | static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) |
564 | { | 570 | { |
565 | struct rfcomm_dev *dev = dlc->owner; | 571 | struct rfcomm_dev *dev = dlc->owner; |
572 | struct tty_struct *tty; | ||
566 | if (!dev) | 573 | if (!dev) |
567 | return; | 574 | return; |
568 | 575 | ||
569 | BT_DBG("dlc %p dev %p err %d", dlc, dev, err); | 576 | BT_DBG("dlc %p dev %p err %d", dlc, dev, err); |
570 | 577 | ||
571 | dev->err = err; | 578 | dev->err = err; |
572 | wake_up_interruptible(&dev->wait); | 579 | if (dlc->state == BT_CONNECTED) { |
580 | device_move(dev->tty_dev, rfcomm_get_device(dev), | ||
581 | DPM_ORDER_DEV_AFTER_PARENT); | ||
573 | 582 | ||
574 | if (dlc->state == BT_CLOSED) { | 583 | wake_up_interruptible(&dev->port.open_wait); |
575 | if (!dev->port.tty) { | 584 | } else if (dlc->state == BT_CLOSED) { |
585 | tty = tty_port_tty_get(&dev->port); | ||
586 | if (!tty) { | ||
576 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { | 587 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { |
577 | /* Drop DLC lock here to avoid deadlock | 588 | /* Drop DLC lock here to avoid deadlock |
578 | * 1. rfcomm_dev_get will take rfcomm_dev_lock | 589 | * 1. rfcomm_dev_get will take rfcomm_dev_lock |
@@ -580,6 +591,9 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) | |||
580 | * rfcomm_dev_lock -> dlc lock | 591 | * rfcomm_dev_lock -> dlc lock |
581 | * 2. tty_port_put will deadlock if it's | 592 | * 2. tty_port_put will deadlock if it's |
582 | * the last reference | 593 | * the last reference |
594 | * | ||
595 | * FIXME: when we release the lock anything | ||
596 | * could happen to dev, even its destruction | ||
583 | */ | 597 | */ |
584 | rfcomm_dlc_unlock(dlc); | 598 | rfcomm_dlc_unlock(dlc); |
585 | if (rfcomm_dev_get(dev->id) == NULL) { | 599 | if (rfcomm_dev_get(dev->id) == NULL) { |
@@ -587,12 +601,17 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) | |||
587 | return; | 601 | return; |
588 | } | 602 | } |
589 | 603 | ||
590 | rfcomm_dev_del(dev); | 604 | if (!test_and_set_bit(RFCOMM_TTY_RELEASED, |
605 | &dev->flags)) | ||
606 | tty_port_put(&dev->port); | ||
607 | |||
591 | tty_port_put(&dev->port); | 608 | tty_port_put(&dev->port); |
592 | rfcomm_dlc_lock(dlc); | 609 | rfcomm_dlc_lock(dlc); |
593 | } | 610 | } |
594 | } else | 611 | } else { |
595 | tty_hangup(dev->port.tty); | 612 | tty_hangup(tty); |
613 | tty_kref_put(tty); | ||
614 | } | ||
596 | } | 615 | } |
597 | } | 616 | } |
598 | 617 | ||
@@ -604,10 +623,8 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig) | |||
604 | 623 | ||
605 | BT_DBG("dlc %p dev %p v24_sig 0x%02x", dlc, dev, v24_sig); | 624 | BT_DBG("dlc %p dev %p v24_sig 0x%02x", dlc, dev, v24_sig); |
606 | 625 | ||
607 | if ((dev->modem_status & TIOCM_CD) && !(v24_sig & RFCOMM_V24_DV)) { | 626 | if ((dev->modem_status & TIOCM_CD) && !(v24_sig & RFCOMM_V24_DV)) |
608 | if (dev->port.tty && !C_CLOCAL(dev->port.tty)) | 627 | tty_port_tty_hangup(&dev->port, true); |
609 | tty_hangup(dev->port.tty); | ||
610 | } | ||
611 | 628 | ||
612 | dev->modem_status = | 629 | dev->modem_status = |
613 | ((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) | | 630 | ((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) | |
@@ -638,124 +655,92 @@ static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev) | |||
638 | tty_flip_buffer_push(&dev->port); | 655 | tty_flip_buffer_push(&dev->port); |
639 | } | 656 | } |
640 | 657 | ||
641 | static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) | 658 | /* do the reverse of install, clearing the tty fields and releasing the |
659 | * reference to tty_port | ||
660 | */ | ||
661 | static void rfcomm_tty_cleanup(struct tty_struct *tty) | ||
642 | { | 662 | { |
643 | DECLARE_WAITQUEUE(wait, current); | 663 | struct rfcomm_dev *dev = tty->driver_data; |
644 | struct rfcomm_dev *dev; | ||
645 | struct rfcomm_dlc *dlc; | ||
646 | unsigned long flags; | ||
647 | int err, id; | ||
648 | 664 | ||
649 | id = tty->index; | 665 | clear_bit(RFCOMM_TTY_ATTACHED, &dev->flags); |
650 | 666 | ||
651 | BT_DBG("tty %p id %d", tty, id); | 667 | rfcomm_dlc_lock(dev->dlc); |
668 | tty->driver_data = NULL; | ||
669 | rfcomm_dlc_unlock(dev->dlc); | ||
652 | 670 | ||
653 | /* We don't leak this refcount. For reasons which are not entirely | 671 | /* |
654 | clear, the TTY layer will call our ->close() method even if the | 672 | * purge the dlc->tx_queue to avoid circular dependencies |
655 | open fails. We decrease the refcount there, and decreasing it | 673 | * between dev and dlc |
656 | here too would cause breakage. */ | 674 | */ |
657 | dev = rfcomm_dev_get(id); | 675 | skb_queue_purge(&dev->dlc->tx_queue); |
658 | if (!dev) | ||
659 | return -ENODEV; | ||
660 | 676 | ||
661 | BT_DBG("dev %p dst %pMR channel %d opened %d", dev, &dev->dst, | 677 | tty_port_put(&dev->port); |
662 | dev->channel, dev->port.count); | 678 | } |
663 | 679 | ||
664 | spin_lock_irqsave(&dev->port.lock, flags); | 680 | /* we acquire the tty_port reference since it's here the tty is first used |
665 | if (++dev->port.count > 1) { | 681 | * by setting the termios. We also populate the driver_data field and install |
666 | spin_unlock_irqrestore(&dev->port.lock, flags); | 682 | * the tty port |
667 | return 0; | 683 | */ |
668 | } | 684 | static int rfcomm_tty_install(struct tty_driver *driver, struct tty_struct *tty) |
669 | spin_unlock_irqrestore(&dev->port.lock, flags); | 685 | { |
686 | struct rfcomm_dev *dev; | ||
687 | struct rfcomm_dlc *dlc; | ||
688 | int err; | ||
689 | |||
690 | dev = rfcomm_dev_get(tty->index); | ||
691 | if (!dev) | ||
692 | return -ENODEV; | ||
670 | 693 | ||
671 | dlc = dev->dlc; | 694 | dlc = dev->dlc; |
672 | 695 | ||
673 | /* Attach TTY and open DLC */ | 696 | /* Attach TTY and open DLC */ |
674 | |||
675 | rfcomm_dlc_lock(dlc); | 697 | rfcomm_dlc_lock(dlc); |
676 | tty->driver_data = dev; | 698 | tty->driver_data = dev; |
677 | dev->port.tty = tty; | ||
678 | rfcomm_dlc_unlock(dlc); | 699 | rfcomm_dlc_unlock(dlc); |
679 | set_bit(RFCOMM_TTY_ATTACHED, &dev->flags); | 700 | set_bit(RFCOMM_TTY_ATTACHED, &dev->flags); |
680 | 701 | ||
681 | err = rfcomm_dlc_open(dlc, &dev->src, &dev->dst, dev->channel); | 702 | /* install the tty_port */ |
682 | if (err < 0) | 703 | err = tty_port_install(&dev->port, driver, tty); |
683 | return err; | 704 | if (err) |
684 | 705 | rfcomm_tty_cleanup(tty); | |
685 | /* Wait for DLC to connect */ | ||
686 | add_wait_queue(&dev->wait, &wait); | ||
687 | while (1) { | ||
688 | set_current_state(TASK_INTERRUPTIBLE); | ||
689 | 706 | ||
690 | if (dlc->state == BT_CLOSED) { | 707 | return err; |
691 | err = -dev->err; | 708 | } |
692 | break; | ||
693 | } | ||
694 | 709 | ||
695 | if (dlc->state == BT_CONNECTED) | 710 | static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) |
696 | break; | 711 | { |
712 | struct rfcomm_dev *dev = tty->driver_data; | ||
713 | int err; | ||
697 | 714 | ||
698 | if (signal_pending(current)) { | 715 | BT_DBG("tty %p id %d", tty, tty->index); |
699 | err = -EINTR; | ||
700 | break; | ||
701 | } | ||
702 | 716 | ||
703 | tty_unlock(tty); | 717 | BT_DBG("dev %p dst %pMR channel %d opened %d", dev, &dev->dst, |
704 | schedule(); | 718 | dev->channel, dev->port.count); |
705 | tty_lock(tty); | ||
706 | } | ||
707 | set_current_state(TASK_RUNNING); | ||
708 | remove_wait_queue(&dev->wait, &wait); | ||
709 | 719 | ||
710 | if (err == 0) | 720 | err = tty_port_open(&dev->port, tty, filp); |
711 | device_move(dev->tty_dev, rfcomm_get_device(dev), | 721 | if (err) |
712 | DPM_ORDER_DEV_AFTER_PARENT); | 722 | return err; |
713 | 723 | ||
724 | /* | ||
725 | * FIXME: rfcomm should use proper flow control for | ||
726 | * received data. This hack will be unnecessary and can | ||
727 | * be removed when that's implemented | ||
728 | */ | ||
714 | rfcomm_tty_copy_pending(dev); | 729 | rfcomm_tty_copy_pending(dev); |
715 | 730 | ||
716 | rfcomm_dlc_unthrottle(dev->dlc); | 731 | rfcomm_dlc_unthrottle(dev->dlc); |
717 | 732 | ||
718 | return err; | 733 | return 0; |
719 | } | 734 | } |
720 | 735 | ||
721 | static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) | 736 | static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) |
722 | { | 737 | { |
723 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; | 738 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; |
724 | unsigned long flags; | ||
725 | |||
726 | if (!dev) | ||
727 | return; | ||
728 | 739 | ||
729 | BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc, | 740 | BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc, |
730 | dev->port.count); | 741 | dev->port.count); |
731 | 742 | ||
732 | spin_lock_irqsave(&dev->port.lock, flags); | 743 | tty_port_close(&dev->port, tty, filp); |
733 | if (!--dev->port.count) { | ||
734 | spin_unlock_irqrestore(&dev->port.lock, flags); | ||
735 | if (dev->tty_dev->parent) | ||
736 | device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST); | ||
737 | |||
738 | /* Close DLC and dettach TTY */ | ||
739 | rfcomm_dlc_close(dev->dlc, 0); | ||
740 | |||
741 | clear_bit(RFCOMM_TTY_ATTACHED, &dev->flags); | ||
742 | |||
743 | rfcomm_dlc_lock(dev->dlc); | ||
744 | tty->driver_data = NULL; | ||
745 | dev->port.tty = NULL; | ||
746 | rfcomm_dlc_unlock(dev->dlc); | ||
747 | |||
748 | if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) { | ||
749 | spin_lock(&rfcomm_dev_lock); | ||
750 | list_del_init(&dev->list); | ||
751 | spin_unlock(&rfcomm_dev_lock); | ||
752 | |||
753 | tty_port_put(&dev->port); | ||
754 | } | ||
755 | } else | ||
756 | spin_unlock_irqrestore(&dev->port.lock, flags); | ||
757 | |||
758 | tty_port_put(&dev->port); | ||
759 | } | 744 | } |
760 | 745 | ||
761 | static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) | 746 | static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) |
@@ -1055,17 +1040,11 @@ static void rfcomm_tty_hangup(struct tty_struct *tty) | |||
1055 | 1040 | ||
1056 | BT_DBG("tty %p dev %p", tty, dev); | 1041 | BT_DBG("tty %p dev %p", tty, dev); |
1057 | 1042 | ||
1058 | if (!dev) | 1043 | tty_port_hangup(&dev->port); |
1059 | return; | ||
1060 | |||
1061 | rfcomm_tty_flush_buffer(tty); | ||
1062 | 1044 | ||
1063 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { | 1045 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags) && |
1064 | if (rfcomm_dev_get(dev->id) == NULL) | 1046 | !test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)) |
1065 | return; | ||
1066 | rfcomm_dev_del(dev); | ||
1067 | tty_port_put(&dev->port); | 1047 | tty_port_put(&dev->port); |
1068 | } | ||
1069 | } | 1048 | } |
1070 | 1049 | ||
1071 | static int rfcomm_tty_tiocmget(struct tty_struct *tty) | 1050 | static int rfcomm_tty_tiocmget(struct tty_struct *tty) |
@@ -1128,6 +1107,8 @@ static const struct tty_operations rfcomm_ops = { | |||
1128 | .wait_until_sent = rfcomm_tty_wait_until_sent, | 1107 | .wait_until_sent = rfcomm_tty_wait_until_sent, |
1129 | .tiocmget = rfcomm_tty_tiocmget, | 1108 | .tiocmget = rfcomm_tty_tiocmget, |
1130 | .tiocmset = rfcomm_tty_tiocmset, | 1109 | .tiocmset = rfcomm_tty_tiocmset, |
1110 | .install = rfcomm_tty_install, | ||
1111 | .cleanup = rfcomm_tty_cleanup, | ||
1131 | }; | 1112 | }; |
1132 | 1113 | ||
1133 | int __init rfcomm_init_ttys(void) | 1114 | int __init rfcomm_init_ttys(void) |
@@ -1146,7 +1127,7 @@ int __init rfcomm_init_ttys(void) | |||
1146 | rfcomm_tty_driver->subtype = SERIAL_TYPE_NORMAL; | 1127 | rfcomm_tty_driver->subtype = SERIAL_TYPE_NORMAL; |
1147 | rfcomm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; | 1128 | rfcomm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
1148 | rfcomm_tty_driver->init_termios = tty_std_termios; | 1129 | rfcomm_tty_driver->init_termios = tty_std_termios; |
1149 | rfcomm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 1130 | rfcomm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL; |
1150 | rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON; | 1131 | rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON; |
1151 | tty_set_operations(rfcomm_tty_driver, &rfcomm_ops); | 1132 | tty_set_operations(rfcomm_tty_driver, &rfcomm_ops); |
1152 | 1133 | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index e7bd4eea575c..96bd388d93a4 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -176,8 +176,13 @@ static int sco_connect(struct sock *sk) | |||
176 | else | 176 | else |
177 | type = SCO_LINK; | 177 | type = SCO_LINK; |
178 | 178 | ||
179 | hcon = hci_connect(hdev, type, dst, BDADDR_BREDR, BT_SECURITY_LOW, | 179 | if (sco_pi(sk)->setting == BT_VOICE_TRANSPARENT && |
180 | HCI_AT_NO_BONDING); | 180 | (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) { |
181 | err = -EOPNOTSUPP; | ||
182 | goto done; | ||
183 | } | ||
184 | |||
185 | hcon = hci_connect_sco(hdev, type, dst, sco_pi(sk)->setting); | ||
181 | if (IS_ERR(hcon)) { | 186 | if (IS_ERR(hcon)) { |
182 | err = PTR_ERR(hcon); | 187 | err = PTR_ERR(hcon); |
183 | goto done; | 188 | goto done; |
@@ -417,6 +422,8 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int pro | |||
417 | sk->sk_protocol = proto; | 422 | sk->sk_protocol = proto; |
418 | sk->sk_state = BT_OPEN; | 423 | sk->sk_state = BT_OPEN; |
419 | 424 | ||
425 | sco_pi(sk)->setting = BT_VOICE_CVSD_16BIT; | ||
426 | |||
420 | setup_timer(&sk->sk_timer, sco_sock_timeout, (unsigned long)sk); | 427 | setup_timer(&sk->sk_timer, sco_sock_timeout, (unsigned long)sk); |
421 | 428 | ||
422 | bt_sock_link(&sco_sk_list, sk); | 429 | bt_sock_link(&sco_sk_list, sk); |
@@ -652,7 +659,7 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
652 | return err; | 659 | return err; |
653 | } | 660 | } |
654 | 661 | ||
655 | static void sco_conn_defer_accept(struct hci_conn *conn, int mask) | 662 | static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting) |
656 | { | 663 | { |
657 | struct hci_dev *hdev = conn->hdev; | 664 | struct hci_dev *hdev = conn->hdev; |
658 | 665 | ||
@@ -664,11 +671,7 @@ static void sco_conn_defer_accept(struct hci_conn *conn, int mask) | |||
664 | struct hci_cp_accept_conn_req cp; | 671 | struct hci_cp_accept_conn_req cp; |
665 | 672 | ||
666 | bacpy(&cp.bdaddr, &conn->dst); | 673 | bacpy(&cp.bdaddr, &conn->dst); |
667 | 674 | cp.role = 0x00; /* Ignored */ | |
668 | if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER)) | ||
669 | cp.role = 0x00; /* Become master */ | ||
670 | else | ||
671 | cp.role = 0x01; /* Remain slave */ | ||
672 | 675 | ||
673 | hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); | 676 | hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); |
674 | } else { | 677 | } else { |
@@ -679,9 +682,21 @@ static void sco_conn_defer_accept(struct hci_conn *conn, int mask) | |||
679 | 682 | ||
680 | cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); | 683 | cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); |
681 | cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); | 684 | cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); |
682 | cp.max_latency = __constant_cpu_to_le16(0xffff); | 685 | cp.content_format = cpu_to_le16(setting); |
683 | cp.content_format = cpu_to_le16(hdev->voice_setting); | 686 | |
684 | cp.retrans_effort = 0xff; | 687 | switch (setting & SCO_AIRMODE_MASK) { |
688 | case SCO_AIRMODE_TRANSP: | ||
689 | if (conn->pkt_type & ESCO_2EV3) | ||
690 | cp.max_latency = __constant_cpu_to_le16(0x0008); | ||
691 | else | ||
692 | cp.max_latency = __constant_cpu_to_le16(0x000D); | ||
693 | cp.retrans_effort = 0x02; | ||
694 | break; | ||
695 | case SCO_AIRMODE_CVSD: | ||
696 | cp.max_latency = __constant_cpu_to_le16(0xffff); | ||
697 | cp.retrans_effort = 0xff; | ||
698 | break; | ||
699 | } | ||
685 | 700 | ||
686 | hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, | 701 | hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, |
687 | sizeof(cp), &cp); | 702 | sizeof(cp), &cp); |
@@ -698,7 +713,7 @@ static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
698 | 713 | ||
699 | if (sk->sk_state == BT_CONNECT2 && | 714 | if (sk->sk_state == BT_CONNECT2 && |
700 | test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) { | 715 | test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) { |
701 | sco_conn_defer_accept(pi->conn->hcon, 0); | 716 | sco_conn_defer_accept(pi->conn->hcon, pi->setting); |
702 | sk->sk_state = BT_CONFIG; | 717 | sk->sk_state = BT_CONFIG; |
703 | msg->msg_namelen = 0; | 718 | msg->msg_namelen = 0; |
704 | 719 | ||
@@ -714,7 +729,8 @@ static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
714 | static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) | 729 | static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) |
715 | { | 730 | { |
716 | struct sock *sk = sock->sk; | 731 | struct sock *sk = sock->sk; |
717 | int err = 0; | 732 | int len, err = 0; |
733 | struct bt_voice voice; | ||
718 | u32 opt; | 734 | u32 opt; |
719 | 735 | ||
720 | BT_DBG("sk %p", sk); | 736 | BT_DBG("sk %p", sk); |
@@ -740,6 +756,31 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char | |||
740 | clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags); | 756 | clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags); |
741 | break; | 757 | break; |
742 | 758 | ||
759 | case BT_VOICE: | ||
760 | if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND && | ||
761 | sk->sk_state != BT_CONNECT2) { | ||
762 | err = -EINVAL; | ||
763 | break; | ||
764 | } | ||
765 | |||
766 | voice.setting = sco_pi(sk)->setting; | ||
767 | |||
768 | len = min_t(unsigned int, sizeof(voice), optlen); | ||
769 | if (copy_from_user((char *) &voice, optval, len)) { | ||
770 | err = -EFAULT; | ||
771 | break; | ||
772 | } | ||
773 | |||
774 | /* Explicitly check for these values */ | ||
775 | if (voice.setting != BT_VOICE_TRANSPARENT && | ||
776 | voice.setting != BT_VOICE_CVSD_16BIT) { | ||
777 | err = -EINVAL; | ||
778 | break; | ||
779 | } | ||
780 | |||
781 | sco_pi(sk)->setting = voice.setting; | ||
782 | break; | ||
783 | |||
743 | default: | 784 | default: |
744 | err = -ENOPROTOOPT; | 785 | err = -ENOPROTOOPT; |
745 | break; | 786 | break; |
@@ -765,7 +806,9 @@ static int sco_sock_getsockopt_old(struct socket *sock, int optname, char __user | |||
765 | 806 | ||
766 | switch (optname) { | 807 | switch (optname) { |
767 | case SCO_OPTIONS: | 808 | case SCO_OPTIONS: |
768 | if (sk->sk_state != BT_CONNECTED) { | 809 | if (sk->sk_state != BT_CONNECTED && |
810 | !(sk->sk_state == BT_CONNECT2 && | ||
811 | test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags))) { | ||
769 | err = -ENOTCONN; | 812 | err = -ENOTCONN; |
770 | break; | 813 | break; |
771 | } | 814 | } |
@@ -781,7 +824,9 @@ static int sco_sock_getsockopt_old(struct socket *sock, int optname, char __user | |||
781 | break; | 824 | break; |
782 | 825 | ||
783 | case SCO_CONNINFO: | 826 | case SCO_CONNINFO: |
784 | if (sk->sk_state != BT_CONNECTED) { | 827 | if (sk->sk_state != BT_CONNECTED && |
828 | !(sk->sk_state == BT_CONNECT2 && | ||
829 | test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags))) { | ||
785 | err = -ENOTCONN; | 830 | err = -ENOTCONN; |
786 | break; | 831 | break; |
787 | } | 832 | } |
@@ -809,6 +854,7 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char | |||
809 | { | 854 | { |
810 | struct sock *sk = sock->sk; | 855 | struct sock *sk = sock->sk; |
811 | int len, err = 0; | 856 | int len, err = 0; |
857 | struct bt_voice voice; | ||
812 | 858 | ||
813 | BT_DBG("sk %p", sk); | 859 | BT_DBG("sk %p", sk); |
814 | 860 | ||
@@ -834,6 +880,15 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char | |||
834 | 880 | ||
835 | break; | 881 | break; |
836 | 882 | ||
883 | case BT_VOICE: | ||
884 | voice.setting = sco_pi(sk)->setting; | ||
885 | |||
886 | len = min_t(unsigned int, len, sizeof(voice)); | ||
887 | if (copy_to_user(optval, (char *)&voice, len)) | ||
888 | err = -EFAULT; | ||
889 | |||
890 | break; | ||
891 | |||
837 | default: | 892 | default: |
838 | err = -ENOPROTOOPT; | 893 | err = -ENOPROTOOPT; |
839 | break; | 894 | break; |
diff --git a/net/can/gw.c b/net/can/gw.c index 2f291f961a17..3f9b0f3a2818 100644 --- a/net/can/gw.c +++ b/net/can/gw.c | |||
@@ -146,6 +146,7 @@ struct cgw_job { | |||
146 | /* tbc */ | 146 | /* tbc */ |
147 | }; | 147 | }; |
148 | u8 gwtype; | 148 | u8 gwtype; |
149 | u8 limit_hops; | ||
149 | u16 flags; | 150 | u16 flags; |
150 | }; | 151 | }; |
151 | 152 | ||
@@ -402,6 +403,11 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data) | |||
402 | 403 | ||
403 | /* put the incremented hop counter in the cloned skb */ | 404 | /* put the incremented hop counter in the cloned skb */ |
404 | cgw_hops(nskb) = cgw_hops(skb) + 1; | 405 | cgw_hops(nskb) = cgw_hops(skb) + 1; |
406 | |||
407 | /* first processing of this CAN frame -> adjust to private hop limit */ | ||
408 | if (gwj->limit_hops && cgw_hops(nskb) == 1) | ||
409 | cgw_hops(nskb) = max_hops - gwj->limit_hops + 1; | ||
410 | |||
405 | nskb->dev = gwj->dst.dev; | 411 | nskb->dev = gwj->dst.dev; |
406 | 412 | ||
407 | /* pointer to modifiable CAN frame */ | 413 | /* pointer to modifiable CAN frame */ |
@@ -509,6 +515,11 @@ static int cgw_put_job(struct sk_buff *skb, struct cgw_job *gwj, int type, | |||
509 | 515 | ||
510 | /* check non default settings of attributes */ | 516 | /* check non default settings of attributes */ |
511 | 517 | ||
518 | if (gwj->limit_hops) { | ||
519 | if (nla_put_u8(skb, CGW_LIM_HOPS, gwj->limit_hops) < 0) | ||
520 | goto cancel; | ||
521 | } | ||
522 | |||
512 | if (gwj->mod.modtype.and) { | 523 | if (gwj->mod.modtype.and) { |
513 | memcpy(&mb.cf, &gwj->mod.modframe.and, sizeof(mb.cf)); | 524 | memcpy(&mb.cf, &gwj->mod.modframe.and, sizeof(mb.cf)); |
514 | mb.modtype = gwj->mod.modtype.and; | 525 | mb.modtype = gwj->mod.modtype.and; |
@@ -606,11 +617,12 @@ static const struct nla_policy cgw_policy[CGW_MAX+1] = { | |||
606 | [CGW_SRC_IF] = { .type = NLA_U32 }, | 617 | [CGW_SRC_IF] = { .type = NLA_U32 }, |
607 | [CGW_DST_IF] = { .type = NLA_U32 }, | 618 | [CGW_DST_IF] = { .type = NLA_U32 }, |
608 | [CGW_FILTER] = { .len = sizeof(struct can_filter) }, | 619 | [CGW_FILTER] = { .len = sizeof(struct can_filter) }, |
620 | [CGW_LIM_HOPS] = { .type = NLA_U8 }, | ||
609 | }; | 621 | }; |
610 | 622 | ||
611 | /* check for common and gwtype specific attributes */ | 623 | /* check for common and gwtype specific attributes */ |
612 | static int cgw_parse_attr(struct nlmsghdr *nlh, struct cf_mod *mod, | 624 | static int cgw_parse_attr(struct nlmsghdr *nlh, struct cf_mod *mod, |
613 | u8 gwtype, void *gwtypeattr) | 625 | u8 gwtype, void *gwtypeattr, u8 *limhops) |
614 | { | 626 | { |
615 | struct nlattr *tb[CGW_MAX+1]; | 627 | struct nlattr *tb[CGW_MAX+1]; |
616 | struct cgw_frame_mod mb; | 628 | struct cgw_frame_mod mb; |
@@ -625,6 +637,13 @@ static int cgw_parse_attr(struct nlmsghdr *nlh, struct cf_mod *mod, | |||
625 | if (err < 0) | 637 | if (err < 0) |
626 | return err; | 638 | return err; |
627 | 639 | ||
640 | if (tb[CGW_LIM_HOPS]) { | ||
641 | *limhops = nla_get_u8(tb[CGW_LIM_HOPS]); | ||
642 | |||
643 | if (*limhops < 1 || *limhops > max_hops) | ||
644 | return -EINVAL; | ||
645 | } | ||
646 | |||
628 | /* check for AND/OR/XOR/SET modifications */ | 647 | /* check for AND/OR/XOR/SET modifications */ |
629 | 648 | ||
630 | if (tb[CGW_MOD_AND]) { | 649 | if (tb[CGW_MOD_AND]) { |
@@ -782,6 +801,7 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
782 | { | 801 | { |
783 | struct rtcanmsg *r; | 802 | struct rtcanmsg *r; |
784 | struct cgw_job *gwj; | 803 | struct cgw_job *gwj; |
804 | u8 limhops = 0; | ||
785 | int err = 0; | 805 | int err = 0; |
786 | 806 | ||
787 | if (!capable(CAP_NET_ADMIN)) | 807 | if (!capable(CAP_NET_ADMIN)) |
@@ -808,7 +828,8 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
808 | gwj->flags = r->flags; | 828 | gwj->flags = r->flags; |
809 | gwj->gwtype = r->gwtype; | 829 | gwj->gwtype = r->gwtype; |
810 | 830 | ||
811 | err = cgw_parse_attr(nlh, &gwj->mod, CGW_TYPE_CAN_CAN, &gwj->ccgw); | 831 | err = cgw_parse_attr(nlh, &gwj->mod, CGW_TYPE_CAN_CAN, &gwj->ccgw, |
832 | &limhops); | ||
812 | if (err < 0) | 833 | if (err < 0) |
813 | goto out; | 834 | goto out; |
814 | 835 | ||
@@ -836,6 +857,8 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
836 | if (gwj->dst.dev->type != ARPHRD_CAN || gwj->dst.dev->header_ops) | 857 | if (gwj->dst.dev->type != ARPHRD_CAN || gwj->dst.dev->header_ops) |
837 | goto put_src_dst_out; | 858 | goto put_src_dst_out; |
838 | 859 | ||
860 | gwj->limit_hops = limhops; | ||
861 | |||
839 | ASSERT_RTNL(); | 862 | ASSERT_RTNL(); |
840 | 863 | ||
841 | err = cgw_register_filter(gwj); | 864 | err = cgw_register_filter(gwj); |
@@ -867,13 +890,14 @@ static void cgw_remove_all_jobs(void) | |||
867 | } | 890 | } |
868 | } | 891 | } |
869 | 892 | ||
870 | static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh) | 893 | static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh) |
871 | { | 894 | { |
872 | struct cgw_job *gwj = NULL; | 895 | struct cgw_job *gwj = NULL; |
873 | struct hlist_node *nx; | 896 | struct hlist_node *nx; |
874 | struct rtcanmsg *r; | 897 | struct rtcanmsg *r; |
875 | struct cf_mod mod; | 898 | struct cf_mod mod; |
876 | struct can_can_gw ccgw; | 899 | struct can_can_gw ccgw; |
900 | u8 limhops = 0; | ||
877 | int err = 0; | 901 | int err = 0; |
878 | 902 | ||
879 | if (!capable(CAP_NET_ADMIN)) | 903 | if (!capable(CAP_NET_ADMIN)) |
@@ -890,7 +914,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
890 | if (r->gwtype != CGW_TYPE_CAN_CAN) | 914 | if (r->gwtype != CGW_TYPE_CAN_CAN) |
891 | return -EINVAL; | 915 | return -EINVAL; |
892 | 916 | ||
893 | err = cgw_parse_attr(nlh, &mod, CGW_TYPE_CAN_CAN, &ccgw); | 917 | err = cgw_parse_attr(nlh, &mod, CGW_TYPE_CAN_CAN, &ccgw, &limhops); |
894 | if (err < 0) | 918 | if (err < 0) |
895 | return err; | 919 | return err; |
896 | 920 | ||
@@ -910,6 +934,9 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
910 | if (gwj->flags != r->flags) | 934 | if (gwj->flags != r->flags) |
911 | continue; | 935 | continue; |
912 | 936 | ||
937 | if (gwj->limit_hops != limhops) | ||
938 | continue; | ||
939 | |||
913 | if (memcmp(&gwj->mod, &mod, sizeof(mod))) | 940 | if (memcmp(&gwj->mod, &mod, sizeof(mod))) |
914 | continue; | 941 | continue; |
915 | 942 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 6fbb0c90849b..5c713f2239cc 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1697,7 +1697,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | |||
1697 | * call skb_scrub_packet() after it to clear pkt_type _after_ calling | 1697 | * call skb_scrub_packet() after it to clear pkt_type _after_ calling |
1698 | * eth_type_trans(). | 1698 | * eth_type_trans(). |
1699 | */ | 1699 | */ |
1700 | skb_scrub_packet(skb); | 1700 | skb_scrub_packet(skb, true); |
1701 | 1701 | ||
1702 | return netif_rx(skb); | 1702 | return netif_rx(skb); |
1703 | } | 1703 | } |
@@ -4679,8 +4679,8 @@ static int __netdev_upper_dev_link(struct net_device *dev, | |||
4679 | * versa, and don't forget the devices itself. All of these | 4679 | * versa, and don't forget the devices itself. All of these |
4680 | * links are non-neighbours. | 4680 | * links are non-neighbours. |
4681 | */ | 4681 | */ |
4682 | list_for_each_entry(i, &upper_dev->upper_dev_list, list) { | 4682 | list_for_each_entry(i, &dev->lower_dev_list, list) { |
4683 | list_for_each_entry(j, &dev->lower_dev_list, list) { | 4683 | list_for_each_entry(j, &upper_dev->upper_dev_list, list) { |
4684 | ret = __netdev_adjacent_dev_link(i->dev, j->dev); | 4684 | ret = __netdev_adjacent_dev_link(i->dev, j->dev); |
4685 | if (ret) | 4685 | if (ret) |
4686 | goto rollback_mesh; | 4686 | goto rollback_mesh; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 60533db8b72d..6072610a8672 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2759,13 +2759,11 @@ errout: | |||
2759 | rtnl_set_sk_err(net, RTNLGRP_NEIGH, err); | 2759 | rtnl_set_sk_err(net, RTNLGRP_NEIGH, err); |
2760 | } | 2760 | } |
2761 | 2761 | ||
2762 | #ifdef CONFIG_ARPD | ||
2763 | void neigh_app_ns(struct neighbour *n) | 2762 | void neigh_app_ns(struct neighbour *n) |
2764 | { | 2763 | { |
2765 | __neigh_notify(n, RTM_GETNEIGH, NLM_F_REQUEST); | 2764 | __neigh_notify(n, RTM_GETNEIGH, NLM_F_REQUEST); |
2766 | } | 2765 | } |
2767 | EXPORT_SYMBOL(neigh_app_ns); | 2766 | EXPORT_SYMBOL(neigh_app_ns); |
2768 | #endif /* CONFIG_ARPD */ | ||
2769 | 2767 | ||
2770 | #ifdef CONFIG_SYSCTL | 2768 | #ifdef CONFIG_SYSCTL |
2771 | static int zero; | 2769 | static int zero; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 2c3d0f53d198..d81cff119f73 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3500,17 +3500,22 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, | |||
3500 | EXPORT_SYMBOL(skb_try_coalesce); | 3500 | EXPORT_SYMBOL(skb_try_coalesce); |
3501 | 3501 | ||
3502 | /** | 3502 | /** |
3503 | * skb_scrub_packet - scrub an skb before sending it to another netns | 3503 | * skb_scrub_packet - scrub an skb |
3504 | * | 3504 | * |
3505 | * @skb: buffer to clean | 3505 | * @skb: buffer to clean |
3506 | * | 3506 | * @xnet: packet is crossing netns |
3507 | * skb_scrub_packet can be used to clean an skb before injecting it in | 3507 | * |
3508 | * another namespace. We have to clear all information in the skb that | 3508 | * skb_scrub_packet can be used after encapsulating or decapsulting a packet |
3509 | * could impact namespace isolation. | 3509 | * into/from a tunnel. Some information have to be cleared during these |
3510 | * operations. | ||
3511 | * skb_scrub_packet can also be used to clean a skb before injecting it in | ||
3512 | * another namespace (@xnet == true). We have to clear all information in the | ||
3513 | * skb that could impact namespace isolation. | ||
3510 | */ | 3514 | */ |
3511 | void skb_scrub_packet(struct sk_buff *skb) | 3515 | void skb_scrub_packet(struct sk_buff *skb, bool xnet) |
3512 | { | 3516 | { |
3513 | skb_orphan(skb); | 3517 | if (xnet) |
3518 | skb_orphan(skb); | ||
3514 | skb->tstamp.tv64 = 0; | 3519 | skb->tstamp.tv64 = 0; |
3515 | skb->pkt_type = PACKET_HOST; | 3520 | skb->pkt_type = PACKET_HOST; |
3516 | skb->skb_iif = 0; | 3521 | skb->skb_iif = 0; |
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 6ebd8fbd9285..29d684ebca6a 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -347,7 +347,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, | |||
347 | 347 | ||
348 | slave_dev->features = master->vlan_features; | 348 | slave_dev->features = master->vlan_features; |
349 | SET_ETHTOOL_OPS(slave_dev, &dsa_slave_ethtool_ops); | 349 | SET_ETHTOOL_OPS(slave_dev, &dsa_slave_ethtool_ops); |
350 | memcpy(slave_dev->dev_addr, master->dev_addr, ETH_ALEN); | 350 | eth_hw_addr_inherit(slave_dev, master); |
351 | slave_dev->tx_queue_len = 0; | 351 | slave_dev->tx_queue_len = 0; |
352 | 352 | ||
353 | switch (ds->dst->tag_protocol) { | 353 | switch (ds->dst->tag_protocol) { |
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 37cf1a6ea3ad..05c57f0fcabe 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -259,22 +259,6 @@ config IP_PIMSM_V2 | |||
259 | gated-5). This routing protocol is not used widely, so say N unless | 259 | gated-5). This routing protocol is not used widely, so say N unless |
260 | you want to play with it. | 260 | you want to play with it. |
261 | 261 | ||
262 | config ARPD | ||
263 | bool "IP: ARP daemon support" | ||
264 | ---help--- | ||
265 | The kernel maintains an internal cache which maps IP addresses to | ||
266 | hardware addresses on the local network, so that Ethernet | ||
267 | frames are sent to the proper address on the physical networking | ||
268 | layer. Normally, kernel uses the ARP protocol to resolve these | ||
269 | mappings. | ||
270 | |||
271 | Saying Y here adds support to have an user space daemon to do this | ||
272 | resolution instead. This is useful for implementing an alternate | ||
273 | address resolution protocol (e.g. NHRP on mGRE tunnels) and also for | ||
274 | testing purposes. | ||
275 | |||
276 | If unsure, say N. | ||
277 | |||
278 | config SYN_COOKIES | 262 | config SYN_COOKIES |
279 | bool "IP: TCP syncookie support" | 263 | bool "IP: TCP syncookie support" |
280 | ---help--- | 264 | ---help--- |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 4429b013f269..7808093cede6 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -368,9 +368,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
368 | } else { | 368 | } else { |
369 | probes -= neigh->parms->app_probes; | 369 | probes -= neigh->parms->app_probes; |
370 | if (probes < 0) { | 370 | if (probes < 0) { |
371 | #ifdef CONFIG_ARPD | ||
372 | neigh_app_ns(neigh); | 371 | neigh_app_ns(neigh); |
373 | #endif | ||
374 | return; | 372 | return; |
375 | } | 373 | } |
376 | } | 374 | } |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 830de3f4e293..ac9fabe0300f 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -461,8 +461,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, | |||
461 | skb->dev = tunnel->dev; | 461 | skb->dev = tunnel->dev; |
462 | } | 462 | } |
463 | 463 | ||
464 | if (!net_eq(tunnel->net, dev_net(tunnel->dev))) | 464 | skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(tunnel->dev))); |
465 | skb_scrub_packet(skb); | ||
466 | 465 | ||
467 | gro_cells_receive(&tunnel->gro_cells, skb); | 466 | gro_cells_receive(&tunnel->gro_cells, skb); |
468 | return 0; | 467 | return 0; |
@@ -614,9 +613,6 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, | |||
614 | goto tx_error; | 613 | goto tx_error; |
615 | } | 614 | } |
616 | 615 | ||
617 | if (!net_eq(tunnel->net, dev_net(dev))) | ||
618 | skb_scrub_packet(skb); | ||
619 | |||
620 | if (tunnel->err_count > 0) { | 616 | if (tunnel->err_count > 0) { |
621 | if (time_before(jiffies, | 617 | if (time_before(jiffies, |
622 | tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { | 618 | tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { |
@@ -654,9 +650,9 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, | |||
654 | } | 650 | } |
655 | } | 651 | } |
656 | 652 | ||
657 | err = iptunnel_xmit(tunnel->net, rt, skb, | 653 | err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol, |
658 | fl4.saddr, fl4.daddr, protocol, | 654 | ip_tunnel_ecn_encap(tos, inner_iph, skb), ttl, df, |
659 | ip_tunnel_ecn_encap(tos, inner_iph, skb), ttl, df); | 655 | !net_eq(tunnel->net, dev_net(dev))); |
660 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); | 656 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); |
661 | 657 | ||
662 | return; | 658 | return; |
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index 850525b34899..d6c856b17fd4 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c | |||
@@ -46,19 +46,17 @@ | |||
46 | #include <net/netns/generic.h> | 46 | #include <net/netns/generic.h> |
47 | #include <net/rtnetlink.h> | 47 | #include <net/rtnetlink.h> |
48 | 48 | ||
49 | int iptunnel_xmit(struct net *net, struct rtable *rt, | 49 | int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, |
50 | struct sk_buff *skb, | ||
51 | __be32 src, __be32 dst, __u8 proto, | 50 | __be32 src, __be32 dst, __u8 proto, |
52 | __u8 tos, __u8 ttl, __be16 df) | 51 | __u8 tos, __u8 ttl, __be16 df, bool xnet) |
53 | { | 52 | { |
54 | int pkt_len = skb->len; | 53 | int pkt_len = skb->len; |
55 | struct iphdr *iph; | 54 | struct iphdr *iph; |
56 | int err; | 55 | int err; |
57 | 56 | ||
58 | nf_reset(skb); | 57 | skb_scrub_packet(skb, xnet); |
59 | secpath_reset(skb); | 58 | |
60 | skb->rxhash = 0; | 59 | skb->rxhash = 0; |
61 | skb_dst_drop(skb); | ||
62 | skb_dst_set(skb, &rt->dst); | 60 | skb_dst_set(skb, &rt->dst); |
63 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); | 61 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
64 | 62 | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index bacc0bcf48ce..9ae54b09254f 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -2067,9 +2067,8 @@ static int __pim_rcv(struct mr_table *mrt, struct sk_buff *skb, | |||
2067 | skb_reset_network_header(skb); | 2067 | skb_reset_network_header(skb); |
2068 | skb->protocol = htons(ETH_P_IP); | 2068 | skb->protocol = htons(ETH_P_IP); |
2069 | skb->ip_summed = CHECKSUM_NONE; | 2069 | skb->ip_summed = CHECKSUM_NONE; |
2070 | skb->pkt_type = PACKET_HOST; | ||
2071 | 2070 | ||
2072 | skb_tunnel_rx(skb, reg_dev); | 2071 | skb_tunnel_rx(skb, reg_dev, dev_net(reg_dev)); |
2073 | 2072 | ||
2074 | netif_rx(skb); | 2073 | netif_rx(skb); |
2075 | 2074 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1a84fffe6993..93d7e9de4143 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5049,8 +5049,8 @@ discard: | |||
5049 | * the rest is checked inline. Fast processing is turned on in | 5049 | * the rest is checked inline. Fast processing is turned on in |
5050 | * tcp_data_queue when everything is OK. | 5050 | * tcp_data_queue when everything is OK. |
5051 | */ | 5051 | */ |
5052 | int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | 5052 | void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
5053 | const struct tcphdr *th, unsigned int len) | 5053 | const struct tcphdr *th, unsigned int len) |
5054 | { | 5054 | { |
5055 | struct tcp_sock *tp = tcp_sk(sk); | 5055 | struct tcp_sock *tp = tcp_sk(sk); |
5056 | 5056 | ||
@@ -5127,7 +5127,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
5127 | tcp_ack(sk, skb, 0); | 5127 | tcp_ack(sk, skb, 0); |
5128 | __kfree_skb(skb); | 5128 | __kfree_skb(skb); |
5129 | tcp_data_snd_check(sk); | 5129 | tcp_data_snd_check(sk); |
5130 | return 0; | 5130 | return; |
5131 | } else { /* Header too small */ | 5131 | } else { /* Header too small */ |
5132 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS); | 5132 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS); |
5133 | goto discard; | 5133 | goto discard; |
@@ -5220,7 +5220,7 @@ no_ack: | |||
5220 | if (eaten) | 5220 | if (eaten) |
5221 | kfree_skb_partial(skb, fragstolen); | 5221 | kfree_skb_partial(skb, fragstolen); |
5222 | sk->sk_data_ready(sk, 0); | 5222 | sk->sk_data_ready(sk, 0); |
5223 | return 0; | 5223 | return; |
5224 | } | 5224 | } |
5225 | } | 5225 | } |
5226 | 5226 | ||
@@ -5236,7 +5236,7 @@ slow_path: | |||
5236 | */ | 5236 | */ |
5237 | 5237 | ||
5238 | if (!tcp_validate_incoming(sk, skb, th, 1)) | 5238 | if (!tcp_validate_incoming(sk, skb, th, 1)) |
5239 | return 0; | 5239 | return; |
5240 | 5240 | ||
5241 | step5: | 5241 | step5: |
5242 | if (tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT) < 0) | 5242 | if (tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT) < 0) |
@@ -5252,7 +5252,7 @@ step5: | |||
5252 | 5252 | ||
5253 | tcp_data_snd_check(sk); | 5253 | tcp_data_snd_check(sk); |
5254 | tcp_ack_snd_check(sk); | 5254 | tcp_ack_snd_check(sk); |
5255 | return 0; | 5255 | return; |
5256 | 5256 | ||
5257 | csum_error: | 5257 | csum_error: |
5258 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_CSUMERRORS); | 5258 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_CSUMERRORS); |
@@ -5260,7 +5260,6 @@ csum_error: | |||
5260 | 5260 | ||
5261 | discard: | 5261 | discard: |
5262 | __kfree_skb(skb); | 5262 | __kfree_skb(skb); |
5263 | return 0; | ||
5264 | } | 5263 | } |
5265 | EXPORT_SYMBOL(tcp_rcv_established); | 5264 | EXPORT_SYMBOL(tcp_rcv_established); |
5266 | 5265 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 09d45d718973..b14266bb91eb 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1799,10 +1799,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1799 | sk->sk_rx_dst = NULL; | 1799 | sk->sk_rx_dst = NULL; |
1800 | } | 1800 | } |
1801 | } | 1801 | } |
1802 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) { | 1802 | tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len); |
1803 | rsk = sk; | ||
1804 | goto reset; | ||
1805 | } | ||
1806 | return 0; | 1803 | return 0; |
1807 | } | 1804 | } |
1808 | 1805 | ||
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index 622a4377b397..611beab38a00 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -122,8 +122,8 @@ static inline int tcp_probe_avail(void) | |||
122 | * Hook inserted to be called before each receive packet. | 122 | * Hook inserted to be called before each receive packet. |
123 | * Note: arguments must match tcp_rcv_established()! | 123 | * Note: arguments must match tcp_rcv_established()! |
124 | */ | 124 | */ |
125 | static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, | 125 | static void jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
126 | const struct tcphdr *th, unsigned int len) | 126 | const struct tcphdr *th, unsigned int len) |
127 | { | 127 | { |
128 | const struct tcp_sock *tp = tcp_sk(sk); | 128 | const struct tcp_sock *tp = tcp_sk(sk); |
129 | const struct inet_sock *inet = inet_sk(sk); | 129 | const struct inet_sock *inet = inet_sk(sk); |
@@ -172,7 +172,6 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
172 | } | 172 | } |
173 | 173 | ||
174 | jprobe_return(); | 174 | jprobe_return(); |
175 | return 0; | ||
176 | } | 175 | } |
177 | 176 | ||
178 | static struct jprobe tcp_jprobe = { | 177 | static struct jprobe tcp_jprobe = { |
@@ -218,7 +217,7 @@ static ssize_t tcpprobe_read(struct file *file, char __user *buf, | |||
218 | return -EINVAL; | 217 | return -EINVAL; |
219 | 218 | ||
220 | while (cnt < len) { | 219 | while (cnt < len) { |
221 | char tbuf[164]; | 220 | char tbuf[256]; |
222 | int width; | 221 | int width; |
223 | 222 | ||
224 | /* Wait for data in buffer */ | 223 | /* Wait for data in buffer */ |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index f2d0a42f8057..db992a373011 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -509,8 +509,6 @@ static int ip6gre_rcv(struct sk_buff *skb) | |||
509 | goto drop; | 509 | goto drop; |
510 | } | 510 | } |
511 | 511 | ||
512 | secpath_reset(skb); | ||
513 | |||
514 | skb->protocol = gre_proto; | 512 | skb->protocol = gre_proto; |
515 | /* WCCP version 1 and 2 protocol decoding. | 513 | /* WCCP version 1 and 2 protocol decoding. |
516 | * - Change protocol to IP | 514 | * - Change protocol to IP |
@@ -525,7 +523,6 @@ static int ip6gre_rcv(struct sk_buff *skb) | |||
525 | skb->mac_header = skb->network_header; | 523 | skb->mac_header = skb->network_header; |
526 | __pskb_pull(skb, offset); | 524 | __pskb_pull(skb, offset); |
527 | skb_postpull_rcsum(skb, skb_transport_header(skb), offset); | 525 | skb_postpull_rcsum(skb, skb_transport_header(skb), offset); |
528 | skb->pkt_type = PACKET_HOST; | ||
529 | 526 | ||
530 | if (((flags&GRE_CSUM) && csum) || | 527 | if (((flags&GRE_CSUM) && csum) || |
531 | (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) { | 528 | (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) { |
@@ -557,7 +554,7 @@ static int ip6gre_rcv(struct sk_buff *skb) | |||
557 | skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN); | 554 | skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN); |
558 | } | 555 | } |
559 | 556 | ||
560 | __skb_tunnel_rx(skb, tunnel->dev); | 557 | __skb_tunnel_rx(skb, tunnel->dev, tunnel->net); |
561 | 558 | ||
562 | skb_reset_network_header(skb); | 559 | skb_reset_network_header(skb); |
563 | 560 | ||
@@ -694,6 +691,8 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, | |||
694 | tunnel->err_count = 0; | 691 | tunnel->err_count = 0; |
695 | } | 692 | } |
696 | 693 | ||
694 | skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(dev))); | ||
695 | |||
697 | max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + dst->header_len; | 696 | max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + dst->header_len; |
698 | 697 | ||
699 | if (skb_headroom(skb) < max_headroom || skb_shared(skb) || | 698 | if (skb_headroom(skb) < max_headroom || skb_shared(skb) || |
@@ -710,8 +709,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, | |||
710 | skb = new_skb; | 709 | skb = new_skb; |
711 | } | 710 | } |
712 | 711 | ||
713 | skb_dst_drop(skb); | ||
714 | |||
715 | if (fl6->flowi6_mark) { | 712 | if (fl6->flowi6_mark) { |
716 | skb_dst_set(skb, dst); | 713 | skb_dst_set(skb, dst); |
717 | ndst = NULL; | 714 | ndst = NULL; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index d6e00a39274c..55999d923f26 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -802,14 +802,12 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, | |||
802 | rcu_read_unlock(); | 802 | rcu_read_unlock(); |
803 | goto discard; | 803 | goto discard; |
804 | } | 804 | } |
805 | secpath_reset(skb); | ||
806 | skb->mac_header = skb->network_header; | 805 | skb->mac_header = skb->network_header; |
807 | skb_reset_network_header(skb); | 806 | skb_reset_network_header(skb); |
808 | skb->protocol = htons(protocol); | 807 | skb->protocol = htons(protocol); |
809 | skb->pkt_type = PACKET_HOST; | ||
810 | memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); | 808 | memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); |
811 | 809 | ||
812 | __skb_tunnel_rx(skb, t->dev); | 810 | __skb_tunnel_rx(skb, t->dev, t->net); |
813 | 811 | ||
814 | err = dscp_ecn_decapsulate(t, ipv6h, skb); | 812 | err = dscp_ecn_decapsulate(t, ipv6h, skb); |
815 | if (unlikely(err)) { | 813 | if (unlikely(err)) { |
@@ -829,9 +827,6 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, | |||
829 | tstats->rx_packets++; | 827 | tstats->rx_packets++; |
830 | tstats->rx_bytes += skb->len; | 828 | tstats->rx_bytes += skb->len; |
831 | 829 | ||
832 | if (!net_eq(t->net, dev_net(t->dev))) | ||
833 | skb_scrub_packet(skb); | ||
834 | |||
835 | netif_rx(skb); | 830 | netif_rx(skb); |
836 | 831 | ||
837 | rcu_read_unlock(); | 832 | rcu_read_unlock(); |
@@ -1001,8 +996,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
1001 | goto tx_err_dst_release; | 996 | goto tx_err_dst_release; |
1002 | } | 997 | } |
1003 | 998 | ||
1004 | if (!net_eq(t->net, dev_net(dev))) | 999 | skb_scrub_packet(skb, !net_eq(t->net, dev_net(dev))); |
1005 | skb_scrub_packet(skb); | ||
1006 | 1000 | ||
1007 | /* | 1001 | /* |
1008 | * Okay, now see if we can stuff it in the buffer as-is. | 1002 | * Okay, now see if we can stuff it in the buffer as-is. |
@@ -1021,7 +1015,6 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
1021 | consume_skb(skb); | 1015 | consume_skb(skb); |
1022 | skb = new_skb; | 1016 | skb = new_skb; |
1023 | } | 1017 | } |
1024 | skb_dst_drop(skb); | ||
1025 | if (fl6->flowi6_mark) { | 1018 | if (fl6->flowi6_mark) { |
1026 | skb_dst_set(skb, dst); | 1019 | skb_dst_set(skb, dst); |
1027 | ndst = NULL; | 1020 | ndst = NULL; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index a60a84ef04f7..f365310bfcca 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -672,9 +672,8 @@ static int pim6_rcv(struct sk_buff *skb) | |||
672 | skb_reset_network_header(skb); | 672 | skb_reset_network_header(skb); |
673 | skb->protocol = htons(ETH_P_IPV6); | 673 | skb->protocol = htons(ETH_P_IPV6); |
674 | skb->ip_summed = CHECKSUM_NONE; | 674 | skb->ip_summed = CHECKSUM_NONE; |
675 | skb->pkt_type = PACKET_HOST; | ||
676 | 675 | ||
677 | skb_tunnel_rx(skb, reg_dev); | 676 | skb_tunnel_rx(skb, reg_dev, dev_net(reg_dev)); |
678 | 677 | ||
679 | netif_rx(skb); | 678 | netif_rx(skb); |
680 | 679 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 14bd2f9d9dbb..22210650596f 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -662,9 +662,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
662 | } | 662 | } |
663 | ndisc_send_ns(dev, neigh, target, target, saddr); | 663 | ndisc_send_ns(dev, neigh, target, target, saddr); |
664 | } else if ((probes -= neigh->parms->app_probes) < 0) { | 664 | } else if ((probes -= neigh->parms->app_probes) < 0) { |
665 | #ifdef CONFIG_ARPD | ||
666 | neigh_app_ns(neigh); | 665 | neigh_app_ns(neigh); |
667 | #endif | ||
668 | } else { | 666 | } else { |
669 | addrconf_addr_solict_mult(target, &mcaddr); | 667 | addrconf_addr_solict_mult(target, &mcaddr); |
670 | ndisc_send_ns(dev, NULL, target, &mcaddr, saddr); | 668 | ndisc_send_ns(dev, NULL, target, &mcaddr, saddr); |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index f18f842ac893..19abcc9d6a1a 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -581,12 +581,10 @@ static int ipip6_rcv(struct sk_buff *skb) | |||
581 | tunnel->parms.iph.protocol != 0) | 581 | tunnel->parms.iph.protocol != 0) |
582 | goto out; | 582 | goto out; |
583 | 583 | ||
584 | secpath_reset(skb); | ||
585 | skb->mac_header = skb->network_header; | 584 | skb->mac_header = skb->network_header; |
586 | skb_reset_network_header(skb); | 585 | skb_reset_network_header(skb); |
587 | IPCB(skb)->flags = 0; | 586 | IPCB(skb)->flags = 0; |
588 | skb->protocol = htons(ETH_P_IPV6); | 587 | skb->protocol = htons(ETH_P_IPV6); |
589 | skb->pkt_type = PACKET_HOST; | ||
590 | 588 | ||
591 | if (tunnel->dev->priv_flags & IFF_ISATAP) { | 589 | if (tunnel->dev->priv_flags & IFF_ISATAP) { |
592 | if (!isatap_chksrc(skb, iph, tunnel)) { | 590 | if (!isatap_chksrc(skb, iph, tunnel)) { |
@@ -603,7 +601,7 @@ static int ipip6_rcv(struct sk_buff *skb) | |||
603 | } | 601 | } |
604 | } | 602 | } |
605 | 603 | ||
606 | __skb_tunnel_rx(skb, tunnel->dev); | 604 | __skb_tunnel_rx(skb, tunnel->dev, tunnel->net); |
607 | 605 | ||
608 | err = IP_ECN_decapsulate(iph, skb); | 606 | err = IP_ECN_decapsulate(iph, skb); |
609 | if (unlikely(err)) { | 607 | if (unlikely(err)) { |
@@ -621,8 +619,6 @@ static int ipip6_rcv(struct sk_buff *skb) | |||
621 | tstats->rx_packets++; | 619 | tstats->rx_packets++; |
622 | tstats->rx_bytes += skb->len; | 620 | tstats->rx_bytes += skb->len; |
623 | 621 | ||
624 | if (!net_eq(tunnel->net, dev_net(tunnel->dev))) | ||
625 | skb_scrub_packet(skb); | ||
626 | netif_rx(skb); | 622 | netif_rx(skb); |
627 | 623 | ||
628 | return 0; | 624 | return 0; |
@@ -860,9 +856,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
860 | tunnel->err_count = 0; | 856 | tunnel->err_count = 0; |
861 | } | 857 | } |
862 | 858 | ||
863 | if (!net_eq(tunnel->net, dev_net(dev))) | ||
864 | skb_scrub_packet(skb); | ||
865 | |||
866 | /* | 859 | /* |
867 | * Okay, now see if we can stuff it in the buffer as-is. | 860 | * Okay, now see if we can stuff it in the buffer as-is. |
868 | */ | 861 | */ |
@@ -888,8 +881,8 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
888 | ttl = iph6->hop_limit; | 881 | ttl = iph6->hop_limit; |
889 | tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6)); | 882 | tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6)); |
890 | 883 | ||
891 | err = iptunnel_xmit(dev_net(dev), rt, skb, fl4.saddr, fl4.daddr, | 884 | err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, IPPROTO_IPV6, tos, |
892 | IPPROTO_IPV6, tos, ttl, df); | 885 | ttl, df, !net_eq(tunnel->net, dev_net(dev))); |
893 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); | 886 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); |
894 | return NETDEV_TX_OK; | 887 | return NETDEV_TX_OK; |
895 | 888 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 5bcfadf09e95..9acdcedf9a14 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1360,8 +1360,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1360 | } | 1360 | } |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) | 1363 | tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len); |
1364 | goto reset; | ||
1365 | if (opt_skb) | 1364 | if (opt_skb) |
1366 | goto ipv6_pktoptions; | 1365 | goto ipv6_pktoptions; |
1367 | return 0; | 1366 | return 0; |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 48aaa89253e0..6cba486353e8 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -321,12 +321,12 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) | |||
321 | if (llc->dev) { | 321 | if (llc->dev) { |
322 | if (!addr->sllc_arphrd) | 322 | if (!addr->sllc_arphrd) |
323 | addr->sllc_arphrd = llc->dev->type; | 323 | addr->sllc_arphrd = llc->dev->type; |
324 | if (llc_mac_null(addr->sllc_mac)) | 324 | if (is_zero_ether_addr(addr->sllc_mac)) |
325 | memcpy(addr->sllc_mac, llc->dev->dev_addr, | 325 | memcpy(addr->sllc_mac, llc->dev->dev_addr, |
326 | IFHWADDRLEN); | 326 | IFHWADDRLEN); |
327 | if (addr->sllc_arphrd != llc->dev->type || | 327 | if (addr->sllc_arphrd != llc->dev->type || |
328 | !llc_mac_match(addr->sllc_mac, | 328 | !ether_addr_equal(addr->sllc_mac, |
329 | llc->dev->dev_addr)) { | 329 | llc->dev->dev_addr)) { |
330 | rc = -EINVAL; | 330 | rc = -EINVAL; |
331 | llc->dev = NULL; | 331 | llc->dev = NULL; |
332 | } | 332 | } |
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index 0d0d416dfab6..cd8724177965 100644 --- a/net/llc/llc_conn.c +++ b/net/llc/llc_conn.c | |||
@@ -478,8 +478,8 @@ static inline bool llc_estab_match(const struct llc_sap *sap, | |||
478 | 478 | ||
479 | return llc->laddr.lsap == laddr->lsap && | 479 | return llc->laddr.lsap == laddr->lsap && |
480 | llc->daddr.lsap == daddr->lsap && | 480 | llc->daddr.lsap == daddr->lsap && |
481 | llc_mac_match(llc->laddr.mac, laddr->mac) && | 481 | ether_addr_equal(llc->laddr.mac, laddr->mac) && |
482 | llc_mac_match(llc->daddr.mac, daddr->mac); | 482 | ether_addr_equal(llc->daddr.mac, daddr->mac); |
483 | } | 483 | } |
484 | 484 | ||
485 | /** | 485 | /** |
@@ -550,7 +550,7 @@ static inline bool llc_listener_match(const struct llc_sap *sap, | |||
550 | 550 | ||
551 | return sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN && | 551 | return sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN && |
552 | llc->laddr.lsap == laddr->lsap && | 552 | llc->laddr.lsap == laddr->lsap && |
553 | llc_mac_match(llc->laddr.mac, laddr->mac); | 553 | ether_addr_equal(llc->laddr.mac, laddr->mac); |
554 | } | 554 | } |
555 | 555 | ||
556 | static struct sock *__llc_lookup_listener(struct llc_sap *sap, | 556 | static struct sock *__llc_lookup_listener(struct llc_sap *sap, |
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 78be45cda5c1..e5850699098e 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c | |||
@@ -302,7 +302,7 @@ static inline bool llc_dgram_match(const struct llc_sap *sap, | |||
302 | 302 | ||
303 | return sk->sk_type == SOCK_DGRAM && | 303 | return sk->sk_type == SOCK_DGRAM && |
304 | llc->laddr.lsap == laddr->lsap && | 304 | llc->laddr.lsap == laddr->lsap && |
305 | llc_mac_match(llc->laddr.mac, laddr->mac); | 305 | ether_addr_equal(llc->laddr.mac, laddr->mac); |
306 | } | 306 | } |
307 | 307 | ||
308 | /** | 308 | /** |
@@ -425,7 +425,7 @@ void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb) | |||
425 | llc_pdu_decode_da(skb, laddr.mac); | 425 | llc_pdu_decode_da(skb, laddr.mac); |
426 | llc_pdu_decode_dsap(skb, &laddr.lsap); | 426 | llc_pdu_decode_dsap(skb, &laddr.lsap); |
427 | 427 | ||
428 | if (llc_mac_multicast(laddr.mac)) { | 428 | if (is_multicast_ether_addr(laddr.mac)) { |
429 | llc_sap_mcast(sap, &laddr, skb); | 429 | llc_sap_mcast(sap, &laddr, skb); |
430 | kfree_skb(skb); | 430 | kfree_skb(skb); |
431 | } else { | 431 | } else { |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 31fc2247bc37..2e7855a1b10d 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -2302,14 +2302,25 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy) | |||
2302 | } | 2302 | } |
2303 | 2303 | ||
2304 | #ifdef CONFIG_NL80211_TESTMODE | 2304 | #ifdef CONFIG_NL80211_TESTMODE |
2305 | static int ieee80211_testmode_cmd(struct wiphy *wiphy, void *data, int len) | 2305 | static int ieee80211_testmode_cmd(struct wiphy *wiphy, |
2306 | struct wireless_dev *wdev, | ||
2307 | void *data, int len) | ||
2306 | { | 2308 | { |
2307 | struct ieee80211_local *local = wiphy_priv(wiphy); | 2309 | struct ieee80211_local *local = wiphy_priv(wiphy); |
2310 | struct ieee80211_vif *vif = NULL; | ||
2308 | 2311 | ||
2309 | if (!local->ops->testmode_cmd) | 2312 | if (!local->ops->testmode_cmd) |
2310 | return -EOPNOTSUPP; | 2313 | return -EOPNOTSUPP; |
2311 | 2314 | ||
2312 | return local->ops->testmode_cmd(&local->hw, data, len); | 2315 | if (wdev) { |
2316 | struct ieee80211_sub_if_data *sdata; | ||
2317 | |||
2318 | sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); | ||
2319 | if (sdata->flags & IEEE80211_SDATA_IN_DRIVER) | ||
2320 | vif = &sdata->vif; | ||
2321 | } | ||
2322 | |||
2323 | return local->ops->testmode_cmd(&local->hw, vif, data, len); | ||
2313 | } | 2324 | } |
2314 | 2325 | ||
2315 | static int ieee80211_testmode_dump(struct wiphy *wiphy, | 2326 | static int ieee80211_testmode_dump(struct wiphy *wiphy, |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index e08387cdc8fd..a12afe77bb26 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -34,13 +34,12 @@ | |||
34 | 34 | ||
35 | #define IEEE80211_IBSS_MAX_STA_ENTRIES 128 | 35 | #define IEEE80211_IBSS_MAX_STA_ENTRIES 128 |
36 | 36 | ||
37 | 37 | static struct beacon_data * | |
38 | static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | 38 | ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata, |
39 | const u8 *bssid, const int beacon_int, | 39 | const int beacon_int, const u32 basic_rates, |
40 | struct ieee80211_channel *chan, | 40 | const u16 capability, u64 tsf, |
41 | const u32 basic_rates, | 41 | struct cfg80211_chan_def *chandef, |
42 | const u16 capability, u64 tsf, | 42 | bool *have_higher_than_11mbit) |
43 | bool creator) | ||
44 | { | 43 | { |
45 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | 44 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; |
46 | struct ieee80211_local *local = sdata->local; | 45 | struct ieee80211_local *local = sdata->local; |
@@ -48,70 +47,11 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
48 | struct ieee80211_mgmt *mgmt; | 47 | struct ieee80211_mgmt *mgmt; |
49 | u8 *pos; | 48 | u8 *pos; |
50 | struct ieee80211_supported_band *sband; | 49 | struct ieee80211_supported_band *sband; |
51 | struct cfg80211_bss *bss; | 50 | u32 rate_flags, rates = 0, rates_added = 0; |
52 | u32 bss_change, rate_flags, rates = 0, rates_added = 0; | ||
53 | struct cfg80211_chan_def chandef; | ||
54 | enum nl80211_bss_scan_width scan_width; | ||
55 | bool have_higher_than_11mbit = false; | ||
56 | struct beacon_data *presp; | 51 | struct beacon_data *presp; |
57 | int frame_len; | 52 | int frame_len; |
58 | int shift; | 53 | int shift; |
59 | 54 | ||
60 | sdata_assert_lock(sdata); | ||
61 | |||
62 | /* Reset own TSF to allow time synchronization work. */ | ||
63 | drv_reset_tsf(local, sdata); | ||
64 | |||
65 | if (!ether_addr_equal(ifibss->bssid, bssid)) | ||
66 | sta_info_flush(sdata); | ||
67 | |||
68 | /* if merging, indicate to driver that we leave the old IBSS */ | ||
69 | if (sdata->vif.bss_conf.ibss_joined) { | ||
70 | sdata->vif.bss_conf.ibss_joined = false; | ||
71 | sdata->vif.bss_conf.ibss_creator = false; | ||
72 | sdata->vif.bss_conf.enable_beacon = false; | ||
73 | netif_carrier_off(sdata->dev); | ||
74 | ieee80211_bss_info_change_notify(sdata, | ||
75 | BSS_CHANGED_IBSS | | ||
76 | BSS_CHANGED_BEACON_ENABLED); | ||
77 | } | ||
78 | |||
79 | presp = rcu_dereference_protected(ifibss->presp, | ||
80 | lockdep_is_held(&sdata->wdev.mtx)); | ||
81 | rcu_assign_pointer(ifibss->presp, NULL); | ||
82 | if (presp) | ||
83 | kfree_rcu(presp, rcu_head); | ||
84 | |||
85 | sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; | ||
86 | |||
87 | chandef = ifibss->chandef; | ||
88 | if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) { | ||
89 | if (chandef.width == NL80211_CHAN_WIDTH_5 || | ||
90 | chandef.width == NL80211_CHAN_WIDTH_10 || | ||
91 | chandef.width == NL80211_CHAN_WIDTH_20_NOHT || | ||
92 | chandef.width == NL80211_CHAN_WIDTH_20) { | ||
93 | sdata_info(sdata, | ||
94 | "Failed to join IBSS, beacons forbidden\n"); | ||
95 | return; | ||
96 | } | ||
97 | chandef.width = NL80211_CHAN_WIDTH_20; | ||
98 | chandef.center_freq1 = chan->center_freq; | ||
99 | } | ||
100 | |||
101 | ieee80211_vif_release_channel(sdata); | ||
102 | if (ieee80211_vif_use_channel(sdata, &chandef, | ||
103 | ifibss->fixed_channel ? | ||
104 | IEEE80211_CHANCTX_SHARED : | ||
105 | IEEE80211_CHANCTX_EXCLUSIVE)) { | ||
106 | sdata_info(sdata, "Failed to join IBSS, no channel context\n"); | ||
107 | return; | ||
108 | } | ||
109 | |||
110 | memcpy(ifibss->bssid, bssid, ETH_ALEN); | ||
111 | |||
112 | sband = local->hw.wiphy->bands[chan->band]; | ||
113 | shift = ieee80211_vif_get_shift(&sdata->vif); | ||
114 | |||
115 | /* Build IBSS probe response */ | 55 | /* Build IBSS probe response */ |
116 | frame_len = sizeof(struct ieee80211_hdr_3addr) + | 56 | frame_len = sizeof(struct ieee80211_hdr_3addr) + |
117 | 12 /* struct ieee80211_mgmt.u.beacon */ + | 57 | 12 /* struct ieee80211_mgmt.u.beacon */ + |
@@ -125,7 +65,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
125 | ifibss->ie_len; | 65 | ifibss->ie_len; |
126 | presp = kzalloc(sizeof(*presp) + frame_len, GFP_KERNEL); | 66 | presp = kzalloc(sizeof(*presp) + frame_len, GFP_KERNEL); |
127 | if (!presp) | 67 | if (!presp) |
128 | return; | 68 | return NULL; |
129 | 69 | ||
130 | presp->head = (void *)(presp + 1); | 70 | presp->head = (void *)(presp + 1); |
131 | 71 | ||
@@ -146,12 +86,19 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
146 | memcpy(pos, ifibss->ssid, ifibss->ssid_len); | 86 | memcpy(pos, ifibss->ssid, ifibss->ssid_len); |
147 | pos += ifibss->ssid_len; | 87 | pos += ifibss->ssid_len; |
148 | 88 | ||
149 | rate_flags = ieee80211_chandef_rate_flags(&chandef); | 89 | sband = local->hw.wiphy->bands[chandef->chan->band]; |
90 | rate_flags = ieee80211_chandef_rate_flags(chandef); | ||
91 | shift = ieee80211_chandef_get_shift(chandef); | ||
92 | rates_n = 0; | ||
93 | if (have_higher_than_11mbit) | ||
94 | *have_higher_than_11mbit = false; | ||
95 | |||
150 | for (i = 0; i < sband->n_bitrates; i++) { | 96 | for (i = 0; i < sband->n_bitrates; i++) { |
151 | if ((rate_flags & sband->bitrates[i].flags) != rate_flags) | 97 | if ((rate_flags & sband->bitrates[i].flags) != rate_flags) |
152 | continue; | 98 | continue; |
153 | if (sband->bitrates[i].bitrate > 110) | 99 | if (sband->bitrates[i].bitrate > 110 && |
154 | have_higher_than_11mbit = true; | 100 | have_higher_than_11mbit) |
101 | *have_higher_than_11mbit = true; | ||
155 | 102 | ||
156 | rates |= BIT(i); | 103 | rates |= BIT(i); |
157 | rates_n++; | 104 | rates_n++; |
@@ -178,7 +125,8 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
178 | if (sband->band == IEEE80211_BAND_2GHZ) { | 125 | if (sband->band == IEEE80211_BAND_2GHZ) { |
179 | *pos++ = WLAN_EID_DS_PARAMS; | 126 | *pos++ = WLAN_EID_DS_PARAMS; |
180 | *pos++ = 1; | 127 | *pos++ = 1; |
181 | *pos++ = ieee80211_frequency_to_channel(chan->center_freq); | 128 | *pos++ = ieee80211_frequency_to_channel( |
129 | chandef->chan->center_freq); | ||
182 | } | 130 | } |
183 | 131 | ||
184 | *pos++ = WLAN_EID_IBSS_PARAMS; | 132 | *pos++ = WLAN_EID_IBSS_PARAMS; |
@@ -210,9 +158,9 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
210 | } | 158 | } |
211 | 159 | ||
212 | /* add HT capability and information IEs */ | 160 | /* add HT capability and information IEs */ |
213 | if (chandef.width != NL80211_CHAN_WIDTH_20_NOHT && | 161 | if (chandef->width != NL80211_CHAN_WIDTH_20_NOHT && |
214 | chandef.width != NL80211_CHAN_WIDTH_5 && | 162 | chandef->width != NL80211_CHAN_WIDTH_5 && |
215 | chandef.width != NL80211_CHAN_WIDTH_10 && | 163 | chandef->width != NL80211_CHAN_WIDTH_10 && |
216 | sband->ht_cap.ht_supported) { | 164 | sband->ht_cap.ht_supported) { |
217 | struct ieee80211_sta_ht_cap ht_cap; | 165 | struct ieee80211_sta_ht_cap ht_cap; |
218 | 166 | ||
@@ -226,7 +174,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
226 | * keep them at 0 | 174 | * keep them at 0 |
227 | */ | 175 | */ |
228 | pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap, | 176 | pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap, |
229 | &chandef, 0); | 177 | chandef, 0); |
230 | } | 178 | } |
231 | 179 | ||
232 | if (local->hw.queues >= IEEE80211_NUM_ACS) { | 180 | if (local->hw.queues >= IEEE80211_NUM_ACS) { |
@@ -243,9 +191,97 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
243 | 191 | ||
244 | presp->head_len = pos - presp->head; | 192 | presp->head_len = pos - presp->head; |
245 | if (WARN_ON(presp->head_len > frame_len)) | 193 | if (WARN_ON(presp->head_len > frame_len)) |
194 | goto error; | ||
195 | |||
196 | return presp; | ||
197 | error: | ||
198 | kfree(presp); | ||
199 | return NULL; | ||
200 | } | ||
201 | |||
202 | static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | ||
203 | const u8 *bssid, const int beacon_int, | ||
204 | struct cfg80211_chan_def *req_chandef, | ||
205 | const u32 basic_rates, | ||
206 | const u16 capability, u64 tsf, | ||
207 | bool creator) | ||
208 | { | ||
209 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | ||
210 | struct ieee80211_local *local = sdata->local; | ||
211 | struct ieee80211_supported_band *sband; | ||
212 | struct ieee80211_mgmt *mgmt; | ||
213 | struct cfg80211_bss *bss; | ||
214 | u32 bss_change; | ||
215 | struct cfg80211_chan_def chandef; | ||
216 | struct ieee80211_channel *chan; | ||
217 | struct beacon_data *presp; | ||
218 | enum nl80211_bss_scan_width scan_width; | ||
219 | bool have_higher_than_11mbit; | ||
220 | |||
221 | sdata_assert_lock(sdata); | ||
222 | |||
223 | /* Reset own TSF to allow time synchronization work. */ | ||
224 | drv_reset_tsf(local, sdata); | ||
225 | |||
226 | if (!ether_addr_equal(ifibss->bssid, bssid)) | ||
227 | sta_info_flush(sdata); | ||
228 | |||
229 | /* if merging, indicate to driver that we leave the old IBSS */ | ||
230 | if (sdata->vif.bss_conf.ibss_joined) { | ||
231 | sdata->vif.bss_conf.ibss_joined = false; | ||
232 | sdata->vif.bss_conf.ibss_creator = false; | ||
233 | sdata->vif.bss_conf.enable_beacon = false; | ||
234 | netif_carrier_off(sdata->dev); | ||
235 | ieee80211_bss_info_change_notify(sdata, | ||
236 | BSS_CHANGED_IBSS | | ||
237 | BSS_CHANGED_BEACON_ENABLED); | ||
238 | } | ||
239 | |||
240 | presp = rcu_dereference_protected(ifibss->presp, | ||
241 | lockdep_is_held(&sdata->wdev.mtx)); | ||
242 | rcu_assign_pointer(ifibss->presp, NULL); | ||
243 | if (presp) | ||
244 | kfree_rcu(presp, rcu_head); | ||
245 | |||
246 | sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; | ||
247 | |||
248 | /* make a copy of the chandef, it could be modified below. */ | ||
249 | chandef = *req_chandef; | ||
250 | chan = chandef.chan; | ||
251 | if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) { | ||
252 | if (chandef.width == NL80211_CHAN_WIDTH_5 || | ||
253 | chandef.width == NL80211_CHAN_WIDTH_10 || | ||
254 | chandef.width == NL80211_CHAN_WIDTH_20_NOHT || | ||
255 | chandef.width == NL80211_CHAN_WIDTH_20) { | ||
256 | sdata_info(sdata, | ||
257 | "Failed to join IBSS, beacons forbidden\n"); | ||
258 | return; | ||
259 | } | ||
260 | chandef.width = NL80211_CHAN_WIDTH_20; | ||
261 | chandef.center_freq1 = chan->center_freq; | ||
262 | } | ||
263 | |||
264 | ieee80211_vif_release_channel(sdata); | ||
265 | if (ieee80211_vif_use_channel(sdata, &chandef, | ||
266 | ifibss->fixed_channel ? | ||
267 | IEEE80211_CHANCTX_SHARED : | ||
268 | IEEE80211_CHANCTX_EXCLUSIVE)) { | ||
269 | sdata_info(sdata, "Failed to join IBSS, no channel context\n"); | ||
270 | return; | ||
271 | } | ||
272 | |||
273 | memcpy(ifibss->bssid, bssid, ETH_ALEN); | ||
274 | |||
275 | sband = local->hw.wiphy->bands[chan->band]; | ||
276 | |||
277 | presp = ieee80211_ibss_build_presp(sdata, beacon_int, basic_rates, | ||
278 | capability, tsf, &chandef, | ||
279 | &have_higher_than_11mbit); | ||
280 | if (!presp) | ||
246 | return; | 281 | return; |
247 | 282 | ||
248 | rcu_assign_pointer(ifibss->presp, presp); | 283 | rcu_assign_pointer(ifibss->presp, presp); |
284 | mgmt = (void *)presp->head; | ||
249 | 285 | ||
250 | sdata->vif.bss_conf.enable_beacon = true; | 286 | sdata->vif.bss_conf.enable_beacon = true; |
251 | sdata->vif.bss_conf.beacon_int = beacon_int; | 287 | sdata->vif.bss_conf.beacon_int = beacon_int; |
@@ -306,10 +342,12 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
306 | struct cfg80211_bss *cbss = | 342 | struct cfg80211_bss *cbss = |
307 | container_of((void *)bss, struct cfg80211_bss, priv); | 343 | container_of((void *)bss, struct cfg80211_bss, priv); |
308 | struct ieee80211_supported_band *sband; | 344 | struct ieee80211_supported_band *sband; |
345 | struct cfg80211_chan_def chandef; | ||
309 | u32 basic_rates; | 346 | u32 basic_rates; |
310 | int i, j; | 347 | int i, j; |
311 | u16 beacon_int = cbss->beacon_interval; | 348 | u16 beacon_int = cbss->beacon_interval; |
312 | const struct cfg80211_bss_ies *ies; | 349 | const struct cfg80211_bss_ies *ies; |
350 | enum nl80211_channel_type chan_type; | ||
313 | u64 tsf; | 351 | u64 tsf; |
314 | u32 rate_flags; | 352 | u32 rate_flags; |
315 | int shift; | 353 | int shift; |
@@ -319,6 +357,26 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
319 | if (beacon_int < 10) | 357 | if (beacon_int < 10) |
320 | beacon_int = 10; | 358 | beacon_int = 10; |
321 | 359 | ||
360 | switch (sdata->u.ibss.chandef.width) { | ||
361 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
362 | case NL80211_CHAN_WIDTH_20: | ||
363 | case NL80211_CHAN_WIDTH_40: | ||
364 | chan_type = cfg80211_get_chandef_type(&sdata->u.ibss.chandef); | ||
365 | cfg80211_chandef_create(&chandef, cbss->channel, chan_type); | ||
366 | break; | ||
367 | case NL80211_CHAN_WIDTH_5: | ||
368 | case NL80211_CHAN_WIDTH_10: | ||
369 | cfg80211_chandef_create(&chandef, cbss->channel, | ||
370 | NL80211_CHAN_WIDTH_20_NOHT); | ||
371 | chandef.width = sdata->u.ibss.chandef.width; | ||
372 | break; | ||
373 | default: | ||
374 | /* fall back to 20 MHz for unsupported modes */ | ||
375 | cfg80211_chandef_create(&chandef, cbss->channel, | ||
376 | NL80211_CHAN_WIDTH_20_NOHT); | ||
377 | break; | ||
378 | } | ||
379 | |||
322 | sband = sdata->local->hw.wiphy->bands[cbss->channel->band]; | 380 | sband = sdata->local->hw.wiphy->bands[cbss->channel->band]; |
323 | rate_flags = ieee80211_chandef_rate_flags(&sdata->u.ibss.chandef); | 381 | rate_flags = ieee80211_chandef_rate_flags(&sdata->u.ibss.chandef); |
324 | shift = ieee80211_vif_get_shift(&sdata->vif); | 382 | shift = ieee80211_vif_get_shift(&sdata->vif); |
@@ -352,7 +410,7 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
352 | 410 | ||
353 | __ieee80211_sta_join_ibss(sdata, cbss->bssid, | 411 | __ieee80211_sta_join_ibss(sdata, cbss->bssid, |
354 | beacon_int, | 412 | beacon_int, |
355 | cbss->channel, | 413 | &chandef, |
356 | basic_rates, | 414 | basic_rates, |
357 | cbss->capability, | 415 | cbss->capability, |
358 | tsf, false); | 416 | tsf, false); |
@@ -834,7 +892,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) | |||
834 | sdata->drop_unencrypted = 0; | 892 | sdata->drop_unencrypted = 0; |
835 | 893 | ||
836 | __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int, | 894 | __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int, |
837 | ifibss->chandef.chan, ifibss->basic_rates, | 895 | &ifibss->chandef, ifibss->basic_rates, |
838 | capability, 0, true); | 896 | capability, 0, true); |
839 | } | 897 | } |
840 | 898 | ||
@@ -891,6 +949,17 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
891 | return; | 949 | return; |
892 | } | 950 | } |
893 | 951 | ||
952 | /* if a fixed bssid and a fixed freq have been provided create the IBSS | ||
953 | * directly and do not waste time scanning | ||
954 | */ | ||
955 | if (ifibss->fixed_bssid && ifibss->fixed_channel) { | ||
956 | sdata_info(sdata, "Created IBSS using preconfigured BSSID %pM\n", | ||
957 | bssid); | ||
958 | ieee80211_sta_create_ibss(sdata); | ||
959 | return; | ||
960 | } | ||
961 | |||
962 | |||
894 | ibss_dbg(sdata, "sta_find_ibss: did not try to join ibss\n"); | 963 | ibss_dbg(sdata, "sta_find_ibss: did not try to join ibss\n"); |
895 | 964 | ||
896 | /* Selected IBSS not found in current scan results - try to scan */ | 965 | /* Selected IBSS not found in current scan results - try to scan */ |
@@ -1260,6 +1329,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) | |||
1260 | clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, &sdata->state); | 1329 | clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, &sdata->state); |
1261 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED | | 1330 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED | |
1262 | BSS_CHANGED_IBSS); | 1331 | BSS_CHANGED_IBSS); |
1332 | ieee80211_vif_release_channel(sdata); | ||
1263 | synchronize_rcu(); | 1333 | synchronize_rcu(); |
1264 | kfree(presp); | 1334 | kfree(presp); |
1265 | 1335 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index e94c84050e9c..b6186517ec56 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -53,9 +53,6 @@ struct ieee80211_local; | |||
53 | * increased memory use (about 2 kB of RAM per entry). */ | 53 | * increased memory use (about 2 kB of RAM per entry). */ |
54 | #define IEEE80211_FRAGMENT_MAX 4 | 54 | #define IEEE80211_FRAGMENT_MAX 4 |
55 | 55 | ||
56 | #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) | ||
57 | #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) | ||
58 | |||
59 | /* power level hasn't been configured (or set to automatic) */ | 56 | /* power level hasn't been configured (or set to automatic) */ |
60 | #define IEEE80211_UNSET_POWER_LEVEL INT_MIN | 57 | #define IEEE80211_UNSET_POWER_LEVEL INT_MIN |
61 | 58 | ||
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 7ca534bf4cea..fcecd633514e 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -308,12 +308,13 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, | |||
308 | return 0; | 308 | return 0; |
309 | } | 309 | } |
310 | 310 | ||
311 | static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata) | 311 | static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata, |
312 | enum nl80211_iftype iftype) | ||
312 | { | 313 | { |
313 | int n_queues = sdata->local->hw.queues; | 314 | int n_queues = sdata->local->hw.queues; |
314 | int i; | 315 | int i; |
315 | 316 | ||
316 | if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE) { | 317 | if (iftype != NL80211_IFTYPE_P2P_DEVICE) { |
317 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { | 318 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { |
318 | if (WARN_ON_ONCE(sdata->vif.hw_queue[i] == | 319 | if (WARN_ON_ONCE(sdata->vif.hw_queue[i] == |
319 | IEEE80211_INVAL_HW_QUEUE)) | 320 | IEEE80211_INVAL_HW_QUEUE)) |
@@ -324,8 +325,9 @@ static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata) | |||
324 | } | 325 | } |
325 | } | 326 | } |
326 | 327 | ||
327 | if ((sdata->vif.type != NL80211_IFTYPE_AP && | 328 | if ((iftype != NL80211_IFTYPE_AP && |
328 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT) || | 329 | iftype != NL80211_IFTYPE_P2P_GO && |
330 | iftype != NL80211_IFTYPE_MESH_POINT) || | ||
329 | !(sdata->local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)) { | 331 | !(sdata->local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)) { |
330 | sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE; | 332 | sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE; |
331 | return 0; | 333 | return 0; |
@@ -408,7 +410,7 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local) | |||
408 | return ret; | 410 | return ret; |
409 | } | 411 | } |
410 | 412 | ||
411 | ret = ieee80211_check_queues(sdata); | 413 | ret = ieee80211_check_queues(sdata, NL80211_IFTYPE_MONITOR); |
412 | if (ret) { | 414 | if (ret) { |
413 | kfree(sdata); | 415 | kfree(sdata); |
414 | return ret; | 416 | return ret; |
@@ -592,7 +594,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) | |||
592 | res = drv_add_interface(local, sdata); | 594 | res = drv_add_interface(local, sdata); |
593 | if (res) | 595 | if (res) |
594 | goto err_stop; | 596 | goto err_stop; |
595 | res = ieee80211_check_queues(sdata); | 597 | res = ieee80211_check_queues(sdata, |
598 | ieee80211_vif_type_p2p(&sdata->vif)); | ||
596 | if (res) | 599 | if (res) |
597 | goto err_del_interface; | 600 | goto err_del_interface; |
598 | } | 601 | } |
@@ -1389,14 +1392,14 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | |||
1389 | 1392 | ||
1390 | ret = drv_change_interface(local, sdata, internal_type, p2p); | 1393 | ret = drv_change_interface(local, sdata, internal_type, p2p); |
1391 | if (ret) | 1394 | if (ret) |
1392 | type = sdata->vif.type; | 1395 | type = ieee80211_vif_type_p2p(&sdata->vif); |
1393 | 1396 | ||
1394 | /* | 1397 | /* |
1395 | * Ignore return value here, there's not much we can do since | 1398 | * Ignore return value here, there's not much we can do since |
1396 | * the driver changed the interface type internally already. | 1399 | * the driver changed the interface type internally already. |
1397 | * The warnings will hopefully make driver authors fix it :-) | 1400 | * The warnings will hopefully make driver authors fix it :-) |
1398 | */ | 1401 | */ |
1399 | ieee80211_check_queues(sdata); | 1402 | ieee80211_check_queues(sdata, type); |
1400 | 1403 | ||
1401 | ieee80211_setup_sdata(sdata, type); | 1404 | ieee80211_setup_sdata(sdata, type); |
1402 | 1405 | ||
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index e39cc91d0cf1..620677e897bd 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -93,6 +93,9 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | |||
93 | 93 | ||
94 | might_sleep(); | 94 | might_sleep(); |
95 | 95 | ||
96 | if (key->flags & KEY_FLAG_TAINTED) | ||
97 | return -EINVAL; | ||
98 | |||
96 | if (!key->local->ops->set_key) | 99 | if (!key->local->ops->set_key) |
97 | goto out_unsupported; | 100 | goto out_unsupported; |
98 | 101 | ||
@@ -455,6 +458,7 @@ int ieee80211_key_link(struct ieee80211_key *key, | |||
455 | struct ieee80211_sub_if_data *sdata, | 458 | struct ieee80211_sub_if_data *sdata, |
456 | struct sta_info *sta) | 459 | struct sta_info *sta) |
457 | { | 460 | { |
461 | struct ieee80211_local *local = sdata->local; | ||
458 | struct ieee80211_key *old_key; | 462 | struct ieee80211_key *old_key; |
459 | int idx, ret; | 463 | int idx, ret; |
460 | bool pairwise; | 464 | bool pairwise; |
@@ -484,10 +488,13 @@ int ieee80211_key_link(struct ieee80211_key *key, | |||
484 | 488 | ||
485 | ieee80211_debugfs_key_add(key); | 489 | ieee80211_debugfs_key_add(key); |
486 | 490 | ||
487 | ret = ieee80211_key_enable_hw_accel(key); | 491 | if (!local->wowlan) { |
488 | 492 | ret = ieee80211_key_enable_hw_accel(key); | |
489 | if (ret) | 493 | if (ret) |
490 | ieee80211_key_free(key, true); | 494 | ieee80211_key_free(key, true); |
495 | } else { | ||
496 | ret = 0; | ||
497 | } | ||
491 | 498 | ||
492 | mutex_unlock(&sdata->local->key_mtx); | 499 | mutex_unlock(&sdata->local->key_mtx); |
493 | 500 | ||
@@ -540,7 +547,7 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw, | |||
540 | void *iter_data) | 547 | void *iter_data) |
541 | { | 548 | { |
542 | struct ieee80211_local *local = hw_to_local(hw); | 549 | struct ieee80211_local *local = hw_to_local(hw); |
543 | struct ieee80211_key *key; | 550 | struct ieee80211_key *key, *tmp; |
544 | struct ieee80211_sub_if_data *sdata; | 551 | struct ieee80211_sub_if_data *sdata; |
545 | 552 | ||
546 | ASSERT_RTNL(); | 553 | ASSERT_RTNL(); |
@@ -548,13 +555,14 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw, | |||
548 | mutex_lock(&local->key_mtx); | 555 | mutex_lock(&local->key_mtx); |
549 | if (vif) { | 556 | if (vif) { |
550 | sdata = vif_to_sdata(vif); | 557 | sdata = vif_to_sdata(vif); |
551 | list_for_each_entry(key, &sdata->key_list, list) | 558 | list_for_each_entry_safe(key, tmp, &sdata->key_list, list) |
552 | iter(hw, &sdata->vif, | 559 | iter(hw, &sdata->vif, |
553 | key->sta ? &key->sta->sta : NULL, | 560 | key->sta ? &key->sta->sta : NULL, |
554 | &key->conf, iter_data); | 561 | &key->conf, iter_data); |
555 | } else { | 562 | } else { |
556 | list_for_each_entry(sdata, &local->interfaces, list) | 563 | list_for_each_entry(sdata, &local->interfaces, list) |
557 | list_for_each_entry(key, &sdata->key_list, list) | 564 | list_for_each_entry_safe(key, tmp, |
565 | &sdata->key_list, list) | ||
558 | iter(hw, &sdata->vif, | 566 | iter(hw, &sdata->vif, |
559 | key->sta ? &key->sta->sta : NULL, | 567 | key->sta ? &key->sta->sta : NULL, |
560 | &key->conf, iter_data); | 568 | &key->conf, iter_data); |
@@ -751,3 +759,135 @@ void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, | |||
751 | } | 759 | } |
752 | } | 760 | } |
753 | EXPORT_SYMBOL(ieee80211_get_key_rx_seq); | 761 | EXPORT_SYMBOL(ieee80211_get_key_rx_seq); |
762 | |||
763 | void ieee80211_set_key_tx_seq(struct ieee80211_key_conf *keyconf, | ||
764 | struct ieee80211_key_seq *seq) | ||
765 | { | ||
766 | struct ieee80211_key *key; | ||
767 | u64 pn64; | ||
768 | |||
769 | key = container_of(keyconf, struct ieee80211_key, conf); | ||
770 | |||
771 | switch (key->conf.cipher) { | ||
772 | case WLAN_CIPHER_SUITE_TKIP: | ||
773 | key->u.tkip.tx.iv32 = seq->tkip.iv32; | ||
774 | key->u.tkip.tx.iv16 = seq->tkip.iv16; | ||
775 | break; | ||
776 | case WLAN_CIPHER_SUITE_CCMP: | ||
777 | pn64 = (u64)seq->ccmp.pn[5] | | ||
778 | ((u64)seq->ccmp.pn[4] << 8) | | ||
779 | ((u64)seq->ccmp.pn[3] << 16) | | ||
780 | ((u64)seq->ccmp.pn[2] << 24) | | ||
781 | ((u64)seq->ccmp.pn[1] << 32) | | ||
782 | ((u64)seq->ccmp.pn[0] << 40); | ||
783 | atomic64_set(&key->u.ccmp.tx_pn, pn64); | ||
784 | break; | ||
785 | case WLAN_CIPHER_SUITE_AES_CMAC: | ||
786 | pn64 = (u64)seq->aes_cmac.pn[5] | | ||
787 | ((u64)seq->aes_cmac.pn[4] << 8) | | ||
788 | ((u64)seq->aes_cmac.pn[3] << 16) | | ||
789 | ((u64)seq->aes_cmac.pn[2] << 24) | | ||
790 | ((u64)seq->aes_cmac.pn[1] << 32) | | ||
791 | ((u64)seq->aes_cmac.pn[0] << 40); | ||
792 | atomic64_set(&key->u.aes_cmac.tx_pn, pn64); | ||
793 | break; | ||
794 | default: | ||
795 | WARN_ON(1); | ||
796 | break; | ||
797 | } | ||
798 | } | ||
799 | EXPORT_SYMBOL_GPL(ieee80211_set_key_tx_seq); | ||
800 | |||
801 | void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf, | ||
802 | int tid, struct ieee80211_key_seq *seq) | ||
803 | { | ||
804 | struct ieee80211_key *key; | ||
805 | u8 *pn; | ||
806 | |||
807 | key = container_of(keyconf, struct ieee80211_key, conf); | ||
808 | |||
809 | switch (key->conf.cipher) { | ||
810 | case WLAN_CIPHER_SUITE_TKIP: | ||
811 | if (WARN_ON(tid < 0 || tid >= IEEE80211_NUM_TIDS)) | ||
812 | return; | ||
813 | key->u.tkip.rx[tid].iv32 = seq->tkip.iv32; | ||
814 | key->u.tkip.rx[tid].iv16 = seq->tkip.iv16; | ||
815 | break; | ||
816 | case WLAN_CIPHER_SUITE_CCMP: | ||
817 | if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS)) | ||
818 | return; | ||
819 | if (tid < 0) | ||
820 | pn = key->u.ccmp.rx_pn[IEEE80211_NUM_TIDS]; | ||
821 | else | ||
822 | pn = key->u.ccmp.rx_pn[tid]; | ||
823 | memcpy(pn, seq->ccmp.pn, IEEE80211_CCMP_PN_LEN); | ||
824 | break; | ||
825 | case WLAN_CIPHER_SUITE_AES_CMAC: | ||
826 | if (WARN_ON(tid != 0)) | ||
827 | return; | ||
828 | pn = key->u.aes_cmac.rx_pn; | ||
829 | memcpy(pn, seq->aes_cmac.pn, IEEE80211_CMAC_PN_LEN); | ||
830 | break; | ||
831 | default: | ||
832 | WARN_ON(1); | ||
833 | break; | ||
834 | } | ||
835 | } | ||
836 | EXPORT_SYMBOL_GPL(ieee80211_set_key_rx_seq); | ||
837 | |||
838 | void ieee80211_remove_key(struct ieee80211_key_conf *keyconf) | ||
839 | { | ||
840 | struct ieee80211_key *key; | ||
841 | |||
842 | key = container_of(keyconf, struct ieee80211_key, conf); | ||
843 | |||
844 | assert_key_lock(key->local); | ||
845 | |||
846 | /* | ||
847 | * if key was uploaded, we assume the driver will/has remove(d) | ||
848 | * it, so adjust bookkeeping accordingly | ||
849 | */ | ||
850 | if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { | ||
851 | key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; | ||
852 | |||
853 | if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || | ||
854 | (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) || | ||
855 | (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))) | ||
856 | increment_tailroom_need_count(key->sdata); | ||
857 | } | ||
858 | |||
859 | ieee80211_key_free(key, false); | ||
860 | } | ||
861 | EXPORT_SYMBOL_GPL(ieee80211_remove_key); | ||
862 | |||
863 | struct ieee80211_key_conf * | ||
864 | ieee80211_gtk_rekey_add(struct ieee80211_vif *vif, | ||
865 | struct ieee80211_key_conf *keyconf) | ||
866 | { | ||
867 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | ||
868 | struct ieee80211_local *local = sdata->local; | ||
869 | struct ieee80211_key *key; | ||
870 | int err; | ||
871 | |||
872 | if (WARN_ON(!local->wowlan)) | ||
873 | return ERR_PTR(-EINVAL); | ||
874 | |||
875 | if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) | ||
876 | return ERR_PTR(-EINVAL); | ||
877 | |||
878 | key = ieee80211_key_alloc(keyconf->cipher, keyconf->keyidx, | ||
879 | keyconf->keylen, keyconf->key, | ||
880 | 0, NULL); | ||
881 | if (IS_ERR(key)) | ||
882 | return ERR_PTR(PTR_ERR(key)); | ||
883 | |||
884 | if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED) | ||
885 | key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; | ||
886 | |||
887 | err = ieee80211_key_link(key, sdata, NULL); | ||
888 | if (err) | ||
889 | return ERR_PTR(err); | ||
890 | |||
891 | return &key->conf; | ||
892 | } | ||
893 | EXPORT_SYMBOL_GPL(ieee80211_gtk_rekey_add); | ||
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 25eb35b01938..21d5d44444d0 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -892,9 +892,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
892 | if (!local->ops->remain_on_channel) | 892 | if (!local->ops->remain_on_channel) |
893 | local->hw.wiphy->max_remain_on_channel_duration = 5000; | 893 | local->hw.wiphy->max_remain_on_channel_duration = 5000; |
894 | 894 | ||
895 | if (local->ops->sched_scan_start) | ||
896 | local->hw.wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; | ||
897 | |||
898 | /* mac80211 based drivers don't support internal TDLS setup */ | 895 | /* mac80211 based drivers don't support internal TDLS setup */ |
899 | if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) | 896 | if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) |
900 | local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; | 897 | local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 885a5f6e2c21..707ac61d63e5 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -832,6 +832,9 @@ ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata, | |||
832 | 832 | ||
833 | ieee802_11_parse_elems(pos, len - baselen, false, &elems); | 833 | ieee802_11_parse_elems(pos, len - baselen, false, &elems); |
834 | 834 | ||
835 | if (!elems.mesh_id) | ||
836 | return; | ||
837 | |||
835 | /* 802.11-2012 10.1.4.3.2 */ | 838 | /* 802.11-2012 10.1.4.3.2 */ |
836 | if ((!ether_addr_equal(mgmt->da, sdata->vif.addr) && | 839 | if ((!ether_addr_equal(mgmt->da, sdata->vif.addr) && |
837 | !is_broadcast_ether_addr(mgmt->da)) || | 840 | !is_broadcast_ether_addr(mgmt->da)) || |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 21bccd849b3f..86e4ad56b573 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1113,6 +1113,15 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
1113 | case -1: | 1113 | case -1: |
1114 | cfg80211_chandef_create(&new_chandef, new_chan, | 1114 | cfg80211_chandef_create(&new_chandef, new_chan, |
1115 | NL80211_CHAN_NO_HT); | 1115 | NL80211_CHAN_NO_HT); |
1116 | /* keep width for 5/10 MHz channels */ | ||
1117 | switch (sdata->vif.bss_conf.chandef.width) { | ||
1118 | case NL80211_CHAN_WIDTH_5: | ||
1119 | case NL80211_CHAN_WIDTH_10: | ||
1120 | new_chandef.width = sdata->vif.bss_conf.chandef.width; | ||
1121 | break; | ||
1122 | default: | ||
1123 | break; | ||
1124 | } | ||
1116 | break; | 1125 | break; |
1117 | } | 1126 | } |
1118 | 1127 | ||
@@ -2852,14 +2861,6 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
2852 | ieee80211_rx_bss_put(local, bss); | 2861 | ieee80211_rx_bss_put(local, bss); |
2853 | sdata->vif.bss_conf.beacon_rate = bss->beacon_rate; | 2862 | sdata->vif.bss_conf.beacon_rate = bss->beacon_rate; |
2854 | } | 2863 | } |
2855 | |||
2856 | if (!sdata->u.mgd.associated || | ||
2857 | !ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) | ||
2858 | return; | ||
2859 | |||
2860 | ieee80211_sta_process_chanswitch(sdata, rx_status->mactime, | ||
2861 | elems, true); | ||
2862 | |||
2863 | } | 2864 | } |
2864 | 2865 | ||
2865 | 2866 | ||
@@ -3148,6 +3149,9 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3148 | 3149 | ||
3149 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems); | 3150 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems); |
3150 | 3151 | ||
3152 | ieee80211_sta_process_chanswitch(sdata, rx_status->mactime, | ||
3153 | &elems, true); | ||
3154 | |||
3151 | if (ieee80211_sta_wmm_params(local, sdata, elems.wmm_param, | 3155 | if (ieee80211_sta_wmm_params(local, sdata, elems.wmm_param, |
3152 | elems.wmm_param_len)) | 3156 | elems.wmm_param_len)) |
3153 | changed |= BSS_CHANGED_QOS; | 3157 | changed |= BSS_CHANGED_QOS; |
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index ba63ac851c2b..e126605cec66 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -210,7 +210,7 @@ static bool rc_no_data_or_no_ack_use_min(struct ieee80211_tx_rate_control *txrc) | |||
210 | !ieee80211_is_data(fc); | 210 | !ieee80211_is_data(fc); |
211 | } | 211 | } |
212 | 212 | ||
213 | static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, | 213 | static void rc_send_low_basicrate(s8 *idx, u32 basic_rates, |
214 | struct ieee80211_supported_band *sband) | 214 | struct ieee80211_supported_band *sband) |
215 | { | 215 | { |
216 | u8 i; | 216 | u8 i; |
@@ -263,28 +263,37 @@ static void __rate_control_send_low(struct ieee80211_hw *hw, | |||
263 | } | 263 | } |
264 | 264 | ||
265 | 265 | ||
266 | bool rate_control_send_low(struct ieee80211_sta *sta, | 266 | bool rate_control_send_low(struct ieee80211_sta *pubsta, |
267 | void *priv_sta, | 267 | void *priv_sta, |
268 | struct ieee80211_tx_rate_control *txrc) | 268 | struct ieee80211_tx_rate_control *txrc) |
269 | { | 269 | { |
270 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); | 270 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); |
271 | struct ieee80211_supported_band *sband = txrc->sband; | 271 | struct ieee80211_supported_band *sband = txrc->sband; |
272 | struct sta_info *sta; | ||
272 | int mcast_rate; | 273 | int mcast_rate; |
274 | bool use_basicrate = false; | ||
273 | 275 | ||
274 | if (!sta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) { | 276 | if (!pubsta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) { |
275 | __rate_control_send_low(txrc->hw, sband, sta, info); | 277 | __rate_control_send_low(txrc->hw, sband, pubsta, info); |
276 | 278 | ||
277 | if (!sta && txrc->bss) { | 279 | if (!pubsta && txrc->bss) { |
278 | mcast_rate = txrc->bss_conf->mcast_rate[sband->band]; | 280 | mcast_rate = txrc->bss_conf->mcast_rate[sband->band]; |
279 | if (mcast_rate > 0) { | 281 | if (mcast_rate > 0) { |
280 | info->control.rates[0].idx = mcast_rate - 1; | 282 | info->control.rates[0].idx = mcast_rate - 1; |
281 | return true; | 283 | return true; |
282 | } | 284 | } |
285 | use_basicrate = true; | ||
286 | } else if (pubsta) { | ||
287 | sta = container_of(pubsta, struct sta_info, sta); | ||
288 | if (ieee80211_vif_is_mesh(&sta->sdata->vif)) | ||
289 | use_basicrate = true; | ||
290 | } | ||
283 | 291 | ||
284 | rc_send_low_broadcast(&info->control.rates[0].idx, | 292 | if (use_basicrate) |
293 | rc_send_low_basicrate(&info->control.rates[0].idx, | ||
285 | txrc->bss_conf->basic_rates, | 294 | txrc->bss_conf->basic_rates, |
286 | sband); | 295 | sband); |
287 | } | 296 | |
288 | return true; | 297 | return true; |
289 | } | 298 | } |
290 | return false; | 299 | return false; |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 61569425b723..7c323f27ba23 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -776,7 +776,7 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
776 | 776 | ||
777 | /* Don't use EAPOL frames for sampling on non-mrr hw */ | 777 | /* Don't use EAPOL frames for sampling on non-mrr hw */ |
778 | if (mp->hw->max_rates == 1 && | 778 | if (mp->hw->max_rates == 1 && |
779 | txrc->skb->protocol == cpu_to_be16(ETH_P_PAE)) | 779 | (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) |
780 | sample_idx = -1; | 780 | sample_idx = -1; |
781 | else | 781 | else |
782 | sample_idx = minstrel_get_sample_rate(mp, mi); | 782 | sample_idx = minstrel_get_sample_rate(mp, mi); |
@@ -828,6 +828,9 @@ minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, | |||
828 | if (sband->band != IEEE80211_BAND_2GHZ) | 828 | if (sband->band != IEEE80211_BAND_2GHZ) |
829 | return; | 829 | return; |
830 | 830 | ||
831 | if (!(mp->hw->flags & IEEE80211_HW_SUPPORTS_HT_CCK_RATES)) | ||
832 | return; | ||
833 | |||
831 | mi->cck_supported = 0; | 834 | mi->cck_supported = 0; |
832 | mi->cck_supported_short = 0; | 835 | mi->cck_supported_short = 0; |
833 | for (i = 0; i < 4; i++) { | 836 | for (i = 0; i < 4; i++) { |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 6b85f95b9ba1..54395d7583ba 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1055,207 +1055,6 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
1055 | 1055 | ||
1056 | 1056 | ||
1057 | static ieee80211_rx_result debug_noinline | 1057 | static ieee80211_rx_result debug_noinline |
1058 | ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | ||
1059 | { | ||
1060 | struct sk_buff *skb = rx->skb; | ||
1061 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
1062 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
1063 | int keyidx; | ||
1064 | int hdrlen; | ||
1065 | ieee80211_rx_result result = RX_DROP_UNUSABLE; | ||
1066 | struct ieee80211_key *sta_ptk = NULL; | ||
1067 | int mmie_keyidx = -1; | ||
1068 | __le16 fc; | ||
1069 | |||
1070 | /* | ||
1071 | * Key selection 101 | ||
1072 | * | ||
1073 | * There are four types of keys: | ||
1074 | * - GTK (group keys) | ||
1075 | * - IGTK (group keys for management frames) | ||
1076 | * - PTK (pairwise keys) | ||
1077 | * - STK (station-to-station pairwise keys) | ||
1078 | * | ||
1079 | * When selecting a key, we have to distinguish between multicast | ||
1080 | * (including broadcast) and unicast frames, the latter can only | ||
1081 | * use PTKs and STKs while the former always use GTKs and IGTKs. | ||
1082 | * Unless, of course, actual WEP keys ("pre-RSNA") are used, then | ||
1083 | * unicast frames can also use key indices like GTKs. Hence, if we | ||
1084 | * don't have a PTK/STK we check the key index for a WEP key. | ||
1085 | * | ||
1086 | * Note that in a regular BSS, multicast frames are sent by the | ||
1087 | * AP only, associated stations unicast the frame to the AP first | ||
1088 | * which then multicasts it on their behalf. | ||
1089 | * | ||
1090 | * There is also a slight problem in IBSS mode: GTKs are negotiated | ||
1091 | * with each station, that is something we don't currently handle. | ||
1092 | * The spec seems to expect that one negotiates the same key with | ||
1093 | * every station but there's no such requirement; VLANs could be | ||
1094 | * possible. | ||
1095 | */ | ||
1096 | |||
1097 | /* | ||
1098 | * No point in finding a key and decrypting if the frame is neither | ||
1099 | * addressed to us nor a multicast frame. | ||
1100 | */ | ||
1101 | if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) | ||
1102 | return RX_CONTINUE; | ||
1103 | |||
1104 | /* start without a key */ | ||
1105 | rx->key = NULL; | ||
1106 | |||
1107 | if (rx->sta) | ||
1108 | sta_ptk = rcu_dereference(rx->sta->ptk); | ||
1109 | |||
1110 | fc = hdr->frame_control; | ||
1111 | |||
1112 | if (!ieee80211_has_protected(fc)) | ||
1113 | mmie_keyidx = ieee80211_get_mmie_keyidx(rx->skb); | ||
1114 | |||
1115 | if (!is_multicast_ether_addr(hdr->addr1) && sta_ptk) { | ||
1116 | rx->key = sta_ptk; | ||
1117 | if ((status->flag & RX_FLAG_DECRYPTED) && | ||
1118 | (status->flag & RX_FLAG_IV_STRIPPED)) | ||
1119 | return RX_CONTINUE; | ||
1120 | /* Skip decryption if the frame is not protected. */ | ||
1121 | if (!ieee80211_has_protected(fc)) | ||
1122 | return RX_CONTINUE; | ||
1123 | } else if (mmie_keyidx >= 0) { | ||
1124 | /* Broadcast/multicast robust management frame / BIP */ | ||
1125 | if ((status->flag & RX_FLAG_DECRYPTED) && | ||
1126 | (status->flag & RX_FLAG_IV_STRIPPED)) | ||
1127 | return RX_CONTINUE; | ||
1128 | |||
1129 | if (mmie_keyidx < NUM_DEFAULT_KEYS || | ||
1130 | mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) | ||
1131 | return RX_DROP_MONITOR; /* unexpected BIP keyidx */ | ||
1132 | if (rx->sta) | ||
1133 | rx->key = rcu_dereference(rx->sta->gtk[mmie_keyidx]); | ||
1134 | if (!rx->key) | ||
1135 | rx->key = rcu_dereference(rx->sdata->keys[mmie_keyidx]); | ||
1136 | } else if (!ieee80211_has_protected(fc)) { | ||
1137 | /* | ||
1138 | * The frame was not protected, so skip decryption. However, we | ||
1139 | * need to set rx->key if there is a key that could have been | ||
1140 | * used so that the frame may be dropped if encryption would | ||
1141 | * have been expected. | ||
1142 | */ | ||
1143 | struct ieee80211_key *key = NULL; | ||
1144 | struct ieee80211_sub_if_data *sdata = rx->sdata; | ||
1145 | int i; | ||
1146 | |||
1147 | if (ieee80211_is_mgmt(fc) && | ||
1148 | is_multicast_ether_addr(hdr->addr1) && | ||
1149 | (key = rcu_dereference(rx->sdata->default_mgmt_key))) | ||
1150 | rx->key = key; | ||
1151 | else { | ||
1152 | if (rx->sta) { | ||
1153 | for (i = 0; i < NUM_DEFAULT_KEYS; i++) { | ||
1154 | key = rcu_dereference(rx->sta->gtk[i]); | ||
1155 | if (key) | ||
1156 | break; | ||
1157 | } | ||
1158 | } | ||
1159 | if (!key) { | ||
1160 | for (i = 0; i < NUM_DEFAULT_KEYS; i++) { | ||
1161 | key = rcu_dereference(sdata->keys[i]); | ||
1162 | if (key) | ||
1163 | break; | ||
1164 | } | ||
1165 | } | ||
1166 | if (key) | ||
1167 | rx->key = key; | ||
1168 | } | ||
1169 | return RX_CONTINUE; | ||
1170 | } else { | ||
1171 | u8 keyid; | ||
1172 | /* | ||
1173 | * The device doesn't give us the IV so we won't be | ||
1174 | * able to look up the key. That's ok though, we | ||
1175 | * don't need to decrypt the frame, we just won't | ||
1176 | * be able to keep statistics accurate. | ||
1177 | * Except for key threshold notifications, should | ||
1178 | * we somehow allow the driver to tell us which key | ||
1179 | * the hardware used if this flag is set? | ||
1180 | */ | ||
1181 | if ((status->flag & RX_FLAG_DECRYPTED) && | ||
1182 | (status->flag & RX_FLAG_IV_STRIPPED)) | ||
1183 | return RX_CONTINUE; | ||
1184 | |||
1185 | hdrlen = ieee80211_hdrlen(fc); | ||
1186 | |||
1187 | if (rx->skb->len < 8 + hdrlen) | ||
1188 | return RX_DROP_UNUSABLE; /* TODO: count this? */ | ||
1189 | |||
1190 | /* | ||
1191 | * no need to call ieee80211_wep_get_keyidx, | ||
1192 | * it verifies a bunch of things we've done already | ||
1193 | */ | ||
1194 | skb_copy_bits(rx->skb, hdrlen + 3, &keyid, 1); | ||
1195 | keyidx = keyid >> 6; | ||
1196 | |||
1197 | /* check per-station GTK first, if multicast packet */ | ||
1198 | if (is_multicast_ether_addr(hdr->addr1) && rx->sta) | ||
1199 | rx->key = rcu_dereference(rx->sta->gtk[keyidx]); | ||
1200 | |||
1201 | /* if not found, try default key */ | ||
1202 | if (!rx->key) { | ||
1203 | rx->key = rcu_dereference(rx->sdata->keys[keyidx]); | ||
1204 | |||
1205 | /* | ||
1206 | * RSNA-protected unicast frames should always be | ||
1207 | * sent with pairwise or station-to-station keys, | ||
1208 | * but for WEP we allow using a key index as well. | ||
1209 | */ | ||
1210 | if (rx->key && | ||
1211 | rx->key->conf.cipher != WLAN_CIPHER_SUITE_WEP40 && | ||
1212 | rx->key->conf.cipher != WLAN_CIPHER_SUITE_WEP104 && | ||
1213 | !is_multicast_ether_addr(hdr->addr1)) | ||
1214 | rx->key = NULL; | ||
1215 | } | ||
1216 | } | ||
1217 | |||
1218 | if (rx->key) { | ||
1219 | if (unlikely(rx->key->flags & KEY_FLAG_TAINTED)) | ||
1220 | return RX_DROP_MONITOR; | ||
1221 | |||
1222 | rx->key->tx_rx_count++; | ||
1223 | /* TODO: add threshold stuff again */ | ||
1224 | } else { | ||
1225 | return RX_DROP_MONITOR; | ||
1226 | } | ||
1227 | |||
1228 | switch (rx->key->conf.cipher) { | ||
1229 | case WLAN_CIPHER_SUITE_WEP40: | ||
1230 | case WLAN_CIPHER_SUITE_WEP104: | ||
1231 | result = ieee80211_crypto_wep_decrypt(rx); | ||
1232 | break; | ||
1233 | case WLAN_CIPHER_SUITE_TKIP: | ||
1234 | result = ieee80211_crypto_tkip_decrypt(rx); | ||
1235 | break; | ||
1236 | case WLAN_CIPHER_SUITE_CCMP: | ||
1237 | result = ieee80211_crypto_ccmp_decrypt(rx); | ||
1238 | break; | ||
1239 | case WLAN_CIPHER_SUITE_AES_CMAC: | ||
1240 | result = ieee80211_crypto_aes_cmac_decrypt(rx); | ||
1241 | break; | ||
1242 | default: | ||
1243 | /* | ||
1244 | * We can reach here only with HW-only algorithms | ||
1245 | * but why didn't it decrypt the frame?! | ||
1246 | */ | ||
1247 | return RX_DROP_UNUSABLE; | ||
1248 | } | ||
1249 | |||
1250 | /* the hdr variable is invalid after the decrypt handlers */ | ||
1251 | |||
1252 | /* either the frame has been decrypted or will be dropped */ | ||
1253 | status->flag |= RX_FLAG_DECRYPTED; | ||
1254 | |||
1255 | return result; | ||
1256 | } | ||
1257 | |||
1258 | static ieee80211_rx_result debug_noinline | ||
1259 | ieee80211_rx_h_check_more_data(struct ieee80211_rx_data *rx) | 1058 | ieee80211_rx_h_check_more_data(struct ieee80211_rx_data *rx) |
1260 | { | 1059 | { |
1261 | struct ieee80211_local *local; | 1060 | struct ieee80211_local *local; |
@@ -1556,6 +1355,207 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1556 | return RX_CONTINUE; | 1355 | return RX_CONTINUE; |
1557 | } /* ieee80211_rx_h_sta_process */ | 1356 | } /* ieee80211_rx_h_sta_process */ |
1558 | 1357 | ||
1358 | static ieee80211_rx_result debug_noinline | ||
1359 | ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | ||
1360 | { | ||
1361 | struct sk_buff *skb = rx->skb; | ||
1362 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
1363 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
1364 | int keyidx; | ||
1365 | int hdrlen; | ||
1366 | ieee80211_rx_result result = RX_DROP_UNUSABLE; | ||
1367 | struct ieee80211_key *sta_ptk = NULL; | ||
1368 | int mmie_keyidx = -1; | ||
1369 | __le16 fc; | ||
1370 | |||
1371 | /* | ||
1372 | * Key selection 101 | ||
1373 | * | ||
1374 | * There are four types of keys: | ||
1375 | * - GTK (group keys) | ||
1376 | * - IGTK (group keys for management frames) | ||
1377 | * - PTK (pairwise keys) | ||
1378 | * - STK (station-to-station pairwise keys) | ||
1379 | * | ||
1380 | * When selecting a key, we have to distinguish between multicast | ||
1381 | * (including broadcast) and unicast frames, the latter can only | ||
1382 | * use PTKs and STKs while the former always use GTKs and IGTKs. | ||
1383 | * Unless, of course, actual WEP keys ("pre-RSNA") are used, then | ||
1384 | * unicast frames can also use key indices like GTKs. Hence, if we | ||
1385 | * don't have a PTK/STK we check the key index for a WEP key. | ||
1386 | * | ||
1387 | * Note that in a regular BSS, multicast frames are sent by the | ||
1388 | * AP only, associated stations unicast the frame to the AP first | ||
1389 | * which then multicasts it on their behalf. | ||
1390 | * | ||
1391 | * There is also a slight problem in IBSS mode: GTKs are negotiated | ||
1392 | * with each station, that is something we don't currently handle. | ||
1393 | * The spec seems to expect that one negotiates the same key with | ||
1394 | * every station but there's no such requirement; VLANs could be | ||
1395 | * possible. | ||
1396 | */ | ||
1397 | |||
1398 | /* | ||
1399 | * No point in finding a key and decrypting if the frame is neither | ||
1400 | * addressed to us nor a multicast frame. | ||
1401 | */ | ||
1402 | if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) | ||
1403 | return RX_CONTINUE; | ||
1404 | |||
1405 | /* start without a key */ | ||
1406 | rx->key = NULL; | ||
1407 | |||
1408 | if (rx->sta) | ||
1409 | sta_ptk = rcu_dereference(rx->sta->ptk); | ||
1410 | |||
1411 | fc = hdr->frame_control; | ||
1412 | |||
1413 | if (!ieee80211_has_protected(fc)) | ||
1414 | mmie_keyidx = ieee80211_get_mmie_keyidx(rx->skb); | ||
1415 | |||
1416 | if (!is_multicast_ether_addr(hdr->addr1) && sta_ptk) { | ||
1417 | rx->key = sta_ptk; | ||
1418 | if ((status->flag & RX_FLAG_DECRYPTED) && | ||
1419 | (status->flag & RX_FLAG_IV_STRIPPED)) | ||
1420 | return RX_CONTINUE; | ||
1421 | /* Skip decryption if the frame is not protected. */ | ||
1422 | if (!ieee80211_has_protected(fc)) | ||
1423 | return RX_CONTINUE; | ||
1424 | } else if (mmie_keyidx >= 0) { | ||
1425 | /* Broadcast/multicast robust management frame / BIP */ | ||
1426 | if ((status->flag & RX_FLAG_DECRYPTED) && | ||
1427 | (status->flag & RX_FLAG_IV_STRIPPED)) | ||
1428 | return RX_CONTINUE; | ||
1429 | |||
1430 | if (mmie_keyidx < NUM_DEFAULT_KEYS || | ||
1431 | mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) | ||
1432 | return RX_DROP_MONITOR; /* unexpected BIP keyidx */ | ||
1433 | if (rx->sta) | ||
1434 | rx->key = rcu_dereference(rx->sta->gtk[mmie_keyidx]); | ||
1435 | if (!rx->key) | ||
1436 | rx->key = rcu_dereference(rx->sdata->keys[mmie_keyidx]); | ||
1437 | } else if (!ieee80211_has_protected(fc)) { | ||
1438 | /* | ||
1439 | * The frame was not protected, so skip decryption. However, we | ||
1440 | * need to set rx->key if there is a key that could have been | ||
1441 | * used so that the frame may be dropped if encryption would | ||
1442 | * have been expected. | ||
1443 | */ | ||
1444 | struct ieee80211_key *key = NULL; | ||
1445 | struct ieee80211_sub_if_data *sdata = rx->sdata; | ||
1446 | int i; | ||
1447 | |||
1448 | if (ieee80211_is_mgmt(fc) && | ||
1449 | is_multicast_ether_addr(hdr->addr1) && | ||
1450 | (key = rcu_dereference(rx->sdata->default_mgmt_key))) | ||
1451 | rx->key = key; | ||
1452 | else { | ||
1453 | if (rx->sta) { | ||
1454 | for (i = 0; i < NUM_DEFAULT_KEYS; i++) { | ||
1455 | key = rcu_dereference(rx->sta->gtk[i]); | ||
1456 | if (key) | ||
1457 | break; | ||
1458 | } | ||
1459 | } | ||
1460 | if (!key) { | ||
1461 | for (i = 0; i < NUM_DEFAULT_KEYS; i++) { | ||
1462 | key = rcu_dereference(sdata->keys[i]); | ||
1463 | if (key) | ||
1464 | break; | ||
1465 | } | ||
1466 | } | ||
1467 | if (key) | ||
1468 | rx->key = key; | ||
1469 | } | ||
1470 | return RX_CONTINUE; | ||
1471 | } else { | ||
1472 | u8 keyid; | ||
1473 | /* | ||
1474 | * The device doesn't give us the IV so we won't be | ||
1475 | * able to look up the key. That's ok though, we | ||
1476 | * don't need to decrypt the frame, we just won't | ||
1477 | * be able to keep statistics accurate. | ||
1478 | * Except for key threshold notifications, should | ||
1479 | * we somehow allow the driver to tell us which key | ||
1480 | * the hardware used if this flag is set? | ||
1481 | */ | ||
1482 | if ((status->flag & RX_FLAG_DECRYPTED) && | ||
1483 | (status->flag & RX_FLAG_IV_STRIPPED)) | ||
1484 | return RX_CONTINUE; | ||
1485 | |||
1486 | hdrlen = ieee80211_hdrlen(fc); | ||
1487 | |||
1488 | if (rx->skb->len < 8 + hdrlen) | ||
1489 | return RX_DROP_UNUSABLE; /* TODO: count this? */ | ||
1490 | |||
1491 | /* | ||
1492 | * no need to call ieee80211_wep_get_keyidx, | ||
1493 | * it verifies a bunch of things we've done already | ||
1494 | */ | ||
1495 | skb_copy_bits(rx->skb, hdrlen + 3, &keyid, 1); | ||
1496 | keyidx = keyid >> 6; | ||
1497 | |||
1498 | /* check per-station GTK first, if multicast packet */ | ||
1499 | if (is_multicast_ether_addr(hdr->addr1) && rx->sta) | ||
1500 | rx->key = rcu_dereference(rx->sta->gtk[keyidx]); | ||
1501 | |||
1502 | /* if not found, try default key */ | ||
1503 | if (!rx->key) { | ||
1504 | rx->key = rcu_dereference(rx->sdata->keys[keyidx]); | ||
1505 | |||
1506 | /* | ||
1507 | * RSNA-protected unicast frames should always be | ||
1508 | * sent with pairwise or station-to-station keys, | ||
1509 | * but for WEP we allow using a key index as well. | ||
1510 | */ | ||
1511 | if (rx->key && | ||
1512 | rx->key->conf.cipher != WLAN_CIPHER_SUITE_WEP40 && | ||
1513 | rx->key->conf.cipher != WLAN_CIPHER_SUITE_WEP104 && | ||
1514 | !is_multicast_ether_addr(hdr->addr1)) | ||
1515 | rx->key = NULL; | ||
1516 | } | ||
1517 | } | ||
1518 | |||
1519 | if (rx->key) { | ||
1520 | if (unlikely(rx->key->flags & KEY_FLAG_TAINTED)) | ||
1521 | return RX_DROP_MONITOR; | ||
1522 | |||
1523 | rx->key->tx_rx_count++; | ||
1524 | /* TODO: add threshold stuff again */ | ||
1525 | } else { | ||
1526 | return RX_DROP_MONITOR; | ||
1527 | } | ||
1528 | |||
1529 | switch (rx->key->conf.cipher) { | ||
1530 | case WLAN_CIPHER_SUITE_WEP40: | ||
1531 | case WLAN_CIPHER_SUITE_WEP104: | ||
1532 | result = ieee80211_crypto_wep_decrypt(rx); | ||
1533 | break; | ||
1534 | case WLAN_CIPHER_SUITE_TKIP: | ||
1535 | result = ieee80211_crypto_tkip_decrypt(rx); | ||
1536 | break; | ||
1537 | case WLAN_CIPHER_SUITE_CCMP: | ||
1538 | result = ieee80211_crypto_ccmp_decrypt(rx); | ||
1539 | break; | ||
1540 | case WLAN_CIPHER_SUITE_AES_CMAC: | ||
1541 | result = ieee80211_crypto_aes_cmac_decrypt(rx); | ||
1542 | break; | ||
1543 | default: | ||
1544 | /* | ||
1545 | * We can reach here only with HW-only algorithms | ||
1546 | * but why didn't it decrypt the frame?! | ||
1547 | */ | ||
1548 | return RX_DROP_UNUSABLE; | ||
1549 | } | ||
1550 | |||
1551 | /* the hdr variable is invalid after the decrypt handlers */ | ||
1552 | |||
1553 | /* either the frame has been decrypted or will be dropped */ | ||
1554 | status->flag |= RX_FLAG_DECRYPTED; | ||
1555 | |||
1556 | return result; | ||
1557 | } | ||
1558 | |||
1559 | static inline struct ieee80211_fragment_entry * | 1559 | static inline struct ieee80211_fragment_entry * |
1560 | ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, | 1560 | ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, |
1561 | unsigned int frag, unsigned int seq, int rx_queue, | 1561 | unsigned int frag, unsigned int seq, int rx_queue, |
@@ -2684,8 +2684,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx) | |||
2684 | sig = status->signal; | 2684 | sig = status->signal; |
2685 | 2685 | ||
2686 | if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig, | 2686 | if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig, |
2687 | rx->skb->data, rx->skb->len, | 2687 | rx->skb->data, rx->skb->len, 0, GFP_ATOMIC)) { |
2688 | GFP_ATOMIC)) { | ||
2689 | if (rx->sta) | 2688 | if (rx->sta) |
2690 | rx->sta->rx_packets++; | 2689 | rx->sta->rx_packets++; |
2691 | dev_kfree_skb(rx->skb); | 2690 | dev_kfree_skb(rx->skb); |
@@ -2939,10 +2938,10 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx, | |||
2939 | */ | 2938 | */ |
2940 | rx->skb = skb; | 2939 | rx->skb = skb; |
2941 | 2940 | ||
2942 | CALL_RXH(ieee80211_rx_h_decrypt) | ||
2943 | CALL_RXH(ieee80211_rx_h_check_more_data) | 2941 | CALL_RXH(ieee80211_rx_h_check_more_data) |
2944 | CALL_RXH(ieee80211_rx_h_uapsd_and_pspoll) | 2942 | CALL_RXH(ieee80211_rx_h_uapsd_and_pspoll) |
2945 | CALL_RXH(ieee80211_rx_h_sta_process) | 2943 | CALL_RXH(ieee80211_rx_h_sta_process) |
2944 | CALL_RXH(ieee80211_rx_h_decrypt) | ||
2946 | CALL_RXH(ieee80211_rx_h_defragment) | 2945 | CALL_RXH(ieee80211_rx_h_defragment) |
2947 | CALL_RXH(ieee80211_rx_h_michael_mic_verify) | 2946 | CALL_RXH(ieee80211_rx_h_michael_mic_verify) |
2948 | /* must be after MMIC verify so header is counted in MPDU mic */ | 2947 | /* must be after MMIC verify so header is counted in MPDU mic */ |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 0e42322aa6b1..3456c0486b48 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -539,9 +539,11 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx) | |||
539 | { | 539 | { |
540 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 540 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
541 | 541 | ||
542 | if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol && | 542 | if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol)) { |
543 | tx->sdata->control_port_no_encrypt)) | 543 | if (tx->sdata->control_port_no_encrypt) |
544 | info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 544 | info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
545 | info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO; | ||
546 | } | ||
545 | 547 | ||
546 | return TX_CONTINUE; | 548 | return TX_CONTINUE; |
547 | } | 549 | } |
@@ -779,9 +781,11 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | |||
779 | /* | 781 | /* |
780 | * Anything but QoS data that has a sequence number field | 782 | * Anything but QoS data that has a sequence number field |
781 | * (is long enough) gets a sequence number from the global | 783 | * (is long enough) gets a sequence number from the global |
782 | * counter. | 784 | * counter. QoS data frames with a multicast destination |
785 | * also use the global counter (802.11-2012 9.3.2.10). | ||
783 | */ | 786 | */ |
784 | if (!ieee80211_is_data_qos(hdr->frame_control)) { | 787 | if (!ieee80211_is_data_qos(hdr->frame_control) || |
788 | is_multicast_ether_addr(hdr->addr1)) { | ||
785 | /* driver should assign sequence number */ | 789 | /* driver should assign sequence number */ |
786 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; | 790 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; |
787 | /* for pure STA mode without beacons, we can do it */ | 791 | /* for pure STA mode without beacons, we can do it */ |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index d23c5a705a68..e1b34a18b243 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1453,8 +1453,8 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1453 | local->resuming = true; | 1453 | local->resuming = true; |
1454 | 1454 | ||
1455 | if (local->wowlan) { | 1455 | if (local->wowlan) { |
1456 | local->wowlan = false; | ||
1457 | res = drv_resume(local); | 1456 | res = drv_resume(local); |
1457 | local->wowlan = false; | ||
1458 | if (res < 0) { | 1458 | if (res < 0) { |
1459 | local->resuming = false; | 1459 | local->resuming = false; |
1460 | return res; | 1460 | return res; |
diff --git a/net/nfc/core.c b/net/nfc/core.c index 1d074dd1650f..e92923cf3e03 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -77,11 +77,19 @@ error: | |||
77 | return rc; | 77 | return rc; |
78 | } | 78 | } |
79 | 79 | ||
80 | int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name) | 80 | /** |
81 | * nfc_fw_download_done - inform that a firmware download was completed | ||
82 | * | ||
83 | * @dev: The nfc device to which firmware was downloaded | ||
84 | * @firmware_name: The firmware filename | ||
85 | * @result: The positive value of a standard errno value | ||
86 | */ | ||
87 | int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name, | ||
88 | u32 result) | ||
81 | { | 89 | { |
82 | dev->fw_download_in_progress = false; | 90 | dev->fw_download_in_progress = false; |
83 | 91 | ||
84 | return nfc_genl_fw_download_done(dev, firmware_name); | 92 | return nfc_genl_fw_download_done(dev, firmware_name, result); |
85 | } | 93 | } |
86 | EXPORT_SYMBOL(nfc_fw_download_done); | 94 | EXPORT_SYMBOL(nfc_fw_download_done); |
87 | 95 | ||
@@ -129,7 +137,7 @@ int nfc_dev_up(struct nfc_dev *dev) | |||
129 | /* We have to enable the device before discovering SEs */ | 137 | /* We have to enable the device before discovering SEs */ |
130 | if (dev->ops->discover_se) { | 138 | if (dev->ops->discover_se) { |
131 | rc = dev->ops->discover_se(dev); | 139 | rc = dev->ops->discover_se(dev); |
132 | if (!rc) | 140 | if (rc) |
133 | pr_warn("SE discovery failed\n"); | 141 | pr_warn("SE discovery failed\n"); |
134 | } | 142 | } |
135 | 143 | ||
@@ -575,12 +583,14 @@ int nfc_enable_se(struct nfc_dev *dev, u32 se_idx) | |||
575 | goto error; | 583 | goto error; |
576 | } | 584 | } |
577 | 585 | ||
578 | if (se->type == NFC_SE_ENABLED) { | 586 | if (se->state == NFC_SE_ENABLED) { |
579 | rc = -EALREADY; | 587 | rc = -EALREADY; |
580 | goto error; | 588 | goto error; |
581 | } | 589 | } |
582 | 590 | ||
583 | rc = dev->ops->enable_se(dev, se_idx); | 591 | rc = dev->ops->enable_se(dev, se_idx); |
592 | if (rc >= 0) | ||
593 | se->state = NFC_SE_ENABLED; | ||
584 | 594 | ||
585 | error: | 595 | error: |
586 | device_unlock(&dev->dev); | 596 | device_unlock(&dev->dev); |
@@ -618,12 +628,14 @@ int nfc_disable_se(struct nfc_dev *dev, u32 se_idx) | |||
618 | goto error; | 628 | goto error; |
619 | } | 629 | } |
620 | 630 | ||
621 | if (se->type == NFC_SE_DISABLED) { | 631 | if (se->state == NFC_SE_DISABLED) { |
622 | rc = -EALREADY; | 632 | rc = -EALREADY; |
623 | goto error; | 633 | goto error; |
624 | } | 634 | } |
625 | 635 | ||
626 | rc = dev->ops->disable_se(dev, se_idx); | 636 | rc = dev->ops->disable_se(dev, se_idx); |
637 | if (rc >= 0) | ||
638 | se->state = NFC_SE_DISABLED; | ||
627 | 639 | ||
628 | error: | 640 | error: |
629 | device_unlock(&dev->dev); | 641 | device_unlock(&dev->dev); |
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index fe66908401f5..d07ca4c5cf8c 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -717,7 +717,7 @@ static int hci_disable_se(struct nfc_dev *nfc_dev, u32 se_idx) | |||
717 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); | 717 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); |
718 | 718 | ||
719 | if (hdev->ops->disable_se) | 719 | if (hdev->ops->disable_se) |
720 | return hdev->ops->enable_se(hdev, se_idx); | 720 | return hdev->ops->disable_se(hdev, se_idx); |
721 | 721 | ||
722 | return 0; | 722 | return 0; |
723 | } | 723 | } |
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index f16fd59d4160..68063b2025da 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -1114,7 +1114,8 @@ static int nfc_genl_fw_download(struct sk_buff *skb, struct genl_info *info) | |||
1114 | return rc; | 1114 | return rc; |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name) | 1117 | int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name, |
1118 | u32 result) | ||
1118 | { | 1119 | { |
1119 | struct sk_buff *msg; | 1120 | struct sk_buff *msg; |
1120 | void *hdr; | 1121 | void *hdr; |
@@ -1129,6 +1130,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name) | |||
1129 | goto free_msg; | 1130 | goto free_msg; |
1130 | 1131 | ||
1131 | if (nla_put_string(msg, NFC_ATTR_FIRMWARE_NAME, firmware_name) || | 1132 | if (nla_put_string(msg, NFC_ATTR_FIRMWARE_NAME, firmware_name) || |
1133 | nla_put_u32(msg, NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, result) || | ||
1132 | nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) | 1134 | nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) |
1133 | goto nla_put_failure; | 1135 | goto nla_put_failure; |
1134 | 1136 | ||
@@ -1191,6 +1193,91 @@ static int nfc_genl_disable_se(struct sk_buff *skb, struct genl_info *info) | |||
1191 | return rc; | 1193 | return rc; |
1192 | } | 1194 | } |
1193 | 1195 | ||
1196 | static int nfc_genl_send_se(struct sk_buff *msg, struct nfc_dev *dev, | ||
1197 | u32 portid, u32 seq, | ||
1198 | struct netlink_callback *cb, | ||
1199 | int flags) | ||
1200 | { | ||
1201 | void *hdr; | ||
1202 | struct nfc_se *se, *n; | ||
1203 | |||
1204 | list_for_each_entry_safe(se, n, &dev->secure_elements, list) { | ||
1205 | hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, flags, | ||
1206 | NFC_CMD_GET_SE); | ||
1207 | if (!hdr) | ||
1208 | goto nla_put_failure; | ||
1209 | |||
1210 | if (cb) | ||
1211 | genl_dump_check_consistent(cb, hdr, &nfc_genl_family); | ||
1212 | |||
1213 | if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || | ||
1214 | nla_put_u32(msg, NFC_ATTR_SE_INDEX, se->idx) || | ||
1215 | nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) | ||
1216 | goto nla_put_failure; | ||
1217 | |||
1218 | if (genlmsg_end(msg, hdr) < 0) | ||
1219 | goto nla_put_failure; | ||
1220 | } | ||
1221 | |||
1222 | return 0; | ||
1223 | |||
1224 | nla_put_failure: | ||
1225 | genlmsg_cancel(msg, hdr); | ||
1226 | return -EMSGSIZE; | ||
1227 | } | ||
1228 | |||
1229 | static int nfc_genl_dump_ses(struct sk_buff *skb, | ||
1230 | struct netlink_callback *cb) | ||
1231 | { | ||
1232 | struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0]; | ||
1233 | struct nfc_dev *dev = (struct nfc_dev *) cb->args[1]; | ||
1234 | bool first_call = false; | ||
1235 | |||
1236 | if (!iter) { | ||
1237 | first_call = true; | ||
1238 | iter = kmalloc(sizeof(struct class_dev_iter), GFP_KERNEL); | ||
1239 | if (!iter) | ||
1240 | return -ENOMEM; | ||
1241 | cb->args[0] = (long) iter; | ||
1242 | } | ||
1243 | |||
1244 | mutex_lock(&nfc_devlist_mutex); | ||
1245 | |||
1246 | cb->seq = nfc_devlist_generation; | ||
1247 | |||
1248 | if (first_call) { | ||
1249 | nfc_device_iter_init(iter); | ||
1250 | dev = nfc_device_iter_next(iter); | ||
1251 | } | ||
1252 | |||
1253 | while (dev) { | ||
1254 | int rc; | ||
1255 | |||
1256 | rc = nfc_genl_send_se(skb, dev, NETLINK_CB(cb->skb).portid, | ||
1257 | cb->nlh->nlmsg_seq, cb, NLM_F_MULTI); | ||
1258 | if (rc < 0) | ||
1259 | break; | ||
1260 | |||
1261 | dev = nfc_device_iter_next(iter); | ||
1262 | } | ||
1263 | |||
1264 | mutex_unlock(&nfc_devlist_mutex); | ||
1265 | |||
1266 | cb->args[1] = (long) dev; | ||
1267 | |||
1268 | return skb->len; | ||
1269 | } | ||
1270 | |||
1271 | static int nfc_genl_dump_ses_done(struct netlink_callback *cb) | ||
1272 | { | ||
1273 | struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0]; | ||
1274 | |||
1275 | nfc_device_iter_exit(iter); | ||
1276 | kfree(iter); | ||
1277 | |||
1278 | return 0; | ||
1279 | } | ||
1280 | |||
1194 | static struct genl_ops nfc_genl_ops[] = { | 1281 | static struct genl_ops nfc_genl_ops[] = { |
1195 | { | 1282 | { |
1196 | .cmd = NFC_CMD_GET_DEVICE, | 1283 | .cmd = NFC_CMD_GET_DEVICE, |
@@ -1265,6 +1352,12 @@ static struct genl_ops nfc_genl_ops[] = { | |||
1265 | .doit = nfc_genl_disable_se, | 1352 | .doit = nfc_genl_disable_se, |
1266 | .policy = nfc_genl_policy, | 1353 | .policy = nfc_genl_policy, |
1267 | }, | 1354 | }, |
1355 | { | ||
1356 | .cmd = NFC_CMD_GET_SE, | ||
1357 | .dumpit = nfc_genl_dump_ses, | ||
1358 | .done = nfc_genl_dump_ses_done, | ||
1359 | .policy = nfc_genl_policy, | ||
1360 | }, | ||
1268 | }; | 1361 | }; |
1269 | 1362 | ||
1270 | 1363 | ||
diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h index 820a7850c36a..aaf606fc1faa 100644 --- a/net/nfc/nfc.h +++ b/net/nfc/nfc.h | |||
@@ -124,9 +124,8 @@ static inline void nfc_device_iter_exit(struct class_dev_iter *iter) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name); | 126 | int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name); |
127 | int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name); | 127 | int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name, |
128 | 128 | u32 result); | |
129 | int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name); | ||
130 | 129 | ||
131 | int nfc_dev_up(struct nfc_dev *dev); | 130 | int nfc_dev_up(struct nfc_dev *dev); |
132 | 131 | ||
diff --git a/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c index 21d5073e148e..c99dea543d64 100644 --- a/net/openvswitch/vport-gre.c +++ b/net/openvswitch/vport-gre.c | |||
@@ -176,10 +176,10 @@ static int gre_tnl_send(struct vport *vport, struct sk_buff *skb) | |||
176 | 176 | ||
177 | skb->local_df = 1; | 177 | skb->local_df = 1; |
178 | 178 | ||
179 | return iptunnel_xmit(net, rt, skb, fl.saddr, | 179 | return iptunnel_xmit(rt, skb, fl.saddr, |
180 | OVS_CB(skb)->tun_key->ipv4_dst, IPPROTO_GRE, | 180 | OVS_CB(skb)->tun_key->ipv4_dst, IPPROTO_GRE, |
181 | OVS_CB(skb)->tun_key->ipv4_tos, | 181 | OVS_CB(skb)->tun_key->ipv4_tos, |
182 | OVS_CB(skb)->tun_key->ipv4_ttl, df); | 182 | OVS_CB(skb)->tun_key->ipv4_ttl, df, false); |
183 | err_free_rt: | 183 | err_free_rt: |
184 | ip_rt_put(rt); | 184 | ip_rt_put(rt); |
185 | error: | 185 | error: |
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c index a0060245b4e1..a481c03e2861 100644 --- a/net/openvswitch/vport-vxlan.c +++ b/net/openvswitch/vport-vxlan.c | |||
@@ -176,7 +176,7 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb) | |||
176 | inet_get_local_port_range(&port_min, &port_max); | 176 | inet_get_local_port_range(&port_min, &port_max); |
177 | src_port = vxlan_src_port(port_min, port_max, skb); | 177 | src_port = vxlan_src_port(port_min, port_max, skb); |
178 | 178 | ||
179 | err = vxlan_xmit_skb(net, vxlan_port->vs, rt, skb, | 179 | err = vxlan_xmit_skb(vxlan_port->vs, rt, skb, |
180 | fl.saddr, OVS_CB(skb)->tun_key->ipv4_dst, | 180 | fl.saddr, OVS_CB(skb)->tun_key->ipv4_dst, |
181 | OVS_CB(skb)->tun_key->ipv4_tos, | 181 | OVS_CB(skb)->tun_key->ipv4_tos, |
182 | OVS_CB(skb)->tun_key->ipv4_ttl, df, | 182 | OVS_CB(skb)->tun_key->ipv4_ttl, df, |
diff --git a/net/rfkill/rfkill-regulator.c b/net/rfkill/rfkill-regulator.c index d11ac79246e4..cf5b145902e5 100644 --- a/net/rfkill/rfkill-regulator.c +++ b/net/rfkill/rfkill-regulator.c | |||
@@ -30,6 +30,7 @@ struct rfkill_regulator_data { | |||
30 | static int rfkill_regulator_set_block(void *data, bool blocked) | 30 | static int rfkill_regulator_set_block(void *data, bool blocked) |
31 | { | 31 | { |
32 | struct rfkill_regulator_data *rfkill_data = data; | 32 | struct rfkill_regulator_data *rfkill_data = data; |
33 | int ret = 0; | ||
33 | 34 | ||
34 | pr_debug("%s: blocked: %d\n", __func__, blocked); | 35 | pr_debug("%s: blocked: %d\n", __func__, blocked); |
35 | 36 | ||
@@ -40,15 +41,16 @@ static int rfkill_regulator_set_block(void *data, bool blocked) | |||
40 | } | 41 | } |
41 | } else { | 42 | } else { |
42 | if (!rfkill_data->reg_enabled) { | 43 | if (!rfkill_data->reg_enabled) { |
43 | regulator_enable(rfkill_data->vcc); | 44 | ret = regulator_enable(rfkill_data->vcc); |
44 | rfkill_data->reg_enabled = true; | 45 | if (!ret) |
46 | rfkill_data->reg_enabled = true; | ||
45 | } | 47 | } |
46 | } | 48 | } |
47 | 49 | ||
48 | pr_debug("%s: regulator_is_enabled after set_block: %d\n", __func__, | 50 | pr_debug("%s: regulator_is_enabled after set_block: %d\n", __func__, |
49 | regulator_is_enabled(rfkill_data->vcc)); | 51 | regulator_is_enabled(rfkill_data->vcc)); |
50 | 52 | ||
51 | return 0; | 53 | return ret; |
52 | } | 54 | } |
53 | 55 | ||
54 | static struct rfkill_ops rfkill_regulator_ops = { | 56 | static struct rfkill_ops rfkill_regulator_ops = { |
diff --git a/net/sctp/probe.c b/net/sctp/probe.c index cd72ae57aff1..53c452efb40b 100644 --- a/net/sctp/probe.c +++ b/net/sctp/probe.c | |||
@@ -46,6 +46,10 @@ static int port __read_mostly = 0; | |||
46 | MODULE_PARM_DESC(port, "Port to match (0=all)"); | 46 | MODULE_PARM_DESC(port, "Port to match (0=all)"); |
47 | module_param(port, int, 0); | 47 | module_param(port, int, 0); |
48 | 48 | ||
49 | static unsigned int fwmark __read_mostly = 0; | ||
50 | MODULE_PARM_DESC(fwmark, "skb mark to match (0=no mark)"); | ||
51 | module_param(fwmark, uint, 0); | ||
52 | |||
49 | static int bufsize __read_mostly = 64 * 1024; | 53 | static int bufsize __read_mostly = 64 * 1024; |
50 | MODULE_PARM_DESC(bufsize, "Log buffer size (default 64k)"); | 54 | MODULE_PARM_DESC(bufsize, "Log buffer size (default 64k)"); |
51 | module_param(bufsize, int, 0); | 55 | module_param(bufsize, int, 0); |
@@ -129,15 +133,19 @@ static sctp_disposition_t jsctp_sf_eat_sack(struct net *net, | |||
129 | void *arg, | 133 | void *arg, |
130 | sctp_cmd_seq_t *commands) | 134 | sctp_cmd_seq_t *commands) |
131 | { | 135 | { |
136 | struct sctp_chunk *chunk = arg; | ||
137 | struct sk_buff *skb = chunk->skb; | ||
132 | struct sctp_transport *sp; | 138 | struct sctp_transport *sp; |
133 | static __u32 lcwnd = 0; | 139 | static __u32 lcwnd = 0; |
134 | struct timespec now; | 140 | struct timespec now; |
135 | 141 | ||
136 | sp = asoc->peer.primary_path; | 142 | sp = asoc->peer.primary_path; |
137 | 143 | ||
138 | if ((full || sp->cwnd != lcwnd) && | 144 | if (((port == 0 && fwmark == 0) || |
139 | (!port || asoc->peer.port == port || | 145 | asoc->peer.port == port || |
140 | ep->base.bind_addr.port == port)) { | 146 | ep->base.bind_addr.port == port || |
147 | (fwmark > 0 && skb->mark == fwmark)) && | ||
148 | (full || sp->cwnd != lcwnd)) { | ||
141 | lcwnd = sp->cwnd; | 149 | lcwnd = sp->cwnd; |
142 | 150 | ||
143 | getnstimeofday(&now); | 151 | getnstimeofday(&now); |
@@ -198,8 +206,8 @@ static __init int sctpprobe_init(void) | |||
198 | if (ret) | 206 | if (ret) |
199 | goto remove_proc; | 207 | goto remove_proc; |
200 | 208 | ||
201 | pr_info("probe registered (port=%d)\n", port); | 209 | pr_info("probe registered (port=%d/fwmark=%u) bufsize=%u\n", |
202 | 210 | port, fwmark, bufsize); | |
203 | return 0; | 211 | return 0; |
204 | 212 | ||
205 | remove_proc: | 213 | remove_proc: |
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index bfac5e186f57..8d49c1ce3dea 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -621,7 +621,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | |||
621 | } | 621 | } |
622 | 622 | ||
623 | bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm, | 623 | bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm, |
624 | const u8 *buf, size_t len, gfp_t gfp) | 624 | const u8 *buf, size_t len, u32 flags, gfp_t gfp) |
625 | { | 625 | { |
626 | struct wiphy *wiphy = wdev->wiphy; | 626 | struct wiphy *wiphy = wdev->wiphy; |
627 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 627 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
@@ -664,7 +664,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm, | |||
664 | /* Indicate the received Action frame to user space */ | 664 | /* Indicate the received Action frame to user space */ |
665 | if (nl80211_send_mgmt(rdev, wdev, reg->nlportid, | 665 | if (nl80211_send_mgmt(rdev, wdev, reg->nlportid, |
666 | freq, sig_mbm, | 666 | freq, sig_mbm, |
667 | buf, len, gfp)) | 667 | buf, len, flags, gfp)) |
668 | continue; | 668 | continue; |
669 | 669 | ||
670 | result = true; | 670 | result = true; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 170c0abd2a01..af8d84a4a5b2 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -6593,19 +6593,30 @@ static struct genl_multicast_group nl80211_testmode_mcgrp = { | |||
6593 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) | 6593 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) |
6594 | { | 6594 | { |
6595 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 6595 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
6596 | struct wireless_dev *wdev = | ||
6597 | __cfg80211_wdev_from_attrs(genl_info_net(info), info->attrs); | ||
6596 | int err; | 6598 | int err; |
6597 | 6599 | ||
6600 | if (!rdev->ops->testmode_cmd) | ||
6601 | return -EOPNOTSUPP; | ||
6602 | |||
6603 | if (IS_ERR(wdev)) { | ||
6604 | err = PTR_ERR(wdev); | ||
6605 | if (err != -EINVAL) | ||
6606 | return err; | ||
6607 | wdev = NULL; | ||
6608 | } else if (wdev->wiphy != &rdev->wiphy) { | ||
6609 | return -EINVAL; | ||
6610 | } | ||
6611 | |||
6598 | if (!info->attrs[NL80211_ATTR_TESTDATA]) | 6612 | if (!info->attrs[NL80211_ATTR_TESTDATA]) |
6599 | return -EINVAL; | 6613 | return -EINVAL; |
6600 | 6614 | ||
6601 | err = -EOPNOTSUPP; | 6615 | rdev->testmode_info = info; |
6602 | if (rdev->ops->testmode_cmd) { | 6616 | err = rdev_testmode_cmd(rdev, wdev, |
6603 | rdev->testmode_info = info; | ||
6604 | err = rdev_testmode_cmd(rdev, | ||
6605 | nla_data(info->attrs[NL80211_ATTR_TESTDATA]), | 6617 | nla_data(info->attrs[NL80211_ATTR_TESTDATA]), |
6606 | nla_len(info->attrs[NL80211_ATTR_TESTDATA])); | 6618 | nla_len(info->attrs[NL80211_ATTR_TESTDATA])); |
6607 | rdev->testmode_info = NULL; | 6619 | rdev->testmode_info = NULL; |
6608 | } | ||
6609 | 6620 | ||
6610 | return err; | 6621 | return err; |
6611 | } | 6622 | } |
@@ -7567,14 +7578,12 @@ static int nl80211_set_cqm_txe(struct genl_info *info, | |||
7567 | u32 rate, u32 pkts, u32 intvl) | 7578 | u32 rate, u32 pkts, u32 intvl) |
7568 | { | 7579 | { |
7569 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 7580 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
7570 | struct wireless_dev *wdev; | ||
7571 | struct net_device *dev = info->user_ptr[1]; | 7581 | struct net_device *dev = info->user_ptr[1]; |
7582 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
7572 | 7583 | ||
7573 | if (rate > 100 || intvl > NL80211_CQM_TXE_MAX_INTVL) | 7584 | if (rate > 100 || intvl > NL80211_CQM_TXE_MAX_INTVL) |
7574 | return -EINVAL; | 7585 | return -EINVAL; |
7575 | 7586 | ||
7576 | wdev = dev->ieee80211_ptr; | ||
7577 | |||
7578 | if (!rdev->ops->set_cqm_txe_config) | 7587 | if (!rdev->ops->set_cqm_txe_config) |
7579 | return -EOPNOTSUPP; | 7588 | return -EOPNOTSUPP; |
7580 | 7589 | ||
@@ -7589,13 +7598,15 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, | |||
7589 | s32 threshold, u32 hysteresis) | 7598 | s32 threshold, u32 hysteresis) |
7590 | { | 7599 | { |
7591 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 7600 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
7592 | struct wireless_dev *wdev; | ||
7593 | struct net_device *dev = info->user_ptr[1]; | 7601 | struct net_device *dev = info->user_ptr[1]; |
7602 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
7594 | 7603 | ||
7595 | if (threshold > 0) | 7604 | if (threshold > 0) |
7596 | return -EINVAL; | 7605 | return -EINVAL; |
7597 | 7606 | ||
7598 | wdev = dev->ieee80211_ptr; | 7607 | /* disabling - hysteresis should also be zero then */ |
7608 | if (threshold == 0) | ||
7609 | hysteresis = 0; | ||
7599 | 7610 | ||
7600 | if (!rdev->ops->set_cqm_rssi_config) | 7611 | if (!rdev->ops->set_cqm_rssi_config) |
7601 | return -EOPNOTSUPP; | 7612 | return -EOPNOTSUPP; |
@@ -7614,36 +7625,33 @@ static int nl80211_set_cqm(struct sk_buff *skb, struct genl_info *info) | |||
7614 | int err; | 7625 | int err; |
7615 | 7626 | ||
7616 | cqm = info->attrs[NL80211_ATTR_CQM]; | 7627 | cqm = info->attrs[NL80211_ATTR_CQM]; |
7617 | if (!cqm) { | 7628 | if (!cqm) |
7618 | err = -EINVAL; | 7629 | return -EINVAL; |
7619 | goto out; | ||
7620 | } | ||
7621 | 7630 | ||
7622 | err = nla_parse_nested(attrs, NL80211_ATTR_CQM_MAX, cqm, | 7631 | err = nla_parse_nested(attrs, NL80211_ATTR_CQM_MAX, cqm, |
7623 | nl80211_attr_cqm_policy); | 7632 | nl80211_attr_cqm_policy); |
7624 | if (err) | 7633 | if (err) |
7625 | goto out; | 7634 | return err; |
7626 | 7635 | ||
7627 | if (attrs[NL80211_ATTR_CQM_RSSI_THOLD] && | 7636 | if (attrs[NL80211_ATTR_CQM_RSSI_THOLD] && |
7628 | attrs[NL80211_ATTR_CQM_RSSI_HYST]) { | 7637 | attrs[NL80211_ATTR_CQM_RSSI_HYST]) { |
7629 | s32 threshold; | 7638 | s32 threshold = nla_get_s32(attrs[NL80211_ATTR_CQM_RSSI_THOLD]); |
7630 | u32 hysteresis; | 7639 | u32 hysteresis = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_HYST]); |
7631 | threshold = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_THOLD]); | ||
7632 | hysteresis = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_HYST]); | ||
7633 | err = nl80211_set_cqm_rssi(info, threshold, hysteresis); | ||
7634 | } else if (attrs[NL80211_ATTR_CQM_TXE_RATE] && | ||
7635 | attrs[NL80211_ATTR_CQM_TXE_PKTS] && | ||
7636 | attrs[NL80211_ATTR_CQM_TXE_INTVL]) { | ||
7637 | u32 rate, pkts, intvl; | ||
7638 | rate = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_RATE]); | ||
7639 | pkts = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_PKTS]); | ||
7640 | intvl = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_INTVL]); | ||
7641 | err = nl80211_set_cqm_txe(info, rate, pkts, intvl); | ||
7642 | } else | ||
7643 | err = -EINVAL; | ||
7644 | 7640 | ||
7645 | out: | 7641 | return nl80211_set_cqm_rssi(info, threshold, hysteresis); |
7646 | return err; | 7642 | } |
7643 | |||
7644 | if (attrs[NL80211_ATTR_CQM_TXE_RATE] && | ||
7645 | attrs[NL80211_ATTR_CQM_TXE_PKTS] && | ||
7646 | attrs[NL80211_ATTR_CQM_TXE_INTVL]) { | ||
7647 | u32 rate = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_RATE]); | ||
7648 | u32 pkts = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_PKTS]); | ||
7649 | u32 intvl = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_INTVL]); | ||
7650 | |||
7651 | return nl80211_set_cqm_txe(info, rate, pkts, intvl); | ||
7652 | } | ||
7653 | |||
7654 | return -EINVAL; | ||
7647 | } | 7655 | } |
7648 | 7656 | ||
7649 | static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) | 7657 | static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) |
@@ -10442,7 +10450,7 @@ EXPORT_SYMBOL(cfg80211_rx_unexpected_4addr_frame); | |||
10442 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, | 10450 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, |
10443 | struct wireless_dev *wdev, u32 nlportid, | 10451 | struct wireless_dev *wdev, u32 nlportid, |
10444 | int freq, int sig_dbm, | 10452 | int freq, int sig_dbm, |
10445 | const u8 *buf, size_t len, gfp_t gfp) | 10453 | const u8 *buf, size_t len, u32 flags, gfp_t gfp) |
10446 | { | 10454 | { |
10447 | struct net_device *netdev = wdev->netdev; | 10455 | struct net_device *netdev = wdev->netdev; |
10448 | struct sk_buff *msg; | 10456 | struct sk_buff *msg; |
@@ -10465,7 +10473,9 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, | |||
10465 | nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) || | 10473 | nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) || |
10466 | (sig_dbm && | 10474 | (sig_dbm && |
10467 | nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) || | 10475 | nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) || |
10468 | nla_put(msg, NL80211_ATTR_FRAME, len, buf)) | 10476 | nla_put(msg, NL80211_ATTR_FRAME, len, buf) || |
10477 | (flags && | ||
10478 | nla_put_u32(msg, NL80211_ATTR_RXMGMT_FLAGS, flags))) | ||
10469 | goto nla_put_failure; | 10479 | goto nla_put_failure; |
10470 | 10480 | ||
10471 | genlmsg_end(msg, hdr); | 10481 | genlmsg_end(msg, hdr); |
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h index 44341bf53cfc..2c0f2b3c07cb 100644 --- a/net/wireless/nl80211.h +++ b/net/wireless/nl80211.h | |||
@@ -66,7 +66,7 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, | |||
66 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, | 66 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, |
67 | struct wireless_dev *wdev, u32 nlpid, | 67 | struct wireless_dev *wdev, u32 nlpid, |
68 | int freq, int sig_dbm, | 68 | int freq, int sig_dbm, |
69 | const u8 *buf, size_t len, gfp_t gfp); | 69 | const u8 *buf, size_t len, u32 flags, gfp_t gfp); |
70 | 70 | ||
71 | void | 71 | void |
72 | nl80211_radar_notify(struct cfg80211_registered_device *rdev, | 72 | nl80211_radar_notify(struct cfg80211_registered_device *rdev, |
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index de870d4d0bcc..37ce9fdfe934 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h | |||
@@ -516,11 +516,12 @@ static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev) | |||
516 | 516 | ||
517 | #ifdef CONFIG_NL80211_TESTMODE | 517 | #ifdef CONFIG_NL80211_TESTMODE |
518 | static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev, | 518 | static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev, |
519 | struct wireless_dev *wdev, | ||
519 | void *data, int len) | 520 | void *data, int len) |
520 | { | 521 | { |
521 | int ret; | 522 | int ret; |
522 | trace_rdev_testmode_cmd(&rdev->wiphy); | 523 | trace_rdev_testmode_cmd(&rdev->wiphy, wdev); |
523 | ret = rdev->ops->testmode_cmd(&rdev->wiphy, data, len); | 524 | ret = rdev->ops->testmode_cmd(&rdev->wiphy, wdev, data, len); |
524 | trace_rdev_return_int(&rdev->wiphy, ret); | 525 | trace_rdev_return_int(&rdev->wiphy, ret); |
525 | return ret; | 526 | return ret; |
526 | } | 527 | } |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index ad1e4068ce06..eeb71480f1af 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -465,10 +465,6 @@ static int cmp_bss(struct cfg80211_bss *a, | |||
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
468 | /* | ||
469 | * we can't use compare_ether_addr here since we need a < > operator. | ||
470 | * The binary return value of compare_ether_addr isn't enough | ||
471 | */ | ||
472 | r = memcmp(a->bssid, b->bssid, sizeof(a->bssid)); | 468 | r = memcmp(a->bssid, b->bssid, sizeof(a->bssid)); |
473 | if (r) | 469 | if (r) |
474 | return r; | 470 | return r; |
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index f0ebdcd394ef..ba5f0d6614d5 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -1293,15 +1293,17 @@ TRACE_EVENT(rdev_return_int_int, | |||
1293 | 1293 | ||
1294 | #ifdef CONFIG_NL80211_TESTMODE | 1294 | #ifdef CONFIG_NL80211_TESTMODE |
1295 | TRACE_EVENT(rdev_testmode_cmd, | 1295 | TRACE_EVENT(rdev_testmode_cmd, |
1296 | TP_PROTO(struct wiphy *wiphy), | 1296 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev), |
1297 | TP_ARGS(wiphy), | 1297 | TP_ARGS(wiphy, wdev), |
1298 | TP_STRUCT__entry( | 1298 | TP_STRUCT__entry( |
1299 | WIPHY_ENTRY | 1299 | WIPHY_ENTRY |
1300 | WDEV_ENTRY | ||
1300 | ), | 1301 | ), |
1301 | TP_fast_assign( | 1302 | TP_fast_assign( |
1302 | WIPHY_ASSIGN; | 1303 | WIPHY_ASSIGN; |
1304 | WDEV_ASSIGN; | ||
1303 | ), | 1305 | ), |
1304 | TP_printk(WIPHY_PR_FMT, WIPHY_PR_ARG) | 1306 | TP_printk(WIPHY_PR_FMT WDEV_PR_FMT, WIPHY_PR_ARG, WDEV_PR_ARG) |
1305 | ); | 1307 | ); |
1306 | 1308 | ||
1307 | TRACE_EVENT(rdev_testmode_dump, | 1309 | TRACE_EVENT(rdev_testmode_dump, |
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c index 66c638730c7a..b8253250d723 100644 --- a/net/x25/x25_facilities.c +++ b/net/x25/x25_facilities.c | |||
@@ -156,6 +156,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
156 | case X25_FAC_CALLING_AE: | 156 | case X25_FAC_CALLING_AE: |
157 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) | 157 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
158 | return -1; | 158 | return -1; |
159 | if (p[2] > X25_MAX_AE_LEN) | ||
160 | return -1; | ||
159 | dte_facs->calling_len = p[2]; | 161 | dte_facs->calling_len = p[2]; |
160 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); | 162 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); |
161 | *vc_fac_mask |= X25_MASK_CALLING_AE; | 163 | *vc_fac_mask |= X25_MASK_CALLING_AE; |
@@ -163,6 +165,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
163 | case X25_FAC_CALLED_AE: | 165 | case X25_FAC_CALLED_AE: |
164 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) | 166 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
165 | return -1; | 167 | return -1; |
168 | if (p[2] > X25_MAX_AE_LEN) | ||
169 | return -1; | ||
166 | dte_facs->called_len = p[2]; | 170 | dte_facs->called_len = p[2]; |
167 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); | 171 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); |
168 | *vc_fac_mask |= X25_MASK_CALLED_AE; | 172 | *vc_fac_mask |= X25_MASK_CALLED_AE; |