diff options
Diffstat (limited to 'drivers/net/wireless/p54/txrx.c')
-rw-r--r-- | drivers/net/wireless/p54/txrx.c | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index 0e937dc0c9c4..042842e704de 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
@@ -273,17 +273,15 @@ void p54_tx(struct p54_common *priv, struct sk_buff *skb) | |||
273 | 273 | ||
274 | static int p54_rssi_to_dbm(struct p54_common *priv, int rssi) | 274 | static int p54_rssi_to_dbm(struct p54_common *priv, int rssi) |
275 | { | 275 | { |
276 | int band = priv->hw->conf.channel->band; | 276 | if (priv->rxhw != 5) { |
277 | 277 | return ((rssi * priv->cur_rssi->mul) / 64 + | |
278 | if (priv->rxhw != 5) | 278 | priv->cur_rssi->add) / 4; |
279 | return ((rssi * priv->rssical_db[band].mul) / 64 + | 279 | } else { |
280 | priv->rssical_db[band].add) / 4; | ||
281 | else | ||
282 | /* | 280 | /* |
283 | * TODO: find the correct formula | 281 | * TODO: find the correct formula |
284 | */ | 282 | */ |
285 | return ((rssi * priv->rssical_db[band].mul) / 64 + | 283 | return rssi / 2 - 110; |
286 | priv->rssical_db[band].add) / 4; | 284 | } |
287 | } | 285 | } |
288 | 286 | ||
289 | /* | 287 | /* |
@@ -369,7 +367,7 @@ static int p54_rx_data(struct p54_common *priv, struct sk_buff *skb) | |||
369 | rx_status->mactime = ((u64)priv->tsf_high32) << 32 | tsf32; | 367 | rx_status->mactime = ((u64)priv->tsf_high32) << 32 | tsf32; |
370 | priv->tsf_low32 = tsf32; | 368 | priv->tsf_low32 = tsf32; |
371 | 369 | ||
372 | rx_status->flag |= RX_FLAG_TSFT; | 370 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; |
373 | 371 | ||
374 | if (hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN)) | 372 | if (hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN)) |
375 | header_len += hdr->align[0]; | 373 | header_len += hdr->align[0]; |
@@ -618,7 +616,7 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, | |||
618 | else | 616 | else |
619 | *burst_possible = false; | 617 | *burst_possible = false; |
620 | 618 | ||
621 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) | 619 | if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) |
622 | *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; | 620 | *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; |
623 | 621 | ||
624 | if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE) | 622 | if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE) |
@@ -683,28 +681,29 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, | |||
683 | } | 681 | } |
684 | } | 682 | } |
685 | 683 | ||
686 | static u8 p54_convert_algo(enum ieee80211_key_alg alg) | 684 | static u8 p54_convert_algo(u32 cipher) |
687 | { | 685 | { |
688 | switch (alg) { | 686 | switch (cipher) { |
689 | case ALG_WEP: | 687 | case WLAN_CIPHER_SUITE_WEP40: |
688 | case WLAN_CIPHER_SUITE_WEP104: | ||
690 | return P54_CRYPTO_WEP; | 689 | return P54_CRYPTO_WEP; |
691 | case ALG_TKIP: | 690 | case WLAN_CIPHER_SUITE_TKIP: |
692 | return P54_CRYPTO_TKIPMICHAEL; | 691 | return P54_CRYPTO_TKIPMICHAEL; |
693 | case ALG_CCMP: | 692 | case WLAN_CIPHER_SUITE_CCMP: |
694 | return P54_CRYPTO_AESCCMP; | 693 | return P54_CRYPTO_AESCCMP; |
695 | default: | 694 | default: |
696 | return 0; | 695 | return 0; |
697 | } | 696 | } |
698 | } | 697 | } |
699 | 698 | ||
700 | int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) | 699 | void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) |
701 | { | 700 | { |
702 | struct p54_common *priv = dev->priv; | 701 | struct p54_common *priv = dev->priv; |
703 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 702 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
704 | struct p54_tx_info *p54info; | 703 | struct p54_tx_info *p54info; |
705 | struct p54_hdr *hdr; | 704 | struct p54_hdr *hdr; |
706 | struct p54_tx_data *txhdr; | 705 | struct p54_tx_data *txhdr; |
707 | unsigned int padding, len, extra_len; | 706 | unsigned int padding, len, extra_len = 0; |
708 | int i, j, ridx; | 707 | int i, j, ridx; |
709 | u16 hdr_flags = 0, aid = 0; | 708 | u16 hdr_flags = 0, aid = 0; |
710 | u8 rate, queue = 0, crypt_offset = 0; | 709 | u8 rate, queue = 0, crypt_offset = 0; |
@@ -718,12 +717,8 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
718 | &hdr_flags, &aid, &burst_allowed); | 717 | &hdr_flags, &aid, &burst_allowed); |
719 | 718 | ||
720 | if (p54_tx_qos_accounting_alloc(priv, skb, queue)) { | 719 | if (p54_tx_qos_accounting_alloc(priv, skb, queue)) { |
721 | if (!IS_QOS_QUEUE(queue)) { | 720 | dev_kfree_skb_any(skb); |
722 | dev_kfree_skb_any(skb); | 721 | return; |
723 | return NETDEV_TX_OK; | ||
724 | } else { | ||
725 | return NETDEV_TX_BUSY; | ||
726 | } | ||
727 | } | 722 | } |
728 | 723 | ||
729 | padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3; | 724 | padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3; |
@@ -731,7 +726,7 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
731 | 726 | ||
732 | if (info->control.hw_key) { | 727 | if (info->control.hw_key) { |
733 | crypt_offset = ieee80211_get_hdrlen_from_skb(skb); | 728 | crypt_offset = ieee80211_get_hdrlen_from_skb(skb); |
734 | if (info->control.hw_key->alg == ALG_TKIP) { | 729 | if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { |
735 | u8 *iv = (u8 *)(skb->data + crypt_offset); | 730 | u8 *iv = (u8 *)(skb->data + crypt_offset); |
736 | /* | 731 | /* |
737 | * The firmware excepts that the IV has to have | 732 | * The firmware excepts that the IV has to have |
@@ -827,10 +822,10 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
827 | hdr->tries = ridx; | 822 | hdr->tries = ridx; |
828 | txhdr->rts_rate_idx = 0; | 823 | txhdr->rts_rate_idx = 0; |
829 | if (info->control.hw_key) { | 824 | if (info->control.hw_key) { |
830 | txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); | 825 | txhdr->key_type = p54_convert_algo(info->control.hw_key->cipher); |
831 | txhdr->key_len = min((u8)16, info->control.hw_key->keylen); | 826 | txhdr->key_len = min((u8)16, info->control.hw_key->keylen); |
832 | memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); | 827 | memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); |
833 | if (info->control.hw_key->alg == ALG_TKIP) { | 828 | if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { |
834 | /* reserve space for the MIC key */ | 829 | /* reserve space for the MIC key */ |
835 | len += 8; | 830 | len += 8; |
836 | memcpy(skb_put(skb, 8), &(info->control.hw_key->key | 831 | memcpy(skb_put(skb, 8), &(info->control.hw_key->key |
@@ -866,5 +861,4 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
866 | p54info->extra_len = extra_len; | 861 | p54info->extra_len = extra_len; |
867 | 862 | ||
868 | p54_tx(priv, skb); | 863 | p54_tx(priv, skb); |
869 | return NETDEV_TX_OK; | ||
870 | } | 864 | } |