qtnfmac: support WPA3 OWE in AP mode

Enable WPA3 OWE support in AP mode. Driver currently supports cards that
offload OWE processing to userspace. This patch adds all the required
tools for such offloading. Firmware requests OWE processing sending new
UPDATE_OWE event to driver, which uses cfg80211_update_owe_info_event to
notify userspace software. After OWE processing is completed, userspace
sends calculated IEs to firmware using update_owe_info cfg80211 callback.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Sergey Matyukevich 2020-02-13 11:45:29 +00:00 committed by Kalle Valo
parent b3860e7a3e
commit 44d0976485
5 changed files with 137 additions and 1 deletions

View File

@ -908,6 +908,26 @@ static int qtnf_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
return ret;
}
static int qtnf_update_owe_info(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_update_owe_info *owe_info)
{
struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);
int ret;
if (vif->wdev.iftype != NL80211_IFTYPE_AP)
return -EOPNOTSUPP;
ret = qtnf_cmd_send_update_owe(vif, owe_info);
if (ret) {
pr_err("VIF%u.%u: failed to update owe info\n",
vif->mac->macid, vif->vifid);
goto out;
}
out:
return ret;
}
#ifdef CONFIG_PM
static int qtnf_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wowlan)
{
@ -1004,6 +1024,7 @@ static struct cfg80211_ops qtn_cfg80211_ops = {
.set_power_mgmt = qtnf_set_power_mgmt,
.get_tx_power = qtnf_get_tx_power,
.set_tx_power = qtnf_set_tx_power,
.update_owe_info = qtnf_update_owe_info,
#ifdef CONFIG_PM
.suspend = qtnf_suspend,
.resume = qtnf_resume,

View File

@ -2791,3 +2791,39 @@ int qtnf_cmd_netdev_changeupper(const struct qtnf_vif *vif, int br_domain)
return ret;
}
int qtnf_cmd_send_update_owe(struct qtnf_vif *vif,
struct cfg80211_update_owe_info *owe)
{
struct qlink_cmd_update_owe *cmd;
struct sk_buff *cmd_skb;
int ret;
if (sizeof(*cmd) + owe->ie_len > QTNF_MAX_CMD_BUF_SIZE) {
pr_warn("VIF%u.%u: OWE update IEs too big: %zu\n",
vif->mac->macid, vif->vifid, owe->ie_len);
return -E2BIG;
}
cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid,
QLINK_CMD_UPDATE_OWE,
sizeof(*cmd));
if (!cmd_skb)
return -ENOMEM;
cmd = (struct qlink_cmd_update_owe *)cmd_skb->data;
ether_addr_copy(cmd->peer, owe->peer);
cmd->status = cpu_to_le16(owe->status);
if (owe->ie_len && owe->ie)
qtnf_cmd_skb_put_buffer(cmd_skb, owe->ie, owe->ie_len);
qtnf_bus_lock(vif->mac->bus);
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
if (ret)
goto out;
out:
qtnf_bus_unlock(vif->mac->bus);
return ret;
}

View File

@ -76,5 +76,7 @@ int qtnf_cmd_set_tx_power(const struct qtnf_vif *vif,
int qtnf_cmd_send_wowlan_set(const struct qtnf_vif *vif,
const struct cfg80211_wowlan *wowl);
int qtnf_cmd_netdev_changeupper(const struct qtnf_vif *vif, int br_domain);
int qtnf_cmd_send_update_owe(struct qtnf_vif *vif,
struct cfg80211_update_owe_info *owe);
#endif /* QLINK_COMMANDS_H_ */

View File

@ -625,6 +625,50 @@ qtnf_event_handle_mic_failure(struct qtnf_vif *vif,
return 0;
}
static int
qtnf_event_handle_update_owe(struct qtnf_vif *vif,
const struct qlink_event_update_owe *owe_ev,
u16 len)
{
struct wiphy *wiphy = priv_to_wiphy(vif->mac);
struct cfg80211_update_owe_info owe_info = {};
const u16 ie_len = len - sizeof(*owe_ev);
u8 *ie;
if (len < sizeof(*owe_ev)) {
pr_err("VIF%u.%u: payload is too short (%u < %zu)\n",
vif->mac->macid, vif->vifid, len,
sizeof(struct qlink_event_update_owe));
return -EINVAL;
}
if (!wiphy->registered || !vif->netdev)
return 0;
if (vif->wdev.iftype != NL80211_IFTYPE_AP) {
pr_err("VIF%u.%u: UPDATE_OWE event when not in AP mode\n",
vif->mac->macid, vif->vifid);
return -EPROTO;
}
ie = kzalloc(ie_len, GFP_KERNEL);
if (!ie)
return -ENOMEM;
memcpy(owe_info.peer, owe_ev->peer, ETH_ALEN);
memcpy(ie, owe_ev->ies, ie_len);
owe_info.ie_len = ie_len;
owe_info.ie = ie;
pr_info("%s: external OWE processing: peer=%pM\n",
vif->netdev->name, owe_ev->peer);
cfg80211_update_owe_info_event(vif->netdev, &owe_info, GFP_KERNEL);
kfree(ie);
return 0;
}
static int qtnf_event_parse(struct qtnf_wmac *mac,
const struct sk_buff *event_skb)
{
@ -693,6 +737,10 @@ static int qtnf_event_parse(struct qtnf_wmac *mac,
ret = qtnf_event_handle_mic_failure(vif, (const void *)event,
event_len);
break;
case QLINK_EVENT_UPDATE_OWE:
ret = qtnf_event_handle_update_owe(vif, (const void *)event,
event_len);
break;
default:
pr_warn("unknown event type: %x\n", event_id);
break;

View File

@ -15,7 +15,7 @@
#define QLINK_VER(_maj, _min) (((_maj) << QLINK_PROTO_VER_MAJOR_S) | (_min))
#define QLINK_PROTO_VER_MAJOR 18
#define QLINK_PROTO_VER_MINOR 0
#define QLINK_PROTO_VER_MINOR 1
#define QLINK_PROTO_VER \
QLINK_VER(QLINK_PROTO_VER_MAJOR, QLINK_PROTO_VER_MINOR)
@ -322,6 +322,7 @@ enum qlink_cmd_type {
QLINK_CMD_WOWLAN_SET = 0x0063,
QLINK_CMD_EXTERNAL_AUTH = 0x0066,
QLINK_CMD_TXPWR = 0x0067,
QLINK_CMD_UPDATE_OWE = 0x0068,
};
/**
@ -960,6 +961,20 @@ struct qlink_cmd_scan {
u8 var_info[0];
} __packed;
/**
* struct qlink_cmd_update_owe - data for QLINK_CMD_UPDATE_OWE_INFO command
*
* @peer: MAC of the peer device for which OWE processing has been completed
* @status: OWE external processing status code
* @ies: IEs for the peer constructed by the user space
*/
struct qlink_cmd_update_owe {
struct qlink_cmd chdr;
u8 peer[ETH_ALEN];
__le16 status;
u8 ies[0];
} __packed;
/* QLINK Command Responses messages related definitions
*/
@ -1222,6 +1237,7 @@ enum qlink_event_type {
QLINK_EVENT_RADAR = 0x0029,
QLINK_EVENT_EXTERNAL_AUTH = 0x0030,
QLINK_EVENT_MIC_FAILURE = 0x0031,
QLINK_EVENT_UPDATE_OWE = 0x0032,
};
/**
@ -1430,6 +1446,19 @@ struct qlink_event_mic_failure {
u8 pairwise;
} __packed;
/**
* struct qlink_event_update_owe - data for QLINK_EVENT_UPDATE_OWE event
*
* @peer: MAC addr of the peer device for which OWE processing needs to be done
* @ies: IEs from the peer
*/
struct qlink_event_update_owe {
struct qlink_event ehdr;
u8 peer[ETH_ALEN];
u8 rsvd[2];
u8 ies[0];
} __packed;
/* QLINK TLVs (Type-Length Values) definitions
*/