ath10k: adjust default peer limits if qcache enabled in 10.4 fw
authorRaja Mani <rmani@qti.qualcomm.com>
Mon, 22 Jun 2015 14:40:17 +0000 (20:10 +0530)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 30 Jun 2015 12:31:15 +0000 (15:31 +0300)
10.4 firmware supports upto 512 clients when qcache feature is enabled.
Make adjustment on default max peer count, active peers, number of tid in
such case to meet qcache requirement. 10.4 fw has extra unit info flag
NUM_UNITS_IS_NUM_ACTIVE_PEERS which is also handled in this patch.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/hw.h
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/ath10k/wmi.h

index 52fc0249378be11b0b32f5fe64d2c3d569455491..568c5ea5561f794b2fc8a7a5e4cf162b9672590f 100644 (file)
@@ -360,6 +360,12 @@ enum ath10k_hw_rate_cck {
 #define TARGET_10_4_NUM_PEERS                  ((TARGET_10_4_NUM_STATIONS) + \
                                                 (TARGET_10_4_NUM_VDEVS))
 #define TARGET_10_4_ACTIVE_PEERS               0
+
+/* TODO: increase qcache max client limit to 512 after
+ * testing with 512 client.
+ */
+#define TARGET_10_4_NUM_QCACHE_PEERS_MAX       256
+#define TARGET_10_4_QCACHE_ACTIVE_PEERS                50
 #define TARGET_10_4_NUM_OFFLOAD_PEERS          0
 #define TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS  0
 #define TARGET_10_4_NUM_PEER_KEYS              2
index 9502032f46dcde85ddb47605de1c62a28e225100..62ea0bca03e191e728f42ea078ed6b9f56da2358 100644 (file)
@@ -3826,20 +3826,39 @@ void ath10k_wmi_event_service_ready(struct ath10k *ar, struct sk_buff *skb)
                return;
        }
 
+       if (test_bit(WMI_SERVICE_PEER_CACHING, ar->wmi.svc_map)) {
+               ar->max_num_peers = TARGET_10_4_NUM_QCACHE_PEERS_MAX +
+                                   TARGET_10_4_NUM_VDEVS;
+               ar->num_active_peers = TARGET_10_4_QCACHE_ACTIVE_PEERS +
+                                      TARGET_10_4_NUM_VDEVS;
+               ar->num_tids = ar->num_active_peers * 2;
+               ar->max_num_stations = TARGET_10_4_NUM_QCACHE_PEERS_MAX;
+       }
+
+       /* TODO: Adjust max peer count for cases like WMI_SERVICE_RATECTRL_CACHE
+        * and WMI_SERVICE_IRAM_TIDS, etc.
+        */
+
        for (i = 0; i < num_mem_reqs; ++i) {
                req_id = __le32_to_cpu(arg.mem_reqs[i]->req_id);
                num_units = __le32_to_cpu(arg.mem_reqs[i]->num_units);
                unit_size = __le32_to_cpu(arg.mem_reqs[i]->unit_size);
                num_unit_info = __le32_to_cpu(arg.mem_reqs[i]->num_unit_info);
 
-               if (num_unit_info & NUM_UNITS_IS_NUM_PEERS)
+               if (num_unit_info & NUM_UNITS_IS_NUM_ACTIVE_PEERS) {
+                       if (ar->num_active_peers)
+                               num_units = ar->num_active_peers + 1;
+                       else
+                               num_units = ar->max_num_peers + 1;
+               } else if (num_unit_info & NUM_UNITS_IS_NUM_PEERS) {
                        /* number of units to allocate is number of
                         * peers, 1 extra for self peer on target */
                        /* this needs to be tied, host and target
                         * can get out of sync */
-                       num_units = TARGET_10X_NUM_PEERS + 1;
-               else if (num_unit_info & NUM_UNITS_IS_NUM_VDEVS)
-                       num_units = TARGET_10X_NUM_VDEVS + 1;
+                       num_units = ar->max_num_peers + 1;
+               } else if (num_unit_info & NUM_UNITS_IS_NUM_VDEVS) {
+                       num_units = ar->max_num_vdevs + 1;
+               }
 
                ath10k_dbg(ar, ATH10K_DBG_WMI,
                           "wmi mem_req_id %d num_units %d num_unit_info %d unit size %d actual units %d\n",
index b1bec031c1117d41aca4bc6cd513a36b739cc139..b1e4932f97f9c551e3f5a34b1a4c550974393da0 100644 (file)
@@ -2377,8 +2377,9 @@ struct wmi_resource_config_10_2 {
        __le32 feature_mask;
 } __packed;
 
-#define NUM_UNITS_IS_NUM_VDEVS   0x1
-#define NUM_UNITS_IS_NUM_PEERS   0x2
+#define NUM_UNITS_IS_NUM_VDEVS         BIT(0)
+#define NUM_UNITS_IS_NUM_PEERS         BIT(1)
+#define NUM_UNITS_IS_NUM_ACTIVE_PEERS  BIT(2)
 
 struct wmi_resource_config_10_4 {
        /* Number of virtual devices (VAPs) to support */