diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-06-11 06:48:11 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-06-19 15:49:20 -0400 |
commit | 7414863ed3dfa407006c92616c1e0efda481738c (patch) | |
tree | 22a536107934c24d1c8f0c8e4c264eaf61c362be /drivers/net/wireless/ath/ath9k/beacon.c | |
parent | 73fa2f26d35a37034fdff9fd702887909e138926 (diff) |
ath9k: Add periodic NoA support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/beacon.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/beacon.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index 85a40d749e20..eaf8f058c151 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -122,12 +122,15 @@ static void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp, | |||
122 | }; | 122 | }; |
123 | 123 | ||
124 | struct ieee80211_p2p_noa_attr *noa; | 124 | struct ieee80211_p2p_noa_attr *noa; |
125 | int noa_len = 2 + sizeof(struct ieee80211_p2p_noa_desc); | 125 | int noa_len, noa_desc, i = 0; |
126 | u8 *hdr; | 126 | u8 *hdr; |
127 | 127 | ||
128 | if (!avp->offchannel_duration) | 128 | if (!avp->offchannel_duration && !avp->periodic_noa_duration) |
129 | return; | 129 | return; |
130 | 130 | ||
131 | noa_desc = !!avp->offchannel_duration + !!avp->periodic_noa_duration; | ||
132 | noa_len = 2 + sizeof(struct ieee80211_p2p_noa_desc) * noa_desc; | ||
133 | |||
131 | hdr = skb_put(skb, sizeof(noa_ie_hdr)); | 134 | hdr = skb_put(skb, sizeof(noa_ie_hdr)); |
132 | memcpy(hdr, noa_ie_hdr, sizeof(noa_ie_hdr)); | 135 | memcpy(hdr, noa_ie_hdr, sizeof(noa_ie_hdr)); |
133 | hdr[1] = sizeof(noa_ie_hdr) + noa_len - 2; | 136 | hdr[1] = sizeof(noa_ie_hdr) + noa_len - 2; |
@@ -137,9 +140,21 @@ static void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp, | |||
137 | memset(noa, 0, noa_len); | 140 | memset(noa, 0, noa_len); |
138 | 141 | ||
139 | noa->index = avp->noa_index; | 142 | noa->index = avp->noa_index; |
140 | noa->desc[0].count = 1; | 143 | if (avp->periodic_noa_duration) { |
141 | noa->desc[0].duration = cpu_to_le32(avp->offchannel_duration); | 144 | u32 interval = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval); |
142 | noa->desc[0].start_time = cpu_to_le32(avp->offchannel_start); | 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 | } | ||
143 | } | 158 | } |
144 | 159 | ||
145 | static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw, | 160 | static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw, |