Search Linux Wireless

[RFC 13/14] mac80211: add TIM IE to mesh beacons

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Create a TIM IE similarly to AP mode and add it to mesh beacons.
Use the peer's link ID instead of the access point's association ID.

Since the TIM map only supports announcing buffered frames for
IEEE80211_MAX_AID STA (2007), we mod down our mesh LLID/PLID to fit.

Signed-off-by: Marco Porsch <marco.porsch@xxxxxxxxxxxxxxxxxxx>
---
 net/mac80211/tx.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index a62deaf..bfcda52 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2333,6 +2333,31 @@ static void ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata,
 	}
 }
 
+static int mesh_add_tim_ie(struct sk_buff *skb,
+			   struct ieee80211_sub_if_data *sdata,
+			   u16 *tim_offset, u16 *tim_length)
+{
+	struct ieee80211_local *local = sdata->local;
+	u16 tmp = skb->len;
+
+	if (local->tim_in_locked_section) {
+		ieee80211_beacon_add_tim(sdata, &sdata->u.mesh.ps, skb);
+	} else {
+		unsigned long flags;
+
+		spin_lock_irqsave(&local->tim_lock, flags);
+		ieee80211_beacon_add_tim(sdata, &sdata->u.mesh.ps, skb);
+		spin_unlock_irqrestore(&local->tim_lock, flags);
+	}
+
+	if (tim_offset)
+		*tim_offset = tmp - local->hw.extra_tx_headroom;
+	if (tim_length)
+		*tim_length = skb->len - tmp;
+
+	return 0;
+}
+
 struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
 					 struct ieee80211_vif *vif,
 					 u16 *tim_offset, u16 *tim_length)
@@ -2440,6 +2465,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
 				    2 + /* NULL SSID */
 				    2 + 8 + /* supported rates */
 				    2 + 3 + /* DS params */
+				    256 + /* TIM IE */
 				    2 + (IEEE80211_MAX_SUPP_RATES - 8) +
 				    2 + sizeof(struct ieee80211_ht_cap) +
 				    2 + sizeof(struct ieee80211_ht_operation) +
@@ -2473,6 +2499,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
 
 		if (ieee80211_add_srates_ie(sdata, skb, true, band) ||
 		    mesh_add_ds_params_ie(skb, sdata) ||
+		    mesh_add_tim_ie(skb, sdata, tim_offset, tim_length) ||
 		    ieee80211_add_ext_srates_ie(sdata, skb, true, band) ||
 		    mesh_add_rsn_ie(skb, sdata) ||
 		    mesh_add_ht_cap_ie(skb, sdata) ||
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux