Lines Matching refs:buf

30 #define WSM_SKIP(buf, size)						\  argument
32 if ((buf)->data + size > (buf)->end) \
34 (buf)->data += size; \
37 #define WSM_GET(buf, ptr, size) \ argument
39 if ((buf)->data + size > (buf)->end) \
41 memcpy(ptr, (buf)->data, size); \
42 (buf)->data += size; \
45 #define __WSM_GET(buf, type, type2, cvt) \ argument
48 if ((buf)->data + sizeof(type) > (buf)->end) \
50 val = cvt(*(type2 *)(buf)->data); \
51 (buf)->data += sizeof(type); \
55 #define WSM_GET8(buf) __WSM_GET(buf, u8, u8, (u8)) argument
56 #define WSM_GET16(buf) __WSM_GET(buf, u16, __le16, __le16_to_cpu) argument
57 #define WSM_GET32(buf) __WSM_GET(buf, u32, __le32, __le32_to_cpu) argument
59 #define WSM_PUT(buf, ptr, size) \ argument
61 if ((buf)->data + size > (buf)->end) \
62 if (wsm_buf_reserve((buf), size)) \
64 memcpy((buf)->data, ptr, size); \
65 (buf)->data += size; \
68 #define __WSM_PUT(buf, val, type, type2, cvt) \ argument
70 if ((buf)->data + sizeof(type) > (buf)->end) \
71 if (wsm_buf_reserve((buf), sizeof(type))) \
73 *(type2 *)(buf)->data = cvt(val); \
74 (buf)->data += sizeof(type); \
77 #define WSM_PUT8(buf, val) __WSM_PUT(buf, val, u8, u8, (u8)) argument
78 #define WSM_PUT16(buf, val) __WSM_PUT(buf, val, u16, __le16, __cpu_to_le16) argument
79 #define WSM_PUT32(buf, val) __WSM_PUT(buf, val, u32, __le32, __cpu_to_le32) argument
81 static void wsm_buf_reset(struct wsm_buf *buf);
82 static int wsm_buf_reserve(struct wsm_buf *buf, size_t extra_size);
85 struct wsm_buf *buf,
96 struct wsm_buf *buf) in wsm_generic_confirm() argument
98 u32 status = WSM_GET32(buf); in wsm_generic_confirm()
111 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_configuration() local
115 WSM_PUT32(buf, arg->dot11MaxTransmitMsduLifeTime); in wsm_configuration()
116 WSM_PUT32(buf, arg->dot11MaxReceiveLifeTime); in wsm_configuration()
117 WSM_PUT32(buf, arg->dot11RtsThreshold); in wsm_configuration()
120 WSM_PUT16(buf, arg->dpdData_size + 12); in wsm_configuration()
121 WSM_PUT16(buf, 1); /* DPD version */ in wsm_configuration()
122 WSM_PUT(buf, arg->dot11StationId, ETH_ALEN); in wsm_configuration()
123 WSM_PUT16(buf, 5); /* DPD flags */ in wsm_configuration()
124 WSM_PUT(buf, arg->dpdData, arg->dpdData_size); in wsm_configuration()
126 ret = wsm_cmd_send(priv, buf, arg, in wsm_configuration()
139 struct wsm_buf *buf) in wsm_configuration_confirm() argument
144 status = WSM_GET32(buf); in wsm_configuration_confirm()
148 WSM_GET(buf, arg->dot11StationId, ETH_ALEN); in wsm_configuration_confirm()
149 arg->dot11FrequencyBandsSupported = WSM_GET8(buf); in wsm_configuration_confirm()
150 WSM_SKIP(buf, 1); in wsm_configuration_confirm()
151 arg->supportedRateMask = WSM_GET32(buf); in wsm_configuration_confirm()
153 arg->txPowerRange[i].min_power_level = WSM_GET32(buf); in wsm_configuration_confirm()
154 arg->txPowerRange[i].max_power_level = WSM_GET32(buf); in wsm_configuration_confirm()
155 arg->txPowerRange[i].stepping = WSM_GET32(buf); in wsm_configuration_confirm()
169 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_reset() local
174 WSM_PUT32(buf, arg->reset_statistics ? 0 : 1); in wsm_reset()
175 ret = wsm_cmd_send(priv, buf, NULL, cmd, WSM_CMD_RESET_TIMEOUT); in wsm_reset()
188 void *buf; member
196 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_read_mib() local
199 .buf = _buf, in wsm_read_mib()
204 WSM_PUT16(buf, mib_id); in wsm_read_mib()
205 WSM_PUT16(buf, 0); in wsm_read_mib()
207 ret = wsm_cmd_send(priv, buf, &mib_buf, in wsm_read_mib()
219 struct wsm_buf *buf) in wsm_read_mib_confirm() argument
222 if (WARN_ON(WSM_GET32(buf) != WSM_STATUS_SUCCESS)) in wsm_read_mib_confirm()
225 if (WARN_ON(WSM_GET16(buf) != arg->mib_id)) in wsm_read_mib_confirm()
228 size = WSM_GET16(buf); in wsm_read_mib_confirm()
232 WSM_GET(buf, arg->buf, size); in wsm_read_mib_confirm()
247 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_write_mib() local
250 .buf = _buf, in wsm_write_mib()
256 WSM_PUT16(buf, mib_id); in wsm_write_mib()
257 WSM_PUT16(buf, buf_size); in wsm_write_mib()
258 WSM_PUT(buf, _buf, buf_size); in wsm_write_mib()
260 ret = wsm_cmd_send(priv, buf, &mib_buf, in wsm_write_mib()
272 struct wsm_buf *buf) in wsm_write_mib_confirm() argument
276 ret = wsm_generic_confirm(priv, arg, buf); in wsm_write_mib_confirm()
282 const char *p = arg->buf; in wsm_write_mib_confirm()
294 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_scan() local
307 WSM_PUT8(buf, arg->band); in wsm_scan()
308 WSM_PUT8(buf, arg->type); in wsm_scan()
309 WSM_PUT8(buf, arg->flags); in wsm_scan()
310 WSM_PUT8(buf, arg->max_tx_rate); in wsm_scan()
311 WSM_PUT32(buf, arg->auto_scan_interval); in wsm_scan()
312 WSM_PUT8(buf, arg->num_probes); in wsm_scan()
313 WSM_PUT8(buf, arg->num_channels); in wsm_scan()
314 WSM_PUT8(buf, arg->num_ssids); in wsm_scan()
315 WSM_PUT8(buf, arg->probe_delay); in wsm_scan()
318 WSM_PUT16(buf, arg->ch[i].number); in wsm_scan()
319 WSM_PUT16(buf, 0); in wsm_scan()
320 WSM_PUT32(buf, arg->ch[i].min_chan_time); in wsm_scan()
321 WSM_PUT32(buf, arg->ch[i].max_chan_time); in wsm_scan()
322 WSM_PUT32(buf, 0); in wsm_scan()
326 WSM_PUT32(buf, arg->ssids[i].length); in wsm_scan()
327 WSM_PUT(buf, &arg->ssids[i].ssid[0], in wsm_scan()
331 ret = wsm_cmd_send(priv, buf, NULL, in wsm_scan()
346 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_stop_scan() local
348 ret = wsm_cmd_send(priv, buf, NULL, in wsm_stop_scan()
356 struct wsm_buf *buf, in wsm_tx_confirm() argument
361 tx_confirm.packet_id = WSM_GET32(buf); in wsm_tx_confirm()
362 tx_confirm.status = WSM_GET32(buf); in wsm_tx_confirm()
363 tx_confirm.tx_rate = WSM_GET8(buf); in wsm_tx_confirm()
364 tx_confirm.ack_failures = WSM_GET8(buf); in wsm_tx_confirm()
365 tx_confirm.flags = WSM_GET16(buf); in wsm_tx_confirm()
366 tx_confirm.media_delay = WSM_GET32(buf); in wsm_tx_confirm()
367 tx_confirm.tx_queue_delay = WSM_GET32(buf); in wsm_tx_confirm()
378 struct wsm_buf *buf, int link_id) in wsm_multi_tx_confirm() argument
384 count = WSM_GET32(buf); in wsm_multi_tx_confirm()
399 ret = wsm_tx_confirm(priv, buf, link_id); in wsm_multi_tx_confirm()
414 struct wsm_buf *buf) in wsm_join_confirm() argument
416 arg->status = WSM_GET32(buf); in wsm_join_confirm()
420 arg->min_power_level = WSM_GET32(buf); in wsm_join_confirm()
421 arg->max_power_level = WSM_GET32(buf); in wsm_join_confirm()
433 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_join() local
437 WSM_PUT8(buf, arg->mode); in wsm_join()
438 WSM_PUT8(buf, arg->band); in wsm_join()
439 WSM_PUT16(buf, arg->channel_number); in wsm_join()
440 WSM_PUT(buf, &arg->bssid[0], sizeof(arg->bssid)); in wsm_join()
441 WSM_PUT16(buf, arg->atim_window); in wsm_join()
442 WSM_PUT8(buf, arg->preamble_type); in wsm_join()
443 WSM_PUT8(buf, arg->probe_for_join); in wsm_join()
444 WSM_PUT8(buf, arg->dtim_period); in wsm_join()
445 WSM_PUT8(buf, arg->flags); in wsm_join()
446 WSM_PUT32(buf, arg->ssid_len); in wsm_join()
447 WSM_PUT(buf, &arg->ssid[0], sizeof(arg->ssid)); in wsm_join()
448 WSM_PUT32(buf, arg->beacon_interval); in wsm_join()
449 WSM_PUT32(buf, arg->basic_rate_set); in wsm_join()
452 ret = wsm_cmd_send(priv, buf, &resp, in wsm_join()
472 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_set_bss_params() local
476 WSM_PUT8(buf, (arg->reset_beacon_loss ? 0x1 : 0)); in wsm_set_bss_params()
477 WSM_PUT8(buf, arg->beacon_lost_count); in wsm_set_bss_params()
478 WSM_PUT16(buf, arg->aid); in wsm_set_bss_params()
479 WSM_PUT32(buf, arg->operational_rate_set); in wsm_set_bss_params()
481 ret = wsm_cmd_send(priv, buf, NULL, in wsm_set_bss_params()
497 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_add_key() local
501 WSM_PUT(buf, arg, sizeof(*arg)); in wsm_add_key()
503 ret = wsm_cmd_send(priv, buf, NULL, in wsm_add_key()
519 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_remove_key() local
523 WSM_PUT8(buf, arg->index); in wsm_remove_key()
524 WSM_PUT8(buf, 0); in wsm_remove_key()
525 WSM_PUT16(buf, 0); in wsm_remove_key()
527 ret = wsm_cmd_send(priv, buf, NULL, in wsm_remove_key()
544 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_set_tx_queue_params() local
549 WSM_PUT8(buf, queue_id_to_wmm_aci[id]); in wsm_set_tx_queue_params()
550 WSM_PUT8(buf, 0); in wsm_set_tx_queue_params()
551 WSM_PUT8(buf, arg->ackPolicy); in wsm_set_tx_queue_params()
552 WSM_PUT8(buf, 0); in wsm_set_tx_queue_params()
553 WSM_PUT32(buf, arg->maxTransmitLifetime); in wsm_set_tx_queue_params()
554 WSM_PUT16(buf, arg->allowedMediumTime); in wsm_set_tx_queue_params()
555 WSM_PUT16(buf, 0); in wsm_set_tx_queue_params()
557 ret = wsm_cmd_send(priv, buf, NULL, 0x0012, WSM_CMD_TIMEOUT); in wsm_set_tx_queue_params()
573 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_set_edca_params() local
579 WSM_PUT16(buf, arg->params[3].cwmin); in wsm_set_edca_params()
580 WSM_PUT16(buf, arg->params[2].cwmin); in wsm_set_edca_params()
581 WSM_PUT16(buf, arg->params[1].cwmin); in wsm_set_edca_params()
582 WSM_PUT16(buf, arg->params[0].cwmin); in wsm_set_edca_params()
584 WSM_PUT16(buf, arg->params[3].cwmax); in wsm_set_edca_params()
585 WSM_PUT16(buf, arg->params[2].cwmax); in wsm_set_edca_params()
586 WSM_PUT16(buf, arg->params[1].cwmax); in wsm_set_edca_params()
587 WSM_PUT16(buf, arg->params[0].cwmax); in wsm_set_edca_params()
589 WSM_PUT8(buf, arg->params[3].aifns); in wsm_set_edca_params()
590 WSM_PUT8(buf, arg->params[2].aifns); in wsm_set_edca_params()
591 WSM_PUT8(buf, arg->params[1].aifns); in wsm_set_edca_params()
592 WSM_PUT8(buf, arg->params[0].aifns); in wsm_set_edca_params()
594 WSM_PUT16(buf, arg->params[3].txop_limit); in wsm_set_edca_params()
595 WSM_PUT16(buf, arg->params[2].txop_limit); in wsm_set_edca_params()
596 WSM_PUT16(buf, arg->params[1].txop_limit); in wsm_set_edca_params()
597 WSM_PUT16(buf, arg->params[0].txop_limit); in wsm_set_edca_params()
599 WSM_PUT32(buf, arg->params[3].max_rx_lifetime); in wsm_set_edca_params()
600 WSM_PUT32(buf, arg->params[2].max_rx_lifetime); in wsm_set_edca_params()
601 WSM_PUT32(buf, arg->params[1].max_rx_lifetime); in wsm_set_edca_params()
602 WSM_PUT32(buf, arg->params[0].max_rx_lifetime); in wsm_set_edca_params()
604 ret = wsm_cmd_send(priv, buf, NULL, in wsm_set_edca_params()
620 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_switch_channel() local
624 WSM_PUT8(buf, arg->mode); in wsm_switch_channel()
625 WSM_PUT8(buf, arg->switch_count); in wsm_switch_channel()
626 WSM_PUT16(buf, arg->channel_number); in wsm_switch_channel()
630 ret = wsm_cmd_send(priv, buf, NULL, in wsm_switch_channel()
648 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_set_pm() local
653 WSM_PUT8(buf, arg->mode); in wsm_set_pm()
654 WSM_PUT8(buf, arg->fast_psm_idle_period); in wsm_set_pm()
655 WSM_PUT8(buf, arg->ap_psm_change_period); in wsm_set_pm()
656 WSM_PUT8(buf, arg->min_auto_pspoll_period); in wsm_set_pm()
658 ret = wsm_cmd_send(priv, buf, NULL, in wsm_set_pm()
674 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_start() local
678 WSM_PUT8(buf, arg->mode); in wsm_start()
679 WSM_PUT8(buf, arg->band); in wsm_start()
680 WSM_PUT16(buf, arg->channel_number); in wsm_start()
681 WSM_PUT32(buf, arg->ct_window); in wsm_start()
682 WSM_PUT32(buf, arg->beacon_interval); in wsm_start()
683 WSM_PUT8(buf, arg->dtim_period); in wsm_start()
684 WSM_PUT8(buf, arg->preamble); in wsm_start()
685 WSM_PUT8(buf, arg->probe_delay); in wsm_start()
686 WSM_PUT8(buf, arg->ssid_len); in wsm_start()
687 WSM_PUT(buf, arg->ssid, sizeof(arg->ssid)); in wsm_start()
688 WSM_PUT32(buf, arg->basic_rate_set); in wsm_start()
691 ret = wsm_cmd_send(priv, buf, NULL, in wsm_start()
708 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_beacon_transmit() local
712 WSM_PUT32(buf, arg->enable_beaconing ? 1 : 0); in wsm_beacon_transmit()
714 ret = wsm_cmd_send(priv, buf, NULL, in wsm_beacon_transmit()
730 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_start_find() local
733 ret = wsm_cmd_send(priv, buf, NULL, 0x0019, WSM_CMD_TIMEOUT); in wsm_start_find()
743 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_stop_find() local
746 ret = wsm_cmd_send(priv, buf, NULL, 0x001A, WSM_CMD_TIMEOUT); in wsm_stop_find()
756 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_map_link() local
761 WSM_PUT(buf, &arg->mac_addr[0], sizeof(arg->mac_addr)); in wsm_map_link()
762 WSM_PUT16(buf, 0); in wsm_map_link()
764 ret = wsm_cmd_send(priv, buf, NULL, cmd, WSM_CMD_TIMEOUT); in wsm_map_link()
780 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_update_ie() local
784 WSM_PUT16(buf, arg->what); in wsm_update_ie()
785 WSM_PUT16(buf, arg->count); in wsm_update_ie()
786 WSM_PUT(buf, arg->ies, arg->length); in wsm_update_ie()
788 ret = wsm_cmd_send(priv, buf, NULL, 0x001B, WSM_CMD_TIMEOUT); in wsm_update_ie()
816 struct wsm_buf *buf) in wsm_startup_indication() argument
818 priv->wsm_caps.input_buffers = WSM_GET16(buf); in wsm_startup_indication()
819 priv->wsm_caps.input_buffer_size = WSM_GET16(buf); in wsm_startup_indication()
820 priv->wsm_caps.hw_id = WSM_GET16(buf); in wsm_startup_indication()
821 priv->wsm_caps.hw_subid = WSM_GET16(buf); in wsm_startup_indication()
822 priv->wsm_caps.status = WSM_GET16(buf); in wsm_startup_indication()
823 priv->wsm_caps.fw_cap = WSM_GET16(buf); in wsm_startup_indication()
824 priv->wsm_caps.fw_type = WSM_GET16(buf); in wsm_startup_indication()
825 priv->wsm_caps.fw_api = WSM_GET16(buf); in wsm_startup_indication()
826 priv->wsm_caps.fw_build = WSM_GET16(buf); in wsm_startup_indication()
827 priv->wsm_caps.fw_ver = WSM_GET16(buf); in wsm_startup_indication()
828 WSM_GET(buf, priv->wsm_caps.fw_label, sizeof(priv->wsm_caps.fw_label)); in wsm_startup_indication()
867 struct wsm_buf *buf, in wsm_receive_indication() argument
875 rx.status = WSM_GET32(buf); in wsm_receive_indication()
876 rx.channel_number = WSM_GET16(buf); in wsm_receive_indication()
877 rx.rx_rate = WSM_GET8(buf); in wsm_receive_indication()
878 rx.rcpi_rssi = WSM_GET8(buf); in wsm_receive_indication()
879 rx.flags = WSM_GET32(buf); in wsm_receive_indication()
897 fctl = *(__le16 *)buf->data; in wsm_receive_indication()
898 hdr_len = buf->data - buf->begin; in wsm_receive_indication()
920 static int wsm_event_indication(struct cw1200_common *priv, struct wsm_buf *buf) in wsm_event_indication() argument
934 event->evt.id = WSM_GET32(buf); in wsm_event_indication()
935 event->evt.data = WSM_GET32(buf); in wsm_event_indication()
956 struct wsm_buf *buf) in wsm_channel_switch_indication() argument
958 WARN_ON(WSM_GET32(buf)); in wsm_channel_switch_indication()
972 struct wsm_buf *buf) in wsm_set_pm_indication() argument
983 struct wsm_buf *buf) in wsm_scan_started() argument
985 u32 status = WSM_GET32(buf); in wsm_scan_started()
998 struct wsm_buf *buf) in wsm_scan_complete_indication() argument
1001 arg.status = WSM_GET32(buf); in wsm_scan_complete_indication()
1002 arg.psm = WSM_GET8(buf); in wsm_scan_complete_indication()
1003 arg.num_channels = WSM_GET8(buf); in wsm_scan_complete_indication()
1013 struct wsm_buf *buf) in wsm_join_complete_indication() argument
1016 arg.status = WSM_GET32(buf); in wsm_join_complete_indication()
1027 struct wsm_buf *buf) in wsm_find_complete_indication() argument
1034 struct wsm_buf *buf) in wsm_ba_timeout_indication() argument
1041 dummy = WSM_GET32(buf); in wsm_ba_timeout_indication()
1042 tid = WSM_GET8(buf); in wsm_ba_timeout_indication()
1043 dummy2 = WSM_GET8(buf); in wsm_ba_timeout_indication()
1044 WSM_GET(buf, addr, ETH_ALEN); in wsm_ba_timeout_indication()
1056 int link_id, struct wsm_buf *buf) in wsm_suspend_resume_indication() argument
1061 flags = WSM_GET32(buf); in wsm_suspend_resume_indication()
1080 struct wsm_buf *buf, in wsm_cmd_send() argument
1083 size_t buf_len = buf->data - buf->begin; in wsm_cmd_send()
1104 cmd, __le16_to_cpu(((__le16 *)buf->begin)[2]), in wsm_cmd_send()
1117 ((__le16 *)buf->begin)[0] = __cpu_to_le16(buf_len); in wsm_cmd_send()
1118 ((__le16 *)buf->begin)[1] = __cpu_to_le16(cmd); in wsm_cmd_send()
1122 priv->wsm_cmd.ptr = buf->begin; in wsm_cmd_send()
1145 buf->begin, buf_len); in wsm_cmd_send()
1160 wsm_buf_reset(buf); in wsm_cmd_send()
1248 struct wsm_buf buf; in wsm_handle_exception() local
1261 buf.begin = buf.data = data; in wsm_handle_exception()
1262 buf.end = &buf.begin[len]; in wsm_handle_exception()
1264 reason = WSM_GET32(&buf); in wsm_handle_exception()
1266 reg[i] = WSM_GET32(&buf); in wsm_handle_exception()
1267 WSM_GET(&buf, fname, sizeof(fname)); in wsm_handle_exception()
1782 void wsm_buf_init(struct wsm_buf *buf) in wsm_buf_init() argument
1784 BUG_ON(buf->begin); in wsm_buf_init()
1785 buf->begin = kmalloc(FWLOAD_BLOCK_SIZE, GFP_KERNEL | GFP_DMA); in wsm_buf_init()
1786 buf->end = buf->begin ? &buf->begin[FWLOAD_BLOCK_SIZE] : buf->begin; in wsm_buf_init()
1787 wsm_buf_reset(buf); in wsm_buf_init()
1790 void wsm_buf_deinit(struct wsm_buf *buf) in wsm_buf_deinit() argument
1792 kfree(buf->begin); in wsm_buf_deinit()
1793 buf->begin = buf->data = buf->end = NULL; in wsm_buf_deinit()
1796 static void wsm_buf_reset(struct wsm_buf *buf) in wsm_buf_reset() argument
1798 if (buf->begin) { in wsm_buf_reset()
1799 buf->data = &buf->begin[4]; in wsm_buf_reset()
1800 *(u32 *)buf->begin = 0; in wsm_buf_reset()
1802 buf->data = buf->begin; in wsm_buf_reset()
1806 static int wsm_buf_reserve(struct wsm_buf *buf, size_t extra_size) in wsm_buf_reserve() argument
1808 size_t pos = buf->data - buf->begin; in wsm_buf_reserve()
1813 buf->begin = krealloc(buf->begin, size, GFP_KERNEL | GFP_DMA); in wsm_buf_reserve()
1814 if (buf->begin) { in wsm_buf_reserve()
1815 buf->data = &buf->begin[pos]; in wsm_buf_reserve()
1816 buf->end = &buf->begin[size]; in wsm_buf_reserve()
1819 buf->end = buf->data = buf->begin; in wsm_buf_reserve()