Skip to contentSkip to conversation

ath11k: move per peer pktlog entry to per sta debugfs

PATCH Superseded Anilkumar Kolli 3 participants 6 messages Apr 16, 2019 – May 2, 2019 Qualcomm Atheros ATH11K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath11k: move per peer pktlog entry to per sta debugfs

Per peer pktlog is enabled through per sta debugfs Currently this feature is limited on single peer.

Enable pktlog using,
echo "0x6f 2" > /sys/kernel/debug/ath11k/mac0/pktlog_filter

Enable peer pktlog using,
echo 1 > /sys/kernel/debug/ieee80211/phy9/netdev\:wlan0/stations /8c\:fd\:f0\:0a\:8c\:14/peer_pktlog

---
 drivers/net/wireless/ath/ath11k/debug.c       | 99 +++++----------------------
 drivers/net/wireless/ath/ath11k/debugfs_sta.c | 80 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/dp_rx.c       |  2 +-
 3 files changed, 99 insertions(+), 82 deletions(-)
drivers/net/wireless/ath/ath11k/debug.c +18 -81
index f24099ed8dda..b6e18938ba5e 100644
@@ -992,10 +992,9 @@ static ssize_t ath11k_write_pktlog_filter(struct file *file,
 {
 	struct ath11k *ar = file->private_data;
 	struct htt_rx_ring_tlv_filter tlv_filter = {0};
-	u32 rx_filter = 0, ring_id, filter, peer_valid;
-	u8 buf[128] = {0}, mac_addr[ETH_ALEN] = {0}, mode;
-	char *token, *sptr;
-	int ret, i;
+	u32 rx_filter = 0, ring_id, filter, mode;
+	u8 buf[128] = {0};
+	int ret;
 	ssize_t rc;
 
 	mutex_lock(&ar->conf_mutex);
@@ -1010,24 +1009,13 @@ static ssize_t ath11k_write_pktlog_filter(struct file *file,
 		goto out;
 	}
 	buf[rc] = '\0';
-	sptr = buf;
-
-	token = strsep(&sptr, " ");
-	if (!token) {
-		ret = -EINVAL;
-		goto out;
-	}
 
-	if (kstrtou32(token, 0, &filter)) {
+	ret = sscanf(buf, "0x%x %u", &filter, &mode);
+	if (ret != 2) {
 		ret = -EINVAL;
 		goto out;
 	}
 
-	if (filter == ar->debug.pktlog_filter) {
-		ret = count;
-		goto out;
-	}
-
 	if (filter) {
 		ret = ath11k_wmi_pdev_pktlog_enable(ar, filter);
 		if (ret) {
@@ -1044,36 +1032,23 @@ static ssize_t ath11k_write_pktlog_filter(struct file *file,
 		}
 	}
 
-	token = strsep(&sptr, " ");
-	if (!token) {
-		ret = -EINVAL;
-		goto out;
-	}
-
-	if (kstrtou8(token, 0, &mode)) {
-		ret = -EINVAL;
-		goto out;
-	}
+#define HTT_RX_FILTER_TLV_LITE_MODE \
+			(HTT_RX_FILTER_TLV_FLAGS_PPDU_START | \
+			HTT_RX_FILTER_TLV_FLAGS_PPDU_END | \
+			HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS | \
+			HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS_EXT | \
+			HTT_RX_FILTER_TLV_FLAGS_PPDU_END_STATUS_DONE | \
+			HTT_RX_FILTER_TLV_FLAGS_MPDU_START)
 
 	if (mode == ATH11K_PKTLOG_MODE_FULL) {
-		rx_filter = HTT_RX_FILTER_TLV_FLAGS_PPDU_START |
-			    HTT_RX_FILTER_TLV_FLAGS_PPDU_END |
-			    HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS |
-			    HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS_EXT |
-			    HTT_RX_FILTER_TLV_FLAGS_PPDU_END_STATUS_DONE |
-			    HTT_RX_FILTER_TLV_FLAGS_MPDU_START |
+		rx_filter = HTT_RX_FILTER_TLV_LITE_MODE |
 			    HTT_RX_FILTER_TLV_FLAGS_MSDU_START |
 			    HTT_RX_FILTER_TLV_FLAGS_MSDU_END |
 			    HTT_RX_FILTER_TLV_FLAGS_MPDU_END |
 			    HTT_RX_FILTER_TLV_FLAGS_PACKET_HEADER |
 			    HTT_RX_FILTER_TLV_FLAGS_ATTENTION;
 	} else if (mode == ATH11K_PKTLOG_MODE_LITE) {
-		rx_filter = HTT_RX_FILTER_TLV_FLAGS_PPDU_START |
-			    HTT_RX_FILTER_TLV_FLAGS_PPDU_END |
-			    HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS |
-			    HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS_EXT |
-			    HTT_RX_FILTER_TLV_FLAGS_PPDU_END_STATUS_DONE |
-			    HTT_RX_FILTER_TLV_FLAGS_MPDU_START;
+		rx_filter = HTT_RX_FILTER_TLV_LITE_MODE;
 	}
 
 	tlv_filter.rx_filter = rx_filter;
@@ -1089,53 +1064,16 @@ static ssize_t ath11k_write_pktlog_filter(struct file *file,
 	ret = ath11k_dp_htt_rx_filter_setup(ar->ab, ring_id, ar->dp.mac_id,
 					    HAL_RXDMA_MONITOR_STATUS,
 					    DP_RX_BUFFER_SIZE, &tlv_filter);
-
 	if (ret) {
 		ath11k_warn(ar->ab, "failed to set rx filter for moniter status ring\n");
 		goto out;
 	}
 
-	token = strsep(&sptr, " ");
-	if (!token) {
-		ret = -EINVAL;
-		goto out;
-	}
-
-	if (kstrtou32(token, 0, &peer_valid)) {
-		ret = -EINVAL;
-		goto out;
-	}
-
-	if (peer_valid) {
-		token = strsep(&sptr, " ");
-		if (token) {
-			for (i = 0; i < ETH_ALEN - 1; i++) {
-				token = strsep(&sptr, ":");
-				if (!token)
-					return -EINVAL;
-
-				if (kstrtou8(token, 16, &mac_addr[i]))
-					return -EINVAL;
-			}
-			memcpy(ar->debug.pktlog_peer_addr, mac_addr, ETH_ALEN);
-		}
-	}
-
-	/* Send peer based pktlog enable/disable */
-	ret = ath11k_wmi_pdev_peer_pktlog_filter(ar, mac_addr, peer_valid);
-	if (ret) {
-		ath11k_warn(ar->ab, "failed to set peer pktlog filter %pM: %d\n",
-			    mac_addr, ret);
-		goto out;
-	}
-
-	ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "pktlog filter %d mode %s peer addr %pM\n",
-		   filter, ((mode == ATH11K_PKTLOG_MODE_FULL)?"full":"lite"),
-		   ar->debug.pktlog_peer_addr);
+	ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "pktlog filter %d mode %s\n",
+		   filter, ((mode == ATH11K_PKTLOG_MODE_FULL)?"full":"lite"));
 
 	ar->debug.pktlog_filter = filter;
 	ar->debug.pktlog_mode = mode;
-	ar->debug.pktlog_peer_valid = peer_valid;
 	ret = count;
 
 out:
@@ -1153,10 +1091,9 @@ static ssize_t ath11k_read_pktlog_filter(struct file *file,
 	int len = 0;
 
 	mutex_lock(&ar->conf_mutex);
-	len = scnprintf(buf, sizeof(buf) - len, "%08x %08x %08x\n",
+	len = scnprintf(buf, sizeof(buf) - len, "%08x %08x\n",
 			ar->debug.pktlog_filter,
-			ar->debug.pktlog_mode,
-			ar->debug.pktlog_peer_valid);
+			ar->debug.pktlog_mode);
 	mutex_unlock(&ar->conf_mutex);
 
 	return simple_read_from_buffer(ubuf, count, ppos, buf, len);
drivers/net/wireless/ath/ath11k/debugfs_sta.c +80 -0

90 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/dp_rx.c +1 -1
index cc18ce1228c4..4fea82f5b4b6 100644
@@ -988,7 +988,7 @@ static int ath11k_htt_pull_ppdu_stats(struct ath11k_base *ab,
 	ppdu_id = *((u32 *)data + 1);
 	ar = ab->pdevs[pdev_id].ar;
 
-	if (!ar->debug.pktlog_mode == ATH11K_PKTLOG_MODE_LITE) {
+	if (ar->debug.pktlog_mode == ATH11K_PKTLOG_MODE_LITE) {
 		/* TODO update the pktlog tracing */
 	}
 
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw
Quoted 11 lines · Anilkumar Kolli

Per peer pktlog is enabled through per sta debugfs Currently this feature is limited on single peer.

Enable pktlog using,
echo "0x6f 2" > /sys/kernel/debug/ath11k/mac0/pktlog_filter

Enable peer pktlog using,
echo 1 > /sys/kernel/debug/ieee80211/phy9/netdev\:wlan0/stations /8c\:fd\:f0\:0a\:8c\:14/peer_pktlog

Does not compile:

drivers/net/wireless/ath/ath11k/debugfs_sta.c:455:11: error: initialization of 'ssize_t (*)(struct file *, const char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, const char *, long unsigned int, long long int *)'} from incompatible pointer type 'ssize_t (*)(struct file *, char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, char *, long unsigned int, long long int *)'} [-Werror=incompatible-pointer-types]
.write = ath11k_dbg_sta_write_peer_pktlog,

           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 6 lines
Kalle Valo

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#2 lore raw

Hi Kalle,

Thanks for the review.

Quoted 13 lines
Quoted 2 lines

Does not compile:

drivers/net/wireless/ath/ath11k/debugfs_sta.c:455:11: error:
initialization of 'ssize_t (*)(struct file *, const char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, const char *, long unsigned int, long long int *)'} from incompatible pointer type 'ssize_t (*)(struct file *, char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, char *, long unsigned int, long long int *)'} [-Werror=incompatible-pointer-types]
.write = ath11k_dbg_sta_write_peer_pktlog,

Quoted 1 line
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I am using "arch/x86/configs/x86_64_defconfig" and ath11k enabled, could not reproduce this issue. Kindly share the build instructions.

Thanks
Anil.

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k

#3 lore raw
Quoted 19 lines · Anilkumar Kolli

Hi Kalle,

Thanks for the review.

Quoted 13 lines
Quoted 2 lines

Does not compile:

drivers/net/wireless/ath/ath11k/debugfs_sta.c:455:11: error:
initialization of 'ssize_t (*)(struct file *, const char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, const char *, long unsigned int, long long int *)'} from incompatible pointer type 'ssize_t (*)(struct file *, char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, char *, long unsigned int, long long int *)'} [-Werror=incompatible-pointer-types]
.write = ath11k_dbg_sta_write_peer_pktlog,

Quoted 1 line
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 4 lines

I am using "arch/x86/configs/x86_64_defconfig" and ath11k enabled, could not reproduce this issue.
Kindly share the build instructions.

My build machine configs,
./ath10k-check --version
ath10k-check (md5sum 5d3d5f426267bdc0a18e038d2f691a74)

gcc:            gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
sparse:         0.4.5-rc1
checkpatch.pl:  Version: 0.32 (md5sum 3a4f482bde0f92cd08f79fca7efd2a71)
gtags:          gtags - GNU GLOBAL 5.7.1

Thanks
Anil.

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k

#4 lore raw

On Wednesday, 24 April 2019 11:04:19 CEST Anilkumar Kolli wrote:
[...]

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

Does not compile:

drivers/net/wireless/ath/ath11k/debugfs_sta.c:455:11: error:
initialization of 'ssize_t (*)(struct file *, const char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, const char *, long unsigned int, long long int *)'} from incompatible pointer type 'ssize_t (*)(struct file *, char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, char *, long unsigned int, long long int *)'} [-Werror=incompatible-pointer-types]
.write = ath11k_dbg_sta_write_peer_pktlog,

           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 3 lines
Quoted 3 lines

I am using "arch/x86/configs/x86_64_defconfig" and ath11k enabled, could not reproduce this issue.
Kindly share the build instructions.

Not sure what kernel you compile against but the second argument (ubuf) is a const since a long time (before the history of the git repo starts). I can not tell you since when GCC checks the constness for function pointers. But try to upgrade to something recent like GCC 8.

Quoted 8 lines

My build machine configs,
./ath10k-check --version
ath10k-check (md5sum 5d3d5f426267bdc0a18e038d2f691a74)

gcc:            gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
sparse:         0.4.5-rc1
checkpatch.pl:  Version: 0.32 (md5sum 3a4f482bde0f92cd08f79fca7efd2a71)
gtags:          gtags - GNU GLOBAL 5.7.1

Btw. you should really think about not using such old components. Ever though about upgrading your system from a nearly EOL [1] ubuntu version from 2014 to something more recent?

Kind regards,
Sven

[1] https://blog.ubuntu.com/2019/02/05/ubuntu-14-04-trusty-tahr

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k

#5 lore raw
Quoted 27 lines · Sven Eckelmann

On Wednesday, 24 April 2019 11:04:19 CEST Anilkumar Kolli wrote:
[...]

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

Does not compile:

drivers/net/wireless/ath/ath11k/debugfs_sta.c:455:11: error:
initialization of 'ssize_t (*)(struct file *, const char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, const char *, long unsigned int, long long int *)'} from incompatible pointer type 'ssize_t (*)(struct file *, char *, size_t, loff_t *)' {aka 'long int (*)(struct file *, char *, long unsigned int, long long int *)'} [-Werror=incompatible-pointer-types]
.write = ath11k_dbg_sta_write_peer_pktlog,

           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 3 lines
Quoted 3 lines

I am using "arch/x86/configs/x86_64_defconfig" and ath11k enabled, could not reproduce this issue.
Kindly share the build instructions.

Not sure what kernel you compile against but the second argument (ubuf) is a const since a long time (before the history of the git repo starts). I can not tell you since when GCC checks the constness for function pointers. But try to upgrade to something recent like GCC 8.

Quoted 4 lines

My build machine configs,
./ath10k-check --version
ath10k-check (md5sum 5d3d5f426267bdc0a18e038d2f691a74)

Quoted 8 lines
Quoted 4 lines
gcc:            gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
sparse:         0.4.5-rc1
checkpatch.pl:  Version: 0.32 (md5sum 3a4f482bde0f92cd08f79fca7efd2a71)
gtags:          gtags - GNU GLOBAL 5.7.1

Btw. you should really think about not using such old components. Ever though about upgrading your system from a nearly EOL [1] ubuntu version from 2014 to something more recent?

Yeah, you really should upgrade your ancient distro. But for the kernel compilation I use crosstool as it's so easy to upgrade the kernel and not mess with distro's compiler:

https://www.kernel.org/pub/tools/crosstool/

Here's an example to install GCC 8.1 from crosstool:

wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.1.0/x86_64-gcc-8.1.0-nolibc-x86_64-linux.tar.xz
cd /opt/cross/
tar -xf ~/tmp/crosstool/x86_64-gcc-8.1.0-nolibc-x86_64-linux.tar.xz

And then just create GNUMakefile to the kernel's top level directory:

CROSS_COMPILE=/opt/cross/gcc-8.1.0-nolibc/x86_64-linux/bin/x86_64-linux- include Makefile

Now you can just run 'make' and the linux build system will use the new compiler.

Signature · 6 lines
Kalle Valo

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k