aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>2011-10-25 10:04:17 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-11-11 05:58:49 -0500
commit6765d0aa5ff5b92098f5e571f26904106eae6ff3 (patch)
tree7b677f3222b52131edba6f139971399019b2844d
parent6db8fa53ad4fa6d4b390e9bdd68f1238a01070ee (diff)
ath6kl: Use interface index from wmi data headr
Interface index is passed in wmi data header as well, use it to get the corresponding vif structure. Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.h2
-rw-r--r--drivers/net/wireless/ath/ath6kl/main.c5
-rw-r--r--drivers/net/wireless/ath/ath6kl/txrx.c56
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c16
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.h21
5 files changed, 73 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 498b626b3637..466f6e17154c 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -618,7 +618,7 @@ struct htc_packet *ath6kl_alloc_amsdu_rxbuf(struct htc_target *target,
618void aggr_module_destroy(struct aggr_info *aggr_info); 618void aggr_module_destroy(struct aggr_info *aggr_info);
619void aggr_reset_state(struct aggr_info *aggr_info); 619void aggr_reset_state(struct aggr_info *aggr_info);
620 620
621struct ath6kl_sta *ath6kl_find_sta(struct ath6kl *ar, u8 * node_addr); 621struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 * node_addr);
622struct ath6kl_sta *ath6kl_find_sta_by_aid(struct ath6kl *ar, u8 aid); 622struct ath6kl_sta *ath6kl_find_sta_by_aid(struct ath6kl *ar, u8 aid);
623 623
624void ath6kl_ready_event(void *devt, u8 * datap, u32 sw_ver, u32 abi_ver); 624void ath6kl_ready_event(void *devt, u8 * datap, u32 sw_ver, u32 abi_ver);
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index a10002de8247..cc3e3c808657 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -20,10 +20,9 @@
20#include "target.h" 20#include "target.h"
21#include "debug.h" 21#include "debug.h"
22 22
23struct ath6kl_sta *ath6kl_find_sta(struct ath6kl *ar, u8 *node_addr) 23struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 *node_addr)
24{ 24{
25 /* TODO: Findout vif */ 25 struct ath6kl *ar = vif->ar;
26 struct ath6kl_vif *vif = ar->vif;
27 struct ath6kl_sta *conn = NULL; 26 struct ath6kl_sta *conn = NULL;
28 u8 i, max_conn; 27 u8 i, max_conn;
29 28
diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
index 7e2d6011f054..e4a6d8f54177 100644
--- a/drivers/net/wireless/ath/ath6kl/txrx.c
+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
@@ -77,14 +77,13 @@ static u8 ath6kl_ibss_map_epid(struct sk_buff *skb, struct net_device *dev,
77 return ar->node_map[ep_map].ep_id; 77 return ar->node_map[ep_map].ep_id;
78} 78}
79 79
80static bool ath6kl_powersave_ap(struct ath6kl *ar, struct sk_buff *skb, 80static bool ath6kl_powersave_ap(struct ath6kl_vif *vif, struct sk_buff *skb,
81 bool *more_data) 81 bool *more_data)
82{ 82{
83 struct ethhdr *datap = (struct ethhdr *) skb->data; 83 struct ethhdr *datap = (struct ethhdr *) skb->data;
84 struct ath6kl_sta *conn = NULL; 84 struct ath6kl_sta *conn = NULL;
85 bool ps_queued = false, is_psq_empty = false; 85 bool ps_queued = false, is_psq_empty = false;
86 /* TODO: Findout vif */ 86 struct ath6kl *ar = vif->ar;
87 struct ath6kl_vif *vif = ar->vif;
88 87
89 if (is_multicast_ether_addr(datap->h_dest)) { 88 if (is_multicast_ether_addr(datap->h_dest)) {
90 u8 ctr = 0; 89 u8 ctr = 0;
@@ -134,7 +133,7 @@ static bool ath6kl_powersave_ap(struct ath6kl *ar, struct sk_buff *skb,
134 } 133 }
135 } 134 }
136 } else { 135 } else {
137 conn = ath6kl_find_sta(ar, datap->h_dest); 136 conn = ath6kl_find_sta(vif, datap->h_dest);
138 if (!conn) { 137 if (!conn) {
139 dev_kfree_skb(skb); 138 dev_kfree_skb(skb);
140 139
@@ -261,7 +260,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
261 260
262 /* AP mode Power saving processing */ 261 /* AP mode Power saving processing */
263 if (vif->nw_type == AP_NETWORK) { 262 if (vif->nw_type == AP_NETWORK) {
264 if (ath6kl_powersave_ap(ar, skb, &more_data)) 263 if (ath6kl_powersave_ap(vif, skb, &more_data))
265 return 0; 264 return 0;
266 } 265 }
267 266
@@ -277,7 +276,8 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
277 } 276 }
278 277
279 if (ath6kl_wmi_data_hdr_add(ar->wmi, skb, DATA_MSGTYPE, 278 if (ath6kl_wmi_data_hdr_add(ar->wmi, skb, DATA_MSGTYPE,
280 more_data, 0, 0, NULL)) { 279 more_data, 0, 0, NULL,
280 vif->fw_vif_idx)) {
281 ath6kl_err("wmi_data_hdr_add failed\n"); 281 ath6kl_err("wmi_data_hdr_add failed\n");
282 goto fail_tx; 282 goto fail_tx;
283 } 283 }
@@ -534,6 +534,7 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
534 enum htc_endpoint_id eid; 534 enum htc_endpoint_id eid;
535 bool wake_event = false; 535 bool wake_event = false;
536 bool flushing = false; 536 bool flushing = false;
537 u8 if_idx;
537 /* TODO: Findout vif */ 538 /* TODO: Findout vif */
538 struct ath6kl_vif *vif = ar->vif; 539 struct ath6kl_vif *vif = ar->vif;
539 540
@@ -581,6 +582,20 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
581 wake_event = true; 582 wake_event = true;
582 } 583 }
583 584
585 if (eid == ar->ctrl_ep) {
586 if_idx = wmi_cmd_hdr_get_if_idx(
587 (struct wmi_cmd_hdr *) skb->data);
588 } else {
589 if_idx = wmi_data_hdr_get_if_idx(
590 (struct wmi_data_hdr *) skb->data);
591 }
592
593 vif = ath6kl_get_vif_by_index(ar, if_idx);
594 if (!vif) {
595 ath6kl_free_cookie(ar, ath6kl_cookie);
596 continue;
597 }
598
584 if (status) { 599 if (status) {
585 if (status == -ECANCELED) 600 if (status == -ECANCELED)
586 /* a packet was flushed */ 601 /* a packet was flushed */
@@ -1053,10 +1068,9 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
1053 struct ath6kl_sta *conn = NULL; 1068 struct ath6kl_sta *conn = NULL;
1054 struct sk_buff *skb1 = NULL; 1069 struct sk_buff *skb1 = NULL;
1055 struct ethhdr *datap = NULL; 1070 struct ethhdr *datap = NULL;
1056 /* TODO: Findout vif */ 1071 struct ath6kl_vif *vif;
1057 struct ath6kl_vif *vif = ar->vif;
1058 u16 seq_no, offset; 1072 u16 seq_no, offset;
1059 u8 tid; 1073 u8 tid, if_idx;
1060 1074
1061 ath6kl_dbg(ATH6KL_DBG_WLAN_RX, 1075 ath6kl_dbg(ATH6KL_DBG_WLAN_RX,
1062 "%s: ar=0x%p eid=%d, skb=0x%p, data=0x%p, len=0x%x status:%d", 1076 "%s: ar=0x%p eid=%d, skb=0x%p, data=0x%p, len=0x%x status:%d",
@@ -1064,7 +1078,23 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
1064 packet->act_len, status); 1078 packet->act_len, status);
1065 1079
1066 if (status || !(skb->data + HTC_HDR_LENGTH)) { 1080 if (status || !(skb->data + HTC_HDR_LENGTH)) {
1067 vif->net_stats.rx_errors++; 1081 dev_kfree_skb(skb);
1082 return;
1083 }
1084
1085 skb_put(skb, packet->act_len + HTC_HDR_LENGTH);
1086 skb_pull(skb, HTC_HDR_LENGTH);
1087
1088 if (ept == ar->ctrl_ep) {
1089 if_idx =
1090 wmi_cmd_hdr_get_if_idx((struct wmi_cmd_hdr *) skb->data);
1091 } else {
1092 if_idx =
1093 wmi_data_hdr_get_if_idx((struct wmi_data_hdr *) skb->data);
1094 }
1095
1096 vif = ath6kl_get_vif_by_index(ar, if_idx);
1097 if (!vif) {
1068 dev_kfree_skb(skb); 1098 dev_kfree_skb(skb);
1069 return; 1099 return;
1070 } 1100 }
@@ -1080,8 +1110,6 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
1080 1110
1081 spin_unlock_bh(&ar->lock); 1111 spin_unlock_bh(&ar->lock);
1082 1112
1083 skb_put(skb, packet->act_len + HTC_HDR_LENGTH);
1084 skb_pull(skb, HTC_HDR_LENGTH);
1085 1113
1086 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "rx ", 1114 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "rx ",
1087 skb->data, skb->len); 1115 skb->data, skb->len);
@@ -1143,7 +1171,7 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
1143 } 1171 }
1144 1172
1145 datap = (struct ethhdr *) (skb->data + offset); 1173 datap = (struct ethhdr *) (skb->data + offset);
1146 conn = ath6kl_find_sta(ar, datap->h_source); 1174 conn = ath6kl_find_sta(vif, datap->h_source);
1147 1175
1148 if (!conn) { 1176 if (!conn) {
1149 dev_kfree_skb(skb); 1177 dev_kfree_skb(skb);
@@ -1250,7 +1278,7 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
1250 * frame to it on the air else send the 1278 * frame to it on the air else send the
1251 * frame up the stack. 1279 * frame up the stack.
1252 */ 1280 */
1253 conn = ath6kl_find_sta(ar, datap->h_dest); 1281 conn = ath6kl_find_sta(vif, datap->h_dest);
1254 1282
1255 if (conn && ar->intra_bss) { 1283 if (conn && ar->intra_bss) {
1256 skb1 = skb; 1284 skb1 = skb;
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index ed092b77ef6b..ed95c2acf475 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -81,7 +81,7 @@ enum htc_endpoint_id ath6kl_wmi_get_control_ep(struct wmi *wmi)
81 return wmi->ep_id; 81 return wmi->ep_id;
82} 82}
83 83
84static struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx) 84struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx)
85{ 85{
86 if (WARN_ON(if_idx > (MAX_NUM_VIF - 1))) 86 if (WARN_ON(if_idx > (MAX_NUM_VIF - 1)))
87 return NULL; 87 return NULL;
@@ -170,12 +170,12 @@ static int ath6kl_wmi_meta_add(struct wmi *wmi, struct sk_buff *skb,
170int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb, 170int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb,
171 u8 msg_type, bool more_data, 171 u8 msg_type, bool more_data,
172 enum wmi_data_hdr_data_type data_type, 172 enum wmi_data_hdr_data_type data_type,
173 u8 meta_ver, void *tx_meta_info) 173 u8 meta_ver, void *tx_meta_info, u8 if_idx)
174{ 174{
175 struct wmi_data_hdr *data_hdr; 175 struct wmi_data_hdr *data_hdr;
176 int ret; 176 int ret;
177 177
178 if (WARN_ON(skb == NULL)) 178 if (WARN_ON(skb == NULL || (if_idx > MAX_NUM_VIF - 1)))
179 return -EINVAL; 179 return -EINVAL;
180 180
181 if (tx_meta_info) { 181 if (tx_meta_info) {
@@ -197,7 +197,7 @@ int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb,
197 WMI_DATA_HDR_MORE_MASK << WMI_DATA_HDR_MORE_SHIFT; 197 WMI_DATA_HDR_MORE_MASK << WMI_DATA_HDR_MORE_SHIFT;
198 198
199 data_hdr->info2 = cpu_to_le16(meta_ver << WMI_DATA_HDR_META_SHIFT); 199 data_hdr->info2 = cpu_to_le16(meta_ver << WMI_DATA_HDR_META_SHIFT);
200 data_hdr->info3 = 0; 200 data_hdr->info3 = cpu_to_le16(if_idx & WMI_DATA_HDR_IF_IDX_MASK);
201 201
202 return 0; 202 return 0;
203} 203}
@@ -1631,7 +1631,7 @@ int ath6kl_wmi_cmd_send(struct wmi *wmi, u8 if_idx, struct sk_buff *skb,
1631 /* Only for OPT_TX_CMD, use BE endpoint. */ 1631 /* Only for OPT_TX_CMD, use BE endpoint. */
1632 if (cmd_id == WMI_OPT_TX_FRAME_CMDID) { 1632 if (cmd_id == WMI_OPT_TX_FRAME_CMDID) {
1633 ret = ath6kl_wmi_data_hdr_add(wmi, skb, OPT_MSGTYPE, 1633 ret = ath6kl_wmi_data_hdr_add(wmi, skb, OPT_MSGTYPE,
1634 false, false, 0, NULL); 1634 false, false, 0, NULL, if_idx);
1635 if (ret) { 1635 if (ret) {
1636 dev_kfree_skb(skb); 1636 dev_kfree_skb(skb);
1637 return ret; 1637 return ret;
@@ -2098,7 +2098,7 @@ int ath6kl_wmi_setpmkid_cmd(struct wmi *wmi, u8 if_idx, const u8 *bssid,
2098} 2098}
2099 2099
2100static int ath6kl_wmi_data_sync_send(struct wmi *wmi, struct sk_buff *skb, 2100static int ath6kl_wmi_data_sync_send(struct wmi *wmi, struct sk_buff *skb,
2101 enum htc_endpoint_id ep_id) 2101 enum htc_endpoint_id ep_id, u8 if_idx)
2102{ 2102{
2103 struct wmi_data_hdr *data_hdr; 2103 struct wmi_data_hdr *data_hdr;
2104 int ret; 2104 int ret;
@@ -2110,7 +2110,7 @@ static int ath6kl_wmi_data_sync_send(struct wmi *wmi, struct sk_buff *skb,
2110 2110
2111 data_hdr = (struct wmi_data_hdr *) skb->data; 2111 data_hdr = (struct wmi_data_hdr *) skb->data;
2112 data_hdr->info = SYNC_MSGTYPE << WMI_DATA_HDR_MSG_TYPE_SHIFT; 2112 data_hdr->info = SYNC_MSGTYPE << WMI_DATA_HDR_MSG_TYPE_SHIFT;
2113 data_hdr->info3 = 0; 2113 data_hdr->info3 = cpu_to_le16(if_idx & WMI_DATA_HDR_IF_IDX_MASK);
2114 2114
2115 ret = ath6kl_control_tx(wmi->parent_dev, skb, ep_id); 2115 ret = ath6kl_control_tx(wmi->parent_dev, skb, ep_id);
2116 2116
@@ -2192,7 +2192,7 @@ static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx)
2192 traffic_class); 2192 traffic_class);
2193 ret = 2193 ret =
2194 ath6kl_wmi_data_sync_send(wmi, data_sync_bufs[index].skb, 2194 ath6kl_wmi_data_sync_send(wmi, data_sync_bufs[index].skb,
2195 ep_id); 2195 ep_id, if_idx);
2196 2196
2197 if (ret) 2197 if (ret)
2198 break; 2198 break;
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h
index d2c951056a52..621189b7b970 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.h
+++ b/drivers/net/wireless/ath/ath6kl/wmi.h
@@ -173,6 +173,8 @@ enum wmi_data_hdr_data_type {
173#define WMI_DATA_HDR_META_MASK 0x7 173#define WMI_DATA_HDR_META_MASK 0x7
174#define WMI_DATA_HDR_META_SHIFT 13 174#define WMI_DATA_HDR_META_SHIFT 13
175 175
176#define WMI_DATA_HDR_IF_IDX_MASK 0xF
177
176struct wmi_data_hdr { 178struct wmi_data_hdr {
177 s8 rssi; 179 s8 rssi;
178 180
@@ -197,6 +199,12 @@ struct wmi_data_hdr {
197 * b15:b13 - META_DATA_VERSION 0 - 7 199 * b15:b13 - META_DATA_VERSION 0 - 7
198 */ 200 */
199 __le16 info2; 201 __le16 info2;
202
203 /*
204 * usage of info3, 16-bit:
205 * b3:b0 - Interface index
206 * b15:b4 - Reserved
207 */
200 __le16 info3; 208 __le16 info3;
201} __packed; 209} __packed;
202 210
@@ -239,6 +247,11 @@ static inline u8 wmi_data_hdr_get_meta(struct wmi_data_hdr *dhdr)
239 WMI_DATA_HDR_META_MASK; 247 WMI_DATA_HDR_META_MASK;
240} 248}
241 249
250static inline u8 wmi_data_hdr_get_if_idx(struct wmi_data_hdr *dhdr)
251{
252 return le16_to_cpu(dhdr->info3) & WMI_DATA_HDR_IF_IDX_MASK;
253}
254
242/* Tx meta version definitions */ 255/* Tx meta version definitions */
243#define WMI_MAX_TX_META_SZ 12 256#define WMI_MAX_TX_META_SZ 12
244#define WMI_META_VERSION_1 0x01 257#define WMI_META_VERSION_1 0x01
@@ -303,6 +316,11 @@ struct wmi_cmd_hdr {
303 __le16 reserved; 316 __le16 reserved;
304} __packed; 317} __packed;
305 318
319static inline u8 wmi_cmd_hdr_get_if_idx(struct wmi_cmd_hdr *chdr)
320{
321 return le16_to_cpu(chdr->info1) & WMI_CMD_HDR_IF_ID_MASK;
322}
323
306/* List of WMI commands */ 324/* List of WMI commands */
307enum wmi_cmd_id { 325enum wmi_cmd_id {
308 WMI_CONNECT_CMDID = 0x0001, 326 WMI_CONNECT_CMDID = 0x0001,
@@ -2167,7 +2185,7 @@ int ath6kl_wmi_dix_2_dot3(struct wmi *wmi, struct sk_buff *skb);
2167int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb, 2185int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb,
2168 u8 msg_type, bool more_data, 2186 u8 msg_type, bool more_data,
2169 enum wmi_data_hdr_data_type data_type, 2187 enum wmi_data_hdr_data_type data_type,
2170 u8 meta_ver, void *tx_meta_info); 2188 u8 meta_ver, void *tx_meta_info, u8 if_idx);
2171 2189
2172int ath6kl_wmi_dot11_hdr_remove(struct wmi *wmi, struct sk_buff *skb); 2190int ath6kl_wmi_dot11_hdr_remove(struct wmi *wmi, struct sk_buff *skb);
2173int ath6kl_wmi_dot3_2_dix(struct sk_buff *skb); 2191int ath6kl_wmi_dot3_2_dix(struct sk_buff *skb);
@@ -2292,6 +2310,7 @@ int ath6kl_wmi_cancel_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx);
2292int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type, 2310int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type,
2293 const u8 *ie, u8 ie_len); 2311 const u8 *ie, u8 ie_len);
2294 2312
2313struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx);
2295void *ath6kl_wmi_init(struct ath6kl *devt); 2314void *ath6kl_wmi_init(struct ath6kl *devt);
2296void ath6kl_wmi_shutdown(struct wmi *wmi); 2315void ath6kl_wmi_shutdown(struct wmi *wmi);
2297 2316