aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Mitsyanko <igor.mitsyanko.os@quantenna.com>2017-10-30 21:04:55 -0400
committerKalle Valo <kvalo@codeaurora.org>2017-11-09 21:30:58 -0500
commitc9889671736cbc6324aa31cffab5fed0e3f74a2f (patch)
treef2bd9de15d3d5a4cd83f2820ed322c6fae121fe6
parenta3945f43761c3e15bebe56e5eb5674caf00f0d32 (diff)
qtnfmac: pass all CONNECT cmd params to wireless card for processing
Specifically, following parameters are needed for wireless device configuration but were not available to it before: - HT/VHT capabilities and capabilities masks. - full channel info (not just IEEE number) - BSSID hint - previous BSSID for reassoc request Move Management Frame Protection setting from common encr info structure into STA-specific .connect command parameters. Make sure that all new qlink structure definitions are alignment-safe. Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com> Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/commands.c63
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/qlink.h32
2 files changed, 65 insertions, 30 deletions
diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c
index c2f0b750365b..8bc8dd637315 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c
@@ -221,7 +221,6 @@ int qtnf_cmd_send_start_ap(struct qtnf_vif *vif,
221 aen = &cmd->aen; 221 aen = &cmd->aen;
222 aen->auth_type = s->auth_type; 222 aen->auth_type = s->auth_type;
223 aen->privacy = !!s->privacy; 223 aen->privacy = !!s->privacy;
224 aen->mfp = 0;
225 aen->wpa_versions = cpu_to_le32(s->crypto.wpa_versions); 224 aen->wpa_versions = cpu_to_le32(s->crypto.wpa_versions);
226 aen->cipher_group = cpu_to_le32(s->crypto.cipher_group); 225 aen->cipher_group = cpu_to_le32(s->crypto.cipher_group);
227 aen->n_ciphers_pairwise = cpu_to_le32(s->crypto.n_ciphers_pairwise); 226 aen->n_ciphers_pairwise = cpu_to_le32(s->crypto.n_ciphers_pairwise);
@@ -2029,17 +2028,36 @@ out:
2029 return ret; 2028 return ret;
2030} 2029}
2031 2030
2031static void qtnf_cmd_channel_tlv_add(struct sk_buff *cmd_skb,
2032 const struct ieee80211_channel *sc)
2033{
2034 struct qlink_tlv_channel *qchan;
2035 u32 flags = 0;
2036
2037 qchan = skb_put_zero(cmd_skb, sizeof(*qchan));
2038 qchan->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL);
2039 qchan->hdr.len = cpu_to_le16(sizeof(*qchan) - sizeof(qchan->hdr));
2040 qchan->center_freq = cpu_to_le16(sc->center_freq);
2041 qchan->hw_value = cpu_to_le16(sc->hw_value);
2042
2043 if (sc->flags & IEEE80211_CHAN_NO_IR)
2044 flags |= QLINK_CHAN_NO_IR;
2045
2046 if (sc->flags & IEEE80211_CHAN_RADAR)
2047 flags |= QLINK_CHAN_RADAR;
2048
2049 qchan->flags = cpu_to_le32(flags);
2050}
2051
2032int qtnf_cmd_send_scan(struct qtnf_wmac *mac) 2052int qtnf_cmd_send_scan(struct qtnf_wmac *mac)
2033{ 2053{
2034 struct sk_buff *cmd_skb; 2054 struct sk_buff *cmd_skb;
2035 u16 res_code = QLINK_CMD_RESULT_OK; 2055 u16 res_code = QLINK_CMD_RESULT_OK;
2036 struct ieee80211_channel *sc; 2056 struct ieee80211_channel *sc;
2037 struct cfg80211_scan_request *scan_req = mac->scan_req; 2057 struct cfg80211_scan_request *scan_req = mac->scan_req;
2038 struct qlink_tlv_channel *qchan;
2039 int n_channels; 2058 int n_channels;
2040 int count = 0; 2059 int count = 0;
2041 int ret; 2060 int ret;
2042 u32 flags;
2043 2061
2044 if (scan_req->n_ssids > QTNF_MAX_SSID_LIST_LENGTH) { 2062 if (scan_req->n_ssids > QTNF_MAX_SSID_LIST_LENGTH) {
2045 pr_err("MAC%u: too many SSIDs in scan request\n", mac->macid); 2063 pr_err("MAC%u: too many SSIDs in scan request\n", mac->macid);
@@ -2081,22 +2099,8 @@ int qtnf_cmd_send_scan(struct qtnf_wmac *mac)
2081 pr_debug("MAC%u: scan chan=%d, freq=%d, flags=%#x\n", 2099 pr_debug("MAC%u: scan chan=%d, freq=%d, flags=%#x\n",
2082 mac->macid, sc->hw_value, sc->center_freq, 2100 mac->macid, sc->hw_value, sc->center_freq,
2083 sc->flags); 2101 sc->flags);
2084 qchan = skb_put_zero(cmd_skb, sizeof(*qchan));
2085 flags = 0;
2086
2087 qchan->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL);
2088 qchan->hdr.len = cpu_to_le16(sizeof(*qchan) -
2089 sizeof(struct qlink_tlv_hdr));
2090 qchan->center_freq = cpu_to_le16(sc->center_freq);
2091 qchan->hw_value = cpu_to_le16(sc->hw_value);
2092
2093 if (sc->flags & IEEE80211_CHAN_NO_IR)
2094 flags |= QLINK_CHAN_NO_IR;
2095 2102
2096 if (sc->flags & IEEE80211_CHAN_RADAR) 2103 qtnf_cmd_channel_tlv_add(cmd_skb, sc);
2097 flags |= QLINK_CHAN_RADAR;
2098
2099 qchan->flags = cpu_to_le32(flags);
2100 n_channels--; 2104 n_channels--;
2101 count++; 2105 count++;
2102 } 2106 }
@@ -2140,10 +2144,15 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif,
2140 2144
2141 ether_addr_copy(cmd->bssid, vif->bssid); 2145 ether_addr_copy(cmd->bssid, vif->bssid);
2142 2146
2143 if (sme->channel) 2147 if (sme->bssid_hint)
2144 cmd->channel = cpu_to_le16(sme->channel->hw_value); 2148 ether_addr_copy(cmd->bssid_hint, sme->bssid_hint);
2145 else 2149 else
2146 cmd->channel = 0; 2150 eth_zero_addr(cmd->bssid_hint);
2151
2152 if (sme->prev_bssid)
2153 ether_addr_copy(cmd->prev_bssid, sme->prev_bssid);
2154 else
2155 eth_zero_addr(cmd->prev_bssid);
2147 2156
2148 if ((sme->bg_scan_period > 0) && 2157 if ((sme->bg_scan_period > 0) &&
2149 (sme->bg_scan_period <= QTNF_MAX_BG_SCAN_PERIOD)) 2158 (sme->bg_scan_period <= QTNF_MAX_BG_SCAN_PERIOD))
@@ -2161,11 +2170,18 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif,
2161 connect_flags |= QLINK_STA_CONNECT_USE_RRM; 2170 connect_flags |= QLINK_STA_CONNECT_USE_RRM;
2162 2171
2163 cmd->flags = cpu_to_le32(connect_flags); 2172 cmd->flags = cpu_to_le32(connect_flags);
2173 memcpy(&cmd->ht_capa, &sme->ht_capa, sizeof(cmd->ht_capa));
2174 memcpy(&cmd->ht_capa_mask, &sme->ht_capa_mask,
2175 sizeof(cmd->ht_capa_mask));
2176 memcpy(&cmd->vht_capa, &sme->vht_capa, sizeof(cmd->vht_capa));
2177 memcpy(&cmd->vht_capa_mask, &sme->vht_capa_mask,
2178 sizeof(cmd->vht_capa_mask));
2179 cmd->pbss = sme->pbss;
2164 2180
2165 aen = &cmd->aen; 2181 aen = &cmd->aen;
2166 aen->auth_type = sme->auth_type; 2182 aen->auth_type = sme->auth_type;
2167 aen->privacy = !!sme->privacy; 2183 aen->privacy = !!sme->privacy;
2168 aen->mfp = sme->mfp; 2184 cmd->mfp = sme->mfp;
2169 aen->wpa_versions = cpu_to_le32(sme->crypto.wpa_versions); 2185 aen->wpa_versions = cpu_to_le32(sme->crypto.wpa_versions);
2170 aen->cipher_group = cpu_to_le32(sme->crypto.cipher_group); 2186 aen->cipher_group = cpu_to_le32(sme->crypto.cipher_group);
2171 aen->n_ciphers_pairwise = cpu_to_le32(sme->crypto.n_ciphers_pairwise); 2187 aen->n_ciphers_pairwise = cpu_to_le32(sme->crypto.n_ciphers_pairwise);
@@ -2192,6 +2208,9 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif,
2192 qtnf_cmd_tlv_ie_set_add(cmd_skb, QLINK_IE_SET_ASSOC_REQ, 2208 qtnf_cmd_tlv_ie_set_add(cmd_skb, QLINK_IE_SET_ASSOC_REQ,
2193 sme->ie, sme->ie_len); 2209 sme->ie, sme->ie_len);
2194 2210
2211 if (sme->channel)
2212 qtnf_cmd_channel_tlv_add(cmd_skb, sme->channel);
2213
2195 qtnf_bus_lock(vif->mac->bus); 2214 qtnf_bus_lock(vif->mac->bus);
2196 2215
2197 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb, &res_code); 2216 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb, &res_code);
diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h
index e07f776fe928..a432fb001c41 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h
+++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h
@@ -19,7 +19,7 @@
19 19
20#include <linux/ieee80211.h> 20#include <linux/ieee80211.h>
21 21
22#define QLINK_PROTO_VER 5 22#define QLINK_PROTO_VER 6
23 23
24#define QLINK_MACID_RSVD 0xFF 24#define QLINK_MACID_RSVD 0xFF
25#define QLINK_VIFID_RSVD 0xFF 25#define QLINK_VIFID_RSVD 0xFF
@@ -148,9 +148,9 @@ struct qlink_auth_encr {
148 __le16 control_port_ethertype; 148 __le16 control_port_ethertype;
149 u8 auth_type; 149 u8 auth_type;
150 u8 privacy; 150 u8 privacy;
151 u8 mfp;
152 u8 control_port; 151 u8 control_port;
153 u8 control_port_no_encrypt; 152 u8 control_port_no_encrypt;
153 u8 rsvd[2];
154} __packed; 154} __packed;
155 155
156/* QLINK Command messages related definitions 156/* QLINK Command messages related definitions
@@ -404,20 +404,36 @@ enum qlink_sta_connect_flags {
404/** 404/**
405 * struct qlink_cmd_connect - data for QLINK_CMD_CONNECT command 405 * struct qlink_cmd_connect - data for QLINK_CMD_CONNECT command
406 * 406 *
407 * @flags: for future use. 407 * @bssid: BSSID of the BSS to connect to.
408 * @channel: channel which should be used to connect. 408 * @bssid_hint: recommended AP BSSID for initial connection to the BSS or
409 * 00:00:00:00:00:00 if not specified.
410 * @prev_bssid: previous BSSID, if specified (not 00:00:00:00:00:00) indicates
411 * a request to reassociate.
409 * @bg_scan_period: period of background scan. 412 * @bg_scan_period: period of background scan.
413 * @flags: one of &enum qlink_sta_connect_flags.
414 * @ht_capa: HT Capabilities overrides.
415 * @ht_capa_mask: The bits of ht_capa which are to be used.
416 * @vht_capa: VHT Capability overrides
417 * @vht_capa_mask: The bits of vht_capa which are to be used.
410 * @aen: authentication information. 418 * @aen: authentication information.
411 * @bssid: BSSID of the BSS to connect to. 419 * @mfp: whether to use management frame protection.
412 * @payload: variable portion of connection request. 420 * @payload: variable portion of connection request.
413 */ 421 */
414struct qlink_cmd_connect { 422struct qlink_cmd_connect {
415 struct qlink_cmd chdr; 423 struct qlink_cmd chdr;
416 __le32 flags; 424 u8 bssid[ETH_ALEN];
417 __le16 channel; 425 u8 bssid_hint[ETH_ALEN];
426 u8 prev_bssid[ETH_ALEN];
418 __le16 bg_scan_period; 427 __le16 bg_scan_period;
428 __le32 flags;
429 struct ieee80211_ht_cap ht_capa;
430 struct ieee80211_ht_cap ht_capa_mask;
431 struct ieee80211_vht_cap vht_capa;
432 struct ieee80211_vht_cap vht_capa_mask;
419 struct qlink_auth_encr aen; 433 struct qlink_auth_encr aen;
420 u8 bssid[ETH_ALEN]; 434 u8 mfp;
435 u8 pbss;
436 u8 rsvd[2];
421 u8 payload[0]; 437 u8 payload[0];
422} __packed; 438} __packed;
423 439