svn commit: r331042 - head/sys/dev/usb/wlan
Andriy Voskoboinyk
avos at FreeBSD.org
Fri Mar 16 00:38:11 UTC 2018
Author: avos
Date: Fri Mar 16 00:38:10 2018
New Revision: 331042
URL: https://svnweb.freebsd.org/changeset/base/331042
Log:
urtw(4), zyd(4): reduce code verbosity.
No functional change intended.
Modified:
head/sys/dev/usb/wlan/if_urtw.c
head/sys/dev/usb/wlan/if_zyd.c
Modified: head/sys/dev/usb/wlan/if_urtw.c
==============================================================================
--- head/sys/dev/usb/wlan/if_urtw.c Fri Mar 16 00:09:16 2018 (r331041)
+++ head/sys/dev/usb/wlan/if_urtw.c Fri Mar 16 00:38:10 2018 (r331042)
@@ -1661,14 +1661,17 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_
sc->sc_xfer[URTW_8187B_BULK_TX_VO]
};
struct usb_xfer *xfer;
- int dur = 0, rtsdur = 0, rtsenable = 0, ctsenable = 0, rate,
- pkttime = 0, txdur = 0, isshort = 0, xferlen;
+ int dur = 0, rtsdur = 0, rtsenable = 0, ctsenable = 0, rate, type,
+ pkttime = 0, txdur = 0, isshort = 0, xferlen, ismcast;
uint16_t acktime, rtstime, ctstime;
uint32_t flags;
usb_error_t error;
URTW_ASSERT_LOCKED(sc);
+ ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
+ type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
+
/*
* Software crypto.
*/
@@ -1697,13 +1700,13 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_
ieee80211_radiotap_tx(vap, m0);
}
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT ||
- (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL ||
+ if (type == IEEE80211_FC0_TYPE_MGT ||
+ type == IEEE80211_FC0_TYPE_CTL ||
(m0->m_flags & M_EAPOL) != 0) {
rate = tp->mgmtrate;
} else {
/* for data frames */
- if (IEEE80211_IS_MULTICAST(wh->i_addr1))
+ if (ismcast)
rate = tp->mcastrate;
else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
rate = tp->ucastrate;
@@ -1713,7 +1716,7 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_
sc->sc_stats.txrates[sc->sc_currate]++;
- if (IEEE80211_IS_MULTICAST(wh->i_addr1))
+ if (ismcast)
txdur = pkttime = urtw_compute_txtime(m0->m_pkthdr.len +
IEEE80211_CRC_LEN, rate, 0, 0);
else {
@@ -1776,8 +1779,7 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_
}
tx->flag = htole32(flags);
tx->txdur = txdur;
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
- IEEE80211_FC0_TYPE_MGT &&
+ if (type == IEEE80211_FC0_TYPE_MGT &&
(wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
IEEE80211_FC0_SUBTYPE_PROBE_RESP)
tx->retry = 1;
@@ -1805,7 +1807,7 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_
data->m = m0;
if (sc->sc_flags & URTW_RTL8187B) {
- switch (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) {
+ switch (type) {
case IEEE80211_FC0_TYPE_CTL:
case IEEE80211_FC0_TYPE_MGT:
xfer = sc->sc_xfer[URTW_8187B_BULK_TX_EP12];
Modified: head/sys/dev/usb/wlan/if_zyd.c
==============================================================================
--- head/sys/dev/usb/wlan/if_zyd.c Fri Mar 16 00:09:16 2018 (r331041)
+++ head/sys/dev/usb/wlan/if_zyd.c Fri Mar 16 00:38:10 2018 (r331042)
@@ -2443,7 +2443,7 @@ zyd_tx_start(struct zyd_softc *sc, struct mbuf *m0, st
struct ieee80211_frame *wh;
const struct ieee80211_txparam *tp = ni->ni_txparms;
struct ieee80211_key *k;
- int rate, totlen;
+ int rate, totlen, type, ismcast;
static const uint8_t ratediv[] = ZYD_TX_RATEDIV;
uint8_t phy;
uint16_t pktlen;
@@ -2454,13 +2454,16 @@ zyd_tx_start(struct zyd_softc *sc, struct mbuf *m0, st
STAILQ_REMOVE_HEAD(&sc->tx_free, next);
sc->tx_nfree--;
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT ||
- (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL ||
+ ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
+ type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
+
+ if (type == IEEE80211_FC0_TYPE_MGT ||
+ type == IEEE80211_FC0_TYPE_CTL ||
(m0->m_flags & M_EAPOL) != 0) {
rate = tp->mgmtrate;
} else {
/* for data frames */
- if (IEEE80211_IS_MULTICAST(wh->i_addr1))
+ if (ismcast)
rate = tp->mcastrate;
else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
rate = tp->ucastrate;
@@ -2498,7 +2501,7 @@ zyd_tx_start(struct zyd_softc *sc, struct mbuf *m0, st
desc->len = htole16(totlen);
desc->flags = ZYD_TX_FLAG_BACKOFF;
- if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+ if (!ismcast) {
/* multicast frames are not sent at OFDM rates in 802.11b/g */
if (totlen > vap->iv_rtsthreshold) {
desc->flags |= ZYD_TX_FLAG_RTS;
More information about the svn-src-all
mailing list