Re: [PATCHv2 3/3] ath10k: average ack rssi support for data frames

2018-09-06 Thread Kalle Valo
Balaji Pothunoori  wrote:

> Average ack rssi value is weighted average of ack rssi for
> no of msdu's has been sent.
> This feature is enabled by the host driver if firmware is capable.
> After receiving event from host, firmware allocates the necessary
> memory to store the ack_rssi for data packets during the init time.
> 
> After each successful transmission, If tx completion status is OK
> and 24th bit is set in HTT message header then host will fetch the
> ack_rssi else host can ignore the ack_rssi field.
> 
> Signed-off-by: Balaji Pothunoori 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

c7fd8d237e2e ath10k: average ack rssi support for data frames

-- 
https://patchwork.kernel.org/patch/10343153/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCHv2 3/3] ath10k: average ack rssi support for data frames

2018-09-05 Thread Balaji Pothunoori

On 2018-09-05 10:20, Kalle Valo wrote:

Balaji Pothunoori  writes:


Average ack rssi value is weighted average of ack rssi for
no of msdu's has been sent.
This feature is enabled by the host driver if firmware is capable.
After receiving event from host, firmware allocates the necessary
memory to store the ack_rssi for data packets during the init time.

After each successful transmission, If tx completion status is OK
and 24th bit is set in HTT message header then host will fetch the
ack_rssi else host can ignore the ack_rssi field.

Signed-off-by: Balaji Pothunoori 


There were two new warnings:

drivers/net/wireless/ath/ath10k/htt_rx.c:1928: line over 90 characters
drivers/net/wireless/ath/ath10k/mac.c:8511: Alignment should match
open parenthesis


In v3 i have addressed Alignment warning.



I fixed those in the pending branch. The first one I solved by adding a
temporary variable 'msdus'. Please review:


Thanks kalle for optimizing the code , I am fine with the changes.



https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=e4ac90b9c915a3b86eeef60509a6d2bb85d3507d



___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCHv2 3/3] ath10k: average ack rssi support for data frames

2018-09-04 Thread Kalle Valo
Balaji Pothunoori  writes:

> Average ack rssi value is weighted average of ack rssi for
> no of msdu's has been sent.
> This feature is enabled by the host driver if firmware is capable.
> After receiving event from host, firmware allocates the necessary
> memory to store the ack_rssi for data packets during the init time.
>
> After each successful transmission, If tx completion status is OK
> and 24th bit is set in HTT message header then host will fetch the
> ack_rssi else host can ignore the ack_rssi field.
>
> Signed-off-by: Balaji Pothunoori 

There were two new warnings:

drivers/net/wireless/ath/ath10k/htt_rx.c:1928: line over 90 characters
drivers/net/wireless/ath/ath10k/mac.c:8511: Alignment should match open 
parenthesis

I fixed those in the pending branch. The first one I solved by adding a
temporary variable 'msdus'. Please review:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=e4ac90b9c915a3b86eeef60509a6d2bb85d3507d

-- 
Kalle Valo

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCHv2 3/3] ath10k: average ack rssi support for data frames

2018-04-16 Thread Balaji Pothunoori
Average ack rssi value is weighted average of ack rssi for
no of msdu's has been sent.
This feature is enabled by the host driver if firmware is capable.
After receiving event from host, firmware allocates the necessary
memory to store the ack_rssi for data packets during the init time.

After each successful transmission, If tx completion status is OK
and 24th bit is set in HTT message header then host will fetch the
ack_rssi else host can ignore the ack_rssi field.

Signed-off-by: Balaji Pothunoori 
---
 drivers/net/wireless/ath/ath10k/core.c   |  4 
 drivers/net/wireless/ath/ath10k/htt.h|  6 +-
 drivers/net/wireless/ath/ath10k/htt_rx.c | 22 +-
 drivers/net/wireless/ath/ath10k/mac.c|  4 
 drivers/net/wireless/ath/ath10k/wmi.h|  8 
 5 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 8a3020d..0fe98e9 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2307,6 +2307,10 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
 ar->wmi.svc_map))
val |= WMI_10_4_TDLS_UAPSD_BUFFER_STA;
 
+   if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI,
+ar->wmi.svc_map))
+   val |= WMI_10_4_TX_DATA_ACK_RSSI;
+
status = ath10k_mac_ext_resource_config(ar, val);
if (status) {
ath10k_err(ar,
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 8cc2a8b..bd39d6b 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005-2011 Atheros Communications Inc.
  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -557,6 +558,8 @@ struct htt_mgmt_tx_completion {
 #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_MASK 0xFF00
 #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_LSB  24
 
+#define HTT_TX_CMPL_FLAG_DATA_RSSI BIT(0)
+
 struct htt_rx_indication_hdr {
u8 info0; /* %HTT_RX_INDICATION_INFO0_ */
__le16 peer_id;
@@ -820,7 +823,7 @@ struct htt_data_tx_completion {
} __packed;
} __packed;
u8 num_msdus;
-   u8 rsvd0;
+   u8 flags2; /* HTT_TX_CMPL_FLAG_DATA_RSSI */
__le16 msdus[0]; /* variable length based on %num_msdus */
 } __packed;
 
@@ -1648,6 +1651,7 @@ struct htt_resp {
 struct htt_tx_done {
u16 msdu_id;
u16 status;
+   u8 ack_rssi;
 };
 
 enum htt_tx_compl_state {
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 5e02e26..0228bbe 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1882,6 +1882,8 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
int status = MS(resp->data_tx_completion.flags, HTT_DATA_TX_STATUS);
__le16 msdu_id;
int i;
+   bool rssi_enabled = false;
+   u8 msdu_count = 0;
 
switch (status) {
case HTT_DATA_TX_STATUS_NO_ACK:
@@ -1904,10 +1906,28 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k 
*ar,
ath10k_dbg(ar, ATH10K_DBG_HTT, "htt tx completion num_msdus %d\n",
   resp->data_tx_completion.num_msdus);
 
-   for (i = 0; i < resp->data_tx_completion.num_msdus; i++) {
+   msdu_count = resp->data_tx_completion.num_msdus;
+
+   if (resp->data_tx_completion.flags2 & HTT_TX_CMPL_FLAG_DATA_RSSI)
+   rssi_enabled = true;
+
+   for (i = 0; i < msdu_count; i++) {
msdu_id = resp->data_tx_completion.msdus[i];
tx_done.msdu_id = __le16_to_cpu(msdu_id);
 
+   if (rssi_enabled) {
+   /* Total no of MSDUs should be even,
+* if odd MSDUs are sent firmware fills
+* last msdu id with 0x
+*/
+   if (msdu_count & 0x01) {
+   msdu_id = 
resp->data_tx_completion.msdus[msdu_count +  i + 1];
+   tx_done.ack_rssi = __le16_to_cpu(msdu_id);
+   } else {
+   msdu_id = 
resp->data_tx_completion.msdus[msdu_count +  i];
+   tx_done.ack_rssi = __le16_to_cpu(msdu_id);
+   }
+   }
/* kfifo_put: In practice firmware shouldn't fire off per-CE
 * interrupt and main interrupt (MSI/-X range case) for the same
 * HTC service so it should be safe to use kfifo_put w/o