Lines Matching +full:out +full:- +full:of +full:- +full:band

1 // SPDX-License-Identifier: GPL-2.0+
2 /* Copyright (c) 2015-2016 Quantenna Communications. All rights reserved. */
25 if (unlikely(le16_to_cpu(resp->cmd_id) != cmd_id)) { in qtnf_cmd_check_reply_header()
27 mac_id, vif_id, cmd_id, le16_to_cpu(resp->cmd_id)); in qtnf_cmd_check_reply_header()
28 return -EINVAL; in qtnf_cmd_check_reply_header()
31 if (unlikely(resp->macid != mac_id)) { in qtnf_cmd_check_reply_header()
33 mac_id, vif_id, cmd_id, resp->macid); in qtnf_cmd_check_reply_header()
34 return -EINVAL; in qtnf_cmd_check_reply_header()
37 if (unlikely(resp->vifid != vif_id)) { in qtnf_cmd_check_reply_header()
39 mac_id, vif_id, cmd_id, resp->vifid); in qtnf_cmd_check_reply_header()
40 return -EINVAL; in qtnf_cmd_check_reply_header()
43 if (unlikely(le16_to_cpu(resp->mhdr.len) < resp_size)) { in qtnf_cmd_check_reply_header()
46 le16_to_cpu(resp->mhdr.len), resp_size); in qtnf_cmd_check_reply_header()
47 return -ENOSPC; in qtnf_cmd_check_reply_header()
59 return -EINVAL; in qtnf_cmd_resp_result_decode()
61 return -ENOTSUPP; in qtnf_cmd_resp_result_decode()
63 return -ENOENT; in qtnf_cmd_resp_result_decode()
65 return -EALREADY; in qtnf_cmd_resp_result_decode()
67 return -EADDRINUSE; in qtnf_cmd_resp_result_decode()
69 return -EADDRNOTAVAIL; in qtnf_cmd_resp_result_decode()
71 return -EBUSY; in qtnf_cmd_resp_result_decode()
73 return -EFAULT; in qtnf_cmd_resp_result_decode()
91 cmd = (struct qlink_cmd *)cmd_skb->data; in qtnf_cmd_send_with_reply()
92 cmd_id = le16_to_cpu(cmd->cmd_id); in qtnf_cmd_send_with_reply()
93 mac_id = cmd->macid; in qtnf_cmd_send_with_reply()
94 vif_id = cmd->vifid; in qtnf_cmd_send_with_reply()
95 cmd->mhdr.len = cpu_to_le16(cmd_skb->len); in qtnf_cmd_send_with_reply()
101 mac_id, vif_id, cmd_id, bus->fw_state); in qtnf_cmd_send_with_reply()
103 return -ENODEV; in qtnf_cmd_send_with_reply()
108 goto out; in qtnf_cmd_send_with_reply()
110 if (WARN_ON(!resp_skb || !resp_skb->data)) { in qtnf_cmd_send_with_reply()
111 ret = -EFAULT; in qtnf_cmd_send_with_reply()
112 goto out; in qtnf_cmd_send_with_reply()
115 resp = (struct qlink_resp *)resp_skb->data; in qtnf_cmd_send_with_reply()
119 goto out; in qtnf_cmd_send_with_reply()
121 /* Return length of variable part of response */ in qtnf_cmd_send_with_reply()
123 *var_resp_size = le16_to_cpu(resp->mhdr.len) - const_resp_size; in qtnf_cmd_send_with_reply()
125 out: in qtnf_cmd_send_with_reply()
132 return qtnf_cmd_resp_result_decode(le16_to_cpu(resp->result)); in qtnf_cmd_send_with_reply()
161 cmd = (struct qlink_cmd *)cmd_skb->data; in qtnf_cmd_alloc_new_cmdskb()
162 cmd->mhdr.len = cpu_to_le16(cmd_skb->len); in qtnf_cmd_alloc_new_cmdskb()
163 cmd->mhdr.type = cpu_to_le16(QLINK_MSG_TYPE_CMD); in qtnf_cmd_alloc_new_cmdskb()
164 cmd->cmd_id = cpu_to_le16(cmd_no); in qtnf_cmd_alloc_new_cmdskb()
165 cmd->macid = macid; in qtnf_cmd_alloc_new_cmdskb()
166 cmd->vifid = vifid; in qtnf_cmd_alloc_new_cmdskb()
177 tlv->hdr.type = cpu_to_le16(QTN_TLV_ID_IE_SET); in qtnf_cmd_tlv_ie_set_add()
178 tlv->hdr.len = cpu_to_le16(len + sizeof(*tlv) - sizeof(tlv->hdr)); in qtnf_cmd_tlv_ie_set_add()
179 tlv->type = frame_type; in qtnf_cmd_tlv_ie_set_add()
180 tlv->flags = 0; in qtnf_cmd_tlv_ie_set_add()
183 memcpy(tlv->ie_data, buf, len); in qtnf_cmd_tlv_ie_set_add()
191 len += s->ssid_len; in qtnf_cmd_start_ap_can_fit()
192 len += s->beacon.head_len; in qtnf_cmd_start_ap_can_fit()
193 len += s->beacon.tail_len; in qtnf_cmd_start_ap_can_fit()
194 len += s->beacon.beacon_ies_len; in qtnf_cmd_start_ap_can_fit()
195 len += s->beacon.proberesp_ies_len; in qtnf_cmd_start_ap_can_fit()
196 len += s->beacon.assocresp_ies_len; in qtnf_cmd_start_ap_can_fit()
197 len += s->beacon.probe_resp_len; in qtnf_cmd_start_ap_can_fit()
199 if (cfg80211_chandef_valid(&s->chandef)) in qtnf_cmd_start_ap_can_fit()
202 if (s->acl) in qtnf_cmd_start_ap_can_fit()
204 struct_size(s->acl, mac_addrs, s->acl->n_acl_entries); in qtnf_cmd_start_ap_can_fit()
208 vif->mac->macid, vif->vifid, len); in qtnf_cmd_start_ap_can_fit()
225 return -E2BIG; in qtnf_cmd_send_start_ap()
227 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_start_ap()
231 return -ENOMEM; in qtnf_cmd_send_start_ap()
233 cmd = (struct qlink_cmd_start_ap *)cmd_skb->data; in qtnf_cmd_send_start_ap()
234 cmd->dtim_period = s->dtim_period; in qtnf_cmd_send_start_ap()
235 cmd->beacon_interval = cpu_to_le16(s->beacon_interval); in qtnf_cmd_send_start_ap()
236 cmd->hidden_ssid = qlink_hidden_ssid_nl2q(s->hidden_ssid); in qtnf_cmd_send_start_ap()
237 cmd->inactivity_timeout = cpu_to_le16(s->inactivity_timeout); in qtnf_cmd_send_start_ap()
238 cmd->smps_mode = s->smps_mode; in qtnf_cmd_send_start_ap()
239 cmd->p2p_ctwindow = s->p2p_ctwindow; in qtnf_cmd_send_start_ap()
240 cmd->p2p_opp_ps = s->p2p_opp_ps; in qtnf_cmd_send_start_ap()
241 cmd->pbss = s->pbss; in qtnf_cmd_send_start_ap()
242 cmd->ht_required = s->ht_required; in qtnf_cmd_send_start_ap()
243 cmd->vht_required = s->vht_required; in qtnf_cmd_send_start_ap()
245 aen = &cmd->aen; in qtnf_cmd_send_start_ap()
246 aen->auth_type = s->auth_type; in qtnf_cmd_send_start_ap()
247 aen->privacy = !!s->privacy; in qtnf_cmd_send_start_ap()
248 aen->wpa_versions = cpu_to_le32(s->crypto.wpa_versions); in qtnf_cmd_send_start_ap()
249 aen->cipher_group = cpu_to_le32(s->crypto.cipher_group); in qtnf_cmd_send_start_ap()
250 aen->n_ciphers_pairwise = cpu_to_le32(s->crypto.n_ciphers_pairwise); in qtnf_cmd_send_start_ap()
252 aen->ciphers_pairwise[i] = in qtnf_cmd_send_start_ap()
253 cpu_to_le32(s->crypto.ciphers_pairwise[i]); in qtnf_cmd_send_start_ap()
254 aen->n_akm_suites = cpu_to_le32(s->crypto.n_akm_suites); in qtnf_cmd_send_start_ap()
256 aen->akm_suites[i] = cpu_to_le32(s->crypto.akm_suites[i]); in qtnf_cmd_send_start_ap()
257 aen->control_port = s->crypto.control_port; in qtnf_cmd_send_start_ap()
258 aen->control_port_no_encrypt = s->crypto.control_port_no_encrypt; in qtnf_cmd_send_start_ap()
259 aen->control_port_ethertype = in qtnf_cmd_send_start_ap()
260 cpu_to_le16(be16_to_cpu(s->crypto.control_port_ethertype)); in qtnf_cmd_send_start_ap()
262 if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) in qtnf_cmd_send_start_ap()
263 qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, in qtnf_cmd_send_start_ap()
264 s->ssid_len); in qtnf_cmd_send_start_ap()
266 if (cfg80211_chandef_valid(&s->chandef)) { in qtnf_cmd_send_start_ap()
271 chtlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANDEF); in qtnf_cmd_send_start_ap()
272 chtlv->hdr.len = cpu_to_le16(sizeof(*chtlv) - in qtnf_cmd_send_start_ap()
273 sizeof(chtlv->hdr)); in qtnf_cmd_send_start_ap()
274 qlink_chandef_cfg2q(&s->chandef, &chtlv->chdef); in qtnf_cmd_send_start_ap()
278 s->beacon.head, s->beacon.head_len); in qtnf_cmd_send_start_ap()
280 s->beacon.tail, s->beacon.tail_len); in qtnf_cmd_send_start_ap()
282 s->beacon.beacon_ies, s->beacon.beacon_ies_len); in qtnf_cmd_send_start_ap()
284 s->beacon.probe_resp, s->beacon.probe_resp_len); in qtnf_cmd_send_start_ap()
286 s->beacon.proberesp_ies, in qtnf_cmd_send_start_ap()
287 s->beacon.proberesp_ies_len); in qtnf_cmd_send_start_ap()
289 s->beacon.assocresp_ies, in qtnf_cmd_send_start_ap()
290 s->beacon.assocresp_ies_len); in qtnf_cmd_send_start_ap()
292 if (s->ht_cap) { in qtnf_cmd_send_start_ap()
294 skb_put(cmd_skb, sizeof(*tlv) + sizeof(*s->ht_cap)); in qtnf_cmd_send_start_ap()
296 tlv->type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); in qtnf_cmd_send_start_ap()
297 tlv->len = cpu_to_le16(sizeof(*s->ht_cap)); in qtnf_cmd_send_start_ap()
298 memcpy(tlv->val, s->ht_cap, sizeof(*s->ht_cap)); in qtnf_cmd_send_start_ap()
301 if (s->vht_cap) { in qtnf_cmd_send_start_ap()
303 skb_put(cmd_skb, sizeof(*tlv) + sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
305 tlv->type = cpu_to_le16(WLAN_EID_VHT_CAPABILITY); in qtnf_cmd_send_start_ap()
306 tlv->len = cpu_to_le16(sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
307 memcpy(tlv->val, s->vht_cap, sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
310 if (s->acl) { in qtnf_cmd_send_start_ap()
311 size_t acl_size = struct_size(s->acl, mac_addrs, in qtnf_cmd_send_start_ap()
312 s->acl->n_acl_entries); in qtnf_cmd_send_start_ap()
316 tlv->type = cpu_to_le16(QTN_TLV_ID_ACL_DATA); in qtnf_cmd_send_start_ap()
317 tlv->len = cpu_to_le16(acl_size); in qtnf_cmd_send_start_ap()
318 qlink_acl_data_cfg2q(s->acl, (struct qlink_acl_data *)tlv->val); in qtnf_cmd_send_start_ap()
321 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_start_ap()
322 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_start_ap()
324 goto out; in qtnf_cmd_send_start_ap()
326 netif_carrier_on(vif->netdev); in qtnf_cmd_send_start_ap()
328 out: in qtnf_cmd_send_start_ap()
329 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_start_ap()
339 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_stop_ap()
343 return -ENOMEM; in qtnf_cmd_send_stop_ap()
345 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_stop_ap()
346 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_stop_ap()
348 goto out; in qtnf_cmd_send_stop_ap()
350 out: in qtnf_cmd_send_stop_ap()
351 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_stop_ap()
362 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_register_mgmt()
366 return -ENOMEM; in qtnf_cmd_send_register_mgmt()
368 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_register_mgmt()
370 cmd = (struct qlink_cmd_mgmt_frame_register *)cmd_skb->data; in qtnf_cmd_send_register_mgmt()
371 cmd->frame_type = cpu_to_le16(frame_type); in qtnf_cmd_send_register_mgmt()
372 cmd->do_register = reg; in qtnf_cmd_send_register_mgmt()
374 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_register_mgmt()
376 goto out; in qtnf_cmd_send_register_mgmt()
378 out: in qtnf_cmd_send_register_mgmt()
379 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_register_mgmt()
392 pr_warn("VIF%u.%u: frame is too big: %zu\n", vif->mac->macid, in qtnf_cmd_send_frame()
393 vif->vifid, len); in qtnf_cmd_send_frame()
394 return -E2BIG; in qtnf_cmd_send_frame()
397 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_frame()
401 return -ENOMEM; in qtnf_cmd_send_frame()
403 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_frame()
405 cmd = (struct qlink_cmd_frame_tx *)cmd_skb->data; in qtnf_cmd_send_frame()
406 cmd->cookie = cpu_to_le32(cookie); in qtnf_cmd_send_frame()
407 cmd->freq = cpu_to_le16(freq); in qtnf_cmd_send_frame()
408 cmd->flags = cpu_to_le16(flags); in qtnf_cmd_send_frame()
413 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_frame()
415 goto out; in qtnf_cmd_send_frame()
417 out: in qtnf_cmd_send_frame()
418 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_frame()
430 pr_warn("VIF%u.%u: %u frame is too big: %zu\n", vif->mac->macid, in qtnf_cmd_send_mgmt_set_appie()
431 vif->vifid, frame_type, len); in qtnf_cmd_send_mgmt_set_appie()
432 return -E2BIG; in qtnf_cmd_send_mgmt_set_appie()
435 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_mgmt_set_appie()
439 return -ENOMEM; in qtnf_cmd_send_mgmt_set_appie()
443 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_mgmt_set_appie()
444 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_mgmt_set_appie()
446 goto out; in qtnf_cmd_send_mgmt_set_appie()
448 out: in qtnf_cmd_send_mgmt_set_appie()
449 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_mgmt_set_appie()
458 rate_dst->legacy = get_unaligned_le16(&rate_src->rate) * 10; in qtnf_sta_info_parse_rate()
460 rate_dst->mcs = rate_src->mcs; in qtnf_sta_info_parse_rate()
461 rate_dst->nss = rate_src->nss; in qtnf_sta_info_parse_rate()
462 rate_dst->flags = 0; in qtnf_sta_info_parse_rate()
464 switch (rate_src->bw) { in qtnf_sta_info_parse_rate()
466 rate_dst->bw = RATE_INFO_BW_5; in qtnf_sta_info_parse_rate()
469 rate_dst->bw = RATE_INFO_BW_10; in qtnf_sta_info_parse_rate()
473 rate_dst->bw = RATE_INFO_BW_20; in qtnf_sta_info_parse_rate()
476 rate_dst->bw = RATE_INFO_BW_40; in qtnf_sta_info_parse_rate()
479 rate_dst->bw = RATE_INFO_BW_80; in qtnf_sta_info_parse_rate()
482 rate_dst->bw = RATE_INFO_BW_160; in qtnf_sta_info_parse_rate()
485 rate_dst->bw = 0; in qtnf_sta_info_parse_rate()
489 if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_HT_MCS) in qtnf_sta_info_parse_rate()
490 rate_dst->flags |= RATE_INFO_FLAGS_MCS; in qtnf_sta_info_parse_rate()
491 else if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_VHT_MCS) in qtnf_sta_info_parse_rate()
492 rate_dst->flags |= RATE_INFO_FLAGS_VHT_MCS; in qtnf_sta_info_parse_rate()
494 if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_SHORT_GI) in qtnf_sta_info_parse_rate()
495 rate_dst->flags |= RATE_INFO_FLAGS_SHORT_GI; in qtnf_sta_info_parse_rate()
504 dst->mask = 0; in qtnf_sta_info_parse_flags()
505 dst->set = 0; in qtnf_sta_info_parse_flags()
507 mask = le32_to_cpu(src->mask); in qtnf_sta_info_parse_flags()
508 value = le32_to_cpu(src->value); in qtnf_sta_info_parse_flags()
511 dst->mask |= BIT(NL80211_STA_FLAG_AUTHORIZED); in qtnf_sta_info_parse_flags()
513 dst->set |= BIT(NL80211_STA_FLAG_AUTHORIZED); in qtnf_sta_info_parse_flags()
517 dst->mask |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE); in qtnf_sta_info_parse_flags()
519 dst->set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE); in qtnf_sta_info_parse_flags()
523 dst->mask |= BIT(NL80211_STA_FLAG_WME); in qtnf_sta_info_parse_flags()
525 dst->set |= BIT(NL80211_STA_FLAG_WME); in qtnf_sta_info_parse_flags()
529 dst->mask |= BIT(NL80211_STA_FLAG_MFP); in qtnf_sta_info_parse_flags()
531 dst->set |= BIT(NL80211_STA_FLAG_MFP); in qtnf_sta_info_parse_flags()
535 dst->mask |= BIT(NL80211_STA_FLAG_AUTHENTICATED); in qtnf_sta_info_parse_flags()
537 dst->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED); in qtnf_sta_info_parse_flags()
541 dst->mask |= BIT(NL80211_STA_FLAG_TDLS_PEER); in qtnf_sta_info_parse_flags()
543 dst->set |= BIT(NL80211_STA_FLAG_TDLS_PEER); in qtnf_sta_info_parse_flags()
547 dst->mask |= BIT(NL80211_STA_FLAG_ASSOCIATED); in qtnf_sta_info_parse_flags()
549 dst->set |= BIT(NL80211_STA_FLAG_ASSOCIATED); in qtnf_sta_info_parse_flags()
569 tlv_len = le16_to_cpu(tlv->len); in qtnf_cmd_sta_info_parse()
571 switch (le16_to_cpu(tlv->type)) { in qtnf_cmd_sta_info_parse()
574 map = tlv->val; in qtnf_cmd_sta_info_parse()
578 stats = (const struct qlink_sta_stats *)tlv->val; in qtnf_cmd_sta_info_parse()
584 resp_size -= tlv_len + sizeof(*tlv); in qtnf_cmd_sta_info_parse()
585 tlv = (const struct qlink_tlv_hdr *)(tlv->val + tlv_len); in qtnf_cmd_sta_info_parse()
592 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); in qtnf_cmd_sta_info_parse()
593 sinfo->inactive_time = le32_to_cpu(stats->inactive_time); in qtnf_cmd_sta_info_parse()
598 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME); in qtnf_cmd_sta_info_parse()
599 sinfo->connected_time = le32_to_cpu(stats->connected_time); in qtnf_cmd_sta_info_parse()
603 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in qtnf_cmd_sta_info_parse()
604 sinfo->signal = stats->signal - QLINK_RSSI_OFFSET; in qtnf_cmd_sta_info_parse()
608 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in qtnf_cmd_sta_info_parse()
609 sinfo->signal_avg = stats->signal_avg - QLINK_RSSI_OFFSET; in qtnf_cmd_sta_info_parse()
613 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in qtnf_cmd_sta_info_parse()
614 qtnf_sta_info_parse_rate(&sinfo->rxrate, &stats->rxrate); in qtnf_cmd_sta_info_parse()
618 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in qtnf_cmd_sta_info_parse()
619 qtnf_sta_info_parse_rate(&sinfo->txrate, &stats->txrate); in qtnf_cmd_sta_info_parse()
623 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_STA_FLAGS); in qtnf_cmd_sta_info_parse()
624 qtnf_sta_info_parse_flags(&sinfo->sta_flags, &stats->sta_flags); in qtnf_cmd_sta_info_parse()
628 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); in qtnf_cmd_sta_info_parse()
629 sinfo->rx_bytes = le64_to_cpu(stats->rx_bytes); in qtnf_cmd_sta_info_parse()
633 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); in qtnf_cmd_sta_info_parse()
634 sinfo->tx_bytes = le64_to_cpu(stats->tx_bytes); in qtnf_cmd_sta_info_parse()
638 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); in qtnf_cmd_sta_info_parse()
639 sinfo->rx_bytes = le64_to_cpu(stats->rx_bytes); in qtnf_cmd_sta_info_parse()
643 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); in qtnf_cmd_sta_info_parse()
644 sinfo->tx_bytes = le64_to_cpu(stats->tx_bytes); in qtnf_cmd_sta_info_parse()
648 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); in qtnf_cmd_sta_info_parse()
649 sinfo->rx_packets = le32_to_cpu(stats->rx_packets); in qtnf_cmd_sta_info_parse()
653 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); in qtnf_cmd_sta_info_parse()
654 sinfo->tx_packets = le32_to_cpu(stats->tx_packets); in qtnf_cmd_sta_info_parse()
658 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); in qtnf_cmd_sta_info_parse()
659 sinfo->rx_beacon = le64_to_cpu(stats->rx_beacon); in qtnf_cmd_sta_info_parse()
663 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC); in qtnf_cmd_sta_info_parse()
664 sinfo->rx_dropped_misc = le32_to_cpu(stats->rx_dropped_misc); in qtnf_cmd_sta_info_parse()
668 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in qtnf_cmd_sta_info_parse()
669 sinfo->tx_failed = le32_to_cpu(stats->tx_failed); in qtnf_cmd_sta_info_parse()
684 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_sta_info()
688 return -ENOMEM; in qtnf_cmd_get_sta_info()
690 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_get_sta_info()
692 cmd = (struct qlink_cmd_get_sta_info *)cmd_skb->data; in qtnf_cmd_get_sta_info()
693 ether_addr_copy(cmd->sta_addr, sta_mac); in qtnf_cmd_get_sta_info()
695 ret = qtnf_cmd_send_with_reply(vif->mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_sta_info()
698 goto out; in qtnf_cmd_get_sta_info()
700 resp = (const struct qlink_resp_get_sta_info *)resp_skb->data; in qtnf_cmd_get_sta_info()
702 if (!ether_addr_equal(sta_mac, resp->sta_addr)) { in qtnf_cmd_get_sta_info()
704 vif->mac->macid, vif->vifid, resp->sta_addr, sta_mac); in qtnf_cmd_get_sta_info()
705 ret = -EINVAL; in qtnf_cmd_get_sta_info()
706 goto out; in qtnf_cmd_get_sta_info()
710 (const struct qlink_tlv_hdr *)resp->info, in qtnf_cmd_get_sta_info()
713 out: in qtnf_cmd_get_sta_info()
714 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_get_sta_info()
731 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_add_change_intf()
735 return -ENOMEM; in qtnf_cmd_send_add_change_intf()
737 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_add_change_intf()
739 cmd = (struct qlink_cmd_manage_intf *)cmd_skb->data; in qtnf_cmd_send_add_change_intf()
740 cmd->intf_info.use4addr = use4addr; in qtnf_cmd_send_add_change_intf()
744 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_add_change_intf()
747 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_add_change_intf()
750 pr_err("VIF%u.%u: unsupported type %d\n", vif->mac->macid, in qtnf_cmd_send_add_change_intf()
751 vif->vifid, iftype); in qtnf_cmd_send_add_change_intf()
752 ret = -EINVAL; in qtnf_cmd_send_add_change_intf()
753 goto out; in qtnf_cmd_send_add_change_intf()
757 ether_addr_copy(cmd->intf_info.mac_addr, mac_addr); in qtnf_cmd_send_add_change_intf()
759 eth_zero_addr(cmd->intf_info.mac_addr); in qtnf_cmd_send_add_change_intf()
761 ret = qtnf_cmd_send_with_reply(vif->mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_send_add_change_intf()
764 goto out; in qtnf_cmd_send_add_change_intf()
766 resp = (const struct qlink_resp_manage_intf *)resp_skb->data; in qtnf_cmd_send_add_change_intf()
767 ether_addr_copy(vif->mac_addr, resp->intf_info.mac_addr); in qtnf_cmd_send_add_change_intf()
769 out: in qtnf_cmd_send_add_change_intf()
770 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_add_change_intf()
794 if (ret == 0 && vif->wdev.iftype != iftype) { in qtnf_cmd_send_change_intf_type()
795 enum nl80211_band band; in qtnf_cmd_send_change_intf_type() local
796 struct wiphy *wiphy = priv_to_wiphy(vif->mac); in qtnf_cmd_send_change_intf_type()
798 for (band = 0; band < NUM_NL80211_BANDS; ++band) { in qtnf_cmd_send_change_intf_type()
799 if (!wiphy->bands[band]) in qtnf_cmd_send_change_intf_type()
802 qtnf_cmd_band_info_get(vif->mac, wiphy->bands[band]); in qtnf_cmd_send_change_intf_type()
815 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_intf()
819 return -ENOMEM; in qtnf_cmd_send_del_intf()
821 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_intf()
823 cmd = (struct qlink_cmd_manage_intf *)cmd_skb->data; in qtnf_cmd_send_del_intf()
825 switch (vif->wdev.iftype) { in qtnf_cmd_send_del_intf()
827 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_del_intf()
830 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_del_intf()
833 pr_warn("VIF%u.%u: unsupported iftype %d\n", vif->mac->macid, in qtnf_cmd_send_del_intf()
834 vif->vifid, vif->wdev.iftype); in qtnf_cmd_send_del_intf()
835 ret = -EINVAL; in qtnf_cmd_send_del_intf()
836 goto out; in qtnf_cmd_send_del_intf()
839 eth_zero_addr(cmd->intf_info.mac_addr); in qtnf_cmd_send_del_intf()
841 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_intf()
843 goto out; in qtnf_cmd_send_del_intf()
845 out: in qtnf_cmd_send_del_intf()
846 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_intf()
855 struct qtnf_hw_info *hwinfo = &bus->hw_info; in qtnf_cmd_resp_proc_hw_info()
870 hwinfo->num_mac = resp->num_mac; in qtnf_cmd_resp_proc_hw_info()
871 hwinfo->mac_bitmap = resp->mac_bitmap; in qtnf_cmd_resp_proc_hw_info()
872 hwinfo->fw_ver = le32_to_cpu(resp->fw_ver); in qtnf_cmd_resp_proc_hw_info()
873 hwinfo->ql_proto_ver = le16_to_cpu(resp->ql_proto_ver); in qtnf_cmd_resp_proc_hw_info()
874 hwinfo->total_tx_chain = resp->total_tx_chain; in qtnf_cmd_resp_proc_hw_info()
875 hwinfo->total_rx_chain = resp->total_rx_chain; in qtnf_cmd_resp_proc_hw_info()
876 hwinfo->hw_capab = le32_to_cpu(resp->hw_capab); in qtnf_cmd_resp_proc_hw_info()
878 bld_tmstamp = le32_to_cpu(resp->bld_tmstamp); in qtnf_cmd_resp_proc_hw_info()
879 plat_id = le32_to_cpu(resp->plat_id); in qtnf_cmd_resp_proc_hw_info()
880 hw_ver = le32_to_cpu(resp->hw_ver); in qtnf_cmd_resp_proc_hw_info()
882 tlv = (const struct qlink_tlv_hdr *)resp->info; in qtnf_cmd_resp_proc_hw_info()
885 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_proc_hw_info()
886 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_cmd_resp_proc_hw_info()
891 return -EINVAL; in qtnf_cmd_resp_proc_hw_info()
896 bld_name = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
899 bld_rev = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
902 bld_type = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
905 bld_label = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
908 hw_id = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
911 calibration_ver = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
914 uboot_ver = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
917 hwinfo->max_scan_ssids = *tlv->val; in qtnf_cmd_resp_proc_hw_info()
923 info_len -= tlv_value_len + sizeof(*tlv); in qtnf_cmd_resp_proc_hw_info()
924 tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len); in qtnf_cmd_resp_proc_hw_info()
928 hwinfo->fw_ver, hwinfo->mac_bitmap, in qtnf_cmd_resp_proc_hw_info()
929 hwinfo->total_tx_chain, hwinfo->total_rx_chain, in qtnf_cmd_resp_proc_hw_info()
930 hwinfo->hw_capab); in qtnf_cmd_resp_proc_hw_info()
940 "\nU-Boot version: %s" \ in qtnf_cmd_resp_proc_hw_info()
947 strlcpy(hwinfo->fw_version, bld_label, sizeof(hwinfo->fw_version)); in qtnf_cmd_resp_proc_hw_info()
948 hwinfo->hw_version = hw_ver; in qtnf_cmd_resp_proc_hw_info()
957 struct qtnf_mac_info *mac_info = &mac->macinfo; in qtnf_parse_wowlan_info()
965 switch (le16_to_cpu(wowlan->version)) { in qtnf_parse_wowlan_info()
967 data1 = (struct qlink_wowlan_support *)wowlan->data; in qtnf_parse_wowlan_info()
969 supp->flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT; in qtnf_parse_wowlan_info()
970 supp->n_patterns = le32_to_cpu(data1->n_patterns); in qtnf_parse_wowlan_info()
971 supp->pattern_max_len = le32_to_cpu(data1->pattern_max_len); in qtnf_parse_wowlan_info()
972 supp->pattern_min_len = le32_to_cpu(data1->pattern_min_len); in qtnf_parse_wowlan_info()
974 mac_info->wowlan = supp; in qtnf_parse_wowlan_info()
978 mac->macid, le16_to_cpu(wowlan->version)); in qtnf_parse_wowlan_info()
989 const u8 *tlv_buf = resp->var_info; in qtnf_parse_variable_mac_info()
1011 if (WARN_ON(resp->n_reg_rules > NL80211_MAX_SUPP_REG_RULES)) in qtnf_parse_variable_mac_info()
1012 return -E2BIG; in qtnf_parse_variable_mac_info()
1014 mac->rd = kzalloc(struct_size(mac->rd, reg_rules, resp->n_reg_rules), in qtnf_parse_variable_mac_info()
1016 if (!mac->rd) in qtnf_parse_variable_mac_info()
1017 return -ENOMEM; in qtnf_parse_variable_mac_info()
1019 mac->rd->n_reg_rules = resp->n_reg_rules; in qtnf_parse_variable_mac_info()
1020 mac->rd->alpha2[0] = resp->alpha2[0]; in qtnf_parse_variable_mac_info()
1021 mac->rd->alpha2[1] = resp->alpha2[1]; in qtnf_parse_variable_mac_info()
1023 switch (resp->dfs_region) { in qtnf_parse_variable_mac_info()
1025 mac->rd->dfs_region = NL80211_DFS_FCC; in qtnf_parse_variable_mac_info()
1028 mac->rd->dfs_region = NL80211_DFS_ETSI; in qtnf_parse_variable_mac_info()
1031 mac->rd->dfs_region = NL80211_DFS_JP; in qtnf_parse_variable_mac_info()
1035 mac->rd->dfs_region = NL80211_DFS_UNSET; in qtnf_parse_variable_mac_info()
1041 tlv_type = le16_to_cpu(tlv->type); in qtnf_parse_variable_mac_info()
1042 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_parse_variable_mac_info()
1046 mac->macid, tlv_type, tlv_value_len); in qtnf_parse_variable_mac_info()
1047 return -EINVAL; in qtnf_parse_variable_mac_info()
1053 return -EINVAL; in qtnf_parse_variable_mac_info()
1055 comb_num = (void *)tlv->val; in qtnf_parse_variable_mac_info()
1060 mac->macinfo.n_if_comb = in qtnf_parse_variable_mac_info()
1061 le32_to_cpu(comb_num->iface_comb_num); in qtnf_parse_variable_mac_info()
1063 mac->macinfo.if_comb = in qtnf_parse_variable_mac_info()
1064 kcalloc(mac->macinfo.n_if_comb, in qtnf_parse_variable_mac_info()
1065 sizeof(*mac->macinfo.if_comb), in qtnf_parse_variable_mac_info()
1068 if (!mac->macinfo.if_comb) in qtnf_parse_variable_mac_info()
1069 return -ENOMEM; in qtnf_parse_variable_mac_info()
1071 comb = mac->macinfo.if_comb; in qtnf_parse_variable_mac_info()
1074 mac->macid, mac->macinfo.n_if_comb); in qtnf_parse_variable_mac_info()
1080 mac->macid); in qtnf_parse_variable_mac_info()
1081 return -EINVAL; in qtnf_parse_variable_mac_info()
1084 if (n_comb >= mac->macinfo.n_if_comb) { in qtnf_parse_variable_mac_info()
1086 mac->macid); in qtnf_parse_variable_mac_info()
1091 rec = (void *)tlv->val; in qtnf_parse_variable_mac_info()
1092 rec_len = sizeof(*rec) + rec->n_limits * sizeof(*lim); in qtnf_parse_variable_mac_info()
1096 mac->macid, n_comb); in qtnf_parse_variable_mac_info()
1097 return -EINVAL; in qtnf_parse_variable_mac_info()
1100 limits = kcalloc(rec->n_limits, sizeof(*limits), in qtnf_parse_variable_mac_info()
1103 return -ENOMEM; in qtnf_parse_variable_mac_info()
1106 rec->num_different_channels; in qtnf_parse_variable_mac_info()
1108 le16_to_cpu(rec->max_interfaces); in qtnf_parse_variable_mac_info()
1109 comb[n_comb].n_limits = rec->n_limits; in qtnf_parse_variable_mac_info()
1112 for (i = 0; i < rec->n_limits; i++) { in qtnf_parse_variable_mac_info()
1113 lim = &rec->limits[i]; in qtnf_parse_variable_mac_info()
1114 limits[i].max = le16_to_cpu(lim->max_num); in qtnf_parse_variable_mac_info()
1116 qlink_iface_type_to_nl_mask(le16_to_cpu(lim->type)); in qtnf_parse_variable_mac_info()
1118 mac->macid, n_comb, in qtnf_parse_variable_mac_info()
1126 return -EINVAL; in qtnf_parse_variable_mac_info()
1127 ext_capa = (u8 *)tlv->val; in qtnf_parse_variable_mac_info()
1132 return -EINVAL; in qtnf_parse_variable_mac_info()
1133 ext_capa_mask = (u8 *)tlv->val; in qtnf_parse_variable_mac_info()
1138 return -EINVAL; in qtnf_parse_variable_mac_info()
1140 wowlan = (void *)tlv->val; in qtnf_parse_variable_mac_info()
1141 if (!le16_to_cpu(wowlan->len)) { in qtnf_parse_variable_mac_info()
1143 mac->macid); in qtnf_parse_variable_mac_info()
1147 rec_len = sizeof(*wowlan) + le16_to_cpu(wowlan->len); in qtnf_parse_variable_mac_info()
1150 mac->macid); in qtnf_parse_variable_mac_info()
1151 return -EINVAL; in qtnf_parse_variable_mac_info()
1154 kfree(mac->macinfo.wowlan); in qtnf_parse_variable_mac_info()
1155 mac->macinfo.wowlan = NULL; in qtnf_parse_variable_mac_info()
1159 if (rule_idx >= resp->n_reg_rules) { in qtnf_parse_variable_mac_info()
1160 pr_warn("unexpected number of rules: %u\n", in qtnf_parse_variable_mac_info()
1161 resp->n_reg_rules); in qtnf_parse_variable_mac_info()
1162 return -EINVAL; in qtnf_parse_variable_mac_info()
1165 if (tlv_value_len != sizeof(*tlv_rule) - sizeof(*tlv)) { in qtnf_parse_variable_mac_info()
1168 return -EINVAL; in qtnf_parse_variable_mac_info()
1172 rule = &mac->rd->reg_rules[rule_idx++]; in qtnf_parse_variable_mac_info()
1177 mac->macid, tlv_type); in qtnf_parse_variable_mac_info()
1181 tlv_buf_size -= tlv_full_len; in qtnf_parse_variable_mac_info()
1182 tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len); in qtnf_parse_variable_mac_info()
1187 mac->macid, tlv_buf_size); in qtnf_parse_variable_mac_info()
1188 return -EINVAL; in qtnf_parse_variable_mac_info()
1191 if (mac->macinfo.n_if_comb != n_comb) { in qtnf_parse_variable_mac_info()
1193 mac->macid, mac->macinfo.n_if_comb, n_comb); in qtnf_parse_variable_mac_info()
1194 return -EINVAL; in qtnf_parse_variable_mac_info()
1199 mac->macid, ext_capa_len, ext_capa_mask_len); in qtnf_parse_variable_mac_info()
1200 return -EINVAL; in qtnf_parse_variable_mac_info()
1203 if (rule_idx != resp->n_reg_rules) { in qtnf_parse_variable_mac_info()
1204 pr_warn("unexpected number of rules: expected %u got %u\n", in qtnf_parse_variable_mac_info()
1205 resp->n_reg_rules, rule_idx); in qtnf_parse_variable_mac_info()
1206 return -EINVAL; in qtnf_parse_variable_mac_info()
1212 return -ENOMEM; in qtnf_parse_variable_mac_info()
1218 return -ENOMEM; in qtnf_parse_variable_mac_info()
1226 mac->macinfo.extended_capabilities = ext_capa; in qtnf_parse_variable_mac_info()
1227 mac->macinfo.extended_capabilities_mask = ext_capa_mask; in qtnf_parse_variable_mac_info()
1228 mac->macinfo.extended_capabilities_len = ext_capa_len; in qtnf_parse_variable_mac_info()
1240 mac_info = &mac->macinfo; in qtnf_cmd_resp_proc_mac_info()
1242 mac_info->bands_cap = resp_info->bands_cap; in qtnf_cmd_resp_proc_mac_info()
1243 memcpy(&mac_info->dev_mac, &resp_info->dev_mac, in qtnf_cmd_resp_proc_mac_info()
1244 sizeof(mac_info->dev_mac)); in qtnf_cmd_resp_proc_mac_info()
1246 ether_addr_copy(mac->macaddr, mac_info->dev_mac); in qtnf_cmd_resp_proc_mac_info()
1250 ether_addr_copy(vif->mac_addr, mac->macaddr); in qtnf_cmd_resp_proc_mac_info()
1254 mac_info->num_tx_chain = resp_info->num_tx_chain; in qtnf_cmd_resp_proc_mac_info()
1255 mac_info->num_rx_chain = resp_info->num_rx_chain; in qtnf_cmd_resp_proc_mac_info()
1257 mac_info->max_ap_assoc_sta = le16_to_cpu(resp_info->max_ap_assoc_sta); in qtnf_cmd_resp_proc_mac_info()
1258 mac_info->radar_detect_widths = in qtnf_cmd_resp_proc_mac_info()
1260 resp_info->radar_detect_widths)); in qtnf_cmd_resp_proc_mac_info()
1261 mac_info->max_acl_mac_addrs = le32_to_cpu(resp_info->max_acl_mac_addrs); in qtnf_cmd_resp_proc_mac_info()
1263 memcpy(&mac_info->ht_cap_mod_mask, &resp_info->ht_cap_mod_mask, in qtnf_cmd_resp_proc_mac_info()
1264 sizeof(mac_info->ht_cap_mod_mask)); in qtnf_cmd_resp_proc_mac_info()
1265 memcpy(&mac_info->vht_cap_mod_mask, &resp_info->vht_cap_mod_mask, in qtnf_cmd_resp_proc_mac_info()
1266 sizeof(mac_info->vht_cap_mod_mask)); in qtnf_cmd_resp_proc_mac_info()
1275 bcap->ht_supported = true; in qtnf_cmd_resp_band_fill_htcap()
1276 bcap->cap = le16_to_cpu(ht_cap->cap_info); in qtnf_cmd_resp_band_fill_htcap()
1277 bcap->ampdu_factor = in qtnf_cmd_resp_band_fill_htcap()
1278 ht_cap->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_FACTOR; in qtnf_cmd_resp_band_fill_htcap()
1279 bcap->ampdu_density = in qtnf_cmd_resp_band_fill_htcap()
1280 (ht_cap->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_DENSITY) >> in qtnf_cmd_resp_band_fill_htcap()
1282 memcpy(&bcap->mcs, &ht_cap->mcs, sizeof(bcap->mcs)); in qtnf_cmd_resp_band_fill_htcap()
1291 bcap->vht_supported = true; in qtnf_cmd_resp_band_fill_vhtcap()
1292 bcap->cap = le32_to_cpu(vht_cap->vht_cap_info); in qtnf_cmd_resp_band_fill_vhtcap()
1293 memcpy(&bcap->vht_mcs, &vht_cap->supp_mcs, sizeof(bcap->vht_mcs)); in qtnf_cmd_resp_band_fill_vhtcap()
1297 qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, in qtnf_cmd_resp_fill_band_info() argument
1310 memset(&band->ht_cap, 0, sizeof(band->ht_cap)); in qtnf_cmd_resp_fill_band_info()
1311 memset(&band->vht_cap, 0, sizeof(band->vht_cap)); in qtnf_cmd_resp_fill_band_info()
1313 if (band->channels) { in qtnf_cmd_resp_fill_band_info()
1314 if (band->n_channels == resp->num_chans) { in qtnf_cmd_resp_fill_band_info()
1315 memset(band->channels, 0, in qtnf_cmd_resp_fill_band_info()
1316 sizeof(*band->channels) * band->n_channels); in qtnf_cmd_resp_fill_band_info()
1318 kfree(band->channels); in qtnf_cmd_resp_fill_band_info()
1319 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1320 band->channels = NULL; in qtnf_cmd_resp_fill_band_info()
1324 band->n_channels = resp->num_chans; in qtnf_cmd_resp_fill_band_info()
1325 if (band->n_channels == 0) in qtnf_cmd_resp_fill_band_info()
1328 if (!band->channels) in qtnf_cmd_resp_fill_band_info()
1329 band->channels = kcalloc(band->n_channels, sizeof(*chan), in qtnf_cmd_resp_fill_band_info()
1331 if (!band->channels) { in qtnf_cmd_resp_fill_band_info()
1332 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1333 return -ENOMEM; in qtnf_cmd_resp_fill_band_info()
1336 tlv = (struct qlink_tlv_hdr *)resp->info; in qtnf_cmd_resp_fill_band_info()
1339 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_fill_band_info()
1340 tlv_dlen = le16_to_cpu(tlv->len); in qtnf_cmd_resp_fill_band_info()
1357 if (chidx == band->n_channels) { in qtnf_cmd_resp_fill_band_info()
1362 qchan = (const struct qlink_channel *)tlv->val; in qtnf_cmd_resp_fill_band_info()
1363 chan = &band->channels[chidx++]; in qtnf_cmd_resp_fill_band_info()
1364 qflags = le32_to_cpu(qchan->flags); in qtnf_cmd_resp_fill_band_info()
1366 chan->hw_value = le16_to_cpu(qchan->hw_value); in qtnf_cmd_resp_fill_band_info()
1367 chan->band = band->band; in qtnf_cmd_resp_fill_band_info()
1368 chan->center_freq = le16_to_cpu(qchan->center_freq); in qtnf_cmd_resp_fill_band_info()
1369 chan->max_antenna_gain = (int)qchan->max_antenna_gain; in qtnf_cmd_resp_fill_band_info()
1370 chan->max_power = (int)qchan->max_power; in qtnf_cmd_resp_fill_band_info()
1371 chan->max_reg_power = (int)qchan->max_reg_power; in qtnf_cmd_resp_fill_band_info()
1372 chan->beacon_found = qchan->beacon_found; in qtnf_cmd_resp_fill_band_info()
1373 chan->dfs_cac_ms = le32_to_cpu(qchan->dfs_cac_ms); in qtnf_cmd_resp_fill_band_info()
1374 chan->flags = 0; in qtnf_cmd_resp_fill_band_info()
1377 chan->flags |= IEEE80211_CHAN_DISABLED; in qtnf_cmd_resp_fill_band_info()
1380 chan->flags |= IEEE80211_CHAN_NO_IR; in qtnf_cmd_resp_fill_band_info()
1383 chan->flags |= IEEE80211_CHAN_NO_HT40PLUS; in qtnf_cmd_resp_fill_band_info()
1386 chan->flags |= IEEE80211_CHAN_NO_HT40MINUS; in qtnf_cmd_resp_fill_band_info()
1389 chan->flags |= IEEE80211_CHAN_NO_OFDM; in qtnf_cmd_resp_fill_band_info()
1392 chan->flags |= IEEE80211_CHAN_NO_80MHZ; in qtnf_cmd_resp_fill_band_info()
1395 chan->flags |= IEEE80211_CHAN_NO_160MHZ; in qtnf_cmd_resp_fill_band_info()
1398 chan->flags |= IEEE80211_CHAN_INDOOR_ONLY; in qtnf_cmd_resp_fill_band_info()
1401 chan->flags |= IEEE80211_CHAN_IR_CONCURRENT; in qtnf_cmd_resp_fill_band_info()
1404 chan->flags |= IEEE80211_CHAN_NO_20MHZ; in qtnf_cmd_resp_fill_band_info()
1407 chan->flags |= IEEE80211_CHAN_NO_10MHZ; in qtnf_cmd_resp_fill_band_info()
1410 chan->flags |= IEEE80211_CHAN_RADAR; in qtnf_cmd_resp_fill_band_info()
1411 chan->dfs_state_entered = jiffies; in qtnf_cmd_resp_fill_band_info()
1413 if (qchan->dfs_state == QLINK_DFS_USABLE) in qtnf_cmd_resp_fill_band_info()
1414 chan->dfs_state = NL80211_DFS_USABLE; in qtnf_cmd_resp_fill_band_info()
1415 else if (qchan->dfs_state == in qtnf_cmd_resp_fill_band_info()
1417 chan->dfs_state = NL80211_DFS_AVAILABLE; in qtnf_cmd_resp_fill_band_info()
1419 chan->dfs_state = in qtnf_cmd_resp_fill_band_info()
1424 chan->hw_value, chan->flags, chan->max_power, in qtnf_cmd_resp_fill_band_info()
1425 chan->max_reg_power); in qtnf_cmd_resp_fill_band_info()
1434 qtnf_cmd_resp_band_fill_htcap(tlv->val, &band->ht_cap); in qtnf_cmd_resp_fill_band_info()
1443 qtnf_cmd_resp_band_fill_vhtcap(tlv->val, in qtnf_cmd_resp_fill_band_info()
1444 &band->vht_cap); in qtnf_cmd_resp_fill_band_info()
1451 payload_len -= tlv_len; in qtnf_cmd_resp_fill_band_info()
1452 tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_dlen); in qtnf_cmd_resp_fill_band_info()
1460 if (band->n_channels != chidx) { in qtnf_cmd_resp_fill_band_info()
1462 band->n_channels, chidx); in qtnf_cmd_resp_fill_band_info()
1469 kfree(band->channels); in qtnf_cmd_resp_fill_band_info()
1470 band->channels = NULL; in qtnf_cmd_resp_fill_band_info()
1471 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1473 return -EINVAL; in qtnf_cmd_resp_fill_band_info()
1488 mac_info = &mac->macinfo; in qtnf_cmd_resp_proc_phy_params()
1492 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_proc_phy_params()
1493 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_cmd_resp_proc_phy_params()
1498 mac->macid, tlv_type, tlv_value_len); in qtnf_cmd_resp_proc_phy_params()
1499 return -EINVAL; in qtnf_cmd_resp_proc_phy_params()
1505 mac_info->frag_thr = le32_to_cpu(phy_thr->thr); in qtnf_cmd_resp_proc_phy_params()
1509 mac_info->rts_thr = le32_to_cpu(phy_thr->thr); in qtnf_cmd_resp_proc_phy_params()
1513 mac_info->sretry_limit = limit->rlimit; in qtnf_cmd_resp_proc_phy_params()
1517 mac_info->lretry_limit = limit->rlimit; in qtnf_cmd_resp_proc_phy_params()
1521 mac_info->coverage_class = class->cclass; in qtnf_cmd_resp_proc_phy_params()
1524 pr_err("MAC%u: Unknown TLV type: %#x\n", mac->macid, in qtnf_cmd_resp_proc_phy_params()
1525 le16_to_cpu(tlv->type)); in qtnf_cmd_resp_proc_phy_params()
1529 payload_len -= tlv_full_len; in qtnf_cmd_resp_proc_phy_params()
1530 tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len); in qtnf_cmd_resp_proc_phy_params()
1535 mac->macid, payload_len); in qtnf_cmd_resp_proc_phy_params()
1536 return -EINVAL; in qtnf_cmd_resp_proc_phy_params()
1554 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_proc_chan_stat_info()
1555 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_cmd_resp_proc_chan_stat_info()
1560 return -EINVAL; in qtnf_cmd_resp_proc_chan_stat_info()
1566 return -EINVAL; in qtnf_cmd_resp_proc_chan_stat_info()
1569 qlink_stats = (void *)tlv->val; in qtnf_cmd_resp_proc_chan_stat_info()
1571 stats->chan_num = le32_to_cpu(qlink_stats->chan_num); in qtnf_cmd_resp_proc_chan_stat_info()
1572 stats->cca_tx = le32_to_cpu(qlink_stats->cca_tx); in qtnf_cmd_resp_proc_chan_stat_info()
1573 stats->cca_rx = le32_to_cpu(qlink_stats->cca_rx); in qtnf_cmd_resp_proc_chan_stat_info()
1574 stats->cca_busy = le32_to_cpu(qlink_stats->cca_busy); in qtnf_cmd_resp_proc_chan_stat_info()
1575 stats->cca_try = le32_to_cpu(qlink_stats->cca_try); in qtnf_cmd_resp_proc_chan_stat_info()
1576 stats->chan_noise = qlink_stats->chan_noise; in qtnf_cmd_resp_proc_chan_stat_info()
1579 stats->chan_num, stats->cca_try, in qtnf_cmd_resp_proc_chan_stat_info()
1580 stats->cca_busy, stats->chan_noise); in qtnf_cmd_resp_proc_chan_stat_info()
1584 le16_to_cpu(tlv->type)); in qtnf_cmd_resp_proc_chan_stat_info()
1586 payload_len -= tlv_full_len; in qtnf_cmd_resp_proc_chan_stat_info()
1587 tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len); in qtnf_cmd_resp_proc_chan_stat_info()
1592 return -EINVAL; in qtnf_cmd_resp_proc_chan_stat_info()
1605 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_get_mac_info()
1609 return -ENOMEM; in qtnf_cmd_get_mac_info()
1611 qtnf_bus_lock(mac->bus); in qtnf_cmd_get_mac_info()
1612 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_mac_info()
1615 goto out; in qtnf_cmd_get_mac_info()
1617 resp = (const struct qlink_resp_get_mac_info *)resp_skb->data; in qtnf_cmd_get_mac_info()
1621 out: in qtnf_cmd_get_mac_info()
1622 qtnf_bus_unlock(mac->bus); in qtnf_cmd_get_mac_info()
1639 return -ENOMEM; in qtnf_cmd_get_hw_info()
1645 goto out; in qtnf_cmd_get_hw_info()
1647 resp = (const struct qlink_resp_get_hw_info *)resp_skb->data; in qtnf_cmd_get_hw_info()
1650 out: in qtnf_cmd_get_hw_info()
1658 struct ieee80211_supported_band *band) in qtnf_cmd_band_info_get() argument
1665 u8 qband = qlink_utils_band_cfg2q(band->band); in qtnf_cmd_band_info_get()
1667 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_band_info_get()
1671 return -ENOMEM; in qtnf_cmd_band_info_get()
1673 cmd = (struct qlink_cmd_band_info_get *)cmd_skb->data; in qtnf_cmd_band_info_get()
1674 cmd->band = qband; in qtnf_cmd_band_info_get()
1676 qtnf_bus_lock(mac->bus); in qtnf_cmd_band_info_get()
1677 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_band_info_get()
1680 goto out; in qtnf_cmd_band_info_get()
1682 resp = (struct qlink_resp_band_info_get *)resp_skb->data; in qtnf_cmd_band_info_get()
1683 if (resp->band != qband) { in qtnf_cmd_band_info_get()
1684 pr_err("MAC%u: reply band %u != cmd band %u\n", mac->macid, in qtnf_cmd_band_info_get()
1685 resp->band, qband); in qtnf_cmd_band_info_get()
1686 ret = -EINVAL; in qtnf_cmd_band_info_get()
1687 goto out; in qtnf_cmd_band_info_get()
1690 ret = qtnf_cmd_resp_fill_band_info(band, resp, info_len); in qtnf_cmd_band_info_get()
1692 out: in qtnf_cmd_band_info_get()
1693 qtnf_bus_unlock(mac->bus); in qtnf_cmd_band_info_get()
1706 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_send_get_phy_params()
1710 return -ENOMEM; in qtnf_cmd_send_get_phy_params()
1712 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_get_phy_params()
1713 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_send_get_phy_params()
1716 goto out; in qtnf_cmd_send_get_phy_params()
1718 resp = (struct qlink_resp_phy_params *)resp_skb->data; in qtnf_cmd_send_get_phy_params()
1719 ret = qtnf_cmd_resp_proc_phy_params(mac, resp->info, response_size); in qtnf_cmd_send_get_phy_params()
1721 out: in qtnf_cmd_send_get_phy_params()
1722 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_get_phy_params()
1734 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_send_update_phy_params()
1738 return -ENOMEM; in qtnf_cmd_send_update_phy_params()
1740 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_update_phy_params()
1744 wiphy->frag_threshold); in qtnf_cmd_send_update_phy_params()
1747 wiphy->rts_threshold); in qtnf_cmd_send_update_phy_params()
1750 wiphy->coverage_class); in qtnf_cmd_send_update_phy_params()
1754 wiphy->retry_long); in qtnf_cmd_send_update_phy_params()
1758 wiphy->retry_short); in qtnf_cmd_send_update_phy_params()
1760 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_update_phy_params()
1762 goto out; in qtnf_cmd_send_update_phy_params()
1764 out: in qtnf_cmd_send_update_phy_params()
1765 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_update_phy_params()
1779 return -ENOMEM; in qtnf_cmd_send_init_fw()
1784 goto out; in qtnf_cmd_send_init_fw()
1786 out: in qtnf_cmd_send_init_fw()
1814 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_add_key()
1818 return -ENOMEM; in qtnf_cmd_send_add_key()
1820 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_add_key()
1822 cmd = (struct qlink_cmd_add_key *)cmd_skb->data; in qtnf_cmd_send_add_key()
1825 ether_addr_copy(cmd->addr, mac_addr); in qtnf_cmd_send_add_key()
1827 eth_broadcast_addr(cmd->addr); in qtnf_cmd_send_add_key()
1829 cmd->cipher = cpu_to_le32(params->cipher); in qtnf_cmd_send_add_key()
1830 cmd->key_index = key_index; in qtnf_cmd_send_add_key()
1831 cmd->pairwise = pairwise; in qtnf_cmd_send_add_key()
1833 if (params->key && params->key_len > 0) in qtnf_cmd_send_add_key()
1835 params->key, in qtnf_cmd_send_add_key()
1836 params->key_len); in qtnf_cmd_send_add_key()
1838 if (params->seq && params->seq_len > 0) in qtnf_cmd_send_add_key()
1840 params->seq, in qtnf_cmd_send_add_key()
1841 params->seq_len); in qtnf_cmd_send_add_key()
1843 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_add_key()
1845 goto out; in qtnf_cmd_send_add_key()
1847 out: in qtnf_cmd_send_add_key()
1848 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_add_key()
1860 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_key()
1864 return -ENOMEM; in qtnf_cmd_send_del_key()
1866 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_key()
1868 cmd = (struct qlink_cmd_del_key *)cmd_skb->data; in qtnf_cmd_send_del_key()
1871 ether_addr_copy(cmd->addr, mac_addr); in qtnf_cmd_send_del_key()
1873 eth_broadcast_addr(cmd->addr); in qtnf_cmd_send_del_key()
1875 cmd->key_index = key_index; in qtnf_cmd_send_del_key()
1876 cmd->pairwise = pairwise; in qtnf_cmd_send_del_key()
1878 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_key()
1880 goto out; in qtnf_cmd_send_del_key()
1882 out: in qtnf_cmd_send_del_key()
1883 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_key()
1895 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_set_default_key()
1899 return -ENOMEM; in qtnf_cmd_send_set_default_key()
1901 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_set_default_key()
1903 cmd = (struct qlink_cmd_set_def_key *)cmd_skb->data; in qtnf_cmd_send_set_default_key()
1904 cmd->key_index = key_index; in qtnf_cmd_send_set_default_key()
1905 cmd->unicast = unicast; in qtnf_cmd_send_set_default_key()
1906 cmd->multicast = multicast; in qtnf_cmd_send_set_default_key()
1908 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_set_default_key()
1910 goto out; in qtnf_cmd_send_set_default_key()
1912 out: in qtnf_cmd_send_set_default_key()
1913 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_set_default_key()
1924 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_set_default_mgmt_key()
1928 return -ENOMEM; in qtnf_cmd_send_set_default_mgmt_key()
1930 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_set_default_mgmt_key()
1932 cmd = (struct qlink_cmd_set_def_mgmt_key *)cmd_skb->data; in qtnf_cmd_send_set_default_mgmt_key()
1933 cmd->key_index = key_index; in qtnf_cmd_send_set_default_mgmt_key()
1935 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_set_default_mgmt_key()
1937 goto out; in qtnf_cmd_send_set_default_mgmt_key()
1939 out: in qtnf_cmd_send_set_default_mgmt_key()
1940 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_set_default_mgmt_key()
1973 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_change_sta()
1977 return -ENOMEM; in qtnf_cmd_send_change_sta()
1979 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_change_sta()
1981 cmd = (struct qlink_cmd_change_sta *)cmd_skb->data; in qtnf_cmd_send_change_sta()
1982 ether_addr_copy(cmd->sta_addr, mac); in qtnf_cmd_send_change_sta()
1983 cmd->flag_update.mask = in qtnf_cmd_send_change_sta()
1984 cpu_to_le32(qtnf_encode_sta_flags(params->sta_flags_mask)); in qtnf_cmd_send_change_sta()
1985 cmd->flag_update.value = in qtnf_cmd_send_change_sta()
1986 cpu_to_le32(qtnf_encode_sta_flags(params->sta_flags_set)); in qtnf_cmd_send_change_sta()
1988 switch (vif->wdev.iftype) { in qtnf_cmd_send_change_sta()
1990 cmd->if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_change_sta()
1993 cmd->if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_change_sta()
1996 pr_err("unsupported iftype %d\n", vif->wdev.iftype); in qtnf_cmd_send_change_sta()
1997 ret = -EINVAL; in qtnf_cmd_send_change_sta()
1998 goto out; in qtnf_cmd_send_change_sta()
2001 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_change_sta()
2003 goto out; in qtnf_cmd_send_change_sta()
2005 out: in qtnf_cmd_send_change_sta()
2006 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_change_sta()
2018 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_sta()
2022 return -ENOMEM; in qtnf_cmd_send_del_sta()
2024 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_sta()
2026 cmd = (struct qlink_cmd_del_sta *)cmd_skb->data; in qtnf_cmd_send_del_sta()
2028 if (params->mac) in qtnf_cmd_send_del_sta()
2029 ether_addr_copy(cmd->sta_addr, params->mac); in qtnf_cmd_send_del_sta()
2031 eth_broadcast_addr(cmd->sta_addr); /* flush all stations */ in qtnf_cmd_send_del_sta()
2033 cmd->subtype = params->subtype; in qtnf_cmd_send_del_sta()
2034 cmd->reason_code = cpu_to_le16(params->reason_code); in qtnf_cmd_send_del_sta()
2036 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_sta()
2038 goto out; in qtnf_cmd_send_del_sta()
2040 out: in qtnf_cmd_send_del_sta()
2041 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_sta()
2053 qch = &tlv->chan; in qtnf_cmd_channel_tlv_add()
2054 tlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL); in qtnf_cmd_channel_tlv_add()
2055 tlv->hdr.len = cpu_to_le16(sizeof(*qch)); in qtnf_cmd_channel_tlv_add()
2057 qch->center_freq = cpu_to_le16(sc->center_freq); in qtnf_cmd_channel_tlv_add()
2058 qch->hw_value = cpu_to_le16(sc->hw_value); in qtnf_cmd_channel_tlv_add()
2059 qch->band = qlink_utils_band_cfg2q(sc->band); in qtnf_cmd_channel_tlv_add()
2060 qch->max_power = sc->max_power; in qtnf_cmd_channel_tlv_add()
2061 qch->max_reg_power = sc->max_reg_power; in qtnf_cmd_channel_tlv_add()
2062 qch->max_antenna_gain = sc->max_antenna_gain; in qtnf_cmd_channel_tlv_add()
2063 qch->beacon_found = sc->beacon_found; in qtnf_cmd_channel_tlv_add()
2064 qch->dfs_state = qlink_utils_dfs_state_cfg2q(sc->dfs_state); in qtnf_cmd_channel_tlv_add()
2065 qch->flags = cpu_to_le32(qlink_utils_chflags_cfg2q(sc->flags)); in qtnf_cmd_channel_tlv_add()
2076 hdr->type = cpu_to_le16(QTN_TLV_ID_RANDOM_MAC_ADDR); in qtnf_cmd_randmac_tlv_add()
2077 hdr->len = cpu_to_le16(sizeof(*randmac)); in qtnf_cmd_randmac_tlv_add()
2078 randmac = (struct qlink_random_mac_addr *)hdr->val; in qtnf_cmd_randmac_tlv_add()
2080 memcpy(randmac->mac_addr, mac_addr, ETH_ALEN); in qtnf_cmd_randmac_tlv_add()
2081 memcpy(randmac->mac_addr_mask, mac_addr_mask, ETH_ALEN); in qtnf_cmd_randmac_tlv_add()
2087 struct cfg80211_scan_request *scan_req = mac->scan_req; in qtnf_cmd_scan_set_dwell()
2092 if (scan_req->duration) { in qtnf_cmd_scan_set_dwell()
2093 dwell_active = scan_req->duration; in qtnf_cmd_scan_set_dwell()
2094 dwell_passive = scan_req->duration; in qtnf_cmd_scan_set_dwell()
2098 mac->macid, in qtnf_cmd_scan_set_dwell()
2099 scan_req->duration_mandatory ? "mandatory" : "max", in qtnf_cmd_scan_set_dwell()
2117 struct cfg80211_scan_request *scan_req = mac->scan_req; in qtnf_cmd_send_scan()
2122 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_send_scan()
2126 return -ENOMEM; in qtnf_cmd_send_scan()
2128 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_scan()
2130 if (scan_req->n_ssids != 0) { in qtnf_cmd_send_scan()
2131 while (count < scan_req->n_ssids) { in qtnf_cmd_send_scan()
2133 scan_req->ssids[count].ssid, in qtnf_cmd_send_scan()
2134 scan_req->ssids[count].ssid_len); in qtnf_cmd_send_scan()
2139 if (scan_req->ie_len != 0) in qtnf_cmd_send_scan()
2141 scan_req->ie, scan_req->ie_len); in qtnf_cmd_send_scan()
2143 if (scan_req->n_channels) { in qtnf_cmd_send_scan()
2144 n_channels = scan_req->n_channels; in qtnf_cmd_send_scan()
2148 sc = scan_req->channels[count]; in qtnf_cmd_send_scan()
2149 if (sc->flags & IEEE80211_CHAN_DISABLED) { in qtnf_cmd_send_scan()
2150 n_channels--; in qtnf_cmd_send_scan()
2155 mac->macid, sc->hw_value, sc->center_freq, in qtnf_cmd_send_scan()
2156 sc->flags); in qtnf_cmd_send_scan()
2159 n_channels--; in qtnf_cmd_send_scan()
2166 if (scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in qtnf_cmd_send_scan()
2168 mac->macid, in qtnf_cmd_send_scan()
2169 scan_req->mac_addr, scan_req->mac_addr_mask); in qtnf_cmd_send_scan()
2171 qtnf_cmd_randmac_tlv_add(cmd_skb, scan_req->mac_addr, in qtnf_cmd_send_scan()
2172 scan_req->mac_addr_mask); in qtnf_cmd_send_scan()
2175 if (scan_req->flags & NL80211_SCAN_FLAG_FLUSH) { in qtnf_cmd_send_scan()
2176 pr_debug("MAC%u: flush cache before scan\n", mac->macid); in qtnf_cmd_send_scan()
2181 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_scan()
2183 goto out; in qtnf_cmd_send_scan()
2185 out: in qtnf_cmd_send_scan()
2186 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_scan()
2201 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_connect()
2205 return -ENOMEM; in qtnf_cmd_send_connect()
2207 cmd = (struct qlink_cmd_connect *)cmd_skb->data; in qtnf_cmd_send_connect()
2209 ether_addr_copy(cmd->bssid, vif->bssid); in qtnf_cmd_send_connect()
2211 if (sme->bssid_hint) in qtnf_cmd_send_connect()
2212 ether_addr_copy(cmd->bssid_hint, sme->bssid_hint); in qtnf_cmd_send_connect()
2214 eth_zero_addr(cmd->bssid_hint); in qtnf_cmd_send_connect()
2216 if (sme->prev_bssid) in qtnf_cmd_send_connect()
2217 ether_addr_copy(cmd->prev_bssid, sme->prev_bssid); in qtnf_cmd_send_connect()
2219 eth_zero_addr(cmd->prev_bssid); in qtnf_cmd_send_connect()
2221 if ((sme->bg_scan_period >= 0) && in qtnf_cmd_send_connect()
2222 (sme->bg_scan_period <= SHRT_MAX)) in qtnf_cmd_send_connect()
2223 cmd->bg_scan_period = cpu_to_le16(sme->bg_scan_period); in qtnf_cmd_send_connect()
2225 cmd->bg_scan_period = cpu_to_le16(-1); /* use default value */ in qtnf_cmd_send_connect()
2227 if (sme->flags & ASSOC_REQ_DISABLE_HT) in qtnf_cmd_send_connect()
2229 if (sme->flags & ASSOC_REQ_DISABLE_VHT) in qtnf_cmd_send_connect()
2231 if (sme->flags & ASSOC_REQ_USE_RRM) in qtnf_cmd_send_connect()
2234 cmd->flags = cpu_to_le32(connect_flags); in qtnf_cmd_send_connect()
2235 memcpy(&cmd->ht_capa, &sme->ht_capa, sizeof(cmd->ht_capa)); in qtnf_cmd_send_connect()
2236 memcpy(&cmd->ht_capa_mask, &sme->ht_capa_mask, in qtnf_cmd_send_connect()
2237 sizeof(cmd->ht_capa_mask)); in qtnf_cmd_send_connect()
2238 memcpy(&cmd->vht_capa, &sme->vht_capa, sizeof(cmd->vht_capa)); in qtnf_cmd_send_connect()
2239 memcpy(&cmd->vht_capa_mask, &sme->vht_capa_mask, in qtnf_cmd_send_connect()
2240 sizeof(cmd->vht_capa_mask)); in qtnf_cmd_send_connect()
2241 cmd->pbss = sme->pbss; in qtnf_cmd_send_connect()
2243 aen = &cmd->aen; in qtnf_cmd_send_connect()
2244 aen->auth_type = sme->auth_type; in qtnf_cmd_send_connect()
2245 aen->privacy = !!sme->privacy; in qtnf_cmd_send_connect()
2246 cmd->mfp = sme->mfp; in qtnf_cmd_send_connect()
2247 aen->wpa_versions = cpu_to_le32(sme->crypto.wpa_versions); in qtnf_cmd_send_connect()
2248 aen->cipher_group = cpu_to_le32(sme->crypto.cipher_group); in qtnf_cmd_send_connect()
2249 aen->n_ciphers_pairwise = cpu_to_le32(sme->crypto.n_ciphers_pairwise); in qtnf_cmd_send_connect()
2252 aen->ciphers_pairwise[i] = in qtnf_cmd_send_connect()
2253 cpu_to_le32(sme->crypto.ciphers_pairwise[i]); in qtnf_cmd_send_connect()
2255 aen->n_akm_suites = cpu_to_le32(sme->crypto.n_akm_suites); in qtnf_cmd_send_connect()
2258 aen->akm_suites[i] = cpu_to_le32(sme->crypto.akm_suites[i]); in qtnf_cmd_send_connect()
2260 aen->control_port = sme->crypto.control_port; in qtnf_cmd_send_connect()
2261 aen->control_port_no_encrypt = in qtnf_cmd_send_connect()
2262 sme->crypto.control_port_no_encrypt; in qtnf_cmd_send_connect()
2263 aen->control_port_ethertype = in qtnf_cmd_send_connect()
2264 cpu_to_le16(be16_to_cpu(sme->crypto.control_port_ethertype)); in qtnf_cmd_send_connect()
2266 qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, sme->ssid, in qtnf_cmd_send_connect()
2267 sme->ssid_len); in qtnf_cmd_send_connect()
2269 if (sme->ie_len != 0) in qtnf_cmd_send_connect()
2271 sme->ie, sme->ie_len); in qtnf_cmd_send_connect()
2273 if (sme->channel) in qtnf_cmd_send_connect()
2274 qtnf_cmd_channel_tlv_add(cmd_skb, sme->channel); in qtnf_cmd_send_connect()
2276 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_connect()
2277 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_connect()
2279 goto out; in qtnf_cmd_send_connect()
2281 out: in qtnf_cmd_send_connect()
2282 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_connect()
2294 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_external_auth()
2298 return -ENOMEM; in qtnf_cmd_send_external_auth()
2300 cmd = (struct qlink_cmd_external_auth *)cmd_skb->data; in qtnf_cmd_send_external_auth()
2302 ether_addr_copy(cmd->bssid, auth->bssid); in qtnf_cmd_send_external_auth()
2303 cmd->status = cpu_to_le16(auth->status); in qtnf_cmd_send_external_auth()
2305 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_external_auth()
2306 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_external_auth()
2308 goto out; in qtnf_cmd_send_external_auth()
2310 out: in qtnf_cmd_send_external_auth()
2311 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_external_auth()
2322 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_disconnect()
2326 return -ENOMEM; in qtnf_cmd_send_disconnect()
2328 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_disconnect()
2330 cmd = (struct qlink_cmd_disconnect *)cmd_skb->data; in qtnf_cmd_send_disconnect()
2331 cmd->reason = cpu_to_le16(reason_code); in qtnf_cmd_send_disconnect()
2333 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_disconnect()
2335 goto out; in qtnf_cmd_send_disconnect()
2337 out: in qtnf_cmd_send_disconnect()
2338 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_disconnect()
2349 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_updown_intf()
2353 return -ENOMEM; in qtnf_cmd_send_updown_intf()
2355 cmd = (struct qlink_cmd_updown *)cmd_skb->data; in qtnf_cmd_send_updown_intf()
2356 cmd->if_up = !!up; in qtnf_cmd_send_updown_intf()
2358 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_updown_intf()
2359 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_updown_intf()
2361 goto out; in qtnf_cmd_send_updown_intf()
2363 out: in qtnf_cmd_send_updown_intf()
2364 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_updown_intf()
2373 struct qtnf_bus *bus = mac->bus; in qtnf_cmd_reg_notify()
2377 enum nl80211_band band; in qtnf_cmd_reg_notify() local
2380 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_reg_notify()
2384 return -ENOMEM; in qtnf_cmd_reg_notify()
2386 cmd = (struct qlink_cmd_reg_notify *)cmd_skb->data; in qtnf_cmd_reg_notify()
2387 cmd->alpha2[0] = req->alpha2[0]; in qtnf_cmd_reg_notify()
2388 cmd->alpha2[1] = req->alpha2[1]; in qtnf_cmd_reg_notify()
2390 switch (req->initiator) { in qtnf_cmd_reg_notify()
2392 cmd->initiator = QLINK_REGDOM_SET_BY_CORE; in qtnf_cmd_reg_notify()
2395 cmd->initiator = QLINK_REGDOM_SET_BY_USER; in qtnf_cmd_reg_notify()
2398 cmd->initiator = QLINK_REGDOM_SET_BY_DRIVER; in qtnf_cmd_reg_notify()
2401 cmd->initiator = QLINK_REGDOM_SET_BY_COUNTRY_IE; in qtnf_cmd_reg_notify()
2405 switch (req->user_reg_hint_type) { in qtnf_cmd_reg_notify()
2407 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_USER; in qtnf_cmd_reg_notify()
2410 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_CELL_BASE; in qtnf_cmd_reg_notify()
2413 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_INDOOR; in qtnf_cmd_reg_notify()
2417 switch (req->dfs_region) { in qtnf_cmd_reg_notify()
2419 cmd->dfs_region = QLINK_DFS_FCC; in qtnf_cmd_reg_notify()
2422 cmd->dfs_region = QLINK_DFS_ETSI; in qtnf_cmd_reg_notify()
2425 cmd->dfs_region = QLINK_DFS_JP; in qtnf_cmd_reg_notify()
2428 cmd->dfs_region = QLINK_DFS_UNSET; in qtnf_cmd_reg_notify()
2432 cmd->slave_radar = slave_radar; in qtnf_cmd_reg_notify()
2433 cmd->num_channels = 0; in qtnf_cmd_reg_notify()
2435 for (band = 0; band < NUM_NL80211_BANDS; band++) { in qtnf_cmd_reg_notify()
2438 cfg_band = wiphy->bands[band]; in qtnf_cmd_reg_notify()
2442 cmd->num_channels += cfg_band->n_channels; in qtnf_cmd_reg_notify()
2444 for (i = 0; i < cfg_band->n_channels; ++i) { in qtnf_cmd_reg_notify()
2446 &cfg_band->channels[i]); in qtnf_cmd_reg_notify()
2466 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_get_chan_stats()
2470 return -ENOMEM; in qtnf_cmd_get_chan_stats()
2472 qtnf_bus_lock(mac->bus); in qtnf_cmd_get_chan_stats()
2474 cmd = (struct qlink_cmd_get_chan_stats *)cmd_skb->data; in qtnf_cmd_get_chan_stats()
2475 cmd->channel = cpu_to_le16(channel); in qtnf_cmd_get_chan_stats()
2477 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_chan_stats()
2480 goto out; in qtnf_cmd_get_chan_stats()
2482 resp = (struct qlink_resp_get_chan_stats *)resp_skb->data; in qtnf_cmd_get_chan_stats()
2483 ret = qtnf_cmd_resp_proc_chan_stat_info(stats, resp->info, in qtnf_cmd_get_chan_stats()
2486 out: in qtnf_cmd_get_chan_stats()
2487 qtnf_bus_unlock(mac->bus); in qtnf_cmd_get_chan_stats()
2496 struct qtnf_wmac *mac = vif->mac; in qtnf_cmd_send_chan_switch()
2501 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, vif->vifid, in qtnf_cmd_send_chan_switch()
2505 return -ENOMEM; in qtnf_cmd_send_chan_switch()
2507 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_chan_switch()
2509 cmd = (struct qlink_cmd_chan_switch *)cmd_skb->data; in qtnf_cmd_send_chan_switch()
2510 cmd->channel = cpu_to_le16(params->chandef.chan->hw_value); in qtnf_cmd_send_chan_switch()
2511 cmd->radar_required = params->radar_required; in qtnf_cmd_send_chan_switch()
2512 cmd->block_tx = params->block_tx; in qtnf_cmd_send_chan_switch()
2513 cmd->beacon_count = params->count; in qtnf_cmd_send_chan_switch()
2515 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_chan_switch()
2517 goto out; in qtnf_cmd_send_chan_switch()
2519 out: in qtnf_cmd_send_chan_switch()
2520 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_chan_switch()
2527 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_get_channel()
2533 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_channel()
2537 return -ENOMEM; in qtnf_cmd_get_channel()
2543 goto out; in qtnf_cmd_get_channel()
2545 resp = (const struct qlink_resp_channel_get *)resp_skb->data; in qtnf_cmd_get_channel()
2546 qlink_chandef_q2cfg(priv_to_wiphy(vif->mac), &resp->chan, chdef); in qtnf_cmd_get_channel()
2548 out: in qtnf_cmd_get_channel()
2559 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_start_cac()
2564 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_start_cac()
2568 return -ENOMEM; in qtnf_cmd_start_cac()
2570 cmd = (struct qlink_cmd_start_cac *)cmd_skb->data; in qtnf_cmd_start_cac()
2571 cmd->cac_time_ms = cpu_to_le32(cac_time_ms); in qtnf_cmd_start_cac()
2572 qlink_chandef_cfg2q(chdef, &cmd->chan); in qtnf_cmd_start_cac()
2577 goto out; in qtnf_cmd_start_cac()
2579 out: in qtnf_cmd_start_cac()
2588 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_set_mac_acl()
2591 size_t acl_size = struct_size(params, mac_addrs, params->n_acl_entries); in qtnf_cmd_set_mac_acl()
2594 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_set_mac_acl()
2598 return -ENOMEM; in qtnf_cmd_set_mac_acl()
2601 tlv->type = cpu_to_le16(QTN_TLV_ID_ACL_DATA); in qtnf_cmd_set_mac_acl()
2602 tlv->len = cpu_to_le16(acl_size); in qtnf_cmd_set_mac_acl()
2603 qlink_acl_data_cfg2q(params, (struct qlink_acl_data *)tlv->val); in qtnf_cmd_set_mac_acl()
2608 goto out; in qtnf_cmd_set_mac_acl()
2610 out: in qtnf_cmd_set_mac_acl()
2618 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_send_pm_set()
2623 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_pm_set()
2626 return -ENOMEM; in qtnf_cmd_send_pm_set()
2628 cmd = (struct qlink_cmd_pm_set *)cmd_skb->data; in qtnf_cmd_send_pm_set()
2629 cmd->pm_mode = pm_mode; in qtnf_cmd_send_pm_set()
2630 cmd->pm_standby_timer = cpu_to_le32(timeout); in qtnf_cmd_send_pm_set()
2636 goto out; in qtnf_cmd_send_pm_set()
2638 out: in qtnf_cmd_send_pm_set()
2647 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_send_wowlan_set()
2654 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_wowlan_set()
2657 return -ENOMEM; in qtnf_cmd_send_wowlan_set()
2661 cmd = (struct qlink_cmd_wowlan_set *)cmd_skb->data; in qtnf_cmd_send_wowlan_set()
2664 if (wowl->disconnect) in qtnf_cmd_send_wowlan_set()
2667 if (wowl->magic_pkt) in qtnf_cmd_send_wowlan_set()
2670 if (wowl->n_patterns && wowl->patterns) { in qtnf_cmd_send_wowlan_set()
2672 while (count < wowl->n_patterns) { in qtnf_cmd_send_wowlan_set()
2675 wowl->patterns[count].pattern, in qtnf_cmd_send_wowlan_set()
2676 wowl->patterns[count].pattern_len); in qtnf_cmd_send_wowlan_set()
2682 cmd->triggers = cpu_to_le32(triggers); in qtnf_cmd_send_wowlan_set()
2686 goto out; in qtnf_cmd_send_wowlan_set()
2688 out: in qtnf_cmd_send_wowlan_set()