diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2014-08-23 09:42:15 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-08-28 14:49:38 -0400 |
commit | 11e39a4e054cde1aaa9f5d3830f41f86818602fd (patch) | |
tree | baa3e929aa75814e2bdc0518e812cab5885dde76 | |
parent | 7d876174e7cd81912930cb5e501f5036eabfaaf3 (diff) |
ath9k: Move ath9k_beacon_add_noa to channel.c
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ath9k.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/beacon.c | 49 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/channel.c | 49 |
3 files changed, 56 insertions, 49 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index a2f4fa78ce76..9e61679b3de2 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "spectral.h" | 31 | #include "spectral.h" |
32 | 32 | ||
33 | struct ath_node; | 33 | struct ath_node; |
34 | struct ath_vif; | ||
34 | 35 | ||
35 | extern struct ieee80211_ops ath9k_ops; | 36 | extern struct ieee80211_ops ath9k_ops; |
36 | extern int ath9k_modparam_nohwcrypt; | 37 | extern int ath9k_modparam_nohwcrypt; |
@@ -434,6 +435,8 @@ void ath9k_p2p_remove_vif(struct ath_softc *sc, | |||
434 | void ath9k_p2p_beacon_sync(struct ath_softc *sc); | 435 | void ath9k_p2p_beacon_sync(struct ath_softc *sc); |
435 | void ath9k_p2p_bss_info_changed(struct ath_softc *sc, | 436 | void ath9k_p2p_bss_info_changed(struct ath_softc *sc, |
436 | struct ieee80211_vif *vif); | 437 | struct ieee80211_vif *vif); |
438 | void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp, | ||
439 | struct sk_buff *skb); | ||
437 | void ath9k_p2p_ps_timer(void *priv); | 440 | void ath9k_p2p_ps_timer(void *priv); |
438 | void ath9k_chanctx_wake_queues(struct ath_softc *sc); | 441 | void ath9k_chanctx_wake_queues(struct ath_softc *sc); |
439 | void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx); | 442 | 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, | |||
496 | struct ieee80211_vif *vif) | 499 | struct ieee80211_vif *vif) |
497 | { | 500 | { |
498 | } | 501 | } |
502 | static inline void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp, | ||
503 | struct sk_buff *skb) | ||
504 | { | ||
505 | } | ||
499 | static inline void ath9k_p2p_ps_timer(struct ath_softc *sc) | 506 | static inline void ath9k_p2p_ps_timer(struct ath_softc *sc) |
500 | { | 507 | { |
501 | } | 508 | } |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index dc68d114f2fd..b2f56d8b9043 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -108,55 +108,6 @@ static void ath9k_beacon_setup(struct ath_softc *sc, struct ieee80211_vif *vif, | |||
108 | ath9k_hw_set_txdesc(ah, bf->bf_desc, &info); | 108 | ath9k_hw_set_txdesc(ah, bf->bf_desc, &info); |
109 | } | 109 | } |
110 | 110 | ||
111 | static void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp, | ||
112 | struct sk_buff *skb) | ||
113 | { | ||
114 | static const u8 noa_ie_hdr[] = { | ||
115 | WLAN_EID_VENDOR_SPECIFIC, /* type */ | ||
116 | 0, /* length */ | ||
117 | 0x50, 0x6f, 0x9a, /* WFA OUI */ | ||
118 | 0x09, /* P2P subtype */ | ||
119 | 0x0c, /* Notice of Absence */ | ||
120 | 0x00, /* LSB of little-endian len */ | ||
121 | 0x00, /* MSB of little-endian len */ | ||
122 | }; | ||
123 | |||
124 | struct ieee80211_p2p_noa_attr *noa; | ||
125 | int noa_len, noa_desc, i = 0; | ||
126 | u8 *hdr; | ||
127 | |||
128 | if (!avp->offchannel_duration && !avp->periodic_noa_duration) | ||
129 | return; | ||
130 | |||
131 | noa_desc = !!avp->offchannel_duration + !!avp->periodic_noa_duration; | ||
132 | noa_len = 2 + sizeof(struct ieee80211_p2p_noa_desc) * noa_desc; | ||
133 | |||
134 | hdr = skb_put(skb, sizeof(noa_ie_hdr)); | ||
135 | memcpy(hdr, noa_ie_hdr, sizeof(noa_ie_hdr)); | ||
136 | hdr[1] = sizeof(noa_ie_hdr) + noa_len - 2; | ||
137 | hdr[7] = noa_len; | ||
138 | |||
139 | noa = (void *) skb_put(skb, noa_len); | ||
140 | memset(noa, 0, noa_len); | ||
141 | |||
142 | noa->index = avp->noa_index; | ||
143 | if (avp->periodic_noa_duration) { | ||
144 | u32 interval = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval); | ||
145 | |||
146 | noa->desc[i].count = 255; | ||
147 | noa->desc[i].start_time = cpu_to_le32(avp->periodic_noa_start); | ||
148 | noa->desc[i].duration = cpu_to_le32(avp->periodic_noa_duration); | ||
149 | noa->desc[i].interval = cpu_to_le32(interval); | ||
150 | i++; | ||
151 | } | ||
152 | |||
153 | if (avp->offchannel_duration) { | ||
154 | noa->desc[i].count = 1; | ||
155 | noa->desc[i].start_time = cpu_to_le32(avp->offchannel_start); | ||
156 | noa->desc[i].duration = cpu_to_le32(avp->offchannel_duration); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw, | 111 | static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw, |
161 | struct ieee80211_vif *vif) | 112 | struct ieee80211_vif *vif) |
162 | { | 113 | { |
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c index 7aa953545c07..0e64b736160e 100644 --- a/drivers/net/wireless/ath/ath9k/channel.c +++ b/drivers/net/wireless/ath/ath9k/channel.c | |||
@@ -1042,6 +1042,55 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif) | |||
1042 | ath9k_update_p2p_ps_timer(sc, avp); | 1042 | ath9k_update_p2p_ps_timer(sc, avp); |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp, | ||
1046 | struct sk_buff *skb) | ||
1047 | { | ||
1048 | static const u8 noa_ie_hdr[] = { | ||
1049 | WLAN_EID_VENDOR_SPECIFIC, /* type */ | ||
1050 | 0, /* length */ | ||
1051 | 0x50, 0x6f, 0x9a, /* WFA OUI */ | ||
1052 | 0x09, /* P2P subtype */ | ||
1053 | 0x0c, /* Notice of Absence */ | ||
1054 | 0x00, /* LSB of little-endian len */ | ||
1055 | 0x00, /* MSB of little-endian len */ | ||
1056 | }; | ||
1057 | |||
1058 | struct ieee80211_p2p_noa_attr *noa; | ||
1059 | int noa_len, noa_desc, i = 0; | ||
1060 | u8 *hdr; | ||
1061 | |||
1062 | if (!avp->offchannel_duration && !avp->periodic_noa_duration) | ||
1063 | return; | ||
1064 | |||
1065 | noa_desc = !!avp->offchannel_duration + !!avp->periodic_noa_duration; | ||
1066 | noa_len = 2 + sizeof(struct ieee80211_p2p_noa_desc) * noa_desc; | ||
1067 | |||
1068 | hdr = skb_put(skb, sizeof(noa_ie_hdr)); | ||
1069 | memcpy(hdr, noa_ie_hdr, sizeof(noa_ie_hdr)); | ||
1070 | hdr[1] = sizeof(noa_ie_hdr) + noa_len - 2; | ||
1071 | hdr[7] = noa_len; | ||
1072 | |||
1073 | noa = (void *) skb_put(skb, noa_len); | ||
1074 | memset(noa, 0, noa_len); | ||
1075 | |||
1076 | noa->index = avp->noa_index; | ||
1077 | if (avp->periodic_noa_duration) { | ||
1078 | u32 interval = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval); | ||
1079 | |||
1080 | noa->desc[i].count = 255; | ||
1081 | noa->desc[i].start_time = cpu_to_le32(avp->periodic_noa_start); | ||
1082 | noa->desc[i].duration = cpu_to_le32(avp->periodic_noa_duration); | ||
1083 | noa->desc[i].interval = cpu_to_le32(interval); | ||
1084 | i++; | ||
1085 | } | ||
1086 | |||
1087 | if (avp->offchannel_duration) { | ||
1088 | noa->desc[i].count = 1; | ||
1089 | noa->desc[i].start_time = cpu_to_le32(avp->offchannel_start); | ||
1090 | noa->desc[i].duration = cpu_to_le32(avp->offchannel_duration); | ||
1091 | } | ||
1092 | } | ||
1093 | |||
1045 | void ath9k_p2p_ps_timer(void *priv) | 1094 | void ath9k_p2p_ps_timer(void *priv) |
1046 | { | 1095 | { |
1047 | struct ath_softc *sc = priv; | 1096 | struct ath_softc *sc = priv; |