xref: /linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1 // SPDX-License-Identifier: ISC
2 /*
3  * Copyright (c) 2022 Broadcom Corporation
4  */
5 #include <linux/errno.h>
6 #include <linux/types.h>
7 #include <core.h>
8 #include <bus.h>
9 #include <fwvid.h>
10 #include <cfg80211.h>
11 
12 #include "vops.h"
13 
14 #define BRCMF_WCC_E_LAST		213
15 
brcmf_wcc_set_sae_pwd(struct brcmf_if * ifp,struct cfg80211_crypto_settings * crypto)16 static int brcmf_wcc_set_sae_pwd(struct brcmf_if *ifp,
17 				 struct cfg80211_crypto_settings *crypto)
18 {
19 	return brcmf_set_wsec(ifp, crypto->sae_pwd, crypto->sae_pwd_len,
20 			      BRCMF_WSEC_PASSPHRASE);
21 }
22 
brcmf_wcc_alloc_fweh_info(struct brcmf_pub * drvr)23 static int brcmf_wcc_alloc_fweh_info(struct brcmf_pub *drvr)
24 {
25 	struct brcmf_fweh_info *fweh;
26 
27 	fweh = kzalloc(struct_size(fweh, evt_handler, BRCMF_WCC_E_LAST),
28 		       GFP_KERNEL);
29 	if (!fweh)
30 		return -ENOMEM;
31 
32 	fweh->num_event_codes = BRCMF_WCC_E_LAST;
33 	drvr->fweh = fweh;
34 	return 0;
35 }
36 
37 const struct brcmf_fwvid_ops brcmf_wcc_ops = {
38 	.set_sae_password = brcmf_wcc_set_sae_pwd,
39 	.alloc_fweh_info = brcmf_wcc_alloc_fweh_info,
40 };
41