ath9k: Move ath9k_beacon_add_noa to channel.c
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Sat, 23 Aug 2014 13:42:15 +0000 (19:12 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 28 Aug 2014 18:49:38 +0000 (14:49 -0400)
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/beacon.c
drivers/net/wireless/ath/ath9k/channel.c

index a2f4fa78ce76697b8258f9e36e381cfd801df4ed..9e61679b3de25e8d4c1d7c2608fa2203d24767f7 100644 (file)
@@ -31,6 +31,7 @@
 #include "spectral.h"
 
 struct ath_node;
+struct ath_vif;
 
 extern struct ieee80211_ops ath9k_ops;
 extern int ath9k_modparam_nohwcrypt;
@@ -434,6 +435,8 @@ void ath9k_p2p_remove_vif(struct ath_softc *sc,
 void ath9k_p2p_beacon_sync(struct ath_softc *sc);
 void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
                                struct ieee80211_vif *vif);
+void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
+                         struct sk_buff *skb);
 void ath9k_p2p_ps_timer(void *priv);
 void ath9k_chanctx_wake_queues(struct ath_softc *sc);
 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx);
@@ -496,6 +499,10 @@ static inline void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
                                              struct ieee80211_vif *vif)
 {
 }
+static inline void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
+                                       struct sk_buff *skb)
+{
+}
 static inline void ath9k_p2p_ps_timer(struct ath_softc *sc)
 {
 }
index dc68d114f2fd4304c0df2e649c0a302472cf3e8a..b2f56d8b9043783021c873a87cee6ed4772daf4d 100644 (file)
@@ -108,55 +108,6 @@ static void ath9k_beacon_setup(struct ath_softc *sc, struct ieee80211_vif *vif,
        ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
 }
 
-static void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
-                                struct sk_buff *skb)
-{
-       static const u8 noa_ie_hdr[] = {
-               WLAN_EID_VENDOR_SPECIFIC,       /* type */
-               0,                              /* length */
-               0x50, 0x6f, 0x9a,               /* WFA OUI */
-               0x09,                           /* P2P subtype */
-               0x0c,                           /* Notice of Absence */
-               0x00,                           /* LSB of little-endian len */
-               0x00,                           /* MSB of little-endian len */
-       };
-
-       struct ieee80211_p2p_noa_attr *noa;
-       int noa_len, noa_desc, i = 0;
-       u8 *hdr;
-
-       if (!avp->offchannel_duration && !avp->periodic_noa_duration)
-               return;
-
-       noa_desc = !!avp->offchannel_duration + !!avp->periodic_noa_duration;
-       noa_len = 2 + sizeof(struct ieee80211_p2p_noa_desc) * noa_desc;
-
-       hdr = skb_put(skb, sizeof(noa_ie_hdr));
-       memcpy(hdr, noa_ie_hdr, sizeof(noa_ie_hdr));
-       hdr[1] = sizeof(noa_ie_hdr) + noa_len - 2;
-       hdr[7] = noa_len;
-
-       noa = (void *) skb_put(skb, noa_len);
-       memset(noa, 0, noa_len);
-
-       noa->index = avp->noa_index;
-       if (avp->periodic_noa_duration) {
-               u32 interval = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval);
-
-               noa->desc[i].count = 255;
-               noa->desc[i].start_time = cpu_to_le32(avp->periodic_noa_start);
-               noa->desc[i].duration = cpu_to_le32(avp->periodic_noa_duration);
-               noa->desc[i].interval = cpu_to_le32(interval);
-               i++;
-       }
-
-       if (avp->offchannel_duration) {
-               noa->desc[i].count = 1;
-               noa->desc[i].start_time = cpu_to_le32(avp->offchannel_start);
-               noa->desc[i].duration = cpu_to_le32(avp->offchannel_duration);
-       }
-}
-
 static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw,
                                             struct ieee80211_vif *vif)
 {
index 7aa953545c07f12def12ab9f43ba519b26287435..0e64b736160eb9e55a500682f1d7e71a33f9162c 100644 (file)
@@ -1042,6 +1042,55 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
        ath9k_update_p2p_ps_timer(sc, avp);
 }
 
+void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
+                         struct sk_buff *skb)
+{
+       static const u8 noa_ie_hdr[] = {
+               WLAN_EID_VENDOR_SPECIFIC,       /* type */
+               0,                              /* length */
+               0x50, 0x6f, 0x9a,               /* WFA OUI */
+               0x09,                           /* P2P subtype */
+               0x0c,                           /* Notice of Absence */
+               0x00,                           /* LSB of little-endian len */
+               0x00,                           /* MSB of little-endian len */
+       };
+
+       struct ieee80211_p2p_noa_attr *noa;
+       int noa_len, noa_desc, i = 0;
+       u8 *hdr;
+
+       if (!avp->offchannel_duration && !avp->periodic_noa_duration)
+               return;
+
+       noa_desc = !!avp->offchannel_duration + !!avp->periodic_noa_duration;
+       noa_len = 2 + sizeof(struct ieee80211_p2p_noa_desc) * noa_desc;
+
+       hdr = skb_put(skb, sizeof(noa_ie_hdr));
+       memcpy(hdr, noa_ie_hdr, sizeof(noa_ie_hdr));
+       hdr[1] = sizeof(noa_ie_hdr) + noa_len - 2;
+       hdr[7] = noa_len;
+
+       noa = (void *) skb_put(skb, noa_len);
+       memset(noa, 0, noa_len);
+
+       noa->index = avp->noa_index;
+       if (avp->periodic_noa_duration) {
+               u32 interval = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval);
+
+               noa->desc[i].count = 255;
+               noa->desc[i].start_time = cpu_to_le32(avp->periodic_noa_start);
+               noa->desc[i].duration = cpu_to_le32(avp->periodic_noa_duration);
+               noa->desc[i].interval = cpu_to_le32(interval);
+               i++;
+       }
+
+       if (avp->offchannel_duration) {
+               noa->desc[i].count = 1;
+               noa->desc[i].start_time = cpu_to_le32(avp->offchannel_start);
+               noa->desc[i].duration = cpu_to_le32(avp->offchannel_duration);
+       }
+}
+
 void ath9k_p2p_ps_timer(void *priv)
 {
        struct ath_softc *sc = priv;