ath10k: Reduce number of peers to support peer stats feature
diff mbox

Message ID 1456210197-27892-1-git-send-email-akolli@qti.qualcomm.com
State Accepted
Headers show

Commit Message

akolli@qti.qualcomm.com Feb. 23, 2016, 6:49 a.m. UTC
From: Anilkumar Kolli <akolli@qti.qualcomm.com>

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.

Comments

kernel test robot Feb. 23, 2016, 7:09 a.m. UTC | #1
Hi Anilkumar,

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v4.5-rc5 next-20160223]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/akolli-qti-qualcomm-com/ath10k-Reduce-number-of-peers-to-support-peer-stats-feature/20160223-145312
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: xtensa-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers/net/wireless/ath/ath10k/core.c: In function 'ath10k_core_init_firmware_features':
>> drivers/net/wireless/ath/ath10k/core.c:1481:16: error: 'WMI_SERVICE_PEER_STATS' undeclared (first use in this function)
      if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
                   ^
   drivers/net/wireless/ath/ath10k/core.c:1481:16: note: each undeclared identifier is reported only once for each function it appears in
--
   drivers/net/wireless/ath/ath10k/wmi.c: In function 'ath10k_wmi_10_2_op_gen_init':
>> drivers/net/wireless/ath/ath10k/wmi.c:5464:15: error: 'WMI_SERVICE_PEER_STATS' undeclared (first use in this function)
     if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
                  ^
   drivers/net/wireless/ath/ath10k/wmi.c:5464:15: note: each undeclared identifier is reported only once for each function it appears in

vim +/WMI_SERVICE_PEER_STATS +1481 drivers/net/wireless/ath/ath10k/core.c

  1475				WMI_STAT_PEER;
  1476			ar->max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
  1477			break;
  1478		case ATH10K_FW_WMI_OP_VERSION_10_1:
  1479		case ATH10K_FW_WMI_OP_VERSION_10_2:
  1480		case ATH10K_FW_WMI_OP_VERSION_10_2_4:
> 1481			if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
  1482				ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS;
  1483				ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS;
  1484			} else {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
akolli@qti.qualcomm.com Feb. 23, 2016, 10:03 a.m. UTC | #2
Hi Kalle,

This patch depends on 'ath10k: add support for parsing per STA rx_duration for 10.2.4',
Which is part of ath.git pending branch.

Thanks,
Anil.


-----Original Message-----
From: kbuild test robot [mailto:lkp@intel.com] 
Sent: Tuesday, February 23, 2016 12:40 PM
To: Kolli, Anilkumar
Cc: kbuild-all@01.org; ath10k@lists.infradead.org; linux-wireless@vger.kernel.org; Kolli, Anilkumar
Subject: Re: [PATCH] ath10k: Reduce number of peers to support peer stats feature

Hi Anilkumar,

[auto build test ERROR on wireless-drivers-next/master] [also build test ERROR on v4.5-rc5 next-20160223] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/akolli-qti-qualcomm-com/ath10k-Reduce-number-of-peers-to-support-peer-stats-feature/20160223-145312
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: xtensa-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers/net/wireless/ath/ath10k/core.c: In function 'ath10k_core_init_firmware_features':
>> drivers/net/wireless/ath/ath10k/core.c:1481:16: error: 
>> 'WMI_SERVICE_PEER_STATS' undeclared (first use in this function)
      if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
                   ^
   drivers/net/wireless/ath/ath10k/core.c:1481:16: note: each undeclared identifier is reported only once for each function it appears in
--
   drivers/net/wireless/ath/ath10k/wmi.c: In function 'ath10k_wmi_10_2_op_gen_init':
>> drivers/net/wireless/ath/ath10k/wmi.c:5464:15: error: 
>> 'WMI_SERVICE_PEER_STATS' undeclared (first use in this function)
     if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
                  ^
   drivers/net/wireless/ath/ath10k/wmi.c:5464:15: note: each undeclared identifier is reported only once for each function it appears in

vim +/WMI_SERVICE_PEER_STATS +1481 drivers/net/wireless/ath/ath10k/core.c

  1475				WMI_STAT_PEER;
  1476			ar->max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
  1477			break;
  1478		case ATH10K_FW_WMI_OP_VERSION_10_1:
  1479		case ATH10K_FW_WMI_OP_VERSION_10_2:
  1480		case ATH10K_FW_WMI_OP_VERSION_10_2_4:
> 1481			if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
  1482				ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS;
  1483				ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS;
  1484			} else {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Ben Greear Feb. 23, 2016, 1:53 p.m. UTC | #3
On 02/22/2016 10:49 PM, akolli@qti.qualcomm.com wrote:
> From: Anilkumar Kolli <akolli@qti.qualcomm.com>
>
> 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.

Maybe this is OK for defaults, but we should also give the user the ability
to configure various things, including disabling pktlog, setting number
of vdevs, peers, tids, etc.  Maybe something like the parseable config file
patch I linked too earlier?

http://dmz2.candelatech.com/?p=linux-4.4.dev.y/.git;a=commit;h=6708e4047d91edf234239943332bc2f0d124d009

You can also save a lot of RAM in your firmware if you naturally pack your structs
better, and remove un-used members from various structures, etc.

Thanks,
Ben
akolli@qti.qualcomm.com Feb. 24, 2016, noon UTC | #4
Hi Ben,

We have one more patch to enable/disable this feature.
If we do not need this feature, disable this feature and number
of peers won't be reduced.

Thanks,
Anil.

-----Original Message-----
From: Ben Greear [mailto:greearb@candelatech.com] 
Sent: Tuesday, February 23, 2016 7:24 PM
To: Kolli, Anilkumar; ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] ath10k: Reduce number of peers to support peer stats feature



On 02/22/2016 10:49 PM, akolli@qti.qualcomm.com wrote:
> From: Anilkumar Kolli <akolli@qti.qualcomm.com>
>
> 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.

Maybe this is OK for defaults, but we should also give the user the ability to configure various things, including disabling pktlog, setting number of vdevs, peers, tids, etc.  Maybe something like the parseable config file patch I linked too earlier?

http://dmz2.candelatech.com/?p=linux-4.4.dev.y/.git;a=commit;h=6708e4047d91edf234239943332bc2f0d124d009

You can also save a lot of RAM in your firmware if you naturally pack your structs better, and remove un-used members from various structures, etc.

Thanks,
Ben

--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
Kalle Valo March 4, 2016, 8:43 a.m. UTC | #5
<akolli@qti.qualcomm.com> writes:

> From: Anilkumar Kolli <akolli@qti.qualcomm.com>
>
> 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.
>
> Signed-off-by: Anilkumar Kolli <akolli@qti.qualcomm.com>

Applied, thanks.

I add a note in the commit log that this fixes a crash with
firmware-5.bin_10.2.4.70.22-2.

Patch
diff mbox

========		=======================
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.

Signed-off-by: Anilkumar Kolli <akolli@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |  9 +++++++--
 drivers/net/wireless/ath/ath10k/hw.h   |  5 +++++
 drivers/net/wireless/ath/ath10k/wmi.c  | 10 ++++++++--
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 1f4a278..59a7b00 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1479,8 +1479,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;
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 4217bdb..c8c86a7 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -367,14 +367,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
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index b109b80..e77e60c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5517,9 +5517,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);