381-ath9k-fix-tx99-with-monitor-mode-interface.patch 2.8 KB

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