Skip to contentSkip to conversation

some trivial mac80211 cleanups

PATCH New Johannes Berg 1 participant 6 messages Mar 27, 2012 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

cover some trivial mac80211 cleanups

First set of cleanups I noticed while beginning work on my new multi-queue design :-)

johannes

author maintainer
#1 lore raw

PATCH 1/5 mac80211: fix mesh TX coding style

From: Johannes Berg <[email protected]>

Fix bad indentation & pointless if nesting.

---
 net/mac80211/tx.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
net/mac80211/tx.c +6 -6
@@ -1468,12 +1468,12 @@ void ieee80211_xmit(struct ieee80211_sub
 
 	if (ieee80211_vif_is_mesh(&sdata->vif) &&
 	    ieee80211_is_data(hdr->frame_control) &&
-		!is_multicast_ether_addr(hdr->addr1))
-			if (mesh_nexthop_resolve(skb, sdata)) {
-				/* skb queued: don't free */
-				rcu_read_unlock();
-				return;
-			}
+	    !is_multicast_ether_addr(hdr->addr1) &&
+	    mesh_nexthop_resolve(skb, sdata)) {
+		/* skb queued: don't free */
+		rcu_read_unlock();
+		return;
+	}
 
 	ieee80211_set_qos_hdr(sdata, skb);
 	ieee80211_tx(sdata, skb, false);
author maintainer
#2 lore raw

PATCH 2/5 mac80211: clean up uAPSD TX code

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

Clean up the code formatting and also replace
the constant 0 by IEEE80211_AC_VO.

---
 net/mac80211/tx.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/mac80211/tx.c +3 -3
@@ -230,9 +230,9 @@ ieee80211_tx_h_dynamic_ps(struct ieee802
 	 * changed via debugfs, user needs to reassociate manually to have
 	 * everything in sync.
 	 */
-	if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED)
-	    && (ifmgd->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
-	    && skb_get_queue_mapping(tx->skb) == 0)
+	if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) &&
+	    (ifmgd->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) &&
+	    skb_get_queue_mapping(tx->skb) == IEEE80211_AC_VO)
 		return TX_CONTINUE;
 
 	if (local->hw.conf.flags & IEEE80211_CONF_PS) {
author maintainer
#3 lore raw

PATCH 3/5 mac80211: make ieee80211_downgrade_queue static

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

There's no reason for it to not be static.

---
 net/mac80211/wme.c |   40 ++++++++++++++++++++--------------------
 net/mac80211/wme.h |    3 ---
 2 files changed, 20 insertions(+), 23 deletions(-)
net/mac80211/wme.c +20 -20
@@ -52,6 +52,26 @@ static int wme_downgrade_ac(struct sk_bu
 	}
 }
 
+static u16 ieee80211_downgrade_queue(struct ieee80211_local *local,
+				     struct sk_buff *skb)
+{
+	/* in case we are a client verify acm is not set for this ac */
+	while (unlikely(local->wmm_acm & BIT(skb->priority))) {
+		if (wme_downgrade_ac(skb)) {
+			/*
+			 * This should not really happen. The AP has marked all
+			 * lower ACs to require admission control which is not
+			 * a reasonable configuration. Allow the frame to be
+			 * transmitted using AC_BK as a workaround.
+			 */
+			break;
+		}
+	}
+
+	/* look up which queue to use for frames with this 1d tag */
+	return ieee802_1d_to_ac[skb->priority];
+}
+
 /* Indicate which queue to use for this fully formed 802.11 frame */
 u16 ieee80211_select_queue_80211(struct ieee80211_local *local,
 				 struct sk_buff *skb,
@@ -139,26 +159,6 @@ u16 ieee80211_select_queue(struct ieee80
 	return ieee80211_downgrade_queue(local, skb);
 }
 
-u16 ieee80211_downgrade_queue(struct ieee80211_local *local,
-			      struct sk_buff *skb)
-{
-	/* in case we are a client verify acm is not set for this ac */
-	while (unlikely(local->wmm_acm & BIT(skb->priority))) {
-		if (wme_downgrade_ac(skb)) {
-			/*
-			 * This should not really happen. The AP has marked all
-			 * lower ACs to require admission control which is not
-			 * a reasonable configuration. Allow the frame to be
-			 * transmitted using AC_BK as a workaround.
-			 */
-			break;
-		}
-	}
-
-	/* look up which queue to use for frames with this 1d tag */
-	return ieee802_1d_to_ac[skb->priority];
-}
-
 void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
 			   struct sk_buff *skb)
 {
net/mac80211/wme.h +0 -3
@@ -22,8 +22,5 @@ u16 ieee80211_select_queue(struct ieee80
 			   struct sk_buff *skb);
 void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
 			   struct sk_buff *skb);
-u16 ieee80211_downgrade_queue(struct ieee80211_local *local,
-                              struct sk_buff *skb);
-
 
 #endif /* _WME_H */
author maintainer
#4 lore raw

PATCH 4/5 mac80211: inline ieee80211_add_pending_skbs

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

This is a trivial wrapper function, inline it.

---
 net/mac80211/ieee80211_i.h |    7 +++++--
 net/mac80211/util.c        |    6 ------
 2 files changed, 5 insertions(+), 8 deletions(-)
net/mac80211/ieee80211_i.h +5 -2
@@ -1432,11 +1432,14 @@ void ieee80211_stop_queue_by_reason(stru
 				    enum queue_stop_reason reason);
 void ieee80211_add_pending_skb(struct ieee80211_local *local,
 			       struct sk_buff *skb);
-void ieee80211_add_pending_skbs(struct ieee80211_local *local,
-				struct sk_buff_head *skbs);
 void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local,
 				   struct sk_buff_head *skbs,
 				   void (*fn)(void *data), void *data);
+static inline void ieee80211_add_pending_skbs(struct ieee80211_local *local,
+					      struct sk_buff_head *skbs)
+{
+	ieee80211_add_pending_skbs_fn(local, skbs, NULL, NULL);
+}
 
 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
 			 u16 transaction, u16 auth_alg,
net/mac80211/util.c +0 -6
@@ -404,12 +404,6 @@ void ieee80211_add_pending_skbs_fn(struc
 	spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
 }
 
-void ieee80211_add_pending_skbs(struct ieee80211_local *local,
-				struct sk_buff_head *skbs)
-{
-	ieee80211_add_pending_skbs_fn(local, skbs, NULL, NULL);
-}
-
 void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
 				    enum queue_stop_reason reason)
 {
author maintainer
#5 lore raw

PATCH 5/5 mac80211: use AC constants

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

Use the AC constants instead of hard-coding
the numbers with comments.

---
 net/mac80211/util.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/mac80211/util.c +4 -4
@@ -790,20 +790,20 @@ void ieee80211_set_wmm_default(struct ie
 			aCWmin = 15;
 
 		switch (queue) {
-		case 3: /* AC_BK */
+		case IEEE80211_AC_BK:
 			qparam.cw_max = aCWmax;
 			qparam.cw_min = aCWmin;
 			qparam.txop = 0;
 			qparam.aifs = 7;
 			break;
 		default: /* never happens but let's not leave undefined */
-		case 2: /* AC_BE */
+		case IEEE80211_AC_BE:
 			qparam.cw_max = aCWmax;
 			qparam.cw_min = aCWmin;
 			qparam.txop = 0;
 			qparam.aifs = 3;
 			break;
-		case 1: /* AC_VI */
+		case IEEE80211_AC_VI:
 			qparam.cw_max = aCWmin;
 			qparam.cw_min = (aCWmin + 1) / 2 - 1;
 			if (use_11b)
@@ -812,7 +812,7 @@ void ieee80211_set_wmm_default(struct ie
 				qparam.txop = 3008/32;
 			qparam.aifs = 2;
 			break;
-		case 0: /* AC_VO */
+		case IEEE80211_AC_VO:
 			qparam.cw_max = (aCWmin + 1) / 2 - 1;
 			qparam.cw_min = (aCWmin + 1) / 4 - 1;
 			if (use_11b)