15
15
16
16
/* It is the caller's responsibility to free the pointer returned here */
17
17
static struct iwl_mcc_update_resp_v8 *
18
- iwl_mld_parse_mcc_update_resp_v8 (const struct iwl_rx_packet * pkt )
18
+ iwl_mld_copy_mcc_resp (const struct iwl_rx_packet * pkt )
19
19
{
20
20
const struct iwl_mcc_update_resp_v8 * mcc_resp_v8 = (const void * )pkt -> data ;
21
21
int n_channels = __le32_to_cpu (mcc_resp_v8 -> n_channels );
@@ -32,43 +32,11 @@ iwl_mld_parse_mcc_update_resp_v8(const struct iwl_rx_packet *pkt)
32
32
return resp_cp ;
33
33
}
34
34
35
- /* It is the caller's responsibility to free the pointer returned here */
36
- static struct iwl_mcc_update_resp_v8 *
37
- iwl_mld_parse_mcc_update_resp_v5_v6 (const struct iwl_rx_packet * pkt )
38
- {
39
- const struct iwl_mcc_update_resp_v4 * mcc_resp_v4 = (const void * )pkt -> data ;
40
- struct iwl_mcc_update_resp_v8 * resp_cp ;
41
- int n_channels = __le32_to_cpu (mcc_resp_v4 -> n_channels );
42
- int resp_len ;
43
-
44
- if (iwl_rx_packet_payload_len (pkt ) !=
45
- struct_size (mcc_resp_v4 , channels , n_channels ))
46
- return ERR_PTR (- EINVAL );
47
-
48
- resp_len = struct_size (resp_cp , channels , n_channels );
49
- resp_cp = kzalloc (resp_len , GFP_KERNEL );
50
- if (!resp_cp )
51
- return ERR_PTR (- ENOMEM );
52
-
53
- resp_cp -> status = mcc_resp_v4 -> status ;
54
- resp_cp -> mcc = mcc_resp_v4 -> mcc ;
55
- resp_cp -> cap = cpu_to_le32 (le16_to_cpu (mcc_resp_v4 -> cap ));
56
- resp_cp -> source_id = mcc_resp_v4 -> source_id ;
57
- resp_cp -> geo_info = mcc_resp_v4 -> geo_info ;
58
- resp_cp -> n_channels = mcc_resp_v4 -> n_channels ;
59
- memcpy (resp_cp -> channels , mcc_resp_v4 -> channels ,
60
- n_channels * sizeof (__le32 ));
61
-
62
- return resp_cp ;
63
- }
64
-
65
35
/* It is the caller's responsibility to free the pointer returned here */
66
36
static struct iwl_mcc_update_resp_v8 *
67
37
iwl_mld_update_mcc (struct iwl_mld * mld , const char * alpha2 ,
68
38
enum iwl_mcc_source src_id )
69
39
{
70
- int resp_ver = iwl_fw_lookup_notif_ver (mld -> fw , LONG_GROUP ,
71
- MCC_UPDATE_CMD , 0 );
72
40
struct iwl_mcc_update_cmd mcc_update_cmd = {
73
41
.mcc = cpu_to_le16 (alpha2 [0 ] << 8 | alpha2 [1 ]),
74
42
.source_id = (u8 )src_id ,
@@ -93,23 +61,7 @@ iwl_mld_update_mcc(struct iwl_mld *mld, const char *alpha2,
93
61
94
62
pkt = cmd .resp_pkt ;
95
63
96
- /* For Wifi-7 radios, we get version 8
97
- * For Wifi-6E radios, we get version 6
98
- * For Wifi-6 radios, we get version 5, but 5, 6, and 4 are compatible.
99
- */
100
- switch (resp_ver ) {
101
- case 5 :
102
- case 6 :
103
- resp_cp = iwl_mld_parse_mcc_update_resp_v5_v6 (pkt );
104
- break ;
105
- case 8 :
106
- resp_cp = iwl_mld_parse_mcc_update_resp_v8 (pkt );
107
- break ;
108
- default :
109
- IWL_FW_CHECK_FAILED (mld , "Unknown MCC_UPDATE_CMD version %d\n" , resp_ver );
110
- resp_cp = ERR_PTR (- EINVAL );
111
- }
112
-
64
+ resp_cp = iwl_mld_copy_mcc_resp (pkt );
113
65
if (IS_ERR (resp_cp ))
114
66
goto exit ;
115
67
0 commit comments