Skip to content

Commit

Permalink
ath10k-ct: Pull in some upstream patches.
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Greear <greearb@candelatech.com>
  • Loading branch information
greearb committed Jan 11, 2021
1 parent b753e8b commit 9fe1df7
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 51 deletions.
2 changes: 1 addition & 1 deletion ath10k-5.10/core.c
Expand Up @@ -3560,7 +3560,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
*/
ar->ct_all_pkts_htt = false;
}

if (test_bit(ATH10K_FW_FEATURE_SET_SPECIAL_CT,
ar->running_fw->fw_file.fw_features)) {
/* Apply user-supplied configuration changes. */
Expand Down
17 changes: 9 additions & 8 deletions ath10k-5.10/htt_tx.c
Expand Up @@ -1499,7 +1499,8 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
info->flags & IEEE80211_TX_CTL_TX_OFFCHAN, txmode);
}

/* ath10k_warn(ar, "info: %p vif: %p arvif: %p txo-active: %d\n", info, vif, arvif, arvif && arvif->txo_active); */
/*ath10k_warn(ar, "info: %p vif: %p arvif: %p txo-active: %d\n",
info, vif, arvif, arvif && arvif->txo_active); */

if (unlikely(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN))
freq = ar->scan.roc_freq;
Expand Down Expand Up @@ -1549,14 +1550,14 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
}

num_retries = info->control.rates[0].count;
} else if ((msdu->len >= 100) &&
(ieee80211_is_data_qos(fc) || ieee80211_is_data(fc)) &&
(!(ieee80211_is_qos_nullfunc(fc) || ieee80211_is_nullfunc(fc)))) {
} else if ((msdu->len >= 400) &&
(ieee80211_is_data_qos(fc) || ieee80211_is_data(fc)) &&
(!(ieee80211_is_qos_nullfunc(fc) || ieee80211_is_nullfunc(fc)))) {
/* Only do the overrides for data frames. */
/*ath10k_warn(ar, "qos-data: %d data: %d qos-nullfunc: %d nullfunc: %d\n",
ieee80211_is_data_qos(fc), ieee80211_is_data(fc),
ieee80211_is_qos_nullfunc(fc), ieee80211_is_nullfunc(fc));*/
/* In order to allow ARP to work, don't mess with frames < 100 bytes in length, assume
/* ath10k_warn(ar, "msdu->len: %d qos-data: %d data: %d qos-nullfunc: %d nullfunc: %d\n",
msdu->len, ieee80211_is_data_qos(fc), ieee80211_is_data(fc),
ieee80211_is_qos_nullfunc(fc), ieee80211_is_nullfunc(fc)); */
/* In order to allow ARP, DHCP, other such frames, don't mess with frames < 400 bytes in length, assume
* test frames are larger.
*/

Expand Down
7 changes: 6 additions & 1 deletion ath10k-5.10/usb.c
Expand Up @@ -997,6 +997,8 @@ static int ath10k_usb_probe(struct usb_interface *interface,

ar_usb = ath10k_usb_priv(ar);
ret = ath10k_usb_create(ar, interface);
if (ret)
goto err;
ar_usb->ar = ar;

ar->dev_id = product_id;
Expand All @@ -1009,14 +1011,17 @@ static int ath10k_usb_probe(struct usb_interface *interface,
ret = ath10k_core_register(ar, &bus_params);
if (ret) {
ath10k_warn(ar, "failed to register driver core: %d\n", ret);
goto err;
goto err_usb_destroy;
}

/* TODO: remove this once USB support is fully implemented */
ath10k_warn(ar, "Warning: ath10k USB support is incomplete, don't expect anything to work!\n");

return 0;

err_usb_destroy:
ath10k_usb_destroy(ar);

err:
ath10k_core_destroy(ar);

Expand Down
4 changes: 3 additions & 1 deletion ath10k-5.10/wmi-tlv.c
Expand Up @@ -1401,13 +1401,15 @@ static int ath10k_wmi_tlv_svc_avail_parse(struct ath10k *ar, u16 tag, u16 len,

switch (tag) {
case WMI_TLV_TAG_STRUCT_SERVICE_AVAILABLE_EVENT:
arg->service_map_ext_valid = true;
arg->service_map_ext_len = *(__le32 *)ptr;
arg->service_map_ext = ptr + sizeof(__le32);
return 0;
default:
break;
}
return -EPROTO;

return 0;
}

static int ath10k_wmi_tlv_op_pull_svc_avail(struct ath10k *ar,
Expand Down
9 changes: 7 additions & 2 deletions ath10k-5.10/wmi.c
Expand Up @@ -6198,8 +6198,13 @@ void ath10k_wmi_event_service_available(struct ath10k *ar, struct sk_buff *skb)
ret);
}

ath10k_wmi_map_svc_ext(ar, arg.service_map_ext, ar->wmi.svc_map,
__le32_to_cpu(arg.service_map_ext_len));
/*
* Initialization of "arg.service_map_ext_valid" to ZERO is necessary
* for the below logic to work.
*/
if (arg.service_map_ext_valid)
ath10k_wmi_map_svc_ext(ar, arg.service_map_ext, ar->wmi.svc_map,
__le32_to_cpu(arg.service_map_ext_len));
}

static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb)
Expand Down
1 change: 1 addition & 0 deletions ath10k-5.10/wmi.h
Expand Up @@ -7365,6 +7365,7 @@ struct wmi_svc_rdy_ev_arg {
};

struct wmi_svc_avail_ev_arg {
bool service_map_ext_valid;
__le32 service_map_ext_len;
const __le32 *service_map_ext;
};
Expand Down
2 changes: 1 addition & 1 deletion ath10k-5.4/ce.c
Expand Up @@ -1555,7 +1555,7 @@ ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int ce_id,
ret = ath10k_ce_alloc_shadow_base(ar, src_ring, nentries);
if (ret) {
dma_free_coherent(ar->dev,
(nentries * sizeof(struct ce_desc_64) +
(nentries * sizeof(struct ce_desc) +
CE_DESC_RING_ALIGN),
src_ring->base_addr_owner_space_unaligned,
base_addr);
Expand Down
3 changes: 2 additions & 1 deletion ath10k-5.4/debug.c
Expand Up @@ -2963,7 +2963,7 @@ static void ath10k_tpc_stats_print(struct ath10k_tpc_stats *tpc_stats,
*len += scnprintf(buf + *len, buf_len - *len,
"No. Preamble Rate_code ");

for (i = 0; i < WMI_TPC_TX_N_CHAIN; i++)
for (i = 0; i < tpc_stats->num_tx_chain; i++)
*len += scnprintf(buf + *len, buf_len - *len,
"tpc_value%d ", i);

Expand Down Expand Up @@ -4339,6 +4339,7 @@ void ath10k_debug_destroy(struct ath10k *ar)
ath10k_debug_fw_stats_reset(ar);

kfree(ar->debug.tpc_stats);
kfree(ar->debug.tpc_stats_final);

cancel_delayed_work_sync(&ar->debug.nop_dwork);
}
Expand Down
16 changes: 15 additions & 1 deletion ath10k-5.4/htt_rx.c
Expand Up @@ -142,6 +142,14 @@ static int __ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
BUILD_BUG_ON(HTT_RX_RING_FILL_LEVEL >= HTT_RX_RING_SIZE / 2);

idx = __le32_to_cpu(*htt->rx_ring.alloc_idx.vaddr);

if (idx < 0 || idx >= htt->rx_ring.size) {
ath10k_err(htt->ar, "rx ring index is not valid, firmware malfunctioning?\n");
idx &= htt->rx_ring.size_mask;
ret = -ENOMEM;
goto fail;
}

while (num > 0) {
skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN);
if (!skb) {
Expand Down Expand Up @@ -949,6 +957,7 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar,
u8 preamble = 0;
u8 group_id;
u32 info1, info2, info3;
u32 stbc, nsts_su;

info1 = __le32_to_cpu(rxd->ppdu_start.info1);
info2 = __le32_to_cpu(rxd->ppdu_start.info2);
Expand Down Expand Up @@ -993,11 +1002,16 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar,
*/
bw = info2 & 3;
sgi = info3 & 1;
stbc = (info2 >> 3) & 1;
group_id = (info2 >> 4) & 0x3F;

if (GROUP_ID_IS_SU_MIMO(group_id)) {
mcs = (info3 >> 4) & 0x0F;
nss = ((info2 >> 10) & 0x07) + 1;
nsts_su = ((info2 >> 10) & 0x07);
if (stbc)
nss = (nsts_su >> 2) + 1;
else
nss = (nsts_su + 1);
} else {
/* Hardware doesn't decode VHT-SIG-B into Rx descriptor
* so it's impossible to decode MCS. Also since
Expand Down
21 changes: 13 additions & 8 deletions ath10k-5.4/htt_tx.c
Expand Up @@ -1445,7 +1445,8 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
info->flags & IEEE80211_TX_CTL_TX_OFFCHAN, txmode);
}

/* ath10k_warn(ar, "info: %p vif: %p arvif: %p txo-active: %d\n", info, vif, arvif, arvif && arvif->txo_active); */
/*ath10k_warn(ar, "info: %p vif: %p arvif: %p txo-active: %d\n",
info, vif, arvif, arvif && arvif->txo_active); */

if (unlikely(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN))
freq = ar->scan.roc_freq;
Expand Down Expand Up @@ -1495,14 +1496,14 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
}

num_retries = info->control.rates[0].count;
} else if ((msdu->len >= 100) &&
(ieee80211_is_data_qos(fc) || ieee80211_is_data(fc)) &&
(!(ieee80211_is_qos_nullfunc(fc) || ieee80211_is_nullfunc(fc)))) {
} else if ((msdu->len >= 400) &&
(ieee80211_is_data_qos(fc) || ieee80211_is_data(fc)) &&
(!(ieee80211_is_qos_nullfunc(fc) || ieee80211_is_nullfunc(fc)))) {
/* Only do the overrides for data frames. */
/*ath10k_warn(ar, "qos-data: %d data: %d qos-nullfunc: %d nullfunc: %d\n",
ieee80211_is_data_qos(fc), ieee80211_is_data(fc),
ieee80211_is_qos_nullfunc(fc), ieee80211_is_nullfunc(fc));*/
/* In order to allow ARP to work, don't mess with frames < 100 bytes in length, assume
/* ath10k_warn(ar, "msdu->len: %d qos-data: %d data: %d qos-nullfunc: %d nullfunc: %d\n",
msdu->len, ieee80211_is_data_qos(fc), ieee80211_is_data(fc),
ieee80211_is_qos_nullfunc(fc), ieee80211_is_nullfunc(fc)); */
/* In order to allow ARP, DHCP, other such frames, don't mess with frames < 400 bytes in length, assume
* test frames are larger.
*/

Expand Down Expand Up @@ -1757,7 +1758,9 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
err_unmap_msdu:
dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
err_free_msdu_id:
spin_lock_bh(&htt->tx_lock);
ath10k_htt_tx_free_msdu_id(htt, msdu_id);
spin_unlock_bh(&htt->tx_lock);
err:
return res;
}
Expand Down Expand Up @@ -1977,7 +1980,9 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt,
err_unmap_msdu:
dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
err_free_msdu_id:
spin_lock_bh(&htt->tx_lock);
ath10k_htt_tx_free_msdu_id(htt, msdu_id);
spin_unlock_bh(&htt->tx_lock);
err:
return res;
}
Expand Down
2 changes: 1 addition & 1 deletion ath10k-5.4/mac.c
Expand Up @@ -8226,7 +8226,7 @@ ath10k_mac_update_bss_chan_survey(struct ath10k *ar,
struct ieee80211_channel *channel)
{
int ret;
enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR;
enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ;

lockdep_assert_held(&ar->conf_mutex);

Expand Down
22 changes: 18 additions & 4 deletions ath10k-5.4/sdio.c
Expand Up @@ -550,6 +550,10 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar,
le16_to_cpu(htc_hdr->len),
ATH10K_HTC_MBOX_MAX_PAYLOAD_LENGTH);
ret = -ENOMEM;

queue_work(ar->workqueue, &ar->restart_work);
ath10k_warn(ar, "exceeds length, start recovery\n");

goto err;
}

Expand Down Expand Up @@ -1582,23 +1586,33 @@ static int ath10k_sdio_hif_diag_read(struct ath10k *ar, u32 address, void *buf,
size_t buf_len)
{
int ret;
void *mem;

mem = kzalloc(buf_len, GFP_KERNEL);
if (!mem)
return -ENOMEM;

/* set window register to start read cycle */
ret = ath10k_sdio_write32(ar, MBOX_WINDOW_READ_ADDR_ADDRESS, address);
if (ret) {
ath10k_warn(ar, "failed to set mbox window read address: %d", ret);
return ret;
goto out;
}

/* read the data */
ret = ath10k_sdio_read(ar, MBOX_WINDOW_DATA_ADDRESS, buf, buf_len);
ret = ath10k_sdio_read(ar, MBOX_WINDOW_DATA_ADDRESS, mem, buf_len);
if (ret) {
ath10k_warn(ar, "failed to read from mbox window data address: %d\n",
ret);
return ret;
goto out;
}

return 0;
memcpy(buf, mem, buf_len);

out:
kfree(mem);

return ret;
}

static int ath10k_sdio_hif_diag_read32(struct ath10k *ar, u32 address,
Expand Down
7 changes: 6 additions & 1 deletion ath10k-5.4/usb.c
Expand Up @@ -1009,6 +1009,8 @@ static int ath10k_usb_probe(struct usb_interface *interface,

ar_usb = ath10k_usb_priv(ar);
ret = ath10k_usb_create(ar, interface);
if (ret)
goto err;
ar_usb->ar = ar;

ar->dev_id = product_id;
Expand All @@ -1021,14 +1023,17 @@ static int ath10k_usb_probe(struct usb_interface *interface,
ret = ath10k_core_register(ar, &bus_params);
if (ret) {
ath10k_warn(ar, "failed to register driver core: %d\n", ret);
goto err;
goto err_usb_destroy;
}

/* TODO: remove this once USB support is fully implemented */
ath10k_warn(ar, "Warning: ath10k USB support is incomplete, don't expect anything to work!\n");

return 0;

err_usb_destroy:
ath10k_usb_destroy(ar);

err:
ath10k_core_destroy(ar);

Expand Down
4 changes: 3 additions & 1 deletion ath10k-5.4/wmi-tlv.c
Expand Up @@ -1260,13 +1260,15 @@ static int ath10k_wmi_tlv_svc_avail_parse(struct ath10k *ar, u16 tag, u16 len,

switch (tag) {
case WMI_TLV_TAG_STRUCT_SERVICE_AVAILABLE_EVENT:
arg->service_map_ext_valid = true;
arg->service_map_ext_len = *(__le32 *)ptr;
arg->service_map_ext = ptr + sizeof(__le32);
return 0;
default:
break;
}
return -EPROTO;

return 0;
}

static int ath10k_wmi_tlv_op_pull_svc_avail(struct ath10k *ar,
Expand Down

2 comments on commit 9fe1df7

@julianocss
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @greearb .

Are you planning to port these patches to 5.8 Kernel?

I am asking because
Openwrt currently is using 5.8 version to compile ct drivers.

Juliano

@Noltari
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @greearb .

Are you planning to port these patches to 5.8 Kernel?

I am asking because
Openwrt currently is using 5.8 version to compile ct drivers.

Juliano

Hi @julianocss @greearb, OpenWrt is now using 5.10, so this is no longer needed:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=a5c4c404764e9125d7a6c435c2f8d840c68ceed2

Best regards.

Please sign in to comment.