PERFORCE change 66299 for review

Sam Leffler sam at FreeBSD.org
Thu Dec 2 22:10:35 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=66299

Change 66299 by sam at sam_ebb on 2004/12/03 06:09:57

	support dtim period other than 1

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/if_ath.c#37 edit
.. //depot/projects/wifi/sys/net80211/ieee80211.c#13 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#23 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#14 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_output.c#20 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_var.h#15 edit

Differences ...

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

@@ -1904,7 +1904,7 @@
 	 * Enable the CAB queue before the beacon queue to
 	 * insure cab frames are triggered by this beacon.
 	 */
-	if (ncabq)
+	if (sc->sc_boff.bo_tim[4] & 1)		/* NB: only at DTIM */
 		ath_hal_txstart(ah, sc->sc_cabq->axq_qnum);
 	ath_hal_puttxbuf(ah, sc->sc_bhalq, bf->bf_daddr);
 	ath_hal_txstart(ah, sc->sc_bhalq);

==== //depot/projects/wifi/sys/net80211/ieee80211.c#13 (text+ko) ====

@@ -170,6 +170,7 @@
 	if (ic->ic_lintval == 0)
 		ic->ic_lintval = 100;		/* default sleep */
 	ic->ic_bmisstimeout = 7*ic->ic_lintval;	/* default 7 beacons */
+	ic->ic_dtim_period = IEEE80211_DTIM_DEFAULT;
 	IEEE80211_BEACON_LOCK_INIT(ic, "beacon");
 
 	ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX;

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

@@ -1435,6 +1435,9 @@
 	case IEEE80211_IOC_WME_ACKPOLICY:	/* WME: ACK policy (bss only) */
 		error = ieee80211_ioctl_getwmeparam(ic, ireq);
 		break;
+	case IEEE80211_IOC_DTIM_PERIOD:
+		ireq->i_val = ic->ic_dtim_period;
+		break;
 	default:
 		error = EINVAL;
 		break;
@@ -2248,6 +2251,15 @@
 	case IEEE80211_IOC_WME_ACKPOLICY:	/* WME: ACK policy (bss only) */
 		error = ieee80211_ioctl_setwmeparam(ic, ireq);
 		break;
+	case IEEE80211_IOC_DTIM_PERIOD:
+		if (IEEE80211_DTIM_MIN < ireq->i_val &&
+		    ireq->i_val <= IEEE80211_DTIM_MAX) {
+			IEEE80211_BEACON_LOCK(ic);
+			ic->ic_dtim_period = ireq->i_val;
+			IEEE80211_BEACON_UNLOCK(ic);
+		} else
+			error = EINVAL;
+		break;
 	default:
 		error = EINVAL;
 		break;

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

@@ -419,6 +419,7 @@
 #define	IEEE80211_IOC_WME_TXOPLIMIT	49	/* WME: txops limit */
 #define	IEEE80211_IOC_WME_ACM		50	/* WME: ACM (bss only) */
 #define	IEEE80211_IOC_WME_ACKPOLICY	51	/* WME: ACK policy (!bss only)*/
+#define	IEEE80211_IOC_DTIM_PERIOD	52	/* DTIM period */
 
 /*
  * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.

==== //depot/projects/wifi/sys/net80211/ieee80211_output.c#20 (text+ko) ====

@@ -1518,8 +1518,19 @@
 				"%s: TIM updated, pending %u, off %u, len %u\n",
 				__func__, ic->ic_ps_pending, timoff, timlen);
 		}
+		/* count down DTIM period */
+		if (bo->bo_tim[2] == 0) {
+			/*
+			 * NB: update both from ic_dtim_period
+			 *     so we automatically collect any
+			 *     new DTIM period.
+			 */
+			bo->bo_tim[2] = ic->ic_dtim_period - 1;
+			bo->bo_tim[3] = ic->ic_dtim_period;
+		} else
+			bo->bo_tim[2]--;
 		/* update TIM state regarding buffered multicast frames */
-		if (mcast)
+		if (mcast && (bo->bo_tim[2] == 1 || bo->bo_tim[3] == 1))
 			bo->bo_tim[4] |= 1;
 		else
 			bo->bo_tim[4] &= ~1;

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

@@ -61,6 +61,10 @@
 #define	IEEE80211_TXPOWER_MAX	100	/* .5 dbM (XXX units?) */
 #define	IEEE80211_TXPOWER_MIN	0	/* kill radio */
 
+#define	IEEE80211_DTIM_MAX	15	/* max DTIM period */
+#define	IEEE80211_DTIM_MIN	1	/* min DTIM period */
+#define	IEEE80211_DTIM_DEFAULT	8	/* default DTIM period */
+
 #define	IEEE80211_PS_SLEEP	0x1	/* STA is in power saving mode */
 #define	IEEE80211_PS_MAX_QUEUE	50	/* maximum saved packets */
 
@@ -113,7 +117,8 @@
 	u_int16_t		ic_ps_sta;	/* stations in power save */
 	u_int16_t		ic_ps_pending;	/* ps sta's w/ pending frames */
 	u_int8_t		*ic_tim_bitmap;	/* power-save stations w/ data*/
-	u_int			ic_tim_len;	/* ic_tim_bitmap size (bytes) */
+	u_int16_t		ic_tim_len;	/* ic_tim_bitmap size (bytes) */
+	u_int16_t		ic_dtim_period;	/* DTIM period */
 	struct ifmedia		ic_media;	/* interface media config */
 	struct bpf_if		*ic_rawbpf;	/* packet filter structure */
 	struct ieee80211_node	*ic_bss;	/* information for this node */


More information about the p4-projects mailing list