Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jul 2013 09:48:56 GMT
From:      ccqin@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r255101 - soc2013/ccqin/head/sys/net80211
Message-ID:  <201307240948.r6O9musc044943@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ccqin
Date: Wed Jul 24 09:48:56 2013
New Revision: 255101
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=255101

Log:
  Change of naming conversion and field max_4ms_framelen.
  * change "IEEE80211_RATECTL_OPT_*" to "IEEE80211_RATECTL_CAP_*". change field
    "options" of ieee80211_ratectl to "ir_capabilities". update the references.
  * fix error on initialization of ir_capabilities.
  * re-add max4msframelen to ieee80211_rc_series. port max_4ms_framelen[4][32]
    to ieee80211_ratectl. also add setup of max4msframelen to
    ieee80211_ratectl_complete_rcflags().
  * move ieee80211_ratectl_complete_rcflags() to ieee80211_ratectl.c, also put
    max_4ms_framelen[4][32] there.
  * add pre-compile declaration to ieee80211_ratectl.h. (strange it not appeared)

Modified:
  soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c
  soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h

Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c
==============================================================================
--- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c	Wed Jul 24 09:35:44 2013	(r255100)
+++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c	Wed Jul 24 09:48:56 2013	(r255101)
@@ -50,6 +50,33 @@
 
 MALLOC_DEFINE(M_80211_RATECTL, "80211ratectl", "802.11 rate control");
 
+int max_4ms_framelen[4][32] = {
+	[MCS_HT20] = {
+		3212,  6432,  9648,  12864,  19300,  25736,  28952,  32172,
+		6424,  12852, 19280, 25708,  38568,  51424,  57852,  64280,
+		9628,  19260, 28896, 38528,  57792,  65532,  65532,  65532,
+		12828, 25656, 38488, 51320,  65532,  65532,  65532,  65532,
+	},
+	[MCS_HT20_SGI] = {
+		3572,  7144,  10720,  14296,  21444,  28596,  32172,  35744,
+		7140,  14284, 21428,  28568,  42856,  57144,  64288,  65532,
+		10700, 21408, 32112,  42816,  64228,  65532,  65532,  65532,
+		14256, 28516, 42780,  57040,  65532,  65532,  65532,  65532,
+	},
+	[MCS_HT40] = {
+		6680,  13360,  20044,  26724,  40092,  53456,  60140,  65532,
+		13348, 26700,  40052,  53400,  65532,  65532,  65532,  65532,
+		20004, 40008,  60016,  65532,  65532,  65532,  65532,  65532,
+		26644, 53292,  65532,  65532,  65532,  65532,  65532,  65532,
+	},
+	[MCS_HT40_SGI] = {
+		7420,  14844,  22272,  29696,  44544,  59396,  65532,  65532,
+		14832, 29668,  44504,  59340,  65532,  65532,  65532,  65532,
+		22232, 44464,  65532,  65532,  65532,  65532,  65532,  65532,
+		29616, 59232,  65532,  65532,  65532,  65532,  65532,  65532,
+	}
+};
+
 void
 ieee80211_ratectl_register(int type, const struct ieee80211_ratectl *ratectl)
 {
@@ -67,11 +94,11 @@
 }
 
 void
-ieee80211_ratectl_init(struct ieee80211vap *vap, uint32_t options)
+ieee80211_ratectl_init(struct ieee80211vap *vap, uint32_t capabilities)
 {
 	if (vap->iv_rate == ratectls[IEEE80211_RATECTL_NONE])
 		ieee80211_ratectl_set(vap, IEEE80211_RATECTL_AMRR);
-	vap->iv_rate.options = options;
+	vap->iv_rate.ir_capabilities = capabilities;
 	vap->iv_rate->ir_init(vap);
 }
 
@@ -92,3 +119,95 @@
 	}
 	vap->iv_rate = ratectls[type];
 }
+
+void
+ieee80211_ratectl_complete_rcflags(const struct ieee80211_node *ni,
+		struct ieee80211_rc_series *rc, int shortPreamble)
+{
+	const struct ieee80211com *ic = ni->ni_ic;
+	const struct ieee80211vap *vap = ni->ni_vap;
+	const struct ieee80211_rate_table * rt = ic->ic_rt;
+	uint8_t rate;
+	int i;
+
+	/* Make sure that rate control code doesn't mess it up.
+	 * If enable rts/cts and is pre-802.11n, blank tries 1, 2, 3 
+	 */
+
+	if (! (vap->iv_rate->ir_capabilities & IEEE80211_RATECTL_CAP_MRRPROT))
+	{
+		for (i = 1; i < IEEE80211_RATECTL_NUM; i++)
+		{
+			if (rc[0].flags & IEEE80211_RATECTL_RTSCTS_FLAG)
+				rc[i].tries = 0;
+			rc[i].flags &= ~IEEE80211_RATECTL_RTSCTS_FLAG; 
+		}
+	}
+
+	for (i = 0; i < IEEE80211_RATECTL_NUM; i++) {
+		
+		if (rc[i].tries == 0)
+			continue;
+
+		rate = rt->info[rc[i].rix].rateCode;
+
+		/*
+		 * Only enable short preamble for legacy rates
+		 */
+		if ((! IS_HT_RATE(rate)) && shortPreamble)
+			rate |= rt->info[rc[i].rix].shortPreamble;
+
+		/*
+		 * Save this, used by the TX and completion code
+		 */
+		rc[i].ratecode = rate;
+
+		/* Only enable shortgi, 2040, dual-stream if HT is set */
+		if (IS_HT_RATE(rate)) {
+			rc[i].flags |= IEEE80211_RATECTL_HT_FLAG;
+
+			/*
+			 * XXX TODO: LDPC
+			 */
+
+			/*
+			 * Dual / Triple stream rate?
+			 */
+			if (HT_RC_2_STREAMS(rate) == 2)
+				rc[i].flags |= IEEE80211_RATECTL_DS_FLAG;
+			else if (HT_RC_2_STREAMS(rate) == 3)
+				rc[i].flags |= IEEE80211_RATECTL_TS_FLAG;
+		}
+
+		/*
+		 * Calculate the maximum TX power cap for the current
+		 * node. 
+		 * Rate control algo can't control TX power by now.
+		 */
+		rc[i].tx_power_cap = ieee80211_get_node_txpower(ni);
+		
+		/*
+		 * Calculate the maximum 4ms frame length based
+		 * on the MCS rate, SGI and channel width flags.
+		 */
+		if ((rc[i].flags & IEEE80211_RATECTL_HT_FLAG) &&
+		    (HT_RC_2_MCS(rate) < 32)) {
+			int j;
+			if (rc[i].flags & IEEE80211_RATECTL_CW40_FLAG) {
+				if (rc[i].flags & IEEE80211_RATECTL_SGI_FLAG)
+					j = MCS_HT40_SGI;
+				else
+					j = MCS_HT40;
+			} else {
+				if (rc[i].flags & IEEE80211_RATECTL_SGI_FLAG)
+					j = MCS_HT20_SGI;
+				else
+					j = MCS_HT20;
+			}
+			rc[i].max4msframelen =
+			    max_4ms_framelen[j][HT_RC_2_MCS(rate)];
+		} else
+			rc[i].max4msframelen = 0;
+	}
+}
+

Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h
==============================================================================
--- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h	Wed Jul 24 09:35:44 2013	(r255100)
+++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h	Wed Jul 24 09:48:56 2013	(r255101)
@@ -25,6 +25,8 @@
  *
  * $FreeBSD$
  */
+#ifndef _NET80211_IEEE80211_RATECTL_H_
+#define _NET80211_IEEE80211_RATECTL_H_
 
 enum ieee80211_ratealgs {
 	IEEE80211_RATECTL_AMRR		= 0,
@@ -35,6 +37,13 @@
 	IEEE80211_RATECTL_MAX
 };
 
+enum {
+	MCS_HT20,
+	MCS_HT20_SGI,
+	MCS_HT40,
+	MCS_HT40_SGI,
+};
+
 #define	IEEE80211_RATECTL_TX_SUCCESS	1
 #define	IEEE80211_RATECTL_TX_FAILURE	0
 
@@ -51,10 +60,10 @@
 #define	IEEE80211_RATECTL_STBC_FLAG		0x20	/* enable STBC */
 #define	IEEE80211_RATECTL_TS_FLAG		0x40	/* triple-stream rate */
 
-/* Hardware options chip offered to rate control code */
-#define	IEEE80211_RATECTL_OPT_MRR			0x01	/* support MRR */
-#define	IEEE80211_RATECTL_OPT_MRRPROT		0x02	/* support MRR + protect */
-#define	IEEE80211_RATECTL_OPT_MULTXCHAIN	0x04	/* has more than 1 txchain */
+/* Hardware CAPs chip offered to rate control code */
+#define	IEEE80211_RATECTL_CAP_MRR			0x01	/* support MRR */
+#define	IEEE80211_RATECTL_CAP_MRRPROT		0x02	/* support MRR + protect */
+#define	IEEE80211_RATECTL_CAP_MULTXCHAIN	0x04	/* has more than 1 txchain */
 
 #define IS_VAP_HT(vap)	((vap)->iv_htcaps & IEEE80211_HTC_HT)
 
@@ -62,17 +71,22 @@
 #define HT_RC_2_MCS(_rc)    ((_rc) & 0x7f)
 #define HT_RC_2_STREAMS(_rc)    ((((_rc) & 0x78) >> 3) + 1)
 
+
+extern int max_4ms_framelen[4][32];
+
 struct ieee80211_rc_series {
 	uint8_t rix;		/* ratetable index, not rate code */
 	uint8_t ratecode;	/* hardware rate code */
 	uint8_t tries;
 	uint8_t tx_power_cap;
 	uint16_t flags;
+	uint16_t max4msframelen;
 };
 
 struct ieee80211_ratectl {
 	const char *ir_name;
-	uint32_t options;		/* IEEE80211_RATECTL_OPTs */
+	uint32_t ir_capabilities;		/* hardware capabilities offered to rc */
+
 	int	(*ir_attach)(const struct ieee80211vap *);
 	void	(*ir_detach)(const struct ieee80211vap *);
 	void	(*ir_init)(struct ieee80211vap *);
@@ -80,7 +94,8 @@
 	void	(*ir_node_init)(struct ieee80211_node *);
 	void	(*ir_node_deinit)(struct ieee80211_node *);
 	int	(*ir_rate)(struct ieee80211_node *, void *, uint32_t);
-	void	(*ir_rates)(struct ieee80211_node *, struct ieee80211_rc_series *, int, size_t);
+	void	(*ir_rates)(struct ieee80211_node *, struct ieee80211_rc_series *, 
+					  int, size_t);
 	void	(*ir_tx_complete)(const struct ieee80211vap *,
 	    			  const struct ieee80211_node *, int,
 	    			  void *, void *);
@@ -94,6 +109,8 @@
 void	ieee80211_ratectl_unregister(int);
 void	ieee80211_ratectl_init(struct ieee80211vap *, uint32_t);
 void	ieee80211_ratectl_set(struct ieee80211vap *, int);
+void	ieee80211_ratectl_complete_rcflags(const struct ieee80211_node *, 
+		struct ieee80211_rc_series *, int)
 
 MALLOC_DECLARE(M_80211_RATECTL);
 
@@ -104,11 +121,11 @@
 }
 
 static void __inline
-ieee80211_ratectl_node_init(struct ieee80211_node *ni, uint32_t options)
+ieee80211_ratectl_node_init(struct ieee80211_node *ni)
 {
 	const struct ieee80211vap *vap = ni->ni_vap;
 
-	vap->iv_rate->ir_node_init(ni, options);
+	vap->iv_rate->ir_node_init(ni);
 }
 
 static void __inline
@@ -194,73 +211,7 @@
 {
    return IS_VAP_HT(vap) && (vap->iv_htcaps & IEEE80211_HTCAP_TXSTBC) &&
 			    (ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM) &&
-			    (vap->iv_rate->options & IEEE80211_RATECTL_OPT_MULTXCHAIN);
+			    (vap->iv_rate->ir_capabilities & IEEE80211_RATECTL_CAP_MULTXCHAIN);
 }
 
-static void
-ieee80211_ratectl_complete_rcflags(struct ieee80211_node *ni,
-		struct ieee80211_rc_series *rc, int shortPreamble)
-{
-	struct ieee80211com *ic = ni->ni_ic;
-	const struct ieee80211_rate_table * rt = ic->ic_rt;
-	uint8_t rate0, rate;
-	int i;
-
-	rate0 = rt->info[rc[0].rix].rateCode;
-	
-	/* Make sure that rate control code doesn't mess it up.
-	 * If enable rts/cts and is pre-802.11n, blank tries 1, 2, 3 
-	 */
-
-	if (! IS_HT_RATE(rate0))
-	{
-		if (rc[0].flags & IEEE80211_RATECTL_RTSCTS_FLAG)
-			rc[1].tries = rc[2].tries = rc[3].tries = 0;
-		rc[1].flags &= ~IEEE80211_RATECTL_RTSCTS_FLAG; 
-		rc[2].flags &= ~IEEE80211_RATECTL_RTSCTS_FLAG; 
-		rc[3].flags &= ~IEEE80211_RATECTL_RTSCTS_FLAG; 
-	}
-
-	for (i = 0; i < IEEE80211_RATECTL_NUM; i++) {
-		
-		if (rc[i].tries == 0)
-			continue;
-
-		rate = rt->info[rc[i].rix].rateCode;
-
-		/*
-		 * Only enable short preamble for legacy rates
-		 */
-		if ((! IS_HT_RATE(rate)) && shortPreamble)
-			rate |= rt->info[rc[i].rix].shortPreamble;
-
-		/*
-		 * Save this, used by the TX and completion code
-		 */
-		rc[i].ratecode = rate;
-
-		/* Only enable shortgi, 2040, dual-stream if HT is set */
-		if (IS_HT_RATE(rate)) {
-			rc[i].flags |= IEEE80211_RATECTL_HT_FLAG;
-
-			/*
-			 * XXX TODO: LDPC
-			 */
-
-			/*
-			 * Dual / Triple stream rate?
-			 */
-			if (HT_RC_2_STREAMS(rate) == 2)
-				rc[i].flags |= IEEE80211_RATECTL_DS_FLAG;
-			else if (HT_RC_2_STREAMS(rate) == 3)
-				rc[i].flags |= IEEE80211_RATECTL_TS_FLAG;
-		}
-
-		/*
-		 * Calculate the maximum TX power cap for the current
-		 * node. 
-		 * Rate control algo can't control TX power by now.
-		 */
-		rc[i].tx_power_cap = ieee80211_get_node_txpower(ni);
-	}
-}
+#endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307240948.r6O9musc044943>