aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54/p54common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/p54/p54common.c')
-rw-r--r--drivers/net/wireless/p54/p54common.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 82354b974a04..c6a370fa9bcb 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -138,6 +138,7 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
138 u8 *fw_version = NULL; 138 u8 *fw_version = NULL;
139 size_t len; 139 size_t len;
140 int i; 140 int i;
141 int maxlen;
141 142
142 if (priv->rx_start) 143 if (priv->rx_start)
143 return 0; 144 return 0;
@@ -195,6 +196,16 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
195 else 196 else
196 priv->rx_mtu = (size_t) 197 priv->rx_mtu = (size_t)
197 0x620 - priv->tx_hdr_len; 198 0x620 - priv->tx_hdr_len;
199 maxlen = priv->tx_hdr_len + /* USB devices */
200 sizeof(struct p54_rx_data) +
201 4 + /* rx alignment */
202 IEEE80211_MAX_FRAG_THRESHOLD;
203 if (priv->rx_mtu > maxlen && PAGE_SIZE == 4096) {
204 printk(KERN_INFO "p54: rx_mtu reduced from %d "
205 "to %d\n", priv->rx_mtu,
206 maxlen);
207 priv->rx_mtu = maxlen;
208 }
198 break; 209 break;
199 } 210 }
200 case BR_CODE_EXPOSED_IF: 211 case BR_CODE_EXPOSED_IF:
@@ -575,6 +586,7 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
575 u16 freq = le16_to_cpu(hdr->freq); 586 u16 freq = le16_to_cpu(hdr->freq);
576 size_t header_len = sizeof(*hdr); 587 size_t header_len = sizeof(*hdr);
577 u32 tsf32; 588 u32 tsf32;
589 u8 rate = hdr->rate & 0xf;
578 590
579 /* 591 /*
580 * If the device is in a unspecified state we have to 592 * If the device is in a unspecified state we have to
@@ -603,8 +615,11 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
603 rx_status.qual = (100 * hdr->rssi) / 127; 615 rx_status.qual = (100 * hdr->rssi) / 127;
604 if (hdr->rate & 0x10) 616 if (hdr->rate & 0x10)
605 rx_status.flag |= RX_FLAG_SHORTPRE; 617 rx_status.flag |= RX_FLAG_SHORTPRE;
606 rx_status.rate_idx = (dev->conf.channel->band == IEEE80211_BAND_2GHZ ? 618 if (dev->conf.channel->band == IEEE80211_BAND_5GHZ)
607 hdr->rate : (hdr->rate - 4)) & 0xf; 619 rx_status.rate_idx = (rate < 4) ? 0 : rate - 4;
620 else
621 rx_status.rate_idx = rate;
622
608 rx_status.freq = freq; 623 rx_status.freq = freq;
609 rx_status.band = dev->conf.channel->band; 624 rx_status.band = dev->conf.channel->band;
610 rx_status.antenna = hdr->antenna; 625 rx_status.antenna = hdr->antenna;
@@ -798,6 +813,16 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
798 info->flags |= IEEE80211_TX_STAT_TX_FILTERED; 813 info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
799 info->status.ack_signal = p54_rssi_to_dbm(dev, 814 info->status.ack_signal = p54_rssi_to_dbm(dev,
800 (int)payload->ack_rssi); 815 (int)payload->ack_rssi);
816
817 if (entry_data->key_type == P54_CRYPTO_TKIPMICHAEL) {
818 u8 *iv = (u8 *)(entry_data->align + pad +
819 entry_data->crypt_offset);
820
821 /* Restore the original TKIP IV. */
822 iv[2] = iv[0];
823 iv[0] = iv[1];
824 iv[1] = (iv[0] | 0x20) & 0x7f; /* WEPSeed - 8.3.2.2 */
825 }
801 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); 826 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data));
802 ieee80211_tx_status_irqsafe(dev, entry); 827 ieee80211_tx_status_irqsafe(dev, entry);
803 goto out; 828 goto out;
@@ -1383,7 +1408,6 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1383 hdr->tries = ridx; 1408 hdr->tries = ridx;
1384 txhdr->rts_rate_idx = 0; 1409 txhdr->rts_rate_idx = 0;
1385 if (info->control.hw_key) { 1410 if (info->control.hw_key) {
1386 crypt_offset += info->control.hw_key->iv_len;
1387 txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); 1411 txhdr->key_type = p54_convert_algo(info->control.hw_key->alg);
1388 txhdr->key_len = min((u8)16, info->control.hw_key->keylen); 1412 txhdr->key_len = min((u8)16, info->control.hw_key->keylen);
1389 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); 1413 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len);
@@ -1397,6 +1421,8 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1397 } 1421 }
1398 /* reserve some space for ICV */ 1422 /* reserve some space for ICV */
1399 len += info->control.hw_key->icv_len; 1423 len += info->control.hw_key->icv_len;
1424 memset(skb_put(skb, info->control.hw_key->icv_len), 0,
1425 info->control.hw_key->icv_len);
1400 } else { 1426 } else {
1401 txhdr->key_type = 0; 1427 txhdr->key_type = 0;
1402 txhdr->key_len = 0; 1428 txhdr->key_len = 0;
@@ -1824,7 +1850,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev,
1824 1850
1825static int p54_config(struct ieee80211_hw *dev, u32 changed) 1851static int p54_config(struct ieee80211_hw *dev, u32 changed)
1826{ 1852{
1827 int ret; 1853 int ret = 0;
1828 struct p54_common *priv = dev->priv; 1854 struct p54_common *priv = dev->priv;
1829 struct ieee80211_conf *conf = &dev->conf; 1855 struct ieee80211_conf *conf = &dev->conf;
1830 1856