1 /******************************************************************************
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * The full GNU General Public License is included in this distribution
25 * in the file called COPYING.
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
33 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 *****************************************************************************/
64 #include <linux/etherdevice.h>
67 #include <net/cfg80211.h>
70 #include <net/addrconf.h>
71 #include "iwl-modparams.h"
75 void iwl_mvm_set_rekey_data(struct ieee80211_hw
*hw
,
76 struct ieee80211_vif
*vif
,
77 struct cfg80211_gtk_rekey_data
*data
)
79 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
80 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
82 if (iwlwifi_mod_params
.sw_crypto
)
85 mutex_lock(&mvm
->mutex
);
87 memcpy(mvmvif
->rekey_data
.kek
, data
->kek
, NL80211_KEK_LEN
);
88 memcpy(mvmvif
->rekey_data
.kck
, data
->kck
, NL80211_KCK_LEN
);
89 mvmvif
->rekey_data
.replay_ctr
=
90 cpu_to_le64(be64_to_cpup((__be64
*)&data
->replay_ctr
));
91 mvmvif
->rekey_data
.valid
= true;
93 mutex_unlock(&mvm
->mutex
);
96 #if IS_ENABLED(CONFIG_IPV6)
97 void iwl_mvm_ipv6_addr_change(struct ieee80211_hw
*hw
,
98 struct ieee80211_vif
*vif
,
99 struct inet6_dev
*idev
)
101 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
102 struct inet6_ifaddr
*ifa
;
105 read_lock_bh(&idev
->lock
);
106 list_for_each_entry(ifa
, &idev
->addr_list
, if_list
) {
107 mvmvif
->target_ipv6_addrs
[idx
] = ifa
->addr
;
109 if (idx
>= IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX
)
112 read_unlock_bh(&idev
->lock
);
114 mvmvif
->num_target_ipv6_addrs
= idx
;
118 void iwl_mvm_set_default_unicast_key(struct ieee80211_hw
*hw
,
119 struct ieee80211_vif
*vif
, int idx
)
121 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
123 mvmvif
->tx_key_idx
= idx
;
126 static void iwl_mvm_convert_p1k(u16
*p1k
, __le16
*out
)
130 for (i
= 0; i
< IWL_P1K_SIZE
; i
++)
131 out
[i
] = cpu_to_le16(p1k
[i
]);
134 struct wowlan_key_data
{
135 struct iwl_wowlan_rsc_tsc_params_cmd
*rsc_tsc
;
136 struct iwl_wowlan_tkip_params_cmd
*tkip
;
137 bool error
, use_rsc_tsc
, use_tkip
;
141 static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw
*hw
,
142 struct ieee80211_vif
*vif
,
143 struct ieee80211_sta
*sta
,
144 struct ieee80211_key_conf
*key
,
147 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
148 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
149 struct wowlan_key_data
*data
= _data
;
150 struct aes_sc
*aes_sc
, *aes_tx_sc
= NULL
;
151 struct tkip_sc
*tkip_sc
, *tkip_tx_sc
= NULL
;
152 struct iwl_p1k_cache
*rx_p1ks
;
154 struct ieee80211_key_seq seq
;
156 u16 p1k
[IWL_P1K_SIZE
];
159 mutex_lock(&mvm
->mutex
);
161 switch (key
->cipher
) {
162 case WLAN_CIPHER_SUITE_WEP40
:
163 case WLAN_CIPHER_SUITE_WEP104
: { /* hack it for now */
165 struct iwl_mvm_wep_key_cmd wep_key_cmd
;
166 struct iwl_mvm_wep_key wep_key
;
168 .wep_key_cmd
.mac_id_n_color
=
169 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif
->id
,
171 .wep_key_cmd
.num_keys
= 1,
172 /* firmware sets STA_KEY_FLG_WEP_13BYTES */
173 .wep_key_cmd
.decryption_type
= STA_KEY_FLG_WEP
,
174 .wep_key
.key_index
= key
->keyidx
,
175 .wep_key
.key_size
= key
->keylen
,
179 * This will fail -- the key functions don't set support
180 * pairwise WEP keys. However, that's better than silently
181 * failing WoWLAN. Or maybe not?
183 if (key
->flags
& IEEE80211_KEY_FLAG_PAIRWISE
)
186 memcpy(&wkc
.wep_key
.key
[3], key
->key
, key
->keylen
);
187 if (key
->keyidx
== mvmvif
->tx_key_idx
) {
188 /* TX key must be at offset 0 */
189 wkc
.wep_key
.key_offset
= 0;
191 /* others start at 1 */
193 wkc
.wep_key
.key_offset
= data
->wep_key_idx
;
196 ret
= iwl_mvm_send_cmd_pdu(mvm
, WEP_KEY
, CMD_SYNC
,
198 data
->error
= ret
!= 0;
200 mvm
->ptk_ivlen
= key
->iv_len
;
201 mvm
->ptk_icvlen
= key
->icv_len
;
202 mvm
->gtk_ivlen
= key
->iv_len
;
203 mvm
->gtk_icvlen
= key
->icv_len
;
205 /* don't upload key again */
211 case WLAN_CIPHER_SUITE_AES_CMAC
:
213 * Ignore CMAC keys -- the WoWLAN firmware doesn't support them
214 * but we also shouldn't abort suspend due to that. It does have
215 * support for the IGTK key renewal, but doesn't really use the
216 * IGTK for anything. This means we could spuriously wake up or
217 * be deauthenticated, but that was considered acceptable.
220 case WLAN_CIPHER_SUITE_TKIP
:
222 tkip_sc
= data
->rsc_tsc
->all_tsc_rsc
.tkip
.unicast_rsc
;
223 tkip_tx_sc
= &data
->rsc_tsc
->all_tsc_rsc
.tkip
.tsc
;
225 rx_p1ks
= data
->tkip
->rx_uni
;
227 ieee80211_get_key_tx_seq(key
, &seq
);
228 tkip_tx_sc
->iv16
= cpu_to_le16(seq
.tkip
.iv16
);
229 tkip_tx_sc
->iv32
= cpu_to_le32(seq
.tkip
.iv32
);
231 ieee80211_get_tkip_p1k_iv(key
, seq
.tkip
.iv32
, p1k
);
232 iwl_mvm_convert_p1k(p1k
, data
->tkip
->tx
.p1k
);
234 memcpy(data
->tkip
->mic_keys
.tx
,
235 &key
->key
[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY
],
238 rx_mic_key
= data
->tkip
->mic_keys
.rx_unicast
;
241 data
->rsc_tsc
->all_tsc_rsc
.tkip
.multicast_rsc
;
242 rx_p1ks
= data
->tkip
->rx_multi
;
243 rx_mic_key
= data
->tkip
->mic_keys
.rx_mcast
;
247 * For non-QoS this relies on the fact that both the uCode and
248 * mac80211 use TID 0 (as they need to to avoid replay attacks)
249 * for checking the IV in the frames.
251 for (i
= 0; i
< IWL_NUM_RSC
; i
++) {
252 ieee80211_get_key_rx_seq(key
, i
, &seq
);
253 tkip_sc
[i
].iv16
= cpu_to_le16(seq
.tkip
.iv16
);
254 tkip_sc
[i
].iv32
= cpu_to_le32(seq
.tkip
.iv32
);
255 /* wrapping isn't allowed, AP must rekey */
256 if (seq
.tkip
.iv32
> cur_rx_iv32
)
257 cur_rx_iv32
= seq
.tkip
.iv32
;
260 ieee80211_get_tkip_rx_p1k(key
, vif
->bss_conf
.bssid
,
262 iwl_mvm_convert_p1k(p1k
, rx_p1ks
[0].p1k
);
263 ieee80211_get_tkip_rx_p1k(key
, vif
->bss_conf
.bssid
,
264 cur_rx_iv32
+ 1, p1k
);
265 iwl_mvm_convert_p1k(p1k
, rx_p1ks
[1].p1k
);
268 &key
->key
[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY
],
271 data
->use_tkip
= true;
272 data
->use_rsc_tsc
= true;
274 case WLAN_CIPHER_SUITE_CCMP
:
276 u8
*pn
= seq
.ccmp
.pn
;
278 aes_sc
= data
->rsc_tsc
->all_tsc_rsc
.aes
.unicast_rsc
;
279 aes_tx_sc
= &data
->rsc_tsc
->all_tsc_rsc
.aes
.tsc
;
281 ieee80211_get_key_tx_seq(key
, &seq
);
282 aes_tx_sc
->pn
= cpu_to_le64((u64
)pn
[5] |
289 aes_sc
= data
->rsc_tsc
->all_tsc_rsc
.aes
.multicast_rsc
;
293 * For non-QoS this relies on the fact that both the uCode and
294 * mac80211 use TID 0 for checking the IV in the frames.
296 for (i
= 0; i
< IWL_NUM_RSC
; i
++) {
297 u8
*pn
= seq
.ccmp
.pn
;
299 ieee80211_get_key_rx_seq(key
, i
, &seq
);
300 aes_sc
->pn
= cpu_to_le64((u64
)pn
[5] |
307 data
->use_rsc_tsc
= true;
312 * The D3 firmware hardcodes the key offset 0 as the key it uses
313 * to transmit packets to the AP, i.e. the PTK.
315 if (key
->flags
& IEEE80211_KEY_FLAG_PAIRWISE
) {
317 mvm
->ptk_ivlen
= key
->iv_len
;
318 mvm
->ptk_icvlen
= key
->icv_len
;
321 * firmware only supports TSC/RSC for a single key,
322 * so if there are multiple keep overwriting them
323 * with new ones -- this relies on mac80211 doing
327 mvm
->gtk_ivlen
= key
->iv_len
;
328 mvm
->gtk_icvlen
= key
->icv_len
;
331 ret
= iwl_mvm_set_sta_key(mvm
, vif
, sta
, key
, true);
332 data
->error
= ret
!= 0;
334 mutex_unlock(&mvm
->mutex
);
337 static int iwl_mvm_send_patterns(struct iwl_mvm
*mvm
,
338 struct cfg80211_wowlan
*wowlan
)
340 struct iwl_wowlan_patterns_cmd
*pattern_cmd
;
341 struct iwl_host_cmd cmd
= {
342 .id
= WOWLAN_PATTERNS
,
343 .dataflags
[0] = IWL_HCMD_DFL_NOCOPY
,
348 if (!wowlan
->n_patterns
)
351 cmd
.len
[0] = sizeof(*pattern_cmd
) +
352 wowlan
->n_patterns
* sizeof(struct iwl_wowlan_pattern
);
354 pattern_cmd
= kmalloc(cmd
.len
[0], GFP_KERNEL
);
358 pattern_cmd
->n_patterns
= cpu_to_le32(wowlan
->n_patterns
);
360 for (i
= 0; i
< wowlan
->n_patterns
; i
++) {
361 int mask_len
= DIV_ROUND_UP(wowlan
->patterns
[i
].pattern_len
, 8);
363 memcpy(&pattern_cmd
->patterns
[i
].mask
,
364 wowlan
->patterns
[i
].mask
, mask_len
);
365 memcpy(&pattern_cmd
->patterns
[i
].pattern
,
366 wowlan
->patterns
[i
].pattern
,
367 wowlan
->patterns
[i
].pattern_len
);
368 pattern_cmd
->patterns
[i
].mask_size
= mask_len
;
369 pattern_cmd
->patterns
[i
].pattern_size
=
370 wowlan
->patterns
[i
].pattern_len
;
373 cmd
.data
[0] = pattern_cmd
;
374 err
= iwl_mvm_send_cmd(mvm
, &cmd
);
379 static int iwl_mvm_send_proto_offload(struct iwl_mvm
*mvm
,
380 struct ieee80211_vif
*vif
)
383 struct iwl_proto_offload_cmd_v1 v1
;
384 struct iwl_proto_offload_cmd_v2 v2
;
385 struct iwl_proto_offload_cmd_v3_small v3s
;
386 struct iwl_proto_offload_cmd_v3_large v3l
;
388 struct iwl_host_cmd hcmd
= {
389 .id
= PROT_OFFLOAD_CONFIG_CMD
,
392 .dataflags
[0] = IWL_HCMD_DFL_DUP
,
394 struct iwl_proto_offload_cmd_common
*common
;
395 u32 enabled
= 0, size
;
396 u32 capa_flags
= mvm
->fw
->ucode_capa
.flags
;
397 #if IS_ENABLED(CONFIG_IPV6)
398 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
401 if (capa_flags
& IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL
||
402 capa_flags
& IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE
) {
403 struct iwl_ns_config
*nsc
;
404 struct iwl_targ_addr
*addrs
;
408 if (capa_flags
& IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL
) {
409 nsc
= cmd
.v3s
.ns_config
;
410 n_nsc
= IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S
;
411 addrs
= cmd
.v3s
.targ_addrs
;
412 n_addrs
= IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S
;
414 nsc
= cmd
.v3l
.ns_config
;
415 n_nsc
= IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L
;
416 addrs
= cmd
.v3l
.targ_addrs
;
417 n_addrs
= IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L
;
420 if (mvmvif
->num_target_ipv6_addrs
)
421 enabled
|= IWL_D3_PROTO_OFFLOAD_NS
;
424 * For each address we have (and that will fit) fill a target
425 * address struct and combine for NS offload structs with the
426 * solicited node addresses.
429 i
< mvmvif
->num_target_ipv6_addrs
&&
430 i
< n_addrs
&& c
< n_nsc
; i
++) {
431 struct in6_addr solicited_addr
;
434 addrconf_addr_solict_mult(&mvmvif
->target_ipv6_addrs
[i
],
436 for (j
= 0; j
< c
; j
++)
437 if (ipv6_addr_cmp(&nsc
[j
].dest_ipv6_addr
,
438 &solicited_addr
) == 0)
442 addrs
[i
].addr
= mvmvif
->target_ipv6_addrs
[i
];
443 addrs
[i
].config_num
= cpu_to_le32(j
);
444 nsc
[j
].dest_ipv6_addr
= solicited_addr
;
445 memcpy(nsc
[j
].target_mac_addr
, vif
->addr
, ETH_ALEN
);
448 if (capa_flags
& IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL
)
449 cmd
.v3s
.num_valid_ipv6_addrs
= cpu_to_le32(i
);
451 cmd
.v3l
.num_valid_ipv6_addrs
= cpu_to_le32(i
);
452 } else if (capa_flags
& IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS
) {
453 if (mvmvif
->num_target_ipv6_addrs
) {
454 enabled
|= IWL_D3_PROTO_OFFLOAD_NS
;
455 memcpy(cmd
.v2
.ndp_mac_addr
, vif
->addr
, ETH_ALEN
);
458 BUILD_BUG_ON(sizeof(cmd
.v2
.target_ipv6_addr
[0]) !=
459 sizeof(mvmvif
->target_ipv6_addrs
[0]));
461 for (i
= 0; i
< min(mvmvif
->num_target_ipv6_addrs
,
462 IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2
); i
++)
463 memcpy(cmd
.v2
.target_ipv6_addr
[i
],
464 &mvmvif
->target_ipv6_addrs
[i
],
465 sizeof(cmd
.v2
.target_ipv6_addr
[i
]));
467 if (mvmvif
->num_target_ipv6_addrs
) {
468 enabled
|= IWL_D3_PROTO_OFFLOAD_NS
;
469 memcpy(cmd
.v1
.ndp_mac_addr
, vif
->addr
, ETH_ALEN
);
472 BUILD_BUG_ON(sizeof(cmd
.v1
.target_ipv6_addr
[0]) !=
473 sizeof(mvmvif
->target_ipv6_addrs
[0]));
475 for (i
= 0; i
< min(mvmvif
->num_target_ipv6_addrs
,
476 IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1
); i
++)
477 memcpy(cmd
.v1
.target_ipv6_addr
[i
],
478 &mvmvif
->target_ipv6_addrs
[i
],
479 sizeof(cmd
.v1
.target_ipv6_addr
[i
]));
483 if (capa_flags
& IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL
) {
484 common
= &cmd
.v3s
.common
;
485 size
= sizeof(cmd
.v3s
);
486 } else if (capa_flags
& IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE
) {
487 common
= &cmd
.v3l
.common
;
488 size
= sizeof(cmd
.v3l
);
489 } else if (capa_flags
& IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS
) {
490 common
= &cmd
.v2
.common
;
491 size
= sizeof(cmd
.v2
);
493 common
= &cmd
.v1
.common
;
494 size
= sizeof(cmd
.v1
);
497 if (vif
->bss_conf
.arp_addr_cnt
) {
498 enabled
|= IWL_D3_PROTO_OFFLOAD_ARP
;
499 common
->host_ipv4_addr
= vif
->bss_conf
.arp_addr_list
[0];
500 memcpy(common
->arp_mac_addr
, vif
->addr
, ETH_ALEN
);
506 common
->enabled
= cpu_to_le32(enabled
);
509 return iwl_mvm_send_cmd(mvm
, &hcmd
);
512 enum iwl_mvm_tcp_packet_type
{
521 static __le16
pseudo_hdr_check(int len
, __be32 saddr
, __be32 daddr
)
523 __sum16 check
= tcp_v4_check(len
, saddr
, daddr
, 0);
524 return cpu_to_le16(be16_to_cpu((__force __be16
)check
));
527 static void iwl_mvm_build_tcp_packet(struct ieee80211_vif
*vif
,
528 struct cfg80211_wowlan_tcp
*tcp
,
529 void *_pkt
, u8
*mask
,
530 __le16
*pseudo_hdr_csum
,
531 enum iwl_mvm_tcp_packet_type ptype
)
538 } __packed
*pkt
= _pkt
;
539 u16 ip_tot_len
= sizeof(struct iphdr
) + sizeof(struct tcphdr
);
542 pkt
->eth
.h_proto
= cpu_to_be16(ETH_P_IP
),
545 pkt
->ip
.protocol
= IPPROTO_TCP
;
549 case MVM_TCP_TX_DATA
:
551 memcpy(pkt
->eth
.h_dest
, tcp
->dst_mac
, ETH_ALEN
);
552 memcpy(pkt
->eth
.h_source
, vif
->addr
, ETH_ALEN
);
554 pkt
->ip
.saddr
= tcp
->src
;
555 pkt
->ip
.daddr
= tcp
->dst
;
556 pkt
->tcp
.source
= cpu_to_be16(tcp
->src_port
);
557 pkt
->tcp
.dest
= cpu_to_be16(tcp
->dst_port
);
558 /* overwritten for TX SYN later */
559 pkt
->tcp
.doff
= sizeof(struct tcphdr
) / 4;
560 pkt
->tcp
.window
= cpu_to_be16(65000);
562 case MVM_TCP_RX_SYNACK
:
564 case MVM_TCP_RX_WAKE
:
565 memcpy(pkt
->eth
.h_dest
, vif
->addr
, ETH_ALEN
);
566 memcpy(pkt
->eth
.h_source
, tcp
->dst_mac
, ETH_ALEN
);
567 pkt
->ip
.saddr
= tcp
->dst
;
568 pkt
->ip
.daddr
= tcp
->src
;
569 pkt
->tcp
.source
= cpu_to_be16(tcp
->dst_port
);
570 pkt
->tcp
.dest
= cpu_to_be16(tcp
->src_port
);
579 /* firmware assumes 8 option bytes - 8 NOPs for now */
580 memset(pkt
->data
, 0x01, 8);
582 pkt
->tcp
.doff
= (sizeof(struct tcphdr
) + 8) / 4;
585 case MVM_TCP_TX_DATA
:
586 ip_tot_len
+= tcp
->payload_len
;
587 memcpy(pkt
->data
, tcp
->payload
, tcp
->payload_len
);
595 case MVM_TCP_RX_SYNACK
:
602 case MVM_TCP_RX_WAKE
:
603 ip_tot_len
+= tcp
->wake_len
;
606 memcpy(pkt
->data
, tcp
->wake_data
, tcp
->wake_len
);
612 case MVM_TCP_TX_DATA
:
614 pkt
->ip
.tot_len
= cpu_to_be16(ip_tot_len
);
615 pkt
->ip
.check
= ip_fast_csum(&pkt
->ip
, pkt
->ip
.ihl
);
617 case MVM_TCP_RX_WAKE
:
618 for (i
= 0; i
< DIV_ROUND_UP(tcp
->wake_len
, 8); i
++) {
619 u8 tmp
= tcp
->wake_mask
[i
];
620 mask
[i
+ 6] |= tmp
<< 6;
621 if (i
+ 1 < DIV_ROUND_UP(tcp
->wake_len
, 8))
622 mask
[i
+ 7] = tmp
>> 2;
624 /* fall through for ethernet/IP/TCP headers mask */
625 case MVM_TCP_RX_SYNACK
:
627 mask
[0] = 0xff; /* match ethernet */
629 * match ethernet, ip.version, ip.ihl
630 * the ip.ihl half byte is really masked out by firmware
633 mask
[2] = 0x80; /* match ip.protocol */
634 mask
[3] = 0xfc; /* match ip.saddr, ip.daddr */
635 mask
[4] = 0x3f; /* match ip.daddr, tcp.source, tcp.dest */
636 mask
[5] = 0x80; /* match tcp flags */
637 /* leave rest (0 or set for MVM_TCP_RX_WAKE) */
641 *pseudo_hdr_csum
= pseudo_hdr_check(ip_tot_len
- sizeof(struct iphdr
),
642 pkt
->ip
.saddr
, pkt
->ip
.daddr
);
645 static int iwl_mvm_send_remote_wake_cfg(struct iwl_mvm
*mvm
,
646 struct ieee80211_vif
*vif
,
647 struct cfg80211_wowlan_tcp
*tcp
)
649 struct iwl_wowlan_remote_wake_config
*cfg
;
650 struct iwl_host_cmd cmd
= {
651 .id
= REMOTE_WAKE_CONFIG_CMD
,
652 .len
= { sizeof(*cfg
), },
653 .dataflags
= { IWL_HCMD_DFL_NOCOPY
, },
661 cfg
= kzalloc(sizeof(*cfg
), GFP_KERNEL
);
666 cfg
->max_syn_retries
= 10;
667 cfg
->max_data_retries
= 10;
668 cfg
->tcp_syn_ack_timeout
= 1; /* seconds */
669 cfg
->tcp_ack_timeout
= 1; /* seconds */
672 iwl_mvm_build_tcp_packet(
673 vif
, tcp
, cfg
->syn_tx
.data
, NULL
,
674 &cfg
->syn_tx
.info
.tcp_pseudo_header_checksum
,
676 cfg
->syn_tx
.info
.tcp_payload_length
= 0;
679 iwl_mvm_build_tcp_packet(
680 vif
, tcp
, cfg
->synack_rx
.data
, cfg
->synack_rx
.rx_mask
,
681 &cfg
->synack_rx
.info
.tcp_pseudo_header_checksum
,
683 cfg
->synack_rx
.info
.tcp_payload_length
= 0;
685 /* KEEPALIVE/ACK (TX) */
686 iwl_mvm_build_tcp_packet(
687 vif
, tcp
, cfg
->keepalive_tx
.data
, NULL
,
688 &cfg
->keepalive_tx
.info
.tcp_pseudo_header_checksum
,
690 cfg
->keepalive_tx
.info
.tcp_payload_length
=
691 cpu_to_le16(tcp
->payload_len
);
692 cfg
->sequence_number_offset
= tcp
->payload_seq
.offset
;
693 /* length must be 0..4, the field is little endian */
694 cfg
->sequence_number_length
= tcp
->payload_seq
.len
;
695 cfg
->initial_sequence_number
= cpu_to_le32(tcp
->payload_seq
.start
);
696 cfg
->keepalive_interval
= cpu_to_le16(tcp
->data_interval
);
697 if (tcp
->payload_tok
.len
) {
698 cfg
->token_offset
= tcp
->payload_tok
.offset
;
699 cfg
->token_length
= tcp
->payload_tok
.len
;
701 cpu_to_le16(tcp
->tokens_size
% tcp
->payload_tok
.len
);
702 memcpy(cfg
->tokens
, tcp
->payload_tok
.token_stream
,
705 /* set tokens to max value to almost never run out */
706 cfg
->num_tokens
= cpu_to_le16(65535);
710 iwl_mvm_build_tcp_packet(
711 vif
, tcp
, cfg
->keepalive_ack_rx
.data
,
712 cfg
->keepalive_ack_rx
.rx_mask
,
713 &cfg
->keepalive_ack_rx
.info
.tcp_pseudo_header_checksum
,
715 cfg
->keepalive_ack_rx
.info
.tcp_payload_length
= 0;
718 iwl_mvm_build_tcp_packet(
719 vif
, tcp
, cfg
->wake_rx
.data
, cfg
->wake_rx
.rx_mask
,
720 &cfg
->wake_rx
.info
.tcp_pseudo_header_checksum
,
722 cfg
->wake_rx
.info
.tcp_payload_length
=
723 cpu_to_le16(tcp
->wake_len
);
726 iwl_mvm_build_tcp_packet(
727 vif
, tcp
, cfg
->fin_tx
.data
, NULL
,
728 &cfg
->fin_tx
.info
.tcp_pseudo_header_checksum
,
730 cfg
->fin_tx
.info
.tcp_payload_length
= 0;
732 ret
= iwl_mvm_send_cmd(mvm
, &cmd
);
738 struct iwl_d3_iter_data
{
740 struct ieee80211_vif
*vif
;
744 static void iwl_mvm_d3_iface_iterator(void *_data
, u8
*mac
,
745 struct ieee80211_vif
*vif
)
747 struct iwl_d3_iter_data
*data
= _data
;
748 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
750 if (vif
->type
!= NL80211_IFTYPE_STATION
|| vif
->p2p
)
753 if (mvmvif
->ap_sta_id
== IWL_MVM_STATION_COUNT
)
757 IWL_ERR(data
->mvm
, "More than one managed interface active!\n");
765 static int iwl_mvm_d3_reprogram(struct iwl_mvm
*mvm
, struct ieee80211_vif
*vif
,
766 struct ieee80211_sta
*ap_sta
)
768 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
769 struct ieee80211_chanctx_conf
*ctx
;
770 u8 chains_static
, chains_dynamic
;
771 struct cfg80211_chan_def chandef
;
773 struct iwl_binding_cmd binding_cmd
= {};
774 struct iwl_time_quota_cmd quota_cmd
= {};
777 /* add back the PHY */
778 if (WARN_ON(!mvmvif
->phy_ctxt
))
782 ctx
= rcu_dereference(vif
->chanctx_conf
);
788 chains_static
= ctx
->rx_chains_static
;
789 chains_dynamic
= ctx
->rx_chains_dynamic
;
792 ret
= iwl_mvm_phy_ctxt_add(mvm
, mvmvif
->phy_ctxt
, &chandef
,
793 chains_static
, chains_dynamic
);
797 /* add back the MAC */
798 mvmvif
->uploaded
= false;
800 if (WARN_ON(!vif
->bss_conf
.assoc
))
803 vif
->bss_conf
.assoc
= false;
804 ret
= iwl_mvm_mac_ctxt_add(mvm
, vif
);
805 vif
->bss_conf
.assoc
= true;
809 /* add back binding - XXX refactor? */
810 binding_cmd
.id_and_color
=
811 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif
->phy_ctxt
->id
,
812 mvmvif
->phy_ctxt
->color
));
813 binding_cmd
.action
= cpu_to_le32(FW_CTXT_ACTION_ADD
);
815 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif
->phy_ctxt
->id
,
816 mvmvif
->phy_ctxt
->color
));
817 binding_cmd
.macs
[0] = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif
->id
,
819 for (i
= 1; i
< MAX_MACS_IN_BINDING
; i
++)
820 binding_cmd
.macs
[i
] = cpu_to_le32(FW_CTXT_INVALID
);
823 ret
= iwl_mvm_send_cmd_pdu_status(mvm
, BINDING_CONTEXT_CMD
,
824 sizeof(binding_cmd
), &binding_cmd
,
827 IWL_ERR(mvm
, "Failed to add binding: %d\n", ret
);
832 IWL_ERR(mvm
, "Binding command failed: %u\n", status
);
836 ret
= iwl_mvm_sta_send_to_fw(mvm
, ap_sta
, false);
839 rcu_assign_pointer(mvm
->fw_id_to_mac_id
[mvmvif
->ap_sta_id
], ap_sta
);
841 ret
= iwl_mvm_mac_ctxt_changed(mvm
, vif
);
846 quota_cmd
.quotas
[0].id_and_color
=
847 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif
->phy_ctxt
->id
,
848 mvmvif
->phy_ctxt
->color
));
849 quota_cmd
.quotas
[0].quota
= cpu_to_le32(100);
850 quota_cmd
.quotas
[0].max_duration
= cpu_to_le32(1000);
852 for (i
= 1; i
< MAX_BINDINGS
; i
++)
853 quota_cmd
.quotas
[i
].id_and_color
= cpu_to_le32(FW_CTXT_INVALID
);
855 ret
= iwl_mvm_send_cmd_pdu(mvm
, TIME_QUOTA_CMD
, CMD_SYNC
,
856 sizeof(quota_cmd
), "a_cmd
);
858 IWL_ERR(mvm
, "Failed to send quota: %d\n", ret
);
863 static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm
*mvm
,
864 struct ieee80211_vif
*vif
)
866 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
867 struct iwl_nonqos_seq_query_cmd query_cmd
= {
868 .get_set_flag
= cpu_to_le32(IWL_NONQOS_SEQ_GET
),
870 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif
->id
,
873 struct iwl_host_cmd cmd
= {
874 .id
= NON_QOS_TX_COUNTER_CMD
,
875 .flags
= CMD_SYNC
| CMD_WANT_SKB
,
880 if (mvm
->fw
->ucode_capa
.flags
& IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API
) {
881 cmd
.data
[0] = &query_cmd
;
882 cmd
.len
[0] = sizeof(query_cmd
);
885 err
= iwl_mvm_send_cmd(mvm
, &cmd
);
889 size
= iwl_rx_packet_payload_len(cmd
.resp_pkt
);
890 if (size
< sizeof(__le16
)) {
893 err
= le16_to_cpup((__le16
*)cmd
.resp_pkt
->data
);
894 /* new API returns next, not last-used seqno */
895 if (mvm
->fw
->ucode_capa
.flags
&
896 IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API
)
897 err
= (u16
) (err
- 0x10);
904 void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm
*mvm
, struct ieee80211_vif
*vif
)
906 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
907 struct iwl_nonqos_seq_query_cmd query_cmd
= {
908 .get_set_flag
= cpu_to_le32(IWL_NONQOS_SEQ_SET
),
910 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif
->id
,
912 .value
= cpu_to_le16(mvmvif
->seqno
),
915 /* return if called during restart, not resume from D3 */
916 if (!mvmvif
->seqno_valid
)
919 mvmvif
->seqno_valid
= false;
921 if (!(mvm
->fw
->ucode_capa
.flags
&
922 IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API
))
925 if (iwl_mvm_send_cmd_pdu(mvm
, NON_QOS_TX_COUNTER_CMD
, CMD_SYNC
,
926 sizeof(query_cmd
), &query_cmd
))
927 IWL_ERR(mvm
, "failed to set non-QoS seqno\n");
930 static int __iwl_mvm_suspend(struct ieee80211_hw
*hw
,
931 struct cfg80211_wowlan
*wowlan
,
934 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
935 struct iwl_d3_iter_data suspend_iter_data
= {
938 struct ieee80211_vif
*vif
;
939 struct iwl_mvm_vif
*mvmvif
;
940 struct ieee80211_sta
*ap_sta
;
941 struct iwl_mvm_sta
*mvm_ap_sta
;
942 struct iwl_wowlan_config_cmd wowlan_config_cmd
= {};
943 struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd
= {};
944 struct iwl_wowlan_tkip_params_cmd tkip_cmd
= {};
945 struct iwl_d3_manager_config d3_cfg_cmd_data
= {
947 * Program the minimum sleep time to 10 seconds, as many
948 * platforms have issues processing a wakeup signal while
949 * still being in the process of suspending.
951 .min_sleep_time
= cpu_to_le32(10 * 1000 * 1000),
953 struct iwl_host_cmd d3_cfg_cmd
= {
955 .flags
= CMD_SYNC
| CMD_WANT_SKB
,
956 .data
[0] = &d3_cfg_cmd_data
,
957 .len
[0] = sizeof(d3_cfg_cmd_data
),
959 struct wowlan_key_data key_data
= {
960 .use_rsc_tsc
= false,
965 int len __maybe_unused
;
966 u8 old_aux_sta_id
, old_ap_sta_id
= IWL_MVM_STATION_COUNT
;
970 * mac80211 shouldn't get here, but for D3 test
971 * it doesn't warrant a warning
977 key_data
.rsc_tsc
= kzalloc(sizeof(*key_data
.rsc_tsc
), GFP_KERNEL
);
978 if (!key_data
.rsc_tsc
)
981 mutex_lock(&mvm
->mutex
);
983 old_aux_sta_id
= mvm
->aux_sta
.sta_id
;
985 /* see if there's only a single BSS vif and it's associated */
986 ieee80211_iterate_active_interfaces_atomic(
987 mvm
->hw
, IEEE80211_IFACE_ITER_NORMAL
,
988 iwl_mvm_d3_iface_iterator
, &suspend_iter_data
);
990 if (suspend_iter_data
.error
|| !suspend_iter_data
.vif
) {
995 vif
= suspend_iter_data
.vif
;
996 mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
998 ap_sta
= rcu_dereference_protected(
999 mvm
->fw_id_to_mac_id
[mvmvif
->ap_sta_id
],
1000 lockdep_is_held(&mvm
->mutex
));
1001 if (IS_ERR_OR_NULL(ap_sta
)) {
1006 mvm_ap_sta
= (struct iwl_mvm_sta
*)ap_sta
->drv_priv
;
1008 /* TODO: wowlan_config_cmd.wowlan_ba_teardown_tids */
1010 wowlan_config_cmd
.is_11n_connection
= ap_sta
->ht_cap
.ht_supported
;
1012 /* Query the last used seqno and set it */
1013 ret
= iwl_mvm_get_last_nonqos_seq(mvm
, vif
);
1016 wowlan_config_cmd
.non_qos_seq
= cpu_to_le16(ret
);
1019 * For QoS counters, we store the one to use next, so subtract 0x10
1020 * since the uCode will add 0x10 *before* using the value while we
1021 * increment after using the value (i.e. store the next value to use).
1023 for (i
= 0; i
< IWL_MAX_TID_COUNT
; i
++) {
1024 u16 seq
= mvm_ap_sta
->tid_data
[i
].seq_number
;
1026 wowlan_config_cmd
.qos_seq
[i
] = cpu_to_le16(seq
);
1029 if (wowlan
->disconnect
)
1030 wowlan_config_cmd
.wakeup_filter
|=
1031 cpu_to_le32(IWL_WOWLAN_WAKEUP_BEACON_MISS
|
1032 IWL_WOWLAN_WAKEUP_LINK_CHANGE
);
1033 if (wowlan
->magic_pkt
)
1034 wowlan_config_cmd
.wakeup_filter
|=
1035 cpu_to_le32(IWL_WOWLAN_WAKEUP_MAGIC_PACKET
);
1036 if (wowlan
->gtk_rekey_failure
)
1037 wowlan_config_cmd
.wakeup_filter
|=
1038 cpu_to_le32(IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL
);
1039 if (wowlan
->eap_identity_req
)
1040 wowlan_config_cmd
.wakeup_filter
|=
1041 cpu_to_le32(IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ
);
1042 if (wowlan
->four_way_handshake
)
1043 wowlan_config_cmd
.wakeup_filter
|=
1044 cpu_to_le32(IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE
);
1045 if (wowlan
->n_patterns
)
1046 wowlan_config_cmd
.wakeup_filter
|=
1047 cpu_to_le32(IWL_WOWLAN_WAKEUP_PATTERN_MATCH
);
1049 if (wowlan
->rfkill_release
)
1050 wowlan_config_cmd
.wakeup_filter
|=
1051 cpu_to_le32(IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT
);
1055 * Set the "link change" (really "link lost") flag as well
1056 * since that implies losing the TCP connection.
1058 wowlan_config_cmd
.wakeup_filter
|=
1059 cpu_to_le32(IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS
|
1060 IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE
|
1061 IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET
|
1062 IWL_WOWLAN_WAKEUP_LINK_CHANGE
);
1065 iwl_mvm_cancel_scan(mvm
);
1067 iwl_trans_stop_device(mvm
->trans
);
1070 * The D3 firmware still hardcodes the AP station ID for the
1071 * BSS we're associated with as 0. Store the real STA ID here
1072 * and assign 0. When we leave this function, we'll restore
1073 * the original value for the resume code.
1075 old_ap_sta_id
= mvm_ap_sta
->sta_id
;
1076 mvm_ap_sta
->sta_id
= 0;
1077 mvmvif
->ap_sta_id
= 0;
1080 * Set the HW restart bit -- this is mostly true as we're
1081 * going to load new firmware and reprogram that, though
1082 * the reprogramming is going to be manual to avoid adding
1083 * all the MACs that aren't support.
1084 * We don't have to clear up everything though because the
1085 * reprogramming is manual. When we resume, we'll actually
1086 * go through a proper restart sequence again to switch
1087 * back to the runtime firmware image.
1089 set_bit(IWL_MVM_STATUS_IN_HW_RESTART
, &mvm
->status
);
1091 /* We reprogram keys and shouldn't allocate new key indices */
1092 memset(mvm
->fw_key_table
, 0, sizeof(mvm
->fw_key_table
));
1095 mvm
->ptk_icvlen
= 0;
1097 mvm
->ptk_icvlen
= 0;
1100 * The D3 firmware still hardcodes the AP station ID for the
1101 * BSS we're associated with as 0. As a result, we have to move
1102 * the auxiliary station to ID 1 so the ID 0 remains free for
1103 * the AP station for later.
1104 * We set the sta_id to 1 here, and reset it to its previous
1105 * value (that we stored above) later.
1107 mvm
->aux_sta
.sta_id
= 1;
1109 ret
= iwl_mvm_load_d3_fw(mvm
);
1113 ret
= iwl_mvm_d3_reprogram(mvm
, vif
, ap_sta
);
1117 if (!iwlwifi_mod_params
.sw_crypto
) {
1119 * This needs to be unlocked due to lock ordering
1120 * constraints. Since we're in the suspend path
1121 * that isn't really a problem though.
1123 mutex_unlock(&mvm
->mutex
);
1124 ieee80211_iter_keys(mvm
->hw
, vif
,
1125 iwl_mvm_wowlan_program_keys
,
1127 mutex_lock(&mvm
->mutex
);
1128 if (key_data
.error
) {
1133 if (key_data
.use_rsc_tsc
) {
1134 struct iwl_host_cmd rsc_tsc_cmd
= {
1135 .id
= WOWLAN_TSC_RSC_PARAM
,
1137 .data
[0] = key_data
.rsc_tsc
,
1138 .dataflags
[0] = IWL_HCMD_DFL_NOCOPY
,
1139 .len
[0] = sizeof(*key_data
.rsc_tsc
),
1142 ret
= iwl_mvm_send_cmd(mvm
, &rsc_tsc_cmd
);
1147 if (key_data
.use_tkip
) {
1148 ret
= iwl_mvm_send_cmd_pdu(mvm
,
1150 CMD_SYNC
, sizeof(tkip_cmd
),
1156 if (mvmvif
->rekey_data
.valid
) {
1157 memset(&kek_kck_cmd
, 0, sizeof(kek_kck_cmd
));
1158 memcpy(kek_kck_cmd
.kck
, mvmvif
->rekey_data
.kck
,
1160 kek_kck_cmd
.kck_len
= cpu_to_le16(NL80211_KCK_LEN
);
1161 memcpy(kek_kck_cmd
.kek
, mvmvif
->rekey_data
.kek
,
1163 kek_kck_cmd
.kek_len
= cpu_to_le16(NL80211_KEK_LEN
);
1164 kek_kck_cmd
.replay_ctr
= mvmvif
->rekey_data
.replay_ctr
;
1166 ret
= iwl_mvm_send_cmd_pdu(mvm
,
1167 WOWLAN_KEK_KCK_MATERIAL
,
1169 sizeof(kek_kck_cmd
),
1176 ret
= iwl_mvm_send_cmd_pdu(mvm
, WOWLAN_CONFIGURATION
,
1177 CMD_SYNC
, sizeof(wowlan_config_cmd
),
1178 &wowlan_config_cmd
);
1182 ret
= iwl_mvm_send_patterns(mvm
, wowlan
);
1186 ret
= iwl_mvm_send_proto_offload(mvm
, vif
);
1190 ret
= iwl_mvm_send_remote_wake_cfg(mvm
, vif
, wowlan
->tcp
);
1194 ret
= iwl_mvm_power_update_device_mode(mvm
);
1198 ret
= iwl_mvm_power_update_mode(mvm
, vif
);
1202 #ifdef CONFIG_IWLWIFI_DEBUGFS
1203 if (mvm
->d3_wake_sysassert
)
1204 d3_cfg_cmd_data
.wakeup_flags
|=
1205 cpu_to_le32(IWL_WAKEUP_D3_CONFIG_FW_ERROR
);
1208 /* must be last -- this switches firmware state */
1209 ret
= iwl_mvm_send_cmd(mvm
, &d3_cfg_cmd
);
1212 #ifdef CONFIG_IWLWIFI_DEBUGFS
1213 len
= iwl_rx_packet_payload_len(d3_cfg_cmd
.resp_pkt
);
1214 if (len
>= sizeof(u32
)) {
1215 mvm
->d3_test_pme_ptr
=
1216 le32_to_cpup((__le32
*)d3_cfg_cmd
.resp_pkt
->data
);
1219 iwl_free_resp(&d3_cfg_cmd
);
1221 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART
, &mvm
->status
);
1223 iwl_trans_d3_suspend(mvm
->trans
, test
);
1225 mvm
->aux_sta
.sta_id
= old_aux_sta_id
;
1226 mvm_ap_sta
->sta_id
= old_ap_sta_id
;
1227 mvmvif
->ap_sta_id
= old_ap_sta_id
;
1230 ieee80211_restart_hw(mvm
->hw
);
1232 kfree(key_data
.rsc_tsc
);
1234 mutex_unlock(&mvm
->mutex
);
1239 int iwl_mvm_suspend(struct ieee80211_hw
*hw
, struct cfg80211_wowlan
*wowlan
)
1241 return __iwl_mvm_suspend(hw
, wowlan
, false);
1244 /* converted data from the different status responses */
1245 struct iwl_wowlan_status_data
{
1249 u32 wake_packet_length
;
1250 u32 wake_packet_bufsize
;
1251 const u8
*wake_packet
;
1254 static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm
*mvm
,
1255 struct ieee80211_vif
*vif
,
1256 struct iwl_wowlan_status_data
*status
)
1258 struct sk_buff
*pkt
= NULL
;
1259 struct cfg80211_wowlan_wakeup wakeup
= {
1262 struct cfg80211_wowlan_wakeup
*wakeup_report
= &wakeup
;
1263 u32 reasons
= status
->wakeup_reasons
;
1265 if (reasons
== IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS
) {
1266 wakeup_report
= NULL
;
1270 if (reasons
& IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET
)
1271 wakeup
.magic_pkt
= true;
1273 if (reasons
& IWL_WOWLAN_WAKEUP_BY_PATTERN
)
1274 wakeup
.pattern_idx
=
1275 status
->pattern_number
;
1277 if (reasons
& (IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON
|
1278 IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH
))
1279 wakeup
.disconnect
= true;
1281 if (reasons
& IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE
)
1282 wakeup
.gtk_rekey_failure
= true;
1284 if (reasons
& IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED
)
1285 wakeup
.rfkill_release
= true;
1287 if (reasons
& IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST
)
1288 wakeup
.eap_identity_req
= true;
1290 if (reasons
& IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE
)
1291 wakeup
.four_way_handshake
= true;
1293 if (reasons
& IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS
)
1294 wakeup
.tcp_connlost
= true;
1296 if (reasons
& IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE
)
1297 wakeup
.tcp_nomoretokens
= true;
1299 if (reasons
& IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET
)
1300 wakeup
.tcp_match
= true;
1302 if (status
->wake_packet_bufsize
) {
1303 int pktsize
= status
->wake_packet_bufsize
;
1304 int pktlen
= status
->wake_packet_length
;
1305 const u8
*pktdata
= status
->wake_packet
;
1306 struct ieee80211_hdr
*hdr
= (void *)pktdata
;
1307 int truncated
= pktlen
- pktsize
;
1309 /* this would be a firmware bug */
1310 if (WARN_ON_ONCE(truncated
< 0))
1313 if (ieee80211_is_data(hdr
->frame_control
)) {
1314 int hdrlen
= ieee80211_hdrlen(hdr
->frame_control
);
1315 int ivlen
= 0, icvlen
= 4; /* also FCS */
1317 pkt
= alloc_skb(pktsize
, GFP_KERNEL
);
1321 memcpy(skb_put(pkt
, hdrlen
), pktdata
, hdrlen
);
1325 if (ieee80211_has_protected(hdr
->frame_control
)) {
1327 * This is unlocked and using gtk_i(c)vlen,
1328 * but since everything is under RTNL still
1329 * that's not really a problem - changing
1330 * it would be difficult.
1332 if (is_multicast_ether_addr(hdr
->addr1
)) {
1333 ivlen
= mvm
->gtk_ivlen
;
1334 icvlen
+= mvm
->gtk_icvlen
;
1336 ivlen
= mvm
->ptk_ivlen
;
1337 icvlen
+= mvm
->ptk_icvlen
;
1341 /* if truncated, FCS/ICV is (partially) gone */
1342 if (truncated
>= icvlen
) {
1344 truncated
-= icvlen
;
1346 icvlen
-= truncated
;
1350 pktsize
-= ivlen
+ icvlen
;
1353 memcpy(skb_put(pkt
, pktsize
), pktdata
, pktsize
);
1355 if (ieee80211_data_to_8023(pkt
, vif
->addr
, vif
->type
))
1357 wakeup
.packet
= pkt
->data
;
1358 wakeup
.packet_present_len
= pkt
->len
;
1359 wakeup
.packet_len
= pkt
->len
- truncated
;
1360 wakeup
.packet_80211
= false;
1364 if (truncated
>= 4) {
1368 fcslen
-= truncated
;
1372 wakeup
.packet
= status
->wake_packet
;
1373 wakeup
.packet_present_len
= pktsize
;
1374 wakeup
.packet_len
= pktlen
- truncated
;
1375 wakeup
.packet_80211
= true;
1380 ieee80211_report_wowlan_wakeup(vif
, wakeup_report
, GFP_KERNEL
);
1384 static void iwl_mvm_aes_sc_to_seq(struct aes_sc
*sc
,
1385 struct ieee80211_key_seq
*seq
)
1389 pn
= le64_to_cpu(sc
->pn
);
1390 seq
->ccmp
.pn
[0] = pn
>> 40;
1391 seq
->ccmp
.pn
[1] = pn
>> 32;
1392 seq
->ccmp
.pn
[2] = pn
>> 24;
1393 seq
->ccmp
.pn
[3] = pn
>> 16;
1394 seq
->ccmp
.pn
[4] = pn
>> 8;
1395 seq
->ccmp
.pn
[5] = pn
;
1398 static void iwl_mvm_tkip_sc_to_seq(struct tkip_sc
*sc
,
1399 struct ieee80211_key_seq
*seq
)
1401 seq
->tkip
.iv32
= le32_to_cpu(sc
->iv32
);
1402 seq
->tkip
.iv16
= le16_to_cpu(sc
->iv16
);
1405 static void iwl_mvm_set_aes_rx_seq(struct aes_sc
*scs
,
1406 struct ieee80211_key_conf
*key
)
1410 BUILD_BUG_ON(IWL_NUM_RSC
!= IEEE80211_NUM_TIDS
);
1412 for (tid
= 0; tid
< IWL_NUM_RSC
; tid
++) {
1413 struct ieee80211_key_seq seq
= {};
1415 iwl_mvm_aes_sc_to_seq(&scs
[tid
], &seq
);
1416 ieee80211_set_key_rx_seq(key
, tid
, &seq
);
1420 static void iwl_mvm_set_tkip_rx_seq(struct tkip_sc
*scs
,
1421 struct ieee80211_key_conf
*key
)
1425 BUILD_BUG_ON(IWL_NUM_RSC
!= IEEE80211_NUM_TIDS
);
1427 for (tid
= 0; tid
< IWL_NUM_RSC
; tid
++) {
1428 struct ieee80211_key_seq seq
= {};
1430 iwl_mvm_tkip_sc_to_seq(&scs
[tid
], &seq
);
1431 ieee80211_set_key_rx_seq(key
, tid
, &seq
);
1435 static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf
*key
,
1436 struct iwl_wowlan_status_v6
*status
)
1438 union iwl_all_tsc_rsc
*rsc
= &status
->gtk
.rsc
.all_tsc_rsc
;
1440 switch (key
->cipher
) {
1441 case WLAN_CIPHER_SUITE_CCMP
:
1442 iwl_mvm_set_aes_rx_seq(rsc
->aes
.multicast_rsc
, key
);
1444 case WLAN_CIPHER_SUITE_TKIP
:
1445 iwl_mvm_set_tkip_rx_seq(rsc
->tkip
.multicast_rsc
, key
);
1452 struct iwl_mvm_d3_gtk_iter_data
{
1453 struct iwl_wowlan_status_v6
*status
;
1456 bool find_phase
, unhandled_cipher
;
1460 static void iwl_mvm_d3_update_gtks(struct ieee80211_hw
*hw
,
1461 struct ieee80211_vif
*vif
,
1462 struct ieee80211_sta
*sta
,
1463 struct ieee80211_key_conf
*key
,
1466 struct iwl_mvm_d3_gtk_iter_data
*data
= _data
;
1468 if (data
->unhandled_cipher
)
1471 switch (key
->cipher
) {
1472 case WLAN_CIPHER_SUITE_WEP40
:
1473 case WLAN_CIPHER_SUITE_WEP104
:
1474 /* ignore WEP completely, nothing to do */
1476 case WLAN_CIPHER_SUITE_CCMP
:
1477 case WLAN_CIPHER_SUITE_TKIP
:
1478 /* we support these */
1481 /* everything else (even CMAC for MFP) - disconnect from AP */
1482 data
->unhandled_cipher
= true;
1489 * pairwise key - update sequence counters only;
1490 * note that this assumes no TDLS sessions are active
1493 struct ieee80211_key_seq seq
= {};
1494 union iwl_all_tsc_rsc
*sc
= &data
->status
->gtk
.rsc
.all_tsc_rsc
;
1496 if (data
->find_phase
)
1499 switch (key
->cipher
) {
1500 case WLAN_CIPHER_SUITE_CCMP
:
1501 iwl_mvm_aes_sc_to_seq(&sc
->aes
.tsc
, &seq
);
1502 iwl_mvm_set_aes_rx_seq(sc
->aes
.unicast_rsc
, key
);
1504 case WLAN_CIPHER_SUITE_TKIP
:
1505 iwl_mvm_tkip_sc_to_seq(&sc
->tkip
.tsc
, &seq
);
1506 iwl_mvm_set_tkip_rx_seq(sc
->tkip
.unicast_rsc
, key
);
1509 ieee80211_set_key_tx_seq(key
, &seq
);
1511 /* that's it for this key */
1515 if (data
->find_phase
) {
1516 data
->last_gtk
= key
;
1517 data
->cipher
= key
->cipher
;
1521 if (data
->status
->num_of_gtk_rekeys
)
1522 ieee80211_remove_key(key
);
1523 else if (data
->last_gtk
== key
)
1524 iwl_mvm_set_key_rx_seq(key
, data
->status
);
1527 static bool iwl_mvm_setup_connection_keep(struct iwl_mvm
*mvm
,
1528 struct ieee80211_vif
*vif
,
1529 struct iwl_wowlan_status_v6
*status
)
1531 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
1532 struct iwl_mvm_d3_gtk_iter_data gtkdata
= {
1535 u32 disconnection_reasons
=
1536 IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON
|
1537 IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH
;
1539 if (!status
|| !vif
->bss_conf
.bssid
)
1542 if (le32_to_cpu(status
->wakeup_reasons
) & disconnection_reasons
)
1545 /* find last GTK that we used initially, if any */
1546 gtkdata
.find_phase
= true;
1547 ieee80211_iter_keys(mvm
->hw
, vif
,
1548 iwl_mvm_d3_update_gtks
, >kdata
);
1549 /* not trying to keep connections with MFP/unhandled ciphers */
1550 if (gtkdata
.unhandled_cipher
)
1552 if (!gtkdata
.num_keys
)
1554 if (!gtkdata
.last_gtk
)
1558 * invalidate all other GTKs that might still exist and update
1559 * the one that we used
1561 gtkdata
.find_phase
= false;
1562 ieee80211_iter_keys(mvm
->hw
, vif
,
1563 iwl_mvm_d3_update_gtks
, >kdata
);
1565 if (status
->num_of_gtk_rekeys
) {
1566 struct ieee80211_key_conf
*key
;
1568 struct ieee80211_key_conf conf
;
1571 .conf
.cipher
= gtkdata
.cipher
,
1572 .conf
.keyidx
= status
->gtk
.key_index
,
1575 switch (gtkdata
.cipher
) {
1576 case WLAN_CIPHER_SUITE_CCMP
:
1577 conf
.conf
.keylen
= WLAN_KEY_LEN_CCMP
;
1578 memcpy(conf
.conf
.key
, status
->gtk
.decrypt_key
,
1581 case WLAN_CIPHER_SUITE_TKIP
:
1582 conf
.conf
.keylen
= WLAN_KEY_LEN_TKIP
;
1583 memcpy(conf
.conf
.key
, status
->gtk
.decrypt_key
, 16);
1584 /* leave TX MIC key zeroed, we don't use it anyway */
1585 memcpy(conf
.conf
.key
+
1586 NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY
,
1587 status
->gtk
.tkip_mic_key
, 8);
1591 key
= ieee80211_gtk_rekey_add(vif
, &conf
.conf
);
1594 iwl_mvm_set_key_rx_seq(key
, status
);
1597 if (status
->num_of_gtk_rekeys
) {
1599 cpu_to_be64(le64_to_cpu(status
->replay_ctr
));
1600 ieee80211_gtk_rekey_notify(vif
, vif
->bss_conf
.bssid
,
1601 (void *)&replay_ctr
, GFP_KERNEL
);
1605 mvmvif
->seqno_valid
= true;
1606 /* +0x10 because the set API expects next-to-use, not last-used */
1607 mvmvif
->seqno
= le16_to_cpu(status
->non_qos_seq_ctr
) + 0x10;
1612 /* releases the MVM mutex */
1613 static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm
*mvm
,
1614 struct ieee80211_vif
*vif
)
1616 u32 base
= mvm
->error_event_table
;
1617 struct error_table_start
{
1618 /* cf. struct iwl_error_event_table */
1622 struct iwl_host_cmd cmd
= {
1623 .id
= WOWLAN_GET_STATUSES
,
1624 .flags
= CMD_SYNC
| CMD_WANT_SKB
,
1626 struct iwl_wowlan_status_data status
;
1627 struct iwl_wowlan_status_v6
*status_v6
;
1628 int ret
, len
, status_size
, i
;
1630 struct ieee80211_sta
*ap_sta
;
1631 struct iwl_mvm_sta
*mvm_ap_sta
;
1633 iwl_trans_read_mem_bytes(mvm
->trans
, base
,
1634 &err_info
, sizeof(err_info
));
1636 if (err_info
.valid
) {
1637 IWL_INFO(mvm
, "error table is valid (%d)\n",
1639 if (err_info
.error_id
== RF_KILL_INDICATOR_FOR_WOWLAN
) {
1640 struct cfg80211_wowlan_wakeup wakeup
= {
1641 .rfkill_release
= true,
1643 ieee80211_report_wowlan_wakeup(vif
, &wakeup
,
1649 /* only for tracing for now */
1650 ret
= iwl_mvm_send_cmd_pdu(mvm
, OFFLOADS_QUERY_CMD
, CMD_SYNC
, 0, NULL
);
1652 IWL_ERR(mvm
, "failed to query offload statistics (%d)\n", ret
);
1654 ret
= iwl_mvm_send_cmd(mvm
, &cmd
);
1656 IWL_ERR(mvm
, "failed to query status (%d)\n", ret
);
1660 /* RF-kill already asserted again... */
1664 if (mvm
->fw
->ucode_capa
.flags
& IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API
)
1665 status_size
= sizeof(struct iwl_wowlan_status_v6
);
1667 status_size
= sizeof(struct iwl_wowlan_status_v4
);
1669 len
= iwl_rx_packet_payload_len(cmd
.resp_pkt
);
1670 if (len
< status_size
) {
1671 IWL_ERR(mvm
, "Invalid WoWLAN status response!\n");
1675 if (mvm
->fw
->ucode_capa
.flags
& IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API
) {
1676 status_v6
= (void *)cmd
.resp_pkt
->data
;
1678 status
.pattern_number
= le16_to_cpu(status_v6
->pattern_number
);
1679 for (i
= 0; i
< 8; i
++)
1680 status
.qos_seq_ctr
[i
] =
1681 le16_to_cpu(status_v6
->qos_seq_ctr
[i
]);
1682 status
.wakeup_reasons
= le32_to_cpu(status_v6
->wakeup_reasons
);
1683 status
.wake_packet_length
=
1684 le32_to_cpu(status_v6
->wake_packet_length
);
1685 status
.wake_packet_bufsize
=
1686 le32_to_cpu(status_v6
->wake_packet_bufsize
);
1687 status
.wake_packet
= status_v6
->wake_packet
;
1689 struct iwl_wowlan_status_v4
*status_v4
;
1691 status_v4
= (void *)cmd
.resp_pkt
->data
;
1693 status
.pattern_number
= le16_to_cpu(status_v4
->pattern_number
);
1694 for (i
= 0; i
< 8; i
++)
1695 status
.qos_seq_ctr
[i
] =
1696 le16_to_cpu(status_v4
->qos_seq_ctr
[i
]);
1697 status
.wakeup_reasons
= le32_to_cpu(status_v4
->wakeup_reasons
);
1698 status
.wake_packet_length
=
1699 le32_to_cpu(status_v4
->wake_packet_length
);
1700 status
.wake_packet_bufsize
=
1701 le32_to_cpu(status_v4
->wake_packet_bufsize
);
1702 status
.wake_packet
= status_v4
->wake_packet
;
1705 if (len
!= status_size
+ ALIGN(status
.wake_packet_bufsize
, 4)) {
1706 IWL_ERR(mvm
, "Invalid WoWLAN status response!\n");
1710 /* still at hard-coded place 0 for D3 image */
1711 ap_sta
= rcu_dereference_protected(
1712 mvm
->fw_id_to_mac_id
[0],
1713 lockdep_is_held(&mvm
->mutex
));
1714 if (IS_ERR_OR_NULL(ap_sta
))
1717 mvm_ap_sta
= (struct iwl_mvm_sta
*)ap_sta
->drv_priv
;
1718 for (i
= 0; i
< IWL_MAX_TID_COUNT
; i
++) {
1719 u16 seq
= status
.qos_seq_ctr
[i
];
1720 /* firmware stores last-used value, we store next value */
1722 mvm_ap_sta
->tid_data
[i
].seq_number
= seq
;
1725 /* now we have all the data we need, unlock to avoid mac80211 issues */
1726 mutex_unlock(&mvm
->mutex
);
1728 iwl_mvm_report_wakeup_reasons(mvm
, vif
, &status
);
1730 keep
= iwl_mvm_setup_connection_keep(mvm
, vif
, status_v6
);
1732 iwl_free_resp(&cmd
);
1736 iwl_free_resp(&cmd
);
1738 mutex_unlock(&mvm
->mutex
);
1742 static void iwl_mvm_read_d3_sram(struct iwl_mvm
*mvm
)
1744 #ifdef CONFIG_IWLWIFI_DEBUGFS
1745 const struct fw_img
*img
= &mvm
->fw
->img
[IWL_UCODE_WOWLAN
];
1746 u32 len
= img
->sec
[IWL_UCODE_SECTION_DATA
].len
;
1747 u32 offs
= img
->sec
[IWL_UCODE_SECTION_DATA
].offset
;
1749 if (!mvm
->store_d3_resume_sram
)
1752 if (!mvm
->d3_resume_sram
) {
1753 mvm
->d3_resume_sram
= kzalloc(len
, GFP_KERNEL
);
1754 if (!mvm
->d3_resume_sram
)
1758 iwl_trans_read_mem_bytes(mvm
->trans
, offs
, mvm
->d3_resume_sram
, len
);
1762 static void iwl_mvm_d3_disconnect_iter(void *data
, u8
*mac
,
1763 struct ieee80211_vif
*vif
)
1765 /* skip the one we keep connection on */
1769 if (vif
->type
== NL80211_IFTYPE_STATION
)
1770 ieee80211_resume_disconnect(vif
);
1773 static int __iwl_mvm_resume(struct iwl_mvm
*mvm
, bool test
)
1775 struct iwl_d3_iter_data resume_iter_data
= {
1778 struct ieee80211_vif
*vif
= NULL
;
1780 enum iwl_d3_status d3_status
;
1783 mutex_lock(&mvm
->mutex
);
1785 /* get the BSS vif pointer again */
1786 ieee80211_iterate_active_interfaces_atomic(
1787 mvm
->hw
, IEEE80211_IFACE_ITER_NORMAL
,
1788 iwl_mvm_d3_iface_iterator
, &resume_iter_data
);
1790 if (WARN_ON(resume_iter_data
.error
|| !resume_iter_data
.vif
))
1793 vif
= resume_iter_data
.vif
;
1795 ret
= iwl_trans_d3_resume(mvm
->trans
, &d3_status
, test
);
1799 if (d3_status
!= IWL_D3_STATUS_ALIVE
) {
1800 IWL_INFO(mvm
, "Device was reset during suspend\n");
1804 /* query SRAM first in case we want event logging */
1805 iwl_mvm_read_d3_sram(mvm
);
1807 keep
= iwl_mvm_query_wakeup_reasons(mvm
, vif
);
1808 #ifdef CONFIG_IWLWIFI_DEBUGFS
1810 mvm
->keep_vif
= vif
;
1812 /* has unlocked the mutex, so skip that */
1816 mutex_unlock(&mvm
->mutex
);
1820 ieee80211_iterate_active_interfaces_rtnl(mvm
->hw
,
1821 IEEE80211_IFACE_ITER_NORMAL
,
1822 iwl_mvm_d3_disconnect_iter
, keep
? vif
: NULL
);
1824 /* return 1 to reconfigure the device */
1825 set_bit(IWL_MVM_STATUS_IN_HW_RESTART
, &mvm
->status
);
1829 int iwl_mvm_resume(struct ieee80211_hw
*hw
)
1831 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1833 return __iwl_mvm_resume(mvm
, false);
1836 void iwl_mvm_set_wakeup(struct ieee80211_hw
*hw
, bool enabled
)
1838 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1840 device_set_wakeup_enable(mvm
->trans
->dev
, enabled
);
1843 #ifdef CONFIG_IWLWIFI_DEBUGFS
1844 static int iwl_mvm_d3_test_open(struct inode
*inode
, struct file
*file
)
1846 struct iwl_mvm
*mvm
= inode
->i_private
;
1849 if (mvm
->d3_test_active
)
1852 file
->private_data
= inode
->i_private
;
1854 ieee80211_stop_queues(mvm
->hw
);
1857 /* start pseudo D3 */
1859 err
= __iwl_mvm_suspend(mvm
->hw
, mvm
->hw
->wiphy
->wowlan_config
, true);
1864 ieee80211_wake_queues(mvm
->hw
);
1867 mvm
->d3_test_active
= true;
1868 mvm
->keep_vif
= NULL
;
1872 static ssize_t
iwl_mvm_d3_test_read(struct file
*file
, char __user
*user_buf
,
1873 size_t count
, loff_t
*ppos
)
1875 struct iwl_mvm
*mvm
= file
->private_data
;
1879 /* read pme_ptr if available */
1880 if (mvm
->d3_test_pme_ptr
) {
1881 pme_asserted
= iwl_trans_read_mem32(mvm
->trans
,
1882 mvm
->d3_test_pme_ptr
);
1887 if (msleep_interruptible(100))
1894 static void iwl_mvm_d3_test_disconn_work_iter(void *_data
, u8
*mac
,
1895 struct ieee80211_vif
*vif
)
1897 /* skip the one we keep connection on */
1901 if (vif
->type
== NL80211_IFTYPE_STATION
)
1902 ieee80211_connection_loss(vif
);
1905 static int iwl_mvm_d3_test_release(struct inode
*inode
, struct file
*file
)
1907 struct iwl_mvm
*mvm
= inode
->i_private
;
1908 int remaining_time
= 10;
1910 mvm
->d3_test_active
= false;
1911 __iwl_mvm_resume(mvm
, true);
1912 iwl_abort_notification_waits(&mvm
->notif_wait
);
1913 ieee80211_restart_hw(mvm
->hw
);
1915 /* wait for restart and disconnect all interfaces */
1916 while (test_bit(IWL_MVM_STATUS_IN_HW_RESTART
, &mvm
->status
) &&
1917 remaining_time
> 0) {
1922 if (remaining_time
== 0)
1923 IWL_ERR(mvm
, "Timed out waiting for HW restart to finish!\n");
1925 ieee80211_iterate_active_interfaces_atomic(
1926 mvm
->hw
, IEEE80211_IFACE_ITER_NORMAL
,
1927 iwl_mvm_d3_test_disconn_work_iter
, mvm
->keep_vif
);
1929 ieee80211_wake_queues(mvm
->hw
);
1934 const struct file_operations iwl_dbgfs_d3_test_ops
= {
1935 .llseek
= no_llseek
,
1936 .open
= iwl_mvm_d3_test_open
,
1937 .read
= iwl_mvm_d3_test_read
,
1938 .release
= iwl_mvm_d3_test_release
,