}
/* Only the lower 17-bits are valid */
- scratch = ltoh32(scratch);
+ scratch = le32_to_cpu(scratch);
scratch &= 0x0001FFFF;
return scratch;
}
static int dhdcdc_msg(dhd_pub_t *dhd)
{
dhd_prot_t *prot = dhd->prot;
- int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
+ int len = le32_to_cpu(prot->msg.len) + sizeof(cdc_ioctl_t);
DHD_TRACE(("%s: Enter\n", __func__));
len + sizeof(cdc_ioctl_t));
if (ret < 0)
break;
- } while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id);
+ } while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id);
return ret;
}
memset(msg, 0, sizeof(cdc_ioctl_t));
- msg->cmd = htol32(cmd);
- msg->len = htol32(len);
+ msg->cmd = cpu_to_le32(cmd);
+ msg->len = cpu_to_le32(len);
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
CDC_SET_IF_IDX(msg, ifidx);
- msg->flags = htol32(msg->flags);
+ msg->flags = cpu_to_le32(msg->flags);
if (buf)
memcpy(prot->buf, buf, len);
if (ret < 0)
goto done;
- flags = ltoh32(msg->flags);
+ flags = le32_to_cpu(msg->flags);
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
if ((id < prot->reqid) && (++retries < RETRIES))
/* Check the ERROR flag */
if (flags & CDCF_IOC_ERROR) {
- ret = ltoh32(msg->status);
+ ret = le32_to_cpu(msg->status);
/* Cache error from dongle */
dhd->dongle_error = ret;
}
memset(msg, 0, sizeof(cdc_ioctl_t));
- msg->cmd = htol32(cmd);
- msg->len = htol32(len);
+ msg->cmd = cpu_to_le32(cmd);
+ msg->len = cpu_to_le32(len);
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET;
CDC_SET_IF_IDX(msg, ifidx);
- msg->flags = htol32(msg->flags);
+ msg->flags = cpu_to_le32(msg->flags);
if (buf)
memcpy(prot->buf, buf, len);
if (ret < 0)
goto done;
- flags = ltoh32(msg->flags);
+ flags = le32_to_cpu(msg->flags);
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
if (id != prot->reqid) {
/* Check the ERROR flag */
if (flags & CDCF_IOC_ERROR) {
- ret = ltoh32(msg->status);
+ ret = le32_to_cpu(msg->status);
/* Cache error from dongle */
dhd->dongle_error = ret;
}
ret = 0;
else {
cdc_ioctl_t *msg = &prot->msg;
- ioc->needed = ltoh32(msg->len); /* len == needed when set/query
- fails from dongle */
+ /* len == needed when set/query fails from dongle */
+ ioc->needed = le32_to_cpu(msg->len);
}
/* Intercept the wme_dp ioctl here */
slen = strlen("wme_dp") + 1;
if (len >= (int)(slen + sizeof(int)))
memcpy(&val, (char *)buf + slen, sizeof(int));
- dhd->wme_dp = (u8) ltoh32(val);
+ dhd->wme_dp = (u8) le32_to_cpu(val);
}
prot->pending = false;
WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
};
uint event_type, flags, auth_type, datalen;
- event_type = ntoh32(event->event_type);
- flags = ntoh16(event->flags);
- status = ntoh32(event->status);
- reason = ntoh32(event->reason);
- auth_type = ntoh32(event->auth_type);
- datalen = ntoh32(event->datalen);
+ event_type = be32_to_cpu(event->event_type);
+ flags = be16_to_cpu(event->flags);
+ status = be32_to_cpu(event->status);
+ reason = be32_to_cpu(event->reason);
+ auth_type = be32_to_cpu(event->auth_type);
+ datalen = be32_to_cpu(event->datalen);
/* debug dump of event messages */
sprintf(eabuf, "%pM", event->addr);
}
/* There are 2 bytes available at the end of data */
- buf[MSGTRACE_HDRLEN + ntoh16(hdr.len)] = '\0';
+ buf[MSGTRACE_HDRLEN + be16_to_cpu(hdr.len)] = '\0';
- if (ntoh32(hdr.discarded_bytes)
- || ntoh32(hdr.discarded_printf)) {
+ if (be32_to_cpu(hdr.discarded_bytes)
+ || be32_to_cpu(hdr.discarded_printf)) {
DHD_ERROR(
("\nWLC_E_TRACE: [Discarded traces in dongle -->"
"discarded_bytes %d discarded_printf %d]\n",
- ntoh32(hdr.discarded_bytes),
- ntoh32(hdr.discarded_printf)));
+ be32_to_cpu(hdr.discarded_bytes),
+ be32_to_cpu(hdr.discarded_printf)));
}
- nblost = ntoh32(hdr.seqnum) - seqnum_prev - 1;
+ nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
if (nblost > 0) {
DHD_ERROR(
("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
- ntoh32(hdr.seqnum), nblost));
+ be32_to_cpu(hdr.seqnum), nblost));
}
- seqnum_prev = ntoh32(hdr.seqnum);
+ seqnum_prev = be32_to_cpu(hdr.seqnum);
/* Display the trace buffer. Advance from \n to \n to
* avoid display big
case WLC_E_RSSI:
DHD_EVENT(("MACEVENT: %s %d\n", event_name,
- ntoh32(*((int *)event_data))));
+ be32_to_cpu(*((int *)event_data))));
break;
default:
temp = ntoh32_ua((void *)&event->event_type);
DHD_TRACE(("Converted to WLC_E_LINK type %d\n", temp));
- temp = ntoh32(WLC_E_NDIS_LINK);
+ temp = be32_to_cpu(WLC_E_NDIS_LINK);
memcpy((void *)(&pvt_data->event.event_type), &temp,
sizeof(pvt_data->event.event_type));
}
strcpy(bufp, "mcast_list");
bufp += strlen("mcast_list") + 1;
- cnt = htol32(cnt);
+ cnt = cpu_to_le32(cnt);
memcpy(bufp, &cnt, sizeof(cnt));
bufp += sizeof(cnt);
dhd_ifname(&dhd->pub, ifidx)));
return;
}
- allmulti = htol32(allmulti);
+ allmulti = cpu_to_le32(allmulti);
if (!bcm_mkiovar
("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
DHD_ERROR(("%s: set allmulti %d failed\n",
- dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti)));
+ dhd_ifname(&dhd->pub, ifidx),
+ le32_to_cpu(allmulti)));
}
kfree(buf);
driver does */
allmulti = (dev->flags & IFF_PROMISC) ? true : false;
- allmulti = htol32(allmulti);
+ allmulti = cpu_to_le32(allmulti);
memset(&ioc, 0, sizeof(ioc));
ioc.cmd = WLC_SET_PROMISC;
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
DHD_ERROR(("%s: set promisc %d failed\n",
- dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti)));
+ dhd_ifname(&dhd->pub, ifidx),
+ le32_to_cpu(allmulti)));
}
}
if (is_multicast_ether_addr(eh->h_dest))
dhdp->tx_multicast++;
- if (ntoh16(eh->h_proto) == ETH_P_PAE)
+ if (ntohs(eh->h_proto) == ETH_P_PAE)
atomic_inc(&dhd->pend_8021x_cnt);
}
skb_pull(skb, ETH_HLEN);
/* Process special event packets and then discard them */
- if (ntoh16(skb->protocol) == ETH_P_BRCM)
+ if (ntohs(skb->protocol) == ETH_P_BRCM)
dhd_wl_host_event(dhd, &ifidx,
skb_mac_header(skb),
&event, &data);
dhd_prot_hdrpull(dhdp, &ifidx, txp);
eh = (struct ethhdr *)(txp->data);
- type = ntoh16(eh->h_proto);
+ type = ntohs(eh->h_proto);
if (type == ETH_P_PAE)
atomic_dec(&dhd->pend_8021x_cnt);
/* send up locally generated event */
void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data)
{
- switch (ntoh32(event->event_type)) {
+ switch (be32_to_cpu(event->event_type)) {
default:
break;
}
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
len = (u16) (pkt->len);
- *(u16 *) frame = htol16(len);
- *(((u16 *) frame) + 1) = htol16(~len);
+ *(u16 *) frame = cpu_to_le16(len);
+ *(((u16 *) frame) + 1) = cpu_to_le16(~len);
/* Software tag: channel, sequence number, data offset */
swheader =
dhdsdio_clkctl(bus, CLK_AVAIL, false);
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
- *(u16 *) frame = htol16((u16) msglen);
- *(((u16 *) frame) + 1) = htol16(~msglen);
+ *(u16 *) frame = cpu_to_le16((u16) msglen);
+ *(((u16 *) frame) + 1) = cpu_to_le16(~msglen);
/* Software tag: channel, sequence number, data offset */
swheader =
if (rv < 0)
return rv;
- addr = ltoh32(addr);
+ addr = le32_to_cpu(addr);
DHD_INFO(("sdpcm_shared address 0x%08X\n", addr));
return rv;
/* Endianness */
- sh->flags = ltoh32(sh->flags);
- sh->trap_addr = ltoh32(sh->trap_addr);
- sh->assert_exp_addr = ltoh32(sh->assert_exp_addr);
- sh->assert_file_addr = ltoh32(sh->assert_file_addr);
- sh->assert_line = ltoh32(sh->assert_line);
- sh->console_addr = ltoh32(sh->console_addr);
- sh->msgtrace_addr = ltoh32(sh->msgtrace_addr);
+ sh->flags = le32_to_cpu(sh->flags);
+ sh->trap_addr = le32_to_cpu(sh->trap_addr);
+ sh->assert_exp_addr = le32_to_cpu(sh->assert_exp_addr);
+ sh->assert_file_addr = le32_to_cpu(sh->assert_file_addr);
+ sh->assert_line = le32_to_cpu(sh->assert_line);
+ sh->console_addr = le32_to_cpu(sh->console_addr);
+ sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr);
if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
DHD_ERROR(("%s: sdpcm_shared version %d in dhd "
/* Allocate console buffer (one time only) */
if (c->buf == NULL) {
- c->bufsize = ltoh32(c->log.buf_size);
+ c->bufsize = le32_to_cpu(c->log.buf_size);
c->buf = kmalloc(c->bufsize, GFP_ATOMIC);
if (c->buf == NULL)
return BCME_NOMEM;
}
- idx = ltoh32(c->log.idx);
+ idx = le32_to_cpu(c->log.idx);
/* Protect against corrupt value */
if (idx > c->bufsize)
return BCME_OK;
/* Read the console buffer */
- addr = ltoh32(c->log.buf);
+ addr = le32_to_cpu(c->log.buf);
rv = dhdsdio_membytes(bus, false, addr, c->buf, c->bufsize);
if (rv < 0)
return rv;
} else {
varsizew = varsize / 4;
varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF);
- varsizew = htol32(varsizew);
+ varsizew = cpu_to_le32(varsizew);
}
DHD_INFO(("New varsize is %d, length token=0x%08x\n", varsize,
/* Zero cbuf_index */
addr = bus->console_addr + offsetof(hndrte_cons_t, cbuf_idx);
- val = htol32(0);
+ val = cpu_to_le32(0);
rv = dhdsdio_membytes(bus, true, addr, (u8 *)&val, sizeof(val));
if (rv < 0)
goto done;
/* Write length into vcons_in */
addr = bus->console_addr + offsetof(hndrte_cons_t, vcons_in);
- val = htol32(msglen);
+ val = cpu_to_le32(msglen);
rv = dhdsdio_membytes(bus, true, addr, (u8 *)&val, sizeof(val));
if (rv < 0)
goto done;
static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e)
{
- u32 event = ntoh32(e->event_type);
- u16 flags = ntoh16(e->flags);
+ u32 event = be32_to_cpu(e->event_type);
+ u16 flags = be16_to_cpu(e->flags);
if (event == WLC_E_LINK) {
if (flags & WLC_EVENT_MSG_LINK) {
static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e)
{
- u32 event = ntoh32(e->event_type);
- u16 flags = ntoh16(e->flags);
+ u32 event = be32_to_cpu(e->event_type);
+ u16 flags = be16_to_cpu(e->flags);
if (event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND) {
return true;
static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e)
{
- u32 event = ntoh32(e->event_type);
- u32 status = ntoh32(e->status);
+ u32 event = be32_to_cpu(e->event_type);
+ u32 status = be32_to_cpu(e->status);
if (event == WLC_E_SET_SSID || event == WLC_E_LINK) {
if (status == WLC_E_STATUS_NO_NETWORKS)
wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
{
- u16 flags = ntoh16(e->flags);
+ u16 flags = be16_to_cpu(e->flags);
enum nl80211_key_type key_type;
rtnl_lock();
void
wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t * e, void *data)
{
- u32 event_type = ntoh32(e->event_type);
+ u32 event_type = be32_to_cpu(e->event_type);
struct wl_priv *wl = ndev_to_wl(ndev);
#if (WL_DBG_LEVEL > 0)
s8 *estr = (event_type <= sizeof(wl_dbg_estr) / WL_DBG_ESTR_MAX - 1) ?
static bool
wl_iw_check_conn_fail(wl_event_msg_t *e, char *stringBuf, uint buflen)
{
- u32 event = ntoh32(e->event_type);
- u32 status = ntoh32(e->status);
- u32 reason = ntoh32(e->reason);
+ u32 event = be32_to_cpu(e->event_type);
+ u32 status = be32_to_cpu(e->status);
+ u32 reason = be32_to_cpu(e->reason);
if (wl_iw_conn_status_str(event, status, reason, stringBuf, buflen)) {
return true;
union iwreq_data wrqu;
char extra[IW_CUSTOM_MAX + 1];
int cmd = 0;
- u32 event_type = ntoh32(e->event_type);
- u16 flags = ntoh16(e->flags);
- u32 datalen = ntoh32(e->datalen);
- u32 status = ntoh32(e->status);
+ u32 event_type = be32_to_cpu(e->event_type);
+ u16 flags = be16_to_cpu(e->flags);
+ u32 datalen = be32_to_cpu(e->datalen);
+ u32 status = be32_to_cpu(e->status);
wl_iw_t *iw;
u32 toto;
memset(&wrqu, 0, sizeof(wrqu));
{
wlc_d11rxhdr_t *wlc_rxhdr = (wlc_d11rxhdr_t *) ctx;
d11rxhdr_t *rxh = &wlc_rxhdr->rxhdr;
- int rssi = ltoh16(rxh->PhyRxStatus_1) & PRXS1_JSSI_MASK;
+ int rssi = le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_JSSI_MASK;
uint radioid = pih->radioid;
phy_info_t *pi = (phy_info_t *) pih;
}
if ((pi->sh->corerev >= 11)
- && !(ltoh16(rxh->RxStatus2) & RXS_PHYRXST_VALID)) {
+ && !(le16_to_cpu(rxh->RxStatus2) & RXS_PHYRXST_VALID)) {
rssi = WLC_RSSI_INVALID;
goto end;
}
if (ISLCNPHY(pi)) {
- u8 gidx = (ltoh16(rxh->PhyRxStatus_2) & 0xFC00) >> 10;
+ u8 gidx = (le16_to_cpu(rxh->PhyRxStatus_2) & 0xFC00) >> 10;
phy_info_lcnphy_t *pi_lcn = pi->u.pi_lcnphy;
if (rssi > 127)
s16 phyRx0_l, phyRx2_l;
rxpwr = 0;
- rxpwr0 = ltoh16(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR0_MASK;
- rxpwr1 = (ltoh16(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR1_MASK) >> 8;
+ rxpwr0 = le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR0_MASK;
+ rxpwr1 = (le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR1_MASK) >> 8;
if (rxpwr0 > 127)
rxpwr0 -= 256;
if (rxpwr1 > 127)
rxpwr1 -= 256;
- phyRx0_l = ltoh16(rxh->PhyRxStatus_0) & 0x00ff;
- phyRx2_l = ltoh16(rxh->PhyRxStatus_2) & 0x00ff;
+ phyRx0_l = le16_to_cpu(rxh->PhyRxStatus_0) & 0x00ff;
+ phyRx2_l = le16_to_cpu(rxh->PhyRxStatus_2) & 0x00ff;
if (phyRx2_l > 127)
phyRx2_l -= 256;
txh = (d11txh_t *) p->data;
plcp = (u8 *) (txh + 1);
h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN);
- seq = ltoh16(h->seq_ctrl) >> SEQNUM_SHIFT;
+ seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT;
index = TX_SEQ_TO_INDEX(seq);
/* check mcl fields and test whether it can be agg'd */
- mcl = ltoh16(txh->MacTxControlLow);
+ mcl = le16_to_cpu(txh->MacTxControlLow);
mcl &= ~TXC_AMPDU_MASK;
- fbr_iscck = !(ltoh16(txh->XtraFrameTypes) & 0x3);
+ fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x3);
ASSERT(!fbr_iscck);
txh->PreloadSize = 0; /* always default to 0 */
/* refill the bits since might be a retx mpdu */
mcl |= TXC_STARTMSDU;
rts = (struct ieee80211_rts *)&txh->rts_frame;
- fc = ltoh16(rts->frame_control);
+ fc = le16_to_cpu(rts->frame_control);
if ((fc & FC_KIND_MASK) == FC_RTS) {
mcl |= TXC_SENDRTS;
use_rts = true;
WL_AMPDU_TX("wl%d: wlc_sendampdu: ampdu_len %d seg_cnt %d null delim %d\n",
wlc->pub->unit, ampdu_len, seg_cnt, ndelim);
- txh->MacTxControlLow = htol16(mcl);
+ txh->MacTxControlLow = cpu_to_le16(mcl);
/* this packet is added */
pkt[count++] = p;
/* patch up the last txh */
txh = (d11txh_t *) pkt[count - 1]->data;
- mcl = ltoh16(txh->MacTxControlLow);
+ mcl = le16_to_cpu(txh->MacTxControlLow);
mcl &= ~TXC_AMPDU_MASK;
mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT);
- txh->MacTxControlLow = htol16(mcl);
+ txh->MacTxControlLow = cpu_to_le16(mcl);
/* remove the null delimiter after last mpdu */
ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM];
ampdu_len -= ndelim * AMPDU_DELIMITER_LEN;
/* remove the pad len from last mpdu */
- fbr_iscck = ((ltoh16(txh->XtraFrameTypes) & 0x3) == 0);
+ fbr_iscck = ((le16_to_cpu(txh->XtraFrameTypes) & 0x3) == 0);
len = fbr_iscck ? WLC_GET_CCK_PLCP_LEN(txh->FragPLCPFallback)
: WLC_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback);
ampdu_len -= roundup(len, 4) - len;
if (txh->MModeLen) {
u16 mmodelen =
wlc_calc_lsig_len(wlc, rspec, ampdu_len);
- txh->MModeLen = htol16(mmodelen);
+ txh->MModeLen = cpu_to_le16(mmodelen);
preamble_type = WLC_MM_PREAMBLE;
}
if (txh->MModeFbrLen) {
u16 mmfbrlen =
wlc_calc_lsig_len(wlc, rspec_fallback, ampdu_len);
- txh->MModeFbrLen = htol16(mmfbrlen);
+ txh->MModeFbrLen = cpu_to_le16(mmfbrlen);
fbr_preamble_type = WLC_MM_PREAMBLE;
}
/* set the preload length */
if (MCS_RATE(mcs, true, false) >= f->dmaxferrate) {
dma_len = min(dma_len, f->ampdu_pld_size);
- txh->PreloadSize = htol16(dma_len);
+ txh->PreloadSize = cpu_to_le16(dma_len);
} else
txh->PreloadSize = 0;
- mch = ltoh16(txh->MacTxControlHigh);
+ mch = le16_to_cpu(txh->MacTxControlHigh);
/* update RTS dur fields */
if (use_rts || use_cts) {
rspec, rts_preamble_type,
preamble_type, ampdu_len,
true);
- rts->duration = htol16(durid);
+ rts->duration = cpu_to_le16(durid);
durid = wlc_compute_rtscts_dur(wlc, use_cts,
rts_rspec_fallback,
rspec_fallback,
rts_fbr_preamble_type,
fbr_preamble_type,
ampdu_len, true);
- txh->RTSDurFallback = htol16(durid);
+ txh->RTSDurFallback = cpu_to_le16(durid);
/* set TxFesTimeNormal */
txh->TxFesTimeNormal = rts->duration;
/* set fallback rate version of TxFesTimeNormal */
WLCNTADD(ampdu->cnt->txfbr_mpdu, count);
WLCNTINCR(ampdu->cnt->txfbr_ampdu);
mch |= TXC_AMPDU_FBR;
- txh->MacTxControlHigh = htol16(mch);
+ txh->MacTxControlHigh = cpu_to_le16(mch);
WLC_SET_MIMO_PLCP_AMPDU(plcp);
WLC_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback);
}
wlc->pub->unit, count, ampdu_len);
/* inform rate_sel if it this is a rate probe pkt */
- frameid = ltoh16(txh->TxFrameID);
+ frameid = le16_to_cpu(txh->TxFrameID);
if (frameid & TXFID_RATE_PROBE_MASK) {
WL_ERROR("%s: XXX what to do with TXFID_RATE_PROBE_MASK!?\n",
__func__);
tx_info = IEEE80211_SKB_CB(p);
ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
txh = (d11txh_t *) p->data;
- mcl = ltoh16(txh->MacTxControlLow);
+ mcl = le16_to_cpu(txh->MacTxControlLow);
plcp = (u8 *) (txh + 1);
h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN);
- seq = ltoh16(h->seq_ctrl) >> SEQNUM_SHIFT;
+ seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT;
if (tot_mpdu == 0) {
mcs = plcp[0] & MIMO_PLCP_MCS_MASK;
- mimoantsel = ltoh16(txh->ABI_MimoAntSel);
+ mimoantsel = le16_to_cpu(txh->ABI_MimoAntSel);
}
index = TX_SEQ_TO_INDEX(seq);
/* record the tsf_l in wlc_rxd11hdr */
wlc_rxhdr = (wlc_d11rxhdr_t *) p->data;
- wlc_rxhdr->tsf_l = htol32(tsf_l);
+ wlc_rxhdr->tsf_l = cpu_to_le32(tsf_l);
/* compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */
wlc_phy_rssi_compute(wlc_hw->band->pi, wlc_rxhdr);
memcpy(&word, buf, sizeof(u32));
if (be_bit)
- word = hton32(word);
+ word = cpu_to_be32(word);
else
- word = htol32(word);
+ word = cpu_to_le32(word);
W_REG(osh, ®s->tplatewrdata, word);
0,
{
{EDCF_AC_BE_ACI_STA, EDCF_AC_BE_ECW_STA,
- HTOL16(EDCF_AC_BE_TXOP_STA)},
+ cpu_to_le16(EDCF_AC_BE_TXOP_STA)},
{EDCF_AC_BK_ACI_STA, EDCF_AC_BK_ECW_STA,
- HTOL16(EDCF_AC_BK_TXOP_STA)},
+ cpu_to_le16(EDCF_AC_BK_TXOP_STA)},
{EDCF_AC_VI_ACI_STA, EDCF_AC_VI_ECW_STA,
- HTOL16(EDCF_AC_VI_TXOP_STA)},
+ cpu_to_le16(EDCF_AC_VI_TXOP_STA)},
{EDCF_AC_VO_ACI_STA, EDCF_AC_VO_ECW_STA,
- HTOL16(EDCF_AC_VO_TXOP_STA)}
+ cpu_to_le16(EDCF_AC_VO_TXOP_STA)}
}
};
/* wlc->wme_admctl |= 1 << aci; *//* should be set ?? seems like off by default */
/* fill in shm ac params struct */
- acp_shm.txop = ltoh16(params->txop);
+ acp_shm.txop = le16_to_cpu(params->txop);
/* convert from units of 32us to us for ucode */
wlc->edcf_txop[aci & 0x3] = acp_shm.txop =
EDCF_TXOP2USEC(acp_shm.txop);
}
/* fill in shm ac params struct */
- acp_shm.txop = ltoh16(edcf_acp->TXOP);
+ acp_shm.txop = le16_to_cpu(edcf_acp->TXOP);
/* convert from units of 32us to us for ucode */
wlc->edcf_txop[aci] = acp_shm.txop =
EDCF_TXOP2USEC(acp_shm.txop);
u16 v;
u16 delta;
- v = ltoh16(cur_stat);
+ v = le16_to_cpu(cur_stat);
delta = (u16)(v - *macstat_snapshot);
if (delta != 0) {
#if defined(BCMDBG)
void wlc_print_txdesc(d11txh_t *txh)
{
- u16 mtcl = ltoh16(txh->MacTxControlLow);
- u16 mtch = ltoh16(txh->MacTxControlHigh);
- u16 mfc = ltoh16(txh->MacFrameControl);
- u16 tfest = ltoh16(txh->TxFesTimeNormal);
- u16 ptcw = ltoh16(txh->PhyTxControlWord);
- u16 ptcw_1 = ltoh16(txh->PhyTxControlWord_1);
- u16 ptcw_1_Fbr = ltoh16(txh->PhyTxControlWord_1_Fbr);
- u16 ptcw_1_Rts = ltoh16(txh->PhyTxControlWord_1_Rts);
- u16 ptcw_1_FbrRts = ltoh16(txh->PhyTxControlWord_1_FbrRts);
- u16 mainrates = ltoh16(txh->MainRates);
- u16 xtraft = ltoh16(txh->XtraFrameTypes);
+ u16 mtcl = le16_to_cpu(txh->MacTxControlLow);
+ u16 mtch = le16_to_cpu(txh->MacTxControlHigh);
+ u16 mfc = le16_to_cpu(txh->MacFrameControl);
+ u16 tfest = le16_to_cpu(txh->TxFesTimeNormal);
+ u16 ptcw = le16_to_cpu(txh->PhyTxControlWord);
+ u16 ptcw_1 = le16_to_cpu(txh->PhyTxControlWord_1);
+ u16 ptcw_1_Fbr = le16_to_cpu(txh->PhyTxControlWord_1_Fbr);
+ u16 ptcw_1_Rts = le16_to_cpu(txh->PhyTxControlWord_1_Rts);
+ u16 ptcw_1_FbrRts = le16_to_cpu(txh->PhyTxControlWord_1_FbrRts);
+ u16 mainrates = le16_to_cpu(txh->MainRates);
+ u16 xtraft = le16_to_cpu(txh->XtraFrameTypes);
u8 *iv = txh->IV;
u8 *ra = txh->TxFrameRA;
- u16 tfestfb = ltoh16(txh->TxFesTimeFallback);
+ u16 tfestfb = le16_to_cpu(txh->TxFesTimeFallback);
u8 *rtspfb = txh->RTSPLCPFallback;
- u16 rtsdfb = ltoh16(txh->RTSDurFallback);
+ u16 rtsdfb = le16_to_cpu(txh->RTSDurFallback);
u8 *fragpfb = txh->FragPLCPFallback;
- u16 fragdfb = ltoh16(txh->FragDurFallback);
- u16 mmodelen = ltoh16(txh->MModeLen);
- u16 mmodefbrlen = ltoh16(txh->MModeFbrLen);
- u16 tfid = ltoh16(txh->TxFrameID);
- u16 txs = ltoh16(txh->TxStatus);
- u16 mnmpdu = ltoh16(txh->MaxNMpdus);
- u16 mabyte = ltoh16(txh->MaxABytes_MRT);
- u16 mabyte_f = ltoh16(txh->MaxABytes_FBR);
- u16 mmbyte = ltoh16(txh->MinMBytes);
+ u16 fragdfb = le16_to_cpu(txh->FragDurFallback);
+ u16 mmodelen = le16_to_cpu(txh->MModeLen);
+ u16 mmodefbrlen = le16_to_cpu(txh->MModeFbrLen);
+ u16 tfid = le16_to_cpu(txh->TxFrameID);
+ u16 txs = le16_to_cpu(txh->TxStatus);
+ u16 mnmpdu = le16_to_cpu(txh->MaxNMpdus);
+ u16 mabyte = le16_to_cpu(txh->MaxABytes_MRT);
+ u16 mabyte_f = le16_to_cpu(txh->MaxABytes_FBR);
+ u16 mmbyte = le16_to_cpu(txh->MinMBytes);
u8 *rtsph = txh->RTSPhyHeader;
struct ieee80211_rts rts = txh->rts_frame;
ASSERT(sdu);
- fc = ltoh16(d11_header->frame_control);
+ fc = le16_to_cpu(d11_header->frame_control);
type = (fc & IEEE80211_FCTL_FTYPE);
/* 802.11 standard requires management traffic to go at highest priority */
{
u16 frameid;
- frameid = ltoh16(txh->TxFrameID) & ~(TXFID_SEQ_MASK | TXFID_QUEUE_MASK);
+ frameid = le16_to_cpu(txh->TxFrameID) & ~(TXFID_SEQ_MASK |
+ TXFID_QUEUE_MASK);
frameid |=
(((wlc->
mc_fid_counter++) << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
* ucode or BSS info as appropriate.
*/
if (fifo == TX_BCMC_FIFO) {
- frameid = ltoh16(txh->TxFrameID);
+ frameid = le16_to_cpu(txh->TxFrameID);
}
/* locate 802.11 MAC header */
h = (struct ieee80211_hdr *)(p->data);
- fc = ltoh16(h->frame_control);
+ fc = le16_to_cpu(h->frame_control);
type = (fc & IEEE80211_FCTL_FTYPE);
qos = (type == IEEE80211_FTYPE_DATA &&
}
/* extract fragment number from frame first */
- seq = ltoh16(seq) & FRAGNUM_MASK;
+ seq = le16_to_cpu(seq) & FRAGNUM_MASK;
seq |= (SCB_SEQNUM(scb, p->priority) << SEQNUM_SHIFT);
- h->seq_ctrl = htol16(seq);
+ h->seq_ctrl = cpu_to_le16(seq);
frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
(queue & TXFID_QUEUE_MASK);
durid =
wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0],
next_frag_len);
- h->duration_id = htol16(durid);
+ h->duration_id = cpu_to_le16(durid);
} else if (use_rifs) {
/* NAV protect to end of next max packet size */
durid =
preamble_type[0],
DOT11_MAX_FRAG_LEN);
durid += RIFS_11N_TIME;
- h->duration_id = htol16(durid);
+ h->duration_id = cpu_to_le16(durid);
}
/* DUR field for fallback rate */
else {
durid = wlc_compute_frame_dur(wlc, rspec[1],
preamble_type[1], next_frag_len);
- txh->FragDurFallback = htol16(durid);
+ txh->FragDurFallback = cpu_to_le16(durid);
}
/* (4) MAC-HDR: MacTxControlLow */
if (hwtkmic)
mcl |= TXC_AMIC;
- txh->MacTxControlLow = htol16(mcl);
+ txh->MacTxControlLow = cpu_to_le16(mcl);
/* MacTxControlHigh */
mch = 0;
/* MacFrameControl */
memcpy(&txh->MacFrameControl, &h->frame_control, sizeof(u16));
- txh->TxFesTimeNormal = htol16(0);
+ txh->TxFesTimeNormal = cpu_to_le16(0);
- txh->TxFesTimeFallback = htol16(0);
+ txh->TxFesTimeFallback = cpu_to_le16(0);
/* TxFrameRA */
memcpy(&txh->TxFrameRA, &h->addr1, ETH_ALEN);
/* TxFrameID */
- txh->TxFrameID = htol16(frameid);
+ txh->TxFrameID = cpu_to_le16(frameid);
/* TxStatus, Note the case of recreating the first frag of a suppressed frame
* then we may need to reset the retry cnt's via the status reg
*/
- txh->TxStatus = htol16(status);
+ txh->TxStatus = cpu_to_le16(status);
/* extra fields for ucode AMPDU aggregation, the new fields are added to
* the END of previous structure so that it's compatible in driver.
*/
- txh->MaxNMpdus = htol16(0);
- txh->MaxABytes_MRT = htol16(0);
- txh->MaxABytes_FBR = htol16(0);
- txh->MinMBytes = htol16(0);
+ txh->MaxNMpdus = cpu_to_le16(0);
+ txh->MaxABytes_MRT = cpu_to_le16(0);
+ txh->MaxABytes_FBR = cpu_to_le16(0);
+ txh->MinMBytes = cpu_to_le16(0);
/* (5) RTS/CTS: determine RTS/CTS PLCP header and MAC duration, furnish d11txh_t */
/* RTS PLCP header and RTS frame */
/* RTS/CTS additions to MacTxControlLow */
if (use_cts) {
- txh->MacTxControlLow |= htol16(TXC_SENDCTS);
+ txh->MacTxControlLow |= cpu_to_le16(TXC_SENDCTS);
} else {
- txh->MacTxControlLow |= htol16(TXC_SENDRTS);
- txh->MacTxControlLow |= htol16(TXC_LONGFRAME);
+ txh->MacTxControlLow |= cpu_to_le16(TXC_SENDRTS);
+ txh->MacTxControlLow |= cpu_to_le16(TXC_LONGFRAME);
}
/* RTS PLCP header */
durid = wlc_compute_rtscts_dur(wlc, use_cts, rts_rspec[0],
rspec[0], rts_preamble_type[0],
preamble_type[0], phylen, false);
- rts->duration = htol16(durid);
+ rts->duration = cpu_to_le16(durid);
/* fallback rate version of RTS DUR field */
durid = wlc_compute_rtscts_dur(wlc, use_cts,
rts_rspec[1], rspec[1],
rts_preamble_type[1],
preamble_type[1], phylen, false);
- txh->RTSDurFallback = htol16(durid);
+ txh->RTSDurFallback = cpu_to_le16(durid);
if (use_cts) {
- rts->frame_control = htol16(FC_CTS);
+ rts->frame_control = cpu_to_le16(FC_CTS);
memcpy(&rts->ra, &h->addr2, ETH_ALEN);
} else {
- rts->frame_control = htol16((u16) FC_RTS);
+ rts->frame_control = cpu_to_le16((u16) FC_RTS);
memcpy(&rts->ra, &h->addr1, 2 * ETH_ALEN);
}
#endif
/* Now that RTS/RTS FB preamble types are updated, write the final value */
- txh->MacTxControlHigh = htol16(mch);
+ txh->MacTxControlHigh = cpu_to_le16(mch);
/* MainRates (both the rts and frag plcp rates have been calculated now) */
- txh->MainRates = htol16(mainrates);
+ txh->MainRates = cpu_to_le16(mainrates);
/* XtraFrameTypes */
xfts = FRAMETYPE(rspec[1], wlc->mimoft);
xfts |= (FRAMETYPE(rts_rspec[1], wlc->mimoft) << XFTS_FBRRTS_FT_SHIFT);
xfts |=
CHSPEC_CHANNEL(WLC_BAND_PI_RADIO_CHANSPEC) << XFTS_CHANNEL_SHIFT;
- txh->XtraFrameTypes = htol16(xfts);
+ txh->XtraFrameTypes = cpu_to_le16(xfts);
/* PhyTxControlWord */
phyctl = FRAMETYPE(rspec[0], wlc->mimoft);
/* phytxant is properly bit shifted */
phyctl |= wlc_stf_d11hdrs_phyctl_txant(wlc, rspec[0]);
- txh->PhyTxControlWord = htol16(phyctl);
+ txh->PhyTxControlWord = cpu_to_le16(phyctl);
/* PhyTxControlWord_1 */
if (WLC_PHY_11N_CAP(wlc->band)) {
u16 phyctl1 = 0;
phyctl1 = wlc_phytxctl1_calc(wlc, rspec[0]);
- txh->PhyTxControlWord_1 = htol16(phyctl1);
+ txh->PhyTxControlWord_1 = cpu_to_le16(phyctl1);
phyctl1 = wlc_phytxctl1_calc(wlc, rspec[1]);
- txh->PhyTxControlWord_1_Fbr = htol16(phyctl1);
+ txh->PhyTxControlWord_1_Fbr = cpu_to_le16(phyctl1);
if (use_rts || use_cts) {
phyctl1 = wlc_phytxctl1_calc(wlc, rts_rspec[0]);
- txh->PhyTxControlWord_1_Rts = htol16(phyctl1);
+ txh->PhyTxControlWord_1_Rts = cpu_to_le16(phyctl1);
phyctl1 = wlc_phytxctl1_calc(wlc, rts_rspec[1]);
- txh->PhyTxControlWord_1_FbrRts = htol16(phyctl1);
+ txh->PhyTxControlWord_1_FbrRts = cpu_to_le16(phyctl1);
}
/*
if (IS_MCS(rspec[0]) && (preamble_type[0] == WLC_MM_PREAMBLE)) {
u16 mmodelen =
wlc_calc_lsig_len(wlc, rspec[0], phylen);
- txh->MModeLen = htol16(mmodelen);
+ txh->MModeLen = cpu_to_le16(mmodelen);
}
if (IS_MCS(rspec[1]) && (preamble_type[1] == WLC_MM_PREAMBLE)) {
u16 mmodefbrlen =
wlc_calc_lsig_len(wlc, rspec[1], phylen);
- txh->MModeFbrLen = htol16(mmodefbrlen);
+ txh->MModeFbrLen = cpu_to_le16(mmodefbrlen);
}
}
wlc_calc_cts_time(wlc, rts_rspec[1],
rts_preamble_type[1]);
/* (SIFS + CTS) + SIFS + frame + SIFS + ACK */
- dur += ltoh16(rts->duration);
- dur_fallback += ltoh16(txh->RTSDurFallback);
+ dur += le16_to_cpu(rts->duration);
+ dur_fallback +=
+ le16_to_cpu(txh->RTSDurFallback);
} else if (use_rifs) {
dur = frag_dur;
dur_fallback = 0;
preamble_type[1], 0);
}
/* NEED to set TxFesTimeNormal (hard) */
- txh->TxFesTimeNormal = htol16((u16) dur);
+ txh->TxFesTimeNormal = cpu_to_le16((u16) dur);
/* NEED to set fallback rate version of TxFesTimeNormal (hard) */
- txh->TxFesTimeFallback = htol16((u16) dur_fallback);
+ txh->TxFesTimeFallback =
+ cpu_to_le16((u16) dur_fallback);
/* update txop byte threshold (txop minus intraframe overhead) */
if (wlc->edcf_txop[ac] >= (dur - frag_dur)) {
goto fatal;
txh = (d11txh_t *) (p->data);
- mcl = ltoh16(txh->MacTxControlLow);
+ mcl = le16_to_cpu(txh->MacTxControlLow);
if (txs->phyerr) {
if (WL_ERROR_ON()) {
wlc_print_txstatus(txs);
}
- ASSERT(txs->frameid == htol16(txh->TxFrameID));
- if (txs->frameid != htol16(txh->TxFrameID))
+ ASSERT(txs->frameid == cpu_to_le16(txh->TxFrameID));
+ if (txs->frameid != cpu_to_le16(txh->TxFrameID))
goto fatal;
tx_info = IEEE80211_SKB_CB(p);
h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
- fc = ltoh16(h->frame_control);
+ fc = le16_to_cpu(h->frame_control);
scb = (struct scb *)tx_info->control.sta->drv_priv;
WL_NONE("%s: Pkt tx suppressed, possibly channel %d\n",
__func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec));
- tx_rts = htol16(txh->MacTxControlLow) & TXC_SENDRTS;
+ tx_rts = cpu_to_le16(txh->MacTxControlLow) & TXC_SENDRTS;
tx_frame_count =
(txs->status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT;
tx_rts_count =
/* check received pkt has at least frame control field */
if (len >= D11_PHY_HDR_LEN + sizeof(h->frame_control)) {
- fc = ltoh16(h->frame_control);
+ fc = le16_to_cpu(h->frame_control);
} else {
wlc->pub->_cnt->rxrunt++;
goto toss;
h = (struct ieee80211_mgmt *)&plcp[1];
/* fill in 802.11 header */
- h->frame_control = htol16((u16) type);
+ h->frame_control = cpu_to_le16((u16) type);
/* DUR is 0 for multicast bcn, or filled in by MAC for prb resp */
/* A1 filled in by MAC for prb resp, broadcast for bcn */
ASSERT(txh);
h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
ASSERT(h);
- fc = ltoh16(h->frame_control);
+ fc = le16_to_cpu(h->frame_control);
/* get the pkt queue info. This was put at wlc_sendctl or wlc_send for PDU */
- fifo = ltoh16(txh->TxFrameID) & TXFID_QUEUE_MASK;
+ fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK;
scb = NULL;
return BCME_BUSY;
}
- if ((ltoh16(txh->MacFrameControl) & IEEE80211_FCTL_FTYPE) !=
- IEEE80211_FTYPE_DATA)
+ if (!ieee80211_is_data(txh->MacFrameControl))
wlc->pub->_cnt->txctl++;
return 0;
((u32)((((u32)(val) & (u32)0x0000ffffU) << 16) | \
(((u32)(val) & (u32)0xffff0000U) >> 16)))
-/* Byte swapping macros
- * Host <=> Network (Big Endian) for 16- and 32-bit values
- * Host <=> Little-Endian for 16- and 32-bit values
- */
-#ifndef hton16
-#ifndef IL_BIGENDIAN
-#define HTON16(i) BCMSWAP16(i)
-#define hton16(i) bcmswap16(i)
-#define HTON32(i) BCMSWAP32(i)
-#define hton32(i) bcmswap32(i)
-#define NTOH16(i) BCMSWAP16(i)
-#define ntoh16(i) bcmswap16(i)
-#define NTOH32(i) BCMSWAP32(i)
-#define ntoh32(i) bcmswap32(i)
-#define LTOH16(i) (i)
-#define ltoh16(i) (i)
-#define LTOH32(i) (i)
-#define ltoh32(i) (i)
-#define HTOL16(i) (i)
-#define htol16(i) (i)
-#define HTOL32(i) (i)
-#define htol32(i) (i)
-#else /* IL_BIGENDIAN */
-#define HTON16(i) (i)
-#define hton16(i) (i)
-#define HTON32(i) (i)
-#define hton32(i) (i)
-#define NTOH16(i) (i)
-#define ntoh16(i) (i)
-#define NTOH32(i) (i)
-#define ntoh32(i) (i)
-#define LTOH16(i) BCMSWAP16(i)
-#define ltoh16(i) bcmswap16(i)
-#define LTOH32(i) BCMSWAP32(i)
-#define ltoh32(i) bcmswap32(i)
-#define HTOL16(i) BCMSWAP16(i)
-#define htol16(i) bcmswap16(i)
-#define HTOL32(i) BCMSWAP32(i)
-#define htol32(i) bcmswap32(i)
-#endif /* IL_BIGENDIAN */
-#endif /* hton16 */
-
#ifndef IL_BIGENDIAN
#define ltoh16_buf(buf, i)
#define htol16_buf(buf, i)
if (head == NULL)
return NULL;
- len = ltoh16(*(u16 *) (head->data));
+ len = le16_to_cpu(*(u16 *) (head->data));
DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
#if defined(__mips__)
while (!(len = *(u16 *) OSL_UNCACHED(head->data)))
udelay(1);
- *(u16 *) (head->data) = htol16((u16) len);
+ *(u16 *) (head->data) = cpu_to_le16((u16) len);
}
#endif /* defined(__mips__) */