Skip to contentSkip to conversation

mac80211: Add support for QoS mapping

PATCH In review Jouni Malinen 2 participants 2 messages Nov 20, 2013 – Nov 25, 2013 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 mac80211: Add support for QoS mapping

From: Kyeyoon Park <[email protected]>

Implement set_qos_map() handler for mac80211 to enable QoS mapping functionality.

---
 net/mac80211/cfg.c         |   12 ++++++++++++
 net/mac80211/ieee80211_i.h |    1 +
 net/mac80211/iface.c       |    2 ++
 net/mac80211/wme.c         |    3 ++-
 4 files changed, 17 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +12 -0
index 95667b0..37fc6ff 100644
@@ -3785,6 +3785,17 @@ static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled)
 }
 #endif
 
+static int ieee80211_set_qos_map(struct wiphy *wiphy,
+				 struct net_device *dev,
+				 struct cfg80211_qos_map *qos_map)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+	memcpy(&sdata->qos_map, qos_map, sizeof(struct cfg80211_qos_map));
+
+	return 0;
+}
+
 struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
@@ -3864,4 +3875,5 @@ struct cfg80211_ops mac80211_config_ops = {
 	.get_channel = ieee80211_cfg_get_channel,
 	.start_radar_detection = ieee80211_start_radar_detection,
 	.channel_switch = ieee80211_channel_switch,
+	.set_qos_map = ieee80211_set_qos_map,
 };
net/mac80211/ieee80211_i.h +1 -0
index 29dc505..7bb5914 100644
@@ -730,6 +730,7 @@ struct ieee80211_sub_if_data {
 	bool control_port_no_encrypt;
 
 	struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
+	struct cfg80211_qos_map qos_map;
 
 	struct work_struct csa_finalize_work;
 	int csa_counter_offset_beacon;
net/mac80211/iface.c +2 -0
index ff101ea..bd43217 100644
@@ -636,6 +636,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 		ieee80211_set_wmm_default(sdata, true);
 	}
 
+	sdata->qos_map.valid = false;
+
 	set_bit(SDATA_STATE_RUNNING, &sdata->state);
 
 	if (sdata->vif.type == NL80211_IFTYPE_WDS) {
net/mac80211/wme.c +2 -1
index faa9d8e..eb87ec5 100644
@@ -103,6 +103,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
 			   struct sk_buff *skb)
 {
 	struct ieee80211_local *local = sdata->local;
+	struct cfg80211_qos_map *qos_map = &sdata->qos_map;
 	struct sta_info *sta = NULL;
 	const u8 *ra = NULL;
 	bool qos = false;
@@ -155,7 +156,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
 
 	/* use the data classifier to determine what 802.1d tag the
 	 * data frame has */
-	skb->priority = cfg80211_classify8021d(skb, NULL);
+	skb->priority = cfg80211_classify8021d(skb, qos_map);
 
 	return ieee80211_downgrade_queue(sdata, skb);
 }
Signature · 5 lines
1.7.9.5


-- 
Jouni Malinen                                            PGP id EFC895FA
maintainer
#1 lore raw

net/mac80211/iface.c int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) · line 639

Quoted 6 lines · Jouni Malinen

+++ b/net/mac80211/iface.c

net/mac80211/iface.c +1 -0
@@ -636,6 +636,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 		ieee80211_set_wmm_default(sdata, true);
 	}
 
+	sdata->qos_map.valid = false;

This isn't really needed for the first ifup (everything will be zero) and seems insufficient for any later changes since iftype can change and we should probably clear this on disassoc etc.

Might be better to handle that in cfg80211 to make it consistent, but then you don't really need to set valid to false at all (never mind the fact that I think valid should just go away :) )

johannes