diff options
author | David S. Miller <davem@davemloft.net> | 2016-07-14 19:27:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-14 19:32:27 -0400 |
commit | 88b3ec527416f95ac4eae3cd458249143105deb8 (patch) | |
tree | 601973e8ccc882145068c77ef6be013307a18a36 | |
parent | d8c62a91f7fd4239576d105b741140434e5368a0 (diff) | |
parent | 25f700ef0653d7644ed273f8770230e734cae726 (diff) |
Merge tag 'wireless-drivers-next-for-davem-2016-07-13' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
Kalle Valo says:
====================
wireless-drivers-next patches for 4.8
Major changes:
iwlwifi
* more work on the RX path for the 9000 device series
* some more dynamic queue allocation work
* SAR BIOS implementation
* some work on debugging capabilities
* added support for GCMP encryption
* data path rework in preparation for new HW
* some cleanup to remove transport dependency on mac80211
* support for MSIx in preparation for new HW
* lots of work in preparation for HW support (9000 and a000 series)
mwifiex
* implement get_tx_power and get_antenna cfg80211 operation callbacks
wl18xx
* add support for 64bit clock
rtl8xxxu
* aggregation support (optional for now)
Also wireless-drivers is merged to fix some conflicts.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
161 files changed, 3670 insertions, 1962 deletions
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index afe2b202040a..b8f7dec212e5 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | |||
@@ -789,12 +789,48 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, | |||
789 | return err; | 789 | return err; |
790 | } | 790 | } |
791 | 791 | ||
792 | static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy, | ||
793 | struct wireless_dev *wdev) | ||
794 | { | ||
795 | struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); | ||
796 | struct net_device *ndev = wdev->netdev; | ||
797 | struct brcmf_if *ifp = netdev_priv(ndev); | ||
798 | int ret; | ||
799 | int err; | ||
800 | |||
801 | brcmf_cfg80211_arm_vif_event(cfg, ifp->vif); | ||
802 | |||
803 | err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0); | ||
804 | if (err) { | ||
805 | brcmf_err("interface_remove failed %d\n", err); | ||
806 | goto err_unarm; | ||
807 | } | ||
808 | |||
809 | /* wait for firmware event */ | ||
810 | ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL, | ||
811 | BRCMF_VIF_EVENT_TIMEOUT); | ||
812 | if (!ret) { | ||
813 | brcmf_err("timeout occurred\n"); | ||
814 | err = -EIO; | ||
815 | goto err_unarm; | ||
816 | } | ||
817 | |||
818 | brcmf_remove_interface(ifp, true); | ||
819 | |||
820 | err_unarm: | ||
821 | brcmf_cfg80211_arm_vif_event(cfg, NULL); | ||
822 | return err; | ||
823 | } | ||
824 | |||
792 | static | 825 | static |
793 | int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) | 826 | int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) |
794 | { | 827 | { |
795 | struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); | 828 | struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); |
796 | struct net_device *ndev = wdev->netdev; | 829 | struct net_device *ndev = wdev->netdev; |
797 | 830 | ||
831 | if (ndev && ndev == cfg_to_ndev(cfg)) | ||
832 | return -ENOTSUPP; | ||
833 | |||
798 | /* vif event pending in firmware */ | 834 | /* vif event pending in firmware */ |
799 | if (brcmf_cfg80211_vif_event_armed(cfg)) | 835 | if (brcmf_cfg80211_vif_event_armed(cfg)) |
800 | return -EBUSY; | 836 | return -EBUSY; |
@@ -811,12 +847,13 @@ int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
811 | switch (wdev->iftype) { | 847 | switch (wdev->iftype) { |
812 | case NL80211_IFTYPE_ADHOC: | 848 | case NL80211_IFTYPE_ADHOC: |
813 | case NL80211_IFTYPE_STATION: | 849 | case NL80211_IFTYPE_STATION: |
814 | case NL80211_IFTYPE_AP: | ||
815 | case NL80211_IFTYPE_AP_VLAN: | 850 | case NL80211_IFTYPE_AP_VLAN: |
816 | case NL80211_IFTYPE_WDS: | 851 | case NL80211_IFTYPE_WDS: |
817 | case NL80211_IFTYPE_MONITOR: | 852 | case NL80211_IFTYPE_MONITOR: |
818 | case NL80211_IFTYPE_MESH_POINT: | 853 | case NL80211_IFTYPE_MESH_POINT: |
819 | return -EOPNOTSUPP; | 854 | return -EOPNOTSUPP; |
855 | case NL80211_IFTYPE_AP: | ||
856 | return brcmf_cfg80211_del_ap_iface(wiphy, wdev); | ||
820 | case NL80211_IFTYPE_P2P_CLIENT: | 857 | case NL80211_IFTYPE_P2P_CLIENT: |
821 | case NL80211_IFTYPE_P2P_GO: | 858 | case NL80211_IFTYPE_P2P_GO: |
822 | case NL80211_IFTYPE_P2P_DEVICE: | 859 | case NL80211_IFTYPE_P2P_DEVICE: |
@@ -6288,29 +6325,15 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) | |||
6288 | if (!combo) | 6325 | if (!combo) |
6289 | goto err; | 6326 | goto err; |
6290 | 6327 | ||
6291 | c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL); | ||
6292 | if (!c0_limits) | ||
6293 | goto err; | ||
6294 | |||
6295 | if (p2p) { | ||
6296 | p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL); | ||
6297 | if (!p2p_limits) | ||
6298 | goto err; | ||
6299 | } | ||
6300 | |||
6301 | if (mbss) { | ||
6302 | mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL); | ||
6303 | if (!mbss_limits) | ||
6304 | goto err; | ||
6305 | } | ||
6306 | |||
6307 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | | 6328 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | |
6308 | BIT(NL80211_IFTYPE_ADHOC) | | 6329 | BIT(NL80211_IFTYPE_ADHOC) | |
6309 | BIT(NL80211_IFTYPE_AP); | 6330 | BIT(NL80211_IFTYPE_AP); |
6310 | 6331 | ||
6311 | c = 0; | 6332 | c = 0; |
6312 | i = 0; | 6333 | i = 0; |
6313 | combo[c].num_different_channels = 1; | 6334 | c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL); |
6335 | if (!c0_limits) | ||
6336 | goto err; | ||
6314 | c0_limits[i].max = 1; | 6337 | c0_limits[i].max = 1; |
6315 | c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); | 6338 | c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); |
6316 | if (p2p) { | 6339 | if (p2p) { |
@@ -6328,6 +6351,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) | |||
6328 | c0_limits[i].max = 1; | 6351 | c0_limits[i].max = 1; |
6329 | c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); | 6352 | c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); |
6330 | } | 6353 | } |
6354 | combo[c].num_different_channels = 1; | ||
6331 | combo[c].max_interfaces = i; | 6355 | combo[c].max_interfaces = i; |
6332 | combo[c].n_limits = i; | 6356 | combo[c].n_limits = i; |
6333 | combo[c].limits = c0_limits; | 6357 | combo[c].limits = c0_limits; |
@@ -6335,7 +6359,9 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) | |||
6335 | if (p2p) { | 6359 | if (p2p) { |
6336 | c++; | 6360 | c++; |
6337 | i = 0; | 6361 | i = 0; |
6338 | combo[c].num_different_channels = 1; | 6362 | p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL); |
6363 | if (!p2p_limits) | ||
6364 | goto err; | ||
6339 | p2p_limits[i].max = 1; | 6365 | p2p_limits[i].max = 1; |
6340 | p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION); | 6366 | p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION); |
6341 | p2p_limits[i].max = 1; | 6367 | p2p_limits[i].max = 1; |
@@ -6344,6 +6370,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) | |||
6344 | p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT); | 6370 | p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT); |
6345 | p2p_limits[i].max = 1; | 6371 | p2p_limits[i].max = 1; |
6346 | p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); | 6372 | p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); |
6373 | combo[c].num_different_channels = 1; | ||
6347 | combo[c].max_interfaces = i; | 6374 | combo[c].max_interfaces = i; |
6348 | combo[c].n_limits = i; | 6375 | combo[c].n_limits = i; |
6349 | combo[c].limits = p2p_limits; | 6376 | combo[c].limits = p2p_limits; |
@@ -6351,14 +6378,19 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) | |||
6351 | 6378 | ||
6352 | if (mbss) { | 6379 | if (mbss) { |
6353 | c++; | 6380 | c++; |
6381 | i = 0; | ||
6382 | mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL); | ||
6383 | if (!mbss_limits) | ||
6384 | goto err; | ||
6385 | mbss_limits[i].max = 4; | ||
6386 | mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP); | ||
6354 | combo[c].beacon_int_infra_match = true; | 6387 | combo[c].beacon_int_infra_match = true; |
6355 | combo[c].num_different_channels = 1; | 6388 | combo[c].num_different_channels = 1; |
6356 | mbss_limits[0].max = 4; | ||
6357 | mbss_limits[0].types = BIT(NL80211_IFTYPE_AP); | ||
6358 | combo[c].max_interfaces = 4; | 6389 | combo[c].max_interfaces = 4; |
6359 | combo[c].n_limits = 1; | 6390 | combo[c].n_limits = i; |
6360 | combo[c].limits = mbss_limits; | 6391 | combo[c].limits = mbss_limits; |
6361 | } | 6392 | } |
6393 | |||
6362 | wiphy->n_iface_combinations = n_combos; | 6394 | wiphy->n_iface_combinations = n_combos; |
6363 | wiphy->iface_combinations = combo; | 6395 | wiphy->iface_combinations = combo; |
6364 | return 0; | 6396 | return 0; |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h index 04bfc7e3ecde..7d77f869b7f1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | |||
@@ -20,6 +20,7 @@ | |||
20 | /* for brcmu_d11inf */ | 20 | /* for brcmu_d11inf */ |
21 | #include <brcmu_d11.h> | 21 | #include <brcmu_d11.h> |
22 | 22 | ||
23 | #include "core.h" | ||
23 | #include "fwil_types.h" | 24 | #include "fwil_types.h" |
24 | #include "p2p.h" | 25 | #include "p2p.h" |
25 | 26 | ||
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index faf4e46bd65b..8d16f0204985 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | |||
@@ -548,12 +548,16 @@ fail: | |||
548 | return -EBADE; | 548 | return -EBADE; |
549 | } | 549 | } |
550 | 550 | ||
551 | static void brcmf_net_detach(struct net_device *ndev) | 551 | static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked) |
552 | { | 552 | { |
553 | if (ndev->reg_state == NETREG_REGISTERED) | 553 | if (ndev->reg_state == NETREG_REGISTERED) { |
554 | unregister_netdev(ndev); | 554 | if (rtnl_locked) |
555 | else | 555 | unregister_netdevice(ndev); |
556 | else | ||
557 | unregister_netdev(ndev); | ||
558 | } else { | ||
556 | brcmf_cfg80211_free_netdev(ndev); | 559 | brcmf_cfg80211_free_netdev(ndev); |
560 | } | ||
557 | } | 561 | } |
558 | 562 | ||
559 | void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on) | 563 | void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on) |
@@ -634,7 +638,7 @@ fail: | |||
634 | } | 638 | } |
635 | 639 | ||
636 | struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, | 640 | struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, |
637 | bool is_p2pdev, char *name, u8 *mac_addr) | 641 | bool is_p2pdev, const char *name, u8 *mac_addr) |
638 | { | 642 | { |
639 | struct brcmf_if *ifp; | 643 | struct brcmf_if *ifp; |
640 | struct net_device *ndev; | 644 | struct net_device *ndev; |
@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, | |||
651 | brcmf_err("ERROR: netdev:%s already exists\n", | 655 | brcmf_err("ERROR: netdev:%s already exists\n", |
652 | ifp->ndev->name); | 656 | ifp->ndev->name); |
653 | netif_stop_queue(ifp->ndev); | 657 | netif_stop_queue(ifp->ndev); |
654 | brcmf_net_detach(ifp->ndev); | 658 | brcmf_net_detach(ifp->ndev, false); |
655 | drvr->iflist[bsscfgidx] = NULL; | 659 | drvr->iflist[bsscfgidx] = NULL; |
656 | } else { | 660 | } else { |
657 | brcmf_dbg(INFO, "netdev:%s ignore IF event\n", | 661 | brcmf_dbg(INFO, "netdev:%s ignore IF event\n", |
@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, | |||
699 | return ifp; | 703 | return ifp; |
700 | } | 704 | } |
701 | 705 | ||
702 | static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx) | 706 | static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, |
707 | bool rtnl_locked) | ||
703 | { | 708 | { |
704 | struct brcmf_if *ifp; | 709 | struct brcmf_if *ifp; |
705 | 710 | ||
@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx) | |||
729 | cancel_work_sync(&ifp->multicast_work); | 734 | cancel_work_sync(&ifp->multicast_work); |
730 | cancel_work_sync(&ifp->ndoffload_work); | 735 | cancel_work_sync(&ifp->ndoffload_work); |
731 | } | 736 | } |
732 | brcmf_net_detach(ifp->ndev); | 737 | brcmf_net_detach(ifp->ndev, rtnl_locked); |
733 | } else { | 738 | } else { |
734 | /* Only p2p device interfaces which get dynamically created | 739 | /* Only p2p device interfaces which get dynamically created |
735 | * end up here. In this case the p2p module should be informed | 740 | * end up here. In this case the p2p module should be informed |
@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx) | |||
743 | } | 748 | } |
744 | } | 749 | } |
745 | 750 | ||
746 | void brcmf_remove_interface(struct brcmf_if *ifp) | 751 | void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked) |
747 | { | 752 | { |
748 | if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp)) | 753 | if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp)) |
749 | return; | 754 | return; |
750 | brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx, | 755 | brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx, |
751 | ifp->ifidx); | 756 | ifp->ifidx); |
752 | brcmf_fws_del_interface(ifp); | 757 | brcmf_fws_del_interface(ifp); |
753 | brcmf_del_if(ifp->drvr, ifp->bsscfgidx); | 758 | brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked); |
754 | } | 759 | } |
755 | 760 | ||
756 | #ifdef CONFIG_INET | 761 | #ifdef CONFIG_INET |
@@ -1057,9 +1062,9 @@ fail: | |||
1057 | brcmf_fws_deinit(drvr); | 1062 | brcmf_fws_deinit(drvr); |
1058 | } | 1063 | } |
1059 | if (ifp) | 1064 | if (ifp) |
1060 | brcmf_net_detach(ifp->ndev); | 1065 | brcmf_net_detach(ifp->ndev, false); |
1061 | if (p2p_ifp) | 1066 | if (p2p_ifp) |
1062 | brcmf_net_detach(p2p_ifp->ndev); | 1067 | brcmf_net_detach(p2p_ifp->ndev, false); |
1063 | drvr->iflist[0] = NULL; | 1068 | drvr->iflist[0] = NULL; |
1064 | drvr->iflist[1] = NULL; | 1069 | drvr->iflist[1] = NULL; |
1065 | if (drvr->settings->ignore_probe_fail) | 1070 | if (drvr->settings->ignore_probe_fail) |
@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev) | |||
1128 | 1133 | ||
1129 | /* make sure primary interface removed last */ | 1134 | /* make sure primary interface removed last */ |
1130 | for (i = BRCMF_MAX_IFS-1; i > -1; i--) | 1135 | for (i = BRCMF_MAX_IFS-1; i > -1; i--) |
1131 | brcmf_remove_interface(drvr->iflist[i]); | 1136 | brcmf_remove_interface(drvr->iflist[i], false); |
1132 | 1137 | ||
1133 | brcmf_cfg80211_detach(drvr->config); | 1138 | brcmf_cfg80211_detach(drvr->config); |
1134 | 1139 | ||
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h index 2a075c5f6f8b..8fa34cad5a96 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | |||
@@ -215,8 +215,8 @@ char *brcmf_ifname(struct brcmf_if *ifp); | |||
215 | struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); | 215 | struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); |
216 | int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); | 216 | int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); |
217 | struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, | 217 | struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, |
218 | bool is_p2pdev, char *name, u8 *mac_addr); | 218 | bool is_p2pdev, const char *name, u8 *mac_addr); |
219 | void brcmf_remove_interface(struct brcmf_if *ifp); | 219 | void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked); |
220 | void brcmf_txflowblock_if(struct brcmf_if *ifp, | 220 | void brcmf_txflowblock_if(struct brcmf_if *ifp, |
221 | enum brcmf_netif_stop_reason reason, bool state); | 221 | enum brcmf_netif_stop_reason reason, bool state); |
222 | void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success); | 222 | void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success); |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c index b390561255b3..79c081fd560f 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include "brcmu_wifi.h" | 18 | #include "brcmu_wifi.h" |
19 | #include "brcmu_utils.h" | 19 | #include "brcmu_utils.h" |
20 | 20 | ||
21 | #include "cfg80211.h" | ||
21 | #include "core.h" | 22 | #include "core.h" |
22 | #include "debug.h" | 23 | #include "debug.h" |
23 | #include "tracepoint.h" | 24 | #include "tracepoint.h" |
@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
182 | 183 | ||
183 | err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); | 184 | err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); |
184 | 185 | ||
185 | if (ifp && ifevent->action == BRCMF_E_IF_DEL) | 186 | if (ifp && ifevent->action == BRCMF_E_IF_DEL) { |
186 | brcmf_remove_interface(ifp); | 187 | bool armed = brcmf_cfg80211_vif_event_armed(drvr->config); |
188 | |||
189 | /* Default handling in case no-one waits for this event */ | ||
190 | if (!armed) | ||
191 | brcmf_remove_interface(ifp, false); | ||
192 | } | ||
187 | } | 193 | } |
188 | 194 | ||
189 | /** | 195 | /** |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c index f38a82133540..66f942f7448e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | |||
@@ -2261,6 +2261,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2261 | return 0; | 2261 | return 0; |
2262 | brcmf_p2p_cancel_remain_on_channel(vif->ifp); | 2262 | brcmf_p2p_cancel_remain_on_channel(vif->ifp); |
2263 | brcmf_p2p_deinit_discovery(p2p); | 2263 | brcmf_p2p_deinit_discovery(p2p); |
2264 | break; | ||
2265 | |||
2264 | default: | 2266 | default: |
2265 | return -ENOTSUPP; | 2267 | return -ENOTSUPP; |
2266 | } | 2268 | } |
@@ -2286,8 +2288,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2286 | else | 2288 | else |
2287 | err = 0; | 2289 | err = 0; |
2288 | } | 2290 | } |
2289 | if (err) | 2291 | brcmf_remove_interface(vif->ifp, true); |
2290 | brcmf_remove_interface(vif->ifp); | ||
2291 | 2292 | ||
2292 | brcmf_cfg80211_arm_vif_event(cfg, NULL); | 2293 | brcmf_cfg80211_arm_vif_event(cfg, NULL); |
2293 | if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE) | 2294 | if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE) |
@@ -2393,7 +2394,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_info *p2p) | |||
2393 | if (vif != NULL) { | 2394 | if (vif != NULL) { |
2394 | brcmf_p2p_cancel_remain_on_channel(vif->ifp); | 2395 | brcmf_p2p_cancel_remain_on_channel(vif->ifp); |
2395 | brcmf_p2p_deinit_discovery(p2p); | 2396 | brcmf_p2p_deinit_discovery(p2p); |
2396 | brcmf_remove_interface(vif->ifp); | 2397 | brcmf_remove_interface(vif->ifp, false); |
2397 | } | 2398 | } |
2398 | /* just set it all to zero */ | 2399 | /* just set it all to zero */ |
2399 | memset(p2p, 0, sizeof(*p2p)); | 2400 | memset(p2p, 0, sizeof(*p2p)); |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c index e16ee60639f5..c2a938b59044 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c | |||
@@ -3349,8 +3349,8 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc) | |||
3349 | dma_rxfill(wlc_hw->di[RX_FIFO]); | 3349 | dma_rxfill(wlc_hw->di[RX_FIFO]); |
3350 | } | 3350 | } |
3351 | 3351 | ||
3352 | void | 3352 | static void brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) |
3353 | static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) { | 3353 | { |
3354 | u32 macintmask; | 3354 | u32 macintmask; |
3355 | bool fastclk; | 3355 | bool fastclk; |
3356 | struct brcms_c_info *wlc = wlc_hw->wlc; | 3356 | struct brcms_c_info *wlc = wlc_hw->wlc; |
diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index ca3cd2102bd6..69b826d229c5 100644 --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c | |||
@@ -1102,8 +1102,8 @@ static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)"; | |||
1102 | struct airo_info; | 1102 | struct airo_info; |
1103 | 1103 | ||
1104 | static int get_dec_u16( char *buffer, int *start, int limit ); | 1104 | static int get_dec_u16( char *buffer, int *start, int limit ); |
1105 | static void OUT4500( struct airo_info *, u16 register, u16 value ); | 1105 | static void OUT4500( struct airo_info *, u16 reg, u16 value ); |
1106 | static unsigned short IN4500( struct airo_info *, u16 register ); | 1106 | static unsigned short IN4500( struct airo_info *, u16 reg ); |
1107 | static u16 setup_card(struct airo_info*, u8 *mac, int lock); | 1107 | static u16 setup_card(struct airo_info*, u8 *mac, int lock); |
1108 | static int enable_MAC(struct airo_info *ai, int lock); | 1108 | static int enable_MAC(struct airo_info *ai, int lock); |
1109 | static void disable_MAC(struct airo_info *ai, int lock); | 1109 | static void disable_MAC(struct airo_info *ai, int lock); |
diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c index 5adb7cefb2fe..bfd68612a535 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c | |||
@@ -4093,7 +4093,7 @@ static const char *ipw_get_status_code(u16 status) | |||
4093 | return "Unknown status value."; | 4093 | return "Unknown status value."; |
4094 | } | 4094 | } |
4095 | 4095 | ||
4096 | static void inline average_init(struct average *avg) | 4096 | static inline void average_init(struct average *avg) |
4097 | { | 4097 | { |
4098 | memset(avg, 0, sizeof(*avg)); | 4098 | memset(avg, 0, sizeof(*avg)); |
4099 | } | 4099 | } |
diff --git a/drivers/net/wireless/intel/iwlwifi/Makefile b/drivers/net/wireless/intel/iwlwifi/Makefile index 05828c61d1ab..6e7ed908de0c 100644 --- a/drivers/net/wireless/intel/iwlwifi/Makefile +++ b/drivers/net/wireless/intel/iwlwifi/Makefile | |||
@@ -8,7 +8,7 @@ iwlwifi-objs += iwl-eeprom-read.o iwl-eeprom-parse.o | |||
8 | iwlwifi-objs += iwl-phy-db.o iwl-nvm-parse.o | 8 | iwlwifi-objs += iwl-phy-db.o iwl-nvm-parse.o |
9 | iwlwifi-objs += pcie/drv.o pcie/rx.o pcie/tx.o pcie/trans.o | 9 | iwlwifi-objs += pcie/drv.o pcie/rx.o pcie/tx.o pcie/trans.o |
10 | iwlwifi-$(CONFIG_IWLDVM) += iwl-1000.o iwl-2000.o iwl-5000.o iwl-6000.o | 10 | iwlwifi-$(CONFIG_IWLDVM) += iwl-1000.o iwl-2000.o iwl-5000.o iwl-6000.o |
11 | iwlwifi-$(CONFIG_IWLMVM) += iwl-7000.o iwl-8000.o iwl-9000.o | 11 | iwlwifi-$(CONFIG_IWLMVM) += iwl-7000.o iwl-8000.o iwl-9000.o iwl-a000.o |
12 | iwlwifi-objs += iwl-trans.o | 12 | iwlwifi-objs += iwl-trans.o |
13 | 13 | ||
14 | iwlwifi-objs += $(iwlwifi-m) | 14 | iwlwifi-objs += $(iwlwifi-m) |
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c index 8dda52ae3bb5..6c2d6da7eec6 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c | |||
@@ -205,23 +205,6 @@ static const __le32 iwlagn_def_3w_lookup[IWLAGN_BT_DECISION_LUT_SIZE] = { | |||
205 | cpu_to_le32(0xf0005000), | 205 | cpu_to_le32(0xf0005000), |
206 | }; | 206 | }; |
207 | 207 | ||
208 | |||
209 | /* Loose Coex */ | ||
210 | static const __le32 iwlagn_loose_lookup[IWLAGN_BT_DECISION_LUT_SIZE] = { | ||
211 | cpu_to_le32(0xaaaaaaaa), | ||
212 | cpu_to_le32(0xaaaaaaaa), | ||
213 | cpu_to_le32(0xaeaaaaaa), | ||
214 | cpu_to_le32(0xaaaaaaaa), | ||
215 | cpu_to_le32(0xcc00ff28), | ||
216 | cpu_to_le32(0x0000aaaa), | ||
217 | cpu_to_le32(0xcc00aaaa), | ||
218 | cpu_to_le32(0x0000aaaa), | ||
219 | cpu_to_le32(0x00000000), | ||
220 | cpu_to_le32(0x00000000), | ||
221 | cpu_to_le32(0xf0005000), | ||
222 | cpu_to_le32(0xf0005000), | ||
223 | }; | ||
224 | |||
225 | /* Full concurrency */ | 208 | /* Full concurrency */ |
226 | static const __le32 iwlagn_concurrent_lookup[IWLAGN_BT_DECISION_LUT_SIZE] = { | 209 | static const __le32 iwlagn_concurrent_lookup[IWLAGN_BT_DECISION_LUT_SIZE] = { |
227 | cpu_to_le32(0xaaaaaaaa), | 210 | cpu_to_le32(0xaaaaaaaa), |
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c index 37b32a6f60fd..b49848683587 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c | |||
@@ -1317,6 +1317,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1317 | trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); | 1317 | trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); |
1318 | 1318 | ||
1319 | switch (iwlwifi_mod_params.amsdu_size) { | 1319 | switch (iwlwifi_mod_params.amsdu_size) { |
1320 | case IWL_AMSDU_DEF: | ||
1320 | case IWL_AMSDU_4K: | 1321 | case IWL_AMSDU_4K: |
1321 | trans_cfg.rx_buf_size = IWL_AMSDU_4K; | 1322 | trans_cfg.rx_buf_size = IWL_AMSDU_4K; |
1322 | break; | 1323 | break; |
@@ -1336,6 +1337,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1336 | trans_cfg.command_groups_size = ARRAY_SIZE(iwl_dvm_groups); | 1337 | trans_cfg.command_groups_size = ARRAY_SIZE(iwl_dvm_groups); |
1337 | 1338 | ||
1338 | trans_cfg.cmd_fifo = IWLAGN_CMD_FIFO_NUM; | 1339 | trans_cfg.cmd_fifo = IWLAGN_CMD_FIFO_NUM; |
1340 | trans_cfg.cb_data_offs = offsetof(struct ieee80211_tx_info, | ||
1341 | driver_data[2]); | ||
1339 | 1342 | ||
1340 | WARN_ON(sizeof(priv->transport_queue_stop) * BITS_PER_BYTE < | 1343 | WARN_ON(sizeof(priv->transport_queue_stop) * BITS_PER_BYTE < |
1341 | priv->cfg->base_params->num_of_queues); | 1344 | priv->cfg->base_params->num_of_queues); |
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rxon.c b/drivers/net/wireless/intel/iwlwifi/dvm/rxon.c index b228552184b5..087e579854ab 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rxon.c | |||
@@ -523,11 +523,6 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv, | |||
523 | return ret; | 523 | return ret; |
524 | } | 524 | } |
525 | 525 | ||
526 | if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION && | ||
527 | priv->cfg->ht_params && priv->cfg->ht_params->smps_mode) | ||
528 | ieee80211_request_smps(ctx->vif, | ||
529 | priv->cfg->ht_params->smps_mode); | ||
530 | |||
531 | return 0; | 526 | return 0; |
532 | } | 527 | } |
533 | 528 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c index 3ac298fdd3cd..5c1e71fe45f3 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c | |||
@@ -178,6 +178,7 @@ const struct iwl_cfg iwl5165_2ac_cfg = { | |||
178 | .nvm_ver = IWL9000_NVM_VERSION, | 178 | .nvm_ver = IWL9000_NVM_VERSION, |
179 | .nvm_calib_ver = IWL9000_TX_POWER_VERSION, | 179 | .nvm_calib_ver = IWL9000_TX_POWER_VERSION, |
180 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, | 180 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, |
181 | .integrated = true, | ||
181 | }; | 182 | }; |
182 | 183 | ||
183 | MODULE_FIRMWARE(IWL9000_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX)); | 184 | MODULE_FIRMWARE(IWL9000_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-a000.c b/drivers/net/wireless/intel/iwlwifi/iwl-a000.c new file mode 100644 index 000000000000..4d78232c8afe --- /dev/null +++ b/drivers/net/wireless/intel/iwlwifi/iwl-a000.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
4 | * redistributing this file, you may do so under either license. | ||
5 | * | ||
6 | * GPL LICENSE SUMMARY | ||
7 | * | ||
8 | * Copyright(c) 2015-2016 Intel Deutschland GmbH | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of version 2 of the GNU General Public License as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * BSD LICENSE | ||
20 | * | ||
21 | * Copyright(c) 2015-2016 Intel Deutschland GmbH | ||
22 | * All rights reserved. | ||
23 | * | ||
24 | * Redistribution and use in source and binary forms, with or without | ||
25 | * modification, are permitted provided that the following conditions | ||
26 | * are met: | ||
27 | * | ||
28 | * * Redistributions of source code must retain the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer. | ||
30 | * * Redistributions in binary form must reproduce the above copyright | ||
31 | * notice, this list of conditions and the following disclaimer in | ||
32 | * the documentation and/or other materials provided with the | ||
33 | * distribution. | ||
34 | * * Neither the name Intel Corporation nor the names of its | ||
35 | * contributors may be used to endorse or promote products derived | ||
36 | * from this software without specific prior written permission. | ||
37 | * | ||
38 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
39 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
40 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
41 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
42 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
44 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
45 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
46 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
47 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
48 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
49 | * | ||
50 | *****************************************************************************/ | ||
51 | |||
52 | #include <linux/module.h> | ||
53 | #include <linux/stringify.h> | ||
54 | #include "iwl-config.h" | ||
55 | #include "iwl-agn-hw.h" | ||
56 | |||
57 | /* Highest firmware API version supported */ | ||
58 | #define IWL_A000_UCODE_API_MAX 24 | ||
59 | |||
60 | /* Lowest firmware API version supported */ | ||
61 | #define IWL_A000_UCODE_API_MIN 24 | ||
62 | |||
63 | /* NVM versions */ | ||
64 | #define IWL_A000_NVM_VERSION 0x0a1d | ||
65 | #define IWL_A000_TX_POWER_VERSION 0xffff /* meaningless */ | ||
66 | |||
67 | /* Memory offsets and lengths */ | ||
68 | #define IWL_A000_DCCM_OFFSET 0x800000 | ||
69 | #define IWL_A000_DCCM_LEN 0x18000 | ||
70 | #define IWL_A000_DCCM2_OFFSET 0x880000 | ||
71 | #define IWL_A000_DCCM2_LEN 0x8000 | ||
72 | #define IWL_A000_SMEM_OFFSET 0x400000 | ||
73 | #define IWL_A000_SMEM_LEN 0x68000 | ||
74 | |||
75 | #define IWL_A000_FW_PRE "iwlwifi-Qu-a0-jf-b0-" | ||
76 | #define IWL_A000_MODULE_FIRMWARE(api) \ | ||
77 | IWL_A000_FW_PRE "-" __stringify(api) ".ucode" | ||
78 | |||
79 | #define NVM_HW_SECTION_NUM_FAMILY_A000 10 | ||
80 | |||
81 | static const struct iwl_base_params iwl_a000_base_params = { | ||
82 | .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_A000, | ||
83 | .num_of_queues = 31, | ||
84 | .shadow_ram_support = true, | ||
85 | .led_compensation = 57, | ||
86 | .wd_timeout = IWL_LONG_WD_TIMEOUT, | ||
87 | .max_event_log_size = 512, | ||
88 | .shadow_reg_enable = true, | ||
89 | .pcie_l1_allowed = true, | ||
90 | }; | ||
91 | |||
92 | static const struct iwl_ht_params iwl_a000_ht_params = { | ||
93 | .stbc = true, | ||
94 | .ldpc = true, | ||
95 | .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ), | ||
96 | }; | ||
97 | |||
98 | #define IWL_DEVICE_A000 \ | ||
99 | .ucode_api_max = IWL_A000_UCODE_API_MAX, \ | ||
100 | .ucode_api_min = IWL_A000_UCODE_API_MIN, \ | ||
101 | .device_family = IWL_DEVICE_FAMILY_8000, \ | ||
102 | .max_inst_size = IWL60_RTC_INST_SIZE, \ | ||
103 | .max_data_size = IWL60_RTC_DATA_SIZE, \ | ||
104 | .base_params = &iwl_a000_base_params, \ | ||
105 | .led_mode = IWL_LED_RF_STATE, \ | ||
106 | .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_A000, \ | ||
107 | .non_shared_ant = ANT_A, \ | ||
108 | .dccm_offset = IWL_A000_DCCM_OFFSET, \ | ||
109 | .dccm_len = IWL_A000_DCCM_LEN, \ | ||
110 | .dccm2_offset = IWL_A000_DCCM2_OFFSET, \ | ||
111 | .dccm2_len = IWL_A000_DCCM2_LEN, \ | ||
112 | .smem_offset = IWL_A000_SMEM_OFFSET, \ | ||
113 | .smem_len = IWL_A000_SMEM_LEN, \ | ||
114 | .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, \ | ||
115 | .apmg_not_supported = true, \ | ||
116 | .mq_rx_supported = true, \ | ||
117 | .vht_mu_mimo_supported = true, \ | ||
118 | .mac_addr_from_csr = true, \ | ||
119 | .use_tfh = true | ||
120 | |||
121 | const struct iwl_cfg iwla000_2ac_cfg = { | ||
122 | .name = "Intel(R) Dual Band Wireless AC a000", | ||
123 | .fw_name_pre = IWL_A000_FW_PRE, | ||
124 | IWL_DEVICE_A000, | ||
125 | .ht_params = &iwl_a000_ht_params, | ||
126 | .nvm_ver = IWL_A000_NVM_VERSION, | ||
127 | .nvm_calib_ver = IWL_A000_TX_POWER_VERSION, | ||
128 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, | ||
129 | }; | ||
130 | |||
131 | MODULE_FIRMWARE(IWL_A000_MODULE_FIRMWARE(IWL_A000_UCODE_API_MAX)); | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h index 4a0af7de82fd..423b23320d4f 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h | |||
@@ -66,8 +66,9 @@ | |||
66 | #define __IWL_CONFIG_H__ | 66 | #define __IWL_CONFIG_H__ |
67 | 67 | ||
68 | #include <linux/types.h> | 68 | #include <linux/types.h> |
69 | #include <net/mac80211.h> | 69 | #include <linux/netdevice.h> |
70 | 70 | #include <linux/ieee80211.h> | |
71 | #include <linux/nl80211.h> | ||
71 | 72 | ||
72 | enum iwl_device_family { | 73 | enum iwl_device_family { |
73 | IWL_DEVICE_FAMILY_UNDEFINED, | 74 | IWL_DEVICE_FAMILY_UNDEFINED, |
@@ -192,7 +193,6 @@ struct iwl_base_params { | |||
192 | * @ht40_bands: bitmap of bands (using %NL80211_BAND_*) that support HT40 | 193 | * @ht40_bands: bitmap of bands (using %NL80211_BAND_*) that support HT40 |
193 | */ | 194 | */ |
194 | struct iwl_ht_params { | 195 | struct iwl_ht_params { |
195 | enum ieee80211_smps_mode smps_mode; | ||
196 | u8 ht_greenfield_support:1, | 196 | u8 ht_greenfield_support:1, |
197 | stbc:1, | 197 | stbc:1, |
198 | ldpc:1, | 198 | ldpc:1, |
@@ -261,6 +261,7 @@ struct iwl_tt_params { | |||
261 | #define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(u16)) /* 16 KB */ | 261 | #define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(u16)) /* 16 KB */ |
262 | #define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */ | 262 | #define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */ |
263 | #define OTP_LOW_IMAGE_SIZE_FAMILY_9000 OTP_LOW_IMAGE_SIZE_FAMILY_8000 | 263 | #define OTP_LOW_IMAGE_SIZE_FAMILY_9000 OTP_LOW_IMAGE_SIZE_FAMILY_8000 |
264 | #define OTP_LOW_IMAGE_SIZE_FAMILY_A000 OTP_LOW_IMAGE_SIZE_FAMILY_9000 | ||
264 | 265 | ||
265 | struct iwl_eeprom_params { | 266 | struct iwl_eeprom_params { |
266 | const u8 regulatory_bands[7]; | 267 | const u8 regulatory_bands[7]; |
@@ -319,6 +320,7 @@ struct iwl_pwr_tx_backoff { | |||
319 | * @mq_rx_supported: multi-queue rx support | 320 | * @mq_rx_supported: multi-queue rx support |
320 | * @vht_mu_mimo_supported: VHT MU-MIMO support | 321 | * @vht_mu_mimo_supported: VHT MU-MIMO support |
321 | * @rf_id: need to read rf_id to determine the firmware image | 322 | * @rf_id: need to read rf_id to determine the firmware image |
323 | * @integrated: discrete or integrated | ||
322 | * | 324 | * |
323 | * We enable the driver to be backward compatible wrt. hardware features. | 325 | * We enable the driver to be backward compatible wrt. hardware features. |
324 | * API differences in uCode shouldn't be handled here but through TLVs | 326 | * API differences in uCode shouldn't be handled here but through TLVs |
@@ -362,7 +364,9 @@ struct iwl_cfg { | |||
362 | apmg_not_supported:1, | 364 | apmg_not_supported:1, |
363 | mq_rx_supported:1, | 365 | mq_rx_supported:1, |
364 | vht_mu_mimo_supported:1, | 366 | vht_mu_mimo_supported:1, |
365 | rf_id:1; | 367 | rf_id:1, |
368 | integrated:1, | ||
369 | use_tfh:1; | ||
366 | u8 valid_tx_ant; | 370 | u8 valid_tx_ant; |
367 | u8 valid_rx_ant; | 371 | u8 valid_rx_ant; |
368 | u8 non_shared_ant; | 372 | u8 non_shared_ant; |
@@ -448,6 +452,7 @@ extern const struct iwl_cfg iwl4165_2ac_sdio_cfg; | |||
448 | extern const struct iwl_cfg iwl9260_2ac_cfg; | 452 | extern const struct iwl_cfg iwl9260_2ac_cfg; |
449 | extern const struct iwl_cfg iwl9260lc_2ac_cfg; | 453 | extern const struct iwl_cfg iwl9260lc_2ac_cfg; |
450 | extern const struct iwl_cfg iwl5165_2ac_cfg; | 454 | extern const struct iwl_cfg iwl5165_2ac_cfg; |
455 | extern const struct iwl_cfg iwla000_2ac_cfg; | ||
451 | #endif /* CONFIG_IWLMVM */ | 456 | #endif /* CONFIG_IWLMVM */ |
452 | 457 | ||
453 | #endif /* __IWL_CONFIG_H__ */ | 458 | #endif /* __IWL_CONFIG_H__ */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h index b52913448c4a..871ad02fdb17 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h | |||
@@ -145,8 +145,10 @@ | |||
145 | 145 | ||
146 | #define CSR_LED_REG (CSR_BASE+0x094) | 146 | #define CSR_LED_REG (CSR_BASE+0x094) |
147 | #define CSR_DRAM_INT_TBL_REG (CSR_BASE+0x0A0) | 147 | #define CSR_DRAM_INT_TBL_REG (CSR_BASE+0x0A0) |
148 | #define CSR_MAC_SHADOW_REG_CTRL (CSR_BASE+0x0A8) /* 6000 and up */ | 148 | #define CSR_MAC_SHADOW_REG_CTRL (CSR_BASE + 0x0A8) /* 6000 and up */ |
149 | 149 | #define CSR_MAC_SHADOW_REG_CTRL_RX_WAKE BIT(20) | |
150 | #define CSR_MAC_SHADOW_REG_CTL2 (CSR_BASE + 0x0AC) | ||
151 | #define CSR_MAC_SHADOW_REG_CTL2_RX_WAKE 0xFFFF | ||
150 | 152 | ||
151 | /* GIO Chicken Bits (PCI Express bus link power management) */ | 153 | /* GIO Chicken Bits (PCI Express bus link power management) */ |
152 | #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) | 154 | #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-debug.h b/drivers/net/wireless/intel/iwlwifi/iwl-debug.h index 110333208450..cd77c6971753 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-debug.h | |||
@@ -41,6 +41,7 @@ static inline bool iwl_have_debug_level(u32 level) | |||
41 | #endif | 41 | #endif |
42 | } | 42 | } |
43 | 43 | ||
44 | struct device; | ||
44 | void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace, | 45 | void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace, |
45 | const char *fmt, ...) __printf(4, 5); | 46 | const char *fmt, ...) __printf(4, 5); |
46 | void __iwl_warn(struct device *dev, const char *fmt, ...) __printf(2, 3); | 47 | void __iwl_warn(struct device *dev, const char *fmt, ...) __printf(2, 3); |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-io.h b/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-io.h index 27914eedc146..1dccae6532cf 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-io.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-io.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. |
4 | * Copyright(c) 2016 Intel Deutschland GmbH | ||
4 | * | 5 | * |
5 | * 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 |
6 | * 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 |
@@ -83,6 +84,23 @@ TRACE_EVENT(iwlwifi_dev_iowrite32, | |||
83 | __get_str(dev), __entry->offs, __entry->val) | 84 | __get_str(dev), __entry->offs, __entry->val) |
84 | ); | 85 | ); |
85 | 86 | ||
87 | TRACE_EVENT(iwlwifi_dev_iowrite64, | ||
88 | TP_PROTO(const struct device *dev, u64 offs, u64 val), | ||
89 | TP_ARGS(dev, offs, val), | ||
90 | TP_STRUCT__entry( | ||
91 | DEV_ENTRY | ||
92 | __field(u64, offs) | ||
93 | __field(u64, val) | ||
94 | ), | ||
95 | TP_fast_assign( | ||
96 | DEV_ASSIGN; | ||
97 | __entry->offs = offs; | ||
98 | __entry->val = val; | ||
99 | ), | ||
100 | TP_printk("[%s] write io[%llu] = %llu)", | ||
101 | __get_str(dev), __entry->offs, __entry->val) | ||
102 | ); | ||
103 | |||
86 | TRACE_EVENT(iwlwifi_dev_iowrite_prph32, | 104 | TRACE_EVENT(iwlwifi_dev_iowrite_prph32, |
87 | TP_PROTO(const struct device *dev, u32 offs, u32 val), | 105 | TP_PROTO(const struct device *dev, u32 offs, u32 val), |
88 | TP_ARGS(dev, offs, val), | 106 | TP_ARGS(dev, offs, val), |
@@ -100,6 +118,23 @@ TRACE_EVENT(iwlwifi_dev_iowrite_prph32, | |||
100 | __get_str(dev), __entry->offs, __entry->val) | 118 | __get_str(dev), __entry->offs, __entry->val) |
101 | ); | 119 | ); |
102 | 120 | ||
121 | TRACE_EVENT(iwlwifi_dev_iowrite_prph64, | ||
122 | TP_PROTO(const struct device *dev, u64 offs, u64 val), | ||
123 | TP_ARGS(dev, offs, val), | ||
124 | TP_STRUCT__entry( | ||
125 | DEV_ENTRY | ||
126 | __field(u64, offs) | ||
127 | __field(u64, val) | ||
128 | ), | ||
129 | TP_fast_assign( | ||
130 | DEV_ASSIGN; | ||
131 | __entry->offs = offs; | ||
132 | __entry->val = val; | ||
133 | ), | ||
134 | TP_printk("[%s] write PRPH[%llu] = %llu)", | ||
135 | __get_str(dev), __entry->offs, __entry->val) | ||
136 | ); | ||
137 | |||
103 | TRACE_EVENT(iwlwifi_dev_ioread_prph32, | 138 | TRACE_EVENT(iwlwifi_dev_ioread_prph32, |
104 | TP_PROTO(const struct device *dev, u32 offs, u32 val), | 139 | TP_PROTO(const struct device *dev, u32 offs, u32 val), |
105 | TP_ARGS(dev, offs, val), | 140 | TP_ARGS(dev, offs, val), |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h index f4d3cd010087..545d14b0bc92 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. |
4 | * Copyright(C) 2016 Intel Deutschland GmbH | ||
4 | * | 5 | * |
5 | * 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 |
6 | * 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 |
@@ -33,11 +34,29 @@ | |||
33 | static inline bool iwl_trace_data(struct sk_buff *skb) | 34 | static inline bool iwl_trace_data(struct sk_buff *skb) |
34 | { | 35 | { |
35 | struct ieee80211_hdr *hdr = (void *)skb->data; | 36 | struct ieee80211_hdr *hdr = (void *)skb->data; |
36 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 37 | __le16 fc = hdr->frame_control; |
38 | int offs = 24; /* start with normal header length */ | ||
37 | 39 | ||
38 | if (!ieee80211_is_data(hdr->frame_control)) | 40 | if (!ieee80211_is_data(fc)) |
39 | return false; | 41 | return false; |
40 | return !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO); | 42 | |
43 | /* Try to determine if the frame is EAPOL. This might have false | ||
44 | * positives (if there's no RFC 1042 header and we compare to some | ||
45 | * payload instead) but since we're only doing tracing that's not | ||
46 | * a problem. | ||
47 | */ | ||
48 | |||
49 | if (ieee80211_has_a4(fc)) | ||
50 | offs += 6; | ||
51 | if (ieee80211_is_data_qos(fc)) | ||
52 | offs += 2; | ||
53 | /* don't account for crypto - these are unencrypted */ | ||
54 | |||
55 | /* also account for the RFC 1042 header, of course */ | ||
56 | offs += 6; | ||
57 | |||
58 | return skb->len > offs + 2 && | ||
59 | *(__be16 *)(skb->data + offs) == cpu_to_be16(ETH_P_PAE); | ||
41 | } | 60 | } |
42 | 61 | ||
43 | static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans, | 62 | static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans, |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index f52ff75f6f80..45b2f679e4d8 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c | |||
@@ -129,8 +129,8 @@ struct iwl_drv { | |||
129 | }; | 129 | }; |
130 | 130 | ||
131 | enum { | 131 | enum { |
132 | DVM_OP_MODE = 0, | 132 | DVM_OP_MODE, |
133 | MVM_OP_MODE = 1, | 133 | MVM_OP_MODE, |
134 | }; | 134 | }; |
135 | 135 | ||
136 | /* Protects the table contents, i.e. the ops pointer & drv list */ | 136 | /* Protects the table contents, i.e. the ops pointer & drv list */ |
@@ -326,8 +326,6 @@ static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len) | |||
326 | int i, j; | 326 | int i, j; |
327 | struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; | 327 | struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; |
328 | struct iwl_fw_cipher_scheme *fwcs; | 328 | struct iwl_fw_cipher_scheme *fwcs; |
329 | struct ieee80211_cipher_scheme *cs; | ||
330 | u32 cipher; | ||
331 | 329 | ||
332 | if (len < sizeof(*l) || | 330 | if (len < sizeof(*l) || |
333 | len < sizeof(l->size) + l->size * sizeof(l->cs[0])) | 331 | len < sizeof(l->size) + l->size * sizeof(l->cs[0])) |
@@ -335,22 +333,12 @@ static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len) | |||
335 | 333 | ||
336 | for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i++) { | 334 | for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i++) { |
337 | fwcs = &l->cs[j]; | 335 | fwcs = &l->cs[j]; |
338 | cipher = le32_to_cpu(fwcs->cipher); | ||
339 | 336 | ||
340 | /* we skip schemes with zero cipher suite selector */ | 337 | /* we skip schemes with zero cipher suite selector */ |
341 | if (!cipher) | 338 | if (!fwcs->cipher) |
342 | continue; | 339 | continue; |
343 | 340 | ||
344 | cs = &fw->cs[j++]; | 341 | fw->cs[j++] = *fwcs; |
345 | cs->cipher = cipher; | ||
346 | cs->iftype = BIT(NL80211_IFTYPE_STATION); | ||
347 | cs->hdr_len = fwcs->hdr_len; | ||
348 | cs->pn_len = fwcs->pn_len; | ||
349 | cs->pn_off = fwcs->pn_off; | ||
350 | cs->key_idx_off = fwcs->key_idx_off; | ||
351 | cs->key_idx_mask = fwcs->key_idx_mask; | ||
352 | cs->key_idx_shift = fwcs->key_idx_shift; | ||
353 | cs->mic_len = fwcs->mic_len; | ||
354 | } | 342 | } |
355 | 343 | ||
356 | return 0; | 344 | return 0; |
@@ -795,17 +783,17 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, | |||
795 | case IWL_UCODE_TLV_SEC_RT: | 783 | case IWL_UCODE_TLV_SEC_RT: |
796 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, | 784 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, |
797 | tlv_len); | 785 | tlv_len); |
798 | drv->fw.mvm_fw = true; | 786 | drv->fw.type = IWL_FW_MVM; |
799 | break; | 787 | break; |
800 | case IWL_UCODE_TLV_SEC_INIT: | 788 | case IWL_UCODE_TLV_SEC_INIT: |
801 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, | 789 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, |
802 | tlv_len); | 790 | tlv_len); |
803 | drv->fw.mvm_fw = true; | 791 | drv->fw.type = IWL_FW_MVM; |
804 | break; | 792 | break; |
805 | case IWL_UCODE_TLV_SEC_WOWLAN: | 793 | case IWL_UCODE_TLV_SEC_WOWLAN: |
806 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, | 794 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, |
807 | tlv_len); | 795 | tlv_len); |
808 | drv->fw.mvm_fw = true; | 796 | drv->fw.type = IWL_FW_MVM; |
809 | break; | 797 | break; |
810 | case IWL_UCODE_TLV_DEF_CALIB: | 798 | case IWL_UCODE_TLV_DEF_CALIB: |
811 | if (tlv_len != sizeof(struct iwl_tlv_calib_data)) | 799 | if (tlv_len != sizeof(struct iwl_tlv_calib_data)) |
@@ -827,17 +815,17 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, | |||
827 | case IWL_UCODE_TLV_SECURE_SEC_RT: | 815 | case IWL_UCODE_TLV_SECURE_SEC_RT: |
828 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, | 816 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, |
829 | tlv_len); | 817 | tlv_len); |
830 | drv->fw.mvm_fw = true; | 818 | drv->fw.type = IWL_FW_MVM; |
831 | break; | 819 | break; |
832 | case IWL_UCODE_TLV_SECURE_SEC_INIT: | 820 | case IWL_UCODE_TLV_SECURE_SEC_INIT: |
833 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, | 821 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, |
834 | tlv_len); | 822 | tlv_len); |
835 | drv->fw.mvm_fw = true; | 823 | drv->fw.type = IWL_FW_MVM; |
836 | break; | 824 | break; |
837 | case IWL_UCODE_TLV_SECURE_SEC_WOWLAN: | 825 | case IWL_UCODE_TLV_SECURE_SEC_WOWLAN: |
838 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, | 826 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, |
839 | tlv_len); | 827 | tlv_len); |
840 | drv->fw.mvm_fw = true; | 828 | drv->fw.type = IWL_FW_MVM; |
841 | break; | 829 | break; |
842 | case IWL_UCODE_TLV_NUM_OF_CPU: | 830 | case IWL_UCODE_TLV_NUM_OF_CPU: |
843 | if (tlv_len != sizeof(u32)) | 831 | if (tlv_len != sizeof(u32)) |
@@ -1275,7 +1263,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | |||
1275 | * In mvm uCode there is no difference between data and instructions | 1263 | * In mvm uCode there is no difference between data and instructions |
1276 | * sections. | 1264 | * sections. |
1277 | */ | 1265 | */ |
1278 | if (!fw->mvm_fw && validate_sec_sizes(drv, pieces, drv->cfg)) | 1266 | if (fw->type == IWL_FW_DVM && validate_sec_sizes(drv, pieces, drv->cfg)) |
1279 | goto try_again; | 1267 | goto try_again; |
1280 | 1268 | ||
1281 | /* Allocate ucode buffers for card's bus-master loading ... */ | 1269 | /* Allocate ucode buffers for card's bus-master loading ... */ |
@@ -1403,10 +1391,16 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | |||
1403 | release_firmware(ucode_raw); | 1391 | release_firmware(ucode_raw); |
1404 | 1392 | ||
1405 | mutex_lock(&iwlwifi_opmode_table_mtx); | 1393 | mutex_lock(&iwlwifi_opmode_table_mtx); |
1406 | if (fw->mvm_fw) | 1394 | switch (fw->type) { |
1407 | op = &iwlwifi_opmode_table[MVM_OP_MODE]; | 1395 | case IWL_FW_DVM: |
1408 | else | ||
1409 | op = &iwlwifi_opmode_table[DVM_OP_MODE]; | 1396 | op = &iwlwifi_opmode_table[DVM_OP_MODE]; |
1397 | break; | ||
1398 | default: | ||
1399 | WARN(1, "Invalid fw type %d\n", fw->type); | ||
1400 | case IWL_FW_MVM: | ||
1401 | op = &iwlwifi_opmode_table[MVM_OP_MODE]; | ||
1402 | break; | ||
1403 | } | ||
1410 | 1404 | ||
1411 | IWL_INFO(drv, "loaded firmware version %s op_mode %s\n", | 1405 | IWL_INFO(drv, "loaded firmware version %s op_mode %s\n", |
1412 | drv->fw.fw_version, op->name); | 1406 | drv->fw.fw_version, op->name); |
@@ -1658,7 +1652,8 @@ MODULE_PARM_DESC(11n_disable, | |||
1658 | "disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX"); | 1652 | "disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX"); |
1659 | module_param_named(amsdu_size, iwlwifi_mod_params.amsdu_size, | 1653 | module_param_named(amsdu_size, iwlwifi_mod_params.amsdu_size, |
1660 | int, S_IRUGO); | 1654 | int, S_IRUGO); |
1661 | MODULE_PARM_DESC(amsdu_size, "amsdu size 0:4K 1:8K 2:12K (default 0)"); | 1655 | MODULE_PARM_DESC(amsdu_size, |
1656 | "amsdu size 0: 12K for multi Rx queue devices, 4K for other devices 1:4K 2:8K 3:12K (default 0)"); | ||
1662 | module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, bool, S_IRUGO); | 1657 | module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, bool, S_IRUGO); |
1663 | MODULE_PARM_DESC(fw_restart, "restart firmware in case of error (default true)"); | 1658 | MODULE_PARM_DESC(fw_restart, "restart firmware in case of error (default true)"); |
1664 | 1659 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c index bf1b69aec813..3199d345b427 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c | |||
@@ -766,7 +766,9 @@ void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg, | |||
766 | if (cfg->ht_params->ldpc) | 766 | if (cfg->ht_params->ldpc) |
767 | ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; | 767 | ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; |
768 | 768 | ||
769 | if (iwlwifi_mod_params.amsdu_size >= IWL_AMSDU_8K) | 769 | if ((cfg->mq_rx_supported && |
770 | iwlwifi_mod_params.amsdu_size != IWL_AMSDU_4K) || | ||
771 | iwlwifi_mod_params.amsdu_size >= IWL_AMSDU_8K) | ||
770 | ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; | 772 | ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; |
771 | 773 | ||
772 | ht_info->ampdu_factor = cfg->max_ht_ampdu_exponent; | 774 | ht_info->ampdu_factor = cfg->max_ht_ampdu_exponent; |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.h b/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.h index 1f4e50289c14..e04a91d70a15 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.h | |||
@@ -66,6 +66,7 @@ | |||
66 | 66 | ||
67 | #include <linux/types.h> | 67 | #include <linux/types.h> |
68 | #include <linux/if_ether.h> | 68 | #include <linux/if_ether.h> |
69 | #include <net/cfg80211.h> | ||
69 | #include "iwl-trans.h" | 70 | #include "iwl-trans.h" |
70 | 71 | ||
71 | struct iwl_nvm_data { | 72 | struct iwl_nvm_data { |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fh.h b/drivers/net/wireless/intel/iwlwifi/iwl-fh.h index 270f39ecd2d4..1d6f5d21a663 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-fh.h | |||
@@ -77,6 +77,7 @@ | |||
77 | */ | 77 | */ |
78 | #define FH_MEM_LOWER_BOUND (0x1000) | 78 | #define FH_MEM_LOWER_BOUND (0x1000) |
79 | #define FH_MEM_UPPER_BOUND (0x2000) | 79 | #define FH_MEM_UPPER_BOUND (0x2000) |
80 | #define TFH_MEM_LOWER_BOUND (0xA06000) | ||
80 | 81 | ||
81 | /** | 82 | /** |
82 | * Keep-Warm (KW) buffer base address. | 83 | * Keep-Warm (KW) buffer base address. |
@@ -118,10 +119,17 @@ | |||
118 | #define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) | 119 | #define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) |
119 | #define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) | 120 | #define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) |
120 | #define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) | 121 | #define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) |
122 | /* a000 TFD table address, 64 bit */ | ||
123 | #define TFH_TFDQ_CBB_TABLE (TFH_MEM_LOWER_BOUND + 0x1C00) | ||
121 | 124 | ||
122 | /* Find TFD CB base pointer for given queue */ | 125 | /* Find TFD CB base pointer for given queue */ |
123 | static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | 126 | static inline unsigned int FH_MEM_CBBC_QUEUE(struct iwl_trans *trans, |
127 | unsigned int chnl) | ||
124 | { | 128 | { |
129 | if (trans->cfg->use_tfh) { | ||
130 | WARN_ON_ONCE(chnl >= 64); | ||
131 | return TFH_TFDQ_CBB_TABLE + 8 * chnl; | ||
132 | } | ||
125 | if (chnl < 16) | 133 | if (chnl < 16) |
126 | return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; | 134 | return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; |
127 | if (chnl < 20) | 135 | if (chnl < 20) |
@@ -130,6 +138,65 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | |||
130 | return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); | 138 | return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); |
131 | } | 139 | } |
132 | 140 | ||
141 | /* a000 configuration registers */ | ||
142 | |||
143 | /* | ||
144 | * TFH Configuration register. | ||
145 | * | ||
146 | * BIT fields: | ||
147 | * | ||
148 | * Bits 3:0: | ||
149 | * Define the maximum number of pending read requests. | ||
150 | * Maximum configration value allowed is 0xC | ||
151 | * Bits 9:8: | ||
152 | * Define the maximum transfer size. (64 / 128 / 256) | ||
153 | * Bit 10: | ||
154 | * When bit is set and transfer size is set to 128B, the TFH will enable | ||
155 | * reading chunks of more than 64B only if the read address is aligned to 128B. | ||
156 | * In case of DRAM read address which is not aligned to 128B, the TFH will | ||
157 | * enable transfer size which doesn't cross 64B DRAM address boundary. | ||
158 | */ | ||
159 | #define TFH_TRANSFER_MODE (TFH_MEM_LOWER_BOUND + 0x1F40) | ||
160 | #define TFH_TRANSFER_MAX_PENDING_REQ 0xc | ||
161 | #define TFH_CHUNK_SIZE_128 BIT(8) | ||
162 | #define TFH_CHUNK_SPLIT_MODE BIT(10) | ||
163 | /* | ||
164 | * Defines the offset address in dwords referring from the beginning of the | ||
165 | * Tx CMD which will be updated in DRAM. | ||
166 | * Note that the TFH offset address for Tx CMD update is always referring to | ||
167 | * the start of the TFD first TB. | ||
168 | * In case of a DRAM Tx CMD update the TFH will update PN and Key ID | ||
169 | */ | ||
170 | #define TFH_TXCMD_UPDATE_CFG (TFH_MEM_LOWER_BOUND + 0x1F48) | ||
171 | /* | ||
172 | * Controls TX DMA operation | ||
173 | * | ||
174 | * BIT fields: | ||
175 | * | ||
176 | * Bits 31:30: Enable the SRAM DMA channel. | ||
177 | * Turning on bit 31 will kick the SRAM2DRAM DMA. | ||
178 | * Note that the sram2dram may be enabled only after configuring the DRAM and | ||
179 | * SRAM addresses registers and the byte count register. | ||
180 | * Bits 25:24: Defines the interrupt target upon dram2sram transfer done. When | ||
181 | * set to 1 - interrupt is sent to the driver | ||
182 | * Bit 0: Indicates the snoop configuration | ||
183 | */ | ||
184 | #define TFH_SRV_DMA_CHNL0_CTRL (TFH_MEM_LOWER_BOUND + 0x1F60) | ||
185 | #define TFH_SRV_DMA_SNOOP BIT(0) | ||
186 | #define TFH_SRV_DMA_TO_DRIVER BIT(24) | ||
187 | #define TFH_SRV_DMA_START BIT(31) | ||
188 | |||
189 | /* Defines the DMA SRAM write start address to transfer a data block */ | ||
190 | #define TFH_SRV_DMA_CHNL0_SRAM_ADDR (TFH_MEM_LOWER_BOUND + 0x1F64) | ||
191 | |||
192 | /* Defines the 64bits DRAM start address to read the DMA data block from */ | ||
193 | #define TFH_SRV_DMA_CHNL0_DRAM_ADDR (TFH_MEM_LOWER_BOUND + 0x1F68) | ||
194 | |||
195 | /* | ||
196 | * Defines the number of bytes to transfer from DRAM to SRAM. | ||
197 | * Note that this register may be configured with non-dword aligned size. | ||
198 | */ | ||
199 | #define TFH_SRV_DMA_CHNL0_BC (TFH_MEM_LOWER_BOUND + 0x1F70) | ||
133 | 200 | ||
134 | /** | 201 | /** |
135 | * Rx SRAM Control and Status Registers (RSCSR) | 202 | * Rx SRAM Control and Status Registers (RSCSR) |
@@ -344,6 +411,32 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | |||
344 | #define RFH_RBDBUF_RBD0_LSB 0xA08300 | 411 | #define RFH_RBDBUF_RBD0_LSB 0xA08300 |
345 | #define RFH_RBDBUF_RBD_LSB(q) (RFH_RBDBUF_RBD0_LSB + (q) * 8) | 412 | #define RFH_RBDBUF_RBD_LSB(q) (RFH_RBDBUF_RBD0_LSB + (q) * 8) |
346 | 413 | ||
414 | /** | ||
415 | * RFH Status Register | ||
416 | * | ||
417 | * Bit fields: | ||
418 | * | ||
419 | * Bit 29: RBD_FETCH_IDLE | ||
420 | * This status flag is set by the RFH when there is no active RBD fetch from | ||
421 | * DRAM. | ||
422 | * Once the RFH RBD controller starts fetching (or when there is a pending | ||
423 | * RBD read response from DRAM), this flag is immediately turned off. | ||
424 | * | ||
425 | * Bit 30: SRAM_DMA_IDLE | ||
426 | * This status flag is set by the RFH when there is no active transaction from | ||
427 | * SRAM to DRAM. | ||
428 | * Once the SRAM to DRAM DMA is active, this flag is immediately turned off. | ||
429 | * | ||
430 | * Bit 31: RXF_DMA_IDLE | ||
431 | * This status flag is set by the RFH when there is no active transaction from | ||
432 | * RXF to DRAM. | ||
433 | * Once the RXF-to-DRAM DMA is active, this flag is immediately turned off. | ||
434 | */ | ||
435 | #define RFH_GEN_STATUS 0xA09808 | ||
436 | #define RBD_FETCH_IDLE BIT(29) | ||
437 | #define SRAM_DMA_IDLE BIT(30) | ||
438 | #define RXF_DMA_IDLE BIT(31) | ||
439 | |||
347 | /* DMA configuration */ | 440 | /* DMA configuration */ |
348 | #define RFH_RXF_DMA_CFG 0xA09820 | 441 | #define RFH_RXF_DMA_CFG 0xA09820 |
349 | /* RB size */ | 442 | /* RB size */ |
@@ -384,7 +477,9 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | |||
384 | #define RFH_GEN_CFG 0xA09800 | 477 | #define RFH_GEN_CFG 0xA09800 |
385 | #define RFH_GEN_CFG_SERVICE_DMA_SNOOP BIT(0) | 478 | #define RFH_GEN_CFG_SERVICE_DMA_SNOOP BIT(0) |
386 | #define RFH_GEN_CFG_RFH_DMA_SNOOP BIT(1) | 479 | #define RFH_GEN_CFG_RFH_DMA_SNOOP BIT(1) |
387 | #define RFH_GEN_CFG_RB_CHUNK_SIZE BIT(4) /* 0 - 64B, 1- 128B */ | 480 | #define RFH_GEN_CFG_RB_CHUNK_SIZE_POS 4 |
481 | #define RFH_GEN_CFG_RB_CHUNK_SIZE_128 1 | ||
482 | #define RFH_GEN_CFG_RB_CHUNK_SIZE_64 0 | ||
388 | #define RFH_GEN_CFG_DEFAULT_RXQ_NUM_MASK 0xF00 | 483 | #define RFH_GEN_CFG_DEFAULT_RXQ_NUM_MASK 0xF00 |
389 | #define RFH_GEN_CFG_DEFAULT_RXQ_NUM_POS 8 | 484 | #define RFH_GEN_CFG_DEFAULT_RXQ_NUM_POS 8 |
390 | 485 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h index 09b7ea28f4a0..420c31dab263 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h | |||
@@ -89,6 +89,9 @@ | |||
89 | * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were | 89 | * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were |
90 | * paged to the DRAM. | 90 | * paged to the DRAM. |
91 | * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers. | 91 | * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers. |
92 | * @IWL_FW_ERROR_DUMP_EXTERNAL: used only by external code utilities, and | ||
93 | * for that reason is not in use in any other place in the Linux Wi-Fi | ||
94 | * stack. | ||
92 | */ | 95 | */ |
93 | enum iwl_fw_error_dump_type { | 96 | enum iwl_fw_error_dump_type { |
94 | /* 0 is deprecated */ | 97 | /* 0 is deprecated */ |
@@ -106,6 +109,7 @@ enum iwl_fw_error_dump_type { | |||
106 | IWL_FW_ERROR_DUMP_PAGING = 12, | 109 | IWL_FW_ERROR_DUMP_PAGING = 12, |
107 | IWL_FW_ERROR_DUMP_RADIO_REG = 13, | 110 | IWL_FW_ERROR_DUMP_RADIO_REG = 13, |
108 | IWL_FW_ERROR_DUMP_INTERNAL_TXF = 14, | 111 | IWL_FW_ERROR_DUMP_INTERNAL_TXF = 14, |
112 | IWL_FW_ERROR_DUMP_EXTERNAL = 15, /* Do not move */ | ||
109 | 113 | ||
110 | IWL_FW_ERROR_DUMP_MAX, | 114 | IWL_FW_ERROR_DUMP_MAX, |
111 | }; | 115 | }; |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h index 37dc09e8b6a7..1b1e045f8907 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h | |||
@@ -301,7 +301,8 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t; | |||
301 | * @IWL_UCODE_TLV_CAPA_DC2DC_SUPPORT: supports DC2DC Command | 301 | * @IWL_UCODE_TLV_CAPA_DC2DC_SUPPORT: supports DC2DC Command |
302 | * @IWL_UCODE_TLV_CAPA_CSUM_SUPPORT: supports TCP Checksum Offload | 302 | * @IWL_UCODE_TLV_CAPA_CSUM_SUPPORT: supports TCP Checksum Offload |
303 | * @IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS: support radio and beacon statistics | 303 | * @IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS: support radio and beacon statistics |
304 | * @IWL_UCODE_TLV_CAPA_P2P_STANDALONE_UAPSD: support p2p standalone U-APSD | 304 | * @IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD: supports U-APSD on p2p interface when it |
305 | * is standalone or with a BSS station interface in the same binding. | ||
305 | * @IWL_UCODE_TLV_CAPA_BT_COEX_PLCR: enabled BT Coex packet level co-running | 306 | * @IWL_UCODE_TLV_CAPA_BT_COEX_PLCR: enabled BT Coex packet level co-running |
306 | * @IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC: ucode supports LAR updates with different | 307 | * @IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC: ucode supports LAR updates with different |
307 | * sources for the MCC. This TLV bit is a future replacement to | 308 | * sources for the MCC. This TLV bit is a future replacement to |
@@ -312,6 +313,9 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t; | |||
312 | * @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement | 313 | * @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement |
313 | * @IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS: supports short PM timeouts | 314 | * @IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS: supports short PM timeouts |
314 | * @IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT: supports bt-coex Multi-priority LUT | 315 | * @IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT: supports bt-coex Multi-priority LUT |
316 | * @IWL_UCODE_TLV_CAPA_CSA_AND_TBTT_OFFLOAD: the firmware supports CSA | ||
317 | * countdown offloading. Beacon notifications are not sent to the host. | ||
318 | * The fw also offloads TBTT alignment. | ||
315 | * @IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION: firmware will decide on what | 319 | * @IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION: firmware will decide on what |
316 | * antenna the beacon should be transmitted | 320 | * antenna the beacon should be transmitted |
317 | * @IWL_UCODE_TLV_CAPA_BEACON_STORING: firmware will store the latest beacon | 321 | * @IWL_UCODE_TLV_CAPA_BEACON_STORING: firmware will store the latest beacon |
@@ -326,6 +330,9 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t; | |||
326 | * @IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG: support getting more shared | 330 | * @IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG: support getting more shared |
327 | * memory addresses from the firmware. | 331 | * memory addresses from the firmware. |
328 | * @IWL_UCODE_TLV_CAPA_LQM_SUPPORT: supports Link Quality Measurement | 332 | * @IWL_UCODE_TLV_CAPA_LQM_SUPPORT: supports Link Quality Measurement |
333 | * @IWL_UCODE_TLV_CAPA_TX_POWER_ACK: reduced TX power API has larger | ||
334 | * command size (command version 4) that supports toggling ACK TX | ||
335 | * power reduction. | ||
329 | * | 336 | * |
330 | * @NUM_IWL_UCODE_TLV_CAPA: number of bits used | 337 | * @NUM_IWL_UCODE_TLV_CAPA: number of bits used |
331 | */ | 338 | */ |
@@ -347,7 +354,7 @@ enum iwl_ucode_tlv_capa { | |||
347 | IWL_UCODE_TLV_CAPA_DC2DC_CONFIG_SUPPORT = (__force iwl_ucode_tlv_capa_t)19, | 354 | IWL_UCODE_TLV_CAPA_DC2DC_CONFIG_SUPPORT = (__force iwl_ucode_tlv_capa_t)19, |
348 | IWL_UCODE_TLV_CAPA_CSUM_SUPPORT = (__force iwl_ucode_tlv_capa_t)21, | 355 | IWL_UCODE_TLV_CAPA_CSUM_SUPPORT = (__force iwl_ucode_tlv_capa_t)21, |
349 | IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS = (__force iwl_ucode_tlv_capa_t)22, | 356 | IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS = (__force iwl_ucode_tlv_capa_t)22, |
350 | IWL_UCODE_TLV_CAPA_P2P_STANDALONE_UAPSD = (__force iwl_ucode_tlv_capa_t)26, | 357 | IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD = (__force iwl_ucode_tlv_capa_t)26, |
351 | IWL_UCODE_TLV_CAPA_BT_COEX_PLCR = (__force iwl_ucode_tlv_capa_t)28, | 358 | IWL_UCODE_TLV_CAPA_BT_COEX_PLCR = (__force iwl_ucode_tlv_capa_t)28, |
352 | IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC = (__force iwl_ucode_tlv_capa_t)29, | 359 | IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC = (__force iwl_ucode_tlv_capa_t)29, |
353 | IWL_UCODE_TLV_CAPA_BT_COEX_RRC = (__force iwl_ucode_tlv_capa_t)30, | 360 | IWL_UCODE_TLV_CAPA_BT_COEX_RRC = (__force iwl_ucode_tlv_capa_t)30, |
@@ -356,6 +363,7 @@ enum iwl_ucode_tlv_capa { | |||
356 | IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS = (__force iwl_ucode_tlv_capa_t)65, | 363 | IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS = (__force iwl_ucode_tlv_capa_t)65, |
357 | IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT = (__force iwl_ucode_tlv_capa_t)67, | 364 | IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT = (__force iwl_ucode_tlv_capa_t)67, |
358 | IWL_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT = (__force iwl_ucode_tlv_capa_t)68, | 365 | IWL_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT = (__force iwl_ucode_tlv_capa_t)68, |
366 | IWL_UCODE_TLV_CAPA_CSA_AND_TBTT_OFFLOAD = (__force iwl_ucode_tlv_capa_t)70, | ||
359 | IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION = (__force iwl_ucode_tlv_capa_t)71, | 367 | IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION = (__force iwl_ucode_tlv_capa_t)71, |
360 | IWL_UCODE_TLV_CAPA_BEACON_STORING = (__force iwl_ucode_tlv_capa_t)72, | 368 | IWL_UCODE_TLV_CAPA_BEACON_STORING = (__force iwl_ucode_tlv_capa_t)72, |
361 | IWL_UCODE_TLV_CAPA_LAR_SUPPORT_V2 = (__force iwl_ucode_tlv_capa_t)73, | 369 | IWL_UCODE_TLV_CAPA_LAR_SUPPORT_V2 = (__force iwl_ucode_tlv_capa_t)73, |
@@ -365,6 +373,7 @@ enum iwl_ucode_tlv_capa { | |||
365 | IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED = (__force iwl_ucode_tlv_capa_t)77, | 373 | IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED = (__force iwl_ucode_tlv_capa_t)77, |
366 | IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG = (__force iwl_ucode_tlv_capa_t)80, | 374 | IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG = (__force iwl_ucode_tlv_capa_t)80, |
367 | IWL_UCODE_TLV_CAPA_LQM_SUPPORT = (__force iwl_ucode_tlv_capa_t)81, | 375 | IWL_UCODE_TLV_CAPA_LQM_SUPPORT = (__force iwl_ucode_tlv_capa_t)81, |
376 | IWL_UCODE_TLV_CAPA_TX_POWER_ACK = (__force iwl_ucode_tlv_capa_t)84, | ||
368 | 377 | ||
369 | NUM_IWL_UCODE_TLV_CAPA | 378 | NUM_IWL_UCODE_TLV_CAPA |
370 | #ifdef __CHECKER__ | 379 | #ifdef __CHECKER__ |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw.h index e461d631893a..74ea68d1063c 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw.h | |||
@@ -67,7 +67,6 @@ | |||
67 | #ifndef __iwl_fw_h__ | 67 | #ifndef __iwl_fw_h__ |
68 | #define __iwl_fw_h__ | 68 | #define __iwl_fw_h__ |
69 | #include <linux/types.h> | 69 | #include <linux/types.h> |
70 | #include <net/mac80211.h> | ||
71 | 70 | ||
72 | #include "iwl-fw-file.h" | 71 | #include "iwl-fw-file.h" |
73 | #include "iwl-fw-error-dump.h" | 72 | #include "iwl-fw-error-dump.h" |
@@ -231,6 +230,16 @@ struct iwl_gscan_capabilities { | |||
231 | }; | 230 | }; |
232 | 231 | ||
233 | /** | 232 | /** |
233 | * enum iwl_fw_type - iwlwifi firmware type | ||
234 | * @IWL_FW_DVM: DVM firmware | ||
235 | * @IWL_FW_MVM: MVM firmware | ||
236 | */ | ||
237 | enum iwl_fw_type { | ||
238 | IWL_FW_DVM, | ||
239 | IWL_FW_MVM, | ||
240 | }; | ||
241 | |||
242 | /** | ||
234 | * struct iwl_fw - variables associated with the firmware | 243 | * struct iwl_fw - variables associated with the firmware |
235 | * | 244 | * |
236 | * @ucode_ver: ucode version from the ucode file | 245 | * @ucode_ver: ucode version from the ucode file |
@@ -244,7 +253,7 @@ struct iwl_gscan_capabilities { | |||
244 | * @inst_evtlog_ptr: event log offset for runtime ucode. | 253 | * @inst_evtlog_ptr: event log offset for runtime ucode. |
245 | * @inst_evtlog_size: event log size for runtime ucode. | 254 | * @inst_evtlog_size: event log size for runtime ucode. |
246 | * @inst_errlog_ptr: error log offfset for runtime ucode. | 255 | * @inst_errlog_ptr: error log offfset for runtime ucode. |
247 | * @mvm_fw: indicates this is MVM firmware | 256 | * @type: firmware type (&enum iwl_fw_type) |
248 | * @cipher_scheme: optional external cipher scheme. | 257 | * @cipher_scheme: optional external cipher scheme. |
249 | * @human_readable: human readable version | 258 | * @human_readable: human readable version |
250 | * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until | 259 | * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until |
@@ -275,9 +284,9 @@ struct iwl_fw { | |||
275 | u8 valid_tx_ant; | 284 | u8 valid_tx_ant; |
276 | u8 valid_rx_ant; | 285 | u8 valid_rx_ant; |
277 | 286 | ||
278 | bool mvm_fw; | 287 | enum iwl_fw_type type; |
279 | 288 | ||
280 | struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS]; | 289 | struct iwl_fw_cipher_scheme cs[IWL_UCODE_MAX_CS]; |
281 | u8 human_readable[FW_VER_HUMAN_READABLE_SZ]; | 290 | u8 human_readable[FW_VER_HUMAN_READABLE_SZ]; |
282 | 291 | ||
283 | u32 sdio_adma_addr; | 292 | u32 sdio_adma_addr; |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.c b/drivers/net/wireless/intel/iwlwifi/iwl-io.c index 32c8f84ae519..92c8b5f9a9cb 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. |
4 | * Copyright(c) 2015 Intel Deutschland GmbH | 4 | * Copyright(c) 2015 - 2016 Intel Deutschland GmbH |
5 | * | 5 | * |
6 | * Portions of this file are derived from the ipw3945 project. | 6 | * Portions of this file are derived from the ipw3945 project. |
7 | * | 7 | * |
@@ -51,6 +51,14 @@ void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val) | |||
51 | } | 51 | } |
52 | IWL_EXPORT_SYMBOL(iwl_write32); | 52 | IWL_EXPORT_SYMBOL(iwl_write32); |
53 | 53 | ||
54 | void iwl_write64(struct iwl_trans *trans, u64 ofs, u64 val) | ||
55 | { | ||
56 | trace_iwlwifi_dev_iowrite64(trans->dev, ofs, val); | ||
57 | iwl_trans_write32(trans, ofs, val & 0xffffffff); | ||
58 | iwl_trans_write32(trans, ofs + 4, val >> 32); | ||
59 | } | ||
60 | IWL_EXPORT_SYMBOL(iwl_write64); | ||
61 | |||
54 | u32 iwl_read32(struct iwl_trans *trans, u32 ofs) | 62 | u32 iwl_read32(struct iwl_trans *trans, u32 ofs) |
55 | { | 63 | { |
56 | u32 val = iwl_trans_read32(trans, ofs); | 64 | u32 val = iwl_trans_read32(trans, ofs); |
@@ -102,6 +110,17 @@ void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value) | |||
102 | } | 110 | } |
103 | IWL_EXPORT_SYMBOL(iwl_write_direct32); | 111 | IWL_EXPORT_SYMBOL(iwl_write_direct32); |
104 | 112 | ||
113 | void iwl_write_direct64(struct iwl_trans *trans, u64 reg, u64 value) | ||
114 | { | ||
115 | unsigned long flags; | ||
116 | |||
117 | if (iwl_trans_grab_nic_access(trans, &flags)) { | ||
118 | iwl_write64(trans, reg, value); | ||
119 | iwl_trans_release_nic_access(trans, &flags); | ||
120 | } | ||
121 | } | ||
122 | IWL_EXPORT_SYMBOL(iwl_write_direct64); | ||
123 | |||
105 | int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, | 124 | int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, |
106 | int timeout) | 125 | int timeout) |
107 | { | 126 | { |
@@ -133,6 +152,14 @@ void iwl_write_prph_no_grab(struct iwl_trans *trans, u32 ofs, u32 val) | |||
133 | } | 152 | } |
134 | IWL_EXPORT_SYMBOL(iwl_write_prph_no_grab); | 153 | IWL_EXPORT_SYMBOL(iwl_write_prph_no_grab); |
135 | 154 | ||
155 | void iwl_write_prph64_no_grab(struct iwl_trans *trans, u64 ofs, u64 val) | ||
156 | { | ||
157 | trace_iwlwifi_dev_iowrite_prph64(trans->dev, ofs, val); | ||
158 | iwl_write_prph_no_grab(trans, ofs, val & 0xffffffff); | ||
159 | iwl_write_prph_no_grab(trans, ofs + 4, val >> 32); | ||
160 | } | ||
161 | IWL_EXPORT_SYMBOL(iwl_write_prph64_no_grab); | ||
162 | |||
136 | u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs) | 163 | u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs) |
137 | { | 164 | { |
138 | unsigned long flags; | 165 | unsigned long flags; |
@@ -228,9 +255,117 @@ void iwl_force_nmi(struct iwl_trans *trans) | |||
228 | } | 255 | } |
229 | IWL_EXPORT_SYMBOL(iwl_force_nmi); | 256 | IWL_EXPORT_SYMBOL(iwl_force_nmi); |
230 | 257 | ||
231 | static const char *get_fh_string(int cmd) | 258 | static const char *get_rfh_string(int cmd) |
232 | { | 259 | { |
233 | #define IWL_CMD(x) case x: return #x | 260 | #define IWL_CMD(x) case x: return #x |
261 | #define IWL_CMD_MQ(arg, reg, q) { if (arg == reg(q)) return #reg; } | ||
262 | |||
263 | int i; | ||
264 | |||
265 | for (i = 0; i < IWL_MAX_RX_HW_QUEUES; i++) { | ||
266 | IWL_CMD_MQ(cmd, RFH_Q_FRBDCB_BA_LSB, i); | ||
267 | IWL_CMD_MQ(cmd, RFH_Q_FRBDCB_WIDX, i); | ||
268 | IWL_CMD_MQ(cmd, RFH_Q_FRBDCB_RIDX, i); | ||
269 | IWL_CMD_MQ(cmd, RFH_Q_URBD_STTS_WPTR_LSB, i); | ||
270 | }; | ||
271 | |||
272 | switch (cmd) { | ||
273 | IWL_CMD(RFH_RXF_DMA_CFG); | ||
274 | IWL_CMD(RFH_GEN_CFG); | ||
275 | IWL_CMD(RFH_GEN_STATUS); | ||
276 | IWL_CMD(FH_TSSR_TX_STATUS_REG); | ||
277 | IWL_CMD(FH_TSSR_TX_ERROR_REG); | ||
278 | default: | ||
279 | return "UNKNOWN"; | ||
280 | } | ||
281 | #undef IWL_CMD_MQ | ||
282 | } | ||
283 | |||
284 | struct reg { | ||
285 | u32 addr; | ||
286 | bool is64; | ||
287 | }; | ||
288 | |||
289 | static int iwl_dump_rfh(struct iwl_trans *trans, char **buf) | ||
290 | { | ||
291 | int i, q; | ||
292 | int num_q = trans->num_rx_queues; | ||
293 | static const u32 rfh_tbl[] = { | ||
294 | RFH_RXF_DMA_CFG, | ||
295 | RFH_GEN_CFG, | ||
296 | RFH_GEN_STATUS, | ||
297 | FH_TSSR_TX_STATUS_REG, | ||
298 | FH_TSSR_TX_ERROR_REG, | ||
299 | }; | ||
300 | static const struct reg rfh_mq_tbl[] = { | ||
301 | { RFH_Q0_FRBDCB_BA_LSB, true }, | ||
302 | { RFH_Q0_FRBDCB_WIDX, false }, | ||
303 | { RFH_Q0_FRBDCB_RIDX, false }, | ||
304 | { RFH_Q0_URBD_STTS_WPTR_LSB, true }, | ||
305 | }; | ||
306 | |||
307 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
308 | if (buf) { | ||
309 | int pos = 0; | ||
310 | /* | ||
311 | * Register (up to 34 for name + 8 blank/q for MQ): 40 chars | ||
312 | * Colon + space: 2 characters | ||
313 | * 0X%08x: 10 characters | ||
314 | * New line: 1 character | ||
315 | * Total of 53 characters | ||
316 | */ | ||
317 | size_t bufsz = ARRAY_SIZE(rfh_tbl) * 53 + | ||
318 | ARRAY_SIZE(rfh_mq_tbl) * 53 * num_q + 40; | ||
319 | |||
320 | *buf = kmalloc(bufsz, GFP_KERNEL); | ||
321 | if (!*buf) | ||
322 | return -ENOMEM; | ||
323 | |||
324 | pos += scnprintf(*buf + pos, bufsz - pos, | ||
325 | "RFH register values:\n"); | ||
326 | |||
327 | for (i = 0; i < ARRAY_SIZE(rfh_tbl); i++) | ||
328 | pos += scnprintf(*buf + pos, bufsz - pos, | ||
329 | "%40s: 0X%08x\n", | ||
330 | get_rfh_string(rfh_tbl[i]), | ||
331 | iwl_read_prph(trans, rfh_tbl[i])); | ||
332 | |||
333 | for (i = 0; i < ARRAY_SIZE(rfh_mq_tbl); i++) | ||
334 | for (q = 0; q < num_q; q++) { | ||
335 | u32 addr = rfh_mq_tbl[i].addr; | ||
336 | |||
337 | addr += q * (rfh_mq_tbl[i].is64 ? 8 : 4); | ||
338 | pos += scnprintf(*buf + pos, bufsz - pos, | ||
339 | "%34s(q %2d): 0X%08x\n", | ||
340 | get_rfh_string(addr), q, | ||
341 | iwl_read_prph(trans, addr)); | ||
342 | } | ||
343 | |||
344 | return pos; | ||
345 | } | ||
346 | #endif | ||
347 | |||
348 | IWL_ERR(trans, "RFH register values:\n"); | ||
349 | for (i = 0; i < ARRAY_SIZE(rfh_tbl); i++) | ||
350 | IWL_ERR(trans, " %34s: 0X%08x\n", | ||
351 | get_rfh_string(rfh_tbl[i]), | ||
352 | iwl_read_prph(trans, rfh_tbl[i])); | ||
353 | |||
354 | for (i = 0; i < ARRAY_SIZE(rfh_mq_tbl); i++) | ||
355 | for (q = 0; q < num_q; q++) { | ||
356 | u32 addr = rfh_mq_tbl[i].addr; | ||
357 | |||
358 | addr += q * (rfh_mq_tbl[i].is64 ? 8 : 4); | ||
359 | IWL_ERR(trans, " %34s(q %d): 0X%08x\n", | ||
360 | get_rfh_string(addr), q, | ||
361 | iwl_read_prph(trans, addr)); | ||
362 | } | ||
363 | |||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | static const char *get_fh_string(int cmd) | ||
368 | { | ||
234 | switch (cmd) { | 369 | switch (cmd) { |
235 | IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); | 370 | IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); |
236 | IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); | 371 | IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); |
@@ -262,6 +397,9 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf) | |||
262 | FH_TSSR_TX_ERROR_REG | 397 | FH_TSSR_TX_ERROR_REG |
263 | }; | 398 | }; |
264 | 399 | ||
400 | if (trans->cfg->mq_rx_supported) | ||
401 | return iwl_dump_rfh(trans, buf); | ||
402 | |||
265 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 403 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
266 | if (buf) { | 404 | if (buf) { |
267 | int pos = 0; | 405 | int pos = 0; |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.h b/drivers/net/wireless/intel/iwlwifi/iwl-io.h index a9bcc788cae1..5c8c0e130194 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.h | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val); | 35 | void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val); |
36 | void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val); | 36 | void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val); |
37 | void iwl_write64(struct iwl_trans *trans, u64 ofs, u64 val); | ||
37 | u32 iwl_read32(struct iwl_trans *trans, u32 ofs); | 38 | u32 iwl_read32(struct iwl_trans *trans, u32 ofs); |
38 | 39 | ||
39 | static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask) | 40 | static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask) |
@@ -53,11 +54,13 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, | |||
53 | 54 | ||
54 | u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg); | 55 | u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg); |
55 | void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); | 56 | void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); |
57 | void iwl_write_direct64(struct iwl_trans *trans, u64 reg, u64 value); | ||
56 | 58 | ||
57 | 59 | ||
58 | u32 iwl_read_prph_no_grab(struct iwl_trans *trans, u32 ofs); | 60 | u32 iwl_read_prph_no_grab(struct iwl_trans *trans, u32 ofs); |
59 | u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs); | 61 | u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs); |
60 | void iwl_write_prph_no_grab(struct iwl_trans *trans, u32 ofs, u32 val); | 62 | void iwl_write_prph_no_grab(struct iwl_trans *trans, u32 ofs, u32 val); |
63 | void iwl_write_prph64_no_grab(struct iwl_trans *trans, u64 ofs, u64 val); | ||
61 | void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val); | 64 | void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val); |
62 | int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr, | 65 | int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr, |
63 | u32 bits, u32 mask, int timeout); | 66 | u32 bits, u32 mask, int timeout); |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h b/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h index 6c5c2f9f73a2..4d32b10fe50c 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h | |||
@@ -66,7 +66,6 @@ | |||
66 | #include <linux/types.h> | 66 | #include <linux/types.h> |
67 | #include <linux/spinlock.h> | 67 | #include <linux/spinlock.h> |
68 | #include <linux/gfp.h> | 68 | #include <linux/gfp.h> |
69 | #include <net/mac80211.h> | ||
70 | 69 | ||
71 | extern struct iwl_mod_params iwlwifi_mod_params; | 70 | extern struct iwl_mod_params iwlwifi_mod_params; |
72 | 71 | ||
@@ -87,9 +86,10 @@ enum iwl_disable_11n { | |||
87 | }; | 86 | }; |
88 | 87 | ||
89 | enum iwl_amsdu_size { | 88 | enum iwl_amsdu_size { |
90 | IWL_AMSDU_4K = 0, | 89 | IWL_AMSDU_DEF = 0, |
91 | IWL_AMSDU_8K = 1, | 90 | IWL_AMSDU_4K = 1, |
92 | IWL_AMSDU_12K = 2, | 91 | IWL_AMSDU_8K = 2, |
92 | IWL_AMSDU_12K = 3, | ||
93 | }; | 93 | }; |
94 | 94 | ||
95 | enum iwl_uapsd_disable { | 95 | enum iwl_uapsd_disable { |
@@ -105,7 +105,7 @@ enum iwl_uapsd_disable { | |||
105 | * @sw_crypto: using hardware encryption, default = 0 | 105 | * @sw_crypto: using hardware encryption, default = 0 |
106 | * @disable_11n: disable 11n capabilities, default = 0, | 106 | * @disable_11n: disable 11n capabilities, default = 0, |
107 | * use IWL_[DIS,EN]ABLE_HT_* constants | 107 | * use IWL_[DIS,EN]ABLE_HT_* constants |
108 | * @amsdu_size: enable 8K amsdu size, default = 4K. enum iwl_amsdu_size. | 108 | * @amsdu_size: See &enum iwl_amsdu_size. |
109 | * @restart_fw: restart firmware, default = 1 | 109 | * @restart_fw: restart firmware, default = 1 |
110 | * @bt_coex_active: enable bt coex, default = true | 110 | * @bt_coex_active: enable bt coex, default = true |
111 | * @led_mode: system default, default = 0 | 111 | * @led_mode: system default, default = 0 |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c index 21653fee806c..43f8f7d45ddb 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | |||
@@ -397,6 +397,13 @@ static void iwl_init_vht_hw_capab(const struct iwl_cfg *cfg, | |||
397 | vht_cap->cap |= IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; | 397 | vht_cap->cap |= IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
398 | 398 | ||
399 | switch (iwlwifi_mod_params.amsdu_size) { | 399 | switch (iwlwifi_mod_params.amsdu_size) { |
400 | case IWL_AMSDU_DEF: | ||
401 | if (cfg->mq_rx_supported) | ||
402 | vht_cap->cap |= | ||
403 | IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454; | ||
404 | else | ||
405 | vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895; | ||
406 | break; | ||
400 | case IWL_AMSDU_4K: | 407 | case IWL_AMSDU_4K: |
401 | vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895; | 408 | vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895; |
402 | break; | 409 | break; |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h index 6c1d20ded04b..459bf736fd5b 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h | |||
@@ -417,5 +417,6 @@ enum { | |||
417 | }; | 417 | }; |
418 | 418 | ||
419 | #define UREG_CHICK (0xA05C00) | 419 | #define UREG_CHICK (0xA05C00) |
420 | #define UREG_CHICK_MSI_ENABLE BIT(24) | ||
420 | #define UREG_CHICK_MSIX_ENABLE BIT(25) | 421 | #define UREG_CHICK_MSIX_ENABLE BIT(25) |
421 | #endif /* __iwl_prph_h__ */ | 422 | #endif /* __iwl_prph_h__ */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h index 8193d36ae2dd..5535e2238da3 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h | |||
@@ -211,6 +211,9 @@ struct iwl_cmd_header_wide { | |||
211 | #define FH_RSCSR_FRAME_SIZE_MSK 0x00003FFF /* bits 0-13 */ | 211 | #define FH_RSCSR_FRAME_SIZE_MSK 0x00003FFF /* bits 0-13 */ |
212 | #define FH_RSCSR_FRAME_INVALID 0x55550000 | 212 | #define FH_RSCSR_FRAME_INVALID 0x55550000 |
213 | #define FH_RSCSR_FRAME_ALIGN 0x40 | 213 | #define FH_RSCSR_FRAME_ALIGN 0x40 |
214 | #define FH_RSCSR_RPA_EN BIT(25) | ||
215 | #define FH_RSCSR_RXQ_POS 16 | ||
216 | #define FH_RSCSR_RXQ_MASK 0x3F0000 | ||
214 | 217 | ||
215 | struct iwl_rx_packet { | 218 | struct iwl_rx_packet { |
216 | /* | 219 | /* |
@@ -220,7 +223,13 @@ struct iwl_rx_packet { | |||
220 | * 31: flag flush RB request | 223 | * 31: flag flush RB request |
221 | * 30: flag ignore TC (terminal counter) request | 224 | * 30: flag ignore TC (terminal counter) request |
222 | * 29: flag fast IRQ request | 225 | * 29: flag fast IRQ request |
223 | * 28-14: Reserved | 226 | * 28-26: Reserved |
227 | * 25: Offload enabled | ||
228 | * 24: RPF enabled | ||
229 | * 23: RSS enabled | ||
230 | * 22: Checksum enabled | ||
231 | * 21-16: RX queue | ||
232 | * 15-14: Reserved | ||
224 | * 13-00: RX frame size | 233 | * 13-00: RX frame size |
225 | */ | 234 | */ |
226 | __le32 len_n_flags; | 235 | __le32 len_n_flags; |
@@ -383,11 +392,6 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r) | |||
383 | 392 | ||
384 | #define MAX_NO_RECLAIM_CMDS 6 | 393 | #define MAX_NO_RECLAIM_CMDS 6 |
385 | 394 | ||
386 | /* | ||
387 | * The first entry in driver_data array in ieee80211_tx_info | ||
388 | * that can be used by the transport. | ||
389 | */ | ||
390 | #define IWL_TRANS_FIRST_DRIVER_DATA 2 | ||
391 | #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) | 395 | #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) |
392 | 396 | ||
393 | /* | 397 | /* |
@@ -491,6 +495,8 @@ struct iwl_hcmd_arr { | |||
491 | * @command_groups_size: number of command groups, to avoid illegal access | 495 | * @command_groups_size: number of command groups, to avoid illegal access |
492 | * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until | 496 | * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until |
493 | * we get the ALIVE from the uCode | 497 | * we get the ALIVE from the uCode |
498 | * @cb_data_offs: offset inside skb->cb to store transport data at, must have | ||
499 | * space for at least two pointers | ||
494 | */ | 500 | */ |
495 | struct iwl_trans_config { | 501 | struct iwl_trans_config { |
496 | struct iwl_op_mode *op_mode; | 502 | struct iwl_op_mode *op_mode; |
@@ -510,6 +516,8 @@ struct iwl_trans_config { | |||
510 | int command_groups_size; | 516 | int command_groups_size; |
511 | 517 | ||
512 | u32 sdio_adma_addr; | 518 | u32 sdio_adma_addr; |
519 | |||
520 | u8 cb_data_offs; | ||
513 | }; | 521 | }; |
514 | 522 | ||
515 | struct iwl_trans_dump_data { | 523 | struct iwl_trans_dump_data { |
@@ -574,6 +582,7 @@ struct iwl_trans_txq_scd_cfg { | |||
574 | * configured. May sleep. | 582 | * configured. May sleep. |
575 | * @txq_disable: de-configure a Tx queue to send AMPDUs | 583 | * @txq_disable: de-configure a Tx queue to send AMPDUs |
576 | * Must be atomic | 584 | * Must be atomic |
585 | * @txq_set_shared_mode: change Tx queue shared/unshared marking | ||
577 | * @wait_tx_queue_empty: wait until tx queues are empty. May sleep. | 586 | * @wait_tx_queue_empty: wait until tx queues are empty. May sleep. |
578 | * @freeze_txq_timer: prevents the timer of the queue from firing until the | 587 | * @freeze_txq_timer: prevents the timer of the queue from firing until the |
579 | * queue is set to awake. Must be atomic. | 588 | * queue is set to awake. Must be atomic. |
@@ -637,6 +646,9 @@ struct iwl_trans_ops { | |||
637 | void (*txq_disable)(struct iwl_trans *trans, int queue, | 646 | void (*txq_disable)(struct iwl_trans *trans, int queue, |
638 | bool configure_scd); | 647 | bool configure_scd); |
639 | 648 | ||
649 | void (*txq_set_shared_mode)(struct iwl_trans *trans, u32 txq_id, | ||
650 | bool shared); | ||
651 | |||
640 | int (*wait_tx_queue_empty)(struct iwl_trans *trans, u32 txq_bm); | 652 | int (*wait_tx_queue_empty)(struct iwl_trans *trans, u32 txq_bm); |
641 | void (*freeze_txq_timer)(struct iwl_trans *trans, unsigned long txqs, | 653 | void (*freeze_txq_timer)(struct iwl_trans *trans, unsigned long txqs, |
642 | bool freeze); | 654 | bool freeze); |
@@ -749,6 +761,7 @@ enum iwl_plat_pm_mode { | |||
749 | * @ops - pointer to iwl_trans_ops | 761 | * @ops - pointer to iwl_trans_ops |
750 | * @op_mode - pointer to the op_mode | 762 | * @op_mode - pointer to the op_mode |
751 | * @cfg - pointer to the configuration | 763 | * @cfg - pointer to the configuration |
764 | * @drv - pointer to iwl_drv | ||
752 | * @status: a bit-mask of transport status flags | 765 | * @status: a bit-mask of transport status flags |
753 | * @dev - pointer to struct device * that represents the device | 766 | * @dev - pointer to struct device * that represents the device |
754 | * @max_skb_frags: maximum number of fragments an SKB can have when transmitted. | 767 | * @max_skb_frags: maximum number of fragments an SKB can have when transmitted. |
@@ -792,6 +805,7 @@ struct iwl_trans { | |||
792 | const struct iwl_trans_ops *ops; | 805 | const struct iwl_trans_ops *ops; |
793 | struct iwl_op_mode *op_mode; | 806 | struct iwl_op_mode *op_mode; |
794 | const struct iwl_cfg *cfg; | 807 | const struct iwl_cfg *cfg; |
808 | struct iwl_drv *drv; | ||
795 | enum iwl_trans_state state; | 809 | enum iwl_trans_state state; |
796 | unsigned long status; | 810 | unsigned long status; |
797 | 811 | ||
@@ -1052,6 +1066,13 @@ iwl_trans_txq_enable_cfg(struct iwl_trans *trans, int queue, u16 ssn, | |||
1052 | trans->ops->txq_enable(trans, queue, ssn, cfg, queue_wdg_timeout); | 1066 | trans->ops->txq_enable(trans, queue, ssn, cfg, queue_wdg_timeout); |
1053 | } | 1067 | } |
1054 | 1068 | ||
1069 | static inline void iwl_trans_txq_set_shared_mode(struct iwl_trans *trans, | ||
1070 | int queue, bool shared_mode) | ||
1071 | { | ||
1072 | if (trans->ops->txq_set_shared_mode) | ||
1073 | trans->ops->txq_set_shared_mode(trans, queue, shared_mode); | ||
1074 | } | ||
1075 | |||
1055 | static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue, | 1076 | static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue, |
1056 | int fifo, int sta_id, int tid, | 1077 | int fifo, int sta_id, int tid, |
1057 | int frame_limit, u16 ssn, | 1078 | int frame_limit, u16 ssn, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c index a63f5bbb1ba7..5bdb6c2c8390 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c | |||
@@ -142,7 +142,7 @@ static const __le64 iwl_ci_mask[][3] = { | |||
142 | cpu_to_le64(0x0) | 142 | cpu_to_le64(0x0) |
143 | }, | 143 | }, |
144 | { | 144 | { |
145 | cpu_to_le64(0xFFC0000000ULL), | 145 | cpu_to_le64(0xFE00000000ULL), |
146 | cpu_to_le64(0x0ULL), | 146 | cpu_to_le64(0x0ULL), |
147 | cpu_to_le64(0x0ULL) | 147 | cpu_to_le64(0x0ULL) |
148 | }, | 148 | }, |
@@ -615,8 +615,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
615 | * don't reduce the Tx power if one of these is true: | 615 | * don't reduce the Tx power if one of these is true: |
616 | * we are in LOOSE | 616 | * we are in LOOSE |
617 | * single share antenna product | 617 | * single share antenna product |
618 | * BT is active | 618 | * BT is inactive |
619 | * we are associated | 619 | * we are not associated |
620 | */ | 620 | */ |
621 | if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || | 621 | if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || |
622 | mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc || | 622 | mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc || |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index 406cf1cb945c..b34489817c70 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | |||
@@ -1020,6 +1020,8 @@ static ssize_t iwl_dbgfs_max_amsdu_len_write(struct iwl_mvm *mvm, | |||
1020 | int ret; | 1020 | int ret; |
1021 | 1021 | ||
1022 | ret = kstrtouint(buf, 0, &max_amsdu_len); | 1022 | ret = kstrtouint(buf, 0, &max_amsdu_len); |
1023 | if (ret) | ||
1024 | return ret; | ||
1023 | 1025 | ||
1024 | if (max_amsdu_len > IEEE80211_MAX_MPDU_LEN_VHT_11454) | 1026 | if (max_amsdu_len > IEEE80211_MAX_MPDU_LEN_VHT_11454) |
1025 | return -EINVAL; | 1027 | return -EINVAL; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-coex.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-coex.h index 2a33b694ba10..204c1b13988b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-coex.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-coex.h | |||
@@ -70,85 +70,6 @@ | |||
70 | 70 | ||
71 | #define BITS(nb) (BIT(nb) - 1) | 71 | #define BITS(nb) (BIT(nb) - 1) |
72 | 72 | ||
73 | /** | ||
74 | * enum iwl_bt_coex_flags - flags for BT_COEX command | ||
75 | * @BT_COEX_MODE_POS: | ||
76 | * @BT_COEX_MODE_MSK: | ||
77 | * @BT_COEX_DISABLE_OLD: | ||
78 | * @BT_COEX_2W_OLD: | ||
79 | * @BT_COEX_3W_OLD: | ||
80 | * @BT_COEX_NW_OLD: | ||
81 | * @BT_COEX_AUTO_OLD: | ||
82 | * @BT_COEX_BT_OLD: Antenna is for BT (manufacuring tests) | ||
83 | * @BT_COEX_WIFI_OLD: Antenna is for BT (manufacuring tests) | ||
84 | * @BT_COEX_SYNC2SCO: | ||
85 | * @BT_COEX_CORUNNING: | ||
86 | * @BT_COEX_MPLUT: | ||
87 | * @BT_COEX_TTC: | ||
88 | * @BT_COEX_RRC: | ||
89 | * | ||
90 | * The COEX_MODE must be set for each command. Even if it is not changed. | ||
91 | */ | ||
92 | enum iwl_bt_coex_flags { | ||
93 | BT_COEX_MODE_POS = 3, | ||
94 | BT_COEX_MODE_MSK = BITS(3) << BT_COEX_MODE_POS, | ||
95 | BT_COEX_DISABLE_OLD = 0x0 << BT_COEX_MODE_POS, | ||
96 | BT_COEX_2W_OLD = 0x1 << BT_COEX_MODE_POS, | ||
97 | BT_COEX_3W_OLD = 0x2 << BT_COEX_MODE_POS, | ||
98 | BT_COEX_NW_OLD = 0x3 << BT_COEX_MODE_POS, | ||
99 | BT_COEX_AUTO_OLD = 0x5 << BT_COEX_MODE_POS, | ||
100 | BT_COEX_BT_OLD = 0x6 << BT_COEX_MODE_POS, | ||
101 | BT_COEX_WIFI_OLD = 0x7 << BT_COEX_MODE_POS, | ||
102 | BT_COEX_SYNC2SCO = BIT(7), | ||
103 | BT_COEX_CORUNNING = BIT(8), | ||
104 | BT_COEX_MPLUT = BIT(9), | ||
105 | BT_COEX_TTC = BIT(20), | ||
106 | BT_COEX_RRC = BIT(21), | ||
107 | }; | ||
108 | |||
109 | /* | ||
110 | * indicates what has changed in the BT_COEX command. | ||
111 | * BT_VALID_ENABLE must be set for each command. Commands without this bit will | ||
112 | * discarded by the firmware | ||
113 | */ | ||
114 | enum iwl_bt_coex_valid_bit_msk { | ||
115 | BT_VALID_ENABLE = BIT(0), | ||
116 | BT_VALID_BT_PRIO_BOOST = BIT(1), | ||
117 | BT_VALID_MAX_KILL = BIT(2), | ||
118 | BT_VALID_3W_TMRS = BIT(3), | ||
119 | BT_VALID_KILL_ACK = BIT(4), | ||
120 | BT_VALID_KILL_CTS = BIT(5), | ||
121 | BT_VALID_REDUCED_TX_POWER = BIT(6), | ||
122 | BT_VALID_LUT = BIT(7), | ||
123 | BT_VALID_WIFI_RX_SW_PRIO_BOOST = BIT(8), | ||
124 | BT_VALID_WIFI_TX_SW_PRIO_BOOST = BIT(9), | ||
125 | BT_VALID_MULTI_PRIO_LUT = BIT(10), | ||
126 | BT_VALID_TRM_KICK_FILTER = BIT(11), | ||
127 | BT_VALID_CORUN_LUT_20 = BIT(12), | ||
128 | BT_VALID_CORUN_LUT_40 = BIT(13), | ||
129 | BT_VALID_ANT_ISOLATION = BIT(14), | ||
130 | BT_VALID_ANT_ISOLATION_THRS = BIT(15), | ||
131 | BT_VALID_TXTX_DELTA_FREQ_THRS = BIT(16), | ||
132 | BT_VALID_TXRX_MAX_FREQ_0 = BIT(17), | ||
133 | BT_VALID_SYNC_TO_SCO = BIT(18), | ||
134 | BT_VALID_TTC = BIT(20), | ||
135 | BT_VALID_RRC = BIT(21), | ||
136 | }; | ||
137 | |||
138 | /** | ||
139 | * enum iwl_bt_reduced_tx_power - allows to reduce txpower for WiFi frames. | ||
140 | * @BT_REDUCED_TX_POWER_CTL: reduce Tx power for control frames | ||
141 | * @BT_REDUCED_TX_POWER_DATA: reduce Tx power for data frames | ||
142 | * | ||
143 | * This mechanism allows to have BT and WiFi run concurrently. Since WiFi | ||
144 | * reduces its Tx power, it can work along with BT, hence reducing the amount | ||
145 | * of WiFi frames being killed by BT. | ||
146 | */ | ||
147 | enum iwl_bt_reduced_tx_power { | ||
148 | BT_REDUCED_TX_POWER_CTL = BIT(0), | ||
149 | BT_REDUCED_TX_POWER_DATA = BIT(1), | ||
150 | }; | ||
151 | |||
152 | enum iwl_bt_coex_lut_type { | 73 | enum iwl_bt_coex_lut_type { |
153 | BT_COEX_TIGHT_LUT = 0, | 74 | BT_COEX_TIGHT_LUT = 0, |
154 | BT_COEX_LOOSE_LUT, | 75 | BT_COEX_LOOSE_LUT, |
@@ -158,64 +79,9 @@ enum iwl_bt_coex_lut_type { | |||
158 | BT_COEX_INVALID_LUT = 0xff, | 79 | BT_COEX_INVALID_LUT = 0xff, |
159 | }; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */ | 80 | }; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */ |
160 | 81 | ||
161 | #define BT_COEX_LUT_SIZE (12) | ||
162 | #define BT_COEX_CORUN_LUT_SIZE (32) | 82 | #define BT_COEX_CORUN_LUT_SIZE (32) |
163 | #define BT_COEX_MULTI_PRIO_LUT_SIZE (2) | ||
164 | #define BT_COEX_BOOST_SIZE (4) | ||
165 | #define BT_REDUCED_TX_POWER_BIT BIT(7) | 83 | #define BT_REDUCED_TX_POWER_BIT BIT(7) |
166 | 84 | ||
167 | /** | ||
168 | * struct iwl_bt_coex_cmd_old - bt coex configuration command | ||
169 | * @flags:&enum iwl_bt_coex_flags | ||
170 | * @max_kill: | ||
171 | * @bt_reduced_tx_power: enum %iwl_bt_reduced_tx_power | ||
172 | * @override_primary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT | ||
173 | * should be set by default | ||
174 | * @override_secondary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT | ||
175 | * should be set by default | ||
176 | * @bt4_antenna_isolation: antenna isolation | ||
177 | * @bt4_antenna_isolation_thr: antenna threshold value | ||
178 | * @bt4_tx_tx_delta_freq_thr: TxTx delta frequency | ||
179 | * @bt4_tx_rx_max_freq0: TxRx max frequency | ||
180 | * @bt_prio_boost: BT priority boost registers | ||
181 | * @wifi_tx_prio_boost: SW boost of wifi tx priority | ||
182 | * @wifi_rx_prio_boost: SW boost of wifi rx priority | ||
183 | * @kill_ack_msk: kill ACK mask. 1 - Tx ACK, 0 - kill Tx of ACK. | ||
184 | * @kill_cts_msk: kill CTS mask. 1 - Tx CTS, 0 - kill Tx of CTS. | ||
185 | * @decision_lut: PTA decision LUT, per Prio-Ch | ||
186 | * @bt4_multiprio_lut: multi priority LUT configuration | ||
187 | * @bt4_corun_lut20: co-running 20 MHz LUT configuration | ||
188 | * @bt4_corun_lut40: co-running 40 MHz LUT configuration | ||
189 | * @valid_bit_msk: enum %iwl_bt_coex_valid_bit_msk | ||
190 | * | ||
191 | * The structure is used for the BT_COEX command. | ||
192 | */ | ||
193 | struct iwl_bt_coex_cmd_old { | ||
194 | __le32 flags; | ||
195 | u8 max_kill; | ||
196 | u8 bt_reduced_tx_power; | ||
197 | u8 override_primary_lut; | ||
198 | u8 override_secondary_lut; | ||
199 | |||
200 | u8 bt4_antenna_isolation; | ||
201 | u8 bt4_antenna_isolation_thr; | ||
202 | u8 bt4_tx_tx_delta_freq_thr; | ||
203 | u8 bt4_tx_rx_max_freq0; | ||
204 | |||
205 | __le32 bt_prio_boost[BT_COEX_BOOST_SIZE]; | ||
206 | __le32 wifi_tx_prio_boost; | ||
207 | __le32 wifi_rx_prio_boost; | ||
208 | __le32 kill_ack_msk; | ||
209 | __le32 kill_cts_msk; | ||
210 | |||
211 | __le32 decision_lut[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE]; | ||
212 | __le32 bt4_multiprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE]; | ||
213 | __le32 bt4_corun_lut20[BT_COEX_CORUN_LUT_SIZE]; | ||
214 | __le32 bt4_corun_lut40[BT_COEX_CORUN_LUT_SIZE]; | ||
215 | |||
216 | __le32 valid_bit_msk; | ||
217 | } __packed; /* BT_COEX_CMD_API_S_VER_5 */ | ||
218 | |||
219 | enum iwl_bt_coex_mode { | 85 | enum iwl_bt_coex_mode { |
220 | BT_COEX_DISABLE = 0x0, | 86 | BT_COEX_DISABLE = 0x0, |
221 | BT_COEX_NW = 0x1, | 87 | BT_COEX_NW = 0x1, |
@@ -385,92 +251,4 @@ struct iwl_bt_coex_profile_notif { | |||
385 | u8 reserved[3]; | 251 | u8 reserved[3]; |
386 | } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */ | 252 | } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */ |
387 | 253 | ||
388 | enum iwl_bt_coex_prio_table_event { | ||
389 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, | ||
390 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1, | ||
391 | BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2, | ||
392 | BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3, | ||
393 | BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4, | ||
394 | BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5, | ||
395 | BT_COEX_PRIO_TBL_EVT_DTIM = 6, | ||
396 | BT_COEX_PRIO_TBL_EVT_SCAN52 = 7, | ||
397 | BT_COEX_PRIO_TBL_EVT_SCAN24 = 8, | ||
398 | BT_COEX_PRIO_TBL_EVT_IDLE = 9, | ||
399 | BT_COEX_PRIO_TBL_EVT_MAX = 16, | ||
400 | }; /* BT_COEX_PRIO_TABLE_EVENTS_API_E_VER_1 */ | ||
401 | |||
402 | enum iwl_bt_coex_prio_table_prio { | ||
403 | BT_COEX_PRIO_TBL_DISABLED = 0, | ||
404 | BT_COEX_PRIO_TBL_PRIO_LOW = 1, | ||
405 | BT_COEX_PRIO_TBL_PRIO_HIGH = 2, | ||
406 | BT_COEX_PRIO_TBL_PRIO_BYPASS = 3, | ||
407 | BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4, | ||
408 | BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5, | ||
409 | BT_COEX_PRIO_TBL_PRIO_COEX_IDLE = 6, | ||
410 | BT_COEX_PRIO_TBL_MAX = 8, | ||
411 | }; /* BT_COEX_PRIO_TABLE_PRIORITIES_API_E_VER_1 */ | ||
412 | |||
413 | #define BT_COEX_PRIO_TBL_SHRD_ANT_POS (0) | ||
414 | #define BT_COEX_PRIO_TBL_PRIO_POS (1) | ||
415 | #define BT_COEX_PRIO_TBL_RESERVED_POS (4) | ||
416 | |||
417 | /** | ||
418 | * struct iwl_bt_coex_prio_tbl_cmd - priority table for BT coex | ||
419 | * @prio_tbl: | ||
420 | */ | ||
421 | struct iwl_bt_coex_prio_tbl_cmd { | ||
422 | u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX]; | ||
423 | } __packed; | ||
424 | |||
425 | /** | ||
426 | * struct iwl_bt_coex_ci_cmd_old - bt coex channel inhibition command | ||
427 | * @bt_primary_ci: | ||
428 | * @bt_secondary_ci: | ||
429 | * @co_run_bw_primary: | ||
430 | * @co_run_bw_secondary: | ||
431 | * @primary_ch_phy_id: | ||
432 | * @secondary_ch_phy_id: | ||
433 | * | ||
434 | * Used for BT_COEX_CI command | ||
435 | */ | ||
436 | struct iwl_bt_coex_ci_cmd_old { | ||
437 | __le64 bt_primary_ci; | ||
438 | __le64 bt_secondary_ci; | ||
439 | |||
440 | u8 co_run_bw_primary; | ||
441 | u8 co_run_bw_secondary; | ||
442 | u8 primary_ch_phy_id; | ||
443 | u8 secondary_ch_phy_id; | ||
444 | } __packed; /* BT_CI_MSG_API_S_VER_1 */ | ||
445 | |||
446 | /** | ||
447 | * struct iwl_bt_coex_profile_notif_old - notification about BT coex | ||
448 | * @mbox_msg: message from BT to WiFi | ||
449 | * @msg_idx: the index of the message | ||
450 | * @bt_status: 0 - off, 1 - on | ||
451 | * @bt_open_conn: number of BT connections open | ||
452 | * @bt_traffic_load: load of BT traffic | ||
453 | * @bt_agg_traffic_load: aggregated load of BT traffic | ||
454 | * @bt_ci_compliance: 0 - no CI compliance, 1 - CI compliant | ||
455 | * @primary_ch_lut: LUT used for primary channel | ||
456 | * @secondary_ch_lut: LUT used for secondary channel | ||
457 | * @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading | ||
458 | */ | ||
459 | struct iwl_bt_coex_profile_notif_old { | ||
460 | __le32 mbox_msg[4]; | ||
461 | __le32 msg_idx; | ||
462 | u8 bt_status; | ||
463 | u8 bt_open_conn; | ||
464 | u8 bt_traffic_load; | ||
465 | u8 bt_agg_traffic_load; | ||
466 | u8 bt_ci_compliance; | ||
467 | u8 ttc_enabled; | ||
468 | u8 rrc_enabled; | ||
469 | u8 reserved; | ||
470 | |||
471 | __le32 primary_ch_lut; | ||
472 | __le32 secondary_ch_lut; | ||
473 | __le32 bt_activity_grading; | ||
474 | } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_3 */ | ||
475 | |||
476 | #endif /* __fw_api_bt_coex_h__ */ | 254 | #endif /* __fw_api_bt_coex_h__ */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h index 95ac59d088b1..0246506ab595 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h | |||
@@ -72,6 +72,9 @@ | |||
72 | #define NUM_MAC_INDEX_DRIVER MAC_INDEX_AUX | 72 | #define NUM_MAC_INDEX_DRIVER MAC_INDEX_AUX |
73 | #define NUM_MAC_INDEX (MAC_INDEX_AUX + 1) | 73 | #define NUM_MAC_INDEX (MAC_INDEX_AUX + 1) |
74 | 74 | ||
75 | #define IWL_MVM_STATION_COUNT 16 | ||
76 | #define IWL_MVM_TDLS_STA_COUNT 4 | ||
77 | |||
75 | enum iwl_ac { | 78 | enum iwl_ac { |
76 | AC_BK, | 79 | AC_BK, |
77 | AC_BE, | 80 | AC_BE, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-power.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-power.h index 65a7c8a4cacf..404b0de9e2dc 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-power.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-power.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
10 | * Copyright(c) 2015 Intel Deutschland GmbH | 10 | * Copyright(c) 2015 - 2016 Intel Deutschland GmbH |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
13 | * it under the terms of version 2 of the GNU General Public License as | 13 | * it under the terms of version 2 of the GNU General Public License as |
@@ -34,7 +34,7 @@ | |||
34 | * | 34 | * |
35 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 35 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
36 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 36 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
37 | * Copyright(c) 2015 Intel Deutschland GmbH | 37 | * Copyright(c) 2015 - 2016 Intel Deutschland GmbH |
38 | * All rights reserved. | 38 | * All rights reserved. |
39 | * | 39 | * |
40 | * Redistribution and use in source and binary forms, with or without | 40 | * Redistribution and use in source and binary forms, with or without |
@@ -310,7 +310,8 @@ enum iwl_dev_tx_power_cmd_mode { | |||
310 | IWL_TX_POWER_MODE_SET_MAC = 0, | 310 | IWL_TX_POWER_MODE_SET_MAC = 0, |
311 | IWL_TX_POWER_MODE_SET_DEVICE = 1, | 311 | IWL_TX_POWER_MODE_SET_DEVICE = 1, |
312 | IWL_TX_POWER_MODE_SET_CHAINS = 2, | 312 | IWL_TX_POWER_MODE_SET_CHAINS = 2, |
313 | }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_2 */; | 313 | IWL_TX_POWER_MODE_SET_ACK = 3, |
314 | }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_4 */; | ||
314 | 315 | ||
315 | /** | 316 | /** |
316 | * struct iwl_dev_tx_power_cmd_v2 - TX power reduction command | 317 | * struct iwl_dev_tx_power_cmd_v2 - TX power reduction command |
@@ -338,7 +339,7 @@ struct iwl_dev_tx_power_cmd_v2 { | |||
338 | * @v2: version 2 of the command, embedded here for easier software handling | 339 | * @v2: version 2 of the command, embedded here for easier software handling |
339 | * @per_chain_restriction: per chain restrictions | 340 | * @per_chain_restriction: per chain restrictions |
340 | */ | 341 | */ |
341 | struct iwl_dev_tx_power_cmd { | 342 | struct iwl_dev_tx_power_cmd_v3 { |
342 | /* v3 is just an extension of v2 - keep this here */ | 343 | /* v3 is just an extension of v2 - keep this here */ |
343 | struct iwl_dev_tx_power_cmd_v2 v2; | 344 | struct iwl_dev_tx_power_cmd_v2 v2; |
344 | __le16 per_chain_restriction[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS]; | 345 | __le16 per_chain_restriction[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS]; |
@@ -347,6 +348,19 @@ struct iwl_dev_tx_power_cmd { | |||
347 | #define IWL_DEV_MAX_TX_POWER 0x7FFF | 348 | #define IWL_DEV_MAX_TX_POWER 0x7FFF |
348 | 349 | ||
349 | /** | 350 | /** |
351 | * struct iwl_dev_tx_power_cmd - TX power reduction command | ||
352 | * @v3: version 3 of the command, embedded here for easier software handling | ||
353 | * @enable_ack_reduction: enable or disable close range ack TX power | ||
354 | * reduction. | ||
355 | */ | ||
356 | struct iwl_dev_tx_power_cmd { | ||
357 | /* v4 is just an extension of v3 - keep this here */ | ||
358 | struct iwl_dev_tx_power_cmd_v3 v3; | ||
359 | u8 enable_ack_reduction; | ||
360 | u8 reserved[3]; | ||
361 | } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */ | ||
362 | |||
363 | /** | ||
350 | * struct iwl_beacon_filter_cmd | 364 | * struct iwl_beacon_filter_cmd |
351 | * REPLY_BEACON_FILTERING_CMD = 0xd2 (command) | 365 | * REPLY_BEACON_FILTERING_CMD = 0xd2 (command) |
352 | * @id_and_color: MAC contex identifier | 366 | * @id_and_color: MAC contex identifier |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h index 1ca8e4988b88..acc5cd53e4ba 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h | |||
@@ -296,7 +296,7 @@ enum iwl_rx_mpdu_status { | |||
296 | IWL_RX_MPDU_STATUS_OVERRUN_OK = BIT(1), | 296 | IWL_RX_MPDU_STATUS_OVERRUN_OK = BIT(1), |
297 | IWL_RX_MPDU_STATUS_SRC_STA_FOUND = BIT(2), | 297 | IWL_RX_MPDU_STATUS_SRC_STA_FOUND = BIT(2), |
298 | IWL_RX_MPDU_STATUS_KEY_VALID = BIT(3), | 298 | IWL_RX_MPDU_STATUS_KEY_VALID = BIT(3), |
299 | IWL_RX_MPDU_STATUS_KEY_ERROR = BIT(4), | 299 | IWL_RX_MPDU_STATUS_KEY_PARAM_OK = BIT(4), |
300 | IWL_RX_MPDU_STATUS_ICV_OK = BIT(5), | 300 | IWL_RX_MPDU_STATUS_ICV_OK = BIT(5), |
301 | IWL_RX_MPDU_STATUS_MIC_OK = BIT(6), | 301 | IWL_RX_MPDU_STATUS_MIC_OK = BIT(6), |
302 | IWL_RX_MPDU_RES_STATUS_TTAK_OK = BIT(7), | 302 | IWL_RX_MPDU_RES_STATUS_TTAK_OK = BIT(7), |
@@ -311,7 +311,7 @@ enum iwl_rx_mpdu_status { | |||
311 | IWL_RX_MPDU_STATUS_WEP_MATCH = BIT(12), | 311 | IWL_RX_MPDU_STATUS_WEP_MATCH = BIT(12), |
312 | IWL_RX_MPDU_STATUS_EXT_IV_MATCH = BIT(13), | 312 | IWL_RX_MPDU_STATUS_EXT_IV_MATCH = BIT(13), |
313 | IWL_RX_MPDU_STATUS_KEY_ID_MATCH = BIT(14), | 313 | IWL_RX_MPDU_STATUS_KEY_ID_MATCH = BIT(14), |
314 | IWL_RX_MPDU_STATUS_KEY_COLOR = BIT(15), | 314 | IWL_RX_MPDU_STATUS_ROBUST_MNG_FRAME = BIT(15), |
315 | }; | 315 | }; |
316 | 316 | ||
317 | enum iwl_rx_mpdu_hash_filter { | 317 | enum iwl_rx_mpdu_hash_filter { |
@@ -336,6 +336,18 @@ enum iwl_rx_mpdu_reorder_data { | |||
336 | IWL_RX_MPDU_REORDER_BA_OLD_SN = 0x80000000, | 336 | IWL_RX_MPDU_REORDER_BA_OLD_SN = 0x80000000, |
337 | }; | 337 | }; |
338 | 338 | ||
339 | enum iwl_rx_mpdu_phy_info { | ||
340 | IWL_RX_MPDU_PHY_AMPDU = BIT(5), | ||
341 | IWL_RX_MPDU_PHY_AMPDU_TOGGLE = BIT(6), | ||
342 | IWL_RX_MPDU_PHY_SHORT_PREAMBLE = BIT(7), | ||
343 | IWL_RX_MPDU_PHY_TSF_OVERLOAD = BIT(8), | ||
344 | }; | ||
345 | |||
346 | enum iwl_rx_mpdu_mac_info { | ||
347 | IWL_RX_MPDU_PHY_MAC_INDEX_MASK = 0x0f, | ||
348 | IWL_RX_MPDU_PHY_PHY_INDEX_MASK = 0xf0, | ||
349 | }; | ||
350 | |||
339 | struct iwl_rx_mpdu_desc { | 351 | struct iwl_rx_mpdu_desc { |
340 | /* DW2 */ | 352 | /* DW2 */ |
341 | __le16 mpdu_len; | 353 | __le16 mpdu_len; |
@@ -343,9 +355,9 @@ struct iwl_rx_mpdu_desc { | |||
343 | u8 mac_flags2; | 355 | u8 mac_flags2; |
344 | /* DW3 */ | 356 | /* DW3 */ |
345 | u8 amsdu_info; | 357 | u8 amsdu_info; |
346 | __le16 reserved_for_software; | 358 | __le16 phy_info; |
347 | u8 mac_phy_idx; | 359 | u8 mac_phy_idx; |
348 | /* DW4 */ | 360 | /* DW4 - carries csum data only when rpa_en == 1 */ |
349 | __le16 raw_csum; /* alledgedly unreliable */ | 361 | __le16 raw_csum; /* alledgedly unreliable */ |
350 | __le16 l3l4_flags; | 362 | __le16 l3l4_flags; |
351 | /* DW5 */ | 363 | /* DW5 */ |
@@ -354,17 +366,17 @@ struct iwl_rx_mpdu_desc { | |||
354 | u8 sta_id_flags; | 366 | u8 sta_id_flags; |
355 | /* DW6 */ | 367 | /* DW6 */ |
356 | __le32 reorder_data; | 368 | __le32 reorder_data; |
357 | /* DW7 */ | 369 | /* DW7 - carries rss_hash only when rpa_en == 1 */ |
358 | __le32 rss_hash; | 370 | __le32 rss_hash; |
359 | /* DW8 */ | 371 | /* DW8 - carries filter_match only when rpa_en == 1 */ |
360 | __le32 filter_match; | 372 | __le32 filter_match; |
361 | /* DW9 */ | 373 | /* DW9 */ |
362 | __le32 rate_n_flags; | 374 | __le32 rate_n_flags; |
363 | /* DW10 */ | 375 | /* DW10 */ |
364 | u8 energy_a, energy_b, channel, reserved; | 376 | u8 energy_a, energy_b, channel, mac_context; |
365 | /* DW11 */ | 377 | /* DW11 */ |
366 | __le32 gp2_on_air_rise; | 378 | __le32 gp2_on_air_rise; |
367 | /* DW12 & DW13 */ | 379 | /* DW12 & DW13 - carries TSF only TSF_OVERLOAD bit == 0 */ |
368 | __le64 tsf_on_air_rise; | 380 | __le64 tsf_on_air_rise; |
369 | } __packed; | 381 | } __packed; |
370 | 382 | ||
@@ -435,26 +447,26 @@ struct iwl_rxq_sync_notification { | |||
435 | } __packed; /* MULTI_QUEUE_DRV_SYNC_HDR_CMD_API_S_VER_1 */ | 447 | } __packed; /* MULTI_QUEUE_DRV_SYNC_HDR_CMD_API_S_VER_1 */ |
436 | 448 | ||
437 | /** | 449 | /** |
438 | * Internal message identifier | 450 | * Internal message identifier |
439 | * | 451 | * |
440 | * @IWL_MVM_RXQ_EMPTY: empty sync notification | 452 | * @IWL_MVM_RXQ_EMPTY: empty sync notification |
441 | * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA | 453 | * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA |
442 | */ | 454 | */ |
443 | enum iwl_mvm_rxq_notif_type { | 455 | enum iwl_mvm_rxq_notif_type { |
444 | IWL_MVM_RXQ_EMPTY, | 456 | IWL_MVM_RXQ_EMPTY, |
445 | IWL_MVM_RXQ_NOTIF_DEL_BA, | 457 | IWL_MVM_RXQ_NOTIF_DEL_BA, |
446 | }; | 458 | }; |
447 | 459 | ||
448 | /** | 460 | /** |
449 | * struct iwl_mvm_internal_rxq_notif - Internal representation of the data sent | 461 | * struct iwl_mvm_internal_rxq_notif - Internal representation of the data sent |
450 | * in &iwl_rxq_sync_cmd. Should be DWORD aligned. | 462 | * in &iwl_rxq_sync_cmd. Should be DWORD aligned. |
451 | * FW is agnostic to the payload, so there are no endianity requirements. | 463 | * FW is agnostic to the payload, so there are no endianity requirements. |
452 | * | 464 | * |
453 | * @type: value from &iwl_mvm_rxq_notif_type | 465 | * @type: value from &iwl_mvm_rxq_notif_type |
454 | * @sync: ctrl path is waiting for all notifications to be received | 466 | * @sync: ctrl path is waiting for all notifications to be received |
455 | * @cookie: internal cookie to identify old notifications | 467 | * @cookie: internal cookie to identify old notifications |
456 | * @data: payload | 468 | * @data: payload |
457 | */ | 469 | */ |
458 | struct iwl_mvm_internal_rxq_notif { | 470 | struct iwl_mvm_internal_rxq_notif { |
459 | u16 type; | 471 | u16 type; |
460 | u16 sync; | 472 | u16 sync; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-sta.h index 38b1d045be8e..d1c4fb849111 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-sta.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-sta.h | |||
@@ -141,6 +141,7 @@ enum iwl_sta_flags { | |||
141 | * @STA_KEY_FLG_CCM: CCMP encryption algorithm | 141 | * @STA_KEY_FLG_CCM: CCMP encryption algorithm |
142 | * @STA_KEY_FLG_TKIP: TKIP encryption algorithm | 142 | * @STA_KEY_FLG_TKIP: TKIP encryption algorithm |
143 | * @STA_KEY_FLG_EXT: extended cipher algorithm (depends on the FW support) | 143 | * @STA_KEY_FLG_EXT: extended cipher algorithm (depends on the FW support) |
144 | * @STA_KEY_FLG_GCMP: GCMP encryption algorithm | ||
144 | * @STA_KEY_FLG_CMAC: CMAC encryption algorithm | 145 | * @STA_KEY_FLG_CMAC: CMAC encryption algorithm |
145 | * @STA_KEY_FLG_ENC_UNKNOWN: unknown encryption algorithm | 146 | * @STA_KEY_FLG_ENC_UNKNOWN: unknown encryption algorithm |
146 | * @STA_KEY_FLG_EN_MSK: mask for encryption algorithmi value | 147 | * @STA_KEY_FLG_EN_MSK: mask for encryption algorithmi value |
@@ -149,6 +150,7 @@ enum iwl_sta_flags { | |||
149 | * @STA_KEY_FLG_KEYID_MSK: the index of the key | 150 | * @STA_KEY_FLG_KEYID_MSK: the index of the key |
150 | * @STA_KEY_NOT_VALID: key is invalid | 151 | * @STA_KEY_NOT_VALID: key is invalid |
151 | * @STA_KEY_FLG_WEP_13BYTES: set for 13 bytes WEP key | 152 | * @STA_KEY_FLG_WEP_13BYTES: set for 13 bytes WEP key |
153 | * @STA_KEY_FLG_KEY_32BYTES for non-wep key set for 32 bytes key | ||
152 | * @STA_KEY_MULTICAST: set for multical key | 154 | * @STA_KEY_MULTICAST: set for multical key |
153 | * @STA_KEY_MFP: key is used for Management Frame Protection | 155 | * @STA_KEY_MFP: key is used for Management Frame Protection |
154 | */ | 156 | */ |
@@ -158,6 +160,7 @@ enum iwl_sta_key_flag { | |||
158 | STA_KEY_FLG_CCM = (2 << 0), | 160 | STA_KEY_FLG_CCM = (2 << 0), |
159 | STA_KEY_FLG_TKIP = (3 << 0), | 161 | STA_KEY_FLG_TKIP = (3 << 0), |
160 | STA_KEY_FLG_EXT = (4 << 0), | 162 | STA_KEY_FLG_EXT = (4 << 0), |
163 | STA_KEY_FLG_GCMP = (5 << 0), | ||
161 | STA_KEY_FLG_CMAC = (6 << 0), | 164 | STA_KEY_FLG_CMAC = (6 << 0), |
162 | STA_KEY_FLG_ENC_UNKNOWN = (7 << 0), | 165 | STA_KEY_FLG_ENC_UNKNOWN = (7 << 0), |
163 | STA_KEY_FLG_EN_MSK = (7 << 0), | 166 | STA_KEY_FLG_EN_MSK = (7 << 0), |
@@ -167,6 +170,7 @@ enum iwl_sta_key_flag { | |||
167 | STA_KEY_FLG_KEYID_MSK = (3 << STA_KEY_FLG_KEYID_POS), | 170 | STA_KEY_FLG_KEYID_MSK = (3 << STA_KEY_FLG_KEYID_POS), |
168 | STA_KEY_NOT_VALID = BIT(11), | 171 | STA_KEY_NOT_VALID = BIT(11), |
169 | STA_KEY_FLG_WEP_13BYTES = BIT(12), | 172 | STA_KEY_FLG_WEP_13BYTES = BIT(12), |
173 | STA_KEY_FLG_KEY_32BYTES = BIT(12), | ||
170 | STA_KEY_MULTICAST = BIT(14), | 174 | STA_KEY_MULTICAST = BIT(14), |
171 | STA_KEY_MFP = BIT(15), | 175 | STA_KEY_MFP = BIT(15), |
172 | }; | 176 | }; |
@@ -388,7 +392,6 @@ struct iwl_mvm_add_sta_cmd { | |||
388 | * @key_offset: key offset in key storage | 392 | * @key_offset: key offset in key storage |
389 | * @key_flags: type %iwl_sta_key_flag | 393 | * @key_flags: type %iwl_sta_key_flag |
390 | * @key: key material data | 394 | * @key: key material data |
391 | * @key2: key material data | ||
392 | * @rx_secur_seq_cnt: RX security sequence counter for the key | 395 | * @rx_secur_seq_cnt: RX security sequence counter for the key |
393 | * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection | 396 | * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection |
394 | * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx | 397 | * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx |
@@ -397,8 +400,7 @@ struct iwl_mvm_add_sta_key_cmd { | |||
397 | u8 sta_id; | 400 | u8 sta_id; |
398 | u8 key_offset; | 401 | u8 key_offset; |
399 | __le16 key_flags; | 402 | __le16 key_flags; |
400 | u8 key[16]; | 403 | u8 key[32]; |
401 | u8 key2[16]; | ||
402 | u8 rx_secur_seq_cnt[16]; | 404 | u8 rx_secur_seq_cnt[16]; |
403 | u8 tkip_rx_tsc_byte2; | 405 | u8 tkip_rx_tsc_byte2; |
404 | u8 reserved; | 406 | u8 reserved; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-stats.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-stats.h index 438665a54923..4e638a44babb 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-stats.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-stats.h | |||
@@ -7,6 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH | 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
10 | * Copyright(c) 2016 Intel Deutschland GmbH | ||
10 | * | 11 | * |
11 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of version 2 of the GNU General Public License as | 13 | * it under the terms of version 2 of the GNU General Public License as |
@@ -252,6 +253,20 @@ struct mvm_statistics_general_v8 { | |||
252 | u8 reserved[4 - (NUM_MAC_INDEX % 4)]; | 253 | u8 reserved[4 - (NUM_MAC_INDEX % 4)]; |
253 | } __packed; /* STATISTICS_GENERAL_API_S_VER_8 */ | 254 | } __packed; /* STATISTICS_GENERAL_API_S_VER_8 */ |
254 | 255 | ||
256 | /** | ||
257 | * struct mvm_statistics_load - RX statistics for multi-queue devices | ||
258 | * @air_time: accumulated air time, per mac | ||
259 | * @byte_count: accumulated byte count, per mac | ||
260 | * @pkt_count: accumulated packet count, per mac | ||
261 | * @avg_energy: average RSSI, per station | ||
262 | */ | ||
263 | struct mvm_statistics_load { | ||
264 | __le32 air_time[NUM_MAC_INDEX]; | ||
265 | __le32 byte_count[NUM_MAC_INDEX]; | ||
266 | __le32 pkt_count[NUM_MAC_INDEX]; | ||
267 | u8 avg_energy[IWL_MVM_STATION_COUNT]; | ||
268 | } __packed; /* STATISTICS_RX_MAC_STATION_S_VER_1 */ | ||
269 | |||
255 | struct mvm_statistics_rx { | 270 | struct mvm_statistics_rx { |
256 | struct mvm_statistics_rx_phy ofdm; | 271 | struct mvm_statistics_rx_phy ofdm; |
257 | struct mvm_statistics_rx_phy cck; | 272 | struct mvm_statistics_rx_phy cck; |
@@ -266,7 +281,6 @@ struct mvm_statistics_rx { | |||
266 | * while associated. To disable this behavior, set DISABLE_NOTIF flag in the | 281 | * while associated. To disable this behavior, set DISABLE_NOTIF flag in the |
267 | * STATISTICS_CMD (0x9c), below. | 282 | * STATISTICS_CMD (0x9c), below. |
268 | */ | 283 | */ |
269 | |||
270 | struct iwl_notif_statistics_v10 { | 284 | struct iwl_notif_statistics_v10 { |
271 | __le32 flag; | 285 | __le32 flag; |
272 | struct mvm_statistics_rx rx; | 286 | struct mvm_statistics_rx rx; |
@@ -274,6 +288,14 @@ struct iwl_notif_statistics_v10 { | |||
274 | struct mvm_statistics_general_v8 general; | 288 | struct mvm_statistics_general_v8 general; |
275 | } __packed; /* STATISTICS_NTFY_API_S_VER_10 */ | 289 | } __packed; /* STATISTICS_NTFY_API_S_VER_10 */ |
276 | 290 | ||
291 | struct iwl_notif_statistics_v11 { | ||
292 | __le32 flag; | ||
293 | struct mvm_statistics_rx rx; | ||
294 | struct mvm_statistics_tx tx; | ||
295 | struct mvm_statistics_general_v8 general; | ||
296 | struct mvm_statistics_load load_stats; | ||
297 | } __packed; /* STATISTICS_NTFY_API_S_VER_11 */ | ||
298 | |||
277 | #define IWL_STATISTICS_FLG_CLEAR 0x1 | 299 | #define IWL_STATISTICS_FLG_CLEAR 0x1 |
278 | #define IWL_STATISTICS_FLG_DISABLE_NOTIF 0x2 | 300 | #define IWL_STATISTICS_FLG_DISABLE_NOTIF 0x2 |
279 | 301 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h index dadcccd88255..4144623e1616 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h | |||
@@ -137,17 +137,32 @@ enum iwl_tx_pm_timeouts { | |||
137 | PM_FRAME_ASSOC = 3, | 137 | PM_FRAME_ASSOC = 3, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | /* | ||
141 | * TX command security control | ||
142 | */ | ||
143 | #define TX_CMD_SEC_WEP 0x01 | ||
144 | #define TX_CMD_SEC_CCM 0x02 | ||
145 | #define TX_CMD_SEC_TKIP 0x03 | ||
146 | #define TX_CMD_SEC_EXT 0x04 | ||
147 | #define TX_CMD_SEC_MSK 0x07 | 140 | #define TX_CMD_SEC_MSK 0x07 |
148 | #define TX_CMD_SEC_WEP_KEY_IDX_POS 6 | 141 | #define TX_CMD_SEC_WEP_KEY_IDX_POS 6 |
149 | #define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0 | 142 | #define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0 |
150 | #define TX_CMD_SEC_KEY128 0x08 | 143 | |
144 | /** | ||
145 | * enum iwl_tx_cmd_sec_ctrl - bitmasks for security control in TX command | ||
146 | * @TX_CMD_SEC_WEP: WEP encryption algorithm. | ||
147 | * @TX_CMD_SEC_CCM: CCM encryption algorithm. | ||
148 | * @TX_CMD_SEC_TKIP: TKIP encryption algorithm. | ||
149 | * @TX_CMD_SEC_EXT: extended cipher algorithm. | ||
150 | * @TX_CMD_SEC_GCMP: GCMP encryption algorithm. | ||
151 | * @TX_CMD_SEC_KEY128: set for 104 bits WEP key. | ||
152 | * @TC_CMD_SEC_KEY_FROM_TABLE: for a non-WEP key, set if the key should be taken | ||
153 | * from the table instead of from the TX command. | ||
154 | * If the key is taken from the key table its index should be given by the | ||
155 | * first byte of the TX command key field. | ||
156 | */ | ||
157 | enum iwl_tx_cmd_sec_ctrl { | ||
158 | TX_CMD_SEC_WEP = 0x01, | ||
159 | TX_CMD_SEC_CCM = 0x02, | ||
160 | TX_CMD_SEC_TKIP = 0x03, | ||
161 | TX_CMD_SEC_EXT = 0x04, | ||
162 | TX_CMD_SEC_GCMP = 0x05, | ||
163 | TX_CMD_SEC_KEY128 = 0x08, | ||
164 | TC_CMD_SEC_KEY_FROM_TABLE = 0x08, | ||
165 | }; | ||
151 | 166 | ||
152 | /* TODO: how does these values are OK with only 16 bit variable??? */ | 167 | /* TODO: how does these values are OK with only 16 bit variable??? */ |
153 | /* | 168 | /* |
@@ -562,8 +577,8 @@ struct iwl_mvm_ba_notif { | |||
562 | u8 reserved1; | 577 | u8 reserved1; |
563 | } __packed; | 578 | } __packed; |
564 | 579 | ||
565 | /* | 580 | /** |
566 | * struct iwl_mac_beacon_cmd - beacon template command | 581 | * struct iwl_mac_beacon_cmd_v6 - beacon template command |
567 | * @tx: the tx commands associated with the beacon frame | 582 | * @tx: the tx commands associated with the beacon frame |
568 | * @template_id: currently equal to the mac context id of the coresponding | 583 | * @template_id: currently equal to the mac context id of the coresponding |
569 | * mac. | 584 | * mac. |
@@ -571,13 +586,34 @@ struct iwl_mvm_ba_notif { | |||
571 | * @tim_size: the length of the tim IE | 586 | * @tim_size: the length of the tim IE |
572 | * @frame: the template of the beacon frame | 587 | * @frame: the template of the beacon frame |
573 | */ | 588 | */ |
589 | struct iwl_mac_beacon_cmd_v6 { | ||
590 | struct iwl_tx_cmd tx; | ||
591 | __le32 template_id; | ||
592 | __le32 tim_idx; | ||
593 | __le32 tim_size; | ||
594 | struct ieee80211_hdr frame[0]; | ||
595 | } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_6 */ | ||
596 | |||
597 | /** | ||
598 | * struct iwl_mac_beacon_cmd - beacon template command with offloaded CSA | ||
599 | * @tx: the tx commands associated with the beacon frame | ||
600 | * @template_id: currently equal to the mac context id of the coresponding | ||
601 | * mac. | ||
602 | * @tim_idx: the offset of the tim IE in the beacon | ||
603 | * @tim_size: the length of the tim IE | ||
604 | * @ecsa_offset: offset to the ECSA IE if present | ||
605 | * @csa_offset: offset to the CSA IE if present | ||
606 | * @frame: the template of the beacon frame | ||
607 | */ | ||
574 | struct iwl_mac_beacon_cmd { | 608 | struct iwl_mac_beacon_cmd { |
575 | struct iwl_tx_cmd tx; | 609 | struct iwl_tx_cmd tx; |
576 | __le32 template_id; | 610 | __le32 template_id; |
577 | __le32 tim_idx; | 611 | __le32 tim_idx; |
578 | __le32 tim_size; | 612 | __le32 tim_size; |
613 | __le32 ecsa_offset; | ||
614 | __le32 csa_offset; | ||
579 | struct ieee80211_hdr frame[0]; | 615 | struct ieee80211_hdr frame[0]; |
580 | } __packed; | 616 | } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_7 */ |
581 | 617 | ||
582 | struct iwl_beacon_notif { | 618 | struct iwl_beacon_notif { |
583 | struct iwl_mvm_tx_resp beacon_notify_hdr; | 619 | struct iwl_mvm_tx_resp beacon_notify_hdr; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h index 41b80ae2d5f8..71076f02796e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h | |||
@@ -90,6 +90,7 @@ enum { | |||
90 | * DQA queue numbers | 90 | * DQA queue numbers |
91 | * | 91 | * |
92 | * @IWL_MVM_DQA_CMD_QUEUE: a queue reserved for sending HCMDs to the FW | 92 | * @IWL_MVM_DQA_CMD_QUEUE: a queue reserved for sending HCMDs to the FW |
93 | * @IWL_MVM_DQA_AUX_QUEUE: a queue reserved for aux frames | ||
93 | * @IWL_MVM_DQA_P2P_DEVICE_QUEUE: a queue reserved for P2P device frames | 94 | * @IWL_MVM_DQA_P2P_DEVICE_QUEUE: a queue reserved for P2P device frames |
94 | * @IWL_MVM_DQA_GCAST_QUEUE: a queue reserved for P2P GO/SoftAP GCAST frames | 95 | * @IWL_MVM_DQA_GCAST_QUEUE: a queue reserved for P2P GO/SoftAP GCAST frames |
95 | * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure | 96 | * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure |
@@ -108,6 +109,7 @@ enum { | |||
108 | */ | 109 | */ |
109 | enum iwl_mvm_dqa_txq { | 110 | enum iwl_mvm_dqa_txq { |
110 | IWL_MVM_DQA_CMD_QUEUE = 0, | 111 | IWL_MVM_DQA_CMD_QUEUE = 0, |
112 | IWL_MVM_DQA_AUX_QUEUE = 1, | ||
111 | IWL_MVM_DQA_P2P_DEVICE_QUEUE = 2, | 113 | IWL_MVM_DQA_P2P_DEVICE_QUEUE = 2, |
112 | IWL_MVM_DQA_GCAST_QUEUE = 3, | 114 | IWL_MVM_DQA_GCAST_QUEUE = 3, |
113 | IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4, | 115 | IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4, |
@@ -127,9 +129,6 @@ enum iwl_mvm_tx_fifo { | |||
127 | IWL_MVM_TX_FIFO_CMD = 7, | 129 | IWL_MVM_TX_FIFO_CMD = 7, |
128 | }; | 130 | }; |
129 | 131 | ||
130 | #define IWL_MVM_STATION_COUNT 16 | ||
131 | |||
132 | #define IWL_MVM_TDLS_STA_COUNT 4 | ||
133 | 132 | ||
134 | /* commands */ | 133 | /* commands */ |
135 | enum { | 134 | enum { |
@@ -314,6 +313,7 @@ enum { | |||
314 | enum iwl_mac_conf_subcmd_ids { | 313 | enum iwl_mac_conf_subcmd_ids { |
315 | LINK_QUALITY_MEASUREMENT_CMD = 0x1, | 314 | LINK_QUALITY_MEASUREMENT_CMD = 0x1, |
316 | LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF = 0xFE, | 315 | LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF = 0xFE, |
316 | CHANNEL_SWITCH_NOA_NOTIF = 0xFF, | ||
317 | }; | 317 | }; |
318 | 318 | ||
319 | enum iwl_phy_ops_subcmd_ids { | 319 | enum iwl_phy_ops_subcmd_ids { |
@@ -329,6 +329,7 @@ enum iwl_system_subcmd_ids { | |||
329 | }; | 329 | }; |
330 | 330 | ||
331 | enum iwl_data_path_subcmd_ids { | 331 | enum iwl_data_path_subcmd_ids { |
332 | DQA_ENABLE_CMD = 0x0, | ||
332 | UPDATE_MU_GROUPS_CMD = 0x1, | 333 | UPDATE_MU_GROUPS_CMD = 0x1, |
333 | TRIGGER_RX_QUEUES_NOTIF_CMD = 0x2, | 334 | TRIGGER_RX_QUEUES_NOTIF_CMD = 0x2, |
334 | MU_GROUP_MGMT_NOTIF = 0xFE, | 335 | MU_GROUP_MGMT_NOTIF = 0xFE, |
@@ -359,6 +360,14 @@ struct iwl_cmd_response { | |||
359 | }; | 360 | }; |
360 | 361 | ||
361 | /* | 362 | /* |
363 | * struct iwl_dqa_enable_cmd | ||
364 | * @cmd_queue: the TXQ number of the command queue | ||
365 | */ | ||
366 | struct iwl_dqa_enable_cmd { | ||
367 | __le32 cmd_queue; | ||
368 | } __packed; /* DQA_CONTROL_CMD_API_S_VER_1 */ | ||
369 | |||
370 | /* | ||
362 | * struct iwl_tx_ant_cfg_cmd | 371 | * struct iwl_tx_ant_cfg_cmd |
363 | * @valid: valid antenna configuration | 372 | * @valid: valid antenna configuration |
364 | */ | 373 | */ |
@@ -732,7 +741,7 @@ enum iwl_time_event_type { | |||
732 | 741 | ||
733 | /* P2P GO Events */ | 742 | /* P2P GO Events */ |
734 | TE_P2P_GO_ASSOC_PROT, | 743 | TE_P2P_GO_ASSOC_PROT, |
735 | TE_P2P_GO_REPETITIVE_NOA, | 744 | TE_P2P_GO_REPETITIVET_NOA, |
736 | TE_P2P_GO_CT_WINDOW, | 745 | TE_P2P_GO_CT_WINDOW, |
737 | 746 | ||
738 | /* WiDi Sync Events */ | 747 | /* WiDi Sync Events */ |
@@ -2111,4 +2120,13 @@ struct iwl_link_qual_msrmnt_notif { | |||
2111 | __le32 reserved[3]; | 2120 | __le32 reserved[3]; |
2112 | } __packed; /* LQM_MEASUREMENT_COMPLETE_NTF_API_S_VER1 */ | 2121 | } __packed; /* LQM_MEASUREMENT_COMPLETE_NTF_API_S_VER1 */ |
2113 | 2122 | ||
2123 | /** | ||
2124 | * Channel switch NOA notification | ||
2125 | * | ||
2126 | * @id_and_color: ID and color of the MAC | ||
2127 | */ | ||
2128 | struct iwl_channel_switch_noa_notif { | ||
2129 | __le32 id_and_color; | ||
2130 | } __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */ | ||
2131 | |||
2114 | #endif /* __fw_api_h__ */ | 2132 | #endif /* __fw_api_h__ */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c index e1b6b2c665eb..1abcabb9b6cd 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c | |||
@@ -288,7 +288,8 @@ static void iwl_mvm_dump_fifos(struct iwl_mvm *mvm, | |||
288 | fifo_hdr->fifo_num = cpu_to_le32(i); | 288 | fifo_hdr->fifo_num = cpu_to_le32(i); |
289 | 289 | ||
290 | /* Mark the number of TXF we're pulling now */ | 290 | /* Mark the number of TXF we're pulling now */ |
291 | iwl_trans_write_prph(mvm->trans, TXF_CPU2_NUM, i); | 291 | iwl_trans_write_prph(mvm->trans, TXF_CPU2_NUM, i + |
292 | ARRAY_SIZE(mvm->shared_mem_cfg.txfifo_size)); | ||
292 | 293 | ||
293 | fifo_hdr->available_bytes = | 294 | fifo_hdr->available_bytes = |
294 | cpu_to_le32(iwl_trans_read_prph(mvm->trans, | 295 | cpu_to_le32(iwl_trans_read_prph(mvm->trans, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index 7057f35cb2e7..7e0cdbf8bf74 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c | |||
@@ -65,6 +65,7 @@ | |||
65 | *****************************************************************************/ | 65 | *****************************************************************************/ |
66 | #include <net/mac80211.h> | 66 | #include <net/mac80211.h> |
67 | #include <linux/netdevice.h> | 67 | #include <linux/netdevice.h> |
68 | #include <linux/acpi.h> | ||
68 | 69 | ||
69 | #include "iwl-trans.h" | 70 | #include "iwl-trans.h" |
70 | #include "iwl-op-mode.h" | 71 | #include "iwl-op-mode.h" |
@@ -122,6 +123,9 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm) | |||
122 | IWL_RSS_HASH_TYPE_IPV6_PAYLOAD, | 123 | IWL_RSS_HASH_TYPE_IPV6_PAYLOAD, |
123 | }; | 124 | }; |
124 | 125 | ||
126 | if (mvm->trans->num_rx_queues == 1) | ||
127 | return 0; | ||
128 | |||
125 | /* Do not direct RSS traffic to Q 0 which is our fallback queue */ | 129 | /* Do not direct RSS traffic to Q 0 which is our fallback queue */ |
126 | for (i = 0; i < ARRAY_SIZE(cmd.indirection_table); i++) | 130 | for (i = 0; i < ARRAY_SIZE(cmd.indirection_table); i++) |
127 | cmd.indirection_table[i] = | 131 | cmd.indirection_table[i] = |
@@ -131,6 +135,23 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm) | |||
131 | return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd); | 135 | return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd); |
132 | } | 136 | } |
133 | 137 | ||
138 | static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm) | ||
139 | { | ||
140 | struct iwl_dqa_enable_cmd dqa_cmd = { | ||
141 | .cmd_queue = cpu_to_le32(IWL_MVM_DQA_CMD_QUEUE), | ||
142 | }; | ||
143 | u32 cmd_id = iwl_cmd_id(DQA_ENABLE_CMD, DATA_PATH_GROUP, 0); | ||
144 | int ret; | ||
145 | |||
146 | ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(dqa_cmd), &dqa_cmd); | ||
147 | if (ret) | ||
148 | IWL_ERR(mvm, "Failed to send DQA enabling command: %d\n", ret); | ||
149 | else | ||
150 | IWL_DEBUG_FW(mvm, "Working in DQA mode\n"); | ||
151 | |||
152 | return ret; | ||
153 | } | ||
154 | |||
134 | void iwl_free_fw_paging(struct iwl_mvm *mvm) | 155 | void iwl_free_fw_paging(struct iwl_mvm *mvm) |
135 | { | 156 | { |
136 | int i; | 157 | int i; |
@@ -139,17 +160,21 @@ void iwl_free_fw_paging(struct iwl_mvm *mvm) | |||
139 | return; | 160 | return; |
140 | 161 | ||
141 | for (i = 0; i < NUM_OF_FW_PAGING_BLOCKS; i++) { | 162 | for (i = 0; i < NUM_OF_FW_PAGING_BLOCKS; i++) { |
142 | if (!mvm->fw_paging_db[i].fw_paging_block) { | 163 | struct iwl_fw_paging *paging = &mvm->fw_paging_db[i]; |
164 | |||
165 | if (!paging->fw_paging_block) { | ||
143 | IWL_DEBUG_FW(mvm, | 166 | IWL_DEBUG_FW(mvm, |
144 | "Paging: block %d already freed, continue to next page\n", | 167 | "Paging: block %d already freed, continue to next page\n", |
145 | i); | 168 | i); |
146 | 169 | ||
147 | continue; | 170 | continue; |
148 | } | 171 | } |
172 | dma_unmap_page(mvm->trans->dev, paging->fw_paging_phys, | ||
173 | paging->fw_paging_size, DMA_BIDIRECTIONAL); | ||
149 | 174 | ||
150 | __free_pages(mvm->fw_paging_db[i].fw_paging_block, | 175 | __free_pages(paging->fw_paging_block, |
151 | get_order(mvm->fw_paging_db[i].fw_paging_size)); | 176 | get_order(paging->fw_paging_size)); |
152 | mvm->fw_paging_db[i].fw_paging_block = NULL; | 177 | paging->fw_paging_block = NULL; |
153 | } | 178 | } |
154 | kfree(mvm->trans->paging_download_buf); | 179 | kfree(mvm->trans->paging_download_buf); |
155 | mvm->trans->paging_download_buf = NULL; | 180 | mvm->trans->paging_download_buf = NULL; |
@@ -882,6 +907,177 @@ static int iwl_mvm_config_ltr(struct iwl_mvm *mvm) | |||
882 | sizeof(cmd), &cmd); | 907 | sizeof(cmd), &cmd); |
883 | } | 908 | } |
884 | 909 | ||
910 | #define ACPI_WRDS_METHOD "WRDS" | ||
911 | #define ACPI_WRDS_WIFI (0x07) | ||
912 | #define ACPI_WRDS_TABLE_SIZE 10 | ||
913 | |||
914 | struct iwl_mvm_sar_table { | ||
915 | bool enabled; | ||
916 | u8 values[ACPI_WRDS_TABLE_SIZE]; | ||
917 | }; | ||
918 | |||
919 | #ifdef CONFIG_ACPI | ||
920 | static int iwl_mvm_sar_get_wrds(struct iwl_mvm *mvm, union acpi_object *wrds, | ||
921 | struct iwl_mvm_sar_table *sar_table) | ||
922 | { | ||
923 | union acpi_object *data_pkg; | ||
924 | u32 i; | ||
925 | |||
926 | /* We need at least two packages, one for the revision and one | ||
927 | * for the data itself. Also check that the revision is valid | ||
928 | * (i.e. it is an integer set to 0). | ||
929 | */ | ||
930 | if (wrds->type != ACPI_TYPE_PACKAGE || | ||
931 | wrds->package.count < 2 || | ||
932 | wrds->package.elements[0].type != ACPI_TYPE_INTEGER || | ||
933 | wrds->package.elements[0].integer.value != 0) { | ||
934 | IWL_DEBUG_RADIO(mvm, "Unsupported wrds structure\n"); | ||
935 | return -EINVAL; | ||
936 | } | ||
937 | |||
938 | /* loop through all the packages to find the one for WiFi */ | ||
939 | for (i = 1; i < wrds->package.count; i++) { | ||
940 | union acpi_object *domain; | ||
941 | |||
942 | data_pkg = &wrds->package.elements[i]; | ||
943 | |||
944 | /* Skip anything that is not a package with the right | ||
945 | * amount of elements (i.e. domain_type, | ||
946 | * enabled/disabled plus the sar table size. | ||
947 | */ | ||
948 | if (data_pkg->type != ACPI_TYPE_PACKAGE || | ||
949 | data_pkg->package.count != ACPI_WRDS_TABLE_SIZE + 2) | ||
950 | continue; | ||
951 | |||
952 | domain = &data_pkg->package.elements[0]; | ||
953 | if (domain->type == ACPI_TYPE_INTEGER && | ||
954 | domain->integer.value == ACPI_WRDS_WIFI) | ||
955 | break; | ||
956 | |||
957 | data_pkg = NULL; | ||
958 | } | ||
959 | |||
960 | if (!data_pkg) | ||
961 | return -ENOENT; | ||
962 | |||
963 | if (data_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) | ||
964 | return -EINVAL; | ||
965 | |||
966 | sar_table->enabled = !!(data_pkg->package.elements[1].integer.value); | ||
967 | |||
968 | for (i = 0; i < ACPI_WRDS_TABLE_SIZE; i++) { | ||
969 | union acpi_object *entry; | ||
970 | |||
971 | entry = &data_pkg->package.elements[i + 2]; | ||
972 | if ((entry->type != ACPI_TYPE_INTEGER) || | ||
973 | (entry->integer.value > U8_MAX)) | ||
974 | return -EINVAL; | ||
975 | |||
976 | sar_table->values[i] = entry->integer.value; | ||
977 | } | ||
978 | |||
979 | return 0; | ||
980 | } | ||
981 | |||
982 | static int iwl_mvm_sar_get_table(struct iwl_mvm *mvm, | ||
983 | struct iwl_mvm_sar_table *sar_table) | ||
984 | { | ||
985 | acpi_handle root_handle; | ||
986 | acpi_handle handle; | ||
987 | struct acpi_buffer wrds = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
988 | acpi_status status; | ||
989 | int ret; | ||
990 | |||
991 | root_handle = ACPI_HANDLE(mvm->dev); | ||
992 | if (!root_handle) { | ||
993 | IWL_DEBUG_RADIO(mvm, | ||
994 | "Could not retrieve root port ACPI handle\n"); | ||
995 | return -ENOENT; | ||
996 | } | ||
997 | |||
998 | /* Get the method's handle */ | ||
999 | status = acpi_get_handle(root_handle, (acpi_string)ACPI_WRDS_METHOD, | ||
1000 | &handle); | ||
1001 | if (ACPI_FAILURE(status)) { | ||
1002 | IWL_DEBUG_RADIO(mvm, "WRDS method not found\n"); | ||
1003 | return -ENOENT; | ||
1004 | } | ||
1005 | |||
1006 | /* Call WRDS with no arguments */ | ||
1007 | status = acpi_evaluate_object(handle, NULL, NULL, &wrds); | ||
1008 | if (ACPI_FAILURE(status)) { | ||
1009 | IWL_DEBUG_RADIO(mvm, "WRDS invocation failed (0x%x)\n", status); | ||
1010 | return -ENOENT; | ||
1011 | } | ||
1012 | |||
1013 | ret = iwl_mvm_sar_get_wrds(mvm, wrds.pointer, sar_table); | ||
1014 | kfree(wrds.pointer); | ||
1015 | |||
1016 | return ret; | ||
1017 | } | ||
1018 | #else /* CONFIG_ACPI */ | ||
1019 | static int iwl_mvm_sar_get_table(struct iwl_mvm *mvm, | ||
1020 | struct iwl_mvm_sar_table *sar_table) | ||
1021 | { | ||
1022 | return -ENOENT; | ||
1023 | } | ||
1024 | #endif /* CONFIG_ACPI */ | ||
1025 | |||
1026 | static int iwl_mvm_sar_init(struct iwl_mvm *mvm) | ||
1027 | { | ||
1028 | struct iwl_mvm_sar_table sar_table; | ||
1029 | struct iwl_dev_tx_power_cmd cmd = { | ||
1030 | .v3.v2.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS), | ||
1031 | }; | ||
1032 | int ret, i, j, idx; | ||
1033 | int len = sizeof(cmd); | ||
1034 | |||
1035 | /* we can't do anything with the table if the FW doesn't support it */ | ||
1036 | if (!fw_has_api(&mvm->fw->ucode_capa, | ||
1037 | IWL_UCODE_TLV_API_TX_POWER_CHAIN)) { | ||
1038 | IWL_DEBUG_RADIO(mvm, | ||
1039 | "FW doesn't support per-chain TX power settings.\n"); | ||
1040 | return 0; | ||
1041 | } | ||
1042 | |||
1043 | if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TX_POWER_ACK)) | ||
1044 | len = sizeof(cmd.v3); | ||
1045 | |||
1046 | ret = iwl_mvm_sar_get_table(mvm, &sar_table); | ||
1047 | if (ret < 0) { | ||
1048 | IWL_DEBUG_RADIO(mvm, | ||
1049 | "SAR BIOS table invalid or unavailable. (%d)\n", | ||
1050 | ret); | ||
1051 | /* we don't fail if the table is not available */ | ||
1052 | return 0; | ||
1053 | } | ||
1054 | |||
1055 | if (!sar_table.enabled) | ||
1056 | return 0; | ||
1057 | |||
1058 | IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n"); | ||
1059 | |||
1060 | BUILD_BUG_ON(IWL_NUM_CHAIN_LIMITS * IWL_NUM_SUB_BANDS != | ||
1061 | ACPI_WRDS_TABLE_SIZE); | ||
1062 | |||
1063 | for (i = 0; i < IWL_NUM_CHAIN_LIMITS; i++) { | ||
1064 | IWL_DEBUG_RADIO(mvm, " Chain[%d]:\n", i); | ||
1065 | for (j = 0; j < IWL_NUM_SUB_BANDS; j++) { | ||
1066 | idx = (i * IWL_NUM_SUB_BANDS) + j; | ||
1067 | cmd.v3.per_chain_restriction[i][j] = | ||
1068 | cpu_to_le16(sar_table.values[idx]); | ||
1069 | IWL_DEBUG_RADIO(mvm, " Band[%d] = %d * .125dBm\n", | ||
1070 | j, sar_table.values[idx]); | ||
1071 | } | ||
1072 | } | ||
1073 | |||
1074 | ret = iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); | ||
1075 | if (ret) | ||
1076 | IWL_ERR(mvm, "failed to set per-chain TX power: %d\n", ret); | ||
1077 | |||
1078 | return ret; | ||
1079 | } | ||
1080 | |||
885 | int iwl_mvm_up(struct iwl_mvm *mvm) | 1081 | int iwl_mvm_up(struct iwl_mvm *mvm) |
886 | { | 1082 | { |
887 | int ret, i; | 1083 | int ret, i; |
@@ -976,6 +1172,15 @@ int iwl_mvm_up(struct iwl_mvm *mvm) | |||
976 | /* reset quota debouncing buffer - 0xff will yield invalid data */ | 1172 | /* reset quota debouncing buffer - 0xff will yield invalid data */ |
977 | memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd)); | 1173 | memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd)); |
978 | 1174 | ||
1175 | /* Enable DQA-mode if required */ | ||
1176 | if (iwl_mvm_is_dqa_supported(mvm)) { | ||
1177 | ret = iwl_mvm_send_dqa_cmd(mvm); | ||
1178 | if (ret) | ||
1179 | goto error; | ||
1180 | } else { | ||
1181 | IWL_DEBUG_FW(mvm, "Working in non-DQA mode\n"); | ||
1182 | } | ||
1183 | |||
979 | /* Add auxiliary station for scanning */ | 1184 | /* Add auxiliary station for scanning */ |
980 | ret = iwl_mvm_add_aux_sta(mvm); | 1185 | ret = iwl_mvm_add_aux_sta(mvm); |
981 | if (ret) | 1186 | if (ret) |
@@ -1048,6 +1253,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm) | |||
1048 | if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) | 1253 | if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) |
1049 | iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); | 1254 | iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); |
1050 | 1255 | ||
1256 | ret = iwl_mvm_sar_init(mvm); | ||
1257 | if (ret) | ||
1258 | goto error; | ||
1259 | |||
1051 | IWL_DEBUG_INFO(mvm, "RT uCode started.\n"); | 1260 | IWL_DEBUG_INFO(mvm, "RT uCode started.\n"); |
1052 | return 0; | 1261 | return 0; |
1053 | error: | 1262 | error: |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index 7aae068c02e5..69c42ce45b8a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | |||
@@ -1006,7 +1006,7 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_device(struct iwl_mvm *mvm, | |||
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | static void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, | 1008 | static void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, |
1009 | struct iwl_mac_beacon_cmd *beacon_cmd, | 1009 | struct iwl_mac_beacon_cmd_v6 *beacon_cmd, |
1010 | u8 *beacon, u32 frame_size) | 1010 | u8 *beacon, u32 frame_size) |
1011 | { | 1011 | { |
1012 | u32 tim_idx; | 1012 | u32 tim_idx; |
@@ -1030,6 +1030,23 @@ static void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, | |||
1030 | } | 1030 | } |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size) | ||
1034 | { | ||
1035 | struct ieee80211_mgmt *mgmt = (void *)beacon; | ||
1036 | const u8 *ie; | ||
1037 | |||
1038 | if (WARN_ON_ONCE(frame_size <= (mgmt->u.beacon.variable - beacon))) | ||
1039 | return 0; | ||
1040 | |||
1041 | frame_size -= mgmt->u.beacon.variable - beacon; | ||
1042 | |||
1043 | ie = cfg80211_find_ie(eid, mgmt->u.beacon.variable, frame_size); | ||
1044 | if (!ie) | ||
1045 | return 0; | ||
1046 | |||
1047 | return ie - beacon; | ||
1048 | } | ||
1049 | |||
1033 | static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, | 1050 | static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, |
1034 | struct ieee80211_vif *vif, | 1051 | struct ieee80211_vif *vif, |
1035 | struct sk_buff *beacon) | 1052 | struct sk_buff *beacon) |
@@ -1039,7 +1056,10 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, | |||
1039 | .id = BEACON_TEMPLATE_CMD, | 1056 | .id = BEACON_TEMPLATE_CMD, |
1040 | .flags = CMD_ASYNC, | 1057 | .flags = CMD_ASYNC, |
1041 | }; | 1058 | }; |
1042 | struct iwl_mac_beacon_cmd beacon_cmd = {}; | 1059 | union { |
1060 | struct iwl_mac_beacon_cmd_v6 beacon_cmd_v6; | ||
1061 | struct iwl_mac_beacon_cmd beacon_cmd; | ||
1062 | } u = {}; | ||
1043 | struct ieee80211_tx_info *info; | 1063 | struct ieee80211_tx_info *info; |
1044 | u32 beacon_skb_len; | 1064 | u32 beacon_skb_len; |
1045 | u32 rate, tx_flags; | 1065 | u32 rate, tx_flags; |
@@ -1051,18 +1071,18 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, | |||
1051 | 1071 | ||
1052 | /* TODO: for now the beacon template id is set to be the mac context id. | 1072 | /* TODO: for now the beacon template id is set to be the mac context id. |
1053 | * Might be better to handle it as another resource ... */ | 1073 | * Might be better to handle it as another resource ... */ |
1054 | beacon_cmd.template_id = cpu_to_le32((u32)mvmvif->id); | 1074 | u.beacon_cmd_v6.template_id = cpu_to_le32((u32)mvmvif->id); |
1055 | info = IEEE80211_SKB_CB(beacon); | 1075 | info = IEEE80211_SKB_CB(beacon); |
1056 | 1076 | ||
1057 | /* Set up TX command fields */ | 1077 | /* Set up TX command fields */ |
1058 | beacon_cmd.tx.len = cpu_to_le16((u16)beacon_skb_len); | 1078 | u.beacon_cmd_v6.tx.len = cpu_to_le16((u16)beacon_skb_len); |
1059 | beacon_cmd.tx.sta_id = mvmvif->bcast_sta.sta_id; | 1079 | u.beacon_cmd_v6.tx.sta_id = mvmvif->bcast_sta.sta_id; |
1060 | beacon_cmd.tx.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); | 1080 | u.beacon_cmd_v6.tx.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); |
1061 | tx_flags = TX_CMD_FLG_SEQ_CTL | TX_CMD_FLG_TSF; | 1081 | tx_flags = TX_CMD_FLG_SEQ_CTL | TX_CMD_FLG_TSF; |
1062 | tx_flags |= | 1082 | tx_flags |= |
1063 | iwl_mvm_bt_coex_tx_prio(mvm, (void *)beacon->data, info, 0) << | 1083 | iwl_mvm_bt_coex_tx_prio(mvm, (void *)beacon->data, info, 0) << |
1064 | TX_CMD_FLG_BT_PRIO_POS; | 1084 | TX_CMD_FLG_BT_PRIO_POS; |
1065 | beacon_cmd.tx.tx_flags = cpu_to_le32(tx_flags); | 1085 | u.beacon_cmd_v6.tx.tx_flags = cpu_to_le32(tx_flags); |
1066 | 1086 | ||
1067 | if (!fw_has_capa(&mvm->fw->ucode_capa, | 1087 | if (!fw_has_capa(&mvm->fw->ucode_capa, |
1068 | IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION)) { | 1088 | IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION)) { |
@@ -1071,7 +1091,7 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, | |||
1071 | mvm->mgmt_last_antenna_idx); | 1091 | mvm->mgmt_last_antenna_idx); |
1072 | } | 1092 | } |
1073 | 1093 | ||
1074 | beacon_cmd.tx.rate_n_flags = | 1094 | u.beacon_cmd_v6.tx.rate_n_flags = |
1075 | cpu_to_le32(BIT(mvm->mgmt_last_antenna_idx) << | 1095 | cpu_to_le32(BIT(mvm->mgmt_last_antenna_idx) << |
1076 | RATE_MCS_ANT_POS); | 1096 | RATE_MCS_ANT_POS); |
1077 | 1097 | ||
@@ -1079,20 +1099,37 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, | |||
1079 | rate = IWL_FIRST_OFDM_RATE; | 1099 | rate = IWL_FIRST_OFDM_RATE; |
1080 | } else { | 1100 | } else { |
1081 | rate = IWL_FIRST_CCK_RATE; | 1101 | rate = IWL_FIRST_CCK_RATE; |
1082 | beacon_cmd.tx.rate_n_flags |= cpu_to_le32(RATE_MCS_CCK_MSK); | 1102 | u.beacon_cmd_v6.tx.rate_n_flags |= |
1103 | cpu_to_le32(RATE_MCS_CCK_MSK); | ||
1083 | } | 1104 | } |
1084 | beacon_cmd.tx.rate_n_flags |= | 1105 | u.beacon_cmd_v6.tx.rate_n_flags |= |
1085 | cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(rate)); | 1106 | cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(rate)); |
1086 | 1107 | ||
1087 | /* Set up TX beacon command fields */ | 1108 | /* Set up TX beacon command fields */ |
1088 | if (vif->type == NL80211_IFTYPE_AP) | 1109 | if (vif->type == NL80211_IFTYPE_AP) |
1089 | iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd, | 1110 | iwl_mvm_mac_ctxt_set_tim(mvm, &u.beacon_cmd_v6, |
1090 | beacon->data, | 1111 | beacon->data, |
1091 | beacon_skb_len); | 1112 | beacon_skb_len); |
1092 | 1113 | ||
1093 | /* Submit command */ | 1114 | /* Submit command */ |
1094 | cmd.len[0] = sizeof(beacon_cmd); | 1115 | |
1095 | cmd.data[0] = &beacon_cmd; | 1116 | if (fw_has_capa(&mvm->fw->ucode_capa, |
1117 | IWL_UCODE_TLV_CAPA_CSA_AND_TBTT_OFFLOAD)) { | ||
1118 | u.beacon_cmd.csa_offset = | ||
1119 | cpu_to_le32(iwl_mvm_find_ie_offset(beacon->data, | ||
1120 | WLAN_EID_CHANNEL_SWITCH, | ||
1121 | beacon_skb_len)); | ||
1122 | u.beacon_cmd.ecsa_offset = | ||
1123 | cpu_to_le32(iwl_mvm_find_ie_offset(beacon->data, | ||
1124 | WLAN_EID_EXT_CHANSWITCH_ANN, | ||
1125 | beacon_skb_len)); | ||
1126 | |||
1127 | cmd.len[0] = sizeof(u.beacon_cmd); | ||
1128 | } else { | ||
1129 | cmd.len[0] = sizeof(u.beacon_cmd_v6); | ||
1130 | } | ||
1131 | |||
1132 | cmd.data[0] = &u; | ||
1096 | cmd.dataflags[0] = 0; | 1133 | cmd.dataflags[0] = 0; |
1097 | cmd.len[1] = beacon_skb_len; | 1134 | cmd.len[1] = beacon_skb_len; |
1098 | cmd.data[1] = beacon->data; | 1135 | cmd.data[1] = beacon->data; |
@@ -1538,3 +1575,48 @@ void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm, | |||
1538 | /* pass it as regular rx to mac80211 */ | 1575 | /* pass it as regular rx to mac80211 */ |
1539 | ieee80211_rx_napi(mvm->hw, NULL, skb, NULL); | 1576 | ieee80211_rx_napi(mvm->hw, NULL, skb, NULL); |
1540 | } | 1577 | } |
1578 | |||
1579 | void iwl_mvm_channel_switch_noa_notif(struct iwl_mvm *mvm, | ||
1580 | struct iwl_rx_cmd_buffer *rxb) | ||
1581 | { | ||
1582 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | ||
1583 | struct iwl_channel_switch_noa_notif *notif = (void *)pkt->data; | ||
1584 | struct ieee80211_vif *csa_vif; | ||
1585 | struct iwl_mvm_vif *mvmvif; | ||
1586 | int len = iwl_rx_packet_payload_len(pkt); | ||
1587 | u32 id_n_color; | ||
1588 | |||
1589 | if (WARN_ON_ONCE(len < sizeof(*notif))) | ||
1590 | return; | ||
1591 | |||
1592 | rcu_read_lock(); | ||
1593 | |||
1594 | csa_vif = rcu_dereference(mvm->csa_vif); | ||
1595 | if (WARN_ON(!csa_vif || !csa_vif->csa_active)) | ||
1596 | goto out_unlock; | ||
1597 | |||
1598 | id_n_color = le32_to_cpu(notif->id_and_color); | ||
1599 | |||
1600 | mvmvif = iwl_mvm_vif_from_mac80211(csa_vif); | ||
1601 | if (WARN(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color) != id_n_color, | ||
1602 | "channel switch noa notification on unexpected vif (csa_vif=%d, notif=%d)", | ||
1603 | FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color), id_n_color)) | ||
1604 | goto out_unlock; | ||
1605 | |||
1606 | IWL_DEBUG_INFO(mvm, "Channel Switch Started Notification\n"); | ||
1607 | |||
1608 | queue_delayed_work(system_wq, &mvm->cs_tx_unblock_dwork, | ||
1609 | msecs_to_jiffies(IWL_MVM_CS_UNBLOCK_TX_TIMEOUT * | ||
1610 | csa_vif->bss_conf.beacon_int)); | ||
1611 | |||
1612 | ieee80211_csa_finish(csa_vif); | ||
1613 | |||
1614 | rcu_read_unlock(); | ||
1615 | |||
1616 | RCU_INIT_POINTER(mvm->csa_vif, NULL); | ||
1617 | |||
1618 | return; | ||
1619 | |||
1620 | out_unlock: | ||
1621 | rcu_read_unlock(); | ||
1622 | } | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 18a8474b5760..6d6064534d59 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | |||
@@ -465,11 +465,20 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
465 | hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES; | 465 | hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES; |
466 | hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; | 466 | hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; |
467 | 467 | ||
468 | BUILD_BUG_ON(ARRAY_SIZE(mvm->ciphers) < ARRAY_SIZE(mvm_ciphers) + 2); | 468 | BUILD_BUG_ON(ARRAY_SIZE(mvm->ciphers) < ARRAY_SIZE(mvm_ciphers) + 4); |
469 | memcpy(mvm->ciphers, mvm_ciphers, sizeof(mvm_ciphers)); | 469 | memcpy(mvm->ciphers, mvm_ciphers, sizeof(mvm_ciphers)); |
470 | hw->wiphy->n_cipher_suites = ARRAY_SIZE(mvm_ciphers); | 470 | hw->wiphy->n_cipher_suites = ARRAY_SIZE(mvm_ciphers); |
471 | hw->wiphy->cipher_suites = mvm->ciphers; | 471 | hw->wiphy->cipher_suites = mvm->ciphers; |
472 | 472 | ||
473 | if (iwl_mvm_has_new_rx_api(mvm)) { | ||
474 | mvm->ciphers[hw->wiphy->n_cipher_suites] = | ||
475 | WLAN_CIPHER_SUITE_GCMP; | ||
476 | hw->wiphy->n_cipher_suites++; | ||
477 | mvm->ciphers[hw->wiphy->n_cipher_suites] = | ||
478 | WLAN_CIPHER_SUITE_GCMP_256; | ||
479 | hw->wiphy->n_cipher_suites++; | ||
480 | } | ||
481 | |||
473 | /* | 482 | /* |
474 | * Enable 11w if advertised by firmware and software crypto | 483 | * Enable 11w if advertised by firmware and software crypto |
475 | * is not enabled (as the firmware will interpret some mgmt | 484 | * is not enabled (as the firmware will interpret some mgmt |
@@ -485,10 +494,23 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
485 | 494 | ||
486 | /* currently FW API supports only one optional cipher scheme */ | 495 | /* currently FW API supports only one optional cipher scheme */ |
487 | if (mvm->fw->cs[0].cipher) { | 496 | if (mvm->fw->cs[0].cipher) { |
497 | const struct iwl_fw_cipher_scheme *fwcs = &mvm->fw->cs[0]; | ||
498 | struct ieee80211_cipher_scheme *cs = &mvm->cs[0]; | ||
499 | |||
488 | mvm->hw->n_cipher_schemes = 1; | 500 | mvm->hw->n_cipher_schemes = 1; |
489 | mvm->hw->cipher_schemes = &mvm->fw->cs[0]; | 501 | |
490 | mvm->ciphers[hw->wiphy->n_cipher_suites] = | 502 | cs->cipher = le32_to_cpu(fwcs->cipher); |
491 | mvm->fw->cs[0].cipher; | 503 | cs->iftype = BIT(NL80211_IFTYPE_STATION); |
504 | cs->hdr_len = fwcs->hdr_len; | ||
505 | cs->pn_len = fwcs->pn_len; | ||
506 | cs->pn_off = fwcs->pn_off; | ||
507 | cs->key_idx_off = fwcs->key_idx_off; | ||
508 | cs->key_idx_mask = fwcs->key_idx_mask; | ||
509 | cs->key_idx_shift = fwcs->key_idx_shift; | ||
510 | cs->mic_len = fwcs->mic_len; | ||
511 | |||
512 | mvm->hw->cipher_schemes = mvm->cs; | ||
513 | mvm->ciphers[hw->wiphy->n_cipher_suites] = cs->cipher; | ||
492 | hw->wiphy->n_cipher_suites++; | 514 | hw->wiphy->n_cipher_suites++; |
493 | } | 515 | } |
494 | 516 | ||
@@ -1011,11 +1033,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) | |||
1011 | memset(mvm->sta_deferred_frames, 0, sizeof(mvm->sta_deferred_frames)); | 1033 | memset(mvm->sta_deferred_frames, 0, sizeof(mvm->sta_deferred_frames)); |
1012 | memset(mvm->tfd_drained, 0, sizeof(mvm->tfd_drained)); | 1034 | memset(mvm->tfd_drained, 0, sizeof(mvm->tfd_drained)); |
1013 | memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); | 1035 | memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); |
1014 | memset(&mvm->last_bt_notif_old, 0, sizeof(mvm->last_bt_notif_old)); | ||
1015 | memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); | 1036 | memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); |
1016 | memset(&mvm->last_bt_ci_cmd_old, 0, sizeof(mvm->last_bt_ci_cmd_old)); | ||
1017 | memset(&mvm->bt_ack_kill_msk, 0, sizeof(mvm->bt_ack_kill_msk)); | ||
1018 | memset(&mvm->bt_cts_kill_msk, 0, sizeof(mvm->bt_cts_kill_msk)); | ||
1019 | 1037 | ||
1020 | ieee80211_wake_queues(mvm->hw); | 1038 | ieee80211_wake_queues(mvm->hw); |
1021 | 1039 | ||
@@ -1199,6 +1217,8 @@ static void iwl_mvm_mac_stop(struct ieee80211_hw *hw) | |||
1199 | flush_work(&mvm->async_handlers_wk); | 1217 | flush_work(&mvm->async_handlers_wk); |
1200 | flush_work(&mvm->add_stream_wk); | 1218 | flush_work(&mvm->add_stream_wk); |
1201 | cancel_delayed_work_sync(&mvm->fw_dump_wk); | 1219 | cancel_delayed_work_sync(&mvm->fw_dump_wk); |
1220 | cancel_delayed_work_sync(&mvm->cs_tx_unblock_dwork); | ||
1221 | cancel_delayed_work_sync(&mvm->scan_timeout_dwork); | ||
1202 | iwl_mvm_free_fw_dump_desc(mvm); | 1222 | iwl_mvm_free_fw_dump_desc(mvm); |
1203 | 1223 | ||
1204 | mutex_lock(&mvm->mutex); | 1224 | mutex_lock(&mvm->mutex); |
@@ -1230,18 +1250,20 @@ static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
1230 | s16 tx_power) | 1250 | s16 tx_power) |
1231 | { | 1251 | { |
1232 | struct iwl_dev_tx_power_cmd cmd = { | 1252 | struct iwl_dev_tx_power_cmd cmd = { |
1233 | .v2.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_MAC), | 1253 | .v3.v2.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_MAC), |
1234 | .v2.mac_context_id = | 1254 | .v3.v2.mac_context_id = |
1235 | cpu_to_le32(iwl_mvm_vif_from_mac80211(vif)->id), | 1255 | cpu_to_le32(iwl_mvm_vif_from_mac80211(vif)->id), |
1236 | .v2.pwr_restriction = cpu_to_le16(8 * tx_power), | 1256 | .v3.v2.pwr_restriction = cpu_to_le16(8 * tx_power), |
1237 | }; | 1257 | }; |
1238 | int len = sizeof(cmd); | 1258 | int len = sizeof(cmd); |
1239 | 1259 | ||
1240 | if (tx_power == IWL_DEFAULT_MAX_TX_POWER) | 1260 | if (tx_power == IWL_DEFAULT_MAX_TX_POWER) |
1241 | cmd.v2.pwr_restriction = cpu_to_le16(IWL_DEV_MAX_TX_POWER); | 1261 | cmd.v3.v2.pwr_restriction = cpu_to_le16(IWL_DEV_MAX_TX_POWER); |
1242 | 1262 | ||
1263 | if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TX_POWER_ACK)) | ||
1264 | len = sizeof(cmd.v3); | ||
1243 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_TX_POWER_CHAIN)) | 1265 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_TX_POWER_CHAIN)) |
1244 | len = sizeof(cmd.v2); | 1266 | len = sizeof(cmd.v3.v2); |
1245 | 1267 | ||
1246 | return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); | 1268 | return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); |
1247 | } | 1269 | } |
@@ -2360,7 +2382,7 @@ static void iwl_mvm_check_uapsd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
2360 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT)) | 2382 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT)) |
2361 | return; | 2383 | return; |
2362 | 2384 | ||
2363 | if (vif->p2p && !iwl_mvm_is_p2p_standalone_uapsd_supported(mvm)) { | 2385 | if (vif->p2p && !iwl_mvm_is_p2p_scm_uapsd_supported(mvm)) { |
2364 | vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; | 2386 | vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; |
2365 | return; | 2387 | return; |
2366 | } | 2388 | } |
@@ -2719,6 +2741,8 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |||
2719 | key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; | 2741 | key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; |
2720 | break; | 2742 | break; |
2721 | case WLAN_CIPHER_SUITE_CCMP: | 2743 | case WLAN_CIPHER_SUITE_CCMP: |
2744 | case WLAN_CIPHER_SUITE_GCMP: | ||
2745 | case WLAN_CIPHER_SUITE_GCMP_256: | ||
2722 | key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; | 2746 | key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; |
2723 | break; | 2747 | break; |
2724 | case WLAN_CIPHER_SUITE_AES_CMAC: | 2748 | case WLAN_CIPHER_SUITE_AES_CMAC: |
@@ -2780,7 +2804,8 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |||
2780 | sta && iwl_mvm_has_new_rx_api(mvm) && | 2804 | sta && iwl_mvm_has_new_rx_api(mvm) && |
2781 | key->flags & IEEE80211_KEY_FLAG_PAIRWISE && | 2805 | key->flags & IEEE80211_KEY_FLAG_PAIRWISE && |
2782 | (key->cipher == WLAN_CIPHER_SUITE_CCMP || | 2806 | (key->cipher == WLAN_CIPHER_SUITE_CCMP || |
2783 | key->cipher == WLAN_CIPHER_SUITE_GCMP)) { | 2807 | key->cipher == WLAN_CIPHER_SUITE_GCMP || |
2808 | key->cipher == WLAN_CIPHER_SUITE_GCMP_256)) { | ||
2784 | struct ieee80211_key_seq seq; | 2809 | struct ieee80211_key_seq seq; |
2785 | int tid, q; | 2810 | int tid, q; |
2786 | 2811 | ||
@@ -2834,7 +2859,8 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |||
2834 | if (sta && iwl_mvm_has_new_rx_api(mvm) && | 2859 | if (sta && iwl_mvm_has_new_rx_api(mvm) && |
2835 | key->flags & IEEE80211_KEY_FLAG_PAIRWISE && | 2860 | key->flags & IEEE80211_KEY_FLAG_PAIRWISE && |
2836 | (key->cipher == WLAN_CIPHER_SUITE_CCMP || | 2861 | (key->cipher == WLAN_CIPHER_SUITE_CCMP || |
2837 | key->cipher == WLAN_CIPHER_SUITE_GCMP)) { | 2862 | key->cipher == WLAN_CIPHER_SUITE_GCMP || |
2863 | key->cipher == WLAN_CIPHER_SUITE_GCMP_256)) { | ||
2838 | mvmsta = iwl_mvm_sta_from_mac80211(sta); | 2864 | mvmsta = iwl_mvm_sta_from_mac80211(sta); |
2839 | ptk_pn = rcu_dereference_protected( | 2865 | ptk_pn = rcu_dereference_protected( |
2840 | mvmsta->ptk_pn[keyidx], | 2866 | mvmsta->ptk_pn[keyidx], |
@@ -3687,6 +3713,13 @@ static int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw, | |||
3687 | goto out_unlock; | 3713 | goto out_unlock; |
3688 | } | 3714 | } |
3689 | 3715 | ||
3716 | /* we still didn't unblock tx. prevent new CS meanwhile */ | ||
3717 | if (rcu_dereference_protected(mvm->csa_tx_blocked_vif, | ||
3718 | lockdep_is_held(&mvm->mutex))) { | ||
3719 | ret = -EBUSY; | ||
3720 | goto out_unlock; | ||
3721 | } | ||
3722 | |||
3690 | rcu_assign_pointer(mvm->csa_vif, vif); | 3723 | rcu_assign_pointer(mvm->csa_vif, vif); |
3691 | 3724 | ||
3692 | if (WARN_ONCE(mvmvif->csa_countdown, | 3725 | if (WARN_ONCE(mvmvif->csa_countdown, |
@@ -3695,6 +3728,8 @@ static int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw, | |||
3695 | goto out_unlock; | 3728 | goto out_unlock; |
3696 | } | 3729 | } |
3697 | 3730 | ||
3731 | mvmvif->csa_target_freq = chsw->chandef.chan->center_freq; | ||
3732 | |||
3698 | break; | 3733 | break; |
3699 | case NL80211_IFTYPE_STATION: | 3734 | case NL80211_IFTYPE_STATION: |
3700 | if (mvmvif->lqm_active) | 3735 | if (mvmvif->lqm_active) |
@@ -3898,6 +3933,11 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, | |||
3898 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 3933 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
3899 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | 3934 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
3900 | 3935 | ||
3936 | if (mvmsta->avg_energy) { | ||
3937 | sinfo->signal_avg = mvmsta->avg_energy; | ||
3938 | sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG); | ||
3939 | } | ||
3940 | |||
3901 | if (!fw_has_capa(&mvm->fw->ucode_capa, | 3941 | if (!fw_has_capa(&mvm->fw->ucode_capa, |
3902 | IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) | 3942 | IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) |
3903 | return; | 3943 | return; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index ffbd41dcc0d4..b4fc86d5d7ef 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | |||
@@ -452,6 +452,7 @@ struct iwl_mvm_vif { | |||
452 | /* Indicates that CSA countdown may be started */ | 452 | /* Indicates that CSA countdown may be started */ |
453 | bool csa_countdown; | 453 | bool csa_countdown; |
454 | bool csa_failed; | 454 | bool csa_failed; |
455 | u16 csa_target_freq; | ||
455 | 456 | ||
456 | /* TCP Checksum Offload */ | 457 | /* TCP Checksum Offload */ |
457 | netdev_features_t features; | 458 | netdev_features_t features; |
@@ -686,13 +687,28 @@ struct iwl_mvm_baid_data { | |||
686 | * This is the state of a queue that has been fully configured (including | 687 | * This is the state of a queue that has been fully configured (including |
687 | * SCD pointers, etc), has a specific RA/TID assigned to it, and can be | 688 | * SCD pointers, etc), has a specific RA/TID assigned to it, and can be |
688 | * used to send traffic. | 689 | * used to send traffic. |
690 | * @IWL_MVM_QUEUE_SHARED: queue is shared, or in a process of becoming shared | ||
691 | * This is a state in which a single queue serves more than one TID, all of | ||
692 | * which are not aggregated. Note that the queue is only associated to one | ||
693 | * RA. | ||
694 | * @IWL_MVM_QUEUE_INACTIVE: queue is allocated but no traffic on it | ||
695 | * This is a state of a queue that has had traffic on it, but during the | ||
696 | * last %IWL_MVM_DQA_QUEUE_TIMEOUT time period there has been no traffic on | ||
697 | * it. In this state, when a new queue is needed to be allocated but no | ||
698 | * such free queue exists, an inactive queue might be freed and given to | ||
699 | * the new RA/TID. | ||
689 | */ | 700 | */ |
690 | enum iwl_mvm_queue_status { | 701 | enum iwl_mvm_queue_status { |
691 | IWL_MVM_QUEUE_FREE, | 702 | IWL_MVM_QUEUE_FREE, |
692 | IWL_MVM_QUEUE_RESERVED, | 703 | IWL_MVM_QUEUE_RESERVED, |
693 | IWL_MVM_QUEUE_READY, | 704 | IWL_MVM_QUEUE_READY, |
705 | IWL_MVM_QUEUE_SHARED, | ||
706 | IWL_MVM_QUEUE_INACTIVE, | ||
694 | }; | 707 | }; |
695 | 708 | ||
709 | #define IWL_MVM_DQA_QUEUE_TIMEOUT (5 * HZ) | ||
710 | #define IWL_MVM_NUM_CIPHERS 8 | ||
711 | |||
696 | struct iwl_mvm { | 712 | struct iwl_mvm { |
697 | /* for logger access */ | 713 | /* for logger access */ |
698 | struct device *dev; | 714 | struct device *dev; |
@@ -731,6 +747,7 @@ struct iwl_mvm { | |||
731 | struct iwl_sf_region sf_space; | 747 | struct iwl_sf_region sf_space; |
732 | 748 | ||
733 | u32 ampdu_ref; | 749 | u32 ampdu_ref; |
750 | bool ampdu_toggle; | ||
734 | 751 | ||
735 | struct iwl_notif_wait_data notif_wait; | 752 | struct iwl_notif_wait_data notif_wait; |
736 | 753 | ||
@@ -748,11 +765,16 @@ struct iwl_mvm { | |||
748 | u32 hw_queue_to_mac80211; | 765 | u32 hw_queue_to_mac80211; |
749 | u8 hw_queue_refcount; | 766 | u8 hw_queue_refcount; |
750 | u8 ra_sta_id; /* The RA this queue is mapped to, if exists */ | 767 | u8 ra_sta_id; /* The RA this queue is mapped to, if exists */ |
768 | bool reserved; /* Is this the TXQ reserved for a STA */ | ||
769 | u8 mac80211_ac; /* The mac80211 AC this queue is mapped to */ | ||
751 | u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */ | 770 | u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */ |
771 | /* Timestamp for inactivation per TID of this queue */ | ||
772 | unsigned long last_frame_time[IWL_MAX_TID_COUNT + 1]; | ||
752 | enum iwl_mvm_queue_status status; | 773 | enum iwl_mvm_queue_status status; |
753 | } queue_info[IWL_MAX_HW_QUEUES]; | 774 | } queue_info[IWL_MAX_HW_QUEUES]; |
754 | spinlock_t queue_info_lock; /* For syncing queue mgmt operations */ | 775 | spinlock_t queue_info_lock; /* For syncing queue mgmt operations */ |
755 | struct work_struct add_stream_wk; /* To add streams to queues */ | 776 | struct work_struct add_stream_wk; /* To add streams to queues */ |
777 | |||
756 | atomic_t mac80211_queue_stop_count[IEEE80211_MAX_QUEUES]; | 778 | atomic_t mac80211_queue_stop_count[IEEE80211_MAX_QUEUES]; |
757 | 779 | ||
758 | const char *nvm_file_name; | 780 | const char *nvm_file_name; |
@@ -787,7 +809,7 @@ struct iwl_mvm { | |||
787 | struct iwl_mcast_filter_cmd *mcast_filter_cmd; | 809 | struct iwl_mcast_filter_cmd *mcast_filter_cmd; |
788 | enum iwl_mvm_scan_type scan_type; | 810 | enum iwl_mvm_scan_type scan_type; |
789 | enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all; | 811 | enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all; |
790 | struct timer_list scan_timer; | 812 | struct delayed_work scan_timeout_dwork; |
791 | 813 | ||
792 | /* max number of simultaneous scans the FW supports */ | 814 | /* max number of simultaneous scans the FW supports */ |
793 | unsigned int max_scans; | 815 | unsigned int max_scans; |
@@ -910,11 +932,6 @@ struct iwl_mvm { | |||
910 | wait_queue_head_t d0i3_exit_waitq; | 932 | wait_queue_head_t d0i3_exit_waitq; |
911 | 933 | ||
912 | /* BT-Coex */ | 934 | /* BT-Coex */ |
913 | u8 bt_ack_kill_msk[NUM_PHY_CTX]; | ||
914 | u8 bt_cts_kill_msk[NUM_PHY_CTX]; | ||
915 | |||
916 | struct iwl_bt_coex_profile_notif_old last_bt_notif_old; | ||
917 | struct iwl_bt_coex_ci_cmd_old last_bt_ci_cmd_old; | ||
918 | struct iwl_bt_coex_profile_notif last_bt_notif; | 935 | struct iwl_bt_coex_profile_notif last_bt_notif; |
919 | struct iwl_bt_coex_ci_cmd last_bt_ci_cmd; | 936 | struct iwl_bt_coex_ci_cmd last_bt_ci_cmd; |
920 | 937 | ||
@@ -994,7 +1011,8 @@ struct iwl_mvm { | |||
994 | 1011 | ||
995 | struct iwl_mvm_shared_mem_cfg shared_mem_cfg; | 1012 | struct iwl_mvm_shared_mem_cfg shared_mem_cfg; |
996 | 1013 | ||
997 | u32 ciphers[6]; | 1014 | u32 ciphers[IWL_MVM_NUM_CIPHERS]; |
1015 | struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS]; | ||
998 | struct iwl_mvm_tof_data tof_data; | 1016 | struct iwl_mvm_tof_data tof_data; |
999 | 1017 | ||
1000 | struct ieee80211_vif *nan_vif; | 1018 | struct ieee80211_vif *nan_vif; |
@@ -1006,6 +1024,8 @@ struct iwl_mvm { | |||
1006 | * clients. | 1024 | * clients. |
1007 | */ | 1025 | */ |
1008 | bool drop_bcn_ap_mode; | 1026 | bool drop_bcn_ap_mode; |
1027 | |||
1028 | struct delayed_work cs_tx_unblock_dwork; | ||
1009 | }; | 1029 | }; |
1010 | 1030 | ||
1011 | /* Extract MVM priv from op_mode and _hw */ | 1031 | /* Extract MVM priv from op_mode and _hw */ |
@@ -1158,10 +1178,10 @@ static inline bool iwl_mvm_is_mplut_supported(struct iwl_mvm *mvm) | |||
1158 | } | 1178 | } |
1159 | 1179 | ||
1160 | static inline | 1180 | static inline |
1161 | bool iwl_mvm_is_p2p_standalone_uapsd_supported(struct iwl_mvm *mvm) | 1181 | bool iwl_mvm_is_p2p_scm_uapsd_supported(struct iwl_mvm *mvm) |
1162 | { | 1182 | { |
1163 | return fw_has_capa(&mvm->fw->ucode_capa, | 1183 | return fw_has_capa(&mvm->fw->ucode_capa, |
1164 | IWL_UCODE_TLV_CAPA_P2P_STANDALONE_UAPSD) && | 1184 | IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD) && |
1165 | !(iwlwifi_mod_params.uapsd_disable & | 1185 | !(iwlwifi_mod_params.uapsd_disable & |
1166 | IWL_DISABLE_UAPSD_P2P_CLIENT); | 1186 | IWL_DISABLE_UAPSD_P2P_CLIENT); |
1167 | } | 1187 | } |
@@ -1321,7 +1341,6 @@ bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm, | |||
1321 | void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); | 1341 | void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
1322 | void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, | 1342 | void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, |
1323 | struct iwl_rx_cmd_buffer *rxb); | 1343 | struct iwl_rx_cmd_buffer *rxb); |
1324 | void iwl_mvm_rx_phy_cmd_mq(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); | ||
1325 | void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | 1344 | void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, |
1326 | struct iwl_rx_cmd_buffer *rxb, int queue); | 1345 | struct iwl_rx_cmd_buffer *rxb, int queue); |
1327 | void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, | 1346 | void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, |
@@ -1381,6 +1400,8 @@ void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm, | |||
1381 | struct ieee80211_vif *vif); | 1400 | struct ieee80211_vif *vif); |
1382 | unsigned long iwl_mvm_get_used_hw_queues(struct iwl_mvm *mvm, | 1401 | unsigned long iwl_mvm_get_used_hw_queues(struct iwl_mvm *mvm, |
1383 | struct ieee80211_vif *exclude_vif); | 1402 | struct ieee80211_vif *exclude_vif); |
1403 | void iwl_mvm_channel_switch_noa_notif(struct iwl_mvm *mvm, | ||
1404 | struct iwl_rx_cmd_buffer *rxb); | ||
1384 | /* Bindings */ | 1405 | /* Bindings */ |
1385 | int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | 1406 | int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1386 | int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | 1407 | int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
@@ -1397,7 +1418,7 @@ int iwl_mvm_scan_size(struct iwl_mvm *mvm); | |||
1397 | int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify); | 1418 | int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify); |
1398 | int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm); | 1419 | int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm); |
1399 | void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm); | 1420 | void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm); |
1400 | void iwl_mvm_scan_timeout(unsigned long data); | 1421 | void iwl_mvm_scan_timeout_wk(struct work_struct *work); |
1401 | 1422 | ||
1402 | /* Scheduled scan */ | 1423 | /* Scheduled scan */ |
1403 | void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm, | 1424 | void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm, |
@@ -1613,7 +1634,7 @@ void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue, | |||
1613 | */ | 1634 | */ |
1614 | void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue, | 1635 | void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue, |
1615 | u8 tid, u8 flags); | 1636 | u8 tid, u8 flags); |
1616 | int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 minq, u8 maxq); | 1637 | int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq); |
1617 | 1638 | ||
1618 | /* Return a bitmask with all the hw supported queues, except for the | 1639 | /* Return a bitmask with all the hw supported queues, except for the |
1619 | * command queue, which can't be flushed. | 1640 | * command queue, which can't be flushed. |
@@ -1720,6 +1741,8 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, | |||
1720 | void iwl_mvm_reorder_timer_expired(unsigned long data); | 1741 | void iwl_mvm_reorder_timer_expired(unsigned long data); |
1721 | struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm); | 1742 | struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm); |
1722 | 1743 | ||
1744 | void iwl_mvm_inactivity_check(struct iwl_mvm *mvm); | ||
1745 | |||
1723 | void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error); | 1746 | void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error); |
1724 | unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, | 1747 | unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, |
1725 | struct ieee80211_vif *vif, | 1748 | struct ieee80211_vif *vif, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c index 25a98401a64f..7a686f67f007 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | |||
@@ -66,7 +66,6 @@ | |||
66 | *****************************************************************************/ | 66 | *****************************************************************************/ |
67 | #include <linux/firmware.h> | 67 | #include <linux/firmware.h> |
68 | #include <linux/rtnetlink.h> | 68 | #include <linux/rtnetlink.h> |
69 | #include <linux/pci.h> | ||
70 | #include <linux/acpi.h> | 69 | #include <linux/acpi.h> |
71 | #include "iwl-trans.h" | 70 | #include "iwl-trans.h" |
72 | #include "iwl-csr.h" | 71 | #include "iwl-csr.h" |
@@ -667,8 +666,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, | |||
667 | .mcc = cpu_to_le16(alpha2[0] << 8 | alpha2[1]), | 666 | .mcc = cpu_to_le16(alpha2[0] << 8 | alpha2[1]), |
668 | .source_id = (u8)src_id, | 667 | .source_id = (u8)src_id, |
669 | }; | 668 | }; |
670 | struct iwl_mcc_update_resp *mcc_resp, *resp_cp = NULL; | 669 | struct iwl_mcc_update_resp *resp_cp; |
671 | struct iwl_mcc_update_resp_v1 *mcc_resp_v1 = NULL; | ||
672 | struct iwl_rx_packet *pkt; | 670 | struct iwl_rx_packet *pkt; |
673 | struct iwl_host_cmd cmd = { | 671 | struct iwl_host_cmd cmd = { |
674 | .id = MCC_UPDATE_CMD, | 672 | .id = MCC_UPDATE_CMD, |
@@ -701,34 +699,36 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, | |||
701 | 699 | ||
702 | /* Extract MCC response */ | 700 | /* Extract MCC response */ |
703 | if (resp_v2) { | 701 | if (resp_v2) { |
704 | mcc_resp = (void *)pkt->data; | 702 | struct iwl_mcc_update_resp *mcc_resp = (void *)pkt->data; |
703 | |||
705 | n_channels = __le32_to_cpu(mcc_resp->n_channels); | 704 | n_channels = __le32_to_cpu(mcc_resp->n_channels); |
705 | resp_len = sizeof(struct iwl_mcc_update_resp) + | ||
706 | n_channels * sizeof(__le32); | ||
707 | resp_cp = kmemdup(mcc_resp, resp_len, GFP_KERNEL); | ||
706 | } else { | 708 | } else { |
707 | mcc_resp_v1 = (void *)pkt->data; | 709 | struct iwl_mcc_update_resp_v1 *mcc_resp_v1 = (void *)pkt->data; |
710 | |||
708 | n_channels = __le32_to_cpu(mcc_resp_v1->n_channels); | 711 | n_channels = __le32_to_cpu(mcc_resp_v1->n_channels); |
712 | resp_len = sizeof(struct iwl_mcc_update_resp) + | ||
713 | n_channels * sizeof(__le32); | ||
714 | resp_cp = kzalloc(resp_len, GFP_KERNEL); | ||
715 | |||
716 | if (resp_cp) { | ||
717 | resp_cp->status = mcc_resp_v1->status; | ||
718 | resp_cp->mcc = mcc_resp_v1->mcc; | ||
719 | resp_cp->cap = mcc_resp_v1->cap; | ||
720 | resp_cp->source_id = mcc_resp_v1->source_id; | ||
721 | resp_cp->n_channels = mcc_resp_v1->n_channels; | ||
722 | memcpy(resp_cp->channels, mcc_resp_v1->channels, | ||
723 | n_channels * sizeof(__le32)); | ||
724 | } | ||
709 | } | 725 | } |
710 | 726 | ||
711 | resp_len = sizeof(struct iwl_mcc_update_resp) + n_channels * | ||
712 | sizeof(__le32); | ||
713 | |||
714 | resp_cp = kzalloc(resp_len, GFP_KERNEL); | ||
715 | if (!resp_cp) { | 727 | if (!resp_cp) { |
716 | ret = -ENOMEM; | 728 | ret = -ENOMEM; |
717 | goto exit; | 729 | goto exit; |
718 | } | 730 | } |
719 | 731 | ||
720 | if (resp_v2) { | ||
721 | memcpy(resp_cp, mcc_resp, resp_len); | ||
722 | } else { | ||
723 | resp_cp->status = mcc_resp_v1->status; | ||
724 | resp_cp->mcc = mcc_resp_v1->mcc; | ||
725 | resp_cp->cap = mcc_resp_v1->cap; | ||
726 | resp_cp->source_id = mcc_resp_v1->source_id; | ||
727 | resp_cp->n_channels = mcc_resp_v1->n_channels; | ||
728 | memcpy(resp_cp->channels, mcc_resp_v1->channels, | ||
729 | n_channels * sizeof(__le32)); | ||
730 | } | ||
731 | |||
732 | status = le32_to_cpu(resp_cp->status); | 732 | status = le32_to_cpu(resp_cp->status); |
733 | 733 | ||
734 | mcc = le16_to_cpu(resp_cp->mcc); | 734 | mcc = le16_to_cpu(resp_cp->mcc); |
@@ -802,9 +802,8 @@ static int iwl_mvm_get_bios_mcc(struct iwl_mvm *mvm, char *mcc) | |||
802 | struct acpi_buffer wrdd = {ACPI_ALLOCATE_BUFFER, NULL}; | 802 | struct acpi_buffer wrdd = {ACPI_ALLOCATE_BUFFER, NULL}; |
803 | acpi_status status; | 803 | acpi_status status; |
804 | u32 mcc_val; | 804 | u32 mcc_val; |
805 | struct pci_dev *pdev = to_pci_dev(mvm->dev); | ||
806 | 805 | ||
807 | root_handle = ACPI_HANDLE(&pdev->dev); | 806 | root_handle = ACPI_HANDLE(mvm->dev); |
808 | if (!root_handle) { | 807 | if (!root_handle) { |
809 | IWL_DEBUG_LAR(mvm, | 808 | IWL_DEBUG_LAR(mvm, |
810 | "Could not retrieve root port ACPI handle\n"); | 809 | "Could not retrieve root port ACPI handle\n"); |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index a68054f127fa..55d9096da68c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c | |||
@@ -431,6 +431,7 @@ static const struct iwl_hcmd_names iwl_mvm_system_names[] = { | |||
431 | static const struct iwl_hcmd_names iwl_mvm_mac_conf_names[] = { | 431 | static const struct iwl_hcmd_names iwl_mvm_mac_conf_names[] = { |
432 | HCMD_NAME(LINK_QUALITY_MEASUREMENT_CMD), | 432 | HCMD_NAME(LINK_QUALITY_MEASUREMENT_CMD), |
433 | HCMD_NAME(LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF), | 433 | HCMD_NAME(LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF), |
434 | HCMD_NAME(CHANNEL_SWITCH_NOA_NOTIF), | ||
434 | }; | 435 | }; |
435 | 436 | ||
436 | /* Please keep this array *SORTED* by hex value. | 437 | /* Please keep this array *SORTED* by hex value. |
@@ -494,6 +495,29 @@ static u32 calc_min_backoff(struct iwl_trans *trans, const struct iwl_cfg *cfg) | |||
494 | 495 | ||
495 | static void iwl_mvm_fw_error_dump_wk(struct work_struct *work); | 496 | static void iwl_mvm_fw_error_dump_wk(struct work_struct *work); |
496 | 497 | ||
498 | static void iwl_mvm_tx_unblock_dwork(struct work_struct *work) | ||
499 | { | ||
500 | struct iwl_mvm *mvm = | ||
501 | container_of(work, struct iwl_mvm, cs_tx_unblock_dwork.work); | ||
502 | struct ieee80211_vif *tx_blocked_vif; | ||
503 | struct iwl_mvm_vif *mvmvif; | ||
504 | |||
505 | mutex_lock(&mvm->mutex); | ||
506 | |||
507 | tx_blocked_vif = | ||
508 | rcu_dereference_protected(mvm->csa_tx_blocked_vif, | ||
509 | lockdep_is_held(&mvm->mutex)); | ||
510 | |||
511 | if (!tx_blocked_vif) | ||
512 | goto unlock; | ||
513 | |||
514 | mvmvif = iwl_mvm_vif_from_mac80211(tx_blocked_vif); | ||
515 | iwl_mvm_modify_all_sta_disable_tx(mvm, mvmvif, false); | ||
516 | RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); | ||
517 | unlock: | ||
518 | mutex_unlock(&mvm->mutex); | ||
519 | } | ||
520 | |||
497 | static struct iwl_op_mode * | 521 | static struct iwl_op_mode * |
498 | iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | 522 | iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, |
499 | const struct iwl_fw *fw, struct dentry *dbgfs_dir) | 523 | const struct iwl_fw *fw, struct dentry *dbgfs_dir) |
@@ -553,18 +577,21 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
553 | 577 | ||
554 | mvm->restart_fw = iwlwifi_mod_params.restart_fw ? -1 : 0; | 578 | mvm->restart_fw = iwlwifi_mod_params.restart_fw ? -1 : 0; |
555 | 579 | ||
556 | mvm->aux_queue = 15; | ||
557 | if (!iwl_mvm_is_dqa_supported(mvm)) { | 580 | if (!iwl_mvm_is_dqa_supported(mvm)) { |
558 | mvm->first_agg_queue = 16; | ||
559 | mvm->last_agg_queue = mvm->cfg->base_params->num_of_queues - 1; | 581 | mvm->last_agg_queue = mvm->cfg->base_params->num_of_queues - 1; |
582 | |||
583 | if (mvm->cfg->base_params->num_of_queues == 16) { | ||
584 | mvm->aux_queue = 11; | ||
585 | mvm->first_agg_queue = 12; | ||
586 | } else { | ||
587 | mvm->aux_queue = 15; | ||
588 | mvm->first_agg_queue = 16; | ||
589 | } | ||
560 | } else { | 590 | } else { |
591 | mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; | ||
561 | mvm->first_agg_queue = IWL_MVM_DQA_MIN_DATA_QUEUE; | 592 | mvm->first_agg_queue = IWL_MVM_DQA_MIN_DATA_QUEUE; |
562 | mvm->last_agg_queue = IWL_MVM_DQA_MAX_DATA_QUEUE; | 593 | mvm->last_agg_queue = IWL_MVM_DQA_MAX_DATA_QUEUE; |
563 | } | 594 | } |
564 | if (mvm->cfg->base_params->num_of_queues == 16) { | ||
565 | mvm->aux_queue = 11; | ||
566 | mvm->first_agg_queue = 12; | ||
567 | } | ||
568 | mvm->sf_state = SF_UNINIT; | 595 | mvm->sf_state = SF_UNINIT; |
569 | mvm->cur_ucode = IWL_UCODE_INIT; | 596 | mvm->cur_ucode = IWL_UCODE_INIT; |
570 | mvm->drop_bcn_ap_mode = true; | 597 | mvm->drop_bcn_ap_mode = true; |
@@ -584,6 +611,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
584 | INIT_WORK(&mvm->d0i3_exit_work, iwl_mvm_d0i3_exit_work); | 611 | INIT_WORK(&mvm->d0i3_exit_work, iwl_mvm_d0i3_exit_work); |
585 | INIT_DELAYED_WORK(&mvm->fw_dump_wk, iwl_mvm_fw_error_dump_wk); | 612 | INIT_DELAYED_WORK(&mvm->fw_dump_wk, iwl_mvm_fw_error_dump_wk); |
586 | INIT_DELAYED_WORK(&mvm->tdls_cs.dwork, iwl_mvm_tdls_ch_switch_work); | 613 | INIT_DELAYED_WORK(&mvm->tdls_cs.dwork, iwl_mvm_tdls_ch_switch_work); |
614 | INIT_DELAYED_WORK(&mvm->scan_timeout_dwork, iwl_mvm_scan_timeout_wk); | ||
587 | INIT_WORK(&mvm->add_stream_wk, iwl_mvm_add_new_dqa_stream_wk); | 615 | INIT_WORK(&mvm->add_stream_wk, iwl_mvm_add_new_dqa_stream_wk); |
588 | 616 | ||
589 | spin_lock_init(&mvm->d0i3_tx_lock); | 617 | spin_lock_init(&mvm->d0i3_tx_lock); |
@@ -595,6 +623,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
595 | 623 | ||
596 | SET_IEEE80211_DEV(mvm->hw, mvm->trans->dev); | 624 | SET_IEEE80211_DEV(mvm->hw, mvm->trans->dev); |
597 | 625 | ||
626 | INIT_DELAYED_WORK(&mvm->cs_tx_unblock_dwork, iwl_mvm_tx_unblock_dwork); | ||
627 | |||
598 | /* | 628 | /* |
599 | * Populate the state variables that the transport layer needs | 629 | * Populate the state variables that the transport layer needs |
600 | * to know about. | 630 | * to know about. |
@@ -603,6 +633,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
603 | trans_cfg.no_reclaim_cmds = no_reclaim_cmds; | 633 | trans_cfg.no_reclaim_cmds = no_reclaim_cmds; |
604 | trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); | 634 | trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); |
605 | switch (iwlwifi_mod_params.amsdu_size) { | 635 | switch (iwlwifi_mod_params.amsdu_size) { |
636 | case IWL_AMSDU_DEF: | ||
606 | case IWL_AMSDU_4K: | 637 | case IWL_AMSDU_4K: |
607 | trans_cfg.rx_buf_size = IWL_AMSDU_4K; | 638 | trans_cfg.rx_buf_size = IWL_AMSDU_4K; |
608 | break; | 639 | break; |
@@ -617,6 +648,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
617 | iwlwifi_mod_params.amsdu_size); | 648 | iwlwifi_mod_params.amsdu_size); |
618 | trans_cfg.rx_buf_size = IWL_AMSDU_4K; | 649 | trans_cfg.rx_buf_size = IWL_AMSDU_4K; |
619 | } | 650 | } |
651 | |||
652 | /* the hardware splits the A-MSDU */ | ||
653 | if (mvm->cfg->mq_rx_supported) | ||
654 | trans_cfg.rx_buf_size = IWL_AMSDU_4K; | ||
620 | trans_cfg.wide_cmd_header = fw_has_api(&mvm->fw->ucode_capa, | 655 | trans_cfg.wide_cmd_header = fw_has_api(&mvm->fw->ucode_capa, |
621 | IWL_UCODE_TLV_API_WIDE_CMD_HDR); | 656 | IWL_UCODE_TLV_API_WIDE_CMD_HDR); |
622 | 657 | ||
@@ -633,6 +668,9 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
633 | trans_cfg.cmd_fifo = IWL_MVM_TX_FIFO_CMD; | 668 | trans_cfg.cmd_fifo = IWL_MVM_TX_FIFO_CMD; |
634 | trans_cfg.scd_set_active = true; | 669 | trans_cfg.scd_set_active = true; |
635 | 670 | ||
671 | trans_cfg.cb_data_offs = offsetof(struct ieee80211_tx_info, | ||
672 | driver_data[2]); | ||
673 | |||
636 | trans_cfg.sdio_adma_addr = fw->sdio_adma_addr; | 674 | trans_cfg.sdio_adma_addr = fw->sdio_adma_addr; |
637 | trans_cfg.sw_csum_tx = IWL_MVM_SW_TX_CSUM_OFFLOAD; | 675 | trans_cfg.sw_csum_tx = IWL_MVM_SW_TX_CSUM_OFFLOAD; |
638 | 676 | ||
@@ -735,9 +773,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
735 | 773 | ||
736 | iwl_mvm_tof_init(mvm); | 774 | iwl_mvm_tof_init(mvm); |
737 | 775 | ||
738 | setup_timer(&mvm->scan_timer, iwl_mvm_scan_timeout, | ||
739 | (unsigned long)mvm); | ||
740 | |||
741 | return op_mode; | 776 | return op_mode; |
742 | 777 | ||
743 | out_unregister: | 778 | out_unregister: |
@@ -791,8 +826,6 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode) | |||
791 | 826 | ||
792 | iwl_mvm_tof_clean(mvm); | 827 | iwl_mvm_tof_clean(mvm); |
793 | 828 | ||
794 | del_timer_sync(&mvm->scan_timer); | ||
795 | |||
796 | mutex_destroy(&mvm->mutex); | 829 | mutex_destroy(&mvm->mutex); |
797 | mutex_destroy(&mvm->d0i3_suspend_mutex); | 830 | mutex_destroy(&mvm->d0i3_suspend_mutex); |
798 | 831 | ||
@@ -936,8 +969,6 @@ static void iwl_mvm_rx(struct iwl_op_mode *op_mode, | |||
936 | 969 | ||
937 | if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD)) | 970 | if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD)) |
938 | iwl_mvm_rx_rx_mpdu(mvm, napi, rxb); | 971 | iwl_mvm_rx_rx_mpdu(mvm, napi, rxb); |
939 | else if (pkt->hdr.cmd == FRAME_RELEASE) | ||
940 | iwl_mvm_rx_frame_release(mvm, napi, rxb, 0); | ||
941 | else if (pkt->hdr.cmd == REPLY_RX_PHY_CMD) | 972 | else if (pkt->hdr.cmd == REPLY_RX_PHY_CMD) |
942 | iwl_mvm_rx_rx_phy_cmd(mvm, rxb); | 973 | iwl_mvm_rx_rx_phy_cmd(mvm, rxb); |
943 | else | 974 | else |
@@ -953,11 +984,11 @@ static void iwl_mvm_rx_mq(struct iwl_op_mode *op_mode, | |||
953 | 984 | ||
954 | if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD)) | 985 | if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD)) |
955 | iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, 0); | 986 | iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, 0); |
956 | else if (pkt->hdr.cmd == REPLY_RX_PHY_CMD) | ||
957 | iwl_mvm_rx_phy_cmd_mq(mvm, rxb); | ||
958 | else if (unlikely(pkt->hdr.group_id == DATA_PATH_GROUP && | 987 | else if (unlikely(pkt->hdr.group_id == DATA_PATH_GROUP && |
959 | pkt->hdr.cmd == RX_QUEUES_NOTIFICATION)) | 988 | pkt->hdr.cmd == RX_QUEUES_NOTIFICATION)) |
960 | iwl_mvm_rx_queue_notif(mvm, rxb, 0); | 989 | iwl_mvm_rx_queue_notif(mvm, rxb, 0); |
990 | else if (pkt->hdr.cmd == FRAME_RELEASE) | ||
991 | iwl_mvm_rx_frame_release(mvm, napi, rxb, 0); | ||
961 | else | 992 | else |
962 | iwl_mvm_rx_common(mvm, rxb, pkt); | 993 | iwl_mvm_rx_common(mvm, rxb, pkt); |
963 | } | 994 | } |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/power.c b/drivers/net/wireless/intel/iwlwifi/mvm/power.c index 7b1f6ad6062b..ff85865b1dda 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/power.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/power.c | |||
@@ -308,7 +308,7 @@ static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm, | |||
308 | /* Allow U-APSD only if p2p is stand alone */ | 308 | /* Allow U-APSD only if p2p is stand alone */ |
309 | bool is_p2p_standalone = true; | 309 | bool is_p2p_standalone = true; |
310 | 310 | ||
311 | if (!iwl_mvm_is_p2p_standalone_uapsd_supported(mvm)) | 311 | if (!iwl_mvm_is_p2p_scm_uapsd_supported(mvm)) |
312 | return false; | 312 | return false; |
313 | 313 | ||
314 | ieee80211_iterate_active_interfaces_atomic(mvm->hw, | 314 | ieee80211_iterate_active_interfaces_atomic(mvm->hw, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c index 81dd2f6a48a5..227c5ed9cbe6 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c | |||
@@ -211,6 +211,9 @@ static bool rs_sgi_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
211 | if (is_ht80(rate) && (vht_cap->cap & | 211 | if (is_ht80(rate) && (vht_cap->cap & |
212 | IEEE80211_VHT_CAP_SHORT_GI_80)) | 212 | IEEE80211_VHT_CAP_SHORT_GI_80)) |
213 | return true; | 213 | return true; |
214 | if (is_ht160(rate) && (vht_cap->cap & | ||
215 | IEEE80211_VHT_CAP_SHORT_GI_160)) | ||
216 | return true; | ||
214 | 217 | ||
215 | return false; | 218 | return false; |
216 | } | 219 | } |
@@ -399,7 +402,7 @@ static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) | |||
399 | static void rs_rate_scale_perform(struct iwl_mvm *mvm, | 402 | static void rs_rate_scale_perform(struct iwl_mvm *mvm, |
400 | struct ieee80211_sta *sta, | 403 | struct ieee80211_sta *sta, |
401 | struct iwl_lq_sta *lq_sta, | 404 | struct iwl_lq_sta *lq_sta, |
402 | int tid); | 405 | int tid, bool ndp); |
403 | static void rs_fill_lq_cmd(struct iwl_mvm *mvm, | 406 | static void rs_fill_lq_cmd(struct iwl_mvm *mvm, |
404 | struct ieee80211_sta *sta, | 407 | struct ieee80211_sta *sta, |
405 | struct iwl_lq_sta *lq_sta, | 408 | struct iwl_lq_sta *lq_sta, |
@@ -445,6 +448,13 @@ static const u16 expected_tpt_siso_80MHz[4][IWL_RATE_COUNT] = { | |||
445 | {0, 0, 0, 0, 241, 0, 475, 701, 921, 1343, 1741, 1931, 2117, 2468, 2691}, | 448 | {0, 0, 0, 0, 241, 0, 475, 701, 921, 1343, 1741, 1931, 2117, 2468, 2691}, |
446 | }; | 449 | }; |
447 | 450 | ||
451 | static const u16 expected_tpt_siso_160MHz[4][IWL_RATE_COUNT] = { | ||
452 | {0, 0, 0, 0, 191, 0, 244, 288, 298, 308, 313, 318, 323, 328, 330}, | ||
453 | {0, 0, 0, 0, 200, 0, 251, 293, 302, 312, 317, 322, 327, 332, 334}, | ||
454 | {0, 0, 0, 0, 439, 0, 875, 1307, 1736, 2584, 3419, 3831, 4240, 5049, 5581}, | ||
455 | {0, 0, 0, 0, 488, 0, 972, 1451, 1925, 2864, 3785, 4240, 4691, 5581, 6165}, | ||
456 | }; | ||
457 | |||
448 | static const u16 expected_tpt_mimo2_20MHz[4][IWL_RATE_COUNT] = { | 458 | static const u16 expected_tpt_mimo2_20MHz[4][IWL_RATE_COUNT] = { |
449 | {0, 0, 0, 0, 74, 0, 123, 155, 179, 213, 235, 243, 250, 261, 0}, | 459 | {0, 0, 0, 0, 74, 0, 123, 155, 179, 213, 235, 243, 250, 261, 0}, |
450 | {0, 0, 0, 0, 81, 0, 131, 164, 187, 221, 242, 250, 256, 267, 0}, | 460 | {0, 0, 0, 0, 81, 0, 131, 164, 187, 221, 242, 250, 256, 267, 0}, |
@@ -466,6 +476,13 @@ static const u16 expected_tpt_mimo2_80MHz[4][IWL_RATE_COUNT] = { | |||
466 | {0, 0, 0, 0, 474, 0, 920, 1338, 1732, 2464, 3116, 3418, 3705, 4225, 4545}, | 476 | {0, 0, 0, 0, 474, 0, 920, 1338, 1732, 2464, 3116, 3418, 3705, 4225, 4545}, |
467 | }; | 477 | }; |
468 | 478 | ||
479 | static const u16 expected_tpt_mimo2_160MHz[4][IWL_RATE_COUNT] = { | ||
480 | {0, 0, 0, 0, 240, 0, 278, 308, 313, 319, 322, 324, 328, 330, 334}, | ||
481 | {0, 0, 0, 0, 247, 0, 282, 310, 315, 320, 323, 325, 329, 332, 338}, | ||
482 | {0, 0, 0, 0, 875, 0, 1735, 2582, 3414, 5043, 6619, 7389, 8147, 9629, 10592}, | ||
483 | {0, 0, 0, 0, 971, 0, 1925, 2861, 3779, 5574, 7304, 8147, 8976, 10592, 11640}, | ||
484 | }; | ||
485 | |||
469 | /* mbps, mcs */ | 486 | /* mbps, mcs */ |
470 | static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { | 487 | static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { |
471 | { "1", "BPSK DSSS"}, | 488 | { "1", "BPSK DSSS"}, |
@@ -901,7 +918,6 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate, | |||
901 | } | 918 | } |
902 | } | 919 | } |
903 | 920 | ||
904 | WARN_ON_ONCE(rate->bw == RATE_MCS_CHAN_WIDTH_160); | ||
905 | WARN_ON_ONCE(rate->bw == RATE_MCS_CHAN_WIDTH_80 && | 921 | WARN_ON_ONCE(rate->bw == RATE_MCS_CHAN_WIDTH_80 && |
906 | !is_vht(rate)); | 922 | !is_vht(rate)); |
907 | 923 | ||
@@ -1161,7 +1177,7 @@ static u8 rs_get_tid(struct ieee80211_hdr *hdr) | |||
1161 | } | 1177 | } |
1162 | 1178 | ||
1163 | void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 1179 | void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
1164 | int tid, struct ieee80211_tx_info *info) | 1180 | int tid, struct ieee80211_tx_info *info, bool ndp) |
1165 | { | 1181 | { |
1166 | int legacy_success; | 1182 | int legacy_success; |
1167 | int retries; | 1183 | int retries; |
@@ -1384,7 +1400,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
1384 | done: | 1400 | done: |
1385 | /* See if there's a better rate or modulation mode to try. */ | 1401 | /* See if there's a better rate or modulation mode to try. */ |
1386 | if (sta->supp_rates[info->band]) | 1402 | if (sta->supp_rates[info->band]) |
1387 | rs_rate_scale_perform(mvm, sta, lq_sta, tid); | 1403 | rs_rate_scale_perform(mvm, sta, lq_sta, tid, ndp); |
1388 | } | 1404 | } |
1389 | 1405 | ||
1390 | /* | 1406 | /* |
@@ -1407,7 +1423,8 @@ static void rs_mac80211_tx_status(void *mvm_r, | |||
1407 | info->flags & IEEE80211_TX_CTL_NO_ACK) | 1423 | info->flags & IEEE80211_TX_CTL_NO_ACK) |
1408 | return; | 1424 | return; |
1409 | 1425 | ||
1410 | iwl_mvm_rs_tx_status(mvm, sta, rs_get_tid(hdr), info); | 1426 | iwl_mvm_rs_tx_status(mvm, sta, rs_get_tid(hdr), info, |
1427 | ieee80211_is_qos_nullfunc(hdr->frame_control)); | ||
1411 | } | 1428 | } |
1412 | 1429 | ||
1413 | /* | 1430 | /* |
@@ -1494,6 +1511,9 @@ static const u16 *rs_get_expected_tpt_table(struct iwl_lq_sta *lq_sta, | |||
1494 | case RATE_MCS_CHAN_WIDTH_80: | 1511 | case RATE_MCS_CHAN_WIDTH_80: |
1495 | ht_tbl_pointer = expected_tpt_siso_80MHz; | 1512 | ht_tbl_pointer = expected_tpt_siso_80MHz; |
1496 | break; | 1513 | break; |
1514 | case RATE_MCS_CHAN_WIDTH_160: | ||
1515 | ht_tbl_pointer = expected_tpt_siso_160MHz; | ||
1516 | break; | ||
1497 | default: | 1517 | default: |
1498 | WARN_ON_ONCE(1); | 1518 | WARN_ON_ONCE(1); |
1499 | } | 1519 | } |
@@ -1508,6 +1528,9 @@ static const u16 *rs_get_expected_tpt_table(struct iwl_lq_sta *lq_sta, | |||
1508 | case RATE_MCS_CHAN_WIDTH_80: | 1528 | case RATE_MCS_CHAN_WIDTH_80: |
1509 | ht_tbl_pointer = expected_tpt_mimo2_80MHz; | 1529 | ht_tbl_pointer = expected_tpt_mimo2_80MHz; |
1510 | break; | 1530 | break; |
1531 | case RATE_MCS_CHAN_WIDTH_160: | ||
1532 | ht_tbl_pointer = expected_tpt_mimo2_160MHz; | ||
1533 | break; | ||
1511 | default: | 1534 | default: |
1512 | WARN_ON_ONCE(1); | 1535 | WARN_ON_ONCE(1); |
1513 | } | 1536 | } |
@@ -1582,12 +1605,17 @@ static s32 rs_get_best_rate(struct iwl_mvm *mvm, | |||
1582 | 1605 | ||
1583 | static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) | 1606 | static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) |
1584 | { | 1607 | { |
1585 | if (sta->bandwidth >= IEEE80211_STA_RX_BW_80) | 1608 | switch (sta->bandwidth) { |
1609 | case IEEE80211_STA_RX_BW_160: | ||
1610 | return RATE_MCS_CHAN_WIDTH_160; | ||
1611 | case IEEE80211_STA_RX_BW_80: | ||
1586 | return RATE_MCS_CHAN_WIDTH_80; | 1612 | return RATE_MCS_CHAN_WIDTH_80; |
1587 | else if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) | 1613 | case IEEE80211_STA_RX_BW_40: |
1588 | return RATE_MCS_CHAN_WIDTH_40; | 1614 | return RATE_MCS_CHAN_WIDTH_40; |
1589 | 1615 | case IEEE80211_STA_RX_BW_20: | |
1590 | return RATE_MCS_CHAN_WIDTH_20; | 1616 | default: |
1617 | return RATE_MCS_CHAN_WIDTH_20; | ||
1618 | } | ||
1591 | } | 1619 | } |
1592 | 1620 | ||
1593 | /* | 1621 | /* |
@@ -2213,7 +2241,7 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm, | |||
2213 | static void rs_rate_scale_perform(struct iwl_mvm *mvm, | 2241 | static void rs_rate_scale_perform(struct iwl_mvm *mvm, |
2214 | struct ieee80211_sta *sta, | 2242 | struct ieee80211_sta *sta, |
2215 | struct iwl_lq_sta *lq_sta, | 2243 | struct iwl_lq_sta *lq_sta, |
2216 | int tid) | 2244 | int tid, bool ndp) |
2217 | { | 2245 | { |
2218 | int low = IWL_RATE_INVALID; | 2246 | int low = IWL_RATE_INVALID; |
2219 | int high = IWL_RATE_INVALID; | 2247 | int high = IWL_RATE_INVALID; |
@@ -2512,7 +2540,7 @@ lq_update: | |||
2512 | (lq_sta->tx_agg_tid_en & (1 << tid)) && | 2540 | (lq_sta->tx_agg_tid_en & (1 << tid)) && |
2513 | (tid != IWL_MAX_TID_COUNT)) { | 2541 | (tid != IWL_MAX_TID_COUNT)) { |
2514 | tid_data = &sta_priv->tid_data[tid]; | 2542 | tid_data = &sta_priv->tid_data[tid]; |
2515 | if (tid_data->state == IWL_AGG_OFF) { | 2543 | if (tid_data->state == IWL_AGG_OFF && !ndp) { |
2516 | IWL_DEBUG_RATE(mvm, | 2544 | IWL_DEBUG_RATE(mvm, |
2517 | "try to aggregate tid %d\n", | 2545 | "try to aggregate tid %d\n", |
2518 | tid); | 2546 | tid); |
@@ -2565,6 +2593,9 @@ static const struct rs_init_rate_info rs_optimal_rates_ht[] = { | |||
2565 | { S8_MIN, IWL_RATE_MCS_0_INDEX}, | 2593 | { S8_MIN, IWL_RATE_MCS_0_INDEX}, |
2566 | }; | 2594 | }; |
2567 | 2595 | ||
2596 | /* MCS index 9 is not valid for 20MHz VHT channel width, | ||
2597 | * but is ok for 40, 80 and 160MHz channels. | ||
2598 | */ | ||
2568 | static const struct rs_init_rate_info rs_optimal_rates_vht_20mhz[] = { | 2599 | static const struct rs_init_rate_info rs_optimal_rates_vht_20mhz[] = { |
2569 | { -60, IWL_RATE_MCS_8_INDEX }, | 2600 | { -60, IWL_RATE_MCS_8_INDEX }, |
2570 | { -64, IWL_RATE_MCS_7_INDEX }, | 2601 | { -64, IWL_RATE_MCS_7_INDEX }, |
@@ -2577,7 +2608,7 @@ static const struct rs_init_rate_info rs_optimal_rates_vht_20mhz[] = { | |||
2577 | { S8_MIN, IWL_RATE_MCS_0_INDEX}, | 2608 | { S8_MIN, IWL_RATE_MCS_0_INDEX}, |
2578 | }; | 2609 | }; |
2579 | 2610 | ||
2580 | static const struct rs_init_rate_info rs_optimal_rates_vht_40_80mhz[] = { | 2611 | static const struct rs_init_rate_info rs_optimal_rates_vht[] = { |
2581 | { -60, IWL_RATE_MCS_9_INDEX }, | 2612 | { -60, IWL_RATE_MCS_9_INDEX }, |
2582 | { -64, IWL_RATE_MCS_8_INDEX }, | 2613 | { -64, IWL_RATE_MCS_8_INDEX }, |
2583 | { -68, IWL_RATE_MCS_7_INDEX }, | 2614 | { -68, IWL_RATE_MCS_7_INDEX }, |
@@ -2640,9 +2671,9 @@ static void rs_init_optimal_rate(struct iwl_mvm *mvm, | |||
2640 | lq_sta->optimal_nentries = | 2671 | lq_sta->optimal_nentries = |
2641 | ARRAY_SIZE(rs_optimal_rates_vht_20mhz); | 2672 | ARRAY_SIZE(rs_optimal_rates_vht_20mhz); |
2642 | } else { | 2673 | } else { |
2643 | lq_sta->optimal_rates = rs_optimal_rates_vht_40_80mhz; | 2674 | lq_sta->optimal_rates = rs_optimal_rates_vht; |
2644 | lq_sta->optimal_nentries = | 2675 | lq_sta->optimal_nentries = |
2645 | ARRAY_SIZE(rs_optimal_rates_vht_40_80mhz); | 2676 | ARRAY_SIZE(rs_optimal_rates_vht); |
2646 | } | 2677 | } |
2647 | } else if (is_ht(rate)) { | 2678 | } else if (is_ht(rate)) { |
2648 | lq_sta->optimal_rates = rs_optimal_rates_ht; | 2679 | lq_sta->optimal_rates = rs_optimal_rates_ht; |
@@ -2734,23 +2765,25 @@ static void rs_get_initial_rate(struct iwl_mvm *mvm, | |||
2734 | */ | 2765 | */ |
2735 | if (sta->vht_cap.vht_supported && | 2766 | if (sta->vht_cap.vht_supported && |
2736 | best_rssi > IWL_RS_LOW_RSSI_THRESHOLD) { | 2767 | best_rssi > IWL_RS_LOW_RSSI_THRESHOLD) { |
2737 | if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { | 2768 | switch (sta->bandwidth) { |
2738 | initial_rates = rs_optimal_rates_vht_40_80mhz; | 2769 | case IEEE80211_STA_RX_BW_160: |
2739 | nentries = ARRAY_SIZE(rs_optimal_rates_vht_40_80mhz); | 2770 | case IEEE80211_STA_RX_BW_80: |
2740 | if (sta->bandwidth >= IEEE80211_STA_RX_BW_80) | 2771 | case IEEE80211_STA_RX_BW_40: |
2741 | rate->bw = RATE_MCS_CHAN_WIDTH_80; | 2772 | initial_rates = rs_optimal_rates_vht; |
2742 | else | 2773 | nentries = ARRAY_SIZE(rs_optimal_rates_vht); |
2743 | rate->bw = RATE_MCS_CHAN_WIDTH_40; | 2774 | break; |
2744 | } else if (sta->bandwidth == IEEE80211_STA_RX_BW_20) { | 2775 | case IEEE80211_STA_RX_BW_20: |
2745 | initial_rates = rs_optimal_rates_vht_20mhz; | 2776 | initial_rates = rs_optimal_rates_vht_20mhz; |
2746 | nentries = ARRAY_SIZE(rs_optimal_rates_vht_20mhz); | 2777 | nentries = ARRAY_SIZE(rs_optimal_rates_vht_20mhz); |
2747 | rate->bw = RATE_MCS_CHAN_WIDTH_20; | 2778 | break; |
2748 | } else { | 2779 | default: |
2749 | IWL_ERR(mvm, "Invalid BW %d\n", sta->bandwidth); | 2780 | IWL_ERR(mvm, "Invalid BW %d\n", sta->bandwidth); |
2750 | goto out; | 2781 | goto out; |
2751 | } | 2782 | } |
2783 | |||
2752 | active_rate = lq_sta->active_siso_rate; | 2784 | active_rate = lq_sta->active_siso_rate; |
2753 | rate->type = LQ_VHT_SISO; | 2785 | rate->type = LQ_VHT_SISO; |
2786 | rate->bw = rs_bw_from_sta_bw(sta); | ||
2754 | } else if (sta->ht_cap.ht_supported && | 2787 | } else if (sta->ht_cap.ht_supported && |
2755 | best_rssi > IWL_RS_LOW_RSSI_THRESHOLD) { | 2788 | best_rssi > IWL_RS_LOW_RSSI_THRESHOLD) { |
2756 | initial_rates = rs_optimal_rates_ht; | 2789 | initial_rates = rs_optimal_rates_ht; |
@@ -3057,6 +3090,9 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg) | |||
3057 | case RATE_MCS_CHAN_WIDTH_80: | 3090 | case RATE_MCS_CHAN_WIDTH_80: |
3058 | mvm->drv_rx_stats.bw_80_frames++; | 3091 | mvm->drv_rx_stats.bw_80_frames++; |
3059 | break; | 3092 | break; |
3093 | case RATE_MCS_CHAN_WIDTH_160: | ||
3094 | mvm->drv_rx_stats.bw_160_frames++; | ||
3095 | break; | ||
3060 | default: | 3096 | default: |
3061 | WARN_ONCE(1, "bad BW. rate 0x%x", rate); | 3097 | WARN_ONCE(1, "bad BW. rate 0x%x", rate); |
3062 | } | 3098 | } |
@@ -3705,7 +3741,8 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
3705 | desc += sprintf(buff + desc, " %s", | 3741 | desc += sprintf(buff + desc, " %s", |
3706 | (is_ht20(rate)) ? "20MHz" : | 3742 | (is_ht20(rate)) ? "20MHz" : |
3707 | (is_ht40(rate)) ? "40MHz" : | 3743 | (is_ht40(rate)) ? "40MHz" : |
3708 | (is_ht80(rate)) ? "80Mhz" : "BAD BW"); | 3744 | (is_ht80(rate)) ? "80MHz" : |
3745 | (is_ht160(rate)) ? "160MHz" : "BAD BW"); | ||
3709 | desc += sprintf(buff + desc, " %s %s %s %s\n", | 3746 | desc += sprintf(buff + desc, " %s %s %s %s\n", |
3710 | (rate->sgi) ? "SGI" : "NGI", | 3747 | (rate->sgi) ? "SGI" : "NGI", |
3711 | (rate->ldpc) ? "LDPC" : "BCC", | 3748 | (rate->ldpc) ? "LDPC" : "BCC", |
@@ -3787,9 +3824,10 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | |||
3787 | lq_sta->active_tbl == i ? "*" : "x", | 3824 | lq_sta->active_tbl == i ? "*" : "x", |
3788 | rate->type, | 3825 | rate->type, |
3789 | rate->sgi, | 3826 | rate->sgi, |
3790 | is_ht20(rate) ? "20Mhz" : | 3827 | is_ht20(rate) ? "20MHz" : |
3791 | is_ht40(rate) ? "40Mhz" : | 3828 | is_ht40(rate) ? "40MHz" : |
3792 | is_ht80(rate) ? "80Mhz" : "ERR", | 3829 | is_ht80(rate) ? "80MHz" : |
3830 | is_ht160(rate) ? "160MHz" : "ERR", | ||
3793 | rate->index); | 3831 | rate->index); |
3794 | for (j = 0; j < IWL_RATE_COUNT; j++) { | 3832 | for (j = 0; j < IWL_RATE_COUNT; j++) { |
3795 | desc += sprintf(buff+desc, | 3833 | desc += sprintf(buff+desc, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h index 90d046fb24a0..ee207f2c0a90 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h | |||
@@ -205,6 +205,7 @@ struct rs_rate { | |||
205 | #define is_ht20(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_20) | 205 | #define is_ht20(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_20) |
206 | #define is_ht40(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_40) | 206 | #define is_ht40(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_40) |
207 | #define is_ht80(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_80) | 207 | #define is_ht80(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_80) |
208 | #define is_ht160(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_160) | ||
208 | 209 | ||
209 | #define IWL_MAX_MCS_DISPLAY_SIZE 12 | 210 | #define IWL_MAX_MCS_DISPLAY_SIZE 12 |
210 | 211 | ||
@@ -362,7 +363,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
362 | 363 | ||
363 | /* Notify RS about Tx status */ | 364 | /* Notify RS about Tx status */ |
364 | void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 365 | void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
365 | int tid, struct ieee80211_tx_info *info); | 366 | int tid, struct ieee80211_tx_info *info, bool ndp); |
366 | 367 | ||
367 | /** | 368 | /** |
368 | * iwl_rate_control_register - Register the rate control algorithm callbacks | 369 | * iwl_rate_control_register - Register the rate control algorithm callbacks |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index ab7f7eda9c13..0e60e38b2acf 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c | |||
@@ -101,7 +101,7 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, | |||
101 | struct napi_struct *napi, | 101 | struct napi_struct *napi, |
102 | struct sk_buff *skb, | 102 | struct sk_buff *skb, |
103 | struct ieee80211_hdr *hdr, u16 len, | 103 | struct ieee80211_hdr *hdr, u16 len, |
104 | u32 ampdu_status, u8 crypt_len, | 104 | u8 crypt_len, |
105 | struct iwl_rx_cmd_buffer *rxb) | 105 | struct iwl_rx_cmd_buffer *rxb) |
106 | { | 106 | { |
107 | unsigned int hdrlen, fraglen; | 107 | unsigned int hdrlen, fraglen; |
@@ -268,7 +268,6 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
268 | struct ieee80211_sta *sta = NULL; | 268 | struct ieee80211_sta *sta = NULL; |
269 | struct sk_buff *skb; | 269 | struct sk_buff *skb; |
270 | u32 len; | 270 | u32 len; |
271 | u32 ampdu_status; | ||
272 | u32 rate_n_flags; | 271 | u32 rate_n_flags; |
273 | u32 rx_pkt_status; | 272 | u32 rx_pkt_status; |
274 | u8 crypt_len = 0; | 273 | u8 crypt_len = 0; |
@@ -354,13 +353,22 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
354 | 353 | ||
355 | if (sta) { | 354 | if (sta) { |
356 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | 355 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
356 | struct ieee80211_vif *tx_blocked_vif = | ||
357 | rcu_dereference(mvm->csa_tx_blocked_vif); | ||
357 | 358 | ||
358 | /* We have tx blocked stations (with CS bit). If we heard | 359 | /* We have tx blocked stations (with CS bit). If we heard |
359 | * frames from a blocked station on a new channel we can | 360 | * frames from a blocked station on a new channel we can |
360 | * TX to it again. | 361 | * TX to it again. |
361 | */ | 362 | */ |
362 | if (unlikely(mvm->csa_tx_block_bcn_timeout)) | 363 | if (unlikely(tx_blocked_vif) && |
363 | iwl_mvm_sta_modify_disable_tx_ap(mvm, sta, false); | 364 | mvmsta->vif == tx_blocked_vif) { |
365 | struct iwl_mvm_vif *mvmvif = | ||
366 | iwl_mvm_vif_from_mac80211(tx_blocked_vif); | ||
367 | |||
368 | if (mvmvif->csa_target_freq == rx_status->freq) | ||
369 | iwl_mvm_sta_modify_disable_tx_ap(mvm, sta, | ||
370 | false); | ||
371 | } | ||
364 | 372 | ||
365 | rs_update_last_rssi(mvm, &mvmsta->lq_sta, rx_status); | 373 | rs_update_last_rssi(mvm, &mvmsta->lq_sta, rx_status); |
366 | 374 | ||
@@ -471,7 +479,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
471 | iwl_mvm_ref(mvm, IWL_MVM_REF_RX); | 479 | iwl_mvm_ref(mvm, IWL_MVM_REF_RX); |
472 | 480 | ||
473 | iwl_mvm_pass_packet_to_mac80211(mvm, sta, napi, skb, hdr, len, | 481 | iwl_mvm_pass_packet_to_mac80211(mvm, sta, napi, skb, hdr, len, |
474 | ampdu_status, crypt_len, rxb); | 482 | crypt_len, rxb); |
475 | 483 | ||
476 | if (take_ref) | 484 | if (take_ref) |
477 | iwl_mvm_unref(mvm, IWL_MVM_REF_RX); | 485 | iwl_mvm_unref(mvm, IWL_MVM_REF_RX); |
@@ -490,6 +498,7 @@ struct iwl_mvm_stat_data { | |||
490 | __le32 mac_id; | 498 | __le32 mac_id; |
491 | u8 beacon_filter_average_energy; | 499 | u8 beacon_filter_average_energy; |
492 | struct mvm_statistics_general_v8 *general; | 500 | struct mvm_statistics_general_v8 *general; |
501 | struct mvm_statistics_load *load; | ||
493 | }; | 502 | }; |
494 | 503 | ||
495 | static void iwl_mvm_stat_iterator(void *_data, u8 *mac, | 504 | static void iwl_mvm_stat_iterator(void *_data, u8 *mac, |
@@ -606,13 +615,15 @@ iwl_mvm_rx_stats_check_trigger(struct iwl_mvm *mvm, struct iwl_rx_packet *pkt) | |||
606 | void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm, | 615 | void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm, |
607 | struct iwl_rx_packet *pkt) | 616 | struct iwl_rx_packet *pkt) |
608 | { | 617 | { |
609 | struct iwl_notif_statistics_v10 *stats = (void *)&pkt->data; | 618 | struct iwl_notif_statistics_v11 *stats = (void *)&pkt->data; |
610 | struct iwl_mvm_stat_data data = { | 619 | struct iwl_mvm_stat_data data = { |
611 | .mvm = mvm, | 620 | .mvm = mvm, |
612 | }; | 621 | }; |
622 | int expected_size = iwl_mvm_has_new_rx_api(mvm) ? sizeof(*stats) : | ||
623 | sizeof(struct iwl_notif_statistics_v10); | ||
613 | u32 temperature; | 624 | u32 temperature; |
614 | 625 | ||
615 | if (iwl_rx_packet_payload_len(pkt) != sizeof(*stats)) | 626 | if (iwl_rx_packet_payload_len(pkt) != expected_size) |
616 | goto invalid; | 627 | goto invalid; |
617 | 628 | ||
618 | temperature = le32_to_cpu(stats->general.radio_temperature); | 629 | temperature = le32_to_cpu(stats->general.radio_temperature); |
@@ -630,6 +641,25 @@ void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm, | |||
630 | le64_to_cpu(stats->general.on_time_scan); | 641 | le64_to_cpu(stats->general.on_time_scan); |
631 | 642 | ||
632 | data.general = &stats->general; | 643 | data.general = &stats->general; |
644 | if (iwl_mvm_has_new_rx_api(mvm)) { | ||
645 | int i; | ||
646 | |||
647 | data.load = &stats->load_stats; | ||
648 | |||
649 | rcu_read_lock(); | ||
650 | for (i = 0; i < IWL_MVM_STATION_COUNT; i++) { | ||
651 | struct iwl_mvm_sta *sta; | ||
652 | |||
653 | if (!data.load->avg_energy[i]) | ||
654 | continue; | ||
655 | |||
656 | sta = iwl_mvm_sta_from_staid_rcu(mvm, i); | ||
657 | if (!sta) | ||
658 | continue; | ||
659 | sta->avg_energy = data.load->avg_energy[i]; | ||
660 | } | ||
661 | rcu_read_unlock(); | ||
662 | } | ||
633 | 663 | ||
634 | iwl_mvm_rx_stats_check_trigger(mvm, pkt); | 664 | iwl_mvm_rx_stats_check_trigger(mvm, pkt); |
635 | 665 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c index 2c61516d06ff..df6c32caa5f0 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | |||
@@ -65,19 +65,6 @@ | |||
65 | #include "fw-api.h" | 65 | #include "fw-api.h" |
66 | #include "fw-dbg.h" | 66 | #include "fw-dbg.h" |
67 | 67 | ||
68 | void iwl_mvm_rx_phy_cmd_mq(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) | ||
69 | { | ||
70 | mvm->ampdu_ref++; | ||
71 | |||
72 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
73 | if (mvm->last_phy_info.phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_AGG)) { | ||
74 | spin_lock(&mvm->drv_stats_lock); | ||
75 | mvm->drv_rx_stats.ampdu_count++; | ||
76 | spin_unlock(&mvm->drv_stats_lock); | ||
77 | } | ||
78 | #endif | ||
79 | } | ||
80 | |||
81 | static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb, | 68 | static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb, |
82 | int queue, struct ieee80211_sta *sta) | 69 | int queue, struct ieee80211_sta *sta) |
83 | { | 70 | { |
@@ -489,6 +476,9 @@ void iwl_mvm_reorder_timer_expired(unsigned long data) | |||
489 | rcu_read_lock(); | 476 | rcu_read_lock(); |
490 | sta = rcu_dereference(buf->mvm->fw_id_to_mac_id[buf->sta_id]); | 477 | sta = rcu_dereference(buf->mvm->fw_id_to_mac_id[buf->sta_id]); |
491 | /* SN is set to the last expired frame + 1 */ | 478 | /* SN is set to the last expired frame + 1 */ |
479 | IWL_DEBUG_HT(buf->mvm, | ||
480 | "Releasing expired frames for sta %u, sn %d\n", | ||
481 | buf->sta_id, sn); | ||
492 | iwl_mvm_release_frames(buf->mvm, sta, NULL, buf, sn); | 482 | iwl_mvm_release_frames(buf->mvm, sta, NULL, buf, sn); |
493 | rcu_read_unlock(); | 483 | rcu_read_unlock(); |
494 | } else if (buf->num_stored) { | 484 | } else if (buf->num_stored) { |
@@ -587,6 +577,8 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, | |||
587 | struct sk_buff *tail; | 577 | struct sk_buff *tail; |
588 | u32 reorder = le32_to_cpu(desc->reorder_data); | 578 | u32 reorder = le32_to_cpu(desc->reorder_data); |
589 | bool amsdu = desc->mac_flags2 & IWL_RX_MPDU_MFLG2_AMSDU; | 579 | bool amsdu = desc->mac_flags2 & IWL_RX_MPDU_MFLG2_AMSDU; |
580 | bool last_subframe = | ||
581 | desc->amsdu_info & IWL_RX_MPDU_AMSDU_LAST_SUBFRAME; | ||
590 | u8 tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; | 582 | u8 tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; |
591 | u8 sub_frame_idx = desc->amsdu_info & | 583 | u8 sub_frame_idx = desc->amsdu_info & |
592 | IWL_RX_MPDU_AMSDU_SUBFRAME_IDX_MASK; | 584 | IWL_RX_MPDU_AMSDU_SUBFRAME_IDX_MASK; |
@@ -653,7 +645,8 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, | |||
653 | /* release immediately if allowed by nssn and no stored frames */ | 645 | /* release immediately if allowed by nssn and no stored frames */ |
654 | if (!buffer->num_stored && ieee80211_sn_less(sn, nssn)) { | 646 | if (!buffer->num_stored && ieee80211_sn_less(sn, nssn)) { |
655 | if (iwl_mvm_is_sn_less(buffer->head_sn, nssn, | 647 | if (iwl_mvm_is_sn_less(buffer->head_sn, nssn, |
656 | buffer->buf_size)) | 648 | buffer->buf_size) && |
649 | (!amsdu || last_subframe)) | ||
657 | buffer->head_sn = nssn; | 650 | buffer->head_sn = nssn; |
658 | /* No need to update AMSDU last SN - we are moving the head */ | 651 | /* No need to update AMSDU last SN - we are moving the head */ |
659 | spin_unlock_bh(&buffer->lock); | 652 | spin_unlock_bh(&buffer->lock); |
@@ -687,7 +680,20 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, | |||
687 | buffer->last_sub_index = sub_frame_idx; | 680 | buffer->last_sub_index = sub_frame_idx; |
688 | } | 681 | } |
689 | 682 | ||
690 | iwl_mvm_release_frames(mvm, sta, napi, buffer, nssn); | 683 | /* |
684 | * We cannot trust NSSN for AMSDU sub-frames that are not the last. | ||
685 | * The reason is that NSSN advances on the first sub-frame, and may | ||
686 | * cause the reorder buffer to advance before all the sub-frames arrive. | ||
687 | * Example: reorder buffer contains SN 0 & 2, and we receive AMSDU with | ||
688 | * SN 1. NSSN for first sub frame will be 3 with the result of driver | ||
689 | * releasing SN 0,1, 2. When sub-frame 1 arrives - reorder buffer is | ||
690 | * already ahead and it will be dropped. | ||
691 | * If the last sub-frame is not on this queue - we will get frame | ||
692 | * release notification with up to date NSSN. | ||
693 | */ | ||
694 | if (!amsdu || last_subframe) | ||
695 | iwl_mvm_release_frames(mvm, sta, napi, buffer, nssn); | ||
696 | |||
691 | spin_unlock_bh(&buffer->lock); | 697 | spin_unlock_bh(&buffer->lock); |
692 | return true; | 698 | return true; |
693 | 699 | ||
@@ -736,6 +742,7 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
736 | struct ieee80211_hdr *hdr = (void *)(pkt->data + sizeof(*desc)); | 742 | struct ieee80211_hdr *hdr = (void *)(pkt->data + sizeof(*desc)); |
737 | u32 len = le16_to_cpu(desc->mpdu_len); | 743 | u32 len = le16_to_cpu(desc->mpdu_len); |
738 | u32 rate_n_flags = le32_to_cpu(desc->rate_n_flags); | 744 | u32 rate_n_flags = le32_to_cpu(desc->rate_n_flags); |
745 | u16 phy_info = le16_to_cpu(desc->phy_info); | ||
739 | struct ieee80211_sta *sta = NULL; | 746 | struct ieee80211_sta *sta = NULL; |
740 | struct sk_buff *skb; | 747 | struct sk_buff *skb; |
741 | u8 crypt_len = 0; | 748 | u8 crypt_len = 0; |
@@ -766,16 +773,34 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
766 | le16_to_cpu(desc->status)); | 773 | le16_to_cpu(desc->status)); |
767 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; | 774 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; |
768 | } | 775 | } |
769 | 776 | /* set the preamble flag if appropriate */ | |
770 | rx_status->mactime = le64_to_cpu(desc->tsf_on_air_rise); | 777 | if (phy_info & IWL_RX_MPDU_PHY_SHORT_PREAMBLE) |
778 | rx_status->flag |= RX_FLAG_SHORTPRE; | ||
779 | |||
780 | if (likely(!(phy_info & IWL_RX_MPDU_PHY_TSF_OVERLOAD))) { | ||
781 | rx_status->mactime = le64_to_cpu(desc->tsf_on_air_rise); | ||
782 | /* TSF as indicated by the firmware is at INA time */ | ||
783 | rx_status->flag |= RX_FLAG_MACTIME_PLCP_START; | ||
784 | } | ||
771 | rx_status->device_timestamp = le32_to_cpu(desc->gp2_on_air_rise); | 785 | rx_status->device_timestamp = le32_to_cpu(desc->gp2_on_air_rise); |
772 | rx_status->band = desc->channel > 14 ? NL80211_BAND_5GHZ : | 786 | rx_status->band = desc->channel > 14 ? NL80211_BAND_5GHZ : |
773 | NL80211_BAND_2GHZ; | 787 | NL80211_BAND_2GHZ; |
774 | rx_status->freq = ieee80211_channel_to_frequency(desc->channel, | 788 | rx_status->freq = ieee80211_channel_to_frequency(desc->channel, |
775 | rx_status->band); | 789 | rx_status->band); |
776 | iwl_mvm_get_signal_strength(mvm, desc, rx_status); | 790 | iwl_mvm_get_signal_strength(mvm, desc, rx_status); |
777 | /* TSF as indicated by the firmware is at INA time */ | 791 | |
778 | rx_status->flag |= RX_FLAG_MACTIME_PLCP_START; | 792 | /* update aggregation data for monitor sake on default queue */ |
793 | if (!queue && (phy_info & IWL_RX_MPDU_PHY_AMPDU)) { | ||
794 | bool toggle_bit = phy_info & IWL_RX_MPDU_PHY_AMPDU_TOGGLE; | ||
795 | |||
796 | rx_status->flag |= RX_FLAG_AMPDU_DETAILS; | ||
797 | rx_status->ampdu_reference = mvm->ampdu_ref; | ||
798 | /* toggle is switched whenever new aggregation starts */ | ||
799 | if (toggle_bit != mvm->ampdu_toggle) { | ||
800 | mvm->ampdu_ref++; | ||
801 | mvm->ampdu_toggle = toggle_bit; | ||
802 | } | ||
803 | } | ||
779 | 804 | ||
780 | rcu_read_lock(); | 805 | rcu_read_lock(); |
781 | 806 | ||
@@ -797,6 +822,8 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
797 | 822 | ||
798 | if (sta) { | 823 | if (sta) { |
799 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | 824 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
825 | struct ieee80211_vif *tx_blocked_vif = | ||
826 | rcu_dereference(mvm->csa_tx_blocked_vif); | ||
800 | u8 baid = (u8)((le32_to_cpu(desc->reorder_data) & | 827 | u8 baid = (u8)((le32_to_cpu(desc->reorder_data) & |
801 | IWL_RX_MPDU_REORDER_BAID_MASK) >> | 828 | IWL_RX_MPDU_REORDER_BAID_MASK) >> |
802 | IWL_RX_MPDU_REORDER_BAID_SHIFT); | 829 | IWL_RX_MPDU_REORDER_BAID_SHIFT); |
@@ -806,8 +833,15 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
806 | * frames from a blocked station on a new channel we can | 833 | * frames from a blocked station on a new channel we can |
807 | * TX to it again. | 834 | * TX to it again. |
808 | */ | 835 | */ |
809 | if (unlikely(mvm->csa_tx_block_bcn_timeout)) | 836 | if (unlikely(tx_blocked_vif) && |
810 | iwl_mvm_sta_modify_disable_tx_ap(mvm, sta, false); | 837 | tx_blocked_vif == mvmsta->vif) { |
838 | struct iwl_mvm_vif *mvmvif = | ||
839 | iwl_mvm_vif_from_mac80211(tx_blocked_vif); | ||
840 | |||
841 | if (mvmvif->csa_target_freq == rx_status->freq) | ||
842 | iwl_mvm_sta_modify_disable_tx_ap(mvm, sta, | ||
843 | false); | ||
844 | } | ||
811 | 845 | ||
812 | rs_update_last_rssi(mvm, &mvmsta->lq_sta, rx_status); | 846 | rs_update_last_rssi(mvm, &mvmsta->lq_sta, rx_status); |
813 | 847 | ||
@@ -830,8 +864,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
830 | iwl_mvm_fw_dbg_collect_trig(mvm, trig, NULL); | 864 | iwl_mvm_fw_dbg_collect_trig(mvm, trig, NULL); |
831 | } | 865 | } |
832 | 866 | ||
833 | /* TODO: multi queue TCM */ | ||
834 | |||
835 | if (ieee80211_is_data(hdr->frame_control)) | 867 | if (ieee80211_is_data(hdr->frame_control)) |
836 | iwl_mvm_rx_csum(sta, skb, desc); | 868 | iwl_mvm_rx_csum(sta, skb, desc); |
837 | 869 | ||
@@ -856,14 +888,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
856 | iwl_mvm_agg_rx_received(mvm, baid); | 888 | iwl_mvm_agg_rx_received(mvm, baid); |
857 | } | 889 | } |
858 | 890 | ||
859 | /* | ||
860 | * TODO: PHY info. | ||
861 | * Verify we don't have the information in the MPDU descriptor and | ||
862 | * that it is not needed. | ||
863 | * Make sure for monitor mode that we are on default queue, update | ||
864 | * ampdu_ref and the rest of phy info then | ||
865 | */ | ||
866 | |||
867 | /* Set up the HT phy flags */ | 891 | /* Set up the HT phy flags */ |
868 | switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) { | 892 | switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) { |
869 | case RATE_MCS_CHAN_WIDTH_20: | 893 | case RATE_MCS_CHAN_WIDTH_20: |
@@ -907,8 +931,18 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
907 | rx_status->band); | 931 | rx_status->band); |
908 | } | 932 | } |
909 | 933 | ||
910 | /* TODO: PHY info - update ampdu queue statistics (for debugfs) */ | 934 | /* management stuff on default queue */ |
911 | /* TODO: PHY info - gscan */ | 935 | if (!queue) { |
936 | if (unlikely((ieee80211_is_beacon(hdr->frame_control) || | ||
937 | ieee80211_is_probe_resp(hdr->frame_control)) && | ||
938 | mvm->sched_scan_pass_all == | ||
939 | SCHED_SCAN_PASS_ALL_ENABLED)) | ||
940 | mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_FOUND; | ||
941 | |||
942 | if (unlikely(ieee80211_is_beacon(hdr->frame_control) || | ||
943 | ieee80211_is_probe_resp(hdr->frame_control))) | ||
944 | rx_status->boottime_ns = ktime_get_boot_ns(); | ||
945 | } | ||
912 | 946 | ||
913 | iwl_mvm_create_skb(skb, hdr, len, crypt_len, rxb); | 947 | iwl_mvm_create_skb(skb, hdr, len, crypt_len, rxb); |
914 | if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc)) | 948 | if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc)) |
@@ -927,6 +961,9 @@ void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
927 | 961 | ||
928 | int baid = release->baid; | 962 | int baid = release->baid; |
929 | 963 | ||
964 | IWL_DEBUG_HT(mvm, "Frame release notification for BAID %u, NSSN %d\n", | ||
965 | release->baid, le16_to_cpu(release->nssn)); | ||
966 | |||
930 | if (WARN_ON_ONCE(baid == IWL_RX_REORDER_DATA_INVALID_BAID)) | 967 | if (WARN_ON_ONCE(baid == IWL_RX_REORDER_DATA_INVALID_BAID)) |
931 | return; | 968 | return; |
932 | 969 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 1cac10c5d818..dac120f8861b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c | |||
@@ -402,7 +402,7 @@ void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm, | |||
402 | mvm->scan_status &= ~IWL_MVM_SCAN_REGULAR; | 402 | mvm->scan_status &= ~IWL_MVM_SCAN_REGULAR; |
403 | ieee80211_scan_completed(mvm->hw, &info); | 403 | ieee80211_scan_completed(mvm->hw, &info); |
404 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | 404 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); |
405 | del_timer(&mvm->scan_timer); | 405 | cancel_delayed_work(&mvm->scan_timeout_dwork); |
406 | } else { | 406 | } else { |
407 | IWL_ERR(mvm, | 407 | IWL_ERR(mvm, |
408 | "got scan complete notification but no scan is running\n"); | 408 | "got scan complete notification but no scan is running\n"); |
@@ -1225,15 +1225,16 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) | |||
1225 | return -EIO; | 1225 | return -EIO; |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | #define SCAN_TIMEOUT (20 * HZ) | 1228 | #define SCAN_TIMEOUT 20000 |
1229 | 1229 | ||
1230 | void iwl_mvm_scan_timeout(unsigned long data) | 1230 | void iwl_mvm_scan_timeout_wk(struct work_struct *work) |
1231 | { | 1231 | { |
1232 | struct iwl_mvm *mvm = (struct iwl_mvm *)data; | 1232 | struct delayed_work *delayed_work = to_delayed_work(work); |
1233 | struct iwl_mvm *mvm = container_of(delayed_work, struct iwl_mvm, | ||
1234 | scan_timeout_dwork); | ||
1233 | 1235 | ||
1234 | IWL_ERR(mvm, "regular scan timed out\n"); | 1236 | IWL_ERR(mvm, "regular scan timed out\n"); |
1235 | 1237 | ||
1236 | del_timer(&mvm->scan_timer); | ||
1237 | iwl_force_nmi(mvm->trans); | 1238 | iwl_force_nmi(mvm->trans); |
1238 | } | 1239 | } |
1239 | 1240 | ||
@@ -1316,7 +1317,8 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
1316 | mvm->scan_status |= IWL_MVM_SCAN_REGULAR; | 1317 | mvm->scan_status |= IWL_MVM_SCAN_REGULAR; |
1317 | iwl_mvm_ref(mvm, IWL_MVM_REF_SCAN); | 1318 | iwl_mvm_ref(mvm, IWL_MVM_REF_SCAN); |
1318 | 1319 | ||
1319 | mod_timer(&mvm->scan_timer, jiffies + SCAN_TIMEOUT); | 1320 | queue_delayed_work(system_wq, &mvm->scan_timeout_dwork, |
1321 | msecs_to_jiffies(SCAN_TIMEOUT)); | ||
1320 | 1322 | ||
1321 | return 0; | 1323 | return 0; |
1322 | } | 1324 | } |
@@ -1439,7 +1441,7 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, | |||
1439 | 1441 | ||
1440 | ieee80211_scan_completed(mvm->hw, &info); | 1442 | ieee80211_scan_completed(mvm->hw, &info); |
1441 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | 1443 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); |
1442 | del_timer(&mvm->scan_timer); | 1444 | cancel_delayed_work(&mvm->scan_timeout_dwork); |
1443 | } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) { | 1445 | } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) { |
1444 | ieee80211_sched_scan_stopped(mvm->hw); | 1446 | ieee80211_sched_scan_stopped(mvm->hw); |
1445 | mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; | 1447 | mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; |
@@ -1644,7 +1646,7 @@ out: | |||
1644 | * to release the scan reference here. | 1646 | * to release the scan reference here. |
1645 | */ | 1647 | */ |
1646 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | 1648 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); |
1647 | del_timer(&mvm->scan_timer); | 1649 | cancel_delayed_work(&mvm->scan_timeout_dwork); |
1648 | if (notify) { | 1650 | if (notify) { |
1649 | struct cfg80211_scan_info info = { | 1651 | struct cfg80211_scan_info info = { |
1650 | .aborted = true, | 1652 | .aborted = true, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sf.c b/drivers/net/wireless/intel/iwlwifi/mvm/sf.c index 443a42855c9e..101fb04a8573 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sf.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sf.c | |||
@@ -215,7 +215,7 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, | |||
215 | enum iwl_sf_state new_state) | 215 | enum iwl_sf_state new_state) |
216 | { | 216 | { |
217 | struct iwl_sf_cfg_cmd sf_cmd = { | 217 | struct iwl_sf_cfg_cmd sf_cmd = { |
218 | .state = cpu_to_le32(SF_FULL_ON), | 218 | .state = cpu_to_le32(new_state), |
219 | }; | 219 | }; |
220 | struct ieee80211_sta *sta; | 220 | struct ieee80211_sta *sta; |
221 | int ret = 0; | 221 | int ret = 0; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index b23ab4a4504f..3130b9c68a74 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | |||
@@ -310,6 +310,304 @@ static void iwl_mvm_tdls_sta_deinit(struct iwl_mvm *mvm, | |||
310 | iwl_mvm_disable_txq(mvm, i, i, IWL_MAX_TID_COUNT, 0); | 310 | iwl_mvm_disable_txq(mvm, i, i, IWL_MAX_TID_COUNT, 0); |
311 | } | 311 | } |
312 | 312 | ||
313 | /* Disable aggregations for a bitmap of TIDs for a given station */ | ||
314 | static int iwl_mvm_invalidate_sta_queue(struct iwl_mvm *mvm, int queue, | ||
315 | unsigned long disable_agg_tids, | ||
316 | bool remove_queue) | ||
317 | { | ||
318 | struct iwl_mvm_add_sta_cmd cmd = {}; | ||
319 | struct ieee80211_sta *sta; | ||
320 | struct iwl_mvm_sta *mvmsta; | ||
321 | u32 status; | ||
322 | u8 sta_id; | ||
323 | int ret; | ||
324 | |||
325 | spin_lock_bh(&mvm->queue_info_lock); | ||
326 | sta_id = mvm->queue_info[queue].ra_sta_id; | ||
327 | spin_unlock_bh(&mvm->queue_info_lock); | ||
328 | |||
329 | rcu_read_lock(); | ||
330 | |||
331 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); | ||
332 | |||
333 | if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) { | ||
334 | rcu_read_unlock(); | ||
335 | return -EINVAL; | ||
336 | } | ||
337 | |||
338 | mvmsta = iwl_mvm_sta_from_mac80211(sta); | ||
339 | |||
340 | mvmsta->tid_disable_agg |= disable_agg_tids; | ||
341 | |||
342 | cmd.mac_id_n_color = cpu_to_le32(mvmsta->mac_id_n_color); | ||
343 | cmd.sta_id = mvmsta->sta_id; | ||
344 | cmd.add_modify = STA_MODE_MODIFY; | ||
345 | cmd.modify_mask = STA_MODIFY_QUEUES; | ||
346 | if (disable_agg_tids) | ||
347 | cmd.modify_mask |= STA_MODIFY_TID_DISABLE_TX; | ||
348 | if (remove_queue) | ||
349 | cmd.modify_mask |= STA_MODIFY_QUEUE_REMOVAL; | ||
350 | cmd.tfd_queue_msk = cpu_to_le32(mvmsta->tfd_queue_msk); | ||
351 | cmd.tid_disable_tx = cpu_to_le16(mvmsta->tid_disable_agg); | ||
352 | |||
353 | rcu_read_unlock(); | ||
354 | |||
355 | /* Notify FW of queue removal from the STA queues */ | ||
356 | status = ADD_STA_SUCCESS; | ||
357 | ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, | ||
358 | iwl_mvm_add_sta_cmd_size(mvm), | ||
359 | &cmd, &status); | ||
360 | |||
361 | return ret; | ||
362 | } | ||
363 | |||
364 | static int iwl_mvm_get_queue_agg_tids(struct iwl_mvm *mvm, int queue) | ||
365 | { | ||
366 | struct ieee80211_sta *sta; | ||
367 | struct iwl_mvm_sta *mvmsta; | ||
368 | unsigned long tid_bitmap; | ||
369 | unsigned long agg_tids = 0; | ||
370 | s8 sta_id; | ||
371 | int tid; | ||
372 | |||
373 | lockdep_assert_held(&mvm->mutex); | ||
374 | |||
375 | spin_lock_bh(&mvm->queue_info_lock); | ||
376 | sta_id = mvm->queue_info[queue].ra_sta_id; | ||
377 | tid_bitmap = mvm->queue_info[queue].tid_bitmap; | ||
378 | spin_unlock_bh(&mvm->queue_info_lock); | ||
379 | |||
380 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], | ||
381 | lockdep_is_held(&mvm->mutex)); | ||
382 | |||
383 | if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) | ||
384 | return -EINVAL; | ||
385 | |||
386 | mvmsta = iwl_mvm_sta_from_mac80211(sta); | ||
387 | |||
388 | spin_lock_bh(&mvmsta->lock); | ||
389 | for_each_set_bit(tid, &tid_bitmap, IWL_MAX_TID_COUNT + 1) { | ||
390 | if (mvmsta->tid_data[tid].state == IWL_AGG_ON) | ||
391 | agg_tids |= BIT(tid); | ||
392 | } | ||
393 | spin_unlock_bh(&mvmsta->lock); | ||
394 | |||
395 | return agg_tids; | ||
396 | } | ||
397 | |||
398 | /* | ||
399 | * Remove a queue from a station's resources. | ||
400 | * Note that this only marks as free. It DOESN'T delete a BA agreement, and | ||
401 | * doesn't disable the queue | ||
402 | */ | ||
403 | static int iwl_mvm_remove_sta_queue_marking(struct iwl_mvm *mvm, int queue) | ||
404 | { | ||
405 | struct ieee80211_sta *sta; | ||
406 | struct iwl_mvm_sta *mvmsta; | ||
407 | unsigned long tid_bitmap; | ||
408 | unsigned long disable_agg_tids = 0; | ||
409 | u8 sta_id; | ||
410 | int tid; | ||
411 | |||
412 | lockdep_assert_held(&mvm->mutex); | ||
413 | |||
414 | spin_lock_bh(&mvm->queue_info_lock); | ||
415 | sta_id = mvm->queue_info[queue].ra_sta_id; | ||
416 | tid_bitmap = mvm->queue_info[queue].tid_bitmap; | ||
417 | spin_unlock_bh(&mvm->queue_info_lock); | ||
418 | |||
419 | rcu_read_lock(); | ||
420 | |||
421 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); | ||
422 | |||
423 | if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) { | ||
424 | rcu_read_unlock(); | ||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | mvmsta = iwl_mvm_sta_from_mac80211(sta); | ||
429 | |||
430 | spin_lock_bh(&mvmsta->lock); | ||
431 | /* Unmap MAC queues and TIDs from this queue */ | ||
432 | for_each_set_bit(tid, &tid_bitmap, IWL_MAX_TID_COUNT + 1) { | ||
433 | if (mvmsta->tid_data[tid].state == IWL_AGG_ON) | ||
434 | disable_agg_tids |= BIT(tid); | ||
435 | mvmsta->tid_data[tid].txq_id = IEEE80211_INVAL_HW_QUEUE; | ||
436 | } | ||
437 | |||
438 | mvmsta->tfd_queue_msk &= ~BIT(queue); /* Don't use this queue anymore */ | ||
439 | spin_unlock_bh(&mvmsta->lock); | ||
440 | |||
441 | rcu_read_unlock(); | ||
442 | |||
443 | spin_lock_bh(&mvm->queue_info_lock); | ||
444 | /* Unmap MAC queues and TIDs from this queue */ | ||
445 | mvm->queue_info[queue].hw_queue_to_mac80211 = 0; | ||
446 | mvm->queue_info[queue].hw_queue_refcount = 0; | ||
447 | mvm->queue_info[queue].tid_bitmap = 0; | ||
448 | spin_unlock_bh(&mvm->queue_info_lock); | ||
449 | |||
450 | return disable_agg_tids; | ||
451 | } | ||
452 | |||
453 | static int iwl_mvm_get_shared_queue(struct iwl_mvm *mvm, | ||
454 | unsigned long tfd_queue_mask, u8 ac) | ||
455 | { | ||
456 | int queue = 0; | ||
457 | u8 ac_to_queue[IEEE80211_NUM_ACS]; | ||
458 | int i; | ||
459 | |||
460 | lockdep_assert_held(&mvm->queue_info_lock); | ||
461 | |||
462 | memset(&ac_to_queue, IEEE80211_INVAL_HW_QUEUE, sizeof(ac_to_queue)); | ||
463 | |||
464 | /* See what ACs the existing queues for this STA have */ | ||
465 | for_each_set_bit(i, &tfd_queue_mask, IWL_MVM_DQA_MAX_DATA_QUEUE) { | ||
466 | /* Only DATA queues can be shared */ | ||
467 | if (i < IWL_MVM_DQA_MIN_DATA_QUEUE && | ||
468 | i != IWL_MVM_DQA_BSS_CLIENT_QUEUE) | ||
469 | continue; | ||
470 | |||
471 | ac_to_queue[mvm->queue_info[i].mac80211_ac] = i; | ||
472 | } | ||
473 | |||
474 | /* | ||
475 | * The queue to share is chosen only from DATA queues as follows (in | ||
476 | * descending priority): | ||
477 | * 1. An AC_BE queue | ||
478 | * 2. Same AC queue | ||
479 | * 3. Highest AC queue that is lower than new AC | ||
480 | * 4. Any existing AC (there always is at least 1 DATA queue) | ||
481 | */ | ||
482 | |||
483 | /* Priority 1: An AC_BE queue */ | ||
484 | if (ac_to_queue[IEEE80211_AC_BE] != IEEE80211_INVAL_HW_QUEUE) | ||
485 | queue = ac_to_queue[IEEE80211_AC_BE]; | ||
486 | /* Priority 2: Same AC queue */ | ||
487 | else if (ac_to_queue[ac] != IEEE80211_INVAL_HW_QUEUE) | ||
488 | queue = ac_to_queue[ac]; | ||
489 | /* Priority 3a: If new AC is VO and VI exists - use VI */ | ||
490 | else if (ac == IEEE80211_AC_VO && | ||
491 | ac_to_queue[IEEE80211_AC_VI] != IEEE80211_INVAL_HW_QUEUE) | ||
492 | queue = ac_to_queue[IEEE80211_AC_VI]; | ||
493 | /* Priority 3b: No BE so only AC less than the new one is BK */ | ||
494 | else if (ac_to_queue[IEEE80211_AC_BK] != IEEE80211_INVAL_HW_QUEUE) | ||
495 | queue = ac_to_queue[IEEE80211_AC_BK]; | ||
496 | /* Priority 4a: No BE nor BK - use VI if exists */ | ||
497 | else if (ac_to_queue[IEEE80211_AC_VI] != IEEE80211_INVAL_HW_QUEUE) | ||
498 | queue = ac_to_queue[IEEE80211_AC_VI]; | ||
499 | /* Priority 4b: No BE, BK nor VI - use VO if exists */ | ||
500 | else if (ac_to_queue[IEEE80211_AC_VO] != IEEE80211_INVAL_HW_QUEUE) | ||
501 | queue = ac_to_queue[IEEE80211_AC_VO]; | ||
502 | |||
503 | /* Make sure queue found (or not) is legal */ | ||
504 | if (!((queue >= IWL_MVM_DQA_MIN_MGMT_QUEUE && | ||
505 | queue <= IWL_MVM_DQA_MAX_MGMT_QUEUE) || | ||
506 | (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE && | ||
507 | queue <= IWL_MVM_DQA_MAX_DATA_QUEUE) || | ||
508 | (queue == IWL_MVM_DQA_BSS_CLIENT_QUEUE))) { | ||
509 | IWL_ERR(mvm, "No DATA queues available to share\n"); | ||
510 | queue = -ENOSPC; | ||
511 | } | ||
512 | |||
513 | return queue; | ||
514 | } | ||
515 | |||
516 | /* | ||
517 | * If a given queue has a higher AC than the TID stream that is being added to | ||
518 | * it, the queue needs to be redirected to the lower AC. This function does that | ||
519 | * in such a case, otherwise - if no redirection required - it does nothing, | ||
520 | * unless the %force param is true. | ||
521 | */ | ||
522 | static int iwl_mvm_scd_queue_redirect(struct iwl_mvm *mvm, int queue, int tid, | ||
523 | int ac, int ssn, unsigned int wdg_timeout, | ||
524 | bool force) | ||
525 | { | ||
526 | struct iwl_scd_txq_cfg_cmd cmd = { | ||
527 | .scd_queue = queue, | ||
528 | .enable = 0, | ||
529 | }; | ||
530 | bool shared_queue; | ||
531 | unsigned long mq; | ||
532 | int ret; | ||
533 | |||
534 | /* | ||
535 | * If the AC is lower than current one - FIFO needs to be redirected to | ||
536 | * the lowest one of the streams in the queue. Check if this is needed | ||
537 | * here. | ||
538 | * Notice that the enum ieee80211_ac_numbers is "flipped", so BK is with | ||
539 | * value 3 and VO with value 0, so to check if ac X is lower than ac Y | ||
540 | * we need to check if the numerical value of X is LARGER than of Y. | ||
541 | */ | ||
542 | spin_lock_bh(&mvm->queue_info_lock); | ||
543 | if (ac <= mvm->queue_info[queue].mac80211_ac && !force) { | ||
544 | spin_unlock_bh(&mvm->queue_info_lock); | ||
545 | |||
546 | IWL_DEBUG_TX_QUEUES(mvm, | ||
547 | "No redirection needed on TXQ #%d\n", | ||
548 | queue); | ||
549 | return 0; | ||
550 | } | ||
551 | |||
552 | cmd.sta_id = mvm->queue_info[queue].ra_sta_id; | ||
553 | cmd.tx_fifo = iwl_mvm_ac_to_tx_fifo[mvm->queue_info[queue].mac80211_ac]; | ||
554 | mq = mvm->queue_info[queue].hw_queue_to_mac80211; | ||
555 | shared_queue = (mvm->queue_info[queue].hw_queue_refcount > 1); | ||
556 | spin_unlock_bh(&mvm->queue_info_lock); | ||
557 | |||
558 | IWL_DEBUG_TX_QUEUES(mvm, "Redirecting shared TXQ #%d to FIFO #%d\n", | ||
559 | queue, iwl_mvm_ac_to_tx_fifo[ac]); | ||
560 | |||
561 | /* Stop MAC queues and wait for this queue to empty */ | ||
562 | iwl_mvm_stop_mac_queues(mvm, mq); | ||
563 | ret = iwl_trans_wait_tx_queue_empty(mvm->trans, BIT(queue)); | ||
564 | if (ret) { | ||
565 | IWL_ERR(mvm, "Error draining queue %d before reconfig\n", | ||
566 | queue); | ||
567 | ret = -EIO; | ||
568 | goto out; | ||
569 | } | ||
570 | |||
571 | /* Before redirecting the queue we need to de-activate it */ | ||
572 | iwl_trans_txq_disable(mvm->trans, queue, false); | ||
573 | ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), &cmd); | ||
574 | if (ret) | ||
575 | IWL_ERR(mvm, "Failed SCD disable TXQ %d (ret=%d)\n", queue, | ||
576 | ret); | ||
577 | |||
578 | /* Make sure the SCD wrptr is correctly set before reconfiguring */ | ||
579 | iwl_trans_txq_enable(mvm->trans, queue, iwl_mvm_ac_to_tx_fifo[ac], | ||
580 | cmd.sta_id, tid, LINK_QUAL_AGG_FRAME_LIMIT_DEF, | ||
581 | ssn, wdg_timeout); | ||
582 | |||
583 | /* TODO: Work-around SCD bug when moving back by multiples of 0x40 */ | ||
584 | |||
585 | /* Redirect to lower AC */ | ||
586 | iwl_mvm_reconfig_scd(mvm, queue, iwl_mvm_ac_to_tx_fifo[ac], | ||
587 | cmd.sta_id, tid, LINK_QUAL_AGG_FRAME_LIMIT_DEF, | ||
588 | ssn); | ||
589 | |||
590 | /* Update AC marking of the queue */ | ||
591 | spin_lock_bh(&mvm->queue_info_lock); | ||
592 | mvm->queue_info[queue].mac80211_ac = ac; | ||
593 | spin_unlock_bh(&mvm->queue_info_lock); | ||
594 | |||
595 | /* | ||
596 | * Mark queue as shared in transport if shared | ||
597 | * Note this has to be done after queue enablement because enablement | ||
598 | * can also set this value, and there is no indication there to shared | ||
599 | * queues | ||
600 | */ | ||
601 | if (shared_queue) | ||
602 | iwl_trans_txq_set_shared_mode(mvm->trans, queue, true); | ||
603 | |||
604 | out: | ||
605 | /* Continue using the MAC queues */ | ||
606 | iwl_mvm_start_mac_queues(mvm, mq); | ||
607 | |||
608 | return ret; | ||
609 | } | ||
610 | |||
313 | static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, | 611 | static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, |
314 | struct ieee80211_sta *sta, u8 ac, int tid, | 612 | struct ieee80211_sta *sta, u8 ac, int tid, |
315 | struct ieee80211_hdr *hdr) | 613 | struct ieee80211_hdr *hdr) |
@@ -325,11 +623,20 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, | |||
325 | iwl_mvm_get_wd_timeout(mvm, mvmsta->vif, false, false); | 623 | iwl_mvm_get_wd_timeout(mvm, mvmsta->vif, false, false); |
326 | u8 mac_queue = mvmsta->vif->hw_queue[ac]; | 624 | u8 mac_queue = mvmsta->vif->hw_queue[ac]; |
327 | int queue = -1; | 625 | int queue = -1; |
626 | bool using_inactive_queue = false; | ||
627 | unsigned long disable_agg_tids = 0; | ||
628 | enum iwl_mvm_agg_state queue_state; | ||
629 | bool shared_queue = false; | ||
328 | int ssn; | 630 | int ssn; |
631 | unsigned long tfd_queue_mask; | ||
329 | int ret; | 632 | int ret; |
330 | 633 | ||
331 | lockdep_assert_held(&mvm->mutex); | 634 | lockdep_assert_held(&mvm->mutex); |
332 | 635 | ||
636 | spin_lock_bh(&mvmsta->lock); | ||
637 | tfd_queue_mask = mvmsta->tfd_queue_msk; | ||
638 | spin_unlock_bh(&mvmsta->lock); | ||
639 | |||
333 | spin_lock_bh(&mvm->queue_info_lock); | 640 | spin_lock_bh(&mvm->queue_info_lock); |
334 | 641 | ||
335 | /* | 642 | /* |
@@ -338,7 +645,8 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, | |||
338 | */ | 645 | */ |
339 | if (!ieee80211_is_data_qos(hdr->frame_control) || | 646 | if (!ieee80211_is_data_qos(hdr->frame_control) || |
340 | ieee80211_is_qos_nullfunc(hdr->frame_control)) { | 647 | ieee80211_is_qos_nullfunc(hdr->frame_control)) { |
341 | queue = iwl_mvm_find_free_queue(mvm, IWL_MVM_DQA_MIN_MGMT_QUEUE, | 648 | queue = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, |
649 | IWL_MVM_DQA_MIN_MGMT_QUEUE, | ||
342 | IWL_MVM_DQA_MAX_MGMT_QUEUE); | 650 | IWL_MVM_DQA_MAX_MGMT_QUEUE); |
343 | if (queue >= IWL_MVM_DQA_MIN_MGMT_QUEUE) | 651 | if (queue >= IWL_MVM_DQA_MIN_MGMT_QUEUE) |
344 | IWL_DEBUG_TX_QUEUES(mvm, "Found free MGMT queue #%d\n", | 652 | IWL_DEBUG_TX_QUEUES(mvm, "Found free MGMT queue #%d\n", |
@@ -347,29 +655,62 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, | |||
347 | /* If no such queue is found, we'll use a DATA queue instead */ | 655 | /* If no such queue is found, we'll use a DATA queue instead */ |
348 | } | 656 | } |
349 | 657 | ||
350 | if (queue < 0 && mvmsta->reserved_queue != IEEE80211_INVAL_HW_QUEUE) { | 658 | if ((queue < 0 && mvmsta->reserved_queue != IEEE80211_INVAL_HW_QUEUE) && |
659 | (mvm->queue_info[mvmsta->reserved_queue].status == | ||
660 | IWL_MVM_QUEUE_RESERVED || | ||
661 | mvm->queue_info[mvmsta->reserved_queue].status == | ||
662 | IWL_MVM_QUEUE_INACTIVE)) { | ||
351 | queue = mvmsta->reserved_queue; | 663 | queue = mvmsta->reserved_queue; |
664 | mvm->queue_info[queue].reserved = true; | ||
352 | IWL_DEBUG_TX_QUEUES(mvm, "Using reserved queue #%d\n", queue); | 665 | IWL_DEBUG_TX_QUEUES(mvm, "Using reserved queue #%d\n", queue); |
353 | } | 666 | } |
354 | 667 | ||
355 | if (queue < 0) | 668 | if (queue < 0) |
356 | queue = iwl_mvm_find_free_queue(mvm, IWL_MVM_DQA_MIN_DATA_QUEUE, | 669 | queue = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, |
670 | IWL_MVM_DQA_MIN_DATA_QUEUE, | ||
357 | IWL_MVM_DQA_MAX_DATA_QUEUE); | 671 | IWL_MVM_DQA_MAX_DATA_QUEUE); |
358 | 672 | ||
359 | /* | 673 | /* |
674 | * Check if this queue is already allocated but inactive. | ||
675 | * In such a case, we'll need to first free this queue before enabling | ||
676 | * it again, so we'll mark it as reserved to make sure no new traffic | ||
677 | * arrives on it | ||
678 | */ | ||
679 | if (queue > 0 && | ||
680 | mvm->queue_info[queue].status == IWL_MVM_QUEUE_INACTIVE) { | ||
681 | mvm->queue_info[queue].status = IWL_MVM_QUEUE_RESERVED; | ||
682 | using_inactive_queue = true; | ||
683 | IWL_DEBUG_TX_QUEUES(mvm, | ||
684 | "Re-assigning TXQ %d: sta_id=%d, tid=%d\n", | ||
685 | queue, mvmsta->sta_id, tid); | ||
686 | } | ||
687 | |||
688 | /* No free queue - we'll have to share */ | ||
689 | if (queue <= 0) { | ||
690 | queue = iwl_mvm_get_shared_queue(mvm, tfd_queue_mask, ac); | ||
691 | if (queue > 0) { | ||
692 | shared_queue = true; | ||
693 | mvm->queue_info[queue].status = IWL_MVM_QUEUE_SHARED; | ||
694 | } | ||
695 | } | ||
696 | |||
697 | /* | ||
360 | * Mark TXQ as ready, even though it hasn't been fully configured yet, | 698 | * Mark TXQ as ready, even though it hasn't been fully configured yet, |
361 | * to make sure no one else takes it. | 699 | * to make sure no one else takes it. |
362 | * This will allow avoiding re-acquiring the lock at the end of the | 700 | * This will allow avoiding re-acquiring the lock at the end of the |
363 | * configuration. On error we'll mark it back as free. | 701 | * configuration. On error we'll mark it back as free. |
364 | */ | 702 | */ |
365 | if (queue >= 0) | 703 | if ((queue > 0) && !shared_queue) |
366 | mvm->queue_info[queue].status = IWL_MVM_QUEUE_READY; | 704 | mvm->queue_info[queue].status = IWL_MVM_QUEUE_READY; |
367 | 705 | ||
368 | spin_unlock_bh(&mvm->queue_info_lock); | 706 | spin_unlock_bh(&mvm->queue_info_lock); |
369 | 707 | ||
370 | /* TODO: support shared queues for same RA */ | 708 | /* This shouldn't happen - out of queues */ |
371 | if (queue < 0) | 709 | if (WARN_ON(queue <= 0)) { |
710 | IWL_ERR(mvm, "No available queues for tid %d on sta_id %d\n", | ||
711 | tid, cfg.sta_id); | ||
372 | return -ENOSPC; | 712 | return -ENOSPC; |
713 | } | ||
373 | 714 | ||
374 | /* | 715 | /* |
375 | * Actual en/disablement of aggregations is through the ADD_STA HCMD, | 716 | * Actual en/disablement of aggregations is through the ADD_STA HCMD, |
@@ -380,24 +721,103 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, | |||
380 | cfg.aggregate = (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE || | 721 | cfg.aggregate = (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE || |
381 | queue == IWL_MVM_DQA_BSS_CLIENT_QUEUE); | 722 | queue == IWL_MVM_DQA_BSS_CLIENT_QUEUE); |
382 | 723 | ||
383 | IWL_DEBUG_TX_QUEUES(mvm, "Allocating queue #%d to sta %d on tid %d\n", | 724 | /* |
384 | queue, mvmsta->sta_id, tid); | 725 | * If this queue was previously inactive (idle) - we need to free it |
726 | * first | ||
727 | */ | ||
728 | if (using_inactive_queue) { | ||
729 | struct iwl_scd_txq_cfg_cmd cmd = { | ||
730 | .scd_queue = queue, | ||
731 | .enable = 0, | ||
732 | }; | ||
733 | u8 ac; | ||
734 | |||
735 | disable_agg_tids = iwl_mvm_remove_sta_queue_marking(mvm, queue); | ||
736 | |||
737 | spin_lock_bh(&mvm->queue_info_lock); | ||
738 | ac = mvm->queue_info[queue].mac80211_ac; | ||
739 | cmd.sta_id = mvm->queue_info[queue].ra_sta_id; | ||
740 | cmd.tx_fifo = iwl_mvm_ac_to_tx_fifo[ac]; | ||
741 | spin_unlock_bh(&mvm->queue_info_lock); | ||
742 | |||
743 | /* Disable the queue */ | ||
744 | iwl_mvm_invalidate_sta_queue(mvm, queue, disable_agg_tids, | ||
745 | true); | ||
746 | iwl_trans_txq_disable(mvm->trans, queue, false); | ||
747 | ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), | ||
748 | &cmd); | ||
749 | if (ret) { | ||
750 | IWL_ERR(mvm, | ||
751 | "Failed to free inactive queue %d (ret=%d)\n", | ||
752 | queue, ret); | ||
753 | |||
754 | /* Re-mark the inactive queue as inactive */ | ||
755 | spin_lock_bh(&mvm->queue_info_lock); | ||
756 | mvm->queue_info[queue].status = IWL_MVM_QUEUE_INACTIVE; | ||
757 | spin_unlock_bh(&mvm->queue_info_lock); | ||
758 | |||
759 | return ret; | ||
760 | } | ||
761 | } | ||
762 | |||
763 | IWL_DEBUG_TX_QUEUES(mvm, | ||
764 | "Allocating %squeue #%d to sta %d on tid %d\n", | ||
765 | shared_queue ? "shared " : "", queue, | ||
766 | mvmsta->sta_id, tid); | ||
767 | |||
768 | if (shared_queue) { | ||
769 | /* Disable any open aggs on this queue */ | ||
770 | disable_agg_tids = iwl_mvm_get_queue_agg_tids(mvm, queue); | ||
771 | |||
772 | if (disable_agg_tids) { | ||
773 | IWL_DEBUG_TX_QUEUES(mvm, "Disabling aggs on queue %d\n", | ||
774 | queue); | ||
775 | iwl_mvm_invalidate_sta_queue(mvm, queue, | ||
776 | disable_agg_tids, false); | ||
777 | } | ||
778 | } | ||
385 | 779 | ||
386 | ssn = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); | 780 | ssn = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); |
387 | iwl_mvm_enable_txq(mvm, queue, mac_queue, ssn, &cfg, | 781 | iwl_mvm_enable_txq(mvm, queue, mac_queue, ssn, &cfg, |
388 | wdg_timeout); | 782 | wdg_timeout); |
389 | 783 | ||
784 | /* | ||
785 | * Mark queue as shared in transport if shared | ||
786 | * Note this has to be done after queue enablement because enablement | ||
787 | * can also set this value, and there is no indication there to shared | ||
788 | * queues | ||
789 | */ | ||
790 | if (shared_queue) | ||
791 | iwl_trans_txq_set_shared_mode(mvm->trans, queue, true); | ||
792 | |||
390 | spin_lock_bh(&mvmsta->lock); | 793 | spin_lock_bh(&mvmsta->lock); |
391 | mvmsta->tid_data[tid].txq_id = queue; | 794 | mvmsta->tid_data[tid].txq_id = queue; |
795 | mvmsta->tid_data[tid].is_tid_active = true; | ||
392 | mvmsta->tfd_queue_msk |= BIT(queue); | 796 | mvmsta->tfd_queue_msk |= BIT(queue); |
797 | queue_state = mvmsta->tid_data[tid].state; | ||
393 | 798 | ||
394 | if (mvmsta->reserved_queue == queue) | 799 | if (mvmsta->reserved_queue == queue) |
395 | mvmsta->reserved_queue = IEEE80211_INVAL_HW_QUEUE; | 800 | mvmsta->reserved_queue = IEEE80211_INVAL_HW_QUEUE; |
396 | spin_unlock_bh(&mvmsta->lock); | 801 | spin_unlock_bh(&mvmsta->lock); |
397 | 802 | ||
398 | ret = iwl_mvm_sta_send_to_fw(mvm, sta, true, STA_MODIFY_QUEUES); | 803 | if (!shared_queue) { |
399 | if (ret) | 804 | ret = iwl_mvm_sta_send_to_fw(mvm, sta, true, STA_MODIFY_QUEUES); |
400 | goto out_err; | 805 | if (ret) |
806 | goto out_err; | ||
807 | |||
808 | /* If we need to re-enable aggregations... */ | ||
809 | if (queue_state == IWL_AGG_ON) { | ||
810 | ret = iwl_mvm_sta_tx_agg(mvm, sta, tid, queue, true); | ||
811 | if (ret) | ||
812 | goto out_err; | ||
813 | } | ||
814 | } else { | ||
815 | /* Redirect queue, if needed */ | ||
816 | ret = iwl_mvm_scd_queue_redirect(mvm, queue, tid, ac, ssn, | ||
817 | wdg_timeout, false); | ||
818 | if (ret) | ||
819 | goto out_err; | ||
820 | } | ||
401 | 821 | ||
402 | return 0; | 822 | return 0; |
403 | 823 | ||
@@ -476,6 +896,9 @@ void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk) | |||
476 | unsigned long deferred_tid_traffic; | 896 | unsigned long deferred_tid_traffic; |
477 | int sta_id, tid; | 897 | int sta_id, tid; |
478 | 898 | ||
899 | /* Check inactivity of queues */ | ||
900 | iwl_mvm_inactivity_check(mvm); | ||
901 | |||
479 | mutex_lock(&mvm->mutex); | 902 | mutex_lock(&mvm->mutex); |
480 | 903 | ||
481 | /* Go over all stations with deferred traffic */ | 904 | /* Go over all stations with deferred traffic */ |
@@ -505,6 +928,12 @@ static int iwl_mvm_reserve_sta_stream(struct iwl_mvm *mvm, | |||
505 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | 928 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
506 | int queue; | 929 | int queue; |
507 | 930 | ||
931 | /* | ||
932 | * Check for inactive queues, so we don't reach a situation where we | ||
933 | * can't add a STA due to a shortage in queues that doesn't really exist | ||
934 | */ | ||
935 | iwl_mvm_inactivity_check(mvm); | ||
936 | |||
508 | spin_lock_bh(&mvm->queue_info_lock); | 937 | spin_lock_bh(&mvm->queue_info_lock); |
509 | 938 | ||
510 | /* Make sure we have free resources for this STA */ | 939 | /* Make sure we have free resources for this STA */ |
@@ -514,7 +943,8 @@ static int iwl_mvm_reserve_sta_stream(struct iwl_mvm *mvm, | |||
514 | IWL_MVM_QUEUE_FREE)) | 943 | IWL_MVM_QUEUE_FREE)) |
515 | queue = IWL_MVM_DQA_BSS_CLIENT_QUEUE; | 944 | queue = IWL_MVM_DQA_BSS_CLIENT_QUEUE; |
516 | else | 945 | else |
517 | queue = iwl_mvm_find_free_queue(mvm, IWL_MVM_DQA_MIN_DATA_QUEUE, | 946 | queue = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, |
947 | IWL_MVM_DQA_MIN_DATA_QUEUE, | ||
518 | IWL_MVM_DQA_MAX_DATA_QUEUE); | 948 | IWL_MVM_DQA_MAX_DATA_QUEUE); |
519 | if (queue < 0) { | 949 | if (queue < 0) { |
520 | spin_unlock_bh(&mvm->queue_info_lock); | 950 | spin_unlock_bh(&mvm->queue_info_lock); |
@@ -568,8 +998,11 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm, | |||
568 | mvm_sta->tid_disable_agg = 0xffff; /* No aggs at first */ | 998 | mvm_sta->tid_disable_agg = 0xffff; /* No aggs at first */ |
569 | mvm_sta->tfd_queue_msk = 0; | 999 | mvm_sta->tfd_queue_msk = 0; |
570 | 1000 | ||
571 | /* allocate new queues for a TDLS station */ | 1001 | /* |
572 | if (sta->tdls) { | 1002 | * Allocate new queues for a TDLS station, unless we're in DQA mode, |
1003 | * and then they'll be allocated dynamically | ||
1004 | */ | ||
1005 | if (!iwl_mvm_is_dqa_supported(mvm) && sta->tdls) { | ||
573 | ret = iwl_mvm_tdls_sta_init(mvm, sta); | 1006 | ret = iwl_mvm_tdls_sta_init(mvm, sta); |
574 | if (ret) | 1007 | if (ret) |
575 | return ret; | 1008 | return ret; |
@@ -633,7 +1066,8 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm, | |||
633 | return 0; | 1066 | return 0; |
634 | 1067 | ||
635 | err: | 1068 | err: |
636 | iwl_mvm_tdls_sta_deinit(mvm, sta); | 1069 | if (!iwl_mvm_is_dqa_supported(mvm) && sta->tdls) |
1070 | iwl_mvm_tdls_sta_deinit(mvm, sta); | ||
637 | return ret; | 1071 | return ret; |
638 | } | 1072 | } |
639 | 1073 | ||
@@ -819,8 +1253,9 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm, | |||
819 | if (iwl_mvm_has_new_rx_api(mvm)) | 1253 | if (iwl_mvm_has_new_rx_api(mvm)) |
820 | kfree(mvm_sta->dup_data); | 1254 | kfree(mvm_sta->dup_data); |
821 | 1255 | ||
822 | if (vif->type == NL80211_IFTYPE_STATION && | 1256 | if ((vif->type == NL80211_IFTYPE_STATION && |
823 | mvmvif->ap_sta_id == mvm_sta->sta_id) { | 1257 | mvmvif->ap_sta_id == mvm_sta->sta_id) || |
1258 | iwl_mvm_is_dqa_supported(mvm)){ | ||
824 | ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); | 1259 | ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); |
825 | if (ret) | 1260 | if (ret) |
826 | return ret; | 1261 | return ret; |
@@ -838,16 +1273,19 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm, | |||
838 | if (iwl_mvm_is_dqa_supported(mvm)) | 1273 | if (iwl_mvm_is_dqa_supported(mvm)) |
839 | iwl_mvm_disable_sta_queues(mvm, vif, mvm_sta); | 1274 | iwl_mvm_disable_sta_queues(mvm, vif, mvm_sta); |
840 | 1275 | ||
841 | /* if we are associated - we can't remove the AP STA now */ | 1276 | if (vif->type == NL80211_IFTYPE_STATION && |
842 | if (vif->bss_conf.assoc) | 1277 | mvmvif->ap_sta_id == mvm_sta->sta_id) { |
843 | return ret; | 1278 | /* if associated - we can't remove the AP STA now */ |
1279 | if (vif->bss_conf.assoc) | ||
1280 | return ret; | ||
844 | 1281 | ||
845 | /* unassoc - go ahead - remove the AP STA now */ | 1282 | /* unassoc - go ahead - remove the AP STA now */ |
846 | mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; | 1283 | mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; |
847 | 1284 | ||
848 | /* clear d0i3_ap_sta_id if no longer relevant */ | 1285 | /* clear d0i3_ap_sta_id if no longer relevant */ |
849 | if (mvm->d0i3_ap_sta_id == mvm_sta->sta_id) | 1286 | if (mvm->d0i3_ap_sta_id == mvm_sta->sta_id) |
850 | mvm->d0i3_ap_sta_id = IWL_MVM_STATION_COUNT; | 1287 | mvm->d0i3_ap_sta_id = IWL_MVM_STATION_COUNT; |
1288 | } | ||
851 | } | 1289 | } |
852 | 1290 | ||
853 | /* | 1291 | /* |
@@ -885,7 +1323,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm, | |||
885 | } else { | 1323 | } else { |
886 | spin_unlock_bh(&mvm_sta->lock); | 1324 | spin_unlock_bh(&mvm_sta->lock); |
887 | 1325 | ||
888 | if (sta->tdls) | 1326 | if (!iwl_mvm_is_dqa_supported(mvm) && sta->tdls) |
889 | iwl_mvm_tdls_sta_deinit(mvm, sta); | 1327 | iwl_mvm_tdls_sta_deinit(mvm, sta); |
890 | 1328 | ||
891 | ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); | 1329 | ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); |
@@ -983,8 +1421,9 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) | |||
983 | lockdep_assert_held(&mvm->mutex); | 1421 | lockdep_assert_held(&mvm->mutex); |
984 | 1422 | ||
985 | /* Map Aux queue to fifo - needs to happen before adding Aux station */ | 1423 | /* Map Aux queue to fifo - needs to happen before adding Aux station */ |
986 | iwl_mvm_enable_ac_txq(mvm, mvm->aux_queue, mvm->aux_queue, | 1424 | if (!iwl_mvm_is_dqa_supported(mvm)) |
987 | IWL_MVM_TX_FIFO_MCAST, 0, wdg_timeout); | 1425 | iwl_mvm_enable_ac_txq(mvm, mvm->aux_queue, mvm->aux_queue, |
1426 | IWL_MVM_TX_FIFO_MCAST, 0, wdg_timeout); | ||
988 | 1427 | ||
989 | /* Allocate aux station and assign to it the aux queue */ | 1428 | /* Allocate aux station and assign to it the aux queue */ |
990 | ret = iwl_mvm_allocate_int_sta(mvm, &mvm->aux_sta, BIT(mvm->aux_queue), | 1429 | ret = iwl_mvm_allocate_int_sta(mvm, &mvm->aux_sta, BIT(mvm->aux_queue), |
@@ -992,6 +1431,19 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) | |||
992 | if (ret) | 1431 | if (ret) |
993 | return ret; | 1432 | return ret; |
994 | 1433 | ||
1434 | if (iwl_mvm_is_dqa_supported(mvm)) { | ||
1435 | struct iwl_trans_txq_scd_cfg cfg = { | ||
1436 | .fifo = IWL_MVM_TX_FIFO_MCAST, | ||
1437 | .sta_id = mvm->aux_sta.sta_id, | ||
1438 | .tid = IWL_MAX_TID_COUNT, | ||
1439 | .aggregate = false, | ||
1440 | .frame_limit = IWL_FRAME_LIMIT, | ||
1441 | }; | ||
1442 | |||
1443 | iwl_mvm_enable_txq(mvm, mvm->aux_queue, mvm->aux_queue, 0, &cfg, | ||
1444 | wdg_timeout); | ||
1445 | } | ||
1446 | |||
995 | ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL, | 1447 | ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL, |
996 | MAC_INDEX_AUX, 0); | 1448 | MAC_INDEX_AUX, 0); |
997 | 1449 | ||
@@ -1316,8 +1768,8 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
1316 | 1768 | ||
1317 | switch (status & IWL_ADD_STA_STATUS_MASK) { | 1769 | switch (status & IWL_ADD_STA_STATUS_MASK) { |
1318 | case ADD_STA_SUCCESS: | 1770 | case ADD_STA_SUCCESS: |
1319 | IWL_DEBUG_INFO(mvm, "RX BA Session %sed in fw\n", | 1771 | IWL_DEBUG_HT(mvm, "RX BA Session %sed in fw\n", |
1320 | start ? "start" : "stopp"); | 1772 | start ? "start" : "stopp"); |
1321 | break; | 1773 | break; |
1322 | case ADD_STA_IMMEDIATE_BA_FAILURE: | 1774 | case ADD_STA_IMMEDIATE_BA_FAILURE: |
1323 | IWL_WARN(mvm, "RX BA Session refused by fw\n"); | 1775 | IWL_WARN(mvm, "RX BA Session refused by fw\n"); |
@@ -1372,13 +1824,16 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
1372 | * supposed to happen) and we will free the session data while | 1824 | * supposed to happen) and we will free the session data while |
1373 | * RX is being processed in parallel | 1825 | * RX is being processed in parallel |
1374 | */ | 1826 | */ |
1827 | IWL_DEBUG_HT(mvm, "Sta %d(%d) is assigned to BAID %d\n", | ||
1828 | mvm_sta->sta_id, tid, baid); | ||
1375 | WARN_ON(rcu_access_pointer(mvm->baid_map[baid])); | 1829 | WARN_ON(rcu_access_pointer(mvm->baid_map[baid])); |
1376 | rcu_assign_pointer(mvm->baid_map[baid], baid_data); | 1830 | rcu_assign_pointer(mvm->baid_map[baid], baid_data); |
1377 | } else if (mvm->rx_ba_sessions > 0) { | 1831 | } else { |
1378 | u8 baid = mvm_sta->tid_to_baid[tid]; | 1832 | u8 baid = mvm_sta->tid_to_baid[tid]; |
1379 | 1833 | ||
1380 | /* check that restart flow didn't zero the counter */ | 1834 | if (mvm->rx_ba_sessions > 0) |
1381 | mvm->rx_ba_sessions--; | 1835 | /* check that restart flow didn't zero the counter */ |
1836 | mvm->rx_ba_sessions--; | ||
1382 | if (!iwl_mvm_has_new_rx_api(mvm)) | 1837 | if (!iwl_mvm_has_new_rx_api(mvm)) |
1383 | return 0; | 1838 | return 0; |
1384 | 1839 | ||
@@ -1394,6 +1849,7 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
1394 | del_timer_sync(&baid_data->session_timer); | 1849 | del_timer_sync(&baid_data->session_timer); |
1395 | RCU_INIT_POINTER(mvm->baid_map[baid], NULL); | 1850 | RCU_INIT_POINTER(mvm->baid_map[baid], NULL); |
1396 | kfree_rcu(baid_data, rcu_head); | 1851 | kfree_rcu(baid_data, rcu_head); |
1852 | IWL_DEBUG_HT(mvm, "BAID %d is free\n", baid); | ||
1397 | } | 1853 | } |
1398 | return 0; | 1854 | return 0; |
1399 | 1855 | ||
@@ -1402,8 +1858,8 @@ out_free: | |||
1402 | return ret; | 1858 | return ret; |
1403 | } | 1859 | } |
1404 | 1860 | ||
1405 | static int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 1861 | int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
1406 | int tid, u8 queue, bool start) | 1862 | int tid, u8 queue, bool start) |
1407 | { | 1863 | { |
1408 | struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta); | 1864 | struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta); |
1409 | struct iwl_mvm_add_sta_cmd cmd = {}; | 1865 | struct iwl_mvm_add_sta_cmd cmd = {}; |
@@ -1458,6 +1914,7 @@ const u8 tid_to_mac80211_ac[] = { | |||
1458 | IEEE80211_AC_VI, | 1914 | IEEE80211_AC_VI, |
1459 | IEEE80211_AC_VO, | 1915 | IEEE80211_AC_VO, |
1460 | IEEE80211_AC_VO, | 1916 | IEEE80211_AC_VO, |
1917 | IEEE80211_AC_VO, /* We treat MGMT as TID 8, which is set as AC_VO */ | ||
1461 | }; | 1918 | }; |
1462 | 1919 | ||
1463 | static const u8 tid_to_ucode_ac[] = { | 1920 | static const u8 tid_to_ucode_ac[] = { |
@@ -1512,7 +1969,8 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
1512 | txq_id = mvmsta->tid_data[tid].txq_id; | 1969 | txq_id = mvmsta->tid_data[tid].txq_id; |
1513 | if (!iwl_mvm_is_dqa_supported(mvm) || | 1970 | if (!iwl_mvm_is_dqa_supported(mvm) || |
1514 | mvm->queue_info[txq_id].status != IWL_MVM_QUEUE_READY) { | 1971 | mvm->queue_info[txq_id].status != IWL_MVM_QUEUE_READY) { |
1515 | txq_id = iwl_mvm_find_free_queue(mvm, mvm->first_agg_queue, | 1972 | txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, |
1973 | mvm->first_agg_queue, | ||
1516 | mvm->last_agg_queue); | 1974 | mvm->last_agg_queue); |
1517 | if (txq_id < 0) { | 1975 | if (txq_id < 0) { |
1518 | ret = txq_id; | 1976 | ret = txq_id; |
@@ -1907,6 +2365,13 @@ static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm, | |||
1907 | key_flags |= cpu_to_le16(STA_KEY_FLG_WEP); | 2365 | key_flags |= cpu_to_le16(STA_KEY_FLG_WEP); |
1908 | memcpy(cmd.key + 3, keyconf->key, keyconf->keylen); | 2366 | memcpy(cmd.key + 3, keyconf->key, keyconf->keylen); |
1909 | break; | 2367 | break; |
2368 | case WLAN_CIPHER_SUITE_GCMP_256: | ||
2369 | key_flags |= cpu_to_le16(STA_KEY_FLG_KEY_32BYTES); | ||
2370 | /* fall through */ | ||
2371 | case WLAN_CIPHER_SUITE_GCMP: | ||
2372 | key_flags |= cpu_to_le16(STA_KEY_FLG_GCMP); | ||
2373 | memcpy(cmd.key, keyconf->key, keyconf->keylen); | ||
2374 | break; | ||
1910 | default: | 2375 | default: |
1911 | key_flags |= cpu_to_le16(STA_KEY_FLG_EXT); | 2376 | key_flags |= cpu_to_le16(STA_KEY_FLG_EXT); |
1912 | memcpy(cmd.key, keyconf->key, keyconf->keylen); | 2377 | memcpy(cmd.key, keyconf->key, keyconf->keylen); |
@@ -2035,6 +2500,8 @@ static int __iwl_mvm_set_sta_key(struct iwl_mvm *mvm, | |||
2035 | case WLAN_CIPHER_SUITE_CCMP: | 2500 | case WLAN_CIPHER_SUITE_CCMP: |
2036 | case WLAN_CIPHER_SUITE_WEP40: | 2501 | case WLAN_CIPHER_SUITE_WEP40: |
2037 | case WLAN_CIPHER_SUITE_WEP104: | 2502 | case WLAN_CIPHER_SUITE_WEP104: |
2503 | case WLAN_CIPHER_SUITE_GCMP: | ||
2504 | case WLAN_CIPHER_SUITE_GCMP_256: | ||
2038 | ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, | 2505 | ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, |
2039 | 0, NULL, 0, key_offset); | 2506 | 0, NULL, 0, key_offset); |
2040 | break; | 2507 | break; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h index d2c58f134fcf..bbc1cab2c3bf 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h | |||
@@ -321,6 +321,9 @@ enum iwl_mvm_agg_state { | |||
321 | * Basically when next_reclaimed reaches ssn, we can tell mac80211 that | 321 | * Basically when next_reclaimed reaches ssn, we can tell mac80211 that |
322 | * we are ready to finish the Tx AGG stop / start flow. | 322 | * we are ready to finish the Tx AGG stop / start flow. |
323 | * @tx_time: medium time consumed by this A-MPDU | 323 | * @tx_time: medium time consumed by this A-MPDU |
324 | * @is_tid_active: has this TID sent traffic in the last | ||
325 | * %IWL_MVM_DQA_QUEUE_TIMEOUT time period. If %txq_id is invalid, this | ||
326 | * field should be ignored. | ||
324 | */ | 327 | */ |
325 | struct iwl_mvm_tid_data { | 328 | struct iwl_mvm_tid_data { |
326 | struct sk_buff_head deferred_tx_frames; | 329 | struct sk_buff_head deferred_tx_frames; |
@@ -333,6 +336,7 @@ struct iwl_mvm_tid_data { | |||
333 | u16 txq_id; | 336 | u16 txq_id; |
334 | u16 ssn; | 337 | u16 ssn; |
335 | u16 tx_time; | 338 | u16 tx_time; |
339 | bool is_tid_active; | ||
336 | }; | 340 | }; |
337 | 341 | ||
338 | static inline u16 iwl_mvm_tid_queued(struct iwl_mvm_tid_data *tid_data) | 342 | static inline u16 iwl_mvm_tid_queued(struct iwl_mvm_tid_data *tid_data) |
@@ -434,6 +438,7 @@ struct iwl_mvm_sta { | |||
434 | bool tlc_amsdu; | 438 | bool tlc_amsdu; |
435 | u8 agg_tids; | 439 | u8 agg_tids; |
436 | u8 sleep_tx_count; | 440 | u8 sleep_tx_count; |
441 | u8 avg_energy; | ||
437 | }; | 442 | }; |
438 | 443 | ||
439 | static inline struct iwl_mvm_sta * | 444 | static inline struct iwl_mvm_sta * |
@@ -509,6 +514,9 @@ int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
509 | int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 514 | int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
510 | struct ieee80211_sta *sta, u16 tid); | 515 | struct ieee80211_sta *sta, u16 tid); |
511 | 516 | ||
517 | int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | ||
518 | int tid, u8 queue, bool start); | ||
519 | |||
512 | int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm); | 520 | int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm); |
513 | void iwl_mvm_del_aux_sta(struct iwl_mvm *mvm); | 521 | void iwl_mvm_del_aux_sta(struct iwl_mvm *mvm); |
514 | 522 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index 779bafcbc9a1..c6585ab48df3 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c | |||
@@ -138,28 +138,19 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
138 | 138 | ||
139 | protocol = ipv6h->nexthdr; | 139 | protocol = ipv6h->nexthdr; |
140 | while (protocol != NEXTHDR_NONE && ipv6_ext_hdr(protocol)) { | 140 | while (protocol != NEXTHDR_NONE && ipv6_ext_hdr(protocol)) { |
141 | struct ipv6_opt_hdr *hp; | ||
142 | |||
141 | /* only supported extension headers */ | 143 | /* only supported extension headers */ |
142 | if (protocol != NEXTHDR_ROUTING && | 144 | if (protocol != NEXTHDR_ROUTING && |
143 | protocol != NEXTHDR_HOP && | 145 | protocol != NEXTHDR_HOP && |
144 | protocol != NEXTHDR_DEST && | 146 | protocol != NEXTHDR_DEST) { |
145 | protocol != NEXTHDR_FRAGMENT) { | ||
146 | skb_checksum_help(skb); | 147 | skb_checksum_help(skb); |
147 | return; | 148 | return; |
148 | } | 149 | } |
149 | 150 | ||
150 | if (protocol == NEXTHDR_FRAGMENT) { | 151 | hp = OPT_HDR(struct ipv6_opt_hdr, skb, off); |
151 | struct frag_hdr *hp = | 152 | protocol = hp->nexthdr; |
152 | OPT_HDR(struct frag_hdr, skb, off); | 153 | off += ipv6_optlen(hp); |
153 | |||
154 | protocol = hp->nexthdr; | ||
155 | off += sizeof(struct frag_hdr); | ||
156 | } else { | ||
157 | struct ipv6_opt_hdr *hp = | ||
158 | OPT_HDR(struct ipv6_opt_hdr, skb, off); | ||
159 | |||
160 | protocol = hp->nexthdr; | ||
161 | off += ipv6_optlen(hp); | ||
162 | } | ||
163 | } | 154 | } |
164 | /* if we get here - protocol now should be TCP/UDP */ | 155 | /* if we get here - protocol now should be TCP/UDP */ |
165 | #endif | 156 | #endif |
@@ -388,6 +379,23 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd, | |||
388 | tx_cmd->rate_n_flags = cpu_to_le32((u32)rate_plcp | rate_flags); | 379 | tx_cmd->rate_n_flags = cpu_to_le32((u32)rate_plcp | rate_flags); |
389 | } | 380 | } |
390 | 381 | ||
382 | static inline void iwl_mvm_set_tx_cmd_pn(struct ieee80211_tx_info *info, | ||
383 | u8 *crypto_hdr) | ||
384 | { | ||
385 | struct ieee80211_key_conf *keyconf = info->control.hw_key; | ||
386 | u64 pn; | ||
387 | |||
388 | pn = atomic64_inc_return(&keyconf->tx_pn); | ||
389 | crypto_hdr[0] = pn; | ||
390 | crypto_hdr[2] = 0; | ||
391 | crypto_hdr[3] = 0x20 | (keyconf->keyidx << 6); | ||
392 | crypto_hdr[1] = pn >> 8; | ||
393 | crypto_hdr[4] = pn >> 16; | ||
394 | crypto_hdr[5] = pn >> 24; | ||
395 | crypto_hdr[6] = pn >> 32; | ||
396 | crypto_hdr[7] = pn >> 40; | ||
397 | } | ||
398 | |||
391 | /* | 399 | /* |
392 | * Sets the fields in the Tx cmd that are crypto related | 400 | * Sets the fields in the Tx cmd that are crypto related |
393 | */ | 401 | */ |
@@ -405,15 +413,7 @@ static void iwl_mvm_set_tx_cmd_crypto(struct iwl_mvm *mvm, | |||
405 | case WLAN_CIPHER_SUITE_CCMP: | 413 | case WLAN_CIPHER_SUITE_CCMP: |
406 | case WLAN_CIPHER_SUITE_CCMP_256: | 414 | case WLAN_CIPHER_SUITE_CCMP_256: |
407 | iwl_mvm_set_tx_cmd_ccmp(info, tx_cmd); | 415 | iwl_mvm_set_tx_cmd_ccmp(info, tx_cmd); |
408 | pn = atomic64_inc_return(&keyconf->tx_pn); | 416 | iwl_mvm_set_tx_cmd_pn(info, crypto_hdr); |
409 | crypto_hdr[0] = pn; | ||
410 | crypto_hdr[2] = 0; | ||
411 | crypto_hdr[3] = 0x20 | (keyconf->keyidx << 6); | ||
412 | crypto_hdr[1] = pn >> 8; | ||
413 | crypto_hdr[4] = pn >> 16; | ||
414 | crypto_hdr[5] = pn >> 24; | ||
415 | crypto_hdr[6] = pn >> 32; | ||
416 | crypto_hdr[7] = pn >> 40; | ||
417 | break; | 417 | break; |
418 | 418 | ||
419 | case WLAN_CIPHER_SUITE_TKIP: | 419 | case WLAN_CIPHER_SUITE_TKIP: |
@@ -433,6 +433,18 @@ static void iwl_mvm_set_tx_cmd_crypto(struct iwl_mvm *mvm, | |||
433 | 433 | ||
434 | memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); | 434 | memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); |
435 | break; | 435 | break; |
436 | case WLAN_CIPHER_SUITE_GCMP: | ||
437 | case WLAN_CIPHER_SUITE_GCMP_256: | ||
438 | /* TODO: Taking the key from the table might introduce a race | ||
439 | * when PTK rekeying is done, having an old packets with a PN | ||
440 | * based on the old key but the message encrypted with a new | ||
441 | * one. | ||
442 | * Need to handle this. | ||
443 | */ | ||
444 | tx_cmd->sec_ctl |= TX_CMD_SEC_GCMP | TC_CMD_SEC_KEY_FROM_TABLE; | ||
445 | tx_cmd->key[0] = keyconf->hw_key_idx; | ||
446 | iwl_mvm_set_tx_cmd_pn(info, crypto_hdr); | ||
447 | break; | ||
436 | default: | 448 | default: |
437 | tx_cmd->sec_ctl |= TX_CMD_SEC_EXT; | 449 | tx_cmd->sec_ctl |= TX_CMD_SEC_EXT; |
438 | } | 450 | } |
@@ -534,6 +546,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) | |||
534 | * (this is not possible for unicast packets as a TLDS discovery | 546 | * (this is not possible for unicast packets as a TLDS discovery |
535 | * response are sent without a station entry); otherwise use the | 547 | * response are sent without a station entry); otherwise use the |
536 | * AUX station. | 548 | * AUX station. |
549 | * In DQA mode, if vif is of type STATION and frames are not multicast, | ||
550 | * they should be sent from the BSS queue. For example, TDLS setup | ||
551 | * frames should be sent on this queue, as they go through the AP. | ||
537 | */ | 552 | */ |
538 | sta_id = mvm->aux_sta.sta_id; | 553 | sta_id = mvm->aux_sta.sta_id; |
539 | if (info.control.vif) { | 554 | if (info.control.vif) { |
@@ -551,6 +566,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) | |||
551 | 566 | ||
552 | if (ap_sta_id != IWL_MVM_STATION_COUNT) | 567 | if (ap_sta_id != IWL_MVM_STATION_COUNT) |
553 | sta_id = ap_sta_id; | 568 | sta_id = ap_sta_id; |
569 | } else if (iwl_mvm_is_dqa_supported(mvm) && | ||
570 | info.control.vif->type == NL80211_IFTYPE_STATION) { | ||
571 | queue = IWL_MVM_DQA_BSS_CLIENT_QUEUE; | ||
554 | } | 572 | } |
555 | } | 573 | } |
556 | 574 | ||
@@ -884,15 +902,17 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
884 | * nullfunc frames should go to the MGMT queue regardless of QOS | 902 | * nullfunc frames should go to the MGMT queue regardless of QOS |
885 | */ | 903 | */ |
886 | tid = IWL_MAX_TID_COUNT; | 904 | tid = IWL_MAX_TID_COUNT; |
887 | txq_id = mvmsta->tid_data[tid].txq_id; | ||
888 | } | 905 | } |
889 | 906 | ||
907 | if (iwl_mvm_is_dqa_supported(mvm)) | ||
908 | txq_id = mvmsta->tid_data[tid].txq_id; | ||
909 | |||
890 | /* Copy MAC header from skb into command buffer */ | 910 | /* Copy MAC header from skb into command buffer */ |
891 | memcpy(tx_cmd->hdr, hdr, hdrlen); | 911 | memcpy(tx_cmd->hdr, hdr, hdrlen); |
892 | 912 | ||
893 | WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM); | 913 | WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM); |
894 | 914 | ||
895 | if (sta->tdls) { | 915 | if (sta->tdls && !iwl_mvm_is_dqa_supported(mvm)) { |
896 | /* default to TID 0 for non-QoS packets */ | 916 | /* default to TID 0 for non-QoS packets */ |
897 | u8 tdls_tid = tid == IWL_MAX_TID_COUNT ? 0 : tid; | 917 | u8 tdls_tid = tid == IWL_MAX_TID_COUNT ? 0 : tid; |
898 | 918 | ||
@@ -905,9 +925,12 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
905 | txq_id = mvmsta->tid_data[tid].txq_id; | 925 | txq_id = mvmsta->tid_data[tid].txq_id; |
906 | } | 926 | } |
907 | 927 | ||
908 | if (iwl_mvm_is_dqa_supported(mvm)) { | 928 | /* Check if TXQ needs to be allocated or re-activated */ |
909 | if (unlikely(mvmsta->tid_data[tid].txq_id == | 929 | if (unlikely(txq_id == IEEE80211_INVAL_HW_QUEUE || |
910 | IEEE80211_INVAL_HW_QUEUE)) { | 930 | !mvmsta->tid_data[tid].is_tid_active) && |
931 | iwl_mvm_is_dqa_supported(mvm)) { | ||
932 | /* If TXQ needs to be allocated... */ | ||
933 | if (txq_id == IEEE80211_INVAL_HW_QUEUE) { | ||
911 | iwl_mvm_tx_add_stream(mvm, mvmsta, tid, skb); | 934 | iwl_mvm_tx_add_stream(mvm, mvmsta, tid, skb); |
912 | 935 | ||
913 | /* | 936 | /* |
@@ -917,11 +940,22 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
917 | iwl_trans_free_tx_cmd(mvm->trans, dev_cmd); | 940 | iwl_trans_free_tx_cmd(mvm->trans, dev_cmd); |
918 | spin_unlock(&mvmsta->lock); | 941 | spin_unlock(&mvmsta->lock); |
919 | return 0; | 942 | return 0; |
943 | |||
920 | } | 944 | } |
921 | 945 | ||
922 | txq_id = mvmsta->tid_data[tid].txq_id; | 946 | /* If we are here - TXQ exists and needs to be re-activated */ |
947 | spin_lock(&mvm->queue_info_lock); | ||
948 | mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_READY; | ||
949 | mvmsta->tid_data[tid].is_tid_active = true; | ||
950 | spin_unlock(&mvm->queue_info_lock); | ||
951 | |||
952 | IWL_DEBUG_TX_QUEUES(mvm, "Re-activating queue %d for TX\n", | ||
953 | txq_id); | ||
923 | } | 954 | } |
924 | 955 | ||
956 | /* Keep track of the time of the last frame for this RA/TID */ | ||
957 | mvm->queue_info[txq_id].last_frame_time[tid] = jiffies; | ||
958 | |||
925 | IWL_DEBUG_TX(mvm, "TX to [%d|%d] Q:%d - seq: 0x%x\n", mvmsta->sta_id, | 959 | IWL_DEBUG_TX(mvm, "TX to [%d|%d] Q:%d - seq: 0x%x\n", mvmsta->sta_id, |
926 | tid, txq_id, IEEE80211_SEQ_TO_SN(seq_number)); | 960 | tid, txq_id, IEEE80211_SEQ_TO_SN(seq_number)); |
927 | 961 | ||
@@ -1313,7 +1347,15 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, | |||
1313 | bool send_eosp_ndp = false; | 1347 | bool send_eosp_ndp = false; |
1314 | 1348 | ||
1315 | spin_lock_bh(&mvmsta->lock); | 1349 | spin_lock_bh(&mvmsta->lock); |
1316 | txq_agg = (mvmsta->tid_data[tid].state == IWL_AGG_ON); | 1350 | if (iwl_mvm_is_dqa_supported(mvm)) { |
1351 | enum iwl_mvm_agg_state state; | ||
1352 | |||
1353 | state = mvmsta->tid_data[tid].state; | ||
1354 | txq_agg = (state == IWL_AGG_ON || | ||
1355 | state == IWL_EMPTYING_HW_QUEUE_DELBA); | ||
1356 | } else { | ||
1357 | txq_agg = txq_id >= mvm->first_agg_queue; | ||
1358 | } | ||
1317 | 1359 | ||
1318 | if (!is_ndp) { | 1360 | if (!is_ndp) { |
1319 | tid_data->next_reclaimed = next_reclaimed; | 1361 | tid_data->next_reclaimed = next_reclaimed; |
@@ -1644,7 +1686,7 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) | |||
1644 | iwl_mvm_tx_info_from_ba_notif(&ba_info, ba_notif, tid_data); | 1686 | iwl_mvm_tx_info_from_ba_notif(&ba_info, ba_notif, tid_data); |
1645 | 1687 | ||
1646 | IWL_DEBUG_TX_REPLY(mvm, "No reclaim. Update rs directly\n"); | 1688 | IWL_DEBUG_TX_REPLY(mvm, "No reclaim. Update rs directly\n"); |
1647 | iwl_mvm_rs_tx_status(mvm, sta, tid, &ba_info); | 1689 | iwl_mvm_rs_tx_status(mvm, sta, tid, &ba_info, false); |
1648 | } | 1690 | } |
1649 | 1691 | ||
1650 | out: | 1692 | out: |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c index 161b99efd63d..68f4e7fdfc11 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c | |||
@@ -579,17 +579,29 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) | |||
579 | iwl_mvm_dump_umac_error_log(mvm); | 579 | iwl_mvm_dump_umac_error_log(mvm); |
580 | } | 580 | } |
581 | 581 | ||
582 | int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 minq, u8 maxq) | 582 | int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq) |
583 | { | 583 | { |
584 | int i; | 584 | int i; |
585 | 585 | ||
586 | lockdep_assert_held(&mvm->queue_info_lock); | 586 | lockdep_assert_held(&mvm->queue_info_lock); |
587 | 587 | ||
588 | /* Start by looking for a free queue */ | ||
588 | for (i = minq; i <= maxq; i++) | 589 | for (i = minq; i <= maxq; i++) |
589 | if (mvm->queue_info[i].hw_queue_refcount == 0 && | 590 | if (mvm->queue_info[i].hw_queue_refcount == 0 && |
590 | mvm->queue_info[i].status == IWL_MVM_QUEUE_FREE) | 591 | mvm->queue_info[i].status == IWL_MVM_QUEUE_FREE) |
591 | return i; | 592 | return i; |
592 | 593 | ||
594 | /* | ||
595 | * If no free queue found - settle for an inactive one to reconfigure | ||
596 | * Make sure that the inactive queue either already belongs to this STA, | ||
597 | * or that if it belongs to another one - it isn't the reserved queue | ||
598 | */ | ||
599 | for (i = minq; i <= maxq; i++) | ||
600 | if (mvm->queue_info[i].status == IWL_MVM_QUEUE_INACTIVE && | ||
601 | (sta_id == mvm->queue_info[i].ra_sta_id || | ||
602 | !mvm->queue_info[i].reserved)) | ||
603 | return i; | ||
604 | |||
593 | return -ENOSPC; | 605 | return -ENOSPC; |
594 | } | 606 | } |
595 | 607 | ||
@@ -643,13 +655,21 @@ void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue, | |||
643 | } | 655 | } |
644 | 656 | ||
645 | /* Update mappings and refcounts */ | 657 | /* Update mappings and refcounts */ |
658 | if (mvm->queue_info[queue].hw_queue_refcount > 0) | ||
659 | enable_queue = false; | ||
660 | |||
646 | mvm->queue_info[queue].hw_queue_to_mac80211 |= BIT(mac80211_queue); | 661 | mvm->queue_info[queue].hw_queue_to_mac80211 |= BIT(mac80211_queue); |
647 | mvm->queue_info[queue].hw_queue_refcount++; | 662 | mvm->queue_info[queue].hw_queue_refcount++; |
648 | if (mvm->queue_info[queue].hw_queue_refcount > 1) | ||
649 | enable_queue = false; | ||
650 | else | ||
651 | mvm->queue_info[queue].ra_sta_id = cfg->sta_id; | ||
652 | mvm->queue_info[queue].tid_bitmap |= BIT(cfg->tid); | 663 | mvm->queue_info[queue].tid_bitmap |= BIT(cfg->tid); |
664 | mvm->queue_info[queue].ra_sta_id = cfg->sta_id; | ||
665 | |||
666 | if (enable_queue) { | ||
667 | if (cfg->tid != IWL_MAX_TID_COUNT) | ||
668 | mvm->queue_info[queue].mac80211_ac = | ||
669 | tid_to_mac80211_ac[cfg->tid]; | ||
670 | else | ||
671 | mvm->queue_info[queue].mac80211_ac = IEEE80211_AC_VO; | ||
672 | } | ||
653 | 673 | ||
654 | IWL_DEBUG_TX_QUEUES(mvm, | 674 | IWL_DEBUG_TX_QUEUES(mvm, |
655 | "Enabling TXQ #%d refcount=%d (mac80211 map:0x%x)\n", | 675 | "Enabling TXQ #%d refcount=%d (mac80211 map:0x%x)\n", |
@@ -671,6 +691,10 @@ void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue, | |||
671 | .tid = cfg->tid, | 691 | .tid = cfg->tid, |
672 | }; | 692 | }; |
673 | 693 | ||
694 | /* Set sta_id in the command, if it exists */ | ||
695 | if (iwl_mvm_is_dqa_supported(mvm)) | ||
696 | cmd.sta_id = cfg->sta_id; | ||
697 | |||
674 | iwl_trans_txq_enable_cfg(mvm->trans, queue, ssn, NULL, | 698 | iwl_trans_txq_enable_cfg(mvm->trans, queue, ssn, NULL, |
675 | wdg_timeout); | 699 | wdg_timeout); |
676 | WARN(iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), | 700 | WARN(iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), |
@@ -752,6 +776,9 @@ void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue, | |||
752 | mvm->queue_info[queue].tid_bitmap = 0; | 776 | mvm->queue_info[queue].tid_bitmap = 0; |
753 | mvm->queue_info[queue].hw_queue_to_mac80211 = 0; | 777 | mvm->queue_info[queue].hw_queue_to_mac80211 = 0; |
754 | 778 | ||
779 | /* Regardless if this is a reserved TXQ for a STA - mark it as false */ | ||
780 | mvm->queue_info[queue].reserved = false; | ||
781 | |||
755 | spin_unlock_bh(&mvm->queue_info_lock); | 782 | spin_unlock_bh(&mvm->queue_info_lock); |
756 | 783 | ||
757 | iwl_trans_txq_disable(mvm->trans, queue, false); | 784 | iwl_trans_txq_disable(mvm->trans, queue, false); |
@@ -1039,6 +1066,155 @@ out: | |||
1039 | ieee80211_connection_loss(vif); | 1066 | ieee80211_connection_loss(vif); |
1040 | } | 1067 | } |
1041 | 1068 | ||
1069 | /* | ||
1070 | * Remove inactive TIDs of a given queue. | ||
1071 | * If all queue TIDs are inactive - mark the queue as inactive | ||
1072 | * If only some the queue TIDs are inactive - unmap them from the queue | ||
1073 | */ | ||
1074 | static void iwl_mvm_remove_inactive_tids(struct iwl_mvm *mvm, | ||
1075 | struct iwl_mvm_sta *mvmsta, int queue, | ||
1076 | unsigned long tid_bitmap) | ||
1077 | { | ||
1078 | int tid; | ||
1079 | |||
1080 | lockdep_assert_held(&mvmsta->lock); | ||
1081 | lockdep_assert_held(&mvm->queue_info_lock); | ||
1082 | |||
1083 | /* Go over all non-active TIDs, incl. IWL_MAX_TID_COUNT (for mgmt) */ | ||
1084 | for_each_set_bit(tid, &tid_bitmap, IWL_MAX_TID_COUNT + 1) { | ||
1085 | /* If some TFDs are still queued - don't mark TID as inactive */ | ||
1086 | if (iwl_mvm_tid_queued(&mvmsta->tid_data[tid])) | ||
1087 | tid_bitmap &= ~BIT(tid); | ||
1088 | } | ||
1089 | |||
1090 | /* If all TIDs in the queue are inactive - mark queue as inactive. */ | ||
1091 | if (tid_bitmap == mvm->queue_info[queue].tid_bitmap) { | ||
1092 | mvm->queue_info[queue].status = IWL_MVM_QUEUE_INACTIVE; | ||
1093 | |||
1094 | for_each_set_bit(tid, &tid_bitmap, IWL_MAX_TID_COUNT + 1) | ||
1095 | mvmsta->tid_data[tid].is_tid_active = false; | ||
1096 | |||
1097 | IWL_DEBUG_TX_QUEUES(mvm, "Queue %d marked as inactive\n", | ||
1098 | queue); | ||
1099 | return; | ||
1100 | } | ||
1101 | |||
1102 | /* | ||
1103 | * If we are here, this is a shared queue and not all TIDs timed-out. | ||
1104 | * Remove the ones that did. | ||
1105 | */ | ||
1106 | for_each_set_bit(tid, &tid_bitmap, IWL_MAX_TID_COUNT + 1) { | ||
1107 | int mac_queue = mvmsta->vif->hw_queue[tid_to_mac80211_ac[tid]]; | ||
1108 | |||
1109 | mvmsta->tid_data[tid].txq_id = IEEE80211_INVAL_HW_QUEUE; | ||
1110 | mvm->queue_info[queue].hw_queue_to_mac80211 &= ~BIT(mac_queue); | ||
1111 | mvm->queue_info[queue].hw_queue_refcount--; | ||
1112 | mvm->queue_info[queue].tid_bitmap &= ~BIT(tid); | ||
1113 | mvmsta->tid_data[tid].is_tid_active = false; | ||
1114 | |||
1115 | IWL_DEBUG_TX_QUEUES(mvm, | ||
1116 | "Removing inactive TID %d from shared Q:%d\n", | ||
1117 | tid, queue); | ||
1118 | } | ||
1119 | |||
1120 | IWL_DEBUG_TX_QUEUES(mvm, | ||
1121 | "TXQ #%d left with tid bitmap 0x%x\n", queue, | ||
1122 | mvm->queue_info[queue].tid_bitmap); | ||
1123 | |||
1124 | /* | ||
1125 | * There may be different TIDs with the same mac queues, so make | ||
1126 | * sure all TIDs have existing corresponding mac queues enabled | ||
1127 | */ | ||
1128 | tid_bitmap = mvm->queue_info[queue].tid_bitmap; | ||
1129 | for_each_set_bit(tid, &tid_bitmap, IWL_MAX_TID_COUNT + 1) { | ||
1130 | mvm->queue_info[queue].hw_queue_to_mac80211 |= | ||
1131 | BIT(mvmsta->vif->hw_queue[tid_to_mac80211_ac[tid]]); | ||
1132 | } | ||
1133 | |||
1134 | /* TODO: if queue was shared - need to re-enable AGGs */ | ||
1135 | } | ||
1136 | |||
1137 | void iwl_mvm_inactivity_check(struct iwl_mvm *mvm) | ||
1138 | { | ||
1139 | unsigned long timeout_queues_map = 0; | ||
1140 | unsigned long now = jiffies; | ||
1141 | int i; | ||
1142 | |||
1143 | spin_lock_bh(&mvm->queue_info_lock); | ||
1144 | for (i = 0; i < IWL_MAX_HW_QUEUES; i++) | ||
1145 | if (mvm->queue_info[i].hw_queue_refcount > 0) | ||
1146 | timeout_queues_map |= BIT(i); | ||
1147 | spin_unlock_bh(&mvm->queue_info_lock); | ||
1148 | |||
1149 | rcu_read_lock(); | ||
1150 | |||
1151 | /* | ||
1152 | * If a queue time outs - mark it as INACTIVE (don't remove right away | ||
1153 | * if we don't have to.) This is an optimization in case traffic comes | ||
1154 | * later, and we don't HAVE to use a currently-inactive queue | ||
1155 | */ | ||
1156 | for_each_set_bit(i, &timeout_queues_map, IWL_MAX_HW_QUEUES) { | ||
1157 | struct ieee80211_sta *sta; | ||
1158 | struct iwl_mvm_sta *mvmsta; | ||
1159 | u8 sta_id; | ||
1160 | int tid; | ||
1161 | unsigned long inactive_tid_bitmap = 0; | ||
1162 | unsigned long queue_tid_bitmap; | ||
1163 | |||
1164 | spin_lock_bh(&mvm->queue_info_lock); | ||
1165 | queue_tid_bitmap = mvm->queue_info[i].tid_bitmap; | ||
1166 | |||
1167 | /* If TXQ isn't in active use anyway - nothing to do here... */ | ||
1168 | if (mvm->queue_info[i].status != IWL_MVM_QUEUE_READY && | ||
1169 | mvm->queue_info[i].status != IWL_MVM_QUEUE_SHARED) { | ||
1170 | spin_unlock_bh(&mvm->queue_info_lock); | ||
1171 | continue; | ||
1172 | } | ||
1173 | |||
1174 | /* Check to see if there are inactive TIDs on this queue */ | ||
1175 | for_each_set_bit(tid, &queue_tid_bitmap, | ||
1176 | IWL_MAX_TID_COUNT + 1) { | ||
1177 | if (time_after(mvm->queue_info[i].last_frame_time[tid] + | ||
1178 | IWL_MVM_DQA_QUEUE_TIMEOUT, now)) | ||
1179 | continue; | ||
1180 | |||
1181 | inactive_tid_bitmap |= BIT(tid); | ||
1182 | } | ||
1183 | spin_unlock_bh(&mvm->queue_info_lock); | ||
1184 | |||
1185 | /* If all TIDs are active - finish check on this queue */ | ||
1186 | if (!inactive_tid_bitmap) | ||
1187 | continue; | ||
1188 | |||
1189 | /* | ||
1190 | * If we are here - the queue hadn't been served recently and is | ||
1191 | * in use | ||
1192 | */ | ||
1193 | |||
1194 | sta_id = mvm->queue_info[i].ra_sta_id; | ||
1195 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); | ||
1196 | |||
1197 | /* | ||
1198 | * If the STA doesn't exist anymore, it isn't an error. It could | ||
1199 | * be that it was removed since getting the queues, and in this | ||
1200 | * case it should've inactivated its queues anyway. | ||
1201 | */ | ||
1202 | if (IS_ERR_OR_NULL(sta)) | ||
1203 | continue; | ||
1204 | |||
1205 | mvmsta = iwl_mvm_sta_from_mac80211(sta); | ||
1206 | |||
1207 | spin_lock_bh(&mvmsta->lock); | ||
1208 | spin_lock(&mvm->queue_info_lock); | ||
1209 | iwl_mvm_remove_inactive_tids(mvm, mvmsta, i, | ||
1210 | inactive_tid_bitmap); | ||
1211 | spin_unlock(&mvm->queue_info_lock); | ||
1212 | spin_unlock_bh(&mvmsta->lock); | ||
1213 | } | ||
1214 | |||
1215 | rcu_read_unlock(); | ||
1216 | } | ||
1217 | |||
1042 | int iwl_mvm_send_lqm_cmd(struct ieee80211_vif *vif, | 1218 | int iwl_mvm_send_lqm_cmd(struct ieee80211_vif *vif, |
1043 | enum iwl_lqm_cmd_operatrions operation, | 1219 | enum iwl_lqm_cmd_operatrions operation, |
1044 | u32 duration, u32 timeout) | 1220 | u32 duration, u32 timeout) |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c index a588b05e38eb..78cf9a7f3eac 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c | |||
@@ -433,6 +433,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
433 | /* 8000 Series */ | 433 | /* 8000 Series */ |
434 | {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)}, | 434 | {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)}, |
435 | {IWL_PCI_DEVICE(0x24F3, 0x1010, iwl8260_2ac_cfg)}, | 435 | {IWL_PCI_DEVICE(0x24F3, 0x1010, iwl8260_2ac_cfg)}, |
436 | {IWL_PCI_DEVICE(0x24F3, 0x10B0, iwl8260_2ac_cfg)}, | ||
436 | {IWL_PCI_DEVICE(0x24F3, 0x0130, iwl8260_2ac_cfg)}, | 437 | {IWL_PCI_DEVICE(0x24F3, 0x0130, iwl8260_2ac_cfg)}, |
437 | {IWL_PCI_DEVICE(0x24F3, 0x1130, iwl8260_2ac_cfg)}, | 438 | {IWL_PCI_DEVICE(0x24F3, 0x1130, iwl8260_2ac_cfg)}, |
438 | {IWL_PCI_DEVICE(0x24F3, 0x0132, iwl8260_2ac_cfg)}, | 439 | {IWL_PCI_DEVICE(0x24F3, 0x0132, iwl8260_2ac_cfg)}, |
@@ -454,6 +455,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
454 | {IWL_PCI_DEVICE(0x24F3, 0xD010, iwl8260_2ac_cfg)}, | 455 | {IWL_PCI_DEVICE(0x24F3, 0xD010, iwl8260_2ac_cfg)}, |
455 | {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)}, | 456 | {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)}, |
456 | {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)}, | 457 | {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)}, |
458 | {IWL_PCI_DEVICE(0x24F3, 0xD0B0, iwl8260_2ac_cfg)}, | ||
459 | {IWL_PCI_DEVICE(0x24F3, 0xB0B0, iwl8260_2ac_cfg)}, | ||
457 | {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)}, | 460 | {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)}, |
458 | {IWL_PCI_DEVICE(0x24F3, 0x8110, iwl8260_2ac_cfg)}, | 461 | {IWL_PCI_DEVICE(0x24F3, 0x8110, iwl8260_2ac_cfg)}, |
459 | {IWL_PCI_DEVICE(0x24F3, 0x9010, iwl8260_2ac_cfg)}, | 462 | {IWL_PCI_DEVICE(0x24F3, 0x9010, iwl8260_2ac_cfg)}, |
@@ -481,6 +484,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
481 | {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)}, | 484 | {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)}, |
482 | {IWL_PCI_DEVICE(0x24FD, 0x0110, iwl8265_2ac_cfg)}, | 485 | {IWL_PCI_DEVICE(0x24FD, 0x0110, iwl8265_2ac_cfg)}, |
483 | {IWL_PCI_DEVICE(0x24FD, 0x1110, iwl8265_2ac_cfg)}, | 486 | {IWL_PCI_DEVICE(0x24FD, 0x1110, iwl8265_2ac_cfg)}, |
487 | {IWL_PCI_DEVICE(0x24FD, 0x1130, iwl8265_2ac_cfg)}, | ||
488 | {IWL_PCI_DEVICE(0x24FD, 0x0130, iwl8265_2ac_cfg)}, | ||
484 | {IWL_PCI_DEVICE(0x24FD, 0x1010, iwl8265_2ac_cfg)}, | 489 | {IWL_PCI_DEVICE(0x24FD, 0x1010, iwl8265_2ac_cfg)}, |
485 | {IWL_PCI_DEVICE(0x24FD, 0x0050, iwl8265_2ac_cfg)}, | 490 | {IWL_PCI_DEVICE(0x24FD, 0x0050, iwl8265_2ac_cfg)}, |
486 | {IWL_PCI_DEVICE(0x24FD, 0x0150, iwl8265_2ac_cfg)}, | 491 | {IWL_PCI_DEVICE(0x24FD, 0x0150, iwl8265_2ac_cfg)}, |
@@ -491,6 +496,10 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
491 | {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)}, | 496 | {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)}, |
492 | {IWL_PCI_DEVICE(0x24FD, 0x9110, iwl8265_2ac_cfg)}, | 497 | {IWL_PCI_DEVICE(0x24FD, 0x9110, iwl8265_2ac_cfg)}, |
493 | {IWL_PCI_DEVICE(0x24FD, 0x8130, iwl8265_2ac_cfg)}, | 498 | {IWL_PCI_DEVICE(0x24FD, 0x8130, iwl8265_2ac_cfg)}, |
499 | {IWL_PCI_DEVICE(0x24FD, 0x0910, iwl8265_2ac_cfg)}, | ||
500 | {IWL_PCI_DEVICE(0x24FD, 0x0930, iwl8265_2ac_cfg)}, | ||
501 | {IWL_PCI_DEVICE(0x24FD, 0x0950, iwl8265_2ac_cfg)}, | ||
502 | {IWL_PCI_DEVICE(0x24FD, 0x0850, iwl8265_2ac_cfg)}, | ||
494 | 503 | ||
495 | /* 9000 Series */ | 504 | /* 9000 Series */ |
496 | {IWL_PCI_DEVICE(0x2526, 0x0000, iwl9260_2ac_cfg)}, | 505 | {IWL_PCI_DEVICE(0x2526, 0x0000, iwl9260_2ac_cfg)}, |
@@ -507,6 +516,9 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
507 | {IWL_PCI_DEVICE(0x2526, 0x1420, iwl5165_2ac_cfg)}, | 516 | {IWL_PCI_DEVICE(0x2526, 0x1420, iwl5165_2ac_cfg)}, |
508 | {IWL_PCI_DEVICE(0x9DF0, 0x0710, iwl5165_2ac_cfg)}, | 517 | {IWL_PCI_DEVICE(0x9DF0, 0x0710, iwl5165_2ac_cfg)}, |
509 | {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)}, | 518 | {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)}, |
519 | |||
520 | /* a000 Series */ | ||
521 | {IWL_PCI_DEVICE(0x2720, 0x0A10, iwla000_2ac_cfg)}, | ||
510 | #endif /* CONFIG_IWLMVM */ | 522 | #endif /* CONFIG_IWLMVM */ |
511 | 523 | ||
512 | {0} | 524 | {0} |
@@ -598,7 +610,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
598 | const struct iwl_cfg *cfg_7265d __maybe_unused = NULL; | 610 | const struct iwl_cfg *cfg_7265d __maybe_unused = NULL; |
599 | const struct iwl_cfg *cfg_9260lc __maybe_unused = NULL; | 611 | const struct iwl_cfg *cfg_9260lc __maybe_unused = NULL; |
600 | struct iwl_trans *iwl_trans; | 612 | struct iwl_trans *iwl_trans; |
601 | struct iwl_trans_pcie *trans_pcie; | ||
602 | int ret; | 613 | int ret; |
603 | 614 | ||
604 | iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); | 615 | iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); |
@@ -636,12 +647,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
636 | #endif | 647 | #endif |
637 | 648 | ||
638 | pci_set_drvdata(pdev, iwl_trans); | 649 | pci_set_drvdata(pdev, iwl_trans); |
650 | iwl_trans->drv = iwl_drv_start(iwl_trans, cfg); | ||
639 | 651 | ||
640 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); | 652 | if (IS_ERR(iwl_trans->drv)) { |
641 | trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); | 653 | ret = PTR_ERR(iwl_trans->drv); |
642 | |||
643 | if (IS_ERR(trans_pcie->drv)) { | ||
644 | ret = PTR_ERR(trans_pcie->drv); | ||
645 | goto out_free_trans; | 654 | goto out_free_trans; |
646 | } | 655 | } |
647 | 656 | ||
@@ -680,7 +689,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
680 | return 0; | 689 | return 0; |
681 | 690 | ||
682 | out_free_drv: | 691 | out_free_drv: |
683 | iwl_drv_stop(trans_pcie->drv); | 692 | iwl_drv_stop(iwl_trans->drv); |
684 | out_free_trans: | 693 | out_free_trans: |
685 | iwl_trans_pcie_free(iwl_trans); | 694 | iwl_trans_pcie_free(iwl_trans); |
686 | return ret; | 695 | return ret; |
@@ -689,7 +698,6 @@ out_free_trans: | |||
689 | static void iwl_pci_remove(struct pci_dev *pdev) | 698 | static void iwl_pci_remove(struct pci_dev *pdev) |
690 | { | 699 | { |
691 | struct iwl_trans *trans = pci_get_drvdata(pdev); | 700 | struct iwl_trans *trans = pci_get_drvdata(pdev); |
692 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
693 | 701 | ||
694 | /* if RTPM was in use, restore it to the state before probe */ | 702 | /* if RTPM was in use, restore it to the state before probe */ |
695 | if (trans->runtime_pm_mode != IWL_PLAT_PM_MODE_DISABLED) { | 703 | if (trans->runtime_pm_mode != IWL_PLAT_PM_MODE_DISABLED) { |
@@ -700,7 +708,7 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
700 | pm_runtime_forbid(trans->dev); | 708 | pm_runtime_forbid(trans->dev); |
701 | } | 709 | } |
702 | 710 | ||
703 | iwl_drv_stop(trans_pcie->drv); | 711 | iwl_drv_stop(trans->drv); |
704 | 712 | ||
705 | iwl_trans_pcie_free(trans); | 713 | iwl_trans_pcie_free(trans); |
706 | } | 714 | } |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h index de6974f9c52f..11e347dd44c7 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h | |||
@@ -68,12 +68,14 @@ struct iwl_host_cmd; | |||
68 | * struct iwl_rx_mem_buffer | 68 | * struct iwl_rx_mem_buffer |
69 | * @page_dma: bus address of rxb page | 69 | * @page_dma: bus address of rxb page |
70 | * @page: driver's pointer to the rxb page | 70 | * @page: driver's pointer to the rxb page |
71 | * @invalid: rxb is in driver ownership - not owned by HW | ||
71 | * @vid: index of this rxb in the global table | 72 | * @vid: index of this rxb in the global table |
72 | */ | 73 | */ |
73 | struct iwl_rx_mem_buffer { | 74 | struct iwl_rx_mem_buffer { |
74 | dma_addr_t page_dma; | 75 | dma_addr_t page_dma; |
75 | struct page *page; | 76 | struct page *page; |
76 | u16 vid; | 77 | u16 vid; |
78 | bool invalid; | ||
77 | struct list_head list; | 79 | struct list_head list; |
78 | }; | 80 | }; |
79 | 81 | ||
@@ -230,15 +232,16 @@ struct iwl_queue { | |||
230 | #define TFD_CMD_SLOTS 32 | 232 | #define TFD_CMD_SLOTS 32 |
231 | 233 | ||
232 | /* | 234 | /* |
233 | * The FH will write back to the first TB only, so we need | 235 | * The FH will write back to the first TB only, so we need to copy some data |
234 | * to copy some data into the buffer regardless of whether | 236 | * into the buffer regardless of whether it should be mapped or not. |
235 | * it should be mapped or not. This indicates how big the | 237 | * This indicates how big the first TB must be to include the scratch buffer |
236 | * first TB must be to include the scratch buffer. Since | 238 | * and the assigned PN. |
237 | * the scratch is 4 bytes at offset 12, it's 16 now. If we | 239 | * Since PN location is 16 bytes at offset 24, it's 40 now. |
238 | * make it bigger then allocations will be bigger and copy | 240 | * If we make it bigger then allocations will be bigger and copy slower, so |
239 | * slower, so that's probably not useful. | 241 | * that's probably not useful. |
240 | */ | 242 | */ |
241 | #define IWL_HCMD_SCRATCHBUF_SIZE 16 | 243 | #define IWL_FIRST_TB_SIZE 40 |
244 | #define IWL_FIRST_TB_SIZE_ALIGN ALIGN(IWL_FIRST_TB_SIZE, 64) | ||
242 | 245 | ||
243 | struct iwl_pcie_txq_entry { | 246 | struct iwl_pcie_txq_entry { |
244 | struct iwl_device_cmd *cmd; | 247 | struct iwl_device_cmd *cmd; |
@@ -248,20 +251,18 @@ struct iwl_pcie_txq_entry { | |||
248 | struct iwl_cmd_meta meta; | 251 | struct iwl_cmd_meta meta; |
249 | }; | 252 | }; |
250 | 253 | ||
251 | struct iwl_pcie_txq_scratch_buf { | 254 | struct iwl_pcie_first_tb_buf { |
252 | struct iwl_cmd_header hdr; | 255 | u8 buf[IWL_FIRST_TB_SIZE_ALIGN]; |
253 | u8 buf[8]; | ||
254 | __le32 scratch; | ||
255 | }; | 256 | }; |
256 | 257 | ||
257 | /** | 258 | /** |
258 | * struct iwl_txq - Tx Queue for DMA | 259 | * struct iwl_txq - Tx Queue for DMA |
259 | * @q: generic Rx/Tx queue descriptor | 260 | * @q: generic Rx/Tx queue descriptor |
260 | * @tfds: transmit frame descriptors (DMA memory) | 261 | * @tfds: transmit frame descriptors (DMA memory) |
261 | * @scratchbufs: start of command headers, including scratch buffers, for | 262 | * @first_tb_bufs: start of command headers, including scratch buffers, for |
262 | * the writeback -- this is DMA memory and an array holding one buffer | 263 | * the writeback -- this is DMA memory and an array holding one buffer |
263 | * for each command on the queue | 264 | * for each command on the queue |
264 | * @scratchbufs_dma: DMA address for the scratchbufs start | 265 | * @first_tb_dma: DMA address for the first_tb_bufs start |
265 | * @entries: transmit entries (driver state) | 266 | * @entries: transmit entries (driver state) |
266 | * @lock: queue lock | 267 | * @lock: queue lock |
267 | * @stuck_timer: timer that fires if queue gets stuck | 268 | * @stuck_timer: timer that fires if queue gets stuck |
@@ -279,8 +280,8 @@ struct iwl_pcie_txq_scratch_buf { | |||
279 | struct iwl_txq { | 280 | struct iwl_txq { |
280 | struct iwl_queue q; | 281 | struct iwl_queue q; |
281 | struct iwl_tfd *tfds; | 282 | struct iwl_tfd *tfds; |
282 | struct iwl_pcie_txq_scratch_buf *scratchbufs; | 283 | struct iwl_pcie_first_tb_buf *first_tb_bufs; |
283 | dma_addr_t scratchbufs_dma; | 284 | dma_addr_t first_tb_dma; |
284 | struct iwl_pcie_txq_entry *entries; | 285 | struct iwl_pcie_txq_entry *entries; |
285 | spinlock_t lock; | 286 | spinlock_t lock; |
286 | unsigned long frozen_expiry_remainder; | 287 | unsigned long frozen_expiry_remainder; |
@@ -296,10 +297,10 @@ struct iwl_txq { | |||
296 | }; | 297 | }; |
297 | 298 | ||
298 | static inline dma_addr_t | 299 | static inline dma_addr_t |
299 | iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx) | 300 | iwl_pcie_get_first_tb_dma(struct iwl_txq *txq, int idx) |
300 | { | 301 | { |
301 | return txq->scratchbufs_dma + | 302 | return txq->first_tb_dma + |
302 | sizeof(struct iwl_pcie_txq_scratch_buf) * idx; | 303 | sizeof(struct iwl_pcie_first_tb_buf) * idx; |
303 | } | 304 | } |
304 | 305 | ||
305 | struct iwl_tso_hdr_page { | 306 | struct iwl_tso_hdr_page { |
@@ -313,7 +314,6 @@ struct iwl_tso_hdr_page { | |||
313 | * @rx_pool: initial pool of iwl_rx_mem_buffer for all the queues | 314 | * @rx_pool: initial pool of iwl_rx_mem_buffer for all the queues |
314 | * @global_table: table mapping received VID from hw to rxb | 315 | * @global_table: table mapping received VID from hw to rxb |
315 | * @rba: allocator for RX replenishing | 316 | * @rba: allocator for RX replenishing |
316 | * @drv - pointer to iwl_drv | ||
317 | * @trans: pointer to the generic transport area | 317 | * @trans: pointer to the generic transport area |
318 | * @scd_base_addr: scheduler sram base address in SRAM | 318 | * @scd_base_addr: scheduler sram base address in SRAM |
319 | * @scd_bc_tbls: pointer to the byte count table of the scheduler | 319 | * @scd_bc_tbls: pointer to the byte count table of the scheduler |
@@ -351,7 +351,6 @@ struct iwl_trans_pcie { | |||
351 | struct iwl_rx_mem_buffer *global_table[RX_POOL_SIZE]; | 351 | struct iwl_rx_mem_buffer *global_table[RX_POOL_SIZE]; |
352 | struct iwl_rb_allocator rba; | 352 | struct iwl_rb_allocator rba; |
353 | struct iwl_trans *trans; | 353 | struct iwl_trans *trans; |
354 | struct iwl_drv *drv; | ||
355 | 354 | ||
356 | struct net_device napi_dev; | 355 | struct net_device napi_dev; |
357 | 356 | ||
@@ -385,6 +384,8 @@ struct iwl_trans_pcie { | |||
385 | wait_queue_head_t wait_command_queue; | 384 | wait_queue_head_t wait_command_queue; |
386 | wait_queue_head_t d0i3_waitq; | 385 | wait_queue_head_t d0i3_waitq; |
387 | 386 | ||
387 | u8 page_offs, dev_cmd_offs; | ||
388 | |||
388 | u8 cmd_queue; | 389 | u8 cmd_queue; |
389 | u8 cmd_fifo; | 390 | u8 cmd_fifo; |
390 | unsigned int cmd_q_wdg_timeout; | 391 | unsigned int cmd_q_wdg_timeout; |
@@ -471,6 +472,10 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int queue, u16 ssn, | |||
471 | unsigned int wdg_timeout); | 472 | unsigned int wdg_timeout); |
472 | void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue, | 473 | void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue, |
473 | bool configure_scd); | 474 | bool configure_scd); |
475 | void iwl_trans_pcie_txq_set_shared_mode(struct iwl_trans *trans, u32 txq_id, | ||
476 | bool shared_mode); | ||
477 | void iwl_trans_pcie_log_scd_error(struct iwl_trans *trans, | ||
478 | struct iwl_txq *txq); | ||
474 | int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | 479 | int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, |
475 | struct iwl_device_cmd *dev_cmd, int txq_id); | 480 | struct iwl_device_cmd *dev_cmd, int txq_id); |
476 | void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans); | 481 | void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans); |
@@ -496,7 +501,7 @@ void iwl_pcie_dump_csr(struct iwl_trans *trans); | |||
496 | /***************************************************** | 501 | /***************************************************** |
497 | * Helpers | 502 | * Helpers |
498 | ******************************************************/ | 503 | ******************************************************/ |
499 | static inline void iwl_disable_interrupts(struct iwl_trans *trans) | 504 | static inline void _iwl_disable_interrupts(struct iwl_trans *trans) |
500 | { | 505 | { |
501 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 506 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
502 | 507 | ||
@@ -519,7 +524,16 @@ static inline void iwl_disable_interrupts(struct iwl_trans *trans) | |||
519 | IWL_DEBUG_ISR(trans, "Disabled interrupts\n"); | 524 | IWL_DEBUG_ISR(trans, "Disabled interrupts\n"); |
520 | } | 525 | } |
521 | 526 | ||
522 | static inline void iwl_enable_interrupts(struct iwl_trans *trans) | 527 | static inline void iwl_disable_interrupts(struct iwl_trans *trans) |
528 | { | ||
529 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
530 | |||
531 | spin_lock(&trans_pcie->irq_lock); | ||
532 | _iwl_disable_interrupts(trans); | ||
533 | spin_unlock(&trans_pcie->irq_lock); | ||
534 | } | ||
535 | |||
536 | static inline void _iwl_enable_interrupts(struct iwl_trans *trans) | ||
523 | { | 537 | { |
524 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 538 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
525 | 539 | ||
@@ -542,6 +556,14 @@ static inline void iwl_enable_interrupts(struct iwl_trans *trans) | |||
542 | } | 556 | } |
543 | } | 557 | } |
544 | 558 | ||
559 | static inline void iwl_enable_interrupts(struct iwl_trans *trans) | ||
560 | { | ||
561 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
562 | |||
563 | spin_lock(&trans_pcie->irq_lock); | ||
564 | _iwl_enable_interrupts(trans); | ||
565 | spin_unlock(&trans_pcie->irq_lock); | ||
566 | } | ||
545 | static inline void iwl_enable_hw_int_msk_msix(struct iwl_trans *trans, u32 msk) | 567 | static inline void iwl_enable_hw_int_msk_msix(struct iwl_trans *trans, u32 msk) |
546 | { | 568 | { |
547 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 569 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
@@ -673,4 +695,6 @@ static inline int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans) | |||
673 | int iwl_pci_fw_exit_d0i3(struct iwl_trans *trans); | 695 | int iwl_pci_fw_exit_d0i3(struct iwl_trans *trans); |
674 | int iwl_pci_fw_enter_d0i3(struct iwl_trans *trans); | 696 | int iwl_pci_fw_enter_d0i3(struct iwl_trans *trans); |
675 | 697 | ||
698 | void iwl_pcie_enable_rx_wake(struct iwl_trans *trans, bool enable); | ||
699 | |||
676 | #endif /* __iwl_trans_int_pcie_h__ */ | 700 | #endif /* __iwl_trans_int_pcie_h__ */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c index 0a4a3c502c3c..5c36e6d00622 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c | |||
@@ -161,21 +161,21 @@ static inline __le32 iwl_pcie_dma_addr2rbd_ptr(dma_addr_t dma_addr) | |||
161 | return cpu_to_le32((u32)(dma_addr >> 8)); | 161 | return cpu_to_le32((u32)(dma_addr >> 8)); |
162 | } | 162 | } |
163 | 163 | ||
164 | static void iwl_pcie_write_prph_64_no_grab(struct iwl_trans *trans, u64 ofs, | ||
165 | u64 val) | ||
166 | { | ||
167 | iwl_write_prph_no_grab(trans, ofs, val & 0xffffffff); | ||
168 | iwl_write_prph_no_grab(trans, ofs + 4, val >> 32); | ||
169 | } | ||
170 | |||
171 | /* | 164 | /* |
172 | * iwl_pcie_rx_stop - stops the Rx DMA | 165 | * iwl_pcie_rx_stop - stops the Rx DMA |
173 | */ | 166 | */ |
174 | int iwl_pcie_rx_stop(struct iwl_trans *trans) | 167 | int iwl_pcie_rx_stop(struct iwl_trans *trans) |
175 | { | 168 | { |
176 | iwl_write_direct32(trans, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); | 169 | if (trans->cfg->mq_rx_supported) { |
177 | return iwl_poll_direct_bit(trans, FH_MEM_RSSR_RX_STATUS_REG, | 170 | iwl_write_prph(trans, RFH_RXF_DMA_CFG, 0); |
178 | FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); | 171 | return iwl_poll_prph_bit(trans, RFH_GEN_STATUS, |
172 | RXF_DMA_IDLE, RXF_DMA_IDLE, 1000); | ||
173 | } else { | ||
174 | iwl_write_direct32(trans, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); | ||
175 | return iwl_poll_direct_bit(trans, FH_MEM_RSSR_RX_STATUS_REG, | ||
176 | FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, | ||
177 | 1000); | ||
178 | } | ||
179 | } | 179 | } |
180 | 180 | ||
181 | /* | 181 | /* |
@@ -211,12 +211,8 @@ static void iwl_pcie_rxq_inc_wr_ptr(struct iwl_trans *trans, | |||
211 | if (trans->cfg->mq_rx_supported) | 211 | if (trans->cfg->mq_rx_supported) |
212 | iwl_write32(trans, RFH_Q_FRBDCB_WIDX_TRG(rxq->id), | 212 | iwl_write32(trans, RFH_Q_FRBDCB_WIDX_TRG(rxq->id), |
213 | rxq->write_actual); | 213 | rxq->write_actual); |
214 | /* | 214 | else |
215 | * write to FH_RSCSR_CHNL0_WPTR register even in MQ as a W/A to | 215 | iwl_write32(trans, FH_RSCSR_CHNL0_WPTR, rxq->write_actual); |
216 | * hardware shadow registers bug - writing to RFH_Q_FRBDCB_WIDX will | ||
217 | * not wake the NIC. | ||
218 | */ | ||
219 | iwl_write32(trans, FH_RSCSR_CHNL0_WPTR, rxq->write_actual); | ||
220 | } | 216 | } |
221 | 217 | ||
222 | static void iwl_pcie_rxq_check_wrptr(struct iwl_trans *trans) | 218 | static void iwl_pcie_rxq_check_wrptr(struct iwl_trans *trans) |
@@ -237,10 +233,10 @@ static void iwl_pcie_rxq_check_wrptr(struct iwl_trans *trans) | |||
237 | } | 233 | } |
238 | 234 | ||
239 | /* | 235 | /* |
240 | * iwl_pcie_rxq_mq_restock - restock implementation for multi-queue rx | 236 | * iwl_pcie_rxmq_restock - restock implementation for multi-queue rx |
241 | */ | 237 | */ |
242 | static void iwl_pcie_rxq_mq_restock(struct iwl_trans *trans, | 238 | static void iwl_pcie_rxmq_restock(struct iwl_trans *trans, |
243 | struct iwl_rxq *rxq) | 239 | struct iwl_rxq *rxq) |
244 | { | 240 | { |
245 | struct iwl_rx_mem_buffer *rxb; | 241 | struct iwl_rx_mem_buffer *rxb; |
246 | 242 | ||
@@ -263,7 +259,7 @@ static void iwl_pcie_rxq_mq_restock(struct iwl_trans *trans, | |||
263 | rxb = list_first_entry(&rxq->rx_free, struct iwl_rx_mem_buffer, | 259 | rxb = list_first_entry(&rxq->rx_free, struct iwl_rx_mem_buffer, |
264 | list); | 260 | list); |
265 | list_del(&rxb->list); | 261 | list_del(&rxb->list); |
266 | 262 | rxb->invalid = false; | |
267 | /* 12 first bits are expected to be empty */ | 263 | /* 12 first bits are expected to be empty */ |
268 | WARN_ON(rxb->page_dma & DMA_BIT_MASK(12)); | 264 | WARN_ON(rxb->page_dma & DMA_BIT_MASK(12)); |
269 | /* Point to Rx buffer via next RBD in circular buffer */ | 265 | /* Point to Rx buffer via next RBD in circular buffer */ |
@@ -285,10 +281,10 @@ static void iwl_pcie_rxq_mq_restock(struct iwl_trans *trans, | |||
285 | } | 281 | } |
286 | 282 | ||
287 | /* | 283 | /* |
288 | * iwl_pcie_rxq_sq_restock - restock implementation for single queue rx | 284 | * iwl_pcie_rxsq_restock - restock implementation for single queue rx |
289 | */ | 285 | */ |
290 | static void iwl_pcie_rxq_sq_restock(struct iwl_trans *trans, | 286 | static void iwl_pcie_rxsq_restock(struct iwl_trans *trans, |
291 | struct iwl_rxq *rxq) | 287 | struct iwl_rxq *rxq) |
292 | { | 288 | { |
293 | struct iwl_rx_mem_buffer *rxb; | 289 | struct iwl_rx_mem_buffer *rxb; |
294 | 290 | ||
@@ -314,6 +310,7 @@ static void iwl_pcie_rxq_sq_restock(struct iwl_trans *trans, | |||
314 | rxb = list_first_entry(&rxq->rx_free, struct iwl_rx_mem_buffer, | 310 | rxb = list_first_entry(&rxq->rx_free, struct iwl_rx_mem_buffer, |
315 | list); | 311 | list); |
316 | list_del(&rxb->list); | 312 | list_del(&rxb->list); |
313 | rxb->invalid = false; | ||
317 | 314 | ||
318 | /* Point to Rx buffer via next RBD in circular buffer */ | 315 | /* Point to Rx buffer via next RBD in circular buffer */ |
319 | bd[rxq->write] = iwl_pcie_dma_addr2rbd_ptr(rxb->page_dma); | 316 | bd[rxq->write] = iwl_pcie_dma_addr2rbd_ptr(rxb->page_dma); |
@@ -347,9 +344,9 @@ static | |||
347 | void iwl_pcie_rxq_restock(struct iwl_trans *trans, struct iwl_rxq *rxq) | 344 | void iwl_pcie_rxq_restock(struct iwl_trans *trans, struct iwl_rxq *rxq) |
348 | { | 345 | { |
349 | if (trans->cfg->mq_rx_supported) | 346 | if (trans->cfg->mq_rx_supported) |
350 | iwl_pcie_rxq_mq_restock(trans, rxq); | 347 | iwl_pcie_rxmq_restock(trans, rxq); |
351 | else | 348 | else |
352 | iwl_pcie_rxq_sq_restock(trans, rxq); | 349 | iwl_pcie_rxsq_restock(trans, rxq); |
353 | } | 350 | } |
354 | 351 | ||
355 | /* | 352 | /* |
@@ -764,6 +761,23 @@ static void iwl_pcie_rx_hw_init(struct iwl_trans *trans, struct iwl_rxq *rxq) | |||
764 | iwl_set_bit(trans, CSR_INT_COALESCING, IWL_HOST_INT_OPER_MODE); | 761 | iwl_set_bit(trans, CSR_INT_COALESCING, IWL_HOST_INT_OPER_MODE); |
765 | } | 762 | } |
766 | 763 | ||
764 | void iwl_pcie_enable_rx_wake(struct iwl_trans *trans, bool enable) | ||
765 | { | ||
766 | /* | ||
767 | * Turn on the chicken-bits that cause MAC wakeup for RX-related | ||
768 | * values. | ||
769 | * This costs some power, but needed for W/A 9000 integrated A-step | ||
770 | * bug where shadow registers are not in the retention list and their | ||
771 | * value is lost when NIC powers down | ||
772 | */ | ||
773 | if (trans->cfg->integrated) { | ||
774 | iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, | ||
775 | CSR_MAC_SHADOW_REG_CTRL_RX_WAKE); | ||
776 | iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTL2, | ||
777 | CSR_MAC_SHADOW_REG_CTL2_RX_WAKE); | ||
778 | } | ||
779 | } | ||
780 | |||
767 | static void iwl_pcie_rx_mq_hw_init(struct iwl_trans *trans) | 781 | static void iwl_pcie_rx_mq_hw_init(struct iwl_trans *trans) |
768 | { | 782 | { |
769 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 783 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
@@ -796,17 +810,17 @@ static void iwl_pcie_rx_mq_hw_init(struct iwl_trans *trans) | |||
796 | 810 | ||
797 | for (i = 0; i < trans->num_rx_queues; i++) { | 811 | for (i = 0; i < trans->num_rx_queues; i++) { |
798 | /* Tell device where to find RBD free table in DRAM */ | 812 | /* Tell device where to find RBD free table in DRAM */ |
799 | iwl_pcie_write_prph_64_no_grab(trans, | 813 | iwl_write_prph64_no_grab(trans, |
800 | RFH_Q_FRBDCB_BA_LSB(i), | 814 | RFH_Q_FRBDCB_BA_LSB(i), |
801 | trans_pcie->rxq[i].bd_dma); | 815 | trans_pcie->rxq[i].bd_dma); |
802 | /* Tell device where to find RBD used table in DRAM */ | 816 | /* Tell device where to find RBD used table in DRAM */ |
803 | iwl_pcie_write_prph_64_no_grab(trans, | 817 | iwl_write_prph64_no_grab(trans, |
804 | RFH_Q_URBDCB_BA_LSB(i), | 818 | RFH_Q_URBDCB_BA_LSB(i), |
805 | trans_pcie->rxq[i].used_bd_dma); | 819 | trans_pcie->rxq[i].used_bd_dma); |
806 | /* Tell device where in DRAM to update its Rx status */ | 820 | /* Tell device where in DRAM to update its Rx status */ |
807 | iwl_pcie_write_prph_64_no_grab(trans, | 821 | iwl_write_prph64_no_grab(trans, |
808 | RFH_Q_URBD_STTS_WPTR_LSB(i), | 822 | RFH_Q_URBD_STTS_WPTR_LSB(i), |
809 | trans_pcie->rxq[i].rb_stts_dma); | 823 | trans_pcie->rxq[i].rb_stts_dma); |
810 | /* Reset device indice tables */ | 824 | /* Reset device indice tables */ |
811 | iwl_write_prph_no_grab(trans, RFH_Q_FRBDCB_WIDX(i), 0); | 825 | iwl_write_prph_no_grab(trans, RFH_Q_FRBDCB_WIDX(i), 0); |
812 | iwl_write_prph_no_grab(trans, RFH_Q_FRBDCB_RIDX(i), 0); | 826 | iwl_write_prph_no_grab(trans, RFH_Q_FRBDCB_RIDX(i), 0); |
@@ -815,33 +829,32 @@ static void iwl_pcie_rx_mq_hw_init(struct iwl_trans *trans) | |||
815 | enabled |= BIT(i) | BIT(i + 16); | 829 | enabled |= BIT(i) | BIT(i + 16); |
816 | } | 830 | } |
817 | 831 | ||
818 | /* restock default queue */ | ||
819 | iwl_pcie_rxq_mq_restock(trans, &trans_pcie->rxq[0]); | ||
820 | |||
821 | /* | 832 | /* |
822 | * Enable Rx DMA | 833 | * Enable Rx DMA |
823 | * Single frame mode | ||
824 | * Rx buffer size 4 or 8k or 12k | 834 | * Rx buffer size 4 or 8k or 12k |
825 | * Min RB size 4 or 8 | 835 | * Min RB size 4 or 8 |
826 | * Drop frames that exceed RB size | 836 | * Drop frames that exceed RB size |
827 | * 512 RBDs | 837 | * 512 RBDs |
828 | */ | 838 | */ |
829 | iwl_write_prph_no_grab(trans, RFH_RXF_DMA_CFG, | 839 | iwl_write_prph_no_grab(trans, RFH_RXF_DMA_CFG, |
830 | RFH_DMA_EN_ENABLE_VAL | | 840 | RFH_DMA_EN_ENABLE_VAL | rb_size | |
831 | rb_size | RFH_RXF_DMA_SINGLE_FRAME_MASK | | ||
832 | RFH_RXF_DMA_MIN_RB_4_8 | | 841 | RFH_RXF_DMA_MIN_RB_4_8 | |
833 | RFH_RXF_DMA_DROP_TOO_LARGE_MASK | | 842 | RFH_RXF_DMA_DROP_TOO_LARGE_MASK | |
834 | RFH_RXF_DMA_RBDCB_SIZE_512); | 843 | RFH_RXF_DMA_RBDCB_SIZE_512); |
835 | 844 | ||
836 | /* | 845 | /* |
837 | * Activate DMA snooping. | 846 | * Activate DMA snooping. |
838 | * Set RX DMA chunk size to 64B | 847 | * Set RX DMA chunk size to 64B for IOSF and 128B for PCIe |
839 | * Default queue is 0 | 848 | * Default queue is 0 |
840 | */ | 849 | */ |
841 | iwl_write_prph_no_grab(trans, RFH_GEN_CFG, RFH_GEN_CFG_RFH_DMA_SNOOP | | 850 | iwl_write_prph_no_grab(trans, RFH_GEN_CFG, RFH_GEN_CFG_RFH_DMA_SNOOP | |
842 | (DEFAULT_RXQ_NUM << | 851 | (DEFAULT_RXQ_NUM << |
843 | RFH_GEN_CFG_DEFAULT_RXQ_NUM_POS) | | 852 | RFH_GEN_CFG_DEFAULT_RXQ_NUM_POS) | |
844 | RFH_GEN_CFG_SERVICE_DMA_SNOOP); | 853 | RFH_GEN_CFG_SERVICE_DMA_SNOOP | |
854 | (trans->cfg->integrated ? | ||
855 | RFH_GEN_CFG_RB_CHUNK_SIZE_64 : | ||
856 | RFH_GEN_CFG_RB_CHUNK_SIZE_128) << | ||
857 | RFH_GEN_CFG_RB_CHUNK_SIZE_POS); | ||
845 | /* Enable the relevant rx queues */ | 858 | /* Enable the relevant rx queues */ |
846 | iwl_write_prph_no_grab(trans, RFH_RXF_RXQ_ACTIVE, enabled); | 859 | iwl_write_prph_no_grab(trans, RFH_RXF_RXQ_ACTIVE, enabled); |
847 | 860 | ||
@@ -849,6 +862,8 @@ static void iwl_pcie_rx_mq_hw_init(struct iwl_trans *trans) | |||
849 | 862 | ||
850 | /* Set interrupt coalescing timer to default (2048 usecs) */ | 863 | /* Set interrupt coalescing timer to default (2048 usecs) */ |
851 | iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_TIMEOUT_DEF); | 864 | iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_TIMEOUT_DEF); |
865 | |||
866 | iwl_pcie_enable_rx_wake(trans, true); | ||
852 | } | 867 | } |
853 | 868 | ||
854 | static void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq) | 869 | static void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq) |
@@ -939,16 +954,18 @@ int iwl_pcie_rx_init(struct iwl_trans *trans) | |||
939 | else | 954 | else |
940 | list_add(&rxb->list, &def_rxq->rx_used); | 955 | list_add(&rxb->list, &def_rxq->rx_used); |
941 | trans_pcie->global_table[i] = rxb; | 956 | trans_pcie->global_table[i] = rxb; |
942 | rxb->vid = (u16)i; | 957 | rxb->vid = (u16)(i + 1); |
958 | rxb->invalid = true; | ||
943 | } | 959 | } |
944 | 960 | ||
945 | iwl_pcie_rxq_alloc_rbs(trans, GFP_KERNEL, def_rxq); | 961 | iwl_pcie_rxq_alloc_rbs(trans, GFP_KERNEL, def_rxq); |
946 | if (trans->cfg->mq_rx_supported) { | 962 | |
963 | if (trans->cfg->mq_rx_supported) | ||
947 | iwl_pcie_rx_mq_hw_init(trans); | 964 | iwl_pcie_rx_mq_hw_init(trans); |
948 | } else { | 965 | else |
949 | iwl_pcie_rxq_sq_restock(trans, def_rxq); | ||
950 | iwl_pcie_rx_hw_init(trans, def_rxq); | 966 | iwl_pcie_rx_hw_init(trans, def_rxq); |
951 | } | 967 | |
968 | iwl_pcie_rxq_restock(trans, def_rxq); | ||
952 | 969 | ||
953 | spin_lock(&def_rxq->lock); | 970 | spin_lock(&def_rxq->lock); |
954 | iwl_pcie_rxq_inc_wr_ptr(trans, def_rxq); | 971 | iwl_pcie_rxq_inc_wr_ptr(trans, def_rxq); |
@@ -1087,6 +1104,9 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, | |||
1087 | if (pkt->len_n_flags == cpu_to_le32(FH_RSCSR_FRAME_INVALID)) | 1104 | if (pkt->len_n_flags == cpu_to_le32(FH_RSCSR_FRAME_INVALID)) |
1088 | break; | 1105 | break; |
1089 | 1106 | ||
1107 | WARN_ON((le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_RXQ_MASK) >> | ||
1108 | FH_RSCSR_RXQ_POS != rxq->id); | ||
1109 | |||
1090 | IWL_DEBUG_RX(trans, | 1110 | IWL_DEBUG_RX(trans, |
1091 | "cmd at offset %d: %s (0x%.2x, seq 0x%x)\n", | 1111 | "cmd at offset %d: %s (0x%.2x, seq 0x%x)\n", |
1092 | rxcb._offset, | 1112 | rxcb._offset, |
@@ -1224,10 +1244,19 @@ restart: | |||
1224 | */ | 1244 | */ |
1225 | u16 vid = le32_to_cpu(rxq->used_bd[i]) & 0x0FFF; | 1245 | u16 vid = le32_to_cpu(rxq->used_bd[i]) & 0x0FFF; |
1226 | 1246 | ||
1227 | if (WARN(vid >= ARRAY_SIZE(trans_pcie->global_table), | 1247 | if (WARN(!vid || |
1228 | "Invalid rxb index from HW %u\n", (u32)vid)) | 1248 | vid > ARRAY_SIZE(trans_pcie->global_table), |
1249 | "Invalid rxb index from HW %u\n", (u32)vid)) { | ||
1250 | iwl_force_nmi(trans); | ||
1251 | goto out; | ||
1252 | } | ||
1253 | rxb = trans_pcie->global_table[vid - 1]; | ||
1254 | if (WARN(rxb->invalid, | ||
1255 | "Invalid rxb from HW %u\n", (u32)vid)) { | ||
1256 | iwl_force_nmi(trans); | ||
1229 | goto out; | 1257 | goto out; |
1230 | rxb = trans_pcie->global_table[vid]; | 1258 | } |
1259 | rxb->invalid = true; | ||
1231 | } else { | 1260 | } else { |
1232 | rxb = rxq->queue[i]; | 1261 | rxb = rxq->queue[i]; |
1233 | rxq->queue[i] = NULL; | 1262 | rxq->queue[i] = NULL; |
@@ -1507,7 +1536,7 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
1507 | * have anything to service | 1536 | * have anything to service |
1508 | */ | 1537 | */ |
1509 | if (test_bit(STATUS_INT_ENABLED, &trans->status)) | 1538 | if (test_bit(STATUS_INT_ENABLED, &trans->status)) |
1510 | iwl_enable_interrupts(trans); | 1539 | _iwl_enable_interrupts(trans); |
1511 | spin_unlock(&trans_pcie->irq_lock); | 1540 | spin_unlock(&trans_pcie->irq_lock); |
1512 | lock_map_release(&trans->sync_cmd_lockdep_map); | 1541 | lock_map_release(&trans->sync_cmd_lockdep_map); |
1513 | return IRQ_NONE; | 1542 | return IRQ_NONE; |
@@ -1699,15 +1728,17 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
1699 | inta & ~trans_pcie->inta_mask); | 1728 | inta & ~trans_pcie->inta_mask); |
1700 | } | 1729 | } |
1701 | 1730 | ||
1731 | spin_lock(&trans_pcie->irq_lock); | ||
1732 | /* only Re-enable all interrupt if disabled by irq */ | ||
1733 | if (test_bit(STATUS_INT_ENABLED, &trans->status)) | ||
1734 | _iwl_enable_interrupts(trans); | ||
1702 | /* we are loading the firmware, enable FH_TX interrupt only */ | 1735 | /* we are loading the firmware, enable FH_TX interrupt only */ |
1703 | if (handled & CSR_INT_BIT_FH_TX) | 1736 | else if (handled & CSR_INT_BIT_FH_TX) |
1704 | iwl_enable_fw_load_int(trans); | 1737 | iwl_enable_fw_load_int(trans); |
1705 | /* only Re-enable all interrupt if disabled by irq */ | ||
1706 | else if (test_bit(STATUS_INT_ENABLED, &trans->status)) | ||
1707 | iwl_enable_interrupts(trans); | ||
1708 | /* Re-enable RF_KILL if it occurred */ | 1738 | /* Re-enable RF_KILL if it occurred */ |
1709 | else if (handled & CSR_INT_BIT_RF_KILL) | 1739 | else if (handled & CSR_INT_BIT_RF_KILL) |
1710 | iwl_enable_rfkill_int(trans); | 1740 | iwl_enable_rfkill_int(trans); |
1741 | spin_unlock(&trans_pcie->irq_lock); | ||
1711 | 1742 | ||
1712 | out: | 1743 | out: |
1713 | lock_map_release(&trans->sync_cmd_lockdep_map); | 1744 | lock_map_release(&trans->sync_cmd_lockdep_map); |
@@ -1771,7 +1802,7 @@ void iwl_pcie_reset_ict(struct iwl_trans *trans) | |||
1771 | return; | 1802 | return; |
1772 | 1803 | ||
1773 | spin_lock(&trans_pcie->irq_lock); | 1804 | spin_lock(&trans_pcie->irq_lock); |
1774 | iwl_disable_interrupts(trans); | 1805 | _iwl_disable_interrupts(trans); |
1775 | 1806 | ||
1776 | memset(trans_pcie->ict_tbl, 0, ICT_SIZE); | 1807 | memset(trans_pcie->ict_tbl, 0, ICT_SIZE); |
1777 | 1808 | ||
@@ -1787,7 +1818,7 @@ void iwl_pcie_reset_ict(struct iwl_trans *trans) | |||
1787 | trans_pcie->use_ict = true; | 1818 | trans_pcie->use_ict = true; |
1788 | trans_pcie->ict_index = 0; | 1819 | trans_pcie->ict_index = 0; |
1789 | iwl_write32(trans, CSR_INT, trans_pcie->inta_mask); | 1820 | iwl_write32(trans, CSR_INT, trans_pcie->inta_mask); |
1790 | iwl_enable_interrupts(trans); | 1821 | _iwl_enable_interrupts(trans); |
1791 | spin_unlock(&trans_pcie->irq_lock); | 1822 | spin_unlock(&trans_pcie->irq_lock); |
1792 | } | 1823 | } |
1793 | 1824 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index f603d7830a6b..74f2f035bd28 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c | |||
@@ -608,18 +608,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) | |||
608 | /* | 608 | /* |
609 | * ucode | 609 | * ucode |
610 | */ | 610 | */ |
611 | static int iwl_pcie_load_firmware_chunk(struct iwl_trans *trans, u32 dst_addr, | 611 | static void iwl_pcie_load_firmware_chunk_fh(struct iwl_trans *trans, |
612 | dma_addr_t phy_addr, u32 byte_cnt) | 612 | u32 dst_addr, dma_addr_t phy_addr, |
613 | u32 byte_cnt) | ||
613 | { | 614 | { |
614 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
615 | unsigned long flags; | ||
616 | int ret; | ||
617 | |||
618 | trans_pcie->ucode_write_complete = false; | ||
619 | |||
620 | if (!iwl_trans_grab_nic_access(trans, &flags)) | ||
621 | return -EIO; | ||
622 | |||
623 | iwl_write32(trans, FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), | 615 | iwl_write32(trans, FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), |
624 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE); | 616 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE); |
625 | 617 | ||
@@ -642,7 +634,50 @@ static int iwl_pcie_load_firmware_chunk(struct iwl_trans *trans, u32 dst_addr, | |||
642 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | | 634 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | |
643 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | | 635 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | |
644 | FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); | 636 | FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); |
637 | } | ||
638 | |||
639 | static void iwl_pcie_load_firmware_chunk_tfh(struct iwl_trans *trans, | ||
640 | u32 dst_addr, dma_addr_t phy_addr, | ||
641 | u32 byte_cnt) | ||
642 | { | ||
643 | /* Stop DMA channel */ | ||
644 | iwl_write32(trans, TFH_SRV_DMA_CHNL0_CTRL, 0); | ||
645 | |||
646 | /* Configure SRAM address */ | ||
647 | iwl_write32(trans, TFH_SRV_DMA_CHNL0_SRAM_ADDR, | ||
648 | dst_addr); | ||
649 | |||
650 | /* Configure DRAM address - 64 bit */ | ||
651 | iwl_write64(trans, TFH_SRV_DMA_CHNL0_DRAM_ADDR, phy_addr); | ||
652 | |||
653 | /* Configure byte count to transfer */ | ||
654 | iwl_write32(trans, TFH_SRV_DMA_CHNL0_BC, byte_cnt); | ||
645 | 655 | ||
656 | /* Enable the DRAM2SRAM to start */ | ||
657 | iwl_write32(trans, TFH_SRV_DMA_CHNL0_CTRL, TFH_SRV_DMA_SNOOP | | ||
658 | TFH_SRV_DMA_TO_DRIVER | | ||
659 | TFH_SRV_DMA_START); | ||
660 | } | ||
661 | |||
662 | static int iwl_pcie_load_firmware_chunk(struct iwl_trans *trans, | ||
663 | u32 dst_addr, dma_addr_t phy_addr, | ||
664 | u32 byte_cnt) | ||
665 | { | ||
666 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
667 | unsigned long flags; | ||
668 | int ret; | ||
669 | |||
670 | trans_pcie->ucode_write_complete = false; | ||
671 | |||
672 | if (!iwl_trans_grab_nic_access(trans, &flags)) | ||
673 | return -EIO; | ||
674 | |||
675 | if (trans->cfg->use_tfh) | ||
676 | iwl_pcie_load_firmware_chunk_tfh(trans, dst_addr, phy_addr, | ||
677 | byte_cnt); | ||
678 | else | ||
679 | iwl_pcie_load_firmware_chunk_fh(trans, dst_addr, phy_addr, | ||
680 | byte_cnt); | ||
646 | iwl_trans_release_nic_access(trans, &flags); | 681 | iwl_trans_release_nic_access(trans, &flags); |
647 | 682 | ||
648 | ret = wait_event_timeout(trans_pcie->ucode_write_waitq, | 683 | ret = wait_event_timeout(trans_pcie->ucode_write_waitq, |
@@ -801,6 +836,8 @@ static int iwl_pcie_load_cpu_sections_8000(struct iwl_trans *trans, | |||
801 | 836 | ||
802 | *first_ucode_section = last_read_idx; | 837 | *first_ucode_section = last_read_idx; |
803 | 838 | ||
839 | iwl_enable_interrupts(trans); | ||
840 | |||
804 | if (cpu == 1) | 841 | if (cpu == 1) |
805 | iwl_write_direct32(trans, FH_UCODE_LOAD_STATUS, 0xFFFF); | 842 | iwl_write_direct32(trans, FH_UCODE_LOAD_STATUS, 0xFFFF); |
806 | else | 843 | else |
@@ -980,6 +1017,8 @@ static int iwl_pcie_load_given_ucode(struct iwl_trans *trans, | |||
980 | iwl_pcie_apply_destination(trans); | 1017 | iwl_pcie_apply_destination(trans); |
981 | } | 1018 | } |
982 | 1019 | ||
1020 | iwl_enable_interrupts(trans); | ||
1021 | |||
983 | /* release CPU reset */ | 1022 | /* release CPU reset */ |
984 | iwl_write32(trans, CSR_RESET, 0); | 1023 | iwl_write32(trans, CSR_RESET, 0); |
985 | 1024 | ||
@@ -1033,9 +1072,7 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power) | |||
1033 | was_hw_rfkill = iwl_is_rfkill_set(trans); | 1072 | was_hw_rfkill = iwl_is_rfkill_set(trans); |
1034 | 1073 | ||
1035 | /* tell the device to stop sending interrupts */ | 1074 | /* tell the device to stop sending interrupts */ |
1036 | spin_lock(&trans_pcie->irq_lock); | ||
1037 | iwl_disable_interrupts(trans); | 1075 | iwl_disable_interrupts(trans); |
1038 | spin_unlock(&trans_pcie->irq_lock); | ||
1039 | 1076 | ||
1040 | /* device going down, Stop using ICT table */ | 1077 | /* device going down, Stop using ICT table */ |
1041 | iwl_pcie_disable_ict(trans); | 1078 | iwl_pcie_disable_ict(trans); |
@@ -1079,9 +1116,7 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power) | |||
1079 | * the time, unless the interrupt is ACKed even if the interrupt | 1116 | * the time, unless the interrupt is ACKed even if the interrupt |
1080 | * should be masked. Re-ACK all the interrupts here. | 1117 | * should be masked. Re-ACK all the interrupts here. |
1081 | */ | 1118 | */ |
1082 | spin_lock(&trans_pcie->irq_lock); | ||
1083 | iwl_disable_interrupts(trans); | 1119 | iwl_disable_interrupts(trans); |
1084 | spin_unlock(&trans_pcie->irq_lock); | ||
1085 | 1120 | ||
1086 | /* clear all status bits */ | 1121 | /* clear all status bits */ |
1087 | clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); | 1122 | clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); |
@@ -1215,7 +1250,6 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, | |||
1215 | ret = iwl_pcie_load_given_ucode_8000(trans, fw); | 1250 | ret = iwl_pcie_load_given_ucode_8000(trans, fw); |
1216 | else | 1251 | else |
1217 | ret = iwl_pcie_load_given_ucode(trans, fw); | 1252 | ret = iwl_pcie_load_given_ucode(trans, fw); |
1218 | iwl_enable_interrupts(trans); | ||
1219 | 1253 | ||
1220 | /* re-check RF-Kill state since we may have missed the interrupt */ | 1254 | /* re-check RF-Kill state since we may have missed the interrupt */ |
1221 | hw_rfkill = iwl_is_rfkill_set(trans); | 1255 | hw_rfkill = iwl_is_rfkill_set(trans); |
@@ -1286,6 +1320,8 @@ static void iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test, | |||
1286 | iwl_clear_bit(trans, CSR_GP_CNTRL, | 1320 | iwl_clear_bit(trans, CSR_GP_CNTRL, |
1287 | CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 1321 | CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
1288 | 1322 | ||
1323 | iwl_pcie_enable_rx_wake(trans, false); | ||
1324 | |||
1289 | if (reset) { | 1325 | if (reset) { |
1290 | /* | 1326 | /* |
1291 | * reset TX queues -- some of their registers reset during S3 | 1327 | * reset TX queues -- some of their registers reset during S3 |
@@ -1311,6 +1347,8 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, | |||
1311 | return 0; | 1347 | return 0; |
1312 | } | 1348 | } |
1313 | 1349 | ||
1350 | iwl_pcie_enable_rx_wake(trans, true); | ||
1351 | |||
1314 | /* | 1352 | /* |
1315 | * Also enables interrupts - none will happen as the device doesn't | 1353 | * Also enables interrupts - none will happen as the device doesn't |
1316 | * know we're waking it up, only when the opmode actually tells it | 1354 | * know we're waking it up, only when the opmode actually tells it |
@@ -1389,8 +1427,12 @@ static void iwl_pcie_init_msix(struct iwl_trans_pcie *trans_pcie) | |||
1389 | 1427 | ||
1390 | max_rx_vector = trans_pcie->allocated_vector - 1; | 1428 | max_rx_vector = trans_pcie->allocated_vector - 1; |
1391 | 1429 | ||
1392 | if (!trans_pcie->msix_enabled) | 1430 | if (!trans_pcie->msix_enabled) { |
1431 | if (trans->cfg->mq_rx_supported) | ||
1432 | iwl_write_prph(trans, UREG_CHICK, | ||
1433 | UREG_CHICK_MSI_ENABLE); | ||
1393 | return; | 1434 | return; |
1435 | } | ||
1394 | 1436 | ||
1395 | iwl_write_prph(trans, UREG_CHICK, UREG_CHICK_MSIX_ENABLE); | 1437 | iwl_write_prph(trans, UREG_CHICK, UREG_CHICK_MSIX_ENABLE); |
1396 | 1438 | ||
@@ -1567,15 +1609,11 @@ static void iwl_trans_pcie_op_mode_leave(struct iwl_trans *trans) | |||
1567 | mutex_lock(&trans_pcie->mutex); | 1609 | mutex_lock(&trans_pcie->mutex); |
1568 | 1610 | ||
1569 | /* disable interrupts - don't enable HW RF kill interrupt */ | 1611 | /* disable interrupts - don't enable HW RF kill interrupt */ |
1570 | spin_lock(&trans_pcie->irq_lock); | ||
1571 | iwl_disable_interrupts(trans); | 1612 | iwl_disable_interrupts(trans); |
1572 | spin_unlock(&trans_pcie->irq_lock); | ||
1573 | 1613 | ||
1574 | iwl_pcie_apm_stop(trans, true); | 1614 | iwl_pcie_apm_stop(trans, true); |
1575 | 1615 | ||
1576 | spin_lock(&trans_pcie->irq_lock); | ||
1577 | iwl_disable_interrupts(trans); | 1616 | iwl_disable_interrupts(trans); |
1578 | spin_unlock(&trans_pcie->irq_lock); | ||
1579 | 1617 | ||
1580 | iwl_pcie_disable_ict(trans); | 1618 | iwl_pcie_disable_ict(trans); |
1581 | 1619 | ||
@@ -1639,6 +1677,9 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans, | |||
1639 | trans_pcie->scd_set_active = trans_cfg->scd_set_active; | 1677 | trans_pcie->scd_set_active = trans_cfg->scd_set_active; |
1640 | trans_pcie->sw_csum_tx = trans_cfg->sw_csum_tx; | 1678 | trans_pcie->sw_csum_tx = trans_cfg->sw_csum_tx; |
1641 | 1679 | ||
1680 | trans_pcie->page_offs = trans_cfg->cb_data_offs; | ||
1681 | trans_pcie->dev_cmd_offs = trans_cfg->cb_data_offs + sizeof(void *); | ||
1682 | |||
1642 | trans->command_groups = trans_cfg->command_groups; | 1683 | trans->command_groups = trans_cfg->command_groups; |
1643 | trans->command_groups_size = trans_cfg->command_groups_size; | 1684 | trans->command_groups_size = trans_cfg->command_groups_size; |
1644 | 1685 | ||
@@ -1909,6 +1950,48 @@ static void iwl_trans_pcie_block_txq_ptrs(struct iwl_trans *trans, bool block) | |||
1909 | 1950 | ||
1910 | #define IWL_FLUSH_WAIT_MS 2000 | 1951 | #define IWL_FLUSH_WAIT_MS 2000 |
1911 | 1952 | ||
1953 | void iwl_trans_pcie_log_scd_error(struct iwl_trans *trans, struct iwl_txq *txq) | ||
1954 | { | ||
1955 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
1956 | u32 scd_sram_addr; | ||
1957 | u8 buf[16]; | ||
1958 | int cnt; | ||
1959 | |||
1960 | IWL_ERR(trans, "Current SW read_ptr %d write_ptr %d\n", | ||
1961 | txq->q.read_ptr, txq->q.write_ptr); | ||
1962 | |||
1963 | scd_sram_addr = trans_pcie->scd_base_addr + | ||
1964 | SCD_TX_STTS_QUEUE_OFFSET(txq->q.id); | ||
1965 | iwl_trans_read_mem_bytes(trans, scd_sram_addr, buf, sizeof(buf)); | ||
1966 | |||
1967 | iwl_print_hex_error(trans, buf, sizeof(buf)); | ||
1968 | |||
1969 | for (cnt = 0; cnt < FH_TCSR_CHNL_NUM; cnt++) | ||
1970 | IWL_ERR(trans, "FH TRBs(%d) = 0x%08x\n", cnt, | ||
1971 | iwl_read_direct32(trans, FH_TX_TRB_REG(cnt))); | ||
1972 | |||
1973 | for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { | ||
1974 | u32 status = iwl_read_prph(trans, SCD_QUEUE_STATUS_BITS(cnt)); | ||
1975 | u8 fifo = (status >> SCD_QUEUE_STTS_REG_POS_TXF) & 0x7; | ||
1976 | bool active = !!(status & BIT(SCD_QUEUE_STTS_REG_POS_ACTIVE)); | ||
1977 | u32 tbl_dw = | ||
1978 | iwl_trans_read_mem32(trans, trans_pcie->scd_base_addr + | ||
1979 | SCD_TRANS_TBL_OFFSET_QUEUE(cnt)); | ||
1980 | |||
1981 | if (cnt & 0x1) | ||
1982 | tbl_dw = (tbl_dw & 0xFFFF0000) >> 16; | ||
1983 | else | ||
1984 | tbl_dw = tbl_dw & 0x0000FFFF; | ||
1985 | |||
1986 | IWL_ERR(trans, | ||
1987 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", | ||
1988 | cnt, active ? "" : "in", fifo, tbl_dw, | ||
1989 | iwl_read_prph(trans, SCD_QUEUE_RDPTR(cnt)) & | ||
1990 | (TFD_QUEUE_SIZE_MAX - 1), | ||
1991 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(cnt))); | ||
1992 | } | ||
1993 | } | ||
1994 | |||
1912 | static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, u32 txq_bm) | 1995 | static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, u32 txq_bm) |
1913 | { | 1996 | { |
1914 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 1997 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
@@ -1916,8 +1999,6 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, u32 txq_bm) | |||
1916 | struct iwl_queue *q; | 1999 | struct iwl_queue *q; |
1917 | int cnt; | 2000 | int cnt; |
1918 | unsigned long now = jiffies; | 2001 | unsigned long now = jiffies; |
1919 | u32 scd_sram_addr; | ||
1920 | u8 buf[16]; | ||
1921 | int ret = 0; | 2002 | int ret = 0; |
1922 | 2003 | ||
1923 | /* waiting for all the tx frames complete might take a while */ | 2004 | /* waiting for all the tx frames complete might take a while */ |
@@ -1957,42 +2038,8 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, u32 txq_bm) | |||
1957 | IWL_DEBUG_TX_QUEUES(trans, "Queue %d is now empty.\n", cnt); | 2038 | IWL_DEBUG_TX_QUEUES(trans, "Queue %d is now empty.\n", cnt); |
1958 | } | 2039 | } |
1959 | 2040 | ||
1960 | if (!ret) | 2041 | if (ret) |
1961 | return 0; | 2042 | iwl_trans_pcie_log_scd_error(trans, txq); |
1962 | |||
1963 | IWL_ERR(trans, "Current SW read_ptr %d write_ptr %d\n", | ||
1964 | txq->q.read_ptr, txq->q.write_ptr); | ||
1965 | |||
1966 | scd_sram_addr = trans_pcie->scd_base_addr + | ||
1967 | SCD_TX_STTS_QUEUE_OFFSET(txq->q.id); | ||
1968 | iwl_trans_read_mem_bytes(trans, scd_sram_addr, buf, sizeof(buf)); | ||
1969 | |||
1970 | iwl_print_hex_error(trans, buf, sizeof(buf)); | ||
1971 | |||
1972 | for (cnt = 0; cnt < FH_TCSR_CHNL_NUM; cnt++) | ||
1973 | IWL_ERR(trans, "FH TRBs(%d) = 0x%08x\n", cnt, | ||
1974 | iwl_read_direct32(trans, FH_TX_TRB_REG(cnt))); | ||
1975 | |||
1976 | for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { | ||
1977 | u32 status = iwl_read_prph(trans, SCD_QUEUE_STATUS_BITS(cnt)); | ||
1978 | u8 fifo = (status >> SCD_QUEUE_STTS_REG_POS_TXF) & 0x7; | ||
1979 | bool active = !!(status & BIT(SCD_QUEUE_STTS_REG_POS_ACTIVE)); | ||
1980 | u32 tbl_dw = | ||
1981 | iwl_trans_read_mem32(trans, trans_pcie->scd_base_addr + | ||
1982 | SCD_TRANS_TBL_OFFSET_QUEUE(cnt)); | ||
1983 | |||
1984 | if (cnt & 0x1) | ||
1985 | tbl_dw = (tbl_dw & 0xFFFF0000) >> 16; | ||
1986 | else | ||
1987 | tbl_dw = tbl_dw & 0x0000FFFF; | ||
1988 | |||
1989 | IWL_ERR(trans, | ||
1990 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", | ||
1991 | cnt, active ? "" : "in", fifo, tbl_dw, | ||
1992 | iwl_read_prph(trans, SCD_QUEUE_RDPTR(cnt)) & | ||
1993 | (TFD_QUEUE_SIZE_MAX - 1), | ||
1994 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(cnt))); | ||
1995 | } | ||
1996 | 2043 | ||
1997 | return ret; | 2044 | return ret; |
1998 | } | 2045 | } |
@@ -2741,6 +2788,8 @@ static const struct iwl_trans_ops trans_ops_pcie = { | |||
2741 | .txq_disable = iwl_trans_pcie_txq_disable, | 2788 | .txq_disable = iwl_trans_pcie_txq_disable, |
2742 | .txq_enable = iwl_trans_pcie_txq_enable, | 2789 | .txq_enable = iwl_trans_pcie_txq_enable, |
2743 | 2790 | ||
2791 | .txq_set_shared_mode = iwl_trans_pcie_txq_set_shared_mode, | ||
2792 | |||
2744 | .wait_tx_queue_empty = iwl_trans_pcie_wait_txq_empty, | 2793 | .wait_tx_queue_empty = iwl_trans_pcie_wait_txq_empty, |
2745 | .freeze_txq_timer = iwl_trans_pcie_freeze_txq_timer, | 2794 | .freeze_txq_timer = iwl_trans_pcie_freeze_txq_timer, |
2746 | .block_txq_ptrs = iwl_trans_pcie_block_txq_ptrs, | 2795 | .block_txq_ptrs = iwl_trans_pcie_block_txq_ptrs, |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c index d6beac9af029..18650dccdb58 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c | |||
@@ -70,6 +70,7 @@ | |||
70 | * Tx queue resumed. | 70 | * Tx queue resumed. |
71 | * | 71 | * |
72 | ***************************************************/ | 72 | ***************************************************/ |
73 | |||
73 | static int iwl_queue_space(const struct iwl_queue *q) | 74 | static int iwl_queue_space(const struct iwl_queue *q) |
74 | { | 75 | { |
75 | unsigned int max; | 76 | unsigned int max; |
@@ -154,10 +155,6 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data) | |||
154 | struct iwl_txq *txq = (void *)data; | 155 | struct iwl_txq *txq = (void *)data; |
155 | struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; | 156 | struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; |
156 | struct iwl_trans *trans = iwl_trans_pcie_get_trans(trans_pcie); | 157 | struct iwl_trans *trans = iwl_trans_pcie_get_trans(trans_pcie); |
157 | u32 scd_sram_addr = trans_pcie->scd_base_addr + | ||
158 | SCD_TX_STTS_QUEUE_OFFSET(txq->q.id); | ||
159 | u8 buf[16]; | ||
160 | int i; | ||
161 | 158 | ||
162 | spin_lock(&txq->lock); | 159 | spin_lock(&txq->lock); |
163 | /* check if triggered erroneously */ | 160 | /* check if triggered erroneously */ |
@@ -169,38 +166,8 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data) | |||
169 | 166 | ||
170 | IWL_ERR(trans, "Queue %d stuck for %u ms.\n", txq->q.id, | 167 | IWL_ERR(trans, "Queue %d stuck for %u ms.\n", txq->q.id, |
171 | jiffies_to_msecs(txq->wd_timeout)); | 168 | jiffies_to_msecs(txq->wd_timeout)); |
172 | IWL_ERR(trans, "Current SW read_ptr %d write_ptr %d\n", | ||
173 | txq->q.read_ptr, txq->q.write_ptr); | ||
174 | |||
175 | iwl_trans_read_mem_bytes(trans, scd_sram_addr, buf, sizeof(buf)); | ||
176 | |||
177 | iwl_print_hex_error(trans, buf, sizeof(buf)); | ||
178 | |||
179 | for (i = 0; i < FH_TCSR_CHNL_NUM; i++) | ||
180 | IWL_ERR(trans, "FH TRBs(%d) = 0x%08x\n", i, | ||
181 | iwl_read_direct32(trans, FH_TX_TRB_REG(i))); | ||
182 | |||
183 | for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) { | ||
184 | u32 status = iwl_read_prph(trans, SCD_QUEUE_STATUS_BITS(i)); | ||
185 | u8 fifo = (status >> SCD_QUEUE_STTS_REG_POS_TXF) & 0x7; | ||
186 | bool active = !!(status & BIT(SCD_QUEUE_STTS_REG_POS_ACTIVE)); | ||
187 | u32 tbl_dw = | ||
188 | iwl_trans_read_mem32(trans, | ||
189 | trans_pcie->scd_base_addr + | ||
190 | SCD_TRANS_TBL_OFFSET_QUEUE(i)); | ||
191 | |||
192 | if (i & 0x1) | ||
193 | tbl_dw = (tbl_dw & 0xFFFF0000) >> 16; | ||
194 | else | ||
195 | tbl_dw = tbl_dw & 0x0000FFFF; | ||
196 | 169 | ||
197 | IWL_ERR(trans, | 170 | iwl_trans_pcie_log_scd_error(trans, txq); |
198 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", | ||
199 | i, active ? "" : "in", fifo, tbl_dw, | ||
200 | iwl_read_prph(trans, SCD_QUEUE_RDPTR(i)) & | ||
201 | (TFD_QUEUE_SIZE_MAX - 1), | ||
202 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); | ||
203 | } | ||
204 | 171 | ||
205 | iwl_force_nmi(trans); | 172 | iwl_force_nmi(trans); |
206 | } | 173 | } |
@@ -393,7 +360,7 @@ static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, | |||
393 | return; | 360 | return; |
394 | } | 361 | } |
395 | 362 | ||
396 | /* first TB is never freed - it's the scratchbuf data */ | 363 | /* first TB is never freed - it's the bidirectional DMA data */ |
397 | 364 | ||
398 | for (i = 1; i < num_tbs; i++) { | 365 | for (i = 1; i < num_tbs; i++) { |
399 | if (meta->flags & BIT(i + CMD_TB_BITMAP_POS)) | 366 | if (meta->flags & BIT(i + CMD_TB_BITMAP_POS)) |
@@ -491,7 +458,7 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans, | |||
491 | { | 458 | { |
492 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 459 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
493 | size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX; | 460 | size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX; |
494 | size_t scratchbuf_sz; | 461 | size_t tb0_buf_sz; |
495 | int i; | 462 | int i; |
496 | 463 | ||
497 | if (WARN_ON(txq->entries || txq->tfds)) | 464 | if (WARN_ON(txq->entries || txq->tfds)) |
@@ -526,17 +493,14 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans, | |||
526 | if (!txq->tfds) | 493 | if (!txq->tfds) |
527 | goto error; | 494 | goto error; |
528 | 495 | ||
529 | BUILD_BUG_ON(IWL_HCMD_SCRATCHBUF_SIZE != sizeof(*txq->scratchbufs)); | 496 | BUILD_BUG_ON(IWL_FIRST_TB_SIZE_ALIGN != sizeof(*txq->first_tb_bufs)); |
530 | BUILD_BUG_ON(offsetof(struct iwl_pcie_txq_scratch_buf, scratch) != | ||
531 | sizeof(struct iwl_cmd_header) + | ||
532 | offsetof(struct iwl_tx_cmd, scratch)); | ||
533 | 497 | ||
534 | scratchbuf_sz = sizeof(*txq->scratchbufs) * slots_num; | 498 | tb0_buf_sz = sizeof(*txq->first_tb_bufs) * slots_num; |
535 | 499 | ||
536 | txq->scratchbufs = dma_alloc_coherent(trans->dev, scratchbuf_sz, | 500 | txq->first_tb_bufs = dma_alloc_coherent(trans->dev, tb0_buf_sz, |
537 | &txq->scratchbufs_dma, | 501 | &txq->first_tb_dma, |
538 | GFP_KERNEL); | 502 | GFP_KERNEL); |
539 | if (!txq->scratchbufs) | 503 | if (!txq->first_tb_bufs) |
540 | goto err_free_tfds; | 504 | goto err_free_tfds; |
541 | 505 | ||
542 | txq->q.id = txq_id; | 506 | txq->q.id = txq_id; |
@@ -578,22 +542,27 @@ static int iwl_pcie_txq_init(struct iwl_trans *trans, struct iwl_txq *txq, | |||
578 | * Tell nic where to find circular buffer of Tx Frame Descriptors for | 542 | * Tell nic where to find circular buffer of Tx Frame Descriptors for |
579 | * given Tx queue, and enable the DMA channel used for that queue. | 543 | * given Tx queue, and enable the DMA channel used for that queue. |
580 | * Circular buffer (TFD queue in DRAM) physical base address */ | 544 | * Circular buffer (TFD queue in DRAM) physical base address */ |
581 | iwl_write_direct32(trans, FH_MEM_CBBC_QUEUE(txq_id), | 545 | if (trans->cfg->use_tfh) |
582 | txq->q.dma_addr >> 8); | 546 | iwl_write_direct64(trans, |
547 | FH_MEM_CBBC_QUEUE(trans, txq_id), | ||
548 | txq->q.dma_addr); | ||
549 | else | ||
550 | iwl_write_direct32(trans, FH_MEM_CBBC_QUEUE(trans, txq_id), | ||
551 | txq->q.dma_addr >> 8); | ||
583 | 552 | ||
584 | return 0; | 553 | return 0; |
585 | } | 554 | } |
586 | 555 | ||
587 | static void iwl_pcie_free_tso_page(struct sk_buff *skb) | 556 | static void iwl_pcie_free_tso_page(struct iwl_trans_pcie *trans_pcie, |
557 | struct sk_buff *skb) | ||
588 | { | 558 | { |
589 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 559 | struct page **page_ptr; |
590 | 560 | ||
591 | if (info->driver_data[IWL_TRANS_FIRST_DRIVER_DATA]) { | 561 | page_ptr = (void *)((u8 *)skb->cb + trans_pcie->page_offs); |
592 | struct page *page = | ||
593 | info->driver_data[IWL_TRANS_FIRST_DRIVER_DATA]; | ||
594 | 562 | ||
595 | __free_page(page); | 563 | if (*page_ptr) { |
596 | info->driver_data[IWL_TRANS_FIRST_DRIVER_DATA] = NULL; | 564 | __free_page(*page_ptr); |
565 | *page_ptr = NULL; | ||
597 | } | 566 | } |
598 | } | 567 | } |
599 | 568 | ||
@@ -639,7 +608,7 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id) | |||
639 | if (WARN_ON_ONCE(!skb)) | 608 | if (WARN_ON_ONCE(!skb)) |
640 | continue; | 609 | continue; |
641 | 610 | ||
642 | iwl_pcie_free_tso_page(skb); | 611 | iwl_pcie_free_tso_page(trans_pcie, skb); |
643 | } | 612 | } |
644 | iwl_pcie_txq_free_tfd(trans, txq); | 613 | iwl_pcie_txq_free_tfd(trans, txq); |
645 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr); | 614 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr); |
@@ -708,8 +677,8 @@ static void iwl_pcie_txq_free(struct iwl_trans *trans, int txq_id) | |||
708 | txq->tfds = NULL; | 677 | txq->tfds = NULL; |
709 | 678 | ||
710 | dma_free_coherent(dev, | 679 | dma_free_coherent(dev, |
711 | sizeof(*txq->scratchbufs) * txq->q.n_window, | 680 | sizeof(*txq->first_tb_bufs) * txq->q.n_window, |
712 | txq->scratchbufs, txq->scratchbufs_dma); | 681 | txq->first_tb_bufs, txq->first_tb_dma); |
713 | } | 682 | } |
714 | 683 | ||
715 | kfree(txq->entries); | 684 | kfree(txq->entries); |
@@ -786,9 +755,14 @@ void iwl_trans_pcie_tx_reset(struct iwl_trans *trans) | |||
786 | for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; | 755 | for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; |
787 | txq_id++) { | 756 | txq_id++) { |
788 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; | 757 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; |
789 | 758 | if (trans->cfg->use_tfh) | |
790 | iwl_write_direct32(trans, FH_MEM_CBBC_QUEUE(txq_id), | 759 | iwl_write_direct64(trans, |
791 | txq->q.dma_addr >> 8); | 760 | FH_MEM_CBBC_QUEUE(trans, txq_id), |
761 | txq->q.dma_addr); | ||
762 | else | ||
763 | iwl_write_direct32(trans, | ||
764 | FH_MEM_CBBC_QUEUE(trans, txq_id), | ||
765 | txq->q.dma_addr >> 8); | ||
792 | iwl_pcie_txq_unmap(trans, txq_id); | 766 | iwl_pcie_txq_unmap(trans, txq_id); |
793 | txq->q.read_ptr = 0; | 767 | txq->q.read_ptr = 0; |
794 | txq->q.write_ptr = 0; | 768 | txq->q.write_ptr = 0; |
@@ -996,6 +970,12 @@ int iwl_pcie_tx_init(struct iwl_trans *trans) | |||
996 | } | 970 | } |
997 | } | 971 | } |
998 | 972 | ||
973 | if (trans->cfg->use_tfh) | ||
974 | iwl_write_direct32(trans, TFH_TRANSFER_MODE, | ||
975 | TFH_TRANSFER_MAX_PENDING_REQ | | ||
976 | TFH_CHUNK_SIZE_128 | | ||
977 | TFH_CHUNK_SPLIT_MODE); | ||
978 | |||
999 | iwl_set_bits_prph(trans, SCD_GP_CTRL, SCD_GP_CTRL_AUTO_ACTIVE_MODE); | 979 | iwl_set_bits_prph(trans, SCD_GP_CTRL, SCD_GP_CTRL_AUTO_ACTIVE_MODE); |
1000 | if (trans->cfg->base_params->num_of_queues > 20) | 980 | if (trans->cfg->base_params->num_of_queues > 20) |
1001 | iwl_set_bits_prph(trans, SCD_GP_CTRL, | 981 | iwl_set_bits_prph(trans, SCD_GP_CTRL, |
@@ -1084,7 +1064,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
1084 | if (WARN_ON_ONCE(!skb)) | 1064 | if (WARN_ON_ONCE(!skb)) |
1085 | continue; | 1065 | continue; |
1086 | 1066 | ||
1087 | iwl_pcie_free_tso_page(skb); | 1067 | iwl_pcie_free_tso_page(trans_pcie, skb); |
1088 | 1068 | ||
1089 | __skb_queue_tail(skbs, skb); | 1069 | __skb_queue_tail(skbs, skb); |
1090 | 1070 | ||
@@ -1115,17 +1095,17 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
1115 | 1095 | ||
1116 | while (!skb_queue_empty(&overflow_skbs)) { | 1096 | while (!skb_queue_empty(&overflow_skbs)) { |
1117 | struct sk_buff *skb = __skb_dequeue(&overflow_skbs); | 1097 | struct sk_buff *skb = __skb_dequeue(&overflow_skbs); |
1118 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1098 | struct iwl_device_cmd *dev_cmd_ptr; |
1119 | u8 dev_cmd_idx = IWL_TRANS_FIRST_DRIVER_DATA + 1; | 1099 | |
1120 | struct iwl_device_cmd *dev_cmd = | 1100 | dev_cmd_ptr = *(void **)((u8 *)skb->cb + |
1121 | info->driver_data[dev_cmd_idx]; | 1101 | trans_pcie->dev_cmd_offs); |
1122 | 1102 | ||
1123 | /* | 1103 | /* |
1124 | * Note that we can very well be overflowing again. | 1104 | * Note that we can very well be overflowing again. |
1125 | * In that case, iwl_queue_space will be small again | 1105 | * In that case, iwl_queue_space will be small again |
1126 | * and we won't wake mac80211's queue. | 1106 | * and we won't wake mac80211's queue. |
1127 | */ | 1107 | */ |
1128 | iwl_trans_pcie_tx(trans, skb, dev_cmd, txq_id); | 1108 | iwl_trans_pcie_tx(trans, skb, dev_cmd_ptr, txq_id); |
1129 | } | 1109 | } |
1130 | spin_lock_bh(&txq->lock); | 1110 | spin_lock_bh(&txq->lock); |
1131 | 1111 | ||
@@ -1354,6 +1334,15 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, u16 ssn, | |||
1354 | txq->active = true; | 1334 | txq->active = true; |
1355 | } | 1335 | } |
1356 | 1336 | ||
1337 | void iwl_trans_pcie_txq_set_shared_mode(struct iwl_trans *trans, u32 txq_id, | ||
1338 | bool shared_mode) | ||
1339 | { | ||
1340 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
1341 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; | ||
1342 | |||
1343 | txq->ampdu = !shared_mode; | ||
1344 | } | ||
1345 | |||
1357 | void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id, | 1346 | void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id, |
1358 | bool configure_scd) | 1347 | bool configure_scd) |
1359 | { | 1348 | { |
@@ -1413,7 +1402,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1413 | void *dup_buf = NULL; | 1402 | void *dup_buf = NULL; |
1414 | dma_addr_t phys_addr; | 1403 | dma_addr_t phys_addr; |
1415 | int idx; | 1404 | int idx; |
1416 | u16 copy_size, cmd_size, scratch_size; | 1405 | u16 copy_size, cmd_size, tb0_size; |
1417 | bool had_nocopy = false; | 1406 | bool had_nocopy = false; |
1418 | u8 group_id = iwl_cmd_groupid(cmd->id); | 1407 | u8 group_id = iwl_cmd_groupid(cmd->id); |
1419 | int i, ret; | 1408 | int i, ret; |
@@ -1444,9 +1433,9 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1444 | if (!cmd->len[i]) | 1433 | if (!cmd->len[i]) |
1445 | continue; | 1434 | continue; |
1446 | 1435 | ||
1447 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ | 1436 | /* need at least IWL_FIRST_TB_SIZE copied */ |
1448 | if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { | 1437 | if (copy_size < IWL_FIRST_TB_SIZE) { |
1449 | int copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; | 1438 | int copy = IWL_FIRST_TB_SIZE - copy_size; |
1450 | 1439 | ||
1451 | if (copy > cmdlen[i]) | 1440 | if (copy > cmdlen[i]) |
1452 | copy = cmdlen[i]; | 1441 | copy = cmdlen[i]; |
@@ -1567,8 +1556,8 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1567 | } | 1556 | } |
1568 | 1557 | ||
1569 | /* | 1558 | /* |
1570 | * Otherwise we need at least IWL_HCMD_SCRATCHBUF_SIZE copied | 1559 | * Otherwise we need at least IWL_FIRST_TB_SIZE copied |
1571 | * in total (for the scratchbuf handling), but copy up to what | 1560 | * in total (for bi-directional DMA), but copy up to what |
1572 | * we can fit into the payload for debug dump purposes. | 1561 | * we can fit into the payload for debug dump purposes. |
1573 | */ | 1562 | */ |
1574 | copy = min_t(int, TFD_MAX_PAYLOAD_SIZE - cmd_pos, cmd->len[i]); | 1563 | copy = min_t(int, TFD_MAX_PAYLOAD_SIZE - cmd_pos, cmd->len[i]); |
@@ -1577,8 +1566,8 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1577 | cmd_pos += copy; | 1566 | cmd_pos += copy; |
1578 | 1567 | ||
1579 | /* However, treat copy_size the proper way, we need it below */ | 1568 | /* However, treat copy_size the proper way, we need it below */ |
1580 | if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { | 1569 | if (copy_size < IWL_FIRST_TB_SIZE) { |
1581 | copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; | 1570 | copy = IWL_FIRST_TB_SIZE - copy_size; |
1582 | 1571 | ||
1583 | if (copy > cmd->len[i]) | 1572 | if (copy > cmd->len[i]) |
1584 | copy = cmd->len[i]; | 1573 | copy = cmd->len[i]; |
@@ -1593,18 +1582,18 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1593 | le16_to_cpu(out_cmd->hdr.sequence), | 1582 | le16_to_cpu(out_cmd->hdr.sequence), |
1594 | cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue); | 1583 | cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue); |
1595 | 1584 | ||
1596 | /* start the TFD with the scratchbuf */ | 1585 | /* start the TFD with the minimum copy bytes */ |
1597 | scratch_size = min_t(int, copy_size, IWL_HCMD_SCRATCHBUF_SIZE); | 1586 | tb0_size = min_t(int, copy_size, IWL_FIRST_TB_SIZE); |
1598 | memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size); | 1587 | memcpy(&txq->first_tb_bufs[idx], &out_cmd->hdr, tb0_size); |
1599 | iwl_pcie_txq_build_tfd(trans, txq, | 1588 | iwl_pcie_txq_build_tfd(trans, txq, |
1600 | iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr), | 1589 | iwl_pcie_get_first_tb_dma(txq, idx), |
1601 | scratch_size, true); | 1590 | tb0_size, true); |
1602 | 1591 | ||
1603 | /* map first command fragment, if any remains */ | 1592 | /* map first command fragment, if any remains */ |
1604 | if (copy_size > scratch_size) { | 1593 | if (copy_size > tb0_size) { |
1605 | phys_addr = dma_map_single(trans->dev, | 1594 | phys_addr = dma_map_single(trans->dev, |
1606 | ((u8 *)&out_cmd->hdr) + scratch_size, | 1595 | ((u8 *)&out_cmd->hdr) + tb0_size, |
1607 | copy_size - scratch_size, | 1596 | copy_size - tb0_size, |
1608 | DMA_TO_DEVICE); | 1597 | DMA_TO_DEVICE); |
1609 | if (dma_mapping_error(trans->dev, phys_addr)) { | 1598 | if (dma_mapping_error(trans->dev, phys_addr)) { |
1610 | iwl_pcie_tfd_unmap(trans, out_meta, | 1599 | iwl_pcie_tfd_unmap(trans, out_meta, |
@@ -1614,7 +1603,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1614 | } | 1603 | } |
1615 | 1604 | ||
1616 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, | 1605 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, |
1617 | copy_size - scratch_size, false); | 1606 | copy_size - tb0_size, false); |
1618 | } | 1607 | } |
1619 | 1608 | ||
1620 | /* map the remaining (adjusted) nocopy/dup fragments */ | 1609 | /* map the remaining (adjusted) nocopy/dup fragments */ |
@@ -1959,7 +1948,7 @@ static int iwl_fill_data_tbs(struct iwl_trans *trans, struct sk_buff *skb, | |||
1959 | trace_iwlwifi_dev_tx(trans->dev, skb, | 1948 | trace_iwlwifi_dev_tx(trans->dev, skb, |
1960 | &txq->tfds[txq->q.write_ptr], | 1949 | &txq->tfds[txq->q.write_ptr], |
1961 | sizeof(struct iwl_tfd), | 1950 | sizeof(struct iwl_tfd), |
1962 | &dev_cmd->hdr, IWL_HCMD_SCRATCHBUF_SIZE + tb1_len, | 1951 | &dev_cmd->hdr, IWL_FIRST_TB_SIZE + tb1_len, |
1963 | skb->data + hdr_len, tb2_len); | 1952 | skb->data + hdr_len, tb2_len); |
1964 | trace_iwlwifi_dev_tx_data(trans->dev, skb, | 1953 | trace_iwlwifi_dev_tx_data(trans->dev, skb, |
1965 | hdr_len, skb->len - hdr_len); | 1954 | hdr_len, skb->len - hdr_len); |
@@ -2015,7 +2004,6 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, | |||
2015 | struct iwl_cmd_meta *out_meta, | 2004 | struct iwl_cmd_meta *out_meta, |
2016 | struct iwl_device_cmd *dev_cmd, u16 tb1_len) | 2005 | struct iwl_device_cmd *dev_cmd, u16 tb1_len) |
2017 | { | 2006 | { |
2018 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
2019 | struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; | 2007 | struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; |
2020 | struct ieee80211_hdr *hdr = (void *)skb->data; | 2008 | struct ieee80211_hdr *hdr = (void *)skb->data; |
2021 | unsigned int snap_ip_tcp_hdrlen, ip_hdrlen, total_len, hdr_room; | 2009 | unsigned int snap_ip_tcp_hdrlen, ip_hdrlen, total_len, hdr_room; |
@@ -2024,6 +2012,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, | |||
2024 | u16 length, iv_len, amsdu_pad; | 2012 | u16 length, iv_len, amsdu_pad; |
2025 | u8 *start_hdr; | 2013 | u8 *start_hdr; |
2026 | struct iwl_tso_hdr_page *hdr_page; | 2014 | struct iwl_tso_hdr_page *hdr_page; |
2015 | struct page **page_ptr; | ||
2027 | int ret; | 2016 | int ret; |
2028 | struct tso_t tso; | 2017 | struct tso_t tso; |
2029 | 2018 | ||
@@ -2035,7 +2024,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, | |||
2035 | trace_iwlwifi_dev_tx(trans->dev, skb, | 2024 | trace_iwlwifi_dev_tx(trans->dev, skb, |
2036 | &txq->tfds[txq->q.write_ptr], | 2025 | &txq->tfds[txq->q.write_ptr], |
2037 | sizeof(struct iwl_tfd), | 2026 | sizeof(struct iwl_tfd), |
2038 | &dev_cmd->hdr, IWL_HCMD_SCRATCHBUF_SIZE + tb1_len, | 2027 | &dev_cmd->hdr, IWL_FIRST_TB_SIZE + tb1_len, |
2039 | NULL, 0); | 2028 | NULL, 0); |
2040 | 2029 | ||
2041 | ip_hdrlen = skb_transport_header(skb) - skb_network_header(skb); | 2030 | ip_hdrlen = skb_transport_header(skb) - skb_network_header(skb); |
@@ -2054,7 +2043,8 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, | |||
2054 | 2043 | ||
2055 | get_page(hdr_page->page); | 2044 | get_page(hdr_page->page); |
2056 | start_hdr = hdr_page->pos; | 2045 | start_hdr = hdr_page->pos; |
2057 | info->driver_data[IWL_TRANS_FIRST_DRIVER_DATA] = hdr_page->page; | 2046 | page_ptr = (void *)((u8 *)skb->cb + trans_pcie->page_offs); |
2047 | *page_ptr = hdr_page->page; | ||
2058 | memcpy(hdr_page->pos, skb->data + hdr_len, iv_len); | 2048 | memcpy(hdr_page->pos, skb->data + hdr_len, iv_len); |
2059 | hdr_page->pos += iv_len; | 2049 | hdr_page->pos += iv_len; |
2060 | 2050 | ||
@@ -2264,10 +2254,12 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
2264 | 2254 | ||
2265 | /* don't put the packet on the ring, if there is no room */ | 2255 | /* don't put the packet on the ring, if there is no room */ |
2266 | if (unlikely(iwl_queue_space(q) < 3)) { | 2256 | if (unlikely(iwl_queue_space(q) < 3)) { |
2267 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 2257 | struct iwl_device_cmd **dev_cmd_ptr; |
2258 | |||
2259 | dev_cmd_ptr = (void *)((u8 *)skb->cb + | ||
2260 | trans_pcie->dev_cmd_offs); | ||
2268 | 2261 | ||
2269 | info->driver_data[IWL_TRANS_FIRST_DRIVER_DATA + 1] = | 2262 | *dev_cmd_ptr = dev_cmd; |
2270 | dev_cmd; | ||
2271 | __skb_queue_tail(&txq->overflow_q, skb); | 2263 | __skb_queue_tail(&txq->overflow_q, skb); |
2272 | 2264 | ||
2273 | spin_unlock(&txq->lock); | 2265 | spin_unlock(&txq->lock); |
@@ -2294,7 +2286,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
2294 | cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | | 2286 | cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | |
2295 | INDEX_TO_SEQ(q->write_ptr))); | 2287 | INDEX_TO_SEQ(q->write_ptr))); |
2296 | 2288 | ||
2297 | tb0_phys = iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr); | 2289 | tb0_phys = iwl_pcie_get_first_tb_dma(txq, q->write_ptr); |
2298 | scratch_phys = tb0_phys + sizeof(struct iwl_cmd_header) + | 2290 | scratch_phys = tb0_phys + sizeof(struct iwl_cmd_header) + |
2299 | offsetof(struct iwl_tx_cmd, scratch); | 2291 | offsetof(struct iwl_tx_cmd, scratch); |
2300 | 2292 | ||
@@ -2312,7 +2304,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
2312 | * setup of the first TB) | 2304 | * setup of the first TB) |
2313 | */ | 2305 | */ |
2314 | len = sizeof(struct iwl_tx_cmd) + sizeof(struct iwl_cmd_header) + | 2306 | len = sizeof(struct iwl_tx_cmd) + sizeof(struct iwl_cmd_header) + |
2315 | hdr_len - IWL_HCMD_SCRATCHBUF_SIZE; | 2307 | hdr_len - IWL_FIRST_TB_SIZE; |
2316 | /* do not align A-MSDU to dword as the subframe header aligns it */ | 2308 | /* do not align A-MSDU to dword as the subframe header aligns it */ |
2317 | amsdu = ieee80211_is_data_qos(fc) && | 2309 | amsdu = ieee80211_is_data_qos(fc) && |
2318 | (*ieee80211_get_qos_ctl(hdr) & | 2310 | (*ieee80211_get_qos_ctl(hdr) & |
@@ -2326,17 +2318,17 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
2326 | tb1_len = len; | 2318 | tb1_len = len; |
2327 | } | 2319 | } |
2328 | 2320 | ||
2329 | /* The first TB points to the scratchbuf data - min_copy bytes */ | 2321 | /* The first TB points to bi-directional DMA data */ |
2330 | memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr, | 2322 | memcpy(&txq->first_tb_bufs[q->write_ptr], &dev_cmd->hdr, |
2331 | IWL_HCMD_SCRATCHBUF_SIZE); | 2323 | IWL_FIRST_TB_SIZE); |
2332 | iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, | 2324 | iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, |
2333 | IWL_HCMD_SCRATCHBUF_SIZE, true); | 2325 | IWL_FIRST_TB_SIZE, true); |
2334 | 2326 | ||
2335 | /* there must be data left over for TB1 or this code must be changed */ | 2327 | /* there must be data left over for TB1 or this code must be changed */ |
2336 | BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE); | 2328 | BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_FIRST_TB_SIZE); |
2337 | 2329 | ||
2338 | /* map the data for TB1 */ | 2330 | /* map the data for TB1 */ |
2339 | tb1_addr = ((u8 *)&dev_cmd->hdr) + IWL_HCMD_SCRATCHBUF_SIZE; | 2331 | tb1_addr = ((u8 *)&dev_cmd->hdr) + IWL_FIRST_TB_SIZE; |
2340 | tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); | 2332 | tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); |
2341 | if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) | 2333 | if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) |
2342 | goto out_err; | 2334 | goto out_err; |
diff --git a/drivers/net/wireless/marvell/libertas/cmdresp.c b/drivers/net/wireless/marvell/libertas/cmdresp.c index c95bf6dc9522..c753e36c2c0e 100644 --- a/drivers/net/wireless/marvell/libertas/cmdresp.c +++ b/drivers/net/wireless/marvell/libertas/cmdresp.c | |||
@@ -27,6 +27,8 @@ | |||
27 | void lbs_mac_event_disconnected(struct lbs_private *priv, | 27 | void lbs_mac_event_disconnected(struct lbs_private *priv, |
28 | bool locally_generated) | 28 | bool locally_generated) |
29 | { | 29 | { |
30 | unsigned long flags; | ||
31 | |||
30 | if (priv->connect_status != LBS_CONNECTED) | 32 | if (priv->connect_status != LBS_CONNECTED) |
31 | return; | 33 | return; |
32 | 34 | ||
@@ -46,9 +48,11 @@ void lbs_mac_event_disconnected(struct lbs_private *priv, | |||
46 | netif_carrier_off(priv->dev); | 48 | netif_carrier_off(priv->dev); |
47 | 49 | ||
48 | /* Free Tx and Rx packets */ | 50 | /* Free Tx and Rx packets */ |
51 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
49 | kfree_skb(priv->currenttxskb); | 52 | kfree_skb(priv->currenttxskb); |
50 | priv->currenttxskb = NULL; | 53 | priv->currenttxskb = NULL; |
51 | priv->tx_pending_len = 0; | 54 | priv->tx_pending_len = 0; |
55 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
52 | 56 | ||
53 | priv->connect_status = LBS_DISCONNECTED; | 57 | priv->connect_status = LBS_DISCONNECTED; |
54 | 58 | ||
diff --git a/drivers/net/wireless/marvell/libertas_tf/main.c b/drivers/net/wireless/marvell/libertas_tf/main.c index 75bf0c8a2f6f..54e426c1e405 100644 --- a/drivers/net/wireless/marvell/libertas_tf/main.c +++ b/drivers/net/wireless/marvell/libertas_tf/main.c | |||
@@ -735,7 +735,7 @@ EXPORT_SYMBOL_GPL(lbtf_bcn_sent); | |||
735 | static int __init lbtf_init_module(void) | 735 | static int __init lbtf_init_module(void) |
736 | { | 736 | { |
737 | lbtf_deb_enter(LBTF_DEB_MAIN); | 737 | lbtf_deb_enter(LBTF_DEB_MAIN); |
738 | lbtf_wq = create_workqueue("libertastf"); | 738 | lbtf_wq = alloc_workqueue("libertastf", WQ_MEM_RECLAIM, 0); |
739 | if (lbtf_wq == NULL) { | 739 | if (lbtf_wq == NULL) { |
740 | printk(KERN_ERR "libertastf: couldn't create workqueue\n"); | 740 | printk(KERN_ERR "libertastf: couldn't create workqueue\n"); |
741 | return -ENOMEM; | 741 | return -ENOMEM; |
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index ff948a922222..867ab815e16a 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c | |||
@@ -377,6 +377,29 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy, | |||
377 | } | 377 | } |
378 | 378 | ||
379 | /* | 379 | /* |
380 | * CFG802.11 operation handler to get Tx power. | ||
381 | */ | ||
382 | static int | ||
383 | mwifiex_cfg80211_get_tx_power(struct wiphy *wiphy, | ||
384 | struct wireless_dev *wdev, | ||
385 | int *dbm) | ||
386 | { | ||
387 | struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); | ||
388 | struct mwifiex_private *priv = mwifiex_get_priv(adapter, | ||
389 | MWIFIEX_BSS_ROLE_ANY); | ||
390 | int ret = mwifiex_send_cmd(priv, HostCmd_CMD_RF_TX_PWR, | ||
391 | HostCmd_ACT_GEN_GET, 0, NULL, true); | ||
392 | |||
393 | if (ret < 0) | ||
394 | return ret; | ||
395 | |||
396 | /* tx_power_level is set in HostCmd_CMD_RF_TX_PWR command handler */ | ||
397 | *dbm = priv->tx_power_level; | ||
398 | |||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | /* | ||
380 | * CFG802.11 operation handler to set Power Save option. | 403 | * CFG802.11 operation handler to set Power Save option. |
381 | * | 404 | * |
382 | * The timeout value, if provided, is currently ignored. | 405 | * The timeout value, if provided, is currently ignored. |
@@ -1672,6 +1695,9 @@ static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy, | |||
1672 | struct cfg80211_beacon_data *data) | 1695 | struct cfg80211_beacon_data *data) |
1673 | { | 1696 | { |
1674 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 1697 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
1698 | struct mwifiex_adapter *adapter = priv->adapter; | ||
1699 | |||
1700 | mwifiex_cancel_scan(adapter); | ||
1675 | 1701 | ||
1676 | if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) { | 1702 | if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) { |
1677 | mwifiex_dbg(priv->adapter, ERROR, | 1703 | mwifiex_dbg(priv->adapter, ERROR, |
@@ -1804,6 +1830,21 @@ mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) | |||
1804 | HostCmd_ACT_GEN_SET, 0, &ant_cfg, true); | 1830 | HostCmd_ACT_GEN_SET, 0, &ant_cfg, true); |
1805 | } | 1831 | } |
1806 | 1832 | ||
1833 | static int | ||
1834 | mwifiex_cfg80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant) | ||
1835 | { | ||
1836 | struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); | ||
1837 | struct mwifiex_private *priv = mwifiex_get_priv(adapter, | ||
1838 | MWIFIEX_BSS_ROLE_ANY); | ||
1839 | mwifiex_send_cmd(priv, HostCmd_CMD_RF_ANTENNA, | ||
1840 | HostCmd_ACT_GEN_GET, 0, NULL, true); | ||
1841 | |||
1842 | *tx_ant = priv->tx_ant; | ||
1843 | *rx_ant = priv->rx_ant; | ||
1844 | |||
1845 | return 0; | ||
1846 | } | ||
1847 | |||
1807 | /* cfg80211 operation handler for stop ap. | 1848 | /* cfg80211 operation handler for stop ap. |
1808 | * Function stops BSS running at uAP interface. | 1849 | * Function stops BSS running at uAP interface. |
1809 | */ | 1850 | */ |
@@ -2209,6 +2250,9 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |||
2209 | return -EALREADY; | 2250 | return -EALREADY; |
2210 | } | 2251 | } |
2211 | 2252 | ||
2253 | if (priv->scan_block) | ||
2254 | priv->scan_block = false; | ||
2255 | |||
2212 | if (adapter->surprise_removed || adapter->is_cmd_timedout) { | 2256 | if (adapter->surprise_removed || adapter->is_cmd_timedout) { |
2213 | mwifiex_dbg(adapter, ERROR, | 2257 | mwifiex_dbg(adapter, ERROR, |
2214 | "%s: Ignore connection.\t" | 2258 | "%s: Ignore connection.\t" |
@@ -2427,6 +2471,9 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
2427 | return -EBUSY; | 2471 | return -EBUSY; |
2428 | } | 2472 | } |
2429 | 2473 | ||
2474 | if (!priv->wdev.current_bss && priv->scan_block) | ||
2475 | priv->scan_block = false; | ||
2476 | |||
2430 | if (!mwifiex_stop_bg_scan(priv)) | 2477 | if (!mwifiex_stop_bg_scan(priv)) |
2431 | cfg80211_sched_scan_stopped_rtnl(priv->wdev.wiphy); | 2478 | cfg80211_sched_scan_stopped_rtnl(priv->wdev.wiphy); |
2432 | 2479 | ||
@@ -2734,6 +2781,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
2734 | struct mwifiex_private *priv; | 2781 | struct mwifiex_private *priv; |
2735 | struct net_device *dev; | 2782 | struct net_device *dev; |
2736 | void *mdev_priv; | 2783 | void *mdev_priv; |
2784 | int ret; | ||
2737 | 2785 | ||
2738 | if (!adapter) | 2786 | if (!adapter) |
2739 | return ERR_PTR(-EFAULT); | 2787 | return ERR_PTR(-EFAULT); |
@@ -2859,6 +2907,15 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
2859 | mwifiex_init_priv_params(priv, dev); | 2907 | mwifiex_init_priv_params(priv, dev); |
2860 | priv->netdev = dev; | 2908 | priv->netdev = dev; |
2861 | 2909 | ||
2910 | ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE, | ||
2911 | HostCmd_ACT_GEN_SET, 0, NULL, true); | ||
2912 | if (ret) | ||
2913 | return ERR_PTR(ret); | ||
2914 | |||
2915 | ret = mwifiex_sta_init_cmd(priv, false, false); | ||
2916 | if (ret) | ||
2917 | return ERR_PTR(ret); | ||
2918 | |||
2862 | mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv); | 2919 | mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv); |
2863 | if (adapter->is_hw_11ac_capable) | 2920 | if (adapter->is_hw_11ac_capable) |
2864 | mwifiex_setup_vht_caps( | 2921 | mwifiex_setup_vht_caps( |
@@ -3262,7 +3319,10 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, | |||
3262 | struct mwifiex_ds_hs_cfg hs_cfg; | 3319 | struct mwifiex_ds_hs_cfg hs_cfg; |
3263 | int i, ret = 0, retry_num = 10; | 3320 | int i, ret = 0, retry_num = 10; |
3264 | struct mwifiex_private *priv; | 3321 | struct mwifiex_private *priv; |
3322 | struct mwifiex_private *sta_priv = | ||
3323 | mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); | ||
3265 | 3324 | ||
3325 | sta_priv->scan_aborting = true; | ||
3266 | for (i = 0; i < adapter->priv_num; i++) { | 3326 | for (i = 0; i < adapter->priv_num; i++) { |
3267 | priv = adapter->priv[i]; | 3327 | priv = adapter->priv[i]; |
3268 | mwifiex_abort_cac(priv); | 3328 | mwifiex_abort_cac(priv); |
@@ -3291,21 +3351,21 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, | |||
3291 | if (!wowlan) { | 3351 | if (!wowlan) { |
3292 | mwifiex_dbg(adapter, ERROR, | 3352 | mwifiex_dbg(adapter, ERROR, |
3293 | "None of the WOWLAN triggers enabled\n"); | 3353 | "None of the WOWLAN triggers enabled\n"); |
3294 | return 0; | 3354 | ret = 0; |
3355 | goto done; | ||
3295 | } | 3356 | } |
3296 | 3357 | ||
3297 | priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); | 3358 | if (!sta_priv->media_connected && !wowlan->nd_config) { |
3298 | |||
3299 | if (!priv->media_connected && !wowlan->nd_config) { | ||
3300 | mwifiex_dbg(adapter, ERROR, | 3359 | mwifiex_dbg(adapter, ERROR, |
3301 | "Can not configure WOWLAN in disconnected state\n"); | 3360 | "Can not configure WOWLAN in disconnected state\n"); |
3302 | return 0; | 3361 | ret = 0; |
3362 | goto done; | ||
3303 | } | 3363 | } |
3304 | 3364 | ||
3305 | ret = mwifiex_set_mef_filter(priv, wowlan); | 3365 | ret = mwifiex_set_mef_filter(sta_priv, wowlan); |
3306 | if (ret) { | 3366 | if (ret) { |
3307 | mwifiex_dbg(adapter, ERROR, "Failed to set MEF filter\n"); | 3367 | mwifiex_dbg(adapter, ERROR, "Failed to set MEF filter\n"); |
3308 | return ret; | 3368 | goto done; |
3309 | } | 3369 | } |
3310 | 3370 | ||
3311 | memset(&hs_cfg, 0, sizeof(hs_cfg)); | 3371 | memset(&hs_cfg, 0, sizeof(hs_cfg)); |
@@ -3314,26 +3374,25 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, | |||
3314 | if (wowlan->nd_config) { | 3374 | if (wowlan->nd_config) { |
3315 | mwifiex_dbg(adapter, INFO, "Wake on net detect\n"); | 3375 | mwifiex_dbg(adapter, INFO, "Wake on net detect\n"); |
3316 | hs_cfg.conditions |= HS_CFG_COND_MAC_EVENT; | 3376 | hs_cfg.conditions |= HS_CFG_COND_MAC_EVENT; |
3317 | mwifiex_cfg80211_sched_scan_start(wiphy, priv->netdev, | 3377 | mwifiex_cfg80211_sched_scan_start(wiphy, sta_priv->netdev, |
3318 | wowlan->nd_config); | 3378 | wowlan->nd_config); |
3319 | } | 3379 | } |
3320 | 3380 | ||
3321 | if (wowlan->disconnect) { | 3381 | if (wowlan->disconnect) { |
3322 | hs_cfg.conditions |= HS_CFG_COND_MAC_EVENT; | 3382 | hs_cfg.conditions |= HS_CFG_COND_MAC_EVENT; |
3323 | mwifiex_dbg(priv->adapter, INFO, "Wake on device disconnect\n"); | 3383 | mwifiex_dbg(sta_priv->adapter, INFO, "Wake on device disconnect\n"); |
3324 | } | 3384 | } |
3325 | 3385 | ||
3326 | hs_cfg.is_invoke_hostcmd = false; | 3386 | hs_cfg.is_invoke_hostcmd = false; |
3327 | hs_cfg.gpio = adapter->hs_cfg.gpio; | 3387 | hs_cfg.gpio = adapter->hs_cfg.gpio; |
3328 | hs_cfg.gap = adapter->hs_cfg.gap; | 3388 | hs_cfg.gap = adapter->hs_cfg.gap; |
3329 | ret = mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET, | 3389 | ret = mwifiex_set_hs_params(sta_priv, HostCmd_ACT_GEN_SET, |
3330 | MWIFIEX_SYNC_CMD, &hs_cfg); | 3390 | MWIFIEX_SYNC_CMD, &hs_cfg); |
3331 | if (ret) { | 3391 | if (ret) |
3332 | mwifiex_dbg(adapter, ERROR, | 3392 | mwifiex_dbg(adapter, ERROR, "Failed to set HS params\n"); |
3333 | "Failed to set HS params\n"); | ||
3334 | return ret; | ||
3335 | } | ||
3336 | 3393 | ||
3394 | done: | ||
3395 | sta_priv->scan_aborting = false; | ||
3337 | return ret; | 3396 | return ret; |
3338 | } | 3397 | } |
3339 | 3398 | ||
@@ -3940,12 +3999,14 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { | |||
3940 | .set_default_key = mwifiex_cfg80211_set_default_key, | 3999 | .set_default_key = mwifiex_cfg80211_set_default_key, |
3941 | .set_power_mgmt = mwifiex_cfg80211_set_power_mgmt, | 4000 | .set_power_mgmt = mwifiex_cfg80211_set_power_mgmt, |
3942 | .set_tx_power = mwifiex_cfg80211_set_tx_power, | 4001 | .set_tx_power = mwifiex_cfg80211_set_tx_power, |
4002 | .get_tx_power = mwifiex_cfg80211_get_tx_power, | ||
3943 | .set_bitrate_mask = mwifiex_cfg80211_set_bitrate_mask, | 4003 | .set_bitrate_mask = mwifiex_cfg80211_set_bitrate_mask, |
3944 | .start_ap = mwifiex_cfg80211_start_ap, | 4004 | .start_ap = mwifiex_cfg80211_start_ap, |
3945 | .stop_ap = mwifiex_cfg80211_stop_ap, | 4005 | .stop_ap = mwifiex_cfg80211_stop_ap, |
3946 | .change_beacon = mwifiex_cfg80211_change_beacon, | 4006 | .change_beacon = mwifiex_cfg80211_change_beacon, |
3947 | .set_cqm_rssi_config = mwifiex_cfg80211_set_cqm_rssi_config, | 4007 | .set_cqm_rssi_config = mwifiex_cfg80211_set_cqm_rssi_config, |
3948 | .set_antenna = mwifiex_cfg80211_set_antenna, | 4008 | .set_antenna = mwifiex_cfg80211_set_antenna, |
4009 | .get_antenna = mwifiex_cfg80211_get_antenna, | ||
3949 | .del_station = mwifiex_cfg80211_del_station, | 4010 | .del_station = mwifiex_cfg80211_del_station, |
3950 | .sched_scan_start = mwifiex_cfg80211_sched_scan_start, | 4011 | .sched_scan_start = mwifiex_cfg80211_sched_scan_start, |
3951 | .sched_scan_stop = mwifiex_cfg80211_sched_scan_stop, | 4012 | .sched_scan_stop = mwifiex_cfg80211_sched_scan_stop, |
diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index e7a21443647e..c29f26d8baf2 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c | |||
@@ -1020,8 +1020,6 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) | |||
1020 | { | 1020 | { |
1021 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; | 1021 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; |
1022 | unsigned long flags, cmd_flags; | 1022 | unsigned long flags, cmd_flags; |
1023 | struct mwifiex_private *priv; | ||
1024 | int i; | ||
1025 | 1023 | ||
1026 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); | 1024 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); |
1027 | /* Cancel current cmd */ | 1025 | /* Cancel current cmd */ |
@@ -1046,27 +1044,7 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) | |||
1046 | spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); | 1044 | spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); |
1047 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); | 1045 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); |
1048 | 1046 | ||
1049 | mwifiex_cancel_pending_scan_cmd(adapter); | 1047 | mwifiex_cancel_scan(adapter); |
1050 | |||
1051 | if (adapter->scan_processing) { | ||
1052 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); | ||
1053 | adapter->scan_processing = false; | ||
1054 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); | ||
1055 | for (i = 0; i < adapter->priv_num; i++) { | ||
1056 | priv = adapter->priv[i]; | ||
1057 | if (!priv) | ||
1058 | continue; | ||
1059 | if (priv->scan_request) { | ||
1060 | struct cfg80211_scan_info info = { | ||
1061 | .aborted = true, | ||
1062 | }; | ||
1063 | |||
1064 | mwifiex_dbg(adapter, WARN, "info: aborting scan\n"); | ||
1065 | cfg80211_scan_done(priv->scan_request, &info); | ||
1066 | priv->scan_request = NULL; | ||
1067 | } | ||
1068 | } | ||
1069 | } | ||
1070 | } | 1048 | } |
1071 | 1049 | ||
1072 | /* | 1050 | /* |
@@ -1084,8 +1062,6 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) | |||
1084 | { | 1062 | { |
1085 | struct cmd_ctrl_node *cmd_node = NULL; | 1063 | struct cmd_ctrl_node *cmd_node = NULL; |
1086 | unsigned long cmd_flags; | 1064 | unsigned long cmd_flags; |
1087 | struct mwifiex_private *priv; | ||
1088 | int i; | ||
1089 | 1065 | ||
1090 | if ((adapter->curr_cmd) && | 1066 | if ((adapter->curr_cmd) && |
1091 | (adapter->curr_cmd->wait_q_enabled)) { | 1067 | (adapter->curr_cmd->wait_q_enabled)) { |
@@ -1105,27 +1081,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) | |||
1105 | mwifiex_recycle_cmd_node(adapter, cmd_node); | 1081 | mwifiex_recycle_cmd_node(adapter, cmd_node); |
1106 | } | 1082 | } |
1107 | 1083 | ||
1108 | mwifiex_cancel_pending_scan_cmd(adapter); | 1084 | mwifiex_cancel_scan(adapter); |
1109 | |||
1110 | if (adapter->scan_processing) { | ||
1111 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); | ||
1112 | adapter->scan_processing = false; | ||
1113 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); | ||
1114 | for (i = 0; i < adapter->priv_num; i++) { | ||
1115 | priv = adapter->priv[i]; | ||
1116 | if (!priv) | ||
1117 | continue; | ||
1118 | if (priv->scan_request) { | ||
1119 | struct cfg80211_scan_info info = { | ||
1120 | .aborted = true, | ||
1121 | }; | ||
1122 | |||
1123 | mwifiex_dbg(adapter, WARN, "info: aborting scan\n"); | ||
1124 | cfg80211_scan_done(priv->scan_request, &info); | ||
1125 | priv->scan_request = NULL; | ||
1126 | } | ||
1127 | } | ||
1128 | } | ||
1129 | } | 1085 | } |
1130 | 1086 | ||
1131 | /* | 1087 | /* |
diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index 8e4145abdbfa..5596b6be1898 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h | |||
@@ -462,6 +462,9 @@ enum P2P_MODES { | |||
462 | #define HostCmd_ACT_SET_RX 0x0001 | 462 | #define HostCmd_ACT_SET_RX 0x0001 |
463 | #define HostCmd_ACT_SET_TX 0x0002 | 463 | #define HostCmd_ACT_SET_TX 0x0002 |
464 | #define HostCmd_ACT_SET_BOTH 0x0003 | 464 | #define HostCmd_ACT_SET_BOTH 0x0003 |
465 | #define HostCmd_ACT_GET_RX 0x0004 | ||
466 | #define HostCmd_ACT_GET_TX 0x0008 | ||
467 | #define HostCmd_ACT_GET_BOTH 0x000c | ||
465 | 468 | ||
466 | #define RF_ANTENNA_AUTO 0xFFFF | 469 | #define RF_ANTENNA_AUTO 0xFFFF |
467 | 470 | ||
@@ -1958,8 +1961,8 @@ struct mwifiex_ie_types_btcoex_scan_time { | |||
1958 | struct mwifiex_ie_types_header header; | 1961 | struct mwifiex_ie_types_header header; |
1959 | u8 coex_scan; | 1962 | u8 coex_scan; |
1960 | u8 reserved; | 1963 | u8 reserved; |
1961 | u16 min_scan_time; | 1964 | __le16 min_scan_time; |
1962 | u16 max_scan_time; | 1965 | __le16 max_scan_time; |
1963 | } __packed; | 1966 | } __packed; |
1964 | 1967 | ||
1965 | struct mwifiex_ie_types_btcoex_aggr_win_size { | 1968 | struct mwifiex_ie_types_btcoex_aggr_win_size { |
diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index a6d86d4ccd22..1489c90192bd 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c | |||
@@ -60,7 +60,7 @@ static void wakeup_timer_fn(unsigned long data) | |||
60 | adapter->hw_status = MWIFIEX_HW_STATUS_RESET; | 60 | adapter->hw_status = MWIFIEX_HW_STATUS_RESET; |
61 | mwifiex_cancel_all_pending_cmd(adapter); | 61 | mwifiex_cancel_all_pending_cmd(adapter); |
62 | 62 | ||
63 | if (adapter->if_ops.card_reset) | 63 | if (adapter->if_ops.card_reset && !adapter->hs_activated) |
64 | adapter->if_ops.card_reset(adapter); | 64 | adapter->if_ops.card_reset(adapter); |
65 | } | 65 | } |
66 | 66 | ||
@@ -110,6 +110,8 @@ int mwifiex_init_priv(struct mwifiex_private *priv) | |||
110 | priv->tx_power_level = 0; | 110 | priv->tx_power_level = 0; |
111 | priv->max_tx_power_level = 0; | 111 | priv->max_tx_power_level = 0; |
112 | priv->min_tx_power_level = 0; | 112 | priv->min_tx_power_level = 0; |
113 | priv->tx_ant = 0; | ||
114 | priv->rx_ant = 0; | ||
113 | priv->tx_rate = 0; | 115 | priv->tx_rate = 0; |
114 | priv->rxpd_htinfo = 0; | 116 | priv->rxpd_htinfo = 0; |
115 | priv->rxpd_rate = 0; | 117 | priv->rxpd_rate = 0; |
diff --git a/drivers/net/wireless/marvell/mwifiex/ioctl.h b/drivers/net/wireless/marvell/mwifiex/ioctl.h index a5a48c183d37..f5b8fd1fad1b 100644 --- a/drivers/net/wireless/marvell/mwifiex/ioctl.h +++ b/drivers/net/wireless/marvell/mwifiex/ioctl.h | |||
@@ -83,6 +83,8 @@ struct wep_key { | |||
83 | #define MWIFIEX_AUTH_MODE_AUTO 0xFF | 83 | #define MWIFIEX_AUTH_MODE_AUTO 0xFF |
84 | #define BAND_CONFIG_BG 0x00 | 84 | #define BAND_CONFIG_BG 0x00 |
85 | #define BAND_CONFIG_A 0x01 | 85 | #define BAND_CONFIG_A 0x01 |
86 | #define MWIFIEX_SEC_CHAN_BELOW 0x30 | ||
87 | #define MWIFIEX_SEC_CHAN_ABOVE 0x10 | ||
86 | #define MWIFIEX_SUPPORTED_RATES 14 | 88 | #define MWIFIEX_SUPPORTED_RATES 14 |
87 | #define MWIFIEX_SUPPORTED_RATES_EXT 32 | 89 | #define MWIFIEX_SUPPORTED_RATES_EXT 32 |
88 | #define MWIFIEX_TDLS_SUPPORTED_RATES 8 | 90 | #define MWIFIEX_TDLS_SUPPORTED_RATES 8 |
diff --git a/drivers/net/wireless/marvell/mwifiex/join.c b/drivers/net/wireless/marvell/mwifiex/join.c index a4b773d102b3..1c7b00630b90 100644 --- a/drivers/net/wireless/marvell/mwifiex/join.c +++ b/drivers/net/wireless/marvell/mwifiex/join.c | |||
@@ -647,6 +647,12 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, | |||
647 | const u8 *ie_ptr; | 647 | const u8 *ie_ptr; |
648 | struct ieee80211_ht_operation *assoc_resp_ht_oper; | 648 | struct ieee80211_ht_operation *assoc_resp_ht_oper; |
649 | 649 | ||
650 | if (!priv->attempted_bss_desc) { | ||
651 | mwifiex_dbg(priv->adapter, ERROR, | ||
652 | "ASSOC_RESP: failed, association terminated by host\n"); | ||
653 | goto done; | ||
654 | } | ||
655 | |||
650 | assoc_rsp = (struct ieee_types_assoc_rsp *) &resp->params; | 656 | assoc_rsp = (struct ieee_types_assoc_rsp *) &resp->params; |
651 | 657 | ||
652 | cap_info = le16_to_cpu(assoc_rsp->cap_info_bitmap); | 658 | cap_info = le16_to_cpu(assoc_rsp->cap_info_bitmap); |
@@ -1270,6 +1276,12 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, | |||
1270 | u16 cmd = le16_to_cpu(resp->command); | 1276 | u16 cmd = le16_to_cpu(resp->command); |
1271 | u8 result; | 1277 | u8 result; |
1272 | 1278 | ||
1279 | if (!priv->attempted_bss_desc) { | ||
1280 | mwifiex_dbg(priv->adapter, ERROR, | ||
1281 | "ADHOC_RESP: failed, association terminated by host\n"); | ||
1282 | goto done; | ||
1283 | } | ||
1284 | |||
1273 | if (cmd == HostCmd_CMD_802_11_AD_HOC_START) | 1285 | if (cmd == HostCmd_CMD_802_11_AD_HOC_START) |
1274 | result = start_result->result; | 1286 | result = start_result->result; |
1275 | else | 1287 | else |
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index f0cd055c0b2c..9f6bb400bdae 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h | |||
@@ -533,6 +533,8 @@ struct mwifiex_private { | |||
533 | u16 tx_power_level; | 533 | u16 tx_power_level; |
534 | u8 max_tx_power_level; | 534 | u8 max_tx_power_level; |
535 | u8 min_tx_power_level; | 535 | u8 min_tx_power_level; |
536 | u32 tx_ant; | ||
537 | u32 rx_ant; | ||
536 | u8 tx_rate; | 538 | u8 tx_rate; |
537 | u8 tx_htinfo; | 539 | u8 tx_htinfo; |
538 | u8 rxpd_htinfo; | 540 | u8 rxpd_htinfo; |
@@ -1054,6 +1056,7 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter); | |||
1054 | void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter); | 1056 | void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter); |
1055 | void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter); | 1057 | void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter); |
1056 | void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter); | 1058 | void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter); |
1059 | void mwifiex_cancel_scan(struct mwifiex_adapter *adapter); | ||
1057 | 1060 | ||
1058 | void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, | 1061 | void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, |
1059 | struct cmd_ctrl_node *cmd_node); | 1062 | struct cmd_ctrl_node *cmd_node); |
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 1b1e266ce00f..22fe993b7dbb 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c | |||
@@ -440,6 +440,11 @@ static int mwifiex_pcie_disable_host_int(struct mwifiex_adapter *adapter) | |||
440 | return 0; | 440 | return 0; |
441 | } | 441 | } |
442 | 442 | ||
443 | static void mwifiex_pcie_disable_host_int_noerr(struct mwifiex_adapter *adapter) | ||
444 | { | ||
445 | WARN_ON(mwifiex_pcie_disable_host_int(adapter)); | ||
446 | } | ||
447 | |||
443 | /* | 448 | /* |
444 | * This function enables the host interrupt. | 449 | * This function enables the host interrupt. |
445 | * | 450 | * |
@@ -2086,6 +2091,13 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter, | |||
2086 | unsigned long flags; | 2091 | unsigned long flags; |
2087 | struct pcie_service_card *card = adapter->card; | 2092 | struct pcie_service_card *card = adapter->card; |
2088 | 2093 | ||
2094 | if (card->msi_enable) { | ||
2095 | spin_lock_irqsave(&adapter->int_lock, flags); | ||
2096 | adapter->int_status = 1; | ||
2097 | spin_unlock_irqrestore(&adapter->int_lock, flags); | ||
2098 | return; | ||
2099 | } | ||
2100 | |||
2089 | if (!mwifiex_pcie_ok_to_access_hw(adapter)) | 2101 | if (!mwifiex_pcie_ok_to_access_hw(adapter)) |
2090 | return; | 2102 | return; |
2091 | 2103 | ||
@@ -2187,15 +2199,44 @@ exit: | |||
2187 | static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter) | 2199 | static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter) |
2188 | { | 2200 | { |
2189 | int ret; | 2201 | int ret; |
2190 | u32 pcie_ireg; | 2202 | u32 pcie_ireg = 0; |
2191 | unsigned long flags; | 2203 | unsigned long flags; |
2204 | struct pcie_service_card *card = adapter->card; | ||
2192 | 2205 | ||
2193 | spin_lock_irqsave(&adapter->int_lock, flags); | 2206 | spin_lock_irqsave(&adapter->int_lock, flags); |
2194 | /* Clear out unused interrupts */ | 2207 | if (!card->msi_enable) { |
2195 | pcie_ireg = adapter->int_status; | 2208 | /* Clear out unused interrupts */ |
2209 | pcie_ireg = adapter->int_status; | ||
2210 | } | ||
2196 | adapter->int_status = 0; | 2211 | adapter->int_status = 0; |
2197 | spin_unlock_irqrestore(&adapter->int_lock, flags); | 2212 | spin_unlock_irqrestore(&adapter->int_lock, flags); |
2198 | 2213 | ||
2214 | if (card->msi_enable) { | ||
2215 | if (mwifiex_pcie_ok_to_access_hw(adapter)) { | ||
2216 | if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS, | ||
2217 | &pcie_ireg)) { | ||
2218 | mwifiex_dbg(adapter, ERROR, | ||
2219 | "Read register failed\n"); | ||
2220 | return -1; | ||
2221 | } | ||
2222 | |||
2223 | if ((pcie_ireg != 0xFFFFFFFF) && (pcie_ireg)) { | ||
2224 | if (mwifiex_write_reg(adapter, | ||
2225 | PCIE_HOST_INT_STATUS, | ||
2226 | ~pcie_ireg)) { | ||
2227 | mwifiex_dbg(adapter, ERROR, | ||
2228 | "Write register failed\n"); | ||
2229 | return -1; | ||
2230 | } | ||
2231 | if (!adapter->pps_uapsd_mode && | ||
2232 | adapter->ps_state == PS_STATE_SLEEP) { | ||
2233 | adapter->ps_state = PS_STATE_AWAKE; | ||
2234 | adapter->pm_wakeup_fw_try = false; | ||
2235 | del_timer(&adapter->wakeup_timer); | ||
2236 | } | ||
2237 | } | ||
2238 | } | ||
2239 | } | ||
2199 | while (pcie_ireg & HOST_INTR_MASK) { | 2240 | while (pcie_ireg & HOST_INTR_MASK) { |
2200 | if (pcie_ireg & HOST_INTR_DNLD_DONE) { | 2241 | if (pcie_ireg & HOST_INTR_DNLD_DONE) { |
2201 | pcie_ireg &= ~HOST_INTR_DNLD_DONE; | 2242 | pcie_ireg &= ~HOST_INTR_DNLD_DONE; |
@@ -2235,6 +2276,12 @@ static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter) | |||
2235 | return ret; | 2276 | return ret; |
2236 | } | 2277 | } |
2237 | 2278 | ||
2279 | if (card->msi_enable) { | ||
2280 | spin_lock_irqsave(&adapter->int_lock, flags); | ||
2281 | adapter->int_status = 0; | ||
2282 | spin_unlock_irqrestore(&adapter->int_lock, flags); | ||
2283 | } | ||
2284 | |||
2238 | if (mwifiex_pcie_ok_to_access_hw(adapter)) { | 2285 | if (mwifiex_pcie_ok_to_access_hw(adapter)) { |
2239 | if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS, | 2286 | if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS, |
2240 | &pcie_ireg)) { | 2287 | &pcie_ireg)) { |
@@ -2258,7 +2305,7 @@ static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter) | |||
2258 | mwifiex_dbg(adapter, INTR, | 2305 | mwifiex_dbg(adapter, INTR, |
2259 | "info: cmd_sent=%d data_sent=%d\n", | 2306 | "info: cmd_sent=%d data_sent=%d\n", |
2260 | adapter->cmd_sent, adapter->data_sent); | 2307 | adapter->cmd_sent, adapter->data_sent); |
2261 | if (adapter->ps_state != PS_STATE_SLEEP) | 2308 | if (!card->msi_enable && adapter->ps_state != PS_STATE_SLEEP) |
2262 | mwifiex_pcie_enable_host_int(adapter); | 2309 | mwifiex_pcie_enable_host_int(adapter); |
2263 | 2310 | ||
2264 | return 0; | 2311 | return 0; |
@@ -2841,20 +2888,20 @@ static void mwifiex_pcie_get_fw_name(struct mwifiex_adapter *adapter) | |||
2841 | version &= 0x7; | 2888 | version &= 0x7; |
2842 | switch (revision_id) { | 2889 | switch (revision_id) { |
2843 | case PCIE8997_V2: | 2890 | case PCIE8997_V2: |
2844 | if (version == CHIP_VER_PCIEUSB) | 2891 | if (version == CHIP_VER_PCIEUART) |
2845 | strcpy(adapter->fw_name, | 2892 | strcpy(adapter->fw_name, |
2846 | PCIEUSB8997_FW_NAME_V2); | 2893 | PCIEUART8997_FW_NAME_V2); |
2847 | else | 2894 | else |
2848 | strcpy(adapter->fw_name, | 2895 | strcpy(adapter->fw_name, |
2849 | PCIEUART8997_FW_NAME_V2); | 2896 | PCIEUSB8997_FW_NAME_V2); |
2850 | break; | 2897 | break; |
2851 | case PCIE8997_Z: | 2898 | case PCIE8997_Z: |
2852 | if (version == CHIP_VER_PCIEUSB) | 2899 | if (version == CHIP_VER_PCIEUART) |
2853 | strcpy(adapter->fw_name, | 2900 | strcpy(adapter->fw_name, |
2854 | PCIEUSB8997_FW_NAME_Z); | 2901 | PCIEUART8997_FW_NAME_Z); |
2855 | else | 2902 | else |
2856 | strcpy(adapter->fw_name, | 2903 | strcpy(adapter->fw_name, |
2857 | PCIEUART8997_FW_NAME_Z); | 2904 | PCIEUSB8997_FW_NAME_Z); |
2858 | break; | 2905 | break; |
2859 | default: | 2906 | default: |
2860 | strcpy(adapter->fw_name, PCIE8997_DEFAULT_FW_NAME); | 2907 | strcpy(adapter->fw_name, PCIE8997_DEFAULT_FW_NAME); |
@@ -2946,6 +2993,7 @@ static struct mwifiex_if_ops pcie_ops = { | |||
2946 | .register_dev = mwifiex_register_dev, | 2993 | .register_dev = mwifiex_register_dev, |
2947 | .unregister_dev = mwifiex_unregister_dev, | 2994 | .unregister_dev = mwifiex_unregister_dev, |
2948 | .enable_int = mwifiex_pcie_enable_host_int, | 2995 | .enable_int = mwifiex_pcie_enable_host_int, |
2996 | .disable_int = mwifiex_pcie_disable_host_int_noerr, | ||
2949 | .process_int_status = mwifiex_process_int_status, | 2997 | .process_int_status = mwifiex_process_int_status, |
2950 | .host_to_card = mwifiex_pcie_host_to_card, | 2998 | .host_to_card = mwifiex_pcie_host_to_card, |
2951 | .wakeup = mwifiex_pm_wakeup_card, | 2999 | .wakeup = mwifiex_pm_wakeup_card, |
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.h b/drivers/net/wireless/marvell/mwifiex/pcie.h index 2592e63c32cf..f05061cea5cd 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.h +++ b/drivers/net/wireless/marvell/mwifiex/pcie.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #define PCIE8897_DEFAULT_FW_NAME "mrvl/pcie8897_uapsta.bin" | 32 | #define PCIE8897_DEFAULT_FW_NAME "mrvl/pcie8897_uapsta.bin" |
33 | #define PCIE8897_A0_FW_NAME "mrvl/pcie8897_uapsta_a0.bin" | 33 | #define PCIE8897_A0_FW_NAME "mrvl/pcie8897_uapsta_a0.bin" |
34 | #define PCIE8897_B0_FW_NAME "mrvl/pcie8897_uapsta.bin" | 34 | #define PCIE8897_B0_FW_NAME "mrvl/pcie8897_uapsta.bin" |
35 | #define PCIE8997_DEFAULT_FW_NAME "mrvl/pcieuart8997_combo_v2.bin" | 35 | #define PCIE8997_DEFAULT_FW_NAME "mrvl/pcieusb8997_combo_v2.bin" |
36 | #define PCIEUART8997_FW_NAME_Z "mrvl/pcieuart8997_combo.bin" | 36 | #define PCIEUART8997_FW_NAME_Z "mrvl/pcieuart8997_combo.bin" |
37 | #define PCIEUART8997_FW_NAME_V2 "mrvl/pcieuart8997_combo_v2.bin" | 37 | #define PCIEUART8997_FW_NAME_V2 "mrvl/pcieuart8997_combo_v2.bin" |
38 | #define PCIEUSB8997_FW_NAME_Z "mrvl/pcieusb8997_combo.bin" | 38 | #define PCIEUSB8997_FW_NAME_Z "mrvl/pcieusb8997_combo.bin" |
@@ -48,7 +48,7 @@ | |||
48 | #define PCIE8897_B0 0x1200 | 48 | #define PCIE8897_B0 0x1200 |
49 | #define PCIE8997_Z 0x0 | 49 | #define PCIE8997_Z 0x0 |
50 | #define PCIE8997_V2 0x471 | 50 | #define PCIE8997_V2 0x471 |
51 | #define CHIP_VER_PCIEUSB 0x2 | 51 | #define CHIP_VER_PCIEUART 0x3 |
52 | 52 | ||
53 | /* Constants for Buffer Descriptor (BD) rings */ | 53 | /* Constants for Buffer Descriptor (BD) rings */ |
54 | #define MWIFIEX_MAX_TXRX_BD 0x20 | 54 | #define MWIFIEX_MAX_TXRX_BD 0x20 |
@@ -258,7 +258,7 @@ static const struct mwifiex_pcie_card_reg mwifiex_reg_8997 = { | |||
258 | .fw_dump_end = 0xcff, | 258 | .fw_dump_end = 0xcff, |
259 | .fw_dump_host_ready = 0xcc, | 259 | .fw_dump_host_ready = 0xcc, |
260 | .fw_dump_read_done = 0xdd, | 260 | .fw_dump_read_done = 0xdd, |
261 | .msix_support = 1, | 261 | .msix_support = 0, |
262 | }; | 262 | }; |
263 | 263 | ||
264 | static struct memory_type_mapping mem_type_mapping_tbl_w8897[] = { | 264 | static struct memory_type_mapping mem_type_mapping_tbl_w8897[] = { |
diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c index fdd749110fcb..21ec84794d0c 100644 --- a/drivers/net/wireless/marvell/mwifiex/scan.c +++ b/drivers/net/wireless/marvell/mwifiex/scan.c | |||
@@ -1896,7 +1896,8 @@ mwifiex_active_scan_req_for_passive_chan(struct mwifiex_private *priv) | |||
1896 | u8 id = 0; | 1896 | u8 id = 0; |
1897 | struct mwifiex_user_scan_cfg *user_scan_cfg; | 1897 | struct mwifiex_user_scan_cfg *user_scan_cfg; |
1898 | 1898 | ||
1899 | if (adapter->active_scan_triggered || !priv->scan_request) { | 1899 | if (adapter->active_scan_triggered || !priv->scan_request || |
1900 | priv->scan_aborting) { | ||
1900 | adapter->active_scan_triggered = false; | 1901 | adapter->active_scan_triggered = false; |
1901 | return 0; | 1902 | return 0; |
1902 | } | 1903 | } |
@@ -1964,6 +1965,7 @@ static void mwifiex_check_next_scan_command(struct mwifiex_private *priv) | |||
1964 | "info: notifying scan done\n"); | 1965 | "info: notifying scan done\n"); |
1965 | cfg80211_scan_done(priv->scan_request, &info); | 1966 | cfg80211_scan_done(priv->scan_request, &info); |
1966 | priv->scan_request = NULL; | 1967 | priv->scan_request = NULL; |
1968 | priv->scan_aborting = false; | ||
1967 | } else { | 1969 | } else { |
1968 | priv->scan_aborting = false; | 1970 | priv->scan_aborting = false; |
1969 | mwifiex_dbg(adapter, INFO, | 1971 | mwifiex_dbg(adapter, INFO, |
@@ -1989,6 +1991,7 @@ static void mwifiex_check_next_scan_command(struct mwifiex_private *priv) | |||
1989 | "info: aborting scan\n"); | 1991 | "info: aborting scan\n"); |
1990 | cfg80211_scan_done(priv->scan_request, &info); | 1992 | cfg80211_scan_done(priv->scan_request, &info); |
1991 | priv->scan_request = NULL; | 1993 | priv->scan_request = NULL; |
1994 | priv->scan_aborting = false; | ||
1992 | } else { | 1995 | } else { |
1993 | priv->scan_aborting = false; | 1996 | priv->scan_aborting = false; |
1994 | mwifiex_dbg(adapter, INFO, | 1997 | mwifiex_dbg(adapter, INFO, |
@@ -2009,6 +2012,37 @@ static void mwifiex_check_next_scan_command(struct mwifiex_private *priv) | |||
2009 | return; | 2012 | return; |
2010 | } | 2013 | } |
2011 | 2014 | ||
2015 | void mwifiex_cancel_scan(struct mwifiex_adapter *adapter) | ||
2016 | { | ||
2017 | struct mwifiex_private *priv; | ||
2018 | unsigned long cmd_flags; | ||
2019 | int i; | ||
2020 | |||
2021 | mwifiex_cancel_pending_scan_cmd(adapter); | ||
2022 | |||
2023 | if (adapter->scan_processing) { | ||
2024 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); | ||
2025 | adapter->scan_processing = false; | ||
2026 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); | ||
2027 | for (i = 0; i < adapter->priv_num; i++) { | ||
2028 | priv = adapter->priv[i]; | ||
2029 | if (!priv) | ||
2030 | continue; | ||
2031 | if (priv->scan_request) { | ||
2032 | struct cfg80211_scan_info info = { | ||
2033 | .aborted = true, | ||
2034 | }; | ||
2035 | |||
2036 | mwifiex_dbg(adapter, INFO, | ||
2037 | "info: aborting scan\n"); | ||
2038 | cfg80211_scan_done(priv->scan_request, &info); | ||
2039 | priv->scan_request = NULL; | ||
2040 | priv->scan_aborting = false; | ||
2041 | } | ||
2042 | } | ||
2043 | } | ||
2044 | } | ||
2045 | |||
2012 | /* | 2046 | /* |
2013 | * This function handles the command response of scan. | 2047 | * This function handles the command response of scan. |
2014 | * | 2048 | * |
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c index e436574b1698..8c658495bf66 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c | |||
@@ -313,23 +313,41 @@ static int mwifiex_cmd_rf_antenna(struct mwifiex_private *priv, | |||
313 | 313 | ||
314 | cmd->command = cpu_to_le16(HostCmd_CMD_RF_ANTENNA); | 314 | cmd->command = cpu_to_le16(HostCmd_CMD_RF_ANTENNA); |
315 | 315 | ||
316 | if (cmd_action != HostCmd_ACT_GEN_SET) | 316 | switch (cmd_action) { |
317 | return 0; | 317 | case HostCmd_ACT_GEN_SET: |
318 | 318 | if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) { | |
319 | if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) { | 319 | cmd->size = cpu_to_le16(sizeof(struct |
320 | cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_ant_mimo) + | 320 | host_cmd_ds_rf_ant_mimo) |
321 | S_DS_GEN); | 321 | + S_DS_GEN); |
322 | ant_mimo->action_tx = cpu_to_le16(HostCmd_ACT_SET_TX); | 322 | ant_mimo->action_tx = cpu_to_le16(HostCmd_ACT_SET_TX); |
323 | ant_mimo->tx_ant_mode = cpu_to_le16((u16)ant_cfg->tx_ant); | 323 | ant_mimo->tx_ant_mode = cpu_to_le16((u16)ant_cfg-> |
324 | ant_mimo->action_rx = cpu_to_le16(HostCmd_ACT_SET_RX); | 324 | tx_ant); |
325 | ant_mimo->rx_ant_mode = cpu_to_le16((u16)ant_cfg->rx_ant); | 325 | ant_mimo->action_rx = cpu_to_le16(HostCmd_ACT_SET_RX); |
326 | } else { | 326 | ant_mimo->rx_ant_mode = cpu_to_le16((u16)ant_cfg-> |
327 | cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_ant_siso) + | 327 | rx_ant); |
328 | S_DS_GEN); | 328 | } else { |
329 | ant_siso->action = cpu_to_le16(HostCmd_ACT_SET_BOTH); | 329 | cmd->size = cpu_to_le16(sizeof(struct |
330 | ant_siso->ant_mode = cpu_to_le16((u16)ant_cfg->tx_ant); | 330 | host_cmd_ds_rf_ant_siso) + |
331 | S_DS_GEN); | ||
332 | ant_siso->action = cpu_to_le16(HostCmd_ACT_SET_BOTH); | ||
333 | ant_siso->ant_mode = cpu_to_le16((u16)ant_cfg->tx_ant); | ||
334 | } | ||
335 | break; | ||
336 | case HostCmd_ACT_GEN_GET: | ||
337 | if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) { | ||
338 | cmd->size = cpu_to_le16(sizeof(struct | ||
339 | host_cmd_ds_rf_ant_mimo) + | ||
340 | S_DS_GEN); | ||
341 | ant_mimo->action_tx = cpu_to_le16(HostCmd_ACT_GET_TX); | ||
342 | ant_mimo->action_rx = cpu_to_le16(HostCmd_ACT_GET_RX); | ||
343 | } else { | ||
344 | cmd->size = cpu_to_le16(sizeof(struct | ||
345 | host_cmd_ds_rf_ant_siso) + | ||
346 | S_DS_GEN); | ||
347 | ant_siso->action = cpu_to_le16(HostCmd_ACT_GET_BOTH); | ||
348 | } | ||
349 | break; | ||
331 | } | 350 | } |
332 | |||
333 | return 0; | 351 | return 0; |
334 | } | 352 | } |
335 | 353 | ||
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c index bcfd4b743145..9050d06998e6 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | |||
@@ -469,7 +469,9 @@ static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv, | |||
469 | struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso; | 469 | struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso; |
470 | struct mwifiex_adapter *adapter = priv->adapter; | 470 | struct mwifiex_adapter *adapter = priv->adapter; |
471 | 471 | ||
472 | if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) | 472 | if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) { |
473 | priv->tx_ant = le16_to_cpu(ant_mimo->tx_ant_mode); | ||
474 | priv->rx_ant = le16_to_cpu(ant_mimo->rx_ant_mode); | ||
473 | mwifiex_dbg(adapter, INFO, | 475 | mwifiex_dbg(adapter, INFO, |
474 | "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x\t" | 476 | "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x\t" |
475 | "Rx action = 0x%x, Rx Mode = 0x%04x\n", | 477 | "Rx action = 0x%x, Rx Mode = 0x%04x\n", |
@@ -477,12 +479,14 @@ static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv, | |||
477 | le16_to_cpu(ant_mimo->tx_ant_mode), | 479 | le16_to_cpu(ant_mimo->tx_ant_mode), |
478 | le16_to_cpu(ant_mimo->action_rx), | 480 | le16_to_cpu(ant_mimo->action_rx), |
479 | le16_to_cpu(ant_mimo->rx_ant_mode)); | 481 | le16_to_cpu(ant_mimo->rx_ant_mode)); |
480 | else | 482 | } else { |
483 | priv->tx_ant = le16_to_cpu(ant_siso->ant_mode); | ||
484 | priv->rx_ant = le16_to_cpu(ant_siso->ant_mode); | ||
481 | mwifiex_dbg(adapter, INFO, | 485 | mwifiex_dbg(adapter, INFO, |
482 | "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n", | 486 | "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n", |
483 | le16_to_cpu(ant_siso->action), | 487 | le16_to_cpu(ant_siso->action), |
484 | le16_to_cpu(ant_siso->ant_mode)); | 488 | le16_to_cpu(ant_siso->ant_mode)); |
485 | 489 | } | |
486 | return 0; | 490 | return 0; |
487 | } | 491 | } |
488 | 492 | ||
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c index 0cefd40b2762..a422f3306d4d 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c | |||
@@ -474,8 +474,8 @@ void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv, | |||
474 | scantlv = | 474 | scantlv = |
475 | (struct mwifiex_ie_types_btcoex_scan_time *)tlv; | 475 | (struct mwifiex_ie_types_btcoex_scan_time *)tlv; |
476 | adapter->coex_scan = scantlv->coex_scan; | 476 | adapter->coex_scan = scantlv->coex_scan; |
477 | adapter->coex_min_scan_time = scantlv->min_scan_time; | 477 | adapter->coex_min_scan_time = le16_to_cpu(scantlv->min_scan_time); |
478 | adapter->coex_max_scan_time = scantlv->max_scan_time; | 478 | adapter->coex_max_scan_time = le16_to_cpu(scantlv->max_scan_time); |
479 | break; | 479 | break; |
480 | 480 | ||
481 | default: | 481 | default: |
@@ -708,7 +708,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
708 | 708 | ||
709 | case EVENT_EXT_SCAN_REPORT: | 709 | case EVENT_EXT_SCAN_REPORT: |
710 | mwifiex_dbg(adapter, EVENT, "event: EXT_SCAN Report\n"); | 710 | mwifiex_dbg(adapter, EVENT, "event: EXT_SCAN Report\n"); |
711 | if (adapter->ext_scan) | 711 | if (adapter->ext_scan && !priv->scan_aborting) |
712 | ret = mwifiex_handle_event_ext_scan_report(priv, | 712 | ret = mwifiex_handle_event_ext_scan_report(priv, |
713 | adapter->event_skb->data); | 713 | adapter->event_skb->data); |
714 | 714 | ||
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index 8e0862657122..2ba5397272e2 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | |||
@@ -426,6 +426,10 @@ done: | |||
426 | if (bss_desc) | 426 | if (bss_desc) |
427 | kfree(bss_desc->beacon_buf); | 427 | kfree(bss_desc->beacon_buf); |
428 | kfree(bss_desc); | 428 | kfree(bss_desc); |
429 | |||
430 | if (ret < 0) | ||
431 | priv->attempted_bss_desc = NULL; | ||
432 | |||
429 | return ret; | 433 | return ret; |
430 | } | 434 | } |
431 | 435 | ||
diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index f79d00d1e294..a7e9f544f219 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include "main.h" | 20 | #include "main.h" |
21 | #include "11ac.h" | 21 | #include "11ac.h" |
22 | #include "11n.h" | ||
22 | 23 | ||
23 | /* This function parses security related parameters from cfg80211_ap_settings | 24 | /* This function parses security related parameters from cfg80211_ap_settings |
24 | * and sets into FW understandable bss_config structure. | 25 | * and sets into FW understandable bss_config structure. |
@@ -521,9 +522,9 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) | |||
521 | tlv += sizeof(struct host_cmd_tlv_rates) + i; | 522 | tlv += sizeof(struct host_cmd_tlv_rates) + i; |
522 | } | 523 | } |
523 | if (bss_cfg->channel && | 524 | if (bss_cfg->channel && |
524 | ((bss_cfg->band_cfg == BAND_CONFIG_BG && | 525 | (((bss_cfg->band_cfg & BIT(0)) == BAND_CONFIG_BG && |
525 | bss_cfg->channel <= MAX_CHANNEL_BAND_BG) || | 526 | bss_cfg->channel <= MAX_CHANNEL_BAND_BG) || |
526 | (bss_cfg->band_cfg == BAND_CONFIG_A && | 527 | ((bss_cfg->band_cfg & BIT(0)) == BAND_CONFIG_A && |
527 | bss_cfg->channel <= MAX_CHANNEL_BAND_A))) { | 528 | bss_cfg->channel <= MAX_CHANNEL_BAND_A))) { |
528 | chan_band = (struct host_cmd_tlv_channel_band *)tlv; | 529 | chan_band = (struct host_cmd_tlv_channel_band *)tlv; |
529 | chan_band->header.type = cpu_to_le16(TLV_TYPE_CHANNELBANDLIST); | 530 | chan_band->header.type = cpu_to_le16(TLV_TYPE_CHANNELBANDLIST); |
@@ -833,6 +834,31 @@ void mwifiex_uap_set_channel(struct mwifiex_private *priv, | |||
833 | config_bands |= BAND_AAC; | 834 | config_bands |= BAND_AAC; |
834 | } | 835 | } |
835 | 836 | ||
837 | switch (chandef.width) { | ||
838 | case NL80211_CHAN_WIDTH_5: | ||
839 | case NL80211_CHAN_WIDTH_10: | ||
840 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
841 | case NL80211_CHAN_WIDTH_20: | ||
842 | break; | ||
843 | case NL80211_CHAN_WIDTH_40: | ||
844 | if (chandef.center_freq1 < chandef.chan->center_freq) | ||
845 | bss_cfg->band_cfg |= MWIFIEX_SEC_CHAN_BELOW; | ||
846 | else | ||
847 | bss_cfg->band_cfg |= MWIFIEX_SEC_CHAN_ABOVE; | ||
848 | break; | ||
849 | case NL80211_CHAN_WIDTH_80: | ||
850 | case NL80211_CHAN_WIDTH_80P80: | ||
851 | case NL80211_CHAN_WIDTH_160: | ||
852 | bss_cfg->band_cfg |= | ||
853 | mwifiex_get_sec_chan_offset(bss_cfg->channel) << 4; | ||
854 | break; | ||
855 | default: | ||
856 | mwifiex_dbg(priv->adapter, | ||
857 | WARN, "Unknown channel width: %d\n", | ||
858 | chandef.width); | ||
859 | break; | ||
860 | } | ||
861 | |||
836 | priv->adapter->config_bands = config_bands; | 862 | priv->adapter->config_bands = config_bands; |
837 | 863 | ||
838 | if (old_bands != config_bands) { | 864 | if (old_bands != config_bands) { |
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index 870c9cd5cdf3..4341d56805f8 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | |||
@@ -135,7 +135,8 @@ struct rtl8xxxu_rxdesc16 { | |||
135 | 135 | ||
136 | u32 seq:12; | 136 | u32 seq:12; |
137 | u32 frag:4; | 137 | u32 frag:4; |
138 | u32 nextpktlen:14; | 138 | u32 pkt_cnt:8; |
139 | u32 reserved:6; | ||
139 | u32 nextind:1; | 140 | u32 nextind:1; |
140 | u32 reserved0:1; | 141 | u32 reserved0:1; |
141 | 142 | ||
@@ -198,7 +199,8 @@ struct rtl8xxxu_rxdesc16 { | |||
198 | 199 | ||
199 | u32 reserved0:1; | 200 | u32 reserved0:1; |
200 | u32 nextind:1; | 201 | u32 nextind:1; |
201 | u32 nextpktlen:14; | 202 | u32 reserved:6; |
203 | u32 pkt_cnt:8; | ||
202 | u32 frag:4; | 204 | u32 frag:4; |
203 | u32 seq:12; | 205 | u32 seq:12; |
204 | 206 | ||
@@ -1245,6 +1247,7 @@ struct rtl8xxxu_priv { | |||
1245 | u32 ep_tx_normal_queue:1; | 1247 | u32 ep_tx_normal_queue:1; |
1246 | u32 ep_tx_low_queue:1; | 1248 | u32 ep_tx_low_queue:1; |
1247 | u32 has_xtalk:1; | 1249 | u32 has_xtalk:1; |
1250 | u32 rx_buf_aggregation:1; | ||
1248 | u8 xtalk; | 1251 | u8 xtalk; |
1249 | unsigned int pipe_interrupt; | 1252 | unsigned int pipe_interrupt; |
1250 | unsigned int pipe_in; | 1253 | unsigned int pipe_in; |
@@ -1315,8 +1318,7 @@ struct rtl8xxxu_fileops { | |||
1315 | void (*phy_init_antenna_selection) (struct rtl8xxxu_priv *priv); | 1318 | void (*phy_init_antenna_selection) (struct rtl8xxxu_priv *priv); |
1316 | void (*phy_iq_calibrate) (struct rtl8xxxu_priv *priv); | 1319 | void (*phy_iq_calibrate) (struct rtl8xxxu_priv *priv); |
1317 | void (*config_channel) (struct ieee80211_hw *hw); | 1320 | void (*config_channel) (struct ieee80211_hw *hw); |
1318 | int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb, | 1321 | int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb); |
1319 | struct ieee80211_rx_status *rx_status); | ||
1320 | void (*init_aggregation) (struct rtl8xxxu_priv *priv); | 1322 | void (*init_aggregation) (struct rtl8xxxu_priv *priv); |
1321 | void (*init_statistics) (struct rtl8xxxu_priv *priv); | 1323 | void (*init_statistics) (struct rtl8xxxu_priv *priv); |
1322 | void (*enable_rf) (struct rtl8xxxu_priv *priv); | 1324 | void (*enable_rf) (struct rtl8xxxu_priv *priv); |
@@ -1329,6 +1331,7 @@ struct rtl8xxxu_fileops { | |||
1329 | void (*report_connect) (struct rtl8xxxu_priv *priv, | 1331 | void (*report_connect) (struct rtl8xxxu_priv *priv, |
1330 | u8 macid, bool connect); | 1332 | u8 macid, bool connect); |
1331 | int writeN_block_size; | 1333 | int writeN_block_size; |
1334 | int rx_agg_buf_size; | ||
1332 | char tx_desc_size; | 1335 | char tx_desc_size; |
1333 | char rx_desc_size; | 1336 | char rx_desc_size; |
1334 | char has_s0s1; | 1337 | char has_s0s1; |
@@ -1409,13 +1412,12 @@ void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv, | |||
1409 | u8 macid, bool connect); | 1412 | u8 macid, bool connect); |
1410 | void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, | 1413 | void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, |
1411 | u8 macid, bool connect); | 1414 | u8 macid, bool connect); |
1415 | void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv); | ||
1412 | void rtl8xxxu_gen1_enable_rf(struct rtl8xxxu_priv *priv); | 1416 | void rtl8xxxu_gen1_enable_rf(struct rtl8xxxu_priv *priv); |
1413 | void rtl8xxxu_gen1_disable_rf(struct rtl8xxxu_priv *priv); | 1417 | void rtl8xxxu_gen1_disable_rf(struct rtl8xxxu_priv *priv); |
1414 | void rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv); | 1418 | void rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv); |
1415 | int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb, | 1419 | int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb); |
1416 | struct ieee80211_rx_status *rx_status); | 1420 | int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb); |
1417 | int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb, | ||
1418 | struct ieee80211_rx_status *rx_status); | ||
1419 | int rtl8xxxu_gen2_channel_to_group(int channel); | 1421 | int rtl8xxxu_gen2_channel_to_group(int channel); |
1420 | bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, | 1422 | bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, |
1421 | int result[][8], int c1, int c2); | 1423 | int result[][8], int c1, int c2); |
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c index 2c86b5599a30..69d1a1453ede 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | |||
@@ -413,13 +413,8 @@ static int rtl8192cu_parse_efuse(struct rtl8xxxu_priv *priv) | |||
413 | dev_info(&priv->udev->dev, | 413 | dev_info(&priv->udev->dev, |
414 | "%s: dumping efuse (0x%02zx bytes):\n", | 414 | "%s: dumping efuse (0x%02zx bytes):\n", |
415 | __func__, sizeof(struct rtl8192cu_efuse)); | 415 | __func__, sizeof(struct rtl8192cu_efuse)); |
416 | for (i = 0; i < sizeof(struct rtl8192cu_efuse); i += 8) { | 416 | for (i = 0; i < sizeof(struct rtl8192cu_efuse); i += 8) |
417 | dev_info(&priv->udev->dev, "%02x: " | 417 | dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); |
418 | "%02x %02x %02x %02x %02x %02x %02x %02x\n", i, | ||
419 | raw[i], raw[i + 1], raw[i + 2], | ||
420 | raw[i + 3], raw[i + 4], raw[i + 5], | ||
421 | raw[i + 6], raw[i + 7]); | ||
422 | } | ||
423 | } | 418 | } |
424 | return 0; | 419 | return 0; |
425 | } | 420 | } |
@@ -565,6 +560,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = { | |||
565 | .phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate, | 560 | .phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate, |
566 | .config_channel = rtl8xxxu_gen1_config_channel, | 561 | .config_channel = rtl8xxxu_gen1_config_channel, |
567 | .parse_rx_desc = rtl8xxxu_parse_rxdesc16, | 562 | .parse_rx_desc = rtl8xxxu_parse_rxdesc16, |
563 | .init_aggregation = rtl8xxxu_gen1_init_aggregation, | ||
568 | .enable_rf = rtl8xxxu_gen1_enable_rf, | 564 | .enable_rf = rtl8xxxu_gen1_enable_rf, |
569 | .disable_rf = rtl8xxxu_gen1_disable_rf, | 565 | .disable_rf = rtl8xxxu_gen1_disable_rf, |
570 | .usb_quirks = rtl8xxxu_gen1_usb_quirks, | 566 | .usb_quirks = rtl8xxxu_gen1_usb_quirks, |
@@ -572,6 +568,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = { | |||
572 | .update_rate_mask = rtl8xxxu_update_rate_mask, | 568 | .update_rate_mask = rtl8xxxu_update_rate_mask, |
573 | .report_connect = rtl8xxxu_gen1_report_connect, | 569 | .report_connect = rtl8xxxu_gen1_report_connect, |
574 | .writeN_block_size = 128, | 570 | .writeN_block_size = 128, |
571 | .rx_agg_buf_size = 16000, | ||
575 | .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), | 572 | .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), |
576 | .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), | 573 | .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), |
577 | .adda_1t_init = 0x0b1b25a0, | 574 | .adda_1t_init = 0x0b1b25a0, |
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c index b04cf30f3959..9a1994f49b7b 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | |||
@@ -622,13 +622,8 @@ static int rtl8192eu_parse_efuse(struct rtl8xxxu_priv *priv) | |||
622 | dev_info(&priv->udev->dev, | 622 | dev_info(&priv->udev->dev, |
623 | "%s: dumping efuse (0x%02zx bytes):\n", | 623 | "%s: dumping efuse (0x%02zx bytes):\n", |
624 | __func__, sizeof(struct rtl8192eu_efuse)); | 624 | __func__, sizeof(struct rtl8192eu_efuse)); |
625 | for (i = 0; i < sizeof(struct rtl8192eu_efuse); i += 8) { | 625 | for (i = 0; i < sizeof(struct rtl8192eu_efuse); i += 8) |
626 | dev_info(&priv->udev->dev, "%02x: " | 626 | dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); |
627 | "%02x %02x %02x %02x %02x %02x %02x %02x\n", i, | ||
628 | raw[i], raw[i + 1], raw[i + 2], | ||
629 | raw[i + 3], raw[i + 4], raw[i + 5], | ||
630 | raw[i + 6], raw[i + 7]); | ||
631 | } | ||
632 | } | 627 | } |
633 | return 0; | 628 | return 0; |
634 | } | 629 | } |
@@ -1249,11 +1244,9 @@ static void rtl8192eu_phy_iq_calibrate(struct rtl8xxxu_priv *priv) | |||
1249 | reg_e94 = result[i][0]; | 1244 | reg_e94 = result[i][0]; |
1250 | reg_e9c = result[i][1]; | 1245 | reg_e9c = result[i][1]; |
1251 | reg_ea4 = result[i][2]; | 1246 | reg_ea4 = result[i][2]; |
1252 | reg_eac = result[i][3]; | ||
1253 | reg_eb4 = result[i][4]; | 1247 | reg_eb4 = result[i][4]; |
1254 | reg_ebc = result[i][5]; | 1248 | reg_ebc = result[i][5]; |
1255 | reg_ec4 = result[i][6]; | 1249 | reg_ec4 = result[i][6]; |
1256 | reg_ecc = result[i][7]; | ||
1257 | } | 1250 | } |
1258 | 1251 | ||
1259 | if (candidate >= 0) { | 1252 | if (candidate >= 0) { |
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c index a8e172ceab89..686c551581b1 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | |||
@@ -377,6 +377,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = { | |||
377 | .phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate, | 377 | .phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate, |
378 | .config_channel = rtl8xxxu_gen1_config_channel, | 378 | .config_channel = rtl8xxxu_gen1_config_channel, |
379 | .parse_rx_desc = rtl8xxxu_parse_rxdesc16, | 379 | .parse_rx_desc = rtl8xxxu_parse_rxdesc16, |
380 | .init_aggregation = rtl8xxxu_gen1_init_aggregation, | ||
380 | .enable_rf = rtl8xxxu_gen1_enable_rf, | 381 | .enable_rf = rtl8xxxu_gen1_enable_rf, |
381 | .disable_rf = rtl8xxxu_gen1_disable_rf, | 382 | .disable_rf = rtl8xxxu_gen1_disable_rf, |
382 | .usb_quirks = rtl8xxxu_gen1_usb_quirks, | 383 | .usb_quirks = rtl8xxxu_gen1_usb_quirks, |
@@ -384,6 +385,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = { | |||
384 | .update_rate_mask = rtl8xxxu_update_rate_mask, | 385 | .update_rate_mask = rtl8xxxu_update_rate_mask, |
385 | .report_connect = rtl8xxxu_gen1_report_connect, | 386 | .report_connect = rtl8xxxu_gen1_report_connect, |
386 | .writeN_block_size = 1024, | 387 | .writeN_block_size = 1024, |
388 | .rx_agg_buf_size = 16000, | ||
387 | .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), | 389 | .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), |
388 | .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), | 390 | .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), |
389 | .adda_1t_init = 0x0b1b25a0, | 391 | .adda_1t_init = 0x0b1b25a0, |
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c index 4186e7cf0ddf..9d45afb0e3fd 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | |||
@@ -466,13 +466,8 @@ static int rtl8723bu_parse_efuse(struct rtl8xxxu_priv *priv) | |||
466 | dev_info(&priv->udev->dev, | 466 | dev_info(&priv->udev->dev, |
467 | "%s: dumping efuse (0x%02zx bytes):\n", | 467 | "%s: dumping efuse (0x%02zx bytes):\n", |
468 | __func__, sizeof(struct rtl8723bu_efuse)); | 468 | __func__, sizeof(struct rtl8723bu_efuse)); |
469 | for (i = 0; i < sizeof(struct rtl8723bu_efuse); i += 8) { | 469 | for (i = 0; i < sizeof(struct rtl8723bu_efuse); i += 8) |
470 | dev_info(&priv->udev->dev, "%02x: " | 470 | dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); |
471 | "%02x %02x %02x %02x %02x %02x %02x %02x\n", i, | ||
472 | raw[i], raw[i + 1], raw[i + 2], | ||
473 | raw[i + 3], raw[i + 4], raw[i + 5], | ||
474 | raw[i + 6], raw[i + 7]); | ||
475 | } | ||
476 | } | 471 | } |
477 | 472 | ||
478 | return 0; | 473 | return 0; |
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 9f6dbb4490a9..77048db3b32a 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | |||
@@ -44,6 +44,9 @@ | |||
44 | 44 | ||
45 | int rtl8xxxu_debug = RTL8XXXU_DEBUG_EFUSE; | 45 | int rtl8xxxu_debug = RTL8XXXU_DEBUG_EFUSE; |
46 | static bool rtl8xxxu_ht40_2g; | 46 | static bool rtl8xxxu_ht40_2g; |
47 | static bool rtl8xxxu_dma_aggregation; | ||
48 | static int rtl8xxxu_dma_agg_timeout = -1; | ||
49 | static int rtl8xxxu_dma_agg_pages = -1; | ||
47 | 50 | ||
48 | MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@redhat.com>"); | 51 | MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@redhat.com>"); |
49 | MODULE_DESCRIPTION("RTL8XXXu USB mac80211 Wireless LAN Driver"); | 52 | MODULE_DESCRIPTION("RTL8XXXu USB mac80211 Wireless LAN Driver"); |
@@ -62,10 +65,14 @@ module_param_named(debug, rtl8xxxu_debug, int, 0600); | |||
62 | MODULE_PARM_DESC(debug, "Set debug mask"); | 65 | MODULE_PARM_DESC(debug, "Set debug mask"); |
63 | module_param_named(ht40_2g, rtl8xxxu_ht40_2g, bool, 0600); | 66 | module_param_named(ht40_2g, rtl8xxxu_ht40_2g, bool, 0600); |
64 | MODULE_PARM_DESC(ht40_2g, "Enable HT40 support on the 2.4GHz band"); | 67 | MODULE_PARM_DESC(ht40_2g, "Enable HT40 support on the 2.4GHz band"); |
68 | module_param_named(dma_aggregation, rtl8xxxu_dma_aggregation, bool, 0600); | ||
69 | MODULE_PARM_DESC(dma_aggregation, "Enable DMA packet aggregation"); | ||
70 | module_param_named(dma_agg_timeout, rtl8xxxu_dma_agg_timeout, int, 0600); | ||
71 | MODULE_PARM_DESC(dma_agg_timeout, "Set DMA aggregation timeout (range 1-127)"); | ||
72 | module_param_named(dma_agg_pages, rtl8xxxu_dma_agg_pages, int, 0600); | ||
73 | MODULE_PARM_DESC(dma_agg_pages, "Set DMA aggregation pages (range 1-127, 0 to disable)"); | ||
65 | 74 | ||
66 | #define USB_VENDOR_ID_REALTEK 0x0bda | 75 | #define USB_VENDOR_ID_REALTEK 0x0bda |
67 | /* Minimum IEEE80211_MAX_FRAME_LEN */ | ||
68 | #define RTL_RX_BUFFER_SIZE IEEE80211_MAX_FRAME_LEN | ||
69 | #define RTL8XXXU_RX_URBS 32 | 76 | #define RTL8XXXU_RX_URBS 32 |
70 | #define RTL8XXXU_RX_URB_PENDING_WATER 8 | 77 | #define RTL8XXXU_RX_URB_PENDING_WATER 8 |
71 | #define RTL8XXXU_TX_URBS 64 | 78 | #define RTL8XXXU_TX_URBS 64 |
@@ -4407,6 +4414,73 @@ void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, | |||
4407 | rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.media_status_rpt)); | 4414 | rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.media_status_rpt)); |
4408 | } | 4415 | } |
4409 | 4416 | ||
4417 | void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv) | ||
4418 | { | ||
4419 | u8 agg_ctrl, usb_spec, page_thresh, timeout; | ||
4420 | |||
4421 | usb_spec = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); | ||
4422 | usb_spec &= ~USB_SPEC_USB_AGG_ENABLE; | ||
4423 | rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, usb_spec); | ||
4424 | |||
4425 | agg_ctrl = rtl8xxxu_read8(priv, REG_TRXDMA_CTRL); | ||
4426 | agg_ctrl &= ~TRXDMA_CTRL_RXDMA_AGG_EN; | ||
4427 | |||
4428 | if (!rtl8xxxu_dma_aggregation) { | ||
4429 | rtl8xxxu_write8(priv, REG_TRXDMA_CTRL, agg_ctrl); | ||
4430 | return; | ||
4431 | } | ||
4432 | |||
4433 | agg_ctrl |= TRXDMA_CTRL_RXDMA_AGG_EN; | ||
4434 | rtl8xxxu_write8(priv, REG_TRXDMA_CTRL, agg_ctrl); | ||
4435 | |||
4436 | /* | ||
4437 | * The number of packets we can take looks to be buffer size / 512 | ||
4438 | * which matches the 512 byte rounding we have to do when de-muxing | ||
4439 | * the packets. | ||
4440 | * | ||
4441 | * Sample numbers from the vendor driver: | ||
4442 | * USB High-Speed mode values: | ||
4443 | * RxAggBlockCount = 8 : 512 byte unit | ||
4444 | * RxAggBlockTimeout = 6 | ||
4445 | * RxAggPageCount = 48 : 128 byte unit | ||
4446 | * RxAggPageTimeout = 4 or 6 (absolute time 34ms/(2^6)) | ||
4447 | */ | ||
4448 | |||
4449 | page_thresh = (priv->fops->rx_agg_buf_size / 512); | ||
4450 | if (rtl8xxxu_dma_agg_pages >= 0) { | ||
4451 | if (rtl8xxxu_dma_agg_pages <= page_thresh) | ||
4452 | timeout = page_thresh; | ||
4453 | else if (rtl8xxxu_dma_agg_pages <= 6) | ||
4454 | dev_err(&priv->udev->dev, | ||
4455 | "%s: dma_agg_pages=%i too small, minium is 6\n", | ||
4456 | __func__, rtl8xxxu_dma_agg_pages); | ||
4457 | else | ||
4458 | dev_err(&priv->udev->dev, | ||
4459 | "%s: dma_agg_pages=%i larger than limit %i\n", | ||
4460 | __func__, rtl8xxxu_dma_agg_pages, page_thresh); | ||
4461 | } | ||
4462 | rtl8xxxu_write8(priv, REG_RXDMA_AGG_PG_TH, page_thresh); | ||
4463 | /* | ||
4464 | * REG_RXDMA_AGG_PG_TH + 1 seems to be the timeout register on | ||
4465 | * gen2 chips and rtl8188eu. The rtl8723au seems unhappy if we | ||
4466 | * don't set it, so better set both. | ||
4467 | */ | ||
4468 | timeout = 4; | ||
4469 | |||
4470 | if (rtl8xxxu_dma_agg_timeout >= 0) { | ||
4471 | if (rtl8xxxu_dma_agg_timeout <= 127) | ||
4472 | timeout = rtl8xxxu_dma_agg_timeout; | ||
4473 | else | ||
4474 | dev_err(&priv->udev->dev, | ||
4475 | "%s: Invalid dma_agg_timeout: %i\n", | ||
4476 | __func__, rtl8xxxu_dma_agg_timeout); | ||
4477 | } | ||
4478 | |||
4479 | rtl8xxxu_write8(priv, REG_RXDMA_AGG_PG_TH + 1, timeout); | ||
4480 | rtl8xxxu_write8(priv, REG_USB_DMA_AGG_TO, timeout); | ||
4481 | priv->rx_buf_aggregation = 1; | ||
4482 | } | ||
4483 | |||
4410 | static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg) | 4484 | static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg) |
4411 | { | 4485 | { |
4412 | u32 val32; | 4486 | u32 val32; |
@@ -5045,55 +5119,143 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work) | |||
5045 | } | 5119 | } |
5046 | } | 5120 | } |
5047 | 5121 | ||
5048 | int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb, | 5122 | static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv, |
5049 | struct ieee80211_rx_status *rx_status) | 5123 | struct sk_buff *skb) |
5124 | { | ||
5125 | struct rtl8723bu_c2h *c2h = (struct rtl8723bu_c2h *)skb->data; | ||
5126 | struct device *dev = &priv->udev->dev; | ||
5127 | int len; | ||
5128 | |||
5129 | len = skb->len - 2; | ||
5130 | |||
5131 | dev_dbg(dev, "C2H ID %02x seq %02x, len %02x source %02x\n", | ||
5132 | c2h->id, c2h->seq, len, c2h->bt_info.response_source); | ||
5133 | |||
5134 | switch(c2h->id) { | ||
5135 | case C2H_8723B_BT_INFO: | ||
5136 | if (c2h->bt_info.response_source > | ||
5137 | BT_INFO_SRC_8723B_BT_ACTIVE_SEND) | ||
5138 | dev_dbg(dev, "C2H_BT_INFO WiFi only firmware\n"); | ||
5139 | else | ||
5140 | dev_dbg(dev, "C2H_BT_INFO BT/WiFi coexist firmware\n"); | ||
5141 | |||
5142 | if (c2h->bt_info.bt_has_reset) | ||
5143 | dev_dbg(dev, "BT has been reset\n"); | ||
5144 | if (c2h->bt_info.tx_rx_mask) | ||
5145 | dev_dbg(dev, "BT TRx mask\n"); | ||
5146 | |||
5147 | break; | ||
5148 | case C2H_8723B_BT_MP_INFO: | ||
5149 | dev_dbg(dev, "C2H_MP_INFO ext ID %02x, status %02x\n", | ||
5150 | c2h->bt_mp_info.ext_id, c2h->bt_mp_info.status); | ||
5151 | break; | ||
5152 | case C2H_8723B_RA_REPORT: | ||
5153 | dev_dbg(dev, | ||
5154 | "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n", | ||
5155 | c2h->ra_report.rate, c2h->ra_report.dummy0_0, | ||
5156 | c2h->ra_report.macid, c2h->ra_report.noisy_state); | ||
5157 | break; | ||
5158 | default: | ||
5159 | dev_info(dev, "Unhandled C2H event %02x seq %02x\n", | ||
5160 | c2h->id, c2h->seq); | ||
5161 | print_hex_dump(KERN_INFO, "C2H content: ", DUMP_PREFIX_NONE, | ||
5162 | 16, 1, c2h->raw.payload, len, false); | ||
5163 | break; | ||
5164 | } | ||
5165 | } | ||
5166 | |||
5167 | int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb) | ||
5050 | { | 5168 | { |
5051 | struct rtl8xxxu_rxdesc16 *rx_desc = | 5169 | struct ieee80211_hw *hw = priv->hw; |
5052 | (struct rtl8xxxu_rxdesc16 *)skb->data; | 5170 | struct ieee80211_rx_status *rx_status; |
5171 | struct rtl8xxxu_rxdesc16 *rx_desc; | ||
5053 | struct rtl8723au_phy_stats *phy_stats; | 5172 | struct rtl8723au_phy_stats *phy_stats; |
5054 | __le32 *_rx_desc_le = (__le32 *)skb->data; | 5173 | struct sk_buff *next_skb = NULL; |
5055 | u32 *_rx_desc = (u32 *)skb->data; | 5174 | __le32 *_rx_desc_le; |
5175 | u32 *_rx_desc; | ||
5056 | int drvinfo_sz, desc_shift; | 5176 | int drvinfo_sz, desc_shift; |
5057 | int i; | 5177 | int i, pkt_cnt, pkt_len, urb_len, pkt_offset; |
5058 | 5178 | ||
5059 | for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc16) / sizeof(u32)); i++) | 5179 | urb_len = skb->len; |
5060 | _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); | 5180 | pkt_cnt = 0; |
5061 | 5181 | ||
5062 | skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc16)); | 5182 | do { |
5183 | rx_desc = (struct rtl8xxxu_rxdesc16 *)skb->data; | ||
5184 | _rx_desc_le = (__le32 *)skb->data; | ||
5185 | _rx_desc = (u32 *)skb->data; | ||
5063 | 5186 | ||
5064 | phy_stats = (struct rtl8723au_phy_stats *)skb->data; | 5187 | for (i = 0; |
5188 | i < (sizeof(struct rtl8xxxu_rxdesc16) / sizeof(u32)); i++) | ||
5189 | _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); | ||
5065 | 5190 | ||
5066 | drvinfo_sz = rx_desc->drvinfo_sz * 8; | 5191 | /* |
5067 | desc_shift = rx_desc->shift; | 5192 | * Only read pkt_cnt from the header if we're parsing the |
5068 | skb_pull(skb, drvinfo_sz + desc_shift); | 5193 | * first packet |
5194 | */ | ||
5195 | if (!pkt_cnt) | ||
5196 | pkt_cnt = rx_desc->pkt_cnt; | ||
5197 | pkt_len = rx_desc->pktlen; | ||
5069 | 5198 | ||
5070 | if (rx_desc->phy_stats) | 5199 | drvinfo_sz = rx_desc->drvinfo_sz * 8; |
5071 | rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, | 5200 | desc_shift = rx_desc->shift; |
5072 | rx_desc->rxmcs); | 5201 | pkt_offset = roundup(pkt_len + drvinfo_sz + desc_shift + |
5202 | sizeof(struct rtl8xxxu_rxdesc16), 128); | ||
5073 | 5203 | ||
5074 | rx_status->mactime = le32_to_cpu(rx_desc->tsfl); | 5204 | if (pkt_cnt > 1) |
5075 | rx_status->flag |= RX_FLAG_MACTIME_START; | 5205 | next_skb = skb_clone(skb, GFP_ATOMIC); |
5076 | 5206 | ||
5077 | if (!rx_desc->swdec) | 5207 | rx_status = IEEE80211_SKB_RXCB(skb); |
5078 | rx_status->flag |= RX_FLAG_DECRYPTED; | 5208 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); |
5079 | if (rx_desc->crc32) | ||
5080 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; | ||
5081 | if (rx_desc->bw) | ||
5082 | rx_status->flag |= RX_FLAG_40MHZ; | ||
5083 | 5209 | ||
5084 | if (rx_desc->rxht) { | 5210 | skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc16)); |
5085 | rx_status->flag |= RX_FLAG_HT; | 5211 | |
5086 | rx_status->rate_idx = rx_desc->rxmcs - DESC_RATE_MCS0; | 5212 | phy_stats = (struct rtl8723au_phy_stats *)skb->data; |
5087 | } else { | 5213 | |
5088 | rx_status->rate_idx = rx_desc->rxmcs; | 5214 | skb_pull(skb, drvinfo_sz + desc_shift); |
5089 | } | 5215 | |
5216 | skb_trim(skb, pkt_len); | ||
5217 | |||
5218 | if (rx_desc->phy_stats) | ||
5219 | rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, | ||
5220 | rx_desc->rxmcs); | ||
5221 | |||
5222 | rx_status->mactime = le32_to_cpu(rx_desc->tsfl); | ||
5223 | rx_status->flag |= RX_FLAG_MACTIME_START; | ||
5224 | |||
5225 | if (!rx_desc->swdec) | ||
5226 | rx_status->flag |= RX_FLAG_DECRYPTED; | ||
5227 | if (rx_desc->crc32) | ||
5228 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; | ||
5229 | if (rx_desc->bw) | ||
5230 | rx_status->flag |= RX_FLAG_40MHZ; | ||
5231 | |||
5232 | if (rx_desc->rxht) { | ||
5233 | rx_status->flag |= RX_FLAG_HT; | ||
5234 | rx_status->rate_idx = rx_desc->rxmcs - DESC_RATE_MCS0; | ||
5235 | } else { | ||
5236 | rx_status->rate_idx = rx_desc->rxmcs; | ||
5237 | } | ||
5238 | |||
5239 | rx_status->freq = hw->conf.chandef.chan->center_freq; | ||
5240 | rx_status->band = hw->conf.chandef.chan->band; | ||
5241 | |||
5242 | ieee80211_rx_irqsafe(hw, skb); | ||
5243 | |||
5244 | skb = next_skb; | ||
5245 | if (skb) | ||
5246 | skb_pull(next_skb, pkt_offset); | ||
5247 | |||
5248 | pkt_cnt--; | ||
5249 | urb_len -= pkt_offset; | ||
5250 | } while (skb && urb_len > 0 && pkt_cnt > 0); | ||
5090 | 5251 | ||
5091 | return RX_TYPE_DATA_PKT; | 5252 | return RX_TYPE_DATA_PKT; |
5092 | } | 5253 | } |
5093 | 5254 | ||
5094 | int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb, | 5255 | int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb) |
5095 | struct ieee80211_rx_status *rx_status) | ||
5096 | { | 5256 | { |
5257 | struct ieee80211_hw *hw = priv->hw; | ||
5258 | struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); | ||
5097 | struct rtl8xxxu_rxdesc24 *rx_desc = | 5259 | struct rtl8xxxu_rxdesc24 *rx_desc = |
5098 | (struct rtl8xxxu_rxdesc24 *)skb->data; | 5260 | (struct rtl8xxxu_rxdesc24 *)skb->data; |
5099 | struct rtl8723au_phy_stats *phy_stats; | 5261 | struct rtl8723au_phy_stats *phy_stats; |
@@ -5105,6 +5267,8 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb, | |||
5105 | for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc24) / sizeof(u32)); i++) | 5267 | for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc24) / sizeof(u32)); i++) |
5106 | _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); | 5268 | _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); |
5107 | 5269 | ||
5270 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); | ||
5271 | |||
5108 | skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc24)); | 5272 | skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc24)); |
5109 | 5273 | ||
5110 | phy_stats = (struct rtl8723au_phy_stats *)skb->data; | 5274 | phy_stats = (struct rtl8723au_phy_stats *)skb->data; |
@@ -5116,6 +5280,8 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb, | |||
5116 | if (rx_desc->rpt_sel) { | 5280 | if (rx_desc->rpt_sel) { |
5117 | struct device *dev = &priv->udev->dev; | 5281 | struct device *dev = &priv->udev->dev; |
5118 | dev_dbg(dev, "%s: C2H packet\n", __func__); | 5282 | dev_dbg(dev, "%s: C2H packet\n", __func__); |
5283 | rtl8723bu_handle_c2h(priv, skb); | ||
5284 | dev_kfree_skb(skb); | ||
5119 | return RX_TYPE_C2H; | 5285 | return RX_TYPE_C2H; |
5120 | } | 5286 | } |
5121 | 5287 | ||
@@ -5140,52 +5306,11 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb, | |||
5140 | rx_status->rate_idx = rx_desc->rxmcs; | 5306 | rx_status->rate_idx = rx_desc->rxmcs; |
5141 | } | 5307 | } |
5142 | 5308 | ||
5143 | return RX_TYPE_DATA_PKT; | 5309 | rx_status->freq = hw->conf.chandef.chan->center_freq; |
5144 | } | 5310 | rx_status->band = hw->conf.chandef.chan->band; |
5145 | |||
5146 | static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv, | ||
5147 | struct sk_buff *skb) | ||
5148 | { | ||
5149 | struct rtl8723bu_c2h *c2h = (struct rtl8723bu_c2h *)skb->data; | ||
5150 | struct device *dev = &priv->udev->dev; | ||
5151 | int len; | ||
5152 | |||
5153 | len = skb->len - 2; | ||
5154 | |||
5155 | dev_dbg(dev, "C2H ID %02x seq %02x, len %02x source %02x\n", | ||
5156 | c2h->id, c2h->seq, len, c2h->bt_info.response_source); | ||
5157 | |||
5158 | switch(c2h->id) { | ||
5159 | case C2H_8723B_BT_INFO: | ||
5160 | if (c2h->bt_info.response_source > | ||
5161 | BT_INFO_SRC_8723B_BT_ACTIVE_SEND) | ||
5162 | dev_dbg(dev, "C2H_BT_INFO WiFi only firmware\n"); | ||
5163 | else | ||
5164 | dev_dbg(dev, "C2H_BT_INFO BT/WiFi coexist firmware\n"); | ||
5165 | |||
5166 | if (c2h->bt_info.bt_has_reset) | ||
5167 | dev_dbg(dev, "BT has been reset\n"); | ||
5168 | if (c2h->bt_info.tx_rx_mask) | ||
5169 | dev_dbg(dev, "BT TRx mask\n"); | ||
5170 | 5311 | ||
5171 | break; | 5312 | ieee80211_rx_irqsafe(hw, skb); |
5172 | case C2H_8723B_BT_MP_INFO: | 5313 | return RX_TYPE_DATA_PKT; |
5173 | dev_dbg(dev, "C2H_MP_INFO ext ID %02x, status %02x\n", | ||
5174 | c2h->bt_mp_info.ext_id, c2h->bt_mp_info.status); | ||
5175 | break; | ||
5176 | case C2H_8723B_RA_REPORT: | ||
5177 | dev_dbg(dev, | ||
5178 | "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n", | ||
5179 | c2h->ra_report.rate, c2h->ra_report.dummy0_0, | ||
5180 | c2h->ra_report.macid, c2h->ra_report.noisy_state); | ||
5181 | break; | ||
5182 | default: | ||
5183 | dev_info(dev, "Unhandled C2H event %02x seq %02x\n", | ||
5184 | c2h->id, c2h->seq); | ||
5185 | print_hex_dump(KERN_INFO, "C2H content: ", DUMP_PREFIX_NONE, | ||
5186 | 16, 1, c2h->raw.payload, len, false); | ||
5187 | break; | ||
5188 | } | ||
5189 | } | 5314 | } |
5190 | 5315 | ||
5191 | static void rtl8xxxu_rx_complete(struct urb *urb) | 5316 | static void rtl8xxxu_rx_complete(struct urb *urb) |
@@ -5195,26 +5320,12 @@ static void rtl8xxxu_rx_complete(struct urb *urb) | |||
5195 | struct ieee80211_hw *hw = rx_urb->hw; | 5320 | struct ieee80211_hw *hw = rx_urb->hw; |
5196 | struct rtl8xxxu_priv *priv = hw->priv; | 5321 | struct rtl8xxxu_priv *priv = hw->priv; |
5197 | struct sk_buff *skb = (struct sk_buff *)urb->context; | 5322 | struct sk_buff *skb = (struct sk_buff *)urb->context; |
5198 | struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); | ||
5199 | struct device *dev = &priv->udev->dev; | 5323 | struct device *dev = &priv->udev->dev; |
5200 | int rx_type; | ||
5201 | 5324 | ||
5202 | skb_put(skb, urb->actual_length); | 5325 | skb_put(skb, urb->actual_length); |
5203 | 5326 | ||
5204 | if (urb->status == 0) { | 5327 | if (urb->status == 0) { |
5205 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); | 5328 | priv->fops->parse_rx_desc(priv, skb); |
5206 | |||
5207 | rx_type = priv->fops->parse_rx_desc(priv, skb, rx_status); | ||
5208 | |||
5209 | rx_status->freq = hw->conf.chandef.chan->center_freq; | ||
5210 | rx_status->band = hw->conf.chandef.chan->band; | ||
5211 | |||
5212 | if (rx_type == RX_TYPE_DATA_PKT) | ||
5213 | ieee80211_rx_irqsafe(hw, skb); | ||
5214 | else { | ||
5215 | rtl8723bu_handle_c2h(priv, skb); | ||
5216 | dev_kfree_skb(skb); | ||
5217 | } | ||
5218 | 5329 | ||
5219 | skb = NULL; | 5330 | skb = NULL; |
5220 | rx_urb->urb.context = NULL; | 5331 | rx_urb->urb.context = NULL; |
@@ -5234,12 +5345,20 @@ cleanup: | |||
5234 | static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv, | 5345 | static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv, |
5235 | struct rtl8xxxu_rx_urb *rx_urb) | 5346 | struct rtl8xxxu_rx_urb *rx_urb) |
5236 | { | 5347 | { |
5348 | struct rtl8xxxu_fileops *fops = priv->fops; | ||
5237 | struct sk_buff *skb; | 5349 | struct sk_buff *skb; |
5238 | int skb_size; | 5350 | int skb_size; |
5239 | int ret, rx_desc_sz; | 5351 | int ret, rx_desc_sz; |
5240 | 5352 | ||
5241 | rx_desc_sz = priv->fops->rx_desc_size; | 5353 | rx_desc_sz = fops->rx_desc_size; |
5242 | skb_size = rx_desc_sz + RTL_RX_BUFFER_SIZE; | 5354 | |
5355 | if (priv->rx_buf_aggregation && fops->rx_agg_buf_size) { | ||
5356 | skb_size = fops->rx_agg_buf_size; | ||
5357 | skb_size += (rx_desc_sz + sizeof(struct rtl8723au_phy_stats)); | ||
5358 | } else { | ||
5359 | skb_size = IEEE80211_MAX_FRAME_LEN; | ||
5360 | } | ||
5361 | |||
5243 | skb = __netdev_alloc_skb(NULL, skb_size, GFP_KERNEL); | 5362 | skb = __netdev_alloc_skb(NULL, skb_size, GFP_KERNEL); |
5244 | if (!skb) | 5363 | if (!skb) |
5245 | return -ENOMEM; | 5364 | return -ENOMEM; |
@@ -5267,7 +5386,7 @@ static void rtl8xxxu_int_complete(struct urb *urb) | |||
5267 | if (ret) | 5386 | if (ret) |
5268 | usb_unanchor_urb(urb); | 5387 | usb_unanchor_urb(urb); |
5269 | } else { | 5388 | } else { |
5270 | dev_info(dev, "%s: Error %i\n", __func__, urb->status); | 5389 | dev_dbg(dev, "%s: Error %i\n", __func__, urb->status); |
5271 | } | 5390 | } |
5272 | } | 5391 | } |
5273 | 5392 | ||
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h index b0e0c642302c..921c5653fff2 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | |||
@@ -405,7 +405,11 @@ | |||
405 | #define REG_DWBCN1_CTRL_8723B 0x0228 | 405 | #define REG_DWBCN1_CTRL_8723B 0x0228 |
406 | 406 | ||
407 | /* 0x0280 ~ 0x02FF RXDMA Configuration */ | 407 | /* 0x0280 ~ 0x02FF RXDMA Configuration */ |
408 | #define REG_RXDMA_AGG_PG_TH 0x0280 | 408 | #define REG_RXDMA_AGG_PG_TH 0x0280 /* 0-7 : USB DMA size bits |
409 | 8-14: USB DMA timeout | ||
410 | 15 : Aggregation enable | ||
411 | Only seems to be used | ||
412 | on 8723bu/8192eu */ | ||
409 | #define RXDMA_USB_AGG_ENABLE BIT(31) | 413 | #define RXDMA_USB_AGG_ENABLE BIT(31) |
410 | #define REG_RXPKT_NUM 0x0284 | 414 | #define REG_RXPKT_NUM 0x0284 |
411 | #define RXPKT_NUM_RXDMA_IDLE BIT(17) | 415 | #define RXPKT_NUM_RXDMA_IDLE BIT(17) |
@@ -1052,10 +1056,14 @@ | |||
1052 | #define USB_HIMR_ROK BIT(0) /* Receive DMA OK Interrupt */ | 1056 | #define USB_HIMR_ROK BIT(0) /* Receive DMA OK Interrupt */ |
1053 | 1057 | ||
1054 | #define REG_USB_SPECIAL_OPTION 0xfe55 | 1058 | #define REG_USB_SPECIAL_OPTION 0xfe55 |
1059 | #define USB_SPEC_USB_AGG_ENABLE BIT(3) /* Enable USB aggregation */ | ||
1060 | #define USB_SPEC_INT_BULK_SELECT BIT(4) /* Use interrupt endpoint to | ||
1061 | deliver interrupt packet. | ||
1062 | 0: Use int, 1: use bulk */ | ||
1055 | #define REG_USB_HRPWM 0xfe58 | 1063 | #define REG_USB_HRPWM 0xfe58 |
1056 | #define REG_USB_DMA_AGG_TO 0xfe5b | 1064 | #define REG_USB_DMA_AGG_TO 0xfe5b |
1057 | #define REG_USB_AGG_TO 0xfe5c | 1065 | #define REG_USB_AGG_TIMEOUT 0xfe5c |
1058 | #define REG_USB_AGG_TH 0xfe5d | 1066 | #define REG_USB_AGG_THRESH 0xfe5d |
1059 | 1067 | ||
1060 | #define REG_NORMAL_SIE_VID 0xfe60 /* 0xfe60 - 0xfe61 */ | 1068 | #define REG_NORMAL_SIE_VID 0xfe60 /* 0xfe60 - 0xfe61 */ |
1061 | #define REG_NORMAL_SIE_PID 0xfe62 /* 0xfe62 - 0xfe63 */ | 1069 | #define REG_NORMAL_SIE_PID 0xfe62 /* 0xfe62 - 0xfe63 */ |
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c index b660c214dc71..91cc1397b150 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | |||
@@ -901,7 +901,7 @@ void exhalbtc_stack_update_profile_info(void) | |||
901 | { | 901 | { |
902 | } | 902 | } |
903 | 903 | ||
904 | void exhalbtc_update_min_bt_rssi(char bt_rssi) | 904 | void exhalbtc_update_min_bt_rssi(s8 bt_rssi) |
905 | { | 905 | { |
906 | struct btc_coexist *btcoexist = &gl_bt_coexist; | 906 | struct btc_coexist *btcoexist = &gl_bt_coexist; |
907 | 907 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h index 3cbe34c535ec..3d308ebbe048 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h | |||
@@ -433,7 +433,7 @@ struct btc_stack_info { | |||
433 | u8 num_of_hid; | 433 | u8 num_of_hid; |
434 | bool pan_exist; | 434 | bool pan_exist; |
435 | bool unknown_acl_exist; | 435 | bool unknown_acl_exist; |
436 | char min_bt_rssi; | 436 | s8 min_bt_rssi; |
437 | }; | 437 | }; |
438 | 438 | ||
439 | struct btc_statistics { | 439 | struct btc_statistics { |
@@ -537,7 +537,7 @@ void exhalbtc_dbg_control(struct btc_coexist *btcoexist, u8 code, u8 len, | |||
537 | void exhalbtc_stack_update_profile_info(void); | 537 | void exhalbtc_stack_update_profile_info(void); |
538 | void exhalbtc_set_hci_version(u16 hci_version); | 538 | void exhalbtc_set_hci_version(u16 hci_version); |
539 | void exhalbtc_set_bt_patch_version(u16 bt_hci_version, u16 bt_patch_version); | 539 | void exhalbtc_set_bt_patch_version(u16 bt_hci_version, u16 bt_patch_version); |
540 | void exhalbtc_update_min_bt_rssi(char bt_rssi); | 540 | void exhalbtc_update_min_bt_rssi(s8 bt_rssi); |
541 | void exhalbtc_set_bt_exist(bool bt_exist); | 541 | void exhalbtc_set_bt_exist(bool bt_exist); |
542 | void exhalbtc_set_chip_type(u8 chip_type); | 542 | void exhalbtc_set_chip_type(u8 chip_type); |
543 | void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num); | 543 | void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 3a0faa8fe9d4..41f77f8a309e 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c | |||
@@ -526,7 +526,7 @@ static void _rtl_add_wowlan_patterns(struct ieee80211_hw *hw, | |||
526 | /* 3. calculate crc */ | 526 | /* 3. calculate crc */ |
527 | rtl_pattern.crc = _calculate_wol_pattern_crc(content, len); | 527 | rtl_pattern.crc = _calculate_wol_pattern_crc(content, len); |
528 | RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, | 528 | RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, |
529 | "CRC_Remainder = 0x%x", rtl_pattern.crc); | 529 | "CRC_Remainder = 0x%x\n", rtl_pattern.crc); |
530 | 530 | ||
531 | /* 4. write crc & mask_for_hw to hw */ | 531 | /* 4. write crc & mask_for_hw to hw */ |
532 | rtlpriv->cfg->ops->add_wowlan_pattern(hw, &rtl_pattern, i); | 532 | rtlpriv->cfg->ops->add_wowlan_pattern(hw, &rtl_pattern, i); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.c b/drivers/net/wireless/realtek/rtlwifi/debug.c index fd25abad2b9e..33905bbacad2 100644 --- a/drivers/net/wireless/realtek/rtlwifi/debug.c +++ b/drivers/net/wireless/realtek/rtlwifi/debug.c | |||
@@ -48,3 +48,28 @@ void rtl_dbgp_flag_init(struct ieee80211_hw *hw) | |||
48 | /*Init Debug flag enable condition */ | 48 | /*Init Debug flag enable condition */ |
49 | } | 49 | } |
50 | EXPORT_SYMBOL_GPL(rtl_dbgp_flag_init); | 50 | EXPORT_SYMBOL_GPL(rtl_dbgp_flag_init); |
51 | |||
52 | #ifdef CONFIG_RTLWIFI_DEBUG | ||
53 | void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level, | ||
54 | const char *modname, const char *fmt, ...) | ||
55 | { | ||
56 | if (unlikely((comp & rtlpriv->dbg.global_debugcomponents) && | ||
57 | (level <= rtlpriv->dbg.global_debuglevel))) { | ||
58 | struct va_format vaf; | ||
59 | va_list args; | ||
60 | |||
61 | va_start(args, fmt); | ||
62 | |||
63 | vaf.fmt = fmt; | ||
64 | vaf.va = &args; | ||
65 | |||
66 | printk(KERN_DEBUG "%s:%ps:<%lx-%x> %pV", | ||
67 | modname, __builtin_return_address(0), | ||
68 | in_interrupt(), in_atomic(), | ||
69 | &vaf); | ||
70 | |||
71 | va_end(args); | ||
72 | } | ||
73 | } | ||
74 | EXPORT_SYMBOL_GPL(_rtl_dbg_trace); | ||
75 | #endif | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.h b/drivers/net/wireless/realtek/rtlwifi/debug.h index fc794b3e9f4a..6156a79328c1 100644 --- a/drivers/net/wireless/realtek/rtlwifi/debug.h +++ b/drivers/net/wireless/realtek/rtlwifi/debug.h | |||
@@ -174,15 +174,16 @@ do { \ | |||
174 | } \ | 174 | } \ |
175 | } while (0) | 175 | } while (0) |
176 | 176 | ||
177 | |||
178 | struct rtl_priv; | ||
179 | |||
180 | __printf(5, 6) | ||
181 | void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level, | ||
182 | const char *modname, const char *fmt, ...); | ||
183 | |||
177 | #define RT_TRACE(rtlpriv, comp, level, fmt, ...) \ | 184 | #define RT_TRACE(rtlpriv, comp, level, fmt, ...) \ |
178 | do { \ | 185 | _rtl_dbg_trace(rtlpriv, comp, level, \ |
179 | if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \ | 186 | KBUILD_MODNAME, fmt, ##__VA_ARGS__) |
180 | ((level) <= rtlpriv->dbg.global_debuglevel))) { \ | ||
181 | printk(KERN_DEBUG KBUILD_MODNAME ":%s():<%lx-%x> " fmt, \ | ||
182 | __func__, in_interrupt(), in_atomic(), \ | ||
183 | ##__VA_ARGS__); \ | ||
184 | } \ | ||
185 | } while (0) | ||
186 | 187 | ||
187 | #define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...) \ | 188 | #define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...) \ |
188 | do { \ | 189 | do { \ |
diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c b/drivers/net/wireless/realtek/rtlwifi/efuse.c index 0b4082c9272a..7becfef6cd5c 100644 --- a/drivers/net/wireless/realtek/rtlwifi/efuse.c +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c | |||
@@ -24,6 +24,7 @@ | |||
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | #include "wifi.h" | 25 | #include "wifi.h" |
26 | #include "efuse.h" | 26 | #include "efuse.h" |
27 | #include "pci.h" | ||
27 | #include <linux/export.h> | 28 | #include <linux/export.h> |
28 | 29 | ||
29 | static const u8 MAX_PGPKT_SIZE = 9; | 30 | static const u8 MAX_PGPKT_SIZE = 9; |
@@ -1243,3 +1244,80 @@ static u8 efuse_calculate_word_cnts(u8 word_en) | |||
1243 | return word_cnts; | 1244 | return word_cnts; |
1244 | } | 1245 | } |
1245 | 1246 | ||
1247 | int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv, | ||
1248 | int max_size, u8 *hwinfo, int *params) | ||
1249 | { | ||
1250 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | ||
1251 | struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); | ||
1252 | struct device *dev = &rtlpcipriv->dev.pdev->dev; | ||
1253 | u16 eeprom_id; | ||
1254 | u16 i, usvalue; | ||
1255 | |||
1256 | switch (rtlefuse->epromtype) { | ||
1257 | case EEPROM_BOOT_EFUSE: | ||
1258 | rtl_efuse_shadow_map_update(hw); | ||
1259 | break; | ||
1260 | |||
1261 | case EEPROM_93C46: | ||
1262 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
1263 | "RTL8XXX did not boot from eeprom, check it !!\n"); | ||
1264 | return 1; | ||
1265 | |||
1266 | default: | ||
1267 | dev_warn(dev, "no efuse data\n"); | ||
1268 | return 1; | ||
1269 | } | ||
1270 | |||
1271 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], max_size); | ||
1272 | |||
1273 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", | ||
1274 | hwinfo, max_size); | ||
1275 | |||
1276 | eeprom_id = *((u16 *)&hwinfo[0]); | ||
1277 | if (eeprom_id != params[0]) { | ||
1278 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
1279 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
1280 | rtlefuse->autoload_failflag = true; | ||
1281 | } else { | ||
1282 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
1283 | rtlefuse->autoload_failflag = false; | ||
1284 | } | ||
1285 | |||
1286 | if (rtlefuse->autoload_failflag) | ||
1287 | return 1; | ||
1288 | |||
1289 | rtlefuse->eeprom_vid = *(u16 *)&hwinfo[params[1]]; | ||
1290 | rtlefuse->eeprom_did = *(u16 *)&hwinfo[params[2]]; | ||
1291 | rtlefuse->eeprom_svid = *(u16 *)&hwinfo[params[3]]; | ||
1292 | rtlefuse->eeprom_smid = *(u16 *)&hwinfo[params[4]]; | ||
1293 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1294 | "EEPROMId = 0x%4x\n", eeprom_id); | ||
1295 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1296 | "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); | ||
1297 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1298 | "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); | ||
1299 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1300 | "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); | ||
1301 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1302 | "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); | ||
1303 | |||
1304 | for (i = 0; i < 6; i += 2) { | ||
1305 | usvalue = *(u16 *)&hwinfo[params[5] + i]; | ||
1306 | *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue; | ||
1307 | } | ||
1308 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr); | ||
1309 | |||
1310 | rtlefuse->eeprom_channelplan = *&hwinfo[params[6]]; | ||
1311 | rtlefuse->eeprom_version = *(u16 *)&hwinfo[params[7]]; | ||
1312 | rtlefuse->txpwr_fromeprom = true; | ||
1313 | rtlefuse->eeprom_oemid = *&hwinfo[params[8]]; | ||
1314 | |||
1315 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1316 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); | ||
1317 | |||
1318 | /* set channel plan to world wide 13 */ | ||
1319 | rtlefuse->channel_plan = params[9]; | ||
1320 | |||
1321 | return 0; | ||
1322 | } | ||
1323 | EXPORT_SYMBOL_GPL(rtl_get_hwinfo); | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.h b/drivers/net/wireless/realtek/rtlwifi/efuse.h index be02e7894c61..51aa1210def5 100644 --- a/drivers/net/wireless/realtek/rtlwifi/efuse.h +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.h | |||
@@ -109,5 +109,7 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw); | |||
109 | void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); | 109 | void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); |
110 | void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); | 110 | void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); |
111 | void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx); | 111 | void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx); |
112 | int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv, | ||
113 | int max_size, u8 *hwinfo, int *params); | ||
112 | 114 | ||
113 | #endif | 115 | #endif |
diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c index 93579cac0d45..9a64f9b703e5 100644 --- a/drivers/net/wireless/realtek/rtlwifi/ps.c +++ b/drivers/net/wireless/realtek/rtlwifi/ps.c | |||
@@ -76,9 +76,9 @@ bool rtl_ps_disable_nic(struct ieee80211_hw *hw) | |||
76 | } | 76 | } |
77 | EXPORT_SYMBOL(rtl_ps_disable_nic); | 77 | EXPORT_SYMBOL(rtl_ps_disable_nic); |
78 | 78 | ||
79 | bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, | 79 | static bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, |
80 | enum rf_pwrstate state_toset, | 80 | enum rf_pwrstate state_toset, |
81 | u32 changesource, bool protect_or_not) | 81 | u32 changesource) |
82 | { | 82 | { |
83 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 83 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
84 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 84 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
@@ -86,9 +86,6 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, | |||
86 | bool actionallowed = false; | 86 | bool actionallowed = false; |
87 | u16 rfwait_cnt = 0; | 87 | u16 rfwait_cnt = 0; |
88 | 88 | ||
89 | if (protect_or_not) | ||
90 | goto no_protect; | ||
91 | |||
92 | /*Only one thread can change | 89 | /*Only one thread can change |
93 | *the RF state at one time, and others | 90 | *the RF state at one time, and others |
94 | *should wait to be executed. | 91 | *should wait to be executed. |
@@ -119,7 +116,6 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, | |||
119 | } | 116 | } |
120 | } | 117 | } |
121 | 118 | ||
122 | no_protect: | ||
123 | rtstate = ppsc->rfpwr_state; | 119 | rtstate = ppsc->rfpwr_state; |
124 | 120 | ||
125 | switch (state_toset) { | 121 | switch (state_toset) { |
@@ -162,15 +158,12 @@ no_protect: | |||
162 | if (actionallowed) | 158 | if (actionallowed) |
163 | rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); | 159 | rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); |
164 | 160 | ||
165 | if (!protect_or_not) { | 161 | spin_lock(&rtlpriv->locks.rf_ps_lock); |
166 | spin_lock(&rtlpriv->locks.rf_ps_lock); | 162 | ppsc->rfchange_inprogress = false; |
167 | ppsc->rfchange_inprogress = false; | 163 | spin_unlock(&rtlpriv->locks.rf_ps_lock); |
168 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
169 | } | ||
170 | 164 | ||
171 | return actionallowed; | 165 | return actionallowed; |
172 | } | 166 | } |
173 | EXPORT_SYMBOL(rtl_ps_set_rf_state); | ||
174 | 167 | ||
175 | static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw) | 168 | static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw) |
176 | { | 169 | { |
@@ -191,7 +184,7 @@ static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw) | |||
191 | } | 184 | } |
192 | 185 | ||
193 | rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate, | 186 | rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate, |
194 | RF_CHANGE_BY_IPS, false); | 187 | RF_CHANGE_BY_IPS); |
195 | 188 | ||
196 | if (ppsc->inactive_pwrstate == ERFOFF && | 189 | if (ppsc->inactive_pwrstate == ERFOFF && |
197 | rtlhal->interface == INTF_PCI) { | 190 | rtlhal->interface == INTF_PCI) { |
@@ -587,7 +580,7 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw) | |||
587 | } | 580 | } |
588 | 581 | ||
589 | spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); | 582 | spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); |
590 | rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS, false); | 583 | rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); |
591 | spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); | 584 | spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); |
592 | } | 585 | } |
593 | 586 | ||
@@ -630,7 +623,7 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) | |||
630 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | 623 | spin_unlock(&rtlpriv->locks.rf_ps_lock); |
631 | 624 | ||
632 | spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); | 625 | spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); |
633 | rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS , false); | 626 | rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); |
634 | spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); | 627 | spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); |
635 | 628 | ||
636 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && | 629 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && |
diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.h b/drivers/net/wireless/realtek/rtlwifi/ps.h index 29dfc514212d..0df2b5203030 100644 --- a/drivers/net/wireless/realtek/rtlwifi/ps.h +++ b/drivers/net/wireless/realtek/rtlwifi/ps.h | |||
@@ -28,9 +28,6 @@ | |||
28 | 28 | ||
29 | #define MAX_SW_LPS_SLEEP_INTV 5 | 29 | #define MAX_SW_LPS_SLEEP_INTV 5 |
30 | 30 | ||
31 | bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, | ||
32 | enum rf_pwrstate state_toset, u32 changesource, | ||
33 | bool protect_or_not); | ||
34 | bool rtl_ps_enable_nic(struct ieee80211_hw *hw); | 31 | bool rtl_ps_enable_nic(struct ieee80211_hw *hw); |
35 | bool rtl_ps_disable_nic(struct ieee80211_hw *hw); | 32 | bool rtl_ps_disable_nic(struct ieee80211_hw *hw); |
36 | void rtl_ips_nic_off(struct ieee80211_hw *hw); | 33 | void rtl_ips_nic_off(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c index 1aca77719521..ce8621a0f7aa 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rc.c +++ b/drivers/net/wireless/realtek/rtlwifi/rc.c | |||
@@ -94,7 +94,7 @@ static void _rtl_rc_rate_set_series(struct rtl_priv *rtlpriv, | |||
94 | struct ieee80211_sta *sta, | 94 | struct ieee80211_sta *sta, |
95 | struct ieee80211_tx_rate *rate, | 95 | struct ieee80211_tx_rate *rate, |
96 | struct ieee80211_tx_rate_control *txrc, | 96 | struct ieee80211_tx_rate_control *txrc, |
97 | u8 tries, char rix, int rtsctsenable, | 97 | u8 tries, s8 rix, int rtsctsenable, |
98 | bool not_data) | 98 | bool not_data) |
99 | { | 99 | { |
100 | struct rtl_mac *mac = rtl_mac(rtlpriv); | 100 | struct rtl_mac *mac = rtl_mac(rtlpriv); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c index db9a7829d568..f936a491371b 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c | |||
@@ -886,7 +886,7 @@ static void dm_txpower_track_cb_therm(struct ieee80211_hw *hw) | |||
886 | u8 thermalvalue_avg_count = 0; | 886 | u8 thermalvalue_avg_count = 0; |
887 | u32 thermalvalue_avg = 0; | 887 | u32 thermalvalue_avg = 0; |
888 | long ele_d, temp_cck; | 888 | long ele_d, temp_cck; |
889 | char ofdm_index[2], cck_index = 0, | 889 | s8 ofdm_index[2], cck_index = 0, |
890 | ofdm_index_old[2] = {0, 0}, cck_index_old = 0; | 890 | ofdm_index_old[2] = {0, 0}, cck_index_old = 0; |
891 | int i = 0; | 891 | int i = 0; |
892 | /*bool is2t = false;*/ | 892 | /*bool is2t = false;*/ |
@@ -898,7 +898,7 @@ static void dm_txpower_track_cb_therm(struct ieee80211_hw *hw) | |||
898 | /*0.1 the following TWO tables decide the | 898 | /*0.1 the following TWO tables decide the |
899 | *final index of OFDM/CCK swing table | 899 | *final index of OFDM/CCK swing table |
900 | */ | 900 | */ |
901 | char delta_swing_table_idx[2][15] = { | 901 | s8 delta_swing_table_idx[2][15] = { |
902 | {0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11}, | 902 | {0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11}, |
903 | {0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10} | 903 | {0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10} |
904 | }; | 904 | }; |
@@ -1790,6 +1790,7 @@ void rtl88e_dm_watchdog(struct ieee80211_hw *hw) | |||
1790 | if (ppsc->p2p_ps_info.p2p_ps_mode) | 1790 | if (ppsc->p2p_ps_info.p2p_ps_mode) |
1791 | fw_ps_awake = false; | 1791 | fw_ps_awake = false; |
1792 | 1792 | ||
1793 | spin_lock(&rtlpriv->locks.rf_ps_lock); | ||
1793 | if ((ppsc->rfpwr_state == ERFON) && | 1794 | if ((ppsc->rfpwr_state == ERFON) && |
1794 | ((!fw_current_inpsmode) && fw_ps_awake) && | 1795 | ((!fw_current_inpsmode) && fw_ps_awake) && |
1795 | (!ppsc->rfchange_inprogress)) { | 1796 | (!ppsc->rfchange_inprogress)) { |
@@ -1802,4 +1803,5 @@ void rtl88e_dm_watchdog(struct ieee80211_hw *hw) | |||
1802 | rtl88e_dm_check_edca_turbo(hw); | 1803 | rtl88e_dm_check_edca_turbo(hw); |
1803 | rtl88e_dm_antenna_diversity(hw); | 1804 | rtl88e_dm_antenna_diversity(hw); |
1804 | } | 1805 | } |
1806 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
1805 | } | 1807 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c index e26a233684bb..4ab6201daf1a 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c | |||
@@ -1835,76 +1835,24 @@ static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw) | |||
1835 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1835 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1836 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 1836 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
1837 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 1837 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
1838 | u16 i, usvalue; | 1838 | int params[] = {RTL8188E_EEPROM_ID, EEPROM_VID, EEPROM_DID, |
1839 | u8 hwinfo[HWSET_MAX_SIZE]; | 1839 | EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, |
1840 | u16 eeprom_id; | 1840 | EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, |
1841 | 1841 | COUNTRY_CODE_WORLD_WIDE_13}; | |
1842 | switch (rtlefuse->epromtype) { | 1842 | u8 *hwinfo; |
1843 | case EEPROM_BOOT_EFUSE: | 1843 | |
1844 | rtl_efuse_shadow_map_update(hw); | 1844 | hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); |
1845 | break; | 1845 | if (!hwinfo) |
1846 | |||
1847 | case EEPROM_93C46: | ||
1848 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
1849 | "RTL819X Not boot from eeprom, check it !!"); | ||
1850 | return; | 1846 | return; |
1851 | 1847 | ||
1852 | default: | 1848 | if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) |
1853 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 1849 | goto exit; |
1854 | "boot from neither eeprom nor efuse, check it !!"); | ||
1855 | return; | ||
1856 | } | ||
1857 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); | ||
1858 | |||
1859 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n", | ||
1860 | hwinfo, HWSET_MAX_SIZE); | ||
1861 | |||
1862 | eeprom_id = *((u16 *)&hwinfo[0]); | ||
1863 | if (eeprom_id != RTL8188E_EEPROM_ID) { | ||
1864 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
1865 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
1866 | rtlefuse->autoload_failflag = true; | ||
1867 | } else { | ||
1868 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
1869 | rtlefuse->autoload_failflag = false; | ||
1870 | } | ||
1871 | 1850 | ||
1872 | if (rtlefuse->autoload_failflag == true) | ||
1873 | return; | ||
1874 | /*VID DID SVID SDID*/ | ||
1875 | rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; | ||
1876 | rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; | ||
1877 | rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; | ||
1878 | rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; | ||
1879 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1880 | "EEPROMId = 0x%4x\n", eeprom_id); | ||
1881 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1882 | "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); | ||
1883 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1884 | "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); | ||
1885 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1886 | "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); | ||
1887 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1888 | "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); | ||
1889 | /*customer ID*/ | ||
1890 | rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; | ||
1891 | if (rtlefuse->eeprom_oemid == 0xFF) | 1851 | if (rtlefuse->eeprom_oemid == 0xFF) |
1892 | rtlefuse->eeprom_oemid = 0; | 1852 | rtlefuse->eeprom_oemid = 0; |
1893 | 1853 | ||
1894 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | 1854 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, |
1895 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); | 1855 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); |
1896 | /*EEPROM version*/ | ||
1897 | rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; | ||
1898 | /*mac address*/ | ||
1899 | for (i = 0; i < 6; i += 2) { | ||
1900 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; | ||
1901 | *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue; | ||
1902 | } | ||
1903 | |||
1904 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, | ||
1905 | "dev_addr: %pM\n", rtlefuse->dev_addr); | ||
1906 | /*channel plan */ | ||
1907 | rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; | ||
1908 | /* set channel plan from efuse */ | 1856 | /* set channel plan from efuse */ |
1909 | rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; | 1857 | rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; |
1910 | /*tx power*/ | 1858 | /*tx power*/ |
@@ -1978,6 +1926,8 @@ static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw) | |||
1978 | 1926 | ||
1979 | } | 1927 | } |
1980 | } | 1928 | } |
1929 | exit: | ||
1930 | kfree(hwinfo); | ||
1981 | } | 1931 | } |
1982 | 1932 | ||
1983 | static void _rtl88ee_hal_customized_behavior(struct ieee80211_hw *hw) | 1933 | static void _rtl88ee_hal_customized_behavior(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c index 416a9ba6382e..7498a1218cba 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c | |||
@@ -373,7 +373,7 @@ static bool _rtl88e_phy_bb8188e_config_parafile(struct ieee80211_hw *hw) | |||
373 | 373 | ||
374 | rtstatus = phy_config_bb_with_headerfile(hw, BASEBAND_CONFIG_PHY_REG); | 374 | rtstatus = phy_config_bb_with_headerfile(hw, BASEBAND_CONFIG_PHY_REG); |
375 | if (!rtstatus) { | 375 | if (!rtstatus) { |
376 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!"); | 376 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n"); |
377 | return false; | 377 | return false; |
378 | } | 378 | } |
379 | 379 | ||
@@ -383,7 +383,7 @@ static bool _rtl88e_phy_bb8188e_config_parafile(struct ieee80211_hw *hw) | |||
383 | phy_config_bb_with_pghdr(hw, BASEBAND_CONFIG_PHY_REG); | 383 | phy_config_bb_with_pghdr(hw, BASEBAND_CONFIG_PHY_REG); |
384 | } | 384 | } |
385 | if (!rtstatus) { | 385 | if (!rtstatus) { |
386 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!"); | 386 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n"); |
387 | return false; | 387 | return false; |
388 | } | 388 | } |
389 | rtstatus = | 389 | rtstatus = |
@@ -1239,7 +1239,7 @@ u8 rtl88e_phy_sw_chnl(struct ieee80211_hw *hw) | |||
1239 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { | 1239 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { |
1240 | rtl88e_phy_sw_chnl_callback(hw); | 1240 | rtl88e_phy_sw_chnl_callback(hw); |
1241 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, | 1241 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, |
1242 | "sw_chnl_inprogress false schdule workitem current channel %d\n", | 1242 | "sw_chnl_inprogress false schedule workitem current channel %d\n", |
1243 | rtlphy->current_channel); | 1243 | rtlphy->current_channel); |
1244 | rtlphy->sw_chnl_inprogress = false; | 1244 | rtlphy->sw_chnl_inprogress = false; |
1245 | } else { | 1245 | } else { |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c index 40893cef7dfe..26ac4c2903c7 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c | |||
@@ -498,7 +498,7 @@ static bool _rtl88e_phy_rf6052_config_parafile(struct ieee80211_hw *hw) | |||
498 | 498 | ||
499 | if (rtstatus != true) { | 499 | if (rtstatus != true) { |
500 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 500 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
501 | "Radio[%d] Fail!!", rfpath); | 501 | "Radio[%d] Fail!!\n", rfpath); |
502 | return false; | 502 | return false; |
503 | } | 503 | } |
504 | 504 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c index 11701064b0e1..3e3b88664883 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c | |||
@@ -59,7 +59,7 @@ static void _rtl88ee_query_rxphystatus(struct ieee80211_hw *hw, | |||
59 | struct phy_status_rpt *phystrpt = | 59 | struct phy_status_rpt *phystrpt = |
60 | (struct phy_status_rpt *)p_drvinfo; | 60 | (struct phy_status_rpt *)p_drvinfo; |
61 | struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); | 61 | struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); |
62 | char rx_pwr_all = 0, rx_pwr[4]; | 62 | s8 rx_pwr_all = 0, rx_pwr[4]; |
63 | u8 rf_rx_num = 0, evm, pwdb_all; | 63 | u8 rf_rx_num = 0, evm, pwdb_all; |
64 | u8 i, max_spatial_stream; | 64 | u8 i, max_spatial_stream; |
65 | u32 rssi, total_rssi = 0; | 65 | u32 rssi, total_rssi = 0; |
@@ -540,7 +540,7 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw, | |||
540 | PCI_DMA_TODEVICE); | 540 | PCI_DMA_TODEVICE); |
541 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 541 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
542 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 542 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
543 | "DMA mapping error"); | 543 | "DMA mapping error\n"); |
544 | return; | 544 | return; |
545 | } | 545 | } |
546 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_88e)); | 546 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_88e)); |
@@ -703,7 +703,7 @@ void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
703 | 703 | ||
704 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 704 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
705 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 705 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
706 | "DMA mapping error"); | 706 | "DMA mapping error\n"); |
707 | return; | 707 | return; |
708 | } | 708 | } |
709 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 709 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h index 5a24d194ac76..9a1c2087adee 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h | |||
@@ -593,8 +593,8 @@ struct rx_fwinfo_88e { | |||
593 | u8 pwdb_all; | 593 | u8 pwdb_all; |
594 | u8 cfosho[4]; | 594 | u8 cfosho[4]; |
595 | u8 cfotail[4]; | 595 | u8 cfotail[4]; |
596 | char rxevm[2]; | 596 | s8 rxevm[2]; |
597 | char rxsnr[4]; | 597 | s8 rxsnr[4]; |
598 | u8 pdsnr[2]; | 598 | u8 pdsnr[2]; |
599 | u8 csi_current[2]; | 599 | u8 csi_current[2]; |
600 | u8 csi_target[2]; | 600 | u8 csi_target[2]; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h index 4422e31fedd9..6a72d0c8afa0 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h | |||
@@ -135,7 +135,7 @@ void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw); | |||
135 | void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw); | 135 | void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw); |
136 | void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); | 136 | void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); |
137 | void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal); | 137 | void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal); |
138 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 138 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta); |
139 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); | 139 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); |
140 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); | 140 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); |
141 | void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw); | 141 | void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c index 77e61b19bf36..60ab2ec4f4ef 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c | |||
@@ -213,7 +213,7 @@ bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw) | |||
213 | rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw, | 213 | rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw, |
214 | BASEBAND_CONFIG_PHY_REG); | 214 | BASEBAND_CONFIG_PHY_REG); |
215 | if (!rtstatus) { | 215 | if (!rtstatus) { |
216 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!"); | 216 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n"); |
217 | return false; | 217 | return false; |
218 | } | 218 | } |
219 | if (rtlphy->rf_type == RF_1T2R) { | 219 | if (rtlphy->rf_type == RF_1T2R) { |
@@ -226,7 +226,7 @@ bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw) | |||
226 | BASEBAND_CONFIG_PHY_REG); | 226 | BASEBAND_CONFIG_PHY_REG); |
227 | } | 227 | } |
228 | if (!rtstatus) { | 228 | if (!rtstatus) { |
229 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!"); | 229 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n"); |
230 | return false; | 230 | return false; |
231 | } | 231 | } |
232 | rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw, | 232 | rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw, |
@@ -757,7 +757,7 @@ u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw) | |||
757 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { | 757 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { |
758 | rtl92c_phy_sw_chnl_callback(hw); | 758 | rtl92c_phy_sw_chnl_callback(hw); |
759 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, | 759 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, |
760 | "sw_chnl_inprogress false schdule workitem\n"); | 760 | "sw_chnl_inprogress false schedule workitem\n"); |
761 | rtlphy->sw_chnl_inprogress = false; | 761 | rtlphy->sw_chnl_inprogress = false; |
762 | } else { | 762 | } else { |
763 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, | 763 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, |
@@ -1353,7 +1353,7 @@ static void _rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, | |||
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, | 1355 | static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, |
1356 | char delta, bool is2t) | 1356 | s8 delta, bool is2t) |
1357 | { | 1357 | { |
1358 | } | 1358 | } |
1359 | 1359 | ||
@@ -1518,7 +1518,7 @@ void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw) | |||
1518 | } | 1518 | } |
1519 | EXPORT_SYMBOL(rtl92c_phy_lc_calibrate); | 1519 | EXPORT_SYMBOL(rtl92c_phy_lc_calibrate); |
1520 | 1520 | ||
1521 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta) | 1521 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta) |
1522 | { | 1522 | { |
1523 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1523 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1524 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1524 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h index 64bc49f4dbc6..202412577bf0 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h | |||
@@ -210,7 +210,7 @@ u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); | |||
210 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); | 210 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); |
211 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, | 211 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, |
212 | u16 beaconinterval); | 212 | u16 beaconinterval); |
213 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 213 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta); |
214 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); | 214 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); |
215 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 215 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
216 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 216 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c index 58b7ac6899ef..244607951e28 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c | |||
@@ -1680,65 +1680,18 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) | |||
1680 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1680 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1681 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 1681 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
1682 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 1682 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
1683 | struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev; | 1683 | int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID, |
1684 | u16 i, usvalue; | 1684 | EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, |
1685 | u8 hwinfo[HWSET_MAX_SIZE]; | 1685 | EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, |
1686 | u16 eeprom_id; | 1686 | COUNTRY_CODE_WORLD_WIDE_13}; |
1687 | 1687 | u8 *hwinfo; | |
1688 | switch (rtlefuse->epromtype) { | 1688 | |
1689 | case EEPROM_BOOT_EFUSE: | 1689 | hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); |
1690 | rtl_efuse_shadow_map_update(hw); | 1690 | if (!hwinfo) |
1691 | break; | ||
1692 | |||
1693 | case EEPROM_93C46: | ||
1694 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
1695 | "RTL819X Not boot from eeprom, check it !!"); | ||
1696 | return; | ||
1697 | |||
1698 | default: | ||
1699 | dev_warn(dev, "no efuse data\n"); | ||
1700 | return; | ||
1701 | } | ||
1702 | |||
1703 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); | ||
1704 | |||
1705 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", | ||
1706 | hwinfo, HWSET_MAX_SIZE); | ||
1707 | |||
1708 | eeprom_id = *((u16 *)&hwinfo[0]); | ||
1709 | if (eeprom_id != RTL8190_EEPROM_ID) { | ||
1710 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
1711 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
1712 | rtlefuse->autoload_failflag = true; | ||
1713 | } else { | ||
1714 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
1715 | rtlefuse->autoload_failflag = false; | ||
1716 | } | ||
1717 | |||
1718 | if (rtlefuse->autoload_failflag) | ||
1719 | return; | 1691 | return; |
1720 | 1692 | ||
1721 | rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; | 1693 | if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) |
1722 | rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; | 1694 | goto exit; |
1723 | rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; | ||
1724 | rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; | ||
1725 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1726 | "EEPROMId = 0x%4x\n", eeprom_id); | ||
1727 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1728 | "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); | ||
1729 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1730 | "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); | ||
1731 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1732 | "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); | ||
1733 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1734 | "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); | ||
1735 | |||
1736 | for (i = 0; i < 6; i += 2) { | ||
1737 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; | ||
1738 | *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; | ||
1739 | } | ||
1740 | |||
1741 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr); | ||
1742 | 1695 | ||
1743 | _rtl92ce_read_txpower_info_from_hwpg(hw, | 1696 | _rtl92ce_read_txpower_info_from_hwpg(hw, |
1744 | rtlefuse->autoload_failflag, | 1697 | rtlefuse->autoload_failflag, |
@@ -1747,18 +1700,6 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) | |||
1747 | rtl8192ce_read_bt_coexist_info_from_hwpg(hw, | 1700 | rtl8192ce_read_bt_coexist_info_from_hwpg(hw, |
1748 | rtlefuse->autoload_failflag, | 1701 | rtlefuse->autoload_failflag, |
1749 | hwinfo); | 1702 | hwinfo); |
1750 | |||
1751 | rtlefuse->eeprom_channelplan = *&hwinfo[EEPROM_CHANNELPLAN]; | ||
1752 | rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; | ||
1753 | rtlefuse->txpwr_fromeprom = true; | ||
1754 | rtlefuse->eeprom_oemid = *&hwinfo[EEPROM_CUSTOMER_ID]; | ||
1755 | |||
1756 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1757 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); | ||
1758 | |||
1759 | /* set channel paln to world wide 13 */ | ||
1760 | rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; | ||
1761 | |||
1762 | if (rtlhal->oem_id == RT_CID_DEFAULT) { | 1703 | if (rtlhal->oem_id == RT_CID_DEFAULT) { |
1763 | switch (rtlefuse->eeprom_oemid) { | 1704 | switch (rtlefuse->eeprom_oemid) { |
1764 | case EEPROM_CID_DEFAULT: | 1705 | case EEPROM_CID_DEFAULT: |
@@ -1782,10 +1723,10 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) | |||
1782 | default: | 1723 | default: |
1783 | rtlhal->oem_id = RT_CID_DEFAULT; | 1724 | rtlhal->oem_id = RT_CID_DEFAULT; |
1784 | break; | 1725 | break; |
1785 | |||
1786 | } | 1726 | } |
1787 | } | 1727 | } |
1788 | 1728 | exit: | |
1729 | kfree(hwinfo); | ||
1789 | } | 1730 | } |
1790 | 1731 | ||
1791 | static void _rtl92ce_hal_customized_behavior(struct ieee80211_hw *hw) | 1732 | static void _rtl92ce_hal_customized_behavior(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h index e5e1353a94c3..dadc02b5de0b 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h | |||
@@ -102,7 +102,7 @@ void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); | |||
102 | u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); | 102 | u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); |
103 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); | 103 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); |
104 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval); | 104 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval); |
105 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 105 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta); |
106 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); | 106 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); |
107 | void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); | 107 | void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); |
108 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 108 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c index 84ddd4d07a1d..781af1b99eb5 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c | |||
@@ -49,7 +49,7 @@ static u8 _rtl92ce_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) | |||
49 | return skb->priority; | 49 | return skb->priority; |
50 | } | 50 | } |
51 | 51 | ||
52 | static u8 _rtl92c_query_rxpwrpercentage(char antpower) | 52 | static u8 _rtl92c_query_rxpwrpercentage(s8 antpower) |
53 | { | 53 | { |
54 | if ((antpower <= -100) || (antpower >= 20)) | 54 | if ((antpower <= -100) || (antpower >= 20)) |
55 | return 0; | 55 | return 0; |
@@ -59,9 +59,9 @@ static u8 _rtl92c_query_rxpwrpercentage(char antpower) | |||
59 | return 100 + antpower; | 59 | return 100 + antpower; |
60 | } | 60 | } |
61 | 61 | ||
62 | static u8 _rtl92c_evm_db_to_percentage(char value) | 62 | static u8 _rtl92c_evm_db_to_percentage(s8 value) |
63 | { | 63 | { |
64 | char ret_val; | 64 | s8 ret_val; |
65 | ret_val = value; | 65 | ret_val = value; |
66 | 66 | ||
67 | if (ret_val >= 0) | 67 | if (ret_val >= 0) |
@@ -449,7 +449,7 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
449 | 449 | ||
450 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 450 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
451 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 451 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
452 | "DMA mapping error"); | 452 | "DMA mapping error\n"); |
453 | return; | 453 | return; |
454 | } | 454 | } |
455 | rcu_read_lock(); | 455 | rcu_read_lock(); |
@@ -615,7 +615,7 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
615 | 615 | ||
616 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 616 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
617 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 617 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
618 | "DMA mapping error"); | 618 | "DMA mapping error\n"); |
619 | return; | 619 | return; |
620 | } | 620 | } |
621 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 621 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h index 4bec4b07e3e0..607304586c03 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h | |||
@@ -537,8 +537,8 @@ struct rx_fwinfo_92c { | |||
537 | u8 pwdb_all; | 537 | u8 pwdb_all; |
538 | u8 cfosho[4]; | 538 | u8 cfosho[4]; |
539 | u8 cfotail[4]; | 539 | u8 cfotail[4]; |
540 | char rxevm[2]; | 540 | s8 rxevm[2]; |
541 | char rxsnr[4]; | 541 | s8 rxsnr[4]; |
542 | u8 pdsnr[2]; | 542 | u8 pdsnr[2]; |
543 | u8 csi_current[2]; | 543 | u8 csi_current[2]; |
544 | u8 csi_target[2]; | 544 | u8 csi_target[2]; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c index ae1129f916d5..8789752f8143 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | |||
@@ -347,56 +347,24 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) | |||
347 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 347 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
348 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 348 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
349 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 349 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
350 | u16 i, usvalue; | 350 | int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID, |
351 | u8 hwinfo[HWSET_MAX_SIZE] = {0}; | 351 | EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, |
352 | u16 eeprom_id; | 352 | EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, |
353 | 353 | 0}; | |
354 | switch (rtlefuse->epromtype) { | 354 | u8 *hwinfo; |
355 | case EEPROM_BOOT_EFUSE: | 355 | |
356 | rtl_efuse_shadow_map_update(hw); | 356 | hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); |
357 | break; | 357 | if (!hwinfo) |
358 | |||
359 | case EEPROM_93C46: | ||
360 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
361 | "RTL819X Not boot from eeprom, check it !!\n"); | ||
362 | return; | 358 | return; |
363 | 359 | ||
364 | default: | 360 | if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) |
365 | pr_warn("rtl92cu: no efuse data\n\n"); | 361 | goto exit; |
366 | return; | 362 | |
367 | } | ||
368 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); | ||
369 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD, "MAP", | ||
370 | hwinfo, HWSET_MAX_SIZE); | ||
371 | eeprom_id = le16_to_cpu(*((__le16 *)&hwinfo[0])); | ||
372 | if (eeprom_id != RTL8190_EEPROM_ID) { | ||
373 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
374 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
375 | rtlefuse->autoload_failflag = true; | ||
376 | } else { | ||
377 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
378 | rtlefuse->autoload_failflag = false; | ||
379 | } | ||
380 | if (rtlefuse->autoload_failflag) | ||
381 | return; | ||
382 | for (i = 0; i < 6; i += 2) { | ||
383 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; | ||
384 | *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; | ||
385 | } | ||
386 | pr_info("MAC address: %pM\n", rtlefuse->dev_addr); | ||
387 | _rtl92cu_read_txpower_info_from_hwpg(hw, | 363 | _rtl92cu_read_txpower_info_from_hwpg(hw, |
388 | rtlefuse->autoload_failflag, hwinfo); | 364 | rtlefuse->autoload_failflag, hwinfo); |
389 | rtlefuse->eeprom_vid = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VID]); | 365 | _rtl92cu_read_board_type(hw, hwinfo); |
390 | rtlefuse->eeprom_did = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_DID]); | 366 | |
391 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, " VID = 0x%02x PID = 0x%02x\n", | ||
392 | rtlefuse->eeprom_vid, rtlefuse->eeprom_did); | ||
393 | rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; | ||
394 | rtlefuse->eeprom_version = | ||
395 | le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VERSION]); | ||
396 | rtlefuse->txpwr_fromeprom = true; | 367 | rtlefuse->txpwr_fromeprom = true; |
397 | rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; | ||
398 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n", | ||
399 | rtlefuse->eeprom_oemid); | ||
400 | if (rtlhal->oem_id == RT_CID_DEFAULT) { | 368 | if (rtlhal->oem_id == RT_CID_DEFAULT) { |
401 | switch (rtlefuse->eeprom_oemid) { | 369 | switch (rtlefuse->eeprom_oemid) { |
402 | case EEPROM_CID_DEFAULT: | 370 | case EEPROM_CID_DEFAULT: |
@@ -422,7 +390,8 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) | |||
422 | break; | 390 | break; |
423 | } | 391 | } |
424 | } | 392 | } |
425 | _rtl92cu_read_board_type(hw, hwinfo); | 393 | exit: |
394 | kfree(hwinfo); | ||
426 | } | 395 | } |
427 | 396 | ||
428 | static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw) | 397 | static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c index 035713311a4a..68ca734853c1 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c | |||
@@ -596,7 +596,7 @@ void rtl92c_set_min_space(struct ieee80211_hw *hw, bool is2T) | |||
596 | 596 | ||
597 | /*==============================================================*/ | 597 | /*==============================================================*/ |
598 | 598 | ||
599 | static u8 _rtl92c_query_rxpwrpercentage(char antpower) | 599 | static u8 _rtl92c_query_rxpwrpercentage(s8 antpower) |
600 | { | 600 | { |
601 | if ((antpower <= -100) || (antpower >= 20)) | 601 | if ((antpower <= -100) || (antpower >= 20)) |
602 | return 0; | 602 | return 0; |
@@ -606,9 +606,9 @@ static u8 _rtl92c_query_rxpwrpercentage(char antpower) | |||
606 | return 100 + antpower; | 606 | return 100 + antpower; |
607 | } | 607 | } |
608 | 608 | ||
609 | static u8 _rtl92c_evm_db_to_percentage(char value) | 609 | static u8 _rtl92c_evm_db_to_percentage(s8 value) |
610 | { | 610 | { |
611 | char ret_val; | 611 | s8 ret_val; |
612 | 612 | ||
613 | ret_val = value; | 613 | ret_val = value; |
614 | if (ret_val >= 0) | 614 | if (ret_val >= 0) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h index 553a4bfac668..20a49ec8459b 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h | |||
@@ -79,8 +79,8 @@ struct rx_fwinfo_92c { | |||
79 | u8 pwdb_all; | 79 | u8 pwdb_all; |
80 | u8 cfosho[4]; | 80 | u8 cfosho[4]; |
81 | u8 cfotail[4]; | 81 | u8 cfotail[4]; |
82 | char rxevm[2]; | 82 | s8 rxevm[2]; |
83 | char rxsnr[4]; | 83 | s8 rxsnr[4]; |
84 | u8 pdsnr[2]; | 84 | u8 pdsnr[2]; |
85 | u8 csi_current[2]; | 85 | u8 csi_current[2]; |
86 | u8 csi_target[2]; | 86 | u8 csi_target[2]; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c index 5624ade92cc0..ec2ea56f7933 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c | |||
@@ -465,7 +465,7 @@ static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw) | |||
465 | } | 465 | } |
466 | if (!rtstatus) { | 466 | if (!rtstatus) { |
467 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 467 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
468 | "Radio[%d] Fail!!", rfpath); | 468 | "Radio[%d] Fail!!\n", rfpath); |
469 | goto phy_rf_cfg_fail; | 469 | goto phy_rf_cfg_fail; |
470 | } | 470 | } |
471 | } | 471 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c index 8618c322a3f8..b0f632462335 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c | |||
@@ -1744,71 +1744,26 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) | |||
1744 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1744 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1745 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 1745 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
1746 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 1746 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
1747 | struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev; | 1747 | int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID, |
1748 | u16 i, usvalue; | 1748 | EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR_MAC0_92D, |
1749 | u8 hwinfo[HWSET_MAX_SIZE]; | 1749 | EEPROM_CHANNEL_PLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, |
1750 | u16 eeprom_id; | 1750 | COUNTRY_CODE_WORLD_WIDE_13}; |
1751 | unsigned long flags; | 1751 | int i; |
1752 | u16 usvalue; | ||
1753 | u8 *hwinfo; | ||
1752 | 1754 | ||
1753 | switch (rtlefuse->epromtype) { | 1755 | hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); |
1754 | case EEPROM_BOOT_EFUSE: | 1756 | if (!hwinfo) |
1755 | spin_lock_irqsave(&globalmutex_for_power_and_efuse, flags); | ||
1756 | rtl_efuse_shadow_map_update(hw); | ||
1757 | _rtl92de_efuse_update_chip_version(hw); | ||
1758 | spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags); | ||
1759 | break; | ||
1760 | case EEPROM_93C46: | ||
1761 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
1762 | "RTL819X Not boot from eeprom, check it !!\n"); | ||
1763 | return; | ||
1764 | default: | ||
1765 | dev_warn(dev, "no efuse data\n"); | ||
1766 | return; | 1757 | return; |
1767 | } | ||
1768 | |||
1769 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); | ||
1770 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", | ||
1771 | hwinfo, HWSET_MAX_SIZE); | ||
1772 | 1758 | ||
1773 | eeprom_id = *((u16 *)&hwinfo[0]); | 1759 | if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) |
1774 | if (eeprom_id != RTL8190_EEPROM_ID) { | ||
1775 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
1776 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
1777 | rtlefuse->autoload_failflag = true; | ||
1778 | } else { | ||
1779 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
1780 | rtlefuse->autoload_failflag = false; | ||
1781 | } | ||
1782 | if (rtlefuse->autoload_failflag) { | ||
1783 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
1784 | "RTL819X Not boot from eeprom, check it !!\n"); | ||
1785 | return; | 1760 | return; |
1786 | } | ||
1787 | rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; | ||
1788 | _rtl92de_read_macphymode_and_bandtype(hw, hwinfo); | ||
1789 | 1761 | ||
1790 | /* VID, DID SE 0xA-D */ | 1762 | _rtl92de_efuse_update_chip_version(hw); |
1791 | rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; | 1763 | _rtl92de_read_macphymode_and_bandtype(hw, hwinfo); |
1792 | rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; | ||
1793 | rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; | ||
1794 | rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; | ||
1795 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id); | ||
1796 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1797 | "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); | ||
1798 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1799 | "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); | ||
1800 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1801 | "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); | ||
1802 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1803 | "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); | ||
1804 | 1764 | ||
1805 | /* Read Permanent MAC address */ | 1765 | /* Read Permanent MAC address for 2nd interface */ |
1806 | if (rtlhal->interfaceindex == 0) { | 1766 | if (rtlhal->interfaceindex != 0) { |
1807 | for (i = 0; i < 6; i += 2) { | ||
1808 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR_MAC0_92D + i]; | ||
1809 | *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; | ||
1810 | } | ||
1811 | } else { | ||
1812 | for (i = 0; i < 6; i += 2) { | 1767 | for (i = 0; i < 6; i += 2) { |
1813 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR_MAC1_92D + i]; | 1768 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR_MAC1_92D + i]; |
1814 | *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; | 1769 | *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; |
@@ -1834,10 +1789,8 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) | |||
1834 | rtlefuse->channel_plan = COUNTRY_CODE_FCC; | 1789 | rtlefuse->channel_plan = COUNTRY_CODE_FCC; |
1835 | break; | 1790 | break; |
1836 | } | 1791 | } |
1837 | rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; | ||
1838 | rtlefuse->txpwr_fromeprom = true; | 1792 | rtlefuse->txpwr_fromeprom = true; |
1839 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | 1793 | kfree(hwinfo); |
1840 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); | ||
1841 | } | 1794 | } |
1842 | 1795 | ||
1843 | void rtl92de_read_eeprom_info(struct ieee80211_hw *hw) | 1796 | void rtl92de_read_eeprom_info(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c index 7810fe87dca7..d334d2a5ea63 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | |||
@@ -2695,7 +2695,7 @@ void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw) | |||
2695 | RTPRINT(rtlpriv, FINIT, INIT_IQK, "LCK:Finish!!!\n"); | 2695 | RTPRINT(rtlpriv, FINIT, INIT_IQK, "LCK:Finish!!!\n"); |
2696 | } | 2696 | } |
2697 | 2697 | ||
2698 | void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, char delta) | 2698 | void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta) |
2699 | { | 2699 | { |
2700 | return; | 2700 | return; |
2701 | } | 2701 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h index 48d5c6835b6a..8115bf4ac683 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h | |||
@@ -160,7 +160,7 @@ void rtl92d_phy_config_maccoexist_rfpage(struct ieee80211_hw *hw); | |||
160 | bool rtl92d_phy_check_poweroff(struct ieee80211_hw *hw); | 160 | bool rtl92d_phy_check_poweroff(struct ieee80211_hw *hw); |
161 | void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw); | 161 | void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw); |
162 | void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw); | 162 | void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw); |
163 | void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 163 | void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta); |
164 | void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw); | 164 | void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw); |
165 | void rtl92d_phy_reset_iqk_result(struct ieee80211_hw *hw); | 165 | void rtl92d_phy_reset_iqk_result(struct ieee80211_hw *hw); |
166 | void rtl92d_release_cckandrw_pagea_ctl(struct ieee80211_hw *hw, | 166 | void rtl92d_release_cckandrw_pagea_ctl(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c index 6a6ac540d5b5..2f479d397644 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c | |||
@@ -601,7 +601,7 @@ bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw) | |||
601 | } | 601 | } |
602 | if (!rtstatus) { | 602 | if (!rtstatus) { |
603 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 603 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
604 | "Radio[%d] Fail!!", rfpath); | 604 | "Radio[%d] Fail!!\n", rfpath); |
605 | goto phy_rf_cfg_fail; | 605 | goto phy_rf_cfg_fail; |
606 | } | 606 | } |
607 | 607 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c index 1feaa629dd4f..e998e98d74cb 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c | |||
@@ -48,7 +48,7 @@ static u8 _rtl92de_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) | |||
48 | return skb->priority; | 48 | return skb->priority; |
49 | } | 49 | } |
50 | 50 | ||
51 | static u8 _rtl92d_query_rxpwrpercentage(char antpower) | 51 | static u8 _rtl92d_query_rxpwrpercentage(s8 antpower) |
52 | { | 52 | { |
53 | if ((antpower <= -100) || (antpower >= 20)) | 53 | if ((antpower <= -100) || (antpower >= 20)) |
54 | return 0; | 54 | return 0; |
@@ -58,9 +58,9 @@ static u8 _rtl92d_query_rxpwrpercentage(char antpower) | |||
58 | return 100 + antpower; | 58 | return 100 + antpower; |
59 | } | 59 | } |
60 | 60 | ||
61 | static u8 _rtl92d_evm_db_to_percentage(char value) | 61 | static u8 _rtl92d_evm_db_to_percentage(s8 value) |
62 | { | 62 | { |
63 | char ret_val = value; | 63 | s8 ret_val = value; |
64 | 64 | ||
65 | if (ret_val >= 0) | 65 | if (ret_val >= 0) |
66 | ret_val = 0; | 66 | ret_val = 0; |
@@ -586,7 +586,7 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, | |||
586 | PCI_DMA_TODEVICE); | 586 | PCI_DMA_TODEVICE); |
587 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 587 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
588 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 588 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
589 | "DMA mapping error"); | 589 | "DMA mapping error\n"); |
590 | return; | 590 | return; |
591 | } | 591 | } |
592 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d)); | 592 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d)); |
@@ -744,7 +744,7 @@ void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
744 | 744 | ||
745 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 745 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
746 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 746 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
747 | "DMA mapping error"); | 747 | "DMA mapping error\n"); |
748 | return; | 748 | return; |
749 | } | 749 | } |
750 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 750 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h index fb5cf0634e8d..194d99f8bacf 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h | |||
@@ -554,8 +554,8 @@ struct rx_fwinfo_92d { | |||
554 | u8 pwdb_all; | 554 | u8 pwdb_all; |
555 | u8 cfosho[4]; | 555 | u8 cfosho[4]; |
556 | u8 cfotail[4]; | 556 | u8 cfotail[4]; |
557 | char rxevm[2]; | 557 | s8 rxevm[2]; |
558 | char rxsnr[4]; | 558 | s8 rxsnr[4]; |
559 | u8 pdsnr[2]; | 559 | u8 pdsnr[2]; |
560 | u8 csi_current[2]; | 560 | u8 csi_current[2]; |
561 | u8 csi_target[2]; | 561 | u8 csi_target[2]; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c index 459f3d0efa2f..e6b5786c7d4a 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c | |||
@@ -496,7 +496,7 @@ static void rtl92ee_dm_find_minimum_rssi(struct ieee80211_hw *hw) | |||
496 | rtl_dm_dig->min_undec_pwdb_for_dm = | 496 | rtl_dm_dig->min_undec_pwdb_for_dm = |
497 | rtlpriv->dm.entry_min_undec_sm_pwdb; | 497 | rtlpriv->dm.entry_min_undec_sm_pwdb; |
498 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, | 498 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
499 | "AP Ext Port or disconnet PWDB = 0x%x\n", | 499 | "AP Ext Port or disconnect PWDB = 0x%x\n", |
500 | rtl_dm_dig->min_undec_pwdb_for_dm); | 500 | rtl_dm_dig->min_undec_pwdb_for_dm); |
501 | } | 501 | } |
502 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 502 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
@@ -983,7 +983,7 @@ static bool _rtl92ee_dm_ra_state_check(struct ieee80211_hw *hw, | |||
983 | break; | 983 | break; |
984 | default: | 984 | default: |
985 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, | 985 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, |
986 | "wrong rssi level setting %d !", *ratr_state); | 986 | "wrong rssi level setting %d !\n", *ratr_state); |
987 | break; | 987 | break; |
988 | } | 988 | } |
989 | 989 | ||
@@ -1219,6 +1219,7 @@ void rtl92ee_dm_watchdog(struct ieee80211_hw *hw) | |||
1219 | if (ppsc->p2p_ps_info.p2p_ps_mode) | 1219 | if (ppsc->p2p_ps_info.p2p_ps_mode) |
1220 | fw_ps_awake = false; | 1220 | fw_ps_awake = false; |
1221 | 1221 | ||
1222 | spin_lock(&rtlpriv->locks.rf_ps_lock); | ||
1222 | if ((ppsc->rfpwr_state == ERFON) && | 1223 | if ((ppsc->rfpwr_state == ERFON) && |
1223 | ((!fw_current_inpsmode) && fw_ps_awake) && | 1224 | ((!fw_current_inpsmode) && fw_ps_awake) && |
1224 | (!ppsc->rfchange_inprogress)) { | 1225 | (!ppsc->rfchange_inprogress)) { |
@@ -1233,4 +1234,5 @@ void rtl92ee_dm_watchdog(struct ieee80211_hw *hw) | |||
1233 | rtl92ee_dm_dynamic_atc_switch(hw); | 1234 | rtl92ee_dm_dynamic_atc_switch(hw); |
1234 | rtl92ee_dm_dynamic_primary_cca_ckeck(hw); | 1235 | rtl92ee_dm_dynamic_primary_cca_ckeck(hw); |
1235 | } | 1236 | } |
1237 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
1236 | } | 1238 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c index 28c260dd11ea..b07af8d15273 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c | |||
@@ -2098,75 +2098,24 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw) | |||
2098 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 2098 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2099 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 2099 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
2100 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 2100 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
2101 | u16 i, usvalue; | 2101 | int params[] = {RTL8192E_EEPROM_ID, EEPROM_VID, EEPROM_DID, |
2102 | u8 hwinfo[HWSET_MAX_SIZE]; | 2102 | EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, |
2103 | u16 eeprom_id; | 2103 | EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, |
2104 | 2104 | COUNTRY_CODE_WORLD_WIDE_13}; | |
2105 | switch (rtlefuse->epromtype) { | 2105 | u8 *hwinfo; |
2106 | case EEPROM_BOOT_EFUSE: | 2106 | |
2107 | rtl_efuse_shadow_map_update(hw); | 2107 | hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); |
2108 | break; | 2108 | if (!hwinfo) |
2109 | |||
2110 | case EEPROM_93C46: | ||
2111 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
2112 | "RTL819X Not boot from eeprom, check it !!"); | ||
2113 | return; | ||
2114 | |||
2115 | default: | ||
2116 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
2117 | "boot from neither eeprom nor efuse, check it !!"); | ||
2118 | return; | 2109 | return; |
2119 | } | ||
2120 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); | ||
2121 | 2110 | ||
2122 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n", | 2111 | if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) |
2123 | hwinfo, HWSET_MAX_SIZE); | 2112 | goto exit; |
2124 | 2113 | ||
2125 | eeprom_id = *((u16 *)&hwinfo[0]); | ||
2126 | if (eeprom_id != RTL8192E_EEPROM_ID) { | ||
2127 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
2128 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
2129 | rtlefuse->autoload_failflag = true; | ||
2130 | } else { | ||
2131 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
2132 | rtlefuse->autoload_failflag = false; | ||
2133 | } | ||
2134 | |||
2135 | if (rtlefuse->autoload_failflag) | ||
2136 | return; | ||
2137 | /*VID DID SVID SDID*/ | ||
2138 | rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; | ||
2139 | rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; | ||
2140 | rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; | ||
2141 | rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; | ||
2142 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id); | ||
2143 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2144 | "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); | ||
2145 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2146 | "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); | ||
2147 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2148 | "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); | ||
2149 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2150 | "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); | ||
2151 | /*customer ID*/ | ||
2152 | rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID]; | ||
2153 | if (rtlefuse->eeprom_oemid == 0xFF) | 2114 | if (rtlefuse->eeprom_oemid == 0xFF) |
2154 | rtlefuse->eeprom_oemid = 0; | 2115 | rtlefuse->eeprom_oemid = 0; |
2155 | 2116 | ||
2156 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | 2117 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, |
2157 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); | 2118 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); |
2158 | /*EEPROM version*/ | ||
2159 | rtlefuse->eeprom_version = *(u8 *)&hwinfo[EEPROM_VERSION]; | ||
2160 | /*mac address*/ | ||
2161 | for (i = 0; i < 6; i += 2) { | ||
2162 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; | ||
2163 | *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue; | ||
2164 | } | ||
2165 | |||
2166 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, | ||
2167 | "dev_addr: %pM\n", rtlefuse->dev_addr); | ||
2168 | /*channel plan */ | ||
2169 | rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN]; | ||
2170 | /* set channel plan from efuse */ | 2119 | /* set channel plan from efuse */ |
2171 | rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; | 2120 | rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; |
2172 | /*tx power*/ | 2121 | /*tx power*/ |
@@ -2208,6 +2157,8 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw) | |||
2208 | break; | 2157 | break; |
2209 | } | 2158 | } |
2210 | } | 2159 | } |
2160 | exit: | ||
2161 | kfree(hwinfo); | ||
2211 | } | 2162 | } |
2212 | 2163 | ||
2213 | static void _rtl92ee_hal_customized_behavior(struct ieee80211_hw *hw) | 2164 | static void _rtl92ee_hal_customized_behavior(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c index c2bf8d1a7af3..beafc9a10ad8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c | |||
@@ -547,7 +547,7 @@ static void _rtl92ee_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw) | |||
547 | static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start, | 547 | static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start, |
548 | u8 end, u8 base) | 548 | u8 end, u8 base) |
549 | { | 549 | { |
550 | char i = 0; | 550 | s8 i = 0; |
551 | u8 tmp = 0; | 551 | u8 tmp = 0; |
552 | u32 temp_data = 0; | 552 | u32 temp_data = 0; |
553 | 553 | ||
@@ -650,7 +650,7 @@ static bool _rtl92ee_phy_bb8192ee_config_parafile(struct ieee80211_hw *hw) | |||
650 | 650 | ||
651 | rtstatus = phy_config_bb_with_hdr_file(hw, BASEBAND_CONFIG_PHY_REG); | 651 | rtstatus = phy_config_bb_with_hdr_file(hw, BASEBAND_CONFIG_PHY_REG); |
652 | if (!rtstatus) { | 652 | if (!rtstatus) { |
653 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!"); | 653 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n"); |
654 | return false; | 654 | return false; |
655 | } | 655 | } |
656 | 656 | ||
@@ -662,7 +662,7 @@ static bool _rtl92ee_phy_bb8192ee_config_parafile(struct ieee80211_hw *hw) | |||
662 | } | 662 | } |
663 | _rtl92ee_phy_txpower_by_rate_configuration(hw); | 663 | _rtl92ee_phy_txpower_by_rate_configuration(hw); |
664 | if (!rtstatus) { | 664 | if (!rtstatus) { |
665 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!"); | 665 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n"); |
666 | return false; | 666 | return false; |
667 | } | 667 | } |
668 | rtstatus = phy_config_bb_with_hdr_file(hw, BASEBAND_CONFIG_AGC_TAB); | 668 | rtstatus = phy_config_bb_with_hdr_file(hw, BASEBAND_CONFIG_AGC_TAB); |
@@ -1189,7 +1189,7 @@ static u8 _rtl92ee_get_txpower_by_rate(struct ieee80211_hw *hw, | |||
1189 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1189 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1190 | struct rtl_phy *rtlphy = &rtlpriv->phy; | 1190 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
1191 | u8 shift = 0, sec, tx_num; | 1191 | u8 shift = 0, sec, tx_num; |
1192 | char diff = 0; | 1192 | s8 diff = 0; |
1193 | 1193 | ||
1194 | sec = _rtl92ee_phy_get_ratesection_intxpower_byrate(rf, rate); | 1194 | sec = _rtl92ee_phy_get_ratesection_intxpower_byrate(rf, rate); |
1195 | tx_num = RF_TX_NUM_NONIMPLEMENT; | 1195 | tx_num = RF_TX_NUM_NONIMPLEMENT; |
@@ -1265,14 +1265,14 @@ static u8 _rtl92ee_get_txpower_index(struct ieee80211_hw *hw, | |||
1265 | "Illegal channel!!\n"); | 1265 | "Illegal channel!!\n"); |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | if (IS_CCK_RATE(rate)) | 1268 | if (IS_CCK_RATE((s8)rate)) |
1269 | tx_power = rtlefuse->txpwrlevel_cck[rfpath][index]; | 1269 | tx_power = rtlefuse->txpwrlevel_cck[rfpath][index]; |
1270 | else if (DESC92C_RATE6M <= rate) | 1270 | else if (DESC92C_RATE6M <= rate) |
1271 | tx_power = rtlefuse->txpwrlevel_ht40_1s[rfpath][index]; | 1271 | tx_power = rtlefuse->txpwrlevel_ht40_1s[rfpath][index]; |
1272 | 1272 | ||
1273 | /* OFDM-1T*/ | 1273 | /* OFDM-1T*/ |
1274 | if (DESC92C_RATE6M <= rate && rate <= DESC92C_RATE54M && | 1274 | if (DESC92C_RATE6M <= rate && rate <= DESC92C_RATE54M && |
1275 | !IS_CCK_RATE(rate)) | 1275 | !IS_CCK_RATE((s8)rate)) |
1276 | tx_power += rtlefuse->txpwr_legacyhtdiff[rfpath][TX_1S]; | 1276 | tx_power += rtlefuse->txpwr_legacyhtdiff[rfpath][TX_1S]; |
1277 | 1277 | ||
1278 | /* BW20-1S, BW20-2S */ | 1278 | /* BW20-1S, BW20-2S */ |
@@ -1819,7 +1819,7 @@ u8 rtl92ee_phy_sw_chnl(struct ieee80211_hw *hw) | |||
1819 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { | 1819 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { |
1820 | rtl92ee_phy_sw_chnl_callback(hw); | 1820 | rtl92ee_phy_sw_chnl_callback(hw); |
1821 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, | 1821 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, |
1822 | "sw_chnl_inprogress false schdule workitem current channel %d\n", | 1822 | "sw_chnl_inprogress false schedule workitem current channel %d\n", |
1823 | rtlphy->current_channel); | 1823 | rtlphy->current_channel); |
1824 | rtlphy->sw_chnl_inprogress = false; | 1824 | rtlphy->sw_chnl_inprogress = false; |
1825 | } else { | 1825 | } else { |
@@ -2969,7 +2969,7 @@ void rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw) | |||
2969 | rtlphy->lck_inprogress = false; | 2969 | rtlphy->lck_inprogress = false; |
2970 | } | 2970 | } |
2971 | 2971 | ||
2972 | void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, char delta) | 2972 | void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta) |
2973 | { | 2973 | { |
2974 | } | 2974 | } |
2975 | 2975 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h index c6e97c8df54c..49bd0e554c65 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h | |||
@@ -141,7 +141,7 @@ void rtl92ee_phy_set_bw_mode(struct ieee80211_hw *hw, | |||
141 | void rtl92ee_phy_sw_chnl_callback(struct ieee80211_hw *hw); | 141 | void rtl92ee_phy_sw_chnl_callback(struct ieee80211_hw *hw); |
142 | u8 rtl92ee_phy_sw_chnl(struct ieee80211_hw *hw); | 142 | u8 rtl92ee_phy_sw_chnl(struct ieee80211_hw *hw); |
143 | void rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); | 143 | void rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); |
144 | void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 144 | void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta); |
145 | void rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw); | 145 | void rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw); |
146 | void rtl92ee_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 146 | void rtl92ee_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
147 | bool rtl92ee_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 147 | bool rtl92ee_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c index c9bc33cd1090..73716c07d433 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c | |||
@@ -142,7 +142,7 @@ static bool _rtl92ee_phy_rf6052_config_parafile(struct ieee80211_hw *hw) | |||
142 | 142 | ||
143 | if (!rtstatus) { | 143 | if (!rtstatus) { |
144 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 144 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
145 | "Radio[%d] Fail!!", rfpath); | 145 | "Radio[%d] Fail!!\n", rfpath); |
146 | return false; | 146 | return false; |
147 | } | 147 | } |
148 | } | 148 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c index 35e6bf7e233d..2d48ccd02ac8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | |||
@@ -56,7 +56,7 @@ static void _rtl92ee_query_rxphystatus(struct ieee80211_hw *hw, | |||
56 | { | 56 | { |
57 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 57 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
58 | struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo; | 58 | struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo; |
59 | char rx_pwr_all = 0, rx_pwr[4]; | 59 | s8 rx_pwr_all = 0, rx_pwr[4]; |
60 | u8 rf_rx_num = 0, evm, pwdb_all; | 60 | u8 rf_rx_num = 0, evm, pwdb_all; |
61 | u8 i, max_spatial_stream; | 61 | u8 i, max_spatial_stream; |
62 | u32 rssi, total_rssi = 0; | 62 | u32 rssi, total_rssi = 0; |
@@ -703,7 +703,7 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw, | |||
703 | PCI_DMA_TODEVICE); | 703 | PCI_DMA_TODEVICE); |
704 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 704 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
705 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 705 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
706 | "DMA mapping error"); | 706 | "DMA mapping error\n"); |
707 | return; | 707 | return; |
708 | } | 708 | } |
709 | 709 | ||
@@ -867,7 +867,7 @@ void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
867 | 867 | ||
868 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 868 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
869 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 869 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
870 | "DMA mapping error"); | 870 | "DMA mapping error\n"); |
871 | return; | 871 | return; |
872 | } | 872 | } |
873 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, txdesc_len); | 873 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, txdesc_len); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h index a4c38345233e..8053d1b12ec4 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h | |||
@@ -650,8 +650,8 @@ struct rx_fwinfo { | |||
650 | u8 pwdb_all; | 650 | u8 pwdb_all; |
651 | u8 cfosho[4]; | 651 | u8 cfosho[4]; |
652 | u8 cfotail[4]; | 652 | u8 cfotail[4]; |
653 | char rxevm[2]; | 653 | s8 rxevm[2]; |
654 | char rxsnr[4]; | 654 | s8 rxsnr[4]; |
655 | u8 pdsnr[2]; | 655 | u8 pdsnr[2]; |
656 | u8 csi_current[2]; | 656 | u8 csi_current[2]; |
657 | u8 csi_target[2]; | 657 | u8 csi_target[2]; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c index 442f2b68ee58..ddfa0aee5bf8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c | |||
@@ -2003,7 +2003,7 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw) | |||
2003 | rtlefuse->b1ss_support = rtlefuse->b1x1_recvcombine; | 2003 | rtlefuse->b1ss_support = rtlefuse->b1x1_recvcombine; |
2004 | rtlefuse->eeprom_oemid = *&hwinfo[EEPROM_CUSTOMID]; | 2004 | rtlefuse->eeprom_oemid = *&hwinfo[EEPROM_CUSTOMID]; |
2005 | 2005 | ||
2006 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x", | 2006 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n", |
2007 | rtlefuse->eeprom_oemid); | 2007 | rtlefuse->eeprom_oemid); |
2008 | 2008 | ||
2009 | /* set channel paln to world wide 13 */ | 2009 | /* set channel paln to world wide 13 */ |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c index 9475aa2a8fa0..34e88a3f6abe 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c | |||
@@ -137,7 +137,7 @@ static void _rtl92s_set_antennadiff(struct ieee80211_hw *hw, | |||
137 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 137 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
138 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 138 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
139 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 139 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
140 | char ant_pwr_diff = 0; | 140 | s8 ant_pwr_diff = 0; |
141 | u32 u4reg_val = 0; | 141 | u32 u4reg_val = 0; |
142 | 142 | ||
143 | if (rtlphy->rf_type == RF_2T2R) { | 143 | if (rtlphy->rf_type == RF_2T2R) { |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c index 125b29bd2f93..d53bbf6bef81 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c | |||
@@ -360,7 +360,7 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, | |||
360 | 360 | ||
361 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 361 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
362 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 362 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
363 | "DMA mapping error"); | 363 | "DMA mapping error\n"); |
364 | return; | 364 | return; |
365 | } | 365 | } |
366 | if (mac->opmode == NL80211_IFTYPE_STATION) { | 366 | if (mac->opmode == NL80211_IFTYPE_STATION) { |
@@ -529,7 +529,7 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, | |||
529 | 529 | ||
530 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 530 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
531 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 531 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
532 | "DMA mapping error"); | 532 | "DMA mapping error\n"); |
533 | return; | 533 | return; |
534 | } | 534 | } |
535 | /* Clear all status */ | 535 | /* Clear all status */ |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c index 4c1c96c96a5a..42a6fba90ba9 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c | |||
@@ -816,6 +816,7 @@ void rtl8723e_dm_watchdog(struct ieee80211_hw *hw) | |||
816 | if (ppsc->p2p_ps_info.p2p_ps_mode) | 816 | if (ppsc->p2p_ps_info.p2p_ps_mode) |
817 | fw_ps_awake = false; | 817 | fw_ps_awake = false; |
818 | 818 | ||
819 | spin_lock(&rtlpriv->locks.rf_ps_lock); | ||
819 | if ((ppsc->rfpwr_state == ERFON) && | 820 | if ((ppsc->rfpwr_state == ERFON) && |
820 | ((!fw_current_inpsmode) && fw_ps_awake) && | 821 | ((!fw_current_inpsmode) && fw_ps_awake) && |
821 | (!ppsc->rfchange_inprogress)) { | 822 | (!ppsc->rfchange_inprogress)) { |
@@ -829,6 +830,7 @@ void rtl8723e_dm_watchdog(struct ieee80211_hw *hw) | |||
829 | rtl8723e_dm_bt_coexist(hw); | 830 | rtl8723e_dm_bt_coexist(hw); |
830 | rtl8723e_dm_check_edca_turbo(hw); | 831 | rtl8723e_dm_check_edca_turbo(hw); |
831 | } | 832 | } |
833 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
832 | if (rtlpriv->btcoexist.init_set) | 834 | if (rtlpriv->btcoexist.init_set) |
833 | rtl_write_byte(rtlpriv, 0x76e, 0xc); | 835 | rtl_write_byte(rtlpriv, 0x76e, 0xc); |
834 | } | 836 | } |
@@ -874,8 +876,8 @@ void rtl8723e_dm_bt_coexist(struct ieee80211_hw *hw) | |||
874 | 876 | ||
875 | tmp_byte = rtl_read_byte(rtlpriv, 0x40); | 877 | tmp_byte = rtl_read_byte(rtlpriv, 0x40); |
876 | RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, | 878 | RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
877 | "[DM][BT], 0x40 is 0x%x", tmp_byte); | 879 | "[DM][BT], 0x40 is 0x%x\n", tmp_byte); |
878 | RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, | 880 | RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, |
879 | "[DM][BT], bt_dm_coexist start"); | 881 | "[DM][BT], bt_dm_coexist start\n"); |
880 | rtl8723e_dm_bt_coexist_8723(hw); | 882 | rtl8723e_dm_bt_coexist_8723(hw); |
881 | } | 883 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c index 44de695dc999..ec9bcf32f0ab 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c | |||
@@ -185,7 +185,7 @@ static void rtl8723e_dm_bt_set_hw_pta_mode(struct ieee80211_hw *hw, bool b_mode) | |||
185 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 185 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
186 | 186 | ||
187 | if (BT_PTA_MODE_ON == b_mode) { | 187 | if (BT_PTA_MODE_ON == b_mode) { |
188 | RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, "PTA mode on, "); | 188 | RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, "PTA mode on\n"); |
189 | /* Enable GPIO 0/1/2/3/8 pins for bt */ | 189 | /* Enable GPIO 0/1/2/3/8 pins for bt */ |
190 | rtl_write_byte(rtlpriv, 0x40, 0x20); | 190 | rtl_write_byte(rtlpriv, 0x40, 0x20); |
191 | rtlpriv->btcoexist.hw_coexist_all_off = false; | 191 | rtlpriv->btcoexist.hw_coexist_all_off = false; |
@@ -1401,7 +1401,7 @@ static void rtl8723e_dm_bt_inq_page_monitor(struct ieee80211_hw *hw) | |||
1401 | (long)hal_coex_8723.bt_inq_page_start_time) / HZ) | 1401 | (long)hal_coex_8723.bt_inq_page_start_time) / HZ) |
1402 | >= 10) { | 1402 | >= 10) { |
1403 | RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, | 1403 | RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, |
1404 | "[BTCoex], BT Inquiry/page >= 10sec!!!"); | 1404 | "[BTCoex], BT Inquiry/page >= 10sec!!!\n"); |
1405 | hal_coex_8723.bt_inq_page_start_time = 0; | 1405 | hal_coex_8723.bt_inq_page_start_time = 0; |
1406 | rtlpriv->btcoexist.cstate &= | 1406 | rtlpriv->btcoexist.cstate &= |
1407 | ~BT_COEX_STATE_BT_INQ_PAGE; | 1407 | ~BT_COEX_STATE_BT_INQ_PAGE; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c index 57a1ba8822b1..b88c7ee72dbf 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c | |||
@@ -1630,67 +1630,22 @@ static void _rtl8723e_read_adapter_info(struct ieee80211_hw *hw, | |||
1630 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1630 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1631 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 1631 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
1632 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 1632 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
1633 | struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev; | 1633 | int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID, |
1634 | u16 i, usvalue; | 1634 | EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, |
1635 | u8 hwinfo[HWSET_MAX_SIZE]; | 1635 | EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, |
1636 | u16 eeprom_id; | 1636 | COUNTRY_CODE_WORLD_WIDE_13}; |
1637 | u8 *hwinfo; | ||
1637 | 1638 | ||
1638 | if (b_pseudo_test) { | 1639 | if (b_pseudo_test) { |
1639 | /* need add */ | 1640 | /* need add */ |
1640 | return; | 1641 | return; |
1641 | } | 1642 | } |
1642 | switch (rtlefuse->epromtype) { | 1643 | hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); |
1643 | case EEPROM_BOOT_EFUSE: | 1644 | if (!hwinfo) |
1644 | rtl_efuse_shadow_map_update(hw); | ||
1645 | |||
1646 | case EEPROM_93C46: | ||
1647 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
1648 | "RTL819X Not boot from eeprom, check it !!"); | ||
1649 | return; | ||
1650 | |||
1651 | default: | ||
1652 | dev_warn(dev, "no efuse data\n"); | ||
1653 | } | ||
1654 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); | ||
1655 | |||
1656 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n", | ||
1657 | hwinfo, HWSET_MAX_SIZE); | ||
1658 | |||
1659 | eeprom_id = *((u16 *)&hwinfo[0]); | ||
1660 | if (eeprom_id != RTL8190_EEPROM_ID) { | ||
1661 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
1662 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
1663 | rtlefuse->autoload_failflag = true; | ||
1664 | } else { | ||
1665 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
1666 | rtlefuse->autoload_failflag = false; | ||
1667 | } | ||
1668 | |||
1669 | if (rtlefuse->autoload_failflag) | ||
1670 | return; | 1645 | return; |
1671 | 1646 | ||
1672 | rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; | 1647 | if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) |
1673 | rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; | 1648 | goto exit; |
1674 | rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; | ||
1675 | rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; | ||
1676 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1677 | "EEPROMId = 0x%4x\n", eeprom_id); | ||
1678 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1679 | "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); | ||
1680 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1681 | "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); | ||
1682 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1683 | "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); | ||
1684 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
1685 | "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); | ||
1686 | |||
1687 | for (i = 0; i < 6; i += 2) { | ||
1688 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; | ||
1689 | *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue; | ||
1690 | } | ||
1691 | |||
1692 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, | ||
1693 | "dev_addr: %pM\n", rtlefuse->dev_addr); | ||
1694 | 1649 | ||
1695 | _rtl8723e_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, | 1650 | _rtl8723e_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, |
1696 | hwinfo); | 1651 | hwinfo); |
@@ -1698,144 +1653,138 @@ static void _rtl8723e_read_adapter_info(struct ieee80211_hw *hw, | |||
1698 | rtl8723e_read_bt_coexist_info_from_hwpg(hw, | 1653 | rtl8723e_read_bt_coexist_info_from_hwpg(hw, |
1699 | rtlefuse->autoload_failflag, hwinfo); | 1654 | rtlefuse->autoload_failflag, hwinfo); |
1700 | 1655 | ||
1701 | rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; | 1656 | if (rtlhal->oem_id != RT_CID_DEFAULT) |
1702 | rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; | 1657 | return; |
1703 | rtlefuse->txpwr_fromeprom = true; | 1658 | |
1704 | rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; | 1659 | switch (rtlefuse->eeprom_oemid) { |
1705 | 1660 | case EEPROM_CID_DEFAULT: | |
1706 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | 1661 | switch (rtlefuse->eeprom_did) { |
1707 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); | 1662 | case 0x8176: |
1708 | 1663 | switch (rtlefuse->eeprom_svid) { | |
1709 | /* set channel paln to world wide 13 */ | 1664 | case 0x10EC: |
1710 | rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; | 1665 | switch (rtlefuse->eeprom_smid) { |
1711 | 1666 | case 0x6151 ... 0x6152: | |
1712 | if (rtlhal->oem_id == RT_CID_DEFAULT) { | 1667 | case 0x6154 ... 0x6155: |
1713 | switch (rtlefuse->eeprom_oemid) { | 1668 | case 0x6177 ... 0x6180: |
1714 | case EEPROM_CID_DEFAULT: | 1669 | case 0x7151 ... 0x7152: |
1715 | if (rtlefuse->eeprom_did == 0x8176) { | 1670 | case 0x7154 ... 0x7155: |
1716 | if (CHK_SVID_SMID(0x10EC, 0x6151) || | 1671 | case 0x7177 ... 0x7180: |
1717 | CHK_SVID_SMID(0x10EC, 0x6152) || | 1672 | case 0x8151 ... 0x8152: |
1718 | CHK_SVID_SMID(0x10EC, 0x6154) || | 1673 | case 0x8154 ... 0x8155: |
1719 | CHK_SVID_SMID(0x10EC, 0x6155) || | 1674 | case 0x8181 ... 0x8182: |
1720 | CHK_SVID_SMID(0x10EC, 0x6177) || | 1675 | case 0x8184 ... 0x8185: |
1721 | CHK_SVID_SMID(0x10EC, 0x6178) || | 1676 | case 0x9151 ... 0x9152: |
1722 | CHK_SVID_SMID(0x10EC, 0x6179) || | 1677 | case 0x9154 ... 0x9155: |
1723 | CHK_SVID_SMID(0x10EC, 0x6180) || | 1678 | case 0x9181 ... 0x9182: |
1724 | CHK_SVID_SMID(0x10EC, 0x7151) || | 1679 | case 0x9184 ... 0x9185: |
1725 | CHK_SVID_SMID(0x10EC, 0x7152) || | ||
1726 | CHK_SVID_SMID(0x10EC, 0x7154) || | ||
1727 | CHK_SVID_SMID(0x10EC, 0x7155) || | ||
1728 | CHK_SVID_SMID(0x10EC, 0x7177) || | ||
1729 | CHK_SVID_SMID(0x10EC, 0x7178) || | ||
1730 | CHK_SVID_SMID(0x10EC, 0x7179) || | ||
1731 | CHK_SVID_SMID(0x10EC, 0x7180) || | ||
1732 | CHK_SVID_SMID(0x10EC, 0x8151) || | ||
1733 | CHK_SVID_SMID(0x10EC, 0x8152) || | ||
1734 | CHK_SVID_SMID(0x10EC, 0x8154) || | ||
1735 | CHK_SVID_SMID(0x10EC, 0x8155) || | ||
1736 | CHK_SVID_SMID(0x10EC, 0x8181) || | ||
1737 | CHK_SVID_SMID(0x10EC, 0x8182) || | ||
1738 | CHK_SVID_SMID(0x10EC, 0x8184) || | ||
1739 | CHK_SVID_SMID(0x10EC, 0x8185) || | ||
1740 | CHK_SVID_SMID(0x10EC, 0x9151) || | ||
1741 | CHK_SVID_SMID(0x10EC, 0x9152) || | ||
1742 | CHK_SVID_SMID(0x10EC, 0x9154) || | ||
1743 | CHK_SVID_SMID(0x10EC, 0x9155) || | ||
1744 | CHK_SVID_SMID(0x10EC, 0x9181) || | ||
1745 | CHK_SVID_SMID(0x10EC, 0x9182) || | ||
1746 | CHK_SVID_SMID(0x10EC, 0x9184) || | ||
1747 | CHK_SVID_SMID(0x10EC, 0x9185)) | ||
1748 | rtlhal->oem_id = RT_CID_TOSHIBA; | 1680 | rtlhal->oem_id = RT_CID_TOSHIBA; |
1749 | else if (rtlefuse->eeprom_svid == 0x1025) | 1681 | break; |
1750 | rtlhal->oem_id = RT_CID_819X_ACER; | 1682 | case 0x6191 ... 0x6193: |
1751 | else if (CHK_SVID_SMID(0x10EC, 0x6191) || | 1683 | case 0x7191 ... 0x7193: |
1752 | CHK_SVID_SMID(0x10EC, 0x6192) || | 1684 | case 0x8191 ... 0x8193: |
1753 | CHK_SVID_SMID(0x10EC, 0x6193) || | 1685 | case 0x9191 ... 0x9193: |
1754 | CHK_SVID_SMID(0x10EC, 0x7191) || | ||
1755 | CHK_SVID_SMID(0x10EC, 0x7192) || | ||
1756 | CHK_SVID_SMID(0x10EC, 0x7193) || | ||
1757 | CHK_SVID_SMID(0x10EC, 0x8191) || | ||
1758 | CHK_SVID_SMID(0x10EC, 0x8192) || | ||
1759 | CHK_SVID_SMID(0x10EC, 0x8193) || | ||
1760 | CHK_SVID_SMID(0x10EC, 0x9191) || | ||
1761 | CHK_SVID_SMID(0x10EC, 0x9192) || | ||
1762 | CHK_SVID_SMID(0x10EC, 0x9193)) | ||
1763 | rtlhal->oem_id = RT_CID_819X_SAMSUNG; | 1686 | rtlhal->oem_id = RT_CID_819X_SAMSUNG; |
1764 | else if (CHK_SVID_SMID(0x10EC, 0x8195) || | 1687 | break; |
1765 | CHK_SVID_SMID(0x10EC, 0x9195) || | 1688 | case 0x8197: |
1766 | CHK_SVID_SMID(0x10EC, 0x7194) || | 1689 | case 0x9196: |
1767 | CHK_SVID_SMID(0x10EC, 0x8200) || | ||
1768 | CHK_SVID_SMID(0x10EC, 0x8201) || | ||
1769 | CHK_SVID_SMID(0x10EC, 0x8202) || | ||
1770 | CHK_SVID_SMID(0x10EC, 0x9200)) | ||
1771 | rtlhal->oem_id = RT_CID_819X_LENOVO; | ||
1772 | else if (CHK_SVID_SMID(0x10EC, 0x8197) || | ||
1773 | CHK_SVID_SMID(0x10EC, 0x9196)) | ||
1774 | rtlhal->oem_id = RT_CID_819X_CLEVO; | 1690 | rtlhal->oem_id = RT_CID_819X_CLEVO; |
1775 | else if (CHK_SVID_SMID(0x1028, 0x8194) || | 1691 | break; |
1776 | CHK_SVID_SMID(0x1028, 0x8198) || | 1692 | case 0x8203: |
1777 | CHK_SVID_SMID(0x1028, 0x9197) || | 1693 | rtlhal->oem_id = RT_CID_819X_PRONETS; |
1778 | CHK_SVID_SMID(0x1028, 0x9198)) | 1694 | break; |
1695 | case 0x8195: | ||
1696 | case 0x9195: | ||
1697 | case 0x7194: | ||
1698 | case 0x8200 ... 0x8202: | ||
1699 | case 0x9200: | ||
1700 | rtlhal->oem_id = RT_CID_819X_LENOVO; | ||
1701 | break; | ||
1702 | } | ||
1703 | case 0x1025: | ||
1704 | rtlhal->oem_id = RT_CID_819X_ACER; | ||
1705 | break; | ||
1706 | case 0x1028: | ||
1707 | switch (rtlefuse->eeprom_smid) { | ||
1708 | case 0x8194: | ||
1709 | case 0x8198: | ||
1710 | case 0x9197 ... 0x9198: | ||
1779 | rtlhal->oem_id = RT_CID_819X_DELL; | 1711 | rtlhal->oem_id = RT_CID_819X_DELL; |
1780 | else if (CHK_SVID_SMID(0x103C, 0x1629)) | 1712 | break; |
1713 | } | ||
1714 | break; | ||
1715 | case 0x103C: | ||
1716 | switch (rtlefuse->eeprom_smid) { | ||
1717 | case 0x1629: | ||
1781 | rtlhal->oem_id = RT_CID_819X_HP; | 1718 | rtlhal->oem_id = RT_CID_819X_HP; |
1782 | else if (CHK_SVID_SMID(0x1A32, 0x2315)) | 1719 | } |
1720 | break; | ||
1721 | case 0x1A32: | ||
1722 | switch (rtlefuse->eeprom_smid) { | ||
1723 | case 0x2315: | ||
1783 | rtlhal->oem_id = RT_CID_819X_QMI; | 1724 | rtlhal->oem_id = RT_CID_819X_QMI; |
1784 | else if (CHK_SVID_SMID(0x10EC, 0x8203)) | 1725 | break; |
1785 | rtlhal->oem_id = RT_CID_819X_PRONETS; | 1726 | } |
1786 | else if (CHK_SVID_SMID(0x1043, 0x84B5)) | 1727 | break; |
1787 | rtlhal->oem_id = | 1728 | case 0x1043: |
1788 | RT_CID_819X_EDIMAX_ASUS; | 1729 | switch (rtlefuse->eeprom_smid) { |
1789 | else | 1730 | case 0x84B5: |
1790 | rtlhal->oem_id = RT_CID_DEFAULT; | ||
1791 | } else if (rtlefuse->eeprom_did == 0x8178) { | ||
1792 | if (CHK_SVID_SMID(0x10EC, 0x6181) || | ||
1793 | CHK_SVID_SMID(0x10EC, 0x6182) || | ||
1794 | CHK_SVID_SMID(0x10EC, 0x6184) || | ||
1795 | CHK_SVID_SMID(0x10EC, 0x6185) || | ||
1796 | CHK_SVID_SMID(0x10EC, 0x7181) || | ||
1797 | CHK_SVID_SMID(0x10EC, 0x7182) || | ||
1798 | CHK_SVID_SMID(0x10EC, 0x7184) || | ||
1799 | CHK_SVID_SMID(0x10EC, 0x7185) || | ||
1800 | CHK_SVID_SMID(0x10EC, 0x8181) || | ||
1801 | CHK_SVID_SMID(0x10EC, 0x8182) || | ||
1802 | CHK_SVID_SMID(0x10EC, 0x8184) || | ||
1803 | CHK_SVID_SMID(0x10EC, 0x8185) || | ||
1804 | CHK_SVID_SMID(0x10EC, 0x9181) || | ||
1805 | CHK_SVID_SMID(0x10EC, 0x9182) || | ||
1806 | CHK_SVID_SMID(0x10EC, 0x9184) || | ||
1807 | CHK_SVID_SMID(0x10EC, 0x9185)) | ||
1808 | rtlhal->oem_id = RT_CID_TOSHIBA; | ||
1809 | else if (rtlefuse->eeprom_svid == 0x1025) | ||
1810 | rtlhal->oem_id = RT_CID_819X_ACER; | ||
1811 | else if (CHK_SVID_SMID(0x10EC, 0x8186)) | ||
1812 | rtlhal->oem_id = RT_CID_819X_PRONETS; | ||
1813 | else if (CHK_SVID_SMID(0x1043, 0x8486)) | ||
1814 | rtlhal->oem_id = | 1731 | rtlhal->oem_id = |
1815 | RT_CID_819X_EDIMAX_ASUS; | 1732 | RT_CID_819X_EDIMAX_ASUS; |
1816 | else | 1733 | } |
1817 | rtlhal->oem_id = RT_CID_DEFAULT; | 1734 | break; |
1818 | } else { | ||
1819 | rtlhal->oem_id = RT_CID_DEFAULT; | ||
1820 | } | 1735 | } |
1821 | break; | 1736 | break; |
1822 | case EEPROM_CID_TOSHIBA: | 1737 | case 0x8178: |
1823 | rtlhal->oem_id = RT_CID_TOSHIBA; | 1738 | switch (rtlefuse->eeprom_svid) { |
1824 | break; | 1739 | case 0x10ec: |
1825 | case EEPROM_CID_CCX: | 1740 | switch (rtlefuse->eeprom_smid) { |
1826 | rtlhal->oem_id = RT_CID_CCX; | 1741 | case 0x6181 ... 0x6182: |
1827 | break; | 1742 | case 0x6184 ... 0x6185: |
1828 | case EEPROM_CID_QMI: | 1743 | case 0x7181 ... 0x7182: |
1829 | rtlhal->oem_id = RT_CID_819X_QMI; | 1744 | case 0x7184 ... 0x7185: |
1830 | break; | 1745 | case 0x8181 ... 0x8182: |
1831 | case EEPROM_CID_WHQL: | 1746 | case 0x8184 ... 0x8185: |
1747 | case 0x9181 ... 0x9182: | ||
1748 | case 0x9184 ... 0x9185: | ||
1749 | rtlhal->oem_id = RT_CID_TOSHIBA; | ||
1750 | break; | ||
1751 | case 0x8186: | ||
1752 | rtlhal->oem_id = | ||
1753 | RT_CID_819X_PRONETS; | ||
1754 | break; | ||
1755 | } | ||
1832 | break; | 1756 | break; |
1833 | default: | 1757 | case 0x1025: |
1834 | rtlhal->oem_id = RT_CID_DEFAULT; | 1758 | rtlhal->oem_id = RT_CID_819X_ACER; |
1759 | break; | ||
1760 | case 0x1043: | ||
1761 | switch (rtlefuse->eeprom_smid) { | ||
1762 | case 0x8486: | ||
1763 | rtlhal->oem_id = | ||
1764 | RT_CID_819X_EDIMAX_ASUS; | ||
1765 | } | ||
1766 | break; | ||
1767 | } | ||
1835 | break; | 1768 | break; |
1836 | |||
1837 | } | 1769 | } |
1770 | break; | ||
1771 | case EEPROM_CID_TOSHIBA: | ||
1772 | rtlhal->oem_id = RT_CID_TOSHIBA; | ||
1773 | break; | ||
1774 | case EEPROM_CID_CCX: | ||
1775 | rtlhal->oem_id = RT_CID_CCX; | ||
1776 | break; | ||
1777 | case EEPROM_CID_QMI: | ||
1778 | rtlhal->oem_id = RT_CID_819X_QMI; | ||
1779 | break; | ||
1780 | case EEPROM_CID_WHQL: | ||
1781 | break; | ||
1782 | default: | ||
1783 | rtlhal->oem_id = RT_CID_DEFAULT; | ||
1784 | break; | ||
1838 | } | 1785 | } |
1786 | exit: | ||
1787 | kfree(hwinfo); | ||
1839 | } | 1788 | } |
1840 | 1789 | ||
1841 | static void _rtl8723e_hal_customized_behavior(struct ieee80211_hw *hw) | 1790 | static void _rtl8723e_hal_customized_behavior(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c index d367097f490b..601b78efedfb 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c | |||
@@ -213,7 +213,7 @@ static bool _rtl8723e_phy_bb8192c_config_parafile(struct ieee80211_hw *hw) | |||
213 | rtstatus = _rtl8723e_phy_config_bb_with_headerfile(hw, | 213 | rtstatus = _rtl8723e_phy_config_bb_with_headerfile(hw, |
214 | BASEBAND_CONFIG_PHY_REG); | 214 | BASEBAND_CONFIG_PHY_REG); |
215 | if (rtstatus != true) { | 215 | if (rtstatus != true) { |
216 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!"); | 216 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n"); |
217 | return false; | 217 | return false; |
218 | } | 218 | } |
219 | 219 | ||
@@ -227,7 +227,7 @@ static bool _rtl8723e_phy_bb8192c_config_parafile(struct ieee80211_hw *hw) | |||
227 | BASEBAND_CONFIG_PHY_REG); | 227 | BASEBAND_CONFIG_PHY_REG); |
228 | } | 228 | } |
229 | if (rtstatus != true) { | 229 | if (rtstatus != true) { |
230 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!"); | 230 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n"); |
231 | return false; | 231 | return false; |
232 | } | 232 | } |
233 | rtstatus = | 233 | rtstatus = |
@@ -893,7 +893,7 @@ u8 rtl8723e_phy_sw_chnl(struct ieee80211_hw *hw) | |||
893 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { | 893 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { |
894 | rtl8723e_phy_sw_chnl_callback(hw); | 894 | rtl8723e_phy_sw_chnl_callback(hw); |
895 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, | 895 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, |
896 | "sw_chnl_inprogress false schdule workitem\n"); | 896 | "sw_chnl_inprogress false schedule workitem\n"); |
897 | rtlphy->sw_chnl_inprogress = false; | 897 | rtlphy->sw_chnl_inprogress = false; |
898 | } else { | 898 | } else { |
899 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, | 899 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c index 9ebc8281ff99..422771778e03 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c | |||
@@ -504,7 +504,7 @@ static bool _rtl8723e_phy_rf6052_config_parafile(struct ieee80211_hw *hw) | |||
504 | 504 | ||
505 | if (rtstatus != true) { | 505 | if (rtstatus != true) { |
506 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 506 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
507 | "Radio[%d] Fail!!", rfpath); | 507 | "Radio[%d] Fail!!\n", rfpath); |
508 | return false; | 508 | return false; |
509 | } | 509 | } |
510 | } | 510 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c index 7b4a9b63583b..e93125ebed81 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c | |||
@@ -389,7 +389,7 @@ void rtl8723e_tx_fill_desc(struct ieee80211_hw *hw, | |||
389 | 389 | ||
390 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 390 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
391 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 391 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
392 | "DMA mapping error"); | 392 | "DMA mapping error\n"); |
393 | return; | 393 | return; |
394 | } | 394 | } |
395 | if (mac->opmode == NL80211_IFTYPE_STATION) { | 395 | if (mac->opmode == NL80211_IFTYPE_STATION) { |
@@ -557,7 +557,7 @@ void rtl8723e_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
557 | 557 | ||
558 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 558 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
559 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 559 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
560 | "DMA mapping error"); | 560 | "DMA mapping error\n"); |
561 | return; | 561 | return; |
562 | } | 562 | } |
563 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 563 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h index 32970bf18856..43d4c791d563 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h | |||
@@ -522,8 +522,8 @@ struct rx_fwinfo_8723e { | |||
522 | u8 pwdb_all; | 522 | u8 pwdb_all; |
523 | u8 cfosho[4]; | 523 | u8 cfosho[4]; |
524 | u8 cfotail[4]; | 524 | u8 cfotail[4]; |
525 | char rxevm[2]; | 525 | s8 rxevm[2]; |
526 | char rxsnr[4]; | 526 | s8 rxsnr[4]; |
527 | u8 pdsnr[2]; | 527 | u8 pdsnr[2]; |
528 | u8 csi_current[2]; | 528 | u8 csi_current[2]; |
529 | u8 csi_target[2]; | 529 | u8 csi_target[2]; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c index 3a81cdba8ca3..131c0d1d633e 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c | |||
@@ -758,11 +758,11 @@ static void rtl8723be_dm_txpower_tracking_callback_thermalmeter( | |||
758 | u8 ofdm_min_index = 6; | 758 | u8 ofdm_min_index = 6; |
759 | u8 index_for_channel = 0; | 759 | u8 index_for_channel = 0; |
760 | 760 | ||
761 | char delta_swing_table_idx_tup_a[TXSCALE_TABLE_SIZE] = { | 761 | s8 delta_swing_table_idx_tup_a[TXSCALE_TABLE_SIZE] = { |
762 | 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, | 762 | 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, |
763 | 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, | 763 | 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, |
764 | 10, 11, 11, 12, 12, 13, 14, 15}; | 764 | 10, 11, 11, 12, 12, 13, 14, 15}; |
765 | char delta_swing_table_idx_tdown_a[TXSCALE_TABLE_SIZE] = { | 765 | s8 delta_swing_table_idx_tdown_a[TXSCALE_TABLE_SIZE] = { |
766 | 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, | 766 | 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, |
767 | 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, | 767 | 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, |
768 | 9, 10, 10, 11, 12, 13, 14, 15}; | 768 | 9, 10, 10, 11, 12, 13, 14, 15}; |
@@ -1279,6 +1279,7 @@ void rtl8723be_dm_watchdog(struct ieee80211_hw *hw) | |||
1279 | if (ppsc->p2p_ps_info.p2p_ps_mode) | 1279 | if (ppsc->p2p_ps_info.p2p_ps_mode) |
1280 | fw_ps_awake = false; | 1280 | fw_ps_awake = false; |
1281 | 1281 | ||
1282 | spin_lock(&rtlpriv->locks.rf_ps_lock); | ||
1282 | if ((ppsc->rfpwr_state == ERFON) && | 1283 | if ((ppsc->rfpwr_state == ERFON) && |
1283 | ((!fw_current_inpsmode) && fw_ps_awake) && | 1284 | ((!fw_current_inpsmode) && fw_ps_awake) && |
1284 | (!ppsc->rfchange_inprogress)) { | 1285 | (!ppsc->rfchange_inprogress)) { |
@@ -1294,5 +1295,6 @@ void rtl8723be_dm_watchdog(struct ieee80211_hw *hw) | |||
1294 | rtl8723be_dm_check_txpower_tracking(hw); | 1295 | rtl8723be_dm_check_txpower_tracking(hw); |
1295 | rtl8723be_dm_dynamic_txpower(hw); | 1296 | rtl8723be_dm_dynamic_txpower(hw); |
1296 | } | 1297 | } |
1298 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
1297 | rtlpriv->dm.dbginfo.num_qry_beacon_pkt = 0; | 1299 | rtlpriv->dm.dbginfo.num_qry_beacon_pkt = 0; |
1298 | } | 1300 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c index 08288ac9020a..82e4476cab23 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | |||
@@ -1474,7 +1474,7 @@ static enum version_8723e _rtl8723be_read_chip_version(struct ieee80211_hw *hw) | |||
1474 | 1474 | ||
1475 | value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG1); | 1475 | value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG1); |
1476 | if ((value32 & (CHIP_8723B)) != CHIP_8723B) | 1476 | if ((value32 & (CHIP_8723B)) != CHIP_8723B) |
1477 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "unkown chip version\n"); | 1477 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "unknown chip version\n"); |
1478 | else | 1478 | else |
1479 | version = (enum version_8723e)CHIP_8723B; | 1479 | version = (enum version_8723e)CHIP_8723B; |
1480 | 1480 | ||
@@ -2026,10 +2026,12 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, | |||
2026 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 2026 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2027 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 2027 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
2028 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 2028 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
2029 | struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev; | 2029 | int params[] = {RTL8723BE_EEPROM_ID, EEPROM_VID, EEPROM_DID, |
2030 | u16 i, usvalue; | 2030 | EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, |
2031 | u8 hwinfo[HWSET_MAX_SIZE]; | 2031 | EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, |
2032 | u16 eeprom_id; | 2032 | COUNTRY_CODE_WORLD_WIDE_13}; |
2033 | u8 *hwinfo; | ||
2034 | int i; | ||
2033 | bool is_toshiba_smid1 = false; | 2035 | bool is_toshiba_smid1 = false; |
2034 | bool is_toshiba_smid2 = false; | 2036 | bool is_toshiba_smid2 = false; |
2035 | bool is_samsung_smid = false; | 2037 | bool is_samsung_smid = false; |
@@ -2057,58 +2059,12 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, | |||
2057 | return; | 2059 | return; |
2058 | } | 2060 | } |
2059 | 2061 | ||
2060 | switch (rtlefuse->epromtype) { | 2062 | hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); |
2061 | case EEPROM_BOOT_EFUSE: | 2063 | if (!hwinfo) |
2062 | rtl_efuse_shadow_map_update(hw); | ||
2063 | break; | ||
2064 | |||
2065 | case EEPROM_93C46: | ||
2066 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
2067 | "RTL819X Not boot from eeprom, check it !!"); | ||
2068 | return; | 2064 | return; |
2069 | 2065 | ||
2070 | default: | 2066 | if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) |
2071 | dev_warn(dev, "no efuse data\n"); | 2067 | goto exit; |
2072 | return; | ||
2073 | } | ||
2074 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); | ||
2075 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP\n"), | ||
2076 | hwinfo, HWSET_MAX_SIZE); | ||
2077 | |||
2078 | eeprom_id = *((u16 *)&hwinfo[0]); | ||
2079 | if (eeprom_id != RTL8723BE_EEPROM_ID) { | ||
2080 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
2081 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
2082 | rtlefuse->autoload_failflag = true; | ||
2083 | } else { | ||
2084 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
2085 | rtlefuse->autoload_failflag = false; | ||
2086 | } | ||
2087 | |||
2088 | if (rtlefuse->autoload_failflag) | ||
2089 | return; | ||
2090 | |||
2091 | rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; | ||
2092 | rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; | ||
2093 | rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; | ||
2094 | rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; | ||
2095 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2096 | "EEPROMId = 0x%4x\n", eeprom_id); | ||
2097 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2098 | "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); | ||
2099 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2100 | "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); | ||
2101 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2102 | "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); | ||
2103 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2104 | "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); | ||
2105 | |||
2106 | for (i = 0; i < 6; i += 2) { | ||
2107 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; | ||
2108 | *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue; | ||
2109 | } | ||
2110 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "dev_addr: %pM\n", | ||
2111 | rtlefuse->dev_addr); | ||
2112 | 2068 | ||
2113 | /*parse xtal*/ | 2069 | /*parse xtal*/ |
2114 | rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_8723BE]; | 2070 | rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_8723BE]; |
@@ -2122,14 +2078,6 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, | |||
2122 | rtlefuse->autoload_failflag, | 2078 | rtlefuse->autoload_failflag, |
2123 | hwinfo); | 2079 | hwinfo); |
2124 | 2080 | ||
2125 | rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; | ||
2126 | rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; | ||
2127 | rtlefuse->txpwr_fromeprom = true; | ||
2128 | rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; | ||
2129 | |||
2130 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
2131 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); | ||
2132 | |||
2133 | /* set channel plan from efuse */ | 2081 | /* set channel plan from efuse */ |
2134 | rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; | 2082 | rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; |
2135 | 2083 | ||
@@ -2240,6 +2188,8 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, | |||
2240 | break; | 2188 | break; |
2241 | } | 2189 | } |
2242 | } | 2190 | } |
2191 | exit: | ||
2192 | kfree(hwinfo); | ||
2243 | } | 2193 | } |
2244 | 2194 | ||
2245 | static void _rtl8723be_hal_customized_behavior(struct ieee80211_hw *hw) | 2195 | static void _rtl8723be_hal_customized_behavior(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c index c5ca9dfb445c..285818df149b 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c | |||
@@ -379,7 +379,7 @@ static void _rtl8723be_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw) | |||
379 | static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start, | 379 | static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start, |
380 | u8 end, u8 base_val) | 380 | u8 end, u8 base_val) |
381 | { | 381 | { |
382 | char i = 0; | 382 | s8 i = 0; |
383 | u8 temp_value = 0; | 383 | u8 temp_value = 0; |
384 | u32 temp_data = 0; | 384 | u32 temp_data = 0; |
385 | 385 | ||
@@ -467,7 +467,7 @@ static bool _rtl8723be_phy_bb8723b_config_parafile(struct ieee80211_hw *hw) | |||
467 | rtstatus = _rtl8723be_phy_config_bb_with_headerfile(hw, | 467 | rtstatus = _rtl8723be_phy_config_bb_with_headerfile(hw, |
468 | BASEBAND_CONFIG_PHY_REG); | 468 | BASEBAND_CONFIG_PHY_REG); |
469 | if (!rtstatus) { | 469 | if (!rtstatus) { |
470 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!"); | 470 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n"); |
471 | return false; | 471 | return false; |
472 | } | 472 | } |
473 | _rtl8723be_phy_init_tx_power_by_rate(hw); | 473 | _rtl8723be_phy_init_tx_power_by_rate(hw); |
@@ -478,7 +478,7 @@ static bool _rtl8723be_phy_bb8723b_config_parafile(struct ieee80211_hw *hw) | |||
478 | } | 478 | } |
479 | phy_txpower_by_rate_config(hw); | 479 | phy_txpower_by_rate_config(hw); |
480 | if (!rtstatus) { | 480 | if (!rtstatus) { |
481 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!"); | 481 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n"); |
482 | return false; | 482 | return false; |
483 | } | 483 | } |
484 | rtstatus = _rtl8723be_phy_config_bb_with_headerfile(hw, | 484 | rtstatus = _rtl8723be_phy_config_bb_with_headerfile(hw, |
@@ -953,7 +953,7 @@ static u8 _rtl8723be_get_txpower_by_rate(struct ieee80211_hw *hw, | |||
953 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 953 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
954 | struct rtl_phy *rtlphy = &rtlpriv->phy; | 954 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
955 | u8 shift = 0, rate_section, tx_num; | 955 | u8 shift = 0, rate_section, tx_num; |
956 | char tx_pwr_diff = 0; | 956 | s8 tx_pwr_diff = 0; |
957 | 957 | ||
958 | rate_section = _rtl8723be_phy_get_ratesection_intxpower_byrate(rfpath, | 958 | rate_section = _rtl8723be_phy_get_ratesection_intxpower_byrate(rfpath, |
959 | rate); | 959 | rate); |
@@ -1395,7 +1395,7 @@ u8 rtl8723be_phy_sw_chnl(struct ieee80211_hw *hw) | |||
1395 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { | 1395 | if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { |
1396 | rtl8723be_phy_sw_chnl_callback(hw); | 1396 | rtl8723be_phy_sw_chnl_callback(hw); |
1397 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, | 1397 | RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, |
1398 | "sw_chnl_inprogress false schdule workitem current channel %d\n", | 1398 | "sw_chnl_inprogress false schedule workitem current channel %d\n", |
1399 | rtlphy->current_channel); | 1399 | rtlphy->current_channel); |
1400 | rtlphy->sw_chnl_inprogress = false; | 1400 | rtlphy->sw_chnl_inprogress = false; |
1401 | } else { | 1401 | } else { |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c index 97f5a0377e7a..78f4f18d87b5 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c | |||
@@ -502,7 +502,7 @@ static bool _rtl8723be_phy_rf6052_config_parafile(struct ieee80211_hw *hw) | |||
502 | 502 | ||
503 | if (!rtstatus) { | 503 | if (!rtstatus) { |
504 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 504 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
505 | "Radio[%d] Fail!!", rfpath); | 505 | "Radio[%d] Fail!!\n", rfpath); |
506 | return false; | 506 | return false; |
507 | } | 507 | } |
508 | } | 508 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c index 60345975f9fd..2175aecbb8f4 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c | |||
@@ -56,7 +56,7 @@ static void _rtl8723be_query_rxphystatus(struct ieee80211_hw *hw, | |||
56 | { | 56 | { |
57 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 57 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
58 | struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo; | 58 | struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo; |
59 | char rx_pwr_all = 0, rx_pwr[4]; | 59 | s8 rx_pwr_all = 0, rx_pwr[4]; |
60 | u8 rf_rx_num = 0, evm, pwdb_all, pwdb_all_bt = 0; | 60 | u8 rf_rx_num = 0, evm, pwdb_all, pwdb_all_bt = 0; |
61 | u8 i, max_spatial_stream; | 61 | u8 i, max_spatial_stream; |
62 | u32 rssi, total_rssi = 0; | 62 | u32 rssi, total_rssi = 0; |
@@ -464,7 +464,7 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw, | |||
464 | mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, | 464 | mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, |
465 | PCI_DMA_TODEVICE); | 465 | PCI_DMA_TODEVICE); |
466 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 466 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
467 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "DMA mapping error"); | 467 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "DMA mapping error\n"); |
468 | return; | 468 | return; |
469 | } | 469 | } |
470 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_8723be)); | 470 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_8723be)); |
@@ -616,7 +616,7 @@ void rtl8723be_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, | |||
616 | 616 | ||
617 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 617 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
618 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 618 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
619 | "DMA mapping error"); | 619 | "DMA mapping error\n"); |
620 | return; | 620 | return; |
621 | } | 621 | } |
622 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 622 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h index 40c36607b8b9..8a9fe41ac15b 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h | |||
@@ -385,9 +385,9 @@ struct phy_status_rpt { | |||
385 | u8 cck_rpt_b_ofdm_cfosho_b; | 385 | u8 cck_rpt_b_ofdm_cfosho_b; |
386 | u8 rsvd_1;/* ch_corr_msb; */ | 386 | u8 rsvd_1;/* ch_corr_msb; */ |
387 | u8 noise_power_db_msb; | 387 | u8 noise_power_db_msb; |
388 | char path_cfotail[2]; | 388 | s8 path_cfotail[2]; |
389 | u8 pcts_mask[2]; | 389 | u8 pcts_mask[2]; |
390 | char stream_rxevm[2]; | 390 | s8 stream_rxevm[2]; |
391 | u8 path_rxsnr[2]; | 391 | u8 path_rxsnr[2]; |
392 | u8 noise_power_db_lsb; | 392 | u8 noise_power_db_lsb; |
393 | u8 rsvd_2[3]; | 393 | u8 rsvd_2[3]; |
@@ -422,8 +422,8 @@ struct rx_fwinfo_8723be { | |||
422 | u8 pwdb_all; | 422 | u8 pwdb_all; |
423 | u8 cfosho[4]; | 423 | u8 cfosho[4]; |
424 | u8 cfotail[4]; | 424 | u8 cfotail[4]; |
425 | char rxevm[2]; | 425 | s8 rxevm[2]; |
426 | char rxsnr[2]; | 426 | s8 rxsnr[2]; |
427 | u8 pcts_msk_rpt[2]; | 427 | u8 pcts_msk_rpt[2]; |
428 | u8 pdsnr[2]; | 428 | u8 pdsnr[2]; |
429 | u8 csi_current[2]; | 429 | u8 csi_current[2]; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c index 17a681788611..bdfd444955d2 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c | |||
@@ -843,7 +843,7 @@ static void rtl8821ae_dm_dig(struct ieee80211_hw *hw) | |||
843 | dm_digtable->rssi_val_min + offset; | 843 | dm_digtable->rssi_val_min + offset; |
844 | 844 | ||
845 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 845 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
846 | "dm_digtable->rssi_val_min=0x%x,dm_digtable->rx_gain_max = 0x%x", | 846 | "dm_digtable->rssi_val_min=0x%x,dm_digtable->rx_gain_max = 0x%x\n", |
847 | dm_digtable->rssi_val_min, | 847 | dm_digtable->rssi_val_min, |
848 | dm_digtable->rx_gain_max); | 848 | dm_digtable->rx_gain_max); |
849 | if (rtlpriv->dm.one_entry_only) { | 849 | if (rtlpriv->dm.one_entry_only) { |
@@ -1355,7 +1355,7 @@ void rtl8812ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, | |||
1355 | u32 final_swing_idx[2]; | 1355 | u32 final_swing_idx[2]; |
1356 | u8 pwr_tracking_limit = 26; /*+1.0dB*/ | 1356 | u8 pwr_tracking_limit = 26; /*+1.0dB*/ |
1357 | u8 tx_rate = 0xFF; | 1357 | u8 tx_rate = 0xFF; |
1358 | char final_ofdm_swing_index = 0; | 1358 | s8 final_ofdm_swing_index = 0; |
1359 | 1359 | ||
1360 | if (rtldm->tx_rate != 0xFF) | 1360 | if (rtldm->tx_rate != 0xFF) |
1361 | tx_rate = | 1361 | tx_rate = |
@@ -2045,7 +2045,7 @@ void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, | |||
2045 | u32 final_swing_idx[1]; | 2045 | u32 final_swing_idx[1]; |
2046 | u8 pwr_tracking_limit = 26; /*+1.0dB*/ | 2046 | u8 pwr_tracking_limit = 26; /*+1.0dB*/ |
2047 | u8 tx_rate = 0xFF; | 2047 | u8 tx_rate = 0xFF; |
2048 | char final_ofdm_swing_index = 0; | 2048 | s8 final_ofdm_swing_index = 0; |
2049 | 2049 | ||
2050 | if (rtldm->tx_rate != 0xFF) | 2050 | if (rtldm->tx_rate != 0xFF) |
2051 | tx_rate = rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate); | 2051 | tx_rate = rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate); |
@@ -2682,9 +2682,9 @@ static void rtl8821ae_dm_check_edca_turbo(struct ieee80211_hw *hw) | |||
2682 | bool b_edca_turbo_on = false; | 2682 | bool b_edca_turbo_on = false; |
2683 | 2683 | ||
2684 | RT_TRACE(rtlpriv, COMP_TURBO, DBG_LOUD, | 2684 | RT_TRACE(rtlpriv, COMP_TURBO, DBG_LOUD, |
2685 | "rtl8821ae_dm_check_edca_turbo=====>"); | 2685 | "rtl8821ae_dm_check_edca_turbo=====>\n"); |
2686 | RT_TRACE(rtlpriv, COMP_TURBO, DBG_LOUD, | 2686 | RT_TRACE(rtlpriv, COMP_TURBO, DBG_LOUD, |
2687 | "Orginial BE PARAM: 0x%x\n", | 2687 | "Original BE PARAM: 0x%x\n", |
2688 | rtl_read_dword(rtlpriv, DM_REG_EDCA_BE_11N)); | 2688 | rtl_read_dword(rtlpriv, DM_REG_EDCA_BE_11N)); |
2689 | 2689 | ||
2690 | if (rtlpriv->dm.dbginfo.num_non_be_pkt > 0x100) | 2690 | if (rtlpriv->dm.dbginfo.num_non_be_pkt > 0x100) |
@@ -2949,6 +2949,7 @@ void rtl8821ae_dm_watchdog(struct ieee80211_hw *hw) | |||
2949 | if (ppsc->p2p_ps_info.p2p_ps_mode) | 2949 | if (ppsc->p2p_ps_info.p2p_ps_mode) |
2950 | fw_ps_awake = false; | 2950 | fw_ps_awake = false; |
2951 | 2951 | ||
2952 | spin_lock(&rtlpriv->locks.rf_ps_lock); | ||
2952 | if ((ppsc->rfpwr_state == ERFON) && | 2953 | if ((ppsc->rfpwr_state == ERFON) && |
2953 | ((!fw_current_inpsmode) && fw_ps_awake) && | 2954 | ((!fw_current_inpsmode) && fw_ps_awake) && |
2954 | (!ppsc->rfchange_inprogress)) { | 2955 | (!ppsc->rfchange_inprogress)) { |
@@ -2967,6 +2968,7 @@ void rtl8821ae_dm_watchdog(struct ieee80211_hw *hw) | |||
2967 | rtl8821ae_dm_check_txpower_tracking_thermalmeter(hw); | 2968 | rtl8821ae_dm_check_txpower_tracking_thermalmeter(hw); |
2968 | rtl8821ae_dm_iq_calibrate(hw); | 2969 | rtl8821ae_dm_iq_calibrate(hw); |
2969 | } | 2970 | } |
2971 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
2970 | 2972 | ||
2971 | rtlpriv->dm.dbginfo.num_qry_beacon_pkt = 0; | 2973 | rtlpriv->dm.dbginfo.num_qry_beacon_pkt = 0; |
2972 | RT_TRACE(rtlpriv, COMP_DIG, DBG_DMESG, "\n"); | 2974 | RT_TRACE(rtlpriv, COMP_DIG, DBG_DMESG, "\n"); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c index b9436df9e1ec..0cddf1ad0fff 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | |||
@@ -3101,86 +3101,22 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ | |||
3101 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 3101 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
3102 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 3102 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
3103 | struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); | 3103 | struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); |
3104 | struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev; | 3104 | int params[] = {RTL_EEPROM_ID, EEPROM_VID, EEPROM_DID, |
3105 | u16 i, usvalue; | 3105 | EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, |
3106 | u8 hwinfo[HWSET_MAX_SIZE]; | 3106 | EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, |
3107 | u16 eeprom_id; | 3107 | COUNTRY_CODE_WORLD_WIDE_13}; |
3108 | u8 *hwinfo; | ||
3108 | 3109 | ||
3109 | if (b_pseudo_test) { | 3110 | if (b_pseudo_test) { |
3110 | ;/* need add */ | 3111 | ;/* need add */ |
3111 | } | 3112 | } |
3112 | 3113 | ||
3113 | switch (rtlefuse->epromtype) { | 3114 | hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); |
3114 | case EEPROM_BOOT_EFUSE: | 3115 | if (!hwinfo) |
3115 | rtl_efuse_shadow_map_update(hw); | ||
3116 | break; | ||
3117 | |||
3118 | case EEPROM_93C46: | ||
3119 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
3120 | "RTL819X Not boot from eeprom, check it !!"); | ||
3121 | return; | ||
3122 | |||
3123 | default: | ||
3124 | dev_warn(dev, "no efuse data\n"); | ||
3125 | } | ||
3126 | memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); | ||
3127 | |||
3128 | RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n", | ||
3129 | hwinfo, HWSET_MAX_SIZE); | ||
3130 | |||
3131 | eeprom_id = *((u16 *)&hwinfo[0]); | ||
3132 | if (eeprom_id != RTL_EEPROM_ID) { | ||
3133 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
3134 | "EEPROM ID(%#x) is invalid!!\n", eeprom_id); | ||
3135 | rtlefuse->autoload_failflag = true; | ||
3136 | } else { | ||
3137 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); | ||
3138 | rtlefuse->autoload_failflag = false; | ||
3139 | } | ||
3140 | |||
3141 | if (rtlefuse->autoload_failflag) { | ||
3142 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
3143 | "RTL8812AE autoload_failflag, check it !!"); | ||
3144 | return; | 3116 | return; |
3145 | } | ||
3146 | |||
3147 | rtlefuse->eeprom_version = *(u8 *)&hwinfo[EEPROM_VERSION]; | ||
3148 | if (rtlefuse->eeprom_version == 0xff) | ||
3149 | rtlefuse->eeprom_version = 0; | ||
3150 | |||
3151 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
3152 | "EEPROM version: 0x%2x\n", rtlefuse->eeprom_version); | ||
3153 | |||
3154 | rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; | ||
3155 | rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; | ||
3156 | rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; | ||
3157 | rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; | ||
3158 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
3159 | "EEPROMId = 0x%4x\n", eeprom_id); | ||
3160 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
3161 | "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); | ||
3162 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
3163 | "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); | ||
3164 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
3165 | "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); | ||
3166 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
3167 | "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); | ||
3168 | |||
3169 | /*customer ID*/ | ||
3170 | rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID]; | ||
3171 | if (rtlefuse->eeprom_oemid == 0xFF) | ||
3172 | rtlefuse->eeprom_oemid = 0; | ||
3173 | |||
3174 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | ||
3175 | "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); | ||
3176 | |||
3177 | for (i = 0; i < 6; i += 2) { | ||
3178 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; | ||
3179 | *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue; | ||
3180 | } | ||
3181 | 3117 | ||
3182 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, | 3118 | if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) |
3183 | "dev_addr: %pM\n", rtlefuse->dev_addr); | 3119 | goto exit; |
3184 | 3120 | ||
3185 | _rtl8821ae_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, | 3121 | _rtl8821ae_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, |
3186 | hwinfo); | 3122 | hwinfo); |
@@ -3280,6 +3216,8 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ | |||
3280 | break; | 3216 | break; |
3281 | } | 3217 | } |
3282 | } | 3218 | } |
3219 | exit: | ||
3220 | kfree(hwinfo); | ||
3283 | } | 3221 | } |
3284 | 3222 | ||
3285 | /*static void _rtl8821ae_hal_customized_behavior(struct ieee80211_hw *hw) | 3223 | /*static void _rtl8821ae_hal_customized_behavior(struct ieee80211_hw *hw) |
@@ -3836,7 +3774,7 @@ void rtl8821ae_update_hal_rate_tbl(struct ieee80211_hw *hw, | |||
3836 | rtl8821ae_update_hal_rate_mask(hw, sta, rssi_level); | 3774 | rtl8821ae_update_hal_rate_mask(hw, sta, rssi_level); |
3837 | else | 3775 | else |
3838 | /*RT_TRACE(rtlpriv, COMP_RATR,DBG_LOUD, | 3776 | /*RT_TRACE(rtlpriv, COMP_RATR,DBG_LOUD, |
3839 | "rtl8821ae_update_hal_rate_tbl() Error! 8821ae FW RA Only");*/ | 3777 | "rtl8821ae_update_hal_rate_tbl() Error! 8821ae FW RA Only\n");*/ |
3840 | rtl8821ae_update_hal_rate_table(hw, sta); | 3778 | rtl8821ae_update_hal_rate_table(hw, sta); |
3841 | } | 3779 | } |
3842 | 3780 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c index 0c3b9ce86e2e..a71bfe38e7e1 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | |||
@@ -366,12 +366,12 @@ u32 phy_get_tx_swing_8812A(struct ieee80211_hw *hw, u8 band, | |||
366 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 366 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
367 | struct rtl_dm *rtldm = rtl_dm(rtlpriv); | 367 | struct rtl_dm *rtldm = rtl_dm(rtlpriv); |
368 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 368 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
369 | char reg_swing_2g = -1;/* 0xff; */ | 369 | s8 reg_swing_2g = -1;/* 0xff; */ |
370 | char reg_swing_5g = -1;/* 0xff; */ | 370 | s8 reg_swing_5g = -1;/* 0xff; */ |
371 | char swing_2g = -1 * reg_swing_2g; | 371 | s8 swing_2g = -1 * reg_swing_2g; |
372 | char swing_5g = -1 * reg_swing_5g; | 372 | s8 swing_5g = -1 * reg_swing_5g; |
373 | u32 out = 0x200; | 373 | u32 out = 0x200; |
374 | const char auto_temp = -1; | 374 | const s8 auto_temp = -1; |
375 | 375 | ||
376 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, | 376 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, |
377 | "===> PHY_GetTxBBSwing_8812A, bbSwing_2G: %d, bbSwing_5G: %d,autoload_failflag=%d.\n", | 377 | "===> PHY_GetTxBBSwing_8812A, bbSwing_2G: %d, bbSwing_5G: %d,autoload_failflag=%d.\n", |
@@ -524,7 +524,7 @@ void rtl8821ae_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band) | |||
524 | struct rtl_dm *rtldm = rtl_dm(rtlpriv); | 524 | struct rtl_dm *rtldm = rtl_dm(rtlpriv); |
525 | u8 current_band = rtlhal->current_bandtype; | 525 | u8 current_band = rtlhal->current_bandtype; |
526 | u32 txpath, rxpath; | 526 | u32 txpath, rxpath; |
527 | char bb_diff_between_band; | 527 | s8 bb_diff_between_band; |
528 | 528 | ||
529 | txpath = rtl8821ae_phy_query_bb_reg(hw, RTXPATH, 0xf0); | 529 | txpath = rtl8821ae_phy_query_bb_reg(hw, RTXPATH, 0xf0); |
530 | rxpath = rtl8821ae_phy_query_bb_reg(hw, RCCK_RX, 0x0f000000); | 530 | rxpath = rtl8821ae_phy_query_bb_reg(hw, RCCK_RX, 0x0f000000); |
@@ -581,7 +581,7 @@ void rtl8821ae_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band) | |||
581 | count = 0; | 581 | count = 0; |
582 | reg_41a = rtl_read_word(rtlpriv, REG_TXPKT_EMPTY); | 582 | reg_41a = rtl_read_word(rtlpriv, REG_TXPKT_EMPTY); |
583 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, | 583 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, |
584 | "Reg41A value %d", reg_41a); | 584 | "Reg41A value %d\n", reg_41a); |
585 | reg_41a &= 0x30; | 585 | reg_41a &= 0x30; |
586 | while ((reg_41a != 0x30) && (count < 50)) { | 586 | while ((reg_41a != 0x30) && (count < 50)) { |
587 | udelay(50); | 587 | udelay(50); |
@@ -591,7 +591,7 @@ void rtl8821ae_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band) | |||
591 | reg_41a &= 0x30; | 591 | reg_41a &= 0x30; |
592 | count++; | 592 | count++; |
593 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, | 593 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, |
594 | "Reg41A value %d", reg_41a); | 594 | "Reg41A value %d\n", reg_41a); |
595 | } | 595 | } |
596 | if (count != 0) | 596 | if (count != 0) |
597 | RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, | 597 | RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, |
@@ -986,7 +986,7 @@ static void _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit(struct ieee8 | |||
986 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 986 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
987 | struct rtl_phy *rtlphy = &rtlpriv->phy; | 987 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
988 | u8 regulation, bw, channel, rate_section; | 988 | u8 regulation, bw, channel, rate_section; |
989 | char temp_pwrlmt = 0; | 989 | s8 temp_pwrlmt = 0; |
990 | 990 | ||
991 | for (regulation = 0; regulation < MAX_REGULATION_NUM; ++regulation) { | 991 | for (regulation = 0; regulation < MAX_REGULATION_NUM; ++regulation) { |
992 | for (bw = 0; bw < MAX_5G_BANDWITH_NUM; ++bw) { | 992 | for (bw = 0; bw < MAX_5G_BANDWITH_NUM; ++bw) { |
@@ -1013,7 +1013,7 @@ static void _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit(struct ieee8 | |||
1013 | rtlphy->txpwr_limit_5g[regulation][bw][3][channel][RF90_PATH_A]; | 1013 | rtlphy->txpwr_limit_5g[regulation][bw][3][channel][RF90_PATH_A]; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "use other value %d", temp_pwrlmt); | 1016 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "use other value %d\n", temp_pwrlmt); |
1017 | } | 1017 | } |
1018 | } | 1018 | } |
1019 | } | 1019 | } |
@@ -1155,7 +1155,7 @@ static void _rtl8812ae_phy_convert_txpower_limit_to_power_index(struct ieee80211 | |||
1155 | u8 regulation, bw, channel, rate_section; | 1155 | u8 regulation, bw, channel, rate_section; |
1156 | u8 base_index2_4G = 0; | 1156 | u8 base_index2_4G = 0; |
1157 | u8 base_index5G = 0; | 1157 | u8 base_index5G = 0; |
1158 | char temp_value = 0, temp_pwrlmt = 0; | 1158 | s8 temp_value = 0, temp_pwrlmt = 0; |
1159 | u8 rf_path = 0; | 1159 | u8 rf_path = 0; |
1160 | 1160 | ||
1161 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 1161 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
@@ -1467,11 +1467,11 @@ static bool _rtl8812ae_eq_n_byte(u8 *str1, u8 *str2, u32 num) | |||
1467 | return true; | 1467 | return true; |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | static char _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt(struct ieee80211_hw *hw, | 1470 | static s8 _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt(struct ieee80211_hw *hw, |
1471 | u8 band, u8 channel) | 1471 | u8 band, u8 channel) |
1472 | { | 1472 | { |
1473 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1473 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1474 | char channel_index = -1; | 1474 | s8 channel_index = -1; |
1475 | u8 i = 0; | 1475 | u8 i = 0; |
1476 | 1476 | ||
1477 | if (band == BAND_ON_2_4G) | 1477 | if (band == BAND_ON_2_4G) |
@@ -1482,12 +1482,12 @@ static char _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt(struct ieee80211_hw *hw, | |||
1482 | channel_index = i; | 1482 | channel_index = i; |
1483 | } | 1483 | } |
1484 | } else | 1484 | } else |
1485 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Invalid Band %d in %s", | 1485 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Invalid Band %d in %s\n", |
1486 | band, __func__); | 1486 | band, __func__); |
1487 | 1487 | ||
1488 | if (channel_index == -1) | 1488 | if (channel_index == -1) |
1489 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | 1489 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
1490 | "Invalid Channel %d of Band %d in %s", channel, | 1490 | "Invalid Channel %d of Band %d in %s\n", channel, |
1491 | band, __func__); | 1491 | band, __func__); |
1492 | 1492 | ||
1493 | return channel_index; | 1493 | return channel_index; |
@@ -1502,7 +1502,7 @@ static void _rtl8812ae_phy_set_txpower_limit(struct ieee80211_hw *hw, u8 *pregul | |||
1502 | struct rtl_phy *rtlphy = &rtlpriv->phy; | 1502 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
1503 | u8 regulation = 0, bandwidth = 0, rate_section = 0, channel; | 1503 | u8 regulation = 0, bandwidth = 0, rate_section = 0, channel; |
1504 | u8 channel_index; | 1504 | u8 channel_index; |
1505 | char power_limit = 0, prev_power_limit, ret; | 1505 | s8 power_limit = 0, prev_power_limit, ret; |
1506 | 1506 | ||
1507 | if (!_rtl8812ae_get_integer_from_string((char *)pchannel, &channel) || | 1507 | if (!_rtl8812ae_get_integer_from_string((char *)pchannel, &channel) || |
1508 | !_rtl8812ae_get_integer_from_string((char *)ppower_limit, | 1508 | !_rtl8812ae_get_integer_from_string((char *)ppower_limit, |
@@ -1665,7 +1665,7 @@ static bool _rtl8821ae_phy_bb8821a_config_parafile(struct ieee80211_hw *hw) | |||
1665 | rtstatus = _rtl8821ae_phy_config_bb_with_headerfile(hw, | 1665 | rtstatus = _rtl8821ae_phy_config_bb_with_headerfile(hw, |
1666 | BASEBAND_CONFIG_PHY_REG); | 1666 | BASEBAND_CONFIG_PHY_REG); |
1667 | if (rtstatus != true) { | 1667 | if (rtstatus != true) { |
1668 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!"); | 1668 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n"); |
1669 | return false; | 1669 | return false; |
1670 | } | 1670 | } |
1671 | _rtl8821ae_phy_init_tx_power_by_rate(hw); | 1671 | _rtl8821ae_phy_init_tx_power_by_rate(hw); |
@@ -1674,7 +1674,7 @@ static bool _rtl8821ae_phy_bb8821a_config_parafile(struct ieee80211_hw *hw) | |||
1674 | BASEBAND_CONFIG_PHY_REG); | 1674 | BASEBAND_CONFIG_PHY_REG); |
1675 | } | 1675 | } |
1676 | if (rtstatus != true) { | 1676 | if (rtstatus != true) { |
1677 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!"); | 1677 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n"); |
1678 | return false; | 1678 | return false; |
1679 | } | 1679 | } |
1680 | 1680 | ||
@@ -2254,9 +2254,9 @@ static bool _rtl8821ae_phy_get_chnl_index(u8 channel, u8 *chnl_index) | |||
2254 | return in_24g; | 2254 | return in_24g; |
2255 | } | 2255 | } |
2256 | 2256 | ||
2257 | static char _rtl8821ae_phy_get_ratesection_intxpower_byrate(u8 path, u8 rate) | 2257 | static s8 _rtl8821ae_phy_get_ratesection_intxpower_byrate(u8 path, u8 rate) |
2258 | { | 2258 | { |
2259 | char rate_section = 0; | 2259 | s8 rate_section = 0; |
2260 | switch (rate) { | 2260 | switch (rate) { |
2261 | case DESC_RATE1M: | 2261 | case DESC_RATE1M: |
2262 | case DESC_RATE2M: | 2262 | case DESC_RATE2M: |
@@ -2338,9 +2338,9 @@ static char _rtl8821ae_phy_get_ratesection_intxpower_byrate(u8 path, u8 rate) | |||
2338 | return rate_section; | 2338 | return rate_section; |
2339 | } | 2339 | } |
2340 | 2340 | ||
2341 | static char _rtl8812ae_phy_get_world_wide_limit(char *limit_table) | 2341 | static s8 _rtl8812ae_phy_get_world_wide_limit(s8 *limit_table) |
2342 | { | 2342 | { |
2343 | char min = limit_table[0]; | 2343 | s8 min = limit_table[0]; |
2344 | u8 i = 0; | 2344 | u8 i = 0; |
2345 | 2345 | ||
2346 | for (i = 0; i < MAX_REGULATION_NUM; ++i) { | 2346 | for (i = 0; i < MAX_REGULATION_NUM; ++i) { |
@@ -2350,7 +2350,7 @@ static char _rtl8812ae_phy_get_world_wide_limit(char *limit_table) | |||
2350 | return min; | 2350 | return min; |
2351 | } | 2351 | } |
2352 | 2352 | ||
2353 | static char _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw, | 2353 | static s8 _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw, |
2354 | u8 band, | 2354 | u8 band, |
2355 | enum ht_channel_width bandwidth, | 2355 | enum ht_channel_width bandwidth, |
2356 | enum radio_path rf_path, | 2356 | enum radio_path rf_path, |
@@ -2362,7 +2362,7 @@ static char _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw, | |||
2362 | short band_temp = -1, regulation = -1, bandwidth_temp = -1, | 2362 | short band_temp = -1, regulation = -1, bandwidth_temp = -1, |
2363 | rate_section = -1, channel_temp = -1; | 2363 | rate_section = -1, channel_temp = -1; |
2364 | u16 bd, regu, bdwidth, sec, chnl; | 2364 | u16 bd, regu, bdwidth, sec, chnl; |
2365 | char power_limit = MAX_POWER_INDEX; | 2365 | s8 power_limit = MAX_POWER_INDEX; |
2366 | 2366 | ||
2367 | if (rtlefuse->eeprom_regulatory == 2) | 2367 | if (rtlefuse->eeprom_regulatory == 2) |
2368 | return MAX_POWER_INDEX; | 2368 | return MAX_POWER_INDEX; |
@@ -2489,7 +2489,7 @@ static char _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw, | |||
2489 | chnl = channel_temp; | 2489 | chnl = channel_temp; |
2490 | 2490 | ||
2491 | if (band == BAND_ON_2_4G) { | 2491 | if (band == BAND_ON_2_4G) { |
2492 | char limits[10] = {0}; | 2492 | s8 limits[10] = {0}; |
2493 | u8 i; | 2493 | u8 i; |
2494 | 2494 | ||
2495 | for (i = 0; i < 4; ++i) | 2495 | for (i = 0; i < 4; ++i) |
@@ -2501,7 +2501,7 @@ static char _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw, | |||
2501 | rtlphy->txpwr_limit_2_4g[regu][bdwidth] | 2501 | rtlphy->txpwr_limit_2_4g[regu][bdwidth] |
2502 | [sec][chnl][rf_path]; | 2502 | [sec][chnl][rf_path]; |
2503 | } else if (band == BAND_ON_5G) { | 2503 | } else if (band == BAND_ON_5G) { |
2504 | char limits[10] = {0}; | 2504 | s8 limits[10] = {0}; |
2505 | u8 i; | 2505 | u8 i; |
2506 | 2506 | ||
2507 | for (i = 0; i < MAX_REGULATION_NUM; ++i) | 2507 | for (i = 0; i < MAX_REGULATION_NUM; ++i) |
@@ -2519,14 +2519,14 @@ static char _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw, | |||
2519 | return power_limit; | 2519 | return power_limit; |
2520 | } | 2520 | } |
2521 | 2521 | ||
2522 | static char _rtl8821ae_phy_get_txpower_by_rate(struct ieee80211_hw *hw, | 2522 | static s8 _rtl8821ae_phy_get_txpower_by_rate(struct ieee80211_hw *hw, |
2523 | u8 band, u8 path, u8 rate) | 2523 | u8 band, u8 path, u8 rate) |
2524 | { | 2524 | { |
2525 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 2525 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2526 | struct rtl_phy *rtlphy = &rtlpriv->phy; | 2526 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
2527 | u8 shift = 0, rate_section, tx_num; | 2527 | u8 shift = 0, rate_section, tx_num; |
2528 | char tx_pwr_diff = 0; | 2528 | s8 tx_pwr_diff = 0; |
2529 | char limit = 0; | 2529 | s8 limit = 0; |
2530 | 2530 | ||
2531 | rate_section = _rtl8821ae_phy_get_ratesection_intxpower_byrate(path, rate); | 2531 | rate_section = _rtl8821ae_phy_get_ratesection_intxpower_byrate(path, rate); |
2532 | tx_num = RF_TX_NUM_NONIMPLEMENT; | 2532 | tx_num = RF_TX_NUM_NONIMPLEMENT; |
@@ -2639,7 +2639,7 @@ static u8 _rtl8821ae_get_txpower_index(struct ieee80211_hw *hw, u8 path, | |||
2639 | u8 index = (channel - 1); | 2639 | u8 index = (channel - 1); |
2640 | u8 txpower = 0; | 2640 | u8 txpower = 0; |
2641 | bool in_24g = false; | 2641 | bool in_24g = false; |
2642 | char powerdiff_byrate = 0; | 2642 | s8 powerdiff_byrate = 0; |
2643 | 2643 | ||
2644 | if (((rtlhal->current_bandtype == BAND_ON_2_4G) && | 2644 | if (((rtlhal->current_bandtype == BAND_ON_2_4G) && |
2645 | (channel > 14 || channel < 1)) || | 2645 | (channel > 14 || channel < 1)) || |
@@ -4637,7 +4637,7 @@ void rtl8821ae_phy_lc_calibrate(struct ieee80211_hw *hw) | |||
4637 | { | 4637 | { |
4638 | } | 4638 | } |
4639 | 4639 | ||
4640 | void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, char delta) | 4640 | void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta) |
4641 | { | 4641 | { |
4642 | } | 4642 | } |
4643 | 4643 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h index c411f0a95cc4..1285e1adfe9d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h | |||
@@ -236,7 +236,7 @@ void rtl8821ae_phy_iq_calibrate(struct ieee80211_hw *hw, | |||
236 | bool b_recovery); | 236 | bool b_recovery); |
237 | void rtl8812ae_phy_iq_calibrate(struct ieee80211_hw *hw, | 237 | void rtl8812ae_phy_iq_calibrate(struct ieee80211_hw *hw, |
238 | bool b_recovery); | 238 | bool b_recovery); |
239 | void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 239 | void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta); |
240 | void rtl8821ae_phy_lc_calibrate(struct ieee80211_hw *hw); | 240 | void rtl8821ae_phy_lc_calibrate(struct ieee80211_hw *hw); |
241 | void rtl8821ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 241 | void rtl8821ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
242 | bool rtl8812ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 242 | bool rtl8812ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c index 2922538160e5..c6ab957023e6 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c | |||
@@ -454,7 +454,7 @@ static bool _rtl8821ae_phy_rf6052_config_parafile(struct ieee80211_hw *hw) | |||
454 | 454 | ||
455 | if (!rtstatus) { | 455 | if (!rtstatus) { |
456 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 456 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
457 | "Radio[%d] Fail!!", rfpath); | 457 | "Radio[%d] Fail!!\n", rfpath); |
458 | return false; | 458 | return false; |
459 | } | 459 | } |
460 | } | 460 | } |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c index 41efaa148d13..27727186ba5f 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c | |||
@@ -48,7 +48,7 @@ static u8 _rtl8821ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) | |||
48 | return skb->priority; | 48 | return skb->priority; |
49 | } | 49 | } |
50 | 50 | ||
51 | static u16 odm_cfo(char value) | 51 | static u16 odm_cfo(s8 value) |
52 | { | 52 | { |
53 | int ret_val; | 53 | int ret_val; |
54 | 54 | ||
@@ -64,9 +64,9 @@ static u16 odm_cfo(char value) | |||
64 | return ret_val; | 64 | return ret_val; |
65 | } | 65 | } |
66 | 66 | ||
67 | static u8 _rtl8821ae_evm_dbm_jaguar(char value) | 67 | static u8 _rtl8821ae_evm_dbm_jaguar(s8 value) |
68 | { | 68 | { |
69 | char ret_val = value; | 69 | s8 ret_val = value; |
70 | 70 | ||
71 | /* -33dB~0dB to 33dB ~ 0dB*/ | 71 | /* -33dB~0dB to 33dB ~ 0dB*/ |
72 | if (ret_val == -128) | 72 | if (ret_val == -128) |
@@ -88,7 +88,7 @@ static void query_rxphystatus(struct ieee80211_hw *hw, | |||
88 | struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo; | 88 | struct phy_status_rpt *p_phystrpt = (struct phy_status_rpt *)p_drvinfo; |
89 | struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); | 89 | struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); |
90 | struct rtl_phy *rtlphy = &rtlpriv->phy; | 90 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
91 | char rx_pwr_all = 0, rx_pwr[4]; | 91 | s8 rx_pwr_all = 0, rx_pwr[4]; |
92 | u8 rf_rx_num = 0, evm, evmdbm, pwdb_all; | 92 | u8 rf_rx_num = 0, evm, evmdbm, pwdb_all; |
93 | u8 i, max_spatial_stream; | 93 | u8 i, max_spatial_stream; |
94 | u32 rssi, total_rssi = 0; | 94 | u32 rssi, total_rssi = 0; |
@@ -170,7 +170,7 @@ static void query_rxphystatus(struct ieee80211_hw *hw, | |||
170 | pwdb_all = 100; | 170 | pwdb_all = 100; |
171 | } | 171 | } |
172 | } else { /* 8821 */ | 172 | } else { /* 8821 */ |
173 | char pout = -6; | 173 | s8 pout = -6; |
174 | 174 | ||
175 | switch (lan_idx) { | 175 | switch (lan_idx) { |
176 | case 5: | 176 | case 5: |
@@ -275,7 +275,7 @@ static void query_rxphystatus(struct ieee80211_hw *hw, | |||
275 | if (bpacket_match_bssid) { | 275 | if (bpacket_match_bssid) { |
276 | for (i = RF90_PATH_A; i <= RF90_PATH_B; i++) | 276 | for (i = RF90_PATH_A; i <= RF90_PATH_B; i++) |
277 | rtl_priv(hw)->dm.cfo_tail[i] = | 277 | rtl_priv(hw)->dm.cfo_tail[i] = |
278 | (char)p_phystrpt->cfotail[i]; | 278 | (s8)p_phystrpt->cfotail[i]; |
279 | 279 | ||
280 | rtl_priv(hw)->dm.packet_count++; | 280 | rtl_priv(hw)->dm.packet_count++; |
281 | } | 281 | } |
@@ -716,7 +716,7 @@ void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, | |||
716 | PCI_DMA_TODEVICE); | 716 | PCI_DMA_TODEVICE); |
717 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 717 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
718 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 718 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
719 | "DMA mapping error"); | 719 | "DMA mapping error\n"); |
720 | return; | 720 | return; |
721 | } | 721 | } |
722 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_8821ae)); | 722 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_8821ae)); |
@@ -857,7 +857,7 @@ void rtl8821ae_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
857 | 857 | ||
858 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | 858 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
859 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | 859 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
860 | "DMA mapping error"); | 860 | "DMA mapping error\n"); |
861 | return; | 861 | return; |
862 | } | 862 | } |
863 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 863 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h index ad565bebf1d5..b6f3c564b8d1 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h | |||
@@ -390,11 +390,11 @@ struct phy_status_rpt { | |||
390 | u8 cfosho[4]; /* DW 1 byte 1 DW 2 byte 0 */ | 390 | u8 cfosho[4]; /* DW 1 byte 1 DW 2 byte 0 */ |
391 | 391 | ||
392 | /* DWORD 2 */ | 392 | /* DWORD 2 */ |
393 | char cfotail[4]; /* DW 2 byte 1 DW 3 byte 0 */ | 393 | s8 cfotail[4]; /* DW 2 byte 1 DW 3 byte 0 */ |
394 | 394 | ||
395 | /* DWORD 3 */ | 395 | /* DWORD 3 */ |
396 | char rxevm[2]; /* DW 3 byte 1 DW 3 byte 2 */ | 396 | s8 rxevm[2]; /* DW 3 byte 1 DW 3 byte 2 */ |
397 | char rxsnr[2]; /* DW 3 byte 3 DW 4 byte 0 */ | 397 | s8 rxsnr[2]; /* DW 3 byte 3 DW 4 byte 0 */ |
398 | 398 | ||
399 | /* DWORD 4 */ | 399 | /* DWORD 4 */ |
400 | u8 pcts_msk_rpt[2]; | 400 | u8 pcts_msk_rpt[2]; |
@@ -418,8 +418,8 @@ struct rx_fwinfo_8821ae { | |||
418 | u8 pwdb_all; | 418 | u8 pwdb_all; |
419 | u8 cfosho[4]; | 419 | u8 cfosho[4]; |
420 | u8 cfotail[4]; | 420 | u8 cfotail[4]; |
421 | char rxevm[2]; | 421 | s8 rxevm[2]; |
422 | char rxsnr[4]; | 422 | s8 rxsnr[4]; |
423 | u8 pdsnr[2]; | 423 | u8 pdsnr[2]; |
424 | u8 csi_current[2]; | 424 | u8 csi_current[2]; |
425 | u8 csi_target[2]; | 425 | u8 csi_target[2]; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/stats.c b/drivers/net/wireless/realtek/rtlwifi/stats.c index d8b30690b00d..61700fa05570 100644 --- a/drivers/net/wireless/realtek/rtlwifi/stats.c +++ b/drivers/net/wireless/realtek/rtlwifi/stats.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "stats.h" | 26 | #include "stats.h" |
27 | #include <linux/export.h> | 27 | #include <linux/export.h> |
28 | 28 | ||
29 | u8 rtl_query_rxpwrpercentage(char antpower) | 29 | u8 rtl_query_rxpwrpercentage(s8 antpower) |
30 | { | 30 | { |
31 | if ((antpower <= -100) || (antpower >= 20)) | 31 | if ((antpower <= -100) || (antpower >= 20)) |
32 | return 0; | 32 | return 0; |
@@ -37,9 +37,9 @@ u8 rtl_query_rxpwrpercentage(char antpower) | |||
37 | } | 37 | } |
38 | EXPORT_SYMBOL(rtl_query_rxpwrpercentage); | 38 | EXPORT_SYMBOL(rtl_query_rxpwrpercentage); |
39 | 39 | ||
40 | u8 rtl_evm_db_to_percentage(char value) | 40 | u8 rtl_evm_db_to_percentage(s8 value) |
41 | { | 41 | { |
42 | char ret_val = clamp(-value, 0, 33) * 3; | 42 | s8 ret_val = clamp(-value, 0, 33) * 3; |
43 | 43 | ||
44 | if (ret_val == 99) | 44 | if (ret_val == 99) |
45 | ret_val = 100; | 45 | ret_val = 100; |
diff --git a/drivers/net/wireless/realtek/rtlwifi/stats.h b/drivers/net/wireless/realtek/rtlwifi/stats.h index 2b57dffef572..bd0108f93182 100644 --- a/drivers/net/wireless/realtek/rtlwifi/stats.h +++ b/drivers/net/wireless/realtek/rtlwifi/stats.h | |||
@@ -33,8 +33,8 @@ | |||
33 | /* Rx smooth factor */ | 33 | /* Rx smooth factor */ |
34 | #define RX_SMOOTH_FACTOR 20 | 34 | #define RX_SMOOTH_FACTOR 20 |
35 | 35 | ||
36 | u8 rtl_query_rxpwrpercentage(char antpower); | 36 | u8 rtl_query_rxpwrpercentage(s8 antpower); |
37 | u8 rtl_evm_db_to_percentage(char value); | 37 | u8 rtl_evm_db_to_percentage(s8 value); |
38 | long rtl_signal_scale_mapping(struct ieee80211_hw *hw, long currsig); | 38 | long rtl_signal_scale_mapping(struct ieee80211_hw *hw, long currsig); |
39 | void rtl_process_phyinfo(struct ieee80211_hw *hw, u8 *buffer, | 39 | void rtl_process_phyinfo(struct ieee80211_hw *hw, u8 *buffer, |
40 | struct rtl_stats *pstatus); | 40 | struct rtl_stats *pstatus); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 4e0ab4d42aa6..c5086c2229aa 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h | |||
@@ -1089,7 +1089,7 @@ struct dynamic_primary_cca { | |||
1089 | }; | 1089 | }; |
1090 | 1090 | ||
1091 | struct rtl_regulatory { | 1091 | struct rtl_regulatory { |
1092 | char alpha2[2]; | 1092 | s8 alpha2[2]; |
1093 | u16 country_code; | 1093 | u16 country_code; |
1094 | u16 max_power_level; | 1094 | u16 max_power_level; |
1095 | u32 tp_scale; | 1095 | u32 tp_scale; |
@@ -1256,16 +1256,16 @@ struct rtl_phy { | |||
1256 | u8 cur_bw20_txpwridx; | 1256 | u8 cur_bw20_txpwridx; |
1257 | u8 cur_bw40_txpwridx; | 1257 | u8 cur_bw40_txpwridx; |
1258 | 1258 | ||
1259 | char txpwr_limit_2_4g[MAX_REGULATION_NUM] | 1259 | s8 txpwr_limit_2_4g[MAX_REGULATION_NUM] |
1260 | [MAX_2_4G_BANDWITH_NUM] | 1260 | [MAX_2_4G_BANDWITH_NUM] |
1261 | [MAX_RATE_SECTION_NUM] | ||
1262 | [CHANNEL_MAX_NUMBER_2G] | ||
1263 | [MAX_RF_PATH_NUM]; | ||
1264 | char txpwr_limit_5g[MAX_REGULATION_NUM] | ||
1265 | [MAX_5G_BANDWITH_NUM] | ||
1266 | [MAX_RATE_SECTION_NUM] | 1261 | [MAX_RATE_SECTION_NUM] |
1267 | [CHANNEL_MAX_NUMBER_5G] | 1262 | [CHANNEL_MAX_NUMBER_2G] |
1268 | [MAX_RF_PATH_NUM]; | 1263 | [MAX_RF_PATH_NUM]; |
1264 | s8 txpwr_limit_5g[MAX_REGULATION_NUM] | ||
1265 | [MAX_5G_BANDWITH_NUM] | ||
1266 | [MAX_RATE_SECTION_NUM] | ||
1267 | [CHANNEL_MAX_NUMBER_5G] | ||
1268 | [MAX_RF_PATH_NUM]; | ||
1269 | 1269 | ||
1270 | u32 rfreg_chnlval[2]; | 1270 | u32 rfreg_chnlval[2]; |
1271 | bool apk_done; | 1271 | bool apk_done; |
@@ -1639,7 +1639,7 @@ struct fast_ant_training { | |||
1639 | }; | 1639 | }; |
1640 | 1640 | ||
1641 | struct dm_phy_dbg_info { | 1641 | struct dm_phy_dbg_info { |
1642 | char rx_snrdb[4]; | 1642 | s8 rx_snrdb[4]; |
1643 | u64 num_qry_phy_status; | 1643 | u64 num_qry_phy_status; |
1644 | u64 num_qry_phy_status_cck; | 1644 | u64 num_qry_phy_status_cck; |
1645 | u64 num_qry_phy_status_ofdm; | 1645 | u64 num_qry_phy_status_ofdm; |
@@ -1688,16 +1688,16 @@ struct rtl_dm { | |||
1688 | u8 txpower_track_control; | 1688 | u8 txpower_track_control; |
1689 | bool interrupt_migration; | 1689 | bool interrupt_migration; |
1690 | bool disable_tx_int; | 1690 | bool disable_tx_int; |
1691 | char ofdm_index[MAX_RF_PATH]; | 1691 | s8 ofdm_index[MAX_RF_PATH]; |
1692 | u8 default_ofdm_index; | 1692 | u8 default_ofdm_index; |
1693 | u8 default_cck_index; | 1693 | u8 default_cck_index; |
1694 | char cck_index; | 1694 | s8 cck_index; |
1695 | char delta_power_index[MAX_RF_PATH]; | 1695 | s8 delta_power_index[MAX_RF_PATH]; |
1696 | char delta_power_index_last[MAX_RF_PATH]; | 1696 | s8 delta_power_index_last[MAX_RF_PATH]; |
1697 | char power_index_offset[MAX_RF_PATH]; | 1697 | s8 power_index_offset[MAX_RF_PATH]; |
1698 | char absolute_ofdm_swing_idx[MAX_RF_PATH]; | 1698 | s8 absolute_ofdm_swing_idx[MAX_RF_PATH]; |
1699 | char remnant_ofdm_swing_idx[MAX_RF_PATH]; | 1699 | s8 remnant_ofdm_swing_idx[MAX_RF_PATH]; |
1700 | char remnant_cck_idx; | 1700 | s8 remnant_cck_idx; |
1701 | bool modify_txagc_flag_path_a; | 1701 | bool modify_txagc_flag_path_a; |
1702 | bool modify_txagc_flag_path_b; | 1702 | bool modify_txagc_flag_path_b; |
1703 | 1703 | ||
@@ -1726,8 +1726,8 @@ struct rtl_dm { | |||
1726 | u8 swing_idx_cck_base; | 1726 | u8 swing_idx_cck_base; |
1727 | bool swing_flag_cck; | 1727 | bool swing_flag_cck; |
1728 | 1728 | ||
1729 | char swing_diff_2g; | 1729 | s8 swing_diff_2g; |
1730 | char swing_diff_5g; | 1730 | s8 swing_diff_5g; |
1731 | 1731 | ||
1732 | u8 delta_swing_table_idx_24gccka_p[DEL_SW_IDX_SZ]; | 1732 | u8 delta_swing_table_idx_24gccka_p[DEL_SW_IDX_SZ]; |
1733 | u8 delta_swing_table_idx_24gccka_n[DEL_SW_IDX_SZ]; | 1733 | u8 delta_swing_table_idx_24gccka_n[DEL_SW_IDX_SZ]; |
@@ -1838,17 +1838,17 @@ struct rtl_efuse { | |||
1838 | * | 1838 | * |
1839 | * Sizes of these arrays are decided by the larger ones. | 1839 | * Sizes of these arrays are decided by the larger ones. |
1840 | */ | 1840 | */ |
1841 | char txpwr_cckdiff[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; | 1841 | s8 txpwr_cckdiff[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; |
1842 | char txpwr_ht20diff[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; | 1842 | s8 txpwr_ht20diff[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; |
1843 | char txpwr_ht40diff[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; | 1843 | s8 txpwr_ht40diff[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; |
1844 | char txpwr_legacyhtdiff[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; | 1844 | s8 txpwr_legacyhtdiff[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; |
1845 | 1845 | ||
1846 | u8 txpwr_5g_bw40base[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; | 1846 | u8 txpwr_5g_bw40base[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; |
1847 | u8 txpwr_5g_bw80base[MAX_RF_PATH][CHANNEL_MAX_NUMBER_5G_80M]; | 1847 | u8 txpwr_5g_bw80base[MAX_RF_PATH][CHANNEL_MAX_NUMBER_5G_80M]; |
1848 | char txpwr_5g_ofdmdiff[MAX_RF_PATH][MAX_TX_COUNT]; | 1848 | s8 txpwr_5g_ofdmdiff[MAX_RF_PATH][MAX_TX_COUNT]; |
1849 | char txpwr_5g_bw20diff[MAX_RF_PATH][MAX_TX_COUNT]; | 1849 | s8 txpwr_5g_bw20diff[MAX_RF_PATH][MAX_TX_COUNT]; |
1850 | char txpwr_5g_bw40diff[MAX_RF_PATH][MAX_TX_COUNT]; | 1850 | s8 txpwr_5g_bw40diff[MAX_RF_PATH][MAX_TX_COUNT]; |
1851 | char txpwr_5g_bw80diff[MAX_RF_PATH][MAX_TX_COUNT]; | 1851 | s8 txpwr_5g_bw80diff[MAX_RF_PATH][MAX_TX_COUNT]; |
1852 | 1852 | ||
1853 | u8 txpwr_safetyflag; /* Band edge enable flag */ | 1853 | u8 txpwr_safetyflag; /* Band edge enable flag */ |
1854 | u16 eeprom_txpowerdiff; | 1854 | u16 eeprom_txpowerdiff; |
@@ -2006,7 +2006,7 @@ struct rtl_stats { | |||
2006 | bool is_ht; | 2006 | bool is_ht; |
2007 | bool packet_toself; | 2007 | bool packet_toself; |
2008 | bool packet_beacon; /*for rssi */ | 2008 | bool packet_beacon; /*for rssi */ |
2009 | char cck_adc_pwdb[4]; /*for rx path selection */ | 2009 | s8 cck_adc_pwdb[4]; /*for rx path selection */ |
2010 | 2010 | ||
2011 | bool is_vht; | 2011 | bool is_vht; |
2012 | bool is_short_gi; | 2012 | bool is_short_gi; |
@@ -2413,9 +2413,9 @@ struct dig_t { | |||
2413 | u8 presta_cstate; | 2413 | u8 presta_cstate; |
2414 | u8 curmultista_cstate; | 2414 | u8 curmultista_cstate; |
2415 | u8 stop_dig; | 2415 | u8 stop_dig; |
2416 | char back_val; | 2416 | s8 back_val; |
2417 | char back_range_max; | 2417 | s8 back_range_max; |
2418 | char back_range_min; | 2418 | s8 back_range_min; |
2419 | u8 rx_gain_max; | 2419 | u8 rx_gain_max; |
2420 | u8 rx_gain_min; | 2420 | u8 rx_gain_min; |
2421 | u8 min_undec_pwdb_for_dm; | 2421 | u8 min_undec_pwdb_for_dm; |
@@ -2441,8 +2441,8 @@ struct dig_t { | |||
2441 | u8 cur_cs_ratiostate; | 2441 | u8 cur_cs_ratiostate; |
2442 | u8 pre_cs_ratiostate; | 2442 | u8 pre_cs_ratiostate; |
2443 | u8 backoff_enable_flag; | 2443 | u8 backoff_enable_flag; |
2444 | char backoffval_range_max; | 2444 | s8 backoffval_range_max; |
2445 | char backoffval_range_min; | 2445 | s8 backoffval_range_min; |
2446 | u8 dig_min_0; | 2446 | u8 dig_min_0; |
2447 | u8 dig_min_1; | 2447 | u8 dig_min_1; |
2448 | u8 bt30_cur_igi; | 2448 | u8 bt30_cur_igi; |
diff --git a/drivers/net/wireless/ti/wl18xx/event.c b/drivers/net/wireless/ti/wl18xx/event.c index ef811848d141..2c5df43b8ed9 100644 --- a/drivers/net/wireless/ti/wl18xx/event.c +++ b/drivers/net/wireless/ti/wl18xx/event.c | |||
@@ -112,12 +112,18 @@ static int wlcore_smart_config_decode_event(struct wl1271 *wl, | |||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void wlcore_event_time_sync(struct wl1271 *wl, u16 tsf_msb, u16 tsf_lsb) | 115 | static void wlcore_event_time_sync(struct wl1271 *wl, |
116 | u16 tsf_high_msb, u16 tsf_high_lsb, | ||
117 | u16 tsf_low_msb, u16 tsf_low_lsb) | ||
116 | { | 118 | { |
117 | u32 clock; | 119 | u32 clock_low; |
118 | /* convert the MSB+LSB to a u32 TSF value */ | 120 | u32 clock_high; |
119 | clock = (tsf_msb << 16) | tsf_lsb; | 121 | |
120 | wl1271_info("TIME_SYNC_EVENT_ID: clock %u", clock); | 122 | clock_high = (tsf_high_msb << 16) | tsf_high_lsb; |
123 | clock_low = (tsf_low_msb << 16) | tsf_low_lsb; | ||
124 | |||
125 | wl1271_info("TIME_SYNC_EVENT_ID: clock_high %u, clock low %u", | ||
126 | clock_high, clock_low); | ||
121 | } | 127 | } |
122 | 128 | ||
123 | int wl18xx_process_mailbox_events(struct wl1271 *wl) | 129 | int wl18xx_process_mailbox_events(struct wl1271 *wl) |
@@ -138,8 +144,10 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl) | |||
138 | 144 | ||
139 | if (vector & TIME_SYNC_EVENT_ID) | 145 | if (vector & TIME_SYNC_EVENT_ID) |
140 | wlcore_event_time_sync(wl, | 146 | wlcore_event_time_sync(wl, |
141 | mbox->time_sync_tsf_msb, | 147 | mbox->time_sync_tsf_high_msb, |
142 | mbox->time_sync_tsf_lsb); | 148 | mbox->time_sync_tsf_high_lsb, |
149 | mbox->time_sync_tsf_low_msb, | ||
150 | mbox->time_sync_tsf_low_lsb); | ||
143 | 151 | ||
144 | if (vector & RADAR_DETECTED_EVENT_ID) { | 152 | if (vector & RADAR_DETECTED_EVENT_ID) { |
145 | wl1271_info("radar event: channel %d type %s", | 153 | wl1271_info("radar event: channel %d type %s", |
@@ -187,11 +195,11 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl) | |||
187 | */ | 195 | */ |
188 | if (vector & MAX_TX_FAILURE_EVENT_ID) | 196 | if (vector & MAX_TX_FAILURE_EVENT_ID) |
189 | wlcore_event_max_tx_failure(wl, | 197 | wlcore_event_max_tx_failure(wl, |
190 | le32_to_cpu(mbox->tx_retry_exceeded_bitmap)); | 198 | le16_to_cpu(mbox->tx_retry_exceeded_bitmap)); |
191 | 199 | ||
192 | if (vector & INACTIVE_STA_EVENT_ID) | 200 | if (vector & INACTIVE_STA_EVENT_ID) |
193 | wlcore_event_inactive_sta(wl, | 201 | wlcore_event_inactive_sta(wl, |
194 | le32_to_cpu(mbox->inactive_sta_bitmap)); | 202 | le16_to_cpu(mbox->inactive_sta_bitmap)); |
195 | 203 | ||
196 | if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID) | 204 | if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID) |
197 | wlcore_event_roc_complete(wl); | 205 | wlcore_event_roc_complete(wl); |
diff --git a/drivers/net/wireless/ti/wl18xx/event.h b/drivers/net/wireless/ti/wl18xx/event.h index 070de1274694..ce8ea9c04052 100644 --- a/drivers/net/wireless/ti/wl18xx/event.h +++ b/drivers/net/wireless/ti/wl18xx/event.h | |||
@@ -74,10 +74,16 @@ struct wl18xx_event_mailbox { | |||
74 | __le16 bss_loss_bitmap; | 74 | __le16 bss_loss_bitmap; |
75 | 75 | ||
76 | /* bitmap of stations (by HLID) which exceeded max tx retries */ | 76 | /* bitmap of stations (by HLID) which exceeded max tx retries */ |
77 | __le32 tx_retry_exceeded_bitmap; | 77 | __le16 tx_retry_exceeded_bitmap; |
78 | |||
79 | /* time sync high msb*/ | ||
80 | __le16 time_sync_tsf_high_msb; | ||
78 | 81 | ||
79 | /* bitmap of inactive stations (by HLID) */ | 82 | /* bitmap of inactive stations (by HLID) */ |
80 | __le32 inactive_sta_bitmap; | 83 | __le16 inactive_sta_bitmap; |
84 | |||
85 | /* time sync high lsb*/ | ||
86 | __le16 time_sync_tsf_high_lsb; | ||
81 | 87 | ||
82 | /* rx BA win size indicated by RX_BA_WIN_SIZE_CHANGE_EVENT_ID */ | 88 | /* rx BA win size indicated by RX_BA_WIN_SIZE_CHANGE_EVENT_ID */ |
83 | u8 rx_ba_role_id; | 89 | u8 rx_ba_role_id; |
@@ -98,14 +104,15 @@ struct wl18xx_event_mailbox { | |||
98 | u8 sc_sync_channel; | 104 | u8 sc_sync_channel; |
99 | u8 sc_sync_band; | 105 | u8 sc_sync_band; |
100 | 106 | ||
101 | /* time sync msb*/ | 107 | /* time sync low msb*/ |
102 | u16 time_sync_tsf_msb; | 108 | __le16 time_sync_tsf_low_msb; |
109 | |||
103 | /* radar detect */ | 110 | /* radar detect */ |
104 | u8 radar_channel; | 111 | u8 radar_channel; |
105 | u8 radar_type; | 112 | u8 radar_type; |
106 | 113 | ||
107 | /* time sync lsb*/ | 114 | /* time sync low lsb*/ |
108 | u16 time_sync_tsf_lsb; | 115 | __le16 time_sync_tsf_low_lsb; |
109 | 116 | ||
110 | } __packed; | 117 | } __packed; |
111 | 118 | ||
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index 33153565ad62..5f360cecbb0b 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c | |||
@@ -1566,6 +1566,13 @@ int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
1566 | cpu_to_le32(wl1271_tx_enabled_rates_get(wl, sta_rates, | 1566 | cpu_to_le32(wl1271_tx_enabled_rates_get(wl, sta_rates, |
1567 | wlvif->band)); | 1567 | wlvif->band)); |
1568 | 1568 | ||
1569 | if (!cmd->supported_rates) { | ||
1570 | wl1271_debug(DEBUG_CMD, | ||
1571 | "peer has no supported rates yet, configuring basic rates: 0x%x", | ||
1572 | wlvif->basic_rate_set); | ||
1573 | cmd->supported_rates = cpu_to_le32(wlvif->basic_rate_set); | ||
1574 | } | ||
1575 | |||
1569 | wl1271_debug(DEBUG_CMD, "new peer rates=0x%x queues=0x%x", | 1576 | wl1271_debug(DEBUG_CMD, "new peer rates=0x%x queues=0x%x", |
1570 | cmd->supported_rates, sta->uapsd_queues); | 1577 | cmd->supported_rates, sta->uapsd_queues); |
1571 | 1578 | ||
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 69267d592504..9abc15293307 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -5098,6 +5098,11 @@ static int wl12xx_update_sta_state(struct wl1271 *wl, | |||
5098 | if (ret < 0) | 5098 | if (ret < 0) |
5099 | return ret; | 5099 | return ret; |
5100 | 5100 | ||
5101 | /* reconfigure rates */ | ||
5102 | ret = wl12xx_cmd_add_peer(wl, wlvif, sta, wl_sta->hlid); | ||
5103 | if (ret < 0) | ||
5104 | return ret; | ||
5105 | |||
5101 | ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap, true, | 5106 | ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap, true, |
5102 | wl_sta->hlid); | 5107 | wl_sta->hlid); |
5103 | if (ret) | 5108 | if (ret) |
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index c172da56b550..5839acbbc782 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c | |||
@@ -241,7 +241,6 @@ static int wlcore_probe_of(struct device *dev, int *irq, | |||
241 | *irq = irq_of_parse_and_map(np, 0); | 241 | *irq = irq_of_parse_and_map(np, 0); |
242 | if (!*irq) { | 242 | if (!*irq) { |
243 | dev_err(dev, "No irq in platform data\n"); | 243 | dev_err(dev, "No irq in platform data\n"); |
244 | kfree(pdev_data); | ||
245 | return -EINVAL; | 244 | return -EINVAL; |
246 | } | 245 | } |
247 | 246 | ||