aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>2017-10-27 11:35:41 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2017-11-20 11:10:18 -0500
commit307aeb31af0d9ba63346466f88badd64e7ed9786 (patch)
treef1a00405031a66b77196e78bd62d3e299171a461
parent1514f6fc136943c27364f164de1e86c2d51befa9 (diff)
ath10k: fix data rx for CCMP-256, GCMP and GCMP-256 in raw mode
Make sure 16-byte mic is removed from the rx data packet tail when CCMP-256, GCMP and GCMP-256 ciphers are used in raw decap mode. This fixed rx traffic failures in those ciphers in raw mode. Split the helper returning crypto tail length into two, one to get the ICV length and other to get the mic lengh for the cipher to make it clean. Fixes: 2ea9f12cefe4 ("ath10k: add new cipher suite support") Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/htt_rx.c51
1 files changed, 38 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index e31438541ee1..7d295ee71534 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -566,18 +566,16 @@ static int ath10k_htt_rx_crypto_param_len(struct ath10k *ar,
566 566
567#define MICHAEL_MIC_LEN 8 567#define MICHAEL_MIC_LEN 8
568 568
569static int ath10k_htt_rx_crypto_tail_len(struct ath10k *ar, 569static int ath10k_htt_rx_crypto_mic_len(struct ath10k *ar,
570 enum htt_rx_mpdu_encrypt_type type) 570 enum htt_rx_mpdu_encrypt_type type)
571{ 571{
572 switch (type) { 572 switch (type) {
573 case HTT_RX_MPDU_ENCRYPT_NONE: 573 case HTT_RX_MPDU_ENCRYPT_NONE:
574 return 0;
575 case HTT_RX_MPDU_ENCRYPT_WEP40: 574 case HTT_RX_MPDU_ENCRYPT_WEP40:
576 case HTT_RX_MPDU_ENCRYPT_WEP104: 575 case HTT_RX_MPDU_ENCRYPT_WEP104:
577 return IEEE80211_WEP_ICV_LEN;
578 case HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC: 576 case HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC:
579 case HTT_RX_MPDU_ENCRYPT_TKIP_WPA: 577 case HTT_RX_MPDU_ENCRYPT_TKIP_WPA:
580 return IEEE80211_TKIP_ICV_LEN; 578 return 0;
581 case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2: 579 case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2:
582 return IEEE80211_CCMP_MIC_LEN; 580 return IEEE80211_CCMP_MIC_LEN;
583 case HTT_RX_MPDU_ENCRYPT_AES_CCM256_WPA2: 581 case HTT_RX_MPDU_ENCRYPT_AES_CCM256_WPA2:
@@ -594,6 +592,31 @@ static int ath10k_htt_rx_crypto_tail_len(struct ath10k *ar,
594 return 0; 592 return 0;
595} 593}
596 594
595static int ath10k_htt_rx_crypto_icv_len(struct ath10k *ar,
596 enum htt_rx_mpdu_encrypt_type type)
597{
598 switch (type) {
599 case HTT_RX_MPDU_ENCRYPT_NONE:
600 case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2:
601 case HTT_RX_MPDU_ENCRYPT_AES_CCM256_WPA2:
602 case HTT_RX_MPDU_ENCRYPT_AES_GCMP_WPA2:
603 case HTT_RX_MPDU_ENCRYPT_AES_GCMP256_WPA2:
604 return 0;
605 case HTT_RX_MPDU_ENCRYPT_WEP40:
606 case HTT_RX_MPDU_ENCRYPT_WEP104:
607 return IEEE80211_WEP_ICV_LEN;
608 case HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC:
609 case HTT_RX_MPDU_ENCRYPT_TKIP_WPA:
610 return IEEE80211_TKIP_ICV_LEN;
611 case HTT_RX_MPDU_ENCRYPT_WEP128:
612 case HTT_RX_MPDU_ENCRYPT_WAPI:
613 break;
614 }
615
616 ath10k_warn(ar, "unsupported encryption type %d\n", type);
617 return 0;
618}
619
597struct amsdu_subframe_hdr { 620struct amsdu_subframe_hdr {
598 u8 dst[ETH_ALEN]; 621 u8 dst[ETH_ALEN];
599 u8 src[ETH_ALEN]; 622 u8 src[ETH_ALEN];
@@ -1063,25 +1086,27 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
1063 /* Tail */ 1086 /* Tail */
1064 if (status->flag & RX_FLAG_IV_STRIPPED) { 1087 if (status->flag & RX_FLAG_IV_STRIPPED) {
1065 skb_trim(msdu, msdu->len - 1088 skb_trim(msdu, msdu->len -
1066 ath10k_htt_rx_crypto_tail_len(ar, enctype)); 1089 ath10k_htt_rx_crypto_mic_len(ar, enctype));
1090
1091 skb_trim(msdu, msdu->len -
1092 ath10k_htt_rx_crypto_icv_len(ar, enctype));
1067 } else { 1093 } else {
1068 /* MIC */ 1094 /* MIC */
1069 if ((status->flag & RX_FLAG_MIC_STRIPPED) && 1095 if (status->flag & RX_FLAG_MIC_STRIPPED)
1070 enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2) 1096 skb_trim(msdu, msdu->len -
1071 skb_trim(msdu, msdu->len - 8); 1097 ath10k_htt_rx_crypto_mic_len(ar, enctype));
1072 1098
1073 /* ICV */ 1099 /* ICV */
1074 if (status->flag & RX_FLAG_ICV_STRIPPED && 1100 if (status->flag & RX_FLAG_ICV_STRIPPED)
1075 enctype != HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
1076 skb_trim(msdu, msdu->len - 1101 skb_trim(msdu, msdu->len -
1077 ath10k_htt_rx_crypto_tail_len(ar, enctype)); 1102 ath10k_htt_rx_crypto_icv_len(ar, enctype));
1078 } 1103 }
1079 1104
1080 /* MMIC */ 1105 /* MMIC */
1081 if ((status->flag & RX_FLAG_MMIC_STRIPPED) && 1106 if ((status->flag & RX_FLAG_MMIC_STRIPPED) &&
1082 !ieee80211_has_morefrags(hdr->frame_control) && 1107 !ieee80211_has_morefrags(hdr->frame_control) &&
1083 enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA) 1108 enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA)
1084 skb_trim(msdu, msdu->len - 8); 1109 skb_trim(msdu, msdu->len - MICHAEL_MIC_LEN);
1085 1110
1086 /* Head */ 1111 /* Head */
1087 if (status->flag & RX_FLAG_IV_STRIPPED) { 1112 if (status->flag & RX_FLAG_IV_STRIPPED) {