layerscape: Fix kernel patch
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / ath / 381-ath9k-fix-tx99-with-monitor-mode-interface.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 20 Aug 2018 11:35:05 +0200
3 Subject: [PATCH] ath9k: fix tx99 with monitor mode interface
4
5 Tx99 is typically configured via a monitor mode interface, which does
6 not get added to the driver as a vif. Since the code currently expects
7 a configured virtual interface for tx99, enabling tx99 via debugfs fails.
8 Since the vif is not needed anyway, remove all checks for it.
9
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 ---
12
13 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
14 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
15 @@ -1074,7 +1074,6 @@ struct ath_softc {
16
17 struct ath_spec_scan_priv spec_priv;
18
19 - struct ieee80211_vif *tx99_vif;
20 struct sk_buff *tx99_skb;
21 bool tx99_state;
22 s16 tx99_power;
23 --- a/drivers/net/wireless/ath/ath9k/main.c
24 +++ b/drivers/net/wireless/ath/ath9k/main.c
25 @@ -1251,15 +1251,10 @@ static int ath9k_add_interface(struct ie
26 struct ath_vif *avp = (void *)vif->drv_priv;
27 struct ath_node *an = &avp->mcast_node;
28
29 - mutex_lock(&sc->mutex);
30 + if (IS_ENABLED(CPTCFG_ATH9K_TX99))
31 + return -EOPNOTSUPP;
32
33 - if (IS_ENABLED(CPTCFG_ATH9K_TX99)) {
34 - if (sc->cur_chan->nvifs >= 1) {
35 - mutex_unlock(&sc->mutex);
36 - return -EOPNOTSUPP;
37 - }
38 - sc->tx99_vif = vif;
39 - }
40 + mutex_lock(&sc->mutex);
41
42 ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
43 sc->cur_chan->nvifs++;
44 @@ -1342,7 +1337,6 @@ static void ath9k_remove_interface(struc
45 ath9k_p2p_remove_vif(sc, vif);
46
47 sc->cur_chan->nvifs--;
48 - sc->tx99_vif = NULL;
49 if (!ath9k_is_chanctx_enabled())
50 list_del(&avp->list);
51
52 --- a/drivers/net/wireless/ath/ath9k/tx99.c
53 +++ b/drivers/net/wireless/ath/ath9k/tx99.c
54 @@ -54,12 +54,6 @@ static struct sk_buff *ath9k_build_tx99_
55 struct ieee80211_hdr *hdr;
56 struct ieee80211_tx_info *tx_info;
57 struct sk_buff *skb;
58 - struct ath_vif *avp;
59 -
60 - if (!sc->tx99_vif)
61 - return NULL;
62 -
63 - avp = (struct ath_vif *)sc->tx99_vif->drv_priv;
64
65 skb = alloc_skb(len, GFP_KERNEL);
66 if (!skb)
67 @@ -77,14 +71,11 @@ static struct sk_buff *ath9k_build_tx99_
68 memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN);
69 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
70
71 - hdr->seq_ctrl |= cpu_to_le16(avp->seq_no);
72 -
73 tx_info = IEEE80211_SKB_CB(skb);
74 memset(tx_info, 0, sizeof(*tx_info));
75 rate = &tx_info->control.rates[0];
76 tx_info->band = sc->cur_chan->chandef.chan->band;
77 tx_info->flags = IEEE80211_TX_CTL_NO_ACK;
78 - tx_info->control.vif = sc->tx99_vif;
79 rate->count = 1;
80 if (ah->curchan && IS_CHAN_HT(ah->curchan)) {
81 rate->flags |= IEEE80211_TX_RC_MCS;
82 --- a/drivers/net/wireless/ath/ath9k/xmit.c
83 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
84 @@ -2974,7 +2974,7 @@ int ath9k_tx99_send(struct ath_softc *sc
85 return -EINVAL;
86 }
87
88 - ath_set_rates(sc->tx99_vif, NULL, bf);
89 + ath_set_rates(NULL, NULL, bf);
90
91 ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
92 ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);