Skip to content

Commit 171ae51

Browse files
committed
Merge branch 'at91-5.10-trunk/wilc_new' into linux-5.10-at91
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
2 parents c49b04b + 98f811c commit 171ae51

11 files changed

Lines changed: 347 additions & 283 deletions

File tree

drivers/net/wireless/microchip/wilc1000/cfg80211.c

Lines changed: 186 additions & 133 deletions
Large diffs are not rendered by default.

drivers/net/wireless/microchip/wilc1000/fw.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,23 @@ struct wilc_drv_handler {
4141
u8 mode;
4242
} __packed;
4343

44-
struct wilc_wep_key {
45-
u8 index;
44+
struct wilc_sta_wpa_ptk {
45+
u8 mac_addr[ETH_ALEN];
4646
u8 key_len;
4747
u8 key[];
4848
} __packed;
4949

50-
struct wilc_sta_wpa_ptk {
50+
struct wilc_ap_wpa_ptk {
5151
u8 mac_addr[ETH_ALEN];
52+
u8 index;
5253
u8 key_len;
5354
u8 key[];
5455
} __packed;
5556

56-
struct wilc_ap_wpa_ptk {
57-
u8 mac_addr[ETH_ALEN];
57+
struct wilc_wpa_igtk {
5858
u8 index;
59+
u8 pn_len;
60+
u8 pn[6];
5961
u8 key_len;
6062
u8 key[];
6163
} __packed;
@@ -116,4 +118,13 @@ struct wilc_join_bss_param {
116118
struct wilc_noa_opp_enable opp_en;
117119
};
118120
} __packed;
121+
122+
struct wilc_external_auth_param {
123+
u8 action;
124+
u8 bssid[ETH_ALEN];
125+
u8 ssid[IEEE80211_MAX_SSID_LEN];
126+
u8 ssid_len;
127+
__le32 key_mgmt_suites;
128+
__le16 status;
129+
} __packed;
119130
#endif

drivers/net/wireless/microchip/wilc1000/hif.c

Lines changed: 88 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
404404
static int wilc_send_connect_wid(struct wilc_vif *vif)
405405
{
406406
int result = 0;
407-
struct wid wid_list[4];
407+
struct wid wid_list[5];
408408
u32 wid_cnt = 0;
409409
struct host_if_drv *hif_drv = vif->hif_drv;
410410
struct wilc_conn_info *conn_attr = &hif_drv->conn_info;
@@ -432,6 +432,12 @@ static int wilc_send_connect_wid(struct wilc_vif *vif)
432432
}
433433
srcu_read_unlock(&vif->wilc->srcu, srcu_idx);
434434

435+
wid_list[wid_cnt].id = WID_SET_MFP;
436+
wid_list[wid_cnt].type = WID_CHAR;
437+
wid_list[wid_cnt].size = sizeof(char);
438+
wid_list[wid_cnt].val = (s8 *)&conn_attr->mfp_type;
439+
wid_cnt++;
440+
435441
wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
436442
wid_list[wid_cnt].type = WID_BIN_DATA;
437443
wid_list[wid_cnt].val = conn_attr->req_ies;
@@ -463,16 +469,21 @@ static int wilc_send_connect_wid(struct wilc_vif *vif)
463469
wid_list[wid_cnt].val = (u8 *)bss_param;
464470
wid_cnt++;
465471

472+
PRINT_D(vif->ndev, HOSTINF_DBG, "Management Frame Protection type = %x\n",
473+
conn_attr->mfp_type);
466474
PRINT_INFO(vif->ndev, GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
467475

468476
result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, wid_cnt);
469477
if (result) {
470478
netdev_err(vif->ndev, "failed to send config packet\n");
471479
goto error;
472480
} else {
481+
if (conn_attr->auth_type == WILC_FW_AUTH_SAE)
482+
hif_drv->hif_state = HOST_IF_EXTERNAL_AUTH;
483+
else
484+
hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
473485
PRINT_INFO(vif->ndev, GENERIC_DBG,
474-
"set HOST_IF_WAITING_CONN_RESP\n");
475-
hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
486+
"set state [%d]\n", hif_drv->hif_state);
476487
}
477488

478489
return 0;
@@ -871,7 +882,15 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work)
871882
goto free_msg;
872883
}
873884

874-
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
885+
if (hif_drv->hif_state == HOST_IF_EXTERNAL_AUTH) {
886+
int ret;
887+
888+
pr_debug("%s: external SAE processing: bss=%pM akm=%u\n",
889+
__func__, vif->auth.bssid, vif->auth.key_mgmt_suite);
890+
ret = cfg80211_external_auth_request(vif->ndev, &vif->auth,
891+
GFP_KERNEL);
892+
hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
893+
} else if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
875894
host_int_parse_assoc_resp_info(vif, mac_info->status);
876895
} else if (mac_info->status == WILC_MAC_STATUS_DISCONNECTED) {
877896
if (hif_drv->hif_state == HOST_IF_CONNECTED) {
@@ -941,7 +960,8 @@ int wilc_disconnect(struct wilc_vif *vif)
941960
}
942961

943962
if (conn_info->conn_result) {
944-
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
963+
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
964+
hif_drv->hif_state == HOST_IF_EXTERNAL_AUTH) {
945965
PRINT_INFO(vif->ndev, HOSTINF_DBG,
946966
"supplicant requested disconnection\n");
947967
del_timer(&hif_drv->connect_timer);
@@ -1290,6 +1310,32 @@ void wilc_set_wowlan_trigger(struct wilc_vif *vif, bool enabled)
12901310
"Failed to send wowlan trigger config packet\n");
12911311
}
12921312

1313+
int wilc_set_external_auth_param(struct wilc_vif *vif,
1314+
struct cfg80211_external_auth_params *auth)
1315+
{
1316+
int ret;
1317+
struct wid wid;
1318+
struct wilc_external_auth_param *param;
1319+
1320+
wid.id = WID_EXTERNAL_AUTH_PARAM;
1321+
wid.type = WID_BIN_DATA;
1322+
wid.size = sizeof(*param);
1323+
param = kzalloc(sizeof(*param), GFP_KERNEL);
1324+
if (!param)
1325+
return -EINVAL;
1326+
wid.val = (u8 *)param;
1327+
param->action = auth->action;
1328+
ether_addr_copy(param->bssid, auth->bssid);
1329+
memcpy(param->ssid, auth->ssid.ssid, auth->ssid.ssid_len);
1330+
param->ssid_len = auth->ssid.ssid_len;
1331+
ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1332+
if (ret)
1333+
PRINT_ER(vif->ndev, "failed to set external auth param\n");
1334+
1335+
kfree(param);
1336+
return ret;
1337+
}
1338+
12931339
static void handle_scan_timer(struct work_struct *work)
12941340
{
12951341
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -1396,114 +1442,6 @@ signed int wilc_send_buffered_eap(struct wilc_vif *vif,
13961442
return result;
13971443
}
13981444

1399-
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
1400-
{
1401-
struct wid wid;
1402-
int result;
1403-
1404-
wid.id = WID_REMOVE_WEP_KEY;
1405-
wid.type = WID_STR;
1406-
wid.size = sizeof(char);
1407-
wid.val = &index;
1408-
1409-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1410-
if (result)
1411-
netdev_err(vif->ndev,
1412-
"Failed to send remove wep key config packet\n");
1413-
return result;
1414-
}
1415-
1416-
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
1417-
{
1418-
struct wid wid;
1419-
int result;
1420-
1421-
wid.id = WID_KEY_ID;
1422-
wid.type = WID_CHAR;
1423-
wid.size = sizeof(char);
1424-
wid.val = &index;
1425-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1426-
if (result)
1427-
netdev_err(vif->ndev,
1428-
"Failed to send wep default key config packet\n");
1429-
1430-
return result;
1431-
}
1432-
1433-
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
1434-
u8 index)
1435-
{
1436-
struct wid wid;
1437-
int result;
1438-
struct wilc_wep_key *wep_key;
1439-
1440-
PRINT_INFO(vif->ndev, HOSTINF_DBG, "Handling WEP key\n");
1441-
wid.id = WID_ADD_WEP_KEY;
1442-
wid.type = WID_STR;
1443-
wid.size = sizeof(*wep_key) + len;
1444-
wep_key = kzalloc(wid.size, GFP_KERNEL);
1445-
if (!wep_key) {
1446-
PRINT_ER(vif->ndev, "No buffer to send Key\n");
1447-
return -ENOMEM;
1448-
}
1449-
wid.val = (u8 *)wep_key;
1450-
1451-
wep_key->index = index;
1452-
wep_key->key_len = len;
1453-
memcpy(wep_key->key, key, len);
1454-
1455-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1456-
if (result)
1457-
netdev_err(vif->ndev,
1458-
"Failed to add wep key config packet\n");
1459-
1460-
kfree(wep_key);
1461-
return result;
1462-
}
1463-
1464-
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
1465-
u8 index, u8 mode, enum authtype auth_type)
1466-
{
1467-
struct wid wid_list[3];
1468-
int result;
1469-
struct wilc_wep_key *wep_key;
1470-
1471-
PRINT_INFO(vif->ndev, HOSTINF_DBG, "Handling WEP key index: %d\n",
1472-
index);
1473-
wid_list[0].id = WID_11I_MODE;
1474-
wid_list[0].type = WID_CHAR;
1475-
wid_list[0].size = sizeof(char);
1476-
wid_list[0].val = &mode;
1477-
1478-
wid_list[1].id = WID_AUTH_TYPE;
1479-
wid_list[1].type = WID_CHAR;
1480-
wid_list[1].size = sizeof(char);
1481-
wid_list[1].val = (s8 *)&auth_type;
1482-
1483-
wid_list[2].id = WID_WEP_KEY_VALUE;
1484-
wid_list[2].type = WID_STR;
1485-
wid_list[2].size = sizeof(*wep_key) + len;
1486-
wep_key = kzalloc(wid_list[2].size, GFP_KERNEL);
1487-
if (!wep_key) {
1488-
PRINT_ER(vif->ndev, "No buffer to send Key\n");
1489-
return -ENOMEM;
1490-
}
1491-
1492-
wid_list[2].val = (u8 *)wep_key;
1493-
1494-
wep_key->index = index;
1495-
wep_key->key_len = len;
1496-
memcpy(wep_key->key, key, len);
1497-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
1498-
ARRAY_SIZE(wid_list));
1499-
if (result)
1500-
netdev_err(vif->ndev,
1501-
"Failed to add wep ap key config packet\n");
1502-
1503-
kfree(wep_key);
1504-
return result;
1505-
}
1506-
15071445
int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
15081446
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
15091447
u8 mode, u8 cipher_mode, u8 index)
@@ -1580,6 +1518,37 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
15801518
return result;
15811519
}
15821520

1521+
int wilc_add_igtk(struct wilc_vif *vif, const u8 *igtk, u8 igtk_key_len,
1522+
const u8 *pn, u8 pn_len, const u8 *mac_addr, u8 mode, u8 index)
1523+
{
1524+
int result = 0;
1525+
u8 t_key_len = igtk_key_len;
1526+
struct wid wid;
1527+
struct wilc_wpa_igtk *key_buf;
1528+
1529+
key_buf = kzalloc(sizeof(*key_buf) + t_key_len, GFP_KERNEL);
1530+
if (!key_buf) {
1531+
PRINT_ER(vif->ndev, "No buffer to keep Key buffer - Station\n");
1532+
return -ENOMEM;
1533+
}
1534+
1535+
key_buf->index = index;
1536+
1537+
memcpy(&key_buf->pn[0], pn, pn_len);
1538+
key_buf->pn_len = pn_len;
1539+
1540+
memcpy(&key_buf->key[0], igtk, igtk_key_len);
1541+
key_buf->key_len = t_key_len;
1542+
1543+
wid.id = WID_ADD_IGTK;
1544+
wid.type = WID_STR;
1545+
wid.size = sizeof(*key_buf) + t_key_len;
1546+
wid.val = (s8 *)key_buf;
1547+
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1548+
kfree(key_buf);
1549+
return result;
1550+
}
1551+
15831552
int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
15841553
u8 index, u32 key_rsc_len, const u8 *key_rsc,
15851554
const u8 *rx_mic, const u8 *tx_mic, u8 mode,
@@ -1927,7 +1896,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
19271896
setup_timer(&hif_drv->connect_timer, timer_connect_cb, 0);
19281897
setup_timer(&hif_drv->remain_on_ch_timer, listen_timer_cb, 0);
19291898
setup_timer(&vif->periodic_rssi, get_periodic_rssi,
1930-
(unsigned long)vif);
1899+
(unsigned long)vif);
19311900
#endif
19321901
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
19331902

@@ -2164,6 +2133,11 @@ void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
21642133
reg_frame.reg_id = WILC_FW_PROBE_REQ_IDX;
21652134
break;
21662135

2136+
case IEEE80211_STYPE_AUTH:
2137+
PRINT_INFO(vif->ndev, HOSTINF_DBG, "AUTH\n");
2138+
reg_frame.reg_id = WILC_FW_AUTH_REQ_IDX;
2139+
break;
2140+
21672141
default:
21682142
PRINT_INFO(vif->ndev, HOSTINF_DBG, "Not valid frame type\n");
21692143
break;

drivers/net/wireless/microchip/wilc1000/hif.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ enum host_if_state {
4949
HOST_IF_WAITING_CONN_RESP = 3,
5050
HOST_IF_CONNECTED = 4,
5151
HOST_IF_P2P_LISTEN = 5,
52+
HOST_IF_EXTERNAL_AUTH = 6,
5253
HOST_IF_FORCE_32BIT = 0xFFFFFFFF
5354
};
5455

@@ -110,6 +111,7 @@ struct wilc_conn_info {
110111
u8 bssid[ETH_ALEN];
111112
u8 security;
112113
enum authtype auth_type;
114+
enum mfptype mfp_type;
113115
u8 ch;
114116
u8 *req_ies;
115117
size_t req_ies_len;
@@ -161,15 +163,13 @@ signed int wilc_send_buffered_eap(struct wilc_vif *vif,
161163
void (*eap_buf_param)(void *), u8 *buff,
162164
unsigned int size, unsigned int pkt_offset,
163165
void *user_arg);
164-
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
165-
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
166-
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
167-
u8 index);
168-
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
169-
u8 index, u8 mode, enum authtype auth_type);
170166
int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
171167
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
172168
u8 mode, u8 cipher_mode, u8 index);
169+
int wilc_add_igtk(struct wilc_vif *vif,
170+
const u8 *igtk, u8 igtk_key_len,
171+
const u8 *pn, u8 pn_len,
172+
const u8 *mac_addr, u8 mode, u8 index);
173173
s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
174174
u32 *out_val);
175175
int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
@@ -218,6 +218,8 @@ int wilc_get_vif_idx(struct wilc_vif *vif);
218218
int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
219219
int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
220220
void wilc_set_wowlan_trigger(struct wilc_vif *vif, bool enabled);
221+
int wilc_set_external_auth_param(struct wilc_vif *vif,
222+
struct cfg80211_external_auth_params *param);
221223
/* 0 select antenna 1 , 2 select antenna mode , 2 allow the firmware to choose
222224
* the best antenna
223225
*/

0 commit comments

Comments
 (0)