txrx.c (28ae58dd1f55f55dabf02fbc76a76f0809eee937) | txrx.c (6765d0aa5ff5b92098f5e571f26904106eae6ff3) |
---|---|
1/* 2 * Copyright (c) 2004-2011 Atheros Communications Inc. 3 * 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 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 63 unchanged lines hidden (view full) --- 72 } 73 74 *map_no = ep_map + 1; 75 ar->node_map[ep_map].tx_pend++; 76 77 return ar->node_map[ep_map].ep_id; 78} 79 | 1/* 2 * Copyright (c) 2004-2011 Atheros Communications Inc. 3 * 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 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 63 unchanged lines hidden (view full) --- 72 } 73 74 *map_no = ep_map + 1; 75 ar->node_map[ep_map].tx_pend++; 76 77 return ar->node_map[ep_map].ep_id; 78} 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) 82{ 83 struct ethhdr *datap = (struct ethhdr *) skb->data; 84 struct ath6kl_sta *conn = NULL; 85 bool ps_queued = false, is_psq_empty = false; | 81 bool *more_data) 82{ 83 struct ethhdr *datap = (struct ethhdr *) skb->data; 84 struct ath6kl_sta *conn = NULL; 85 bool ps_queued = false, is_psq_empty = false; |
86 /* TODO: Findout vif */ 87 struct ath6kl_vif *vif = ar->vif; | 86 struct ath6kl *ar = vif->ar; |
88 89 if (is_multicast_ether_addr(datap->h_dest)) { 90 u8 ctr = 0; 91 bool q_mcast = false; 92 93 for (ctr = 0; ctr < AP_MAX_NUM_STA; ctr++) { 94 if (ar->sta_list[ctr].sta_flags & STA_PS_SLEEP) { 95 q_mcast = true; --- 33 unchanged lines hidden (view full) --- 129 */ 130 spin_lock_bh(&ar->mcastpsq_lock); 131 if (!skb_queue_empty(&ar->mcastpsq)) 132 *more_data = true; 133 spin_unlock_bh(&ar->mcastpsq_lock); 134 } 135 } 136 } else { | 87 88 if (is_multicast_ether_addr(datap->h_dest)) { 89 u8 ctr = 0; 90 bool q_mcast = false; 91 92 for (ctr = 0; ctr < AP_MAX_NUM_STA; ctr++) { 93 if (ar->sta_list[ctr].sta_flags & STA_PS_SLEEP) { 94 q_mcast = true; --- 33 unchanged lines hidden (view full) --- 128 */ 129 spin_lock_bh(&ar->mcastpsq_lock); 130 if (!skb_queue_empty(&ar->mcastpsq)) 131 *more_data = true; 132 spin_unlock_bh(&ar->mcastpsq_lock); 133 } 134 } 135 } else { |
137 conn = ath6kl_find_sta(ar, datap->h_dest); | 136 conn = ath6kl_find_sta(vif, datap->h_dest); |
138 if (!conn) { 139 dev_kfree_skb(skb); 140 141 /* Inform the caller that the skb is consumed */ 142 return true; 143 } 144 145 if (conn->sta_flags & STA_PS_SLEEP) { --- 110 unchanged lines hidden (view full) --- 256 return 0; 257 } 258 259 if (!test_bit(WMI_READY, &ar->flag)) 260 goto fail_tx; 261 262 /* AP mode Power saving processing */ 263 if (vif->nw_type == AP_NETWORK) { | 137 if (!conn) { 138 dev_kfree_skb(skb); 139 140 /* Inform the caller that the skb is consumed */ 141 return true; 142 } 143 144 if (conn->sta_flags & STA_PS_SLEEP) { --- 110 unchanged lines hidden (view full) --- 255 return 0; 256 } 257 258 if (!test_bit(WMI_READY, &ar->flag)) 259 goto fail_tx; 260 261 /* AP mode Power saving processing */ 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; 266 } 267 268 if (test_bit(WMI_ENABLED, &ar->flag)) { 269 if (skb_headroom(skb) < dev->needed_headroom) { 270 WARN_ON(1); 271 goto fail_tx; 272 } 273 274 if (ath6kl_wmi_dix_2_dot3(ar->wmi, skb)) { 275 ath6kl_err("ath6kl_wmi_dix_2_dot3 failed\n"); 276 goto fail_tx; 277 } 278 279 if (ath6kl_wmi_data_hdr_add(ar->wmi, skb, DATA_MSGTYPE, | 264 return 0; 265 } 266 267 if (test_bit(WMI_ENABLED, &ar->flag)) { 268 if (skb_headroom(skb) < dev->needed_headroom) { 269 WARN_ON(1); 270 goto fail_tx; 271 } 272 273 if (ath6kl_wmi_dix_2_dot3(ar->wmi, skb)) { 274 ath6kl_err("ath6kl_wmi_dix_2_dot3 failed\n"); 275 goto fail_tx; 276 } 277 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"); 282 goto fail_tx; 283 } 284 285 if ((vif->nw_type == ADHOC_NETWORK) && 286 ar->ibss_ps_enable && test_bit(CONNECTED, &vif->flags)) 287 chk_adhoc_ps_mapping = true; 288 else { --- 240 unchanged lines hidden (view full) --- 529 struct htc_packet *packet; 530 struct sk_buff *skb; 531 struct ath6kl_cookie *ath6kl_cookie; 532 u32 map_no = 0; 533 int status; 534 enum htc_endpoint_id eid; 535 bool wake_event = false; 536 bool flushing = false; | 281 ath6kl_err("wmi_data_hdr_add failed\n"); 282 goto fail_tx; 283 } 284 285 if ((vif->nw_type == ADHOC_NETWORK) && 286 ar->ibss_ps_enable && test_bit(CONNECTED, &vif->flags)) 287 chk_adhoc_ps_mapping = true; 288 else { --- 240 unchanged lines hidden (view full) --- 529 struct htc_packet *packet; 530 struct sk_buff *skb; 531 struct ath6kl_cookie *ath6kl_cookie; 532 u32 map_no = 0; 533 int status; 534 enum htc_endpoint_id eid; 535 bool wake_event = false; 536 bool flushing = false; |
537 u8 if_idx; |
|
537 /* TODO: Findout vif */ 538 struct ath6kl_vif *vif = ar->vif; 539 540 skb_queue_head_init(&skb_queue); 541 542 /* lock the driver as we update internal state */ 543 spin_lock_bh(&ar->lock); 544 --- 31 unchanged lines hidden (view full) --- 576 if (eid == ar->ctrl_ep) { 577 if (test_bit(WMI_CTRL_EP_FULL, &ar->flag)) 578 clear_bit(WMI_CTRL_EP_FULL, &ar->flag); 579 580 if (ar->tx_pending[eid] == 0) 581 wake_event = true; 582 } 583 | 538 /* TODO: Findout vif */ 539 struct ath6kl_vif *vif = ar->vif; 540 541 skb_queue_head_init(&skb_queue); 542 543 /* lock the driver as we update internal state */ 544 spin_lock_bh(&ar->lock); 545 --- 31 unchanged lines hidden (view full) --- 577 if (eid == ar->ctrl_ep) { 578 if (test_bit(WMI_CTRL_EP_FULL, &ar->flag)) 579 clear_bit(WMI_CTRL_EP_FULL, &ar->flag); 580 581 if (ar->tx_pending[eid] == 0) 582 wake_event = true; 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) { 585 if (status == -ECANCELED) 586 /* a packet was flushed */ 587 flushing = true; 588 589 vif->net_stats.tx_errors++; 590 591 if (status != -ENOSPC) --- 456 unchanged lines hidden (view full) --- 1048 int min_hdr_len; 1049 u8 meta_type, dot11_hdr = 0; 1050 int status = packet->status; 1051 enum htc_endpoint_id ept = packet->endpoint; 1052 bool is_amsdu, prev_ps, ps_state = false; 1053 struct ath6kl_sta *conn = NULL; 1054 struct sk_buff *skb1 = NULL; 1055 struct ethhdr *datap = NULL; | 599 if (status) { 600 if (status == -ECANCELED) 601 /* a packet was flushed */ 602 flushing = true; 603 604 vif->net_stats.tx_errors++; 605 606 if (status != -ENOSPC) --- 456 unchanged lines hidden (view full) --- 1063 int min_hdr_len; 1064 u8 meta_type, dot11_hdr = 0; 1065 int status = packet->status; 1066 enum htc_endpoint_id ept = packet->endpoint; 1067 bool is_amsdu, prev_ps, ps_state = false; 1068 struct ath6kl_sta *conn = NULL; 1069 struct sk_buff *skb1 = NULL; 1070 struct ethhdr *datap = NULL; |
1056 /* TODO: Findout vif */ 1057 struct ath6kl_vif *vif = ar->vif; | 1071 struct ath6kl_vif *vif; |
1058 u16 seq_no, offset; | 1072 u16 seq_no, offset; |
1059 u8 tid; | 1073 u8 tid, if_idx; |
1060 1061 ath6kl_dbg(ATH6KL_DBG_WLAN_RX, 1062 "%s: ar=0x%p eid=%d, skb=0x%p, data=0x%p, len=0x%x status:%d", 1063 __func__, ar, ept, skb, packet->buf, 1064 packet->act_len, status); 1065 1066 if (status || !(skb->data + HTC_HDR_LENGTH)) { | 1074 1075 ath6kl_dbg(ATH6KL_DBG_WLAN_RX, 1076 "%s: ar=0x%p eid=%d, skb=0x%p, data=0x%p, len=0x%x status:%d", 1077 __func__, ar, ept, skb, packet->buf, 1078 packet->act_len, status); 1079 1080 if (status || !(skb->data + HTC_HDR_LENGTH)) { |
1067 vif->net_stats.rx_errors++; | |
1068 dev_kfree_skb(skb); 1069 return; 1070 } 1071 | 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) { 1098 dev_kfree_skb(skb); 1099 return; 1100 } 1101 |
|
1072 /* 1073 * Take lock to protect buffer counts and adaptive power throughput 1074 * state. 1075 */ 1076 spin_lock_bh(&ar->lock); 1077 1078 vif->net_stats.rx_packets++; 1079 vif->net_stats.rx_bytes += packet->act_len; 1080 1081 spin_unlock_bh(&ar->lock); 1082 | 1102 /* 1103 * Take lock to protect buffer counts and adaptive power throughput 1104 * state. 1105 */ 1106 spin_lock_bh(&ar->lock); 1107 1108 vif->net_stats.rx_packets++; 1109 vif->net_stats.rx_bytes += packet->act_len; 1110 1111 spin_unlock_bh(&ar->lock); 1112 |
1083 skb_put(skb, packet->act_len + HTC_HDR_LENGTH); 1084 skb_pull(skb, HTC_HDR_LENGTH); | |
1085 1086 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "rx ", 1087 skb->data, skb->len); 1088 1089 skb->dev = vif->ndev; 1090 1091 if (!test_bit(WMI_ENABLED, &ar->flag)) { 1092 if (EPPING_ALIGNMENT_PAD > 0) --- 45 unchanged lines hidden (view full) --- 1138 case WMI_META_VERSION_2: 1139 offset += sizeof(struct wmi_rx_meta_v2); 1140 break; 1141 default: 1142 break; 1143 } 1144 1145 datap = (struct ethhdr *) (skb->data + offset); | 1113 1114 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "rx ", 1115 skb->data, skb->len); 1116 1117 skb->dev = vif->ndev; 1118 1119 if (!test_bit(WMI_ENABLED, &ar->flag)) { 1120 if (EPPING_ALIGNMENT_PAD > 0) --- 45 unchanged lines hidden (view full) --- 1166 case WMI_META_VERSION_2: 1167 offset += sizeof(struct wmi_rx_meta_v2); 1168 break; 1169 default: 1170 break; 1171 } 1172 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 1148 if (!conn) { 1149 dev_kfree_skb(skb); 1150 return; 1151 } 1152 1153 /* 1154 * If there is a change in PS state of the STA, --- 90 unchanged lines hidden (view full) --- 1245 skb1 = skb_copy(skb, GFP_ATOMIC); 1246 else { 1247 /* 1248 * Search for a connected STA with dstMac 1249 * as the Mac address. If found send the 1250 * frame to it on the air else send the 1251 * frame up the stack. 1252 */ | 1175 1176 if (!conn) { 1177 dev_kfree_skb(skb); 1178 return; 1179 } 1180 1181 /* 1182 * If there is a change in PS state of the STA, --- 90 unchanged lines hidden (view full) --- 1273 skb1 = skb_copy(skb, GFP_ATOMIC); 1274 else { 1275 /* 1276 * Search for a connected STA with dstMac 1277 * as the Mac address. If found send the 1278 * frame to it on the air else send the 1279 * frame up the stack. 1280 */ |
1253 conn = ath6kl_find_sta(ar, datap->h_dest); | 1281 conn = ath6kl_find_sta(vif, datap->h_dest); |
1254 1255 if (conn && ar->intra_bss) { 1256 skb1 = skb; 1257 skb = NULL; 1258 } else if (conn && !ar->intra_bss) { 1259 dev_kfree_skb(skb); 1260 skb = NULL; 1261 } --- 237 unchanged lines hidden --- | 1282 1283 if (conn && ar->intra_bss) { 1284 skb1 = skb; 1285 skb = NULL; 1286 } else if (conn && !ar->intra_bss) { 1287 dev_kfree_skb(skb); 1288 skb = NULL; 1289 } --- 237 unchanged lines hidden --- |