forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/intel/iwlwifi/fw/smem.c
....@@ -5,10 +5,9 @@
55 *
66 * GPL LICENSE SUMMARY
77 *
8
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
98 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
109 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11
- * Copyright(c) 2018 - 2019 Intel Corporation
10
+ * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation
1211 *
1312 * This program is free software; you can redistribute it and/or modify
1413 * it under the terms of version 2 of the GNU General Public License as
....@@ -28,10 +27,9 @@
2827 *
2928 * BSD LICENSE
3029 *
31
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
3230 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
3331 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34
- * Copyright(c) 2018 - 2019 Intel Corporation
32
+ * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation
3533 * All rights reserved.
3634 *
3735 * Redistribution and use in source and binary forms, with or without
....@@ -71,6 +69,8 @@
7169 struct iwl_shared_mem_cfg *mem_cfg = (void *)pkt->data;
7270 int i, lmac;
7371 int lmac_num = le32_to_cpu(mem_cfg->lmac_num);
72
+ u8 api_ver = iwl_fw_lookup_notif_ver(fwrt->fw, SYSTEM_GROUP,
73
+ SHARED_MEM_CFG_CMD, 0);
7474
7575 if (WARN_ON(lmac_num > ARRAY_SIZE(mem_cfg->lmac_smem)))
7676 return;
....@@ -79,6 +79,12 @@
7979 fwrt->smem_cfg.num_txfifo_entries =
8080 ARRAY_SIZE(mem_cfg->lmac_smem[0].txfifo_size);
8181 fwrt->smem_cfg.rxfifo2_size = le32_to_cpu(mem_cfg->rxfifo2_size);
82
+
83
+ if (api_ver >= 4 &&
84
+ !WARN_ON_ONCE(iwl_rx_packet_payload_len(pkt) < sizeof(*mem_cfg))) {
85
+ fwrt->smem_cfg.rxfifo2_control_size =
86
+ le32_to_cpu(mem_cfg->rxfifo2_control_size);
87
+ }
8288
8389 for (lmac = 0; lmac < lmac_num; lmac++) {
8490 struct iwl_shared_mem_lmac_cfg *lmac_cfg =
....@@ -151,7 +157,7 @@
151157 }
152158
153159 pkt = cmd.resp_pkt;
154
- if (fwrt->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000)
160
+ if (fwrt->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000)
155161 iwl_parse_shared_mem_22000(fwrt, pkt);
156162 else
157163 iwl_parse_shared_mem(fwrt, pkt);