Lines Matching +full:mic +full:- +full:pos
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (c) 1998-2007 Texas Instruments Incorporated
23 data_in_count = wl->data_in_count; in wl1251_tx_double_buffer_busy()
29 used = data_in_count - data_out_count; in wl1251_tx_double_buffer_busy()
45 addr = wl->data_path->tx_control_addr; in wl1251_tx_path_status()
51 return -EBUSY; in wl1251_tx_path_status()
61 if (wl->tx_frames[i] == NULL) { in wl1251_tx_id()
62 wl->tx_frames[i] = skb; in wl1251_tx_id()
66 return -EBUSY; in wl1251_tx_id()
72 *(u16 *)&tx_hdr->control = 0; in wl1251_tx_control()
74 tx_hdr->control.rate_policy = 0; in wl1251_tx_control()
77 tx_hdr->control.packet_type = 0; in wl1251_tx_control()
80 if ((control->flags & IEEE80211_TX_CTL_NO_ACK) || in wl1251_tx_control()
81 (control->flags & IEEE80211_TX_CTL_INJECTED)) { in wl1251_tx_control()
82 tx_hdr->control.rate_policy = 1; in wl1251_tx_control()
83 tx_hdr->control.ack_policy = 1; in wl1251_tx_control()
86 tx_hdr->control.tx_complete = 1; in wl1251_tx_control()
91 tx_hdr->control.qos = 1; in wl1251_tx_control()
94 /* RSN + MIC = 8 + 8 = 16 bytes (worst case - AES). */
107 tx_hdr->frag_threshold = cpu_to_le16(frag_threshold); in wl1251_tx_frag_block_num()
109 payload_len = le16_to_cpu(tx_hdr->length) + MAX_MSDU_SECURITY_LENGTH; in wl1251_tx_frag_block_num()
117 payload_len -= num_mpdus * frag_threshold; in wl1251_tx_frag_block_num()
131 tx_hdr->num_mem_blocks = mem_blocks; in wl1251_tx_frag_block_num()
143 return -EINVAL; in wl1251_tx_fill_hdr()
149 fc = *(u16 *)skb->data; in wl1251_tx_fill_hdr()
152 tx_hdr->length = cpu_to_le16(skb->len - sizeof(*tx_hdr)); in wl1251_tx_fill_hdr()
153 rate = ieee80211_get_tx_rate(wl->hw, control); in wl1251_tx_fill_hdr()
154 tx_hdr->rate = cpu_to_le16(rate->hw_value); in wl1251_tx_fill_hdr()
155 tx_hdr->expiry_time = cpu_to_le32(1 << 16); in wl1251_tx_fill_hdr()
156 tx_hdr->id = id; in wl1251_tx_fill_hdr()
158 tx_hdr->xmit_queue = wl1251_tx_get_queue(skb_get_queue_mapping(skb)); in wl1251_tx_fill_hdr()
175 return -EINVAL; in wl1251_tx_send_packet()
177 tx_hdr = (struct tx_double_buffer_desc *) skb->data; in wl1251_tx_send_packet()
179 if (control->control.hw_key && in wl1251_tx_send_packet()
180 control->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { in wl1251_tx_send_packet()
184 u8 *pos; in wl1251_tx_send_packet() local
186 fc = *(__le16 *)(skb->data + sizeof(*tx_hdr)); in wl1251_tx_send_packet()
187 length = le16_to_cpu(tx_hdr->length) + WL1251_TKIP_IV_SPACE; in wl1251_tx_send_packet()
188 tx_hdr->length = cpu_to_le16(length); in wl1251_tx_send_packet()
192 pos = skb_push(skb, WL1251_TKIP_IV_SPACE); in wl1251_tx_send_packet()
193 memmove(pos, pos + WL1251_TKIP_IV_SPACE, in wl1251_tx_send_packet()
197 /* Revisit. This is a workaround for getting non-aligned packets. in wl1251_tx_send_packet()
199 Our DMA requires packets to be aligned on a 4-byte boundary. in wl1251_tx_send_packet()
201 if (unlikely((long)skb->data & 0x03)) { in wl1251_tx_send_packet()
202 int offset = (4 - (long)skb->data) & 0x03; in wl1251_tx_send_packet()
211 return -EINVAL; in wl1251_tx_send_packet()
213 tx_hdr = (struct tx_double_buffer_desc *) newskb->data; in wl1251_tx_send_packet()
216 wl->tx_frames[tx_hdr->id] = skb = newskb; in wl1251_tx_send_packet()
218 offset = (4 - (long)skb->data) & 0x03; in wl1251_tx_send_packet()
222 /* align the buffer on a 4-byte boundary */ in wl1251_tx_send_packet()
224 unsigned char *src = skb->data; in wl1251_tx_send_packet()
226 memmove(skb->data, src, skb->len); in wl1251_tx_send_packet()
227 tx_hdr = (struct tx_double_buffer_desc *) skb->data; in wl1251_tx_send_packet()
231 /* Our skb->data at this point includes the HW header */ in wl1251_tx_send_packet()
232 len = WL1251_TX_ALIGN(skb->len); in wl1251_tx_send_packet()
234 if (wl->data_in_count & 0x1) in wl1251_tx_send_packet()
235 addr = wl->data_path->tx_packet_ring_addr + in wl1251_tx_send_packet()
236 wl->data_path->tx_packet_ring_chunk_size; in wl1251_tx_send_packet()
238 addr = wl->data_path->tx_packet_ring_addr; in wl1251_tx_send_packet()
240 wl1251_mem_write(wl, addr, skb->data, len); in wl1251_tx_send_packet()
243 "queue %d", tx_hdr->id, skb, tx_hdr->length, in wl1251_tx_send_packet()
244 tx_hdr->rate, tx_hdr->xmit_queue); in wl1251_tx_send_packet()
253 if (wl->data_in_count & 0x1) { in wl1251_tx_trigger()
264 wl->data_in_count = (wl->data_in_count + 1) & in wl1251_tx_trigger()
272 ret = wl1251_cmd_join(wl, BSS_TYPE_STA_BSS, wl->channel, in enable_tx_for_packet_injection()
273 wl->beacon_int, wl->dtim_period); in enable_tx_for_packet_injection()
285 wl->joined = true; in enable_tx_for_packet_injection()
288 /* caller must hold wl->mutex */
297 if (info->control.hw_key) { in wl1251_tx_frame()
298 if (unlikely(wl->monitor_present)) in wl1251_tx_frame()
299 return -EINVAL; in wl1251_tx_frame()
301 idx = info->control.hw_key->hw_key_idx; in wl1251_tx_frame()
302 if (unlikely(wl->default_key != idx)) { in wl1251_tx_frame()
310 if ((wl->vif == NULL) && !wl->joined) in wl1251_tx_frame()
337 mutex_lock(&wl->mutex); in wl1251_tx_work()
339 if (unlikely(wl->state == WL1251_STATE_OFF)) in wl1251_tx_work()
342 while ((skb = skb_dequeue(&wl->tx_queue))) { in wl1251_tx_work()
351 if (ret == -EBUSY) { in wl1251_tx_work()
352 skb_queue_head(&wl->tx_queue, skb); in wl1251_tx_work()
364 mutex_unlock(&wl->mutex); in wl1251_tx_work()
403 skb = wl->tx_frames[result->id]; in wl1251_tx_packet_cb()
405 wl1251_error("SKB for packet %d is NULL", result->id); in wl1251_tx_packet_cb()
411 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && in wl1251_tx_packet_cb()
412 !(info->flags & IEEE80211_TX_CTL_INJECTED) && in wl1251_tx_packet_cb()
413 (result->status == TX_SUCCESS)) in wl1251_tx_packet_cb()
414 info->flags |= IEEE80211_TX_STAT_ACK; in wl1251_tx_packet_cb()
416 info->status.rates[0].count = result->ack_failures + 1; in wl1251_tx_packet_cb()
417 wl->stats.retry_count += result->ack_failures; in wl1251_tx_packet_cb()
424 if (info->control.hw_key && in wl1251_tx_packet_cb()
425 info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { in wl1251_tx_packet_cb()
433 result->id, skb, result->ack_failures, result->rate, in wl1251_tx_packet_cb()
434 result->status, wl1251_tx_parse_status(result->status)); in wl1251_tx_packet_cb()
437 ieee80211_tx_status_skb(wl->hw, skb); in wl1251_tx_packet_cb()
439 wl->tx_frames[result->id] = NULL; in wl1251_tx_packet_cb()
449 if (unlikely(wl->state != WL1251_STATE_ON)) in wl1251_tx_complete()
459 wl1251_mem_read(wl, wl->data_path->tx_complete_addr, result, in wl1251_tx_complete()
462 result_index = wl->next_tx_complete; in wl1251_tx_complete()
467 if (result_ptr->done_1 == 1 && in wl1251_tx_complete()
468 result_ptr->done_2 == 1) { in wl1251_tx_complete()
471 result_ptr->done_1 = 0; in wl1251_tx_complete()
472 result_ptr->done_2 = 0; in wl1251_tx_complete()
475 (FW_TX_CMPLT_BLOCK_SIZE - 1); in wl1251_tx_complete()
482 queue_len = skb_queue_len(&wl->tx_queue); in wl1251_tx_complete()
487 ieee80211_queue_work(wl->hw, &wl->tx_work); in wl1251_tx_complete()
490 if (wl->tx_queue_stopped && in wl1251_tx_complete()
494 spin_lock_irqsave(&wl->wl_lock, flags); in wl1251_tx_complete()
495 ieee80211_wake_queues(wl->hw); in wl1251_tx_complete()
496 wl->tx_queue_stopped = false; in wl1251_tx_complete()
497 spin_unlock_irqrestore(&wl->wl_lock, flags); in wl1251_tx_complete()
506 if (result_index > wl->next_tx_complete) { in wl1251_tx_complete()
509 wl->data_path->tx_complete_addr + in wl1251_tx_complete()
510 (wl->next_tx_complete * in wl1251_tx_complete()
512 &result[wl->next_tx_complete], in wl1251_tx_complete()
517 } else if (result_index < wl->next_tx_complete) { in wl1251_tx_complete()
520 wl->data_path->tx_complete_addr + in wl1251_tx_complete()
521 (wl->next_tx_complete * in wl1251_tx_complete()
523 &result[wl->next_tx_complete], in wl1251_tx_complete()
524 (FW_TX_CMPLT_BLOCK_SIZE - in wl1251_tx_complete()
525 wl->next_tx_complete) * in wl1251_tx_complete()
529 wl->data_path->tx_complete_addr, in wl1251_tx_complete()
531 (num_complete - in wl1251_tx_complete()
533 wl->next_tx_complete) * in wl1251_tx_complete()
539 wl->data_path->tx_complete_addr, in wl1251_tx_complete()
548 wl->next_tx_complete = result_index; in wl1251_tx_complete()
551 /* caller must hold wl->mutex */
559 /* control->flags = 0; FIXME */ in wl1251_tx_flush()
561 while ((skb = skb_dequeue(&wl->tx_queue))) { in wl1251_tx_flush()
566 if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) in wl1251_tx_flush()
569 ieee80211_tx_status_skb(wl->hw, skb); in wl1251_tx_flush()
573 if (wl->tx_frames[i] != NULL) { in wl1251_tx_flush()
574 skb = wl->tx_frames[i]; in wl1251_tx_flush()
577 if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) in wl1251_tx_flush()
580 ieee80211_tx_status_skb(wl->hw, skb); in wl1251_tx_flush()
581 wl->tx_frames[i] = NULL; in wl1251_tx_flush()