Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 May 2012 12:51:10 +0200
From:      Bernhard Schmidt <bschmidt@freebsd.org>
To:        freebsd-wireless@freebsd.org
Cc:        freebsd-net@freebsd.org, "Sergey V. Dyatko" <sergey.dyatko@gmail.com>, freebsd-current@freebsd.org
Subject:   Re: [CFT] Ralink RT2860, RT2870, RT3060, RT3090 support
Message-ID:  <201205051251.10431.bschmidt@freebsd.org>
In-Reply-To: <20120505105258.28e28803@laptop>
References:  <201205031853.53102.bschmidt@freebsd.org> <20120505105258.28e28803@laptop>

next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_eYQpPv8wqFkpfch
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

On Saturday 05 May 2012 09:52:58 Sergey V. Dyatko wrote:
> On Thu, 3 May 2012 18:53:52 +0200
> Bernhard Schmidt <bschmidt@freebsd.org> wrote:
> 
> > Hi folks,
> > 
> > As some of you might know there has been some work going on porting
> > support for new Ralink chipsets from OpenBSD. Several different
> > drivers where floating around but nothing seemed to be decent enough
> > to be committed. ray@ and I had been working on cleaning up one of
> > those to get it into a good enough shape, but abandoned this approach
> > as it resulted in more work than starting from scratch.
> > 
> > So, attached diff [1] is a from-scratch effort to port over support
> > for the new chipsets. It doesn't contain fancy stuff like 802.11n
> > support as of yet (this will be worked one once the legacy stuff is
> > in HEAD), nonetheless it showed pretty decent performance during the
> > basic sta/adhoc/hostap tests I've done.
> > 
> > I'd appreciate testing and feedback ;)
> > 
> at 1st I would say 'Thank You' for all people who working on this :)
> 
> patch, make, make install, kldload:
> http://tiger.ipfw.ru/files/rt2860_3090.txt
> 
> this is  FreeBSD 10.0-CURRENT, r234992M: Fri May  4 11:25:53 FET 2012
> from time to time on messages:
> May  5 10:32:47 laptop kernel: ral0: device timeout
> May  5 10:37:49 laptop kernel: ral0: device timeout
> May  5 10:42:50 laptop kernel: ral0: device timeout
> 
> LED... is just glowing, rarely blinks. With patch from Alexander (ray@)
> it doesn't work
> 
> [tiger@laptop]~%scp tiger:/storage/FreeBSD-8.2-RELEASE-amd64-dvd1.iso .
> FreeBSD-8.2-RELEASE-amd64-dvd1.iso                                 11%
> 271MB   1.9MB/s   18:19 ETA
> ^C
> Killed by signal 2.
> where 'tiger' is my desktop

Please apply attached patch (also here [1]) on top of the first one,
it fixes channel switching for >= 3070 (called the wrong function,
doh..) as well as a bgscan issue.

[1] http://techwires.net/~bschmidt/rt2860_1.diff

-- 
Bernhard

--Boundary-00=_eYQpPv8wqFkpfch
Content-Type: text/x-patch;
  charset="UTF-8";
  name="rt2860_1.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="rt2860_1.diff"

Index: sys/dev/ral/rt2860.c
===================================================================
--- sys/dev/ral/rt2860.c	(revision 234847)
+++ sys/dev/ral/rt2860.c	(working copy)
@@ -1605,10 +1605,7 @@ rt2860_tx(struct rt2860_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
 		ieee80211_radiotap_tx(vap, m);
 	}
 
-	if (hdrlen & 3)
-		pad = 4 - (hdrlen & 3);
-	else
-		pad = 0;
+	pad = (hdrlen + 3) & ~3;
 
 	/* copy and trim 802.11 header */
 	memcpy(txwi + 1, wh, hdrlen);
@@ -1667,7 +1664,7 @@ rt2860_tx(struct rt2860_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
 	/* first segment is TXWI + 802.11 header */
 	txd = &ring->txd[ring->cur];
 	txd->sdp0 = htole32(data->paddr);
-	txd->sdl0 = htole16(sizeof (struct rt2860_txwi) + hdrlen + pad);
+	txd->sdl0 = htole16(sizeof (struct rt2860_txwi) + pad);
 	txd->flags = qsel;
 
 	/* setup payload segments */
@@ -1776,7 +1773,7 @@ rt2860_tx_raw(struct rt2860_softc *sc, struct mbuf *m,
 	u_int hdrlen;
 	uint16_t dur;
 	uint8_t type, qsel, mcs, pid, tid, qid;
-	int i, nsegs, ntxds, rate, ridx, error;
+	int i, nsegs, ntxds, pad, rate, ridx, error;
 
 	/* the data pool contains at least one element, pick the first */
 	data = SLIST_FIRST(&sc->data_pool);
@@ -1860,6 +1857,8 @@ rt2860_tx_raw(struct rt2860_softc *sc, struct mbuf *m,
 		ieee80211_radiotap_tx(vap, m);
 	}
 
+	pad = (hdrlen + 3) & ~3;
+
 	/* copy and trim 802.11 header */
 	memcpy(txwi + 1, wh, hdrlen);
 	m_adj(m, hdrlen);
@@ -1917,7 +1916,7 @@ rt2860_tx_raw(struct rt2860_softc *sc, struct mbuf *m,
 	/* first segment is TXWI + 802.11 header */
 	txd = &ring->txd[ring->cur];
 	txd->sdp0 = htole32(data->paddr);
-	txd->sdl0 = htole16(sizeof (struct rt2860_txwi) + hdrlen);
+	txd->sdl0 = htole16(sizeof (struct rt2860_txwi) + pad);
 	txd->flags = qsel;
 
 	/* setup payload segments */
@@ -2336,7 +2335,6 @@ rt2860_scan_start(struct ieee80211com *ic)
 	    tmp & ~(RT2860_BCN_TX_EN | RT2860_TSF_TIMER_EN |
 	    RT2860_TBTT_TIMER_EN));
 	rt2860_set_gp_timer(sc, 0);
-	rt2860_set_bssid(sc, ifp->if_broadcastaddr);
 }
 
 static void
@@ -2346,10 +2344,10 @@ rt2860_scan_end(struct ieee80211com *ic)
 	struct rt2860_softc *sc = ifp->if_softc;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 
-	rt2860_enable_tsf_sync(sc);
-	/* XXX keep local copy */
-	rt2860_set_bssid(sc, vap->iv_bss->ni_bssid);
-	rt2860_set_gp_timer(sc, 500);
+	if (vap->iv_state == IEEE80211_S_RUN) {
+		rt2860_enable_tsf_sync(sc);
+		rt2860_set_gp_timer(sc, 500);
+	}
 }
 
 static void
@@ -2359,7 +2357,7 @@ rt2860_set_channel(struct ieee80211com *ic)
 	struct rt2860_softc *sc = ifp->if_softc;
 
 	RAL_LOCK(sc);
-	rt2860_set_chan(sc, ieee80211_chan2ieee(ic, ic->ic_curchan));
+	rt2860_switch_chan(sc, ic->ic_curchan);
 	RAL_UNLOCK(sc);
 }
 

--Boundary-00=_eYQpPv8wqFkpfch--



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