From f3b68c997fd58b0b9f45207edb1aa0763437b20d Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 23 Jul 2008 18:55:18 +0200 Subject: [PATCH] ath9: endianess fixes To: johannes@sipsolutions.net, linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org - in ath_beacon_alloc use a __le64 variable to store a byte swapped result. Keep printing the unshifted native variable. - in ath_bar_rx add a missing le16_to_cpu for bar->control - in ath_rx_tasklet add a missing cpu_to_be16 for skb->protocol Signed-off-by: Christoph Hellwig --- ksrc/beacon.c | 5 +++-- ksrc/recv.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ksrc/beacon.c b/ksrc/beacon.c index 1c5ebe5..bfb1967 100644 --- a/ksrc/beacon.c +++ b/ksrc/beacon.c @@ -438,6 +438,7 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id) */ if (sc->sc_stagbeacons && avp->av_bslot > 0) { u_int64_t tsfadjust; + __le64 val; int intval; /* FIXME: Use default value for now: Sujith */ @@ -456,7 +457,7 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id) * others get a timestamp aligned to the next interval. */ tsfadjust = (intval * (ATH_BCBUF - avp->av_bslot)) / ATH_BCBUF; - tsfadjust = cpu_to_le64(tsfadjust<<10); /* TU->TSF */ + val = cpu_to_le64(tsfadjust << 10); /* TU->TSF */ DPRINTF(sc, ATH_DEBUG_BEACON, "%s: %s beacons, bslot %d intval %u tsfadjust %llu\n", @@ -464,7 +465,7 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id) avp->av_bslot, intval, (unsigned long long)tsfadjust); wh = (struct ieee80211_hdr *)skb->data; - memcpy(&wh[1], &tsfadjust, sizeof(tsfadjust)); + memcpy(&wh[1], &val, sizeof(val)); } bf->bf_buf_addr = ath_skb_map_single(sc, skb, PCI_DMA_TODEVICE, diff --git a/ksrc/recv.c b/ksrc/recv.c index f16b356..7ca0ef9 100644 --- a/ksrc/recv.c +++ b/ksrc/recv.c @@ -80,7 +80,7 @@ static int ath_bar_rx(struct ath_softc *sc, /* look at BAR contents */ bar = (struct ieee80211_bar *)skb->data; - tidno = (bar->control & IEEE80211_BAR_CTL_TID_M) + tidno = (le16_to_cpu(bar->control) & IEEE80211_BAR_CTL_TID_M) >> IEEE80211_BAR_CTL_TID_S; seqno = le16_to_cpu(bar->start_seq_num) >> IEEE80211_SEQ_SEQ_SHIFT; @@ -1026,7 +1026,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) * to receive another frame. */ skb_put(skb, ds->ds_rxstat.rs_datalen); - skb->protocol = ETH_P_CONTROL; + skb->protocol = cpu_to_be16(ETH_P_CONTROL); rx_status.tsf = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp); rx_status.rateieee = sc->sc_hwmap[ds->ds_rxstat.rs_rate].ieeerate; -- 1.5.4.3