Re: [PATCH] ath10k: add pktlog support for 10.4 firmware

2015-08-19 Thread Kalle Valo
Raja Mani  writes:

> 10.4 firmware uses dedicated copy engine for pktlog transaction.
> Whatever the data received in that dedicated copy engine will
> have only pkt log header and followed by pktlog payload (will not
> have htc header). In the current design, htc layer callback
> registered with hif are acting as default receiver for all copy
> engine. We need to change the design in a way dedicated copy
> engine assigned for pktlog directly goes to pktlog module
> (bypassing htc) and rest of copy engine data goes to htc layer.
> In order to meet this, hif layer is changed to maintain copy
> engine specific tx and rx callbacks.
>
> Also, new firmware ie is added to get copy engine number used
> for pktlog in the firmware. Based this, pktlog receiver callback
> handler will be plugged into hif layer.
>
> pktlog.c/h are newly added to have pktlog related stuff.
> 10.4 firmware pktlog header differs from non 10.4 firmware.
> So, new pktlog header is added for 10.4.
>
> This patch enables pktlog to capture only TX related info on
> 10.4 firmware. Some more effort is need to capture RX related
> info in pktlog which is not covered in this patch.
>
> Signed-off-by: Raja Mani 

Like discussed privately, let's drop this now and revisit later.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath10k: add pktlog support for 10.4 firmware

2015-06-23 Thread Raja Mani
10.4 firmware uses dedicated copy engine for pktlog transaction.
Whatever the data received in that dedicated copy engine will
have only pkt log header and followed by pktlog payload (will not
have htc header). In the current design, htc layer callback
registered with hif are acting as default receiver for all copy
engine. We need to change the design in a way dedicated copy
engine assigned for pktlog directly goes to pktlog module
(bypassing htc) and rest of copy engine data goes to htc layer.
In order to meet this, hif layer is changed to maintain copy
engine specific tx and rx callbacks.

Also, new firmware ie is added to get copy engine number used
for pktlog in the firmware. Based this, pktlog receiver callback
handler will be plugged into hif layer.

pktlog.c/h are newly added to have pktlog related stuff.
10.4 firmware pktlog header differs from non 10.4 firmware.
So, new pktlog header is added for 10.4.

This patch enables pktlog to capture only TX related info on
10.4 firmware. Some more effort is need to capture RX related
info in pktlog which is not covered in this patch.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/Makefile |  3 +-
 drivers/net/wireless/ath/ath10k/core.c   | 28 +-
 drivers/net/wireless/ath/ath10k/core.h   |  3 ++
 drivers/net/wireless/ath/ath10k/hif.h| 12 
 drivers/net/wireless/ath/ath10k/htc.c| 15 --
 drivers/net/wireless/ath/ath10k/htt_rx.c |  1 +
 drivers/net/wireless/ath/ath10k/hw.h | 12 ++--
 drivers/net/wireless/ath/ath10k/pci.c| 26 +++-
 drivers/net/wireless/ath/ath10k/pci.h|  2 +-
 drivers/net/wireless/ath/ath10k/pktlog.c | 51 
 drivers/net/wireless/ath/ath10k/pktlog.h | 41 +
 11 files changed, 168 insertions(+), 26 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/pktlog.c
 create mode 100644 drivers/net/wireless/ath/ath10k/pktlog.h

diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index c04fb00..c811b8e 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -12,7 +12,8 @@ ath10k_core-y += mac.o \
 bmi.o \
 hw.o \
 p2p.o \
-swap.o
+swap.o \
+pktlog.o
 
 ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o
 ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index be5f01c..39211c8 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -29,6 +29,7 @@
 #include "htt.h"
 #include "testmode.h"
 #include "wmi-ops.h"
+#include "pktlog.h"
 
 unsigned int ath10k_debug_mask;
 static bool uart_print;
@@ -675,7 +676,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k 
*ar, const char *name)
int ie_id, i, index, bit, ret;
struct ath10k_fw_ie *hdr;
const u8 *data;
-   __le32 *timestamp, *version;
+   __le32 *timestamp, *version, *ce_id;
 
/* first fetch the firmware file (firmware-*.bin) */
ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name);
@@ -819,6 +820,24 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k 
*ar, const char *name)
ar->swap.firmware_codeswap_data = data;
ar->swap.firmware_codeswap_len = ie_len;
break;
+   case ATH10K_FW_IE_PKTLOG_DEDICATED_CE:
+   if (ie_len != sizeof(u32))
+   break;
+
+   ce_id = (__le32 *)data;
+   ar->pktlog_ce = le32_to_cpup(ce_id);
+
+   if (ar->pktlog_ce >= CE_COUNT) {
+   ath10k_warn(ar, "invalid ce number supplied for 
pktlog %d\n",
+   ar->pktlog_ce);
+   break;
+   }
+
+   ar->pktlog_ce_found = true;
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "found fw ie dedicated ce number for pktlog 
%d\n",
+  ar->pktlog_ce);
+   break;
default:
ath10k_warn(ar, "Unknown FW IE: %u\n",
le32_to_cpu(hdr->id));
@@ -1499,6 +1518,13 @@ static void ath10k_core_register_work(struct work_struct 
*work)
goto err_spectral_destroy;
}
 
+   status = ath10k_pktlog_init(ar);
+   if (status) {
+   ath10k_err(ar, "failed to initialize pktlog: %d\n",
+  status);
+   goto err_spectral_destroy;
+   }
+
set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags);
return;
 
diff --git a/drivers/net/wireless/ath/ath10k/core.