395-ath9k-add-back-support-for-using-active-monitor-inte.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. From: Felix Fietkau <[email protected]>
  2. Date: Sat, 22 Sep 2018 15:20:50 +0200
  3. Subject: [PATCH] ath9k: add back support for using active monitor interfaces
  4. for tx99
  5. Various documented examples on how to set up tx99 with ath9k rely
  6. on setting up a regular monitor interface for setting the channel.
  7. My previous patch "ath9k: fix tx99 with monitor mode interface" made
  8. it possible to set it up this way again. However, it was removing support
  9. for using an active monitor interface, which is required for controlling
  10. the bitrate as well, since the bitrate is not passed down with a regular
  11. monitor interface.
  12. This patch partially reverts the previous one, but keeps support for using
  13. a regular monitor interface to keep documented steps working in cases
  14. where the bitrate does not matter
  15. Fixes: d9c52fd17cb48 ("ath9k: fix tx99 with monitor mode interface")
  16. Signed-off-by: Felix Fietkau <[email protected]>
  17. ---
  18. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  19. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  20. @@ -1074,6 +1074,7 @@ struct ath_softc {
  21. struct ath_spec_scan_priv spec_priv;
  22. + struct ieee80211_vif *tx99_vif;
  23. struct sk_buff *tx99_skb;
  24. bool tx99_state;
  25. s16 tx99_power;
  26. --- a/drivers/net/wireless/ath/ath9k/main.c
  27. +++ b/drivers/net/wireless/ath/ath9k/main.c
  28. @@ -1251,8 +1251,13 @@ static int ath9k_add_interface(struct ie
  29. struct ath_vif *avp = (void *)vif->drv_priv;
  30. struct ath_node *an = &avp->mcast_node;
  31. - if (IS_ENABLED(CPTCFG_ATH9K_TX99))
  32. - return -EOPNOTSUPP;
  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. @@ -1337,6 +1342,7 @@ static void ath9k_remove_interface(struc
  42. ath9k_p2p_remove_vif(sc, vif);
  43. sc->cur_chan->nvifs--;
  44. + sc->tx99_vif = NULL;
  45. if (!ath9k_is_chanctx_enabled())
  46. list_del(&avp->list);
  47. --- a/drivers/net/wireless/ath/ath9k/tx99.c
  48. +++ b/drivers/net/wireless/ath/ath9k/tx99.c
  49. @@ -54,6 +54,7 @@ static struct sk_buff *ath9k_build_tx99_
  50. struct ieee80211_hdr *hdr;
  51. struct ieee80211_tx_info *tx_info;
  52. struct sk_buff *skb;
  53. + struct ath_vif *avp;
  54. skb = alloc_skb(len, GFP_KERNEL);
  55. if (!skb)
  56. @@ -71,11 +72,17 @@ 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. + if (sc->tx99_vif) {
  60. + avp = (struct ath_vif *) sc->tx99_vif->drv_priv;
  61. + hdr->seq_ctrl |= cpu_to_le16(avp->seq_no);
  62. + }
  63. +
  64. tx_info = IEEE80211_SKB_CB(skb);
  65. memset(tx_info, 0, sizeof(*tx_info));
  66. rate = &tx_info->control.rates[0];
  67. tx_info->band = sc->cur_chan->chandef.chan->band;
  68. tx_info->flags = IEEE80211_TX_CTL_NO_ACK;
  69. + tx_info->control.vif = sc->tx99_vif;
  70. rate->count = 1;
  71. if (ah->curchan && IS_CHAN_HT(ah->curchan)) {
  72. rate->flags |= IEEE80211_TX_RC_MCS;
  73. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  74. +++ b/drivers/net/wireless/ath/ath9k/xmit.c
  75. @@ -2973,7 +2973,7 @@ int ath9k_tx99_send(struct ath_softc *sc
  76. return -EINVAL;
  77. }
  78. - ath_set_rates(NULL, NULL, bf);
  79. + ath_set_rates(sc->tx99_vif, NULL, bf);
  80. ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
  81. ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);