diff options
| author | Andriy Voskoboinyk <avos@FreeBSD.org> | 2016-04-20 18:29:30 +0000 |
|---|---|---|
| committer | Andriy Voskoboinyk <avos@FreeBSD.org> | 2016-04-20 18:29:30 +0000 |
| commit | 31021a2b4ef82d6491e5769defa8b34f16437761 (patch) | |
| tree | ce3eab7ed45b044ec959a1de503b72ca6e18f182 /sys/dev | |
| parent | d4015ddc57f4920eaf184ab5c5dc246140142c5a (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ath/if_ath.c | 4 | ||||
| -rw-r--r-- | sys/dev/ath/if_ath_beacon.c | 8 | ||||
| -rw-r--r-- | sys/dev/ath/if_ath_misc.h | 9 | ||||
| -rw-r--r-- | sys/dev/ath/if_ath_rx.c | 8 | ||||
| -rw-r--r-- | sys/dev/otus/if_otus.c | 3 | ||||
| -rw-r--r-- | sys/dev/rtwn/if_rtwn.c | 4 | ||||
| -rw-r--r-- | sys/dev/rtwn/if_rtwnreg.h | 4 | ||||
| -rw-r--r-- | sys/dev/urtwn/if_urtwn.c | 11 |
8 files changed, 18 insertions, 33 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index e2dc250bb89a..9a06218ce0e3 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -3483,10 +3483,10 @@ ath_update_mcast_hw(struct ath_softc *sc) /* calculate XOR of eight 6bit values */ dl = LLADDR((struct sockaddr_dl *) ifma->ifma_addr); - val = LE_READ_4(dl + 0); + val = le32dec(dl + 0); pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; - val = LE_READ_4(dl + 3); + val = le32dec(dl + 3); pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; pos &= 0x3f; diff --git a/sys/dev/ath/if_ath_beacon.c b/sys/dev/ath/if_ath_beacon.c index 5db0ba416c83..c700230149e5 100644 --- a/sys/dev/ath/if_ath_beacon.c +++ b/sys/dev/ath/if_ath_beacon.c @@ -942,11 +942,11 @@ ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap) ATH_UNLOCK(sc); /* extract tstamp from last beacon and convert to TU */ - nexttbtt = TSF_TO_TU(LE_READ_4(ni->ni_tstamp.data + 4), - LE_READ_4(ni->ni_tstamp.data)); + nexttbtt = TSF_TO_TU(le32dec(ni->ni_tstamp.data + 4), + le32dec(ni->ni_tstamp.data)); - tsf_beacon = ((uint64_t) LE_READ_4(ni->ni_tstamp.data + 4)) << 32; - tsf_beacon |= LE_READ_4(ni->ni_tstamp.data); + tsf_beacon = ((uint64_t) le32dec(ni->ni_tstamp.data + 4)) << 32; + tsf_beacon |= le32dec(ni->ni_tstamp.data); if (ic->ic_opmode == IEEE80211_M_HOSTAP || ic->ic_opmode == IEEE80211_M_MBSS) { diff --git a/sys/dev/ath/if_ath_misc.h b/sys/dev/ath/if_ath_misc.h index 47d23bcf063c..fbc4d67d72f6 100644 --- a/sys/dev/ath/if_ath_misc.h +++ b/sys/dev/ath/if_ath_misc.h @@ -39,15 +39,6 @@ * and into something else. */ -/* unaligned little endian access */ -#define LE_READ_2(p) \ - ((u_int16_t) \ - ((((u_int8_t *)(p))[0] ) | (((u_int8_t *)(p))[1] << 8))) -#define LE_READ_4(p) \ - ((u_int32_t) \ - ((((u_int8_t *)(p))[0] ) | (((u_int8_t *)(p))[1] << 8) | \ - (((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24))) - extern int ath_rxbuf; extern int ath_txbuf; extern int ath_txbuf_mgmt; diff --git a/sys/dev/ath/if_ath_rx.c b/sys/dev/ath/if_ath_rx.c index ff056adf7148..527083066af0 100644 --- a/sys/dev/ath/if_ath_rx.c +++ b/sys/dev/ath/if_ath_rx.c @@ -344,8 +344,8 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m, uint64_t tsf_beacon_target; int tsf_intval; - tsf_beacon_old = ((uint64_t) LE_READ_4(ni->ni_tstamp.data + 4)) << 32; - tsf_beacon_old |= LE_READ_4(ni->ni_tstamp.data); + tsf_beacon_old = ((uint64_t) le32dec(ni->ni_tstamp.data + 4)) << 32; + tsf_beacon_old |= le32dec(ni->ni_tstamp.data); #define TU_TO_TSF(_tu) (((u_int64_t)(_tu)) << 10) tsf_intval = 1; @@ -378,8 +378,8 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m, ATH_RSSI_LPF(sc->sc_halstats.ns_avgbrssi, rssi); - tsf_beacon = ((uint64_t) LE_READ_4(ni->ni_tstamp.data + 4)) << 32; - tsf_beacon |= LE_READ_4(ni->ni_tstamp.data); + tsf_beacon = ((uint64_t) le32dec(ni->ni_tstamp.data + 4)) << 32; + tsf_beacon |= le32dec(ni->ni_tstamp.data); nexttbtt = ath_hal_getnexttbtt(sc->sc_ah); diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c index 03bfa73d1f52..517ff2abd29b 100644 --- a/sys/dev/otus/if_otus.c +++ b/sys/dev/otus/if_otus.c @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_regdomain.h> #include <net80211/ieee80211_radiotap.h> #include <net80211/ieee80211_ratectl.h> -#include <net80211/ieee80211_input.h> #ifdef IEEE80211_SUPPORT_SUPERG #include <net80211/ieee80211_superg.h> #endif @@ -2307,7 +2306,7 @@ otus_set_multi(struct otus_softc *sc) uint32_t val; dl = LLADDR((struct sockaddr_dl *) ifma->ifma_addr); - val = LE_READ_4(dl + 4); + val = le32dec(dl + 4); /* Get address byte 5 */ val = val & 0x0000ff00; val = val >> 8; diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c index 8e8f1a363b0e..0f7422ffd15e 100644 --- a/sys/dev/rtwn/if_rtwn.c +++ b/sys/dev/rtwn/if_rtwn.c @@ -1265,8 +1265,8 @@ rtwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) rtwn_write_4(sc, R92C_CR, reg); /* Set BSSID. */ - rtwn_write_4(sc, R92C_BSSID + 0, LE_READ_4(&ni->ni_bssid[0])); - rtwn_write_4(sc, R92C_BSSID + 4, LE_READ_2(&ni->ni_bssid[4])); + rtwn_write_4(sc, R92C_BSSID + 0, le32dec(&ni->ni_bssid[0])); + rtwn_write_4(sc, R92C_BSSID + 4, le16dec(&ni->ni_bssid[4])); if (ic->ic_curmode == IEEE80211_MODE_11B) rtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 0); diff --git a/sys/dev/rtwn/if_rtwnreg.h b/sys/dev/rtwn/if_rtwnreg.h index 09a31fad84b0..bfd11c89fae6 100644 --- a/sys/dev/rtwn/if_rtwnreg.h +++ b/sys/dev/rtwn/if_rtwnreg.h @@ -895,10 +895,6 @@ #define R92C_RAID_11B 6 -/* Macros to access unaligned little-endian memory. */ -#define LE_READ_2(x) ((x)[0] | (x)[1] << 8) -#define LE_READ_4(x) ((x)[0] | (x)[1] << 8 | (x)[2] << 16 | (x)[3] << 24) - /* * Macros to access subfields in registers. */ diff --git a/sys/dev/urtwn/if_urtwn.c b/sys/dev/urtwn/if_urtwn.c index 6127af18d5e0..e416b5deed0f 100644 --- a/sys/dev/urtwn/if_urtwn.c +++ b/sys/dev/urtwn/if_urtwn.c @@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip.h> #include <net80211/ieee80211_var.h> -#include <net80211/ieee80211_input.h> #include <net80211/ieee80211_regdomain.h> #include <net80211/ieee80211_radiotap.h> #include <net80211/ieee80211_ratectl.h> @@ -2266,20 +2265,20 @@ urtwn_key_set_cb(struct urtwn_softc *sc, union sec_param *data) /* Write key. */ for (i = 0; i < 4; i++) { error = urtwn_cam_write(sc, R92C_CAM_KEY(k->wk_keyix, i), - LE_READ_4(&k->wk_key[i * 4])); + le32dec(&k->wk_key[i * 4])); if (error != 0) goto fail; } /* Write CTL0 last since that will validate the CAM entry. */ error = urtwn_cam_write(sc, R92C_CAM_CTL1(k->wk_keyix), - LE_READ_4(&k->wk_macaddr[2])); + le32dec(&k->wk_macaddr[2])); if (error != 0) goto fail; error = urtwn_cam_write(sc, R92C_CAM_CTL0(k->wk_keyix), SM(R92C_CAM_ALGO, algo) | SM(R92C_CAM_KEYID, keyid) | - SM(R92C_CAM_MACLO, LE_READ_2(&k->wk_macaddr[0])) | + SM(R92C_CAM_MACLO, le16dec(&k->wk_macaddr[0])) | R92C_CAM_VALID); if (error != 0) goto fail; @@ -2579,8 +2578,8 @@ urtwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) urtwn_set_mode(sc, mode); /* Set BSSID. */ - urtwn_write_4(sc, R92C_BSSID + 0, LE_READ_4(&ni->ni_bssid[0])); - urtwn_write_4(sc, R92C_BSSID + 4, LE_READ_2(&ni->ni_bssid[4])); + urtwn_write_4(sc, R92C_BSSID + 0, le32dec(&ni->ni_bssid[0])); + urtwn_write_4(sc, R92C_BSSID + 4, le16dec(&ni->ni_bssid[4])); if (ic->ic_curmode == IEEE80211_MODE_11B) urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 0); |
