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()
92 cmd = (struct qlink_cmd *)cmd_skb->data; in qtnf_cmd_send_with_reply()
93 cmd_id = le16_to_cpu(cmd->cmd_id); in qtnf_cmd_send_with_reply()
94 mac_id = cmd->macid; in qtnf_cmd_send_with_reply()
95 vif_id = cmd->vifid; in qtnf_cmd_send_with_reply()
96 cmd->mhdr.len = cpu_to_le16(cmd_skb->len); in qtnf_cmd_send_with_reply()
102 mac_id, vif_id, cmd_id, bus->fw_state); in qtnf_cmd_send_with_reply()
104 return -ENODEV; in qtnf_cmd_send_with_reply()
109 goto out; in qtnf_cmd_send_with_reply()
111 if (WARN_ON(!resp_skb || !resp_skb->data)) { in qtnf_cmd_send_with_reply()
112 ret = -EFAULT; in qtnf_cmd_send_with_reply()
113 goto out; in qtnf_cmd_send_with_reply()
116 resp = (struct qlink_resp *)resp_skb->data; in qtnf_cmd_send_with_reply()
117 resp_res = le16_to_cpu(resp->result); in qtnf_cmd_send_with_reply()
121 goto out; in qtnf_cmd_send_with_reply()
123 /* Return length of variable part of response */ in qtnf_cmd_send_with_reply()
125 *var_resp_size = le16_to_cpu(resp->mhdr.len) - const_resp_size; in qtnf_cmd_send_with_reply()
127 out: in qtnf_cmd_send_with_reply()
163 cmd = (struct qlink_cmd *)cmd_skb->data; in qtnf_cmd_alloc_new_cmdskb()
164 cmd->mhdr.len = cpu_to_le16(cmd_skb->len); in qtnf_cmd_alloc_new_cmdskb()
165 cmd->mhdr.type = cpu_to_le16(QLINK_MSG_TYPE_CMD); in qtnf_cmd_alloc_new_cmdskb()
166 cmd->cmd_id = cpu_to_le16(cmd_no); in qtnf_cmd_alloc_new_cmdskb()
167 cmd->macid = macid; in qtnf_cmd_alloc_new_cmdskb()
168 cmd->vifid = vifid; in qtnf_cmd_alloc_new_cmdskb()
180 tlv->hdr.type = cpu_to_le16(QTN_TLV_ID_IE_SET); in qtnf_cmd_tlv_ie_set_add()
181 tlv->hdr.len = cpu_to_le16(len + sizeof(*tlv) - sizeof(tlv->hdr)); in qtnf_cmd_tlv_ie_set_add()
182 tlv->type = frame_type; in qtnf_cmd_tlv_ie_set_add()
183 tlv->flags = 0; in qtnf_cmd_tlv_ie_set_add()
186 memcpy(tlv->ie_data, buf, len); in qtnf_cmd_tlv_ie_set_add()
194 len += round_up(s->ssid_len, QLINK_ALIGN); in qtnf_cmd_start_ap_can_fit()
195 len += round_up(s->beacon.head_len, QLINK_ALIGN); in qtnf_cmd_start_ap_can_fit()
196 len += round_up(s->beacon.tail_len, QLINK_ALIGN); in qtnf_cmd_start_ap_can_fit()
197 len += round_up(s->beacon.beacon_ies_len, QLINK_ALIGN); in qtnf_cmd_start_ap_can_fit()
198 len += round_up(s->beacon.proberesp_ies_len, QLINK_ALIGN); in qtnf_cmd_start_ap_can_fit()
199 len += round_up(s->beacon.assocresp_ies_len, QLINK_ALIGN); in qtnf_cmd_start_ap_can_fit()
200 len += round_up(s->beacon.probe_resp_len, QLINK_ALIGN); in qtnf_cmd_start_ap_can_fit()
202 if (cfg80211_chandef_valid(&s->chandef)) in qtnf_cmd_start_ap_can_fit()
205 if (s->acl) { in qtnf_cmd_start_ap_can_fit()
206 unsigned int acl_len = struct_size(s->acl, mac_addrs, in qtnf_cmd_start_ap_can_fit()
207 s->acl->n_acl_entries); in qtnf_cmd_start_ap_can_fit()
215 vif->mac->macid, vif->vifid, len); in qtnf_cmd_start_ap_can_fit()
228 tlv->hdr.type = cpu_to_le16(WLAN_EID_EXTENSION); in qtnf_cmd_tlv_ie_ext_add()
229 tlv->hdr.len = cpu_to_le16(sizeof(*tlv) + len - sizeof(tlv->hdr)); in qtnf_cmd_tlv_ie_ext_add()
230 tlv->eid_ext = eid_ext; in qtnf_cmd_tlv_ie_ext_add()
233 memcpy(tlv->ie_data, buf, len); in qtnf_cmd_tlv_ie_ext_add()
246 return -E2BIG; in qtnf_cmd_send_start_ap()
248 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_start_ap()
252 return -ENOMEM; in qtnf_cmd_send_start_ap()
254 cmd = (struct qlink_cmd_start_ap *)cmd_skb->data; in qtnf_cmd_send_start_ap()
255 cmd->dtim_period = s->dtim_period; in qtnf_cmd_send_start_ap()
256 cmd->beacon_interval = cpu_to_le16(s->beacon_interval); in qtnf_cmd_send_start_ap()
257 cmd->hidden_ssid = qlink_hidden_ssid_nl2q(s->hidden_ssid); in qtnf_cmd_send_start_ap()
258 cmd->inactivity_timeout = cpu_to_le16(s->inactivity_timeout); in qtnf_cmd_send_start_ap()
259 cmd->smps_mode = s->smps_mode; in qtnf_cmd_send_start_ap()
260 cmd->p2p_ctwindow = s->p2p_ctwindow; in qtnf_cmd_send_start_ap()
261 cmd->p2p_opp_ps = s->p2p_opp_ps; in qtnf_cmd_send_start_ap()
262 cmd->pbss = s->pbss; in qtnf_cmd_send_start_ap()
263 cmd->ht_required = s->ht_required; in qtnf_cmd_send_start_ap()
264 cmd->vht_required = s->vht_required; in qtnf_cmd_send_start_ap()
265 cmd->twt_responder = s->twt_responder; in qtnf_cmd_send_start_ap()
266 if (s->he_obss_pd.enable) { in qtnf_cmd_send_start_ap()
267 cmd->sr_params.sr_control |= QLINK_SR_SRG_INFORMATION_PRESENT; in qtnf_cmd_send_start_ap()
268 cmd->sr_params.srg_obss_pd_min_offset = in qtnf_cmd_send_start_ap()
269 s->he_obss_pd.min_offset; in qtnf_cmd_send_start_ap()
270 cmd->sr_params.srg_obss_pd_max_offset = in qtnf_cmd_send_start_ap()
271 s->he_obss_pd.max_offset; in qtnf_cmd_send_start_ap()
274 aen = &cmd->aen; in qtnf_cmd_send_start_ap()
275 aen->auth_type = s->auth_type; in qtnf_cmd_send_start_ap()
276 aen->privacy = !!s->privacy; in qtnf_cmd_send_start_ap()
277 aen->wpa_versions = cpu_to_le32(s->crypto.wpa_versions); in qtnf_cmd_send_start_ap()
278 aen->cipher_group = cpu_to_le32(s->crypto.cipher_group); in qtnf_cmd_send_start_ap()
279 aen->n_ciphers_pairwise = cpu_to_le32(s->crypto.n_ciphers_pairwise); in qtnf_cmd_send_start_ap()
281 aen->ciphers_pairwise[i] = in qtnf_cmd_send_start_ap()
282 cpu_to_le32(s->crypto.ciphers_pairwise[i]); in qtnf_cmd_send_start_ap()
283 aen->n_akm_suites = cpu_to_le32(s->crypto.n_akm_suites); in qtnf_cmd_send_start_ap()
285 aen->akm_suites[i] = cpu_to_le32(s->crypto.akm_suites[i]); in qtnf_cmd_send_start_ap()
286 aen->control_port = s->crypto.control_port; in qtnf_cmd_send_start_ap()
287 aen->control_port_no_encrypt = s->crypto.control_port_no_encrypt; in qtnf_cmd_send_start_ap()
288 aen->control_port_ethertype = in qtnf_cmd_send_start_ap()
289 cpu_to_le16(be16_to_cpu(s->crypto.control_port_ethertype)); in qtnf_cmd_send_start_ap()
291 if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) in qtnf_cmd_send_start_ap()
292 qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, in qtnf_cmd_send_start_ap()
293 s->ssid_len); in qtnf_cmd_send_start_ap()
295 if (cfg80211_chandef_valid(&s->chandef)) { in qtnf_cmd_send_start_ap()
300 chtlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANDEF); in qtnf_cmd_send_start_ap()
301 chtlv->hdr.len = cpu_to_le16(sizeof(*chtlv) - in qtnf_cmd_send_start_ap()
302 sizeof(chtlv->hdr)); in qtnf_cmd_send_start_ap()
303 qlink_chandef_cfg2q(&s->chandef, &chtlv->chdef); in qtnf_cmd_send_start_ap()
307 s->beacon.head, s->beacon.head_len); in qtnf_cmd_send_start_ap()
309 s->beacon.tail, s->beacon.tail_len); in qtnf_cmd_send_start_ap()
311 s->beacon.beacon_ies, s->beacon.beacon_ies_len); in qtnf_cmd_send_start_ap()
313 s->beacon.probe_resp, s->beacon.probe_resp_len); in qtnf_cmd_send_start_ap()
315 s->beacon.proberesp_ies, in qtnf_cmd_send_start_ap()
316 s->beacon.proberesp_ies_len); in qtnf_cmd_send_start_ap()
318 s->beacon.assocresp_ies, in qtnf_cmd_send_start_ap()
319 s->beacon.assocresp_ies_len); in qtnf_cmd_send_start_ap()
321 if (s->ht_cap) { in qtnf_cmd_send_start_ap()
324 round_up(sizeof(*s->ht_cap), QLINK_ALIGN)); in qtnf_cmd_send_start_ap()
326 tlv->type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); in qtnf_cmd_send_start_ap()
327 tlv->len = cpu_to_le16(sizeof(*s->ht_cap)); in qtnf_cmd_send_start_ap()
328 memcpy(tlv->val, s->ht_cap, sizeof(*s->ht_cap)); in qtnf_cmd_send_start_ap()
331 if (s->vht_cap) { in qtnf_cmd_send_start_ap()
333 skb_put(cmd_skb, sizeof(*tlv) + sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
335 tlv->type = cpu_to_le16(WLAN_EID_VHT_CAPABILITY); in qtnf_cmd_send_start_ap()
336 tlv->len = cpu_to_le16(sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
337 memcpy(tlv->val, s->vht_cap, sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
340 if (s->he_cap) in qtnf_cmd_send_start_ap()
342 s->he_cap, sizeof(*s->he_cap)); in qtnf_cmd_send_start_ap()
344 if (s->acl) { in qtnf_cmd_send_start_ap()
345 size_t acl_size = struct_size(s->acl, mac_addrs, in qtnf_cmd_send_start_ap()
346 s->acl->n_acl_entries); in qtnf_cmd_send_start_ap()
351 tlv->type = cpu_to_le16(QTN_TLV_ID_ACL_DATA); in qtnf_cmd_send_start_ap()
352 tlv->len = cpu_to_le16(acl_size); in qtnf_cmd_send_start_ap()
353 qlink_acl_data_cfg2q(s->acl, (struct qlink_acl_data *)tlv->val); in qtnf_cmd_send_start_ap()
356 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_start_ap()
357 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_start_ap()
359 goto out; in qtnf_cmd_send_start_ap()
361 netif_carrier_on(vif->netdev); in qtnf_cmd_send_start_ap()
363 out: in qtnf_cmd_send_start_ap()
364 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_start_ap()
374 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_stop_ap()
378 return -ENOMEM; in qtnf_cmd_send_stop_ap()
380 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_stop_ap()
381 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_stop_ap()
383 goto out; in qtnf_cmd_send_stop_ap()
385 out: in qtnf_cmd_send_stop_ap()
386 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_stop_ap()
397 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_register_mgmt()
401 return -ENOMEM; in qtnf_cmd_send_register_mgmt()
403 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_register_mgmt()
405 cmd = (struct qlink_cmd_mgmt_frame_register *)cmd_skb->data; in qtnf_cmd_send_register_mgmt()
406 cmd->frame_type = cpu_to_le16(frame_type); in qtnf_cmd_send_register_mgmt()
407 cmd->do_register = reg; in qtnf_cmd_send_register_mgmt()
409 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_register_mgmt()
411 goto out; in qtnf_cmd_send_register_mgmt()
413 out: in qtnf_cmd_send_register_mgmt()
414 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_register_mgmt()
427 pr_warn("VIF%u.%u: frame is too big: %zu\n", vif->mac->macid, in qtnf_cmd_send_frame()
428 vif->vifid, len); in qtnf_cmd_send_frame()
429 return -E2BIG; in qtnf_cmd_send_frame()
432 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_frame()
436 return -ENOMEM; in qtnf_cmd_send_frame()
438 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_frame()
440 cmd = (struct qlink_cmd_frame_tx *)cmd_skb->data; in qtnf_cmd_send_frame()
441 cmd->cookie = cpu_to_le32(cookie); in qtnf_cmd_send_frame()
442 cmd->freq = cpu_to_le16(freq); in qtnf_cmd_send_frame()
443 cmd->flags = cpu_to_le16(flags); in qtnf_cmd_send_frame()
448 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_frame()
450 goto out; in qtnf_cmd_send_frame()
452 out: in qtnf_cmd_send_frame()
453 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_frame()
465 pr_warn("VIF%u.%u: %u frame is too big: %zu\n", vif->mac->macid, in qtnf_cmd_send_mgmt_set_appie()
466 vif->vifid, frame_type, len); in qtnf_cmd_send_mgmt_set_appie()
467 return -E2BIG; in qtnf_cmd_send_mgmt_set_appie()
470 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_mgmt_set_appie()
474 return -ENOMEM; in qtnf_cmd_send_mgmt_set_appie()
478 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_mgmt_set_appie()
479 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_mgmt_set_appie()
481 goto out; in qtnf_cmd_send_mgmt_set_appie()
483 out: in qtnf_cmd_send_mgmt_set_appie()
484 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_mgmt_set_appie()
493 rate_dst->legacy = get_unaligned_le16(&rate_src->rate) * 10; in qtnf_sta_info_parse_rate()
495 rate_dst->mcs = rate_src->mcs; in qtnf_sta_info_parse_rate()
496 rate_dst->nss = rate_src->nss; in qtnf_sta_info_parse_rate()
497 rate_dst->flags = 0; in qtnf_sta_info_parse_rate()
499 switch (rate_src->bw) { in qtnf_sta_info_parse_rate()
501 rate_dst->bw = RATE_INFO_BW_5; in qtnf_sta_info_parse_rate()
504 rate_dst->bw = RATE_INFO_BW_10; in qtnf_sta_info_parse_rate()
508 rate_dst->bw = RATE_INFO_BW_20; in qtnf_sta_info_parse_rate()
511 rate_dst->bw = RATE_INFO_BW_40; in qtnf_sta_info_parse_rate()
514 rate_dst->bw = RATE_INFO_BW_80; in qtnf_sta_info_parse_rate()
517 rate_dst->bw = RATE_INFO_BW_160; in qtnf_sta_info_parse_rate()
520 rate_dst->bw = 0; in qtnf_sta_info_parse_rate()
524 if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_HT_MCS) in qtnf_sta_info_parse_rate()
525 rate_dst->flags |= RATE_INFO_FLAGS_MCS; in qtnf_sta_info_parse_rate()
526 else if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_VHT_MCS) in qtnf_sta_info_parse_rate()
527 rate_dst->flags |= RATE_INFO_FLAGS_VHT_MCS; in qtnf_sta_info_parse_rate()
528 else if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_HE_MCS) in qtnf_sta_info_parse_rate()
529 rate_dst->flags |= RATE_INFO_FLAGS_HE_MCS; in qtnf_sta_info_parse_rate()
531 if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_SHORT_GI) in qtnf_sta_info_parse_rate()
532 rate_dst->flags |= RATE_INFO_FLAGS_SHORT_GI; in qtnf_sta_info_parse_rate()
541 dst->mask = 0; in qtnf_sta_info_parse_flags()
542 dst->set = 0; in qtnf_sta_info_parse_flags()
544 mask = le32_to_cpu(src->mask); in qtnf_sta_info_parse_flags()
545 value = le32_to_cpu(src->value); in qtnf_sta_info_parse_flags()
548 dst->mask |= BIT(NL80211_STA_FLAG_AUTHORIZED); in qtnf_sta_info_parse_flags()
550 dst->set |= BIT(NL80211_STA_FLAG_AUTHORIZED); in qtnf_sta_info_parse_flags()
554 dst->mask |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE); in qtnf_sta_info_parse_flags()
556 dst->set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE); in qtnf_sta_info_parse_flags()
560 dst->mask |= BIT(NL80211_STA_FLAG_WME); in qtnf_sta_info_parse_flags()
562 dst->set |= BIT(NL80211_STA_FLAG_WME); in qtnf_sta_info_parse_flags()
566 dst->mask |= BIT(NL80211_STA_FLAG_MFP); in qtnf_sta_info_parse_flags()
568 dst->set |= BIT(NL80211_STA_FLAG_MFP); in qtnf_sta_info_parse_flags()
572 dst->mask |= BIT(NL80211_STA_FLAG_AUTHENTICATED); in qtnf_sta_info_parse_flags()
574 dst->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED); in qtnf_sta_info_parse_flags()
578 dst->mask |= BIT(NL80211_STA_FLAG_TDLS_PEER); in qtnf_sta_info_parse_flags()
580 dst->set |= BIT(NL80211_STA_FLAG_TDLS_PEER); in qtnf_sta_info_parse_flags()
584 dst->mask |= BIT(NL80211_STA_FLAG_ASSOCIATED); in qtnf_sta_info_parse_flags()
586 dst->set |= BIT(NL80211_STA_FLAG_ASSOCIATED); in qtnf_sta_info_parse_flags()
606 tlv_len = le16_to_cpu(tlv->len); in qtnf_cmd_sta_info_parse()
608 switch (le16_to_cpu(tlv->type)) { in qtnf_cmd_sta_info_parse()
611 map = tlv->val; in qtnf_cmd_sta_info_parse()
615 stats = (const struct qlink_sta_stats *)tlv->val; in qtnf_cmd_sta_info_parse()
631 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); in qtnf_cmd_sta_info_parse()
632 sinfo->inactive_time = le32_to_cpu(stats->inactive_time); in qtnf_cmd_sta_info_parse()
637 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME); in qtnf_cmd_sta_info_parse()
638 sinfo->connected_time = le32_to_cpu(stats->connected_time); in qtnf_cmd_sta_info_parse()
642 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in qtnf_cmd_sta_info_parse()
643 sinfo->signal = stats->signal - QLINK_RSSI_OFFSET; in qtnf_cmd_sta_info_parse()
647 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in qtnf_cmd_sta_info_parse()
648 sinfo->signal_avg = stats->signal_avg - QLINK_RSSI_OFFSET; in qtnf_cmd_sta_info_parse()
652 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in qtnf_cmd_sta_info_parse()
653 qtnf_sta_info_parse_rate(&sinfo->rxrate, &stats->rxrate); in qtnf_cmd_sta_info_parse()
657 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in qtnf_cmd_sta_info_parse()
658 qtnf_sta_info_parse_rate(&sinfo->txrate, &stats->txrate); in qtnf_cmd_sta_info_parse()
662 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_STA_FLAGS); in qtnf_cmd_sta_info_parse()
663 qtnf_sta_info_parse_flags(&sinfo->sta_flags, &stats->sta_flags); in qtnf_cmd_sta_info_parse()
667 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); in qtnf_cmd_sta_info_parse()
668 sinfo->rx_bytes = le64_to_cpu(stats->rx_bytes); in qtnf_cmd_sta_info_parse()
672 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); in qtnf_cmd_sta_info_parse()
673 sinfo->tx_bytes = le64_to_cpu(stats->tx_bytes); in qtnf_cmd_sta_info_parse()
677 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); in qtnf_cmd_sta_info_parse()
678 sinfo->rx_bytes = le64_to_cpu(stats->rx_bytes); in qtnf_cmd_sta_info_parse()
682 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); in qtnf_cmd_sta_info_parse()
683 sinfo->tx_bytes = le64_to_cpu(stats->tx_bytes); in qtnf_cmd_sta_info_parse()
687 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); in qtnf_cmd_sta_info_parse()
688 sinfo->rx_packets = le32_to_cpu(stats->rx_packets); in qtnf_cmd_sta_info_parse()
692 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); in qtnf_cmd_sta_info_parse()
693 sinfo->tx_packets = le32_to_cpu(stats->tx_packets); in qtnf_cmd_sta_info_parse()
697 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); in qtnf_cmd_sta_info_parse()
698 sinfo->rx_beacon = le64_to_cpu(stats->rx_beacon); in qtnf_cmd_sta_info_parse()
702 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC); in qtnf_cmd_sta_info_parse()
703 sinfo->rx_dropped_misc = le32_to_cpu(stats->rx_dropped_misc); in qtnf_cmd_sta_info_parse()
707 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in qtnf_cmd_sta_info_parse()
708 sinfo->tx_failed = le32_to_cpu(stats->tx_failed); in qtnf_cmd_sta_info_parse()
723 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_sta_info()
727 return -ENOMEM; in qtnf_cmd_get_sta_info()
729 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_get_sta_info()
731 cmd = (struct qlink_cmd_get_sta_info *)cmd_skb->data; in qtnf_cmd_get_sta_info()
732 ether_addr_copy(cmd->sta_addr, sta_mac); in qtnf_cmd_get_sta_info()
734 ret = qtnf_cmd_send_with_reply(vif->mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_sta_info()
737 goto out; in qtnf_cmd_get_sta_info()
739 resp = (const struct qlink_resp_get_sta_info *)resp_skb->data; in qtnf_cmd_get_sta_info()
741 if (!ether_addr_equal(sta_mac, resp->sta_addr)) { in qtnf_cmd_get_sta_info()
743 vif->mac->macid, vif->vifid, resp->sta_addr, sta_mac); in qtnf_cmd_get_sta_info()
744 ret = -EINVAL; in qtnf_cmd_get_sta_info()
745 goto out; in qtnf_cmd_get_sta_info()
748 qtnf_cmd_sta_info_parse(sinfo, resp->info, var_resp_len); in qtnf_cmd_get_sta_info()
750 out: in qtnf_cmd_get_sta_info()
751 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_get_sta_info()
768 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_add_change_intf()
772 return -ENOMEM; in qtnf_cmd_send_add_change_intf()
774 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_add_change_intf()
776 cmd = (struct qlink_cmd_manage_intf *)cmd_skb->data; in qtnf_cmd_send_add_change_intf()
777 cmd->intf_info.use4addr = use4addr; in qtnf_cmd_send_add_change_intf()
781 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_add_change_intf()
784 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_add_change_intf()
787 pr_err("VIF%u.%u: unsupported type %d\n", vif->mac->macid, in qtnf_cmd_send_add_change_intf()
788 vif->vifid, iftype); in qtnf_cmd_send_add_change_intf()
789 ret = -EINVAL; in qtnf_cmd_send_add_change_intf()
790 goto out; in qtnf_cmd_send_add_change_intf()
794 ether_addr_copy(cmd->intf_info.mac_addr, mac_addr); in qtnf_cmd_send_add_change_intf()
796 eth_zero_addr(cmd->intf_info.mac_addr); in qtnf_cmd_send_add_change_intf()
798 ret = qtnf_cmd_send_with_reply(vif->mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_send_add_change_intf()
801 goto out; in qtnf_cmd_send_add_change_intf()
803 resp = (const struct qlink_resp_manage_intf *)resp_skb->data; in qtnf_cmd_send_add_change_intf()
804 ether_addr_copy(vif->mac_addr, resp->intf_info.mac_addr); in qtnf_cmd_send_add_change_intf()
806 out: in qtnf_cmd_send_add_change_intf()
807 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_add_change_intf()
831 if (ret == 0 && vif->wdev.iftype != iftype) { in qtnf_cmd_send_change_intf_type()
832 enum nl80211_band band; in qtnf_cmd_send_change_intf_type() local
833 struct wiphy *wiphy = priv_to_wiphy(vif->mac); in qtnf_cmd_send_change_intf_type()
835 for (band = 0; band < NUM_NL80211_BANDS; ++band) { in qtnf_cmd_send_change_intf_type()
836 if (!wiphy->bands[band]) in qtnf_cmd_send_change_intf_type()
839 qtnf_cmd_band_info_get(vif->mac, wiphy->bands[band]); in qtnf_cmd_send_change_intf_type()
852 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_intf()
856 return -ENOMEM; in qtnf_cmd_send_del_intf()
858 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_intf()
860 cmd = (struct qlink_cmd_manage_intf *)cmd_skb->data; in qtnf_cmd_send_del_intf()
862 switch (vif->wdev.iftype) { in qtnf_cmd_send_del_intf()
864 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_del_intf()
867 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_del_intf()
870 pr_warn("VIF%u.%u: unsupported iftype %d\n", vif->mac->macid, in qtnf_cmd_send_del_intf()
871 vif->vifid, vif->wdev.iftype); in qtnf_cmd_send_del_intf()
873 ret = -EINVAL; in qtnf_cmd_send_del_intf()
874 goto out; in qtnf_cmd_send_del_intf()
877 eth_zero_addr(cmd->intf_info.mac_addr); in qtnf_cmd_send_del_intf()
879 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_intf()
881 goto out; in qtnf_cmd_send_del_intf()
883 out: in qtnf_cmd_send_del_intf()
884 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_intf()
893 struct qtnf_hw_info *hwinfo = &bus->hw_info; in qtnf_cmd_resp_proc_hw_info()
908 hwinfo->num_mac = resp->num_mac; in qtnf_cmd_resp_proc_hw_info()
909 hwinfo->mac_bitmap = resp->mac_bitmap; in qtnf_cmd_resp_proc_hw_info()
910 hwinfo->fw_ver = le32_to_cpu(resp->fw_ver); in qtnf_cmd_resp_proc_hw_info()
911 hwinfo->total_tx_chain = resp->total_tx_chain; in qtnf_cmd_resp_proc_hw_info()
912 hwinfo->total_rx_chain = resp->total_rx_chain; in qtnf_cmd_resp_proc_hw_info()
914 bld_tmstamp = le32_to_cpu(resp->bld_tmstamp); in qtnf_cmd_resp_proc_hw_info()
915 plat_id = le32_to_cpu(resp->plat_id); in qtnf_cmd_resp_proc_hw_info()
916 hw_ver = le32_to_cpu(resp->hw_ver); in qtnf_cmd_resp_proc_hw_info()
918 qlink_for_each_tlv(tlv, resp->info, info_len) { in qtnf_cmd_resp_proc_hw_info()
919 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_proc_hw_info()
920 tlv_len = le16_to_cpu(tlv->len); in qtnf_cmd_resp_proc_hw_info()
924 bld_name = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
927 bld_rev = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
930 bld_type = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
933 bld_label = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
936 hw_id = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
939 calibration_ver = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
942 uboot_ver = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
945 memcpy(hwinfo->hw_capab, tlv->val, in qtnf_cmd_resp_proc_hw_info()
946 min(sizeof(hwinfo->hw_capab), (size_t)tlv_len)); in qtnf_cmd_resp_proc_hw_info()
953 if (!qlink_tlv_parsing_ok(tlv, resp->info, info_len)) { in qtnf_cmd_resp_proc_hw_info()
955 return -EINVAL; in qtnf_cmd_resp_proc_hw_info()
966 "U-Boot version: %s\n" in qtnf_cmd_resp_proc_hw_info()
970 "Chains Rx-Tx: %ux%u\n" in qtnf_cmd_resp_proc_hw_info()
976 QLINK_VER_MAJOR(bus->hw_info.ql_proto_ver), in qtnf_cmd_resp_proc_hw_info()
977 QLINK_VER_MINOR(bus->hw_info.ql_proto_ver), in qtnf_cmd_resp_proc_hw_info()
978 hwinfo->mac_bitmap, in qtnf_cmd_resp_proc_hw_info()
979 hwinfo->total_rx_chain, hwinfo->total_tx_chain, in qtnf_cmd_resp_proc_hw_info()
980 hwinfo->fw_ver); in qtnf_cmd_resp_proc_hw_info()
982 strlcpy(hwinfo->fw_version, bld_label, sizeof(hwinfo->fw_version)); in qtnf_cmd_resp_proc_hw_info()
983 hwinfo->hw_version = hw_ver; in qtnf_cmd_resp_proc_hw_info()
992 struct qtnf_mac_info *mac_info = &mac->macinfo; in qtnf_parse_wowlan_info()
1000 switch (le16_to_cpu(wowlan->version)) { in qtnf_parse_wowlan_info()
1002 data1 = (struct qlink_wowlan_support *)wowlan->data; in qtnf_parse_wowlan_info()
1004 supp->flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT; in qtnf_parse_wowlan_info()
1005 supp->n_patterns = le32_to_cpu(data1->n_patterns); in qtnf_parse_wowlan_info()
1006 supp->pattern_max_len = le32_to_cpu(data1->pattern_max_len); in qtnf_parse_wowlan_info()
1007 supp->pattern_min_len = le32_to_cpu(data1->pattern_min_len); in qtnf_parse_wowlan_info()
1009 mac_info->wowlan = supp; in qtnf_parse_wowlan_info()
1013 mac->macid, le16_to_cpu(wowlan->version)); in qtnf_parse_wowlan_info()
1024 struct ieee80211_iface_combination *comb = mac->macinfo.if_comb; in qtnf_parse_variable_mac_info()
1043 if (WARN_ON(resp->n_reg_rules > NL80211_MAX_SUPP_REG_RULES)) in qtnf_parse_variable_mac_info()
1044 return -E2BIG; in qtnf_parse_variable_mac_info()
1046 mac->rd = kzalloc(struct_size(mac->rd, reg_rules, resp->n_reg_rules), in qtnf_parse_variable_mac_info()
1048 if (!mac->rd) in qtnf_parse_variable_mac_info()
1049 return -ENOMEM; in qtnf_parse_variable_mac_info()
1051 mac->rd->n_reg_rules = resp->n_reg_rules; in qtnf_parse_variable_mac_info()
1052 mac->rd->alpha2[0] = resp->alpha2[0]; in qtnf_parse_variable_mac_info()
1053 mac->rd->alpha2[1] = resp->alpha2[1]; in qtnf_parse_variable_mac_info()
1055 switch (resp->dfs_region) { in qtnf_parse_variable_mac_info()
1057 mac->rd->dfs_region = NL80211_DFS_FCC; in qtnf_parse_variable_mac_info()
1060 mac->rd->dfs_region = NL80211_DFS_ETSI; in qtnf_parse_variable_mac_info()
1063 mac->rd->dfs_region = NL80211_DFS_JP; in qtnf_parse_variable_mac_info()
1067 mac->rd->dfs_region = NL80211_DFS_UNSET; in qtnf_parse_variable_mac_info()
1071 qlink_for_each_tlv(tlv, resp->var_info, tlv_buf_size) { in qtnf_parse_variable_mac_info()
1072 tlv_type = le16_to_cpu(tlv->type); in qtnf_parse_variable_mac_info()
1073 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_parse_variable_mac_info()
1079 mac->macid); in qtnf_parse_variable_mac_info()
1080 return -EINVAL; in qtnf_parse_variable_mac_info()
1083 if (n_comb >= mac->macinfo.n_if_comb) { in qtnf_parse_variable_mac_info()
1085 mac->macid); in qtnf_parse_variable_mac_info()
1090 rec = (void *)tlv->val; in qtnf_parse_variable_mac_info()
1091 rec_len = sizeof(*rec) + rec->n_limits * sizeof(*lim); in qtnf_parse_variable_mac_info()
1095 mac->macid, n_comb); in qtnf_parse_variable_mac_info()
1096 return -EINVAL; in qtnf_parse_variable_mac_info()
1099 limits = kcalloc(rec->n_limits, sizeof(*limits), in qtnf_parse_variable_mac_info()
1102 return -ENOMEM; in qtnf_parse_variable_mac_info()
1105 rec->num_different_channels; in qtnf_parse_variable_mac_info()
1107 le16_to_cpu(rec->max_interfaces); in qtnf_parse_variable_mac_info()
1108 comb[n_comb].n_limits = rec->n_limits; in qtnf_parse_variable_mac_info()
1111 for (i = 0; i < rec->n_limits; i++) { in qtnf_parse_variable_mac_info()
1112 lim = &rec->limits[i]; in qtnf_parse_variable_mac_info()
1113 limits[i].max = le16_to_cpu(lim->max_num); in qtnf_parse_variable_mac_info()
1115 qlink_iface_type_to_nl_mask(le16_to_cpu(lim->type)); in qtnf_parse_variable_mac_info()
1117 mac->macid, n_comb, in qtnf_parse_variable_mac_info()
1125 return -EINVAL; in qtnf_parse_variable_mac_info()
1126 ext_capa = (u8 *)tlv->val; in qtnf_parse_variable_mac_info()
1131 return -EINVAL; in qtnf_parse_variable_mac_info()
1132 ext_capa_mask = (u8 *)tlv->val; in qtnf_parse_variable_mac_info()
1137 return -EINVAL; in qtnf_parse_variable_mac_info()
1139 wowlan = (void *)tlv->val; in qtnf_parse_variable_mac_info()
1140 if (!le16_to_cpu(wowlan->len)) { in qtnf_parse_variable_mac_info()
1142 mac->macid); in qtnf_parse_variable_mac_info()
1146 rec_len = sizeof(*wowlan) + le16_to_cpu(wowlan->len); in qtnf_parse_variable_mac_info()
1149 mac->macid); in qtnf_parse_variable_mac_info()
1150 return -EINVAL; in qtnf_parse_variable_mac_info()
1153 kfree(mac->macinfo.wowlan); in qtnf_parse_variable_mac_info()
1154 mac->macinfo.wowlan = NULL; in qtnf_parse_variable_mac_info()
1158 if (rule_idx >= resp->n_reg_rules) { in qtnf_parse_variable_mac_info()
1159 pr_warn("unexpected number of rules: %u\n", in qtnf_parse_variable_mac_info()
1160 resp->n_reg_rules); in qtnf_parse_variable_mac_info()
1161 return -EINVAL; in qtnf_parse_variable_mac_info()
1164 if (tlv_value_len != sizeof(*tlv_rule) - sizeof(*tlv)) { in qtnf_parse_variable_mac_info()
1167 return -EINVAL; in qtnf_parse_variable_mac_info()
1171 rule = &mac->rd->reg_rules[rule_idx++]; in qtnf_parse_variable_mac_info()
1176 mac->macid, tlv_type); in qtnf_parse_variable_mac_info()
1181 if (!qlink_tlv_parsing_ok(tlv, resp->var_info, tlv_buf_size)) { in qtnf_parse_variable_mac_info()
1183 return -EINVAL; in qtnf_parse_variable_mac_info()
1186 if (mac->macinfo.n_if_comb != n_comb) { in qtnf_parse_variable_mac_info()
1188 mac->macid, mac->macinfo.n_if_comb, n_comb); in qtnf_parse_variable_mac_info()
1189 return -EINVAL; in qtnf_parse_variable_mac_info()
1194 mac->macid, ext_capa_len, ext_capa_mask_len); in qtnf_parse_variable_mac_info()
1195 return -EINVAL; in qtnf_parse_variable_mac_info()
1198 if (rule_idx != resp->n_reg_rules) { in qtnf_parse_variable_mac_info()
1199 pr_warn("unexpected number of rules: expected %u got %u\n", in qtnf_parse_variable_mac_info()
1200 resp->n_reg_rules, rule_idx); in qtnf_parse_variable_mac_info()
1201 return -EINVAL; in qtnf_parse_variable_mac_info()
1207 return -ENOMEM; in qtnf_parse_variable_mac_info()
1213 return -ENOMEM; in qtnf_parse_variable_mac_info()
1221 mac->macinfo.extended_capabilities = ext_capa; in qtnf_parse_variable_mac_info()
1222 mac->macinfo.extended_capabilities_mask = ext_capa_mask; in qtnf_parse_variable_mac_info()
1223 mac->macinfo.extended_capabilities_len = ext_capa_len; in qtnf_parse_variable_mac_info()
1237 mac_info = &mac->macinfo; in qtnf_cmd_resp_proc_mac_info()
1239 mac_info->bands_cap = resp_info->bands_cap; in qtnf_cmd_resp_proc_mac_info()
1240 ether_addr_copy(mac->macaddr, resp_info->dev_mac); in qtnf_cmd_resp_proc_mac_info()
1244 ether_addr_copy(vif->mac_addr, mac->macaddr); in qtnf_cmd_resp_proc_mac_info()
1248 mac_info->num_tx_chain = resp_info->num_tx_chain; in qtnf_cmd_resp_proc_mac_info()
1249 mac_info->num_rx_chain = resp_info->num_rx_chain; in qtnf_cmd_resp_proc_mac_info()
1251 mac_info->max_ap_assoc_sta = le16_to_cpu(resp_info->max_ap_assoc_sta); in qtnf_cmd_resp_proc_mac_info()
1252 mac_info->radar_detect_widths = in qtnf_cmd_resp_proc_mac_info()
1254 resp_info->radar_detect_widths)); in qtnf_cmd_resp_proc_mac_info()
1255 mac_info->max_acl_mac_addrs = le16_to_cpu(resp_info->max_acl_mac_addrs); in qtnf_cmd_resp_proc_mac_info()
1256 mac_info->frag_thr = le32_to_cpu(resp_info->frag_threshold); in qtnf_cmd_resp_proc_mac_info()
1257 mac_info->rts_thr = le32_to_cpu(resp_info->rts_threshold); in qtnf_cmd_resp_proc_mac_info()
1258 mac_info->sretry_limit = resp_info->retry_short; in qtnf_cmd_resp_proc_mac_info()
1259 mac_info->lretry_limit = resp_info->retry_long; in qtnf_cmd_resp_proc_mac_info()
1260 mac_info->coverage_class = resp_info->coverage_class; in qtnf_cmd_resp_proc_mac_info()
1261 mac_info->max_scan_ssids = resp_info->max_scan_ssids; 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()
1268 mac_info->n_if_comb = resp_info->n_iface_combinations; in qtnf_cmd_resp_proc_mac_info()
1269 mac_info->if_comb = kcalloc(mac->macinfo.n_if_comb, in qtnf_cmd_resp_proc_mac_info()
1270 sizeof(*mac->macinfo.if_comb), in qtnf_cmd_resp_proc_mac_info()
1273 if (!mac->macinfo.if_comb) in qtnf_cmd_resp_proc_mac_info()
1274 return -ENOMEM; in qtnf_cmd_resp_proc_mac_info()
1285 bcap->ht_supported = true; in qtnf_cmd_resp_band_fill_htcap()
1286 bcap->cap = le16_to_cpu(ht_cap->cap_info); in qtnf_cmd_resp_band_fill_htcap()
1287 bcap->ampdu_factor = in qtnf_cmd_resp_band_fill_htcap()
1288 ht_cap->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_FACTOR; in qtnf_cmd_resp_band_fill_htcap()
1289 bcap->ampdu_density = in qtnf_cmd_resp_band_fill_htcap()
1290 (ht_cap->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_DENSITY) >> in qtnf_cmd_resp_band_fill_htcap()
1292 memcpy(&bcap->mcs, &ht_cap->mcs, sizeof(bcap->mcs)); in qtnf_cmd_resp_band_fill_htcap()
1301 bcap->vht_supported = true; in qtnf_cmd_resp_band_fill_vhtcap()
1302 bcap->cap = le32_to_cpu(vht_cap->vht_cap_info); in qtnf_cmd_resp_band_fill_vhtcap()
1303 memcpy(&bcap->vht_mcs, &vht_cap->supp_mcs, sizeof(bcap->vht_mcs)); in qtnf_cmd_resp_band_fill_vhtcap()
1311 iftype_data->types_mask = le16_to_cpu(qlink_data->types_mask); in qtnf_cmd_conv_iftype()
1313 iftype_data->he_cap.has_he = true; in qtnf_cmd_conv_iftype()
1314 memcpy(&iftype_data->he_cap.he_cap_elem, &qlink_data->he_cap_elem, in qtnf_cmd_conv_iftype()
1315 sizeof(qlink_data->he_cap_elem)); in qtnf_cmd_conv_iftype()
1316 memcpy(iftype_data->he_cap.ppe_thres, qlink_data->ppe_thres, in qtnf_cmd_conv_iftype()
1317 ARRAY_SIZE(qlink_data->ppe_thres)); in qtnf_cmd_conv_iftype()
1319 iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_80 = in qtnf_cmd_conv_iftype()
1320 qlink_data->he_mcs_nss_supp.rx_mcs_80; in qtnf_cmd_conv_iftype()
1321 iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_80 = in qtnf_cmd_conv_iftype()
1322 qlink_data->he_mcs_nss_supp.tx_mcs_80; in qtnf_cmd_conv_iftype()
1323 iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_160 = in qtnf_cmd_conv_iftype()
1324 qlink_data->he_mcs_nss_supp.rx_mcs_160; in qtnf_cmd_conv_iftype()
1325 iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_160 = in qtnf_cmd_conv_iftype()
1326 qlink_data->he_mcs_nss_supp.tx_mcs_160; in qtnf_cmd_conv_iftype()
1327 iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_80p80 = in qtnf_cmd_conv_iftype()
1328 qlink_data->he_mcs_nss_supp.rx_mcs_80p80; in qtnf_cmd_conv_iftype()
1329 iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_80p80 = in qtnf_cmd_conv_iftype()
1330 qlink_data->he_mcs_nss_supp.tx_mcs_80p80; in qtnf_cmd_conv_iftype()
1334 struct ieee80211_supported_band *band) in qtnf_cmd_band_fill_iftype() argument
1340 size_t payload_len = tlv->n_iftype_data * sizeof(*tlv->iftype_data) + in qtnf_cmd_band_fill_iftype()
1341 sizeof(*tlv) - in qtnf_cmd_band_fill_iftype()
1344 if (tlv->hdr.len != cpu_to_le16(payload_len)) { in qtnf_cmd_band_fill_iftype()
1345 pr_err("bad IFTYPE_DATA TLV len %u\n", tlv->hdr.len); in qtnf_cmd_band_fill_iftype()
1346 return -EINVAL; in qtnf_cmd_band_fill_iftype()
1349 kfree(band->iftype_data); in qtnf_cmd_band_fill_iftype()
1350 band->iftype_data = NULL; in qtnf_cmd_band_fill_iftype()
1351 band->n_iftype_data = tlv->n_iftype_data; in qtnf_cmd_band_fill_iftype()
1352 if (band->n_iftype_data == 0) in qtnf_cmd_band_fill_iftype()
1355 iftype_data = kcalloc(band->n_iftype_data, sizeof(*iftype_data), in qtnf_cmd_band_fill_iftype()
1358 band->n_iftype_data = 0; in qtnf_cmd_band_fill_iftype()
1359 return -ENOMEM; in qtnf_cmd_band_fill_iftype()
1361 band->iftype_data = iftype_data; in qtnf_cmd_band_fill_iftype()
1363 for (i = 0; i < band->n_iftype_data; i++) in qtnf_cmd_band_fill_iftype()
1364 qtnf_cmd_conv_iftype(iftype_data++, &tlv->iftype_data[i]); in qtnf_cmd_band_fill_iftype()
1370 qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, in qtnf_cmd_resp_fill_band_info() argument
1381 int ret = -EINVAL; in qtnf_cmd_resp_fill_band_info()
1383 memset(&band->ht_cap, 0, sizeof(band->ht_cap)); in qtnf_cmd_resp_fill_band_info()
1384 memset(&band->vht_cap, 0, sizeof(band->vht_cap)); in qtnf_cmd_resp_fill_band_info()
1386 if (band->channels) { in qtnf_cmd_resp_fill_band_info()
1387 if (band->n_channels == resp->num_chans) { in qtnf_cmd_resp_fill_band_info()
1388 memset(band->channels, 0, in qtnf_cmd_resp_fill_band_info()
1389 sizeof(*band->channels) * band->n_channels); in qtnf_cmd_resp_fill_band_info()
1391 kfree(band->channels); in qtnf_cmd_resp_fill_band_info()
1392 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1393 band->channels = NULL; in qtnf_cmd_resp_fill_band_info()
1397 band->n_channels = resp->num_chans; in qtnf_cmd_resp_fill_band_info()
1398 if (band->n_channels == 0) in qtnf_cmd_resp_fill_band_info()
1401 if (!band->channels) in qtnf_cmd_resp_fill_band_info()
1402 band->channels = kcalloc(band->n_channels, sizeof(*chan), in qtnf_cmd_resp_fill_band_info()
1404 if (!band->channels) { in qtnf_cmd_resp_fill_band_info()
1405 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1406 return -ENOMEM; in qtnf_cmd_resp_fill_band_info()
1409 qlink_for_each_tlv(tlv, resp->info, payload_len) { in qtnf_cmd_resp_fill_band_info()
1410 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_fill_band_info()
1411 tlv_dlen = le16_to_cpu(tlv->len); in qtnf_cmd_resp_fill_band_info()
1421 if (chidx == band->n_channels) { in qtnf_cmd_resp_fill_band_info()
1426 qchan = (const struct qlink_channel *)tlv->val; in qtnf_cmd_resp_fill_band_info()
1427 chan = &band->channels[chidx++]; in qtnf_cmd_resp_fill_band_info()
1428 qflags = le32_to_cpu(qchan->flags); in qtnf_cmd_resp_fill_band_info()
1430 chan->hw_value = le16_to_cpu(qchan->hw_value); in qtnf_cmd_resp_fill_band_info()
1431 chan->band = band->band; in qtnf_cmd_resp_fill_band_info()
1432 chan->center_freq = le16_to_cpu(qchan->center_freq); in qtnf_cmd_resp_fill_band_info()
1433 chan->max_antenna_gain = (int)qchan->max_antenna_gain; in qtnf_cmd_resp_fill_band_info()
1434 chan->max_power = (int)qchan->max_power; in qtnf_cmd_resp_fill_band_info()
1435 chan->max_reg_power = (int)qchan->max_reg_power; in qtnf_cmd_resp_fill_band_info()
1436 chan->beacon_found = qchan->beacon_found; in qtnf_cmd_resp_fill_band_info()
1437 chan->dfs_cac_ms = le32_to_cpu(qchan->dfs_cac_ms); in qtnf_cmd_resp_fill_band_info()
1438 chan->flags = 0; in qtnf_cmd_resp_fill_band_info()
1441 chan->flags |= IEEE80211_CHAN_DISABLED; in qtnf_cmd_resp_fill_band_info()
1444 chan->flags |= IEEE80211_CHAN_NO_IR; in qtnf_cmd_resp_fill_band_info()
1447 chan->flags |= IEEE80211_CHAN_NO_HT40PLUS; in qtnf_cmd_resp_fill_band_info()
1450 chan->flags |= IEEE80211_CHAN_NO_HT40MINUS; in qtnf_cmd_resp_fill_band_info()
1453 chan->flags |= IEEE80211_CHAN_NO_OFDM; in qtnf_cmd_resp_fill_band_info()
1456 chan->flags |= IEEE80211_CHAN_NO_80MHZ; in qtnf_cmd_resp_fill_band_info()
1459 chan->flags |= IEEE80211_CHAN_NO_160MHZ; in qtnf_cmd_resp_fill_band_info()
1462 chan->flags |= IEEE80211_CHAN_INDOOR_ONLY; in qtnf_cmd_resp_fill_band_info()
1465 chan->flags |= IEEE80211_CHAN_IR_CONCURRENT; in qtnf_cmd_resp_fill_band_info()
1468 chan->flags |= IEEE80211_CHAN_NO_20MHZ; in qtnf_cmd_resp_fill_band_info()
1471 chan->flags |= IEEE80211_CHAN_NO_10MHZ; in qtnf_cmd_resp_fill_band_info()
1474 chan->flags |= IEEE80211_CHAN_RADAR; in qtnf_cmd_resp_fill_band_info()
1475 chan->dfs_state_entered = jiffies; in qtnf_cmd_resp_fill_band_info()
1477 if (qchan->dfs_state == QLINK_DFS_USABLE) in qtnf_cmd_resp_fill_band_info()
1478 chan->dfs_state = NL80211_DFS_USABLE; in qtnf_cmd_resp_fill_band_info()
1479 else if (qchan->dfs_state == in qtnf_cmd_resp_fill_band_info()
1481 chan->dfs_state = NL80211_DFS_AVAILABLE; in qtnf_cmd_resp_fill_band_info()
1483 chan->dfs_state = in qtnf_cmd_resp_fill_band_info()
1488 chan->hw_value, chan->flags, chan->max_power, in qtnf_cmd_resp_fill_band_info()
1489 chan->max_reg_power); in qtnf_cmd_resp_fill_band_info()
1498 qtnf_cmd_resp_band_fill_htcap(tlv->val, &band->ht_cap); in qtnf_cmd_resp_fill_band_info()
1507 qtnf_cmd_resp_band_fill_vhtcap(tlv->val, in qtnf_cmd_resp_fill_band_info()
1508 &band->vht_cap); in qtnf_cmd_resp_fill_band_info()
1512 band); in qtnf_cmd_resp_fill_band_info()
1522 if (!qlink_tlv_parsing_ok(tlv, resp->info, payload_len)) { in qtnf_cmd_resp_fill_band_info()
1527 if (band->n_channels != chidx) { in qtnf_cmd_resp_fill_band_info()
1529 band->n_channels, chidx); in qtnf_cmd_resp_fill_band_info()
1536 kfree(band->channels); in qtnf_cmd_resp_fill_band_info()
1537 band->channels = NULL; in qtnf_cmd_resp_fill_band_info()
1538 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1550 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_get_mac_info()
1554 return -ENOMEM; in qtnf_cmd_get_mac_info()
1556 qtnf_bus_lock(mac->bus); in qtnf_cmd_get_mac_info()
1557 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_mac_info()
1560 goto out; in qtnf_cmd_get_mac_info()
1562 resp = (const struct qlink_resp_get_mac_info *)resp_skb->data; in qtnf_cmd_get_mac_info()
1565 goto out; in qtnf_cmd_get_mac_info()
1569 out: in qtnf_cmd_get_mac_info()
1570 qtnf_bus_unlock(mac->bus); in qtnf_cmd_get_mac_info()
1587 return -ENOMEM; in qtnf_cmd_get_hw_info()
1593 goto out; in qtnf_cmd_get_hw_info()
1595 resp = (const struct qlink_resp_get_hw_info *)resp_skb->data; in qtnf_cmd_get_hw_info()
1598 out: in qtnf_cmd_get_hw_info()
1606 struct ieee80211_supported_band *band) in qtnf_cmd_band_info_get() argument
1613 u8 qband = qlink_utils_band_cfg2q(band->band); in qtnf_cmd_band_info_get()
1615 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_band_info_get()
1619 return -ENOMEM; in qtnf_cmd_band_info_get()
1621 cmd = (struct qlink_cmd_band_info_get *)cmd_skb->data; in qtnf_cmd_band_info_get()
1622 cmd->band = qband; in qtnf_cmd_band_info_get()
1624 qtnf_bus_lock(mac->bus); in qtnf_cmd_band_info_get()
1625 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_band_info_get()
1628 goto out; in qtnf_cmd_band_info_get()
1630 resp = (struct qlink_resp_band_info_get *)resp_skb->data; in qtnf_cmd_band_info_get()
1631 if (resp->band != qband) { in qtnf_cmd_band_info_get()
1632 pr_err("MAC%u: reply band %u != cmd band %u\n", mac->macid, in qtnf_cmd_band_info_get()
1633 resp->band, qband); in qtnf_cmd_band_info_get()
1634 ret = -EINVAL; in qtnf_cmd_band_info_get()
1635 goto out; in qtnf_cmd_band_info_get()
1638 ret = qtnf_cmd_resp_fill_band_info(band, resp, info_len); in qtnf_cmd_band_info_get()
1640 out: in qtnf_cmd_band_info_get()
1641 qtnf_bus_unlock(mac->bus); in qtnf_cmd_band_info_get()
1653 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_send_update_phy_params()
1657 return -ENOMEM; in qtnf_cmd_send_update_phy_params()
1659 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_update_phy_params()
1663 wiphy->frag_threshold); in qtnf_cmd_send_update_phy_params()
1666 wiphy->rts_threshold); in qtnf_cmd_send_update_phy_params()
1669 wiphy->coverage_class); in qtnf_cmd_send_update_phy_params()
1673 wiphy->retry_long); in qtnf_cmd_send_update_phy_params()
1677 wiphy->retry_short); in qtnf_cmd_send_update_phy_params()
1679 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_update_phy_params()
1681 goto out; in qtnf_cmd_send_update_phy_params()
1683 out: in qtnf_cmd_send_update_phy_params()
1684 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_update_phy_params()
1702 return -ENOMEM; in qtnf_cmd_send_init_fw()
1704 cmd = (struct qlink_cmd_init_fw *)cmd_skb->data; in qtnf_cmd_send_init_fw()
1705 cmd->qlink_proto_ver = cpu_to_le32(QLINK_PROTO_VER); in qtnf_cmd_send_init_fw()
1713 goto out; in qtnf_cmd_send_init_fw()
1715 resp = (struct qlink_resp_init_fw *)resp_skb->data; in qtnf_cmd_send_init_fw()
1716 bus->hw_info.ql_proto_ver = le32_to_cpu(resp->qlink_proto_ver); in qtnf_cmd_send_init_fw()
1718 out: in qtnf_cmd_send_init_fw()
1745 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_add_key()
1749 return -ENOMEM; in qtnf_cmd_send_add_key()
1751 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_add_key()
1753 cmd = (struct qlink_cmd_add_key *)cmd_skb->data; in qtnf_cmd_send_add_key()
1756 ether_addr_copy(cmd->addr, mac_addr); in qtnf_cmd_send_add_key()
1758 eth_broadcast_addr(cmd->addr); in qtnf_cmd_send_add_key()
1760 cmd->cipher = cpu_to_le32(params->cipher); in qtnf_cmd_send_add_key()
1761 cmd->key_index = key_index; in qtnf_cmd_send_add_key()
1762 cmd->pairwise = pairwise; in qtnf_cmd_send_add_key()
1764 if (params->key && params->key_len > 0) in qtnf_cmd_send_add_key()
1766 params->key, in qtnf_cmd_send_add_key()
1767 params->key_len); in qtnf_cmd_send_add_key()
1769 if (params->seq && params->seq_len > 0) in qtnf_cmd_send_add_key()
1771 params->seq, in qtnf_cmd_send_add_key()
1772 params->seq_len); in qtnf_cmd_send_add_key()
1774 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_add_key()
1776 goto out; in qtnf_cmd_send_add_key()
1778 out: in qtnf_cmd_send_add_key()
1779 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_add_key()
1791 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_key()
1795 return -ENOMEM; in qtnf_cmd_send_del_key()
1797 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_key()
1799 cmd = (struct qlink_cmd_del_key *)cmd_skb->data; in qtnf_cmd_send_del_key()
1802 ether_addr_copy(cmd->addr, mac_addr); in qtnf_cmd_send_del_key()
1804 eth_broadcast_addr(cmd->addr); in qtnf_cmd_send_del_key()
1806 cmd->key_index = key_index; in qtnf_cmd_send_del_key()
1807 cmd->pairwise = pairwise; in qtnf_cmd_send_del_key()
1809 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_key()
1811 goto out; in qtnf_cmd_send_del_key()
1813 out: in qtnf_cmd_send_del_key()
1814 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_key()
1826 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_set_default_key()
1830 return -ENOMEM; in qtnf_cmd_send_set_default_key()
1832 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_set_default_key()
1834 cmd = (struct qlink_cmd_set_def_key *)cmd_skb->data; in qtnf_cmd_send_set_default_key()
1835 cmd->key_index = key_index; in qtnf_cmd_send_set_default_key()
1836 cmd->unicast = unicast; in qtnf_cmd_send_set_default_key()
1837 cmd->multicast = multicast; in qtnf_cmd_send_set_default_key()
1839 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_set_default_key()
1841 goto out; in qtnf_cmd_send_set_default_key()
1843 out: in qtnf_cmd_send_set_default_key()
1844 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_set_default_key()
1855 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_set_default_mgmt_key()
1859 return -ENOMEM; in qtnf_cmd_send_set_default_mgmt_key()
1861 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_set_default_mgmt_key()
1863 cmd = (struct qlink_cmd_set_def_mgmt_key *)cmd_skb->data; in qtnf_cmd_send_set_default_mgmt_key()
1864 cmd->key_index = key_index; in qtnf_cmd_send_set_default_mgmt_key()
1866 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_set_default_mgmt_key()
1868 goto out; in qtnf_cmd_send_set_default_mgmt_key()
1870 out: in qtnf_cmd_send_set_default_mgmt_key()
1871 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_set_default_mgmt_key()
1904 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_change_sta()
1908 return -ENOMEM; in qtnf_cmd_send_change_sta()
1910 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_change_sta()
1912 cmd = (struct qlink_cmd_change_sta *)cmd_skb->data; in qtnf_cmd_send_change_sta()
1913 ether_addr_copy(cmd->sta_addr, mac); in qtnf_cmd_send_change_sta()
1914 cmd->flag_update.mask = in qtnf_cmd_send_change_sta()
1915 cpu_to_le32(qtnf_encode_sta_flags(params->sta_flags_mask)); in qtnf_cmd_send_change_sta()
1916 cmd->flag_update.value = in qtnf_cmd_send_change_sta()
1917 cpu_to_le32(qtnf_encode_sta_flags(params->sta_flags_set)); in qtnf_cmd_send_change_sta()
1919 switch (vif->wdev.iftype) { in qtnf_cmd_send_change_sta()
1921 cmd->if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_change_sta()
1924 cmd->if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_change_sta()
1927 pr_err("unsupported iftype %d\n", vif->wdev.iftype); in qtnf_cmd_send_change_sta()
1929 ret = -EINVAL; in qtnf_cmd_send_change_sta()
1930 goto out; in qtnf_cmd_send_change_sta()
1933 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_change_sta()
1935 goto out; in qtnf_cmd_send_change_sta()
1937 out: in qtnf_cmd_send_change_sta()
1938 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_change_sta()
1950 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_sta()
1954 return -ENOMEM; in qtnf_cmd_send_del_sta()
1956 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_sta()
1958 cmd = (struct qlink_cmd_del_sta *)cmd_skb->data; in qtnf_cmd_send_del_sta()
1960 if (params->mac) in qtnf_cmd_send_del_sta()
1961 ether_addr_copy(cmd->sta_addr, params->mac); in qtnf_cmd_send_del_sta()
1963 eth_broadcast_addr(cmd->sta_addr); /* flush all stations */ in qtnf_cmd_send_del_sta()
1965 cmd->subtype = params->subtype; in qtnf_cmd_send_del_sta()
1966 cmd->reason_code = cpu_to_le16(params->reason_code); in qtnf_cmd_send_del_sta()
1968 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_sta()
1970 goto out; in qtnf_cmd_send_del_sta()
1972 out: in qtnf_cmd_send_del_sta()
1973 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_sta()
1985 qch = &tlv->chan; in qtnf_cmd_channel_tlv_add()
1986 tlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL); in qtnf_cmd_channel_tlv_add()
1987 tlv->hdr.len = cpu_to_le16(sizeof(*qch)); in qtnf_cmd_channel_tlv_add()
1989 qch->center_freq = cpu_to_le16(sc->center_freq); in qtnf_cmd_channel_tlv_add()
1990 qch->hw_value = cpu_to_le16(sc->hw_value); in qtnf_cmd_channel_tlv_add()
1991 qch->band = qlink_utils_band_cfg2q(sc->band); in qtnf_cmd_channel_tlv_add()
1992 qch->max_power = sc->max_power; in qtnf_cmd_channel_tlv_add()
1993 qch->max_reg_power = sc->max_reg_power; in qtnf_cmd_channel_tlv_add()
1994 qch->max_antenna_gain = sc->max_antenna_gain; in qtnf_cmd_channel_tlv_add()
1995 qch->beacon_found = sc->beacon_found; in qtnf_cmd_channel_tlv_add()
1996 qch->dfs_state = qlink_utils_dfs_state_cfg2q(sc->dfs_state); in qtnf_cmd_channel_tlv_add()
1997 qch->flags = cpu_to_le32(qlink_utils_chflags_cfg2q(sc->flags)); in qtnf_cmd_channel_tlv_add()
2008 hdr->type = cpu_to_le16(QTN_TLV_ID_RANDOM_MAC_ADDR); in qtnf_cmd_randmac_tlv_add()
2009 hdr->len = cpu_to_le16(sizeof(*randmac)); in qtnf_cmd_randmac_tlv_add()
2010 randmac = (struct qlink_random_mac_addr *)hdr->val; in qtnf_cmd_randmac_tlv_add()
2012 memcpy(randmac->mac_addr, mac_addr, ETH_ALEN); in qtnf_cmd_randmac_tlv_add()
2013 memcpy(randmac->mac_addr_mask, mac_addr_mask, ETH_ALEN); in qtnf_cmd_randmac_tlv_add()
2018 struct cfg80211_scan_request *scan_req = mac->scan_req; in qtnf_cmd_send_scan()
2021 struct wireless_dev *wdev = scan_req->wdev; in qtnf_cmd_send_scan()
2030 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_send_scan()
2034 return -ENOMEM; in qtnf_cmd_send_scan()
2036 cmd = (struct qlink_cmd_scan *)cmd_skb->data; in qtnf_cmd_send_scan()
2038 if (scan_req->duration) { in qtnf_cmd_send_scan()
2039 dwell_active = scan_req->duration; in qtnf_cmd_send_scan()
2040 dwell_passive = scan_req->duration; in qtnf_cmd_send_scan()
2041 } else if (wdev->iftype == NL80211_IFTYPE_STATION && in qtnf_cmd_send_scan()
2042 wdev->current_bss) { in qtnf_cmd_send_scan()
2048 cmd->n_ssids = cpu_to_le16(scan_req->n_ssids); in qtnf_cmd_send_scan()
2049 for (count = 0; count < scan_req->n_ssids; ++count) { in qtnf_cmd_send_scan()
2051 scan_req->ssids[count].ssid, in qtnf_cmd_send_scan()
2052 scan_req->ssids[count].ssid_len); in qtnf_cmd_send_scan()
2055 if (scan_req->ie_len != 0) in qtnf_cmd_send_scan()
2057 scan_req->ie, scan_req->ie_len); in qtnf_cmd_send_scan()
2059 for (count = 0; count < scan_req->n_channels; ++count) { in qtnf_cmd_send_scan()
2060 sc = scan_req->channels[count]; in qtnf_cmd_send_scan()
2061 if (sc->flags & IEEE80211_CHAN_DISABLED) in qtnf_cmd_send_scan()
2065 mac->macid, sc->hw_value, sc->center_freq, in qtnf_cmd_send_scan()
2066 sc->flags); in qtnf_cmd_send_scan()
2072 if (scan_req->flags & NL80211_SCAN_FLAG_FLUSH) in qtnf_cmd_send_scan()
2075 if (scan_req->duration_mandatory) in qtnf_cmd_send_scan()
2078 cmd->n_channels = cpu_to_le16(n_channels); in qtnf_cmd_send_scan()
2079 cmd->active_dwell = cpu_to_le16(dwell_active); in qtnf_cmd_send_scan()
2080 cmd->passive_dwell = cpu_to_le16(dwell_passive); in qtnf_cmd_send_scan()
2081 cmd->sample_duration = cpu_to_le16(QTNF_SCAN_SAMPLE_DURATION_DEFAULT); in qtnf_cmd_send_scan()
2082 cmd->flags = cpu_to_le64(flags); in qtnf_cmd_send_scan()
2085 mac->macid, in qtnf_cmd_send_scan()
2086 scan_req->duration_mandatory ? "mandatory" : "max", in qtnf_cmd_send_scan()
2090 if (scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in qtnf_cmd_send_scan()
2092 mac->macid, in qtnf_cmd_send_scan()
2093 scan_req->mac_addr, scan_req->mac_addr_mask); in qtnf_cmd_send_scan()
2094 qtnf_cmd_randmac_tlv_add(cmd_skb, scan_req->mac_addr, in qtnf_cmd_send_scan()
2095 scan_req->mac_addr_mask); in qtnf_cmd_send_scan()
2098 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_scan()
2099 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_scan()
2100 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_scan()
2115 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_connect()
2119 return -ENOMEM; in qtnf_cmd_send_connect()
2121 cmd = (struct qlink_cmd_connect *)cmd_skb->data; in qtnf_cmd_send_connect()
2123 ether_addr_copy(cmd->bssid, vif->bssid); in qtnf_cmd_send_connect()
2125 if (sme->bssid_hint) in qtnf_cmd_send_connect()
2126 ether_addr_copy(cmd->bssid_hint, sme->bssid_hint); in qtnf_cmd_send_connect()
2128 eth_zero_addr(cmd->bssid_hint); in qtnf_cmd_send_connect()
2130 if (sme->prev_bssid) in qtnf_cmd_send_connect()
2131 ether_addr_copy(cmd->prev_bssid, sme->prev_bssid); in qtnf_cmd_send_connect()
2133 eth_zero_addr(cmd->prev_bssid); in qtnf_cmd_send_connect()
2135 if ((sme->bg_scan_period >= 0) && in qtnf_cmd_send_connect()
2136 (sme->bg_scan_period <= SHRT_MAX)) in qtnf_cmd_send_connect()
2137 cmd->bg_scan_period = cpu_to_le16(sme->bg_scan_period); in qtnf_cmd_send_connect()
2139 cmd->bg_scan_period = cpu_to_le16(-1); /* use default value */ in qtnf_cmd_send_connect()
2141 if (sme->flags & ASSOC_REQ_DISABLE_HT) in qtnf_cmd_send_connect()
2143 if (sme->flags & ASSOC_REQ_DISABLE_VHT) in qtnf_cmd_send_connect()
2145 if (sme->flags & ASSOC_REQ_USE_RRM) in qtnf_cmd_send_connect()
2148 cmd->flags = cpu_to_le32(connect_flags); in qtnf_cmd_send_connect()
2149 memcpy(&cmd->ht_capa, &sme->ht_capa, sizeof(cmd->ht_capa)); in qtnf_cmd_send_connect()
2150 memcpy(&cmd->ht_capa_mask, &sme->ht_capa_mask, in qtnf_cmd_send_connect()
2151 sizeof(cmd->ht_capa_mask)); in qtnf_cmd_send_connect()
2152 memcpy(&cmd->vht_capa, &sme->vht_capa, sizeof(cmd->vht_capa)); in qtnf_cmd_send_connect()
2153 memcpy(&cmd->vht_capa_mask, &sme->vht_capa_mask, in qtnf_cmd_send_connect()
2154 sizeof(cmd->vht_capa_mask)); in qtnf_cmd_send_connect()
2155 cmd->pbss = sme->pbss; in qtnf_cmd_send_connect()
2157 aen = &cmd->aen; in qtnf_cmd_send_connect()
2158 aen->auth_type = sme->auth_type; in qtnf_cmd_send_connect()
2159 aen->privacy = !!sme->privacy; in qtnf_cmd_send_connect()
2160 cmd->mfp = sme->mfp; in qtnf_cmd_send_connect()
2161 aen->wpa_versions = cpu_to_le32(sme->crypto.wpa_versions); in qtnf_cmd_send_connect()
2162 aen->cipher_group = cpu_to_le32(sme->crypto.cipher_group); in qtnf_cmd_send_connect()
2163 aen->n_ciphers_pairwise = cpu_to_le32(sme->crypto.n_ciphers_pairwise); in qtnf_cmd_send_connect()
2166 aen->ciphers_pairwise[i] = in qtnf_cmd_send_connect()
2167 cpu_to_le32(sme->crypto.ciphers_pairwise[i]); in qtnf_cmd_send_connect()
2169 aen->n_akm_suites = cpu_to_le32(sme->crypto.n_akm_suites); in qtnf_cmd_send_connect()
2172 aen->akm_suites[i] = cpu_to_le32(sme->crypto.akm_suites[i]); in qtnf_cmd_send_connect()
2174 aen->control_port = sme->crypto.control_port; in qtnf_cmd_send_connect()
2175 aen->control_port_no_encrypt = in qtnf_cmd_send_connect()
2176 sme->crypto.control_port_no_encrypt; in qtnf_cmd_send_connect()
2177 aen->control_port_ethertype = in qtnf_cmd_send_connect()
2178 cpu_to_le16(be16_to_cpu(sme->crypto.control_port_ethertype)); in qtnf_cmd_send_connect()
2180 qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, sme->ssid, in qtnf_cmd_send_connect()
2181 sme->ssid_len); in qtnf_cmd_send_connect()
2183 if (sme->ie_len != 0) in qtnf_cmd_send_connect()
2185 sme->ie, sme->ie_len); in qtnf_cmd_send_connect()
2187 if (sme->channel) in qtnf_cmd_send_connect()
2188 qtnf_cmd_channel_tlv_add(cmd_skb, sme->channel); in qtnf_cmd_send_connect()
2190 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_connect()
2191 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_connect()
2193 goto out; in qtnf_cmd_send_connect()
2195 out: in qtnf_cmd_send_connect()
2196 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_connect()
2208 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_external_auth()
2212 return -ENOMEM; in qtnf_cmd_send_external_auth()
2214 cmd = (struct qlink_cmd_external_auth *)cmd_skb->data; in qtnf_cmd_send_external_auth()
2216 ether_addr_copy(cmd->peer, auth->bssid); in qtnf_cmd_send_external_auth()
2217 cmd->status = cpu_to_le16(auth->status); in qtnf_cmd_send_external_auth()
2219 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_external_auth()
2220 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_external_auth()
2222 goto out; in qtnf_cmd_send_external_auth()
2224 out: in qtnf_cmd_send_external_auth()
2225 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_external_auth()
2236 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_disconnect()
2240 return -ENOMEM; in qtnf_cmd_send_disconnect()
2242 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_disconnect()
2244 cmd = (struct qlink_cmd_disconnect *)cmd_skb->data; in qtnf_cmd_send_disconnect()
2245 cmd->reason = cpu_to_le16(reason_code); in qtnf_cmd_send_disconnect()
2247 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_disconnect()
2249 goto out; in qtnf_cmd_send_disconnect()
2251 out: in qtnf_cmd_send_disconnect()
2252 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_disconnect()
2263 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_updown_intf()
2267 return -ENOMEM; in qtnf_cmd_send_updown_intf()
2269 cmd = (struct qlink_cmd_updown *)cmd_skb->data; in qtnf_cmd_send_updown_intf()
2270 cmd->if_up = !!up; in qtnf_cmd_send_updown_intf()
2272 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_updown_intf()
2273 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_updown_intf()
2275 goto out; in qtnf_cmd_send_updown_intf()
2277 out: in qtnf_cmd_send_updown_intf()
2278 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_updown_intf()
2287 struct qtnf_bus *bus = mac->bus; in qtnf_cmd_reg_notify()
2291 enum nl80211_band band; in qtnf_cmd_reg_notify() local
2294 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_reg_notify()
2298 return -ENOMEM; in qtnf_cmd_reg_notify()
2300 cmd = (struct qlink_cmd_reg_notify *)cmd_skb->data; in qtnf_cmd_reg_notify()
2301 cmd->alpha2[0] = req->alpha2[0]; in qtnf_cmd_reg_notify()
2302 cmd->alpha2[1] = req->alpha2[1]; in qtnf_cmd_reg_notify()
2304 switch (req->initiator) { in qtnf_cmd_reg_notify()
2306 cmd->initiator = QLINK_REGDOM_SET_BY_CORE; in qtnf_cmd_reg_notify()
2309 cmd->initiator = QLINK_REGDOM_SET_BY_USER; in qtnf_cmd_reg_notify()
2312 cmd->initiator = QLINK_REGDOM_SET_BY_DRIVER; in qtnf_cmd_reg_notify()
2315 cmd->initiator = QLINK_REGDOM_SET_BY_COUNTRY_IE; in qtnf_cmd_reg_notify()
2319 switch (req->user_reg_hint_type) { in qtnf_cmd_reg_notify()
2321 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_USER; in qtnf_cmd_reg_notify()
2324 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_CELL_BASE; in qtnf_cmd_reg_notify()
2327 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_INDOOR; in qtnf_cmd_reg_notify()
2331 switch (req->dfs_region) { in qtnf_cmd_reg_notify()
2333 cmd->dfs_region = QLINK_DFS_FCC; in qtnf_cmd_reg_notify()
2336 cmd->dfs_region = QLINK_DFS_ETSI; in qtnf_cmd_reg_notify()
2339 cmd->dfs_region = QLINK_DFS_JP; in qtnf_cmd_reg_notify()
2342 cmd->dfs_region = QLINK_DFS_UNSET; in qtnf_cmd_reg_notify()
2346 cmd->slave_radar = slave_radar; in qtnf_cmd_reg_notify()
2347 cmd->dfs_offload = dfs_offload; in qtnf_cmd_reg_notify()
2348 cmd->num_channels = 0; in qtnf_cmd_reg_notify()
2350 for (band = 0; band < NUM_NL80211_BANDS; band++) { in qtnf_cmd_reg_notify()
2353 cfg_band = wiphy->bands[band]; in qtnf_cmd_reg_notify()
2357 cmd->num_channels += cfg_band->n_channels; in qtnf_cmd_reg_notify()
2359 for (i = 0; i < cfg_band->n_channels; ++i) { in qtnf_cmd_reg_notify()
2361 &cfg_band->channels[i]); in qtnf_cmd_reg_notify()
2385 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_proc_chan_stat_info()
2386 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_cmd_resp_proc_chan_stat_info()
2390 map = tlv->val; in qtnf_cmd_resp_proc_chan_stat_info()
2394 stats = (struct qlink_chan_stats *)tlv->val; in qtnf_cmd_resp_proc_chan_stat_info()
2405 return -EINVAL; in qtnf_cmd_resp_proc_chan_stat_info()
2416 survey->filled |= SURVEY_INFO_TIME; in qtnf_cmd_resp_proc_chan_stat_info()
2417 survey->time = le64_to_cpu(stats->time_on); in qtnf_cmd_resp_proc_chan_stat_info()
2421 survey->filled |= SURVEY_INFO_TIME_TX; in qtnf_cmd_resp_proc_chan_stat_info()
2422 survey->time_tx = le64_to_cpu(stats->time_tx); in qtnf_cmd_resp_proc_chan_stat_info()
2426 survey->filled |= SURVEY_INFO_TIME_RX; in qtnf_cmd_resp_proc_chan_stat_info()
2427 survey->time_rx = le64_to_cpu(stats->time_rx); in qtnf_cmd_resp_proc_chan_stat_info()
2431 survey->filled |= SURVEY_INFO_TIME_BUSY; in qtnf_cmd_resp_proc_chan_stat_info()
2432 survey->time_busy = le64_to_cpu(stats->cca_busy); in qtnf_cmd_resp_proc_chan_stat_info()
2436 survey->filled |= SURVEY_INFO_TIME_EXT_BUSY; in qtnf_cmd_resp_proc_chan_stat_info()
2437 survey->time_ext_busy = le64_to_cpu(stats->cca_busy_ext); in qtnf_cmd_resp_proc_chan_stat_info()
2441 survey->filled |= SURVEY_INFO_TIME_SCAN; in qtnf_cmd_resp_proc_chan_stat_info()
2442 survey->time_scan = le64_to_cpu(stats->time_scan); in qtnf_cmd_resp_proc_chan_stat_info()
2446 survey->filled |= SURVEY_INFO_NOISE_DBM; in qtnf_cmd_resp_proc_chan_stat_info()
2447 survey->noise = stats->chan_noise; in qtnf_cmd_resp_proc_chan_stat_info()
2464 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_get_chan_stats()
2468 return -ENOMEM; in qtnf_cmd_get_chan_stats()
2470 cmd = (struct qlink_cmd_get_chan_stats *)cmd_skb->data; in qtnf_cmd_get_chan_stats()
2471 cmd->channel_freq = cpu_to_le32(chan_freq); in qtnf_cmd_get_chan_stats()
2473 qtnf_bus_lock(mac->bus); in qtnf_cmd_get_chan_stats()
2474 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_chan_stats()
2476 qtnf_bus_unlock(mac->bus); in qtnf_cmd_get_chan_stats()
2479 goto out; in qtnf_cmd_get_chan_stats()
2481 resp = (struct qlink_resp_get_chan_stats *)resp_skb->data; in qtnf_cmd_get_chan_stats()
2483 if (le32_to_cpu(resp->chan_freq) != chan_freq) { in qtnf_cmd_get_chan_stats()
2485 mac->macid, le32_to_cpu(resp->chan_freq), chan_freq); in qtnf_cmd_get_chan_stats()
2486 ret = -EINVAL; in qtnf_cmd_get_chan_stats()
2487 goto out; in qtnf_cmd_get_chan_stats()
2490 ret = qtnf_cmd_resp_proc_chan_stat_info(survey, resp->info, in qtnf_cmd_get_chan_stats()
2493 out: in qtnf_cmd_get_chan_stats()
2502 struct qtnf_wmac *mac = vif->mac; in qtnf_cmd_send_chan_switch()
2508 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, vif->vifid, in qtnf_cmd_send_chan_switch()
2512 return -ENOMEM; in qtnf_cmd_send_chan_switch()
2514 if (params->radar_required) in qtnf_cmd_send_chan_switch()
2517 if (params->block_tx) in qtnf_cmd_send_chan_switch()
2520 cmd = (struct qlink_cmd_chan_switch *)cmd_skb->data; in qtnf_cmd_send_chan_switch()
2521 qlink_chandef_cfg2q(¶ms->chandef, &cmd->channel); in qtnf_cmd_send_chan_switch()
2522 cmd->flags = cpu_to_le64(flags); in qtnf_cmd_send_chan_switch()
2523 cmd->beacon_count = params->count; in qtnf_cmd_send_chan_switch()
2525 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_chan_switch()
2526 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_chan_switch()
2527 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_chan_switch()
2534 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_get_channel()
2540 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_channel()
2544 return -ENOMEM; in qtnf_cmd_get_channel()
2550 goto out; in qtnf_cmd_get_channel()
2552 resp = (const struct qlink_resp_channel_get *)resp_skb->data; in qtnf_cmd_get_channel()
2553 qlink_chandef_q2cfg(priv_to_wiphy(vif->mac), &resp->chan, chdef); in qtnf_cmd_get_channel()
2555 out: in qtnf_cmd_get_channel()
2566 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_start_cac()
2571 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_start_cac()
2575 return -ENOMEM; in qtnf_cmd_start_cac()
2577 cmd = (struct qlink_cmd_start_cac *)cmd_skb->data; in qtnf_cmd_start_cac()
2578 cmd->cac_time_ms = cpu_to_le32(cac_time_ms); in qtnf_cmd_start_cac()
2579 qlink_chandef_cfg2q(chdef, &cmd->chan); in qtnf_cmd_start_cac()
2584 goto out; in qtnf_cmd_start_cac()
2586 out: in qtnf_cmd_start_cac()
2595 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_set_mac_acl()
2598 size_t acl_size = struct_size(params, mac_addrs, params->n_acl_entries); in qtnf_cmd_set_mac_acl()
2601 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_set_mac_acl()
2605 return -ENOMEM; in qtnf_cmd_set_mac_acl()
2608 tlv->type = cpu_to_le16(QTN_TLV_ID_ACL_DATA); in qtnf_cmd_set_mac_acl()
2609 tlv->len = cpu_to_le16(acl_size); in qtnf_cmd_set_mac_acl()
2610 qlink_acl_data_cfg2q(params, (struct qlink_acl_data *)tlv->val); in qtnf_cmd_set_mac_acl()
2615 goto out; in qtnf_cmd_set_mac_acl()
2617 out: in qtnf_cmd_set_mac_acl()
2625 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_send_pm_set()
2630 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_pm_set()
2633 return -ENOMEM; in qtnf_cmd_send_pm_set()
2635 cmd = (struct qlink_cmd_pm_set *)cmd_skb->data; in qtnf_cmd_send_pm_set()
2636 cmd->pm_mode = pm_mode; in qtnf_cmd_send_pm_set()
2637 cmd->pm_standby_timer = cpu_to_le32(timeout); in qtnf_cmd_send_pm_set()
2643 goto out; in qtnf_cmd_send_pm_set()
2645 out: in qtnf_cmd_send_pm_set()
2653 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_get_tx_power()
2660 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_tx_power()
2663 return -ENOMEM; in qtnf_cmd_get_tx_power()
2665 cmd = (struct qlink_cmd_txpwr *)cmd_skb->data; in qtnf_cmd_get_tx_power()
2666 cmd->op_type = QLINK_TXPWR_GET; in qtnf_cmd_get_tx_power()
2673 goto out; in qtnf_cmd_get_tx_power()
2675 resp = (const struct qlink_resp_txpwr *)resp_skb->data; in qtnf_cmd_get_tx_power()
2676 *dbm = MBM_TO_DBM(le32_to_cpu(resp->txpwr)); in qtnf_cmd_get_tx_power()
2678 out: in qtnf_cmd_get_tx_power()
2688 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_set_tx_power()
2695 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_set_tx_power()
2698 return -ENOMEM; in qtnf_cmd_set_tx_power()
2700 cmd = (struct qlink_cmd_txpwr *)cmd_skb->data; in qtnf_cmd_set_tx_power()
2701 cmd->op_type = QLINK_TXPWR_SET; in qtnf_cmd_set_tx_power()
2702 cmd->txpwr_setting = type; in qtnf_cmd_set_tx_power()
2703 cmd->txpwr = cpu_to_le32(mbm); in qtnf_cmd_set_tx_power()
2719 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_send_wowlan_set()
2726 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_wowlan_set()
2729 return -ENOMEM; in qtnf_cmd_send_wowlan_set()
2733 cmd = (struct qlink_cmd_wowlan_set *)cmd_skb->data; in qtnf_cmd_send_wowlan_set()
2736 if (wowl->disconnect) in qtnf_cmd_send_wowlan_set()
2739 if (wowl->magic_pkt) in qtnf_cmd_send_wowlan_set()
2742 if (wowl->n_patterns && wowl->patterns) { in qtnf_cmd_send_wowlan_set()
2744 while (count < wowl->n_patterns) { in qtnf_cmd_send_wowlan_set()
2747 wowl->patterns[count].pattern, in qtnf_cmd_send_wowlan_set()
2748 wowl->patterns[count].pattern_len); in qtnf_cmd_send_wowlan_set()
2754 cmd->triggers = cpu_to_le32(triggers); in qtnf_cmd_send_wowlan_set()
2758 goto out; in qtnf_cmd_send_wowlan_set()
2760 out: in qtnf_cmd_send_wowlan_set()
2767 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_netdev_changeupper()
2772 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_netdev_changeupper()
2776 return -ENOMEM; in qtnf_cmd_netdev_changeupper()
2779 vif->mac->macid, vif->vifid, br_domain); in qtnf_cmd_netdev_changeupper()
2781 cmd = (struct qlink_cmd_ndev_changeupper *)cmd_skb->data; in qtnf_cmd_netdev_changeupper()
2782 cmd->nehdr.event = cpu_to_le16(QLINK_NDEV_EVENT_CHANGEUPPER); in qtnf_cmd_netdev_changeupper()
2783 cmd->upper_type = QLINK_NDEV_UPPER_TYPE_BRIDGE; in qtnf_cmd_netdev_changeupper()
2784 cmd->br_domain = cpu_to_le32(br_domain); in qtnf_cmd_netdev_changeupper()
2792 vif->mac->macid, vif->vifid); in qtnf_cmd_netdev_changeupper()
2804 if (sizeof(*cmd) + owe->ie_len > QTNF_MAX_CMD_BUF_SIZE) { in qtnf_cmd_send_update_owe()
2806 vif->mac->macid, vif->vifid, owe->ie_len); in qtnf_cmd_send_update_owe()
2807 return -E2BIG; in qtnf_cmd_send_update_owe()
2810 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_update_owe()
2814 return -ENOMEM; in qtnf_cmd_send_update_owe()
2816 cmd = (struct qlink_cmd_update_owe *)cmd_skb->data; in qtnf_cmd_send_update_owe()
2817 ether_addr_copy(cmd->peer, owe->peer); in qtnf_cmd_send_update_owe()
2818 cmd->status = cpu_to_le16(owe->status); in qtnf_cmd_send_update_owe()
2819 if (owe->ie_len && owe->ie) in qtnf_cmd_send_update_owe()
2820 qtnf_cmd_skb_put_buffer(cmd_skb, owe->ie, owe->ie_len); in qtnf_cmd_send_update_owe()
2822 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_update_owe()
2823 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_update_owe()
2825 goto out; in qtnf_cmd_send_update_owe()
2827 out: in qtnf_cmd_send_update_owe()
2828 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_update_owe()