1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
16 #include <linux/bitfield.h>
22 struct wmi_tlv_policy
{
26 static const struct wmi_tlv_policy wmi_tlv_policies
[] = {
27 [WMI_TLV_TAG_ARRAY_BYTE
]
29 [WMI_TLV_TAG_ARRAY_UINT32
]
31 [WMI_TLV_TAG_STRUCT_SCAN_EVENT
]
32 = { .min_len
= sizeof(struct wmi_scan_event
) },
33 [WMI_TLV_TAG_STRUCT_MGMT_RX_HDR
]
34 = { .min_len
= sizeof(struct wmi_tlv_mgmt_rx_ev
) },
35 [WMI_TLV_TAG_STRUCT_CHAN_INFO_EVENT
]
36 = { .min_len
= sizeof(struct wmi_chan_info_event
) },
37 [WMI_TLV_TAG_STRUCT_VDEV_START_RESPONSE_EVENT
]
38 = { .min_len
= sizeof(struct wmi_vdev_start_response_event
) },
39 [WMI_TLV_TAG_STRUCT_PEER_STA_KICKOUT_EVENT
]
40 = { .min_len
= sizeof(struct wmi_peer_sta_kickout_event
) },
41 [WMI_TLV_TAG_STRUCT_HOST_SWBA_EVENT
]
42 = { .min_len
= sizeof(struct wmi_host_swba_event
) },
43 [WMI_TLV_TAG_STRUCT_TIM_INFO
]
44 = { .min_len
= sizeof(struct wmi_tim_info
) },
45 [WMI_TLV_TAG_STRUCT_P2P_NOA_INFO
]
46 = { .min_len
= sizeof(struct wmi_p2p_noa_info
) },
47 [WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT
]
48 = { .min_len
= sizeof(struct wmi_tlv_svc_rdy_ev
) },
49 [WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES
]
50 = { .min_len
= sizeof(struct hal_reg_capabilities
) },
51 [WMI_TLV_TAG_STRUCT_WLAN_HOST_MEM_REQ
]
52 = { .min_len
= sizeof(struct wlan_host_mem_req
) },
53 [WMI_TLV_TAG_STRUCT_READY_EVENT
]
54 = { .min_len
= sizeof(struct wmi_tlv_rdy_ev
) },
55 [WMI_TLV_TAG_STRUCT_OFFLOAD_BCN_TX_STATUS_EVENT
]
56 = { .min_len
= sizeof(struct wmi_tlv_bcn_tx_status_ev
) },
57 [WMI_TLV_TAG_STRUCT_DIAG_DATA_CONTAINER_EVENT
]
58 = { .min_len
= sizeof(struct wmi_tlv_diag_data_ev
) },
59 [WMI_TLV_TAG_STRUCT_P2P_NOA_EVENT
]
60 = { .min_len
= sizeof(struct wmi_tlv_p2p_noa_ev
) },
61 [WMI_TLV_TAG_STRUCT_ROAM_EVENT
]
62 = { .min_len
= sizeof(struct wmi_tlv_roam_ev
) },
63 [WMI_TLV_TAG_STRUCT_WOW_EVENT_INFO
]
64 = { .min_len
= sizeof(struct wmi_tlv_wow_event_info
) },
65 [WMI_TLV_TAG_STRUCT_TX_PAUSE_EVENT
]
66 = { .min_len
= sizeof(struct wmi_tlv_tx_pause_ev
) },
70 ath10k_wmi_tlv_iter(struct ath10k
*ar
, const void *ptr
, size_t len
,
71 int (*iter
)(struct ath10k
*ar
, u16 tag
, u16 len
,
72 const void *ptr
, void *data
),
75 const void *begin
= ptr
;
76 const struct wmi_tlv
*tlv
;
81 if (len
< sizeof(*tlv
)) {
82 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
83 "wmi tlv parse failure at byte %zd (%zu bytes left, %zu expected)\n",
84 ptr
- begin
, len
, sizeof(*tlv
));
89 tlv_tag
= __le16_to_cpu(tlv
->tag
);
90 tlv_len
= __le16_to_cpu(tlv
->len
);
95 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
96 "wmi tlv parse failure of tag %hhu at byte %zd (%zu bytes left, %hhu expected)\n",
97 tlv_tag
, ptr
- begin
, len
, tlv_len
);
101 if (tlv_tag
< ARRAY_SIZE(wmi_tlv_policies
) &&
102 wmi_tlv_policies
[tlv_tag
].min_len
&&
103 wmi_tlv_policies
[tlv_tag
].min_len
> tlv_len
) {
104 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
105 "wmi tlv parse failure of tag %hhu at byte %zd (%hhu bytes is less than min length %zu)\n",
106 tlv_tag
, ptr
- begin
, tlv_len
,
107 wmi_tlv_policies
[tlv_tag
].min_len
);
111 ret
= iter(ar
, tlv_tag
, tlv_len
, ptr
, data
);
122 static int ath10k_wmi_tlv_iter_parse(struct ath10k
*ar
, u16 tag
, u16 len
,
123 const void *ptr
, void *data
)
125 const void **tb
= data
;
127 if (tag
< WMI_TLV_TAG_MAX
)
133 static int ath10k_wmi_tlv_parse(struct ath10k
*ar
, const void **tb
,
134 const void *ptr
, size_t len
)
136 return ath10k_wmi_tlv_iter(ar
, ptr
, len
, ath10k_wmi_tlv_iter_parse
,
141 ath10k_wmi_tlv_parse_alloc(struct ath10k
*ar
, const void *ptr
,
142 size_t len
, gfp_t gfp
)
147 tb
= kcalloc(WMI_TLV_TAG_MAX
, sizeof(*tb
), gfp
);
149 return ERR_PTR(-ENOMEM
);
151 ret
= ath10k_wmi_tlv_parse(ar
, tb
, ptr
, len
);
160 static u16
ath10k_wmi_tlv_len(const void *ptr
)
162 return __le16_to_cpu((((const struct wmi_tlv
*)ptr
) - 1)->len
);
168 static int ath10k_wmi_tlv_event_bcn_tx_status(struct ath10k
*ar
,
172 const struct wmi_tlv_bcn_tx_status_ev
*ev
;
173 struct ath10k_vif
*arvif
;
174 u32 vdev_id
, tx_status
;
177 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
180 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
184 ev
= tb
[WMI_TLV_TAG_STRUCT_OFFLOAD_BCN_TX_STATUS_EVENT
];
190 tx_status
= __le32_to_cpu(ev
->tx_status
);
191 vdev_id
= __le32_to_cpu(ev
->vdev_id
);
194 case WMI_TLV_BCN_TX_STATUS_OK
:
196 case WMI_TLV_BCN_TX_STATUS_XRETRY
:
197 case WMI_TLV_BCN_TX_STATUS_DROP
:
198 case WMI_TLV_BCN_TX_STATUS_FILTERED
:
199 /* FIXME: It's probably worth telling mac80211 to stop the
200 * interface as it is crippled.
202 ath10k_warn(ar
, "received bcn tmpl tx status on vdev %i: %d",
207 arvif
= ath10k_get_arvif(ar
, vdev_id
);
208 if (arvif
&& arvif
->is_up
&& arvif
->vif
->csa_active
)
209 ieee80211_queue_work(ar
->hw
, &arvif
->ap_csa_work
);
215 static void ath10k_wmi_tlv_event_vdev_delete_resp(struct ath10k
*ar
,
218 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "WMI_VDEV_DELETE_RESP_EVENTID\n");
219 complete(&ar
->vdev_delete_done
);
222 static int ath10k_wmi_tlv_parse_peer_stats_info(struct ath10k
*ar
, u16 tag
, u16 len
,
223 const void *ptr
, void *data
)
225 const struct wmi_tlv_peer_stats_info
*stat
= ptr
;
226 struct ieee80211_sta
*sta
;
227 struct ath10k_sta
*arsta
;
229 if (tag
!= WMI_TLV_TAG_STRUCT_PEER_STATS_INFO
)
232 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
233 "wmi tlv stats peer addr %pMF rx rate code 0x%x bit rate %d kbps\n",
234 stat
->peer_macaddr
.addr
,
235 __le32_to_cpu(stat
->last_rx_rate_code
),
236 __le32_to_cpu(stat
->last_rx_bitrate_kbps
));
238 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
239 "wmi tlv stats tx rate code 0x%x bit rate %d kbps\n",
240 __le32_to_cpu(stat
->last_tx_rate_code
),
241 __le32_to_cpu(stat
->last_tx_bitrate_kbps
));
243 sta
= ieee80211_find_sta_by_ifaddr(ar
->hw
, stat
->peer_macaddr
.addr
, NULL
);
245 ath10k_warn(ar
, "not found station for peer stats\n");
249 arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
250 arsta
->rx_rate_code
= __le32_to_cpu(stat
->last_rx_rate_code
);
251 arsta
->rx_bitrate_kbps
= __le32_to_cpu(stat
->last_rx_bitrate_kbps
);
252 arsta
->tx_rate_code
= __le32_to_cpu(stat
->last_tx_rate_code
);
253 arsta
->tx_bitrate_kbps
= __le32_to_cpu(stat
->last_tx_bitrate_kbps
);
258 static int ath10k_wmi_tlv_op_pull_peer_stats_info(struct ath10k
*ar
,
262 const struct wmi_tlv_peer_stats_info_ev
*ev
;
267 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
270 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
274 ev
= tb
[WMI_TLV_TAG_STRUCT_PEER_STATS_INFO_EVENT
];
275 data
= tb
[WMI_TLV_TAG_ARRAY_STRUCT
];
282 num_peer_stats
= __le32_to_cpu(ev
->num_peers
);
284 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
285 "wmi tlv peer stats info update peer vdev id %d peers %i more data %d\n",
286 __le32_to_cpu(ev
->vdev_id
),
288 __le32_to_cpu(ev
->more_data
));
290 ret
= ath10k_wmi_tlv_iter(ar
, data
, ath10k_wmi_tlv_len(data
),
291 ath10k_wmi_tlv_parse_peer_stats_info
, NULL
);
293 ath10k_warn(ar
, "failed to parse stats info tlv: %d\n", ret
);
299 static void ath10k_wmi_tlv_event_peer_stats_info(struct ath10k
*ar
,
302 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "WMI_PEER_STATS_INFO_EVENTID\n");
303 ath10k_wmi_tlv_op_pull_peer_stats_info(ar
, skb
);
304 complete(&ar
->peer_stats_info_complete
);
307 static int ath10k_wmi_tlv_event_diag_data(struct ath10k
*ar
,
311 const struct wmi_tlv_diag_data_ev
*ev
;
312 const struct wmi_tlv_diag_item
*item
;
314 int ret
, num_items
, len
;
316 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
319 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
323 ev
= tb
[WMI_TLV_TAG_STRUCT_DIAG_DATA_CONTAINER_EVENT
];
324 data
= tb
[WMI_TLV_TAG_ARRAY_BYTE
];
330 num_items
= __le32_to_cpu(ev
->num_items
);
331 len
= ath10k_wmi_tlv_len(data
);
333 while (num_items
--) {
336 if (len
< sizeof(*item
)) {
337 ath10k_warn(ar
, "failed to parse diag data: can't fit item header\n");
343 if (len
< sizeof(*item
) + __le16_to_cpu(item
->len
)) {
344 ath10k_warn(ar
, "failed to parse diag data: item is too long\n");
348 trace_ath10k_wmi_diag_container(ar
,
350 __le32_to_cpu(item
->timestamp
),
351 __le32_to_cpu(item
->code
),
352 __le16_to_cpu(item
->len
),
355 len
-= sizeof(*item
);
356 len
-= roundup(__le16_to_cpu(item
->len
), 4);
358 data
+= sizeof(*item
);
359 data
+= roundup(__le16_to_cpu(item
->len
), 4);
362 if (num_items
!= -1 || len
!= 0)
363 ath10k_warn(ar
, "failed to parse diag data event: num_items %d len %d\n",
370 static int ath10k_wmi_tlv_event_diag(struct ath10k
*ar
,
377 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
380 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
384 data
= tb
[WMI_TLV_TAG_ARRAY_BYTE
];
389 len
= ath10k_wmi_tlv_len(data
);
391 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv diag event len %d\n", len
);
392 trace_ath10k_wmi_diag(ar
, data
, len
);
398 static int ath10k_wmi_tlv_event_p2p_noa(struct ath10k
*ar
,
402 const struct wmi_tlv_p2p_noa_ev
*ev
;
403 const struct wmi_p2p_noa_info
*noa
;
406 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
409 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
413 ev
= tb
[WMI_TLV_TAG_STRUCT_P2P_NOA_EVENT
];
414 noa
= tb
[WMI_TLV_TAG_STRUCT_P2P_NOA_INFO
];
421 vdev_id
= __le32_to_cpu(ev
->vdev_id
);
423 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
424 "wmi tlv p2p noa vdev_id %i descriptors %hhu\n",
425 vdev_id
, noa
->num_descriptors
);
427 ath10k_p2p_noa_update_by_vdev_id(ar
, vdev_id
, noa
);
432 static int ath10k_wmi_tlv_event_tx_pause(struct ath10k
*ar
,
436 const struct wmi_tlv_tx_pause_ev
*ev
;
438 u32 pause_id
, action
, vdev_map
, peer_id
, tid_map
;
440 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
443 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
447 ev
= tb
[WMI_TLV_TAG_STRUCT_TX_PAUSE_EVENT
];
453 pause_id
= __le32_to_cpu(ev
->pause_id
);
454 action
= __le32_to_cpu(ev
->action
);
455 vdev_map
= __le32_to_cpu(ev
->vdev_map
);
456 peer_id
= __le32_to_cpu(ev
->peer_id
);
457 tid_map
= __le32_to_cpu(ev
->tid_map
);
459 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
460 "wmi tlv tx pause pause_id %u action %u vdev_map 0x%08x peer_id %u tid_map 0x%08x\n",
461 pause_id
, action
, vdev_map
, peer_id
, tid_map
);
464 case WMI_TLV_TX_PAUSE_ID_MCC
:
465 case WMI_TLV_TX_PAUSE_ID_P2P_CLI_NOA
:
466 case WMI_TLV_TX_PAUSE_ID_P2P_GO_PS
:
467 case WMI_TLV_TX_PAUSE_ID_AP_PS
:
468 case WMI_TLV_TX_PAUSE_ID_IBSS_PS
:
469 for (vdev_id
= 0; vdev_map
; vdev_id
++) {
470 if (!(vdev_map
& BIT(vdev_id
)))
473 vdev_map
&= ~BIT(vdev_id
);
474 ath10k_mac_handle_tx_pause_vdev(ar
, vdev_id
, pause_id
,
478 case WMI_TLV_TX_PAUSE_ID_AP_PEER_PS
:
479 case WMI_TLV_TX_PAUSE_ID_AP_PEER_UAPSD
:
480 case WMI_TLV_TX_PAUSE_ID_STA_ADD_BA
:
481 case WMI_TLV_TX_PAUSE_ID_HOST
:
482 ath10k_dbg(ar
, ATH10K_DBG_MAC
,
483 "mac ignoring unsupported tx pause id %d\n",
487 ath10k_dbg(ar
, ATH10K_DBG_MAC
,
488 "mac ignoring unknown tx pause vdev %d\n",
497 static void ath10k_wmi_tlv_event_rfkill_state_change(struct ath10k
*ar
,
500 const struct wmi_tlv_rfkill_state_change_ev
*ev
;
505 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
509 "failed to parse rfkill state change event: %d\n",
514 ev
= tb
[WMI_TLV_TAG_STRUCT_RFKILL_EVENT
];
520 ath10k_dbg(ar
, ATH10K_DBG_MAC
,
521 "wmi tlv rfkill state change gpio %d type %d radio_state %d\n",
522 __le32_to_cpu(ev
->gpio_pin_num
),
523 __le32_to_cpu(ev
->int_type
),
524 __le32_to_cpu(ev
->radio_state
));
526 radio
= (__le32_to_cpu(ev
->radio_state
) == WMI_TLV_RFKILL_RADIO_STATE_ON
);
528 spin_lock_bh(&ar
->data_lock
);
531 ar
->hw_rfkill_on
= true;
533 spin_unlock_bh(&ar
->data_lock
);
535 /* notify cfg80211 radio state change */
536 ath10k_mac_rfkill_enable_radio(ar
, radio
);
537 wiphy_rfkill_set_hw_state(ar
->hw
->wiphy
, !radio
);
540 static int ath10k_wmi_tlv_event_temperature(struct ath10k
*ar
,
543 const struct wmi_tlv_pdev_temperature_event
*ev
;
545 ev
= (struct wmi_tlv_pdev_temperature_event
*)skb
->data
;
546 if (WARN_ON(skb
->len
< sizeof(*ev
)))
549 ath10k_thermal_event_temperature(ar
, __le32_to_cpu(ev
->temperature
));
553 static void ath10k_wmi_event_tdls_peer(struct ath10k
*ar
, struct sk_buff
*skb
)
555 struct ieee80211_sta
*station
;
556 const struct wmi_tlv_tdls_peer_event
*ev
;
558 struct ath10k_vif
*arvif
;
560 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
562 ath10k_warn(ar
, "tdls peer failed to parse tlv");
565 ev
= tb
[WMI_TLV_TAG_STRUCT_TDLS_PEER_EVENT
];
568 ath10k_warn(ar
, "tdls peer NULL event");
572 switch (__le32_to_cpu(ev
->peer_reason
)) {
573 case WMI_TDLS_TEARDOWN_REASON_TX
:
574 case WMI_TDLS_TEARDOWN_REASON_RSSI
:
575 case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT
:
576 station
= ieee80211_find_sta_by_ifaddr(ar
->hw
,
577 ev
->peer_macaddr
.addr
,
580 ath10k_warn(ar
, "did not find station from tdls peer event");
584 arvif
= ath10k_get_arvif(ar
, __le32_to_cpu(ev
->vdev_id
));
585 ieee80211_tdls_oper_request(
586 arvif
->vif
, station
->addr
,
587 NL80211_TDLS_TEARDOWN
,
588 WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE
,
596 static int ath10k_wmi_tlv_event_peer_delete_resp(struct ath10k
*ar
,
599 struct wmi_peer_delete_resp_ev_arg
*arg
;
600 struct wmi_tlv
*tlv_hdr
;
602 tlv_hdr
= (struct wmi_tlv
*)skb
->data
;
603 arg
= (struct wmi_peer_delete_resp_ev_arg
*)tlv_hdr
->value
;
605 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "vdev id %d", arg
->vdev_id
);
606 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "peer mac addr %pM", &arg
->peer_addr
);
607 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv peer delete response\n");
609 complete(&ar
->peer_delete_done
);
618 static void ath10k_wmi_tlv_op_rx(struct ath10k
*ar
, struct sk_buff
*skb
)
620 struct wmi_cmd_hdr
*cmd_hdr
;
621 enum wmi_tlv_event_id id
;
624 cmd_hdr
= (struct wmi_cmd_hdr
*)skb
->data
;
625 id
= MS(__le32_to_cpu(cmd_hdr
->cmd_id
), WMI_CMD_HDR_CMD_ID
);
627 if (skb_pull(skb
, sizeof(struct wmi_cmd_hdr
)) == NULL
)
630 trace_ath10k_wmi_event(ar
, id
, skb
->data
, skb
->len
);
632 consumed
= ath10k_tm_event_wmi(ar
, id
, skb
);
634 /* Ready event must be handled normally also in UTF mode so that we
635 * know the UTF firmware has booted, others we are just bypass WMI
636 * events to testmode.
638 if (consumed
&& id
!= WMI_TLV_READY_EVENTID
) {
639 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
640 "wmi tlv testmode consumed 0x%x\n", id
);
645 case WMI_TLV_MGMT_RX_EVENTID
:
646 ath10k_wmi_event_mgmt_rx(ar
, skb
);
647 /* mgmt_rx() owns the skb now! */
649 case WMI_TLV_SCAN_EVENTID
:
650 ath10k_wmi_event_scan(ar
, skb
);
652 case WMI_TLV_CHAN_INFO_EVENTID
:
653 ath10k_wmi_event_chan_info(ar
, skb
);
655 case WMI_TLV_ECHO_EVENTID
:
656 ath10k_wmi_event_echo(ar
, skb
);
658 case WMI_TLV_DEBUG_MESG_EVENTID
:
659 ath10k_wmi_event_debug_mesg(ar
, skb
);
661 case WMI_TLV_UPDATE_STATS_EVENTID
:
662 ath10k_wmi_event_update_stats(ar
, skb
);
664 case WMI_TLV_PEER_STATS_INFO_EVENTID
:
665 ath10k_wmi_tlv_event_peer_stats_info(ar
, skb
);
667 case WMI_TLV_VDEV_START_RESP_EVENTID
:
668 ath10k_wmi_event_vdev_start_resp(ar
, skb
);
670 case WMI_TLV_VDEV_STOPPED_EVENTID
:
671 ath10k_wmi_event_vdev_stopped(ar
, skb
);
673 case WMI_TLV_VDEV_DELETE_RESP_EVENTID
:
674 ath10k_wmi_tlv_event_vdev_delete_resp(ar
, skb
);
676 case WMI_TLV_PEER_STA_KICKOUT_EVENTID
:
677 ath10k_wmi_event_peer_sta_kickout(ar
, skb
);
679 case WMI_TLV_HOST_SWBA_EVENTID
:
680 ath10k_wmi_event_host_swba(ar
, skb
);
682 case WMI_TLV_TBTTOFFSET_UPDATE_EVENTID
:
683 ath10k_wmi_event_tbttoffset_update(ar
, skb
);
685 case WMI_TLV_PHYERR_EVENTID
:
686 ath10k_wmi_event_phyerr(ar
, skb
);
688 case WMI_TLV_ROAM_EVENTID
:
689 ath10k_wmi_event_roam(ar
, skb
);
691 case WMI_TLV_PROFILE_MATCH
:
692 ath10k_wmi_event_profile_match(ar
, skb
);
694 case WMI_TLV_DEBUG_PRINT_EVENTID
:
695 ath10k_wmi_event_debug_print(ar
, skb
);
697 case WMI_TLV_PDEV_QVIT_EVENTID
:
698 ath10k_wmi_event_pdev_qvit(ar
, skb
);
700 case WMI_TLV_WLAN_PROFILE_DATA_EVENTID
:
701 ath10k_wmi_event_wlan_profile_data(ar
, skb
);
703 case WMI_TLV_RTT_MEASUREMENT_REPORT_EVENTID
:
704 ath10k_wmi_event_rtt_measurement_report(ar
, skb
);
706 case WMI_TLV_TSF_MEASUREMENT_REPORT_EVENTID
:
707 ath10k_wmi_event_tsf_measurement_report(ar
, skb
);
709 case WMI_TLV_RTT_ERROR_REPORT_EVENTID
:
710 ath10k_wmi_event_rtt_error_report(ar
, skb
);
712 case WMI_TLV_WOW_WAKEUP_HOST_EVENTID
:
713 ath10k_wmi_event_wow_wakeup_host(ar
, skb
);
715 case WMI_TLV_DCS_INTERFERENCE_EVENTID
:
716 ath10k_wmi_event_dcs_interference(ar
, skb
);
718 case WMI_TLV_PDEV_TPC_CONFIG_EVENTID
:
719 ath10k_wmi_event_pdev_tpc_config(ar
, skb
);
721 case WMI_TLV_PDEV_FTM_INTG_EVENTID
:
722 ath10k_wmi_event_pdev_ftm_intg(ar
, skb
);
724 case WMI_TLV_GTK_OFFLOAD_STATUS_EVENTID
:
725 ath10k_wmi_event_gtk_offload_status(ar
, skb
);
727 case WMI_TLV_GTK_REKEY_FAIL_EVENTID
:
728 ath10k_wmi_event_gtk_rekey_fail(ar
, skb
);
730 case WMI_TLV_TX_DELBA_COMPLETE_EVENTID
:
731 ath10k_wmi_event_delba_complete(ar
, skb
);
733 case WMI_TLV_TX_ADDBA_COMPLETE_EVENTID
:
734 ath10k_wmi_event_addba_complete(ar
, skb
);
736 case WMI_TLV_VDEV_INSTALL_KEY_COMPLETE_EVENTID
:
737 ath10k_wmi_event_vdev_install_key_complete(ar
, skb
);
739 case WMI_TLV_SERVICE_READY_EVENTID
:
740 ath10k_wmi_event_service_ready(ar
, skb
);
742 case WMI_TLV_READY_EVENTID
:
743 ath10k_wmi_event_ready(ar
, skb
);
745 case WMI_TLV_SERVICE_AVAILABLE_EVENTID
:
746 ath10k_wmi_event_service_available(ar
, skb
);
748 case WMI_TLV_OFFLOAD_BCN_TX_STATUS_EVENTID
:
749 ath10k_wmi_tlv_event_bcn_tx_status(ar
, skb
);
751 case WMI_TLV_DIAG_DATA_CONTAINER_EVENTID
:
752 ath10k_wmi_tlv_event_diag_data(ar
, skb
);
754 case WMI_TLV_DIAG_EVENTID
:
755 ath10k_wmi_tlv_event_diag(ar
, skb
);
757 case WMI_TLV_P2P_NOA_EVENTID
:
758 ath10k_wmi_tlv_event_p2p_noa(ar
, skb
);
760 case WMI_TLV_TX_PAUSE_EVENTID
:
761 ath10k_wmi_tlv_event_tx_pause(ar
, skb
);
763 case WMI_TLV_RFKILL_STATE_CHANGE_EVENTID
:
764 ath10k_wmi_tlv_event_rfkill_state_change(ar
, skb
);
766 case WMI_TLV_PDEV_TEMPERATURE_EVENTID
:
767 ath10k_wmi_tlv_event_temperature(ar
, skb
);
769 case WMI_TLV_TDLS_PEER_EVENTID
:
770 ath10k_wmi_event_tdls_peer(ar
, skb
);
772 case WMI_TLV_PEER_DELETE_RESP_EVENTID
:
773 ath10k_wmi_tlv_event_peer_delete_resp(ar
, skb
);
775 case WMI_TLV_MGMT_TX_COMPLETION_EVENTID
:
776 ath10k_wmi_event_mgmt_tx_compl(ar
, skb
);
778 case WMI_TLV_MGMT_TX_BUNDLE_COMPLETION_EVENTID
:
779 ath10k_wmi_event_mgmt_tx_bundle_compl(ar
, skb
);
782 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "Unknown eventid: %d\n", id
);
790 static int ath10k_wmi_tlv_op_pull_scan_ev(struct ath10k
*ar
,
792 struct wmi_scan_ev_arg
*arg
)
795 const struct wmi_scan_event
*ev
;
798 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
801 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
805 ev
= tb
[WMI_TLV_TAG_STRUCT_SCAN_EVENT
];
811 arg
->event_type
= ev
->event_type
;
812 arg
->reason
= ev
->reason
;
813 arg
->channel_freq
= ev
->channel_freq
;
814 arg
->scan_req_id
= ev
->scan_req_id
;
815 arg
->scan_id
= ev
->scan_id
;
816 arg
->vdev_id
= ev
->vdev_id
;
823 ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev(struct ath10k
*ar
, struct sk_buff
*skb
,
824 struct wmi_tlv_mgmt_tx_compl_ev_arg
*arg
)
827 const struct wmi_tlv_mgmt_tx_compl_ev
*ev
;
830 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
833 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
837 ev
= tb
[WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_EVENT
];
839 arg
->desc_id
= ev
->desc_id
;
840 arg
->status
= ev
->status
;
841 arg
->pdev_id
= ev
->pdev_id
;
842 arg
->ppdu_id
= ev
->ppdu_id
;
844 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI
, ar
->wmi
.svc_map
))
845 arg
->ack_rssi
= ev
->ack_rssi
;
851 struct wmi_tlv_tx_bundle_compl_parse
{
852 const __le32
*num_reports
;
853 const __le32
*desc_ids
;
854 const __le32
*status
;
855 const __le32
*ppdu_ids
;
856 const __le32
*ack_rssi
;
864 ath10k_wmi_tlv_mgmt_tx_bundle_compl_parse(struct ath10k
*ar
, u16 tag
, u16 len
,
865 const void *ptr
, void *data
)
867 struct wmi_tlv_tx_bundle_compl_parse
*bundle_tx_compl
= data
;
870 case WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_BUNDLE_EVENT
:
871 bundle_tx_compl
->num_reports
= ptr
;
873 case WMI_TLV_TAG_ARRAY_UINT32
:
874 if (!bundle_tx_compl
->desc_ids_done
) {
875 bundle_tx_compl
->desc_ids_done
= true;
876 bundle_tx_compl
->desc_ids
= ptr
;
877 } else if (!bundle_tx_compl
->status_done
) {
878 bundle_tx_compl
->status_done
= true;
879 bundle_tx_compl
->status
= ptr
;
880 } else if (!bundle_tx_compl
->ppdu_ids_done
) {
881 bundle_tx_compl
->ppdu_ids_done
= true;
882 bundle_tx_compl
->ppdu_ids
= ptr
;
883 } else if (!bundle_tx_compl
->ack_rssi_done
) {
884 bundle_tx_compl
->ack_rssi_done
= true;
885 bundle_tx_compl
->ack_rssi
= ptr
;
894 static int ath10k_wmi_tlv_op_pull_mgmt_tx_bundle_compl_ev(
895 struct ath10k
*ar
, struct sk_buff
*skb
,
896 struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg
*arg
)
898 struct wmi_tlv_tx_bundle_compl_parse bundle_tx_compl
= { };
901 ret
= ath10k_wmi_tlv_iter(ar
, skb
->data
, skb
->len
,
902 ath10k_wmi_tlv_mgmt_tx_bundle_compl_parse
,
905 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
909 if (!bundle_tx_compl
.num_reports
|| !bundle_tx_compl
.desc_ids
||
910 !bundle_tx_compl
.status
)
913 arg
->num_reports
= *bundle_tx_compl
.num_reports
;
914 arg
->desc_ids
= bundle_tx_compl
.desc_ids
;
915 arg
->status
= bundle_tx_compl
.status
;
916 arg
->ppdu_ids
= bundle_tx_compl
.ppdu_ids
;
918 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI
, ar
->wmi
.svc_map
))
919 arg
->ack_rssi
= bundle_tx_compl
.ack_rssi
;
924 static int ath10k_wmi_tlv_op_pull_mgmt_rx_ev(struct ath10k
*ar
,
926 struct wmi_mgmt_rx_ev_arg
*arg
)
929 const struct wmi_tlv_mgmt_rx_ev
*ev
;
934 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
937 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
941 ev
= tb
[WMI_TLV_TAG_STRUCT_MGMT_RX_HDR
];
942 frame
= tb
[WMI_TLV_TAG_ARRAY_BYTE
];
949 arg
->channel
= ev
->channel
;
950 arg
->buf_len
= ev
->buf_len
;
951 arg
->status
= ev
->status
;
953 arg
->phy_mode
= ev
->phy_mode
;
954 arg
->rate
= ev
->rate
;
956 for (i
= 0; i
< ARRAY_SIZE(ev
->rssi
); i
++)
957 arg
->rssi
[i
] = ev
->rssi
[i
];
959 msdu_len
= __le32_to_cpu(arg
->buf_len
);
961 if (skb
->len
< (frame
- skb
->data
) + msdu_len
) {
966 /* shift the sk_buff to point to `frame` */
968 skb_put(skb
, frame
- skb
->data
);
969 skb_pull(skb
, frame
- skb
->data
);
970 skb_put(skb
, msdu_len
);
976 static int ath10k_wmi_tlv_op_pull_ch_info_ev(struct ath10k
*ar
,
978 struct wmi_ch_info_ev_arg
*arg
)
981 const struct wmi_tlv_chan_info_event
*ev
;
984 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
987 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
991 ev
= tb
[WMI_TLV_TAG_STRUCT_CHAN_INFO_EVENT
];
997 arg
->err_code
= ev
->err_code
;
998 arg
->freq
= ev
->freq
;
999 arg
->cmd_flags
= ev
->cmd_flags
;
1000 arg
->noise_floor
= ev
->noise_floor
;
1001 arg
->rx_clear_count
= ev
->rx_clear_count
;
1002 arg
->cycle_count
= ev
->cycle_count
;
1003 if (test_bit(ATH10K_FW_FEATURE_SINGLE_CHAN_INFO_PER_CHANNEL
,
1004 ar
->running_fw
->fw_file
.fw_features
))
1005 arg
->mac_clk_mhz
= ev
->mac_clk_mhz
;
1012 ath10k_wmi_tlv_op_pull_vdev_start_ev(struct ath10k
*ar
, struct sk_buff
*skb
,
1013 struct wmi_vdev_start_ev_arg
*arg
)
1016 const struct wmi_vdev_start_response_event
*ev
;
1019 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
1022 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1026 ev
= tb
[WMI_TLV_TAG_STRUCT_VDEV_START_RESPONSE_EVENT
];
1032 skb_pull(skb
, sizeof(*ev
));
1033 arg
->vdev_id
= ev
->vdev_id
;
1034 arg
->req_id
= ev
->req_id
;
1035 arg
->resp_type
= ev
->resp_type
;
1036 arg
->status
= ev
->status
;
1042 static int ath10k_wmi_tlv_op_pull_peer_kick_ev(struct ath10k
*ar
,
1043 struct sk_buff
*skb
,
1044 struct wmi_peer_kick_ev_arg
*arg
)
1047 const struct wmi_peer_sta_kickout_event
*ev
;
1050 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
1053 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1057 ev
= tb
[WMI_TLV_TAG_STRUCT_PEER_STA_KICKOUT_EVENT
];
1063 arg
->mac_addr
= ev
->peer_macaddr
.addr
;
1069 struct wmi_tlv_swba_parse
{
1070 const struct wmi_host_swba_event
*ev
;
1075 struct wmi_swba_ev_arg
*arg
;
1078 static int ath10k_wmi_tlv_swba_tim_parse(struct ath10k
*ar
, u16 tag
, u16 len
,
1079 const void *ptr
, void *data
)
1081 struct wmi_tlv_swba_parse
*swba
= data
;
1082 struct wmi_tim_info_arg
*tim_info_arg
;
1083 const struct wmi_tim_info
*tim_info_ev
= ptr
;
1085 if (tag
!= WMI_TLV_TAG_STRUCT_TIM_INFO
)
1088 if (swba
->n_tim
>= ARRAY_SIZE(swba
->arg
->tim_info
))
1091 if (__le32_to_cpu(tim_info_ev
->tim_len
) >
1092 sizeof(tim_info_ev
->tim_bitmap
)) {
1093 ath10k_warn(ar
, "refusing to parse invalid swba structure\n");
1097 tim_info_arg
= &swba
->arg
->tim_info
[swba
->n_tim
];
1098 tim_info_arg
->tim_len
= tim_info_ev
->tim_len
;
1099 tim_info_arg
->tim_mcast
= tim_info_ev
->tim_mcast
;
1100 tim_info_arg
->tim_bitmap
= tim_info_ev
->tim_bitmap
;
1101 tim_info_arg
->tim_changed
= tim_info_ev
->tim_changed
;
1102 tim_info_arg
->tim_num_ps_pending
= tim_info_ev
->tim_num_ps_pending
;
1109 static int ath10k_wmi_tlv_swba_noa_parse(struct ath10k
*ar
, u16 tag
, u16 len
,
1110 const void *ptr
, void *data
)
1112 struct wmi_tlv_swba_parse
*swba
= data
;
1114 if (tag
!= WMI_TLV_TAG_STRUCT_P2P_NOA_INFO
)
1117 if (swba
->n_noa
>= ARRAY_SIZE(swba
->arg
->noa_info
))
1120 swba
->arg
->noa_info
[swba
->n_noa
++] = ptr
;
1124 static int ath10k_wmi_tlv_swba_parse(struct ath10k
*ar
, u16 tag
, u16 len
,
1125 const void *ptr
, void *data
)
1127 struct wmi_tlv_swba_parse
*swba
= data
;
1131 case WMI_TLV_TAG_STRUCT_HOST_SWBA_EVENT
:
1134 case WMI_TLV_TAG_ARRAY_STRUCT
:
1135 if (!swba
->tim_done
) {
1136 swba
->tim_done
= true;
1137 ret
= ath10k_wmi_tlv_iter(ar
, ptr
, len
,
1138 ath10k_wmi_tlv_swba_tim_parse
,
1142 } else if (!swba
->noa_done
) {
1143 swba
->noa_done
= true;
1144 ret
= ath10k_wmi_tlv_iter(ar
, ptr
, len
,
1145 ath10k_wmi_tlv_swba_noa_parse
,
1157 static int ath10k_wmi_tlv_op_pull_swba_ev(struct ath10k
*ar
,
1158 struct sk_buff
*skb
,
1159 struct wmi_swba_ev_arg
*arg
)
1161 struct wmi_tlv_swba_parse swba
= { .arg
= arg
};
1166 ret
= ath10k_wmi_tlv_iter(ar
, skb
->data
, skb
->len
,
1167 ath10k_wmi_tlv_swba_parse
, &swba
);
1169 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1176 arg
->vdev_map
= swba
.ev
->vdev_map
;
1178 for (map
= __le32_to_cpu(arg
->vdev_map
), n_vdevs
= 0; map
; map
>>= 1)
1182 if (n_vdevs
!= swba
.n_tim
||
1183 n_vdevs
!= swba
.n_noa
)
1189 static int ath10k_wmi_tlv_op_pull_phyerr_ev_hdr(struct ath10k
*ar
,
1190 struct sk_buff
*skb
,
1191 struct wmi_phyerr_hdr_arg
*arg
)
1194 const struct wmi_tlv_phyerr_ev
*ev
;
1195 const void *phyerrs
;
1198 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
1201 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1205 ev
= tb
[WMI_TLV_TAG_STRUCT_COMB_PHYERR_RX_HDR
];
1206 phyerrs
= tb
[WMI_TLV_TAG_ARRAY_BYTE
];
1208 if (!ev
|| !phyerrs
) {
1213 arg
->num_phyerrs
= __le32_to_cpu(ev
->num_phyerrs
);
1214 arg
->tsf_l32
= __le32_to_cpu(ev
->tsf_l32
);
1215 arg
->tsf_u32
= __le32_to_cpu(ev
->tsf_u32
);
1216 arg
->buf_len
= __le32_to_cpu(ev
->buf_len
);
1217 arg
->phyerrs
= phyerrs
;
1223 #define WMI_TLV_ABI_VER_NS0 0x5F414351
1224 #define WMI_TLV_ABI_VER_NS1 0x00004C4D
1225 #define WMI_TLV_ABI_VER_NS2 0x00000000
1226 #define WMI_TLV_ABI_VER_NS3 0x00000000
1228 #define WMI_TLV_ABI_VER0_MAJOR 1
1229 #define WMI_TLV_ABI_VER0_MINOR 0
1230 #define WMI_TLV_ABI_VER0 ((((WMI_TLV_ABI_VER0_MAJOR) << 24) & 0xFF000000) | \
1231 (((WMI_TLV_ABI_VER0_MINOR) << 0) & 0x00FFFFFF))
1232 #define WMI_TLV_ABI_VER1 53
1235 ath10k_wmi_tlv_parse_mem_reqs(struct ath10k
*ar
, u16 tag
, u16 len
,
1236 const void *ptr
, void *data
)
1238 struct wmi_svc_rdy_ev_arg
*arg
= data
;
1241 if (tag
!= WMI_TLV_TAG_STRUCT_WLAN_HOST_MEM_REQ
)
1244 for (i
= 0; i
< ARRAY_SIZE(arg
->mem_reqs
); i
++) {
1245 if (!arg
->mem_reqs
[i
]) {
1246 arg
->mem_reqs
[i
] = ptr
;
1254 struct wmi_tlv_svc_rdy_parse
{
1255 const struct hal_reg_capabilities
*reg
;
1256 const struct wmi_tlv_svc_rdy_ev
*ev
;
1257 const __le32
*svc_bmap
;
1258 const struct wlan_host_mem_req
*mem_reqs
;
1260 bool dbs_hw_mode_done
;
1263 static int ath10k_wmi_tlv_svc_rdy_parse(struct ath10k
*ar
, u16 tag
, u16 len
,
1264 const void *ptr
, void *data
)
1266 struct wmi_tlv_svc_rdy_parse
*svc_rdy
= data
;
1269 case WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT
:
1272 case WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES
:
1275 case WMI_TLV_TAG_ARRAY_STRUCT
:
1276 svc_rdy
->mem_reqs
= ptr
;
1278 case WMI_TLV_TAG_ARRAY_UINT32
:
1279 if (!svc_rdy
->svc_bmap_done
) {
1280 svc_rdy
->svc_bmap_done
= true;
1281 svc_rdy
->svc_bmap
= ptr
;
1282 } else if (!svc_rdy
->dbs_hw_mode_done
) {
1283 svc_rdy
->dbs_hw_mode_done
= true;
1292 static int ath10k_wmi_tlv_op_pull_svc_rdy_ev(struct ath10k
*ar
,
1293 struct sk_buff
*skb
,
1294 struct wmi_svc_rdy_ev_arg
*arg
)
1296 const struct hal_reg_capabilities
*reg
;
1297 const struct wmi_tlv_svc_rdy_ev
*ev
;
1298 const __le32
*svc_bmap
;
1299 const struct wlan_host_mem_req
*mem_reqs
;
1300 struct wmi_tlv_svc_rdy_parse svc_rdy
= { };
1303 ret
= ath10k_wmi_tlv_iter(ar
, skb
->data
, skb
->len
,
1304 ath10k_wmi_tlv_svc_rdy_parse
, &svc_rdy
);
1306 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1312 svc_bmap
= svc_rdy
.svc_bmap
;
1313 mem_reqs
= svc_rdy
.mem_reqs
;
1315 if (!ev
|| !reg
|| !svc_bmap
|| !mem_reqs
)
1318 /* This is an internal ABI compatibility check for WMI TLV so check it
1319 * here instead of the generic WMI code.
1321 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
1322 "wmi tlv abi 0x%08x ?= 0x%08x, 0x%08x ?= 0x%08x, 0x%08x ?= 0x%08x, 0x%08x ?= 0x%08x, 0x%08x ?= 0x%08x\n",
1323 __le32_to_cpu(ev
->abi
.abi_ver0
), WMI_TLV_ABI_VER0
,
1324 __le32_to_cpu(ev
->abi
.abi_ver_ns0
), WMI_TLV_ABI_VER_NS0
,
1325 __le32_to_cpu(ev
->abi
.abi_ver_ns1
), WMI_TLV_ABI_VER_NS1
,
1326 __le32_to_cpu(ev
->abi
.abi_ver_ns2
), WMI_TLV_ABI_VER_NS2
,
1327 __le32_to_cpu(ev
->abi
.abi_ver_ns3
), WMI_TLV_ABI_VER_NS3
);
1329 if (__le32_to_cpu(ev
->abi
.abi_ver0
) != WMI_TLV_ABI_VER0
||
1330 __le32_to_cpu(ev
->abi
.abi_ver_ns0
) != WMI_TLV_ABI_VER_NS0
||
1331 __le32_to_cpu(ev
->abi
.abi_ver_ns1
) != WMI_TLV_ABI_VER_NS1
||
1332 __le32_to_cpu(ev
->abi
.abi_ver_ns2
) != WMI_TLV_ABI_VER_NS2
||
1333 __le32_to_cpu(ev
->abi
.abi_ver_ns3
) != WMI_TLV_ABI_VER_NS3
) {
1337 arg
->min_tx_power
= ev
->hw_min_tx_power
;
1338 arg
->max_tx_power
= ev
->hw_max_tx_power
;
1339 arg
->ht_cap
= ev
->ht_cap_info
;
1340 arg
->vht_cap
= ev
->vht_cap_info
;
1341 arg
->vht_supp_mcs
= ev
->vht_supp_mcs
;
1342 arg
->sw_ver0
= ev
->abi
.abi_ver0
;
1343 arg
->sw_ver1
= ev
->abi
.abi_ver1
;
1344 arg
->fw_build
= ev
->fw_build_vers
;
1345 arg
->phy_capab
= ev
->phy_capability
;
1346 arg
->num_rf_chains
= ev
->num_rf_chains
;
1347 arg
->eeprom_rd
= reg
->eeprom_rd
;
1348 arg
->low_2ghz_chan
= reg
->low_2ghz_chan
;
1349 arg
->high_2ghz_chan
= reg
->high_2ghz_chan
;
1350 arg
->low_5ghz_chan
= reg
->low_5ghz_chan
;
1351 arg
->high_5ghz_chan
= reg
->high_5ghz_chan
;
1352 arg
->num_mem_reqs
= ev
->num_mem_reqs
;
1353 arg
->service_map
= svc_bmap
;
1354 arg
->service_map_len
= ath10k_wmi_tlv_len(svc_bmap
);
1355 arg
->sys_cap_info
= ev
->sys_cap_info
;
1357 ret
= ath10k_wmi_tlv_iter(ar
, mem_reqs
, ath10k_wmi_tlv_len(mem_reqs
),
1358 ath10k_wmi_tlv_parse_mem_reqs
, arg
);
1360 ath10k_warn(ar
, "failed to parse mem_reqs tlv: %d\n", ret
);
1367 static int ath10k_wmi_tlv_op_pull_rdy_ev(struct ath10k
*ar
,
1368 struct sk_buff
*skb
,
1369 struct wmi_rdy_ev_arg
*arg
)
1372 const struct wmi_tlv_rdy_ev
*ev
;
1375 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
1378 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1382 ev
= tb
[WMI_TLV_TAG_STRUCT_READY_EVENT
];
1388 arg
->sw_version
= ev
->abi
.abi_ver0
;
1389 arg
->abi_version
= ev
->abi
.abi_ver1
;
1390 arg
->status
= ev
->status
;
1391 arg
->mac_addr
= ev
->mac_addr
.addr
;
1397 static int ath10k_wmi_tlv_svc_avail_parse(struct ath10k
*ar
, u16 tag
, u16 len
,
1398 const void *ptr
, void *data
)
1400 struct wmi_svc_avail_ev_arg
*arg
= data
;
1403 case WMI_TLV_TAG_STRUCT_SERVICE_AVAILABLE_EVENT
:
1404 arg
->service_map_ext_valid
= true;
1405 arg
->service_map_ext_len
= *(__le32
*)ptr
;
1406 arg
->service_map_ext
= ptr
+ sizeof(__le32
);
1415 static int ath10k_wmi_tlv_op_pull_svc_avail(struct ath10k
*ar
,
1416 struct sk_buff
*skb
,
1417 struct wmi_svc_avail_ev_arg
*arg
)
1421 ret
= ath10k_wmi_tlv_iter(ar
, skb
->data
, skb
->len
,
1422 ath10k_wmi_tlv_svc_avail_parse
, arg
);
1425 ath10k_warn(ar
, "failed to parse svc_avail tlv: %d\n", ret
);
1432 static void ath10k_wmi_tlv_pull_vdev_stats(const struct wmi_tlv_vdev_stats
*src
,
1433 struct ath10k_fw_stats_vdev
*dst
)
1437 dst
->vdev_id
= __le32_to_cpu(src
->vdev_id
);
1438 dst
->beacon_snr
= __le32_to_cpu(src
->beacon_snr
);
1439 dst
->data_snr
= __le32_to_cpu(src
->data_snr
);
1440 dst
->num_rx_frames
= __le32_to_cpu(src
->num_rx_frames
);
1441 dst
->num_rts_fail
= __le32_to_cpu(src
->num_rts_fail
);
1442 dst
->num_rts_success
= __le32_to_cpu(src
->num_rts_success
);
1443 dst
->num_rx_err
= __le32_to_cpu(src
->num_rx_err
);
1444 dst
->num_rx_discard
= __le32_to_cpu(src
->num_rx_discard
);
1445 dst
->num_tx_not_acked
= __le32_to_cpu(src
->num_tx_not_acked
);
1447 for (i
= 0; i
< ARRAY_SIZE(src
->num_tx_frames
); i
++)
1448 dst
->num_tx_frames
[i
] =
1449 __le32_to_cpu(src
->num_tx_frames
[i
]);
1451 for (i
= 0; i
< ARRAY_SIZE(src
->num_tx_frames_retries
); i
++)
1452 dst
->num_tx_frames_retries
[i
] =
1453 __le32_to_cpu(src
->num_tx_frames_retries
[i
]);
1455 for (i
= 0; i
< ARRAY_SIZE(src
->num_tx_frames_failures
); i
++)
1456 dst
->num_tx_frames_failures
[i
] =
1457 __le32_to_cpu(src
->num_tx_frames_failures
[i
]);
1459 for (i
= 0; i
< ARRAY_SIZE(src
->tx_rate_history
); i
++)
1460 dst
->tx_rate_history
[i
] =
1461 __le32_to_cpu(src
->tx_rate_history
[i
]);
1463 for (i
= 0; i
< ARRAY_SIZE(src
->beacon_rssi_history
); i
++)
1464 dst
->beacon_rssi_history
[i
] =
1465 __le32_to_cpu(src
->beacon_rssi_history
[i
]);
1468 static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k
*ar
,
1469 struct sk_buff
*skb
,
1470 struct ath10k_fw_stats
*stats
)
1473 const struct wmi_tlv_stats_ev
*ev
;
1474 u32 num_peer_stats_extd
;
1479 u32 num_bcnflt_stats
;
1486 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
1489 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1493 ev
= tb
[WMI_TLV_TAG_STRUCT_STATS_EVENT
];
1494 data
= tb
[WMI_TLV_TAG_ARRAY_BYTE
];
1501 data_len
= ath10k_wmi_tlv_len(data
);
1502 num_pdev_stats
= __le32_to_cpu(ev
->num_pdev_stats
);
1503 num_vdev_stats
= __le32_to_cpu(ev
->num_vdev_stats
);
1504 num_peer_stats
= __le32_to_cpu(ev
->num_peer_stats
);
1505 num_bcnflt_stats
= __le32_to_cpu(ev
->num_bcnflt_stats
);
1506 num_chan_stats
= __le32_to_cpu(ev
->num_chan_stats
);
1507 stats_id
= __le32_to_cpu(ev
->stats_id
);
1508 num_peer_stats_extd
= __le32_to_cpu(ev
->num_peer_stats_extd
);
1510 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
1511 "wmi tlv stats update pdev %i vdev %i peer %i bcnflt %i chan %i peer_extd %i\n",
1512 num_pdev_stats
, num_vdev_stats
, num_peer_stats
,
1513 num_bcnflt_stats
, num_chan_stats
, num_peer_stats_extd
);
1515 for (i
= 0; i
< num_pdev_stats
; i
++) {
1516 const struct wmi_pdev_stats
*src
;
1517 struct ath10k_fw_stats_pdev
*dst
;
1520 if (data_len
< sizeof(*src
)) {
1525 data
+= sizeof(*src
);
1526 data_len
-= sizeof(*src
);
1528 dst
= kzalloc(sizeof(*dst
), GFP_ATOMIC
);
1532 ath10k_wmi_pull_pdev_stats_base(&src
->base
, dst
);
1533 ath10k_wmi_pull_pdev_stats_tx(&src
->tx
, dst
);
1534 ath10k_wmi_pull_pdev_stats_rx(&src
->rx
, dst
);
1535 list_add_tail(&dst
->list
, &stats
->pdevs
);
1538 for (i
= 0; i
< num_vdev_stats
; i
++) {
1539 const struct wmi_tlv_vdev_stats
*src
;
1540 struct ath10k_fw_stats_vdev
*dst
;
1543 if (data_len
< sizeof(*src
)) {
1548 data
+= sizeof(*src
);
1549 data_len
-= sizeof(*src
);
1551 dst
= kzalloc(sizeof(*dst
), GFP_ATOMIC
);
1555 ath10k_wmi_tlv_pull_vdev_stats(src
, dst
);
1556 list_add_tail(&dst
->list
, &stats
->vdevs
);
1559 for (i
= 0; i
< num_peer_stats
; i
++) {
1560 const struct wmi_10x_peer_stats
*src
;
1561 struct ath10k_fw_stats_peer
*dst
;
1564 if (data_len
< sizeof(*src
)) {
1569 data
+= sizeof(*src
);
1570 data_len
-= sizeof(*src
);
1572 dst
= kzalloc(sizeof(*dst
), GFP_ATOMIC
);
1576 ath10k_wmi_pull_peer_stats(&src
->old
, dst
);
1577 dst
->peer_rx_rate
= __le32_to_cpu(src
->peer_rx_rate
);
1579 if (stats_id
& WMI_TLV_STAT_PEER_EXTD
) {
1580 const struct wmi_tlv_peer_stats_extd
*extd
;
1581 unsigned long rx_duration_high
;
1583 extd
= data
+ sizeof(*src
) * (num_peer_stats
- i
- 1)
1584 + sizeof(*extd
) * i
;
1586 dst
->rx_duration
= __le32_to_cpu(extd
->rx_duration
);
1587 rx_duration_high
= __le32_to_cpu
1588 (extd
->rx_duration_high
);
1590 if (test_bit(WMI_TLV_PEER_RX_DURATION_HIGH_VALID_BIT
,
1591 &rx_duration_high
)) {
1593 FIELD_GET(WMI_TLV_PEER_RX_DURATION_HIGH_MASK
,
1595 dst
->rx_duration
|= (u64
)rx_duration_high
<<
1596 WMI_TLV_PEER_RX_DURATION_SHIFT
;
1600 list_add_tail(&dst
->list
, &stats
->peers
);
1607 static int ath10k_wmi_tlv_op_pull_roam_ev(struct ath10k
*ar
,
1608 struct sk_buff
*skb
,
1609 struct wmi_roam_ev_arg
*arg
)
1612 const struct wmi_tlv_roam_ev
*ev
;
1615 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
1618 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1622 ev
= tb
[WMI_TLV_TAG_STRUCT_ROAM_EVENT
];
1628 arg
->vdev_id
= ev
->vdev_id
;
1629 arg
->reason
= ev
->reason
;
1630 arg
->rssi
= ev
->rssi
;
1637 ath10k_wmi_tlv_op_pull_wow_ev(struct ath10k
*ar
, struct sk_buff
*skb
,
1638 struct wmi_wow_ev_arg
*arg
)
1641 const struct wmi_tlv_wow_event_info
*ev
;
1644 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
1647 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1651 ev
= tb
[WMI_TLV_TAG_STRUCT_WOW_EVENT_INFO
];
1657 arg
->vdev_id
= __le32_to_cpu(ev
->vdev_id
);
1658 arg
->flag
= __le32_to_cpu(ev
->flag
);
1659 arg
->wake_reason
= __le32_to_cpu(ev
->wake_reason
);
1660 arg
->data_len
= __le32_to_cpu(ev
->data_len
);
1666 static int ath10k_wmi_tlv_op_pull_echo_ev(struct ath10k
*ar
,
1667 struct sk_buff
*skb
,
1668 struct wmi_echo_ev_arg
*arg
)
1671 const struct wmi_echo_event
*ev
;
1674 tb
= ath10k_wmi_tlv_parse_alloc(ar
, skb
->data
, skb
->len
, GFP_ATOMIC
);
1677 ath10k_warn(ar
, "failed to parse tlv: %d\n", ret
);
1681 ev
= tb
[WMI_TLV_TAG_STRUCT_ECHO_EVENT
];
1687 arg
->value
= ev
->value
;
1693 static struct sk_buff
*
1694 ath10k_wmi_tlv_op_gen_pdev_suspend(struct ath10k
*ar
, u32 opt
)
1696 struct wmi_tlv_pdev_suspend
*cmd
;
1697 struct wmi_tlv
*tlv
;
1698 struct sk_buff
*skb
;
1700 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
1702 return ERR_PTR(-ENOMEM
);
1704 tlv
= (void *)skb
->data
;
1705 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SUSPEND_CMD
);
1706 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
1707 cmd
= (void *)tlv
->value
;
1708 cmd
->opt
= __cpu_to_le32(opt
);
1710 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv pdev suspend\n");
1714 static struct sk_buff
*
1715 ath10k_wmi_tlv_op_gen_pdev_resume(struct ath10k
*ar
)
1717 struct wmi_tlv_resume_cmd
*cmd
;
1718 struct wmi_tlv
*tlv
;
1719 struct sk_buff
*skb
;
1721 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
1723 return ERR_PTR(-ENOMEM
);
1725 tlv
= (void *)skb
->data
;
1726 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_RESUME_CMD
);
1727 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
1728 cmd
= (void *)tlv
->value
;
1729 cmd
->reserved
= __cpu_to_le32(0);
1731 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv pdev resume\n");
1735 static struct sk_buff
*
1736 ath10k_wmi_tlv_op_gen_pdev_set_rd(struct ath10k
*ar
,
1737 u16 rd
, u16 rd2g
, u16 rd5g
,
1738 u16 ctl2g
, u16 ctl5g
,
1739 enum wmi_dfs_region dfs_reg
)
1741 struct wmi_tlv_pdev_set_rd_cmd
*cmd
;
1742 struct wmi_tlv
*tlv
;
1743 struct sk_buff
*skb
;
1745 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
1747 return ERR_PTR(-ENOMEM
);
1749 tlv
= (void *)skb
->data
;
1750 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_REGDOMAIN_CMD
);
1751 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
1752 cmd
= (void *)tlv
->value
;
1753 cmd
->regd
= __cpu_to_le32(rd
);
1754 cmd
->regd_2ghz
= __cpu_to_le32(rd2g
);
1755 cmd
->regd_5ghz
= __cpu_to_le32(rd5g
);
1756 cmd
->conform_limit_2ghz
= __cpu_to_le32(ctl2g
);
1757 cmd
->conform_limit_5ghz
= __cpu_to_le32(ctl5g
);
1759 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv pdev set rd\n");
1763 static enum wmi_txbf_conf
ath10k_wmi_tlv_txbf_conf_scheme(struct ath10k
*ar
)
1765 return WMI_TXBF_CONF_AFTER_ASSOC
;
1768 static struct sk_buff
*
1769 ath10k_wmi_tlv_op_gen_pdev_set_param(struct ath10k
*ar
, u32 param_id
,
1772 struct wmi_tlv_pdev_set_param_cmd
*cmd
;
1773 struct wmi_tlv
*tlv
;
1774 struct sk_buff
*skb
;
1776 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
1778 return ERR_PTR(-ENOMEM
);
1780 tlv
= (void *)skb
->data
;
1781 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_PARAM_CMD
);
1782 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
1783 cmd
= (void *)tlv
->value
;
1784 cmd
->param_id
= __cpu_to_le32(param_id
);
1785 cmd
->param_value
= __cpu_to_le32(param_value
);
1787 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv pdev set param %d value 0x%x\n",
1788 param_id
, param_value
);
1793 ath10k_wmi_tlv_put_host_mem_chunks(struct ath10k
*ar
, void *host_mem_chunks
)
1795 struct host_memory_chunk_tlv
*chunk
;
1796 struct wmi_tlv
*tlv
;
1799 __le16 tlv_len
, tlv_tag
;
1801 tlv_tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_WLAN_HOST_MEMORY_CHUNK
);
1802 tlv_len
= __cpu_to_le16(sizeof(*chunk
));
1803 for (i
= 0; i
< ar
->wmi
.num_mem_chunks
; i
++) {
1804 tlv
= host_mem_chunks
;
1807 chunk
= (void *)tlv
->value
;
1809 chunk
->ptr
= __cpu_to_le32(ar
->wmi
.mem_chunks
[i
].paddr
);
1810 chunk
->size
= __cpu_to_le32(ar
->wmi
.mem_chunks
[i
].len
);
1811 chunk
->req_id
= __cpu_to_le32(ar
->wmi
.mem_chunks
[i
].req_id
);
1813 if (test_bit(WMI_SERVICE_SUPPORT_EXTEND_ADDRESS
,
1815 paddr
= ar
->wmi
.mem_chunks
[i
].paddr
;
1816 chunk
->ptr_high
= __cpu_to_le32(upper_32_bits(paddr
));
1819 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
1820 "wmi-tlv chunk %d len %d, addr 0x%llx, id 0x%x\n",
1822 ar
->wmi
.mem_chunks
[i
].len
,
1823 (unsigned long long)ar
->wmi
.mem_chunks
[i
].paddr
,
1824 ar
->wmi
.mem_chunks
[i
].req_id
);
1826 host_mem_chunks
+= sizeof(*tlv
);
1827 host_mem_chunks
+= sizeof(*chunk
);
1831 static struct sk_buff
*ath10k_wmi_tlv_op_gen_init(struct ath10k
*ar
)
1833 struct sk_buff
*skb
;
1834 struct wmi_tlv
*tlv
;
1835 struct wmi_tlv_init_cmd
*cmd
;
1836 struct wmi_tlv_resource_config
*cfg
;
1838 size_t len
, chunks_len
;
1841 chunks_len
= ar
->wmi
.num_mem_chunks
*
1842 (sizeof(struct host_memory_chunk_tlv
) + sizeof(*tlv
));
1843 len
= (sizeof(*tlv
) + sizeof(*cmd
)) +
1844 (sizeof(*tlv
) + sizeof(*cfg
)) +
1845 (sizeof(*tlv
) + chunks_len
);
1847 skb
= ath10k_wmi_alloc_skb(ar
, len
);
1849 return ERR_PTR(-ENOMEM
);
1854 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_INIT_CMD
);
1855 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
1856 cmd
= (void *)tlv
->value
;
1857 ptr
+= sizeof(*tlv
);
1858 ptr
+= sizeof(*cmd
);
1861 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_RESOURCE_CONFIG
);
1862 tlv
->len
= __cpu_to_le16(sizeof(*cfg
));
1863 cfg
= (void *)tlv
->value
;
1864 ptr
+= sizeof(*tlv
);
1865 ptr
+= sizeof(*cfg
);
1868 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
1869 tlv
->len
= __cpu_to_le16(chunks_len
);
1870 chunks
= (void *)tlv
->value
;
1872 ptr
+= sizeof(*tlv
);
1875 cmd
->abi
.abi_ver0
= __cpu_to_le32(WMI_TLV_ABI_VER0
);
1876 cmd
->abi
.abi_ver1
= __cpu_to_le32(WMI_TLV_ABI_VER1
);
1877 cmd
->abi
.abi_ver_ns0
= __cpu_to_le32(WMI_TLV_ABI_VER_NS0
);
1878 cmd
->abi
.abi_ver_ns1
= __cpu_to_le32(WMI_TLV_ABI_VER_NS1
);
1879 cmd
->abi
.abi_ver_ns2
= __cpu_to_le32(WMI_TLV_ABI_VER_NS2
);
1880 cmd
->abi
.abi_ver_ns3
= __cpu_to_le32(WMI_TLV_ABI_VER_NS3
);
1881 cmd
->num_host_mem_chunks
= __cpu_to_le32(ar
->wmi
.num_mem_chunks
);
1883 cfg
->num_vdevs
= __cpu_to_le32(TARGET_TLV_NUM_VDEVS
);
1885 if (ar
->hw_params
.num_peers
)
1886 cfg
->num_peers
= __cpu_to_le32(ar
->hw_params
.num_peers
);
1888 cfg
->num_peers
= __cpu_to_le32(TARGET_TLV_NUM_PEERS
);
1889 cfg
->ast_skid_limit
= __cpu_to_le32(ar
->hw_params
.ast_skid_limit
);
1890 cfg
->num_wds_entries
= __cpu_to_le32(ar
->hw_params
.num_wds_entries
);
1892 if (test_bit(WMI_SERVICE_RX_FULL_REORDER
, ar
->wmi
.svc_map
)) {
1893 cfg
->num_offload_peers
= __cpu_to_le32(TARGET_TLV_NUM_VDEVS
);
1894 cfg
->num_offload_reorder_bufs
= __cpu_to_le32(TARGET_TLV_NUM_VDEVS
);
1896 cfg
->num_offload_peers
= __cpu_to_le32(0);
1897 cfg
->num_offload_reorder_bufs
= __cpu_to_le32(0);
1900 cfg
->num_peer_keys
= __cpu_to_le32(2);
1901 if (ar
->hw_params
.num_peers
)
1902 cfg
->num_tids
= __cpu_to_le32(ar
->hw_params
.num_peers
* 2);
1904 cfg
->num_tids
= __cpu_to_le32(TARGET_TLV_NUM_TIDS
);
1905 cfg
->tx_chain_mask
= __cpu_to_le32(0x7);
1906 cfg
->rx_chain_mask
= __cpu_to_le32(0x7);
1907 cfg
->rx_timeout_pri
[0] = __cpu_to_le32(0x64);
1908 cfg
->rx_timeout_pri
[1] = __cpu_to_le32(0x64);
1909 cfg
->rx_timeout_pri
[2] = __cpu_to_le32(0x64);
1910 cfg
->rx_timeout_pri
[3] = __cpu_to_le32(0x28);
1911 cfg
->rx_decap_mode
= __cpu_to_le32(ar
->wmi
.rx_decap_mode
);
1912 cfg
->scan_max_pending_reqs
= __cpu_to_le32(4);
1913 cfg
->bmiss_offload_max_vdev
= __cpu_to_le32(TARGET_TLV_NUM_VDEVS
);
1914 cfg
->roam_offload_max_vdev
= __cpu_to_le32(TARGET_TLV_NUM_VDEVS
);
1915 cfg
->roam_offload_max_ap_profiles
= __cpu_to_le32(8);
1916 cfg
->num_mcast_groups
= __cpu_to_le32(0);
1917 cfg
->num_mcast_table_elems
= __cpu_to_le32(0);
1918 cfg
->mcast2ucast_mode
= __cpu_to_le32(0);
1919 cfg
->tx_dbg_log_size
= __cpu_to_le32(0x400);
1920 cfg
->dma_burst_size
= __cpu_to_le32(0);
1921 cfg
->mac_aggr_delim
= __cpu_to_le32(0);
1922 cfg
->rx_skip_defrag_timeout_dup_detection_check
= __cpu_to_le32(0);
1923 cfg
->vow_config
= __cpu_to_le32(0);
1924 cfg
->gtk_offload_max_vdev
= __cpu_to_le32(2);
1925 cfg
->num_msdu_desc
= __cpu_to_le32(ar
->htt
.max_num_pending_tx
);
1926 cfg
->max_frag_entries
= __cpu_to_le32(2);
1927 cfg
->num_tdls_vdevs
= __cpu_to_le32(TARGET_TLV_NUM_TDLS_VDEVS
);
1928 cfg
->num_tdls_conn_table_entries
= __cpu_to_le32(0x20);
1929 cfg
->beacon_tx_offload_max_vdev
= __cpu_to_le32(2);
1930 cfg
->num_multicast_filter_entries
= __cpu_to_le32(5);
1931 cfg
->num_wow_filters
= __cpu_to_le32(ar
->wow
.max_num_patterns
);
1932 cfg
->num_keep_alive_pattern
= __cpu_to_le32(6);
1933 cfg
->keep_alive_pattern_size
= __cpu_to_le32(0);
1934 cfg
->max_tdls_concurrent_sleep_sta
= __cpu_to_le32(1);
1935 cfg
->max_tdls_concurrent_buffer_sta
= __cpu_to_le32(1);
1936 cfg
->wmi_send_separate
= __cpu_to_le32(0);
1937 cfg
->num_ocb_vdevs
= __cpu_to_le32(0);
1938 cfg
->num_ocb_channels
= __cpu_to_le32(0);
1939 cfg
->num_ocb_schedules
= __cpu_to_le32(0);
1940 cfg
->host_capab
= __cpu_to_le32(WMI_TLV_FLAG_MGMT_BUNDLE_TX_COMPL
);
1942 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI
, ar
->wmi
.svc_map
))
1943 cfg
->host_capab
|= __cpu_to_le32(WMI_RSRC_CFG_FLAG_TX_ACK_RSSI
);
1945 ath10k_wmi_tlv_put_host_mem_chunks(ar
, chunks
);
1947 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv init\n");
1951 static struct sk_buff
*
1952 ath10k_wmi_tlv_op_gen_start_scan(struct ath10k
*ar
,
1953 const struct wmi_start_scan_arg
*arg
)
1955 struct wmi_tlv_start_scan_cmd
*cmd
;
1956 struct wmi_tlv
*tlv
;
1957 struct sk_buff
*skb
;
1958 size_t len
, chan_len
, ssid_len
, bssid_len
, ie_len
;
1960 struct wmi_ssid
*ssids
;
1961 struct wmi_mac_addr
*addrs
;
1965 ret
= ath10k_wmi_start_scan_verify(arg
);
1967 return ERR_PTR(ret
);
1969 chan_len
= arg
->n_channels
* sizeof(__le32
);
1970 ssid_len
= arg
->n_ssids
* sizeof(struct wmi_ssid
);
1971 bssid_len
= arg
->n_bssids
* sizeof(struct wmi_mac_addr
);
1972 ie_len
= roundup(arg
->ie_len
, 4);
1973 len
= (sizeof(*tlv
) + sizeof(*cmd
)) +
1974 sizeof(*tlv
) + chan_len
+
1975 sizeof(*tlv
) + ssid_len
+
1976 sizeof(*tlv
) + bssid_len
+
1977 sizeof(*tlv
) + ie_len
;
1979 skb
= ath10k_wmi_alloc_skb(ar
, len
);
1981 return ERR_PTR(-ENOMEM
);
1983 ptr
= (void *)skb
->data
;
1985 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_START_SCAN_CMD
);
1986 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
1987 cmd
= (void *)tlv
->value
;
1989 ath10k_wmi_put_start_scan_common(&cmd
->common
, arg
);
1990 cmd
->burst_duration_ms
= __cpu_to_le32(arg
->burst_duration_ms
);
1991 cmd
->num_channels
= __cpu_to_le32(arg
->n_channels
);
1992 cmd
->num_ssids
= __cpu_to_le32(arg
->n_ssids
);
1993 cmd
->num_bssids
= __cpu_to_le32(arg
->n_bssids
);
1994 cmd
->ie_len
= __cpu_to_le32(arg
->ie_len
);
1995 cmd
->num_probes
= __cpu_to_le32(3);
1996 ether_addr_copy(cmd
->mac_addr
.addr
, arg
->mac_addr
.addr
);
1997 ether_addr_copy(cmd
->mac_mask
.addr
, arg
->mac_mask
.addr
);
1999 /* FIXME: There are some scan flag inconsistencies across firmwares,
2000 * e.g. WMI-TLV inverts the logic behind the following flag.
2002 cmd
->common
.scan_ctrl_flags
^= __cpu_to_le32(WMI_SCAN_FILTER_PROBE_REQ
);
2004 ptr
+= sizeof(*tlv
);
2005 ptr
+= sizeof(*cmd
);
2008 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32
);
2009 tlv
->len
= __cpu_to_le16(chan_len
);
2010 chans
= (void *)tlv
->value
;
2011 for (i
= 0; i
< arg
->n_channels
; i
++)
2012 chans
[i
] = __cpu_to_le32(arg
->channels
[i
]);
2014 ptr
+= sizeof(*tlv
);
2018 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_FIXED_STRUCT
);
2019 tlv
->len
= __cpu_to_le16(ssid_len
);
2020 ssids
= (void *)tlv
->value
;
2021 for (i
= 0; i
< arg
->n_ssids
; i
++) {
2022 ssids
[i
].ssid_len
= __cpu_to_le32(arg
->ssids
[i
].len
);
2023 memcpy(ssids
[i
].ssid
, arg
->ssids
[i
].ssid
, arg
->ssids
[i
].len
);
2026 ptr
+= sizeof(*tlv
);
2030 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_FIXED_STRUCT
);
2031 tlv
->len
= __cpu_to_le16(bssid_len
);
2032 addrs
= (void *)tlv
->value
;
2033 for (i
= 0; i
< arg
->n_bssids
; i
++)
2034 ether_addr_copy(addrs
[i
].addr
, arg
->bssids
[i
].bssid
);
2036 ptr
+= sizeof(*tlv
);
2040 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
2041 tlv
->len
= __cpu_to_le16(ie_len
);
2042 memcpy(tlv
->value
, arg
->ie
, arg
->ie_len
);
2044 ptr
+= sizeof(*tlv
);
2047 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv start scan\n");
2051 static struct sk_buff
*
2052 ath10k_wmi_tlv_op_gen_stop_scan(struct ath10k
*ar
,
2053 const struct wmi_stop_scan_arg
*arg
)
2055 struct wmi_stop_scan_cmd
*cmd
;
2056 struct wmi_tlv
*tlv
;
2057 struct sk_buff
*skb
;
2061 if (arg
->req_id
> 0xFFF)
2062 return ERR_PTR(-EINVAL
);
2063 if (arg
->req_type
== WMI_SCAN_STOP_ONE
&& arg
->u
.scan_id
> 0xFFF)
2064 return ERR_PTR(-EINVAL
);
2066 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2068 return ERR_PTR(-ENOMEM
);
2070 scan_id
= arg
->u
.scan_id
;
2071 scan_id
|= WMI_HOST_SCAN_REQ_ID_PREFIX
;
2073 req_id
= arg
->req_id
;
2074 req_id
|= WMI_HOST_SCAN_REQUESTOR_ID_PREFIX
;
2076 tlv
= (void *)skb
->data
;
2077 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_STOP_SCAN_CMD
);
2078 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2079 cmd
= (void *)tlv
->value
;
2080 cmd
->req_type
= __cpu_to_le32(arg
->req_type
);
2081 cmd
->vdev_id
= __cpu_to_le32(arg
->u
.vdev_id
);
2082 cmd
->scan_id
= __cpu_to_le32(scan_id
);
2083 cmd
->scan_req_id
= __cpu_to_le32(req_id
);
2085 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv stop scan\n");
2089 static int ath10k_wmi_tlv_op_get_vdev_subtype(struct ath10k
*ar
,
2090 enum wmi_vdev_subtype subtype
)
2093 case WMI_VDEV_SUBTYPE_NONE
:
2094 return WMI_TLV_VDEV_SUBTYPE_NONE
;
2095 case WMI_VDEV_SUBTYPE_P2P_DEVICE
:
2096 return WMI_TLV_VDEV_SUBTYPE_P2P_DEV
;
2097 case WMI_VDEV_SUBTYPE_P2P_CLIENT
:
2098 return WMI_TLV_VDEV_SUBTYPE_P2P_CLI
;
2099 case WMI_VDEV_SUBTYPE_P2P_GO
:
2100 return WMI_TLV_VDEV_SUBTYPE_P2P_GO
;
2101 case WMI_VDEV_SUBTYPE_PROXY_STA
:
2102 return WMI_TLV_VDEV_SUBTYPE_PROXY_STA
;
2103 case WMI_VDEV_SUBTYPE_MESH_11S
:
2104 return WMI_TLV_VDEV_SUBTYPE_MESH_11S
;
2105 case WMI_VDEV_SUBTYPE_MESH_NON_11S
:
2111 static struct sk_buff
*
2112 ath10k_wmi_tlv_op_gen_vdev_create(struct ath10k
*ar
,
2114 enum wmi_vdev_type vdev_type
,
2115 enum wmi_vdev_subtype vdev_subtype
,
2116 const u8 mac_addr
[ETH_ALEN
])
2118 struct wmi_vdev_create_cmd
*cmd
;
2119 struct wmi_tlv
*tlv
;
2120 struct sk_buff
*skb
;
2122 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2124 return ERR_PTR(-ENOMEM
);
2126 tlv
= (void *)skb
->data
;
2127 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_CREATE_CMD
);
2128 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2129 cmd
= (void *)tlv
->value
;
2130 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2131 cmd
->vdev_type
= __cpu_to_le32(vdev_type
);
2132 cmd
->vdev_subtype
= __cpu_to_le32(vdev_subtype
);
2133 ether_addr_copy(cmd
->vdev_macaddr
.addr
, mac_addr
);
2135 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev create\n");
2139 static struct sk_buff
*
2140 ath10k_wmi_tlv_op_gen_vdev_delete(struct ath10k
*ar
, u32 vdev_id
)
2142 struct wmi_vdev_delete_cmd
*cmd
;
2143 struct wmi_tlv
*tlv
;
2144 struct sk_buff
*skb
;
2146 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2148 return ERR_PTR(-ENOMEM
);
2150 tlv
= (void *)skb
->data
;
2151 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_DELETE_CMD
);
2152 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2153 cmd
= (void *)tlv
->value
;
2154 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2156 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev delete\n");
2160 static struct sk_buff
*
2161 ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k
*ar
,
2162 const struct wmi_vdev_start_request_arg
*arg
,
2165 struct wmi_tlv_vdev_start_cmd
*cmd
;
2166 struct wmi_channel
*ch
;
2167 struct wmi_tlv
*tlv
;
2168 struct sk_buff
*skb
;
2173 if (WARN_ON(arg
->hidden_ssid
&& !arg
->ssid
))
2174 return ERR_PTR(-EINVAL
);
2175 if (WARN_ON(arg
->ssid_len
> sizeof(cmd
->ssid
.ssid
)))
2176 return ERR_PTR(-EINVAL
);
2178 len
= (sizeof(*tlv
) + sizeof(*cmd
)) +
2179 (sizeof(*tlv
) + sizeof(*ch
)) +
2181 skb
= ath10k_wmi_alloc_skb(ar
, len
);
2183 return ERR_PTR(-ENOMEM
);
2185 if (arg
->hidden_ssid
)
2186 flags
|= WMI_VDEV_START_HIDDEN_SSID
;
2187 if (arg
->pmf_enabled
)
2188 flags
|= WMI_VDEV_START_PMF_ENABLED
;
2190 ptr
= (void *)skb
->data
;
2193 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_START_REQUEST_CMD
);
2194 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2195 cmd
= (void *)tlv
->value
;
2196 cmd
->vdev_id
= __cpu_to_le32(arg
->vdev_id
);
2197 cmd
->bcn_intval
= __cpu_to_le32(arg
->bcn_intval
);
2198 cmd
->dtim_period
= __cpu_to_le32(arg
->dtim_period
);
2199 cmd
->flags
= __cpu_to_le32(flags
);
2200 cmd
->bcn_tx_rate
= __cpu_to_le32(arg
->bcn_tx_rate
);
2201 cmd
->bcn_tx_power
= __cpu_to_le32(arg
->bcn_tx_power
);
2202 cmd
->disable_hw_ack
= __cpu_to_le32(arg
->disable_hw_ack
);
2205 cmd
->ssid
.ssid_len
= __cpu_to_le32(arg
->ssid_len
);
2206 memcpy(cmd
->ssid
.ssid
, arg
->ssid
, arg
->ssid_len
);
2209 ptr
+= sizeof(*tlv
);
2210 ptr
+= sizeof(*cmd
);
2213 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_CHANNEL
);
2214 tlv
->len
= __cpu_to_le16(sizeof(*ch
));
2215 ch
= (void *)tlv
->value
;
2216 ath10k_wmi_put_wmi_channel(ar
, ch
, &arg
->channel
);
2218 ptr
+= sizeof(*tlv
);
2222 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
2225 /* Note: This is a nested TLV containing:
2226 * [wmi_tlv][wmi_p2p_noa_descriptor][wmi_tlv]..
2229 ptr
+= sizeof(*tlv
);
2232 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev start\n");
2236 static struct sk_buff
*
2237 ath10k_wmi_tlv_op_gen_vdev_stop(struct ath10k
*ar
, u32 vdev_id
)
2239 struct wmi_vdev_stop_cmd
*cmd
;
2240 struct wmi_tlv
*tlv
;
2241 struct sk_buff
*skb
;
2243 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2245 return ERR_PTR(-ENOMEM
);
2247 tlv
= (void *)skb
->data
;
2248 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_STOP_CMD
);
2249 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2250 cmd
= (void *)tlv
->value
;
2251 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2253 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev stop\n");
2257 static struct sk_buff
*
2258 ath10k_wmi_tlv_op_gen_vdev_up(struct ath10k
*ar
, u32 vdev_id
, u32 aid
,
2262 struct wmi_vdev_up_cmd
*cmd
;
2263 struct wmi_tlv
*tlv
;
2264 struct sk_buff
*skb
;
2266 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2268 return ERR_PTR(-ENOMEM
);
2270 tlv
= (void *)skb
->data
;
2271 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_UP_CMD
);
2272 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2273 cmd
= (void *)tlv
->value
;
2274 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2275 cmd
->vdev_assoc_id
= __cpu_to_le32(aid
);
2276 ether_addr_copy(cmd
->vdev_bssid
.addr
, bssid
);
2278 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev up\n");
2282 static struct sk_buff
*
2283 ath10k_wmi_tlv_op_gen_vdev_down(struct ath10k
*ar
, u32 vdev_id
)
2285 struct wmi_vdev_down_cmd
*cmd
;
2286 struct wmi_tlv
*tlv
;
2287 struct sk_buff
*skb
;
2289 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2291 return ERR_PTR(-ENOMEM
);
2293 tlv
= (void *)skb
->data
;
2294 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_DOWN_CMD
);
2295 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2296 cmd
= (void *)tlv
->value
;
2297 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2299 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev down\n");
2303 static struct sk_buff
*
2304 ath10k_wmi_tlv_op_gen_vdev_set_param(struct ath10k
*ar
, u32 vdev_id
,
2305 u32 param_id
, u32 param_value
)
2307 struct wmi_vdev_set_param_cmd
*cmd
;
2308 struct wmi_tlv
*tlv
;
2309 struct sk_buff
*skb
;
2311 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2313 return ERR_PTR(-ENOMEM
);
2315 tlv
= (void *)skb
->data
;
2316 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_SET_PARAM_CMD
);
2317 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2318 cmd
= (void *)tlv
->value
;
2319 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2320 cmd
->param_id
= __cpu_to_le32(param_id
);
2321 cmd
->param_value
= __cpu_to_le32(param_value
);
2323 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev %d set param %d value 0x%x\n",
2324 vdev_id
, param_id
, param_value
);
2328 static struct sk_buff
*
2329 ath10k_wmi_tlv_op_gen_vdev_install_key(struct ath10k
*ar
,
2330 const struct wmi_vdev_install_key_arg
*arg
)
2332 struct wmi_vdev_install_key_cmd
*cmd
;
2333 struct wmi_tlv
*tlv
;
2334 struct sk_buff
*skb
;
2338 if (arg
->key_cipher
== ar
->wmi_key_cipher
[WMI_CIPHER_NONE
] &&
2340 return ERR_PTR(-EINVAL
);
2341 if (arg
->key_cipher
!= ar
->wmi_key_cipher
[WMI_CIPHER_NONE
] &&
2343 return ERR_PTR(-EINVAL
);
2345 len
= sizeof(*tlv
) + sizeof(*cmd
) +
2346 sizeof(*tlv
) + roundup(arg
->key_len
, sizeof(__le32
));
2347 skb
= ath10k_wmi_alloc_skb(ar
, len
);
2349 return ERR_PTR(-ENOMEM
);
2351 ptr
= (void *)skb
->data
;
2353 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_INSTALL_KEY_CMD
);
2354 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2355 cmd
= (void *)tlv
->value
;
2356 cmd
->vdev_id
= __cpu_to_le32(arg
->vdev_id
);
2357 cmd
->key_idx
= __cpu_to_le32(arg
->key_idx
);
2358 cmd
->key_flags
= __cpu_to_le32(arg
->key_flags
);
2359 cmd
->key_cipher
= __cpu_to_le32(arg
->key_cipher
);
2360 cmd
->key_len
= __cpu_to_le32(arg
->key_len
);
2361 cmd
->key_txmic_len
= __cpu_to_le32(arg
->key_txmic_len
);
2362 cmd
->key_rxmic_len
= __cpu_to_le32(arg
->key_rxmic_len
);
2365 ether_addr_copy(cmd
->peer_macaddr
.addr
, arg
->macaddr
);
2367 ptr
+= sizeof(*tlv
);
2368 ptr
+= sizeof(*cmd
);
2371 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
2372 tlv
->len
= __cpu_to_le16(roundup(arg
->key_len
, sizeof(__le32
)));
2374 memcpy(tlv
->value
, arg
->key_data
, arg
->key_len
);
2376 ptr
+= sizeof(*tlv
);
2377 ptr
+= roundup(arg
->key_len
, sizeof(__le32
));
2379 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev install key\n");
2383 static void *ath10k_wmi_tlv_put_uapsd_ac(struct ath10k
*ar
, void *ptr
,
2384 const struct wmi_sta_uapsd_auto_trig_arg
*arg
)
2386 struct wmi_sta_uapsd_auto_trig_param
*ac
;
2387 struct wmi_tlv
*tlv
;
2390 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_STA_UAPSD_AUTO_TRIG_PARAM
);
2391 tlv
->len
= __cpu_to_le16(sizeof(*ac
));
2392 ac
= (void *)tlv
->value
;
2394 ac
->wmm_ac
= __cpu_to_le32(arg
->wmm_ac
);
2395 ac
->user_priority
= __cpu_to_le32(arg
->user_priority
);
2396 ac
->service_interval
= __cpu_to_le32(arg
->service_interval
);
2397 ac
->suspend_interval
= __cpu_to_le32(arg
->suspend_interval
);
2398 ac
->delay_interval
= __cpu_to_le32(arg
->delay_interval
);
2400 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
2401 "wmi tlv vdev sta uapsd auto trigger ac %d prio %d svc int %d susp int %d delay int %d\n",
2402 ac
->wmm_ac
, ac
->user_priority
, ac
->service_interval
,
2403 ac
->suspend_interval
, ac
->delay_interval
);
2405 return ptr
+ sizeof(*tlv
) + sizeof(*ac
);
2408 static struct sk_buff
*
2409 ath10k_wmi_tlv_op_gen_vdev_sta_uapsd(struct ath10k
*ar
, u32 vdev_id
,
2410 const u8 peer_addr
[ETH_ALEN
],
2411 const struct wmi_sta_uapsd_auto_trig_arg
*args
,
2414 struct wmi_sta_uapsd_auto_trig_cmd_fixed_param
*cmd
;
2415 struct wmi_sta_uapsd_auto_trig_param
*ac
;
2416 struct wmi_tlv
*tlv
;
2417 struct sk_buff
*skb
;
2423 ac_tlv_len
= num_ac
* (sizeof(*tlv
) + sizeof(*ac
));
2424 len
= sizeof(*tlv
) + sizeof(*cmd
) +
2425 sizeof(*tlv
) + ac_tlv_len
;
2426 skb
= ath10k_wmi_alloc_skb(ar
, len
);
2428 return ERR_PTR(-ENOMEM
);
2430 ptr
= (void *)skb
->data
;
2432 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_STA_UAPSD_AUTO_TRIG_CMD
);
2433 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2434 cmd
= (void *)tlv
->value
;
2435 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2436 cmd
->num_ac
= __cpu_to_le32(num_ac
);
2437 ether_addr_copy(cmd
->peer_macaddr
.addr
, peer_addr
);
2439 ptr
+= sizeof(*tlv
);
2440 ptr
+= sizeof(*cmd
);
2443 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
2444 tlv
->len
= __cpu_to_le16(ac_tlv_len
);
2445 ac
= (void *)tlv
->value
;
2447 ptr
+= sizeof(*tlv
);
2448 for (i
= 0; i
< num_ac
; i
++)
2449 ptr
= ath10k_wmi_tlv_put_uapsd_ac(ar
, ptr
, &args
[i
]);
2451 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev sta uapsd auto trigger\n");
2455 static void *ath10k_wmi_tlv_put_wmm(void *ptr
,
2456 const struct wmi_wmm_params_arg
*arg
)
2458 struct wmi_wmm_params
*wmm
;
2459 struct wmi_tlv
*tlv
;
2462 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_WMM_PARAMS
);
2463 tlv
->len
= __cpu_to_le16(sizeof(*wmm
));
2464 wmm
= (void *)tlv
->value
;
2465 ath10k_wmi_set_wmm_param(wmm
, arg
);
2467 return ptr
+ sizeof(*tlv
) + sizeof(*wmm
);
2470 static struct sk_buff
*
2471 ath10k_wmi_tlv_op_gen_vdev_wmm_conf(struct ath10k
*ar
, u32 vdev_id
,
2472 const struct wmi_wmm_params_all_arg
*arg
)
2474 struct wmi_tlv_vdev_set_wmm_cmd
*cmd
;
2475 struct wmi_tlv
*tlv
;
2476 struct sk_buff
*skb
;
2480 len
= sizeof(*tlv
) + sizeof(*cmd
);
2481 skb
= ath10k_wmi_alloc_skb(ar
, len
);
2483 return ERR_PTR(-ENOMEM
);
2485 ptr
= (void *)skb
->data
;
2487 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_SET_WMM_PARAMS_CMD
);
2488 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2489 cmd
= (void *)tlv
->value
;
2490 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2492 ath10k_wmi_set_wmm_param(&cmd
->vdev_wmm_params
[0].params
, &arg
->ac_be
);
2493 ath10k_wmi_set_wmm_param(&cmd
->vdev_wmm_params
[1].params
, &arg
->ac_bk
);
2494 ath10k_wmi_set_wmm_param(&cmd
->vdev_wmm_params
[2].params
, &arg
->ac_vi
);
2495 ath10k_wmi_set_wmm_param(&cmd
->vdev_wmm_params
[3].params
, &arg
->ac_vo
);
2497 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv vdev wmm conf\n");
2501 static struct sk_buff
*
2502 ath10k_wmi_tlv_op_gen_sta_keepalive(struct ath10k
*ar
,
2503 const struct wmi_sta_keepalive_arg
*arg
)
2505 struct wmi_tlv_sta_keepalive_cmd
*cmd
;
2506 struct wmi_sta_keepalive_arp_resp
*arp
;
2507 struct sk_buff
*skb
;
2508 struct wmi_tlv
*tlv
;
2512 len
= sizeof(*tlv
) + sizeof(*cmd
) +
2513 sizeof(*tlv
) + sizeof(*arp
);
2514 skb
= ath10k_wmi_alloc_skb(ar
, len
);
2516 return ERR_PTR(-ENOMEM
);
2518 ptr
= (void *)skb
->data
;
2520 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_STA_KEEPALIVE_CMD
);
2521 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2522 cmd
= (void *)tlv
->value
;
2523 cmd
->vdev_id
= __cpu_to_le32(arg
->vdev_id
);
2524 cmd
->enabled
= __cpu_to_le32(arg
->enabled
);
2525 cmd
->method
= __cpu_to_le32(arg
->method
);
2526 cmd
->interval
= __cpu_to_le32(arg
->interval
);
2528 ptr
+= sizeof(*tlv
);
2529 ptr
+= sizeof(*cmd
);
2532 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_STA_KEEPALVE_ARP_RESPONSE
);
2533 tlv
->len
= __cpu_to_le16(sizeof(*arp
));
2534 arp
= (void *)tlv
->value
;
2536 arp
->src_ip4_addr
= arg
->src_ip4_addr
;
2537 arp
->dest_ip4_addr
= arg
->dest_ip4_addr
;
2538 ether_addr_copy(arp
->dest_mac_addr
.addr
, arg
->dest_mac_addr
);
2540 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv sta keepalive vdev %d enabled %d method %d interval %d\n",
2541 arg
->vdev_id
, arg
->enabled
, arg
->method
, arg
->interval
);
2545 static struct sk_buff
*
2546 ath10k_wmi_tlv_op_gen_peer_create(struct ath10k
*ar
, u32 vdev_id
,
2547 const u8 peer_addr
[ETH_ALEN
],
2548 enum wmi_peer_type peer_type
)
2550 struct wmi_tlv_peer_create_cmd
*cmd
;
2551 struct wmi_tlv
*tlv
;
2552 struct sk_buff
*skb
;
2554 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2556 return ERR_PTR(-ENOMEM
);
2558 tlv
= (void *)skb
->data
;
2559 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_CREATE_CMD
);
2560 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2561 cmd
= (void *)tlv
->value
;
2562 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2563 cmd
->peer_type
= __cpu_to_le32(peer_type
);
2564 ether_addr_copy(cmd
->peer_addr
.addr
, peer_addr
);
2566 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv peer create\n");
2570 static struct sk_buff
*
2571 ath10k_wmi_tlv_op_gen_peer_delete(struct ath10k
*ar
, u32 vdev_id
,
2572 const u8 peer_addr
[ETH_ALEN
])
2574 struct wmi_peer_delete_cmd
*cmd
;
2575 struct wmi_tlv
*tlv
;
2576 struct sk_buff
*skb
;
2578 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2580 return ERR_PTR(-ENOMEM
);
2582 tlv
= (void *)skb
->data
;
2583 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_DELETE_CMD
);
2584 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2585 cmd
= (void *)tlv
->value
;
2586 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2587 ether_addr_copy(cmd
->peer_macaddr
.addr
, peer_addr
);
2589 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv peer delete\n");
2593 static struct sk_buff
*
2594 ath10k_wmi_tlv_op_gen_peer_flush(struct ath10k
*ar
, u32 vdev_id
,
2595 const u8 peer_addr
[ETH_ALEN
], u32 tid_bitmap
)
2597 struct wmi_peer_flush_tids_cmd
*cmd
;
2598 struct wmi_tlv
*tlv
;
2599 struct sk_buff
*skb
;
2601 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2603 return ERR_PTR(-ENOMEM
);
2605 tlv
= (void *)skb
->data
;
2606 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_FLUSH_TIDS_CMD
);
2607 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2608 cmd
= (void *)tlv
->value
;
2609 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2610 cmd
->peer_tid_bitmap
= __cpu_to_le32(tid_bitmap
);
2611 ether_addr_copy(cmd
->peer_macaddr
.addr
, peer_addr
);
2613 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv peer flush\n");
2617 static struct sk_buff
*
2618 ath10k_wmi_tlv_op_gen_peer_set_param(struct ath10k
*ar
, u32 vdev_id
,
2619 const u8
*peer_addr
,
2620 enum wmi_peer_param param_id
,
2623 struct wmi_peer_set_param_cmd
*cmd
;
2624 struct wmi_tlv
*tlv
;
2625 struct sk_buff
*skb
;
2627 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2629 return ERR_PTR(-ENOMEM
);
2631 tlv
= (void *)skb
->data
;
2632 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_SET_PARAM_CMD
);
2633 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2634 cmd
= (void *)tlv
->value
;
2635 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2636 cmd
->param_id
= __cpu_to_le32(param_id
);
2637 cmd
->param_value
= __cpu_to_le32(param_value
);
2638 ether_addr_copy(cmd
->peer_macaddr
.addr
, peer_addr
);
2640 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
2641 "wmi tlv vdev %d peer %pM set param %d value 0x%x\n",
2642 vdev_id
, peer_addr
, param_id
, param_value
);
2646 static struct sk_buff
*
2647 ath10k_wmi_tlv_op_gen_peer_assoc(struct ath10k
*ar
,
2648 const struct wmi_peer_assoc_complete_arg
*arg
)
2650 struct wmi_tlv_peer_assoc_cmd
*cmd
;
2651 struct wmi_vht_rate_set
*vht_rate
;
2652 struct wmi_tlv
*tlv
;
2653 struct sk_buff
*skb
;
2654 size_t len
, legacy_rate_len
, ht_rate_len
;
2657 if (arg
->peer_mpdu_density
> 16)
2658 return ERR_PTR(-EINVAL
);
2659 if (arg
->peer_legacy_rates
.num_rates
> MAX_SUPPORTED_RATES
)
2660 return ERR_PTR(-EINVAL
);
2661 if (arg
->peer_ht_rates
.num_rates
> MAX_SUPPORTED_RATES
)
2662 return ERR_PTR(-EINVAL
);
2664 legacy_rate_len
= roundup(arg
->peer_legacy_rates
.num_rates
,
2666 ht_rate_len
= roundup(arg
->peer_ht_rates
.num_rates
, sizeof(__le32
));
2667 len
= (sizeof(*tlv
) + sizeof(*cmd
)) +
2668 (sizeof(*tlv
) + legacy_rate_len
) +
2669 (sizeof(*tlv
) + ht_rate_len
) +
2670 (sizeof(*tlv
) + sizeof(*vht_rate
));
2671 skb
= ath10k_wmi_alloc_skb(ar
, len
);
2673 return ERR_PTR(-ENOMEM
);
2675 ptr
= (void *)skb
->data
;
2677 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_ASSOC_COMPLETE_CMD
);
2678 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2679 cmd
= (void *)tlv
->value
;
2681 cmd
->vdev_id
= __cpu_to_le32(arg
->vdev_id
);
2682 cmd
->new_assoc
= __cpu_to_le32(arg
->peer_reassoc
? 0 : 1);
2683 cmd
->assoc_id
= __cpu_to_le32(arg
->peer_aid
);
2684 cmd
->flags
= __cpu_to_le32(arg
->peer_flags
);
2685 cmd
->caps
= __cpu_to_le32(arg
->peer_caps
);
2686 cmd
->listen_intval
= __cpu_to_le32(arg
->peer_listen_intval
);
2687 cmd
->ht_caps
= __cpu_to_le32(arg
->peer_ht_caps
);
2688 cmd
->max_mpdu
= __cpu_to_le32(arg
->peer_max_mpdu
);
2689 cmd
->mpdu_density
= __cpu_to_le32(arg
->peer_mpdu_density
);
2690 cmd
->rate_caps
= __cpu_to_le32(arg
->peer_rate_caps
);
2691 cmd
->nss
= __cpu_to_le32(arg
->peer_num_spatial_streams
);
2692 cmd
->vht_caps
= __cpu_to_le32(arg
->peer_vht_caps
);
2693 cmd
->phy_mode
= __cpu_to_le32(arg
->peer_phymode
);
2694 cmd
->num_legacy_rates
= __cpu_to_le32(arg
->peer_legacy_rates
.num_rates
);
2695 cmd
->num_ht_rates
= __cpu_to_le32(arg
->peer_ht_rates
.num_rates
);
2696 ether_addr_copy(cmd
->mac_addr
.addr
, arg
->addr
);
2698 ptr
+= sizeof(*tlv
);
2699 ptr
+= sizeof(*cmd
);
2702 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
2703 tlv
->len
= __cpu_to_le16(legacy_rate_len
);
2704 memcpy(tlv
->value
, arg
->peer_legacy_rates
.rates
,
2705 arg
->peer_legacy_rates
.num_rates
);
2707 ptr
+= sizeof(*tlv
);
2708 ptr
+= legacy_rate_len
;
2711 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
2712 tlv
->len
= __cpu_to_le16(ht_rate_len
);
2713 memcpy(tlv
->value
, arg
->peer_ht_rates
.rates
,
2714 arg
->peer_ht_rates
.num_rates
);
2716 ptr
+= sizeof(*tlv
);
2720 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VHT_RATE_SET
);
2721 tlv
->len
= __cpu_to_le16(sizeof(*vht_rate
));
2722 vht_rate
= (void *)tlv
->value
;
2724 vht_rate
->rx_max_rate
= __cpu_to_le32(arg
->peer_vht_rates
.rx_max_rate
);
2725 vht_rate
->rx_mcs_set
= __cpu_to_le32(arg
->peer_vht_rates
.rx_mcs_set
);
2726 vht_rate
->tx_max_rate
= __cpu_to_le32(arg
->peer_vht_rates
.tx_max_rate
);
2727 vht_rate
->tx_mcs_set
= __cpu_to_le32(arg
->peer_vht_rates
.tx_mcs_set
);
2729 ptr
+= sizeof(*tlv
);
2730 ptr
+= sizeof(*vht_rate
);
2732 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv peer assoc\n");
2736 static struct sk_buff
*
2737 ath10k_wmi_tlv_op_gen_set_psmode(struct ath10k
*ar
, u32 vdev_id
,
2738 enum wmi_sta_ps_mode psmode
)
2740 struct wmi_sta_powersave_mode_cmd
*cmd
;
2741 struct wmi_tlv
*tlv
;
2742 struct sk_buff
*skb
;
2744 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2746 return ERR_PTR(-ENOMEM
);
2748 tlv
= (void *)skb
->data
;
2749 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_STA_POWERSAVE_MODE_CMD
);
2750 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2751 cmd
= (void *)tlv
->value
;
2752 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2753 cmd
->sta_ps_mode
= __cpu_to_le32(psmode
);
2755 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv set psmode\n");
2759 static struct sk_buff
*
2760 ath10k_wmi_tlv_op_gen_set_sta_ps(struct ath10k
*ar
, u32 vdev_id
,
2761 enum wmi_sta_powersave_param param_id
,
2764 struct wmi_sta_powersave_param_cmd
*cmd
;
2765 struct wmi_tlv
*tlv
;
2766 struct sk_buff
*skb
;
2768 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2770 return ERR_PTR(-ENOMEM
);
2772 tlv
= (void *)skb
->data
;
2773 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_STA_POWERSAVE_PARAM_CMD
);
2774 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2775 cmd
= (void *)tlv
->value
;
2776 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2777 cmd
->param_id
= __cpu_to_le32(param_id
);
2778 cmd
->param_value
= __cpu_to_le32(param_value
);
2780 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv set sta ps\n");
2784 static struct sk_buff
*
2785 ath10k_wmi_tlv_op_gen_set_ap_ps(struct ath10k
*ar
, u32 vdev_id
, const u8
*mac
,
2786 enum wmi_ap_ps_peer_param param_id
, u32 value
)
2788 struct wmi_ap_ps_peer_cmd
*cmd
;
2789 struct wmi_tlv
*tlv
;
2790 struct sk_buff
*skb
;
2793 return ERR_PTR(-EINVAL
);
2795 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2797 return ERR_PTR(-ENOMEM
);
2799 tlv
= (void *)skb
->data
;
2800 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_AP_PS_PEER_CMD
);
2801 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2802 cmd
= (void *)tlv
->value
;
2803 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2804 cmd
->param_id
= __cpu_to_le32(param_id
);
2805 cmd
->param_value
= __cpu_to_le32(value
);
2806 ether_addr_copy(cmd
->peer_macaddr
.addr
, mac
);
2808 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv ap ps param\n");
2812 static struct sk_buff
*
2813 ath10k_wmi_tlv_op_gen_scan_chan_list(struct ath10k
*ar
,
2814 const struct wmi_scan_chan_list_arg
*arg
)
2816 struct wmi_tlv_scan_chan_list_cmd
*cmd
;
2817 struct wmi_channel
*ci
;
2818 struct wmi_channel_arg
*ch
;
2819 struct wmi_tlv
*tlv
;
2820 struct sk_buff
*skb
;
2821 size_t chans_len
, len
;
2825 chans_len
= arg
->n_channels
* (sizeof(*tlv
) + sizeof(*ci
));
2826 len
= (sizeof(*tlv
) + sizeof(*cmd
)) +
2827 (sizeof(*tlv
) + chans_len
);
2829 skb
= ath10k_wmi_alloc_skb(ar
, len
);
2831 return ERR_PTR(-ENOMEM
);
2833 ptr
= (void *)skb
->data
;
2835 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_SCAN_CHAN_LIST_CMD
);
2836 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2837 cmd
= (void *)tlv
->value
;
2838 cmd
->num_scan_chans
= __cpu_to_le32(arg
->n_channels
);
2840 ptr
+= sizeof(*tlv
);
2841 ptr
+= sizeof(*cmd
);
2844 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
2845 tlv
->len
= __cpu_to_le16(chans_len
);
2846 chans
= (void *)tlv
->value
;
2848 for (i
= 0; i
< arg
->n_channels
; i
++) {
2849 ch
= &arg
->channels
[i
];
2852 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_CHANNEL
);
2853 tlv
->len
= __cpu_to_le16(sizeof(*ci
));
2854 ci
= (void *)tlv
->value
;
2856 ath10k_wmi_put_wmi_channel(ar
, ci
, ch
);
2858 chans
+= sizeof(*tlv
);
2859 chans
+= sizeof(*ci
);
2862 ptr
+= sizeof(*tlv
);
2865 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv scan chan list\n");
2869 static struct sk_buff
*
2870 ath10k_wmi_tlv_op_gen_scan_prob_req_oui(struct ath10k
*ar
, u32 prob_req_oui
)
2872 struct wmi_scan_prob_req_oui_cmd
*cmd
;
2873 struct wmi_tlv
*tlv
;
2874 struct sk_buff
*skb
;
2876 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2878 return ERR_PTR(-ENOMEM
);
2880 tlv
= (void *)skb
->data
;
2881 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_SCAN_PROB_REQ_OUI_CMD
);
2882 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2883 cmd
= (void *)tlv
->value
;
2884 cmd
->prob_req_oui
= __cpu_to_le32(prob_req_oui
);
2886 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv scan prob req oui\n");
2890 static struct sk_buff
*
2891 ath10k_wmi_tlv_op_gen_beacon_dma(struct ath10k
*ar
, u32 vdev_id
,
2892 const void *bcn
, size_t bcn_len
,
2893 u32 bcn_paddr
, bool dtim_zero
,
2897 struct wmi_bcn_tx_ref_cmd
*cmd
;
2898 struct wmi_tlv
*tlv
;
2899 struct sk_buff
*skb
;
2900 struct ieee80211_hdr
*hdr
;
2903 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2905 return ERR_PTR(-ENOMEM
);
2907 hdr
= (struct ieee80211_hdr
*)bcn
;
2908 fc
= le16_to_cpu(hdr
->frame_control
);
2910 tlv
= (void *)skb
->data
;
2911 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_BCN_SEND_FROM_HOST_CMD
);
2912 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2913 cmd
= (void *)tlv
->value
;
2914 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
2915 cmd
->data_len
= __cpu_to_le32(bcn_len
);
2916 cmd
->data_ptr
= __cpu_to_le32(bcn_paddr
);
2918 cmd
->frame_control
= __cpu_to_le32(fc
);
2922 cmd
->flags
|= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DTIM_ZERO
);
2925 cmd
->flags
|= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB
);
2927 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv beacon dma\n");
2931 static struct sk_buff
*
2932 ath10k_wmi_tlv_op_gen_pdev_set_wmm(struct ath10k
*ar
,
2933 const struct wmi_wmm_params_all_arg
*arg
)
2935 struct wmi_tlv_pdev_set_wmm_cmd
*cmd
;
2936 struct wmi_wmm_params
*wmm
;
2937 struct wmi_tlv
*tlv
;
2938 struct sk_buff
*skb
;
2942 len
= (sizeof(*tlv
) + sizeof(*cmd
)) +
2943 (4 * (sizeof(*tlv
) + sizeof(*wmm
)));
2944 skb
= ath10k_wmi_alloc_skb(ar
, len
);
2946 return ERR_PTR(-ENOMEM
);
2948 ptr
= (void *)skb
->data
;
2951 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_WMM_PARAMS_CMD
);
2952 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2953 cmd
= (void *)tlv
->value
;
2955 /* nothing to set here */
2957 ptr
+= sizeof(*tlv
);
2958 ptr
+= sizeof(*cmd
);
2960 ptr
= ath10k_wmi_tlv_put_wmm(ptr
, &arg
->ac_be
);
2961 ptr
= ath10k_wmi_tlv_put_wmm(ptr
, &arg
->ac_bk
);
2962 ptr
= ath10k_wmi_tlv_put_wmm(ptr
, &arg
->ac_vi
);
2963 ptr
= ath10k_wmi_tlv_put_wmm(ptr
, &arg
->ac_vo
);
2965 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv pdev set wmm\n");
2969 static struct sk_buff
*
2970 ath10k_wmi_tlv_op_gen_request_stats(struct ath10k
*ar
, u32 stats_mask
)
2972 struct wmi_request_stats_cmd
*cmd
;
2973 struct wmi_tlv
*tlv
;
2974 struct sk_buff
*skb
;
2976 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
2978 return ERR_PTR(-ENOMEM
);
2980 tlv
= (void *)skb
->data
;
2981 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_REQUEST_STATS_CMD
);
2982 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
2983 cmd
= (void *)tlv
->value
;
2984 cmd
->stats_id
= __cpu_to_le32(stats_mask
);
2986 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv request stats\n");
2990 static struct sk_buff
*
2991 ath10k_wmi_tlv_op_gen_request_peer_stats_info(struct ath10k
*ar
,
2993 enum wmi_peer_stats_info_request_type type
,
2997 struct wmi_tlv_request_peer_stats_info
*cmd
;
2998 struct wmi_tlv
*tlv
;
2999 struct sk_buff
*skb
;
3001 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
3003 return ERR_PTR(-ENOMEM
);
3005 tlv
= (void *)skb
->data
;
3006 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_REQUEST_PEER_STATS_INFO_CMD
);
3007 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3008 cmd
= (void *)tlv
->value
;
3009 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3010 cmd
->request_type
= __cpu_to_le32(type
);
3012 if (type
== WMI_REQUEST_ONE_PEER_STATS_INFO
)
3013 ether_addr_copy(cmd
->peer_macaddr
.addr
, addr
);
3015 cmd
->reset_after_request
= __cpu_to_le32(reset
);
3016 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv request peer stats info\n");
3021 ath10k_wmi_tlv_op_cleanup_mgmt_tx_send(struct ath10k
*ar
,
3022 struct sk_buff
*msdu
)
3024 struct ath10k_skb_cb
*cb
= ATH10K_SKB_CB(msdu
);
3025 struct ath10k_wmi
*wmi
= &ar
->wmi
;
3027 idr_remove(&wmi
->mgmt_pending_tx
, cb
->msdu_id
);
3033 ath10k_wmi_mgmt_tx_alloc_msdu_id(struct ath10k
*ar
, struct sk_buff
*skb
,
3036 struct ath10k_wmi
*wmi
= &ar
->wmi
;
3037 struct ath10k_mgmt_tx_pkt_addr
*pkt_addr
;
3040 pkt_addr
= kmalloc(sizeof(*pkt_addr
), GFP_ATOMIC
);
3044 pkt_addr
->vaddr
= skb
;
3045 pkt_addr
->paddr
= paddr
;
3047 spin_lock_bh(&ar
->data_lock
);
3048 ret
= idr_alloc(&wmi
->mgmt_pending_tx
, pkt_addr
, 0,
3049 wmi
->mgmt_max_num_pending_tx
, GFP_ATOMIC
);
3050 spin_unlock_bh(&ar
->data_lock
);
3052 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi mgmt tx alloc msdu_id ret %d\n", ret
);
3056 static struct sk_buff
*
3057 ath10k_wmi_tlv_op_gen_mgmt_tx_send(struct ath10k
*ar
, struct sk_buff
*msdu
,
3060 struct ath10k_skb_cb
*cb
= ATH10K_SKB_CB(msdu
);
3061 struct wmi_tlv_mgmt_tx_cmd
*cmd
;
3062 struct ieee80211_hdr
*hdr
;
3063 struct ath10k_vif
*arvif
;
3064 u32 buf_len
= msdu
->len
;
3065 struct wmi_tlv
*tlv
;
3066 struct sk_buff
*skb
;
3072 return ERR_PTR(-EINVAL
);
3074 hdr
= (struct ieee80211_hdr
*)msdu
->data
;
3075 arvif
= (void *)cb
->vif
->drv_priv
;
3076 vdev_id
= arvif
->vdev_id
;
3078 if (WARN_ON_ONCE(!ieee80211_is_mgmt(hdr
->frame_control
) &&
3079 (!(ieee80211_is_nullfunc(hdr
->frame_control
) ||
3080 ieee80211_is_qos_nullfunc(hdr
->frame_control
)))))
3081 return ERR_PTR(-EINVAL
);
3083 len
= sizeof(*cmd
) + 2 * sizeof(*tlv
);
3085 if ((ieee80211_is_action(hdr
->frame_control
) ||
3086 ieee80211_is_deauth(hdr
->frame_control
) ||
3087 ieee80211_is_disassoc(hdr
->frame_control
)) &&
3088 ieee80211_has_protected(hdr
->frame_control
)) {
3089 skb_put(msdu
, IEEE80211_CCMP_MIC_LEN
);
3090 buf_len
+= IEEE80211_CCMP_MIC_LEN
;
3093 buf_len
= min_t(u32
, buf_len
, WMI_TLV_MGMT_TX_FRAME_MAX_LEN
);
3094 buf_len
= round_up(buf_len
, 4);
3097 len
= round_up(len
, 4);
3098 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3100 return ERR_PTR(-ENOMEM
);
3102 desc_id
= ath10k_wmi_mgmt_tx_alloc_msdu_id(ar
, msdu
, paddr
);
3106 cb
->msdu_id
= desc_id
;
3108 ptr
= (void *)skb
->data
;
3110 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_MGMT_TX_CMD
);
3111 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3112 cmd
= (void *)tlv
->value
;
3113 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3114 cmd
->desc_id
= __cpu_to_le32(desc_id
);
3116 cmd
->buf_len
= __cpu_to_le32(buf_len
);
3117 cmd
->frame_len
= __cpu_to_le32(msdu
->len
);
3118 cmd
->paddr
= __cpu_to_le64(paddr
);
3120 ptr
+= sizeof(*tlv
);
3121 ptr
+= sizeof(*cmd
);
3124 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
3125 tlv
->len
= __cpu_to_le16(buf_len
);
3127 ptr
+= sizeof(*tlv
);
3128 memcpy(ptr
, msdu
->data
, buf_len
);
3134 return ERR_PTR(desc_id
);
3137 static struct sk_buff
*
3138 ath10k_wmi_tlv_op_gen_force_fw_hang(struct ath10k
*ar
,
3139 enum wmi_force_fw_hang_type type
,
3142 struct wmi_force_fw_hang_cmd
*cmd
;
3143 struct wmi_tlv
*tlv
;
3144 struct sk_buff
*skb
;
3146 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
3148 return ERR_PTR(-ENOMEM
);
3150 tlv
= (void *)skb
->data
;
3151 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_FORCE_FW_HANG_CMD
);
3152 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3153 cmd
= (void *)tlv
->value
;
3154 cmd
->type
= __cpu_to_le32(type
);
3155 cmd
->delay_ms
= __cpu_to_le32(delay_ms
);
3157 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv force fw hang\n");
3161 static struct sk_buff
*
3162 ath10k_wmi_tlv_op_gen_dbglog_cfg(struct ath10k
*ar
, u64 module_enable
,
3165 struct wmi_tlv_dbglog_cmd
*cmd
;
3166 struct wmi_tlv
*tlv
;
3167 struct sk_buff
*skb
;
3168 size_t len
, bmap_len
;
3172 if (module_enable
) {
3173 value
= WMI_TLV_DBGLOG_LOG_LEVEL_VALUE(
3175 WMI_TLV_DBGLOG_LOG_LEVEL_VERBOSE
);
3177 value
= WMI_TLV_DBGLOG_LOG_LEVEL_VALUE(
3178 WMI_TLV_DBGLOG_ALL_MODULES
,
3179 WMI_TLV_DBGLOG_LOG_LEVEL_WARN
);
3183 len
= sizeof(*tlv
) + sizeof(*cmd
) + sizeof(*tlv
) + bmap_len
;
3184 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3186 return ERR_PTR(-ENOMEM
);
3188 ptr
= (void *)skb
->data
;
3191 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_DEBUG_LOG_CONFIG_CMD
);
3192 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3193 cmd
= (void *)tlv
->value
;
3194 cmd
->param
= __cpu_to_le32(WMI_TLV_DBGLOG_PARAM_LOG_LEVEL
);
3195 cmd
->value
= __cpu_to_le32(value
);
3197 ptr
+= sizeof(*tlv
);
3198 ptr
+= sizeof(*cmd
);
3201 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32
);
3202 tlv
->len
= __cpu_to_le16(bmap_len
);
3204 /* nothing to do here */
3206 ptr
+= sizeof(*tlv
);
3207 ptr
+= sizeof(bmap_len
);
3209 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv dbglog value 0x%08x\n", value
);
3213 static struct sk_buff
*
3214 ath10k_wmi_tlv_op_gen_pktlog_enable(struct ath10k
*ar
, u32 filter
)
3216 struct wmi_tlv_pktlog_enable
*cmd
;
3217 struct wmi_tlv
*tlv
;
3218 struct sk_buff
*skb
;
3222 len
= sizeof(*tlv
) + sizeof(*cmd
);
3223 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3225 return ERR_PTR(-ENOMEM
);
3227 ptr
= (void *)skb
->data
;
3229 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_PKTLOG_ENABLE_CMD
);
3230 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3231 cmd
= (void *)tlv
->value
;
3232 cmd
->filter
= __cpu_to_le32(filter
);
3234 ptr
+= sizeof(*tlv
);
3235 ptr
+= sizeof(*cmd
);
3237 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv pktlog enable filter 0x%08x\n",
3242 static struct sk_buff
*
3243 ath10k_wmi_tlv_op_gen_pdev_get_temperature(struct ath10k
*ar
)
3245 struct wmi_tlv_pdev_get_temp_cmd
*cmd
;
3246 struct wmi_tlv
*tlv
;
3247 struct sk_buff
*skb
;
3249 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
3251 return ERR_PTR(-ENOMEM
);
3253 tlv
= (void *)skb
->data
;
3254 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_GET_TEMPERATURE_CMD
);
3255 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3256 cmd
= (void *)tlv
->value
;
3257 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi pdev get temperature tlv\n");
3261 static struct sk_buff
*
3262 ath10k_wmi_tlv_op_gen_pktlog_disable(struct ath10k
*ar
)
3264 struct wmi_tlv_pktlog_disable
*cmd
;
3265 struct wmi_tlv
*tlv
;
3266 struct sk_buff
*skb
;
3270 len
= sizeof(*tlv
) + sizeof(*cmd
);
3271 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3273 return ERR_PTR(-ENOMEM
);
3275 ptr
= (void *)skb
->data
;
3277 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_PKTLOG_DISABLE_CMD
);
3278 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3279 cmd
= (void *)tlv
->value
;
3281 ptr
+= sizeof(*tlv
);
3282 ptr
+= sizeof(*cmd
);
3284 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv pktlog disable\n");
3288 static struct sk_buff
*
3289 ath10k_wmi_tlv_op_gen_bcn_tmpl(struct ath10k
*ar
, u32 vdev_id
,
3290 u32 tim_ie_offset
, struct sk_buff
*bcn
,
3291 u32 prb_caps
, u32 prb_erp
, void *prb_ies
,
3294 struct wmi_tlv_bcn_tmpl_cmd
*cmd
;
3295 struct wmi_tlv_bcn_prb_info
*info
;
3296 struct wmi_tlv
*tlv
;
3297 struct sk_buff
*skb
;
3301 if (WARN_ON(prb_ies_len
> 0 && !prb_ies
))
3302 return ERR_PTR(-EINVAL
);
3304 len
= sizeof(*tlv
) + sizeof(*cmd
) +
3305 sizeof(*tlv
) + sizeof(*info
) + prb_ies_len
+
3306 sizeof(*tlv
) + roundup(bcn
->len
, 4);
3307 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3309 return ERR_PTR(-ENOMEM
);
3311 ptr
= (void *)skb
->data
;
3313 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_BCN_TMPL_CMD
);
3314 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3315 cmd
= (void *)tlv
->value
;
3316 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3317 cmd
->tim_ie_offset
= __cpu_to_le32(tim_ie_offset
);
3318 cmd
->buf_len
= __cpu_to_le32(bcn
->len
);
3320 ptr
+= sizeof(*tlv
);
3321 ptr
+= sizeof(*cmd
);
3323 /* FIXME: prb_ies_len should be probably aligned to 4byte boundary but
3324 * then it is then impossible to pass original ie len.
3325 * This chunk is not used yet so if setting probe resp template yields
3326 * problems with beaconing or crashes firmware look here.
3329 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_BCN_PRB_INFO
);
3330 tlv
->len
= __cpu_to_le16(sizeof(*info
) + prb_ies_len
);
3331 info
= (void *)tlv
->value
;
3332 info
->caps
= __cpu_to_le32(prb_caps
);
3333 info
->erp
= __cpu_to_le32(prb_erp
);
3334 memcpy(info
->ies
, prb_ies
, prb_ies_len
);
3336 ptr
+= sizeof(*tlv
);
3337 ptr
+= sizeof(*info
);
3341 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
3342 tlv
->len
= __cpu_to_le16(roundup(bcn
->len
, 4));
3343 memcpy(tlv
->value
, bcn
->data
, bcn
->len
);
3345 /* FIXME: Adjust TSF? */
3347 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv bcn tmpl vdev_id %i\n",
3352 static struct sk_buff
*
3353 ath10k_wmi_tlv_op_gen_prb_tmpl(struct ath10k
*ar
, u32 vdev_id
,
3354 struct sk_buff
*prb
)
3356 struct wmi_tlv_prb_tmpl_cmd
*cmd
;
3357 struct wmi_tlv_bcn_prb_info
*info
;
3358 struct wmi_tlv
*tlv
;
3359 struct sk_buff
*skb
;
3363 len
= sizeof(*tlv
) + sizeof(*cmd
) +
3364 sizeof(*tlv
) + sizeof(*info
) +
3365 sizeof(*tlv
) + roundup(prb
->len
, 4);
3366 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3368 return ERR_PTR(-ENOMEM
);
3370 ptr
= (void *)skb
->data
;
3372 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PRB_TMPL_CMD
);
3373 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3374 cmd
= (void *)tlv
->value
;
3375 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3376 cmd
->buf_len
= __cpu_to_le32(prb
->len
);
3378 ptr
+= sizeof(*tlv
);
3379 ptr
+= sizeof(*cmd
);
3382 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_BCN_PRB_INFO
);
3383 tlv
->len
= __cpu_to_le16(sizeof(*info
));
3384 info
= (void *)tlv
->value
;
3388 ptr
+= sizeof(*tlv
);
3389 ptr
+= sizeof(*info
);
3392 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
3393 tlv
->len
= __cpu_to_le16(roundup(prb
->len
, 4));
3394 memcpy(tlv
->value
, prb
->data
, prb
->len
);
3396 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv prb tmpl vdev_id %i\n",
3401 static struct sk_buff
*
3402 ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie(struct ath10k
*ar
, u32 vdev_id
,
3405 struct wmi_tlv_p2p_go_bcn_ie
*cmd
;
3406 struct wmi_tlv
*tlv
;
3407 struct sk_buff
*skb
;
3411 len
= sizeof(*tlv
) + sizeof(*cmd
) +
3412 sizeof(*tlv
) + roundup(p2p_ie
[1] + 2, 4);
3413 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3415 return ERR_PTR(-ENOMEM
);
3417 ptr
= (void *)skb
->data
;
3419 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_P2P_GO_SET_BEACON_IE
);
3420 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3421 cmd
= (void *)tlv
->value
;
3422 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3423 cmd
->ie_len
= __cpu_to_le32(p2p_ie
[1] + 2);
3425 ptr
+= sizeof(*tlv
);
3426 ptr
+= sizeof(*cmd
);
3429 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
3430 tlv
->len
= __cpu_to_le16(roundup(p2p_ie
[1] + 2, 4));
3431 memcpy(tlv
->value
, p2p_ie
, p2p_ie
[1] + 2);
3433 ptr
+= sizeof(*tlv
);
3434 ptr
+= roundup(p2p_ie
[1] + 2, 4);
3436 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv p2p go bcn ie for vdev %i\n",
3441 static struct sk_buff
*
3442 ath10k_wmi_tlv_op_gen_update_fw_tdls_state(struct ath10k
*ar
, u32 vdev_id
,
3443 enum wmi_tdls_state state
)
3445 struct wmi_tdls_set_state_cmd
*cmd
;
3446 struct wmi_tlv
*tlv
;
3447 struct sk_buff
*skb
;
3450 /* Set to options from wmi_tlv_tdls_options,
3451 * for now none of them are enabled.
3455 if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA
, ar
->wmi
.svc_map
))
3456 options
|= WMI_TLV_TDLS_BUFFER_STA_EN
;
3458 /* WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL means firm will handle TDLS
3459 * link inactivity detecting logic.
3461 if (state
== WMI_TDLS_ENABLE_ACTIVE
)
3462 state
= WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL
;
3464 len
= sizeof(*tlv
) + sizeof(*cmd
);
3465 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3467 return ERR_PTR(-ENOMEM
);
3469 ptr
= (void *)skb
->data
;
3471 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_TDLS_SET_STATE_CMD
);
3472 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3474 cmd
= (void *)tlv
->value
;
3475 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3476 cmd
->state
= __cpu_to_le32(state
);
3477 cmd
->notification_interval_ms
= __cpu_to_le32(5000);
3478 cmd
->tx_discovery_threshold
= __cpu_to_le32(100);
3479 cmd
->tx_teardown_threshold
= __cpu_to_le32(5);
3480 cmd
->rssi_teardown_threshold
= __cpu_to_le32(-75);
3481 cmd
->rssi_delta
= __cpu_to_le32(-20);
3482 cmd
->tdls_options
= __cpu_to_le32(options
);
3483 cmd
->tdls_peer_traffic_ind_window
= __cpu_to_le32(2);
3484 cmd
->tdls_peer_traffic_response_timeout_ms
= __cpu_to_le32(5000);
3485 cmd
->tdls_puapsd_mask
= __cpu_to_le32(0xf);
3486 cmd
->tdls_puapsd_inactivity_time_ms
= __cpu_to_le32(0);
3487 cmd
->tdls_puapsd_rx_frame_threshold
= __cpu_to_le32(10);
3489 ptr
+= sizeof(*tlv
);
3490 ptr
+= sizeof(*cmd
);
3492 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv update fw tdls state %d for vdev %i\n",
3497 static u32
ath10k_wmi_tlv_prepare_peer_qos(u8 uapsd_queues
, u8 sp
)
3501 if (uapsd_queues
& IEEE80211_WMM_IE_STA_QOSINFO_AC_VO
)
3502 peer_qos
|= WMI_TLV_TDLS_PEER_QOS_AC_VO
;
3503 if (uapsd_queues
& IEEE80211_WMM_IE_STA_QOSINFO_AC_VI
)
3504 peer_qos
|= WMI_TLV_TDLS_PEER_QOS_AC_VI
;
3505 if (uapsd_queues
& IEEE80211_WMM_IE_STA_QOSINFO_AC_BK
)
3506 peer_qos
|= WMI_TLV_TDLS_PEER_QOS_AC_BK
;
3507 if (uapsd_queues
& IEEE80211_WMM_IE_STA_QOSINFO_AC_BE
)
3508 peer_qos
|= WMI_TLV_TDLS_PEER_QOS_AC_BE
;
3510 peer_qos
|= SM(sp
, WMI_TLV_TDLS_PEER_SP
);
3515 static struct sk_buff
*
3516 ath10k_wmi_tlv_op_gen_tdls_peer_update(struct ath10k
*ar
,
3517 const struct wmi_tdls_peer_update_cmd_arg
*arg
,
3518 const struct wmi_tdls_peer_capab_arg
*cap
,
3519 const struct wmi_channel_arg
*chan_arg
)
3521 struct wmi_tdls_peer_update_cmd
*cmd
;
3522 struct wmi_tdls_peer_capab
*peer_cap
;
3523 struct wmi_channel
*chan
;
3524 struct wmi_tlv
*tlv
;
3525 struct sk_buff
*skb
;
3531 len
= sizeof(*tlv
) + sizeof(*cmd
) +
3532 sizeof(*tlv
) + sizeof(*peer_cap
) +
3533 sizeof(*tlv
) + cap
->peer_chan_len
* sizeof(*chan
);
3535 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3537 return ERR_PTR(-ENOMEM
);
3539 ptr
= (void *)skb
->data
;
3541 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_TDLS_PEER_UPDATE_CMD
);
3542 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3544 cmd
= (void *)tlv
->value
;
3545 cmd
->vdev_id
= __cpu_to_le32(arg
->vdev_id
);
3546 ether_addr_copy(cmd
->peer_macaddr
.addr
, arg
->addr
);
3547 cmd
->peer_state
= __cpu_to_le32(arg
->peer_state
);
3549 ptr
+= sizeof(*tlv
);
3550 ptr
+= sizeof(*cmd
);
3553 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_TDLS_PEER_CAPABILITIES
);
3554 tlv
->len
= __cpu_to_le16(sizeof(*peer_cap
));
3555 peer_cap
= (void *)tlv
->value
;
3556 peer_qos
= ath10k_wmi_tlv_prepare_peer_qos(cap
->peer_uapsd_queues
,
3558 peer_cap
->peer_qos
= __cpu_to_le32(peer_qos
);
3559 peer_cap
->buff_sta_support
= __cpu_to_le32(cap
->buff_sta_support
);
3560 peer_cap
->off_chan_support
= __cpu_to_le32(cap
->off_chan_support
);
3561 peer_cap
->peer_curr_operclass
= __cpu_to_le32(cap
->peer_curr_operclass
);
3562 peer_cap
->self_curr_operclass
= __cpu_to_le32(cap
->self_curr_operclass
);
3563 peer_cap
->peer_chan_len
= __cpu_to_le32(cap
->peer_chan_len
);
3564 peer_cap
->peer_operclass_len
= __cpu_to_le32(cap
->peer_operclass_len
);
3566 for (i
= 0; i
< WMI_TDLS_MAX_SUPP_OPER_CLASSES
; i
++)
3567 peer_cap
->peer_operclass
[i
] = cap
->peer_operclass
[i
];
3569 peer_cap
->is_peer_responder
= __cpu_to_le32(cap
->is_peer_responder
);
3570 peer_cap
->pref_offchan_num
= __cpu_to_le32(cap
->pref_offchan_num
);
3571 peer_cap
->pref_offchan_bw
= __cpu_to_le32(cap
->pref_offchan_bw
);
3573 ptr
+= sizeof(*tlv
);
3574 ptr
+= sizeof(*peer_cap
);
3577 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
3578 tlv
->len
= __cpu_to_le16(cap
->peer_chan_len
* sizeof(*chan
));
3580 ptr
+= sizeof(*tlv
);
3582 for (i
= 0; i
< cap
->peer_chan_len
; i
++) {
3584 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_CHANNEL
);
3585 tlv
->len
= __cpu_to_le16(sizeof(*chan
));
3586 chan
= (void *)tlv
->value
;
3587 ath10k_wmi_put_wmi_channel(ar
, chan
, &chan_arg
[i
]);
3589 ptr
+= sizeof(*tlv
);
3590 ptr
+= sizeof(*chan
);
3593 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
3594 "wmi tlv tdls peer update vdev %i state %d n_chans %u\n",
3595 arg
->vdev_id
, arg
->peer_state
, cap
->peer_chan_len
);
3599 static struct sk_buff
*
3600 ath10k_wmi_tlv_op_gen_pdev_set_quiet_mode(struct ath10k
*ar
, u32 period
,
3601 u32 duration
, u32 next_offset
,
3604 struct wmi_tlv_set_quiet_cmd
*cmd
;
3605 struct wmi_tlv
*tlv
;
3606 struct sk_buff
*skb
;
3608 skb
= ath10k_wmi_alloc_skb(ar
, sizeof(*tlv
) + sizeof(*cmd
));
3610 return ERR_PTR(-ENOMEM
);
3612 tlv
= (void *)skb
->data
;
3613 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_QUIET_CMD
);
3614 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3615 cmd
= (void *)tlv
->value
;
3617 /* vdev_id is not in use, set to 0 */
3618 cmd
->vdev_id
= __cpu_to_le32(0);
3619 cmd
->period
= __cpu_to_le32(period
);
3620 cmd
->duration
= __cpu_to_le32(duration
);
3621 cmd
->next_start
= __cpu_to_le32(next_offset
);
3622 cmd
->enabled
= __cpu_to_le32(enabled
);
3624 ath10k_dbg(ar
, ATH10K_DBG_WMI
,
3625 "wmi tlv quiet param: period %u duration %u enabled %d\n",
3626 period
, duration
, enabled
);
3630 static struct sk_buff
*
3631 ath10k_wmi_tlv_op_gen_wow_enable(struct ath10k
*ar
)
3633 struct wmi_tlv_wow_enable_cmd
*cmd
;
3634 struct wmi_tlv
*tlv
;
3635 struct sk_buff
*skb
;
3638 len
= sizeof(*tlv
) + sizeof(*cmd
);
3639 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3641 return ERR_PTR(-ENOMEM
);
3643 tlv
= (struct wmi_tlv
*)skb
->data
;
3644 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_WOW_ENABLE_CMD
);
3645 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3646 cmd
= (void *)tlv
->value
;
3648 cmd
->enable
= __cpu_to_le32(1);
3649 if (!ar
->bus_param
.link_can_suspend
)
3650 cmd
->pause_iface_config
= __cpu_to_le32(WOW_IFACE_PAUSE_DISABLED
);
3652 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv wow enable\n");
3656 static struct sk_buff
*
3657 ath10k_wmi_tlv_op_gen_wow_add_wakeup_event(struct ath10k
*ar
,
3659 enum wmi_wow_wakeup_event event
,
3662 struct wmi_tlv_wow_add_del_event_cmd
*cmd
;
3663 struct wmi_tlv
*tlv
;
3664 struct sk_buff
*skb
;
3667 len
= sizeof(*tlv
) + sizeof(*cmd
);
3668 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3670 return ERR_PTR(-ENOMEM
);
3672 tlv
= (struct wmi_tlv
*)skb
->data
;
3673 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_WOW_ADD_DEL_EVT_CMD
);
3674 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3675 cmd
= (void *)tlv
->value
;
3677 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3678 cmd
->is_add
= __cpu_to_le32(enable
);
3679 cmd
->event_bitmap
= __cpu_to_le32(1 << event
);
3681 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv wow add wakeup event %s enable %d vdev_id %d\n",
3682 wow_wakeup_event(event
), enable
, vdev_id
);
3686 static struct sk_buff
*
3687 ath10k_wmi_tlv_gen_wow_host_wakeup_ind(struct ath10k
*ar
)
3689 struct wmi_tlv_wow_host_wakeup_ind
*cmd
;
3690 struct wmi_tlv
*tlv
;
3691 struct sk_buff
*skb
;
3694 len
= sizeof(*tlv
) + sizeof(*cmd
);
3695 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3697 return ERR_PTR(-ENOMEM
);
3699 tlv
= (struct wmi_tlv
*)skb
->data
;
3700 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_WOW_HOSTWAKEUP_FROM_SLEEP_CMD
);
3701 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3702 cmd
= (void *)tlv
->value
;
3704 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv wow host wakeup ind\n");
3708 static struct sk_buff
*
3709 ath10k_wmi_tlv_op_gen_wow_add_pattern(struct ath10k
*ar
, u32 vdev_id
,
3710 u32 pattern_id
, const u8
*pattern
,
3711 const u8
*bitmask
, int pattern_len
,
3714 struct wmi_tlv_wow_add_pattern_cmd
*cmd
;
3715 struct wmi_tlv_wow_bitmap_pattern
*bitmap
;
3716 struct wmi_tlv
*tlv
;
3717 struct sk_buff
*skb
;
3721 len
= sizeof(*tlv
) + sizeof(*cmd
) +
3722 sizeof(*tlv
) + /* array struct */
3723 sizeof(*tlv
) + sizeof(*bitmap
) + /* bitmap */
3724 sizeof(*tlv
) + /* empty ipv4 sync */
3725 sizeof(*tlv
) + /* empty ipv6 sync */
3726 sizeof(*tlv
) + /* empty magic */
3727 sizeof(*tlv
) + /* empty info timeout */
3728 sizeof(*tlv
) + sizeof(u32
); /* ratelimit interval */
3730 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3732 return ERR_PTR(-ENOMEM
);
3735 ptr
= (void *)skb
->data
;
3737 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_WOW_ADD_PATTERN_CMD
);
3738 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3739 cmd
= (void *)tlv
->value
;
3741 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3742 cmd
->pattern_id
= __cpu_to_le32(pattern_id
);
3743 cmd
->pattern_type
= __cpu_to_le32(WOW_BITMAP_PATTERN
);
3745 ptr
+= sizeof(*tlv
);
3746 ptr
+= sizeof(*cmd
);
3750 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
3751 tlv
->len
= __cpu_to_le16(sizeof(*tlv
) + sizeof(*bitmap
));
3753 ptr
+= sizeof(*tlv
);
3756 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_WOW_BITMAP_PATTERN_T
);
3757 tlv
->len
= __cpu_to_le16(sizeof(*bitmap
));
3758 bitmap
= (void *)tlv
->value
;
3760 memcpy(bitmap
->patternbuf
, pattern
, pattern_len
);
3761 memcpy(bitmap
->bitmaskbuf
, bitmask
, pattern_len
);
3762 bitmap
->pattern_offset
= __cpu_to_le32(pattern_offset
);
3763 bitmap
->pattern_len
= __cpu_to_le32(pattern_len
);
3764 bitmap
->bitmask_len
= __cpu_to_le32(pattern_len
);
3765 bitmap
->pattern_id
= __cpu_to_le32(pattern_id
);
3767 ptr
+= sizeof(*tlv
);
3768 ptr
+= sizeof(*bitmap
);
3772 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
3773 tlv
->len
= __cpu_to_le16(0);
3775 ptr
+= sizeof(*tlv
);
3779 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
3780 tlv
->len
= __cpu_to_le16(0);
3782 ptr
+= sizeof(*tlv
);
3786 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
3787 tlv
->len
= __cpu_to_le16(0);
3789 ptr
+= sizeof(*tlv
);
3791 /* pattern info timeout */
3793 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32
);
3794 tlv
->len
= __cpu_to_le16(0);
3796 ptr
+= sizeof(*tlv
);
3798 /* ratelimit interval */
3800 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32
);
3801 tlv
->len
= __cpu_to_le16(sizeof(u32
));
3803 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv wow add pattern vdev_id %d pattern_id %d, pattern_offset %d\n",
3804 vdev_id
, pattern_id
, pattern_offset
);
3808 static struct sk_buff
*
3809 ath10k_wmi_tlv_op_gen_wow_del_pattern(struct ath10k
*ar
, u32 vdev_id
,
3812 struct wmi_tlv_wow_del_pattern_cmd
*cmd
;
3813 struct wmi_tlv
*tlv
;
3814 struct sk_buff
*skb
;
3817 len
= sizeof(*tlv
) + sizeof(*cmd
);
3818 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3820 return ERR_PTR(-ENOMEM
);
3822 tlv
= (struct wmi_tlv
*)skb
->data
;
3823 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_WOW_DEL_PATTERN_CMD
);
3824 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3825 cmd
= (void *)tlv
->value
;
3827 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3828 cmd
->pattern_id
= __cpu_to_le32(pattern_id
);
3829 cmd
->pattern_type
= __cpu_to_le32(WOW_BITMAP_PATTERN
);
3831 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv wow del pattern vdev_id %d pattern_id %d\n",
3832 vdev_id
, pattern_id
);
3836 /* Request FW to start PNO operation */
3837 static struct sk_buff
*
3838 ath10k_wmi_tlv_op_gen_config_pno_start(struct ath10k
*ar
,
3840 struct wmi_pno_scan_req
*pno
)
3842 struct nlo_configured_parameters
*nlo_list
;
3843 struct wmi_tlv_wow_nlo_config_cmd
*cmd
;
3844 struct wmi_tlv
*tlv
;
3845 struct sk_buff
*skb
;
3846 __le32
*channel_list
;
3852 len
= sizeof(*tlv
) + sizeof(*cmd
) +
3854 /* TLV place holder for array of structures
3855 * nlo_configured_parameters(nlo_list)
3858 /* TLV place holder for array of uint32 channel_list */
3860 len
+= sizeof(u32
) * min_t(u8
, pno
->a_networks
[0].channel_count
,
3862 len
+= sizeof(struct nlo_configured_parameters
) *
3863 min_t(u8
, pno
->uc_networks_count
, WMI_NLO_MAX_SSIDS
);
3865 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3867 return ERR_PTR(-ENOMEM
);
3869 ptr
= (void *)skb
->data
;
3871 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_NLO_CONFIG_CMD
);
3872 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3873 cmd
= (void *)tlv
->value
;
3875 /* wmi_tlv_wow_nlo_config_cmd parameters*/
3876 cmd
->vdev_id
= __cpu_to_le32(pno
->vdev_id
);
3877 cmd
->flags
= __cpu_to_le32(WMI_NLO_CONFIG_START
| WMI_NLO_CONFIG_SSID_HIDE_EN
);
3879 /* current FW does not support min-max range for dwell time */
3880 cmd
->active_dwell_time
= __cpu_to_le32(pno
->active_max_time
);
3881 cmd
->passive_dwell_time
= __cpu_to_le32(pno
->passive_max_time
);
3883 if (pno
->do_passive_scan
)
3884 cmd
->flags
|= __cpu_to_le32(WMI_NLO_CONFIG_SCAN_PASSIVE
);
3886 /* copy scan interval */
3887 cmd
->fast_scan_period
= __cpu_to_le32(pno
->fast_scan_period
);
3888 cmd
->slow_scan_period
= __cpu_to_le32(pno
->slow_scan_period
);
3889 cmd
->fast_scan_max_cycles
= __cpu_to_le32(pno
->fast_scan_max_cycles
);
3890 cmd
->delay_start_time
= __cpu_to_le32(pno
->delay_start_time
);
3892 if (pno
->enable_pno_scan_randomization
) {
3893 cmd
->flags
|= __cpu_to_le32(WMI_NLO_CONFIG_SPOOFED_MAC_IN_PROBE_REQ
|
3894 WMI_NLO_CONFIG_RANDOM_SEQ_NO_IN_PROBE_REQ
);
3895 ether_addr_copy(cmd
->mac_addr
.addr
, pno
->mac_addr
);
3896 ether_addr_copy(cmd
->mac_mask
.addr
, pno
->mac_addr_mask
);
3899 ptr
+= sizeof(*tlv
);
3900 ptr
+= sizeof(*cmd
);
3902 /* nlo_configured_parameters(nlo_list) */
3903 cmd
->no_of_ssids
= __cpu_to_le32(min_t(u8
, pno
->uc_networks_count
,
3904 WMI_NLO_MAX_SSIDS
));
3905 tlv_len
= __le32_to_cpu(cmd
->no_of_ssids
) *
3906 sizeof(struct nlo_configured_parameters
);
3909 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
3910 tlv
->len
= __cpu_to_le16(tlv_len
);
3912 ptr
+= sizeof(*tlv
);
3914 for (i
= 0; i
< __le32_to_cpu(cmd
->no_of_ssids
); i
++) {
3915 tlv
= (struct wmi_tlv
*)(&nlo_list
[i
].tlv_header
);
3916 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE
);
3917 tlv
->len
= __cpu_to_le16(sizeof(struct nlo_configured_parameters
) -
3920 /* copy ssid and it's length */
3921 nlo_list
[i
].ssid
.valid
= __cpu_to_le32(true);
3922 nlo_list
[i
].ssid
.ssid
.ssid_len
= pno
->a_networks
[i
].ssid
.ssid_len
;
3923 memcpy(nlo_list
[i
].ssid
.ssid
.ssid
,
3924 pno
->a_networks
[i
].ssid
.ssid
,
3925 __le32_to_cpu(nlo_list
[i
].ssid
.ssid
.ssid_len
));
3927 /* copy rssi threshold */
3928 if (pno
->a_networks
[i
].rssi_threshold
&&
3929 pno
->a_networks
[i
].rssi_threshold
> -300) {
3930 nlo_list
[i
].rssi_cond
.valid
= __cpu_to_le32(true);
3931 nlo_list
[i
].rssi_cond
.rssi
=
3932 __cpu_to_le32(pno
->a_networks
[i
].rssi_threshold
);
3935 nlo_list
[i
].bcast_nw_type
.valid
= __cpu_to_le32(true);
3936 nlo_list
[i
].bcast_nw_type
.bcast_nw_type
=
3937 __cpu_to_le32(pno
->a_networks
[i
].bcast_nw_type
);
3940 ptr
+= __le32_to_cpu(cmd
->no_of_ssids
) * sizeof(struct nlo_configured_parameters
);
3942 /* copy channel info */
3943 cmd
->num_of_channels
= __cpu_to_le32(min_t(u8
,
3944 pno
->a_networks
[0].channel_count
,
3948 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32
);
3949 tlv
->len
= __cpu_to_le16(__le32_to_cpu(cmd
->num_of_channels
) *
3951 ptr
+= sizeof(*tlv
);
3953 channel_list
= (__le32
*)ptr
;
3954 for (i
= 0; i
< __le32_to_cpu(cmd
->num_of_channels
); i
++)
3955 channel_list
[i
] = __cpu_to_le32(pno
->a_networks
[0].channels
[i
]);
3957 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv start pno config vdev_id %d\n",
3963 /* Request FW to stop ongoing PNO operation */
3964 static struct sk_buff
*ath10k_wmi_tlv_op_gen_config_pno_stop(struct ath10k
*ar
,
3967 struct wmi_tlv_wow_nlo_config_cmd
*cmd
;
3968 struct wmi_tlv
*tlv
;
3969 struct sk_buff
*skb
;
3973 len
= sizeof(*tlv
) + sizeof(*cmd
) +
3975 /* TLV place holder for array of structures
3976 * nlo_configured_parameters(nlo_list)
3979 /* TLV place holder for array of uint32 channel_list */
3980 skb
= ath10k_wmi_alloc_skb(ar
, len
);
3982 return ERR_PTR(-ENOMEM
);
3984 ptr
= (void *)skb
->data
;
3986 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_NLO_CONFIG_CMD
);
3987 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
3988 cmd
= (void *)tlv
->value
;
3990 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
3991 cmd
->flags
= __cpu_to_le32(WMI_NLO_CONFIG_STOP
);
3993 ptr
+= sizeof(*tlv
);
3994 ptr
+= sizeof(*cmd
);
3996 /* nlo_configured_parameters(nlo_list) */
3998 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT
);
3999 tlv
->len
= __cpu_to_le16(0);
4001 ptr
+= sizeof(*tlv
);
4005 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32
);
4006 tlv
->len
= __cpu_to_le16(0);
4008 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv stop pno config vdev_id %d\n", vdev_id
);
4012 static struct sk_buff
*
4013 ath10k_wmi_tlv_op_gen_config_pno(struct ath10k
*ar
, u32 vdev_id
,
4014 struct wmi_pno_scan_req
*pno_scan
)
4016 if (pno_scan
->enable
)
4017 return ath10k_wmi_tlv_op_gen_config_pno_start(ar
, vdev_id
, pno_scan
);
4019 return ath10k_wmi_tlv_op_gen_config_pno_stop(ar
, vdev_id
);
4022 static struct sk_buff
*
4023 ath10k_wmi_tlv_op_gen_adaptive_qcs(struct ath10k
*ar
, bool enable
)
4025 struct wmi_tlv_adaptive_qcs
*cmd
;
4026 struct wmi_tlv
*tlv
;
4027 struct sk_buff
*skb
;
4031 len
= sizeof(*tlv
) + sizeof(*cmd
);
4032 skb
= ath10k_wmi_alloc_skb(ar
, len
);
4034 return ERR_PTR(-ENOMEM
);
4036 ptr
= (void *)skb
->data
;
4038 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_RESMGR_ADAPTIVE_OCS_CMD
);
4039 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
4040 cmd
= (void *)tlv
->value
;
4041 cmd
->enable
= __cpu_to_le32(enable
? 1 : 0);
4043 ptr
+= sizeof(*tlv
);
4044 ptr
+= sizeof(*cmd
);
4046 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv adaptive qcs %d\n", enable
);
4050 static struct sk_buff
*
4051 ath10k_wmi_tlv_op_gen_echo(struct ath10k
*ar
, u32 value
)
4053 struct wmi_echo_cmd
*cmd
;
4054 struct wmi_tlv
*tlv
;
4055 struct sk_buff
*skb
;
4059 len
= sizeof(*tlv
) + sizeof(*cmd
);
4060 skb
= ath10k_wmi_alloc_skb(ar
, len
);
4062 return ERR_PTR(-ENOMEM
);
4064 ptr
= (void *)skb
->data
;
4066 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_ECHO_CMD
);
4067 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
4068 cmd
= (void *)tlv
->value
;
4069 cmd
->value
= cpu_to_le32(value
);
4071 ptr
+= sizeof(*tlv
);
4072 ptr
+= sizeof(*cmd
);
4074 ath10k_dbg(ar
, ATH10K_DBG_WMI
, "wmi tlv echo value 0x%08x\n", value
);
4078 static struct sk_buff
*
4079 ath10k_wmi_tlv_op_gen_vdev_spectral_conf(struct ath10k
*ar
,
4080 const struct wmi_vdev_spectral_conf_arg
*arg
)
4082 struct wmi_vdev_spectral_conf_cmd
*cmd
;
4083 struct sk_buff
*skb
;
4084 struct wmi_tlv
*tlv
;
4088 len
= sizeof(*tlv
) + sizeof(*cmd
);
4089 skb
= ath10k_wmi_alloc_skb(ar
, len
);
4091 return ERR_PTR(-ENOMEM
);
4093 ptr
= (void *)skb
->data
;
4095 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_SPECTRAL_CONFIGURE_CMD
);
4096 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
4097 cmd
= (void *)tlv
->value
;
4098 cmd
->vdev_id
= __cpu_to_le32(arg
->vdev_id
);
4099 cmd
->scan_count
= __cpu_to_le32(arg
->scan_count
);
4100 cmd
->scan_period
= __cpu_to_le32(arg
->scan_period
);
4101 cmd
->scan_priority
= __cpu_to_le32(arg
->scan_priority
);
4102 cmd
->scan_fft_size
= __cpu_to_le32(arg
->scan_fft_size
);
4103 cmd
->scan_gc_ena
= __cpu_to_le32(arg
->scan_gc_ena
);
4104 cmd
->scan_restart_ena
= __cpu_to_le32(arg
->scan_restart_ena
);
4105 cmd
->scan_noise_floor_ref
= __cpu_to_le32(arg
->scan_noise_floor_ref
);
4106 cmd
->scan_init_delay
= __cpu_to_le32(arg
->scan_init_delay
);
4107 cmd
->scan_nb_tone_thr
= __cpu_to_le32(arg
->scan_nb_tone_thr
);
4108 cmd
->scan_str_bin_thr
= __cpu_to_le32(arg
->scan_str_bin_thr
);
4109 cmd
->scan_wb_rpt_mode
= __cpu_to_le32(arg
->scan_wb_rpt_mode
);
4110 cmd
->scan_rssi_rpt_mode
= __cpu_to_le32(arg
->scan_rssi_rpt_mode
);
4111 cmd
->scan_rssi_thr
= __cpu_to_le32(arg
->scan_rssi_thr
);
4112 cmd
->scan_pwr_format
= __cpu_to_le32(arg
->scan_pwr_format
);
4113 cmd
->scan_rpt_mode
= __cpu_to_le32(arg
->scan_rpt_mode
);
4114 cmd
->scan_bin_scale
= __cpu_to_le32(arg
->scan_bin_scale
);
4115 cmd
->scan_dbm_adj
= __cpu_to_le32(arg
->scan_dbm_adj
);
4116 cmd
->scan_chn_mask
= __cpu_to_le32(arg
->scan_chn_mask
);
4121 static struct sk_buff
*
4122 ath10k_wmi_tlv_op_gen_vdev_spectral_enable(struct ath10k
*ar
, u32 vdev_id
,
4123 u32 trigger
, u32 enable
)
4125 struct wmi_vdev_spectral_enable_cmd
*cmd
;
4126 struct sk_buff
*skb
;
4127 struct wmi_tlv
*tlv
;
4131 len
= sizeof(*tlv
) + sizeof(*cmd
);
4132 skb
= ath10k_wmi_alloc_skb(ar
, len
);
4134 return ERR_PTR(-ENOMEM
);
4136 ptr
= (void *)skb
->data
;
4138 tlv
->tag
= __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_SPECTRAL_ENABLE_CMD
);
4139 tlv
->len
= __cpu_to_le16(sizeof(*cmd
));
4140 cmd
= (void *)tlv
->value
;
4141 cmd
->vdev_id
= __cpu_to_le32(vdev_id
);
4142 cmd
->trigger_cmd
= __cpu_to_le32(trigger
);
4143 cmd
->enable_cmd
= __cpu_to_le32(enable
);
4152 static struct wmi_cmd_map wmi_tlv_cmd_map
= {
4153 .init_cmdid
= WMI_TLV_INIT_CMDID
,
4154 .start_scan_cmdid
= WMI_TLV_START_SCAN_CMDID
,
4155 .stop_scan_cmdid
= WMI_TLV_STOP_SCAN_CMDID
,
4156 .scan_chan_list_cmdid
= WMI_TLV_SCAN_CHAN_LIST_CMDID
,
4157 .scan_sch_prio_tbl_cmdid
= WMI_TLV_SCAN_SCH_PRIO_TBL_CMDID
,
4158 .scan_prob_req_oui_cmdid
= WMI_TLV_SCAN_PROB_REQ_OUI_CMDID
,
4159 .pdev_set_regdomain_cmdid
= WMI_TLV_PDEV_SET_REGDOMAIN_CMDID
,
4160 .pdev_set_channel_cmdid
= WMI_TLV_PDEV_SET_CHANNEL_CMDID
,
4161 .pdev_set_param_cmdid
= WMI_TLV_PDEV_SET_PARAM_CMDID
,
4162 .pdev_pktlog_enable_cmdid
= WMI_TLV_PDEV_PKTLOG_ENABLE_CMDID
,
4163 .pdev_pktlog_disable_cmdid
= WMI_TLV_PDEV_PKTLOG_DISABLE_CMDID
,
4164 .pdev_set_wmm_params_cmdid
= WMI_TLV_PDEV_SET_WMM_PARAMS_CMDID
,
4165 .pdev_set_ht_cap_ie_cmdid
= WMI_TLV_PDEV_SET_HT_CAP_IE_CMDID
,
4166 .pdev_set_vht_cap_ie_cmdid
= WMI_TLV_PDEV_SET_VHT_CAP_IE_CMDID
,
4167 .pdev_set_dscp_tid_map_cmdid
= WMI_TLV_PDEV_SET_DSCP_TID_MAP_CMDID
,
4168 .pdev_set_quiet_mode_cmdid
= WMI_TLV_PDEV_SET_QUIET_MODE_CMDID
,
4169 .pdev_green_ap_ps_enable_cmdid
= WMI_TLV_PDEV_GREEN_AP_PS_ENABLE_CMDID
,
4170 .pdev_get_tpc_config_cmdid
= WMI_TLV_PDEV_GET_TPC_CONFIG_CMDID
,
4171 .pdev_set_base_macaddr_cmdid
= WMI_TLV_PDEV_SET_BASE_MACADDR_CMDID
,
4172 .vdev_create_cmdid
= WMI_TLV_VDEV_CREATE_CMDID
,
4173 .vdev_delete_cmdid
= WMI_TLV_VDEV_DELETE_CMDID
,
4174 .vdev_start_request_cmdid
= WMI_TLV_VDEV_START_REQUEST_CMDID
,
4175 .vdev_restart_request_cmdid
= WMI_TLV_VDEV_RESTART_REQUEST_CMDID
,
4176 .vdev_up_cmdid
= WMI_TLV_VDEV_UP_CMDID
,
4177 .vdev_stop_cmdid
= WMI_TLV_VDEV_STOP_CMDID
,
4178 .vdev_down_cmdid
= WMI_TLV_VDEV_DOWN_CMDID
,
4179 .vdev_set_param_cmdid
= WMI_TLV_VDEV_SET_PARAM_CMDID
,
4180 .vdev_install_key_cmdid
= WMI_TLV_VDEV_INSTALL_KEY_CMDID
,
4181 .peer_create_cmdid
= WMI_TLV_PEER_CREATE_CMDID
,
4182 .peer_delete_cmdid
= WMI_TLV_PEER_DELETE_CMDID
,
4183 .peer_flush_tids_cmdid
= WMI_TLV_PEER_FLUSH_TIDS_CMDID
,
4184 .peer_set_param_cmdid
= WMI_TLV_PEER_SET_PARAM_CMDID
,
4185 .peer_assoc_cmdid
= WMI_TLV_PEER_ASSOC_CMDID
,
4186 .peer_add_wds_entry_cmdid
= WMI_TLV_PEER_ADD_WDS_ENTRY_CMDID
,
4187 .peer_remove_wds_entry_cmdid
= WMI_TLV_PEER_REMOVE_WDS_ENTRY_CMDID
,
4188 .peer_mcast_group_cmdid
= WMI_TLV_PEER_MCAST_GROUP_CMDID
,
4189 .bcn_tx_cmdid
= WMI_TLV_BCN_TX_CMDID
,
4190 .pdev_send_bcn_cmdid
= WMI_TLV_PDEV_SEND_BCN_CMDID
,
4191 .bcn_tmpl_cmdid
= WMI_TLV_BCN_TMPL_CMDID
,
4192 .bcn_filter_rx_cmdid
= WMI_TLV_BCN_FILTER_RX_CMDID
,
4193 .prb_req_filter_rx_cmdid
= WMI_TLV_PRB_REQ_FILTER_RX_CMDID
,
4194 .mgmt_tx_cmdid
= WMI_TLV_MGMT_TX_CMDID
,
4195 .mgmt_tx_send_cmdid
= WMI_TLV_MGMT_TX_SEND_CMD
,
4196 .prb_tmpl_cmdid
= WMI_TLV_PRB_TMPL_CMDID
,
4197 .addba_clear_resp_cmdid
= WMI_TLV_ADDBA_CLEAR_RESP_CMDID
,
4198 .addba_send_cmdid
= WMI_TLV_ADDBA_SEND_CMDID
,
4199 .addba_status_cmdid
= WMI_TLV_ADDBA_STATUS_CMDID
,
4200 .delba_send_cmdid
= WMI_TLV_DELBA_SEND_CMDID
,
4201 .addba_set_resp_cmdid
= WMI_TLV_ADDBA_SET_RESP_CMDID
,
4202 .send_singleamsdu_cmdid
= WMI_TLV_SEND_SINGLEAMSDU_CMDID
,
4203 .sta_powersave_mode_cmdid
= WMI_TLV_STA_POWERSAVE_MODE_CMDID
,
4204 .sta_powersave_param_cmdid
= WMI_TLV_STA_POWERSAVE_PARAM_CMDID
,
4205 .sta_mimo_ps_mode_cmdid
= WMI_TLV_STA_MIMO_PS_MODE_CMDID
,
4206 .pdev_dfs_enable_cmdid
= WMI_TLV_PDEV_DFS_ENABLE_CMDID
,
4207 .pdev_dfs_disable_cmdid
= WMI_TLV_PDEV_DFS_DISABLE_CMDID
,
4208 .roam_scan_mode
= WMI_TLV_ROAM_SCAN_MODE
,
4209 .roam_scan_rssi_threshold
= WMI_TLV_ROAM_SCAN_RSSI_THRESHOLD
,
4210 .roam_scan_period
= WMI_TLV_ROAM_SCAN_PERIOD
,
4211 .roam_scan_rssi_change_threshold
=
4212 WMI_TLV_ROAM_SCAN_RSSI_CHANGE_THRESHOLD
,
4213 .roam_ap_profile
= WMI_TLV_ROAM_AP_PROFILE
,
4214 .ofl_scan_add_ap_profile
= WMI_TLV_ROAM_AP_PROFILE
,
4215 .ofl_scan_remove_ap_profile
= WMI_TLV_OFL_SCAN_REMOVE_AP_PROFILE
,
4216 .ofl_scan_period
= WMI_TLV_OFL_SCAN_PERIOD
,
4217 .p2p_dev_set_device_info
= WMI_TLV_P2P_DEV_SET_DEVICE_INFO
,
4218 .p2p_dev_set_discoverability
= WMI_TLV_P2P_DEV_SET_DISCOVERABILITY
,
4219 .p2p_go_set_beacon_ie
= WMI_TLV_P2P_GO_SET_BEACON_IE
,
4220 .p2p_go_set_probe_resp_ie
= WMI_TLV_P2P_GO_SET_PROBE_RESP_IE
,
4221 .p2p_set_vendor_ie_data_cmdid
= WMI_TLV_P2P_SET_VENDOR_IE_DATA_CMDID
,
4222 .ap_ps_peer_param_cmdid
= WMI_TLV_AP_PS_PEER_PARAM_CMDID
,
4223 .ap_ps_peer_uapsd_coex_cmdid
= WMI_TLV_AP_PS_PEER_UAPSD_COEX_CMDID
,
4224 .peer_rate_retry_sched_cmdid
= WMI_TLV_PEER_RATE_RETRY_SCHED_CMDID
,
4225 .wlan_profile_trigger_cmdid
= WMI_TLV_WLAN_PROFILE_TRIGGER_CMDID
,
4226 .wlan_profile_set_hist_intvl_cmdid
=
4227 WMI_TLV_WLAN_PROFILE_SET_HIST_INTVL_CMDID
,
4228 .wlan_profile_get_profile_data_cmdid
=
4229 WMI_TLV_WLAN_PROFILE_GET_PROFILE_DATA_CMDID
,
4230 .wlan_profile_enable_profile_id_cmdid
=
4231 WMI_TLV_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID
,
4232 .wlan_profile_list_profile_id_cmdid
=
4233 WMI_TLV_WLAN_PROFILE_LIST_PROFILE_ID_CMDID
,
4234 .pdev_suspend_cmdid
= WMI_TLV_PDEV_SUSPEND_CMDID
,
4235 .pdev_resume_cmdid
= WMI_TLV_PDEV_RESUME_CMDID
,
4236 .add_bcn_filter_cmdid
= WMI_TLV_ADD_BCN_FILTER_CMDID
,
4237 .rmv_bcn_filter_cmdid
= WMI_TLV_RMV_BCN_FILTER_CMDID
,
4238 .wow_add_wake_pattern_cmdid
= WMI_TLV_WOW_ADD_WAKE_PATTERN_CMDID
,
4239 .wow_del_wake_pattern_cmdid
= WMI_TLV_WOW_DEL_WAKE_PATTERN_CMDID
,
4240 .wow_enable_disable_wake_event_cmdid
=
4241 WMI_TLV_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID
,
4242 .wow_enable_cmdid
= WMI_TLV_WOW_ENABLE_CMDID
,
4243 .wow_hostwakeup_from_sleep_cmdid
=
4244 WMI_TLV_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID
,
4245 .rtt_measreq_cmdid
= WMI_TLV_RTT_MEASREQ_CMDID
,
4246 .rtt_tsf_cmdid
= WMI_TLV_RTT_TSF_CMDID
,
4247 .vdev_spectral_scan_configure_cmdid
= WMI_TLV_SPECTRAL_SCAN_CONF_CMDID
,
4248 .vdev_spectral_scan_enable_cmdid
= WMI_TLV_SPECTRAL_SCAN_ENABLE_CMDID
,
4249 .request_stats_cmdid
= WMI_TLV_REQUEST_STATS_CMDID
,
4250 .request_peer_stats_info_cmdid
= WMI_TLV_REQUEST_PEER_STATS_INFO_CMDID
,
4251 .set_arp_ns_offload_cmdid
= WMI_TLV_SET_ARP_NS_OFFLOAD_CMDID
,
4252 .network_list_offload_config_cmdid
=
4253 WMI_TLV_NETWORK_LIST_OFFLOAD_CONFIG_CMDID
,
4254 .gtk_offload_cmdid
= WMI_TLV_GTK_OFFLOAD_CMDID
,
4255 .csa_offload_enable_cmdid
= WMI_TLV_CSA_OFFLOAD_ENABLE_CMDID
,
4256 .csa_offload_chanswitch_cmdid
= WMI_TLV_CSA_OFFLOAD_CHANSWITCH_CMDID
,
4257 .chatter_set_mode_cmdid
= WMI_TLV_CHATTER_SET_MODE_CMDID
,
4258 .peer_tid_addba_cmdid
= WMI_TLV_PEER_TID_ADDBA_CMDID
,
4259 .peer_tid_delba_cmdid
= WMI_TLV_PEER_TID_DELBA_CMDID
,
4260 .sta_dtim_ps_method_cmdid
= WMI_TLV_STA_DTIM_PS_METHOD_CMDID
,
4261 .sta_uapsd_auto_trig_cmdid
= WMI_TLV_STA_UAPSD_AUTO_TRIG_CMDID
,
4262 .sta_keepalive_cmd
= WMI_TLV_STA_KEEPALIVE_CMDID
,
4263 .echo_cmdid
= WMI_TLV_ECHO_CMDID
,
4264 .pdev_utf_cmdid
= WMI_TLV_PDEV_UTF_CMDID
,
4265 .dbglog_cfg_cmdid
= WMI_TLV_DBGLOG_CFG_CMDID
,
4266 .pdev_qvit_cmdid
= WMI_TLV_PDEV_QVIT_CMDID
,
4267 .pdev_ftm_intg_cmdid
= WMI_TLV_PDEV_FTM_INTG_CMDID
,
4268 .vdev_set_keepalive_cmdid
= WMI_TLV_VDEV_SET_KEEPALIVE_CMDID
,
4269 .vdev_get_keepalive_cmdid
= WMI_TLV_VDEV_GET_KEEPALIVE_CMDID
,
4270 .force_fw_hang_cmdid
= WMI_TLV_FORCE_FW_HANG_CMDID
,
4271 .gpio_config_cmdid
= WMI_TLV_GPIO_CONFIG_CMDID
,
4272 .gpio_output_cmdid
= WMI_TLV_GPIO_OUTPUT_CMDID
,
4273 .pdev_get_temperature_cmdid
= WMI_TLV_PDEV_GET_TEMPERATURE_CMDID
,
4274 .vdev_set_wmm_params_cmdid
= WMI_TLV_VDEV_SET_WMM_PARAMS_CMDID
,
4275 .tdls_set_state_cmdid
= WMI_TLV_TDLS_SET_STATE_CMDID
,
4276 .tdls_peer_update_cmdid
= WMI_TLV_TDLS_PEER_UPDATE_CMDID
,
4277 .adaptive_qcs_cmdid
= WMI_TLV_RESMGR_ADAPTIVE_OCS_CMDID
,
4278 .scan_update_request_cmdid
= WMI_CMD_UNSUPPORTED
,
4279 .vdev_standby_response_cmdid
= WMI_CMD_UNSUPPORTED
,
4280 .vdev_resume_response_cmdid
= WMI_CMD_UNSUPPORTED
,
4281 .wlan_peer_caching_add_peer_cmdid
= WMI_CMD_UNSUPPORTED
,
4282 .wlan_peer_caching_evict_peer_cmdid
= WMI_CMD_UNSUPPORTED
,
4283 .wlan_peer_caching_restore_peer_cmdid
= WMI_CMD_UNSUPPORTED
,
4284 .wlan_peer_caching_print_all_peers_info_cmdid
= WMI_CMD_UNSUPPORTED
,
4285 .peer_update_wds_entry_cmdid
= WMI_CMD_UNSUPPORTED
,
4286 .peer_add_proxy_sta_entry_cmdid
= WMI_CMD_UNSUPPORTED
,
4287 .rtt_keepalive_cmdid
= WMI_CMD_UNSUPPORTED
,
4288 .oem_req_cmdid
= WMI_CMD_UNSUPPORTED
,
4289 .nan_cmdid
= WMI_CMD_UNSUPPORTED
,
4290 .vdev_ratemask_cmdid
= WMI_CMD_UNSUPPORTED
,
4291 .qboost_cfg_cmdid
= WMI_CMD_UNSUPPORTED
,
4292 .pdev_smart_ant_enable_cmdid
= WMI_CMD_UNSUPPORTED
,
4293 .pdev_smart_ant_set_rx_antenna_cmdid
= WMI_CMD_UNSUPPORTED
,
4294 .peer_smart_ant_set_tx_antenna_cmdid
= WMI_CMD_UNSUPPORTED
,
4295 .peer_smart_ant_set_train_info_cmdid
= WMI_CMD_UNSUPPORTED
,
4296 .peer_smart_ant_set_node_config_ops_cmdid
= WMI_CMD_UNSUPPORTED
,
4297 .pdev_set_antenna_switch_table_cmdid
= WMI_CMD_UNSUPPORTED
,
4298 .pdev_set_ctl_table_cmdid
= WMI_CMD_UNSUPPORTED
,
4299 .pdev_set_mimogain_table_cmdid
= WMI_CMD_UNSUPPORTED
,
4300 .pdev_ratepwr_table_cmdid
= WMI_CMD_UNSUPPORTED
,
4301 .pdev_ratepwr_chainmsk_table_cmdid
= WMI_CMD_UNSUPPORTED
,
4302 .pdev_fips_cmdid
= WMI_CMD_UNSUPPORTED
,
4303 .tt_set_conf_cmdid
= WMI_CMD_UNSUPPORTED
,
4304 .fwtest_cmdid
= WMI_CMD_UNSUPPORTED
,
4305 .vdev_atf_request_cmdid
= WMI_CMD_UNSUPPORTED
,
4306 .peer_atf_request_cmdid
= WMI_CMD_UNSUPPORTED
,
4307 .pdev_get_ani_cck_config_cmdid
= WMI_CMD_UNSUPPORTED
,
4308 .pdev_get_ani_ofdm_config_cmdid
= WMI_CMD_UNSUPPORTED
,
4309 .pdev_reserve_ast_entry_cmdid
= WMI_CMD_UNSUPPORTED
,
4312 static struct wmi_pdev_param_map wmi_tlv_pdev_param_map
= {
4313 .tx_chain_mask
= WMI_TLV_PDEV_PARAM_TX_CHAIN_MASK
,
4314 .rx_chain_mask
= WMI_TLV_PDEV_PARAM_RX_CHAIN_MASK
,
4315 .txpower_limit2g
= WMI_TLV_PDEV_PARAM_TXPOWER_LIMIT2G
,
4316 .txpower_limit5g
= WMI_TLV_PDEV_PARAM_TXPOWER_LIMIT5G
,
4317 .txpower_scale
= WMI_TLV_PDEV_PARAM_TXPOWER_SCALE
,
4318 .beacon_gen_mode
= WMI_TLV_PDEV_PARAM_BEACON_GEN_MODE
,
4319 .beacon_tx_mode
= WMI_TLV_PDEV_PARAM_BEACON_TX_MODE
,
4320 .resmgr_offchan_mode
= WMI_TLV_PDEV_PARAM_RESMGR_OFFCHAN_MODE
,
4321 .protection_mode
= WMI_TLV_PDEV_PARAM_PROTECTION_MODE
,
4322 .dynamic_bw
= WMI_TLV_PDEV_PARAM_DYNAMIC_BW
,
4323 .non_agg_sw_retry_th
= WMI_TLV_PDEV_PARAM_NON_AGG_SW_RETRY_TH
,
4324 .agg_sw_retry_th
= WMI_TLV_PDEV_PARAM_AGG_SW_RETRY_TH
,
4325 .sta_kickout_th
= WMI_TLV_PDEV_PARAM_STA_KICKOUT_TH
,
4326 .ac_aggrsize_scaling
= WMI_TLV_PDEV_PARAM_AC_AGGRSIZE_SCALING
,
4327 .ltr_enable
= WMI_TLV_PDEV_PARAM_LTR_ENABLE
,
4328 .ltr_ac_latency_be
= WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_BE
,
4329 .ltr_ac_latency_bk
= WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_BK
,
4330 .ltr_ac_latency_vi
= WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_VI
,
4331 .ltr_ac_latency_vo
= WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_VO
,
4332 .ltr_ac_latency_timeout
= WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT
,
4333 .ltr_sleep_override
= WMI_TLV_PDEV_PARAM_LTR_SLEEP_OVERRIDE
,
4334 .ltr_rx_override
= WMI_TLV_PDEV_PARAM_LTR_RX_OVERRIDE
,
4335 .ltr_tx_activity_timeout
= WMI_TLV_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT
,
4336 .l1ss_enable
= WMI_TLV_PDEV_PARAM_L1SS_ENABLE
,
4337 .dsleep_enable
= WMI_TLV_PDEV_PARAM_DSLEEP_ENABLE
,
4338 .pcielp_txbuf_flush
= WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_FLUSH
,
4339 .pcielp_txbuf_watermark
= WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_TMO_EN
,
4340 .pcielp_txbuf_tmo_en
= WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_TMO_EN
,
4341 .pcielp_txbuf_tmo_value
= WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE
,
4342 .pdev_stats_update_period
= WMI_TLV_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD
,
4343 .vdev_stats_update_period
= WMI_TLV_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD
,
4344 .peer_stats_update_period
= WMI_TLV_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD
,
4345 .bcnflt_stats_update_period
=
4346 WMI_TLV_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD
,
4347 .pmf_qos
= WMI_TLV_PDEV_PARAM_PMF_QOS
,
4348 .arp_ac_override
= WMI_TLV_PDEV_PARAM_ARP_AC_OVERRIDE
,
4349 .dcs
= WMI_TLV_PDEV_PARAM_DCS
,
4350 .ani_enable
= WMI_TLV_PDEV_PARAM_ANI_ENABLE
,
4351 .ani_poll_period
= WMI_TLV_PDEV_PARAM_ANI_POLL_PERIOD
,
4352 .ani_listen_period
= WMI_TLV_PDEV_PARAM_ANI_LISTEN_PERIOD
,
4353 .ani_ofdm_level
= WMI_TLV_PDEV_PARAM_ANI_OFDM_LEVEL
,
4354 .ani_cck_level
= WMI_TLV_PDEV_PARAM_ANI_CCK_LEVEL
,
4355 .dyntxchain
= WMI_TLV_PDEV_PARAM_DYNTXCHAIN
,
4356 .proxy_sta
= WMI_TLV_PDEV_PARAM_PROXY_STA
,
4357 .idle_ps_config
= WMI_TLV_PDEV_PARAM_IDLE_PS_CONFIG
,
4358 .power_gating_sleep
= WMI_TLV_PDEV_PARAM_POWER_GATING_SLEEP
,
4359 .fast_channel_reset
= WMI_TLV_PDEV_PARAM_UNSUPPORTED
,
4360 .burst_dur
= WMI_TLV_PDEV_PARAM_BURST_DUR
,
4361 .burst_enable
= WMI_TLV_PDEV_PARAM_BURST_ENABLE
,
4362 .cal_period
= WMI_PDEV_PARAM_UNSUPPORTED
,
4363 .aggr_burst
= WMI_PDEV_PARAM_UNSUPPORTED
,
4364 .rx_decap_mode
= WMI_PDEV_PARAM_UNSUPPORTED
,
4365 .smart_antenna_default_antenna
= WMI_PDEV_PARAM_UNSUPPORTED
,
4366 .igmpmld_override
= WMI_PDEV_PARAM_UNSUPPORTED
,
4367 .igmpmld_tid
= WMI_PDEV_PARAM_UNSUPPORTED
,
4368 .antenna_gain
= WMI_PDEV_PARAM_UNSUPPORTED
,
4369 .rx_filter
= WMI_PDEV_PARAM_UNSUPPORTED
,
4370 .set_mcast_to_ucast_tid
= WMI_PDEV_PARAM_UNSUPPORTED
,
4371 .proxy_sta_mode
= WMI_PDEV_PARAM_UNSUPPORTED
,
4372 .set_mcast2ucast_mode
= WMI_PDEV_PARAM_UNSUPPORTED
,
4373 .set_mcast2ucast_buffer
= WMI_PDEV_PARAM_UNSUPPORTED
,
4374 .remove_mcast2ucast_buffer
= WMI_PDEV_PARAM_UNSUPPORTED
,
4375 .peer_sta_ps_statechg_enable
= WMI_PDEV_PARAM_UNSUPPORTED
,
4376 .igmpmld_ac_override
= WMI_PDEV_PARAM_UNSUPPORTED
,
4377 .block_interbss
= WMI_PDEV_PARAM_UNSUPPORTED
,
4378 .set_disable_reset_cmdid
= WMI_PDEV_PARAM_UNSUPPORTED
,
4379 .set_msdu_ttl_cmdid
= WMI_PDEV_PARAM_UNSUPPORTED
,
4380 .set_ppdu_duration_cmdid
= WMI_PDEV_PARAM_UNSUPPORTED
,
4381 .txbf_sound_period_cmdid
= WMI_PDEV_PARAM_UNSUPPORTED
,
4382 .set_promisc_mode_cmdid
= WMI_PDEV_PARAM_UNSUPPORTED
,
4383 .set_burst_mode_cmdid
= WMI_PDEV_PARAM_UNSUPPORTED
,
4384 .en_stats
= WMI_PDEV_PARAM_UNSUPPORTED
,
4385 .mu_group_policy
= WMI_PDEV_PARAM_UNSUPPORTED
,
4386 .noise_detection
= WMI_PDEV_PARAM_UNSUPPORTED
,
4387 .noise_threshold
= WMI_PDEV_PARAM_UNSUPPORTED
,
4388 .dpd_enable
= WMI_PDEV_PARAM_UNSUPPORTED
,
4389 .set_mcast_bcast_echo
= WMI_PDEV_PARAM_UNSUPPORTED
,
4390 .atf_strict_sch
= WMI_PDEV_PARAM_UNSUPPORTED
,
4391 .atf_sched_duration
= WMI_PDEV_PARAM_UNSUPPORTED
,
4392 .ant_plzn
= WMI_PDEV_PARAM_UNSUPPORTED
,
4393 .mgmt_retry_limit
= WMI_PDEV_PARAM_UNSUPPORTED
,
4394 .sensitivity_level
= WMI_PDEV_PARAM_UNSUPPORTED
,
4395 .signed_txpower_2g
= WMI_PDEV_PARAM_UNSUPPORTED
,
4396 .signed_txpower_5g
= WMI_PDEV_PARAM_UNSUPPORTED
,
4397 .enable_per_tid_amsdu
= WMI_PDEV_PARAM_UNSUPPORTED
,
4398 .enable_per_tid_ampdu
= WMI_PDEV_PARAM_UNSUPPORTED
,
4399 .cca_threshold
= WMI_PDEV_PARAM_UNSUPPORTED
,
4400 .rts_fixed_rate
= WMI_PDEV_PARAM_UNSUPPORTED
,
4401 .pdev_reset
= WMI_PDEV_PARAM_UNSUPPORTED
,
4402 .wapi_mbssid_offset
= WMI_PDEV_PARAM_UNSUPPORTED
,
4403 .arp_srcaddr
= WMI_PDEV_PARAM_UNSUPPORTED
,
4404 .arp_dstaddr
= WMI_PDEV_PARAM_UNSUPPORTED
,
4405 .rfkill_config
= WMI_TLV_PDEV_PARAM_HW_RFKILL_CONFIG
,
4406 .rfkill_enable
= WMI_TLV_PDEV_PARAM_RFKILL_ENABLE
,
4407 .peer_stats_info_enable
= WMI_TLV_PDEV_PARAM_PEER_STATS_INFO_ENABLE
,
4410 static struct wmi_peer_param_map wmi_tlv_peer_param_map
= {
4411 .smps_state
= WMI_TLV_PEER_SMPS_STATE
,
4412 .ampdu
= WMI_TLV_PEER_AMPDU
,
4413 .authorize
= WMI_TLV_PEER_AUTHORIZE
,
4414 .chan_width
= WMI_TLV_PEER_CHAN_WIDTH
,
4415 .nss
= WMI_TLV_PEER_NSS
,
4416 .use_4addr
= WMI_TLV_PEER_USE_4ADDR
,
4417 .membership
= WMI_TLV_PEER_MEMBERSHIP
,
4418 .user_pos
= WMI_TLV_PEER_USERPOS
,
4419 .crit_proto_hint_enabled
= WMI_TLV_PEER_CRIT_PROTO_HINT_ENABLED
,
4420 .tx_fail_cnt_thr
= WMI_TLV_PEER_TX_FAIL_CNT_THR
,
4421 .set_hw_retry_cts2s
= WMI_TLV_PEER_SET_HW_RETRY_CTS2S
,
4422 .ibss_atim_win_len
= WMI_TLV_PEER_IBSS_ATIM_WINDOW_LENGTH
,
4423 .phymode
= WMI_TLV_PEER_PHYMODE
,
4424 .use_fixed_power
= WMI_TLV_PEER_USE_FIXED_PWR
,
4425 .dummy_var
= WMI_TLV_PEER_DUMMY_VAR
,
4428 static struct wmi_vdev_param_map wmi_tlv_vdev_param_map
= {
4429 .rts_threshold
= WMI_TLV_VDEV_PARAM_RTS_THRESHOLD
,
4430 .fragmentation_threshold
= WMI_TLV_VDEV_PARAM_FRAGMENTATION_THRESHOLD
,
4431 .beacon_interval
= WMI_TLV_VDEV_PARAM_BEACON_INTERVAL
,
4432 .listen_interval
= WMI_TLV_VDEV_PARAM_LISTEN_INTERVAL
,
4433 .multicast_rate
= WMI_TLV_VDEV_PARAM_MULTICAST_RATE
,
4434 .mgmt_tx_rate
= WMI_TLV_VDEV_PARAM_MGMT_TX_RATE
,
4435 .slot_time
= WMI_TLV_VDEV_PARAM_SLOT_TIME
,
4436 .preamble
= WMI_TLV_VDEV_PARAM_PREAMBLE
,
4437 .swba_time
= WMI_TLV_VDEV_PARAM_SWBA_TIME
,
4438 .wmi_vdev_stats_update_period
= WMI_TLV_VDEV_STATS_UPDATE_PERIOD
,
4439 .wmi_vdev_pwrsave_ageout_time
= WMI_TLV_VDEV_PWRSAVE_AGEOUT_TIME
,
4440 .wmi_vdev_host_swba_interval
= WMI_TLV_VDEV_HOST_SWBA_INTERVAL
,
4441 .dtim_period
= WMI_TLV_VDEV_PARAM_DTIM_PERIOD
,
4442 .wmi_vdev_oc_scheduler_air_time_limit
=
4443 WMI_TLV_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT
,
4444 .wds
= WMI_TLV_VDEV_PARAM_WDS
,
4445 .atim_window
= WMI_TLV_VDEV_PARAM_ATIM_WINDOW
,
4446 .bmiss_count_max
= WMI_TLV_VDEV_PARAM_BMISS_COUNT_MAX
,
4447 .bmiss_first_bcnt
= WMI_TLV_VDEV_PARAM_BMISS_FIRST_BCNT
,
4448 .bmiss_final_bcnt
= WMI_TLV_VDEV_PARAM_BMISS_FINAL_BCNT
,
4449 .feature_wmm
= WMI_TLV_VDEV_PARAM_FEATURE_WMM
,
4450 .chwidth
= WMI_TLV_VDEV_PARAM_CHWIDTH
,
4451 .chextoffset
= WMI_TLV_VDEV_PARAM_CHEXTOFFSET
,
4452 .disable_htprotection
= WMI_TLV_VDEV_PARAM_DISABLE_HTPROTECTION
,
4453 .sta_quickkickout
= WMI_TLV_VDEV_PARAM_STA_QUICKKICKOUT
,
4454 .mgmt_rate
= WMI_TLV_VDEV_PARAM_MGMT_RATE
,
4455 .protection_mode
= WMI_TLV_VDEV_PARAM_PROTECTION_MODE
,
4456 .fixed_rate
= WMI_TLV_VDEV_PARAM_FIXED_RATE
,
4457 .sgi
= WMI_TLV_VDEV_PARAM_SGI
,
4458 .ldpc
= WMI_TLV_VDEV_PARAM_LDPC
,
4459 .tx_stbc
= WMI_TLV_VDEV_PARAM_TX_STBC
,
4460 .rx_stbc
= WMI_TLV_VDEV_PARAM_RX_STBC
,
4461 .intra_bss_fwd
= WMI_TLV_VDEV_PARAM_INTRA_BSS_FWD
,
4462 .def_keyid
= WMI_TLV_VDEV_PARAM_DEF_KEYID
,
4463 .nss
= WMI_TLV_VDEV_PARAM_NSS
,
4464 .bcast_data_rate
= WMI_TLV_VDEV_PARAM_BCAST_DATA_RATE
,
4465 .mcast_data_rate
= WMI_TLV_VDEV_PARAM_MCAST_DATA_RATE
,
4466 .mcast_indicate
= WMI_TLV_VDEV_PARAM_MCAST_INDICATE
,
4467 .dhcp_indicate
= WMI_TLV_VDEV_PARAM_DHCP_INDICATE
,
4468 .unknown_dest_indicate
= WMI_TLV_VDEV_PARAM_UNKNOWN_DEST_INDICATE
,
4469 .ap_keepalive_min_idle_inactive_time_secs
=
4470 WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS
,
4471 .ap_keepalive_max_idle_inactive_time_secs
=
4472 WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS
,
4473 .ap_keepalive_max_unresponsive_time_secs
=
4474 WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS
,
4475 .ap_enable_nawds
= WMI_TLV_VDEV_PARAM_AP_ENABLE_NAWDS
,
4476 .mcast2ucast_set
= WMI_TLV_VDEV_PARAM_UNSUPPORTED
,
4477 .enable_rtscts
= WMI_TLV_VDEV_PARAM_ENABLE_RTSCTS
,
4478 .txbf
= WMI_TLV_VDEV_PARAM_TXBF
,
4479 .packet_powersave
= WMI_TLV_VDEV_PARAM_PACKET_POWERSAVE
,
4480 .drop_unencry
= WMI_TLV_VDEV_PARAM_DROP_UNENCRY
,
4481 .tx_encap_type
= WMI_TLV_VDEV_PARAM_TX_ENCAP_TYPE
,
4482 .ap_detect_out_of_sync_sleeping_sta_time_secs
=
4483 WMI_TLV_VDEV_PARAM_UNSUPPORTED
,
4484 .rc_num_retries
= WMI_VDEV_PARAM_UNSUPPORTED
,
4485 .cabq_maxdur
= WMI_VDEV_PARAM_UNSUPPORTED
,
4486 .mfptest_set
= WMI_VDEV_PARAM_UNSUPPORTED
,
4487 .rts_fixed_rate
= WMI_VDEV_PARAM_UNSUPPORTED
,
4488 .vht_sgimask
= WMI_VDEV_PARAM_UNSUPPORTED
,
4489 .vht80_ratemask
= WMI_VDEV_PARAM_UNSUPPORTED
,
4490 .early_rx_adjust_enable
= WMI_VDEV_PARAM_UNSUPPORTED
,
4491 .early_rx_tgt_bmiss_num
= WMI_VDEV_PARAM_UNSUPPORTED
,
4492 .early_rx_bmiss_sample_cycle
= WMI_VDEV_PARAM_UNSUPPORTED
,
4493 .early_rx_slop_step
= WMI_VDEV_PARAM_UNSUPPORTED
,
4494 .early_rx_init_slop
= WMI_VDEV_PARAM_UNSUPPORTED
,
4495 .early_rx_adjust_pause
= WMI_VDEV_PARAM_UNSUPPORTED
,
4496 .proxy_sta
= WMI_VDEV_PARAM_UNSUPPORTED
,
4497 .meru_vc
= WMI_VDEV_PARAM_UNSUPPORTED
,
4498 .rx_decap_type
= WMI_VDEV_PARAM_UNSUPPORTED
,
4499 .bw_nss_ratemask
= WMI_VDEV_PARAM_UNSUPPORTED
,
4502 static const struct wmi_ops wmi_tlv_ops
= {
4503 .rx
= ath10k_wmi_tlv_op_rx
,
4504 .map_svc
= wmi_tlv_svc_map
,
4505 .map_svc_ext
= wmi_tlv_svc_map_ext
,
4507 .pull_scan
= ath10k_wmi_tlv_op_pull_scan_ev
,
4508 .pull_mgmt_rx
= ath10k_wmi_tlv_op_pull_mgmt_rx_ev
,
4509 .pull_mgmt_tx_compl
= ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev
,
4510 .pull_mgmt_tx_bundle_compl
= ath10k_wmi_tlv_op_pull_mgmt_tx_bundle_compl_ev
,
4511 .pull_ch_info
= ath10k_wmi_tlv_op_pull_ch_info_ev
,
4512 .pull_vdev_start
= ath10k_wmi_tlv_op_pull_vdev_start_ev
,
4513 .pull_peer_kick
= ath10k_wmi_tlv_op_pull_peer_kick_ev
,
4514 .pull_swba
= ath10k_wmi_tlv_op_pull_swba_ev
,
4515 .pull_phyerr_hdr
= ath10k_wmi_tlv_op_pull_phyerr_ev_hdr
,
4516 .pull_phyerr
= ath10k_wmi_op_pull_phyerr_ev
,
4517 .pull_svc_rdy
= ath10k_wmi_tlv_op_pull_svc_rdy_ev
,
4518 .pull_rdy
= ath10k_wmi_tlv_op_pull_rdy_ev
,
4519 .pull_svc_avail
= ath10k_wmi_tlv_op_pull_svc_avail
,
4520 .pull_fw_stats
= ath10k_wmi_tlv_op_pull_fw_stats
,
4521 .pull_roam_ev
= ath10k_wmi_tlv_op_pull_roam_ev
,
4522 .pull_wow_event
= ath10k_wmi_tlv_op_pull_wow_ev
,
4523 .pull_echo_ev
= ath10k_wmi_tlv_op_pull_echo_ev
,
4524 .get_txbf_conf_scheme
= ath10k_wmi_tlv_txbf_conf_scheme
,
4526 .gen_pdev_suspend
= ath10k_wmi_tlv_op_gen_pdev_suspend
,
4527 .gen_pdev_resume
= ath10k_wmi_tlv_op_gen_pdev_resume
,
4528 .gen_pdev_set_rd
= ath10k_wmi_tlv_op_gen_pdev_set_rd
,
4529 .gen_pdev_set_param
= ath10k_wmi_tlv_op_gen_pdev_set_param
,
4530 .gen_init
= ath10k_wmi_tlv_op_gen_init
,
4531 .gen_start_scan
= ath10k_wmi_tlv_op_gen_start_scan
,
4532 .gen_stop_scan
= ath10k_wmi_tlv_op_gen_stop_scan
,
4533 .gen_vdev_create
= ath10k_wmi_tlv_op_gen_vdev_create
,
4534 .gen_vdev_delete
= ath10k_wmi_tlv_op_gen_vdev_delete
,
4535 .gen_vdev_start
= ath10k_wmi_tlv_op_gen_vdev_start
,
4536 .gen_vdev_stop
= ath10k_wmi_tlv_op_gen_vdev_stop
,
4537 .gen_vdev_up
= ath10k_wmi_tlv_op_gen_vdev_up
,
4538 .gen_vdev_down
= ath10k_wmi_tlv_op_gen_vdev_down
,
4539 .gen_vdev_set_param
= ath10k_wmi_tlv_op_gen_vdev_set_param
,
4540 .gen_vdev_install_key
= ath10k_wmi_tlv_op_gen_vdev_install_key
,
4541 .gen_vdev_wmm_conf
= ath10k_wmi_tlv_op_gen_vdev_wmm_conf
,
4542 .gen_peer_create
= ath10k_wmi_tlv_op_gen_peer_create
,
4543 .gen_peer_delete
= ath10k_wmi_tlv_op_gen_peer_delete
,
4544 .gen_peer_flush
= ath10k_wmi_tlv_op_gen_peer_flush
,
4545 .gen_peer_set_param
= ath10k_wmi_tlv_op_gen_peer_set_param
,
4546 .gen_peer_assoc
= ath10k_wmi_tlv_op_gen_peer_assoc
,
4547 .gen_set_psmode
= ath10k_wmi_tlv_op_gen_set_psmode
,
4548 .gen_set_sta_ps
= ath10k_wmi_tlv_op_gen_set_sta_ps
,
4549 .gen_set_ap_ps
= ath10k_wmi_tlv_op_gen_set_ap_ps
,
4550 .gen_scan_chan_list
= ath10k_wmi_tlv_op_gen_scan_chan_list
,
4551 .gen_scan_prob_req_oui
= ath10k_wmi_tlv_op_gen_scan_prob_req_oui
,
4552 .gen_beacon_dma
= ath10k_wmi_tlv_op_gen_beacon_dma
,
4553 .gen_pdev_set_wmm
= ath10k_wmi_tlv_op_gen_pdev_set_wmm
,
4554 .gen_request_stats
= ath10k_wmi_tlv_op_gen_request_stats
,
4555 .gen_request_peer_stats_info
= ath10k_wmi_tlv_op_gen_request_peer_stats_info
,
4556 .gen_force_fw_hang
= ath10k_wmi_tlv_op_gen_force_fw_hang
,
4557 /* .gen_mgmt_tx = not implemented; HTT is used */
4558 .gen_mgmt_tx_send
= ath10k_wmi_tlv_op_gen_mgmt_tx_send
,
4559 .cleanup_mgmt_tx_send
= ath10k_wmi_tlv_op_cleanup_mgmt_tx_send
,
4560 .gen_dbglog_cfg
= ath10k_wmi_tlv_op_gen_dbglog_cfg
,
4561 .gen_pktlog_enable
= ath10k_wmi_tlv_op_gen_pktlog_enable
,
4562 .gen_pktlog_disable
= ath10k_wmi_tlv_op_gen_pktlog_disable
,
4563 .gen_pdev_set_quiet_mode
= ath10k_wmi_tlv_op_gen_pdev_set_quiet_mode
,
4564 .gen_pdev_get_temperature
= ath10k_wmi_tlv_op_gen_pdev_get_temperature
,
4565 /* .gen_addba_clear_resp not implemented */
4566 /* .gen_addba_send not implemented */
4567 /* .gen_addba_set_resp not implemented */
4568 /* .gen_delba_send not implemented */
4569 .gen_bcn_tmpl
= ath10k_wmi_tlv_op_gen_bcn_tmpl
,
4570 .gen_prb_tmpl
= ath10k_wmi_tlv_op_gen_prb_tmpl
,
4571 .gen_p2p_go_bcn_ie
= ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie
,
4572 .gen_vdev_sta_uapsd
= ath10k_wmi_tlv_op_gen_vdev_sta_uapsd
,
4573 .gen_sta_keepalive
= ath10k_wmi_tlv_op_gen_sta_keepalive
,
4574 .gen_wow_enable
= ath10k_wmi_tlv_op_gen_wow_enable
,
4575 .gen_wow_add_wakeup_event
= ath10k_wmi_tlv_op_gen_wow_add_wakeup_event
,
4576 .gen_wow_host_wakeup_ind
= ath10k_wmi_tlv_gen_wow_host_wakeup_ind
,
4577 .gen_wow_add_pattern
= ath10k_wmi_tlv_op_gen_wow_add_pattern
,
4578 .gen_wow_del_pattern
= ath10k_wmi_tlv_op_gen_wow_del_pattern
,
4579 .gen_wow_config_pno
= ath10k_wmi_tlv_op_gen_config_pno
,
4580 .gen_update_fw_tdls_state
= ath10k_wmi_tlv_op_gen_update_fw_tdls_state
,
4581 .gen_tdls_peer_update
= ath10k_wmi_tlv_op_gen_tdls_peer_update
,
4582 .gen_adaptive_qcs
= ath10k_wmi_tlv_op_gen_adaptive_qcs
,
4583 .fw_stats_fill
= ath10k_wmi_main_op_fw_stats_fill
,
4584 .get_vdev_subtype
= ath10k_wmi_tlv_op_get_vdev_subtype
,
4585 .gen_echo
= ath10k_wmi_tlv_op_gen_echo
,
4586 .gen_vdev_spectral_conf
= ath10k_wmi_tlv_op_gen_vdev_spectral_conf
,
4587 .gen_vdev_spectral_enable
= ath10k_wmi_tlv_op_gen_vdev_spectral_enable
,
4590 static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map
= {
4591 .auth
= WMI_TLV_PEER_AUTH
,
4592 .qos
= WMI_TLV_PEER_QOS
,
4593 .need_ptk_4_way
= WMI_TLV_PEER_NEED_PTK_4_WAY
,
4594 .need_gtk_2_way
= WMI_TLV_PEER_NEED_GTK_2_WAY
,
4595 .apsd
= WMI_TLV_PEER_APSD
,
4596 .ht
= WMI_TLV_PEER_HT
,
4597 .bw40
= WMI_TLV_PEER_40MHZ
,
4598 .stbc
= WMI_TLV_PEER_STBC
,
4599 .ldbc
= WMI_TLV_PEER_LDPC
,
4600 .dyn_mimops
= WMI_TLV_PEER_DYN_MIMOPS
,
4601 .static_mimops
= WMI_TLV_PEER_STATIC_MIMOPS
,
4602 .spatial_mux
= WMI_TLV_PEER_SPATIAL_MUX
,
4603 .vht
= WMI_TLV_PEER_VHT
,
4604 .bw80
= WMI_TLV_PEER_80MHZ
,
4605 .pmf
= WMI_TLV_PEER_PMF
,
4606 .bw160
= WMI_TLV_PEER_160MHZ
,
4613 void ath10k_wmi_tlv_attach(struct ath10k
*ar
)
4615 ar
->wmi
.cmd
= &wmi_tlv_cmd_map
;
4616 ar
->wmi
.vdev_param
= &wmi_tlv_vdev_param_map
;
4617 ar
->wmi
.pdev_param
= &wmi_tlv_pdev_param_map
;
4618 ar
->wmi
.peer_param
= &wmi_tlv_peer_param_map
;
4619 ar
->wmi
.ops
= &wmi_tlv_ops
;
4620 ar
->wmi
.peer_flags
= &wmi_tlv_peer_flags_map
;