Skip to content

Commit e70cf22

Browse files
imitsyanko-qtnKalle Valo
authored andcommitted
qtnfmac: merge PHY_PARAMS_GET into MAC_INFO
QLINK_CMD_PHY_PARAMS_GET command does not need to be separate, it can be included into GET_MAC_INFO command. Merge these two commands adding all the missing wiphy data. Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 310cd5d commit e70cf22

4 files changed

Lines changed: 49 additions & 138 deletions

File tree

‎drivers/net/wireless/quantenna/qtnfmac/commands.c‎

Lines changed: 6 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,12 @@ qtnf_cmd_resp_proc_mac_info(struct qtnf_wmac *mac,
12911291
mac_info->radar_detect_widths =
12921292
qlink_chan_width_mask_to_nl(le16_to_cpu(
12931293
resp_info->radar_detect_widths));
1294-
mac_info->max_acl_mac_addrs = le32_to_cpu(resp_info->max_acl_mac_addrs);
1294+
mac_info->max_acl_mac_addrs = le16_to_cpu(resp_info->max_acl_mac_addrs);
1295+
mac_info->frag_thr = le32_to_cpu(resp_info->frag_threshold);
1296+
mac_info->rts_thr = le32_to_cpu(resp_info->rts_threshold);
1297+
mac_info->sretry_limit = resp_info->retry_short;
1298+
mac_info->lretry_limit = resp_info->retry_long;
1299+
mac_info->coverage_class = resp_info->coverage_class;
12951300

12961301
memcpy(&mac_info->ht_cap_mod_mask, &resp_info->ht_cap_mod_mask,
12971302
sizeof(mac_info->ht_cap_mod_mask));
@@ -1576,72 +1581,6 @@ qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band,
15761581
return ret;
15771582
}
15781583

1579-
static int qtnf_cmd_resp_proc_phy_params(struct qtnf_wmac *mac,
1580-
const u8 *payload, size_t payload_len)
1581-
{
1582-
struct qtnf_mac_info *mac_info;
1583-
struct qlink_tlv_frag_rts_thr *phy_thr;
1584-
struct qlink_tlv_rlimit *limit;
1585-
struct qlink_tlv_cclass *class;
1586-
u16 tlv_type;
1587-
u16 tlv_value_len;
1588-
size_t tlv_full_len;
1589-
const struct qlink_tlv_hdr *tlv;
1590-
1591-
mac_info = &mac->macinfo;
1592-
1593-
tlv = (struct qlink_tlv_hdr *)payload;
1594-
while (payload_len >= sizeof(struct qlink_tlv_hdr)) {
1595-
tlv_type = le16_to_cpu(tlv->type);
1596-
tlv_value_len = le16_to_cpu(tlv->len);
1597-
tlv_full_len = tlv_value_len + sizeof(struct qlink_tlv_hdr);
1598-
1599-
if (tlv_full_len > payload_len) {
1600-
pr_warn("MAC%u: malformed TLV 0x%.2X; LEN: %u\n",
1601-
mac->macid, tlv_type, tlv_value_len);
1602-
return -EINVAL;
1603-
}
1604-
1605-
switch (tlv_type) {
1606-
case QTN_TLV_ID_FRAG_THRESH:
1607-
phy_thr = (void *)tlv;
1608-
mac_info->frag_thr = le32_to_cpu(phy_thr->thr);
1609-
break;
1610-
case QTN_TLV_ID_RTS_THRESH:
1611-
phy_thr = (void *)tlv;
1612-
mac_info->rts_thr = le32_to_cpu(phy_thr->thr);
1613-
break;
1614-
case QTN_TLV_ID_SRETRY_LIMIT:
1615-
limit = (void *)tlv;
1616-
mac_info->sretry_limit = limit->rlimit;
1617-
break;
1618-
case QTN_TLV_ID_LRETRY_LIMIT:
1619-
limit = (void *)tlv;
1620-
mac_info->lretry_limit = limit->rlimit;
1621-
break;
1622-
case QTN_TLV_ID_COVERAGE_CLASS:
1623-
class = (void *)tlv;
1624-
mac_info->coverage_class = class->cclass;
1625-
break;
1626-
default:
1627-
pr_err("MAC%u: Unknown TLV type: %#x\n", mac->macid,
1628-
le16_to_cpu(tlv->type));
1629-
break;
1630-
}
1631-
1632-
payload_len -= tlv_full_len;
1633-
tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len);
1634-
}
1635-
1636-
if (payload_len) {
1637-
pr_warn("MAC%u: malformed TLV buf; bytes left: %zu\n",
1638-
mac->macid, payload_len);
1639-
return -EINVAL;
1640-
}
1641-
1642-
return 0;
1643-
}
1644-
16451584
static int
16461585
qtnf_cmd_resp_proc_chan_stat_info(struct qtnf_chan_stats *stats,
16471586
const u8 *payload, size_t payload_len)
@@ -1799,35 +1738,6 @@ int qtnf_cmd_band_info_get(struct qtnf_wmac *mac,
17991738
return ret;
18001739
}
18011740

1802-
int qtnf_cmd_send_get_phy_params(struct qtnf_wmac *mac)
1803-
{
1804-
struct sk_buff *cmd_skb, *resp_skb = NULL;
1805-
struct qlink_resp_phy_params *resp;
1806-
size_t response_size = 0;
1807-
int ret = 0;
1808-
1809-
cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0,
1810-
QLINK_CMD_PHY_PARAMS_GET,
1811-
sizeof(struct qlink_cmd));
1812-
if (!cmd_skb)
1813-
return -ENOMEM;
1814-
1815-
qtnf_bus_lock(mac->bus);
1816-
ret = qtnf_cmd_send_with_reply(mac->bus, cmd_skb, &resp_skb,
1817-
sizeof(*resp), &response_size);
1818-
if (ret)
1819-
goto out;
1820-
1821-
resp = (struct qlink_resp_phy_params *)resp_skb->data;
1822-
ret = qtnf_cmd_resp_proc_phy_params(mac, resp->info, response_size);
1823-
1824-
out:
1825-
qtnf_bus_unlock(mac->bus);
1826-
consume_skb(resp_skb);
1827-
1828-
return ret;
1829-
}
1830-
18311741
int qtnf_cmd_send_update_phy_params(struct qtnf_wmac *mac, u32 changed)
18321742
{
18331743
struct wiphy *wiphy = priv_to_wiphy(mac);

‎drivers/net/wireless/quantenna/qtnfmac/core.c‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -585,16 +585,6 @@ static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid)
585585
return PTR_ERR(mac);
586586
}
587587

588-
ret = qtnf_cmd_get_mac_info(mac);
589-
if (ret) {
590-
pr_err("MAC%u: failed to get info\n", macid);
591-
goto error;
592-
}
593-
594-
/* Use MAC address of the first active radio as a unique device ID */
595-
if (is_zero_ether_addr(mac->bus->hw_id))
596-
ether_addr_copy(mac->bus->hw_id, mac->macaddr);
597-
598588
vif = qtnf_mac_get_base_vif(mac);
599589
if (!vif) {
600590
pr_err("MAC%u: primary VIF is not ready\n", macid);
@@ -609,12 +599,16 @@ static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid)
609599
goto error;
610600
}
611601

612-
ret = qtnf_cmd_send_get_phy_params(mac);
602+
ret = qtnf_cmd_get_mac_info(mac);
613603
if (ret) {
614-
pr_err("MAC%u: failed to get PHY settings\n", macid);
604+
pr_err("MAC%u: failed to get MAC info\n", macid);
615605
goto error_del_vif;
616606
}
617607

608+
/* Use MAC address of the first active radio as a unique device ID */
609+
if (is_zero_ether_addr(mac->bus->hw_id))
610+
ether_addr_copy(mac->bus->hw_id, mac->macaddr);
611+
618612
ret = qtnf_mac_init_bands(mac);
619613
if (ret) {
620614
pr_err("MAC%u: failed to init bands\n", macid);

‎drivers/net/wireless/quantenna/qtnfmac/core.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct qtnf_mac_info {
8484
u8 sretry_limit;
8585
u8 coverage_class;
8686
u8 radar_detect_widths;
87-
u32 max_acl_mac_addrs;
87+
u16 max_acl_mac_addrs;
8888
struct ieee80211_ht_cap ht_cap_mod_mask;
8989
struct ieee80211_vht_cap vht_cap_mod_mask;
9090
struct ieee80211_iface_combination *if_comb;
@@ -141,7 +141,6 @@ int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *priv,
141141
const char *name, unsigned char name_assign_type);
142142
void qtnf_main_work_queue(struct work_struct *work);
143143
int qtnf_cmd_send_update_phy_params(struct qtnf_wmac *mac, u32 changed);
144-
int qtnf_cmd_send_get_phy_params(struct qtnf_wmac *mac);
145144

146145
struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid);
147146
struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb);

‎drivers/net/wireless/quantenna/qtnfmac/qlink.h‎

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ enum qlink_cmd_type {
289289
QLINK_CMD_REGISTER_MGMT = 0x0003,
290290
QLINK_CMD_SEND_FRAME = 0x0004,
291291
QLINK_CMD_MGMT_SET_APPIE = 0x0005,
292-
QLINK_CMD_PHY_PARAMS_GET = 0x0011,
293292
QLINK_CMD_PHY_PARAMS_SET = 0x0012,
294293
QLINK_CMD_GET_HW_INFO = 0x0013,
295294
QLINK_CMD_MAC_INFO = 0x0014,
@@ -982,14 +981,48 @@ struct qlink_resp_get_mac_info {
982981
u8 num_rx_chain;
983982
struct ieee80211_vht_cap vht_cap_mod_mask;
984983
struct ieee80211_ht_cap ht_cap_mod_mask;
984+
985985
__le16 max_ap_assoc_sta;
986+
__le32 hw_version;
987+
__le32 probe_resp_offload;
988+
__le32 bss_select_support;
989+
__le16 n_addresses;
986990
__le16 radar_detect_widths;
987-
__le32 max_acl_mac_addrs;
991+
__le16 max_remain_on_channel_duration;
992+
__le16 max_acl_mac_addrs;
993+
994+
__le32 frag_threshold;
995+
__le32 rts_threshold;
996+
u8 retry_short;
997+
u8 retry_long;
998+
u8 coverage_class;
999+
1000+
u8 max_scan_ssids;
1001+
u8 max_sched_scan_reqs;
1002+
u8 max_sched_scan_ssids;
1003+
u8 max_match_sets;
1004+
u8 max_adj_channel_rssi_comp;
1005+
1006+
__le16 max_scan_ie_len;
1007+
__le16 max_sched_scan_ie_len;
1008+
__le32 max_sched_scan_plans;
1009+
__le32 max_sched_scan_plan_interval;
1010+
__le32 max_sched_scan_plan_iterations;
1011+
1012+
u8 n_cipher_suites;
1013+
u8 n_akm_suites;
1014+
u8 max_num_pmkids;
1015+
u8 num_iftype_ext_capab;
1016+
u8 extended_capabilities_len;
1017+
u8 max_data_retry_count;
1018+
u8 n_iface_combinations;
1019+
u8 max_num_csa_counters;
1020+
9881021
u8 bands_cap;
9891022
u8 alpha2[2];
9901023
u8 n_reg_rules;
9911024
u8 dfs_region;
992-
u8 rsvd[1];
1025+
u8 rsvd[3];
9931026
u8 var_info[0];
9941027
} __packed;
9951028

@@ -1073,16 +1106,6 @@ struct qlink_resp_band_info_get {
10731106
u8 info[0];
10741107
} __packed;
10751108

1076-
/**
1077-
* struct qlink_resp_phy_params - response for QLINK_CMD_PHY_PARAMS_GET command
1078-
*
1079-
* @info: variable-length array of PHY params.
1080-
*/
1081-
struct qlink_resp_phy_params {
1082-
struct qlink_resp rhdr;
1083-
u8 info[0];
1084-
} __packed;
1085-
10861109
/**
10871110
* struct qlink_resp_get_chan_stats - response for QLINK_CMD_CHAN_STATS cmd
10881111
*
@@ -1425,21 +1448,6 @@ struct qlink_iface_limit_record {
14251448

14261449
#define QLINK_RSSI_OFFSET 120
14271450

1428-
struct qlink_tlv_frag_rts_thr {
1429-
struct qlink_tlv_hdr hdr;
1430-
__le32 thr;
1431-
} __packed;
1432-
1433-
struct qlink_tlv_rlimit {
1434-
struct qlink_tlv_hdr hdr;
1435-
u8 rlimit;
1436-
} __packed;
1437-
1438-
struct qlink_tlv_cclass {
1439-
struct qlink_tlv_hdr hdr;
1440-
u8 cclass;
1441-
} __packed;
1442-
14431451
/**
14441452
* enum qlink_reg_rule_flags - regulatory rule flags
14451453
*

0 commit comments

Comments
 (0)