Commit d0f63b20 authored by Luciano Coelho's avatar Luciano Coelho Committed by John W. Linville

wl1271: fix endianess issues

We were not handling endianess correctly.  The wl1271 chip runs on
little-endian values.  This patch makes sure that all the communication with
the wl1271 firmware is done in little-endian by using cpu_to_le* and
le*_to_cpu where appropriate.

Also, all the struct definitions for data exchanged with the firmware has
been changed to use __le16/32 types instead of u16/32.

This fixes a few sparse warnings, such as these:

drivers/net/wireless/wl12xx/wl1271_cmd.c:554:42: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:555:42: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:577:58: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:579:58: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:676:18: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:787:22: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:789:21: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_tx.c:98:47: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1271_acx.c:932:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_boot.c:191:32: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1271_boot.c:197:38: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1271_boot.c:199:37: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1271_init.c:255:40: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_init.c:275:53: warning: incorrect type in assignment (different base types)
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: default avatarJuuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0b5b72da
...@@ -283,15 +283,15 @@ struct wl1271_debugfs { ...@@ -283,15 +283,15 @@ struct wl1271_debugfs {
/* FW status registers */ /* FW status registers */
struct wl1271_fw_status { struct wl1271_fw_status {
u32 intr; __le32 intr;
u8 fw_rx_counter; u8 fw_rx_counter;
u8 drv_rx_counter; u8 drv_rx_counter;
u8 reserved; u8 reserved;
u8 tx_results_counter; u8 tx_results_counter;
u32 rx_pkt_descs[NUM_RX_PKT_DESC]; __le32 rx_pkt_descs[NUM_RX_PKT_DESC];
u32 tx_released_blks[NUM_TX_QUEUES]; __le32 tx_released_blks[NUM_TX_QUEUES];
u32 fw_localtime; __le32 fw_localtime;
u32 padding[2]; __le32 padding[2];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct wl1271_rx_mem_pool_addr { struct wl1271_rx_mem_pool_addr {
......
...@@ -210,7 +210,7 @@ int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl) ...@@ -210,7 +210,7 @@ int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl)
goto out; goto out;
} }
acx->lifetime = wl->conf.rx.rx_msdu_life_time; acx->lifetime = cpu_to_le32(wl->conf.rx.rx_msdu_life_time);
ret = wl1271_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME, ret = wl1271_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME,
acx, sizeof(*acx)); acx, sizeof(*acx));
if (ret < 0) { if (ret < 0) {
...@@ -236,8 +236,8 @@ int wl1271_acx_rx_config(struct wl1271 *wl, u32 config, u32 filter) ...@@ -236,8 +236,8 @@ int wl1271_acx_rx_config(struct wl1271 *wl, u32 config, u32 filter)
goto out; goto out;
} }
rx_config->config_options = config; rx_config->config_options = cpu_to_le32(config);
rx_config->filter_options = filter; rx_config->filter_options = cpu_to_le32(filter);
ret = wl1271_cmd_configure(wl, ACX_RX_CFG, ret = wl1271_cmd_configure(wl, ACX_RX_CFG,
rx_config, sizeof(*rx_config)); rx_config, sizeof(*rx_config));
...@@ -264,7 +264,7 @@ int wl1271_acx_pd_threshold(struct wl1271 *wl) ...@@ -264,7 +264,7 @@ int wl1271_acx_pd_threshold(struct wl1271 *wl)
goto out; goto out;
} }
pd->threshold = wl->conf.rx.packet_detection_threshold; pd->threshold = cpu_to_le32(wl->conf.rx.packet_detection_threshold);
ret = wl1271_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd)); ret = wl1271_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd));
if (ret < 0) { if (ret < 0) {
...@@ -348,8 +348,8 @@ int wl1271_acx_service_period_timeout(struct wl1271 *wl) ...@@ -348,8 +348,8 @@ int wl1271_acx_service_period_timeout(struct wl1271 *wl)
wl1271_debug(DEBUG_ACX, "acx service period timeout"); wl1271_debug(DEBUG_ACX, "acx service period timeout");
rx_timeout->ps_poll_timeout = wl->conf.rx.ps_poll_timeout; rx_timeout->ps_poll_timeout = cpu_to_le16(wl->conf.rx.ps_poll_timeout);
rx_timeout->upsd_timeout = wl->conf.rx.upsd_timeout; rx_timeout->upsd_timeout = cpu_to_le16(wl->conf.rx.upsd_timeout);
ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT, ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT,
rx_timeout, sizeof(*rx_timeout)); rx_timeout, sizeof(*rx_timeout));
...@@ -377,7 +377,7 @@ int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold) ...@@ -377,7 +377,7 @@ int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold)
goto out; goto out;
} }
rts->threshold = rts_threshold; rts->threshold = cpu_to_le16(rts_threshold);
ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts));
if (ret < 0) { if (ret < 0) {
...@@ -494,8 +494,8 @@ int wl1271_acx_conn_monit_params(struct wl1271 *wl) ...@@ -494,8 +494,8 @@ int wl1271_acx_conn_monit_params(struct wl1271 *wl)
goto out; goto out;
} }
acx->synch_fail_thold = wl->conf.conn.synch_fail_thold; acx->synch_fail_thold = cpu_to_le32(wl->conf.conn.synch_fail_thold);
acx->bss_lose_timeout = wl->conf.conn.bss_lose_timeout; acx->bss_lose_timeout = cpu_to_le32(wl->conf.conn.bss_lose_timeout);
ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS, ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS,
acx, sizeof(*acx)); acx, sizeof(*acx));
...@@ -552,16 +552,18 @@ int wl1271_acx_sg_cfg(struct wl1271 *wl) ...@@ -552,16 +552,18 @@ int wl1271_acx_sg_cfg(struct wl1271 *wl)
} }
/* BT-WLAN coext parameters */ /* BT-WLAN coext parameters */
param->per_threshold = c->per_threshold; param->per_threshold = cpu_to_le32(c->per_threshold);
param->max_scan_compensation_time = c->max_scan_compensation_time; param->max_scan_compensation_time =
param->nfs_sample_interval = c->nfs_sample_interval; cpu_to_le32(c->max_scan_compensation_time);
param->nfs_sample_interval = cpu_to_le16(c->nfs_sample_interval);
param->load_ratio = c->load_ratio; param->load_ratio = c->load_ratio;
param->auto_ps_mode = c->auto_ps_mode; param->auto_ps_mode = c->auto_ps_mode;
param->probe_req_compensation = c->probe_req_compensation; param->probe_req_compensation = c->probe_req_compensation;
param->scan_window_compensation = c->scan_window_compensation; param->scan_window_compensation = c->scan_window_compensation;
param->antenna_config = c->antenna_config; param->antenna_config = c->antenna_config;
param->beacon_miss_threshold = c->beacon_miss_threshold; param->beacon_miss_threshold = c->beacon_miss_threshold;
param->rate_adaptation_threshold = c->rate_adaptation_threshold; param->rate_adaptation_threshold =
cpu_to_le32(c->rate_adaptation_threshold);
param->rate_adaptation_snr = c->rate_adaptation_snr; param->rate_adaptation_snr = c->rate_adaptation_snr;
ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param)); ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param));
...@@ -588,7 +590,7 @@ int wl1271_acx_cca_threshold(struct wl1271 *wl) ...@@ -588,7 +590,7 @@ int wl1271_acx_cca_threshold(struct wl1271 *wl)
goto out; goto out;
} }
detection->rx_cca_threshold = wl->conf.rx.rx_cca_threshold; detection->rx_cca_threshold = cpu_to_le16(wl->conf.rx.rx_cca_threshold);
detection->tx_energy_detection = wl->conf.tx.tx_energy_detection; detection->tx_energy_detection = wl->conf.tx.tx_energy_detection;
ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD, ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD,
...@@ -616,8 +618,8 @@ int wl1271_acx_bcn_dtim_options(struct wl1271 *wl) ...@@ -616,8 +618,8 @@ int wl1271_acx_bcn_dtim_options(struct wl1271 *wl)
goto out; goto out;
} }
bb->beacon_rx_timeout = wl->conf.conn.beacon_rx_timeout; bb->beacon_rx_timeout = cpu_to_le16(wl->conf.conn.beacon_rx_timeout);
bb->broadcast_timeout = wl->conf.conn.broadcast_timeout; bb->broadcast_timeout = cpu_to_le16(wl->conf.conn.broadcast_timeout);
bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps; bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps;
bb->ps_poll_threshold = wl->conf.conn.ps_poll_threshold; bb->ps_poll_threshold = wl->conf.conn.ps_poll_threshold;
...@@ -645,7 +647,7 @@ int wl1271_acx_aid(struct wl1271 *wl, u16 aid) ...@@ -645,7 +647,7 @@ int wl1271_acx_aid(struct wl1271 *wl, u16 aid)
goto out; goto out;
} }
acx_aid->aid = aid; acx_aid->aid = cpu_to_le16(aid);
ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid)); ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid));
if (ret < 0) { if (ret < 0) {
...@@ -672,9 +674,8 @@ int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask) ...@@ -672,9 +674,8 @@ int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask)
} }
/* high event mask is unused */ /* high event mask is unused */
mask->high_event_mask = 0xffffffff; mask->high_event_mask = cpu_to_le32(0xffffffff);
mask->event_mask = cpu_to_le32(event_mask);
mask->event_mask = event_mask;
ret = wl1271_cmd_configure(wl, ACX_EVENT_MBOX_MASK, ret = wl1271_cmd_configure(wl, ACX_EVENT_MBOX_MASK,
mask, sizeof(*mask)); mask, sizeof(*mask));
...@@ -773,8 +774,8 @@ int wl1271_acx_rate_policies(struct wl1271 *wl, u32 enabled_rates) ...@@ -773,8 +774,8 @@ int wl1271_acx_rate_policies(struct wl1271 *wl, u32 enabled_rates)
} }
/* configure one default (one-size-fits-all) rate class */ /* configure one default (one-size-fits-all) rate class */
acx->rate_class_cnt = 1; acx->rate_class_cnt = cpu_to_le32(1);
acx->rate_class[0].enabled_rates = enabled_rates; acx->rate_class[0].enabled_rates = cpu_to_le32(enabled_rates);
acx->rate_class[0].short_retry_limit = c->short_retry_limit; acx->rate_class[0].short_retry_limit = c->short_retry_limit;
acx->rate_class[0].long_retry_limit = c->long_retry_limit; acx->rate_class[0].long_retry_limit = c->long_retry_limit;
acx->rate_class[0].aflags = c->aflags; acx->rate_class[0].aflags = c->aflags;
...@@ -808,10 +809,10 @@ int wl1271_acx_ac_cfg(struct wl1271 *wl) ...@@ -808,10 +809,10 @@ int wl1271_acx_ac_cfg(struct wl1271 *wl)
struct conf_tx_ac_category *c = &(wl->conf.tx.ac_conf[i]); struct conf_tx_ac_category *c = &(wl->conf.tx.ac_conf[i]);
acx->ac = c->ac; acx->ac = c->ac;
acx->cw_min = c->cw_min; acx->cw_min = c->cw_min;
acx->cw_max = c->cw_max; acx->cw_max = cpu_to_le16(c->cw_max);
acx->aifsn = c->aifsn; acx->aifsn = c->aifsn;
acx->reserved = 0; acx->reserved = 0;
acx->tx_op_limit = c->tx_op_limit; acx->tx_op_limit = cpu_to_le16(c->tx_op_limit);
ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx)); ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx));
if (ret < 0) { if (ret < 0) {
...@@ -847,8 +848,8 @@ int wl1271_acx_tid_cfg(struct wl1271 *wl) ...@@ -847,8 +848,8 @@ int wl1271_acx_tid_cfg(struct wl1271 *wl)
acx->tsid = c->tsid; acx->tsid = c->tsid;
acx->ps_scheme = c->ps_scheme; acx->ps_scheme = c->ps_scheme;
acx->ack_policy = c->ack_policy; acx->ack_policy = c->ack_policy;
acx->apsd_conf[0] = c->apsd_conf[0]; acx->apsd_conf[0] = cpu_to_le32(c->apsd_conf[0]);
acx->apsd_conf[1] = c->apsd_conf[1]; acx->apsd_conf[1] = cpu_to_le32(c->apsd_conf[1]);
ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx)); ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx));
if (ret < 0) { if (ret < 0) {
...@@ -876,7 +877,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl) ...@@ -876,7 +877,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl)
goto out; goto out;
} }
acx->frag_threshold = wl->conf.tx.frag_threshold; acx->frag_threshold = cpu_to_le16(wl->conf.tx.frag_threshold);
ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx)); ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx));
if (ret < 0) { if (ret < 0) {
wl1271_warning("Setting of frag threshold failed: %d", ret); wl1271_warning("Setting of frag threshold failed: %d", ret);
...@@ -902,8 +903,8 @@ int wl1271_acx_tx_config_options(struct wl1271 *wl) ...@@ -902,8 +903,8 @@ int wl1271_acx_tx_config_options(struct wl1271 *wl)
goto out; goto out;
} }
acx->tx_compl_timeout = wl->conf.tx.tx_compl_timeout; acx->tx_compl_timeout = cpu_to_le16(wl->conf.tx.tx_compl_timeout);
acx->tx_compl_threshold = wl->conf.tx.tx_compl_threshold; acx->tx_compl_threshold = cpu_to_le16(wl->conf.tx.tx_compl_threshold);
ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx)); ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx));
if (ret < 0) { if (ret < 0) {
wl1271_warning("Setting of tx options failed: %d", ret); wl1271_warning("Setting of tx options failed: %d", ret);
...@@ -929,11 +930,11 @@ int wl1271_acx_mem_cfg(struct wl1271 *wl) ...@@ -929,11 +930,11 @@ int wl1271_acx_mem_cfg(struct wl1271 *wl)
} }
/* memory config */ /* memory config */
mem_conf->num_stations = cpu_to_le16(DEFAULT_NUM_STATIONS); mem_conf->num_stations = DEFAULT_NUM_STATIONS;
mem_conf->rx_mem_block_num = ACX_RX_MEM_BLOCKS; mem_conf->rx_mem_block_num = ACX_RX_MEM_BLOCKS;
mem_conf->tx_min_mem_block_num = ACX_TX_MIN_MEM_BLOCKS; mem_conf->tx_min_mem_block_num = ACX_TX_MIN_MEM_BLOCKS;
mem_conf->num_ssid_profiles = ACX_NUM_SSID_PROFILES; mem_conf->num_ssid_profiles = ACX_NUM_SSID_PROFILES;
mem_conf->total_tx_descriptors = ACX_TX_DESCRIPTORS; mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS);
ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf, ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf,
sizeof(*mem_conf)); sizeof(*mem_conf));
...@@ -973,7 +974,8 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl) ...@@ -973,7 +974,8 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl)
} }
/* initialize TX block book keeping */ /* initialize TX block book keeping */
wl->tx_blocks_available = wl->target_mem_map->num_tx_mem_blocks; wl->tx_blocks_available =
le32_to_cpu(wl->target_mem_map->num_tx_mem_blocks);
wl1271_debug(DEBUG_TX, "available tx blocks: %d", wl1271_debug(DEBUG_TX, "available tx blocks: %d",
wl->tx_blocks_available); wl->tx_blocks_available);
...@@ -993,9 +995,9 @@ int wl1271_acx_init_rx_interrupt(struct wl1271 *wl) ...@@ -993,9 +995,9 @@ int wl1271_acx_init_rx_interrupt(struct wl1271 *wl)
goto out; goto out;
} }
rx_conf->threshold = wl->conf.rx.irq_pkt_threshold; rx_conf->threshold = cpu_to_le16(wl->conf.rx.irq_pkt_threshold);
rx_conf->timeout = wl->conf.rx.irq_timeout; rx_conf->timeout = cpu_to_le16(wl->conf.rx.irq_timeout);
rx_conf->mblk_threshold = wl->conf.rx.irq_blk_threshold; rx_conf->mblk_threshold = cpu_to_le16(wl->conf.rx.irq_blk_threshold);
rx_conf->queue_type = wl->conf.rx.queue_type; rx_conf->queue_type = wl->conf.rx.queue_type;
ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf, ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf,
......
This diff is collapsed.
...@@ -188,15 +188,15 @@ static int wl1271_boot_upload_firmware(struct wl1271 *wl) ...@@ -188,15 +188,15 @@ static int wl1271_boot_upload_firmware(struct wl1271 *wl)
u8 *fw; u8 *fw;
fw = wl->fw; fw = wl->fw;
chunks = be32_to_cpup((u32 *) fw); chunks = be32_to_cpup((__be32 *) fw);
fw += sizeof(u32); fw += sizeof(u32);
wl1271_debug(DEBUG_BOOT, "firmware chunks to be uploaded: %u", chunks); wl1271_debug(DEBUG_BOOT, "firmware chunks to be uploaded: %u", chunks);
while (chunks--) { while (chunks--) {
addr = be32_to_cpup((u32 *) fw); addr = be32_to_cpup((__be32 *) fw);
fw += sizeof(u32); fw += sizeof(u32);
len = be32_to_cpup((u32 *) fw); len = be32_to_cpup((__be32 *) fw);
fw += sizeof(u32); fw += sizeof(u32);
if (len > 300000) { if (len > 300000) {
......
...@@ -50,7 +50,7 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len) ...@@ -50,7 +50,7 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len)
int ret = 0; int ret = 0;
cmd = buf; cmd = buf;
cmd->id = id; cmd->id = cpu_to_le16(id);
cmd->status = 0; cmd->status = 0;
WARN_ON(len % 4 != 0); WARN_ON(len % 4 != 0);
...@@ -217,8 +217,8 @@ int wl1271_cmd_join(struct wl1271 *wl) ...@@ -217,8 +217,8 @@ int wl1271_cmd_join(struct wl1271 *wl)
for (i = 0; i < ETH_ALEN; i++) for (i = 0; i < ETH_ALEN; i++)
bssid[i] = wl->bssid[ETH_ALEN - i - 1]; bssid[i] = wl->bssid[ETH_ALEN - i - 1];
join->rx_config_options = wl->rx_config; join->rx_config_options = cpu_to_le32(wl->rx_config);
join->rx_filter_options = wl->rx_filter; join->rx_filter_options = cpu_to_le32(wl->rx_filter);
join->bss_type = wl->bss_type; join->bss_type = wl->bss_type;
/* /*
...@@ -227,21 +227,22 @@ int wl1271_cmd_join(struct wl1271 *wl) ...@@ -227,21 +227,22 @@ int wl1271_cmd_join(struct wl1271 *wl)
* association. The filter logic needs to be implemented properly * association. The filter logic needs to be implemented properly
* and once that is done, this hack can be removed. * and once that is done, this hack can be removed.
*/ */
join->rx_config_options = 0; join->rx_config_options = cpu_to_le32(0);
join->rx_filter_options = WL1271_DEFAULT_RX_FILTER; join->rx_filter_options = cpu_to_le32(WL1271_DEFAULT_RX_FILTER);
if (wl->band == IEEE80211_BAND_2GHZ) if (wl->band == IEEE80211_BAND_2GHZ)
join->basic_rate_set = join->basic_rate_set = cpu_to_le32(CONF_HW_BIT_RATE_1MBPS |
CONF_HW_BIT_RATE_1MBPS | CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_2MBPS |
CONF_HW_BIT_RATE_5_5MBPS | CONF_HW_BIT_RATE_11MBPS; CONF_HW_BIT_RATE_5_5MBPS |
CONF_HW_BIT_RATE_11MBPS);
else { else {
join->bss_type |= WL1271_JOIN_CMD_BSS_TYPE_5GHZ; join->bss_type |= WL1271_JOIN_CMD_BSS_TYPE_5GHZ;
join->basic_rate_set = join->basic_rate_set = cpu_to_le32(CONF_HW_BIT_RATE_6MBPS |
CONF_HW_BIT_RATE_6MBPS | CONF_HW_BIT_RATE_12MBPS | CONF_HW_BIT_RATE_12MBPS |
CONF_HW_BIT_RATE_24MBPS; CONF_HW_BIT_RATE_24MBPS);
} }
join->beacon_interval = WL1271_DEFAULT_BEACON_INT; join->beacon_interval = cpu_to_le16(WL1271_DEFAULT_BEACON_INT);
join->dtim_interval = WL1271_DEFAULT_DTIM_PERIOD; join->dtim_interval = WL1271_DEFAULT_DTIM_PERIOD;
join->channel = wl->channel; join->channel = wl->channel;
...@@ -305,6 +306,7 @@ int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer) ...@@ -305,6 +306,7 @@ int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer)
if (answer) { if (answer) {
struct wl1271_command *cmd_answer; struct wl1271_command *cmd_answer;
u16 status;
/* /*
* The test command got in, we can read the answer. * The test command got in, we can read the answer.
...@@ -314,10 +316,10 @@ int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer) ...@@ -314,10 +316,10 @@ int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer)
wl1271_spi_read(wl, wl->cmd_box_addr, buf, buf_len, false); wl1271_spi_read(wl, wl->cmd_box_addr, buf, buf_len, false);
cmd_answer = buf; cmd_answer = buf;
status = le16_to_cpu(cmd_answer->header.status);
if (cmd_answer->header.status != CMD_STATUS_SUCCESS) if (status != CMD_STATUS_SUCCESS)
wl1271_error("TEST command answer error: %d", wl1271_error("TEST command answer error: %d", status);
cmd_answer->header.status);
} }
return 0; return 0;
...@@ -338,10 +340,10 @@ int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len) ...@@ -338,10 +340,10 @@ int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len)
wl1271_debug(DEBUG_CMD, "cmd interrogate"); wl1271_debug(DEBUG_CMD, "cmd interrogate");
acx->id = id; acx->id = cpu_to_le16(id);
/* payload length, does not include any headers */ /* payload length, does not include any headers */
acx->len = len - sizeof(*acx); acx->len = cpu_to_le16(len - sizeof(*acx));
ret = wl1271_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx)); ret = wl1271_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx));
if (ret < 0) { if (ret < 0) {
...@@ -353,9 +355,9 @@ int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len) ...@@ -353,9 +355,9 @@ int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len)
wl1271_spi_read(wl, wl->cmd_box_addr, buf, len, false); wl1271_spi_read(wl, wl->cmd_box_addr, buf, len, false);
acx = buf; acx = buf;
if (acx->cmd.status != CMD_STATUS_SUCCESS) if (le16_to_cpu(acx->cmd.status) != CMD_STATUS_SUCCESS)
wl1271_error("INTERROGATE command error: %d", wl1271_error("INTERROGATE command error: %d",
acx->cmd.status); le16_to_cpu(acx->cmd.status));
out: out:
return ret; return ret;
...@@ -376,10 +378,10 @@ int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len) ...@@ -376,10 +378,10 @@ int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len)
wl1271_debug(DEBUG_CMD, "cmd configure"); wl1271_debug(DEBUG_CMD, "cmd configure");
acx->id = id; acx->id = cpu_to_le16(id);
/* payload length, does not include any headers */ /* payload length, does not include any headers */
acx->len = len - sizeof(*acx); acx->len = cpu_to_le16(len - sizeof(*acx));
ret = wl1271_cmd_send(wl, CMD_CONFIGURE, acx, len); ret = wl1271_cmd_send(wl, CMD_CONFIGURE, acx, len);
if (ret < 0) { if (ret < 0) {
...@@ -463,7 +465,7 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode) ...@@ -463,7 +465,7 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode)
ps_params->send_null_data = 1; ps_params->send_null_data = 1;
ps_params->retries = 5; ps_params->retries = 5;
ps_params->hang_over_period = 128; ps_params->hang_over_period = 128;
ps_params->null_data_rate = 1; /* 1 Mbps */ ps_params->null_data_rate = cpu_to_le32(1); /* 1 Mbps */
ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params,
sizeof(*ps_params)); sizeof(*ps_params));
...@@ -494,8 +496,8 @@ int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, ...@@ -494,8 +496,8 @@ int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
WARN_ON(len > MAX_READ_SIZE); WARN_ON(len > MAX_READ_SIZE);
len = min_t(size_t, len, MAX_READ_SIZE); len = min_t(size_t, len, MAX_READ_SIZE);
cmd->addr = addr; cmd->addr = cpu_to_le32(addr);
cmd->size = len; cmd->size = cpu_to_le32(len);
ret = wl1271_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd)); ret = wl1271_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd));
if (ret < 0) { if (ret < 0) {
...@@ -506,9 +508,9 @@ int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, ...@@ -506,9 +508,9 @@ int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
/* the read command got in, we can now read the answer */ /* the read command got in, we can now read the answer */
wl1271_spi_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd), false); wl1271_spi_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd), false);
if (cmd->header.status != CMD_STATUS_SUCCESS) if (le16_to_cpu(cmd->header.status) != CMD_STATUS_SUCCESS)
wl1271_error("error in read command result: %d", wl1271_error("error in read command result: %d",
cmd->header.status); le16_to_cpu(cmd->header.status));
memcpy(answer, cmd->value, len); memcpy(answer, cmd->value, len);
...@@ -559,7 +561,7 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len, ...@@ -559,7 +561,7 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len,
scan_options |= WL1271_SCAN_OPT_PASSIVE; scan_options |= WL1271_SCAN_OPT_PASSIVE;
if (high_prio) if (high_prio)
scan_options |= WL1271_SCAN_OPT_PRIORITY_HIGH; scan_options |= WL1271_SCAN_OPT_PRIORITY_HIGH;
params->params.scan_options = scan_options; params->params.scan_options = cpu_to_le16(scan_options);
params->params.num_probe_requests = probe_requests; params->params.num_probe_requests = probe_requests;
/* Let the fw autodetect suitable tx_rate for probes */ /* Let the fw autodetect suitable tx_rate for probes */
...@@ -643,9 +645,9 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len, ...@@ -643,9 +645,9 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len,
wl1271_spi_read(wl, wl->cmd_box_addr, params, sizeof(*params), wl1271_spi_read(wl, wl->cmd_box_addr, params, sizeof(*params),
false); false);
if (params->header.status != CMD_STATUS_SUCCESS) { if (le16_to_cpu(params->header.status) != CMD_STATUS_SUCCESS) {
wl1271_error("Scan command error: %d", wl1271_error("Scan command error: %d",
params->header.status); le16_to_cpu(params->header.status));
wl->scanning = false; wl->scanning = false;
ret = -EIO; ret = -EIO;
goto out; goto out;
...@@ -675,7 +677,7 @@ int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, ...@@ -675,7 +677,7 @@ int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
cmd->len = cpu_to_le16(buf_len); cmd->len = cpu_to_le16(buf_len);
cmd->template_type = template_id; cmd->template_type = template_id;
cmd->enabled_rates = wl->conf.tx.rc_conf.enabled_rates; cmd->enabled_rates = cpu_to_le32(wl->conf.tx.rc_conf.enabled_rates);
cmd->short_retry_limit = wl->conf.tx.rc_conf.short_retry_limit; cmd->short_retry_limit = wl->conf.tx.rc_conf.short_retry_limit;
cmd->long_retry_limit = wl->conf.tx.rc_conf.long_retry_limit; cmd->long_retry_limit = wl->conf.tx.rc_conf.long_retry_limit;
...@@ -858,7 +860,7 @@ int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id) ...@@ -858,7 +860,7 @@ int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id)
} }
cmd->id = id; cmd->id = id;
cmd->key_action = KEY_SET_ID; cmd->key_action = cpu_to_le16(KEY_SET_ID);
cmd->key_type = KEY_WEP; cmd->key_type = KEY_WEP;
ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd)); ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd));
...@@ -889,12 +891,12 @@ int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, ...@@ -889,12 +891,12 @@ int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
if (key_type != KEY_WEP) if (key_type != KEY_WEP)
memcpy(cmd->addr, addr, ETH_ALEN); memcpy(cmd->addr, addr, ETH_ALEN);
cmd->key_action = action; cmd->key_action = cpu_to_le16(action);
cmd->key_size = key_size; cmd->key_size = key_size;
cmd->key_type = key_type; cmd->key_type = key_type;
cmd->ac_seq_num16[0] = tx_seq_16; cmd->ac_seq_num16[0] = cpu_to_le16(tx_seq_16);
cmd->ac_seq_num32[0] = tx_seq_32; cmd->ac_seq_num32[0] = cpu_to_le32(tx_seq_32);
/* we have only one SSID profile */ /* we have only one SSID profile */
cmd->ssid_profile = 0; cmd->ssid_profile = 0;
...@@ -943,8 +945,8 @@ int wl1271_cmd_disconnect(struct wl1271 *wl) ...@@ -943,8 +945,8 @@ int wl1271_cmd_disconnect(struct wl1271 *wl)
goto out; goto out;
} }
cmd->rx_config_options = wl->rx_config; cmd->rx_config_options = cpu_to_le32(wl->rx_config);
cmd->rx_filter_options = wl->rx_filter; cmd->rx_filter_options = cpu_to_le32(wl->rx_filter);
/* disconnect reason is not used in immediate disconnections */ /* disconnect reason is not used in immediate disconnections */
cmd->type = DISCONNECT_IMMEDIATE; cmd->type = DISCONNECT_IMMEDIATE;
......
...@@ -120,8 +120,8 @@ enum cmd_templ { ...@@ -120,8 +120,8 @@ enum cmd_templ {
#define WL1271_CMD_TEMPL_MAX_SIZE 252 #define WL1271_CMD_TEMPL_MAX_SIZE 252
struct wl1271_cmd_header { struct wl1271_cmd_header {
u16 id; __le16 id;
u16 status; __le16 status;
/* payload */ /* payload */
u8 data[0]; u8 data[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -174,11 +174,11 @@ struct cmd_read_write_memory { ...@@ -174,11 +174,11 @@ struct cmd_read_write_memory {
struct wl1271_cmd_header header; struct wl1271_cmd_header header;
/* The address of the memory to read from or write to.*/ /* The address of the memory to read from or write to.*/
u32 addr; __le32 addr;
/* The amount of data in bytes to read from or write to the WiLink /* The amount of data in bytes to read from or write to the WiLink
* device.*/ * device.*/
u32 size; __le32 size;
/* The actual value read from or written to the Wilink. The source /* The actual value read from or written to the Wilink. The source
of this field is the Host in WRITE command or the Wilink in READ of this field is the Host in WRITE command or the Wilink in READ
...@@ -203,18 +203,18 @@ enum { ...@@ -203,18 +203,18 @@ enum {
struct wl1271_cmd_join { struct wl1271_cmd_join {
struct wl1271_cmd_header header; struct wl1271_cmd_header header;
u32 bssid_lsb; __le32 bssid_lsb;
u16 bssid_msb; __le16 bssid_msb;
u16 beacon_interval; /* in TBTTs */ __le16 beacon_interval; /* in TBTTs */
u32 rx_config_options; __le32 rx_config_options;
u32 rx_filter_options; __le32 rx_filter_options;
/* /*
* The target uses this field to determine the rate at * The target uses this field to determine the rate at
* which to transmit control frame responses (such as * which to transmit control frame responses (such as
* ACK or CTS frames). * ACK or CTS frames).
*/ */
u32 basic_rate_set; __le32 basic_rate_set;
u8 dtim_interval; u8 dtim_interval;
/* /*
* bits 0-2: This bitwise field specifies the type * bits 0-2: This bitwise field specifies the type
...@@ -243,10 +243,10 @@ struct cmd_enabledisable_path { ...@@ -243,10 +243,10 @@ struct cmd_enabledisable_path {
struct wl1271_cmd_template_set { struct wl1271_cmd_template_set {
struct wl1271_cmd_header header; struct wl1271_cmd_header header;
u16 len; __le16 len;
u8 template_type; u8 template_type;
u8 index; /* relevant only for KLV_TEMPLATE type */ u8 index; /* relevant only for KLV_TEMPLATE type */
u32 enabled_rates; __le32 enabled_rates;
u8 short_retry_limit; u8 short_retry_limit;
u8 long_retry_limit; u8 long_retry_limit;
u8 aflags; u8 aflags;
...@@ -283,7 +283,7 @@ struct wl1271_cmd_ps_params { ...@@ -283,7 +283,7 @@ struct wl1271_cmd_ps_params {
* to power save mode. * to power save mode.
*/ */
u8 hang_over_period; u8 hang_over_period;
u32 null_data_rate; __le32 null_data_rate;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* HW encryption keys */ /* HW encryption keys */
...@@ -314,9 +314,9 @@ struct wl1271_cmd_set_keys { ...@@ -314,9 +314,9 @@ struct wl1271_cmd_set_keys {
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
/* key_action_e */ /* key_action_e */
u16 key_action; __le16 key_action;
u16 reserved_1; __le16 reserved_1;
/* key size in bytes */ /* key size in bytes */
u8 key_size; u8 key_size;
...@@ -332,8 +332,8 @@ struct wl1271_cmd_set_keys { ...@@ -332,8 +332,8 @@ struct wl1271_cmd_set_keys {
u8 id; u8 id;
u8 reserved_2[6]; u8 reserved_2[6];
u8 key[MAX_KEY_SIZE]; u8 key[MAX_KEY_SIZE];
u16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY]; __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
u32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY]; __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -350,17 +350,17 @@ struct wl1271_cmd_set_keys { ...@@ -350,17 +350,17 @@ struct wl1271_cmd_set_keys {
#define WL1271_SCAN_BAND_DUAL 2 #define WL1271_SCAN_BAND_DUAL 2
struct basic_scan_params { struct basic_scan_params {
u32 rx_config_options; __le32 rx_config_options;
u32 rx_filter_options; __le32 rx_filter_options;
/* Scan option flags (WL1271_SCAN_OPT_*) */ /* Scan option flags (WL1271_SCAN_OPT_*) */
u16 scan_options; __le16 scan_options;
/* Number of scan channels in the list (maximum 30) */ /* Number of scan channels in the list (maximum 30) */
u8 num_channels; u8 num_channels;
/* This field indicates the number of probe requests to send /* This field indicates the number of probe requests to send
per channel for an active scan */ per channel for an active scan */
u8 num_probe_requests; u8 num_probe_requests;
/* Rate bit field for sending the probes */ /* Rate bit field for sending the probes */
u32 tx_rate; __le32 tx_rate;
u8 tid_trigger; u8 tid_trigger;
u8 ssid_len; u8 ssid_len;
/* in order to align */ /* in order to align */
...@@ -375,10 +375,10 @@ struct basic_scan_params { ...@@ -375,10 +375,10 @@ struct basic_scan_params {
struct basic_scan_channel_params { struct basic_scan_channel_params {
/* Duration in TU to wait for frames on a channel for active scan */ /* Duration in TU to wait for frames on a channel for active scan */
u32 min_duration; __le32 min_duration;
u32 max_duration; __le32 max_duration;
u32 bssid_lsb; __le32 bssid_lsb;
u16 bssid_msb; __le16 bssid_msb;
u8 early_termination; u8 early_termination;
u8 tx_power_att; u8 tx_power_att;
u8 channel; u8 channel;
...@@ -398,7 +398,7 @@ struct wl1271_cmd_scan { ...@@ -398,7 +398,7 @@ struct wl1271_cmd_scan {
struct wl1271_cmd_trigger_scan_to { struct wl1271_cmd_trigger_scan_to {
struct wl1271_cmd_header header; struct wl1271_cmd_header header;
u32 timeout; __le32 timeout;
}; };
struct wl1271_cmd_test_header { struct wl1271_cmd_test_header {
...@@ -426,7 +426,7 @@ struct wl1271_cmd_cal_channel_tune { ...@@ -426,7 +426,7 @@ struct wl1271_cmd_cal_channel_tune {
u8 band; u8 band;
u8 channel; u8 channel;
u16 radio_status; __le16 radio_status;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct wl1271_cmd_cal_update_ref_point { struct wl1271_cmd_cal_update_ref_point {
...@@ -434,8 +434,8 @@ struct wl1271_cmd_cal_update_ref_point { ...@@ -434,8 +434,8 @@ struct wl1271_cmd_cal_update_ref_point {
struct wl1271_cmd_test_header test; struct wl1271_cmd_test_header test;
s32 ref_power; __le32 ref_power;
s32 ref_detector; __le32 ref_detector;
u8 sub_band; u8 sub_band;
u8 padding[3]; u8 padding[3];
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -450,12 +450,12 @@ struct wl1271_cmd_cal_p2g { ...@@ -450,12 +450,12 @@ struct wl1271_cmd_cal_p2g {
struct wl1271_cmd_test_header test; struct wl1271_cmd_test_header test;
u16 len; __le16 len;
u8 buf[MAX_TLV_LENGTH]; u8 buf[MAX_TLV_LENGTH];
u8 type; u8 type;
u8 padding; u8 padding;
s16 radio_status; __le16 radio_status;
u8 nvs_version[MAX_NVS_VERSION_LENGTH]; u8 nvs_version[MAX_NVS_VERSION_LENGTH];
u8 sub_band_mask; u8 sub_band_mask;
...@@ -479,10 +479,10 @@ enum wl1271_disconnect_type { ...@@ -479,10 +479,10 @@ enum wl1271_disconnect_type {
}; };
struct wl1271_cmd_disconnect { struct wl1271_cmd_disconnect {
u32 rx_config_options; __le32 rx_config_options;
u32 rx_filter_options; __le32 rx_filter_options;
u16 reason; __le16 reason;
u8 type; u8 type;
u8 padding; u8 padding;
......
...@@ -82,7 +82,8 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox) ...@@ -82,7 +82,8 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
wl1271_event_mbox_dump(mbox); wl1271_event_mbox_dump(mbox);
vector = mbox->events_vector & ~(mbox->events_mask); vector = le32_to_cpu(mbox->events_vector);
vector &= ~(le32_to_cpu(mbox->events_mask));
wl1271_debug(DEBUG_EVENT, "vector: 0x%x", vector); wl1271_debug(DEBUG_EVENT, "vector: 0x%x", vector);
if (vector & SCAN_COMPLETE_EVENT_ID) { if (vector & SCAN_COMPLETE_EVENT_ID) {
......
...@@ -66,33 +66,33 @@ enum { ...@@ -66,33 +66,33 @@ enum {
struct event_debug_report { struct event_debug_report {
u8 debug_event_id; u8 debug_event_id;
u8 num_params; u8 num_params;
u16 pad; __le16 pad;
u32 report_1; __le32 report_1;
u32 report_2; __le32 report_2;
u32 report_3; __le32 report_3;
} __attribute__ ((packed)); } __attribute__ ((packed));
#define NUM_OF_RSSI_SNR_TRIGGERS 8 #define NUM_OF_RSSI_SNR_TRIGGERS 8
struct event_mailbox { struct event_mailbox {
u32 events_vector; __le32 events_vector;
u32 events_mask; __le32 events_mask;
u32 reserved_1; __le32 reserved_1;
u32 reserved_2; __le32 reserved_2;
u8 dbg_event_id; u8 dbg_event_id;
u8 num_relevant_params; u8 num_relevant_params;
u16 reserved_3; __le16 reserved_3;
u32 event_report_p1; __le32 event_report_p1;
u32 event_report_p2; __le32 event_report_p2;
u32 event_report_p3; __le32 event_report_p3;
u8 number_of_scan_results; u8 number_of_scan_results;
u8 scan_tag; u8 scan_tag;
u8 reserved_4[2]; u8 reserved_4[2];
u32 compl_scheduled_scan_status; __le32 compl_scheduled_scan_status;
u16 scheduled_scan_attended_channels; __le16 scheduled_scan_attended_channels;
u8 soft_gemini_sense_info; u8 soft_gemini_sense_info;
u8 soft_gemini_protective_info; u8 soft_gemini_protective_info;
s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS]; s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS];
......
...@@ -65,7 +65,7 @@ struct wl1271_radio_parms { ...@@ -65,7 +65,7 @@ struct wl1271_radio_parms {
/* Dynamic radio parameters */ /* Dynamic radio parameters */
/* 2.4GHz */ /* 2.4GHz */
s16 tx_ref_pd_voltage; __le16 tx_ref_pd_voltage;
s8 tx_ref_power; s8 tx_ref_power;
s8 tx_offset_db; s8 tx_offset_db;
...@@ -82,7 +82,7 @@ struct wl1271_radio_parms { ...@@ -82,7 +82,7 @@ struct wl1271_radio_parms {
u8 padding2; u8 padding2;
/* 5GHz */ /* 5GHz */
s16 tx_ref_pd_voltage_5[CONF_NUMBER_OF_SUB_BANDS_5]; __le16 tx_ref_pd_voltage_5[CONF_NUMBER_OF_SUB_BANDS_5];
s8 tx_ref_power_5[CONF_NUMBER_OF_SUB_BANDS_5]; s8 tx_ref_power_5[CONF_NUMBER_OF_SUB_BANDS_5];
s8 tx_offset_db_5[CONF_NUMBER_OF_SUB_BANDS_5]; s8 tx_offset_db_5[CONF_NUMBER_OF_SUB_BANDS_5];
......
...@@ -397,8 +397,11 @@ static void wl1271_fw_status(struct wl1271 *wl, ...@@ -397,8 +397,11 @@ static void wl1271_fw_status(struct wl1271 *wl,
/* update number of available TX blocks */ /* update number of available TX blocks */
for (i = 0; i < NUM_TX_QUEUES; i++) { for (i = 0; i < NUM_TX_QUEUES; i++) {
u32 cnt = status->tx_released_blks[i] - wl->tx_blocks_freed[i]; u32 cnt = le32_to_cpu(status->tx_released_blks[i]) -
wl->tx_blocks_freed[i] = status->tx_released_blks[i]; wl->tx_blocks_freed[i];
wl->tx_blocks_freed[i] =
le32_to_cpu(status->tx_released_blks[i]);
wl->tx_blocks_available += cnt; wl->tx_blocks_available += cnt;
total += cnt; total += cnt;
} }
...@@ -408,7 +411,8 @@ static void wl1271_fw_status(struct wl1271 *wl, ...@@ -408,7 +411,8 @@ static void wl1271_fw_status(struct wl1271 *wl,
ieee80211_queue_work(wl->hw, &wl->tx_work); ieee80211_queue_work(wl->hw, &wl->tx_work);
/* update the host-chipset time offset */ /* update the host-chipset time offset */
wl->time_offset = jiffies_to_usecs(jiffies) - status->fw_localtime; wl->time_offset = jiffies_to_usecs(jiffies) -
le32_to_cpu(status->fw_localtime);
} }
static void wl1271_irq_work(struct work_struct *work) static void wl1271_irq_work(struct work_struct *work)
...@@ -432,7 +436,7 @@ static void wl1271_irq_work(struct work_struct *work) ...@@ -432,7 +436,7 @@ static void wl1271_irq_work(struct work_struct *work)
wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
wl1271_fw_status(wl, wl->fw_status); wl1271_fw_status(wl, wl->fw_status);
intr = wl->fw_status->intr; intr = le32_to_cpu(wl->fw_status->intr);
if (!intr) { if (!intr) {
wl1271_debug(DEBUG_IRQ, "Zero interrupt received."); wl1271_debug(DEBUG_IRQ, "Zero interrupt received.");
goto out_sleep; goto out_sleep;
......
...@@ -30,14 +30,15 @@ ...@@ -30,14 +30,15 @@
static u8 wl1271_rx_get_mem_block(struct wl1271_fw_status *status, static u8 wl1271_rx_get_mem_block(struct wl1271_fw_status *status,
u32 drv_rx_counter) u32 drv_rx_counter)
{ {
return status->rx_pkt_descs[drv_rx_counter] & RX_MEM_BLOCK_MASK; return le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]) &
RX_MEM_BLOCK_MASK;
} }
static u32 wl1271_rx_get_buf_size(struct wl1271_fw_status *status, static u32 wl1271_rx_get_buf_size(struct wl1271_fw_status *status,
u32 drv_rx_counter) u32 drv_rx_counter)
{ {
return (status->rx_pkt_descs[drv_rx_counter] & RX_BUF_SIZE_MASK) >> return (le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]) &
RX_BUF_SIZE_SHIFT_DIV; RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV;
} }
/* The values of this table must match the wl1271_rates[] array */ /* The values of this table must match the wl1271_rates[] array */
...@@ -203,8 +204,8 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status) ...@@ -203,8 +204,8 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status)
break; break;
} }
wl->rx_mem_pool_addr.addr = wl->rx_mem_pool_addr.addr = (mem_block << 8) +
(mem_block << 8) + wl_mem_map->packet_memory_pool_start; le32_to_cpu(wl_mem_map->packet_memory_pool_start);
wl->rx_mem_pool_addr.addr_extra = wl->rx_mem_pool_addr.addr_extra =
wl->rx_mem_pool_addr.addr + 4; wl->rx_mem_pool_addr.addr + 4;
......
...@@ -102,14 +102,14 @@ ...@@ -102,14 +102,14 @@
#define RX_BUF_SIZE_SHIFT_DIV 6 #define RX_BUF_SIZE_SHIFT_DIV 6
struct wl1271_rx_descriptor { struct wl1271_rx_descriptor {
u16 length; __le16 length;
u8 status; u8 status;
u8 flags; u8 flags;
u8 rate; u8 rate;
u8 channel; u8 channel;
s8 rssi; s8 rssi;
u8 snr; u8 snr;
u32 timestamp; __le32 timestamp;
u8 packet_class; u8 packet_class;
u8 process_id; u8 process_id;
u8 pad_len; u8 pad_len;
......
...@@ -88,6 +88,7 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, ...@@ -88,6 +88,7 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
{ {
struct wl1271_tx_hw_descr *desc; struct wl1271_tx_hw_descr *desc;
int pad; int pad;
u16 tx_attr;
desc = (struct wl1271_tx_hw_descr *) skb->data; desc = (struct wl1271_tx_hw_descr *) skb->data;
...@@ -95,16 +96,17 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, ...@@ -95,16 +96,17 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
if (extra) { if (extra) {
void *framestart = skb->data + sizeof(*desc); void *framestart = skb->data + sizeof(*desc);
u16 fc = *(u16 *)(framestart + extra); u16 fc = *(u16 *)(framestart + extra);
int hdrlen = ieee80211_hdrlen(fc); int hdrlen = ieee80211_hdrlen(cpu_to_le16(fc));
memmove(framestart, framestart + extra, hdrlen); memmove(framestart, framestart + extra, hdrlen);
} }
/* configure packet life time */ /* configure packet life time */
desc->start_time = jiffies_to_usecs(jiffies) - wl->time_offset; desc->start_time = cpu_to_le32(jiffies_to_usecs(jiffies) -
desc->life_time = TX_HW_MGMT_PKT_LIFETIME_TU; wl->time_offset);
desc->life_time = cpu_to_le16(TX_HW_MGMT_PKT_LIFETIME_TU);
/* configure the tx attributes */ /* configure the tx attributes */
desc->tx_attr = wl->session_counter << TX_HW_ATTR_OFST_SESSION_COUNTER; tx_attr = wl->session_counter << TX_HW_ATTR_OFST_SESSION_COUNTER;
/* FIXME: do we know the packet priority? can we identify mgmt /* FIXME: do we know the packet priority? can we identify mgmt
packets, and use max prio for them at least? */ packets, and use max prio for them at least? */
desc->tid = 0; desc->tid = 0;
...@@ -113,11 +115,13 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, ...@@ -113,11 +115,13 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
/* align the length (and store in terms of words) */ /* align the length (and store in terms of words) */
pad = WL1271_TX_ALIGN(skb->len); pad = WL1271_TX_ALIGN(skb->len);
desc->length = pad >> 2; desc->length = cpu_to_le16(pad >> 2);
/* calculate number of padding bytes */ /* calculate number of padding bytes */
pad = pad - skb->len; pad = pad - skb->len;
desc->tx_attr |= pad << TX_HW_ATTR_OFST_LAST_WORD_PAD; tx_attr |= pad << TX_HW_ATTR_OFST_LAST_WORD_PAD;
desc->tx_attr = cpu_to_le16(tx_attr);
wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d", pad); wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d", pad);
return 0; return 0;
...@@ -331,7 +335,7 @@ void wl1271_tx_complete(struct wl1271 *wl, u32 count) ...@@ -331,7 +335,7 @@ void wl1271_tx_complete(struct wl1271 *wl, u32 count)
wl1271_debug(DEBUG_TX, "tx_complete received, packets: %d", count); wl1271_debug(DEBUG_TX, "tx_complete received, packets: %d", count);
/* read the tx results from the chipset */ /* read the tx results from the chipset */
wl1271_spi_read(wl, memmap->tx_result, wl1271_spi_read(wl, le32_to_cpu(memmap->tx_result),
wl->tx_res_if, sizeof(*wl->tx_res_if), false); wl->tx_res_if, sizeof(*wl->tx_res_if), false);
/* verify that the result buffer is not getting overrun */ /* verify that the result buffer is not getting overrun */
...@@ -353,10 +357,10 @@ void wl1271_tx_complete(struct wl1271 *wl, u32 count) ...@@ -353,10 +357,10 @@ void wl1271_tx_complete(struct wl1271 *wl, u32 count)
} }
/* write host counter to chipset (to ack) */ /* write host counter to chipset (to ack) */
wl1271_spi_write32(wl, memmap->tx_result + wl1271_spi_write32(wl, le32_to_cpu(memmap->tx_result) +
offsetof(struct wl1271_tx_hw_res_if, offsetof(struct wl1271_tx_hw_res_if,
tx_result_host_counter), tx_result_host_counter),
wl->tx_res_if->tx_result_fw_counter); le32_to_cpu(wl->tx_res_if->tx_result_fw_counter));
} }
/* caller must hold wl->mutex */ /* caller must hold wl->mutex */
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
struct wl1271_tx_hw_descr { struct wl1271_tx_hw_descr {
/* Length of packet in words, including descriptor+header+data */ /* Length of packet in words, including descriptor+header+data */
u16 length; __le16 length;
/* Number of extra memory blocks to allocate for this packet in /* Number of extra memory blocks to allocate for this packet in
addition to the number of blocks derived from the packet length */ addition to the number of blocks derived from the packet length */
u8 extra_mem_blocks; u8 extra_mem_blocks;
...@@ -67,12 +67,12 @@ struct wl1271_tx_hw_descr { ...@@ -67,12 +67,12 @@ struct wl1271_tx_hw_descr {
HW!! */ HW!! */
u8 total_mem_blocks; u8 total_mem_blocks;
/* Device time (in us) when the packet arrived to the driver */ /* Device time (in us) when the packet arrived to the driver */
u32 start_time; __le32 start_time;
/* Max delay in TUs until transmission. The last device time the /* Max delay in TUs until transmission. The last device time the
packet can be transmitted is: startTime+(1024*LifeTime) */ packet can be transmitted is: startTime+(1024*LifeTime) */
u16 life_time; __le16 life_time;
/* Bitwise fields - see TX_ATTR... definitions above. */ /* Bitwise fields - see TX_ATTR... definitions above. */
u16 tx_attr; __le16 tx_attr;
/* Packet identifier used also in the Tx-Result. */ /* Packet identifier used also in the Tx-Result. */
u8 id; u8 id;
/* The packet TID value (as User-Priority) */ /* The packet TID value (as User-Priority) */
...@@ -100,12 +100,12 @@ struct wl1271_tx_hw_res_descr { ...@@ -100,12 +100,12 @@ struct wl1271_tx_hw_res_descr {
several possible reasons for failure. */ several possible reasons for failure. */
u8 status; u8 status;
/* Total air access duration including all retrys and overheads.*/ /* Total air access duration including all retrys and overheads.*/
u16 medium_usage; __le16 medium_usage;
/* The time passed from host xfer to Tx-complete.*/ /* The time passed from host xfer to Tx-complete.*/
u32 fw_handling_time; __le32 fw_handling_time;
/* Total media delay /* Total media delay
(from 1st EDCA AIFS counter until TX Complete). */ (from 1st EDCA AIFS counter until TX Complete). */
u32 medium_delay; __le32 medium_delay;
/* LS-byte of last TKIP seq-num (saved per AC for recovery). */ /* LS-byte of last TKIP seq-num (saved per AC for recovery). */
u8 lsb_security_sequence_number; u8 lsb_security_sequence_number;
/* Retry count - number of transmissions without successful ACK.*/ /* Retry count - number of transmissions without successful ACK.*/
...@@ -118,8 +118,8 @@ struct wl1271_tx_hw_res_descr { ...@@ -118,8 +118,8 @@ struct wl1271_tx_hw_res_descr {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct wl1271_tx_hw_res_if { struct wl1271_tx_hw_res_if {
u32 tx_result_fw_counter; __le32 tx_result_fw_counter;
u32 tx_result_host_counter; __le32 tx_result_host_counter;
struct wl1271_tx_hw_res_descr tx_results_queue[TX_HW_RESULT_QUEUE_LEN]; struct wl1271_tx_hw_res_descr tx_results_queue[TX_HW_RESULT_QUEUE_LEN];
} __attribute__ ((packed)); } __attribute__ ((packed));
......
...@@ -122,8 +122,8 @@ struct wl12xx_null_data_template { ...@@ -122,8 +122,8 @@ struct wl12xx_null_data_template {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct wl12xx_ps_poll_template { struct wl12xx_ps_poll_template {
u16 fc; __le16 fc;
u16 aid; __le16 aid;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
u8 ta[ETH_ALEN]; u8 ta[ETH_ALEN];
} __attribute__ ((packed)); } __attribute__ ((packed));
......
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