Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Feb 2011 09:08:08 +0300
From:      Alexander Zagrebin <alex@zagrebin.ru>
To:        freebsd-net@freebsd.org
Subject:   if_run in hostap mode: issue with stations in the power save mode
Message-ID:  <20110204060808.GA97298@gw.zagrebin.ru>

next in thread | raw e-mail | index | archive | help

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I'm using an Ralink RT2870 based adapter (run(4) driver) in the hostap mode.
and I've noticed that if_run doesn't support stations working in the
power save mode (PSM). The reason is in lack of the TIM in beacons.
The attached patch adds this functionality and completely fixes this issue.
Despite the fact that patch is working, it seems that it needs an additional
work. For example, now the result of ieee80211_beacon_update is ignored with
a corresponding message, but may be necessary to process it...

Can somebody review it?

-- 
Alexander Zagrebin

--ew6BAiZeqk4r7MaW
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="patch-if_run.c"

--- sys/dev/usb/wlan/if_run.c.orig	2011-01-21 08:28:14.000000000 +0300
+++ sys/dev/usb/wlan/if_run.c		2011-02-03 20:46:16.809999991 +0300
@@ -3903,6 +3903,7 @@
 	struct run_softc *sc = ic->ic_ifp->if_softc;
 	uint32_t i;
 
+	setbit(RUN_VAP(vap)->bo.bo_flags, item);
 	i = RUN_CMDQ_GET(&sc->cmdq_store);
 	DPRINTF("cmdq_store=%d\n", i);
 	sc->cmdq[i].func = run_update_beacon_cb;
@@ -3921,13 +3922,25 @@
 	struct rt2860_txwi txwi;
 	struct mbuf *m;
 	uint8_t ridx;
+	uint8_t flags[4];
 
 	if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC)
 		return;
 
+	/*
+	 * ieee80211_beacon_construct called from ieee80211_beacon_alloc
+	 * will clear bo_flags, so we need store it for later use
+	 */
+	memcpy(&flags, &RUN_VAP(vap)->bo.bo_flags, sizeof(flags));
+
 	if ((m = ieee80211_beacon_alloc(vap->iv_bss, &RUN_VAP(vap)->bo)) == NULL)
 	        return;
 
+	/* Now we may restore bo_flags and update the dynamic beacon contents */
+	memcpy(&RUN_VAP(vap)->bo.bo_flags, &flags, sizeof(flags));
+	if (ieee80211_beacon_update(vap->iv_bss, &RUN_VAP(vap)->bo, m, 1))
+		device_printf(sc->sc_dev, "ieee80211_beacon_update failed\n");
+	
 	memset(&txwi, 0, sizeof txwi);
 	txwi.wcid = 0xff;
 	txwi.len = htole16(m->m_pkthdr.len);

--ew6BAiZeqk4r7MaW--



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