From owner-freebsd-net@FreeBSD.ORG Sat May 5 10:50:48 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 742E41065675 for ; Sat, 5 May 2012 10:50:48 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id EDFD28FC0A for ; Sat, 5 May 2012 10:50:47 +0000 (UTC) Received: by weyt57 with SMTP id t57so2999141wey.13 for ; Sat, 05 May 2012 03:50:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:message-id:x-gm-message-state; bh=DpIyN1EJkG2dgQNSdc+pgi7Tv2Y632zQs4UDIGose9o=; b=V85dQfBSajHlmJecWdW3G5vejgoDAlM+eo152ErUBrA1uYAd7TtUGWNG4cAq1MK7hK PhFQQtqrChgb2Gv9dByekZoa2wsRZScIw4PXu0Lc5IG9Sg1gBWqEneOWoLdTEvnJtU3M 7b/6/Nd8+kUbE4oU/nN1+BZXT2iawMVABETHnQT4Djdo8WhaMGUFGmToA+BA1HnRsvSN L+9KdlIvNI9kgbbQq6MDxKmdkWALFX2hQOZmm8az+Gg3b/OQY4Fkal5STCL/qrHAFOGt LQ3XCUZCI/qcmEowtcCJL2K+K6Zxe5+uxkjvHXvc+9VKeRZQadGz4tbKLF0jifcFHOsJ nUWQ== Received: by 10.180.88.169 with SMTP id bh9mr16806914wib.5.1336215046881; Sat, 05 May 2012 03:50:46 -0700 (PDT) Received: from amy.lab.techwires.net (dslb-088-067-196-237.pools.arcor-ip.net. [88.67.196.237]) by mx.google.com with ESMTPS id fo7sm3275178wib.9.2012.05.05.03.50.44 (version=SSLv3 cipher=OTHER); Sat, 05 May 2012 03:50:46 -0700 (PDT) Sender: Bernhard Schmidt From: Bernhard Schmidt To: freebsd-wireless@freebsd.org Date: Sat, 5 May 2012 12:51:10 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <201205031853.53102.bschmidt@freebsd.org> <20120505105258.28e28803@laptop> In-Reply-To: <20120505105258.28e28803@laptop> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_eYQpPv8wqFkpfch" Message-Id: <201205051251.10431.bschmidt@freebsd.org> X-Gm-Message-State: ALoCoQnW0CfXiE0LLEe+lCjBBl3Ip85E39oTcVMkf1HVuSI1BVZJ+jmeIaUQYUNEegyr/Br4PlRk Cc: freebsd-net@freebsd.org, "Sergey V. Dyatko" , freebsd-current@freebsd.org Subject: Re: [CFT] Ralink RT2860, RT2870, RT3060, RT3090 support X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 May 2012 10:50:48 -0000 --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 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--