Commit 11e39a4e authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k: Move ath9k_beacon_add_noa to channel.c

Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7d876174
......@@ -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)
{
}
......
......@@ -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)
{
......
......@@ -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;
......
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