Commit 981f187b authored by David Woodhouse's avatar David Woodhouse Committed by John W. Linville

[PATCH] libertas: first pass at fixing up endianness issues

Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 123e0e04
......@@ -570,7 +570,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
}
lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size));
lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, le16_to_cpu(cmd->size));
done:
lbs_deb_enter(LBS_DEB_11D);
......@@ -611,8 +611,7 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
int libertas_ret_802_11d_domain_info(wlan_private * priv,
struct cmd_ds_command *resp)
{
struct cmd_ds_802_11d_domain_info
*domaininfo = &resp->params.domaininforesp;
struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
u16 action = le16_to_cpu(domaininfo->action);
s16 ret = 0;
......@@ -623,8 +622,8 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp,
(int)le16_to_cpu(resp->size));
nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset);
/* countrycode 3 bytes */
nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) /
sizeof(struct ieeetypes_subbandset);
lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband);
......
......@@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset {
} __attribute__ ((packed));
struct cmd_ds_802_11d_domain_info {
u16 action;
__le16 action;
struct mrvlietypes_domainparamset domain;
} __attribute__ ((packed));
......
......@@ -209,7 +209,7 @@ static int assoc_helper_mode(wlan_private *priv,
cmd_802_11_snmp_mib,
0, cmd_option_waitforrsp,
OID_802_11_INFRASTRUCTURE_MODE,
(void *) (size_t) assoc_req->mode);
/* Shoot me now */ (void *) (size_t) assoc_req->mode);
done:
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -146,14 +146,14 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
goto done;
}
priv->mstats.fwd_drop_rbt = mesh_access.data[0];
priv->mstats.fwd_drop_ttl = mesh_access.data[1];
priv->mstats.fwd_drop_noroute = mesh_access.data[2];
priv->mstats.fwd_drop_nobuf = mesh_access.data[3];
priv->mstats.fwd_unicast_cnt = mesh_access.data[4];
priv->mstats.fwd_bcast_cnt = mesh_access.data[5];
priv->mstats.drop_blind = mesh_access.data[6];
priv->mstats.tx_failed_cnt = mesh_access.data[7];
priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
ret = MESH_STATS_NUM;
......
......@@ -19,7 +19,7 @@
*/
static int check_fwfile_format(u8 *data, u32 totlen)
{
u8 bincmd, exit;
u32 bincmd, exit;
u32 blksize, offset, len;
int ret;
......@@ -27,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen)
exit = len = 0;
do {
bincmd = *data;
blksize = *(u32*)(data + offsetof(struct fwheader, datalength));
struct fwheader *fwh = (void *)data;
bincmd = le32_to_cpu(fwh->dnldcmd);
blksize = le32_to_cpu(fwh->datalength);
switch (bincmd) {
case FW_HAS_DATA_TO_RECV:
offset = sizeof(struct fwheader) + blksize;
......@@ -72,13 +74,12 @@ static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)
if ((ret = request_firmware(&priv->firmware, fw_name,
priv->hotplug_device)) < 0) {
lbs_pr_err("request_firmware() failed with %#x\n",
ret);
lbs_pr_err("request_firmware() failed with %#x\n", ret);
lbs_pr_err("firmware %s not found\n", fw_name);
goto done;
}
if(check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
release_firmware(priv->firmware);
goto done;
}
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
int i;
/* Prepare command */
sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER;
sbootcmd.u32magicnumber = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER);
sbootcmd.u8cmd_tag = ivalue;
for (i=0; i<11; i++)
sbootcmd.au8dumy[i]=0x00;
......
......@@ -141,10 +141,10 @@ static int if_usb_probe(struct usb_interface *intf,
lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
" bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
udev->descriptor.bcdUSB,
udev->descriptor.bDeviceClass,
udev->descriptor.bDeviceSubClass,
udev->descriptor.bDeviceProtocol);
le16_to_cpu(udev->descriptor.bcdUSB),
udev->descriptor.bDeviceClass,
udev->descriptor.bDeviceSubClass,
udev->descriptor.bDeviceProtocol);
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
endpoint = &iface_desc->endpoint[i].desc;
......@@ -153,10 +153,8 @@ static int if_usb_probe(struct usb_interface *intf,
USB_ENDPOINT_XFER_BULK)) {
/* we found a bulk in endpoint */
lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n",
endpoint->wMaxPacketSize);
if (!
(cardp->rx_urb =
usb_alloc_urb(0, GFP_KERNEL))) {
le16_to_cpu(endpoint->wMaxPacketSize));
if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
lbs_deb_usbd(&udev->dev,
"Rx URB allocation failed\n");
goto dealloc;
......@@ -164,7 +162,7 @@ static int if_usb_probe(struct usb_interface *intf,
cardp->rx_urb_recall = 0;
cardp->bulk_in_size =
endpoint->wMaxPacketSize;
le16_to_cpu(endpoint->wMaxPacketSize);
cardp->bulk_in_endpointAddr =
(endpoint->
bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
......@@ -178,19 +176,17 @@ static int if_usb_probe(struct usb_interface *intf,
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) {
/* We found bulk out endpoint */
if (!
(cardp->tx_urb =
usb_alloc_urb(0, GFP_KERNEL))) {
if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
lbs_deb_usbd(&udev->dev,
"Tx URB allocation failed\n");
goto dealloc;
}
cardp->bulk_out_size =
endpoint->wMaxPacketSize;
le16_to_cpu(endpoint->wMaxPacketSize);
lbs_deb_usbd(&udev->dev,
"Bulk out size is %d\n",
endpoint->wMaxPacketSize);
"Bulk out size is %d\n",
le16_to_cpu(endpoint->wMaxPacketSize));
cardp->bulk_out_endpointAddr =
endpoint->bEndpointAddress;
lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n",
......@@ -313,7 +309,7 @@ static int if_prog_firmware(wlan_private * priv)
/* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */
memcpy(fwdata->data, &firmware[cardp->totalbytes],
fwdata->fwheader.datalength);
le32_to_cpu(fwdata->fwheader.datalength));
/*
lbs_deb_usbd(&cardp->udev->dev,
......@@ -322,13 +318,13 @@ static int if_prog_firmware(wlan_private * priv)
cardp->fwseqnum = cardp->fwseqnum + 1;
fwdata->seqnum = cardp->fwseqnum;
cardp->lastseqnum = fwdata->seqnum;
cardp->totalbytes += fwdata->fwheader.datalength;
fwdata->seqnum = cpu_to_le32(cardp->fwseqnum);
cardp->lastseqnum = cardp->fwseqnum;
cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength);
if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) {
if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) {
/*
lbs_deb_usbd(&cardp->udev->dev, "There is data to follow\n");
lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n");
lbs_deb_usbd(&cardp->udev->dev,
"seqnum = %d totalbytes = %d\n", cardp->fwseqnum,
cardp->totalbytes);
......@@ -486,7 +482,7 @@ static void if_usb_receive_fwload(struct urb *urb)
if (cardp->bootcmdresp == 0) {
memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET,
sizeof(bootcmdresp));
if (cardp->udev->descriptor.bcdDevice < 0x3106) {
if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) {
kfree_skb(skb);
if_usb_submit_rx_urb_fwload(priv);
cardp->bootcmdresp = 1;
......@@ -494,10 +490,10 @@ static void if_usb_receive_fwload(struct urb *urb)
"Received valid boot command response\n");
return;
}
if (bootcmdresp.u32magicnumber != BOOT_CMD_MAGIC_NUMBER) {
if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) {
lbs_pr_info(
"boot cmd response wrong magic number (0x%x)\n",
bootcmdresp.u32magicnumber);
le32_to_cpu(bootcmdresp.u32magicnumber));
} else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) {
lbs_pr_info(
"boot cmd response cmd_tag error (%d)\n",
......@@ -672,7 +668,7 @@ static void if_usb_receive(struct urb *urb)
case CMD_TYPE_INDICATION:
/* Event cause handling */
spin_lock(&priv->adapter->driver_lock);
cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN);
cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN));
lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n",
cardp->usb_event_cause);
if (cardp->usb_event_cause & 0xffff0000) {
......@@ -680,7 +676,7 @@ static void if_usb_receive(struct urb *urb)
spin_unlock(&priv->adapter->driver_lock);
break;
}
cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3;
cardp->usb_event_cause <<= 3;
cardp->usb_int_cause |= his_cardevent;
kfree_skb(skb);
libertas_interrupt(priv->dev);
......
......@@ -20,7 +20,7 @@
struct bootcmdstr
{
u32 u32magicnumber;
__le32 u32magicnumber;
u8 u8cmd_tag;
u8 au8dumy[11];
};
......@@ -30,7 +30,7 @@ struct bootcmdstr
struct bootcmdrespStr
{
u32 u32magicnumber;
__le32 u32magicnumber;
u8 u8cmd_tag;
u8 u8result;
u8 au8dumy[2];
......@@ -76,24 +76,24 @@ struct usb_card_rec {
/** fwheader */
struct fwheader {
u32 dnldcmd;
u32 baseaddr;
u32 datalength;
u32 CRC;
__le32 dnldcmd;
__le32 baseaddr;
__le32 datalength;
__le32 CRC;
};
#define FW_MAX_DATA_BLK_SIZE 600
/** FWData */
struct FWData {
struct fwheader fwheader;
u32 seqnum;
__le32 seqnum;
u8 data[FW_MAX_DATA_BLK_SIZE];
};
/** fwsyncheader */
struct fwsyncheader {
u32 cmd;
u32 seqnum;
__le32 cmd;
__le32 seqnum;
};
#define FW_HAS_DATA_TO_RECV 0x00000001
......
......@@ -216,7 +216,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
struct iwreq *wrq = (struct iwreq *)req;
/* used to pass id and store the bt entry returned by the FW */
union {
int id;
u32 id;
char addr1addr2[2 * ETH_ALEN];
} param;
static char outstr[64];
......@@ -272,7 +272,7 @@ static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req)
int ret;
struct iwreq *wrq = (struct iwreq *)req;
union {
int id;
u32 id;
char addr1addr2[2 * ETH_ALEN];
} param;
......@@ -300,7 +300,7 @@ static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req)
struct iwreq *wrq = (struct iwreq *)req;
int ret;
union {
int id;
u32 id;
char addr1addr2[2 * ETH_ALEN];
} param;
......@@ -365,7 +365,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
fwt_access.metric =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else
fwt_access.metric = FWT_DEFAULT_METRIC;
fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC);
if ((ptr = next_param(ptr)))
fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
......@@ -381,13 +381,13 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
fwt_access.ssn =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else
fwt_access.ssn = FWT_DEFAULT_SSN;
fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN);
if ((ptr = next_param(ptr)))
fwt_access.dsn =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else
fwt_access.dsn = FWT_DEFAULT_DSN;
fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN);
if ((ptr = next_param(ptr)))
fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10);
......@@ -403,7 +403,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
fwt_access.expiration =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else
fwt_access.expiration = FWT_DEFAULT_EXPIRATION;
fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION);
if ((ptr = next_param(ptr)))
fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10);
......@@ -414,7 +414,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
fwt_access.snr =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else
fwt_access.snr = FWT_DEFAULT_SNR;
fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR);
#ifdef DEBUG
{
......@@ -864,7 +864,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
return -EINVAL;
memset(&mesh_access, 0, sizeof(mesh_access));
mesh_access.data[0] = ttl;
mesh_access.data[0] = cpu_to_le32(ttl);
ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
cmd_act_mesh_set_ttl,
......
......@@ -306,13 +306,11 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
lbs_deb_enter(LBS_DEB_JOIN);
cmd->command = cpu_to_le16(cmd_802_11_deauthenticate);
cmd->size =
cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
S_DS_GEN);
/* set AP MAC address */
memmove(dauth->macaddr, adapter->curbssparams.bssid,
ETH_ALEN);
memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN);
/* Reason code 3 = Station is leaving */
#define REASON_CODE_STA_LEAVING 3
......@@ -333,7 +331,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
u8 *card_rates;
u8 *pos;
int card_rates_size;
u16 tmpcap;
u16 tmpcap, tmplen;
struct mrvlietypes_ssidparamset *ssid;
struct mrvlietypes_phyparamset *phy;
struct mrvlietypes_ssparamset *ss;
......@@ -355,7 +353,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
pos += sizeof(passo->peerstaaddr);
/* set the listen interval */
passo->listeninterval = adapter->listeninterval;
passo->listeninterval = cpu_to_le16(adapter->listeninterval);
pos += sizeof(passo->capinfo);
pos += sizeof(passo->listeninterval);
......@@ -364,14 +362,14 @@ int libertas_cmd_80211_associate(wlan_private * priv,
ssid = (struct mrvlietypes_ssidparamset *) pos;
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
ssid->header.len = bss->ssid.ssidlength;
ssid->header.len = cpu_to_le16(bss->ssid.ssidlength);
memcpy(ssid->ssid, bss->ssid.ssid, ssid->header.len);
pos += sizeof(ssid->header) + ssid->header.len;
ssid->header.len = cpu_to_le16(ssid->header.len);
phy = (struct mrvlietypes_phyparamset *) pos;
phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
phy->header.len = sizeof(phy->fh_ds.dsparamset);
phy->header.len = cpu_to_le16(sizeof(phy->fh_ds.dsparamset));
memcpy(&phy->fh_ds.dsparamset,
&bss->phyparamset.dsparamset.currentchan,
sizeof(phy->fh_ds.dsparamset));
......@@ -380,7 +378,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
ss = (struct mrvlietypes_ssparamset *) pos;
ss->header.type = cpu_to_le16(TLV_TYPE_CF);
ss->header.len = sizeof(ss->cf_ibss.cfparamset);
ss->header.len = cpu_to_le16(sizeof(ss->cf_ibss.cfparamset));
pos += sizeof(ss->header) + ss->header.len;
ss->header.len = cpu_to_le16(ss->header.len);
......@@ -398,33 +396,34 @@ int libertas_cmd_80211_associate(wlan_private * priv,
goto done;
}
rates->header.len = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES);
adapter->curbssparams.numofrates = rates->header.len;
tmplen = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES);
adapter->curbssparams.numofrates = tmplen;
pos += sizeof(rates->header) + rates->header.len;
rates->header.len = cpu_to_le16(rates->header.len);
pos += sizeof(rates->header) + tmplen;
rates->header.len = cpu_to_le16(tmplen);
if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
rsn = (struct mrvlietypes_rsnparamset *) pos;
rsn->header.type = (u16) assoc_req->wpa_ie[0]; /* WPA_IE or WPA2_IE */
rsn->header.type = cpu_to_le16(rsn->header.type);
rsn->header.len = (u16) assoc_req->wpa_ie[1];
memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], rsn->header.len);
/* WPA_IE or WPA2_IE */
rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]);
tmplen = (u16) assoc_req->wpa_ie[1];
rsn->header.len = cpu_to_le16(tmplen);
memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen);
lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn,
sizeof(rsn->header) + rsn->header.len);
pos += sizeof(rsn->header) + rsn->header.len;
rsn->header.len = cpu_to_le16(rsn->header.len);
sizeof(rsn->header) + tmplen);
pos += sizeof(rsn->header) + tmplen;
}
/* update curbssparams */
adapter->curbssparams.channel =
(bss->phyparamset.dsparamset.currentchan);
adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan;
/* Copy the infra. association rates into Current BSS state structure */
memcpy(&adapter->curbssparams.datarates, &rates->rates,
min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len));
min_t(size_t, sizeof(adapter->curbssparams.datarates),
cpu_to_le16(rates->header.len)));
lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n",
cpu_to_le16(rates->header.len));
/* set IBSS field */
if (bss->mode == IW_MODE_INFRA) {
......@@ -443,8 +442,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo));
tmpcap &= CAPINFO_MASK;
lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
tmpcap, CAPINFO_MASK);
tmpcap = cpu_to_le16(tmpcap);
tmpcap, CAPINFO_MASK);
memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
done:
......@@ -460,7 +458,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
int ret = 0;
int cmdappendsize = 0;
int i;
u16 tmpcap;
struct assoc_request * assoc_req = pdata_buf;
lbs_deb_enter(LBS_DEB_JOIN);
......@@ -492,7 +489,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
/* set the BSS type */
adhs->bsstype = cmd_bss_type_ibss;
adapter->mode = IW_MODE_ADHOC;
adhs->beaconperiod = adapter->beaconperiod;
adhs->beaconperiod = cpu_to_le16(adapter->beaconperiod);
/* set Physical param set */
#define DS_PARA_IE_ID 3
......@@ -504,7 +501,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
WARN_ON(!assoc_req->channel);
lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n",
assoc_req->channel);
assoc_req->channel);
adhs->phyparamset.dsparamset.currentchan = assoc_req->channel;
......@@ -514,7 +511,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID;
adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN;
adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow;
adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow);
/* set capability info */
adhs->cap.ess = 0;
......@@ -562,13 +559,8 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
goto done;
}
cmd->size =
cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start)
+ S_DS_GEN + cmdappendsize);
memcpy(&tmpcap, &adhs->cap, sizeof(u16));
tmpcap = cpu_to_le16(tmpcap);
memcpy(&adhs->cap, &tmpcap, sizeof(u16));
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) +
S_DS_GEN + cmdappendsize);
ret = 0;
done:
......@@ -605,7 +597,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss;
padhocjoin->bssdescriptor.beaconperiod = bss->beaconperiod;
padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN);
memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength);
......@@ -634,8 +626,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
/* probedelay */
padhocjoin->probedelay =
cpu_to_le16(cmd_scan_probe_delay_time);
padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
/* Copy Data rates from the rates recorded in scan response */
memset(padhocjoin->bssdescriptor.datarates, 0,
......@@ -679,9 +670,9 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
if (adapter->psmode == wlan802_11powermodemax_psp) {
/* wake up first */
enum WLAN_802_11_POWER_MODE Localpsmode;
__le32 Localpsmode;
Localpsmode = wlan802_11powermodecam;
Localpsmode = cpu_to_le32(wlan802_11powermodecam);
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_ps_mode,
cmd_act_set,
......@@ -698,16 +689,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
goto done;
}
cmd->size =
cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join)
+ S_DS_GEN + cmdappendsize);
memcpy(&tmpcap, &padhocjoin->bssdescriptor.cap,
sizeof(struct ieeetypes_capinfo));
tmpcap = cpu_to_le16(tmpcap);
memcpy(&padhocjoin->bssdescriptor.cap,
&tmpcap, sizeof(struct ieeetypes_capinfo));
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) +
S_DS_GEN + cmdappendsize);
done:
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
......@@ -734,11 +717,11 @@ int libertas_ret_80211_associate(wlan_private * priv,
passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
if (passocrsp->statuscode) {
if (le16_to_cpu(passocrsp->statuscode)) {
libertas_mac_event_disconnected(priv);
lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n",
passocrsp->statuscode);
le16_to_cpu(passocrsp->statuscode));
ret = -1;
goto done;
......
......@@ -190,7 +190,7 @@ static ssize_t libertas_mpp_get(struct device * dev,
cmd_act_mesh_get_mpp,
cmd_option_waitforrsp, 0, (void *)&mesh_access);
return snprintf(buf, 3, "%d\n", mesh_access.data[0]);
return snprintf(buf, 3, "%d\n", le32_to_cpu(mesh_access.data[0]));
}
/**
......@@ -199,9 +199,12 @@ static ssize_t libertas_mpp_get(struct device * dev,
static ssize_t libertas_mpp_set(struct device * dev,
struct device_attribute *attr, const char * buf, size_t count) {
struct cmd_ds_mesh_access mesh_access;
uint32_t datum;
memset(&mesh_access, 0, sizeof(mesh_access));
sscanf(buf, "%d", &(mesh_access.data[0]));
sscanf(buf, "%d", &datum);
mesh_access.data[0] = cpu_to_le32(datum);
libertas_prepare_and_send_command((to_net_dev(dev))->priv,
cmd_mesh_access,
cmd_act_mesh_set_mpp,
......@@ -213,8 +216,7 @@ static ssize_t libertas_mpp_set(struct device * dev,
* libertas_mpp attribute to be exported per mshX interface
* through sysfs (/sys/class/net/mshX/libertas-mpp)
*/
static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get,
libertas_mpp_set );
static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, libertas_mpp_set );
/**
* @brief Check if the device can be open and wait if necessary.
......
......@@ -200,7 +200,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
/*
* Check rxpd status and update 802.3 stat,
*/
if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) {
if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
lbs_deb_rx("rx err: frame received with bad status\n");
lbs_pr_alert("rxpd not ok\n");
priv->stats.rx_errors++;
......@@ -353,7 +353,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
/*
* Check rxpd status and update 802.3 stat,
*/
if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) {
if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
//lbs_deb_rx("rx err: frame received with bad status\n");
priv->stats.rx_errors++;
}
......@@ -386,7 +386,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
/* XXX must check no carryout */
radiotap_hdr.antsignal = prxpd->snr + prxpd->nf;
radiotap_hdr.rx_flags = 0;
if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK))
if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS;
//memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18);
......
......@@ -323,14 +323,12 @@ static void wlan_scan_create_channel_list(wlan_private * priv,
if (scantype == cmd_scan_type_passive) {
scanchanlist[chanidx].maxscantime =
cpu_to_le16
(MRVDRV_PASSIVE_SCAN_CHAN_TIME);
cpu_to_le16(MRVDRV_PASSIVE_SCAN_CHAN_TIME);
scanchanlist[chanidx].chanscanmode.passivescan =
1;
} else {
scanchanlist[chanidx].maxscantime =
cpu_to_le16
(MRVDRV_ACTIVE_SCAN_CHAN_TIME);
cpu_to_le16(MRVDRV_ACTIVE_SCAN_CHAN_TIME);
scanchanlist[chanidx].chanscanmode.passivescan =
0;
}
......@@ -487,16 +485,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
/* If the input config or adapter has the number of Probes set, add tlv */
if (numprobes) {
pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos;
pnumprobestlv->header.type =
cpu_to_le16(TLV_TYPE_NUMPROBES);
pnumprobestlv->header.len = sizeof(pnumprobestlv->numprobes);
pnumprobestlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES);
pnumprobestlv->header.len = cpu_to_le16(2);
pnumprobestlv->numprobes = cpu_to_le16(numprobes);
ptlvpos +=
sizeof(pnumprobestlv->header) + pnumprobestlv->header.len;
pnumprobestlv->header.len =
cpu_to_le16(pnumprobestlv->header.len);
ptlvpos += sizeof(*pnumprobestlv);
}
/*
......@@ -655,8 +648,11 @@ static int wlan_scan_channel_list(wlan_private * priv,
ptmpchan, sizeof(pchantlvout->chanscanparam));
/* Increment the TLV header length by the size appended */
pchantlvout->header.len +=
sizeof(pchantlvout->chanscanparam);
/* Ew, it would be _so_ nice if we could just declare the
variable little-endian and let GCC handle it for us */
pchantlvout->header.len =
cpu_to_le16(le16_to_cpu(pchantlvout->header.len) +
sizeof(pchantlvout->chanscanparam));
/*
* The tlv buffer length is set to the number of bytes of the
......@@ -670,7 +666,7 @@ static int wlan_scan_channel_list(wlan_private * priv,
/* Add the size of the channel tlv header and the data length */
pscancfgout->tlvbufferlen +=
(sizeof(pchantlvout->header)
+ pchantlvout->header.len);
+ le16_to_cpu(pchantlvout->header.len));
/* Increment the index to the channel tlv we are constructing */
tlvidx++;
......@@ -955,8 +951,7 @@ static int libertas_process_bss(struct bss_descriptor * bss,
if (*bytesleft >= sizeof(beaconsize)) {
/* Extract & convert beacon size from the command buffer */
memcpy(&beaconsize, *pbeaconinfo, sizeof(beaconsize));
beaconsize = le16_to_cpu(beaconsize);
beaconsize = le16_to_cpup((void *)*pbeaconinfo);
*bytesleft -= sizeof(beaconsize);
*pbeaconinfo += sizeof(beaconsize);
}
......@@ -995,28 +990,25 @@ static int libertas_process_bss(struct bss_descriptor * bss,
*/
/* RSSI is 1 byte long */
bss->rssi = le32_to_cpu((long)(*pcurrentptr));
bss->rssi = *pcurrentptr;
lbs_deb_scan("process_bss: RSSI=%02X\n", *pcurrentptr);
pcurrentptr += 1;
bytesleftforcurrentbeacon -= 1;
/* time stamp is 8 bytes long */
memcpy(fixedie.timestamp, pcurrentptr, 8);
memcpy(bss->timestamp, pcurrentptr, 8);
fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr);
pcurrentptr += 8;
bytesleftforcurrentbeacon -= 8;
/* beacon interval is 2 bytes long */
memcpy(&fixedie.beaconinterval, pcurrentptr, 2);
bss->beaconperiod = le16_to_cpu(fixedie.beaconinterval);
fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr);
pcurrentptr += 2;
bytesleftforcurrentbeacon -= 2;
/* capability information is 2 bytes long */
memcpy(&fixedie.capabilities, pcurrentptr, 2);
memcpy(&fixedie.capabilities, pcurrentptr, 2);
lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n",
fixedie.capabilities);
fixedie.capabilities = le16_to_cpu(fixedie.capabilities);
pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo));
pcurrentptr += 2;
......@@ -1077,8 +1069,10 @@ static int libertas_process_bss(struct bss_descriptor * bss,
pFH = (struct ieeetypes_fhparamset *) pcurrentptr;
memmove(&bss->phyparamset.fhparamset, pFH,
sizeof(struct ieeetypes_fhparamset));
#if 0 /* I think we can store these LE */
bss->phyparamset.fhparamset.dwelltime
= le16_to_cpu(bss->phyparamset.fhparamset.dwelltime);
#endif
break;
case DS_PARAM_SET:
......@@ -1099,8 +1093,10 @@ static int libertas_process_bss(struct bss_descriptor * bss,
bss->atimwindow = le32_to_cpu(pibss->atimwindow);
memmove(&bss->ssparamset.ibssparamset, pibss,
sizeof(struct ieeetypes_ibssparamset));
#if 0
bss->ssparamset.ibssparamset.atimwindow
= le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow);
#endif
break;
/* Handle Country Info IE */
......@@ -1744,7 +1740,8 @@ int libertas_cmd_80211_scan(wlan_private * priv,
+ pscancfg->tlvbufferlen + S_DS_GEN);
lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
cmd->command, cmd->size, cmd->seqnum);
le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
le16_to_cpu(cmd->seqnum));
lbs_deb_leave(LBS_DEB_ASSOC);
return 0;
......@@ -1799,7 +1796,6 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
int bytesleft;
int idx;
int tlvbufsize;
u64 tsfval;
int ret;
lbs_deb_enter(LBS_DEB_ASSOC);
......@@ -1905,9 +1901,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
* beacon or probe response was received.
*/
if (ptsftlv) {
memcpy(&tsfval, &ptsftlv->tsftable[idx], sizeof(tsfval));
tsfval = le64_to_cpu(tsfval);
memcpy(&new.networktsf, &tsfval, sizeof(new.networktsf));
new.networktsf = le64_to_cpup(&ptsftlv->tsftable[idx]);
}
/* Copy the locally created newbssentry to the scan table */
......
......@@ -154,7 +154,7 @@ struct bss_descriptor {
u8 mode;
u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
u8 timestamp[8]; //!< TSF value included in the beacon/probe response
__le64 timestamp; //!< TSF value included in the beacon/probe response
unsigned long last_scanned;
union ieeetypes_phyparamset phyparamset;
......@@ -162,7 +162,7 @@ struct bss_descriptor {
struct ieeetypes_capinfo cap;
u8 datarates[WLAN_SUPPORTED_RATES];
__le64 networktsf; //!< TSF timestamp from the current firmware TSF
u64 networktsf; //!< TSF timestamp from the current firmware TSF
struct ieeetypes_countryinfofullset countryinfo;
......
......@@ -85,13 +85,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
memset(plocaltxpd, 0, sizeof(struct txpd));
plocaltxpd->tx_packet_length = skb->len;
plocaltxpd->tx_packet_length = cpu_to_le16(skb->len);
/* offset of actual data */
plocaltxpd->tx_packet_location = sizeof(struct txpd);
plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd));
/* TxCtrl set by user or default */
plocaltxpd->tx_control = adapter->pkttxctrl;
plocaltxpd->tx_control = cpu_to_le32(adapter->pkttxctrl);
p802x_hdr = skb->data;
if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) {
......@@ -102,15 +102,16 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
/* set txpd fields from the radiotap header */
new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate);
if (new_rate != 0) {
/* erase tx_control[4:0] */
plocaltxpd->tx_control &= ~0x1f;
/* write new tx_control[4:0] */
plocaltxpd->tx_control |= new_rate;
/* use new tx_control[4:0] */
new_rate |= (adapter->pkttxctrl & ~0x1f);
plocaltxpd->tx_control = cpu_to_le32(new_rate);
}
/* skip the radiotap header */
p802x_hdr += sizeof(struct tx_radiotap_hdr);
plocaltxpd->tx_packet_length -= sizeof(struct tx_radiotap_hdr);
plocaltxpd->tx_packet_length =
cpu_to_le32(le32_to_cpu(plocaltxpd->tx_packet_length)
- sizeof(struct tx_radiotap_hdr));
}
/* copy destination address from 802.3 or 802.11 header */
......@@ -122,19 +123,19 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd));
if (IS_MESH_FRAME(skb)) {
plocaltxpd->tx_control |= TxPD_MESH_FRAME;
plocaltxpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME);
}
memcpy(ptr, plocaltxpd, sizeof(struct txpd));
ptr += sizeof(struct txpd);
lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length);
memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length);
lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, le32_to_cpu(plocaltxpd->tx_packet_length));
memcpy(ptr, p802x_hdr, le32_to_cpu(plocaltxpd->tx_packet_length));
ret = priv->hw_host_to_card(priv, MVMS_DAT,
priv->adapter->tmptxbuf,
plocaltxpd->tx_packet_length +
sizeof(struct txpd));
priv->adapter->tmptxbuf,
le32_to_cpu(plocaltxpd->tx_packet_length) +
sizeof(struct txpd));
if (ret) {
lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret);
......
......@@ -5,6 +5,7 @@
#define _WLAN_TYPES_
#include <linux/if_ether.h>
#include <asm/byteorder.h>
/** IEEE type definitions */
enum ieeetypes_elementid {
......@@ -29,9 +30,30 @@ enum ieeetypes_elementid {
EXTRA_IE = 133,
} __attribute__ ((packed));
#ifdef __BIG_ENDIAN
#define CAPINFO_MASK (~(0xda00))
#else
#define CAPINFO_MASK (~(0x00da))
#endif
struct ieeetypes_capinfo {
#ifdef __BIG_ENDIAN_BITFIELD
u8 chanagility:1;
u8 pbcc:1;
u8 shortpreamble:1;
u8 privacy:1;
u8 cfpollrqst:1;
u8 cfpollable:1;
u8 ibss:1;
u8 ess:1;
u8 rsrvd1:2;
u8 dsssofdm:1;
u8 rsvrd2:1;
u8 apsd:1;
u8 shortslottime:1;
u8 rsrvd3:1;
u8 spectrummgmt:1;
#else
u8 ess:1;
u8 ibss:1;
u8 cfpollable:1;
......@@ -47,6 +69,7 @@ struct ieeetypes_capinfo {
u8 rsvrd2:1;
u8 dsssofdm:1;
u8 rsrvd1:2;
#endif
} __attribute__ ((packed));
struct ieeetypes_cfparamset {
......@@ -54,15 +77,15 @@ struct ieeetypes_cfparamset {
u8 len;
u8 cfpcnt;
u8 cfpperiod;
u16 cfpmaxduration;
u16 cfpdurationremaining;
__le16 cfpmaxduration;
__le16 cfpdurationremaining;
} __attribute__ ((packed));
struct ieeetypes_ibssparamset {
u8 elementid;
u8 len;
u16 atimwindow;
__le16 atimwindow;
} __attribute__ ((packed));
union IEEEtypes_ssparamset {
......@@ -73,7 +96,7 @@ union IEEEtypes_ssparamset {
struct ieeetypes_fhparamset {
u8 elementid;
u8 len;
u16 dwelltime;
__le16 dwelltime;
u8 hopset;
u8 hoppattern;
u8 hopindex;
......@@ -92,8 +115,8 @@ union ieeetypes_phyparamset {
struct ieeetypes_assocrsp {
struct ieeetypes_capinfo capability;
u16 statuscode;
u16 aid;
__le16 statuscode;
__le16 aid;
u8 iebuffer[1];
} __attribute__ ((packed));
......@@ -138,8 +161,8 @@ struct ieeetypes_assocrsp {
/** TLV related data structures*/
struct mrvlietypesheader {
u16 type;
u16 len;
__le16 type;
__le16 len;
} __attribute__ ((packed));
struct mrvlietypes_data {
......@@ -164,17 +187,23 @@ struct mrvlietypes_wildcardssidparamset {
} __attribute__ ((packed));
struct chanscanmode {
#ifdef __BIG_ENDIAN_BITFIELD
u8 reserved_2_7:6;
u8 disablechanfilt:1;
u8 passivescan:1;
#else
u8 passivescan:1;
u8 disablechanfilt:1;
u8 reserved_2_7:6;
#endif
} __attribute__ ((packed));
struct chanscanparamset {
u8 radiotype;
u8 channumber;
struct chanscanmode chanscanmode;
u16 minscantime;
u16 maxscantime;
__le16 minscantime;
__le16 maxscantime;
} __attribute__ ((packed));
struct mrvlietypes_chanlistparamset {
......@@ -185,12 +214,12 @@ struct mrvlietypes_chanlistparamset {
struct cfparamset {
u8 cfpcnt;
u8 cfpperiod;
u16 cfpmaxduration;
u16 cfpdurationremaining;
__le16 cfpmaxduration;
__le16 cfpdurationremaining;
} __attribute__ ((packed));
struct ibssparamset {
u16 atimwindow;
__le16 atimwindow;
} __attribute__ ((packed));
struct mrvlietypes_ssparamset {
......@@ -202,7 +231,7 @@ struct mrvlietypes_ssparamset {
} __attribute__ ((packed));
struct fhparamset {
u16 dwelltime;
__le16 dwelltime;
u8 hopset;
u8 hoppattern;
u8 hopindex;
......@@ -263,17 +292,17 @@ struct mrvlietypes_beaconsmissed {
struct mrvlietypes_numprobes {
struct mrvlietypesheader header;
u16 numprobes;
__le16 numprobes;
} __attribute__ ((packed));
struct mrvlietypes_bcastprobe {
struct mrvlietypesheader header;
u16 bcastprobe;
__le16 bcastprobe;
} __attribute__ ((packed));
struct mrvlietypes_numssidprobe {
struct mrvlietypesheader header;
u16 numssidprobe;
__le16 numssidprobe;
} __attribute__ ((packed));
struct led_pin {
......
......@@ -402,7 +402,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
int ret = 0;
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
int rthr = vwrq->value;
u32 rthr = vwrq->value;
lbs_deb_enter(LBS_DEB_WEXT);
......@@ -452,7 +452,7 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra)
{
int ret = 0;
int fthr = vwrq->value;
u32 fthr = vwrq->value;
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
......@@ -1115,7 +1115,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
/* Quality by TX errors */
priv->wstats.discard.retries = priv->stats.tx_errors;
tx_retries = adapter->logmsg.retry;
tx_retries = le16_to_cpu(adapter->logmsg.retry);
if (tx_retries > 75)
tx_qual = (90 - tx_retries) * POOR / 15;
......@@ -1131,10 +1131,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
(PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
quality = min(quality, tx_qual);
priv->wstats.discard.code = adapter->logmsg.wepundecryptable;
priv->wstats.discard.fragment = adapter->logmsg.rxfrag;
priv->wstats.discard.code = le16_to_cpu(adapter->logmsg.wepundecryptable);
priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag);
priv->wstats.discard.retries = tx_retries;
priv->wstats.discard.misc = adapter->logmsg.ackfailure;
priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure);
/* Calculate quality */
priv->wstats.qual.qual = max(quality, (u32)100);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment