Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
0002 /*
0003  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
0004  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
0005  */
0006 
0007 #ifndef ATH11K_CORE_H
0008 #define ATH11K_CORE_H
0009 
0010 #include <linux/types.h>
0011 #include <linux/interrupt.h>
0012 #include <linux/irq.h>
0013 #include <linux/bitfield.h>
0014 #include <linux/dmi.h>
0015 #include <linux/ctype.h>
0016 #include <linux/rhashtable.h>
0017 #include <linux/average.h>
0018 #include "qmi.h"
0019 #include "htc.h"
0020 #include "wmi.h"
0021 #include "hal.h"
0022 #include "dp.h"
0023 #include "ce.h"
0024 #include "mac.h"
0025 #include "hw.h"
0026 #include "hal_rx.h"
0027 #include "reg.h"
0028 #include "thermal.h"
0029 #include "dbring.h"
0030 #include "spectral.h"
0031 #include "wow.h"
0032 
0033 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
0034 
0035 #define ATH11K_TX_MGMT_NUM_PENDING_MAX  512
0036 
0037 #define ATH11K_TX_MGMT_TARGET_MAX_SUPPORT_WMI 64
0038 
0039 /* Pending management packets threshold for dropping probe responses */
0040 #define ATH11K_PRB_RSP_DROP_THRESHOLD ((ATH11K_TX_MGMT_TARGET_MAX_SUPPORT_WMI * 3) / 4)
0041 
0042 #define ATH11K_INVALID_HW_MAC_ID    0xFF
0043 #define ATH11K_CONNECTION_LOSS_HZ   (3 * HZ)
0044 
0045 /* SMBIOS type containing Board Data File Name Extension */
0046 #define ATH11K_SMBIOS_BDF_EXT_TYPE 0xF8
0047 
0048 /* SMBIOS type structure length (excluding strings-set) */
0049 #define ATH11K_SMBIOS_BDF_EXT_LENGTH 0x9
0050 
0051 /* The magic used by QCA spec */
0052 #define ATH11K_SMBIOS_BDF_EXT_MAGIC "BDF_"
0053 
0054 extern unsigned int ath11k_frame_mode;
0055 
0056 #define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ)
0057 
0058 #define ATH11K_MON_TIMER_INTERVAL  10
0059 #define ATH11K_RESET_TIMEOUT_HZ (20 * HZ)
0060 #define ATH11K_RESET_MAX_FAIL_COUNT_FIRST 3
0061 #define ATH11K_RESET_MAX_FAIL_COUNT_FINAL 5
0062 #define ATH11K_RESET_FAIL_TIMEOUT_HZ (20 * HZ)
0063 #define ATH11K_RECONFIGURE_TIMEOUT_HZ (10 * HZ)
0064 #define ATH11K_RECOVER_START_TIMEOUT_HZ (20 * HZ)
0065 
0066 enum ath11k_supported_bw {
0067     ATH11K_BW_20    = 0,
0068     ATH11K_BW_40    = 1,
0069     ATH11K_BW_80    = 2,
0070     ATH11K_BW_160   = 3,
0071 };
0072 
0073 enum ath11k_bdf_search {
0074     ATH11K_BDF_SEARCH_DEFAULT,
0075     ATH11K_BDF_SEARCH_BUS_AND_BOARD,
0076 };
0077 
0078 enum wme_ac {
0079     WME_AC_BE,
0080     WME_AC_BK,
0081     WME_AC_VI,
0082     WME_AC_VO,
0083     WME_NUM_AC
0084 };
0085 
0086 #define ATH11K_HT_MCS_MAX   7
0087 #define ATH11K_VHT_MCS_MAX  9
0088 #define ATH11K_HE_MCS_MAX   11
0089 
0090 enum ath11k_crypt_mode {
0091     /* Only use hardware crypto engine */
0092     ATH11K_CRYPT_MODE_HW,
0093     /* Only use software crypto */
0094     ATH11K_CRYPT_MODE_SW,
0095 };
0096 
0097 static inline enum wme_ac ath11k_tid_to_ac(u32 tid)
0098 {
0099     return (((tid == 0) || (tid == 3)) ? WME_AC_BE :
0100         ((tid == 1) || (tid == 2)) ? WME_AC_BK :
0101         ((tid == 4) || (tid == 5)) ? WME_AC_VI :
0102         WME_AC_VO);
0103 }
0104 
0105 enum ath11k_skb_flags {
0106     ATH11K_SKB_HW_80211_ENCAP = BIT(0),
0107     ATH11K_SKB_CIPHER_SET = BIT(1),
0108 };
0109 
0110 struct ath11k_skb_cb {
0111     dma_addr_t paddr;
0112     u8 eid;
0113     u8 flags;
0114     u32 cipher;
0115     struct ath11k *ar;
0116     struct ieee80211_vif *vif;
0117 } __packed;
0118 
0119 struct ath11k_skb_rxcb {
0120     dma_addr_t paddr;
0121     bool is_first_msdu;
0122     bool is_last_msdu;
0123     bool is_continuation;
0124     bool is_mcbc;
0125     bool is_eapol;
0126     struct hal_rx_desc *rx_desc;
0127     u8 err_rel_src;
0128     u8 err_code;
0129     u8 mac_id;
0130     u8 unmapped;
0131     u8 is_frag;
0132     u8 tid;
0133     u16 peer_id;
0134     u16 seq_no;
0135 };
0136 
0137 enum ath11k_hw_rev {
0138     ATH11K_HW_IPQ8074,
0139     ATH11K_HW_QCA6390_HW20,
0140     ATH11K_HW_IPQ6018_HW10,
0141     ATH11K_HW_QCN9074_HW10,
0142     ATH11K_HW_WCN6855_HW20,
0143     ATH11K_HW_WCN6855_HW21,
0144     ATH11K_HW_WCN6750_HW10,
0145 };
0146 
0147 enum ath11k_firmware_mode {
0148     /* the default mode, standard 802.11 functionality */
0149     ATH11K_FIRMWARE_MODE_NORMAL,
0150 
0151     /* factory tests etc */
0152     ATH11K_FIRMWARE_MODE_FTM,
0153 
0154     /* Cold boot calibration */
0155     ATH11K_FIRMWARE_MODE_COLD_BOOT = 7,
0156 };
0157 
0158 extern bool ath11k_cold_boot_cal;
0159 
0160 #define ATH11K_IRQ_NUM_MAX 52
0161 #define ATH11K_EXT_IRQ_NUM_MAX  16
0162 
0163 struct ath11k_ext_irq_grp {
0164     struct ath11k_base *ab;
0165     u32 irqs[ATH11K_EXT_IRQ_NUM_MAX];
0166     u32 num_irq;
0167     u32 grp_id;
0168     u64 timestamp;
0169     bool napi_enabled;
0170     struct napi_struct napi;
0171     struct net_device napi_ndev;
0172 };
0173 
0174 enum ath11k_smbios_cc_type {
0175     /* disable country code setting from SMBIOS */
0176     ATH11K_SMBIOS_CC_DISABLE = 0,
0177 
0178     /* set country code by ANSI country name, based on ISO3166-1 alpha2 */
0179     ATH11K_SMBIOS_CC_ISO = 1,
0180 
0181     /* worldwide regdomain */
0182     ATH11K_SMBIOS_CC_WW = 2,
0183 };
0184 
0185 struct ath11k_smbios_bdf {
0186     struct dmi_header hdr;
0187 
0188     u8 features_disabled;
0189 
0190     /* enum ath11k_smbios_cc_type */
0191     u8 country_code_flag;
0192 
0193     /* To set specific country, you need to set country code
0194      * flag=ATH11K_SMBIOS_CC_ISO first, then if country is United
0195      * States, then country code value = 0x5553 ("US",'U' = 0x55, 'S'=
0196      * 0x53). To set country to INDONESIA, then country code value =
0197      * 0x4944 ("IN", 'I'=0x49, 'D'=0x44). If country code flag =
0198      * ATH11K_SMBIOS_CC_WW, then you can use worldwide regulatory
0199      * setting.
0200      */
0201     u16 cc_code;
0202 
0203     u8 bdf_enabled;
0204     u8 bdf_ext[];
0205 } __packed;
0206 
0207 #define HEHANDLE_CAP_PHYINFO_SIZE       3
0208 #define HECAP_PHYINFO_SIZE              9
0209 #define HECAP_MACINFO_SIZE              5
0210 #define HECAP_TXRX_MCS_NSS_SIZE         2
0211 #define HECAP_PPET16_PPET8_MAX_SIZE     25
0212 
0213 #define HE_PPET16_PPET8_SIZE            8
0214 
0215 /* 802.11ax PPE (PPDU packet Extension) threshold */
0216 struct he_ppe_threshold {
0217     u32 numss_m1;
0218     u32 ru_mask;
0219     u32 ppet16_ppet8_ru3_ru0[HE_PPET16_PPET8_SIZE];
0220 };
0221 
0222 struct ath11k_he {
0223     u8 hecap_macinfo[HECAP_MACINFO_SIZE];
0224     u32 hecap_rxmcsnssmap;
0225     u32 hecap_txmcsnssmap;
0226     u32 hecap_phyinfo[HEHANDLE_CAP_PHYINFO_SIZE];
0227     struct he_ppe_threshold   hecap_ppet;
0228     u32 heop_param;
0229 };
0230 
0231 #define MAX_RADIOS 3
0232 
0233 enum {
0234     WMI_HOST_TP_SCALE_MAX   = 0,
0235     WMI_HOST_TP_SCALE_50    = 1,
0236     WMI_HOST_TP_SCALE_25    = 2,
0237     WMI_HOST_TP_SCALE_12    = 3,
0238     WMI_HOST_TP_SCALE_MIN   = 4,
0239     WMI_HOST_TP_SCALE_SIZE   = 5,
0240 };
0241 
0242 enum ath11k_scan_state {
0243     ATH11K_SCAN_IDLE,
0244     ATH11K_SCAN_STARTING,
0245     ATH11K_SCAN_RUNNING,
0246     ATH11K_SCAN_ABORTING,
0247 };
0248 
0249 enum ath11k_11d_state {
0250     ATH11K_11D_IDLE,
0251     ATH11K_11D_PREPARING,
0252     ATH11K_11D_RUNNING,
0253 };
0254 
0255 enum ath11k_dev_flags {
0256     ATH11K_CAC_RUNNING,
0257     ATH11K_FLAG_CORE_REGISTERED,
0258     ATH11K_FLAG_CRASH_FLUSH,
0259     ATH11K_FLAG_RAW_MODE,
0260     ATH11K_FLAG_HW_CRYPTO_DISABLED,
0261     ATH11K_FLAG_BTCOEX,
0262     ATH11K_FLAG_RECOVERY,
0263     ATH11K_FLAG_UNREGISTERING,
0264     ATH11K_FLAG_REGISTERED,
0265     ATH11K_FLAG_QMI_FAIL,
0266     ATH11K_FLAG_HTC_SUSPEND_COMPLETE,
0267     ATH11K_FLAG_CE_IRQ_ENABLED,
0268     ATH11K_FLAG_EXT_IRQ_ENABLED,
0269     ATH11K_FLAG_FIXED_MEM_RGN,
0270     ATH11K_FLAG_DEVICE_INIT_DONE,
0271     ATH11K_FLAG_MULTI_MSI_VECTORS,
0272 };
0273 
0274 enum ath11k_monitor_flags {
0275     ATH11K_FLAG_MONITOR_CONF_ENABLED,
0276     ATH11K_FLAG_MONITOR_STARTED,
0277     ATH11K_FLAG_MONITOR_VDEV_CREATED,
0278 };
0279 
0280 #define ATH11K_IPV6_UC_TYPE     0
0281 #define ATH11K_IPV6_AC_TYPE     1
0282 
0283 #define ATH11K_IPV6_MAX_COUNT   16
0284 #define ATH11K_IPV4_MAX_COUNT   2
0285 
0286 struct ath11k_arp_ns_offload {
0287     u8  ipv4_addr[ATH11K_IPV4_MAX_COUNT][4];
0288     u32 ipv4_count;
0289     u32 ipv6_count;
0290     u8  ipv6_addr[ATH11K_IPV6_MAX_COUNT][16];
0291     u8  self_ipv6_addr[ATH11K_IPV6_MAX_COUNT][16];
0292     u8  ipv6_type[ATH11K_IPV6_MAX_COUNT];
0293     bool ipv6_valid[ATH11K_IPV6_MAX_COUNT];
0294     u8  mac_addr[ETH_ALEN];
0295 };
0296 
0297 struct ath11k_rekey_data {
0298     u8 kck[NL80211_KCK_LEN];
0299     u8 kek[NL80211_KCK_LEN];
0300     u64 replay_ctr;
0301     bool enable_offload;
0302 };
0303 
0304 struct ath11k_vif {
0305     u32 vdev_id;
0306     enum wmi_vdev_type vdev_type;
0307     enum wmi_vdev_subtype vdev_subtype;
0308     u32 beacon_interval;
0309     u32 dtim_period;
0310     u16 ast_hash;
0311     u16 ast_idx;
0312     u16 tcl_metadata;
0313     u8 hal_addr_search_flags;
0314     u8 search_type;
0315 
0316     struct ath11k *ar;
0317     struct ieee80211_vif *vif;
0318 
0319     u16 tx_seq_no;
0320     struct wmi_wmm_params_all_arg wmm_params;
0321     struct list_head list;
0322     union {
0323         struct {
0324             u32 uapsd;
0325         } sta;
0326         struct {
0327             /* 127 stations; wmi limit */
0328             u8 tim_bitmap[16];
0329             u8 tim_len;
0330             u32 ssid_len;
0331             u8 ssid[IEEE80211_MAX_SSID_LEN];
0332             bool hidden_ssid;
0333             /* P2P_IE with NoA attribute for P2P_GO case */
0334             u32 noa_len;
0335             u8 *noa_data;
0336         } ap;
0337     } u;
0338 
0339     bool is_started;
0340     bool is_up;
0341     bool spectral_enabled;
0342     bool ps;
0343     u32 aid;
0344     u8 bssid[ETH_ALEN];
0345     struct cfg80211_bitrate_mask bitrate_mask;
0346     struct delayed_work connection_loss_work;
0347     int num_legacy_stations;
0348     int rtscts_prot_mode;
0349     int txpower;
0350     bool rsnie_present;
0351     bool wpaie_present;
0352     bool bcca_zero_sent;
0353     bool do_not_send_tmpl;
0354     struct ieee80211_chanctx_conf chanctx;
0355     struct ath11k_arp_ns_offload arp_ns_offload;
0356     struct ath11k_rekey_data rekey_data;
0357 
0358 #ifdef CONFIG_ATH11K_DEBUGFS
0359     struct dentry *debugfs_twt;
0360 #endif /* CONFIG_ATH11K_DEBUGFS */
0361 };
0362 
0363 struct ath11k_vif_iter {
0364     u32 vdev_id;
0365     struct ath11k_vif *arvif;
0366 };
0367 
0368 struct ath11k_rx_peer_stats {
0369     u64 num_msdu;
0370     u64 num_mpdu_fcs_ok;
0371     u64 num_mpdu_fcs_err;
0372     u64 tcp_msdu_count;
0373     u64 udp_msdu_count;
0374     u64 other_msdu_count;
0375     u64 ampdu_msdu_count;
0376     u64 non_ampdu_msdu_count;
0377     u64 stbc_count;
0378     u64 beamformed_count;
0379     u64 mcs_count[HAL_RX_MAX_MCS + 1];
0380     u64 nss_count[HAL_RX_MAX_NSS];
0381     u64 bw_count[HAL_RX_BW_MAX];
0382     u64 gi_count[HAL_RX_GI_MAX];
0383     u64 coding_count[HAL_RX_SU_MU_CODING_MAX];
0384     u64 tid_count[IEEE80211_NUM_TIDS + 1];
0385     u64 pream_cnt[HAL_RX_PREAMBLE_MAX];
0386     u64 reception_type[HAL_RX_RECEPTION_TYPE_MAX];
0387     u64 rx_duration;
0388     u64 dcm_count;
0389     u64 ru_alloc_cnt[HAL_RX_RU_ALLOC_TYPE_MAX];
0390 };
0391 
0392 #define ATH11K_HE_MCS_NUM       12
0393 #define ATH11K_VHT_MCS_NUM      10
0394 #define ATH11K_BW_NUM           4
0395 #define ATH11K_NSS_NUM          4
0396 #define ATH11K_LEGACY_NUM       12
0397 #define ATH11K_GI_NUM           4
0398 #define ATH11K_HT_MCS_NUM       32
0399 
0400 enum ath11k_pkt_rx_err {
0401     ATH11K_PKT_RX_ERR_FCS,
0402     ATH11K_PKT_RX_ERR_TKIP,
0403     ATH11K_PKT_RX_ERR_CRYPT,
0404     ATH11K_PKT_RX_ERR_PEER_IDX_INVAL,
0405     ATH11K_PKT_RX_ERR_MAX,
0406 };
0407 
0408 enum ath11k_ampdu_subfrm_num {
0409     ATH11K_AMPDU_SUBFRM_NUM_10,
0410     ATH11K_AMPDU_SUBFRM_NUM_20,
0411     ATH11K_AMPDU_SUBFRM_NUM_30,
0412     ATH11K_AMPDU_SUBFRM_NUM_40,
0413     ATH11K_AMPDU_SUBFRM_NUM_50,
0414     ATH11K_AMPDU_SUBFRM_NUM_60,
0415     ATH11K_AMPDU_SUBFRM_NUM_MORE,
0416     ATH11K_AMPDU_SUBFRM_NUM_MAX,
0417 };
0418 
0419 enum ath11k_amsdu_subfrm_num {
0420     ATH11K_AMSDU_SUBFRM_NUM_1,
0421     ATH11K_AMSDU_SUBFRM_NUM_2,
0422     ATH11K_AMSDU_SUBFRM_NUM_3,
0423     ATH11K_AMSDU_SUBFRM_NUM_4,
0424     ATH11K_AMSDU_SUBFRM_NUM_MORE,
0425     ATH11K_AMSDU_SUBFRM_NUM_MAX,
0426 };
0427 
0428 enum ath11k_counter_type {
0429     ATH11K_COUNTER_TYPE_BYTES,
0430     ATH11K_COUNTER_TYPE_PKTS,
0431     ATH11K_COUNTER_TYPE_MAX,
0432 };
0433 
0434 enum ath11k_stats_type {
0435     ATH11K_STATS_TYPE_SUCC,
0436     ATH11K_STATS_TYPE_FAIL,
0437     ATH11K_STATS_TYPE_RETRY,
0438     ATH11K_STATS_TYPE_AMPDU,
0439     ATH11K_STATS_TYPE_MAX,
0440 };
0441 
0442 struct ath11k_htt_data_stats {
0443     u64 legacy[ATH11K_COUNTER_TYPE_MAX][ATH11K_LEGACY_NUM];
0444     u64 ht[ATH11K_COUNTER_TYPE_MAX][ATH11K_HT_MCS_NUM];
0445     u64 vht[ATH11K_COUNTER_TYPE_MAX][ATH11K_VHT_MCS_NUM];
0446     u64 he[ATH11K_COUNTER_TYPE_MAX][ATH11K_HE_MCS_NUM];
0447     u64 bw[ATH11K_COUNTER_TYPE_MAX][ATH11K_BW_NUM];
0448     u64 nss[ATH11K_COUNTER_TYPE_MAX][ATH11K_NSS_NUM];
0449     u64 gi[ATH11K_COUNTER_TYPE_MAX][ATH11K_GI_NUM];
0450 };
0451 
0452 struct ath11k_htt_tx_stats {
0453     struct ath11k_htt_data_stats stats[ATH11K_STATS_TYPE_MAX];
0454     u64 tx_duration;
0455     u64 ba_fails;
0456     u64 ack_fails;
0457 };
0458 
0459 struct ath11k_per_ppdu_tx_stats {
0460     u16 succ_pkts;
0461     u16 failed_pkts;
0462     u16 retry_pkts;
0463     u32 succ_bytes;
0464     u32 failed_bytes;
0465     u32 retry_bytes;
0466 };
0467 
0468 DECLARE_EWMA(avg_rssi, 10, 8)
0469 
0470 struct ath11k_sta {
0471     struct ath11k_vif *arvif;
0472 
0473     /* the following are protected by ar->data_lock */
0474     u32 changed; /* IEEE80211_RC_* */
0475     u32 bw;
0476     u32 nss;
0477     u32 smps;
0478     enum hal_pn_type pn_type;
0479 
0480     struct work_struct update_wk;
0481     struct work_struct set_4addr_wk;
0482     struct rate_info txrate;
0483     u32 peer_nss;
0484     struct rate_info last_txrate;
0485     u64 rx_duration;
0486     u64 tx_duration;
0487     u8 rssi_comb;
0488     struct ewma_avg_rssi avg_rssi;
0489     s8 rssi_beacon;
0490     s8 chain_signal[IEEE80211_MAX_CHAINS];
0491     struct ath11k_htt_tx_stats *tx_stats;
0492     struct ath11k_rx_peer_stats *rx_stats;
0493 
0494 #ifdef CONFIG_MAC80211_DEBUGFS
0495     /* protected by conf_mutex */
0496     bool aggr_mode;
0497 #endif
0498 
0499     bool use_4addr_set;
0500     u16 tcl_metadata;
0501 };
0502 
0503 #define ATH11K_MIN_5G_FREQ 4150
0504 #define ATH11K_MIN_6G_FREQ 5925
0505 #define ATH11K_MAX_6G_FREQ 7115
0506 #define ATH11K_NUM_CHANS 101
0507 #define ATH11K_MAX_5G_CHAN 173
0508 
0509 enum ath11k_state {
0510     ATH11K_STATE_OFF,
0511     ATH11K_STATE_ON,
0512     ATH11K_STATE_RESTARTING,
0513     ATH11K_STATE_RESTARTED,
0514     ATH11K_STATE_WEDGED,
0515     /* Add other states as required */
0516 };
0517 
0518 /* Antenna noise floor */
0519 #define ATH11K_DEFAULT_NOISE_FLOOR -95
0520 
0521 #define ATH11K_INVALID_RSSI_FULL -1
0522 
0523 #define ATH11K_INVALID_RSSI_EMPTY -128
0524 
0525 struct ath11k_fw_stats {
0526     struct dentry *debugfs_fwstats;
0527     u32 pdev_id;
0528     u32 stats_id;
0529     struct list_head pdevs;
0530     struct list_head vdevs;
0531     struct list_head bcn;
0532 };
0533 
0534 struct ath11k_dbg_htt_stats {
0535     u8 type;
0536     u8 reset;
0537     struct debug_htt_stats_req *stats_req;
0538     /* protects shared stats req buffer */
0539     spinlock_t lock;
0540 };
0541 
0542 #define MAX_MODULE_ID_BITMAP_WORDS  16
0543 
0544 struct ath11k_debug {
0545     struct dentry *debugfs_pdev;
0546     struct ath11k_dbg_htt_stats htt_stats;
0547     u32 extd_tx_stats;
0548     struct ath11k_fw_stats fw_stats;
0549     struct completion fw_stats_complete;
0550     bool fw_stats_done;
0551     u32 extd_rx_stats;
0552     u32 pktlog_filter;
0553     u32 pktlog_mode;
0554     u32 pktlog_peer_valid;
0555     u8 pktlog_peer_addr[ETH_ALEN];
0556     u32 rx_filter;
0557     u32 mem_offset;
0558     u32 module_id_bitmap[MAX_MODULE_ID_BITMAP_WORDS];
0559     struct ath11k_debug_dbr *dbr_debug[WMI_DIRECT_BUF_MAX];
0560 };
0561 
0562 struct ath11k_per_peer_tx_stats {
0563     u32 succ_bytes;
0564     u32 retry_bytes;
0565     u32 failed_bytes;
0566     u16 succ_pkts;
0567     u16 retry_pkts;
0568     u16 failed_pkts;
0569     u32 duration;
0570     u8 ba_fails;
0571     bool is_ampdu;
0572 };
0573 
0574 #define ATH11K_FLUSH_TIMEOUT (5 * HZ)
0575 #define ATH11K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ)
0576 
0577 struct ath11k {
0578     struct ath11k_base *ab;
0579     struct ath11k_pdev *pdev;
0580     struct ieee80211_hw *hw;
0581     struct ieee80211_ops *ops;
0582     struct ath11k_pdev_wmi *wmi;
0583     struct ath11k_pdev_dp dp;
0584     u8 mac_addr[ETH_ALEN];
0585     struct ath11k_he ar_he;
0586     enum ath11k_state state;
0587     bool supports_6ghz;
0588     struct {
0589         struct completion started;
0590         struct completion completed;
0591         struct completion on_channel;
0592         struct delayed_work timeout;
0593         enum ath11k_scan_state state;
0594         bool is_roc;
0595         int vdev_id;
0596         int roc_freq;
0597         bool roc_notify;
0598     } scan;
0599 
0600     struct {
0601         struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
0602         struct ieee80211_sband_iftype_data
0603             iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];
0604     } mac;
0605 
0606     unsigned long dev_flags;
0607     unsigned int filter_flags;
0608     unsigned long monitor_flags;
0609     u32 min_tx_power;
0610     u32 max_tx_power;
0611     u32 txpower_limit_2g;
0612     u32 txpower_limit_5g;
0613     u32 txpower_scale;
0614     u32 power_scale;
0615     u32 chan_tx_pwr;
0616     u32 num_stations;
0617     u32 max_num_stations;
0618     /* To synchronize concurrent synchronous mac80211 callback operations,
0619      * concurrent debugfs configuration and concurrent FW statistics events.
0620      */
0621     struct mutex conf_mutex;
0622     /* protects the radio specific data like debug stats, ppdu_stats_info stats,
0623      * vdev_stop_status info, scan data, ath11k_sta info, ath11k_vif info,
0624      * channel context data, survey info, test mode data.
0625      */
0626     spinlock_t data_lock;
0627 
0628     struct list_head arvifs;
0629     /* should never be NULL; needed for regular htt rx */
0630     struct ieee80211_channel *rx_channel;
0631 
0632     /* valid during scan; needed for mgmt rx during scan */
0633     struct ieee80211_channel *scan_channel;
0634 
0635     u8 cfg_tx_chainmask;
0636     u8 cfg_rx_chainmask;
0637     u8 num_rx_chains;
0638     u8 num_tx_chains;
0639     /* pdev_idx starts from 0 whereas pdev->pdev_id starts with 1 */
0640     u8 pdev_idx;
0641     u8 lmac_id;
0642 
0643     struct completion peer_assoc_done;
0644     struct completion peer_delete_done;
0645 
0646     int install_key_status;
0647     struct completion install_key_done;
0648 
0649     int last_wmi_vdev_start_status;
0650     struct completion vdev_setup_done;
0651     struct completion vdev_delete_done;
0652 
0653     int num_peers;
0654     int max_num_peers;
0655     u32 num_started_vdevs;
0656     u32 num_created_vdevs;
0657     unsigned long long allocated_vdev_map;
0658 
0659     struct idr txmgmt_idr;
0660     /* protects txmgmt_idr data */
0661     spinlock_t txmgmt_idr_lock;
0662     atomic_t num_pending_mgmt_tx;
0663     wait_queue_head_t txmgmt_empty_waitq;
0664 
0665     /* cycle count is reported twice for each visited channel during scan.
0666      * access protected by data_lock
0667      */
0668     u32 survey_last_rx_clear_count;
0669     u32 survey_last_cycle_count;
0670 
0671     /* Channel info events are expected to come in pairs without and with
0672      * COMPLETE flag set respectively for each channel visit during scan.
0673      *
0674      * However there are deviations from this rule. This flag is used to
0675      * avoid reporting garbage data.
0676      */
0677     bool ch_info_can_report_survey;
0678     struct survey_info survey[ATH11K_NUM_CHANS];
0679     struct completion bss_survey_done;
0680 
0681     struct work_struct regd_update_work;
0682 
0683     struct work_struct wmi_mgmt_tx_work;
0684     struct sk_buff_head wmi_mgmt_tx_queue;
0685 
0686     struct ath11k_wow wow;
0687     struct completion target_suspend;
0688     bool target_suspend_ack;
0689     struct ath11k_per_peer_tx_stats peer_tx_stats;
0690     struct list_head ppdu_stats_info;
0691     u32 ppdu_stat_list_depth;
0692 
0693     struct ath11k_per_peer_tx_stats cached_stats;
0694     u32 last_ppdu_id;
0695     u32 cached_ppdu_id;
0696     int monitor_vdev_id;
0697 #ifdef CONFIG_ATH11K_DEBUGFS
0698     struct ath11k_debug debug;
0699 #endif
0700 #ifdef CONFIG_ATH11K_SPECTRAL
0701     struct ath11k_spectral spectral;
0702 #endif
0703     bool dfs_block_radar_events;
0704     struct ath11k_thermal thermal;
0705     u32 vdev_id_11d_scan;
0706     struct completion completed_11d_scan;
0707     enum ath11k_11d_state state_11d;
0708     bool regdom_set_by_user;
0709     int hw_rate_code;
0710     u8 twt_enabled;
0711     bool nlo_enabled;
0712     u8 alpha2[REG_ALPHA2_LEN + 1];
0713 };
0714 
0715 struct ath11k_band_cap {
0716     u32 phy_id;
0717     u32 max_bw_supported;
0718     u32 ht_cap_info;
0719     u32 he_cap_info[2];
0720     u32 he_mcs;
0721     u32 he_cap_phy_info[PSOC_HOST_MAX_PHY_SIZE];
0722     struct ath11k_ppe_threshold he_ppet;
0723     u16 he_6ghz_capa;
0724 };
0725 
0726 struct ath11k_pdev_cap {
0727     u32 supported_bands;
0728     u32 ampdu_density;
0729     u32 vht_cap;
0730     u32 vht_mcs;
0731     u32 he_mcs;
0732     u32 tx_chain_mask;
0733     u32 rx_chain_mask;
0734     u32 tx_chain_mask_shift;
0735     u32 rx_chain_mask_shift;
0736     struct ath11k_band_cap band[NUM_NL80211_BANDS];
0737     bool nss_ratio_enabled;
0738     u8 nss_ratio_info;
0739 };
0740 
0741 struct ath11k_pdev {
0742     struct ath11k *ar;
0743     u32 pdev_id;
0744     struct ath11k_pdev_cap cap;
0745     u8 mac_addr[ETH_ALEN];
0746 };
0747 
0748 struct ath11k_board_data {
0749     const struct firmware *fw;
0750     const void *data;
0751     size_t len;
0752 };
0753 
0754 struct ath11k_pci_ops {
0755     int (*wakeup)(struct ath11k_base *ab);
0756     void (*release)(struct ath11k_base *ab);
0757     int (*get_msi_irq)(struct ath11k_base *ab, unsigned int vector);
0758     void (*window_write32)(struct ath11k_base *ab, u32 offset, u32 value);
0759     u32 (*window_read32)(struct ath11k_base *ab, u32 offset);
0760 };
0761 
0762 /* IPQ8074 HW channel counters frequency value in hertz */
0763 #define IPQ8074_CC_FREQ_HERTZ 320000
0764 
0765 struct ath11k_bp_stats {
0766     /* Head Pointer reported by the last HTT Backpressure event for the ring */
0767     u16 hp;
0768 
0769     /* Tail Pointer reported by the last HTT Backpressure event for the ring */
0770     u16 tp;
0771 
0772     /* Number of Backpressure events received for the ring */
0773     u32 count;
0774 
0775     /* Last recorded event timestamp */
0776     unsigned long jiffies;
0777 };
0778 
0779 struct ath11k_dp_ring_bp_stats {
0780     struct ath11k_bp_stats umac_ring_bp_stats[HTT_SW_UMAC_RING_IDX_MAX];
0781     struct ath11k_bp_stats lmac_ring_bp_stats[HTT_SW_LMAC_RING_IDX_MAX][MAX_RADIOS];
0782 };
0783 
0784 struct ath11k_soc_dp_tx_err_stats {
0785     /* TCL Ring Descriptor unavailable */
0786     u32 desc_na[DP_TCL_NUM_RING_MAX];
0787     /* Other failures during dp_tx due to mem allocation failure
0788      * idr unavailable etc.
0789      */
0790     atomic_t misc_fail;
0791 };
0792 
0793 struct ath11k_soc_dp_stats {
0794     u32 err_ring_pkts;
0795     u32 invalid_rbm;
0796     u32 rxdma_error[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX];
0797     u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX];
0798     u32 hal_reo_error[DP_REO_DST_RING_MAX];
0799     struct ath11k_soc_dp_tx_err_stats tx_err;
0800     struct ath11k_dp_ring_bp_stats bp_stats;
0801 };
0802 
0803 struct ath11k_msi_user {
0804     char *name;
0805     int num_vectors;
0806     u32 base_vector;
0807 };
0808 
0809 struct ath11k_msi_config {
0810     int total_vectors;
0811     int total_users;
0812     struct ath11k_msi_user *users;
0813     u16 hw_rev;
0814 };
0815 
0816 /* Master structure to hold the hw data which may be used in core module */
0817 struct ath11k_base {
0818     enum ath11k_hw_rev hw_rev;
0819     struct platform_device *pdev;
0820     struct device *dev;
0821     struct ath11k_qmi qmi;
0822     struct ath11k_wmi_base wmi_ab;
0823     struct completion fw_ready;
0824     int num_radios;
0825     /* HW channel counters frequency value in hertz common to all MACs */
0826     u32 cc_freq_hz;
0827 
0828     struct ath11k_htc htc;
0829 
0830     struct ath11k_dp dp;
0831 
0832     void __iomem *mem;
0833     unsigned long mem_len;
0834 
0835     struct {
0836         enum ath11k_bus bus;
0837         const struct ath11k_hif_ops *ops;
0838     } hif;
0839 
0840     struct {
0841         struct completion wakeup_completed;
0842     } wow;
0843 
0844     struct ath11k_ce ce;
0845     struct timer_list rx_replenish_retry;
0846     struct ath11k_hal hal;
0847     /* To synchronize core_start/core_stop */
0848     struct mutex core_lock;
0849     /* Protects data like peers */
0850     spinlock_t base_lock;
0851     struct ath11k_pdev pdevs[MAX_RADIOS];
0852     struct {
0853         enum WMI_HOST_WLAN_BAND supported_bands;
0854         u32 pdev_id;
0855     } target_pdev_ids[MAX_RADIOS];
0856     u8 target_pdev_count;
0857     struct ath11k_pdev __rcu *pdevs_active[MAX_RADIOS];
0858     struct ath11k_hal_reg_capabilities_ext hal_reg_cap[MAX_RADIOS];
0859     unsigned long long free_vdev_map;
0860 
0861     /* To synchronize rhash tbl write operation */
0862     struct mutex tbl_mtx_lock;
0863 
0864     /* The rhashtable containing struct ath11k_peer keyed by mac addr */
0865     struct rhashtable *rhead_peer_addr;
0866     struct rhashtable_params rhash_peer_addr_param;
0867 
0868     /* The rhashtable containing struct ath11k_peer keyed by id  */
0869     struct rhashtable *rhead_peer_id;
0870     struct rhashtable_params rhash_peer_id_param;
0871 
0872     struct list_head peers;
0873     wait_queue_head_t peer_mapping_wq;
0874     u8 mac_addr[ETH_ALEN];
0875     bool wmi_ready;
0876     u32 wlan_init_status;
0877     int irq_num[ATH11K_IRQ_NUM_MAX];
0878     struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX];
0879     struct ath11k_targ_cap target_caps;
0880     u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE];
0881     bool pdevs_macaddr_valid;
0882     int bd_api;
0883 
0884     struct ath11k_hw_params hw_params;
0885 
0886     const struct firmware *cal_file;
0887 
0888     /* Below regd's are protected by ab->data_lock */
0889     /* This is the regd set for every radio
0890      * by the firmware during initializatin
0891      */
0892     struct ieee80211_regdomain *default_regd[MAX_RADIOS];
0893     /* This regd is set during dynamic country setting
0894      * This may or may not be used during the runtime
0895      */
0896     struct ieee80211_regdomain *new_regd[MAX_RADIOS];
0897 
0898     /* Current DFS Regulatory */
0899     enum ath11k_dfs_region dfs_region;
0900 #ifdef CONFIG_ATH11K_DEBUGFS
0901     struct dentry *debugfs_soc;
0902     struct dentry *debugfs_ath11k;
0903 #endif
0904     struct ath11k_soc_dp_stats soc_stats;
0905 
0906     unsigned long dev_flags;
0907     struct completion driver_recovery;
0908     struct workqueue_struct *workqueue;
0909     struct work_struct restart_work;
0910     struct work_struct update_11d_work;
0911     u8 new_alpha2[3];
0912     struct workqueue_struct *workqueue_aux;
0913     struct work_struct reset_work;
0914     atomic_t reset_count;
0915     atomic_t recovery_count;
0916     atomic_t recovery_start_count;
0917     bool is_reset;
0918     struct completion reset_complete;
0919     struct completion reconfigure_complete;
0920     struct completion recovery_start;
0921     /* continuous recovery fail count */
0922     atomic_t fail_cont_count;
0923     unsigned long reset_fail_timeout;
0924     struct {
0925         /* protected by data_lock */
0926         u32 fw_crash_counter;
0927     } stats;
0928     u32 pktlog_defs_checksum;
0929 
0930     struct ath11k_dbring_cap *db_caps;
0931     u32 num_db_cap;
0932 
0933     /* To synchronize 11d scan vdev id */
0934     struct mutex vdev_id_11d_lock;
0935     struct timer_list mon_reap_timer;
0936 
0937     struct completion htc_suspend;
0938 
0939     struct {
0940         enum ath11k_bdf_search bdf_search;
0941         u32 vendor;
0942         u32 device;
0943         u32 subsystem_vendor;
0944         u32 subsystem_device;
0945     } id;
0946 
0947     struct {
0948         struct {
0949             const struct ath11k_msi_config *config;
0950             u32 ep_base_data;
0951             u32 irqs[32];
0952             u32 addr_lo;
0953             u32 addr_hi;
0954         } msi;
0955 
0956         const struct ath11k_pci_ops *ops;
0957     } pci;
0958 
0959     /* must be last */
0960     u8 drv_priv[] __aligned(sizeof(void *));
0961 };
0962 
0963 struct ath11k_fw_stats_pdev {
0964     struct list_head list;
0965 
0966     /* PDEV stats */
0967     s32 ch_noise_floor;
0968     /* Cycles spent transmitting frames */
0969     u32 tx_frame_count;
0970     /* Cycles spent receiving frames */
0971     u32 rx_frame_count;
0972     /* Total channel busy time, evidently */
0973     u32 rx_clear_count;
0974     /* Total on-channel time */
0975     u32 cycle_count;
0976     u32 phy_err_count;
0977     u32 chan_tx_power;
0978     u32 ack_rx_bad;
0979     u32 rts_bad;
0980     u32 rts_good;
0981     u32 fcs_bad;
0982     u32 no_beacons;
0983     u32 mib_int_count;
0984 
0985     /* PDEV TX stats */
0986     /* Num HTT cookies queued to dispatch list */
0987     s32 comp_queued;
0988     /* Num HTT cookies dispatched */
0989     s32 comp_delivered;
0990     /* Num MSDU queued to WAL */
0991     s32 msdu_enqued;
0992     /* Num MPDU queue to WAL */
0993     s32 mpdu_enqued;
0994     /* Num MSDUs dropped by WMM limit */
0995     s32 wmm_drop;
0996     /* Num Local frames queued */
0997     s32 local_enqued;
0998     /* Num Local frames done */
0999     s32 local_freed;
1000     /* Num queued to HW */
1001     s32 hw_queued;
1002     /* Num PPDU reaped from HW */
1003     s32 hw_reaped;
1004     /* Num underruns */
1005     s32 underrun;
1006     /* Num hw paused */
1007     u32 hw_paused;
1008     /* Num PPDUs cleaned up in TX abort */
1009     s32 tx_abort;
1010     /* Num MPDUs requeued by SW */
1011     s32 mpdus_requeued;
1012     /* excessive retries */
1013     u32 tx_ko;
1014     u32 tx_xretry;
1015     /* data hw rate code */
1016     u32 data_rc;
1017     /* Scheduler self triggers */
1018     u32 self_triggers;
1019     /* frames dropped due to excessive sw retries */
1020     u32 sw_retry_failure;
1021     /* illegal rate phy errors  */
1022     u32 illgl_rate_phy_err;
1023     /* wal pdev continuous xretry */
1024     u32 pdev_cont_xretry;
1025     /* wal pdev tx timeouts */
1026     u32 pdev_tx_timeout;
1027     /* wal pdev resets */
1028     u32 pdev_resets;
1029     /* frames dropped due to non-availability of stateless TIDs */
1030     u32 stateless_tid_alloc_failure;
1031     /* PhY/BB underrun */
1032     u32 phy_underrun;
1033     /* MPDU is more than txop limit */
1034     u32 txop_ovf;
1035     /* Num sequences posted */
1036     u32 seq_posted;
1037     /* Num sequences failed in queueing */
1038     u32 seq_failed_queueing;
1039     /* Num sequences completed */
1040     u32 seq_completed;
1041     /* Num sequences restarted */
1042     u32 seq_restarted;
1043     /* Num of MU sequences posted */
1044     u32 mu_seq_posted;
1045     /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT
1046      * (Reset,channel change)
1047      */
1048     s32 mpdus_sw_flush;
1049     /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
1050     s32 mpdus_hw_filter;
1051     /* Num MPDUs truncated by PDG (TXOP, TBTT,
1052      * PPDU_duration based on rate, dyn_bw)
1053      */
1054     s32 mpdus_truncated;
1055     /* Num MPDUs that was tried but didn't receive ACK or BA */
1056     s32 mpdus_ack_failed;
1057     /* Num MPDUs that was dropped du to expiry. */
1058     s32 mpdus_expired;
1059 
1060     /* PDEV RX stats */
1061     /* Cnts any change in ring routing mid-ppdu */
1062     s32 mid_ppdu_route_change;
1063     /* Total number of statuses processed */
1064     s32 status_rcvd;
1065     /* Extra frags on rings 0-3 */
1066     s32 r0_frags;
1067     s32 r1_frags;
1068     s32 r2_frags;
1069     s32 r3_frags;
1070     /* MSDUs / MPDUs delivered to HTT */
1071     s32 htt_msdus;
1072     s32 htt_mpdus;
1073     /* MSDUs / MPDUs delivered to local stack */
1074     s32 loc_msdus;
1075     s32 loc_mpdus;
1076     /* AMSDUs that have more MSDUs than the status ring size */
1077     s32 oversize_amsdu;
1078     /* Number of PHY errors */
1079     s32 phy_errs;
1080     /* Number of PHY errors drops */
1081     s32 phy_err_drop;
1082     /* Number of mpdu errors - FCS, MIC, ENC etc. */
1083     s32 mpdu_errs;
1084     /* Num overflow errors */
1085     s32 rx_ovfl_errs;
1086 };
1087 
1088 struct ath11k_fw_stats_vdev {
1089     struct list_head list;
1090 
1091     u32 vdev_id;
1092     u32 beacon_snr;
1093     u32 data_snr;
1094     u32 num_tx_frames[WLAN_MAX_AC];
1095     u32 num_rx_frames;
1096     u32 num_tx_frames_retries[WLAN_MAX_AC];
1097     u32 num_tx_frames_failures[WLAN_MAX_AC];
1098     u32 num_rts_fail;
1099     u32 num_rts_success;
1100     u32 num_rx_err;
1101     u32 num_rx_discard;
1102     u32 num_tx_not_acked;
1103     u32 tx_rate_history[MAX_TX_RATE_VALUES];
1104     u32 beacon_rssi_history[MAX_TX_RATE_VALUES];
1105 };
1106 
1107 struct ath11k_fw_stats_bcn {
1108     struct list_head list;
1109 
1110     u32 vdev_id;
1111     u32 tx_bcn_succ_cnt;
1112     u32 tx_bcn_outage_cnt;
1113 };
1114 
1115 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq8074[];
1116 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq8074[];
1117 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq6018[];
1118 
1119 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[];
1120 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[];
1121 
1122 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qcn9074[];
1123 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qcn9074[];
1124 int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab);
1125 int ath11k_core_pre_init(struct ath11k_base *ab);
1126 int ath11k_core_init(struct ath11k_base *ath11k);
1127 void ath11k_core_deinit(struct ath11k_base *ath11k);
1128 struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
1129                       enum ath11k_bus bus);
1130 void ath11k_core_free(struct ath11k_base *ath11k);
1131 int ath11k_core_fetch_bdf(struct ath11k_base *ath11k,
1132               struct ath11k_board_data *bd);
1133 int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd);
1134 int ath11k_core_fetch_board_data_api_1(struct ath11k_base *ab,
1135                        struct ath11k_board_data *bd,
1136                        const char *name);
1137 void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd);
1138 int ath11k_core_check_dt(struct ath11k_base *ath11k);
1139 int ath11k_core_check_smbios(struct ath11k_base *ab);
1140 void ath11k_core_halt(struct ath11k *ar);
1141 int ath11k_core_resume(struct ath11k_base *ab);
1142 int ath11k_core_suspend(struct ath11k_base *ab);
1143 
1144 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
1145                             const char *filename);
1146 
1147 static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state)
1148 {
1149     switch (state) {
1150     case ATH11K_SCAN_IDLE:
1151         return "idle";
1152     case ATH11K_SCAN_STARTING:
1153         return "starting";
1154     case ATH11K_SCAN_RUNNING:
1155         return "running";
1156     case ATH11K_SCAN_ABORTING:
1157         return "aborting";
1158     }
1159 
1160     return "unknown";
1161 }
1162 
1163 static inline struct ath11k_skb_cb *ATH11K_SKB_CB(struct sk_buff *skb)
1164 {
1165     BUILD_BUG_ON(sizeof(struct ath11k_skb_cb) >
1166              IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
1167     return (struct ath11k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data;
1168 }
1169 
1170 static inline struct ath11k_skb_rxcb *ATH11K_SKB_RXCB(struct sk_buff *skb)
1171 {
1172     BUILD_BUG_ON(sizeof(struct ath11k_skb_rxcb) > sizeof(skb->cb));
1173     return (struct ath11k_skb_rxcb *)skb->cb;
1174 }
1175 
1176 static inline struct ath11k_vif *ath11k_vif_to_arvif(struct ieee80211_vif *vif)
1177 {
1178     return (struct ath11k_vif *)vif->drv_priv;
1179 }
1180 
1181 static inline struct ath11k *ath11k_ab_to_ar(struct ath11k_base *ab,
1182                          int mac_id)
1183 {
1184     return ab->pdevs[ath11k_hw_mac_id_to_pdev_id(&ab->hw_params, mac_id)].ar;
1185 }
1186 
1187 static inline void ath11k_core_create_firmware_path(struct ath11k_base *ab,
1188                             const char *filename,
1189                             void *buf, size_t buf_len)
1190 {
1191     snprintf(buf, buf_len, "%s/%s/%s", ATH11K_FW_DIR,
1192          ab->hw_params.fw.dir, filename);
1193 }
1194 
1195 static inline const char *ath11k_bus_str(enum ath11k_bus bus)
1196 {
1197     switch (bus) {
1198     case ATH11K_BUS_PCI:
1199         return "pci";
1200     case ATH11K_BUS_AHB:
1201         return "ahb";
1202     }
1203 
1204     return "unknown";
1205 }
1206 
1207 #endif /* _CORE_H_ */