Skip to content

Commit 805b28c

Browse files
Sergey MatyukevichKalle Valo
Sergey Matyukevich
authored and
Kalle Valo
committed
qtnfmac: prepare for AP_VLAN interface type support
Modify qlink command structures and interface types handling to prepare adding AP_VLAN support to qtnfmac driver. Signed-off-by: Igor Mitsyanko <[email protected]> Signed-off-by: Sergey Matyukevich <[email protected]> Signed-off-by: Avinash Patil <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 03ddf59 commit 805b28c

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

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

+23-4
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,7 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac,
10471047

10481048
/* supported modes: STA, AP */
10491049
limits[rec].types &= BIT(NL80211_IFTYPE_AP) |
1050+
BIT(NL80211_IFTYPE_AP_VLAN) |
10501051
BIT(NL80211_IFTYPE_STATION);
10511052

10521053
pr_debug("MAC%u: MAX: %u; TYPES: %.4X\n", mac->macid,
@@ -1058,6 +1059,7 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac,
10581059
default:
10591060
break;
10601061
}
1062+
10611063
tlv_buf_size -= tlv_full_len;
10621064
tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len);
10631065
}
@@ -1859,10 +1861,27 @@ int qtnf_cmd_send_change_sta(struct qtnf_vif *vif, const u8 *mac,
18591861

18601862
cmd = (struct qlink_cmd_change_sta *)cmd_skb->data;
18611863
ether_addr_copy(cmd->sta_addr, mac);
1862-
cmd->sta_flags_mask = cpu_to_le32(qtnf_encode_sta_flags(
1863-
params->sta_flags_mask));
1864-
cmd->sta_flags_set = cpu_to_le32(qtnf_encode_sta_flags(
1865-
params->sta_flags_set));
1864+
1865+
switch (vif->wdev.iftype) {
1866+
case NL80211_IFTYPE_AP:
1867+
cmd->if_type = cpu_to_le16(QLINK_IFTYPE_AP);
1868+
cmd->sta_flags_mask = cpu_to_le32(qtnf_encode_sta_flags(
1869+
params->sta_flags_mask));
1870+
cmd->sta_flags_set = cpu_to_le32(qtnf_encode_sta_flags(
1871+
params->sta_flags_set));
1872+
break;
1873+
case NL80211_IFTYPE_STATION:
1874+
cmd->if_type = cpu_to_le16(QLINK_IFTYPE_STATION);
1875+
cmd->sta_flags_mask = cpu_to_le32(qtnf_encode_sta_flags(
1876+
params->sta_flags_mask));
1877+
cmd->sta_flags_set = cpu_to_le32(qtnf_encode_sta_flags(
1878+
params->sta_flags_set));
1879+
break;
1880+
default:
1881+
pr_err("unsupported iftype %d\n", vif->wdev.iftype);
1882+
ret = -EINVAL;
1883+
goto out;
1884+
}
18661885

18671886
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb, &res_code);
18681887
if (unlikely(ret))

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

+10-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include <linux/ieee80211.h>
2121

22-
#define QLINK_PROTO_VER 4
22+
#define QLINK_PROTO_VER 5
2323

2424
#define QLINK_MACID_RSVD 0xFF
2525
#define QLINK_VIFID_RSVD 0xFF
@@ -77,6 +77,7 @@ enum qlink_iface_type {
7777
QLINK_IFTYPE_ADHOC = 3,
7878
QLINK_IFTYPE_MONITOR = 4,
7979
QLINK_IFTYPE_WDS = 5,
80+
QLINK_IFTYPE_AP_VLAN = 6,
8081
};
8182

8283
/**
@@ -85,12 +86,12 @@ enum qlink_iface_type {
8586
* Data describing a single virtual interface.
8687
*
8788
* @if_type: Mode of interface operation, one of &enum qlink_iface_type
88-
* @flags: interface flagsmap.
89+
* @vlanid: VLAN ID for AP_VLAN interface type
8990
* @mac_addr: MAC address of virtual interface.
9091
*/
9192
struct qlink_intf_info {
9293
__le16 if_type;
93-
__le16 flags;
94+
__le16 vlanid;
9495
u8 mac_addr[ETH_ALEN];
9596
u8 rsvd[2];
9697
} __packed;
@@ -292,6 +293,7 @@ struct qlink_cmd_get_sta_info {
292293
* @pairwise: whether to use pairwise key.
293294
* @addr: MAC address of a STA key is being installed to.
294295
* @cipher: cipher suite.
296+
* @vlanid: VLAN ID for AP_VLAN interface type
295297
* @key_data: key data itself.
296298
*/
297299
struct qlink_cmd_add_key {
@@ -300,6 +302,7 @@ struct qlink_cmd_add_key {
300302
u8 pairwise;
301303
u8 addr[ETH_ALEN];
302304
__le32 cipher;
305+
__le16 vlanid;
303306
u8 key_data[0];
304307
} __packed;
305308

@@ -346,12 +349,16 @@ struct qlink_cmd_set_def_mgmt_key {
346349
*
347350
* @sta_flags_mask: STA flags mask, bitmap of &enum qlink_sta_flags
348351
* @sta_flags_set: STA flags values, bitmap of &enum qlink_sta_flags
352+
* @if_type: Mode of interface operation, one of &enum qlink_iface_type
353+
* @vlanid: VLAN ID to assign to specific STA
349354
* @sta_addr: address of the STA for which parameters are set.
350355
*/
351356
struct qlink_cmd_change_sta {
352357
struct qlink_cmd chdr;
353358
__le32 sta_flags_mask;
354359
__le32 sta_flags_set;
360+
__le16 if_type;
361+
__le16 vlanid;
355362
u8 sta_addr[ETH_ALEN];
356363
} __packed;
357364

drivers/net/wireless/quantenna/qtnfmac/qlink_util.c

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ u16 qlink_iface_type_to_nl_mask(u16 qlink_type)
3737
case QLINK_IFTYPE_WDS:
3838
result |= BIT(NL80211_IFTYPE_WDS);
3939
break;
40+
case QLINK_IFTYPE_AP_VLAN:
41+
result |= BIT(NL80211_IFTYPE_AP_VLAN);
42+
break;
4043
}
4144

4245
return result;

0 commit comments

Comments
 (0)