staging: brcm80211: replace broadcom specific byte swapping routines

HTON16/hton16 -> cpu_to_be16 (htons for networking code)
HTON32/hton32 -> cpu_to_be32 (htonl for networking code)
NTOH16/ntoh32 -> be16_to_cpu (ntohs for networking code)
NTOH32/ntoh32 -> be32_to_cpu (ntohl for networking code)
LTOH16/ltoh16 -> le16_to_cpu
LTOH32/ltoh32 -> le32_to_cpu
HTOL16/htol16 -> cpu_to_le16
HTOL32/htol32 -> cpu_to_le32

Signed-off-by: Stanislav Fomichev <kernel@fomichev.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Stanislav Fomichev 2011-02-20 21:43:32 +03:00 committed by Greg Kroah-Hartman
parent 1005f08574
commit 628f10ba81
14 changed files with 188 additions and 226 deletions

View File

@ -735,7 +735,7 @@ static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr)
} }
/* Only the lower 17-bits are valid */ /* Only the lower 17-bits are valid */
scratch = ltoh32(scratch); scratch = le32_to_cpu(scratch);
scratch &= 0x0001FFFF; scratch &= 0x0001FFFF;
return scratch; return scratch;
} }

View File

@ -65,7 +65,7 @@ typedef struct dhd_prot {
static int dhdcdc_msg(dhd_pub_t *dhd) static int dhdcdc_msg(dhd_pub_t *dhd)
{ {
dhd_prot_t *prot = dhd->prot; 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__)); DHD_TRACE(("%s: Enter\n", __func__));
@ -93,7 +93,7 @@ static int dhdcdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len)
len + sizeof(cdc_ioctl_t)); len + sizeof(cdc_ioctl_t));
if (ret < 0) if (ret < 0)
break; break;
} while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id); } while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id);
return ret; return ret;
} }
@ -124,11 +124,11 @@ dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
memset(msg, 0, sizeof(cdc_ioctl_t)); memset(msg, 0, sizeof(cdc_ioctl_t));
msg->cmd = htol32(cmd); msg->cmd = cpu_to_le32(cmd);
msg->len = htol32(len); msg->len = cpu_to_le32(len);
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT); msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
CDC_SET_IF_IDX(msg, ifidx); CDC_SET_IF_IDX(msg, ifidx);
msg->flags = htol32(msg->flags); msg->flags = cpu_to_le32(msg->flags);
if (buf) if (buf)
memcpy(prot->buf, buf, len); memcpy(prot->buf, buf, len);
@ -146,7 +146,7 @@ retry:
if (ret < 0) if (ret < 0)
goto done; goto done;
flags = ltoh32(msg->flags); flags = le32_to_cpu(msg->flags);
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT; id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
if ((id < prot->reqid) && (++retries < RETRIES)) if ((id < prot->reqid) && (++retries < RETRIES))
@ -170,7 +170,7 @@ retry:
/* Check the ERROR flag */ /* Check the ERROR flag */
if (flags & CDCF_IOC_ERROR) { if (flags & CDCF_IOC_ERROR) {
ret = ltoh32(msg->status); ret = le32_to_cpu(msg->status);
/* Cache error from dongle */ /* Cache error from dongle */
dhd->dongle_error = ret; dhd->dongle_error = ret;
} }
@ -191,11 +191,11 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
memset(msg, 0, sizeof(cdc_ioctl_t)); memset(msg, 0, sizeof(cdc_ioctl_t));
msg->cmd = htol32(cmd); msg->cmd = cpu_to_le32(cmd);
msg->len = htol32(len); msg->len = cpu_to_le32(len);
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET; msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET;
CDC_SET_IF_IDX(msg, ifidx); CDC_SET_IF_IDX(msg, ifidx);
msg->flags = htol32(msg->flags); msg->flags = cpu_to_le32(msg->flags);
if (buf) if (buf)
memcpy(prot->buf, buf, len); memcpy(prot->buf, buf, len);
@ -208,7 +208,7 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
if (ret < 0) if (ret < 0)
goto done; goto done;
flags = ltoh32(msg->flags); flags = le32_to_cpu(msg->flags);
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT; id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
if (id != prot->reqid) { if (id != prot->reqid) {
@ -220,7 +220,7 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
/* Check the ERROR flag */ /* Check the ERROR flag */
if (flags & CDCF_IOC_ERROR) { if (flags & CDCF_IOC_ERROR) {
ret = ltoh32(msg->status); ret = le32_to_cpu(msg->status);
/* Cache error from dongle */ /* Cache error from dongle */
dhd->dongle_error = ret; dhd->dongle_error = ret;
} }
@ -276,8 +276,8 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
ret = 0; ret = 0;
else { else {
cdc_ioctl_t *msg = &prot->msg; cdc_ioctl_t *msg = &prot->msg;
ioc->needed = ltoh32(msg->len); /* len == needed when set/query /* len == needed when set/query fails from dongle */
fails from dongle */ ioc->needed = le32_to_cpu(msg->len);
} }
/* Intercept the wme_dp ioctl here */ /* Intercept the wme_dp ioctl here */
@ -287,7 +287,7 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
slen = strlen("wme_dp") + 1; slen = strlen("wme_dp") + 1;
if (len >= (int)(slen + sizeof(int))) if (len >= (int)(slen + sizeof(int)))
memcpy(&val, (char *)buf + 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; prot->pending = false;

View File

@ -577,12 +577,12 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"} WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
}; };
uint event_type, flags, auth_type, datalen; uint event_type, flags, auth_type, datalen;
event_type = ntoh32(event->event_type); event_type = be32_to_cpu(event->event_type);
flags = ntoh16(event->flags); flags = be16_to_cpu(event->flags);
status = ntoh32(event->status); status = be32_to_cpu(event->status);
reason = ntoh32(event->reason); reason = be32_to_cpu(event->reason);
auth_type = ntoh32(event->auth_type); auth_type = be32_to_cpu(event->auth_type);
datalen = ntoh32(event->datalen); datalen = be32_to_cpu(event->datalen);
/* debug dump of event messages */ /* debug dump of event messages */
sprintf(eabuf, "%pM", event->addr); sprintf(eabuf, "%pM", event->addr);
@ -750,24 +750,24 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
} }
/* There are 2 bytes available at the end of data */ /* 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) if (be32_to_cpu(hdr.discarded_bytes)
|| ntoh32(hdr.discarded_printf)) { || be32_to_cpu(hdr.discarded_printf)) {
DHD_ERROR( DHD_ERROR(
("\nWLC_E_TRACE: [Discarded traces in dongle -->" ("\nWLC_E_TRACE: [Discarded traces in dongle -->"
"discarded_bytes %d discarded_printf %d]\n", "discarded_bytes %d discarded_printf %d]\n",
ntoh32(hdr.discarded_bytes), be32_to_cpu(hdr.discarded_bytes),
ntoh32(hdr.discarded_printf))); 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) { if (nblost > 0) {
DHD_ERROR( DHD_ERROR(
("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n", ("\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 /* Display the trace buffer. Advance from \n to \n to
* avoid display big * avoid display big
@ -788,7 +788,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
case WLC_E_RSSI: case WLC_E_RSSI:
DHD_EVENT(("MACEVENT: %s %d\n", event_name, DHD_EVENT(("MACEVENT: %s %d\n", event_name,
ntoh32(*((int *)event_data)))); be32_to_cpu(*((int *)event_data))));
break; break;
default: default:
@ -898,7 +898,7 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
temp = ntoh32_ua((void *)&event->event_type); temp = ntoh32_ua((void *)&event->event_type);
DHD_TRACE(("Converted to WLC_E_LINK type %d\n", temp)); 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, memcpy((void *)(&pvt_data->event.event_type), &temp,
sizeof(pvt_data->event.event_type)); sizeof(pvt_data->event.event_type));
} }

View File

@ -713,7 +713,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
strcpy(bufp, "mcast_list"); strcpy(bufp, "mcast_list");
bufp += strlen("mcast_list") + 1; bufp += strlen("mcast_list") + 1;
cnt = htol32(cnt); cnt = cpu_to_le32(cnt);
memcpy(bufp, &cnt, sizeof(cnt)); memcpy(bufp, &cnt, sizeof(cnt));
bufp += sizeof(cnt); bufp += sizeof(cnt);
@ -752,7 +752,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
dhd_ifname(&dhd->pub, ifidx))); dhd_ifname(&dhd->pub, ifidx)));
return; return;
} }
allmulti = htol32(allmulti); allmulti = cpu_to_le32(allmulti);
if (!bcm_mkiovar if (!bcm_mkiovar
("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) { ("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {
@ -772,7 +772,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) { if (ret < 0) {
DHD_ERROR(("%s: set allmulti %d failed\n", 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); kfree(buf);
@ -781,7 +782,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
driver does */ driver does */
allmulti = (dev->flags & IFF_PROMISC) ? true : false; allmulti = (dev->flags & IFF_PROMISC) ? true : false;
allmulti = htol32(allmulti); allmulti = cpu_to_le32(allmulti);
memset(&ioc, 0, sizeof(ioc)); memset(&ioc, 0, sizeof(ioc));
ioc.cmd = WLC_SET_PROMISC; ioc.cmd = WLC_SET_PROMISC;
@ -792,7 +793,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) { if (ret < 0) {
DHD_ERROR(("%s: set promisc %d failed\n", DHD_ERROR(("%s: set promisc %d failed\n",
dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti))); dhd_ifname(&dhd->pub, ifidx),
le32_to_cpu(allmulti)));
} }
} }
@ -1028,7 +1030,7 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
if (is_multicast_ether_addr(eh->h_dest)) if (is_multicast_ether_addr(eh->h_dest))
dhdp->tx_multicast++; 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); atomic_inc(&dhd->pend_8021x_cnt);
} }
@ -1208,7 +1210,7 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf,
skb_pull(skb, ETH_HLEN); skb_pull(skb, ETH_HLEN);
/* Process special event packets and then discard them */ /* 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, dhd_wl_host_event(dhd, &ifidx,
skb_mac_header(skb), skb_mac_header(skb),
&event, &data); &event, &data);
@ -1253,7 +1255,7 @@ void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success)
dhd_prot_hdrpull(dhdp, &ifidx, txp); dhd_prot_hdrpull(dhdp, &ifidx, txp);
eh = (struct ethhdr *)(txp->data); eh = (struct ethhdr *)(txp->data);
type = ntoh16(eh->h_proto); type = ntohs(eh->h_proto);
if (type == ETH_P_PAE) if (type == ETH_P_PAE)
atomic_dec(&dhd->pend_8021x_cnt); atomic_dec(&dhd->pend_8021x_cnt);
@ -2749,7 +2751,7 @@ dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
/* send up locally generated event */ /* send up locally generated event */
void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data) 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: default:
break; break;
} }

View File

@ -966,8 +966,8 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
len = (u16) (pkt->len); len = (u16) (pkt->len);
*(u16 *) frame = htol16(len); *(u16 *) frame = cpu_to_le16(len);
*(((u16 *) frame) + 1) = htol16(~len); *(((u16 *) frame) + 1) = cpu_to_le16(~len);
/* Software tag: channel, sequence number, data offset */ /* Software tag: channel, sequence number, data offset */
swheader = swheader =
@ -1281,8 +1281,8 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
dhdsdio_clkctl(bus, CLK_AVAIL, false); dhdsdio_clkctl(bus, CLK_AVAIL, false);
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
*(u16 *) frame = htol16((u16) msglen); *(u16 *) frame = cpu_to_le16((u16) msglen);
*(((u16 *) frame) + 1) = htol16(~msglen); *(((u16 *) frame) + 1) = cpu_to_le16(~msglen);
/* Software tag: channel, sequence number, data offset */ /* Software tag: channel, sequence number, data offset */
swheader = swheader =
@ -1768,7 +1768,7 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
if (rv < 0) if (rv < 0)
return rv; return rv;
addr = ltoh32(addr); addr = le32_to_cpu(addr);
DHD_INFO(("sdpcm_shared address 0x%08X\n", addr)); DHD_INFO(("sdpcm_shared address 0x%08X\n", addr));
@ -1789,13 +1789,13 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
return rv; return rv;
/* Endianness */ /* Endianness */
sh->flags = ltoh32(sh->flags); sh->flags = le32_to_cpu(sh->flags);
sh->trap_addr = ltoh32(sh->trap_addr); sh->trap_addr = le32_to_cpu(sh->trap_addr);
sh->assert_exp_addr = ltoh32(sh->assert_exp_addr); sh->assert_exp_addr = le32_to_cpu(sh->assert_exp_addr);
sh->assert_file_addr = ltoh32(sh->assert_file_addr); sh->assert_file_addr = le32_to_cpu(sh->assert_file_addr);
sh->assert_line = ltoh32(sh->assert_line); sh->assert_line = le32_to_cpu(sh->assert_line);
sh->console_addr = ltoh32(sh->console_addr); sh->console_addr = le32_to_cpu(sh->console_addr);
sh->msgtrace_addr = ltoh32(sh->msgtrace_addr); sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr);
if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) { if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
DHD_ERROR(("%s: sdpcm_shared version %d in dhd " DHD_ERROR(("%s: sdpcm_shared version %d in dhd "
@ -2008,13 +2008,13 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
/* Allocate console buffer (one time only) */ /* Allocate console buffer (one time only) */
if (c->buf == NULL) { 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); c->buf = kmalloc(c->bufsize, GFP_ATOMIC);
if (c->buf == NULL) if (c->buf == NULL)
return BCME_NOMEM; return BCME_NOMEM;
} }
idx = ltoh32(c->log.idx); idx = le32_to_cpu(c->log.idx);
/* Protect against corrupt value */ /* Protect against corrupt value */
if (idx > c->bufsize) if (idx > c->bufsize)
@ -2026,7 +2026,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
return BCME_OK; return BCME_OK;
/* Read the console buffer */ /* 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); rv = dhdsdio_membytes(bus, false, addr, c->buf, c->bufsize);
if (rv < 0) if (rv < 0)
return rv; return rv;
@ -2589,7 +2589,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus)
} else { } else {
varsizew = varsize / 4; varsizew = varsize / 4;
varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF); 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, DHD_INFO(("New varsize is %d, length token=0x%08x\n", varsize,
@ -4986,7 +4986,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
/* Zero cbuf_index */ /* Zero cbuf_index */
addr = bus->console_addr + offsetof(hndrte_cons_t, cbuf_idx); 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)); rv = dhdsdio_membytes(bus, true, addr, (u8 *)&val, sizeof(val));
if (rv < 0) if (rv < 0)
goto done; goto done;
@ -4999,7 +4999,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
/* Write length into vcons_in */ /* Write length into vcons_in */
addr = bus->console_addr + offsetof(hndrte_cons_t, 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)); rv = dhdsdio_membytes(bus, true, addr, (u8 *)&val, sizeof(val));
if (rv < 0) if (rv < 0)
goto done; goto done;

View File

@ -2336,8 +2336,8 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e) static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e)
{ {
u32 event = ntoh32(e->event_type); u32 event = be32_to_cpu(e->event_type);
u16 flags = ntoh16(e->flags); u16 flags = be16_to_cpu(e->flags);
if (event == WLC_E_LINK) { if (event == WLC_E_LINK) {
if (flags & WLC_EVENT_MSG_LINK) { if (flags & WLC_EVENT_MSG_LINK) {
@ -2355,8 +2355,8 @@ static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e)
static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e) static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e)
{ {
u32 event = ntoh32(e->event_type); u32 event = be32_to_cpu(e->event_type);
u16 flags = ntoh16(e->flags); u16 flags = be16_to_cpu(e->flags);
if (event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND) { if (event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND) {
return true; return true;
@ -2370,8 +2370,8 @@ static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e)
static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e) static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e)
{ {
u32 event = ntoh32(e->event_type); u32 event = be32_to_cpu(e->event_type);
u32 status = ntoh32(e->status); u32 status = be32_to_cpu(e->status);
if (event == WLC_E_SET_SSID || event == WLC_E_LINK) { if (event == WLC_E_SET_SSID || event == WLC_E_LINK) {
if (status == WLC_E_STATUS_NO_NETWORKS) if (status == WLC_E_STATUS_NO_NETWORKS)
@ -2681,7 +2681,7 @@ static s32
wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev, wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data) 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; enum nl80211_key_type key_type;
rtnl_lock(); rtnl_lock();
@ -3273,7 +3273,7 @@ static s32 wl_event_handler(void *data)
void void
wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t * e, void *data) 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); struct wl_priv *wl = ndev_to_wl(ndev);
#if (WL_DBG_LEVEL > 0) #if (WL_DBG_LEVEL > 0)
s8 *estr = (event_type <= sizeof(wl_dbg_estr) / WL_DBG_ESTR_MAX - 1) ? s8 *estr = (event_type <= sizeof(wl_dbg_estr) / WL_DBG_ESTR_MAX - 1) ?

View File

@ -3353,9 +3353,9 @@ wl_iw_conn_status_str(u32 event_type, u32 status, u32 reason,
static bool static bool
wl_iw_check_conn_fail(wl_event_msg_t *e, char *stringBuf, uint buflen) wl_iw_check_conn_fail(wl_event_msg_t *e, char *stringBuf, uint buflen)
{ {
u32 event = ntoh32(e->event_type); u32 event = be32_to_cpu(e->event_type);
u32 status = ntoh32(e->status); u32 status = be32_to_cpu(e->status);
u32 reason = ntoh32(e->reason); u32 reason = be32_to_cpu(e->reason);
if (wl_iw_conn_status_str(event, status, reason, stringBuf, buflen)) { if (wl_iw_conn_status_str(event, status, reason, stringBuf, buflen)) {
return true; return true;
@ -3374,10 +3374,10 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
union iwreq_data wrqu; union iwreq_data wrqu;
char extra[IW_CUSTOM_MAX + 1]; char extra[IW_CUSTOM_MAX + 1];
int cmd = 0; int cmd = 0;
u32 event_type = ntoh32(e->event_type); u32 event_type = be32_to_cpu(e->event_type);
u16 flags = ntoh16(e->flags); u16 flags = be16_to_cpu(e->flags);
u32 datalen = ntoh32(e->datalen); u32 datalen = be32_to_cpu(e->datalen);
u32 status = ntoh32(e->status); u32 status = be32_to_cpu(e->status);
wl_iw_t *iw; wl_iw_t *iw;
u32 toto; u32 toto;
memset(&wrqu, 0, sizeof(wrqu)); memset(&wrqu, 0, sizeof(wrqu));

View File

@ -2859,7 +2859,7 @@ void BCMFASTPATH wlc_phy_rssi_compute(wlc_phy_t *pih, void *ctx)
{ {
wlc_d11rxhdr_t *wlc_rxhdr = (wlc_d11rxhdr_t *) ctx; wlc_d11rxhdr_t *wlc_rxhdr = (wlc_d11rxhdr_t *) ctx;
d11rxhdr_t *rxh = &wlc_rxhdr->rxhdr; 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; uint radioid = pih->radioid;
phy_info_t *pi = (phy_info_t *) pih; phy_info_t *pi = (phy_info_t *) pih;
@ -2869,13 +2869,13 @@ void BCMFASTPATH wlc_phy_rssi_compute(wlc_phy_t *pih, void *ctx)
} }
if ((pi->sh->corerev >= 11) if ((pi->sh->corerev >= 11)
&& !(ltoh16(rxh->RxStatus2) & RXS_PHYRXST_VALID)) { && !(le16_to_cpu(rxh->RxStatus2) & RXS_PHYRXST_VALID)) {
rssi = WLC_RSSI_INVALID; rssi = WLC_RSSI_INVALID;
goto end; goto end;
} }
if (ISLCNPHY(pi)) { 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; phy_info_lcnphy_t *pi_lcn = pi->u.pi_lcnphy;
if (rssi > 127) if (rssi > 127)

View File

@ -21478,16 +21478,16 @@ wlc_phy_rssi_compute_nphy(phy_info_t *pi, wlc_d11rxhdr_t *wlc_rxh)
s16 phyRx0_l, phyRx2_l; s16 phyRx0_l, phyRx2_l;
rxpwr = 0; rxpwr = 0;
rxpwr0 = ltoh16(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR0_MASK; rxpwr0 = le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR0_MASK;
rxpwr1 = (ltoh16(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR1_MASK) >> 8; rxpwr1 = (le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR1_MASK) >> 8;
if (rxpwr0 > 127) if (rxpwr0 > 127)
rxpwr0 -= 256; rxpwr0 -= 256;
if (rxpwr1 > 127) if (rxpwr1 > 127)
rxpwr1 -= 256; rxpwr1 -= 256;
phyRx0_l = ltoh16(rxh->PhyRxStatus_0) & 0x00ff; phyRx0_l = le16_to_cpu(rxh->PhyRxStatus_0) & 0x00ff;
phyRx2_l = ltoh16(rxh->PhyRxStatus_2) & 0x00ff; phyRx2_l = le16_to_cpu(rxh->PhyRxStatus_2) & 0x00ff;
if (phyRx2_l > 127) if (phyRx2_l > 127)
phyRx2_l -= 256; phyRx2_l -= 256;

View File

@ -594,13 +594,13 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
txh = (d11txh_t *) p->data; txh = (d11txh_t *) p->data;
plcp = (u8 *) (txh + 1); plcp = (u8 *) (txh + 1);
h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN); 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); index = TX_SEQ_TO_INDEX(seq);
/* check mcl fields and test whether it can be agg'd */ /* 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; mcl &= ~TXC_AMPDU_MASK;
fbr_iscck = !(ltoh16(txh->XtraFrameTypes) & 0x3); fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x3);
ASSERT(!fbr_iscck); ASSERT(!fbr_iscck);
txh->PreloadSize = 0; /* always default to 0 */ txh->PreloadSize = 0; /* always default to 0 */
@ -637,7 +637,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
/* refill the bits since might be a retx mpdu */ /* refill the bits since might be a retx mpdu */
mcl |= TXC_STARTMSDU; mcl |= TXC_STARTMSDU;
rts = (struct ieee80211_rts *)&txh->rts_frame; 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) { if ((fc & FC_KIND_MASK) == FC_RTS) {
mcl |= TXC_SENDRTS; mcl |= TXC_SENDRTS;
use_rts = true; use_rts = true;
@ -659,7 +659,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
WL_AMPDU_TX("wl%d: wlc_sendampdu: ampdu_len %d seg_cnt %d null delim %d\n", 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); wlc->pub->unit, ampdu_len, seg_cnt, ndelim);
txh->MacTxControlLow = htol16(mcl); txh->MacTxControlLow = cpu_to_le16(mcl);
/* this packet is added */ /* this packet is added */
pkt[count++] = p; pkt[count++] = p;
@ -784,10 +784,10 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
/* patch up the last txh */ /* patch up the last txh */
txh = (d11txh_t *) pkt[count - 1]->data; txh = (d11txh_t *) pkt[count - 1]->data;
mcl = ltoh16(txh->MacTxControlLow); mcl = le16_to_cpu(txh->MacTxControlLow);
mcl &= ~TXC_AMPDU_MASK; mcl &= ~TXC_AMPDU_MASK;
mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT); mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT);
txh->MacTxControlLow = htol16(mcl); txh->MacTxControlLow = cpu_to_le16(mcl);
/* remove the null delimiter after last mpdu */ /* remove the null delimiter after last mpdu */
ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM];
@ -795,7 +795,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
ampdu_len -= ndelim * AMPDU_DELIMITER_LEN; ampdu_len -= ndelim * AMPDU_DELIMITER_LEN;
/* remove the pad len from last mpdu */ /* 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) len = fbr_iscck ? WLC_GET_CCK_PLCP_LEN(txh->FragPLCPFallback)
: WLC_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); : WLC_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback);
ampdu_len -= roundup(len, 4) - len; ampdu_len -= roundup(len, 4) - len;
@ -812,24 +812,24 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
if (txh->MModeLen) { if (txh->MModeLen) {
u16 mmodelen = u16 mmodelen =
wlc_calc_lsig_len(wlc, rspec, ampdu_len); wlc_calc_lsig_len(wlc, rspec, ampdu_len);
txh->MModeLen = htol16(mmodelen); txh->MModeLen = cpu_to_le16(mmodelen);
preamble_type = WLC_MM_PREAMBLE; preamble_type = WLC_MM_PREAMBLE;
} }
if (txh->MModeFbrLen) { if (txh->MModeFbrLen) {
u16 mmfbrlen = u16 mmfbrlen =
wlc_calc_lsig_len(wlc, rspec_fallback, ampdu_len); 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; fbr_preamble_type = WLC_MM_PREAMBLE;
} }
/* set the preload length */ /* set the preload length */
if (MCS_RATE(mcs, true, false) >= f->dmaxferrate) { if (MCS_RATE(mcs, true, false) >= f->dmaxferrate) {
dma_len = min(dma_len, f->ampdu_pld_size); dma_len = min(dma_len, f->ampdu_pld_size);
txh->PreloadSize = htol16(dma_len); txh->PreloadSize = cpu_to_le16(dma_len);
} else } else
txh->PreloadSize = 0; txh->PreloadSize = 0;
mch = ltoh16(txh->MacTxControlHigh); mch = le16_to_cpu(txh->MacTxControlHigh);
/* update RTS dur fields */ /* update RTS dur fields */
if (use_rts || use_cts) { if (use_rts || use_cts) {
@ -848,14 +848,14 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
rspec, rts_preamble_type, rspec, rts_preamble_type,
preamble_type, ampdu_len, preamble_type, ampdu_len,
true); true);
rts->duration = htol16(durid); rts->duration = cpu_to_le16(durid);
durid = wlc_compute_rtscts_dur(wlc, use_cts, durid = wlc_compute_rtscts_dur(wlc, use_cts,
rts_rspec_fallback, rts_rspec_fallback,
rspec_fallback, rspec_fallback,
rts_fbr_preamble_type, rts_fbr_preamble_type,
fbr_preamble_type, fbr_preamble_type,
ampdu_len, true); ampdu_len, true);
txh->RTSDurFallback = htol16(durid); txh->RTSDurFallback = cpu_to_le16(durid);
/* set TxFesTimeNormal */ /* set TxFesTimeNormal */
txh->TxFesTimeNormal = rts->duration; txh->TxFesTimeNormal = rts->duration;
/* set fallback rate version of TxFesTimeNormal */ /* set fallback rate version of TxFesTimeNormal */
@ -867,7 +867,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
WLCNTADD(ampdu->cnt->txfbr_mpdu, count); WLCNTADD(ampdu->cnt->txfbr_mpdu, count);
WLCNTINCR(ampdu->cnt->txfbr_ampdu); WLCNTINCR(ampdu->cnt->txfbr_ampdu);
mch |= TXC_AMPDU_FBR; 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(plcp);
WLC_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback); WLC_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback);
} }
@ -876,7 +876,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
wlc->pub->unit, count, ampdu_len); wlc->pub->unit, count, ampdu_len);
/* inform rate_sel if it this is a rate probe pkt */ /* 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) { if (frameid & TXFID_RATE_PROBE_MASK) {
WL_ERROR("%s: XXX what to do with TXFID_RATE_PROBE_MASK!?\n", WL_ERROR("%s: XXX what to do with TXFID_RATE_PROBE_MASK!?\n",
__func__); __func__);
@ -1082,14 +1082,14 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
tx_info = IEEE80211_SKB_CB(p); tx_info = IEEE80211_SKB_CB(p);
ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU); ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
txh = (d11txh_t *) p->data; txh = (d11txh_t *) p->data;
mcl = ltoh16(txh->MacTxControlLow); mcl = le16_to_cpu(txh->MacTxControlLow);
plcp = (u8 *) (txh + 1); plcp = (u8 *) (txh + 1);
h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN); 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) { if (tot_mpdu == 0) {
mcs = plcp[0] & MIMO_PLCP_MCS_MASK; 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); index = TX_SEQ_TO_INDEX(seq);

View File

@ -304,7 +304,7 @@ wlc_bmac_recv(struct wlc_hw_info *wlc_hw, uint fifo, bool bound)
/* record the tsf_l in wlc_rxd11hdr */ /* record the tsf_l in wlc_rxd11hdr */
wlc_rxhdr = (wlc_d11rxhdr_t *) p->data; 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 */ /* compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */
wlc_phy_rssi_compute(wlc_hw->band->pi, wlc_rxhdr); wlc_phy_rssi_compute(wlc_hw->band->pi, wlc_rxhdr);
@ -1701,9 +1701,9 @@ wlc_bmac_write_template_ram(struct wlc_hw_info *wlc_hw, int offset, int len,
memcpy(&word, buf, sizeof(u32)); memcpy(&word, buf, sizeof(u32));
if (be_bit) if (be_bit)
word = hton32(word); word = cpu_to_be32(word);
else else
word = htol32(word); word = cpu_to_le32(word);
W_REG(osh, &regs->tplatewrdata, word); W_REG(osh, &regs->tplatewrdata, word);

View File

@ -1345,13 +1345,13 @@ void wlc_wme_initparams_sta(struct wlc_info *wlc, wme_param_ie_t *pe)
0, 0,
{ {
{EDCF_AC_BE_ACI_STA, EDCF_AC_BE_ECW_STA, {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, {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, {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, {EDCF_AC_VO_ACI_STA, EDCF_AC_VO_ECW_STA,
HTOL16(EDCF_AC_VO_TXOP_STA)} cpu_to_le16(EDCF_AC_VO_TXOP_STA)}
} }
}; };
@ -1390,7 +1390,7 @@ void wlc_wme_setparams(struct wlc_info *wlc, u16 aci, void *arg, bool suspend)
/* wlc->wme_admctl |= 1 << aci; *//* should be set ?? seems like off by default */ /* wlc->wme_admctl |= 1 << aci; *//* should be set ?? seems like off by default */
/* fill in shm ac params struct */ /* 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 */ /* convert from units of 32us to us for ucode */
wlc->edcf_txop[aci & 0x3] = acp_shm.txop = wlc->edcf_txop[aci & 0x3] = acp_shm.txop =
EDCF_TXOP2USEC(acp_shm.txop); EDCF_TXOP2USEC(acp_shm.txop);
@ -1474,7 +1474,7 @@ void wlc_edcf_setparams(wlc_bsscfg_t *cfg, bool suspend)
} }
/* fill in shm ac params struct */ /* 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 */ /* convert from units of 32us to us for ucode */
wlc->edcf_txop[aci] = acp_shm.txop = wlc->edcf_txop[aci] = acp_shm.txop =
EDCF_TXOP2USEC(acp_shm.txop); EDCF_TXOP2USEC(acp_shm.txop);
@ -4750,7 +4750,7 @@ wlc_ctrupd_cache(u16 cur_stat, u16 *macstat_snapshot, u32 *macstat)
u16 v; u16 v;
u16 delta; u16 delta;
v = ltoh16(cur_stat); v = le16_to_cpu(cur_stat);
delta = (u16)(v - *macstat_snapshot); delta = (u16)(v - *macstat_snapshot);
if (delta != 0) { if (delta != 0) {
@ -4927,32 +4927,32 @@ bool wlc_chipmatch(u16 vendor, u16 device)
#if defined(BCMDBG) #if defined(BCMDBG)
void wlc_print_txdesc(d11txh_t *txh) void wlc_print_txdesc(d11txh_t *txh)
{ {
u16 mtcl = ltoh16(txh->MacTxControlLow); u16 mtcl = le16_to_cpu(txh->MacTxControlLow);
u16 mtch = ltoh16(txh->MacTxControlHigh); u16 mtch = le16_to_cpu(txh->MacTxControlHigh);
u16 mfc = ltoh16(txh->MacFrameControl); u16 mfc = le16_to_cpu(txh->MacFrameControl);
u16 tfest = ltoh16(txh->TxFesTimeNormal); u16 tfest = le16_to_cpu(txh->TxFesTimeNormal);
u16 ptcw = ltoh16(txh->PhyTxControlWord); u16 ptcw = le16_to_cpu(txh->PhyTxControlWord);
u16 ptcw_1 = ltoh16(txh->PhyTxControlWord_1); u16 ptcw_1 = le16_to_cpu(txh->PhyTxControlWord_1);
u16 ptcw_1_Fbr = ltoh16(txh->PhyTxControlWord_1_Fbr); u16 ptcw_1_Fbr = le16_to_cpu(txh->PhyTxControlWord_1_Fbr);
u16 ptcw_1_Rts = ltoh16(txh->PhyTxControlWord_1_Rts); u16 ptcw_1_Rts = le16_to_cpu(txh->PhyTxControlWord_1_Rts);
u16 ptcw_1_FbrRts = ltoh16(txh->PhyTxControlWord_1_FbrRts); u16 ptcw_1_FbrRts = le16_to_cpu(txh->PhyTxControlWord_1_FbrRts);
u16 mainrates = ltoh16(txh->MainRates); u16 mainrates = le16_to_cpu(txh->MainRates);
u16 xtraft = ltoh16(txh->XtraFrameTypes); u16 xtraft = le16_to_cpu(txh->XtraFrameTypes);
u8 *iv = txh->IV; u8 *iv = txh->IV;
u8 *ra = txh->TxFrameRA; u8 *ra = txh->TxFrameRA;
u16 tfestfb = ltoh16(txh->TxFesTimeFallback); u16 tfestfb = le16_to_cpu(txh->TxFesTimeFallback);
u8 *rtspfb = txh->RTSPLCPFallback; u8 *rtspfb = txh->RTSPLCPFallback;
u16 rtsdfb = ltoh16(txh->RTSDurFallback); u16 rtsdfb = le16_to_cpu(txh->RTSDurFallback);
u8 *fragpfb = txh->FragPLCPFallback; u8 *fragpfb = txh->FragPLCPFallback;
u16 fragdfb = ltoh16(txh->FragDurFallback); u16 fragdfb = le16_to_cpu(txh->FragDurFallback);
u16 mmodelen = ltoh16(txh->MModeLen); u16 mmodelen = le16_to_cpu(txh->MModeLen);
u16 mmodefbrlen = ltoh16(txh->MModeFbrLen); u16 mmodefbrlen = le16_to_cpu(txh->MModeFbrLen);
u16 tfid = ltoh16(txh->TxFrameID); u16 tfid = le16_to_cpu(txh->TxFrameID);
u16 txs = ltoh16(txh->TxStatus); u16 txs = le16_to_cpu(txh->TxStatus);
u16 mnmpdu = ltoh16(txh->MaxNMpdus); u16 mnmpdu = le16_to_cpu(txh->MaxNMpdus);
u16 mabyte = ltoh16(txh->MaxABytes_MRT); u16 mabyte = le16_to_cpu(txh->MaxABytes_MRT);
u16 mabyte_f = ltoh16(txh->MaxABytes_FBR); u16 mabyte_f = le16_to_cpu(txh->MaxABytes_FBR);
u16 mmbyte = ltoh16(txh->MinMBytes); u16 mmbyte = le16_to_cpu(txh->MinMBytes);
u8 *rtsph = txh->RTSPhyHeader; u8 *rtsph = txh->RTSPhyHeader;
struct ieee80211_rts rts = txh->rts_frame; struct ieee80211_rts rts = txh->rts_frame;
@ -5213,7 +5213,7 @@ wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu,
ASSERT(sdu); ASSERT(sdu);
fc = ltoh16(d11_header->frame_control); fc = le16_to_cpu(d11_header->frame_control);
type = (fc & IEEE80211_FCTL_FTYPE); type = (fc & IEEE80211_FCTL_FTYPE);
/* 802.11 standard requires management traffic to go at highest priority */ /* 802.11 standard requires management traffic to go at highest priority */
@ -5315,7 +5315,8 @@ bcmc_fid_generate(struct wlc_info *wlc, wlc_bsscfg_t *bsscfg, d11txh_t *txh)
{ {
u16 frameid; 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 |= frameid |=
(((wlc-> (((wlc->
mc_fid_counter++) << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) | mc_fid_counter++) << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
@ -5338,7 +5339,7 @@ wlc_txfifo(struct wlc_info *wlc, uint fifo, struct sk_buff *p, bool commit,
* ucode or BSS info as appropriate. * ucode or BSS info as appropriate.
*/ */
if (fifo == TX_BCMC_FIFO) { if (fifo == TX_BCMC_FIFO) {
frameid = ltoh16(txh->TxFrameID); frameid = le16_to_cpu(txh->TxFrameID);
} }
@ -5789,7 +5790,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
/* locate 802.11 MAC header */ /* locate 802.11 MAC header */
h = (struct ieee80211_hdr *)(p->data); h = (struct ieee80211_hdr *)(p->data);
fc = ltoh16(h->frame_control); fc = le16_to_cpu(h->frame_control);
type = (fc & IEEE80211_FCTL_FTYPE); type = (fc & IEEE80211_FCTL_FTYPE);
qos = (type == IEEE80211_FTYPE_DATA && qos = (type == IEEE80211_FTYPE_DATA &&
@ -5834,9 +5835,9 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
} }
/* extract fragment number from frame first */ /* 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); 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) | frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
(queue & TXFID_QUEUE_MASK); (queue & TXFID_QUEUE_MASK);
@ -6078,7 +6079,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
durid = durid =
wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0], wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0],
next_frag_len); next_frag_len);
h->duration_id = htol16(durid); h->duration_id = cpu_to_le16(durid);
} else if (use_rifs) { } else if (use_rifs) {
/* NAV protect to end of next max packet size */ /* NAV protect to end of next max packet size */
durid = durid =
@ -6086,7 +6087,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
preamble_type[0], preamble_type[0],
DOT11_MAX_FRAG_LEN); DOT11_MAX_FRAG_LEN);
durid += RIFS_11N_TIME; durid += RIFS_11N_TIME;
h->duration_id = htol16(durid); h->duration_id = cpu_to_le16(durid);
} }
/* DUR field for fallback rate */ /* DUR field for fallback rate */
@ -6097,7 +6098,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
else { else {
durid = wlc_compute_frame_dur(wlc, rspec[1], durid = wlc_compute_frame_dur(wlc, rspec[1],
preamble_type[1], next_frag_len); preamble_type[1], next_frag_len);
txh->FragDurFallback = htol16(durid); txh->FragDurFallback = cpu_to_le16(durid);
} }
/* (4) MAC-HDR: MacTxControlLow */ /* (4) MAC-HDR: MacTxControlLow */
@ -6117,7 +6118,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
if (hwtkmic) if (hwtkmic)
mcl |= TXC_AMIC; mcl |= TXC_AMIC;
txh->MacTxControlLow = htol16(mcl); txh->MacTxControlLow = cpu_to_le16(mcl);
/* MacTxControlHigh */ /* MacTxControlHigh */
mch = 0; mch = 0;
@ -6133,28 +6134,28 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
/* MacFrameControl */ /* MacFrameControl */
memcpy(&txh->MacFrameControl, &h->frame_control, sizeof(u16)); 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 */ /* TxFrameRA */
memcpy(&txh->TxFrameRA, &h->addr1, ETH_ALEN); memcpy(&txh->TxFrameRA, &h->addr1, ETH_ALEN);
/* TxFrameID */ /* TxFrameID */
txh->TxFrameID = htol16(frameid); txh->TxFrameID = cpu_to_le16(frameid);
/* TxStatus, Note the case of recreating the first frag of a suppressed frame /* 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 * 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 /* extra fields for ucode AMPDU aggregation, the new fields are added to
* the END of previous structure so that it's compatible in driver. * the END of previous structure so that it's compatible in driver.
*/ */
txh->MaxNMpdus = htol16(0); txh->MaxNMpdus = cpu_to_le16(0);
txh->MaxABytes_MRT = htol16(0); txh->MaxABytes_MRT = cpu_to_le16(0);
txh->MaxABytes_FBR = htol16(0); txh->MaxABytes_FBR = cpu_to_le16(0);
txh->MinMBytes = htol16(0); txh->MinMBytes = cpu_to_le16(0);
/* (5) RTS/CTS: determine RTS/CTS PLCP header and MAC duration, furnish d11txh_t */ /* (5) RTS/CTS: determine RTS/CTS PLCP header and MAC duration, furnish d11txh_t */
/* RTS PLCP header and RTS frame */ /* RTS PLCP header and RTS frame */
@ -6184,10 +6185,10 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
/* RTS/CTS additions to MacTxControlLow */ /* RTS/CTS additions to MacTxControlLow */
if (use_cts) { if (use_cts) {
txh->MacTxControlLow |= htol16(TXC_SENDCTS); txh->MacTxControlLow |= cpu_to_le16(TXC_SENDCTS);
} else { } else {
txh->MacTxControlLow |= htol16(TXC_SENDRTS); txh->MacTxControlLow |= cpu_to_le16(TXC_SENDRTS);
txh->MacTxControlLow |= htol16(TXC_LONGFRAME); txh->MacTxControlLow |= cpu_to_le16(TXC_LONGFRAME);
} }
/* RTS PLCP header */ /* RTS PLCP header */
@ -6212,19 +6213,19 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
durid = wlc_compute_rtscts_dur(wlc, use_cts, rts_rspec[0], durid = wlc_compute_rtscts_dur(wlc, use_cts, rts_rspec[0],
rspec[0], rts_preamble_type[0], rspec[0], rts_preamble_type[0],
preamble_type[0], phylen, false); preamble_type[0], phylen, false);
rts->duration = htol16(durid); rts->duration = cpu_to_le16(durid);
/* fallback rate version of RTS DUR field */ /* fallback rate version of RTS DUR field */
durid = wlc_compute_rtscts_dur(wlc, use_cts, durid = wlc_compute_rtscts_dur(wlc, use_cts,
rts_rspec[1], rspec[1], rts_rspec[1], rspec[1],
rts_preamble_type[1], rts_preamble_type[1],
preamble_type[1], phylen, false); preamble_type[1], phylen, false);
txh->RTSDurFallback = htol16(durid); txh->RTSDurFallback = cpu_to_le16(durid);
if (use_cts) { if (use_cts) {
rts->frame_control = htol16(FC_CTS); rts->frame_control = cpu_to_le16(FC_CTS);
memcpy(&rts->ra, &h->addr2, ETH_ALEN); memcpy(&rts->ra, &h->addr2, ETH_ALEN);
} else { } 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); memcpy(&rts->ra, &h->addr1, 2 * ETH_ALEN);
} }
@ -6253,10 +6254,10 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
#endif #endif
/* Now that RTS/RTS FB preamble types are updated, write the final value */ /* 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) */ /* MainRates (both the rts and frag plcp rates have been calculated now) */
txh->MainRates = htol16(mainrates); txh->MainRates = cpu_to_le16(mainrates);
/* XtraFrameTypes */ /* XtraFrameTypes */
xfts = FRAMETYPE(rspec[1], wlc->mimoft); xfts = FRAMETYPE(rspec[1], wlc->mimoft);
@ -6264,7 +6265,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
xfts |= (FRAMETYPE(rts_rspec[1], wlc->mimoft) << XFTS_FBRRTS_FT_SHIFT); xfts |= (FRAMETYPE(rts_rspec[1], wlc->mimoft) << XFTS_FBRRTS_FT_SHIFT);
xfts |= xfts |=
CHSPEC_CHANNEL(WLC_BAND_PI_RADIO_CHANSPEC) << XFTS_CHANNEL_SHIFT; CHSPEC_CHANNEL(WLC_BAND_PI_RADIO_CHANSPEC) << XFTS_CHANNEL_SHIFT;
txh->XtraFrameTypes = htol16(xfts); txh->XtraFrameTypes = cpu_to_le16(xfts);
/* PhyTxControlWord */ /* PhyTxControlWord */
phyctl = FRAMETYPE(rspec[0], wlc->mimoft); phyctl = FRAMETYPE(rspec[0], wlc->mimoft);
@ -6279,22 +6280,22 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
/* phytxant is properly bit shifted */ /* phytxant is properly bit shifted */
phyctl |= wlc_stf_d11hdrs_phyctl_txant(wlc, rspec[0]); phyctl |= wlc_stf_d11hdrs_phyctl_txant(wlc, rspec[0]);
txh->PhyTxControlWord = htol16(phyctl); txh->PhyTxControlWord = cpu_to_le16(phyctl);
/* PhyTxControlWord_1 */ /* PhyTxControlWord_1 */
if (WLC_PHY_11N_CAP(wlc->band)) { if (WLC_PHY_11N_CAP(wlc->band)) {
u16 phyctl1 = 0; u16 phyctl1 = 0;
phyctl1 = wlc_phytxctl1_calc(wlc, rspec[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]); 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) { if (use_rts || use_cts) {
phyctl1 = wlc_phytxctl1_calc(wlc, rts_rspec[0]); 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]); phyctl1 = wlc_phytxctl1_calc(wlc, rts_rspec[1]);
txh->PhyTxControlWord_1_FbrRts = htol16(phyctl1); txh->PhyTxControlWord_1_FbrRts = cpu_to_le16(phyctl1);
} }
/* /*
@ -6305,13 +6306,13 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
if (IS_MCS(rspec[0]) && (preamble_type[0] == WLC_MM_PREAMBLE)) { if (IS_MCS(rspec[0]) && (preamble_type[0] == WLC_MM_PREAMBLE)) {
u16 mmodelen = u16 mmodelen =
wlc_calc_lsig_len(wlc, rspec[0], phylen); 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)) { if (IS_MCS(rspec[1]) && (preamble_type[1] == WLC_MM_PREAMBLE)) {
u16 mmodefbrlen = u16 mmodefbrlen =
wlc_calc_lsig_len(wlc, rspec[1], phylen); wlc_calc_lsig_len(wlc, rspec[1], phylen);
txh->MModeFbrLen = htol16(mmodefbrlen); txh->MModeFbrLen = cpu_to_le16(mmodefbrlen);
} }
} }
@ -6345,8 +6346,9 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
wlc_calc_cts_time(wlc, rts_rspec[1], wlc_calc_cts_time(wlc, rts_rspec[1],
rts_preamble_type[1]); rts_preamble_type[1]);
/* (SIFS + CTS) + SIFS + frame + SIFS + ACK */ /* (SIFS + CTS) + SIFS + frame + SIFS + ACK */
dur += ltoh16(rts->duration); dur += le16_to_cpu(rts->duration);
dur_fallback += ltoh16(txh->RTSDurFallback); dur_fallback +=
le16_to_cpu(txh->RTSDurFallback);
} else if (use_rifs) { } else if (use_rifs) {
dur = frag_dur; dur = frag_dur;
dur_fallback = 0; dur_fallback = 0;
@ -6366,9 +6368,10 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
preamble_type[1], 0); preamble_type[1], 0);
} }
/* NEED to set TxFesTimeNormal (hard) */ /* 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) */ /* 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) */ /* update txop byte threshold (txop minus intraframe overhead) */
if (wlc->edcf_txop[ac] >= (dur - frag_dur)) { if (wlc->edcf_txop[ac] >= (dur - frag_dur)) {
@ -6636,7 +6639,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
goto fatal; goto fatal;
txh = (d11txh_t *) (p->data); txh = (d11txh_t *) (p->data);
mcl = ltoh16(txh->MacTxControlLow); mcl = le16_to_cpu(txh->MacTxControlLow);
if (txs->phyerr) { if (txs->phyerr) {
if (WL_ERROR_ON()) { if (WL_ERROR_ON()) {
@ -6647,13 +6650,13 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
wlc_print_txstatus(txs); wlc_print_txstatus(txs);
} }
ASSERT(txs->frameid == htol16(txh->TxFrameID)); ASSERT(txs->frameid == cpu_to_le16(txh->TxFrameID));
if (txs->frameid != htol16(txh->TxFrameID)) if (txs->frameid != cpu_to_le16(txh->TxFrameID))
goto fatal; goto fatal;
tx_info = IEEE80211_SKB_CB(p); tx_info = IEEE80211_SKB_CB(p);
h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); 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; scb = (struct scb *)tx_info->control.sta->drv_priv;
@ -6676,7 +6679,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
WL_NONE("%s: Pkt tx suppressed, possibly channel %d\n", WL_NONE("%s: Pkt tx suppressed, possibly channel %d\n",
__func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec)); __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 = tx_frame_count =
(txs->status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT; (txs->status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT;
tx_rts_count = tx_rts_count =
@ -7091,7 +7094,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
/* check received pkt has at least frame control field */ /* check received pkt has at least frame control field */
if (len >= D11_PHY_HDR_LEN + sizeof(h->frame_control)) { if (len >= D11_PHY_HDR_LEN + sizeof(h->frame_control)) {
fc = ltoh16(h->frame_control); fc = le16_to_cpu(h->frame_control);
} else { } else {
wlc->pub->_cnt->rxrunt++; wlc->pub->_cnt->rxrunt++;
goto toss; goto toss;
@ -7716,7 +7719,7 @@ wlc_bcn_prb_template(struct wlc_info *wlc, uint type, ratespec_t bcn_rspec,
h = (struct ieee80211_mgmt *)&plcp[1]; h = (struct ieee80211_mgmt *)&plcp[1];
/* fill in 802.11 header */ /* 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 */ /* 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 */ /* A1 filled in by MAC for prb resp, broadcast for bcn */
@ -7892,10 +7895,10 @@ int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifop)
ASSERT(txh); ASSERT(txh);
h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
ASSERT(h); 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 */ /* 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; scb = NULL;
@ -7908,8 +7911,7 @@ int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifop)
return BCME_BUSY; return BCME_BUSY;
} }
if ((ltoh16(txh->MacFrameControl) & IEEE80211_FCTL_FTYPE) != if (!ieee80211_is_data(txh->MacFrameControl))
IEEE80211_FTYPE_DATA)
wlc->pub->_cnt->txctl++; wlc->pub->_cnt->txctl++;
return 0; return 0;

View File

@ -34,48 +34,6 @@
((u32)((((u32)(val) & (u32)0x0000ffffU) << 16) | \ ((u32)((((u32)(val) & (u32)0x0000ffffU) << 16) | \
(((u32)(val) & (u32)0xffff0000U) >> 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 #ifndef IL_BIGENDIAN
#define ltoh16_buf(buf, i) #define ltoh16_buf(buf, i)
#define htol16_buf(buf, i) #define htol16_buf(buf, i)

View File

@ -746,7 +746,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
if (head == NULL) if (head == NULL)
return 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)); DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
#if defined(__mips__) #if defined(__mips__)
@ -755,7 +755,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
while (!(len = *(u16 *) OSL_UNCACHED(head->data))) while (!(len = *(u16 *) OSL_UNCACHED(head->data)))
udelay(1); udelay(1);
*(u16 *) (head->data) = htol16((u16) len); *(u16 *) (head->data) = cpu_to_le16((u16) len);
} }
#endif /* defined(__mips__) */ #endif /* defined(__mips__) */