From owner-svn-src-head@freebsd.org Wed Jan 20 23:01:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE30FA8AD3F; Wed, 20 Jan 2016 23:01:34 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 975601967; Wed, 20 Jan 2016 23:01:34 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0KN1XYC058390; Wed, 20 Jan 2016 23:01:33 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0KN1XtW058389; Wed, 20 Jan 2016 23:01:33 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201601202301.u0KN1XtW058389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Wed, 20 Jan 2016 23:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294465 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2016 23:01:35 -0000 Author: avos Date: Wed Jan 20 23:01:33 2016 New Revision: 294465 URL: https://svnweb.freebsd.org/changeset/base/294465 Log: urtwn: use ic_updateslot method to handle slot time change (by default it was set to 9us). Tested with RTL8188EU / RTL8188CUS in STA mode. Reviewed by: kevlo Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4535 Modified: head/sys/dev/usb/wlan/if_urtwn.c Modified: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c Wed Jan 20 22:57:10 2016 (r294464) +++ head/sys/dev/usb/wlan/if_urtwn.c Wed Jan 20 23:01:33 2016 (r294465) @@ -319,6 +319,10 @@ static void urtwn_scan_start(struct iee static void urtwn_scan_end(struct ieee80211com *); static void urtwn_set_channel(struct ieee80211com *); static int urtwn_wme_update(struct ieee80211com *); +static void urtwn_update_slot(struct ieee80211com *); +static void urtwn_update_slot_cb(struct urtwn_softc *, + union sec_param *); +static void urtwn_update_aifs(struct urtwn_softc *, uint8_t); static void urtwn_set_promisc(struct urtwn_softc *); static void urtwn_update_promisc(struct ieee80211com *); static void urtwn_update_mcast(struct ieee80211com *); @@ -540,6 +544,7 @@ urtwn_attach(device_t self) ic->ic_vap_create = urtwn_vap_create; ic->ic_vap_delete = urtwn_vap_delete; ic->ic_wme.wme_update = urtwn_wme_update; + ic->ic_updateslot = urtwn_update_slot; ic->ic_update_promisc = urtwn_update_promisc; ic->ic_update_mcast = urtwn_update_mcast; if (sc->chip & URTWN_CHIP_88E) { @@ -4195,6 +4200,40 @@ urtwn_wme_update(struct ieee80211com *ic } static void +urtwn_update_slot(struct ieee80211com *ic) +{ + urtwn_cmd_sleepable(ic->ic_softc, NULL, 0, urtwn_update_slot_cb); +} + +static void +urtwn_update_slot_cb(struct urtwn_softc *sc, union sec_param *data) +{ + struct ieee80211com *ic = &sc->sc_ic; + uint8_t slottime; + + slottime = IEEE80211_GET_SLOTTIME(ic); + + DPRINTFN(10, "setting slot time to %uus\n", slottime); + + urtwn_write_1(sc, R92C_SLOT, slottime); + urtwn_update_aifs(sc, slottime); +} + +static void +urtwn_update_aifs(struct urtwn_softc *sc, uint8_t slottime) +{ + const struct wmeParams *wmep = + sc->sc_ic.ic_wme.wme_chanParams.cap_wmeParams; + uint8_t aifs, ac; + + for (ac = WME_AC_BE; ac < WME_NUM_AC; ac++) { + /* AIFS[AC] = AIFSN[AC] * aSlotTime + aSIFSTime. */ + aifs = wmep[ac].wmep_aifsn * slottime + IEEE80211_DUR_SIFS; + urtwn_write_1(sc, wme2queue[ac].reg, aifs); + } +} + +static void urtwn_set_promisc(struct urtwn_softc *sc) { struct ieee80211com *ic = &sc->sc_ic;