Skip to content

Commit

Permalink
ath10k-ct: stable patches, debugfs crashdump, 5.8 driver
Browse files Browse the repository at this point in the history
Add 5.8 ath10k-ct driver (only very lightly tested so far)

Enable debugfs crashdumps again for 5.7 and higher drivers.

Add in a few stable ath10k patches from upstream.

Signed-off-by: Ben Greear <greearb@candelatech.com>
  • Loading branch information
greearb committed Aug 25, 2020
1 parent edfbf91 commit 13319ff
Show file tree
Hide file tree
Showing 85 changed files with 89,748 additions and 10 deletions.
7 changes: 7 additions & 0 deletions ath10k-5.4/htt.h
Expand Up @@ -2105,6 +2105,7 @@ struct ath10k_htt_tx_ops {
int (*htt_h2t_aggr_cfg_msg)(struct ath10k_htt *htt,
u8 max_subfrms_ampdu,
u8 max_subfrms_amsdu);
void (*htt_flush_tx)(struct ath10k_htt *htt);
};

static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt)
Expand Down Expand Up @@ -2145,6 +2146,12 @@ static inline int ath10k_htt_tx(struct ath10k_htt *htt,
return htt->tx_ops->htt_tx(htt, vif, txmode, msdu);
}

static inline void ath10k_htt_flush_tx(struct ath10k_htt *htt)
{
if (htt->tx_ops->htt_flush_tx)
htt->tx_ops->htt_flush_tx(htt);
}

static inline int ath10k_htt_alloc_txbuff(struct ath10k_htt *htt)
{
if (!htt->tx_ops->htt_alloc_txbuff)
Expand Down
8 changes: 7 additions & 1 deletion ath10k-5.4/htt_tx.c
Expand Up @@ -533,10 +533,15 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt)
htt->tx_mem_allocated = false;
}

void ath10k_htt_tx_stop(struct ath10k_htt *htt)
static void ath10k_htt_flush_tx_queue(struct ath10k_htt *htt)
{

idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
}

void ath10k_htt_tx_stop(struct ath10k_htt *htt)
{
ath10k_htt_flush_tx_queue(htt);
idr_destroy(&htt->pending_tx);
}

Expand Down Expand Up @@ -2002,6 +2007,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_hl = {
.htt_send_frag_desc_bank_cfg = ath10k_htt_send_frag_desc_bank_cfg_32,
.htt_tx = ath10k_htt_tx_hl,
.htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg_32,
.htt_flush_tx = ath10k_htt_flush_tx_queue,
};

void ath10k_htt_set_tx_ops(struct ath10k_htt *htt)
Expand Down
5 changes: 4 additions & 1 deletion ath10k-5.4/mac.c
Expand Up @@ -4677,6 +4677,9 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work)
if (ret) {
ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n",
ret);
/* remove this msdu from idr tracking */
ath10k_wmi_cleanup_mgmt_tx_send(ar, skb);

dma_unmap_single(ar->dev, paddr, skb->len,
DMA_TO_DEVICE);
ieee80211_free_txskb(ar->hw, skb);
Expand Down Expand Up @@ -8136,6 +8139,7 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
ath10k_wmi_peer_flush(ar, arvif->vdev_id,
arvif->bssid, bitmap);
}
ath10k_htt_flush_tx(&ar->htt);
}
goto skip;
}
Expand Down Expand Up @@ -10119,7 +10123,6 @@ int ath10k_mac_register(struct ath10k *ar)
ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN;

if (test_bit(WMI_SERVICE_NLO, ar->wmi.svc_map)) {
ar->hw->wiphy->max_sched_scan_reqs = 1;
ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS;
ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS;
ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH;
Expand Down
1 change: 1 addition & 0 deletions ath10k-5.4/pci.c
Expand Up @@ -2405,6 +2405,7 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
napi_disable(&ar->napi);
ar->napi_enabled = false;
}
cancel_work_sync(&ar_pci->dump_work);

/* Most likely the device has HTT Rx ring configured. The only way to
* prevent the device from accessing (and possible corrupting) host
Expand Down
2 changes: 2 additions & 0 deletions ath10k-5.4/txrx.c
Expand Up @@ -212,9 +212,11 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
wake_up(&htt->empty_tx_wq);
spin_unlock_bh(&htt->tx_lock);

rcu_read_lock();
if (txq && txq->sta && skb_cb->airtime_est)
ieee80211_sta_register_airtime(txq->sta, txq->tid,
skb_cb->airtime_est, 0);
rcu_read_unlock();

if (ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL)
dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
Expand Down
10 changes: 10 additions & 0 deletions ath10k-5.4/wmi-ops.h
Expand Up @@ -135,6 +135,7 @@ struct wmi_ops {
struct sk_buff *(*gen_mgmt_tx_send)(struct ath10k *ar,
struct sk_buff *skb,
dma_addr_t paddr);
int (*cleanup_mgmt_tx_send)(struct ath10k *ar, struct sk_buff *msdu);
struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u64 module_enable,
u32 log_level);
struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter);
Expand Down Expand Up @@ -443,6 +444,15 @@ ath10k_wmi_get_txbf_conf_scheme(struct ath10k *ar)
return ar->wmi.ops->get_txbf_conf_scheme(ar);
}

static inline int
ath10k_wmi_cleanup_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu)
{
if (!ar->wmi.ops->cleanup_mgmt_tx_send)
return -EOPNOTSUPP;

return ar->wmi.ops->cleanup_mgmt_tx_send(ar, msdu);
}

static inline int
ath10k_wmi_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu,
dma_addr_t paddr)
Expand Down
15 changes: 15 additions & 0 deletions ath10k-5.4/wmi-tlv.c
Expand Up @@ -2837,6 +2837,18 @@ ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar, u32 stats_mask, u32 speci
return skb;
}

static int
ath10k_wmi_tlv_op_cleanup_mgmt_tx_send(struct ath10k *ar,
struct sk_buff *msdu)
{
struct ath10k_skb_cb *cb = ATH10K_SKB_CB(msdu);
struct ath10k_wmi *wmi = &ar->wmi;

idr_remove(&wmi->mgmt_pending_tx, cb->msdu_id);

return 0;
}

static int
ath10k_wmi_mgmt_tx_alloc_msdu_id(struct ath10k *ar, struct sk_buff *skb,
dma_addr_t paddr)
Expand Down Expand Up @@ -2911,6 +2923,8 @@ ath10k_wmi_tlv_op_gen_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu,
if (desc_id < 0)
goto err_free_skb;

cb->msdu_id = desc_id;

ptr = (void *)skb->data;
tlv = ptr;
tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_MGMT_TX_CMD);
Expand Down Expand Up @@ -4339,6 +4353,7 @@ static const struct wmi_ops wmi_tlv_ops = {
.gen_force_fw_hang = ath10k_wmi_tlv_op_gen_force_fw_hang,
/* .gen_mgmt_tx = not implemented; HTT is used */
.gen_mgmt_tx_send = ath10k_wmi_tlv_op_gen_mgmt_tx_send,
.cleanup_mgmt_tx_send = ath10k_wmi_tlv_op_cleanup_mgmt_tx_send,
.gen_dbglog_cfg = ath10k_wmi_tlv_op_gen_dbglog_cfg,
.gen_pktlog_enable = ath10k_wmi_tlv_op_gen_pktlog_enable,
.gen_pktlog_disable = ath10k_wmi_tlv_op_gen_pktlog_disable,
Expand Down
2 changes: 1 addition & 1 deletion ath10k-5.7/Makefile
Expand Up @@ -3,6 +3,7 @@ obj-$(CONFIG_ATH10K) += ath10k_core.o
ath10k_core-y += mac.o \
debug.o \
core.o \
coredump.o \
htc.o \
htt.o \
htt_rx.o \
Expand All @@ -21,7 +22,6 @@ ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o
ath10k_core-$(CONFIG_THERMAL) += thermal.o
ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o
ath10k_core-$(CONFIG_PM) += wow.o
ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
ath10k_core-$(CONFIG_ATH10K_CE) += ce.o

obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
Expand Down
1 change: 1 addition & 0 deletions ath10k-5.7/bmi.c
Expand Up @@ -380,6 +380,7 @@ static int ath10k_bmi_lz_data_large(struct ath10k *ar, const void *buffer, u32 l
NULL, NULL);
if (ret) {
ath10k_warn(ar, "unable to write to the device\n");
kfree(cmd);
return ret;
}

Expand Down
3 changes: 2 additions & 1 deletion ath10k-5.7/core.h
Expand Up @@ -1467,9 +1467,10 @@ struct ath10k {

u32 pktlog_filter;

#ifdef CONFIG_DEV_COREDUMP
#if ((defined CONFIG_DEV_COREDUMP) || defined (CONFIG_ATH10K_DEBUGFS))
struct {
struct ath10k_fw_crash_data *fw_crash_data;
struct ath10k_dump_file_data* dump; /* for debugfs */
} coredump;
#endif

Expand Down
25 changes: 25 additions & 0 deletions ath10k-5.7/coredump.c
Expand Up @@ -14,6 +14,8 @@
#include "debug.h"
#include "hw.h"

#if ((defined CONFIG_DEV_COREDUMP) || defined (CONFIG_ATH10K_DEBUGFS))

static const struct ath10k_mem_section qca6174_hw21_register_sections[] = {
{0x800, 0x810},
{0x820, 0x82C},
Expand Down Expand Up @@ -1339,7 +1341,23 @@ int ath10k_coredump_submit(struct ath10k *ar)
return -ENODATA;
}

#ifdef CONFIG_ATH10K_DEBUGFS
#ifdef CONFIG_DEV_COREDUMP
if (ar->coredump.dump)
vfree(ar->coredump.dump); /* guess nothing read the last one, clean it up. */
ar->coredump.dump = vzalloc(le32_to_cpu(dump->len)); /* second one for debugfs */
if (ar->coredump.dump) {
memcpy(ar->coredump.dump, dump, le32_to_cpu(dump->len));
}
#else
/* no coredump use what we have already allocated */
ar->coredump.dump = dump;
#endif
#endif

#ifdef CONFIG_DEV_COREDUMP
dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len), GFP_KERNEL);
#endif

return 0;
}
Expand Down Expand Up @@ -1380,6 +1398,7 @@ void ath10k_coredump_unregister(struct ath10k *ar)
struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data;

vfree(crash_data->ramdump_buf);
crash_data->ramdump_buf = NULL;
}

void ath10k_coredump_destroy(struct ath10k *ar)
Expand All @@ -1392,4 +1411,10 @@ void ath10k_coredump_destroy(struct ath10k *ar)

vfree(ar->coredump.fw_crash_data);
ar->coredump.fw_crash_data = NULL;

vfree(ar->coredump.dump);
ar->coredump.dump = NULL;
}


#endif /* debugfs or coredump */
5 changes: 2 additions & 3 deletions ath10k-5.7/coredump.h
Expand Up @@ -180,8 +180,7 @@ struct ath10k_hw_mem_layout {
/* FIXME: where to put this? */
extern unsigned long ath10k_coredump_mask;

#ifdef CONFIG_DEV_COREDUMP

#if ((defined CONFIG_DEV_COREDUMP) || defined (CONFIG_ATH10K_DEBUGFS))
int ath10k_coredump_submit(struct ath10k *ar);
struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar);
int ath10k_coredump_create(struct ath10k *ar);
Expand All @@ -191,7 +190,7 @@ void ath10k_coredump_destroy(struct ath10k *ar);

const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar);

#else /* CONFIG_DEV_COREDUMP */
#else /* CONFIG_DEV_COREDUMP || CONFIG_ATH10K_DEBUGFS */

static inline int ath10k_coredump_submit(struct ath10k *ar)
{
Expand Down
46 changes: 46 additions & 0 deletions ath10k-5.7/debug.c
Expand Up @@ -16,6 +16,7 @@
#include "hif.h"
#include "wmi-ops.h"
#include "mac.h"
#include "coredump.h"

/* ms */
#define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
Expand Down Expand Up @@ -1773,6 +1774,48 @@ static const struct file_operations fops_chip_id = {
.llseek = default_llseek,
};

static int ath10k_fw_crash_dump_open(struct inode *inode, struct file *file)
{
struct ath10k *ar = inode->i_private;

/*ath10k_warn(ar, "fw_crash_dump debugfs file is deprecated, please use /sys/class/devcoredump instead."); */
if (ar->coredump.dump) {
file->private_data = ar->coredump.dump;
ar->coredump.dump = NULL; /* dump_release will free the mem */
return 0;
}
else {
return -ENODATA;
}
}

static ssize_t ath10k_fw_crash_dump_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath10k_dump_file_data *dump_file = file->private_data;

return simple_read_from_buffer(user_buf, count, ppos,
dump_file,
le32_to_cpu(dump_file->len));
}

static int ath10k_fw_crash_dump_release(struct inode *inode,
struct file *file)
{
vfree(file->private_data);

return 0;
}

static const struct file_operations fops_fw_crash_dump = {
.open = ath10k_fw_crash_dump_open,
.read = ath10k_fw_crash_dump_read,
.release = ath10k_fw_crash_dump_release,
.owner = THIS_MODULE,
.llseek = default_llseek,
};

static ssize_t ath10k_reg_addr_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
Expand Down Expand Up @@ -4388,6 +4431,9 @@ int ath10k_debug_register(struct ath10k *ar)
debugfs_create_file("simulate_fw_crash", 0600, ar->debug.debugfs_phy, ar,
&fops_simulate_fw_crash);

debugfs_create_file("fw_crash_dump", 0400, ar->debug.debugfs_phy, ar,
&fops_fw_crash_dump);

debugfs_create_file("misc", 0400, ar->debug.debugfs_phy, ar,
&fops_misc);

Expand Down
7 changes: 7 additions & 0 deletions ath10k-5.7/htt.h
Expand Up @@ -2108,6 +2108,7 @@ struct ath10k_htt_tx_ops {
int (*htt_h2t_aggr_cfg_msg)(struct ath10k_htt *htt,
u8 max_subfrms_ampdu,
u8 max_subfrms_amsdu);
void (*htt_flush_tx)(struct ath10k_htt *htt);
};

static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt)
Expand Down Expand Up @@ -2148,6 +2149,12 @@ static inline int ath10k_htt_tx(struct ath10k_htt *htt,
return htt->tx_ops->htt_tx(htt, vif, txmode, msdu);
}

static inline void ath10k_htt_flush_tx(struct ath10k_htt *htt)
{
if (htt->tx_ops->htt_flush_tx)
htt->tx_ops->htt_flush_tx(htt);
}

static inline int ath10k_htt_alloc_txbuff(struct ath10k_htt *htt)
{
if (!htt->tx_ops->htt_alloc_txbuff)
Expand Down
8 changes: 7 additions & 1 deletion ath10k-5.7/htt_tx.c
Expand Up @@ -533,13 +533,18 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt)
htt->tx_mem_allocated = false;
}

void ath10k_htt_tx_stop(struct ath10k_htt *htt)
static void ath10k_htt_flush_tx_queue(struct ath10k_htt *htt)
{

/* TODO: Rebase and find where this was added.
* tasklet_kill(&htt->txrx_compl_task);
*/
idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
}

void ath10k_htt_tx_stop(struct ath10k_htt *htt)
{
ath10k_htt_flush_tx_queue(htt);
idr_destroy(&htt->pending_tx);
}

Expand Down Expand Up @@ -2015,6 +2020,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_hl = {
.htt_send_frag_desc_bank_cfg = ath10k_htt_send_frag_desc_bank_cfg_32,
.htt_tx = ath10k_htt_tx_hl,
.htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg_32,
.htt_flush_tx = ath10k_htt_flush_tx_queue,
};

void ath10k_htt_set_tx_ops(struct ath10k_htt *htt)
Expand Down

0 comments on commit 13319ff

Please sign in to comment.