PERFORCE change 87257 for review

Sam Leffler sam at FreeBSD.org
Sat Nov 26 06:34:08 GMT 2005


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

Change 87257 by sam at sam_ebb on 2005/11/26 06:33:35

	first cut at wme and fixing ifs parameters

Affected files ...

.. //depot/projects/wifi/sys/dev/ral/if_ral.c#14 edit
.. //depot/projects/wifi/sys/dev/ral/if_ralvar.h#5 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ral/if_ral.c#14 (text+ko) ====

@@ -109,7 +109,7 @@
 static uint8_t		ral_plcp_signal(int);
 static void		ral_setup_tx_desc(struct ral_softc *,
 			    struct ral_tx_desc *, uint32_t, int, int, int,
-			    bus_addr_t);
+			    u_int, u_int, u_int, bus_addr_t);
 static int		ral_tx_bcn(struct ral_softc *, struct mbuf *,
 			    struct ieee80211_node *);
 static int		ral_tx_mgt(struct ral_softc *, struct mbuf *,
@@ -136,6 +136,7 @@
 static void		ral_enable_tsf_sync(struct ral_softc *);
 static void		ral_update_plcp(struct ral_softc *);
 static void		ral_update_slot(struct ifnet *);
+static int		ral_wme_update(struct ieee80211com *);
 static void		ral_update_led(struct ral_softc *, int, int);
 static void		ral_set_bssid(struct ral_softc *, const uint8_t *);
 static void		ral_set_macaddr(struct ral_softc *, uint8_t *);
@@ -427,6 +428,7 @@
 		| IEEE80211_C_TXPMGT
 		| IEEE80211_C_BGSCAN		/* capable of bg scanning */
 		| IEEE80211_C_WPA		/* capable of WPA1+WPA2 */
+		| IEEE80211_C_WME		/* capable of WME */
 		;
 
 	if (sc->rf_rev == RAL_RF_5222) {
@@ -473,6 +475,7 @@
 	ieee80211_ifattach(ic);
 	ic->ic_node_alloc = ral_node_alloc;
 	ic->ic_updateslot = ral_update_slot;
+	ic->ic_wme.wme_update = ral_wme_update;
 	ic->ic_reset = ral_reset;
 	ic->ic_scan_start = ral_scan_start;
 	ic->ic_scan_end = ral_scan_end;
@@ -1650,7 +1653,8 @@
 
 static void
 ral_setup_tx_desc(struct ral_softc *sc, struct ral_tx_desc *desc,
-    uint32_t flags, int len, int rate, int encrypt, bus_addr_t physaddr)
+    uint32_t flags, int len, int rate, int encrypt,
+    u_int aifsn, u_int logcwmin, u_int logcwmax, bus_addr_t physaddr)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
 	uint16_t plcp_length;
@@ -1664,7 +1668,10 @@
 		desc->flags |= htole32(RAL_TX_OFDM);
 
 	desc->physaddr = htole32(physaddr);
-	desc->wme = htole16(RAL_AIFSN(3) | RAL_LOGCWMIN(4) | RAL_LOGCWMAX(6));
+	desc->wme = htole16(RAL_AIFSN(aifsn)
+			  | RAL_LOGCWMIN(logcwmin)
+		  	  | RAL_LOGCWMAX(logcwmax))
+			  ;
 
 	/*
 	 * Fill PLCP fields.
@@ -1738,8 +1745,27 @@
 	data->m = m0;
 	data->ni = ni;
 
-	ral_setup_tx_desc(sc, desc, RAL_TX_IFS_NEWBACKOFF | RAL_TX_TIMESTAMP,
-	    m0->m_pkthdr.len, rate, 0, segs->ds_addr);
+	if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
+		/*
+		 * Always burst out beacon and CAB traffic.
+		 */
+		ral_setup_tx_desc(sc, desc,
+		    RAL_TX_IFS_NEWBACKOFF | RAL_TX_TIMESTAMP,
+		    m0->m_pkthdr.len, rate, 0, RAL_BEACON_AIFS_DEFAULT,
+		    RAL_BEACON_CWMIN_DEFAULT, RAL_BEACON_CWMAX_DEFAULT,
+		    segs->ds_addr);
+	} else {
+		struct wmeParams *wmep =
+			&ic->ic_wme.wme_chanParams.cap_wmeParams[WME_AC_BE];
+		/*
+		 * Adhoc mode; important thing is to use 2x cwmin.
+		 */
+		ral_setup_tx_desc(sc, desc,
+		    RAL_TX_IFS_NEWBACKOFF | RAL_TX_TIMESTAMP,
+		    m0->m_pkthdr.len, rate, 0, wmep->wmep_aifsn,
+		    wmep->wmep_logcwmin+1, wmep->wmep_logcwmax,
+		    segs->ds_addr);
+	}
 
 	DPRINTFN(10, ("sending beacon frame len=%u idx=%u rate=%u\n",
 	    m0->m_pkthdr.len, sc->bcnq.cur, rate));
@@ -1757,6 +1783,7 @@
 ral_tx_mgt(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
+	const struct wmeParams *wmep;
 	struct ral_tx_desc *desc;
 	struct ral_tx_data *data;
 	struct ieee80211_frame *wh;
@@ -1765,6 +1792,13 @@
 	uint32_t flags = 0;
 	int nsegs, rate, error;
 
+	/* NB: force all management frames to highest queue */
+	if (ni->ni_flags & IEEE80211_NODE_QOS) {
+		/* NB: force all management frames to highest queue */
+		wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[WME_AC_VO];
+	} else
+		wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[WME_AC_BE];
+	/* XXX use different queue's */
 	desc = &sc->prioq.desc[sc->prioq.cur];
 	data = &sc->prioq.data[sc->prioq.cur];
 
@@ -1797,7 +1831,8 @@
 	wh = mtod(m0, struct ieee80211_frame *);
 
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
-		flags |= RAL_TX_ACK;
+		if (!wmep->wmep_noackPolicy)
+			flags |= RAL_TX_ACK;
 
 		dur = ral_txtime(RAL_ACK_SIZE, rate, ic->ic_flags) + RAL_SIFS;
 		*(uint16_t *)wh->i_dur = htole16(dur);
@@ -1811,6 +1846,7 @@
 	}
 
 	ral_setup_tx_desc(sc, desc, flags, m0->m_pkthdr.len, rate, 0,
+	    wmep->wmep_aifsn, wmep->wmep_logcwmin, wmep->wmep_logcwmax,
 	    segs->ds_addr);
 
 	bus_dmamap_sync(sc->prioq.data_dmat, data->map, BUS_DMASYNC_PREWRITE);
@@ -1862,6 +1898,8 @@
 ral_tx_data(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
+	const struct wmeParams * wmep =
+		&ic->ic_wme.wme_chanParams.cap_wmeParams[M_WME_GETAC(m0)];
 	struct ral_tx_desc *desc;
 	struct ral_tx_data *data;
 	struct ral_node *rn;
@@ -1941,7 +1979,8 @@
 		data->id.id_node = NULL;
 
 		ral_setup_tx_desc(sc, desc, RAL_TX_ACK | RAL_TX_MORE_FRAG,
-		    m->m_pkthdr.len, rtsrate, 1, segs->ds_addr);
+		    m->m_pkthdr.len, rtsrate, 1, wmep->wmep_aifsn,
+		    wmep->wmep_logcwmin, wmep->wmep_logcwmax, segs->ds_addr);
 
 		bus_dmamap_sync(sc->txq.data_dmat, data->map,
 		    BUS_DMASYNC_PREWRITE);
@@ -2017,7 +2056,8 @@
 		data->id.id_node = NULL;
 
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
-		flags |= RAL_TX_ACK;
+		if (!wmep->wmep_noackPolicy)
+			flags |= RAL_TX_ACK;
 
 		dur = ral_txtime(RAL_ACK_SIZE, ral_ack_rate(ic, rate),
 		    ic->ic_flags) + RAL_SIFS;
@@ -2025,6 +2065,7 @@
 	}
 
 	ral_setup_tx_desc(sc, desc, flags, m0->m_pkthdr.len, rate, 1,
+	    wmep->wmep_aifsn, wmep->wmep_logcwmin, wmep->wmep_logcwmax,
 	    segs->ds_addr);
 
 	bus_dmamap_sync(sc->txq.data_dmat, data->map, BUS_DMASYNC_PREWRITE);
@@ -2113,6 +2154,12 @@
 				ieee80211_free_node(ni);
 				continue;
 			}
+			/* calculate priority so we can find the tx queue */
+			if (ieee80211_classify(ic, m0, ni)) {
+				m_freem(m0);
+				ieee80211_free_node(ni);
+				continue;
+			}
 			BPF_MTAP(ifp, m0);
 
 			m0 = ieee80211_encap(ic, m0, ni);
@@ -2543,6 +2590,16 @@
 	DPRINTF(("setting slottime to %uus\n", slottime));
 }
 
+/*
+ * Callback from the 802.11 layer to update WME parameters.
+ */
+static int
+ral_wme_update(struct ieee80211com *ic)
+{
+	/* NB: nothing to do right now */
+	return 0;
+}
+
 static void
 ral_update_led(struct ral_softc *sc, int led1, int led2)
 {

==== //depot/projects/wifi/sys/dev/ral/if_ralvar.h#5 (text+ko) ====

@@ -17,6 +17,10 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#define	RAL_BEACON_AIFS_DEFAULT	 0	/* default aifs for ap beacon q */
+#define	RAL_BEACON_CWMIN_DEFAULT 0	/* default cwmin for ap beacon q */
+#define	RAL_BEACON_CWMAX_DEFAULT 0	/* default cwmax for ap beacon q */
+
 struct ral_rx_radiotap_header {
 	struct ieee80211_radiotap_header wr_ihdr;
 	uint64_t	wr_tsf;


More information about the p4-projects mailing list