aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2006-08-20 23:37:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-08-29 17:06:32 -0400
commit851ca2687e224b3ad82222d9788532a0eaa05a41 (patch)
treeb389ad3cd969f55180c8a69687e64182c3ab9d89 /drivers
parent39be0aaf20c832c50e5f0a975d13013a13650865 (diff)
[PATCH] ipw2200: Fix ipw2200 QOS parameters endian issue
Signed-off-by: Jackie Wu <jackie.wu@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ipw2200.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 946d5b4c8f75..04efe6930679 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -2279,7 +2279,7 @@ static int ipw_send_scan_abort(struct ipw_priv *priv)
2279static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) 2279static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens)
2280{ 2280{
2281 struct ipw_sensitivity_calib calib = { 2281 struct ipw_sensitivity_calib calib = {
2282 .beacon_rssi_raw = sens, 2282 .beacon_rssi_raw = cpu_to_le16(sens),
2283 }; 2283 };
2284 2284
2285 return ipw_send_cmd_pdu(priv, IPW_CMD_SENSITIVITY_CALIB, sizeof(calib), 2285 return ipw_send_cmd_pdu(priv, IPW_CMD_SENSITIVITY_CALIB, sizeof(calib),
@@ -2345,6 +2345,7 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off)
2345 return -1; 2345 return -1;
2346 } 2346 }
2347 2347
2348 phy_off = cpu_to_le32(phy_off);
2348 return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(phy_off), 2349 return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(phy_off),
2349 &phy_off); 2350 &phy_off);
2350} 2351}
@@ -2406,7 +2407,7 @@ static int ipw_set_tx_power(struct ipw_priv *priv)
2406static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) 2407static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts)
2407{ 2408{
2408 struct ipw_rts_threshold rts_threshold = { 2409 struct ipw_rts_threshold rts_threshold = {
2409 .rts_threshold = rts, 2410 .rts_threshold = cpu_to_le16(rts),
2410 }; 2411 };
2411 2412
2412 if (!priv) { 2413 if (!priv) {
@@ -2421,7 +2422,7 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts)
2421static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) 2422static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag)
2422{ 2423{
2423 struct ipw_frag_threshold frag_threshold = { 2424 struct ipw_frag_threshold frag_threshold = {
2424 .frag_threshold = frag, 2425 .frag_threshold = cpu_to_le16(frag),
2425 }; 2426 };
2426 2427
2427 if (!priv) { 2428 if (!priv) {
@@ -2456,6 +2457,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
2456 break; 2457 break;
2457 } 2458 }
2458 2459
2460 param = cpu_to_le32(mode);
2459 return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), 2461 return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param),
2460 &param); 2462 &param);
2461} 2463}
@@ -5821,8 +5823,8 @@ static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index)
5821 key.station_index = 0; /* always 0 for BSS */ 5823 key.station_index = 0; /* always 0 for BSS */
5822 key.flags = 0; 5824 key.flags = 0;
5823 /* 0 for new key; previous value of counter (after fatal error) */ 5825 /* 0 for new key; previous value of counter (after fatal error) */
5824 key.tx_counter[0] = 0; 5826 key.tx_counter[0] = cpu_to_le32(0);
5825 key.tx_counter[1] = 0; 5827 key.tx_counter[1] = cpu_to_le32(0);
5826 5828
5827 ipw_send_cmd_pdu(priv, IPW_CMD_TGI_TX_KEY, sizeof(key), &key); 5829 ipw_send_cmd_pdu(priv, IPW_CMD_TGI_TX_KEY, sizeof(key), &key);
5828} 5830}
@@ -6773,7 +6775,7 @@ static int ipw_qos_activate(struct ipw_priv *priv,
6773 burst_duration = ipw_qos_get_burst_duration(priv); 6775 burst_duration = ipw_qos_get_burst_duration(priv);
6774 for (i = 0; i < QOS_QUEUE_NUM; i++) 6776 for (i = 0; i < QOS_QUEUE_NUM; i++)
6775 qos_parameters[QOS_PARAM_SET_ACTIVE].tx_op_limit[i] = 6777 qos_parameters[QOS_PARAM_SET_ACTIVE].tx_op_limit[i] =
6776 (u16) burst_duration; 6778 (u16)burst_duration;
6777 } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 6779 } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) {
6778 if (type == IEEE_B) { 6780 if (type == IEEE_B) {
6779 IPW_DEBUG_QOS("QoS activate IBSS nework mode %d\n", 6781 IPW_DEBUG_QOS("QoS activate IBSS nework mode %d\n",
@@ -6805,11 +6807,20 @@ static int ipw_qos_activate(struct ipw_priv *priv,
6805 burst_duration = ipw_qos_get_burst_duration(priv); 6807 burst_duration = ipw_qos_get_burst_duration(priv);
6806 for (i = 0; i < QOS_QUEUE_NUM; i++) 6808 for (i = 0; i < QOS_QUEUE_NUM; i++)
6807 qos_parameters[QOS_PARAM_SET_ACTIVE]. 6809 qos_parameters[QOS_PARAM_SET_ACTIVE].
6808 tx_op_limit[i] = (u16) burst_duration; 6810 tx_op_limit[i] = (u16)burst_duration;
6809 } 6811 }
6810 } 6812 }
6811 6813
6812 IPW_DEBUG_QOS("QoS sending IPW_CMD_QOS_PARAMETERS\n"); 6814 IPW_DEBUG_QOS("QoS sending IPW_CMD_QOS_PARAMETERS\n");
6815 for (i = 0; i < 3; i++) {
6816 int j;
6817 for (j = 0; j < QOS_QUEUE_NUM; j++) {
6818 qos_parameters[i].cw_min[j] = cpu_to_le16(qos_parameters[i].cw_min[j]);
6819 qos_parameters[i].cw_max[j] = cpu_to_le16(qos_parameters[i].cw_max[j]);
6820 qos_parameters[i].tx_op_limit[j] = cpu_to_le16(qos_parameters[i].tx_op_limit[j]);
6821 }
6822 }
6823
6813 err = ipw_send_qos_params_command(priv, 6824 err = ipw_send_qos_params_command(priv,
6814 (struct ieee80211_qos_parameters *) 6825 (struct ieee80211_qos_parameters *)
6815 &(qos_parameters[0])); 6826 &(qos_parameters[0]));
@@ -7048,7 +7059,7 @@ static int ipw_qos_set_tx_queue_command(struct ipw_priv *priv,
7048 7059
7049 if (priv->qos_data.qos_no_ack_mask & (1UL << tx_queue_id)) { 7060 if (priv->qos_data.qos_no_ack_mask & (1UL << tx_queue_id)) {
7050 tfd->tx_flags &= ~DCT_FLAG_ACK_REQD; 7061 tfd->tx_flags &= ~DCT_FLAG_ACK_REQD;
7051 tfd->tfd.tfd_26.mchdr.qos_ctrl |= CTRL_QOS_NO_ACK; 7062 tfd->tfd.tfd_26.mchdr.qos_ctrl |= cpu_to_le16(CTRL_QOS_NO_ACK);
7052 } 7063 }
7053 return 0; 7064 return 0;
7054} 7065}
@@ -7791,17 +7802,17 @@ static void ipw_handle_promiscuous_rx(struct ipw_priv *priv,
7791 } 7802 }
7792 7803
7793 hdr = (void *)rxb->skb->data + IPW_RX_FRAME_SIZE; 7804 hdr = (void *)rxb->skb->data + IPW_RX_FRAME_SIZE;
7794 if (ieee80211_is_management(hdr->frame_ctl)) { 7805 if (ieee80211_is_management(le16_to_cpu(hdr->frame_ctl))) {
7795 if (filter & IPW_PROM_NO_MGMT) 7806 if (filter & IPW_PROM_NO_MGMT)
7796 return; 7807 return;
7797 if (filter & IPW_PROM_MGMT_HEADER_ONLY) 7808 if (filter & IPW_PROM_MGMT_HEADER_ONLY)
7798 hdr_only = 1; 7809 hdr_only = 1;
7799 } else if (ieee80211_is_control(hdr->frame_ctl)) { 7810 } else if (ieee80211_is_control(le16_to_cpu(hdr->frame_ctl))) {
7800 if (filter & IPW_PROM_NO_CTL) 7811 if (filter & IPW_PROM_NO_CTL)
7801 return; 7812 return;
7802 if (filter & IPW_PROM_CTL_HEADER_ONLY) 7813 if (filter & IPW_PROM_CTL_HEADER_ONLY)
7803 hdr_only = 1; 7814 hdr_only = 1;
7804 } else if (ieee80211_is_data(hdr->frame_ctl)) { 7815 } else if (ieee80211_is_data(le16_to_cpu(hdr->frame_ctl))) {
7805 if (filter & IPW_PROM_NO_DATA) 7816 if (filter & IPW_PROM_NO_DATA)
7806 return; 7817 return;
7807 if (filter & IPW_PROM_DATA_HEADER_ONLY) 7818 if (filter & IPW_PROM_DATA_HEADER_ONLY)
@@ -7819,7 +7830,7 @@ static void ipw_handle_promiscuous_rx(struct ipw_priv *priv,
7819 ipw_rt = (void *)skb->data; 7830 ipw_rt = (void *)skb->data;
7820 7831
7821 if (hdr_only) 7832 if (hdr_only)
7822 len = ieee80211_get_hdrlen(hdr->frame_ctl); 7833 len = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
7823 7834
7824 memcpy(ipw_rt->payload, hdr, len); 7835 memcpy(ipw_rt->payload, hdr, len);
7825 7836
@@ -8125,8 +8136,7 @@ static void ipw_rx(struct ipw_priv *priv)
8125 switch (pkt->header.message_type) { 8136 switch (pkt->header.message_type) {
8126 case RX_FRAME_TYPE: /* 802.11 frame */ { 8137 case RX_FRAME_TYPE: /* 802.11 frame */ {
8127 struct ieee80211_rx_stats stats = { 8138 struct ieee80211_rx_stats stats = {
8128 .rssi = 8139 .rssi = pkt->u.frame.rssi_dbm -
8129 le16_to_cpu(pkt->u.frame.rssi_dbm) -
8130 IPW_RSSI_TO_DBM, 8140 IPW_RSSI_TO_DBM,
8131 .signal = 8141 .signal =
8132 le16_to_cpu(pkt->u.frame.rssi_dbm) - 8142 le16_to_cpu(pkt->u.frame.rssi_dbm) -
@@ -10088,7 +10098,7 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10088 switch (priv->ieee->sec.level) { 10098 switch (priv->ieee->sec.level) {
10089 case SEC_LEVEL_3: 10099 case SEC_LEVEL_3:
10090 tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= 10100 tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |=
10091 IEEE80211_FCTL_PROTECTED; 10101 cpu_to_le16(IEEE80211_FCTL_PROTECTED);
10092 /* XXX: ACK flag must be set for CCMP even if it 10102 /* XXX: ACK flag must be set for CCMP even if it
10093 * is a multicast/broadcast packet, because CCMP 10103 * is a multicast/broadcast packet, because CCMP
10094 * group communication encrypted by GTK is 10104 * group communication encrypted by GTK is
@@ -10103,14 +10113,14 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10103 break; 10113 break;
10104 case SEC_LEVEL_2: 10114 case SEC_LEVEL_2:
10105 tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= 10115 tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |=
10106 IEEE80211_FCTL_PROTECTED; 10116 cpu_to_le16(IEEE80211_FCTL_PROTECTED);
10107 tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; 10117 tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP;
10108 tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_TKIP; 10118 tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_TKIP;
10109 tfd->u.data.key_index = DCT_WEP_INDEX_USE_IMMEDIATE; 10119 tfd->u.data.key_index = DCT_WEP_INDEX_USE_IMMEDIATE;
10110 break; 10120 break;
10111 case SEC_LEVEL_1: 10121 case SEC_LEVEL_1:
10112 tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= 10122 tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |=
10113 IEEE80211_FCTL_PROTECTED; 10123 cpu_to_le16(IEEE80211_FCTL_PROTECTED);
10114 tfd->u.data.key_index = priv->ieee->tx_keyidx; 10124 tfd->u.data.key_index = priv->ieee->tx_keyidx;
10115 if (priv->ieee->sec.key_sizes[priv->ieee->tx_keyidx] <= 10125 if (priv->ieee->sec.key_sizes[priv->ieee->tx_keyidx] <=
10116 40) 10126 40)
@@ -10242,17 +10252,17 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,
10242 10252
10243 /* Filtering of fragment chains is done agains the first fragment */ 10253 /* Filtering of fragment chains is done agains the first fragment */
10244 hdr = (void *)txb->fragments[0]->data; 10254 hdr = (void *)txb->fragments[0]->data;
10245 if (ieee80211_is_management(hdr->frame_ctl)) { 10255 if (ieee80211_is_management(le16_to_cpu(hdr->frame_ctl))) {
10246 if (filter & IPW_PROM_NO_MGMT) 10256 if (filter & IPW_PROM_NO_MGMT)
10247 return; 10257 return;
10248 if (filter & IPW_PROM_MGMT_HEADER_ONLY) 10258 if (filter & IPW_PROM_MGMT_HEADER_ONLY)
10249 hdr_only = 1; 10259 hdr_only = 1;
10250 } else if (ieee80211_is_control(hdr->frame_ctl)) { 10260 } else if (ieee80211_is_control(le16_to_cpu(hdr->frame_ctl))) {
10251 if (filter & IPW_PROM_NO_CTL) 10261 if (filter & IPW_PROM_NO_CTL)
10252 return; 10262 return;
10253 if (filter & IPW_PROM_CTL_HEADER_ONLY) 10263 if (filter & IPW_PROM_CTL_HEADER_ONLY)
10254 hdr_only = 1; 10264 hdr_only = 1;
10255 } else if (ieee80211_is_data(hdr->frame_ctl)) { 10265 } else if (ieee80211_is_data(le16_to_cpu(hdr->frame_ctl))) {
10256 if (filter & IPW_PROM_NO_DATA) 10266 if (filter & IPW_PROM_NO_DATA)
10257 return; 10267 return;
10258 if (filter & IPW_PROM_DATA_HEADER_ONLY) 10268 if (filter & IPW_PROM_DATA_HEADER_ONLY)
@@ -10267,7 +10277,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,
10267 10277
10268 if (hdr_only) { 10278 if (hdr_only) {
10269 hdr = (void *)src->data; 10279 hdr = (void *)src->data;
10270 len = ieee80211_get_hdrlen(hdr->frame_ctl); 10280 len = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
10271 } else 10281 } else
10272 len = src->len; 10282 len = src->len;
10273 10283