From owner-svn-src-all@freebsd.org Sun Mar 11 00:38:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4686F45367; Sun, 11 Mar 2018 00:38:09 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 668FB6E2DD; Sun, 11 Mar 2018 00:38:09 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 477C015334; Sun, 11 Mar 2018 00:38:09 +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 w2B0c99q073387; Sun, 11 Mar 2018 00:38:09 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2B0c9vC073386; Sun, 11 Mar 2018 00:38:09 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201803110038.w2B0c9vC073386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 11 Mar 2018 00:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330753 - head/sys/dev/otus X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/sys/dev/otus X-SVN-Commit-Revision: 330753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Mar 2018 00:38:09 -0000 Author: avos Date: Sun Mar 11 00:38:08 2018 New Revision: 330753 URL: https://svnweb.freebsd.org/changeset/base/330753 Log: otus(4): check mcast / mgt / ucast rates during Tx descriptor setup These parameters may be changed via ifconfig(8); by default, mgt / mcast rates are lowest possible and ucast rate is not set (matches previous configuration). While here, store some variables locally for better readability. Modified: head/sys/dev/otus/if_otus.c Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Sun Mar 11 00:08:09 2018 (r330752) +++ head/sys/dev/otus/if_otus.c Sun Mar 11 00:38:08 2018 (r330753) @@ -2182,6 +2182,7 @@ static int otus_tx(struct otus_softc *sc, struct ieee80211_node *ni, struct mbuf *m, struct otus_data *data, const struct ieee80211_bpf_params *params) { + const struct ieee80211_txparam *tp = ni->ni_txparms; struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_frame *wh; @@ -2190,7 +2191,7 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node * uint32_t phyctl; uint16_t macctl, qos; uint8_t qid, rate; - int hasqos, xferlen; + int hasqos, xferlen, type, ismcast; wh = mtod(m, struct ieee80211_frame *); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { @@ -2228,17 +2229,19 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node * qid = WME_AC_BE; } + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); + /* Pickup a rate index. */ - if (params != NULL) { + if (params != NULL) rate = otus_rate_to_hw_rate(sc, params->ibp_rate0); - } else if (m->m_flags & M_EAPOL) { - /* Get lowest rate */ - rate = otus_rate_to_hw_rate(sc, 0); - } else if (IEEE80211_IS_MULTICAST(wh->i_addr1) || - (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_DATA) { - /* Get lowest rate */ - rate = otus_rate_to_hw_rate(sc, 0); - } else { + else if (!!(m->m_flags & M_EAPOL) || type != IEEE80211_FC0_TYPE_DATA) + rate = otus_rate_to_hw_rate(sc, tp->mgmtrate); + else if (ismcast) + rate = otus_rate_to_hw_rate(sc, tp->mcastrate); + else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) + rate = otus_rate_to_hw_rate(sc, tp->ucastrate); + else { (void) ieee80211_ratectl_rate(ni, NULL, 0); rate = otus_rate_to_hw_rate(sc, ni->ni_txrate); } @@ -2249,12 +2252,12 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node * /* * XXX TODO: params for NOACK, ACK, RTS, CTS, etc */ - if (IEEE80211_IS_MULTICAST(wh->i_addr1) || + if (ismcast || (hasqos && ((qos & IEEE80211_QOS_ACKPOLICY) == IEEE80211_QOS_ACKPOLICY_NOACK))) macctl |= AR_TX_MAC_NOACK; - if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { + if (!ismcast) { if (m->m_pkthdr.len + IEEE80211_CRC_LEN >= vap->iv_rtsthreshold) macctl |= AR_TX_MAC_RTS; else if (ic->ic_flags & IEEE80211_F_USEPROT) {