Lines Matching refs:buf

27 #define WSM_SKIP(buf, size)						\  argument
29 if ((buf)->data + size > (buf)->end) \
31 (buf)->data += size; \
34 #define WSM_GET(buf, ptr, size) \ argument
36 if ((buf)->data + size > (buf)->end) \
38 memcpy(ptr, (buf)->data, size); \
39 (buf)->data += size; \
42 #define __WSM_GET(buf, type, type2, cvt) \ argument
45 if ((buf)->data + sizeof(type) > (buf)->end) \
47 val = cvt(*(type2 *)(buf)->data); \
48 (buf)->data += sizeof(type); \
52 #define WSM_GET8(buf) __WSM_GET(buf, u8, u8, (u8)) argument
53 #define WSM_GET16(buf) __WSM_GET(buf, u16, __le16, __le16_to_cpu) argument
54 #define WSM_GET32(buf) __WSM_GET(buf, u32, __le32, __le32_to_cpu) argument
56 #define WSM_PUT(buf, ptr, size) \ argument
58 if ((buf)->data + size > (buf)->end) \
59 if (wsm_buf_reserve((buf), size)) \
61 memcpy((buf)->data, ptr, size); \
62 (buf)->data += size; \
65 #define __WSM_PUT(buf, val, type, type2, cvt) \ argument
67 if ((buf)->data + sizeof(type) > (buf)->end) \
68 if (wsm_buf_reserve((buf), sizeof(type))) \
70 *(type2 *)(buf)->data = cvt(val); \
71 (buf)->data += sizeof(type); \
74 #define WSM_PUT8(buf, val) __WSM_PUT(buf, val, u8, u8, (u8)) argument
75 #define WSM_PUT16(buf, val) __WSM_PUT(buf, val, u16, __le16, __cpu_to_le16) argument
76 #define WSM_PUT32(buf, val) __WSM_PUT(buf, val, u32, __le32, __cpu_to_le32) argument
78 static void wsm_buf_reset(struct wsm_buf *buf);
79 static int wsm_buf_reserve(struct wsm_buf *buf, size_t extra_size);
82 struct wsm_buf *buf,
93 struct wsm_buf *buf) in wsm_generic_confirm() argument
95 u32 status = WSM_GET32(buf); in wsm_generic_confirm()
108 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_configuration() local
112 WSM_PUT32(buf, arg->dot11MaxTransmitMsduLifeTime); in wsm_configuration()
113 WSM_PUT32(buf, arg->dot11MaxReceiveLifeTime); in wsm_configuration()
114 WSM_PUT32(buf, arg->dot11RtsThreshold); in wsm_configuration()
117 WSM_PUT16(buf, arg->dpdData_size + 12); in wsm_configuration()
118 WSM_PUT16(buf, 1); /* DPD version */ in wsm_configuration()
119 WSM_PUT(buf, arg->dot11StationId, ETH_ALEN); in wsm_configuration()
120 WSM_PUT16(buf, 5); /* DPD flags */ in wsm_configuration()
121 WSM_PUT(buf, arg->dpdData, arg->dpdData_size); in wsm_configuration()
123 ret = wsm_cmd_send(priv, buf, arg, in wsm_configuration()
136 struct wsm_buf *buf) in wsm_configuration_confirm() argument
141 status = WSM_GET32(buf); in wsm_configuration_confirm()
145 WSM_GET(buf, arg->dot11StationId, ETH_ALEN); in wsm_configuration_confirm()
146 arg->dot11FrequencyBandsSupported = WSM_GET8(buf); in wsm_configuration_confirm()
147 WSM_SKIP(buf, 1); in wsm_configuration_confirm()
148 arg->supportedRateMask = WSM_GET32(buf); in wsm_configuration_confirm()
150 arg->txPowerRange[i].min_power_level = WSM_GET32(buf); in wsm_configuration_confirm()
151 arg->txPowerRange[i].max_power_level = WSM_GET32(buf); in wsm_configuration_confirm()
152 arg->txPowerRange[i].stepping = WSM_GET32(buf); in wsm_configuration_confirm()
166 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_reset() local
171 WSM_PUT32(buf, arg->reset_statistics ? 0 : 1); in wsm_reset()
172 ret = wsm_cmd_send(priv, buf, NULL, cmd, WSM_CMD_RESET_TIMEOUT); in wsm_reset()
185 void *buf; member
193 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_read_mib() local
196 .buf = _buf, in wsm_read_mib()
201 WSM_PUT16(buf, mib_id); in wsm_read_mib()
202 WSM_PUT16(buf, 0); in wsm_read_mib()
204 ret = wsm_cmd_send(priv, buf, &mib_buf, in wsm_read_mib()
216 struct wsm_buf *buf) in wsm_read_mib_confirm() argument
219 if (WARN_ON(WSM_GET32(buf) != WSM_STATUS_SUCCESS)) in wsm_read_mib_confirm()
222 if (WARN_ON(WSM_GET16(buf) != arg->mib_id)) in wsm_read_mib_confirm()
225 size = WSM_GET16(buf); in wsm_read_mib_confirm()
229 WSM_GET(buf, arg->buf, size); in wsm_read_mib_confirm()
244 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_write_mib() local
247 .buf = _buf, in wsm_write_mib()
253 WSM_PUT16(buf, mib_id); in wsm_write_mib()
254 WSM_PUT16(buf, buf_size); in wsm_write_mib()
255 WSM_PUT(buf, _buf, buf_size); in wsm_write_mib()
257 ret = wsm_cmd_send(priv, buf, &mib_buf, in wsm_write_mib()
269 struct wsm_buf *buf) in wsm_write_mib_confirm() argument
273 ret = wsm_generic_confirm(priv, arg, buf); in wsm_write_mib_confirm()
279 const char *p = arg->buf; in wsm_write_mib_confirm()
291 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_scan() local
304 WSM_PUT8(buf, arg->band); in wsm_scan()
305 WSM_PUT8(buf, arg->type); in wsm_scan()
306 WSM_PUT8(buf, arg->flags); in wsm_scan()
307 WSM_PUT8(buf, arg->max_tx_rate); in wsm_scan()
308 WSM_PUT32(buf, arg->auto_scan_interval); in wsm_scan()
309 WSM_PUT8(buf, arg->num_probes); in wsm_scan()
310 WSM_PUT8(buf, arg->num_channels); in wsm_scan()
311 WSM_PUT8(buf, arg->num_ssids); in wsm_scan()
312 WSM_PUT8(buf, arg->probe_delay); in wsm_scan()
315 WSM_PUT16(buf, arg->ch[i].number); in wsm_scan()
316 WSM_PUT16(buf, 0); in wsm_scan()
317 WSM_PUT32(buf, arg->ch[i].min_chan_time); in wsm_scan()
318 WSM_PUT32(buf, arg->ch[i].max_chan_time); in wsm_scan()
319 WSM_PUT32(buf, 0); in wsm_scan()
323 WSM_PUT32(buf, arg->ssids[i].length); in wsm_scan()
324 WSM_PUT(buf, &arg->ssids[i].ssid[0], in wsm_scan()
328 ret = wsm_cmd_send(priv, buf, NULL, in wsm_scan()
343 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_stop_scan() local
345 ret = wsm_cmd_send(priv, buf, NULL, in wsm_stop_scan()
353 struct wsm_buf *buf, in wsm_tx_confirm() argument
358 tx_confirm.packet_id = WSM_GET32(buf); in wsm_tx_confirm()
359 tx_confirm.status = WSM_GET32(buf); in wsm_tx_confirm()
360 tx_confirm.tx_rate = WSM_GET8(buf); in wsm_tx_confirm()
361 tx_confirm.ack_failures = WSM_GET8(buf); in wsm_tx_confirm()
362 tx_confirm.flags = WSM_GET16(buf); in wsm_tx_confirm()
363 tx_confirm.media_delay = WSM_GET32(buf); in wsm_tx_confirm()
364 tx_confirm.tx_queue_delay = WSM_GET32(buf); in wsm_tx_confirm()
375 struct wsm_buf *buf, int link_id) in wsm_multi_tx_confirm() argument
380 count = WSM_GET32(buf); in wsm_multi_tx_confirm()
395 ret = wsm_tx_confirm(priv, buf, link_id); in wsm_multi_tx_confirm()
409 struct wsm_buf *buf) in wsm_join_confirm() argument
411 arg->status = WSM_GET32(buf); in wsm_join_confirm()
415 arg->min_power_level = WSM_GET32(buf); in wsm_join_confirm()
416 arg->max_power_level = WSM_GET32(buf); in wsm_join_confirm()
428 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_join() local
432 WSM_PUT8(buf, arg->mode); in wsm_join()
433 WSM_PUT8(buf, arg->band); in wsm_join()
434 WSM_PUT16(buf, arg->channel_number); in wsm_join()
435 WSM_PUT(buf, &arg->bssid[0], sizeof(arg->bssid)); in wsm_join()
436 WSM_PUT16(buf, arg->atim_window); in wsm_join()
437 WSM_PUT8(buf, arg->preamble_type); in wsm_join()
438 WSM_PUT8(buf, arg->probe_for_join); in wsm_join()
439 WSM_PUT8(buf, arg->dtim_period); in wsm_join()
440 WSM_PUT8(buf, arg->flags); in wsm_join()
441 WSM_PUT32(buf, arg->ssid_len); in wsm_join()
442 WSM_PUT(buf, &arg->ssid[0], sizeof(arg->ssid)); in wsm_join()
443 WSM_PUT32(buf, arg->beacon_interval); in wsm_join()
444 WSM_PUT32(buf, arg->basic_rate_set); in wsm_join()
447 ret = wsm_cmd_send(priv, buf, &resp, in wsm_join()
467 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_set_bss_params() local
471 WSM_PUT8(buf, (arg->reset_beacon_loss ? 0x1 : 0)); in wsm_set_bss_params()
472 WSM_PUT8(buf, arg->beacon_lost_count); in wsm_set_bss_params()
473 WSM_PUT16(buf, arg->aid); in wsm_set_bss_params()
474 WSM_PUT32(buf, arg->operational_rate_set); in wsm_set_bss_params()
476 ret = wsm_cmd_send(priv, buf, NULL, in wsm_set_bss_params()
492 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_add_key() local
496 WSM_PUT(buf, arg, sizeof(*arg)); in wsm_add_key()
498 ret = wsm_cmd_send(priv, buf, NULL, in wsm_add_key()
514 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_remove_key() local
518 WSM_PUT8(buf, arg->index); in wsm_remove_key()
519 WSM_PUT8(buf, 0); in wsm_remove_key()
520 WSM_PUT16(buf, 0); in wsm_remove_key()
522 ret = wsm_cmd_send(priv, buf, NULL, in wsm_remove_key()
539 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_set_tx_queue_params() local
544 WSM_PUT8(buf, queue_id_to_wmm_aci[id]); in wsm_set_tx_queue_params()
545 WSM_PUT8(buf, 0); in wsm_set_tx_queue_params()
546 WSM_PUT8(buf, arg->ackPolicy); in wsm_set_tx_queue_params()
547 WSM_PUT8(buf, 0); in wsm_set_tx_queue_params()
548 WSM_PUT32(buf, arg->maxTransmitLifetime); in wsm_set_tx_queue_params()
549 WSM_PUT16(buf, arg->allowedMediumTime); in wsm_set_tx_queue_params()
550 WSM_PUT16(buf, 0); in wsm_set_tx_queue_params()
552 ret = wsm_cmd_send(priv, buf, NULL, 0x0012, WSM_CMD_TIMEOUT); in wsm_set_tx_queue_params()
568 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_set_edca_params() local
574 WSM_PUT16(buf, arg->params[3].cwmin); in wsm_set_edca_params()
575 WSM_PUT16(buf, arg->params[2].cwmin); in wsm_set_edca_params()
576 WSM_PUT16(buf, arg->params[1].cwmin); in wsm_set_edca_params()
577 WSM_PUT16(buf, arg->params[0].cwmin); in wsm_set_edca_params()
579 WSM_PUT16(buf, arg->params[3].cwmax); in wsm_set_edca_params()
580 WSM_PUT16(buf, arg->params[2].cwmax); in wsm_set_edca_params()
581 WSM_PUT16(buf, arg->params[1].cwmax); in wsm_set_edca_params()
582 WSM_PUT16(buf, arg->params[0].cwmax); in wsm_set_edca_params()
584 WSM_PUT8(buf, arg->params[3].aifns); in wsm_set_edca_params()
585 WSM_PUT8(buf, arg->params[2].aifns); in wsm_set_edca_params()
586 WSM_PUT8(buf, arg->params[1].aifns); in wsm_set_edca_params()
587 WSM_PUT8(buf, arg->params[0].aifns); in wsm_set_edca_params()
589 WSM_PUT16(buf, arg->params[3].txop_limit); in wsm_set_edca_params()
590 WSM_PUT16(buf, arg->params[2].txop_limit); in wsm_set_edca_params()
591 WSM_PUT16(buf, arg->params[1].txop_limit); in wsm_set_edca_params()
592 WSM_PUT16(buf, arg->params[0].txop_limit); in wsm_set_edca_params()
594 WSM_PUT32(buf, arg->params[3].max_rx_lifetime); in wsm_set_edca_params()
595 WSM_PUT32(buf, arg->params[2].max_rx_lifetime); in wsm_set_edca_params()
596 WSM_PUT32(buf, arg->params[1].max_rx_lifetime); in wsm_set_edca_params()
597 WSM_PUT32(buf, arg->params[0].max_rx_lifetime); in wsm_set_edca_params()
599 ret = wsm_cmd_send(priv, buf, NULL, in wsm_set_edca_params()
615 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_switch_channel() local
619 WSM_PUT8(buf, arg->mode); in wsm_switch_channel()
620 WSM_PUT8(buf, arg->switch_count); in wsm_switch_channel()
621 WSM_PUT16(buf, arg->channel_number); in wsm_switch_channel()
625 ret = wsm_cmd_send(priv, buf, NULL, in wsm_switch_channel()
643 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_set_pm() local
648 WSM_PUT8(buf, arg->mode); in wsm_set_pm()
649 WSM_PUT8(buf, arg->fast_psm_idle_period); in wsm_set_pm()
650 WSM_PUT8(buf, arg->ap_psm_change_period); in wsm_set_pm()
651 WSM_PUT8(buf, arg->min_auto_pspoll_period); in wsm_set_pm()
653 ret = wsm_cmd_send(priv, buf, NULL, in wsm_set_pm()
669 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_start() local
673 WSM_PUT8(buf, arg->mode); in wsm_start()
674 WSM_PUT8(buf, arg->band); in wsm_start()
675 WSM_PUT16(buf, arg->channel_number); in wsm_start()
676 WSM_PUT32(buf, arg->ct_window); in wsm_start()
677 WSM_PUT32(buf, arg->beacon_interval); in wsm_start()
678 WSM_PUT8(buf, arg->dtim_period); in wsm_start()
679 WSM_PUT8(buf, arg->preamble); in wsm_start()
680 WSM_PUT8(buf, arg->probe_delay); in wsm_start()
681 WSM_PUT8(buf, arg->ssid_len); in wsm_start()
682 WSM_PUT(buf, arg->ssid, sizeof(arg->ssid)); in wsm_start()
683 WSM_PUT32(buf, arg->basic_rate_set); in wsm_start()
686 ret = wsm_cmd_send(priv, buf, NULL, in wsm_start()
703 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_beacon_transmit() local
707 WSM_PUT32(buf, arg->enable_beaconing ? 1 : 0); in wsm_beacon_transmit()
709 ret = wsm_cmd_send(priv, buf, NULL, in wsm_beacon_transmit()
725 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_start_find() local
728 ret = wsm_cmd_send(priv, buf, NULL, 0x0019, WSM_CMD_TIMEOUT); in wsm_start_find()
738 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_stop_find() local
741 ret = wsm_cmd_send(priv, buf, NULL, 0x001A, WSM_CMD_TIMEOUT); in wsm_stop_find()
751 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_map_link() local
756 WSM_PUT(buf, &arg->mac_addr[0], sizeof(arg->mac_addr)); in wsm_map_link()
757 WSM_PUT16(buf, 0); in wsm_map_link()
759 ret = wsm_cmd_send(priv, buf, NULL, cmd, WSM_CMD_TIMEOUT); in wsm_map_link()
775 struct wsm_buf *buf = &priv->wsm_cmd_buf; in wsm_update_ie() local
779 WSM_PUT16(buf, arg->what); in wsm_update_ie()
780 WSM_PUT16(buf, arg->count); in wsm_update_ie()
781 WSM_PUT(buf, arg->ies, arg->length); in wsm_update_ie()
783 ret = wsm_cmd_send(priv, buf, NULL, 0x001B, WSM_CMD_TIMEOUT); in wsm_update_ie()
811 struct wsm_buf *buf) in wsm_startup_indication() argument
813 priv->wsm_caps.input_buffers = WSM_GET16(buf); in wsm_startup_indication()
814 priv->wsm_caps.input_buffer_size = WSM_GET16(buf); in wsm_startup_indication()
815 priv->wsm_caps.hw_id = WSM_GET16(buf); in wsm_startup_indication()
816 priv->wsm_caps.hw_subid = WSM_GET16(buf); in wsm_startup_indication()
817 priv->wsm_caps.status = WSM_GET16(buf); in wsm_startup_indication()
818 priv->wsm_caps.fw_cap = WSM_GET16(buf); in wsm_startup_indication()
819 priv->wsm_caps.fw_type = WSM_GET16(buf); in wsm_startup_indication()
820 priv->wsm_caps.fw_api = WSM_GET16(buf); in wsm_startup_indication()
821 priv->wsm_caps.fw_build = WSM_GET16(buf); in wsm_startup_indication()
822 priv->wsm_caps.fw_ver = WSM_GET16(buf); in wsm_startup_indication()
823 WSM_GET(buf, priv->wsm_caps.fw_label, sizeof(priv->wsm_caps.fw_label)); in wsm_startup_indication()
862 struct wsm_buf *buf, in wsm_receive_indication() argument
870 rx.status = WSM_GET32(buf); in wsm_receive_indication()
871 rx.channel_number = WSM_GET16(buf); in wsm_receive_indication()
872 rx.rx_rate = WSM_GET8(buf); in wsm_receive_indication()
873 rx.rcpi_rssi = WSM_GET8(buf); in wsm_receive_indication()
874 rx.flags = WSM_GET32(buf); in wsm_receive_indication()
892 fctl = *(__le16 *)buf->data; in wsm_receive_indication()
893 hdr_len = buf->data - buf->begin; in wsm_receive_indication()
915 static int wsm_event_indication(struct cw1200_common *priv, struct wsm_buf *buf) in wsm_event_indication() argument
929 event->evt.id = WSM_GET32(buf); in wsm_event_indication()
930 event->evt.data = WSM_GET32(buf); in wsm_event_indication()
951 struct wsm_buf *buf) in wsm_channel_switch_indication() argument
953 WARN_ON(WSM_GET32(buf)); in wsm_channel_switch_indication()
967 struct wsm_buf *buf) in wsm_set_pm_indication() argument
978 struct wsm_buf *buf) in wsm_scan_started() argument
980 u32 status = WSM_GET32(buf); in wsm_scan_started()
993 struct wsm_buf *buf) in wsm_scan_complete_indication() argument
996 arg.status = WSM_GET32(buf); in wsm_scan_complete_indication()
997 arg.psm = WSM_GET8(buf); in wsm_scan_complete_indication()
998 arg.num_channels = WSM_GET8(buf); in wsm_scan_complete_indication()
1008 struct wsm_buf *buf) in wsm_join_complete_indication() argument
1011 arg.status = WSM_GET32(buf); in wsm_join_complete_indication()
1022 struct wsm_buf *buf) in wsm_find_complete_indication() argument
1029 struct wsm_buf *buf) in wsm_ba_timeout_indication() argument
1034 WSM_GET32(buf); in wsm_ba_timeout_indication()
1035 tid = WSM_GET8(buf); in wsm_ba_timeout_indication()
1036 WSM_GET8(buf); in wsm_ba_timeout_indication()
1037 WSM_GET(buf, addr, ETH_ALEN); in wsm_ba_timeout_indication()
1049 int link_id, struct wsm_buf *buf) in wsm_suspend_resume_indication() argument
1054 flags = WSM_GET32(buf); in wsm_suspend_resume_indication()
1073 struct wsm_buf *buf, in wsm_cmd_send() argument
1076 size_t buf_len = buf->data - buf->begin; in wsm_cmd_send()
1097 cmd, __le16_to_cpu(((__le16 *)buf->begin)[2]), in wsm_cmd_send()
1110 ((__le16 *)buf->begin)[0] = __cpu_to_le16(buf_len); in wsm_cmd_send()
1111 ((__le16 *)buf->begin)[1] = __cpu_to_le16(cmd); in wsm_cmd_send()
1115 priv->wsm_cmd.ptr = buf->begin; in wsm_cmd_send()
1138 buf->begin, buf_len); in wsm_cmd_send()
1153 wsm_buf_reset(buf); in wsm_cmd_send()
1241 struct wsm_buf buf; in wsm_handle_exception() local
1254 buf.begin = buf.data = data; in wsm_handle_exception()
1255 buf.end = &buf.begin[len]; in wsm_handle_exception()
1257 reason = WSM_GET32(&buf); in wsm_handle_exception()
1259 reg[i] = WSM_GET32(&buf); in wsm_handle_exception()
1260 WSM_GET(&buf, fname, sizeof(fname)); in wsm_handle_exception()
1775 void wsm_buf_init(struct wsm_buf *buf) in wsm_buf_init() argument
1777 BUG_ON(buf->begin); in wsm_buf_init()
1778 buf->begin = kmalloc(FWLOAD_BLOCK_SIZE, GFP_KERNEL | GFP_DMA); in wsm_buf_init()
1779 buf->end = buf->begin ? &buf->begin[FWLOAD_BLOCK_SIZE] : buf->begin; in wsm_buf_init()
1780 wsm_buf_reset(buf); in wsm_buf_init()
1783 void wsm_buf_deinit(struct wsm_buf *buf) in wsm_buf_deinit() argument
1785 kfree(buf->begin); in wsm_buf_deinit()
1786 buf->begin = buf->data = buf->end = NULL; in wsm_buf_deinit()
1789 static void wsm_buf_reset(struct wsm_buf *buf) in wsm_buf_reset() argument
1791 if (buf->begin) { in wsm_buf_reset()
1792 buf->data = &buf->begin[4]; in wsm_buf_reset()
1793 *(u32 *)buf->begin = 0; in wsm_buf_reset()
1795 buf->data = buf->begin; in wsm_buf_reset()
1799 static int wsm_buf_reserve(struct wsm_buf *buf, size_t extra_size) in wsm_buf_reserve() argument
1801 size_t pos = buf->data - buf->begin; in wsm_buf_reserve()
1807 tmp = krealloc(buf->begin, size, GFP_KERNEL | GFP_DMA); in wsm_buf_reserve()
1809 wsm_buf_deinit(buf); in wsm_buf_reserve()
1813 buf->begin = tmp; in wsm_buf_reserve()
1814 buf->data = &buf->begin[pos]; in wsm_buf_reserve()
1815 buf->end = &buf->begin[size]; in wsm_buf_reserve()