OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 Atheros Communications Inc. | 2 * Copyright (c) 2010 Atheros Communications Inc. |
3 * | 3 * |
4 * Permission to use, copy, modify, and/or distribute this software for any | 4 * Permission to use, copy, modify, and/or distribute this software for any |
5 * purpose with or without fee is hereby granted, provided that the above | 5 * purpose with or without fee is hereby granted, provided that the above |
6 * copyright notice and this permission notice appear in all copies. | 6 * copyright notice and this permission notice appear in all copies. |
7 * | 7 * |
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 */ | 15 */ |
16 | 16 |
17 #include "htc.h" | 17 #include "htc.h" |
18 | 18 |
19 /******/ | 19 /******/ |
20 /* TX */ | 20 /* TX */ |
21 /******/ | 21 /******/ |
22 | 22 |
| 23 static const int subtype_txq_to_hwq[] = { |
| 24 [WME_AC_BE] = ATH_TXQ_AC_BE, |
| 25 [WME_AC_BK] = ATH_TXQ_AC_BK, |
| 26 [WME_AC_VI] = ATH_TXQ_AC_VI, |
| 27 [WME_AC_VO] = ATH_TXQ_AC_VO, |
| 28 }; |
| 29 |
23 #define ATH9K_HTC_INIT_TXQ(subtype) do { \ | 30 #define ATH9K_HTC_INIT_TXQ(subtype) do { \ |
24 » » qi.tqi_subtype = subtype;» » » \ | 31 » » qi.tqi_subtype = subtype_txq_to_hwq[subtype];» \ |
25 qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT; \ | 32 qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT; \ |
26 qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT; \ | 33 qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT; \ |
27 qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT; \ | 34 qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT; \ |
28 qi.tqi_physCompBuf = 0; \ | 35 qi.tqi_physCompBuf = 0; \ |
29 qi.tqi_qflags = TXQ_FLAG_TXEOLINT_ENABLE | \ | 36 qi.tqi_qflags = TXQ_FLAG_TXEOLINT_ENABLE | \ |
30 TXQ_FLAG_TXDESCINT_ENABLE; \ | 37 TXQ_FLAG_TXDESCINT_ENABLE; \ |
31 } while (0) | 38 } while (0) |
32 | 39 |
33 int get_hw_qnum(u16 queue, int *hwq_map) | 40 int get_hw_qnum(u16 queue, int *hwq_map) |
34 { | 41 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 78 |
72 return error; | 79 return error; |
73 } | 80 } |
74 | 81 |
75 int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb) | 82 int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb) |
76 { | 83 { |
77 struct ieee80211_hdr *hdr; | 84 struct ieee80211_hdr *hdr; |
78 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 85 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
79 struct ieee80211_sta *sta = tx_info->control.sta; | 86 struct ieee80211_sta *sta = tx_info->control.sta; |
80 struct ath9k_htc_sta *ista; | 87 struct ath9k_htc_sta *ista; |
81 struct ath9k_htc_vif *avp; | |
82 struct ath9k_htc_tx_ctl tx_ctl; | 88 struct ath9k_htc_tx_ctl tx_ctl; |
83 enum htc_endpoint_id epid; | 89 enum htc_endpoint_id epid; |
84 u16 qnum; | 90 u16 qnum; |
85 __le16 fc; | 91 __le16 fc; |
86 u8 *tx_fhdr; | 92 u8 *tx_fhdr; |
87 » u8 sta_idx; | 93 » u8 sta_idx, vif_idx; |
88 | 94 |
89 hdr = (struct ieee80211_hdr *) skb->data; | 95 hdr = (struct ieee80211_hdr *) skb->data; |
90 fc = hdr->frame_control; | 96 fc = hdr->frame_control; |
91 | 97 |
92 » avp = (struct ath9k_htc_vif *) tx_info->control.vif->drv_priv; | 98 » if (tx_info->control.vif && |
| 99 » » » (struct ath9k_htc_vif *) tx_info->control.vif->drv_priv) |
| 100 » » vif_idx = ((struct ath9k_htc_vif *) |
| 101 » » » » tx_info->control.vif->drv_priv)->index; |
| 102 » else |
| 103 » » vif_idx = priv->nvifs; |
| 104 |
93 if (sta) { | 105 if (sta) { |
94 ista = (struct ath9k_htc_sta *) sta->drv_priv; | 106 ista = (struct ath9k_htc_sta *) sta->drv_priv; |
95 sta_idx = ista->index; | 107 sta_idx = ista->index; |
96 } else { | 108 } else { |
97 sta_idx = 0; | 109 sta_idx = 0; |
98 } | 110 } |
99 | 111 |
100 memset(&tx_ctl, 0, sizeof(struct ath9k_htc_tx_ctl)); | 112 memset(&tx_ctl, 0, sizeof(struct ath9k_htc_tx_ctl)); |
101 | 113 |
102 if (ieee80211_is_data(fc)) { | 114 if (ieee80211_is_data(fc)) { |
103 struct tx_frame_hdr tx_hdr; | 115 struct tx_frame_hdr tx_hdr; |
104 u8 *qc; | 116 u8 *qc; |
105 | 117 |
106 memset(&tx_hdr, 0, sizeof(struct tx_frame_hdr)); | 118 memset(&tx_hdr, 0, sizeof(struct tx_frame_hdr)); |
107 | 119 |
108 tx_hdr.node_idx = sta_idx; | 120 tx_hdr.node_idx = sta_idx; |
109 » » tx_hdr.vif_idx = avp->index; | 121 » » tx_hdr.vif_idx = vif_idx; |
110 | 122 |
111 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { | 123 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { |
112 tx_ctl.type = ATH9K_HTC_AMPDU; | 124 tx_ctl.type = ATH9K_HTC_AMPDU; |
113 tx_hdr.data_type = ATH9K_HTC_AMPDU; | 125 tx_hdr.data_type = ATH9K_HTC_AMPDU; |
114 } else { | 126 } else { |
115 tx_ctl.type = ATH9K_HTC_NORMAL; | 127 tx_ctl.type = ATH9K_HTC_NORMAL; |
116 tx_hdr.data_type = ATH9K_HTC_NORMAL; | 128 tx_hdr.data_type = ATH9K_HTC_NORMAL; |
117 } | 129 } |
118 | 130 |
119 if (ieee80211_is_data(fc)) { | 131 if (ieee80211_is_data(fc)) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 break; | 174 break; |
163 } | 175 } |
164 } else { | 176 } else { |
165 struct tx_mgmt_hdr mgmt_hdr; | 177 struct tx_mgmt_hdr mgmt_hdr; |
166 | 178 |
167 memset(&mgmt_hdr, 0, sizeof(struct tx_mgmt_hdr)); | 179 memset(&mgmt_hdr, 0, sizeof(struct tx_mgmt_hdr)); |
168 | 180 |
169 tx_ctl.type = ATH9K_HTC_NORMAL; | 181 tx_ctl.type = ATH9K_HTC_NORMAL; |
170 | 182 |
171 mgmt_hdr.node_idx = sta_idx; | 183 mgmt_hdr.node_idx = sta_idx; |
172 » » mgmt_hdr.vif_idx = avp->index; | 184 » » mgmt_hdr.vif_idx = vif_idx; |
173 mgmt_hdr.tidno = 0; | 185 mgmt_hdr.tidno = 0; |
174 mgmt_hdr.flags = 0; | 186 mgmt_hdr.flags = 0; |
175 | 187 |
176 mgmt_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb); | 188 mgmt_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb); |
177 if (mgmt_hdr.key_type == ATH9K_KEY_TYPE_CLEAR) | 189 if (mgmt_hdr.key_type == ATH9K_KEY_TYPE_CLEAR) |
178 mgmt_hdr.keyix = (u8) ATH9K_TXKEYIX_INVALID; | 190 mgmt_hdr.keyix = (u8) ATH9K_TXKEYIX_INVALID; |
179 else | 191 else |
180 mgmt_hdr.keyix = tx_info->control.hw_key->hw_key_idx; | 192 mgmt_hdr.keyix = tx_info->control.hw_key->hw_key_idx; |
181 | 193 |
182 tx_fhdr = skb_push(skb, sizeof(mgmt_hdr)); | 194 tx_fhdr = skb_push(skb, sizeof(mgmt_hdr)); |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 } | 736 } |
725 list_add_tail(&rxbuf->list, &priv->rx.rxbuf); | 737 list_add_tail(&rxbuf->list, &priv->rx.rxbuf); |
726 } | 738 } |
727 | 739 |
728 return 0; | 740 return 0; |
729 | 741 |
730 err: | 742 err: |
731 ath9k_rx_cleanup(priv); | 743 ath9k_rx_cleanup(priv); |
732 return -ENOMEM; | 744 return -ENOMEM; |
733 } | 745 } |
OLD | NEW |