Lines Matching +full:mac +full:- +full:s
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()
32 pr_warn("VIF%u.%u CMD%x: bad MAC in response: %u\n", 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()
111 if (WARN_ON(!resp_skb || !resp_skb->data)) { in qtnf_cmd_send_with_reply()
112 ret = -EFAULT; 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()
125 *var_resp_size = le16_to_cpu(resp->mhdr.len) - const_resp_size; 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()
190 const struct cfg80211_ap_settings *s) in qtnf_cmd_start_ap_can_fit() argument
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()
237 const struct cfg80211_ap_settings *s) in qtnf_cmd_send_start_ap() argument
246 if (!qtnf_cmd_start_ap_can_fit(vif, s)) in qtnf_cmd_send_start_ap()
247 return -E2BIG; in qtnf_cmd_send_start_ap()
249 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_start_ap()
253 return -ENOMEM; in qtnf_cmd_send_start_ap()
255 cmd = (struct qlink_cmd_start_ap *)cmd_skb->data; in qtnf_cmd_send_start_ap()
256 cmd->dtim_period = s->dtim_period; in qtnf_cmd_send_start_ap()
257 cmd->beacon_interval = cpu_to_le16(s->beacon_interval); in qtnf_cmd_send_start_ap()
258 cmd->hidden_ssid = qlink_hidden_ssid_nl2q(s->hidden_ssid); in qtnf_cmd_send_start_ap()
259 cmd->inactivity_timeout = cpu_to_le16(s->inactivity_timeout); in qtnf_cmd_send_start_ap()
260 cmd->smps_mode = s->smps_mode; in qtnf_cmd_send_start_ap()
261 cmd->p2p_ctwindow = s->p2p_ctwindow; in qtnf_cmd_send_start_ap()
262 cmd->p2p_opp_ps = s->p2p_opp_ps; in qtnf_cmd_send_start_ap()
263 cmd->pbss = s->pbss; in qtnf_cmd_send_start_ap()
264 cmd->ht_required = s->ht_required; in qtnf_cmd_send_start_ap()
265 cmd->vht_required = s->vht_required; in qtnf_cmd_send_start_ap()
266 cmd->twt_responder = s->twt_responder; in qtnf_cmd_send_start_ap()
267 if (s->he_obss_pd.enable) { in qtnf_cmd_send_start_ap()
268 cmd->sr_params.sr_control |= QLINK_SR_SRG_INFORMATION_PRESENT; in qtnf_cmd_send_start_ap()
269 cmd->sr_params.srg_obss_pd_min_offset = in qtnf_cmd_send_start_ap()
270 s->he_obss_pd.min_offset; in qtnf_cmd_send_start_ap()
271 cmd->sr_params.srg_obss_pd_max_offset = in qtnf_cmd_send_start_ap()
272 s->he_obss_pd.max_offset; in qtnf_cmd_send_start_ap()
275 aen = &cmd->aen; in qtnf_cmd_send_start_ap()
276 aen->auth_type = s->auth_type; in qtnf_cmd_send_start_ap()
277 aen->privacy = !!s->privacy; in qtnf_cmd_send_start_ap()
278 aen->wpa_versions = cpu_to_le32(s->crypto.wpa_versions); in qtnf_cmd_send_start_ap()
279 aen->cipher_group = cpu_to_le32(s->crypto.cipher_group); in qtnf_cmd_send_start_ap()
280 aen->n_ciphers_pairwise = cpu_to_le32(s->crypto.n_ciphers_pairwise); in qtnf_cmd_send_start_ap()
282 aen->ciphers_pairwise[i] = in qtnf_cmd_send_start_ap()
283 cpu_to_le32(s->crypto.ciphers_pairwise[i]); in qtnf_cmd_send_start_ap()
284 n = min(QLINK_MAX_NR_AKM_SUITES, s->crypto.n_akm_suites); in qtnf_cmd_send_start_ap()
285 aen->n_akm_suites = cpu_to_le32(n); in qtnf_cmd_send_start_ap()
287 aen->akm_suites[i] = cpu_to_le32(s->crypto.akm_suites[i]); in qtnf_cmd_send_start_ap()
288 aen->control_port = s->crypto.control_port; in qtnf_cmd_send_start_ap()
289 aen->control_port_no_encrypt = s->crypto.control_port_no_encrypt; in qtnf_cmd_send_start_ap()
290 aen->control_port_ethertype = in qtnf_cmd_send_start_ap()
291 cpu_to_le16(be16_to_cpu(s->crypto.control_port_ethertype)); in qtnf_cmd_send_start_ap()
293 if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) in qtnf_cmd_send_start_ap()
294 qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, in qtnf_cmd_send_start_ap()
295 s->ssid_len); in qtnf_cmd_send_start_ap()
297 if (cfg80211_chandef_valid(&s->chandef)) { in qtnf_cmd_send_start_ap()
302 chtlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANDEF); in qtnf_cmd_send_start_ap()
303 chtlv->hdr.len = cpu_to_le16(sizeof(*chtlv) - in qtnf_cmd_send_start_ap()
304 sizeof(chtlv->hdr)); in qtnf_cmd_send_start_ap()
305 qlink_chandef_cfg2q(&s->chandef, &chtlv->chdef); in qtnf_cmd_send_start_ap()
309 s->beacon.head, s->beacon.head_len); in qtnf_cmd_send_start_ap()
311 s->beacon.tail, s->beacon.tail_len); in qtnf_cmd_send_start_ap()
313 s->beacon.beacon_ies, s->beacon.beacon_ies_len); in qtnf_cmd_send_start_ap()
315 s->beacon.probe_resp, s->beacon.probe_resp_len); in qtnf_cmd_send_start_ap()
317 s->beacon.proberesp_ies, in qtnf_cmd_send_start_ap()
318 s->beacon.proberesp_ies_len); in qtnf_cmd_send_start_ap()
320 s->beacon.assocresp_ies, in qtnf_cmd_send_start_ap()
321 s->beacon.assocresp_ies_len); in qtnf_cmd_send_start_ap()
323 if (s->ht_cap) { in qtnf_cmd_send_start_ap()
326 round_up(sizeof(*s->ht_cap), QLINK_ALIGN)); in qtnf_cmd_send_start_ap()
328 tlv->type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); in qtnf_cmd_send_start_ap()
329 tlv->len = cpu_to_le16(sizeof(*s->ht_cap)); in qtnf_cmd_send_start_ap()
330 memcpy(tlv->val, s->ht_cap, sizeof(*s->ht_cap)); in qtnf_cmd_send_start_ap()
333 if (s->vht_cap) { in qtnf_cmd_send_start_ap()
335 skb_put(cmd_skb, sizeof(*tlv) + sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
337 tlv->type = cpu_to_le16(WLAN_EID_VHT_CAPABILITY); in qtnf_cmd_send_start_ap()
338 tlv->len = cpu_to_le16(sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
339 memcpy(tlv->val, s->vht_cap, sizeof(*s->vht_cap)); in qtnf_cmd_send_start_ap()
342 if (s->he_cap) in qtnf_cmd_send_start_ap()
344 s->he_cap, sizeof(*s->he_cap)); in qtnf_cmd_send_start_ap()
346 if (s->acl) { in qtnf_cmd_send_start_ap()
347 size_t acl_size = struct_size(s->acl, mac_addrs, in qtnf_cmd_send_start_ap()
348 s->acl->n_acl_entries); in qtnf_cmd_send_start_ap()
353 tlv->type = cpu_to_le16(QTN_TLV_ID_ACL_DATA); in qtnf_cmd_send_start_ap()
354 tlv->len = cpu_to_le16(acl_size); in qtnf_cmd_send_start_ap()
355 qlink_acl_data_cfg2q(s->acl, (struct qlink_acl_data *)tlv->val); in qtnf_cmd_send_start_ap()
358 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_start_ap()
359 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_start_ap()
363 netif_carrier_on(vif->netdev); in qtnf_cmd_send_start_ap()
366 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_start_ap()
376 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_stop_ap()
380 return -ENOMEM; in qtnf_cmd_send_stop_ap()
382 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_stop_ap()
383 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_stop_ap()
384 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_stop_ap()
395 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_register_mgmt()
399 return -ENOMEM; in qtnf_cmd_send_register_mgmt()
401 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_register_mgmt()
403 cmd = (struct qlink_cmd_mgmt_frame_register *)cmd_skb->data; in qtnf_cmd_send_register_mgmt()
404 cmd->frame_type = cpu_to_le16(frame_type); in qtnf_cmd_send_register_mgmt()
405 cmd->do_register = reg; in qtnf_cmd_send_register_mgmt()
407 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_register_mgmt()
409 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_register_mgmt()
422 pr_warn("VIF%u.%u: frame is too big: %zu\n", vif->mac->macid, in qtnf_cmd_send_frame()
423 vif->vifid, len); in qtnf_cmd_send_frame()
424 return -E2BIG; in qtnf_cmd_send_frame()
427 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_frame()
431 return -ENOMEM; in qtnf_cmd_send_frame()
433 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_frame()
435 cmd = (struct qlink_cmd_frame_tx *)cmd_skb->data; in qtnf_cmd_send_frame()
436 cmd->cookie = cpu_to_le32(cookie); in qtnf_cmd_send_frame()
437 cmd->freq = cpu_to_le16(freq); in qtnf_cmd_send_frame()
438 cmd->flags = cpu_to_le16(flags); in qtnf_cmd_send_frame()
443 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_frame()
445 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_frame()
457 pr_warn("VIF%u.%u: %u frame is too big: %zu\n", vif->mac->macid, in qtnf_cmd_send_mgmt_set_appie()
458 vif->vifid, frame_type, len); in qtnf_cmd_send_mgmt_set_appie()
459 return -E2BIG; in qtnf_cmd_send_mgmt_set_appie()
462 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_mgmt_set_appie()
466 return -ENOMEM; in qtnf_cmd_send_mgmt_set_appie()
470 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_mgmt_set_appie()
471 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_mgmt_set_appie()
472 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_mgmt_set_appie()
481 rate_dst->legacy = get_unaligned_le16(&rate_src->rate) * 10; in qtnf_sta_info_parse_rate()
483 rate_dst->mcs = rate_src->mcs; in qtnf_sta_info_parse_rate()
484 rate_dst->nss = rate_src->nss; in qtnf_sta_info_parse_rate()
485 rate_dst->flags = 0; in qtnf_sta_info_parse_rate()
487 switch (rate_src->bw) { in qtnf_sta_info_parse_rate()
489 rate_dst->bw = RATE_INFO_BW_5; in qtnf_sta_info_parse_rate()
492 rate_dst->bw = RATE_INFO_BW_10; in qtnf_sta_info_parse_rate()
496 rate_dst->bw = RATE_INFO_BW_20; in qtnf_sta_info_parse_rate()
499 rate_dst->bw = RATE_INFO_BW_40; in qtnf_sta_info_parse_rate()
502 rate_dst->bw = RATE_INFO_BW_80; in qtnf_sta_info_parse_rate()
505 rate_dst->bw = RATE_INFO_BW_160; in qtnf_sta_info_parse_rate()
508 rate_dst->bw = 0; in qtnf_sta_info_parse_rate()
512 if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_HT_MCS) in qtnf_sta_info_parse_rate()
513 rate_dst->flags |= RATE_INFO_FLAGS_MCS; in qtnf_sta_info_parse_rate()
514 else if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_VHT_MCS) in qtnf_sta_info_parse_rate()
515 rate_dst->flags |= RATE_INFO_FLAGS_VHT_MCS; in qtnf_sta_info_parse_rate()
516 else if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_HE_MCS) in qtnf_sta_info_parse_rate()
517 rate_dst->flags |= RATE_INFO_FLAGS_HE_MCS; in qtnf_sta_info_parse_rate()
519 if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_SHORT_GI) in qtnf_sta_info_parse_rate()
520 rate_dst->flags |= RATE_INFO_FLAGS_SHORT_GI; in qtnf_sta_info_parse_rate()
529 dst->mask = 0; in qtnf_sta_info_parse_flags()
530 dst->set = 0; in qtnf_sta_info_parse_flags()
532 mask = le32_to_cpu(src->mask); in qtnf_sta_info_parse_flags()
533 value = le32_to_cpu(src->value); in qtnf_sta_info_parse_flags()
536 dst->mask |= BIT(NL80211_STA_FLAG_AUTHORIZED); in qtnf_sta_info_parse_flags()
538 dst->set |= BIT(NL80211_STA_FLAG_AUTHORIZED); in qtnf_sta_info_parse_flags()
542 dst->mask |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE); in qtnf_sta_info_parse_flags()
544 dst->set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE); in qtnf_sta_info_parse_flags()
548 dst->mask |= BIT(NL80211_STA_FLAG_WME); in qtnf_sta_info_parse_flags()
550 dst->set |= BIT(NL80211_STA_FLAG_WME); in qtnf_sta_info_parse_flags()
554 dst->mask |= BIT(NL80211_STA_FLAG_MFP); in qtnf_sta_info_parse_flags()
556 dst->set |= BIT(NL80211_STA_FLAG_MFP); in qtnf_sta_info_parse_flags()
560 dst->mask |= BIT(NL80211_STA_FLAG_AUTHENTICATED); in qtnf_sta_info_parse_flags()
562 dst->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED); in qtnf_sta_info_parse_flags()
566 dst->mask |= BIT(NL80211_STA_FLAG_TDLS_PEER); in qtnf_sta_info_parse_flags()
568 dst->set |= BIT(NL80211_STA_FLAG_TDLS_PEER); in qtnf_sta_info_parse_flags()
572 dst->mask |= BIT(NL80211_STA_FLAG_ASSOCIATED); in qtnf_sta_info_parse_flags()
574 dst->set |= BIT(NL80211_STA_FLAG_ASSOCIATED); in qtnf_sta_info_parse_flags()
594 tlv_len = le16_to_cpu(tlv->len); in qtnf_cmd_sta_info_parse()
596 switch (le16_to_cpu(tlv->type)) { in qtnf_cmd_sta_info_parse()
599 map = tlv->val; in qtnf_cmd_sta_info_parse()
603 stats = (const struct qlink_sta_stats *)tlv->val; in qtnf_cmd_sta_info_parse()
619 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); in qtnf_cmd_sta_info_parse()
620 sinfo->inactive_time = le32_to_cpu(stats->inactive_time); in qtnf_cmd_sta_info_parse()
625 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME); in qtnf_cmd_sta_info_parse()
626 sinfo->connected_time = le32_to_cpu(stats->connected_time); in qtnf_cmd_sta_info_parse()
630 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in qtnf_cmd_sta_info_parse()
631 sinfo->signal = stats->signal - QLINK_RSSI_OFFSET; in qtnf_cmd_sta_info_parse()
635 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in qtnf_cmd_sta_info_parse()
636 sinfo->signal_avg = stats->signal_avg - QLINK_RSSI_OFFSET; in qtnf_cmd_sta_info_parse()
640 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in qtnf_cmd_sta_info_parse()
641 qtnf_sta_info_parse_rate(&sinfo->rxrate, &stats->rxrate); in qtnf_cmd_sta_info_parse()
645 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in qtnf_cmd_sta_info_parse()
646 qtnf_sta_info_parse_rate(&sinfo->txrate, &stats->txrate); in qtnf_cmd_sta_info_parse()
650 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_STA_FLAGS); in qtnf_cmd_sta_info_parse()
651 qtnf_sta_info_parse_flags(&sinfo->sta_flags, &stats->sta_flags); in qtnf_cmd_sta_info_parse()
655 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); in qtnf_cmd_sta_info_parse()
656 sinfo->rx_bytes = le64_to_cpu(stats->rx_bytes); in qtnf_cmd_sta_info_parse()
660 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); in qtnf_cmd_sta_info_parse()
661 sinfo->tx_bytes = le64_to_cpu(stats->tx_bytes); in qtnf_cmd_sta_info_parse()
665 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); in qtnf_cmd_sta_info_parse()
666 sinfo->rx_bytes = le64_to_cpu(stats->rx_bytes); in qtnf_cmd_sta_info_parse()
670 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); in qtnf_cmd_sta_info_parse()
671 sinfo->tx_bytes = le64_to_cpu(stats->tx_bytes); in qtnf_cmd_sta_info_parse()
675 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); in qtnf_cmd_sta_info_parse()
676 sinfo->rx_packets = le32_to_cpu(stats->rx_packets); in qtnf_cmd_sta_info_parse()
680 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); in qtnf_cmd_sta_info_parse()
681 sinfo->tx_packets = le32_to_cpu(stats->tx_packets); in qtnf_cmd_sta_info_parse()
685 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); in qtnf_cmd_sta_info_parse()
686 sinfo->rx_beacon = le64_to_cpu(stats->rx_beacon); in qtnf_cmd_sta_info_parse()
690 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC); in qtnf_cmd_sta_info_parse()
691 sinfo->rx_dropped_misc = le32_to_cpu(stats->rx_dropped_misc); in qtnf_cmd_sta_info_parse()
695 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in qtnf_cmd_sta_info_parse()
696 sinfo->tx_failed = le32_to_cpu(stats->tx_failed); in qtnf_cmd_sta_info_parse()
711 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_sta_info()
715 return -ENOMEM; in qtnf_cmd_get_sta_info()
717 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_get_sta_info()
719 cmd = (struct qlink_cmd_get_sta_info *)cmd_skb->data; in qtnf_cmd_get_sta_info()
720 ether_addr_copy(cmd->sta_addr, sta_mac); in qtnf_cmd_get_sta_info()
722 ret = qtnf_cmd_send_with_reply(vif->mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_sta_info()
727 resp = (const struct qlink_resp_get_sta_info *)resp_skb->data; in qtnf_cmd_get_sta_info()
729 if (!ether_addr_equal(sta_mac, resp->sta_addr)) { in qtnf_cmd_get_sta_info()
730 pr_err("VIF%u.%u: wrong mac in reply: %pM != %pM\n", in qtnf_cmd_get_sta_info()
731 vif->mac->macid, vif->vifid, resp->sta_addr, sta_mac); in qtnf_cmd_get_sta_info()
732 ret = -EINVAL; in qtnf_cmd_get_sta_info()
736 qtnf_cmd_sta_info_parse(sinfo, resp->info, var_resp_len); in qtnf_cmd_get_sta_info()
739 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_get_sta_info()
756 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_add_change_intf()
760 return -ENOMEM; in qtnf_cmd_send_add_change_intf()
762 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_add_change_intf()
764 cmd = (struct qlink_cmd_manage_intf *)cmd_skb->data; in qtnf_cmd_send_add_change_intf()
765 cmd->intf_info.use4addr = use4addr; in qtnf_cmd_send_add_change_intf()
769 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_add_change_intf()
772 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_add_change_intf()
775 pr_err("VIF%u.%u: unsupported type %d\n", vif->mac->macid, in qtnf_cmd_send_add_change_intf()
776 vif->vifid, iftype); in qtnf_cmd_send_add_change_intf()
777 ret = -EINVAL; in qtnf_cmd_send_add_change_intf()
782 ether_addr_copy(cmd->intf_info.mac_addr, mac_addr); in qtnf_cmd_send_add_change_intf()
784 eth_zero_addr(cmd->intf_info.mac_addr); in qtnf_cmd_send_add_change_intf()
786 ret = qtnf_cmd_send_with_reply(vif->mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_send_add_change_intf()
791 resp = (const struct qlink_resp_manage_intf *)resp_skb->data; in qtnf_cmd_send_add_change_intf()
792 ether_addr_copy(vif->mac_addr, resp->intf_info.mac_addr); in qtnf_cmd_send_add_change_intf()
795 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_add_change_intf()
819 if (ret == 0 && vif->wdev.iftype != iftype) { in qtnf_cmd_send_change_intf_type()
821 struct wiphy *wiphy = priv_to_wiphy(vif->mac); in qtnf_cmd_send_change_intf_type()
824 if (!wiphy->bands[band]) in qtnf_cmd_send_change_intf_type()
827 qtnf_cmd_band_info_get(vif->mac, wiphy->bands[band]); in qtnf_cmd_send_change_intf_type()
840 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_intf()
844 return -ENOMEM; in qtnf_cmd_send_del_intf()
846 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_intf()
848 cmd = (struct qlink_cmd_manage_intf *)cmd_skb->data; in qtnf_cmd_send_del_intf()
850 switch (vif->wdev.iftype) { in qtnf_cmd_send_del_intf()
852 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_del_intf()
855 cmd->intf_info.if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_del_intf()
858 pr_warn("VIF%u.%u: unsupported iftype %d\n", vif->mac->macid, in qtnf_cmd_send_del_intf()
859 vif->vifid, vif->wdev.iftype); in qtnf_cmd_send_del_intf()
861 ret = -EINVAL; in qtnf_cmd_send_del_intf()
865 eth_zero_addr(cmd->intf_info.mac_addr); in qtnf_cmd_send_del_intf()
867 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_intf()
872 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_intf()
881 struct qtnf_hw_info *hwinfo = &bus->hw_info; in qtnf_cmd_resp_proc_hw_info()
896 hwinfo->num_mac = resp->num_mac; in qtnf_cmd_resp_proc_hw_info()
897 hwinfo->mac_bitmap = resp->mac_bitmap; in qtnf_cmd_resp_proc_hw_info()
898 hwinfo->fw_ver = le32_to_cpu(resp->fw_ver); in qtnf_cmd_resp_proc_hw_info()
899 hwinfo->total_tx_chain = resp->total_tx_chain; in qtnf_cmd_resp_proc_hw_info()
900 hwinfo->total_rx_chain = resp->total_rx_chain; in qtnf_cmd_resp_proc_hw_info()
902 bld_tmstamp = le32_to_cpu(resp->bld_tmstamp); in qtnf_cmd_resp_proc_hw_info()
903 plat_id = le32_to_cpu(resp->plat_id); in qtnf_cmd_resp_proc_hw_info()
904 hw_ver = le32_to_cpu(resp->hw_ver); in qtnf_cmd_resp_proc_hw_info()
906 qlink_for_each_tlv(tlv, resp->info, info_len) { in qtnf_cmd_resp_proc_hw_info()
907 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_proc_hw_info()
908 tlv_len = le16_to_cpu(tlv->len); in qtnf_cmd_resp_proc_hw_info()
912 bld_name = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
915 bld_rev = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
918 bld_type = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
921 bld_label = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
924 hw_id = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
927 calibration_ver = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
930 uboot_ver = (const void *)tlv->val; in qtnf_cmd_resp_proc_hw_info()
933 memcpy(hwinfo->hw_capab, tlv->val, in qtnf_cmd_resp_proc_hw_info()
934 min(sizeof(hwinfo->hw_capab), (size_t)tlv_len)); in qtnf_cmd_resp_proc_hw_info()
941 if (!qlink_tlv_parsing_ok(tlv, resp->info, info_len)) { in qtnf_cmd_resp_proc_hw_info()
943 return -EINVAL; in qtnf_cmd_resp_proc_hw_info()
946 pr_info("\nBuild name: %s\n" in qtnf_cmd_resp_proc_hw_info()
947 "Build revision: %s\n" in qtnf_cmd_resp_proc_hw_info()
948 "Build type: %s\n" in qtnf_cmd_resp_proc_hw_info()
949 "Build label: %s\n" in qtnf_cmd_resp_proc_hw_info()
952 "Hardware ID: %s\n" in qtnf_cmd_resp_proc_hw_info()
953 "Calibration version: %s\n" in qtnf_cmd_resp_proc_hw_info()
954 "U-Boot version: %s\n" in qtnf_cmd_resp_proc_hw_info()
958 "Chains Rx-Tx: %ux%u\n" in qtnf_cmd_resp_proc_hw_info()
964 QLINK_VER_MAJOR(bus->hw_info.ql_proto_ver), in qtnf_cmd_resp_proc_hw_info()
965 QLINK_VER_MINOR(bus->hw_info.ql_proto_ver), in qtnf_cmd_resp_proc_hw_info()
966 hwinfo->mac_bitmap, in qtnf_cmd_resp_proc_hw_info()
967 hwinfo->total_rx_chain, hwinfo->total_tx_chain, in qtnf_cmd_resp_proc_hw_info()
968 hwinfo->fw_ver); in qtnf_cmd_resp_proc_hw_info()
970 strscpy(hwinfo->fw_version, bld_label, sizeof(hwinfo->fw_version)); in qtnf_cmd_resp_proc_hw_info()
971 hwinfo->hw_version = hw_ver; in qtnf_cmd_resp_proc_hw_info()
977 qtnf_parse_wowlan_info(struct qtnf_wmac *mac, in qtnf_parse_wowlan_info() argument
980 struct qtnf_mac_info *mac_info = &mac->macinfo; in qtnf_parse_wowlan_info()
988 switch (le16_to_cpu(wowlan->version)) { in qtnf_parse_wowlan_info()
990 data1 = (struct qlink_wowlan_support *)wowlan->data; in qtnf_parse_wowlan_info()
992 supp->flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT; in qtnf_parse_wowlan_info()
993 supp->n_patterns = le32_to_cpu(data1->n_patterns); in qtnf_parse_wowlan_info()
994 supp->pattern_max_len = le32_to_cpu(data1->pattern_max_len); in qtnf_parse_wowlan_info()
995 supp->pattern_min_len = le32_to_cpu(data1->pattern_min_len); in qtnf_parse_wowlan_info()
997 mac_info->wowlan = supp; in qtnf_parse_wowlan_info()
1000 pr_warn("MAC%u: unsupported WoWLAN version 0x%x\n", in qtnf_parse_wowlan_info()
1001 mac->macid, le16_to_cpu(wowlan->version)); in qtnf_parse_wowlan_info()
1008 qtnf_parse_variable_mac_info(struct qtnf_wmac *mac, in qtnf_parse_variable_mac_info() argument
1012 struct ieee80211_iface_combination *comb = mac->macinfo.if_comb; in qtnf_parse_variable_mac_info()
1031 if (WARN_ON(resp->n_reg_rules > NL80211_MAX_SUPP_REG_RULES)) in qtnf_parse_variable_mac_info()
1032 return -E2BIG; in qtnf_parse_variable_mac_info()
1034 mac->rd = kzalloc(struct_size(mac->rd, reg_rules, resp->n_reg_rules), in qtnf_parse_variable_mac_info()
1036 if (!mac->rd) in qtnf_parse_variable_mac_info()
1037 return -ENOMEM; in qtnf_parse_variable_mac_info()
1039 mac->rd->n_reg_rules = resp->n_reg_rules; in qtnf_parse_variable_mac_info()
1040 mac->rd->alpha2[0] = resp->alpha2[0]; in qtnf_parse_variable_mac_info()
1041 mac->rd->alpha2[1] = resp->alpha2[1]; in qtnf_parse_variable_mac_info()
1043 switch (resp->dfs_region) { in qtnf_parse_variable_mac_info()
1045 mac->rd->dfs_region = NL80211_DFS_FCC; in qtnf_parse_variable_mac_info()
1048 mac->rd->dfs_region = NL80211_DFS_ETSI; in qtnf_parse_variable_mac_info()
1051 mac->rd->dfs_region = NL80211_DFS_JP; in qtnf_parse_variable_mac_info()
1055 mac->rd->dfs_region = NL80211_DFS_UNSET; in qtnf_parse_variable_mac_info()
1059 qlink_for_each_tlv(tlv, resp->var_info, tlv_buf_size) { in qtnf_parse_variable_mac_info()
1060 tlv_type = le16_to_cpu(tlv->type); in qtnf_parse_variable_mac_info()
1061 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_parse_variable_mac_info()
1066 pr_warn("MAC%u: no combinations advertised\n", in qtnf_parse_variable_mac_info()
1067 mac->macid); in qtnf_parse_variable_mac_info()
1068 return -EINVAL; in qtnf_parse_variable_mac_info()
1071 if (n_comb >= mac->macinfo.n_if_comb) { in qtnf_parse_variable_mac_info()
1072 pr_warn("MAC%u: combinations count exceeded\n", in qtnf_parse_variable_mac_info()
1073 mac->macid); in qtnf_parse_variable_mac_info()
1078 rec = (void *)tlv->val; in qtnf_parse_variable_mac_info()
1079 rec_len = sizeof(*rec) + rec->n_limits * sizeof(*lim); in qtnf_parse_variable_mac_info()
1082 pr_warn("MAC%u: record %zu size mismatch\n", in qtnf_parse_variable_mac_info()
1083 mac->macid, n_comb); in qtnf_parse_variable_mac_info()
1084 return -EINVAL; in qtnf_parse_variable_mac_info()
1087 limits = kcalloc(rec->n_limits, sizeof(*limits), in qtnf_parse_variable_mac_info()
1090 return -ENOMEM; in qtnf_parse_variable_mac_info()
1093 rec->num_different_channels; in qtnf_parse_variable_mac_info()
1095 le16_to_cpu(rec->max_interfaces); in qtnf_parse_variable_mac_info()
1096 comb[n_comb].n_limits = rec->n_limits; in qtnf_parse_variable_mac_info()
1099 for (i = 0; i < rec->n_limits; i++) { in qtnf_parse_variable_mac_info()
1100 lim = &rec->limits[i]; in qtnf_parse_variable_mac_info()
1101 limits[i].max = le16_to_cpu(lim->max_num); in qtnf_parse_variable_mac_info()
1103 qlink_iface_type_to_nl_mask(le16_to_cpu(lim->type)); in qtnf_parse_variable_mac_info()
1104 pr_debug("MAC%u: comb[%zu]: MAX:%u TYPES:%.4X\n", in qtnf_parse_variable_mac_info()
1105 mac->macid, n_comb, in qtnf_parse_variable_mac_info()
1113 return -EINVAL; in qtnf_parse_variable_mac_info()
1114 ext_capa = (u8 *)tlv->val; in qtnf_parse_variable_mac_info()
1119 return -EINVAL; in qtnf_parse_variable_mac_info()
1120 ext_capa_mask = (u8 *)tlv->val; in qtnf_parse_variable_mac_info()
1125 return -EINVAL; in qtnf_parse_variable_mac_info()
1127 wowlan = (void *)tlv->val; in qtnf_parse_variable_mac_info()
1128 if (!le16_to_cpu(wowlan->len)) { in qtnf_parse_variable_mac_info()
1129 pr_warn("MAC%u: skip empty WoWLAN data\n", in qtnf_parse_variable_mac_info()
1130 mac->macid); in qtnf_parse_variable_mac_info()
1134 rec_len = sizeof(*wowlan) + le16_to_cpu(wowlan->len); in qtnf_parse_variable_mac_info()
1136 pr_warn("MAC%u: WoWLAN data size mismatch\n", in qtnf_parse_variable_mac_info()
1137 mac->macid); in qtnf_parse_variable_mac_info()
1138 return -EINVAL; in qtnf_parse_variable_mac_info()
1141 kfree(mac->macinfo.wowlan); in qtnf_parse_variable_mac_info()
1142 mac->macinfo.wowlan = NULL; in qtnf_parse_variable_mac_info()
1143 qtnf_parse_wowlan_info(mac, wowlan); in qtnf_parse_variable_mac_info()
1146 if (rule_idx >= resp->n_reg_rules) { in qtnf_parse_variable_mac_info()
1148 resp->n_reg_rules); in qtnf_parse_variable_mac_info()
1149 return -EINVAL; in qtnf_parse_variable_mac_info()
1152 if (tlv_value_len != sizeof(*tlv_rule) - sizeof(*tlv)) { in qtnf_parse_variable_mac_info()
1155 return -EINVAL; in qtnf_parse_variable_mac_info()
1159 rule = &mac->rd->reg_rules[rule_idx++]; in qtnf_parse_variable_mac_info()
1163 pr_warn("MAC%u: unknown TLV type %u\n", in qtnf_parse_variable_mac_info()
1164 mac->macid, tlv_type); in qtnf_parse_variable_mac_info()
1169 if (!qlink_tlv_parsing_ok(tlv, resp->var_info, tlv_buf_size)) { in qtnf_parse_variable_mac_info()
1171 return -EINVAL; in qtnf_parse_variable_mac_info()
1174 if (mac->macinfo.n_if_comb != n_comb) { in qtnf_parse_variable_mac_info()
1175 pr_err("MAC%u: combination mismatch: reported=%zu parsed=%zu\n", in qtnf_parse_variable_mac_info()
1176 mac->macid, mac->macinfo.n_if_comb, n_comb); in qtnf_parse_variable_mac_info()
1177 return -EINVAL; in qtnf_parse_variable_mac_info()
1181 pr_err("MAC%u: ext_capa/_mask lengths mismatch: %u != %u\n", in qtnf_parse_variable_mac_info()
1182 mac->macid, ext_capa_len, ext_capa_mask_len); in qtnf_parse_variable_mac_info()
1183 return -EINVAL; in qtnf_parse_variable_mac_info()
1186 if (rule_idx != resp->n_reg_rules) { in qtnf_parse_variable_mac_info()
1188 resp->n_reg_rules, rule_idx); in qtnf_parse_variable_mac_info()
1189 return -EINVAL; in qtnf_parse_variable_mac_info()
1195 return -ENOMEM; in qtnf_parse_variable_mac_info()
1201 return -ENOMEM; in qtnf_parse_variable_mac_info()
1208 qtnf_mac_ext_caps_free(mac); in qtnf_parse_variable_mac_info()
1209 mac->macinfo.extended_capabilities = ext_capa; in qtnf_parse_variable_mac_info()
1210 mac->macinfo.extended_capabilities_mask = ext_capa_mask; in qtnf_parse_variable_mac_info()
1211 mac->macinfo.extended_capabilities_len = ext_capa_len; in qtnf_parse_variable_mac_info()
1217 qtnf_cmd_resp_proc_mac_info(struct qtnf_wmac *mac, in qtnf_cmd_resp_proc_mac_info() argument
1223 qtnf_mac_iface_comb_free(mac); in qtnf_cmd_resp_proc_mac_info()
1225 mac_info = &mac->macinfo; in qtnf_cmd_resp_proc_mac_info()
1227 mac_info->bands_cap = resp_info->bands_cap; in qtnf_cmd_resp_proc_mac_info()
1228 ether_addr_copy(mac->macaddr, resp_info->dev_mac); in qtnf_cmd_resp_proc_mac_info()
1230 vif = qtnf_mac_get_base_vif(mac); in qtnf_cmd_resp_proc_mac_info()
1232 ether_addr_copy(vif->mac_addr, mac->macaddr); in qtnf_cmd_resp_proc_mac_info()
1236 mac_info->num_tx_chain = resp_info->num_tx_chain; in qtnf_cmd_resp_proc_mac_info()
1237 mac_info->num_rx_chain = resp_info->num_rx_chain; in qtnf_cmd_resp_proc_mac_info()
1239 mac_info->max_ap_assoc_sta = le16_to_cpu(resp_info->max_ap_assoc_sta); in qtnf_cmd_resp_proc_mac_info()
1240 mac_info->radar_detect_widths = in qtnf_cmd_resp_proc_mac_info()
1242 resp_info->radar_detect_widths)); in qtnf_cmd_resp_proc_mac_info()
1243 mac_info->max_acl_mac_addrs = le16_to_cpu(resp_info->max_acl_mac_addrs); in qtnf_cmd_resp_proc_mac_info()
1244 mac_info->frag_thr = le32_to_cpu(resp_info->frag_threshold); in qtnf_cmd_resp_proc_mac_info()
1245 mac_info->rts_thr = le32_to_cpu(resp_info->rts_threshold); in qtnf_cmd_resp_proc_mac_info()
1246 mac_info->sretry_limit = resp_info->retry_short; in qtnf_cmd_resp_proc_mac_info()
1247 mac_info->lretry_limit = resp_info->retry_long; in qtnf_cmd_resp_proc_mac_info()
1248 mac_info->coverage_class = resp_info->coverage_class; in qtnf_cmd_resp_proc_mac_info()
1249 mac_info->max_scan_ssids = resp_info->max_scan_ssids; in qtnf_cmd_resp_proc_mac_info()
1251 memcpy(&mac_info->ht_cap_mod_mask, &resp_info->ht_cap_mod_mask, in qtnf_cmd_resp_proc_mac_info()
1252 sizeof(mac_info->ht_cap_mod_mask)); in qtnf_cmd_resp_proc_mac_info()
1253 memcpy(&mac_info->vht_cap_mod_mask, &resp_info->vht_cap_mod_mask, in qtnf_cmd_resp_proc_mac_info()
1254 sizeof(mac_info->vht_cap_mod_mask)); in qtnf_cmd_resp_proc_mac_info()
1256 mac_info->n_if_comb = resp_info->n_iface_combinations; in qtnf_cmd_resp_proc_mac_info()
1257 mac_info->if_comb = kcalloc(mac->macinfo.n_if_comb, in qtnf_cmd_resp_proc_mac_info()
1258 sizeof(*mac->macinfo.if_comb), in qtnf_cmd_resp_proc_mac_info()
1261 if (!mac->macinfo.if_comb) in qtnf_cmd_resp_proc_mac_info()
1262 return -ENOMEM; in qtnf_cmd_resp_proc_mac_info()
1273 bcap->ht_supported = true; in qtnf_cmd_resp_band_fill_htcap()
1274 bcap->cap = le16_to_cpu(ht_cap->cap_info); in qtnf_cmd_resp_band_fill_htcap()
1275 bcap->ampdu_factor = in qtnf_cmd_resp_band_fill_htcap()
1276 ht_cap->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_FACTOR; in qtnf_cmd_resp_band_fill_htcap()
1277 bcap->ampdu_density = in qtnf_cmd_resp_band_fill_htcap()
1278 (ht_cap->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_DENSITY) >> in qtnf_cmd_resp_band_fill_htcap()
1280 memcpy(&bcap->mcs, &ht_cap->mcs, sizeof(bcap->mcs)); in qtnf_cmd_resp_band_fill_htcap()
1289 bcap->vht_supported = true; in qtnf_cmd_resp_band_fill_vhtcap()
1290 bcap->cap = le32_to_cpu(vht_cap->vht_cap_info); in qtnf_cmd_resp_band_fill_vhtcap()
1291 memcpy(&bcap->vht_mcs, &vht_cap->supp_mcs, sizeof(bcap->vht_mcs)); in qtnf_cmd_resp_band_fill_vhtcap()
1299 iftype_data->types_mask = le16_to_cpu(qlink_data->types_mask); in qtnf_cmd_conv_iftype()
1301 iftype_data->he_cap.has_he = true; in qtnf_cmd_conv_iftype()
1302 memcpy(&iftype_data->he_cap.he_cap_elem, &qlink_data->he_cap_elem, in qtnf_cmd_conv_iftype()
1303 sizeof(qlink_data->he_cap_elem)); in qtnf_cmd_conv_iftype()
1304 memcpy(iftype_data->he_cap.ppe_thres, qlink_data->ppe_thres, in qtnf_cmd_conv_iftype()
1305 ARRAY_SIZE(qlink_data->ppe_thres)); in qtnf_cmd_conv_iftype()
1307 iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_80 = in qtnf_cmd_conv_iftype()
1308 qlink_data->he_mcs_nss_supp.rx_mcs_80; in qtnf_cmd_conv_iftype()
1309 iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_80 = in qtnf_cmd_conv_iftype()
1310 qlink_data->he_mcs_nss_supp.tx_mcs_80; in qtnf_cmd_conv_iftype()
1311 iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_160 = in qtnf_cmd_conv_iftype()
1312 qlink_data->he_mcs_nss_supp.rx_mcs_160; in qtnf_cmd_conv_iftype()
1313 iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_160 = in qtnf_cmd_conv_iftype()
1314 qlink_data->he_mcs_nss_supp.tx_mcs_160; in qtnf_cmd_conv_iftype()
1315 iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_80p80 = in qtnf_cmd_conv_iftype()
1316 qlink_data->he_mcs_nss_supp.rx_mcs_80p80; in qtnf_cmd_conv_iftype()
1317 iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_80p80 = in qtnf_cmd_conv_iftype()
1318 qlink_data->he_mcs_nss_supp.tx_mcs_80p80; in qtnf_cmd_conv_iftype()
1330 payload_len = struct_size(tlv, iftype_data, tlv->n_iftype_data); in qtnf_cmd_band_fill_iftype()
1333 if (tlv->hdr.len != cpu_to_le16(payload_len)) { in qtnf_cmd_band_fill_iftype()
1334 pr_err("bad IFTYPE_DATA TLV len %u\n", tlv->hdr.len); in qtnf_cmd_band_fill_iftype()
1335 return -EINVAL; in qtnf_cmd_band_fill_iftype()
1338 kfree((__force void *)band->iftype_data); in qtnf_cmd_band_fill_iftype()
1339 band->iftype_data = NULL; in qtnf_cmd_band_fill_iftype()
1340 band->n_iftype_data = tlv->n_iftype_data; in qtnf_cmd_band_fill_iftype()
1341 if (band->n_iftype_data == 0) in qtnf_cmd_band_fill_iftype()
1344 iftype_data = kcalloc(band->n_iftype_data, sizeof(*iftype_data), in qtnf_cmd_band_fill_iftype()
1347 band->n_iftype_data = 0; in qtnf_cmd_band_fill_iftype()
1348 return -ENOMEM; in qtnf_cmd_band_fill_iftype()
1351 _ieee80211_set_sband_iftype_data(band, iftype_data, tlv->n_iftype_data); in qtnf_cmd_band_fill_iftype()
1353 for (i = 0; i < band->n_iftype_data; i++) in qtnf_cmd_band_fill_iftype()
1354 qtnf_cmd_conv_iftype(iftype_data++, &tlv->iftype_data[i]); in qtnf_cmd_band_fill_iftype()
1371 int ret = -EINVAL; in qtnf_cmd_resp_fill_band_info()
1373 memset(&band->ht_cap, 0, sizeof(band->ht_cap)); in qtnf_cmd_resp_fill_band_info()
1374 memset(&band->vht_cap, 0, sizeof(band->vht_cap)); in qtnf_cmd_resp_fill_band_info()
1376 if (band->channels) { in qtnf_cmd_resp_fill_band_info()
1377 if (band->n_channels == resp->num_chans) { in qtnf_cmd_resp_fill_band_info()
1378 memset(band->channels, 0, in qtnf_cmd_resp_fill_band_info()
1379 sizeof(*band->channels) * band->n_channels); in qtnf_cmd_resp_fill_band_info()
1381 kfree(band->channels); in qtnf_cmd_resp_fill_band_info()
1382 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1383 band->channels = NULL; in qtnf_cmd_resp_fill_band_info()
1387 band->n_channels = resp->num_chans; in qtnf_cmd_resp_fill_band_info()
1388 if (band->n_channels == 0) in qtnf_cmd_resp_fill_band_info()
1391 if (!band->channels) in qtnf_cmd_resp_fill_band_info()
1392 band->channels = kcalloc(band->n_channels, sizeof(*chan), in qtnf_cmd_resp_fill_band_info()
1394 if (!band->channels) { in qtnf_cmd_resp_fill_band_info()
1395 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1396 return -ENOMEM; in qtnf_cmd_resp_fill_band_info()
1399 qlink_for_each_tlv(tlv, resp->info, payload_len) { in qtnf_cmd_resp_fill_band_info()
1400 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_fill_band_info()
1401 tlv_dlen = le16_to_cpu(tlv->len); in qtnf_cmd_resp_fill_band_info()
1411 if (chidx == band->n_channels) { in qtnf_cmd_resp_fill_band_info()
1416 qchan = (const struct qlink_channel *)tlv->val; in qtnf_cmd_resp_fill_band_info()
1417 chan = &band->channels[chidx++]; in qtnf_cmd_resp_fill_band_info()
1418 qflags = le32_to_cpu(qchan->flags); in qtnf_cmd_resp_fill_band_info()
1420 chan->hw_value = le16_to_cpu(qchan->hw_value); in qtnf_cmd_resp_fill_band_info()
1421 chan->band = band->band; in qtnf_cmd_resp_fill_band_info()
1422 chan->center_freq = le16_to_cpu(qchan->center_freq); in qtnf_cmd_resp_fill_band_info()
1423 chan->max_antenna_gain = (int)qchan->max_antenna_gain; in qtnf_cmd_resp_fill_band_info()
1424 chan->max_power = (int)qchan->max_power; in qtnf_cmd_resp_fill_band_info()
1425 chan->max_reg_power = (int)qchan->max_reg_power; in qtnf_cmd_resp_fill_band_info()
1426 chan->beacon_found = qchan->beacon_found; in qtnf_cmd_resp_fill_band_info()
1427 chan->dfs_cac_ms = le32_to_cpu(qchan->dfs_cac_ms); in qtnf_cmd_resp_fill_band_info()
1428 chan->flags = 0; in qtnf_cmd_resp_fill_band_info()
1431 chan->flags |= IEEE80211_CHAN_DISABLED; in qtnf_cmd_resp_fill_band_info()
1434 chan->flags |= IEEE80211_CHAN_NO_IR; in qtnf_cmd_resp_fill_band_info()
1437 chan->flags |= IEEE80211_CHAN_NO_HT40PLUS; in qtnf_cmd_resp_fill_band_info()
1440 chan->flags |= IEEE80211_CHAN_NO_HT40MINUS; in qtnf_cmd_resp_fill_band_info()
1443 chan->flags |= IEEE80211_CHAN_NO_OFDM; in qtnf_cmd_resp_fill_band_info()
1446 chan->flags |= IEEE80211_CHAN_NO_80MHZ; in qtnf_cmd_resp_fill_band_info()
1449 chan->flags |= IEEE80211_CHAN_NO_160MHZ; in qtnf_cmd_resp_fill_band_info()
1452 chan->flags |= IEEE80211_CHAN_INDOOR_ONLY; in qtnf_cmd_resp_fill_band_info()
1455 chan->flags |= IEEE80211_CHAN_IR_CONCURRENT; in qtnf_cmd_resp_fill_band_info()
1458 chan->flags |= IEEE80211_CHAN_NO_20MHZ; in qtnf_cmd_resp_fill_band_info()
1461 chan->flags |= IEEE80211_CHAN_NO_10MHZ; in qtnf_cmd_resp_fill_band_info()
1464 chan->flags |= IEEE80211_CHAN_RADAR; in qtnf_cmd_resp_fill_band_info()
1465 chan->dfs_state_entered = jiffies; in qtnf_cmd_resp_fill_band_info()
1467 if (qchan->dfs_state == QLINK_DFS_USABLE) in qtnf_cmd_resp_fill_band_info()
1468 chan->dfs_state = NL80211_DFS_USABLE; in qtnf_cmd_resp_fill_band_info()
1469 else if (qchan->dfs_state == in qtnf_cmd_resp_fill_band_info()
1471 chan->dfs_state = NL80211_DFS_AVAILABLE; in qtnf_cmd_resp_fill_band_info()
1473 chan->dfs_state = in qtnf_cmd_resp_fill_band_info()
1478 chan->hw_value, chan->flags, chan->max_power, in qtnf_cmd_resp_fill_band_info()
1479 chan->max_reg_power); in qtnf_cmd_resp_fill_band_info()
1488 qtnf_cmd_resp_band_fill_htcap(tlv->val, &band->ht_cap); in qtnf_cmd_resp_fill_band_info()
1497 qtnf_cmd_resp_band_fill_vhtcap(tlv->val, in qtnf_cmd_resp_fill_band_info()
1498 &band->vht_cap); in qtnf_cmd_resp_fill_band_info()
1512 if (!qlink_tlv_parsing_ok(tlv, resp->info, payload_len)) { in qtnf_cmd_resp_fill_band_info()
1517 if (band->n_channels != chidx) { in qtnf_cmd_resp_fill_band_info()
1519 band->n_channels, chidx); in qtnf_cmd_resp_fill_band_info()
1526 kfree(band->channels); in qtnf_cmd_resp_fill_band_info()
1527 band->channels = NULL; in qtnf_cmd_resp_fill_band_info()
1528 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1533 int qtnf_cmd_get_mac_info(struct qtnf_wmac *mac) in qtnf_cmd_get_mac_info() argument
1540 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_get_mac_info()
1544 return -ENOMEM; in qtnf_cmd_get_mac_info()
1546 qtnf_bus_lock(mac->bus); in qtnf_cmd_get_mac_info()
1547 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_mac_info()
1552 resp = (const struct qlink_resp_get_mac_info *)resp_skb->data; in qtnf_cmd_get_mac_info()
1553 ret = qtnf_cmd_resp_proc_mac_info(mac, resp); in qtnf_cmd_get_mac_info()
1557 ret = qtnf_parse_variable_mac_info(mac, resp, var_data_len); in qtnf_cmd_get_mac_info()
1560 qtnf_bus_unlock(mac->bus); in qtnf_cmd_get_mac_info()
1577 return -ENOMEM; in qtnf_cmd_get_hw_info()
1585 resp = (const struct qlink_resp_get_hw_info *)resp_skb->data; in qtnf_cmd_get_hw_info()
1595 int qtnf_cmd_band_info_get(struct qtnf_wmac *mac, in qtnf_cmd_band_info_get() argument
1603 u8 qband = qlink_utils_band_cfg2q(band->band); in qtnf_cmd_band_info_get()
1605 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_band_info_get()
1609 return -ENOMEM; in qtnf_cmd_band_info_get()
1611 cmd = (struct qlink_cmd_band_info_get *)cmd_skb->data; in qtnf_cmd_band_info_get()
1612 cmd->band = qband; in qtnf_cmd_band_info_get()
1614 qtnf_bus_lock(mac->bus); in qtnf_cmd_band_info_get()
1615 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_band_info_get()
1620 resp = (struct qlink_resp_band_info_get *)resp_skb->data; in qtnf_cmd_band_info_get()
1621 if (resp->band != qband) { in qtnf_cmd_band_info_get()
1622 pr_err("MAC%u: reply band %u != cmd band %u\n", mac->macid, in qtnf_cmd_band_info_get()
1623 resp->band, qband); in qtnf_cmd_band_info_get()
1624 ret = -EINVAL; in qtnf_cmd_band_info_get()
1631 qtnf_bus_unlock(mac->bus); in qtnf_cmd_band_info_get()
1637 int qtnf_cmd_send_update_phy_params(struct qtnf_wmac *mac, u32 changed) in qtnf_cmd_send_update_phy_params() argument
1639 struct wiphy *wiphy = priv_to_wiphy(mac); in qtnf_cmd_send_update_phy_params()
1643 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_send_update_phy_params()
1647 return -ENOMEM; in qtnf_cmd_send_update_phy_params()
1649 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_update_phy_params()
1653 wiphy->frag_threshold); in qtnf_cmd_send_update_phy_params()
1656 wiphy->rts_threshold); in qtnf_cmd_send_update_phy_params()
1659 wiphy->coverage_class); in qtnf_cmd_send_update_phy_params()
1663 wiphy->retry_long); in qtnf_cmd_send_update_phy_params()
1667 wiphy->retry_short); in qtnf_cmd_send_update_phy_params()
1669 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_update_phy_params()
1671 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_update_phy_params()
1689 return -ENOMEM; in qtnf_cmd_send_init_fw()
1691 cmd = (struct qlink_cmd_init_fw *)cmd_skb->data; in qtnf_cmd_send_init_fw()
1692 cmd->qlink_proto_ver = cpu_to_le32(QLINK_PROTO_VER); in qtnf_cmd_send_init_fw()
1702 resp = (struct qlink_resp_init_fw *)resp_skb->data; in qtnf_cmd_send_init_fw()
1703 bus->hw_info.ql_proto_ver = le32_to_cpu(resp->qlink_proto_ver); in qtnf_cmd_send_init_fw()
1732 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_add_key()
1736 return -ENOMEM; in qtnf_cmd_send_add_key()
1738 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_add_key()
1740 cmd = (struct qlink_cmd_add_key *)cmd_skb->data; in qtnf_cmd_send_add_key()
1743 ether_addr_copy(cmd->addr, mac_addr); in qtnf_cmd_send_add_key()
1745 eth_broadcast_addr(cmd->addr); in qtnf_cmd_send_add_key()
1747 cmd->cipher = cpu_to_le32(params->cipher); in qtnf_cmd_send_add_key()
1748 cmd->key_index = key_index; in qtnf_cmd_send_add_key()
1749 cmd->pairwise = pairwise; in qtnf_cmd_send_add_key()
1751 if (params->key && params->key_len > 0) in qtnf_cmd_send_add_key()
1753 params->key, in qtnf_cmd_send_add_key()
1754 params->key_len); in qtnf_cmd_send_add_key()
1756 if (params->seq && params->seq_len > 0) in qtnf_cmd_send_add_key()
1758 params->seq, in qtnf_cmd_send_add_key()
1759 params->seq_len); in qtnf_cmd_send_add_key()
1761 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_add_key()
1763 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_add_key()
1775 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_key()
1779 return -ENOMEM; in qtnf_cmd_send_del_key()
1781 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_key()
1783 cmd = (struct qlink_cmd_del_key *)cmd_skb->data; in qtnf_cmd_send_del_key()
1786 ether_addr_copy(cmd->addr, mac_addr); in qtnf_cmd_send_del_key()
1788 eth_broadcast_addr(cmd->addr); in qtnf_cmd_send_del_key()
1790 cmd->key_index = key_index; in qtnf_cmd_send_del_key()
1791 cmd->pairwise = pairwise; in qtnf_cmd_send_del_key()
1793 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_key()
1795 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_key()
1807 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_set_default_key()
1811 return -ENOMEM; in qtnf_cmd_send_set_default_key()
1813 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_set_default_key()
1815 cmd = (struct qlink_cmd_set_def_key *)cmd_skb->data; in qtnf_cmd_send_set_default_key()
1816 cmd->key_index = key_index; in qtnf_cmd_send_set_default_key()
1817 cmd->unicast = unicast; in qtnf_cmd_send_set_default_key()
1818 cmd->multicast = multicast; in qtnf_cmd_send_set_default_key()
1820 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_set_default_key()
1822 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_set_default_key()
1833 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_set_default_mgmt_key()
1837 return -ENOMEM; in qtnf_cmd_send_set_default_mgmt_key()
1839 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_set_default_mgmt_key()
1841 cmd = (struct qlink_cmd_set_def_mgmt_key *)cmd_skb->data; in qtnf_cmd_send_set_default_mgmt_key()
1842 cmd->key_index = key_index; in qtnf_cmd_send_set_default_mgmt_key()
1844 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_set_default_mgmt_key()
1846 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_set_default_mgmt_key()
1872 int qtnf_cmd_send_change_sta(struct qtnf_vif *vif, const u8 *mac, in qtnf_cmd_send_change_sta() argument
1879 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_change_sta()
1883 return -ENOMEM; in qtnf_cmd_send_change_sta()
1885 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_change_sta()
1887 cmd = (struct qlink_cmd_change_sta *)cmd_skb->data; in qtnf_cmd_send_change_sta()
1888 ether_addr_copy(cmd->sta_addr, mac); in qtnf_cmd_send_change_sta()
1889 cmd->flag_update.mask = in qtnf_cmd_send_change_sta()
1890 cpu_to_le32(qtnf_encode_sta_flags(params->sta_flags_mask)); in qtnf_cmd_send_change_sta()
1891 cmd->flag_update.value = in qtnf_cmd_send_change_sta()
1892 cpu_to_le32(qtnf_encode_sta_flags(params->sta_flags_set)); in qtnf_cmd_send_change_sta()
1894 switch (vif->wdev.iftype) { in qtnf_cmd_send_change_sta()
1896 cmd->if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_change_sta()
1899 cmd->if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_change_sta()
1902 pr_err("unsupported iftype %d\n", vif->wdev.iftype); in qtnf_cmd_send_change_sta()
1904 ret = -EINVAL; in qtnf_cmd_send_change_sta()
1908 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_change_sta()
1911 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_change_sta()
1923 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_sta()
1927 return -ENOMEM; in qtnf_cmd_send_del_sta()
1929 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_sta()
1931 cmd = (struct qlink_cmd_del_sta *)cmd_skb->data; in qtnf_cmd_send_del_sta()
1933 if (params->mac) in qtnf_cmd_send_del_sta()
1934 ether_addr_copy(cmd->sta_addr, params->mac); in qtnf_cmd_send_del_sta()
1936 eth_broadcast_addr(cmd->sta_addr); /* flush all stations */ in qtnf_cmd_send_del_sta()
1938 cmd->subtype = params->subtype; in qtnf_cmd_send_del_sta()
1939 cmd->reason_code = cpu_to_le16(params->reason_code); in qtnf_cmd_send_del_sta()
1941 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_sta()
1943 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_sta()
1955 qch = &tlv->chan; in qtnf_cmd_channel_tlv_add()
1956 tlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL); in qtnf_cmd_channel_tlv_add()
1957 tlv->hdr.len = cpu_to_le16(sizeof(*qch)); in qtnf_cmd_channel_tlv_add()
1959 qch->center_freq = cpu_to_le16(sc->center_freq); in qtnf_cmd_channel_tlv_add()
1960 qch->hw_value = cpu_to_le16(sc->hw_value); in qtnf_cmd_channel_tlv_add()
1961 qch->band = qlink_utils_band_cfg2q(sc->band); in qtnf_cmd_channel_tlv_add()
1962 qch->max_power = sc->max_power; in qtnf_cmd_channel_tlv_add()
1963 qch->max_reg_power = sc->max_reg_power; in qtnf_cmd_channel_tlv_add()
1964 qch->max_antenna_gain = sc->max_antenna_gain; in qtnf_cmd_channel_tlv_add()
1965 qch->beacon_found = sc->beacon_found; in qtnf_cmd_channel_tlv_add()
1966 qch->dfs_state = qlink_utils_dfs_state_cfg2q(sc->dfs_state); in qtnf_cmd_channel_tlv_add()
1967 qch->flags = cpu_to_le32(qlink_utils_chflags_cfg2q(sc->flags)); in qtnf_cmd_channel_tlv_add()
1978 hdr->type = cpu_to_le16(QTN_TLV_ID_RANDOM_MAC_ADDR); in qtnf_cmd_randmac_tlv_add()
1979 hdr->len = cpu_to_le16(sizeof(*randmac)); in qtnf_cmd_randmac_tlv_add()
1980 randmac = (struct qlink_random_mac_addr *)hdr->val; in qtnf_cmd_randmac_tlv_add()
1982 memcpy(randmac->mac_addr, mac_addr, ETH_ALEN); in qtnf_cmd_randmac_tlv_add()
1983 memcpy(randmac->mac_addr_mask, mac_addr_mask, ETH_ALEN); in qtnf_cmd_randmac_tlv_add()
1986 int qtnf_cmd_send_scan(struct qtnf_wmac *mac) in qtnf_cmd_send_scan() argument
1988 struct cfg80211_scan_request *scan_req = mac->scan_req; in qtnf_cmd_send_scan()
1991 struct wireless_dev *wdev = scan_req->wdev; in qtnf_cmd_send_scan()
2000 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_send_scan()
2004 return -ENOMEM; in qtnf_cmd_send_scan()
2006 cmd = (struct qlink_cmd_scan *)cmd_skb->data; in qtnf_cmd_send_scan()
2008 if (scan_req->duration) { in qtnf_cmd_send_scan()
2009 dwell_active = scan_req->duration; in qtnf_cmd_send_scan()
2010 dwell_passive = scan_req->duration; in qtnf_cmd_send_scan()
2011 } else if (wdev->iftype == NL80211_IFTYPE_STATION && in qtnf_cmd_send_scan()
2012 wdev->connected) { in qtnf_cmd_send_scan()
2018 cmd->n_ssids = cpu_to_le16(scan_req->n_ssids); in qtnf_cmd_send_scan()
2019 for (count = 0; count < scan_req->n_ssids; ++count) { in qtnf_cmd_send_scan()
2021 scan_req->ssids[count].ssid, in qtnf_cmd_send_scan()
2022 scan_req->ssids[count].ssid_len); in qtnf_cmd_send_scan()
2025 if (scan_req->ie_len != 0) in qtnf_cmd_send_scan()
2027 scan_req->ie, scan_req->ie_len); in qtnf_cmd_send_scan()
2029 for (count = 0; count < scan_req->n_channels; ++count) { in qtnf_cmd_send_scan()
2030 sc = scan_req->channels[count]; in qtnf_cmd_send_scan()
2031 if (sc->flags & IEEE80211_CHAN_DISABLED) in qtnf_cmd_send_scan()
2034 pr_debug("[MAC%u] scan chan=%d, freq=%d, flags=%#x\n", in qtnf_cmd_send_scan()
2035 mac->macid, sc->hw_value, sc->center_freq, in qtnf_cmd_send_scan()
2036 sc->flags); in qtnf_cmd_send_scan()
2042 if (scan_req->flags & NL80211_SCAN_FLAG_FLUSH) in qtnf_cmd_send_scan()
2045 if (scan_req->duration_mandatory) in qtnf_cmd_send_scan()
2048 cmd->n_channels = cpu_to_le16(n_channels); in qtnf_cmd_send_scan()
2049 cmd->active_dwell = cpu_to_le16(dwell_active); in qtnf_cmd_send_scan()
2050 cmd->passive_dwell = cpu_to_le16(dwell_passive); in qtnf_cmd_send_scan()
2051 cmd->sample_duration = cpu_to_le16(QTNF_SCAN_SAMPLE_DURATION_DEFAULT); in qtnf_cmd_send_scan()
2052 cmd->flags = cpu_to_le64(flags); in qtnf_cmd_send_scan()
2054 pr_debug("[MAC%u] %s scan dwell active=%u passive=%u duration=%u\n", in qtnf_cmd_send_scan()
2055 mac->macid, in qtnf_cmd_send_scan()
2056 scan_req->duration_mandatory ? "mandatory" : "max", in qtnf_cmd_send_scan()
2060 if (scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in qtnf_cmd_send_scan()
2061 pr_debug("[MAC%u] scan with random addr=%pM, mask=%pM\n", in qtnf_cmd_send_scan()
2062 mac->macid, in qtnf_cmd_send_scan()
2063 scan_req->mac_addr, scan_req->mac_addr_mask); in qtnf_cmd_send_scan()
2064 qtnf_cmd_randmac_tlv_add(cmd_skb, scan_req->mac_addr, in qtnf_cmd_send_scan()
2065 scan_req->mac_addr_mask); in qtnf_cmd_send_scan()
2068 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_scan()
2069 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_scan()
2070 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_scan()
2086 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_connect()
2090 return -ENOMEM; in qtnf_cmd_send_connect()
2092 cmd = (struct qlink_cmd_connect *)cmd_skb->data; in qtnf_cmd_send_connect()
2094 ether_addr_copy(cmd->bssid, vif->bssid); in qtnf_cmd_send_connect()
2096 if (sme->bssid_hint) in qtnf_cmd_send_connect()
2097 ether_addr_copy(cmd->bssid_hint, sme->bssid_hint); in qtnf_cmd_send_connect()
2099 eth_zero_addr(cmd->bssid_hint); in qtnf_cmd_send_connect()
2101 if (sme->prev_bssid) in qtnf_cmd_send_connect()
2102 ether_addr_copy(cmd->prev_bssid, sme->prev_bssid); in qtnf_cmd_send_connect()
2104 eth_zero_addr(cmd->prev_bssid); in qtnf_cmd_send_connect()
2106 if ((sme->bg_scan_period >= 0) && in qtnf_cmd_send_connect()
2107 (sme->bg_scan_period <= SHRT_MAX)) in qtnf_cmd_send_connect()
2108 cmd->bg_scan_period = cpu_to_le16(sme->bg_scan_period); in qtnf_cmd_send_connect()
2110 cmd->bg_scan_period = cpu_to_le16(-1); /* use default value */ in qtnf_cmd_send_connect()
2112 if (sme->flags & ASSOC_REQ_DISABLE_HT) in qtnf_cmd_send_connect()
2114 if (sme->flags & ASSOC_REQ_DISABLE_VHT) in qtnf_cmd_send_connect()
2116 if (sme->flags & ASSOC_REQ_USE_RRM) in qtnf_cmd_send_connect()
2119 cmd->flags = cpu_to_le32(connect_flags); in qtnf_cmd_send_connect()
2120 memcpy(&cmd->ht_capa, &sme->ht_capa, sizeof(cmd->ht_capa)); in qtnf_cmd_send_connect()
2121 memcpy(&cmd->ht_capa_mask, &sme->ht_capa_mask, in qtnf_cmd_send_connect()
2122 sizeof(cmd->ht_capa_mask)); in qtnf_cmd_send_connect()
2123 memcpy(&cmd->vht_capa, &sme->vht_capa, sizeof(cmd->vht_capa)); in qtnf_cmd_send_connect()
2124 memcpy(&cmd->vht_capa_mask, &sme->vht_capa_mask, in qtnf_cmd_send_connect()
2125 sizeof(cmd->vht_capa_mask)); in qtnf_cmd_send_connect()
2126 cmd->pbss = sme->pbss; in qtnf_cmd_send_connect()
2128 aen = &cmd->aen; in qtnf_cmd_send_connect()
2129 aen->auth_type = sme->auth_type; in qtnf_cmd_send_connect()
2130 aen->privacy = !!sme->privacy; in qtnf_cmd_send_connect()
2131 cmd->mfp = sme->mfp; in qtnf_cmd_send_connect()
2132 aen->wpa_versions = cpu_to_le32(sme->crypto.wpa_versions); in qtnf_cmd_send_connect()
2133 aen->cipher_group = cpu_to_le32(sme->crypto.cipher_group); in qtnf_cmd_send_connect()
2134 aen->n_ciphers_pairwise = cpu_to_le32(sme->crypto.n_ciphers_pairwise); in qtnf_cmd_send_connect()
2137 aen->ciphers_pairwise[i] = in qtnf_cmd_send_connect()
2138 cpu_to_le32(sme->crypto.ciphers_pairwise[i]); in qtnf_cmd_send_connect()
2140 n = min(QLINK_MAX_NR_AKM_SUITES, sme->crypto.n_akm_suites); in qtnf_cmd_send_connect()
2141 aen->n_akm_suites = cpu_to_le32(n); in qtnf_cmd_send_connect()
2144 aen->akm_suites[i] = cpu_to_le32(sme->crypto.akm_suites[i]); in qtnf_cmd_send_connect()
2146 aen->control_port = sme->crypto.control_port; in qtnf_cmd_send_connect()
2147 aen->control_port_no_encrypt = in qtnf_cmd_send_connect()
2148 sme->crypto.control_port_no_encrypt; in qtnf_cmd_send_connect()
2149 aen->control_port_ethertype = in qtnf_cmd_send_connect()
2150 cpu_to_le16(be16_to_cpu(sme->crypto.control_port_ethertype)); in qtnf_cmd_send_connect()
2152 qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, sme->ssid, in qtnf_cmd_send_connect()
2153 sme->ssid_len); in qtnf_cmd_send_connect()
2155 if (sme->ie_len != 0) in qtnf_cmd_send_connect()
2157 sme->ie, sme->ie_len); in qtnf_cmd_send_connect()
2159 if (sme->channel) in qtnf_cmd_send_connect()
2160 qtnf_cmd_channel_tlv_add(cmd_skb, sme->channel); in qtnf_cmd_send_connect()
2162 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_connect()
2163 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_connect()
2164 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_connect()
2176 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_external_auth()
2180 return -ENOMEM; in qtnf_cmd_send_external_auth()
2182 cmd = (struct qlink_cmd_external_auth *)cmd_skb->data; in qtnf_cmd_send_external_auth()
2184 ether_addr_copy(cmd->peer, auth->bssid); in qtnf_cmd_send_external_auth()
2185 cmd->status = cpu_to_le16(auth->status); in qtnf_cmd_send_external_auth()
2187 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_external_auth()
2188 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_external_auth()
2189 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_external_auth()
2200 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_disconnect()
2204 return -ENOMEM; in qtnf_cmd_send_disconnect()
2206 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_disconnect()
2208 cmd = (struct qlink_cmd_disconnect *)cmd_skb->data; in qtnf_cmd_send_disconnect()
2209 cmd->reason = cpu_to_le16(reason_code); in qtnf_cmd_send_disconnect()
2211 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_disconnect()
2213 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_disconnect()
2224 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_updown_intf()
2228 return -ENOMEM; in qtnf_cmd_send_updown_intf()
2230 cmd = (struct qlink_cmd_updown *)cmd_skb->data; in qtnf_cmd_send_updown_intf()
2231 cmd->if_up = !!up; in qtnf_cmd_send_updown_intf()
2233 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_updown_intf()
2234 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_updown_intf()
2235 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_updown_intf()
2240 int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req, in qtnf_cmd_reg_notify() argument
2243 struct wiphy *wiphy = priv_to_wiphy(mac); in qtnf_cmd_reg_notify()
2244 struct qtnf_bus *bus = mac->bus; in qtnf_cmd_reg_notify()
2251 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_reg_notify()
2255 return -ENOMEM; in qtnf_cmd_reg_notify()
2257 cmd = (struct qlink_cmd_reg_notify *)cmd_skb->data; in qtnf_cmd_reg_notify()
2258 cmd->alpha2[0] = req->alpha2[0]; in qtnf_cmd_reg_notify()
2259 cmd->alpha2[1] = req->alpha2[1]; in qtnf_cmd_reg_notify()
2261 switch (req->initiator) { in qtnf_cmd_reg_notify()
2263 cmd->initiator = QLINK_REGDOM_SET_BY_CORE; in qtnf_cmd_reg_notify()
2266 cmd->initiator = QLINK_REGDOM_SET_BY_USER; in qtnf_cmd_reg_notify()
2269 cmd->initiator = QLINK_REGDOM_SET_BY_DRIVER; in qtnf_cmd_reg_notify()
2272 cmd->initiator = QLINK_REGDOM_SET_BY_COUNTRY_IE; in qtnf_cmd_reg_notify()
2276 switch (req->user_reg_hint_type) { in qtnf_cmd_reg_notify()
2278 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_USER; in qtnf_cmd_reg_notify()
2281 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_CELL_BASE; in qtnf_cmd_reg_notify()
2284 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_INDOOR; in qtnf_cmd_reg_notify()
2288 switch (req->dfs_region) { in qtnf_cmd_reg_notify()
2290 cmd->dfs_region = QLINK_DFS_FCC; in qtnf_cmd_reg_notify()
2293 cmd->dfs_region = QLINK_DFS_ETSI; in qtnf_cmd_reg_notify()
2296 cmd->dfs_region = QLINK_DFS_JP; in qtnf_cmd_reg_notify()
2299 cmd->dfs_region = QLINK_DFS_UNSET; in qtnf_cmd_reg_notify()
2303 cmd->slave_radar = slave_radar; in qtnf_cmd_reg_notify()
2304 cmd->dfs_offload = dfs_offload; in qtnf_cmd_reg_notify()
2305 cmd->num_channels = 0; in qtnf_cmd_reg_notify()
2310 cfg_band = wiphy->bands[band]; in qtnf_cmd_reg_notify()
2314 cmd->num_channels += cfg_band->n_channels; in qtnf_cmd_reg_notify()
2316 for (i = 0; i < cfg_band->n_channels; ++i) { in qtnf_cmd_reg_notify()
2318 &cfg_band->channels[i]); in qtnf_cmd_reg_notify()
2342 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_proc_chan_stat_info()
2343 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_cmd_resp_proc_chan_stat_info()
2347 map = tlv->val; in qtnf_cmd_resp_proc_chan_stat_info()
2351 stats = (struct qlink_chan_stats *)tlv->val; in qtnf_cmd_resp_proc_chan_stat_info()
2362 return -EINVAL; in qtnf_cmd_resp_proc_chan_stat_info()
2373 survey->filled |= SURVEY_INFO_TIME; in qtnf_cmd_resp_proc_chan_stat_info()
2374 survey->time = le64_to_cpu(stats->time_on); in qtnf_cmd_resp_proc_chan_stat_info()
2378 survey->filled |= SURVEY_INFO_TIME_TX; in qtnf_cmd_resp_proc_chan_stat_info()
2379 survey->time_tx = le64_to_cpu(stats->time_tx); in qtnf_cmd_resp_proc_chan_stat_info()
2383 survey->filled |= SURVEY_INFO_TIME_RX; in qtnf_cmd_resp_proc_chan_stat_info()
2384 survey->time_rx = le64_to_cpu(stats->time_rx); in qtnf_cmd_resp_proc_chan_stat_info()
2388 survey->filled |= SURVEY_INFO_TIME_BUSY; in qtnf_cmd_resp_proc_chan_stat_info()
2389 survey->time_busy = le64_to_cpu(stats->cca_busy); in qtnf_cmd_resp_proc_chan_stat_info()
2393 survey->filled |= SURVEY_INFO_TIME_EXT_BUSY; in qtnf_cmd_resp_proc_chan_stat_info()
2394 survey->time_ext_busy = le64_to_cpu(stats->cca_busy_ext); in qtnf_cmd_resp_proc_chan_stat_info()
2398 survey->filled |= SURVEY_INFO_TIME_SCAN; in qtnf_cmd_resp_proc_chan_stat_info()
2399 survey->time_scan = le64_to_cpu(stats->time_scan); in qtnf_cmd_resp_proc_chan_stat_info()
2403 survey->filled |= SURVEY_INFO_NOISE_DBM; in qtnf_cmd_resp_proc_chan_stat_info()
2404 survey->noise = stats->chan_noise; in qtnf_cmd_resp_proc_chan_stat_info()
2412 int qtnf_cmd_get_chan_stats(struct qtnf_wmac *mac, u32 chan_freq, in qtnf_cmd_get_chan_stats() argument
2421 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_get_chan_stats()
2425 return -ENOMEM; in qtnf_cmd_get_chan_stats()
2427 cmd = (struct qlink_cmd_get_chan_stats *)cmd_skb->data; in qtnf_cmd_get_chan_stats()
2428 cmd->channel_freq = cpu_to_le32(chan_freq); in qtnf_cmd_get_chan_stats()
2430 qtnf_bus_lock(mac->bus); in qtnf_cmd_get_chan_stats()
2431 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_chan_stats()
2433 qtnf_bus_unlock(mac->bus); in qtnf_cmd_get_chan_stats()
2438 resp = (struct qlink_resp_get_chan_stats *)resp_skb->data; in qtnf_cmd_get_chan_stats()
2440 if (le32_to_cpu(resp->chan_freq) != chan_freq) { in qtnf_cmd_get_chan_stats()
2441 pr_err("[MAC%u] channel stats freq %u != requested %u\n", in qtnf_cmd_get_chan_stats()
2442 mac->macid, le32_to_cpu(resp->chan_freq), chan_freq); in qtnf_cmd_get_chan_stats()
2443 ret = -EINVAL; in qtnf_cmd_get_chan_stats()
2447 ret = qtnf_cmd_resp_proc_chan_stat_info(survey, resp->info, in qtnf_cmd_get_chan_stats()
2459 struct qtnf_wmac *mac = vif->mac; in qtnf_cmd_send_chan_switch() local
2465 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, vif->vifid, in qtnf_cmd_send_chan_switch()
2469 return -ENOMEM; in qtnf_cmd_send_chan_switch()
2471 if (params->radar_required) in qtnf_cmd_send_chan_switch()
2474 if (params->block_tx) in qtnf_cmd_send_chan_switch()
2477 cmd = (struct qlink_cmd_chan_switch *)cmd_skb->data; in qtnf_cmd_send_chan_switch()
2478 qlink_chandef_cfg2q(¶ms->chandef, &cmd->channel); in qtnf_cmd_send_chan_switch()
2479 cmd->flags = cpu_to_le64(flags); in qtnf_cmd_send_chan_switch()
2480 cmd->beacon_count = params->count; in qtnf_cmd_send_chan_switch()
2482 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_chan_switch()
2483 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_chan_switch()
2484 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_chan_switch()
2491 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_get_channel()
2497 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_channel()
2501 return -ENOMEM; in qtnf_cmd_get_channel()
2509 resp = (const struct qlink_resp_channel_get *)resp_skb->data; in qtnf_cmd_get_channel()
2510 qlink_chandef_q2cfg(priv_to_wiphy(vif->mac), &resp->chan, chdef); in qtnf_cmd_get_channel()
2523 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_start_cac()
2528 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_start_cac()
2532 return -ENOMEM; in qtnf_cmd_start_cac()
2534 cmd = (struct qlink_cmd_start_cac *)cmd_skb->data; in qtnf_cmd_start_cac()
2535 cmd->cac_time_ms = cpu_to_le32(cac_time_ms); in qtnf_cmd_start_cac()
2536 qlink_chandef_cfg2q(chdef, &cmd->chan); in qtnf_cmd_start_cac()
2548 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_set_mac_acl()
2551 size_t acl_size = struct_size(params, mac_addrs, params->n_acl_entries); in qtnf_cmd_set_mac_acl()
2554 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_set_mac_acl()
2558 return -ENOMEM; in qtnf_cmd_set_mac_acl()
2561 tlv->type = cpu_to_le16(QTN_TLV_ID_ACL_DATA); in qtnf_cmd_set_mac_acl()
2562 tlv->len = cpu_to_le16(acl_size); in qtnf_cmd_set_mac_acl()
2563 qlink_acl_data_cfg2q(params, (struct qlink_acl_data *)tlv->val); in qtnf_cmd_set_mac_acl()
2574 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_send_pm_set()
2579 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_pm_set()
2582 return -ENOMEM; in qtnf_cmd_send_pm_set()
2584 cmd = (struct qlink_cmd_pm_set *)cmd_skb->data; in qtnf_cmd_send_pm_set()
2585 cmd->pm_mode = pm_mode; in qtnf_cmd_send_pm_set()
2586 cmd->pm_standby_timer = cpu_to_le32(timeout); in qtnf_cmd_send_pm_set()
2599 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_get_tx_power()
2606 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_tx_power()
2609 return -ENOMEM; in qtnf_cmd_get_tx_power()
2611 cmd = (struct qlink_cmd_txpwr *)cmd_skb->data; in qtnf_cmd_get_tx_power()
2612 cmd->op_type = QLINK_TXPWR_GET; in qtnf_cmd_get_tx_power()
2621 resp = (const struct qlink_resp_txpwr *)resp_skb->data; in qtnf_cmd_get_tx_power()
2622 *dbm = MBM_TO_DBM(le32_to_cpu(resp->txpwr)); in qtnf_cmd_get_tx_power()
2634 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_set_tx_power()
2641 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_set_tx_power()
2644 return -ENOMEM; in qtnf_cmd_set_tx_power()
2646 cmd = (struct qlink_cmd_txpwr *)cmd_skb->data; in qtnf_cmd_set_tx_power()
2647 cmd->op_type = QLINK_TXPWR_SET; in qtnf_cmd_set_tx_power()
2648 cmd->txpwr_setting = type; in qtnf_cmd_set_tx_power()
2649 cmd->txpwr = cpu_to_le32(mbm); in qtnf_cmd_set_tx_power()
2665 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_send_wowlan_set()
2672 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_wowlan_set()
2675 return -ENOMEM; in qtnf_cmd_send_wowlan_set()
2679 cmd = (struct qlink_cmd_wowlan_set *)cmd_skb->data; in qtnf_cmd_send_wowlan_set()
2682 if (wowl->disconnect) in qtnf_cmd_send_wowlan_set()
2685 if (wowl->magic_pkt) in qtnf_cmd_send_wowlan_set()
2688 if (wowl->n_patterns && wowl->patterns) { in qtnf_cmd_send_wowlan_set()
2690 while (count < wowl->n_patterns) { in qtnf_cmd_send_wowlan_set()
2693 wowl->patterns[count].pattern, in qtnf_cmd_send_wowlan_set()
2694 wowl->patterns[count].pattern_len); in qtnf_cmd_send_wowlan_set()
2700 cmd->triggers = cpu_to_le32(triggers); in qtnf_cmd_send_wowlan_set()
2710 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_netdev_changeupper()
2715 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_netdev_changeupper()
2719 return -ENOMEM; in qtnf_cmd_netdev_changeupper()
2722 vif->mac->macid, vif->vifid, br_domain); in qtnf_cmd_netdev_changeupper()
2724 cmd = (struct qlink_cmd_ndev_changeupper *)cmd_skb->data; in qtnf_cmd_netdev_changeupper()
2725 cmd->nehdr.event = cpu_to_le16(QLINK_NDEV_EVENT_CHANGEUPPER); in qtnf_cmd_netdev_changeupper()
2726 cmd->upper_type = QLINK_NDEV_UPPER_TYPE_BRIDGE; in qtnf_cmd_netdev_changeupper()
2727 cmd->br_domain = cpu_to_le32(br_domain); in qtnf_cmd_netdev_changeupper()
2735 vif->mac->macid, vif->vifid); in qtnf_cmd_netdev_changeupper()
2747 if (sizeof(*cmd) + owe->ie_len > QTNF_MAX_CMD_BUF_SIZE) { in qtnf_cmd_send_update_owe()
2749 vif->mac->macid, vif->vifid, owe->ie_len); in qtnf_cmd_send_update_owe()
2750 return -E2BIG; in qtnf_cmd_send_update_owe()
2753 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_update_owe()
2757 return -ENOMEM; in qtnf_cmd_send_update_owe()
2759 cmd = (struct qlink_cmd_update_owe *)cmd_skb->data; in qtnf_cmd_send_update_owe()
2760 ether_addr_copy(cmd->peer, owe->peer); in qtnf_cmd_send_update_owe()
2761 cmd->status = cpu_to_le16(owe->status); in qtnf_cmd_send_update_owe()
2762 if (owe->ie_len && owe->ie) in qtnf_cmd_send_update_owe()
2763 qtnf_cmd_skb_put_buffer(cmd_skb, owe->ie, owe->ie_len); in qtnf_cmd_send_update_owe()
2765 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_update_owe()
2766 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_update_owe()
2767 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_update_owe()