ath10k: reduce number of peers to support peer stats feature
authorAnilkumar Kolli <akolli@qti.qualcomm.com>
Tue, 23 Feb 2016 06:49:57 +0000 (12:19 +0530)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 3 Mar 2016 17:20:01 +0000 (19:20 +0200)
To enable per peer stats feature we are reducing the number of peers.
Firmware has introduced tx stats feature. We have memory limitation in
firmware to add these additional bytes.

These are the new variables introduced in the firmware.
======== =======================
Variable        Bytes required/per rate
======== =======================
TX success packets  1
TX failed packets 1
Retry packets 1
Success bytes 2
TX failed bytes 2
Retry bytes 2
Tx duration 4
Rate 1
Bw and AMPDU flags 1
Total 16 (because of allocation in word pattern)

Firmware sends these tx_stats in pktlog.
If we consider 4 feedbacks at a time, Frimware need about ~1K memory for coding
and 8192 bytes required / per rate [ 4*16*128(peers)].
To accommodate this firmware needs to reduce 10 peers.

This fixes a firmware crash with firmware-5.bin_10.2.4.70.22-2.

Signed-off-by: Anilkumar Kolli <akolli@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/core.c
drivers/net/wireless/ath/ath10k/hw.h
drivers/net/wireless/ath/ath10k/wmi.c

index 4d31764..c84c2d3 100644 (file)
@@ -1509,8 +1509,13 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
        case ATH10K_FW_WMI_OP_VERSION_10_1:
        case ATH10K_FW_WMI_OP_VERSION_10_2:
        case ATH10K_FW_WMI_OP_VERSION_10_2_4:
-               ar->max_num_peers = TARGET_10X_NUM_PEERS;
-               ar->max_num_stations = TARGET_10X_NUM_STATIONS;
+               if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
+                       ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS;
+                       ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS;
+               } else {
+                       ar->max_num_peers = TARGET_10X_NUM_PEERS;
+                       ar->max_num_stations = TARGET_10X_NUM_STATIONS;
+               }
                ar->max_num_vdevs = TARGET_10X_NUM_VDEVS;
                ar->htt.max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC;
                ar->fw_stats_req_mask = WMI_STAT_PEER;
index 2dece8d..f0cfbc7 100644 (file)
@@ -375,14 +375,19 @@ enum ath10k_hw_4addr_pad {
 #define TARGET_10X_MAC_AGGR_DELIM              0
 #define TARGET_10X_AST_SKID_LIMIT              128
 #define TARGET_10X_NUM_STATIONS                        128
+#define TARGET_10X_TX_STATS_NUM_STATIONS       118
 #define TARGET_10X_NUM_PEERS                   ((TARGET_10X_NUM_STATIONS) + \
                                                 (TARGET_10X_NUM_VDEVS))
+#define TARGET_10X_TX_STATS_NUM_PEERS          ((TARGET_10X_TX_STATS_NUM_STATIONS) + \
+                                                (TARGET_10X_NUM_VDEVS))
 #define TARGET_10X_NUM_OFFLOAD_PEERS           0
 #define TARGET_10X_NUM_OFFLOAD_REORDER_BUFS    0
 #define TARGET_10X_NUM_PEER_KEYS               2
 #define TARGET_10X_NUM_TIDS_MAX                        256
 #define TARGET_10X_NUM_TIDS                    min((TARGET_10X_NUM_TIDS_MAX), \
                                                    (TARGET_10X_NUM_PEERS) * 2)
+#define TARGET_10X_TX_STATS_NUM_TIDS           min((TARGET_10X_NUM_TIDS_MAX), \
+                                                   (TARGET_10X_TX_STATS_NUM_PEERS) * 2)
 #define TARGET_10X_TX_CHAIN_MASK               (BIT(0) | BIT(1) | BIT(2))
 #define TARGET_10X_RX_CHAIN_MASK               (BIT(0) | BIT(1) | BIT(2))
 #define TARGET_10X_RX_TIMEOUT_LO_PRI           100
index 1ce6742..7026138 100644 (file)
@@ -5516,9 +5516,15 @@ static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar)
        u32 len, val, features;
 
        config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS);
-       config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS);
        config.num_peer_keys = __cpu_to_le32(TARGET_10X_NUM_PEER_KEYS);
-       config.num_tids = __cpu_to_le32(TARGET_10X_NUM_TIDS);
+       if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
+               config.num_peers = __cpu_to_le32(TARGET_10X_TX_STATS_NUM_PEERS);
+               config.num_tids = __cpu_to_le32(TARGET_10X_TX_STATS_NUM_TIDS);
+       } else {
+               config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS);
+               config.num_tids = __cpu_to_le32(TARGET_10X_NUM_TIDS);
+       }
+
        config.ast_skid_limit = __cpu_to_le32(TARGET_10X_AST_SKID_LIMIT);
        config.tx_chain_mask = __cpu_to_le32(TARGET_10X_TX_CHAIN_MASK);
        config.rx_chain_mask = __cpu_to_le32(TARGET_10X_RX_CHAIN_MASK);