Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jul 2005 18:26:53 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80471 for review
Message-ID:  <200507181826.j6IIQrjN069441@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80471

Change 80471 by sam@sam_ebb on 2005/07/18 18:25:53

	add separate tx rate for mcast traffic

Affected files ...

.. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#42 edit
.. //depot/projects/wifi/sys/dev/ath/if_ath.c#88 edit
.. //depot/projects/wifi/sys/dev/ath/if_athvar.h#38 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#41 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#26 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_proto.c#29 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_var.h#29 edit

Differences ...

==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#42 (text+ko) ====

@@ -696,6 +696,12 @@
 	set80211(s, IEEE80211_IOC_ROAM_RATE_11G, 2*atoi(val), 0, NULL);
 }
 
+static
+DECL_CMD_FUNC(set80211mcastrate, val, d)
+{
+	set80211(s, IEEE80211_IOC_MCAST_RATE, 2*atoi(val), 0, NULL);
+}
+
 static int
 getmaxrate(uint8_t rates[15], uint8_t nrates)
 {
@@ -1581,6 +1587,12 @@
 			LINE_CHECK("%crtsthreshold %d", spacer, ireq.i_val);
 	}
 
+	ireq.i_type = IEEE80211_IOC_MCAST_RATE;
+	if (ioctl(s, SIOCG80211, &ireq) != -1) {
+		if (ireq.i_val != 2*1 || verbose)
+			LINE_CHECK("%cmcastrate %d", spacer, ireq.i_val/2);
+	}
+
 	ireq.i_type = IEEE80211_IOC_BGSCAN;
 	if (ioctl(s, SIOCG80211, &ireq) != -1) {
 		bgscan = ireq.i_val;
@@ -1954,6 +1966,7 @@
 	DEF_CMD_ARG("roam:rate11a",	set80211roamrate11a),
 	DEF_CMD_ARG("roam:rate11b",	set80211roamrate11b),
 	DEF_CMD_ARG("roam:rate11g",	set80211roamrate11g),
+	DEF_CMD_ARG("mcastrate",	set80211mcastrate),
 };
 static struct afswtch af_ieee80211 = {
 	.af_name	= "af_ieee80211",

==== //depot/projects/wifi/sys/dev/ath/if_ath.c#88 (text+ko) ====

@@ -3549,6 +3549,20 @@
 	return NULL;
 }
 
+/*
+ * Return h/w rate index for an IEEE rate (w/o basic rate bit).
+ */
+static int
+ath_tx_findrix(const HAL_RATE_TABLE *rt, int rate)
+{
+	int i;
+
+	for (i = 0; i < rt->rateCount; i++)
+		if ((rt->info[i].dot11Rate & IEEE80211_RATE_VAL) == rate)
+			return i;
+	return 0;		/* NB: lowest rate */
+}
+
 static int
 ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf,
     struct mbuf *m0)
@@ -3752,12 +3766,29 @@
 	case IEEE80211_FC0_TYPE_DATA:
 		atype = HAL_PKT_TYPE_NORMAL;		/* default */
 		/*
-		 * Data frames; consult the rate control module.
+		 * Data frames: multicast frames go out at a fixed rate,
+		 * otherwise consult the rate control module for the
+		 * rate to use.
 		 */
-		ath_rate_findrate(sc, an, shortPreamble, pktlen,
-			&rix, &try0, &txrate);
-		sc->sc_txrate = txrate;			/* for LED blinking */
-		sc->sc_lastdatarix = rix;		/* for fast frames */
+		if (ismcast) {
+			/*
+			 * Check mcast rate setting in case it changed.
+			 * XXX move out of fastpath
+			 */
+			if (ic->ic_mcast_rate != sc->sc_mcastrate) {
+				sc->sc_mcastrix =
+					ath_tx_findrix(rt, ic->ic_mcast_rate);
+				sc->sc_mcastrate = ic->ic_mcast_rate;
+			}
+			rix = sc->sc_mcastrix;
+			txrate = rt->info[rix].rateCode;
+			try0 = ATH_TXMAXTRY;
+		} else {
+			ath_rate_findrate(sc, an, shortPreamble, pktlen,
+				&rix, &try0, &txrate);
+			sc->sc_txrate = txrate;		/* for LED blinking */
+			sc->sc_lastdatarix = rix;	/* for fast frames */
+		}
 		/*
 		 * Default all non-QoS traffic to the best-effort queue.
 		 */
@@ -5034,12 +5065,20 @@
 	/*
 	 * All protection frames are transmited at 2Mb/s for
 	 * 11g, otherwise at 1Mb/s.
-	 * XXX select protection rate index from rate table.
 	 */
-	sc->sc_protrix = (mode == IEEE80211_MODE_11G ? 1 : 0);
-	/* NB: caller is responsible for reseting rate control state */
+	if (mode == IEEE80211_MODE_11G)
+		sc->sc_protrix = ath_tx_findrix(rt, 2*2);
+	else
+		sc->sc_protrix = ath_tx_findrix(rt, 2*1);
 	/* rate index used to send management frames */
 	sc->sc_minrateix = 0;
+	/*
+	 * Setup multicast rate state.
+	 */
+	/* XXX layering violation */
+	sc->sc_mcastrix = ath_tx_findrix(rt, sc->sc_ic.ic_mcast_rate);
+	sc->sc_mcastrate = sc->sc_ic.ic_mcast_rate;
+	/* NB: caller is responsible for reseting rate control state */
 #undef N
 }
 

==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#38 (text+ko) ====

@@ -248,8 +248,10 @@
 		u_int16_t	ledoff;		/* softled off time */
 	} sc_hwmap[32];				/* h/w rate ix mappings */
 	u_int8_t		sc_minrateix;	/* min h/w rate index */
+	u_int8_t		sc_mcastrix;	/* mcast h/w rate index */
 	u_int8_t		sc_protrix;	/* protection rate index */
 	u_int8_t		sc_lastdatarix;	/* last data frame rate index */
+	u_int			sc_mcastrate;	/* ieee rate for mcastrateix */
 	u_int			sc_fftxqmin;	/* min frames before staging */
 	u_int			sc_fftxqmax;	/* max frames before drop */
 	u_int			sc_txantenna;	/* tx antenna (fixed or auto) */

==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#41 (text+ko) ====

@@ -797,6 +797,9 @@
 	case IEEE80211_IOC_ROAM_RATE_11G:
 		ireq->i_val = ic->ic_roam.rate11b;
 		break;
+	case IEEE80211_IOC_MCAST_RATE:
+		ireq->i_val = ic->ic_mcast_rate;
+		break;
 	default:
 		error = EINVAL;
 		break;
@@ -1850,13 +1853,16 @@
 		ic->ic_roam.rssi11b = ireq->i_val;
 		break;
 	case IEEE80211_IOC_ROAM_RATE_11A:
-		ic->ic_roam.rate11a = ireq->i_val;
+		ic->ic_roam.rate11a = ireq->i_val & IEEE80211_RATE_VAL;
 		break;
 	case IEEE80211_IOC_ROAM_RATE_11B:
-		ic->ic_roam.rate11bOnly = ireq->i_val;
+		ic->ic_roam.rate11bOnly = ireq->i_val & IEEE80211_RATE_VAL;
 		break;
 	case IEEE80211_IOC_ROAM_RATE_11G:
-		ic->ic_roam.rate11b = ireq->i_val;
+		ic->ic_roam.rate11b = ireq->i_val & IEEE80211_RATE_VAL;
+		break;
+	case IEEE80211_IOC_MCAST_RATE:
+		ic->ic_mcast_rate = ireq->i_val & IEEE80211_RATE_VAL;
 		break;
 	default:
 		error = EINVAL;

==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#26 (text+ko) ====

@@ -445,6 +445,7 @@
 #define	IEEE80211_IOC_ROAM_RATE_11A	69	/* tx rate threshold in 11a */
 #define	IEEE80211_IOC_ROAM_RATE_11B	70	/* tx rate threshold in 11b */
 #define	IEEE80211_IOC_ROAM_RATE_11G	71	/* tx rate threshold in 11g */
+#define	IEEE80211_IOC_MCAST_RATE	72	/* tx rate for mcast frames */
 
 /*
  * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.

==== //depot/projects/wifi/sys/net80211/ieee80211_proto.c#29 (text+ko) ====

@@ -101,6 +101,7 @@
 #endif
 	ic->ic_fragthreshold = 2346;		/* XXX not used yet */
 	ic->ic_fixed_rate = IEEE80211_FIXED_RATE_NONE;
+	ic->ic_mcast_rate = IEEE80211_MCAST_RATE_DEFAULT;
 	ic->ic_protmode = IEEE80211_PROT_CTSONLY;
 	ic->ic_roaming = IEEE80211_ROAMING_AUTO;
 

==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#29 (text+ko) ====

@@ -81,6 +81,7 @@
 #define	IEEE80211_PS_MAX_QUEUE	50	/* maximum saved packets */
 
 #define	IEEE80211_FIXED_RATE_NONE	-1
+#define	IEEE80211_MCAST_RATE_DEFAULT	(2*1)	/* default mcast rate (1M) */
 
 #define	IEEE80211_MS_TO_TU(x)	(((x) * 1000) / 1024)
 #define	IEEE80211_TU_TO_MS(x)	(((x) * 1024) / 1000)



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