Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 805b28c0 authored by Sergey Matyukevich's avatar Sergey Matyukevich Committed by Kalle Valo
Browse files

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: default avatarIgor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: default avatarSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: default avatarAvinash Patil <avinashp@quantenna.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 03ddf59d
Loading
Loading
Loading
Loading
+23 −4
Original line number Diff line number Diff line
@@ -1047,6 +1047,7 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac,

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

			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,
		default:
			break;
		}

		tlv_buf_size -= tlv_full_len;
		tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len);
	}
@@ -1859,10 +1861,27 @@ int qtnf_cmd_send_change_sta(struct qtnf_vif *vif, const u8 *mac,

	cmd = (struct qlink_cmd_change_sta *)cmd_skb->data;
	ether_addr_copy(cmd->sta_addr, mac);

	switch (vif->wdev.iftype) {
	case NL80211_IFTYPE_AP:
		cmd->if_type = cpu_to_le16(QLINK_IFTYPE_AP);
		cmd->sta_flags_mask = cpu_to_le32(qtnf_encode_sta_flags(
						  params->sta_flags_mask));
		cmd->sta_flags_set = cpu_to_le32(qtnf_encode_sta_flags(
						 params->sta_flags_set));
		break;
	case NL80211_IFTYPE_STATION:
		cmd->if_type = cpu_to_le16(QLINK_IFTYPE_STATION);
		cmd->sta_flags_mask = cpu_to_le32(qtnf_encode_sta_flags(
						  params->sta_flags_mask));
		cmd->sta_flags_set = cpu_to_le32(qtnf_encode_sta_flags(
						 params->sta_flags_set));
		break;
	default:
		pr_err("unsupported iftype %d\n", vif->wdev.iftype);
		ret = -EINVAL;
		goto out;
	}

	ret = qtnf_cmd_send(vif->mac->bus, cmd_skb, &res_code);
	if (unlikely(ret))
+10 −3
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@

#include <linux/ieee80211.h>

#define QLINK_PROTO_VER		4
#define QLINK_PROTO_VER		5

#define QLINK_MACID_RSVD		0xFF
#define QLINK_VIFID_RSVD		0xFF
@@ -77,6 +77,7 @@ enum qlink_iface_type {
	QLINK_IFTYPE_ADHOC	= 3,
	QLINK_IFTYPE_MONITOR	= 4,
	QLINK_IFTYPE_WDS	= 5,
	QLINK_IFTYPE_AP_VLAN	= 6,
};

/**
@@ -85,12 +86,12 @@ enum qlink_iface_type {
 * Data describing a single virtual interface.
 *
 * @if_type: Mode of interface operation, one of &enum qlink_iface_type
 * @flags: interface flagsmap.
 * @vlanid: VLAN ID for AP_VLAN interface type
 * @mac_addr: MAC address of virtual interface.
 */
struct qlink_intf_info {
	__le16 if_type;
	__le16 flags;
	__le16 vlanid;
	u8 mac_addr[ETH_ALEN];
	u8 rsvd[2];
} __packed;
@@ -292,6 +293,7 @@ struct qlink_cmd_get_sta_info {
 * @pairwise: whether to use pairwise key.
 * @addr: MAC address of a STA key is being installed to.
 * @cipher: cipher suite.
 * @vlanid: VLAN ID for AP_VLAN interface type
 * @key_data: key data itself.
 */
struct qlink_cmd_add_key {
@@ -300,6 +302,7 @@ struct qlink_cmd_add_key {
	u8 pairwise;
	u8 addr[ETH_ALEN];
	__le32 cipher;
	__le16 vlanid;
	u8 key_data[0];
} __packed;

@@ -346,12 +349,16 @@ struct qlink_cmd_set_def_mgmt_key {
 *
 * @sta_flags_mask: STA flags mask, bitmap of &enum qlink_sta_flags
 * @sta_flags_set: STA flags values, bitmap of &enum qlink_sta_flags
 * @if_type: Mode of interface operation, one of &enum qlink_iface_type
 * @vlanid: VLAN ID to assign to specific STA
 * @sta_addr: address of the STA for which parameters are set.
 */
struct qlink_cmd_change_sta {
	struct qlink_cmd chdr;
	__le32 sta_flags_mask;
	__le32 sta_flags_set;
	__le16 if_type;
	__le16 vlanid;
	u8 sta_addr[ETH_ALEN];
} __packed;

+3 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ u16 qlink_iface_type_to_nl_mask(u16 qlink_type)
	case QLINK_IFTYPE_WDS:
		result |= BIT(NL80211_IFTYPE_WDS);
		break;
	case QLINK_IFTYPE_AP_VLAN:
		result |= BIT(NL80211_IFTYPE_AP_VLAN);
		break;
	}

	return result;