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()
1328 size_t payload_len = tlv->n_iftype_data * sizeof(*tlv->iftype_data) + in qtnf_cmd_band_fill_iftype()
1329 sizeof(*tlv) - in qtnf_cmd_band_fill_iftype()
1332 if (tlv->hdr.len != cpu_to_le16(payload_len)) { in qtnf_cmd_band_fill_iftype()
1333 pr_err("bad IFTYPE_DATA TLV len %u\n", tlv->hdr.len); in qtnf_cmd_band_fill_iftype()
1334 return -EINVAL; in qtnf_cmd_band_fill_iftype()
1337 kfree(band->iftype_data); in qtnf_cmd_band_fill_iftype()
1338 band->iftype_data = NULL; in qtnf_cmd_band_fill_iftype()
1339 band->n_iftype_data = tlv->n_iftype_data; in qtnf_cmd_band_fill_iftype()
1340 if (band->n_iftype_data == 0) in qtnf_cmd_band_fill_iftype()
1343 iftype_data = kcalloc(band->n_iftype_data, sizeof(*iftype_data), in qtnf_cmd_band_fill_iftype()
1346 band->n_iftype_data = 0; in qtnf_cmd_band_fill_iftype()
1347 return -ENOMEM; in qtnf_cmd_band_fill_iftype()
1349 band->iftype_data = iftype_data; in qtnf_cmd_band_fill_iftype()
1351 for (i = 0; i < band->n_iftype_data; i++) in qtnf_cmd_band_fill_iftype()
1352 qtnf_cmd_conv_iftype(iftype_data++, &tlv->iftype_data[i]); in qtnf_cmd_band_fill_iftype()
1369 int ret = -EINVAL; in qtnf_cmd_resp_fill_band_info()
1371 memset(&band->ht_cap, 0, sizeof(band->ht_cap)); in qtnf_cmd_resp_fill_band_info()
1372 memset(&band->vht_cap, 0, sizeof(band->vht_cap)); in qtnf_cmd_resp_fill_band_info()
1374 if (band->channels) { in qtnf_cmd_resp_fill_band_info()
1375 if (band->n_channels == resp->num_chans) { in qtnf_cmd_resp_fill_band_info()
1376 memset(band->channels, 0, in qtnf_cmd_resp_fill_band_info()
1377 sizeof(*band->channels) * band->n_channels); in qtnf_cmd_resp_fill_band_info()
1379 kfree(band->channels); in qtnf_cmd_resp_fill_band_info()
1380 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1381 band->channels = NULL; in qtnf_cmd_resp_fill_band_info()
1385 band->n_channels = resp->num_chans; in qtnf_cmd_resp_fill_band_info()
1386 if (band->n_channels == 0) in qtnf_cmd_resp_fill_band_info()
1389 if (!band->channels) in qtnf_cmd_resp_fill_band_info()
1390 band->channels = kcalloc(band->n_channels, sizeof(*chan), in qtnf_cmd_resp_fill_band_info()
1392 if (!band->channels) { in qtnf_cmd_resp_fill_band_info()
1393 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1394 return -ENOMEM; in qtnf_cmd_resp_fill_band_info()
1397 qlink_for_each_tlv(tlv, resp->info, payload_len) { in qtnf_cmd_resp_fill_band_info()
1398 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_fill_band_info()
1399 tlv_dlen = le16_to_cpu(tlv->len); in qtnf_cmd_resp_fill_band_info()
1409 if (chidx == band->n_channels) { in qtnf_cmd_resp_fill_band_info()
1414 qchan = (const struct qlink_channel *)tlv->val; in qtnf_cmd_resp_fill_band_info()
1415 chan = &band->channels[chidx++]; in qtnf_cmd_resp_fill_band_info()
1416 qflags = le32_to_cpu(qchan->flags); in qtnf_cmd_resp_fill_band_info()
1418 chan->hw_value = le16_to_cpu(qchan->hw_value); in qtnf_cmd_resp_fill_band_info()
1419 chan->band = band->band; in qtnf_cmd_resp_fill_band_info()
1420 chan->center_freq = le16_to_cpu(qchan->center_freq); in qtnf_cmd_resp_fill_band_info()
1421 chan->max_antenna_gain = (int)qchan->max_antenna_gain; in qtnf_cmd_resp_fill_band_info()
1422 chan->max_power = (int)qchan->max_power; in qtnf_cmd_resp_fill_band_info()
1423 chan->max_reg_power = (int)qchan->max_reg_power; in qtnf_cmd_resp_fill_band_info()
1424 chan->beacon_found = qchan->beacon_found; in qtnf_cmd_resp_fill_band_info()
1425 chan->dfs_cac_ms = le32_to_cpu(qchan->dfs_cac_ms); in qtnf_cmd_resp_fill_band_info()
1426 chan->flags = 0; in qtnf_cmd_resp_fill_band_info()
1429 chan->flags |= IEEE80211_CHAN_DISABLED; in qtnf_cmd_resp_fill_band_info()
1432 chan->flags |= IEEE80211_CHAN_NO_IR; in qtnf_cmd_resp_fill_band_info()
1435 chan->flags |= IEEE80211_CHAN_NO_HT40PLUS; in qtnf_cmd_resp_fill_band_info()
1438 chan->flags |= IEEE80211_CHAN_NO_HT40MINUS; in qtnf_cmd_resp_fill_band_info()
1441 chan->flags |= IEEE80211_CHAN_NO_OFDM; in qtnf_cmd_resp_fill_band_info()
1444 chan->flags |= IEEE80211_CHAN_NO_80MHZ; in qtnf_cmd_resp_fill_band_info()
1447 chan->flags |= IEEE80211_CHAN_NO_160MHZ; in qtnf_cmd_resp_fill_band_info()
1450 chan->flags |= IEEE80211_CHAN_INDOOR_ONLY; in qtnf_cmd_resp_fill_band_info()
1453 chan->flags |= IEEE80211_CHAN_IR_CONCURRENT; in qtnf_cmd_resp_fill_band_info()
1456 chan->flags |= IEEE80211_CHAN_NO_20MHZ; in qtnf_cmd_resp_fill_band_info()
1459 chan->flags |= IEEE80211_CHAN_NO_10MHZ; in qtnf_cmd_resp_fill_band_info()
1462 chan->flags |= IEEE80211_CHAN_RADAR; in qtnf_cmd_resp_fill_band_info()
1463 chan->dfs_state_entered = jiffies; in qtnf_cmd_resp_fill_band_info()
1465 if (qchan->dfs_state == QLINK_DFS_USABLE) in qtnf_cmd_resp_fill_band_info()
1466 chan->dfs_state = NL80211_DFS_USABLE; in qtnf_cmd_resp_fill_band_info()
1467 else if (qchan->dfs_state == in qtnf_cmd_resp_fill_band_info()
1469 chan->dfs_state = NL80211_DFS_AVAILABLE; in qtnf_cmd_resp_fill_band_info()
1471 chan->dfs_state = in qtnf_cmd_resp_fill_band_info()
1476 chan->hw_value, chan->flags, chan->max_power, in qtnf_cmd_resp_fill_band_info()
1477 chan->max_reg_power); in qtnf_cmd_resp_fill_band_info()
1486 qtnf_cmd_resp_band_fill_htcap(tlv->val, &band->ht_cap); in qtnf_cmd_resp_fill_band_info()
1495 qtnf_cmd_resp_band_fill_vhtcap(tlv->val, in qtnf_cmd_resp_fill_band_info()
1496 &band->vht_cap); in qtnf_cmd_resp_fill_band_info()
1510 if (!qlink_tlv_parsing_ok(tlv, resp->info, payload_len)) { in qtnf_cmd_resp_fill_band_info()
1515 if (band->n_channels != chidx) { in qtnf_cmd_resp_fill_band_info()
1517 band->n_channels, chidx); in qtnf_cmd_resp_fill_band_info()
1524 kfree(band->channels); in qtnf_cmd_resp_fill_band_info()
1525 band->channels = NULL; in qtnf_cmd_resp_fill_band_info()
1526 band->n_channels = 0; in qtnf_cmd_resp_fill_band_info()
1531 int qtnf_cmd_get_mac_info(struct qtnf_wmac *mac) in qtnf_cmd_get_mac_info() argument
1538 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_get_mac_info()
1542 return -ENOMEM; in qtnf_cmd_get_mac_info()
1544 qtnf_bus_lock(mac->bus); in qtnf_cmd_get_mac_info()
1545 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_mac_info()
1550 resp = (const struct qlink_resp_get_mac_info *)resp_skb->data; in qtnf_cmd_get_mac_info()
1551 ret = qtnf_cmd_resp_proc_mac_info(mac, resp); in qtnf_cmd_get_mac_info()
1555 ret = qtnf_parse_variable_mac_info(mac, resp, var_data_len); in qtnf_cmd_get_mac_info()
1558 qtnf_bus_unlock(mac->bus); in qtnf_cmd_get_mac_info()
1575 return -ENOMEM; in qtnf_cmd_get_hw_info()
1583 resp = (const struct qlink_resp_get_hw_info *)resp_skb->data; in qtnf_cmd_get_hw_info()
1593 int qtnf_cmd_band_info_get(struct qtnf_wmac *mac, in qtnf_cmd_band_info_get() argument
1601 u8 qband = qlink_utils_band_cfg2q(band->band); in qtnf_cmd_band_info_get()
1603 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_band_info_get()
1607 return -ENOMEM; in qtnf_cmd_band_info_get()
1609 cmd = (struct qlink_cmd_band_info_get *)cmd_skb->data; in qtnf_cmd_band_info_get()
1610 cmd->band = qband; in qtnf_cmd_band_info_get()
1612 qtnf_bus_lock(mac->bus); in qtnf_cmd_band_info_get()
1613 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_band_info_get()
1618 resp = (struct qlink_resp_band_info_get *)resp_skb->data; in qtnf_cmd_band_info_get()
1619 if (resp->band != qband) { in qtnf_cmd_band_info_get()
1620 pr_err("MAC%u: reply band %u != cmd band %u\n", mac->macid, in qtnf_cmd_band_info_get()
1621 resp->band, qband); in qtnf_cmd_band_info_get()
1622 ret = -EINVAL; in qtnf_cmd_band_info_get()
1629 qtnf_bus_unlock(mac->bus); in qtnf_cmd_band_info_get()
1635 int qtnf_cmd_send_update_phy_params(struct qtnf_wmac *mac, u32 changed) in qtnf_cmd_send_update_phy_params() argument
1637 struct wiphy *wiphy = priv_to_wiphy(mac); in qtnf_cmd_send_update_phy_params()
1641 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, in qtnf_cmd_send_update_phy_params()
1645 return -ENOMEM; in qtnf_cmd_send_update_phy_params()
1647 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_update_phy_params()
1651 wiphy->frag_threshold); in qtnf_cmd_send_update_phy_params()
1654 wiphy->rts_threshold); in qtnf_cmd_send_update_phy_params()
1657 wiphy->coverage_class); in qtnf_cmd_send_update_phy_params()
1661 wiphy->retry_long); in qtnf_cmd_send_update_phy_params()
1665 wiphy->retry_short); in qtnf_cmd_send_update_phy_params()
1667 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_update_phy_params()
1669 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_update_phy_params()
1687 return -ENOMEM; in qtnf_cmd_send_init_fw()
1689 cmd = (struct qlink_cmd_init_fw *)cmd_skb->data; in qtnf_cmd_send_init_fw()
1690 cmd->qlink_proto_ver = cpu_to_le32(QLINK_PROTO_VER); in qtnf_cmd_send_init_fw()
1700 resp = (struct qlink_resp_init_fw *)resp_skb->data; in qtnf_cmd_send_init_fw()
1701 bus->hw_info.ql_proto_ver = le32_to_cpu(resp->qlink_proto_ver); in qtnf_cmd_send_init_fw()
1730 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_add_key()
1734 return -ENOMEM; in qtnf_cmd_send_add_key()
1736 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_add_key()
1738 cmd = (struct qlink_cmd_add_key *)cmd_skb->data; in qtnf_cmd_send_add_key()
1741 ether_addr_copy(cmd->addr, mac_addr); in qtnf_cmd_send_add_key()
1743 eth_broadcast_addr(cmd->addr); in qtnf_cmd_send_add_key()
1745 cmd->cipher = cpu_to_le32(params->cipher); in qtnf_cmd_send_add_key()
1746 cmd->key_index = key_index; in qtnf_cmd_send_add_key()
1747 cmd->pairwise = pairwise; in qtnf_cmd_send_add_key()
1749 if (params->key && params->key_len > 0) in qtnf_cmd_send_add_key()
1751 params->key, in qtnf_cmd_send_add_key()
1752 params->key_len); in qtnf_cmd_send_add_key()
1754 if (params->seq && params->seq_len > 0) in qtnf_cmd_send_add_key()
1756 params->seq, in qtnf_cmd_send_add_key()
1757 params->seq_len); in qtnf_cmd_send_add_key()
1759 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_add_key()
1761 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_add_key()
1773 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_key()
1777 return -ENOMEM; in qtnf_cmd_send_del_key()
1779 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_key()
1781 cmd = (struct qlink_cmd_del_key *)cmd_skb->data; in qtnf_cmd_send_del_key()
1784 ether_addr_copy(cmd->addr, mac_addr); in qtnf_cmd_send_del_key()
1786 eth_broadcast_addr(cmd->addr); in qtnf_cmd_send_del_key()
1788 cmd->key_index = key_index; in qtnf_cmd_send_del_key()
1789 cmd->pairwise = pairwise; in qtnf_cmd_send_del_key()
1791 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_key()
1793 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_key()
1805 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_set_default_key()
1809 return -ENOMEM; in qtnf_cmd_send_set_default_key()
1811 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_set_default_key()
1813 cmd = (struct qlink_cmd_set_def_key *)cmd_skb->data; in qtnf_cmd_send_set_default_key()
1814 cmd->key_index = key_index; in qtnf_cmd_send_set_default_key()
1815 cmd->unicast = unicast; in qtnf_cmd_send_set_default_key()
1816 cmd->multicast = multicast; in qtnf_cmd_send_set_default_key()
1818 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_set_default_key()
1820 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_set_default_key()
1831 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_set_default_mgmt_key()
1835 return -ENOMEM; in qtnf_cmd_send_set_default_mgmt_key()
1837 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_set_default_mgmt_key()
1839 cmd = (struct qlink_cmd_set_def_mgmt_key *)cmd_skb->data; in qtnf_cmd_send_set_default_mgmt_key()
1840 cmd->key_index = key_index; in qtnf_cmd_send_set_default_mgmt_key()
1842 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_set_default_mgmt_key()
1844 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_set_default_mgmt_key()
1870 int qtnf_cmd_send_change_sta(struct qtnf_vif *vif, const u8 *mac, in qtnf_cmd_send_change_sta() argument
1877 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_change_sta()
1881 return -ENOMEM; in qtnf_cmd_send_change_sta()
1883 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_change_sta()
1885 cmd = (struct qlink_cmd_change_sta *)cmd_skb->data; in qtnf_cmd_send_change_sta()
1886 ether_addr_copy(cmd->sta_addr, mac); in qtnf_cmd_send_change_sta()
1887 cmd->flag_update.mask = in qtnf_cmd_send_change_sta()
1888 cpu_to_le32(qtnf_encode_sta_flags(params->sta_flags_mask)); in qtnf_cmd_send_change_sta()
1889 cmd->flag_update.value = in qtnf_cmd_send_change_sta()
1890 cpu_to_le32(qtnf_encode_sta_flags(params->sta_flags_set)); in qtnf_cmd_send_change_sta()
1892 switch (vif->wdev.iftype) { in qtnf_cmd_send_change_sta()
1894 cmd->if_type = cpu_to_le16(QLINK_IFTYPE_AP); in qtnf_cmd_send_change_sta()
1897 cmd->if_type = cpu_to_le16(QLINK_IFTYPE_STATION); in qtnf_cmd_send_change_sta()
1900 pr_err("unsupported iftype %d\n", vif->wdev.iftype); in qtnf_cmd_send_change_sta()
1902 ret = -EINVAL; in qtnf_cmd_send_change_sta()
1906 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_change_sta()
1909 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_change_sta()
1921 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_del_sta()
1925 return -ENOMEM; in qtnf_cmd_send_del_sta()
1927 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_del_sta()
1929 cmd = (struct qlink_cmd_del_sta *)cmd_skb->data; in qtnf_cmd_send_del_sta()
1931 if (params->mac) in qtnf_cmd_send_del_sta()
1932 ether_addr_copy(cmd->sta_addr, params->mac); in qtnf_cmd_send_del_sta()
1934 eth_broadcast_addr(cmd->sta_addr); /* flush all stations */ in qtnf_cmd_send_del_sta()
1936 cmd->subtype = params->subtype; in qtnf_cmd_send_del_sta()
1937 cmd->reason_code = cpu_to_le16(params->reason_code); in qtnf_cmd_send_del_sta()
1939 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_del_sta()
1941 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_del_sta()
1953 qch = &tlv->chan; in qtnf_cmd_channel_tlv_add()
1954 tlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL); in qtnf_cmd_channel_tlv_add()
1955 tlv->hdr.len = cpu_to_le16(sizeof(*qch)); in qtnf_cmd_channel_tlv_add()
1957 qch->center_freq = cpu_to_le16(sc->center_freq); in qtnf_cmd_channel_tlv_add()
1958 qch->hw_value = cpu_to_le16(sc->hw_value); in qtnf_cmd_channel_tlv_add()
1959 qch->band = qlink_utils_band_cfg2q(sc->band); in qtnf_cmd_channel_tlv_add()
1960 qch->max_power = sc->max_power; in qtnf_cmd_channel_tlv_add()
1961 qch->max_reg_power = sc->max_reg_power; in qtnf_cmd_channel_tlv_add()
1962 qch->max_antenna_gain = sc->max_antenna_gain; in qtnf_cmd_channel_tlv_add()
1963 qch->beacon_found = sc->beacon_found; in qtnf_cmd_channel_tlv_add()
1964 qch->dfs_state = qlink_utils_dfs_state_cfg2q(sc->dfs_state); in qtnf_cmd_channel_tlv_add()
1965 qch->flags = cpu_to_le32(qlink_utils_chflags_cfg2q(sc->flags)); in qtnf_cmd_channel_tlv_add()
1976 hdr->type = cpu_to_le16(QTN_TLV_ID_RANDOM_MAC_ADDR); in qtnf_cmd_randmac_tlv_add()
1977 hdr->len = cpu_to_le16(sizeof(*randmac)); in qtnf_cmd_randmac_tlv_add()
1978 randmac = (struct qlink_random_mac_addr *)hdr->val; in qtnf_cmd_randmac_tlv_add()
1980 memcpy(randmac->mac_addr, mac_addr, ETH_ALEN); in qtnf_cmd_randmac_tlv_add()
1981 memcpy(randmac->mac_addr_mask, mac_addr_mask, ETH_ALEN); in qtnf_cmd_randmac_tlv_add()
1984 int qtnf_cmd_send_scan(struct qtnf_wmac *mac) in qtnf_cmd_send_scan() argument
1986 struct cfg80211_scan_request *scan_req = mac->scan_req; in qtnf_cmd_send_scan()
1989 struct wireless_dev *wdev = scan_req->wdev; in qtnf_cmd_send_scan()
1998 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_send_scan()
2002 return -ENOMEM; in qtnf_cmd_send_scan()
2004 cmd = (struct qlink_cmd_scan *)cmd_skb->data; in qtnf_cmd_send_scan()
2006 if (scan_req->duration) { in qtnf_cmd_send_scan()
2007 dwell_active = scan_req->duration; in qtnf_cmd_send_scan()
2008 dwell_passive = scan_req->duration; in qtnf_cmd_send_scan()
2009 } else if (wdev->iftype == NL80211_IFTYPE_STATION && in qtnf_cmd_send_scan()
2010 wdev->connected) { in qtnf_cmd_send_scan()
2016 cmd->n_ssids = cpu_to_le16(scan_req->n_ssids); in qtnf_cmd_send_scan()
2017 for (count = 0; count < scan_req->n_ssids; ++count) { in qtnf_cmd_send_scan()
2019 scan_req->ssids[count].ssid, in qtnf_cmd_send_scan()
2020 scan_req->ssids[count].ssid_len); in qtnf_cmd_send_scan()
2023 if (scan_req->ie_len != 0) in qtnf_cmd_send_scan()
2025 scan_req->ie, scan_req->ie_len); in qtnf_cmd_send_scan()
2027 for (count = 0; count < scan_req->n_channels; ++count) { in qtnf_cmd_send_scan()
2028 sc = scan_req->channels[count]; in qtnf_cmd_send_scan()
2029 if (sc->flags & IEEE80211_CHAN_DISABLED) in qtnf_cmd_send_scan()
2032 pr_debug("[MAC%u] scan chan=%d, freq=%d, flags=%#x\n", in qtnf_cmd_send_scan()
2033 mac->macid, sc->hw_value, sc->center_freq, in qtnf_cmd_send_scan()
2034 sc->flags); in qtnf_cmd_send_scan()
2040 if (scan_req->flags & NL80211_SCAN_FLAG_FLUSH) in qtnf_cmd_send_scan()
2043 if (scan_req->duration_mandatory) in qtnf_cmd_send_scan()
2046 cmd->n_channels = cpu_to_le16(n_channels); in qtnf_cmd_send_scan()
2047 cmd->active_dwell = cpu_to_le16(dwell_active); in qtnf_cmd_send_scan()
2048 cmd->passive_dwell = cpu_to_le16(dwell_passive); in qtnf_cmd_send_scan()
2049 cmd->sample_duration = cpu_to_le16(QTNF_SCAN_SAMPLE_DURATION_DEFAULT); in qtnf_cmd_send_scan()
2050 cmd->flags = cpu_to_le64(flags); in qtnf_cmd_send_scan()
2052 pr_debug("[MAC%u] %s scan dwell active=%u passive=%u duration=%u\n", in qtnf_cmd_send_scan()
2053 mac->macid, in qtnf_cmd_send_scan()
2054 scan_req->duration_mandatory ? "mandatory" : "max", in qtnf_cmd_send_scan()
2058 if (scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in qtnf_cmd_send_scan()
2059 pr_debug("[MAC%u] scan with random addr=%pM, mask=%pM\n", in qtnf_cmd_send_scan()
2060 mac->macid, in qtnf_cmd_send_scan()
2061 scan_req->mac_addr, scan_req->mac_addr_mask); in qtnf_cmd_send_scan()
2062 qtnf_cmd_randmac_tlv_add(cmd_skb, scan_req->mac_addr, in qtnf_cmd_send_scan()
2063 scan_req->mac_addr_mask); in qtnf_cmd_send_scan()
2066 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_scan()
2067 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_scan()
2068 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_scan()
2084 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_connect()
2088 return -ENOMEM; in qtnf_cmd_send_connect()
2090 cmd = (struct qlink_cmd_connect *)cmd_skb->data; in qtnf_cmd_send_connect()
2092 ether_addr_copy(cmd->bssid, vif->bssid); in qtnf_cmd_send_connect()
2094 if (sme->bssid_hint) in qtnf_cmd_send_connect()
2095 ether_addr_copy(cmd->bssid_hint, sme->bssid_hint); in qtnf_cmd_send_connect()
2097 eth_zero_addr(cmd->bssid_hint); in qtnf_cmd_send_connect()
2099 if (sme->prev_bssid) in qtnf_cmd_send_connect()
2100 ether_addr_copy(cmd->prev_bssid, sme->prev_bssid); in qtnf_cmd_send_connect()
2102 eth_zero_addr(cmd->prev_bssid); in qtnf_cmd_send_connect()
2104 if ((sme->bg_scan_period >= 0) && in qtnf_cmd_send_connect()
2105 (sme->bg_scan_period <= SHRT_MAX)) in qtnf_cmd_send_connect()
2106 cmd->bg_scan_period = cpu_to_le16(sme->bg_scan_period); in qtnf_cmd_send_connect()
2108 cmd->bg_scan_period = cpu_to_le16(-1); /* use default value */ in qtnf_cmd_send_connect()
2110 if (sme->flags & ASSOC_REQ_DISABLE_HT) in qtnf_cmd_send_connect()
2112 if (sme->flags & ASSOC_REQ_DISABLE_VHT) in qtnf_cmd_send_connect()
2114 if (sme->flags & ASSOC_REQ_USE_RRM) in qtnf_cmd_send_connect()
2117 cmd->flags = cpu_to_le32(connect_flags); in qtnf_cmd_send_connect()
2118 memcpy(&cmd->ht_capa, &sme->ht_capa, sizeof(cmd->ht_capa)); in qtnf_cmd_send_connect()
2119 memcpy(&cmd->ht_capa_mask, &sme->ht_capa_mask, in qtnf_cmd_send_connect()
2120 sizeof(cmd->ht_capa_mask)); in qtnf_cmd_send_connect()
2121 memcpy(&cmd->vht_capa, &sme->vht_capa, sizeof(cmd->vht_capa)); in qtnf_cmd_send_connect()
2122 memcpy(&cmd->vht_capa_mask, &sme->vht_capa_mask, in qtnf_cmd_send_connect()
2123 sizeof(cmd->vht_capa_mask)); in qtnf_cmd_send_connect()
2124 cmd->pbss = sme->pbss; in qtnf_cmd_send_connect()
2126 aen = &cmd->aen; in qtnf_cmd_send_connect()
2127 aen->auth_type = sme->auth_type; in qtnf_cmd_send_connect()
2128 aen->privacy = !!sme->privacy; in qtnf_cmd_send_connect()
2129 cmd->mfp = sme->mfp; in qtnf_cmd_send_connect()
2130 aen->wpa_versions = cpu_to_le32(sme->crypto.wpa_versions); in qtnf_cmd_send_connect()
2131 aen->cipher_group = cpu_to_le32(sme->crypto.cipher_group); in qtnf_cmd_send_connect()
2132 aen->n_ciphers_pairwise = cpu_to_le32(sme->crypto.n_ciphers_pairwise); in qtnf_cmd_send_connect()
2135 aen->ciphers_pairwise[i] = in qtnf_cmd_send_connect()
2136 cpu_to_le32(sme->crypto.ciphers_pairwise[i]); in qtnf_cmd_send_connect()
2138 n = min(QLINK_MAX_NR_AKM_SUITES, sme->crypto.n_akm_suites); in qtnf_cmd_send_connect()
2139 aen->n_akm_suites = cpu_to_le32(n); in qtnf_cmd_send_connect()
2142 aen->akm_suites[i] = cpu_to_le32(sme->crypto.akm_suites[i]); in qtnf_cmd_send_connect()
2144 aen->control_port = sme->crypto.control_port; in qtnf_cmd_send_connect()
2145 aen->control_port_no_encrypt = in qtnf_cmd_send_connect()
2146 sme->crypto.control_port_no_encrypt; in qtnf_cmd_send_connect()
2147 aen->control_port_ethertype = in qtnf_cmd_send_connect()
2148 cpu_to_le16(be16_to_cpu(sme->crypto.control_port_ethertype)); in qtnf_cmd_send_connect()
2150 qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, sme->ssid, in qtnf_cmd_send_connect()
2151 sme->ssid_len); in qtnf_cmd_send_connect()
2153 if (sme->ie_len != 0) in qtnf_cmd_send_connect()
2155 sme->ie, sme->ie_len); in qtnf_cmd_send_connect()
2157 if (sme->channel) in qtnf_cmd_send_connect()
2158 qtnf_cmd_channel_tlv_add(cmd_skb, sme->channel); in qtnf_cmd_send_connect()
2160 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_connect()
2161 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_connect()
2162 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_connect()
2174 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_external_auth()
2178 return -ENOMEM; in qtnf_cmd_send_external_auth()
2180 cmd = (struct qlink_cmd_external_auth *)cmd_skb->data; in qtnf_cmd_send_external_auth()
2182 ether_addr_copy(cmd->peer, auth->bssid); in qtnf_cmd_send_external_auth()
2183 cmd->status = cpu_to_le16(auth->status); in qtnf_cmd_send_external_auth()
2185 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_external_auth()
2186 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_external_auth()
2187 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_external_auth()
2198 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_disconnect()
2202 return -ENOMEM; in qtnf_cmd_send_disconnect()
2204 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_disconnect()
2206 cmd = (struct qlink_cmd_disconnect *)cmd_skb->data; in qtnf_cmd_send_disconnect()
2207 cmd->reason = cpu_to_le16(reason_code); in qtnf_cmd_send_disconnect()
2209 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_disconnect()
2211 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_disconnect()
2222 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_updown_intf()
2226 return -ENOMEM; in qtnf_cmd_send_updown_intf()
2228 cmd = (struct qlink_cmd_updown *)cmd_skb->data; in qtnf_cmd_send_updown_intf()
2229 cmd->if_up = !!up; in qtnf_cmd_send_updown_intf()
2231 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_updown_intf()
2232 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_updown_intf()
2233 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_updown_intf()
2238 int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req, in qtnf_cmd_reg_notify() argument
2241 struct wiphy *wiphy = priv_to_wiphy(mac); in qtnf_cmd_reg_notify()
2242 struct qtnf_bus *bus = mac->bus; in qtnf_cmd_reg_notify()
2249 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_reg_notify()
2253 return -ENOMEM; in qtnf_cmd_reg_notify()
2255 cmd = (struct qlink_cmd_reg_notify *)cmd_skb->data; in qtnf_cmd_reg_notify()
2256 cmd->alpha2[0] = req->alpha2[0]; in qtnf_cmd_reg_notify()
2257 cmd->alpha2[1] = req->alpha2[1]; in qtnf_cmd_reg_notify()
2259 switch (req->initiator) { in qtnf_cmd_reg_notify()
2261 cmd->initiator = QLINK_REGDOM_SET_BY_CORE; in qtnf_cmd_reg_notify()
2264 cmd->initiator = QLINK_REGDOM_SET_BY_USER; in qtnf_cmd_reg_notify()
2267 cmd->initiator = QLINK_REGDOM_SET_BY_DRIVER; in qtnf_cmd_reg_notify()
2270 cmd->initiator = QLINK_REGDOM_SET_BY_COUNTRY_IE; in qtnf_cmd_reg_notify()
2274 switch (req->user_reg_hint_type) { in qtnf_cmd_reg_notify()
2276 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_USER; in qtnf_cmd_reg_notify()
2279 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_CELL_BASE; in qtnf_cmd_reg_notify()
2282 cmd->user_reg_hint_type = QLINK_USER_REG_HINT_INDOOR; in qtnf_cmd_reg_notify()
2286 switch (req->dfs_region) { in qtnf_cmd_reg_notify()
2288 cmd->dfs_region = QLINK_DFS_FCC; in qtnf_cmd_reg_notify()
2291 cmd->dfs_region = QLINK_DFS_ETSI; in qtnf_cmd_reg_notify()
2294 cmd->dfs_region = QLINK_DFS_JP; in qtnf_cmd_reg_notify()
2297 cmd->dfs_region = QLINK_DFS_UNSET; in qtnf_cmd_reg_notify()
2301 cmd->slave_radar = slave_radar; in qtnf_cmd_reg_notify()
2302 cmd->dfs_offload = dfs_offload; in qtnf_cmd_reg_notify()
2303 cmd->num_channels = 0; in qtnf_cmd_reg_notify()
2308 cfg_band = wiphy->bands[band]; in qtnf_cmd_reg_notify()
2312 cmd->num_channels += cfg_band->n_channels; in qtnf_cmd_reg_notify()
2314 for (i = 0; i < cfg_band->n_channels; ++i) { in qtnf_cmd_reg_notify()
2316 &cfg_band->channels[i]); in qtnf_cmd_reg_notify()
2340 tlv_type = le16_to_cpu(tlv->type); in qtnf_cmd_resp_proc_chan_stat_info()
2341 tlv_value_len = le16_to_cpu(tlv->len); in qtnf_cmd_resp_proc_chan_stat_info()
2345 map = tlv->val; in qtnf_cmd_resp_proc_chan_stat_info()
2349 stats = (struct qlink_chan_stats *)tlv->val; in qtnf_cmd_resp_proc_chan_stat_info()
2360 return -EINVAL; in qtnf_cmd_resp_proc_chan_stat_info()
2371 survey->filled |= SURVEY_INFO_TIME; in qtnf_cmd_resp_proc_chan_stat_info()
2372 survey->time = le64_to_cpu(stats->time_on); in qtnf_cmd_resp_proc_chan_stat_info()
2376 survey->filled |= SURVEY_INFO_TIME_TX; in qtnf_cmd_resp_proc_chan_stat_info()
2377 survey->time_tx = le64_to_cpu(stats->time_tx); in qtnf_cmd_resp_proc_chan_stat_info()
2381 survey->filled |= SURVEY_INFO_TIME_RX; in qtnf_cmd_resp_proc_chan_stat_info()
2382 survey->time_rx = le64_to_cpu(stats->time_rx); in qtnf_cmd_resp_proc_chan_stat_info()
2386 survey->filled |= SURVEY_INFO_TIME_BUSY; in qtnf_cmd_resp_proc_chan_stat_info()
2387 survey->time_busy = le64_to_cpu(stats->cca_busy); in qtnf_cmd_resp_proc_chan_stat_info()
2391 survey->filled |= SURVEY_INFO_TIME_EXT_BUSY; in qtnf_cmd_resp_proc_chan_stat_info()
2392 survey->time_ext_busy = le64_to_cpu(stats->cca_busy_ext); in qtnf_cmd_resp_proc_chan_stat_info()
2396 survey->filled |= SURVEY_INFO_TIME_SCAN; in qtnf_cmd_resp_proc_chan_stat_info()
2397 survey->time_scan = le64_to_cpu(stats->time_scan); in qtnf_cmd_resp_proc_chan_stat_info()
2401 survey->filled |= SURVEY_INFO_NOISE_DBM; in qtnf_cmd_resp_proc_chan_stat_info()
2402 survey->noise = stats->chan_noise; in qtnf_cmd_resp_proc_chan_stat_info()
2410 int qtnf_cmd_get_chan_stats(struct qtnf_wmac *mac, u32 chan_freq, in qtnf_cmd_get_chan_stats() argument
2419 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, in qtnf_cmd_get_chan_stats()
2423 return -ENOMEM; in qtnf_cmd_get_chan_stats()
2425 cmd = (struct qlink_cmd_get_chan_stats *)cmd_skb->data; in qtnf_cmd_get_chan_stats()
2426 cmd->channel_freq = cpu_to_le32(chan_freq); in qtnf_cmd_get_chan_stats()
2428 qtnf_bus_lock(mac->bus); in qtnf_cmd_get_chan_stats()
2429 ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb, in qtnf_cmd_get_chan_stats()
2431 qtnf_bus_unlock(mac->bus); in qtnf_cmd_get_chan_stats()
2436 resp = (struct qlink_resp_get_chan_stats *)resp_skb->data; in qtnf_cmd_get_chan_stats()
2438 if (le32_to_cpu(resp->chan_freq) != chan_freq) { in qtnf_cmd_get_chan_stats()
2439 pr_err("[MAC%u] channel stats freq %u != requested %u\n", in qtnf_cmd_get_chan_stats()
2440 mac->macid, le32_to_cpu(resp->chan_freq), chan_freq); in qtnf_cmd_get_chan_stats()
2441 ret = -EINVAL; in qtnf_cmd_get_chan_stats()
2445 ret = qtnf_cmd_resp_proc_chan_stat_info(survey, resp->info, in qtnf_cmd_get_chan_stats()
2457 struct qtnf_wmac *mac = vif->mac; in qtnf_cmd_send_chan_switch() local
2463 cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, vif->vifid, in qtnf_cmd_send_chan_switch()
2467 return -ENOMEM; in qtnf_cmd_send_chan_switch()
2469 if (params->radar_required) in qtnf_cmd_send_chan_switch()
2472 if (params->block_tx) in qtnf_cmd_send_chan_switch()
2475 cmd = (struct qlink_cmd_chan_switch *)cmd_skb->data; in qtnf_cmd_send_chan_switch()
2476 qlink_chandef_cfg2q(¶ms->chandef, &cmd->channel); in qtnf_cmd_send_chan_switch()
2477 cmd->flags = cpu_to_le64(flags); in qtnf_cmd_send_chan_switch()
2478 cmd->beacon_count = params->count; in qtnf_cmd_send_chan_switch()
2480 qtnf_bus_lock(mac->bus); in qtnf_cmd_send_chan_switch()
2481 ret = qtnf_cmd_send(mac->bus, cmd_skb); in qtnf_cmd_send_chan_switch()
2482 qtnf_bus_unlock(mac->bus); in qtnf_cmd_send_chan_switch()
2489 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_get_channel()
2495 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_channel()
2499 return -ENOMEM; in qtnf_cmd_get_channel()
2507 resp = (const struct qlink_resp_channel_get *)resp_skb->data; in qtnf_cmd_get_channel()
2508 qlink_chandef_q2cfg(priv_to_wiphy(vif->mac), &resp->chan, chdef); in qtnf_cmd_get_channel()
2521 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_start_cac()
2526 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_start_cac()
2530 return -ENOMEM; in qtnf_cmd_start_cac()
2532 cmd = (struct qlink_cmd_start_cac *)cmd_skb->data; in qtnf_cmd_start_cac()
2533 cmd->cac_time_ms = cpu_to_le32(cac_time_ms); in qtnf_cmd_start_cac()
2534 qlink_chandef_cfg2q(chdef, &cmd->chan); in qtnf_cmd_start_cac()
2546 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_set_mac_acl()
2549 size_t acl_size = struct_size(params, mac_addrs, params->n_acl_entries); in qtnf_cmd_set_mac_acl()
2552 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_set_mac_acl()
2556 return -ENOMEM; in qtnf_cmd_set_mac_acl()
2559 tlv->type = cpu_to_le16(QTN_TLV_ID_ACL_DATA); in qtnf_cmd_set_mac_acl()
2560 tlv->len = cpu_to_le16(acl_size); in qtnf_cmd_set_mac_acl()
2561 qlink_acl_data_cfg2q(params, (struct qlink_acl_data *)tlv->val); in qtnf_cmd_set_mac_acl()
2572 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_send_pm_set()
2577 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_pm_set()
2580 return -ENOMEM; in qtnf_cmd_send_pm_set()
2582 cmd = (struct qlink_cmd_pm_set *)cmd_skb->data; in qtnf_cmd_send_pm_set()
2583 cmd->pm_mode = pm_mode; in qtnf_cmd_send_pm_set()
2584 cmd->pm_standby_timer = cpu_to_le32(timeout); in qtnf_cmd_send_pm_set()
2597 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_get_tx_power()
2604 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_get_tx_power()
2607 return -ENOMEM; in qtnf_cmd_get_tx_power()
2609 cmd = (struct qlink_cmd_txpwr *)cmd_skb->data; in qtnf_cmd_get_tx_power()
2610 cmd->op_type = QLINK_TXPWR_GET; in qtnf_cmd_get_tx_power()
2619 resp = (const struct qlink_resp_txpwr *)resp_skb->data; in qtnf_cmd_get_tx_power()
2620 *dbm = MBM_TO_DBM(le32_to_cpu(resp->txpwr)); in qtnf_cmd_get_tx_power()
2632 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_set_tx_power()
2639 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_set_tx_power()
2642 return -ENOMEM; in qtnf_cmd_set_tx_power()
2644 cmd = (struct qlink_cmd_txpwr *)cmd_skb->data; in qtnf_cmd_set_tx_power()
2645 cmd->op_type = QLINK_TXPWR_SET; in qtnf_cmd_set_tx_power()
2646 cmd->txpwr_setting = type; in qtnf_cmd_set_tx_power()
2647 cmd->txpwr = cpu_to_le32(mbm); in qtnf_cmd_set_tx_power()
2663 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_send_wowlan_set()
2670 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_wowlan_set()
2673 return -ENOMEM; in qtnf_cmd_send_wowlan_set()
2677 cmd = (struct qlink_cmd_wowlan_set *)cmd_skb->data; in qtnf_cmd_send_wowlan_set()
2680 if (wowl->disconnect) in qtnf_cmd_send_wowlan_set()
2683 if (wowl->magic_pkt) in qtnf_cmd_send_wowlan_set()
2686 if (wowl->n_patterns && wowl->patterns) { in qtnf_cmd_send_wowlan_set()
2688 while (count < wowl->n_patterns) { in qtnf_cmd_send_wowlan_set()
2691 wowl->patterns[count].pattern, in qtnf_cmd_send_wowlan_set()
2692 wowl->patterns[count].pattern_len); in qtnf_cmd_send_wowlan_set()
2698 cmd->triggers = cpu_to_le32(triggers); in qtnf_cmd_send_wowlan_set()
2708 struct qtnf_bus *bus = vif->mac->bus; in qtnf_cmd_netdev_changeupper()
2713 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_netdev_changeupper()
2717 return -ENOMEM; in qtnf_cmd_netdev_changeupper()
2720 vif->mac->macid, vif->vifid, br_domain); in qtnf_cmd_netdev_changeupper()
2722 cmd = (struct qlink_cmd_ndev_changeupper *)cmd_skb->data; in qtnf_cmd_netdev_changeupper()
2723 cmd->nehdr.event = cpu_to_le16(QLINK_NDEV_EVENT_CHANGEUPPER); in qtnf_cmd_netdev_changeupper()
2724 cmd->upper_type = QLINK_NDEV_UPPER_TYPE_BRIDGE; in qtnf_cmd_netdev_changeupper()
2725 cmd->br_domain = cpu_to_le32(br_domain); in qtnf_cmd_netdev_changeupper()
2733 vif->mac->macid, vif->vifid); in qtnf_cmd_netdev_changeupper()
2745 if (sizeof(*cmd) + owe->ie_len > QTNF_MAX_CMD_BUF_SIZE) { in qtnf_cmd_send_update_owe()
2747 vif->mac->macid, vif->vifid, owe->ie_len); in qtnf_cmd_send_update_owe()
2748 return -E2BIG; in qtnf_cmd_send_update_owe()
2751 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, in qtnf_cmd_send_update_owe()
2755 return -ENOMEM; in qtnf_cmd_send_update_owe()
2757 cmd = (struct qlink_cmd_update_owe *)cmd_skb->data; in qtnf_cmd_send_update_owe()
2758 ether_addr_copy(cmd->peer, owe->peer); in qtnf_cmd_send_update_owe()
2759 cmd->status = cpu_to_le16(owe->status); in qtnf_cmd_send_update_owe()
2760 if (owe->ie_len && owe->ie) in qtnf_cmd_send_update_owe()
2761 qtnf_cmd_skb_put_buffer(cmd_skb, owe->ie, owe->ie_len); in qtnf_cmd_send_update_owe()
2763 qtnf_bus_lock(vif->mac->bus); in qtnf_cmd_send_update_owe()
2764 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); in qtnf_cmd_send_update_owe()
2765 qtnf_bus_unlock(vif->mac->bus); in qtnf_cmd_send_update_owe()