ath10k: fix the peer mac address in getting stats
PATCH 1/1 ath10k: fix the peer mac address in getting stats
Using the macro to convert the MAC address from WMI word format to char array has lead to the wrong peer mac address printed out while retrieving the peer stats from FW. Fix this.
--- drivers/net/wireless/ath/ath10k/debug.c | 4 ++-- drivers/net/wireless/ath/ath10k/wmi.h | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath10k/debug.c +2 -2
@@ -252,8 +252,8 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, peer_stats = (struct wmi_peer_stats *)tmp; s = &stats->peer_stat[i]; -WMI_MAC_ADDR_TO_CHAR_ARRAY (&peer_stats->peer_macaddr, - s->peer_macaddr); +memcpy (s->peer_macaddr, &peer_stats->peer_macaddr.addr, +ETH_ALEN ); s->peer_rssi =__le32_to_cpu (peer_stats->peer_rssi); s->peer_tx_rate =__le32_to_cpu (peer_stats->peer_tx_rate);
drivers/net/wireless/ath/ath10k/wmi.h +0 -10
@@ -198,16 +198,6 @@ struct wmi_mac_addr { } __packed; } __packed; -/* macro to convert MAC address from WMI word format to char array */ -#define WMI_MAC_ADDR_TO_CHAR_ARRAY (pwmi_mac_addr, c_macaddr) do { \ - (c_macaddr)[0] = ((pwmi_mac_addr)->word0) & 0xff; \ - (c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \ - (c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \ - (c_macaddr)[3] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \ - (c_macaddr)[4] = ((pwmi_mac_addr)->word1) & 0xff; \ - (c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 8) & 0xff; \ - } while (0) -struct wmi_cmd_map {u32 init_cmdid;u32 start_scan_cmdid;
Signature · 1 line
1.7.9.5
Quoted 16 lines · Chun-Yeow Yeoh
Using the macro to convert the MAC address from WMI word format to char array has lead to the wrong peer mac address printed out while retrieving the peer stats from FW. Fix this.
Signed-off-by Chun-Yeow Yeoh <[email protected]>--- drivers/net/wireless/ath/ath10k/debug.c | 4 ++-- drivers/net/wireless/ath/ath10k/wmi.h | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-)drivers/net/wireless/ath/ath10k/debug.c +0
-0
drivers/net/wireless/ath/ath10k/debug.c void ath10k_debug_read_target_stats(struct ath10k *ar, · line 256
Quoted 7 lines
drivers/net/wireless/ath/ath10k/debug.c +2
-2@@ -252,8 +252,8 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, peer_stats = (struct wmi_peer_stats *)tmp; s = &stats->peer_stat[i]; -WMI_MAC_ADDR_TO_CHAR_ARRAY (&peer_stats->peer_macaddr, - s->peer_macaddr); +memcpy (s->peer_macaddr, &peer_stats->peer_macaddr.addr, +ETH_ALEN );
I noticed checkpatch started suggesting to prefer ether_addr_copy() over memcpy(). Not a big deal though.
Other than that the patch looks good.
Michał
Quoted 20 lines · Michal Kazior
Quoted 19 lines · Chun-Yeow Yeoh
Using the macro to convert the MAC address from WMI word format to char array has lead to the wrong peer mac address printed out while retrieving the peer stats from FW. Fix this.
Signed-off-by Chun-Yeow Yeoh <[email protected]>--- drivers/net/wireless/ath/ath10k/debug.c | 4 ++-- drivers/net/wireless/ath/ath10k/wmi.h | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-)drivers/net/wireless/ath/ath10k/debug.c +0
-0@@ -252,8 +252,8 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, peer_stats = (struct wmi_peer_stats *)tmp; s = &stats->peer_stat[i];
Quoted 7 lines
drivers/net/wireless/ath/ath10k/debug.c void ath10k_debug_read_target_stats(struct ath10k *ar, · line 256
Quoted 4 lines
drivers/net/wireless/ath/ath10k/debug.c +2
-2-WMI_MAC_ADDR_TO_CHAR_ARRAY (&peer_stats->peer_macaddr, - s->peer_macaddr); +memcpy (s->peer_macaddr, &peer_stats->peer_macaddr.addr, +ETH_ALEN );I noticed checkpatch started suggesting to prefer
ether_addr_copy()overmemcpy(). Not a big deal though.
Yeah, especially that I haven't updated my checkpatch for few months and I don't see this warning yet :) (I'll try to keep ath10k checkpatch clean whenever possible.)
We need to switch ath10k to use ether_addr_copy() everywhere in a separate patch anyway.
Quoted 3 lines
Other than that the patch looks good.
Reviewed-by Michał Kazior <[email protected]>
Thanks, I added this to the patch.
Let's just hope that the l with the extra line doesn't cause any charset problems :) BTW, what is the name of the character? Never seen that before.
Signature · 1 line
Kalle Valo
Quoted 1 line · Kalle Valo
Michal Kazior <[email protected]> writes:
[...]
Quoted 9 lines
Quoted 3 lines
Other than that the patch looks good.
Reviewed-by Michał Kazior <[email protected]>Thanks, I added this to the patch.
Let's just hope that the l with the extra line doesn't cause any charset problems :) BTW, what is the name of the character? Never seen that before.
http://www.fileformat.info/info/unicode/char/142/index.htm
I don't care much if you s/ł/l/. I already commit patches with an l.
Michał
Kalle Valo
AppliedQuoted 6 lines · Chun-Yeow Yeoh
Using the macro to convert the MAC address from WMI word format to char array has lead to the wrong peer mac address printed out while retrieving the peer stats from FW. Fix this.
Signed-off-by Chun-Yeow Yeoh <[email protected]>
Thanks, applied.
Signature · 1 line
Kalle Valo