diff mbox

[v2,2/2] mac80211: last ack signal support in station dump

Message ID 1528121469-16450-3-git-send-email-bpothuno@codeaurora.org (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show

Commit Message

Balaji Pothunoori June 4, 2018, 2:11 p.m. UTC
This patch adds "last ack signal" and "avg ack signal" support
in station dump for valid ack rssi.

Signed-off-by: Balaji Pothunoori <bpothuno@codeaurora.org>
---
v2:
 - typo corrected in subject

 net/mac80211/sta_info.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Johannes Berg June 15, 2018, 11:43 a.m. UTC | #1
On Mon, 2018-06-04 at 19:41 +0530, Balaji Pothunoori wrote:
> 
> +	if (ieee80211_hw_check(&sta->local->hw, REPORTS_TX_ACK_STATUS)) {
> +		if (sta->status_stats.ack_signal_filled && ((!(sinfo->filled &
> +		    BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL))) ||
> +		    (!(sinfo->filled &
> +		    BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG))))) {

Uh, wow, the indentation here is awful - please break with && and || on
the end of line and indent properly according to the nesting level.

If a line ends up being longer than 80, I think that's better than this
monster expression :)

> +			sinfo->ack_signal =
> +				sta->status_stats.last_ack_signal;
> +			sinfo->filled |=
> +				BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
> +			sinfo->avg_ack_signal =
> +				-(s8)ewma_avg_signal_read(
>  				&sta->status_stats.avg_ack_signal);
> -		sinfo->filled |=
> -			BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG);
> +			sinfo->filled |=
> +				BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
> +		}

Clearly your previous patch would even break the kernel compile since
the DATA_ACK_SIGNAL_AVG is still used here.



Finally, please also explain why you're adding this feature, at least in
the cover letter ("PATCH 0/2"), I can reuse that as a merge commit
message if necessary.

johannes
Balaji Pothunoori June 18, 2018, 10:25 a.m. UTC | #2
On 2018-06-15 17:13, Johannes Berg wrote:
> On Mon, 2018-06-04 at 19:41 +0530, Balaji Pothunoori wrote:
>> 
>> +	if (ieee80211_hw_check(&sta->local->hw, REPORTS_TX_ACK_STATUS)) {
>> +		if (sta->status_stats.ack_signal_filled && ((!(sinfo->filled &
>> +		    BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL))) ||
>> +		    (!(sinfo->filled &
>> +		    BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG))))) {
> 
> Uh, wow, the indentation here is awful - please break with && and || on
> the end of line and indent properly according to the nesting level.
> 
> If a line ends up being longer than 80, I think that's better than this
> monster expression :)

Sure , i will modify in v3.

> 
>> +			sinfo->ack_signal =
>> +				sta->status_stats.last_ack_signal;
>> +			sinfo->filled |=
>> +				BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
>> +			sinfo->avg_ack_signal =
>> +				-(s8)ewma_avg_signal_read(
>>  				&sta->status_stats.avg_ack_signal);
>> -		sinfo->filled |=
>> -			BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG);
>> +			sinfo->filled |=
>> +				BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
>> +		}
> 
> Clearly your previous patch would even break the kernel compile since
> the DATA_ACK_SIGNAL_AVG is still used here.

Here i have used "NL80211_STA_INFO_ACK_SIGNAL_AVG" not as 
"NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG".

> 
> 
> 
> Finally, please also explain why you're adding this feature, at least 
> in
> the cover letter ("PATCH 0/2"), I can reuse that as a merge commit
> message if necessary.

Sure, i will update in v3.

> 
> johannes

Regards,
Balaji.
diff mbox

Patch

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 6428f1a..12b618e 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2310,13 +2310,21 @@  void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
 		sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
 	}
 
-	if (ieee80211_hw_check(&sta->local->hw, REPORTS_TX_ACK_STATUS) &&
-	    !(sinfo->filled & BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG))) {
-		sinfo->avg_ack_signal =
-			-(s8)ewma_avg_signal_read(
+	if (ieee80211_hw_check(&sta->local->hw, REPORTS_TX_ACK_STATUS)) {
+		if (sta->status_stats.ack_signal_filled && ((!(sinfo->filled &
+		    BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL))) ||
+		    (!(sinfo->filled &
+		    BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG))))) {
+			sinfo->ack_signal =
+				sta->status_stats.last_ack_signal;
+			sinfo->filled |=
+				BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
+			sinfo->avg_ack_signal =
+				-(s8)ewma_avg_signal_read(
 				&sta->status_stats.avg_ack_signal);
-		sinfo->filled |=
-			BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG);
+			sinfo->filled |=
+				BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
+		}
 	}
 }