Commit 8d40a13b authored by Kalle Valo's avatar Kalle Valo

Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git

ath.git patches for v6.1. Only fixes this time.
parents 7c13844c b383e8ab
...@@ -98,6 +98,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -98,6 +98,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = true, .tx_stats_over_pktlog = true,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA988X_HW_2_0_VERSION, .id = QCA988X_HW_2_0_VERSION,
...@@ -136,6 +137,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -136,6 +137,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = true, .tx_stats_over_pktlog = true,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA9887_HW_1_0_VERSION, .id = QCA9887_HW_1_0_VERSION,
...@@ -175,6 +177,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -175,6 +177,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA6174_HW_3_2_VERSION, .id = QCA6174_HW_3_2_VERSION,
...@@ -209,6 +212,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -209,6 +212,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.supports_peer_stats_info = true, .supports_peer_stats_info = true,
.dynamic_sar_support = true, .dynamic_sar_support = true,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA6174_HW_2_1_VERSION, .id = QCA6174_HW_2_1_VERSION,
...@@ -247,6 +251,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -247,6 +251,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA6174_HW_2_1_VERSION, .id = QCA6174_HW_2_1_VERSION,
...@@ -285,6 +290,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -285,6 +290,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA6174_HW_3_0_VERSION, .id = QCA6174_HW_3_0_VERSION,
...@@ -323,6 +329,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -323,6 +329,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA6174_HW_3_2_VERSION, .id = QCA6174_HW_3_2_VERSION,
...@@ -365,6 +372,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -365,6 +372,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.supports_peer_stats_info = true, .supports_peer_stats_info = true,
.dynamic_sar_support = true, .dynamic_sar_support = true,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA99X0_HW_2_0_DEV_VERSION, .id = QCA99X0_HW_2_0_DEV_VERSION,
...@@ -409,6 +417,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -409,6 +417,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA9984_HW_1_0_DEV_VERSION, .id = QCA9984_HW_1_0_DEV_VERSION,
...@@ -460,6 +469,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -460,6 +469,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA9888_HW_2_0_DEV_VERSION, .id = QCA9888_HW_2_0_DEV_VERSION,
...@@ -508,6 +518,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -508,6 +518,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA9377_HW_1_0_DEV_VERSION, .id = QCA9377_HW_1_0_DEV_VERSION,
...@@ -546,6 +557,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -546,6 +557,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA9377_HW_1_1_DEV_VERSION, .id = QCA9377_HW_1_1_DEV_VERSION,
...@@ -586,6 +598,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -586,6 +598,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA9377_HW_1_1_DEV_VERSION, .id = QCA9377_HW_1_1_DEV_VERSION,
...@@ -617,6 +630,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -617,6 +630,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.credit_size_workaround = true, .credit_size_workaround = true,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = QCA4019_HW_1_0_DEV_VERSION, .id = QCA4019_HW_1_0_DEV_VERSION,
...@@ -662,6 +676,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -662,6 +676,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = false, .dynamic_sar_support = false,
.hw_restart_disconnect = false, .hw_restart_disconnect = false,
.use_fw_tx_credits = true,
}, },
{ {
.id = WCN3990_HW_1_0_DEV_VERSION, .id = WCN3990_HW_1_0_DEV_VERSION,
...@@ -693,6 +708,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -693,6 +708,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false, .tx_stats_over_pktlog = false,
.dynamic_sar_support = true, .dynamic_sar_support = true,
.hw_restart_disconnect = true, .hw_restart_disconnect = true,
.use_fw_tx_credits = false,
}, },
}; };
......
...@@ -947,13 +947,18 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) ...@@ -947,13 +947,18 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
return -ECOMM; return -ECOMM;
} }
if (ar->hw_params.use_fw_tx_credits)
htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count);
else
htc->total_transmit_credits = 1;
htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size); htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size);
ath10k_dbg(ar, ATH10K_DBG_HTC, ath10k_dbg(ar, ATH10K_DBG_HTC,
"Target ready! transmit resources: %d size:%d\n", "Target ready! transmit resources: %d size:%d actual credits:%d\n",
htc->total_transmit_credits, htc->total_transmit_credits,
htc->target_credit_size); htc->target_credit_size,
msg->ready.credit_count);
if ((htc->total_transmit_credits == 0) || if ((htc->total_transmit_credits == 0) ||
(htc->target_credit_size == 0)) { (htc->target_credit_size == 0)) {
......
...@@ -635,6 +635,8 @@ struct ath10k_hw_params { ...@@ -635,6 +635,8 @@ struct ath10k_hw_params {
bool dynamic_sar_support; bool dynamic_sar_support;
bool hw_restart_disconnect; bool hw_restart_disconnect;
bool use_fw_tx_credits;
}; };
struct htt_resp; struct htt_resp;
......
...@@ -864,22 +864,12 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr) ...@@ -864,22 +864,12 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr)
return 0; return 0;
} }
static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id) static void ath10k_peer_map_cleanup(struct ath10k *ar, struct ath10k_peer *peer)
{ {
struct ath10k_peer *peer, *tmp; int peer_id, i;
int peer_id;
int i;
lockdep_assert_held(&ar->conf_mutex); lockdep_assert_held(&ar->conf_mutex);
spin_lock_bh(&ar->data_lock);
list_for_each_entry_safe(peer, tmp, &ar->peers, list) {
if (peer->vdev_id != vdev_id)
continue;
ath10k_warn(ar, "removing stale peer %pM from vdev_id %d\n",
peer->addr, vdev_id);
for_each_set_bit(peer_id, peer->peer_ids, for_each_set_bit(peer_id, peer->peer_ids,
ATH10K_MAX_NUM_PEER_IDS) { ATH10K_MAX_NUM_PEER_IDS) {
ar->peer_map[peer_id] = NULL; ar->peer_map[peer_id] = NULL;
...@@ -899,6 +889,23 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id) ...@@ -899,6 +889,23 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)
list_del(&peer->list); list_del(&peer->list);
kfree(peer); kfree(peer);
ar->num_peers--; ar->num_peers--;
}
static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)
{
struct ath10k_peer *peer, *tmp;
lockdep_assert_held(&ar->conf_mutex);
spin_lock_bh(&ar->data_lock);
list_for_each_entry_safe(peer, tmp, &ar->peers, list) {
if (peer->vdev_id != vdev_id)
continue;
ath10k_warn(ar, "removing stale peer %pM from vdev_id %d\n",
peer->addr, vdev_id);
ath10k_peer_map_cleanup(ar, peer);
} }
spin_unlock_bh(&ar->data_lock); spin_unlock_bh(&ar->data_lock);
} }
...@@ -7621,10 +7628,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, ...@@ -7621,10 +7628,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
/* Clean up the peer object as well since we /* Clean up the peer object as well since we
* must have failed to do this above. * must have failed to do this above.
*/ */
list_del(&peer->list); ath10k_peer_map_cleanup(ar, peer);
ar->peer_map[i] = NULL;
kfree(peer);
ar->num_peers--;
} }
} }
spin_unlock_bh(&ar->data_lock); spin_unlock_bh(&ar->data_lock);
......
...@@ -364,33 +364,27 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, ...@@ -364,33 +364,27 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
} }
static void ath9k_htc_fw_panic_report(struct htc_target *htc_handle, static void ath9k_htc_fw_panic_report(struct htc_target *htc_handle,
struct sk_buff *skb) struct sk_buff *skb, u32 len)
{ {
uint32_t *pattern = (uint32_t *)skb->data; uint32_t *pattern = (uint32_t *)skb->data;
switch (*pattern) { if (*pattern == 0x33221199 && len >= sizeof(struct htc_panic_bad_vaddr)) {
case 0x33221199:
{
struct htc_panic_bad_vaddr *htc_panic; struct htc_panic_bad_vaddr *htc_panic;
htc_panic = (struct htc_panic_bad_vaddr *) skb->data; htc_panic = (struct htc_panic_bad_vaddr *) skb->data;
dev_err(htc_handle->dev, "ath: firmware panic! " dev_err(htc_handle->dev, "ath: firmware panic! "
"exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n", "exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n",
htc_panic->exccause, htc_panic->pc, htc_panic->exccause, htc_panic->pc,
htc_panic->badvaddr); htc_panic->badvaddr);
break; return;
} }
case 0x33221299: if (*pattern == 0x33221299) {
{
struct htc_panic_bad_epid *htc_panic; struct htc_panic_bad_epid *htc_panic;
htc_panic = (struct htc_panic_bad_epid *) skb->data; htc_panic = (struct htc_panic_bad_epid *) skb->data;
dev_err(htc_handle->dev, "ath: firmware panic! " dev_err(htc_handle->dev, "ath: firmware panic! "
"bad epid: 0x%08x\n", htc_panic->epid); "bad epid: 0x%08x\n", htc_panic->epid);
break; return;
} }
default:
dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); dev_err(htc_handle->dev, "ath: unknown panic pattern!\n");
break;
}
} }
/* /*
...@@ -411,16 +405,26 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, ...@@ -411,16 +405,26 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
if (!htc_handle || !skb) if (!htc_handle || !skb)
return; return;
/* A valid message requires len >= 8.
*
* sizeof(struct htc_frame_hdr) == 8
* sizeof(struct htc_ready_msg) == 8
* sizeof(struct htc_panic_bad_vaddr) == 16
* sizeof(struct htc_panic_bad_epid) == 8
*/
if (unlikely(len < sizeof(struct htc_frame_hdr)))
goto invalid;
htc_hdr = (struct htc_frame_hdr *) skb->data; htc_hdr = (struct htc_frame_hdr *) skb->data;
epid = htc_hdr->endpoint_id; epid = htc_hdr->endpoint_id;
if (epid == 0x99) { if (epid == 0x99) {
ath9k_htc_fw_panic_report(htc_handle, skb); ath9k_htc_fw_panic_report(htc_handle, skb, len);
kfree_skb(skb); kfree_skb(skb);
return; return;
} }
if (epid < 0 || epid >= ENDPOINT_MAX) { if (epid < 0 || epid >= ENDPOINT_MAX) {
invalid:
if (pipe_id != USB_REG_IN_PIPE) if (pipe_id != USB_REG_IN_PIPE)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
else else
...@@ -432,21 +436,30 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, ...@@ -432,21 +436,30 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
/* Handle trailer */ /* Handle trailer */
if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) { if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) {
if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) {
/* Move past the Watchdog pattern */ /* Move past the Watchdog pattern */
htc_hdr = (struct htc_frame_hdr *)(skb->data + 4); htc_hdr = (struct htc_frame_hdr *)(skb->data + 4);
len -= 4;
}
} }
/* Get the message ID */ /* Get the message ID */
if (unlikely(len < sizeof(struct htc_frame_hdr) + sizeof(__be16)))
goto invalid;
msg_id = (__be16 *) ((void *) htc_hdr + msg_id = (__be16 *) ((void *) htc_hdr +
sizeof(struct htc_frame_hdr)); sizeof(struct htc_frame_hdr));
/* Now process HTC messages */ /* Now process HTC messages */
switch (be16_to_cpu(*msg_id)) { switch (be16_to_cpu(*msg_id)) {
case HTC_MSG_READY_ID: case HTC_MSG_READY_ID:
if (unlikely(len < sizeof(struct htc_ready_msg)))
goto invalid;
htc_process_target_rdy(htc_handle, htc_hdr); htc_process_target_rdy(htc_handle, htc_hdr);
break; break;
case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID: case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID:
if (unlikely(len < sizeof(struct htc_frame_hdr) +
sizeof(struct htc_conn_svc_rspmsg)))
goto invalid;
htc_process_conn_rsp(htc_handle, htc_hdr); htc_process_conn_rsp(htc_handle, htc_hdr);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment