Commit b97dcb85 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge tag 'wireless-next-2022-06-10' of...

Merge tag 'wireless-next-2022-06-10' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next

Johannes Berg says:

====================
wireless-next patches for v5.20

Here's a first set of patches for v5.20. This is just a
queue flush, before we get things back from net-next that
are causing conflicts, and then can start merging a lot
of MLO (multi-link operation, part of 802.11be) code.

Lots of cleanups all over.

The only notable change is perhaps wilc1000 being the
first driver to disable WEP (while enabling WPA3).

* tag 'wireless-next-2022-06-10' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (29 commits)
  wifi: mac80211_hwsim: Directly use ida_alloc()/free()
  wifi: mac80211: refactor some key code
  wifi: mac80211: remove cipher scheme support
  wifi: nl80211: fix typo in comment
  wifi: virt_wifi: fix typo in comment
  rtw89: add new state to CFO state machine for UL-OFDMA
  rtw89: 8852c: add trigger frame counter
  ieee80211: add trigger frame definition
  wifi: wfx: Remove redundant NULL check before release_firmware() call
  wifi: rtw89: support MULTI_BSSID and correct BSSID mask of H2C
  wifi: ray_cs: Drop useless status variable in parse_addr()
  wifi: ray_cs: Utilize strnlen() in parse_addr()
  wifi: rtw88: use %*ph to print small buffer
  wifi: wilc1000: add IGTK support
  wifi: wilc1000: add WPA3 SAE support
  wifi: wilc1000: remove WEP security support
  wifi: wilc1000: use correct sequence of RESET for chip Power-UP/Down
  wifi: rtlwifi: fix error codes in rtl_debugfs_set_write_h2c()
  wifi: rtw88: Fix Sparse warning for rtw8821c_hw_spec
  wifi: rtw88: Fix Sparse warning for rtw8723d_hw_spec
  ...
====================

Link: https://lore.kernel.org/r/20220610142838.330862-1-johannes@sipsolutions.net


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 7defbc9a 1449c24e
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -290,8 +290,7 @@ static inline int hwsim_net_set_netgroup(struct net *net)
{
	struct hwsim_net *hwsim_net = net_generic(net, hwsim_net_id);

	hwsim_net->netgroup = ida_simple_get(&hwsim_netgroup_ida,
					     0, 0, GFP_KERNEL);
	hwsim_net->netgroup = ida_alloc(&hwsim_netgroup_ida, GFP_KERNEL);
	return hwsim_net->netgroup >= 0 ? 0 : -ENOMEM;
}

@@ -4733,7 +4732,7 @@ static void __net_exit hwsim_exit_net(struct net *net)
					 NULL);
	}

	ida_simple_remove(&hwsim_netgroup_ida, hwsim_net_get_netgroup(net));
	ida_free(&hwsim_netgroup_ida, hwsim_net_get_netgroup(net));
}

static struct pernet_operations hwsim_net_ops = {
+148 −98
Original line number Diff line number Diff line
@@ -20,9 +20,11 @@
static const struct ieee80211_txrx_stypes
	wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
	[NL80211_IFTYPE_STATION] = {
		.tx = 0xffff,
		.tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
			BIT(IEEE80211_STYPE_AUTH >> 4),
		.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
			BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
			BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
			BIT(IEEE80211_STYPE_AUTH >> 4)
	},
	[NL80211_IFTYPE_AP] = {
		.tx = 0xffff,
@@ -305,6 +307,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
	int ret;
	u32 i;
	u8 security = WILC_FW_SEC_NO;
	enum mfptype mfp_type = WILC_FW_MFP_NONE;
	enum authtype auth_type = WILC_FW_AUTH_ANY;
	u32 cipher_group;
	struct cfg80211_bss *bss;
@@ -313,32 +316,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,

	vif->connecting = true;

	memset(priv->wep_key, 0, sizeof(priv->wep_key));
	memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));

	cipher_group = sme->crypto.cipher_group;
	if (cipher_group != 0) {
		if (cipher_group == WLAN_CIPHER_SUITE_WEP40) {
			security = WILC_FW_SEC_WEP;

			priv->wep_key_len[sme->key_idx] = sme->key_len;
			memcpy(priv->wep_key[sme->key_idx], sme->key,
			       sme->key_len);

			wilc_set_wep_default_keyid(vif, sme->key_idx);
			wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
						 sme->key_idx);
		} else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
			security = WILC_FW_SEC_WEP_EXTENDED;

			priv->wep_key_len[sme->key_idx] = sme->key_len;
			memcpy(priv->wep_key[sme->key_idx], sme->key,
			       sme->key_len);

			wilc_set_wep_default_keyid(vif, sme->key_idx);
			wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
						 sme->key_idx);
		} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
		if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
			if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
				security = WILC_FW_SEC_WPA2_TKIP;
			else
@@ -373,8 +353,14 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
		auth_type = WILC_FW_AUTH_OPEN_SYSTEM;
		break;

	case NL80211_AUTHTYPE_SHARED_KEY:
		auth_type = WILC_FW_AUTH_SHARED_KEY;
	case NL80211_AUTHTYPE_SAE:
		auth_type = WILC_FW_AUTH_SAE;
		if (sme->ssid_len) {
			memcpy(vif->auth.ssid.ssid, sme->ssid, sme->ssid_len);
			vif->auth.ssid.ssid_len = sme->ssid_len;
		}
		vif->auth.key_mgmt_suite = cpu_to_be32(sme->crypto.akm_suites[0]);
		ether_addr_copy(vif->auth.bssid, sme->bssid);
		break;

	default:
@@ -384,6 +370,10 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
	if (sme->crypto.n_akm_suites) {
		if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X)
			auth_type = WILC_FW_AUTH_IEEE8021;
		else if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_PSK_SHA256)
			auth_type = WILC_FW_AUTH_OPEN_SYSTEM_SHA256;
		else if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X_SHA256)
			auth_type = WILC_FW_AUTH_IEE8021X_SHA256;
	}

	if (wfi_drv->usr_scan_req.scan_result) {
@@ -427,6 +417,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
	wfi_drv->conn_info.arg = priv;
	wfi_drv->conn_info.param = join_params;

	if (sme->mfp == NL80211_MFP_OPTIONAL)
		mfp_type = WILC_FW_MFP_OPTIONAL;
	else if (sme->mfp == NL80211_MFP_REQUIRED)
		mfp_type = WILC_FW_MFP_REQUIRED;

	wfi_drv->conn_info.mfp_type = mfp_type;

	ret = wilc_set_join_req(vif, bss->bssid, sme->ie, sme->ie_len);
	if (ret) {
		netdev_err(dev, "wilc_set_join_req(): Error\n");
@@ -487,14 +484,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
	return ret;
}

static inline void wilc_wfi_cfg_copy_wep_info(struct wilc_priv *priv,
					      u8 key_index,
					      struct key_params *params)
{
	priv->wep_key_len[key_index] = params->key_len;
	memcpy(priv->wep_key[key_index], params->key, params->key_len);
}

static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx)
{
	if (!priv->wilc_gtk[idx]) {
@@ -514,6 +503,18 @@ static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx)
	return 0;
}

static int wilc_wfi_cfg_allocate_wpa_igtk_entry(struct wilc_priv *priv, u8 idx)
{
	idx -= 4;
	if (!priv->wilc_igtk[idx]) {
		priv->wilc_igtk[idx] = kzalloc(sizeof(*priv->wilc_igtk[idx]),
					       GFP_KERNEL);
		if (!priv->wilc_igtk[idx])
			return -ENOMEM;
	}
	return 0;
}

static int wilc_wfi_cfg_copy_wpa_info(struct wilc_wfi_key *key_info,
				      struct key_params *params)
{
@@ -550,35 +551,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
	u8 op_mode;
	struct wilc_vif *vif = netdev_priv(netdev);
	struct wilc_priv *priv = &vif->priv;
	struct wilc_wfi_key *key;

	switch (params->cipher) {
	case WLAN_CIPHER_SUITE_WEP40:
	case WLAN_CIPHER_SUITE_WEP104:
		if (priv->wdev.iftype == NL80211_IFTYPE_AP) {
			wilc_wfi_cfg_copy_wep_info(priv, key_index, params);

			if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
				mode = WILC_FW_SEC_WEP;
			else
				mode = WILC_FW_SEC_WEP_EXTENDED;

			ret = wilc_add_wep_key_bss_ap(vif, params->key,
						      params->key_len,
						      key_index, mode,
						      WILC_FW_AUTH_OPEN_SYSTEM);
			break;
		}
		if (memcmp(params->key, priv->wep_key[key_index],
			   params->key_len)) {
			wilc_wfi_cfg_copy_wep_info(priv, key_index, params);

			ret = wilc_add_wep_key_bss_sta(vif, params->key,
						       params->key_len,
						       key_index);
		}

		break;

	case WLAN_CIPHER_SUITE_TKIP:
	case WLAN_CIPHER_SUITE_CCMP:
		if (priv->wdev.iftype == NL80211_IFTYPE_AP ||
@@ -640,6 +615,26 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
					   key_index);

		break;
	case WLAN_CIPHER_SUITE_AES_CMAC:
		ret = wilc_wfi_cfg_allocate_wpa_igtk_entry(priv, key_index);
		if (ret)
			return -ENOMEM;

		key = priv->wilc_igtk[key_index - 4];
		ret = wilc_wfi_cfg_copy_wpa_info(key, params);
		if (ret)
			return -ENOMEM;

		if (priv->wdev.iftype == NL80211_IFTYPE_AP ||
		    priv->wdev.iftype == NL80211_IFTYPE_P2P_GO)
			op_mode = WILC_AP_MODE;
		else
			op_mode = WILC_STATION_MODE;

		ret = wilc_add_igtk(vif, params->key, keylen, params->seq,
				    params->seq_len, mac_addr, op_mode,
				    key_index);
		break;

	default:
		netdev_err(netdev, "%s: Unsupported cipher\n", __func__);
@@ -657,6 +652,17 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
	struct wilc_vif *vif = netdev_priv(netdev);
	struct wilc_priv *priv = &vif->priv;

	if (!pairwise && (key_index == 4 || key_index == 5)) {
		key_index -= 4;
		if (priv->wilc_igtk[key_index]) {
			kfree(priv->wilc_igtk[key_index]->key);
			priv->wilc_igtk[key_index]->key = NULL;
			kfree(priv->wilc_igtk[key_index]->seq);
			priv->wilc_igtk[key_index]->seq = NULL;
			kfree(priv->wilc_igtk[key_index]);
			priv->wilc_igtk[key_index] = NULL;
		}
	} else {
		if (priv->wilc_gtk[key_index]) {
			kfree(priv->wilc_gtk[key_index]->key);
			priv->wilc_gtk[key_index]->key = NULL;
@@ -666,7 +672,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
			kfree(priv->wilc_gtk[key_index]);
			priv->wilc_gtk[key_index] = NULL;
		}

		if (priv->wilc_ptk[key_index]) {
			kfree(priv->wilc_ptk[key_index]->key);
			priv->wilc_ptk[key_index]->key = NULL;
@@ -675,12 +680,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
			kfree(priv->wilc_ptk[key_index]);
			priv->wilc_ptk[key_index] = NULL;
		}

	if (key_index <= 3 && priv->wep_key_len[key_index]) {
		memset(priv->wep_key[key_index], 0,
		       priv->wep_key_len[key_index]);
		priv->wep_key_len[key_index] = 0;
		wilc_remove_wep_key(vif, key_index);
	}

	return 0;
@@ -695,11 +694,20 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
	struct  key_params key_params;

	if (!pairwise) {
		if (key_index == 4 || key_index == 5) {
			key_index -= 4;
			key_params.key = priv->wilc_igtk[key_index]->key;
			key_params.cipher = priv->wilc_igtk[key_index]->cipher;
			key_params.key_len = priv->wilc_igtk[key_index]->key_len;
			key_params.seq = priv->wilc_igtk[key_index]->seq;
			key_params.seq_len = priv->wilc_igtk[key_index]->seq_len;
		} else {
			key_params.key = priv->wilc_gtk[key_index]->key;
			key_params.cipher = priv->wilc_gtk[key_index]->cipher;
			key_params.key_len = priv->wilc_gtk[key_index]->key_len;
			key_params.seq = priv->wilc_gtk[key_index]->seq;
			key_params.seq_len = priv->wilc_gtk[key_index]->seq_len;
		}
	} else {
		key_params.key = priv->wilc_ptk[key_index]->key;
		key_params.cipher = priv->wilc_ptk[key_index]->cipher;
@@ -713,14 +721,19 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
	return 0;
}

/* wiphy_new_nm() will WARNON if not present */
static int set_default_key(struct wiphy *wiphy, struct net_device *netdev,
			   u8 key_index, bool unicast, bool multicast)
{
	struct wilc_vif *vif = netdev_priv(netdev);
	return 0;
}

	wilc_set_wep_default_keyid(vif, key_index);
static int set_default_mgmt_key(struct wiphy *wiphy, struct net_device *netdev,
				u8 key_index)
{
	struct wilc_vif *vif = netdev_priv(netdev);

	return 0;
	return wilc_set_default_mgmt_key_index(vif, key_index);
}

static int get_station(struct wiphy *wiphy, struct net_device *dev,
@@ -977,6 +990,18 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u32 len, u8 sta_ch)
	}
}

bool wilc_wfi_mgmt_frame_rx(struct wilc_vif *vif, u8 *buff, u32 size)
{
	struct wilc *wl = vif->wilc;
	struct wilc_priv *priv = &vif->priv;
	int freq, ret;

	freq = ieee80211_channel_to_frequency(wl->op_ch, NL80211_BAND_2GHZ);
	ret = cfg80211_rx_mgmt(&priv->wdev, freq, 0, buff, size, 0);

	return ret;
}

void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size)
{
	struct wilc *wl = vif->wilc;
@@ -1162,8 +1187,14 @@ static int mgmt_tx(struct wiphy *wiphy,
		goto out_txq_add_pkt;
	}

	if (!ieee80211_is_public_action((struct ieee80211_hdr *)buf, len))
	if (!ieee80211_is_public_action((struct ieee80211_hdr *)buf, len)) {
		if (chan)
			wilc_set_mac_chnl_num(vif, chan->hw_value);
		else
			wilc_set_mac_chnl_num(vif, vif->wilc->op_ch);

		goto out_set_timeout;
	}

	d = (struct wilc_p2p_pub_act_frame *)(&mgmt->u.action);
	if (d->oui_type != WLAN_OUI_TYPE_WFA_P2P ||
@@ -1230,6 +1261,7 @@ void wilc_update_mgmt_frame_registrations(struct wiphy *wiphy,
	struct wilc_vif *vif = netdev_priv(wdev->netdev);
	u32 presp_bit = BIT(IEEE80211_STYPE_PROBE_REQ >> 4);
	u32 action_bit = BIT(IEEE80211_STYPE_ACTION >> 4);
	u32 pauth_bit = BIT(IEEE80211_STYPE_AUTH >> 4);

	if (wl->initialized) {
		bool prev = vif->mgmt_reg_stypes & presp_bit;
@@ -1243,10 +1275,26 @@ void wilc_update_mgmt_frame_registrations(struct wiphy *wiphy,

		if (now != prev)
			wilc_frame_register(vif, IEEE80211_STYPE_ACTION, now);

		prev = vif->mgmt_reg_stypes & pauth_bit;
		now = upd->interface_stypes & pauth_bit;
		if (now != prev)
			wilc_frame_register(vif, IEEE80211_STYPE_AUTH, now);
	}

	vif->mgmt_reg_stypes =
		upd->interface_stypes & (presp_bit | action_bit);
		upd->interface_stypes & (presp_bit | action_bit | pauth_bit);
}

static int external_auth(struct wiphy *wiphy, struct net_device *dev,
			 struct cfg80211_external_auth_params *auth)
{
	struct wilc_vif *vif = netdev_priv(dev);

	if (auth->status == WLAN_STATUS_SUCCESS)
		wilc_set_external_auth_param(vif, auth);

	return 0;
}

static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
@@ -1647,6 +1695,7 @@ static const struct cfg80211_ops wilc_cfg80211_ops = {
	.del_key = del_key,
	.get_key = get_key,
	.set_default_key = set_default_key,
	.set_default_mgmt_key = set_default_mgmt_key,
	.add_virtual_intf = add_virtual_intf,
	.del_virtual_intf = del_virtual_intf,
	.change_virtual_intf = change_virtual_intf,
@@ -1662,6 +1711,7 @@ static const struct cfg80211_ops wilc_cfg80211_ops = {
	.change_bss = change_bss,
	.set_wiphy_params = set_wiphy_params,

	.external_auth = external_auth,
	.set_pmksa = set_pmksa,
	.del_pmksa = del_pmksa,
	.flush_pmksa = flush_pmksa,
@@ -1804,7 +1854,7 @@ struct wilc *wilc_create_wiphy(struct device *dev)
				BIT(NL80211_IFTYPE_P2P_GO) |
				BIT(NL80211_IFTYPE_P2P_CLIENT);
	wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;

	wiphy->features |= NL80211_FEATURE_SAE;
	set_wiphy_dev(wiphy, dev);
	wl->wiphy = wiphy;
	ret = wiphy_register(wiphy);
+16 −5
Original line number Diff line number Diff line
@@ -41,21 +41,23 @@ struct wilc_drv_handler {
	u8 mode;
} __packed;

struct wilc_wep_key {
	u8 index;
struct wilc_sta_wpa_ptk {
	u8 mac_addr[ETH_ALEN];
	u8 key_len;
	u8 key[];
} __packed;

struct wilc_sta_wpa_ptk {
struct wilc_ap_wpa_ptk {
	u8 mac_addr[ETH_ALEN];
	u8 index;
	u8 key_len;
	u8 key[];
} __packed;

struct wilc_ap_wpa_ptk {
	u8 mac_addr[ETH_ALEN];
struct wilc_wpa_igtk {
	u8 index;
	u8 pn_len;
	u8 pn[6];
	u8 key_len;
	u8 key[];
} __packed;
@@ -116,4 +118,13 @@ struct wilc_join_bss_param {
		struct wilc_noa_opp_enable opp_en;
	};
} __packed;

struct wilc_external_auth_param {
	u8 action;
	u8 bssid[ETH_ALEN];
	u8 ssid[IEEE80211_MAX_SSID_LEN];
	u8 ssid_len;
	__le32 key_mgmt_suites;
	__le16 status;
} __packed;
#endif
+96 −106
Original line number Diff line number Diff line
@@ -271,12 +271,19 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
static int wilc_send_connect_wid(struct wilc_vif *vif)
{
	int result = 0;
	struct wid wid_list[4];
	struct wid wid_list[5];
	u32 wid_cnt = 0;
	struct host_if_drv *hif_drv = vif->hif_drv;
	struct wilc_conn_info *conn_attr = &hif_drv->conn_info;
	struct wilc_join_bss_param *bss_param = conn_attr->param;


        wid_list[wid_cnt].id = WID_SET_MFP;
        wid_list[wid_cnt].type = WID_CHAR;
        wid_list[wid_cnt].size = sizeof(char);
        wid_list[wid_cnt].val = (s8 *)&conn_attr->mfp_type;
        wid_cnt++;

	wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
	wid_list[wid_cnt].type = WID_BIN_DATA;
	wid_list[wid_cnt].val = conn_attr->req_ies;
@@ -306,6 +313,9 @@ static int wilc_send_connect_wid(struct wilc_vif *vif)
		netdev_err(vif->ndev, "failed to send config packet\n");
		goto error;
	} else {
                if (conn_attr->auth_type == WILC_FW_AUTH_SAE)
                        hif_drv->hif_state = HOST_IF_EXTERNAL_AUTH;
                else
                        hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
	}

@@ -665,7 +675,12 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work)
		goto free_msg;
	}

	if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {

        if (hif_drv->hif_state == HOST_IF_EXTERNAL_AUTH) {
                cfg80211_external_auth_request(vif->ndev, &vif->auth,
					       GFP_KERNEL);
                hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
        } else if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
		host_int_parse_assoc_resp_info(vif, mac_info->status);
	} else if (mac_info->status == WILC_MAC_STATUS_DISCONNECTED) {
		if (hif_drv->hif_state == HOST_IF_CONNECTED) {
@@ -710,7 +725,8 @@ int wilc_disconnect(struct wilc_vif *vif)
	}

	if (conn_info->conn_result) {
		if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP)
		if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
		    hif_drv->hif_state == HOST_IF_EXTERNAL_AUTH)
			del_timer(&hif_drv->connect_timer);

		conn_info->conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, 0,
@@ -986,6 +1002,31 @@ void wilc_set_wowlan_trigger(struct wilc_vif *vif, bool enabled)
		pr_err("Failed to send wowlan trigger config packet\n");
}

int wilc_set_external_auth_param(struct wilc_vif *vif,
				 struct cfg80211_external_auth_params *auth)
{
	int ret;
	struct wid wid;
	struct wilc_external_auth_param *param;

	wid.id = WID_EXTERNAL_AUTH_PARAM;
	wid.type = WID_BIN_DATA;
	wid.size = sizeof(*param);
	param = kzalloc(sizeof(*param), GFP_KERNEL);
	if (!param)
		return -EINVAL;

	wid.val = (u8 *)param;
	param->action = auth->action;
	ether_addr_copy(param->bssid, auth->bssid);
	memcpy(param->ssid, auth->ssid.ssid, auth->ssid.ssid_len);
	param->ssid_len = auth->ssid.ssid_len;
	ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);

	kfree(param);
	return ret;
}

static void handle_scan_timer(struct work_struct *work)
{
	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -1038,108 +1079,6 @@ static void timer_connect_cb(struct timer_list *t)
		kfree(msg);
}

int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
{
	struct wid wid;
	int result;

	wid.id = WID_REMOVE_WEP_KEY;
	wid.type = WID_STR;
	wid.size = sizeof(char);
	wid.val = &index;

	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
	if (result)
		netdev_err(vif->ndev,
			   "Failed to send remove wep key config packet\n");
	return result;
}

int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
{
	struct wid wid;
	int result;

	wid.id = WID_KEY_ID;
	wid.type = WID_CHAR;
	wid.size = sizeof(char);
	wid.val = &index;
	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
	if (result)
		netdev_err(vif->ndev,
			   "Failed to send wep default key config packet\n");

	return result;
}

int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
			     u8 index)
{
	struct wid wid;
	int result;
	struct wilc_wep_key *wep_key;

	wid.id = WID_ADD_WEP_KEY;
	wid.type = WID_STR;
	wid.size = sizeof(*wep_key) + len;
	wep_key = kzalloc(wid.size, GFP_KERNEL);
	if (!wep_key)
		return -ENOMEM;

	wid.val = (u8 *)wep_key;

	wep_key->index = index;
	wep_key->key_len = len;
	memcpy(wep_key->key, key, len);

	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
	if (result)
		netdev_err(vif->ndev,
			   "Failed to add wep key config packet\n");

	kfree(wep_key);
	return result;
}

int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
			    u8 index, u8 mode, enum authtype auth_type)
{
	struct wid wid_list[3];
	int result;
	struct wilc_wep_key *wep_key;

	wid_list[0].id = WID_11I_MODE;
	wid_list[0].type = WID_CHAR;
	wid_list[0].size = sizeof(char);
	wid_list[0].val = &mode;

	wid_list[1].id = WID_AUTH_TYPE;
	wid_list[1].type = WID_CHAR;
	wid_list[1].size = sizeof(char);
	wid_list[1].val = (s8 *)&auth_type;

	wid_list[2].id = WID_WEP_KEY_VALUE;
	wid_list[2].type = WID_STR;
	wid_list[2].size = sizeof(*wep_key) + len;
	wep_key = kzalloc(wid_list[2].size, GFP_KERNEL);
	if (!wep_key)
		return -ENOMEM;

	wid_list[2].val = (u8 *)wep_key;

	wep_key->index = index;
	wep_key->key_len = len;
	memcpy(wep_key->key, key, len);
	result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
				      ARRAY_SIZE(wid_list));
	if (result)
		netdev_err(vif->ndev,
			   "Failed to add wep ap key config packet\n");

	kfree(wep_key);
	return result;
}

int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
		 const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
		 u8 mode, u8 cipher_mode, u8 index)
@@ -1211,6 +1150,36 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
	return result;
}

int wilc_add_igtk(struct wilc_vif *vif, const u8 *igtk, u8 igtk_key_len,
		  const u8 *pn, u8 pn_len, const u8 *mac_addr, u8 mode, u8 index)
{
	int result = 0;
	u8 t_key_len = igtk_key_len;
	struct wid wid;
	struct wilc_wpa_igtk *key_buf;

	key_buf = kzalloc(sizeof(*key_buf) + t_key_len, GFP_KERNEL);
	if (!key_buf)
		return -ENOMEM;

	key_buf->index = index;

	memcpy(&key_buf->pn[0], pn, pn_len);
	key_buf->pn_len = pn_len;

	memcpy(&key_buf->key[0], igtk, igtk_key_len);
	key_buf->key_len = t_key_len;

	wid.id = WID_ADD_IGTK;
	wid.type = WID_STR;
	wid.size = sizeof(*key_buf) + t_key_len;
	wid.val = (s8 *)key_buf;
	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
	kfree(key_buf);

	return result;
}

int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
		    u8 index, u32 key_rsc_len, const u8 *key_rsc,
		    const u8 *rx_mic, const u8 *tx_mic, u8 mode,
@@ -1749,6 +1718,10 @@ void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
		reg_frame.reg_id = WILC_FW_PROBE_REQ_IDX;
		break;

        case IEEE80211_STYPE_AUTH:
                reg_frame.reg_id = WILC_FW_AUTH_REQ_IDX;
                break;

	default:
		break;
	}
@@ -1996,3 +1969,20 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)

	return wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1);
}

int wilc_set_default_mgmt_key_index(struct wilc_vif *vif, u8 index)
{
        struct wid wid;
        int result;

        wid.id = WID_DEFAULT_MGMT_KEY_ID;
        wid.type = WID_CHAR;
        wid.size = sizeof(char);
        wid.val = &index;
        result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
        if (result)
                netdev_err(vif->ndev,
                           "Failed to send default mgmt key index\n");

        return result;
}
+8 −6
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ enum host_if_state {
	HOST_IF_WAITING_CONN_RESP	= 3,
	HOST_IF_CONNECTED		= 4,
	HOST_IF_P2P_LISTEN		= 5,
	HOST_IF_EXTERNAL_AUTH           = 6,
	HOST_IF_FORCE_32BIT		= 0xFFFFFFFF
};

@@ -107,6 +108,7 @@ struct wilc_conn_info {
	u8 bssid[ETH_ALEN];
	u8 security;
	enum authtype auth_type;
	enum mfptype mfp_type;
	u8 ch;
	u8 *req_ies;
	size_t req_ies_len;
@@ -151,15 +153,12 @@ struct host_if_drv {
};

struct wilc_vif;
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
			     u8 index);
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
			    u8 index, u8 mode, enum authtype auth_type);
int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
		 const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
		 u8 mode, u8 cipher_mode, u8 index);
int wilc_add_igtk(struct wilc_vif *vif, const u8 *igtk, u8 igtk_key_len,
		  const u8 *pn, u8 pn_len, const u8 *mac_addr, u8 mode,
		  u8 index);
s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
			   u32 *out_val);
int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
@@ -208,9 +207,12 @@ int wilc_get_vif_idx(struct wilc_vif *vif);
int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
void wilc_set_wowlan_trigger(struct wilc_vif *vif, bool enabled);
int wilc_set_external_auth_param(struct wilc_vif *vif,
				 struct cfg80211_external_auth_params *param);
void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length);
void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length);
void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length);
void *wilc_parse_join_bss_param(struct cfg80211_bss *bss,
				struct cfg80211_crypto_settings *crypto);
int wilc_set_default_mgmt_key_index(struct wilc_vif *vif, u8 index);
#endif
Loading