1 /* 2 * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #if !defined(WLAN_HDD_MAIN_H) 20 #define WLAN_HDD_MAIN_H 21 /** 22 * DOC: wlan_hdd_main.h 23 * 24 * Linux HDD Adapter Type 25 */ 26 27 /* 28 * The following terms were in use in prior versions of the driver but 29 * have now been replaced with terms that are aligned with the Linux 30 * Coding style. Macros are defined to hopefully prevent new instances 31 * from being introduced, primarily by code propagation. 32 */ 33 #define pHddCtx 34 #define pAdapter 35 #define pHostapdAdapter 36 #define pHddApCtx 37 #define pHddStaCtx 38 #define pHostapdState 39 #define pRoamInfo 40 #define pScanInfo 41 #define pBeaconIes 42 43 /* 44 * Include files 45 */ 46 47 #include <linux/netdevice.h> 48 #include <linux/skbuff.h> 49 #include <net/cfg80211.h> 50 #ifdef CLD_PM_QOS 51 #include <linux/pm_qos.h> 52 #endif 53 #include <linux/ieee80211.h> 54 #include <qdf_delayed_work.h> 55 #include <qdf_list.h> 56 #include <qdf_types.h> 57 #include "sir_mac_prot_def.h" 58 #include "csr_api.h" 59 #include "wlan_dsc.h" 60 #include <wlan_hdd_assoc.h> 61 #include <wlan_hdd_wmm.h> 62 #include <wlan_hdd_cfg.h> 63 #include <linux/spinlock.h> 64 #include <ani_system_defs.h> 65 #if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK) 66 #include <linux/wakelock.h> 67 #endif 68 #ifdef WLAN_FEATURE_TSF_PTP 69 #include <linux/ptp_classify.h> 70 #include <linux/ptp_clock_kernel.h> 71 #endif 72 #include <wlan_hdd_ftm.h> 73 #include "wlan_hdd_tdls.h" 74 #include "wlan_hdd_tsf.h" 75 #include "wlan_hdd_cfg80211.h" 76 #include "wlan_hdd_debugfs.h" 77 #include <qdf_defer.h> 78 #include "sap_api.h" 79 #include <wlan_hdd_lro.h> 80 #include "cdp_txrx_flow_ctrl_legacy.h" 81 #include <cdp_txrx_peer_ops.h> 82 #include "wlan_hdd_nan_datapath.h" 83 #if defined(CONFIG_HL_SUPPORT) 84 #include "wlan_tgt_def_config_hl.h" 85 #else 86 #include "wlan_tgt_def_config.h" 87 #endif 88 #include <wlan_objmgr_cmn.h> 89 #include <wlan_objmgr_global_obj.h> 90 #include <wlan_objmgr_psoc_obj.h> 91 #include <wlan_objmgr_pdev_obj.h> 92 #include <wlan_objmgr_vdev_obj.h> 93 #include <wlan_objmgr_peer_obj.h> 94 #include "wlan_pmo_ucfg_api.h" 95 #ifdef WIFI_POS_CONVERGED 96 #include "os_if_wifi_pos.h" 97 #include "wifi_pos_api.h" 98 #else 99 #include "wlan_hdd_oemdata.h" 100 #endif 101 #include "wlan_hdd_he.h" 102 103 #include <net/neighbour.h> 104 #include <net/netevent.h> 105 #include "wlan_hdd_nud_tracking.h" 106 #include "wlan_hdd_twt.h" 107 #include "wma_sar_public_structs.h" 108 #include "wlan_mlme_ucfg_api.h" 109 #include "pld_common.h" 110 111 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH 112 #include "qdf_periodic_work.h" 113 #endif 114 115 /* 116 * Preprocessor definitions and constants 117 */ 118 119 #ifdef FEATURE_WLAN_APF 120 /** 121 * struct hdd_apf_context - hdd Context for apf 122 * @magic: magic number 123 * @qdf_apf_event: Completion variable for APF get operations 124 * @capability_response: capabilities response received from fw 125 * @apf_enabled: True: APF Interpreter enabled, False: Disabled 126 * @cmd_in_progress: Flag that indicates an APF command is in progress 127 * @buf: Buffer to accumulate read memory chunks 128 * @buf_len: Length of the read memory requested 129 * @offset: APF work memory offset to fetch from 130 * @lock: APF Context lock 131 */ 132 struct hdd_apf_context { 133 unsigned int magic; 134 qdf_event_t qdf_apf_event; 135 bool apf_enabled; 136 bool cmd_in_progress; 137 uint8_t *buf; 138 uint32_t buf_len; 139 uint32_t offset; 140 qdf_spinlock_t lock; 141 }; 142 #endif /* FEATURE_WLAN_APF */ 143 144 /** Number of Tx Queues */ 145 #if defined(QCA_LL_TX_FLOW_CONTROL_V2) || \ 146 defined(QCA_HL_NETDEV_FLOW_CONTROL) || \ 147 defined(QCA_LL_PDEV_TX_FLOW_CONTROL) 148 #define NUM_TX_QUEUES 5 149 #else 150 #define NUM_TX_QUEUES 4 151 #endif 152 153 /* 154 * API in_compat_syscall() is introduced in 4.6 kernel to check whether we're 155 * in a compat syscall or not. It is a new way to query the syscall type, which 156 * works properly on all architectures. 157 * 158 */ 159 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) 160 static inline bool in_compat_syscall(void) { return is_compat_task(); } 161 #endif 162 163 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \ 164 defined(CFG80211_REMOVE_IEEE80211_BACKPORT) 165 #define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ 166 #define HDD_NL80211_BAND_5GHZ NL80211_BAND_5GHZ 167 #define HDD_NUM_NL80211_BANDS NUM_NL80211_BANDS 168 #else 169 #define HDD_NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ 170 #define HDD_NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ 171 #define HDD_NUM_NL80211_BANDS ((enum nl80211_band)IEEE80211_NUM_BANDS) 172 #endif 173 174 #if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ 175 (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) 176 #define HDD_NL80211_BAND_6GHZ NL80211_BAND_6GHZ 177 #endif 178 179 #define TSF_GPIO_PIN_INVALID 255 180 181 /** Length of the TX queue for the netdev */ 182 #define HDD_NETDEV_TX_QUEUE_LEN (3000) 183 184 /** Hdd Tx Time out value */ 185 #define HDD_TX_TIMEOUT msecs_to_jiffies(5000) 186 187 #define HDD_TX_STALL_THRESHOLD 4 188 189 /** Hdd Default MTU */ 190 #define HDD_DEFAULT_MTU (1500) 191 192 #ifdef QCA_CONFIG_SMP 193 #define NUM_CPUS NR_CPUS 194 #else 195 #define NUM_CPUS 1 196 #endif 197 198 #define HDD_PSOC_IDLE_SHUTDOWN_SUSPEND_DELAY (1000) 199 /** 200 * enum hdd_adapter_flags - event bitmap flags registered net device 201 * @NET_DEVICE_REGISTERED: Adapter is registered with the kernel 202 * @SME_SESSION_OPENED: Firmware vdev has been created 203 * @INIT_TX_RX_SUCCESS: Adapter datapath is initialized 204 * @WMM_INIT_DONE: Adapter is initialized 205 * @SOFTAP_BSS_STARTED: Software Access Point (SAP) is running 206 * @DEVICE_IFACE_OPENED: Adapter has been "opened" via the kernel 207 * @ACS_PENDING: Auto Channel Selection (ACS) is pending 208 * @SOFTAP_INIT_DONE: Software Access Point (SAP) is initialized 209 * @VENDOR_ACS_RESPONSE_PENDING: Waiting for event for vendor acs 210 * @DOWN_DURING_SSR: Mark interface is down during SSR 211 */ 212 enum hdd_adapter_flags { 213 NET_DEVICE_REGISTERED, 214 SME_SESSION_OPENED, 215 INIT_TX_RX_SUCCESS, 216 WMM_INIT_DONE, 217 SOFTAP_BSS_STARTED, 218 DEVICE_IFACE_OPENED, 219 ACS_PENDING, 220 SOFTAP_INIT_DONE, 221 VENDOR_ACS_RESPONSE_PENDING, 222 DOWN_DURING_SSR, 223 }; 224 225 /** 226 * enum hdd_driver_flags - HDD global event bitmap flags 227 * @ACS_IN_PROGRESS: Auto Channel Selection (ACS) in progress 228 */ 229 enum hdd_driver_flags { 230 ACS_IN_PROGRESS, 231 }; 232 233 #define WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS 1000 234 #define WLAN_WAIT_TIME_STOP_ROAM 4000 235 #define WLAN_WAIT_TIME_STATS 800 236 #define WLAN_WAIT_TIME_LINK_STATUS 800 237 238 /** Maximum time(ms) to wait for mc thread suspend **/ 239 #define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200 240 241 /** Maximum time(ms) to wait for target to be ready for suspend **/ 242 #define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000 243 244 /* Scan Req Timeout */ 245 #define WLAN_WAIT_TIME_SCAN_REQ 100 246 247 #define WLAN_WAIT_TIME_APF 1000 248 249 #define WLAN_WAIT_TIME_FW_ROAM_STATS 1000 250 251 #define WLAN_WAIT_TIME_ANTENNA_ISOLATION 8000 252 253 /* Maximum time(ms) to wait for RSO CMD status event */ 254 #define WAIT_TIME_RSO_CMD_STATUS 2000 255 256 /* rcpi request timeout in milli seconds */ 257 #define WLAN_WAIT_TIME_RCPI 500 258 259 #define MAX_CFG_STRING_LEN 255 260 261 /* Maximum time(ms) to wait for external acs response */ 262 #define WLAN_VENDOR_ACS_WAIT_TIME 1000 263 264 /* Mac Address string length */ 265 #define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */ 266 /* Max and min IEs length in bytes */ 267 #define MAX_GENIE_LEN (512) 268 #define MIN_GENIE_LEN (2) 269 270 #define WPS_OUI_TYPE "\x00\x50\xf2\x04" 271 #define WPS_OUI_TYPE_SIZE 4 272 273 #define P2P_OUI_TYPE "\x50\x6f\x9a\x09" 274 #define P2P_OUI_TYPE_SIZE 4 275 276 #define HS20_OUI_TYPE "\x50\x6f\x9a\x10" 277 #define HS20_OUI_TYPE_SIZE 4 278 279 #define OSEN_OUI_TYPE "\x50\x6f\x9a\x12" 280 #define OSEN_OUI_TYPE_SIZE 4 281 282 #ifdef WLAN_FEATURE_WFD 283 #define WFD_OUI_TYPE "\x50\x6f\x9a\x0a" 284 #define WFD_OUI_TYPE_SIZE 4 285 #endif 286 287 #define MBO_OUI_TYPE "\x50\x6f\x9a\x16" 288 #define MBO_OUI_TYPE_SIZE 4 289 290 #define QCN_OUI_TYPE "\x8c\xfd\xf0\x01" 291 #define QCN_OUI_TYPE_SIZE 4 292 293 #define wlan_hdd_get_wps_ie_ptr(ie, ie_len) \ 294 wlan_get_vendor_ie_ptr_from_oui(WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE, \ 295 ie, ie_len) 296 297 #define hdd_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_HDD, params) 298 #define hdd_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_HDD, params) 299 #define hdd_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_HDD, params) 300 #define hdd_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_HDD, params) 301 #define hdd_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_HDD, params) 302 303 #define hdd_nofl_alert(params...) \ 304 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_HDD, params) 305 #define hdd_nofl_err(params...) \ 306 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_HDD, params) 307 #define hdd_nofl_warn(params...) \ 308 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_HDD, params) 309 #define hdd_nofl_info(params...) \ 310 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_HDD, params) 311 #define hdd_nofl_debug(params...) \ 312 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_HDD, params) 313 314 #define hdd_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_HDD, params) 315 #define hdd_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_HDD, params) 316 #define hdd_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_HDD, params) 317 #define hdd_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_HDD, params) 318 #define hdd_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_HDD, params) 319 320 #define hdd_enter() QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter") 321 #define hdd_enter_dev(dev) \ 322 QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter(%s)", (dev)->name) 323 #define hdd_exit() QDF_TRACE_EXIT(QDF_MODULE_ID_HDD, "exit") 324 325 #define WLAN_HDD_GET_PRIV_PTR(__dev__) \ 326 (struct hdd_adapter *)(netdev_priv((__dev__))) 327 328 #define MAX_NO_OF_2_4_CHANNELS 14 329 330 #define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24 331 332 #define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \ 333 (((center_freq) == 2412) || ((center_freq) == 2437) || \ 334 ((center_freq) == 2462)) 335 336 #define WLAN_HDD_QOS_ACTION_FRAME 1 337 #define WLAN_HDD_QOS_MAP_CONFIGURE 4 338 #define HDD_SAP_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED 339 340 /* SAP client disconnect wake lock duration in milli seconds */ 341 #define HDD_SAP_CLIENT_DISCONNECT_WAKE_LOCK_DURATION \ 342 WAKELOCK_DURATION_RECOMMENDED 343 344 #define HDD_CFG_REQUEST_FIRMWARE_RETRIES (3) 345 #define HDD_CFG_REQUEST_FIRMWARE_DELAY (20) 346 347 #define MAX_USER_COMMAND_SIZE 4096 348 #define DNS_DOMAIN_NAME_MAX_LEN 255 349 #define ICMPv6_ADDR_LEN 16 350 351 352 #define HDD_MIN_TX_POWER (-100) /* minimum tx power */ 353 #define HDD_MAX_TX_POWER (+100) /* maximum tx power */ 354 355 /* If IPA UC data path is enabled, target should reserve extra tx descriptors 356 * for IPA data path. 357 * Then host data path should allow less TX packet pumping in case 358 * IPA data path enabled 359 */ 360 #define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100 361 362 /* 363 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro 364 * here if the Kernel version is less than 3.17 to avoid the interleave 365 * conditional compilation. 366 */ 367 #if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) ||\ 368 defined(WITH_BACKPORTS)) 369 #define NET_NAME_UNKNOWN 0 370 #endif 371 372 #define PRE_CAC_SSID "pre_cac_ssid" 373 374 #define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */ 375 #define SCAN_REJECT_THRESHOLD 15 376 377 /* Default Psoc id */ 378 #define DEFAULT_PSOC_ID 1 379 380 /* wait time for nud stats in milliseconds */ 381 #define WLAN_WAIT_TIME_NUD_STATS 800 382 /* nud stats skb max length */ 383 #define WLAN_NUD_STATS_LEN 800 384 /* ARP packet type for NUD debug stats */ 385 #define WLAN_NUD_STATS_ARP_PKT_TYPE 1 386 /* Assigned size of driver memory dump is 4096 bytes */ 387 #define DRIVER_MEM_DUMP_SIZE 4096 388 389 /* MAX OS Q block time value in msec 390 * Prevent from permanent stall, resume OS Q if timer expired 391 */ 392 #define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000 393 #define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100 394 #define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14 395 396 #ifndef NUM_TX_RX_HISTOGRAM 397 #define NUM_TX_RX_HISTOGRAM 128 398 #endif 399 400 #define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1) 401 402 /** 403 * enum hdd_auth_key_mgmt - auth key mgmt protocols 404 * @HDD_AUTH_KEY_MGMT_802_1X: 802.1x 405 * @HDD_AUTH_KEY_MGMT_PSK: PSK 406 * @HDD_AUTH_KEY_MGMT_CCKM: CCKM 407 */ 408 enum hdd_auth_key_mgmt { 409 HDD_AUTH_KEY_MGMT_802_1X = BIT(0), 410 HDD_AUTH_KEY_MGMT_PSK = BIT(1), 411 HDD_AUTH_KEY_MGMT_CCKM = BIT(2) 412 }; 413 414 /** 415 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets 416 * received over 100ms intervals 417 * @interval_rx: # of rx packets received in the last 100ms interval 418 * @interval_tx: # of tx packets received in the last 100ms interval 419 * @next_vote_level: pld_bus_width_type voting level (high or low) 420 * determined on the basis of total tx and rx packets 421 * received in the last 100ms interval 422 * @next_rx_level: pld_bus_width_type voting level (high or low) 423 * determined on the basis of rx packets received in the 424 * last 100ms interval 425 * @next_tx_level: pld_bus_width_type voting level (high or low) 426 * determined on the basis of tx packets received in the 427 * last 100ms interval 428 * @is_rx_pm_qos_high Capture rx_pm_qos voting 429 * @is_tx_pm_qos_high Capture tx_pm_qos voting 430 * @qtime timestamp when the record is added 431 * 432 * The structure keeps track of throughput requirements of wlan driver. 433 * An entry is added if either of next_vote_level, next_rx_level or 434 * next_tx_level changes. An entry is not added for every 100ms interval. 435 */ 436 struct hdd_tx_rx_histogram { 437 uint64_t interval_rx; 438 uint64_t interval_tx; 439 uint32_t next_vote_level; 440 uint32_t next_rx_level; 441 uint32_t next_tx_level; 442 bool is_rx_pm_qos_high; 443 bool is_tx_pm_qos_high; 444 uint64_t qtime; 445 }; 446 447 struct hdd_tx_rx_stats { 448 /* start_xmit stats */ 449 __u32 tx_called; 450 __u32 tx_dropped; 451 __u32 tx_orphaned; 452 __u32 tx_classified_ac[NUM_TX_QUEUES]; 453 __u32 tx_dropped_ac[NUM_TX_QUEUES]; 454 455 /* rx stats */ 456 __u32 rx_packets[NUM_CPUS]; 457 __u32 rx_dropped[NUM_CPUS]; 458 __u32 rx_delivered[NUM_CPUS]; 459 __u32 rx_refused[NUM_CPUS]; 460 qdf_atomic_t rx_usolict_arp_n_mcast_drp; 461 462 /* rx gro */ 463 __u32 rx_aggregated; 464 __u32 rx_gro_dropped; 465 __u32 rx_non_aggregated; 466 __u32 rx_gro_flush_skip; 467 __u32 rx_gro_low_tput_flush; 468 469 /* txflow stats */ 470 bool is_txflow_paused; 471 __u32 txflow_pause_cnt; 472 __u32 txflow_unpause_cnt; 473 __u32 txflow_timer_cnt; 474 475 /*tx timeout stats*/ 476 __u32 tx_timeout_cnt; 477 __u32 cont_txtimeout_cnt; 478 u64 jiffies_last_txtimeout; 479 }; 480 481 #ifdef WLAN_FEATURE_11W 482 /** 483 * struct hdd_pmf_stats - Protected Management Frame statistics 484 * @num_unprot_deauth_rx: Number of unprotected deauth frames received 485 * @num_unprot_disassoc_rx: Number of unprotected disassoc frames received 486 */ 487 struct hdd_pmf_stats { 488 uint8_t num_unprot_deauth_rx; 489 uint8_t num_unprot_disassoc_rx; 490 }; 491 #endif 492 493 /** 494 * struct hdd_arp_stats_s - arp debug stats count 495 * @tx_arp_req_count: no. of arp req received from network stack 496 * @rx_arp_rsp_count: no. of arp res received from FW 497 * @tx_dropped: no. of arp req dropped at hdd layer 498 * @rx_dropped: no. of arp res dropped 499 * @rx_delivered: no. of arp res delivered to network stack 500 * @rx_refused: no of arp rsp refused (not delivered) to network stack 501 * @tx_host_fw_sent: no of arp req sent by FW OTA 502 * @rx_host_drop_reorder: no of arp res dropped by host 503 * @rx_fw_cnt: no of arp res received by FW 504 * @tx_ack_cnt: no of arp req acked by FW 505 */ 506 struct hdd_arp_stats_s { 507 uint16_t tx_arp_req_count; 508 uint16_t rx_arp_rsp_count; 509 uint16_t tx_dropped; 510 uint16_t rx_dropped; 511 uint16_t rx_delivered; 512 uint16_t rx_refused; 513 uint16_t tx_host_fw_sent; 514 uint16_t rx_host_drop_reorder; 515 uint16_t rx_fw_cnt; 516 uint16_t tx_ack_cnt; 517 }; 518 519 /** 520 * struct hdd_dns_stats_s - dns debug stats count 521 * @tx_dns_req_count: no. of dns query received from network stack 522 * @rx_dns_rsp_count: no. of dns res received from FW 523 * @tx_dropped: no. of dns query dropped at hdd layer 524 * @rx_delivered: no. of dns res delivered to network stack 525 * @rx_refused: no of dns res refused (not delivered) to network stack 526 * @tx_host_fw_sent: no of dns query sent by FW OTA 527 * @rx_host_drop: no of dns res dropped by host 528 * @tx_ack_cnt: no of dns req acked by FW 529 */ 530 struct hdd_dns_stats_s { 531 uint16_t tx_dns_req_count; 532 uint16_t rx_dns_rsp_count; 533 uint16_t tx_dropped; 534 uint16_t rx_delivered; 535 uint16_t rx_refused; 536 uint16_t tx_host_fw_sent; 537 uint16_t rx_host_drop; 538 uint16_t tx_ack_cnt; 539 }; 540 541 /** 542 * struct hdd_tcp_stats_s - tcp debug stats count 543 * @tx_tcp_syn_count: no. of tcp syn received from network stack 544 * @@tx_tcp_ack_count: no. of tcp ack received from network stack 545 * @rx_tcp_syn_ack_count: no. of tcp syn ack received from FW 546 * @tx_tcp_syn_dropped: no. of tcp syn dropped at hdd layer 547 * @tx_tcp_ack_dropped: no. of tcp ack dropped at hdd layer 548 * @rx_delivered: no. of tcp syn ack delivered to network stack 549 * @rx_refused: no of tcp syn ack refused (not delivered) to network stack 550 * @tx_tcp_syn_host_fw_sent: no of tcp syn sent by FW OTA 551 * @@tx_tcp_ack_host_fw_sent: no of tcp ack sent by FW OTA 552 * @rx_host_drop: no of tcp syn ack dropped by host 553 * @tx_tcp_syn_ack_cnt: no of tcp syn acked by FW 554 * @tx_tcp_syn_ack_cnt: no of tcp ack acked by FW 555 * @is_tcp_syn_ack_rcv: flag to check tcp syn ack received or not 556 * @is_tcp_ack_sent: flag to check tcp ack sent or not 557 */ 558 struct hdd_tcp_stats_s { 559 uint16_t tx_tcp_syn_count; 560 uint16_t tx_tcp_ack_count; 561 uint16_t rx_tcp_syn_ack_count; 562 uint16_t tx_tcp_syn_dropped; 563 uint16_t tx_tcp_ack_dropped; 564 uint16_t rx_delivered; 565 uint16_t rx_refused; 566 uint16_t tx_tcp_syn_host_fw_sent; 567 uint16_t tx_tcp_ack_host_fw_sent; 568 uint16_t rx_host_drop; 569 uint16_t rx_fw_cnt; 570 uint16_t tx_tcp_syn_ack_cnt; 571 uint16_t tx_tcp_ack_ack_cnt; 572 bool is_tcp_syn_ack_rcv; 573 bool is_tcp_ack_sent; 574 575 }; 576 577 /** 578 * struct hdd_icmpv4_stats_s - icmpv4 debug stats count 579 * @tx_icmpv4_req_count: no. of icmpv4 req received from network stack 580 * @rx_icmpv4_rsp_count: no. of icmpv4 res received from FW 581 * @tx_dropped: no. of icmpv4 req dropped at hdd layer 582 * @rx_delivered: no. of icmpv4 res delivered to network stack 583 * @rx_refused: no of icmpv4 res refused (not delivered) to network stack 584 * @tx_host_fw_sent: no of icmpv4 req sent by FW OTA 585 * @rx_host_drop: no of icmpv4 res dropped by host 586 * @rx_fw_cnt: no of icmpv4 res received by FW 587 * @tx_ack_cnt: no of icmpv4 req acked by FW 588 */ 589 struct hdd_icmpv4_stats_s { 590 uint16_t tx_icmpv4_req_count; 591 uint16_t rx_icmpv4_rsp_count; 592 uint16_t tx_dropped; 593 uint16_t rx_delivered; 594 uint16_t rx_refused; 595 uint16_t tx_host_fw_sent; 596 uint16_t rx_host_drop; 597 uint16_t rx_fw_cnt; 598 uint16_t tx_ack_cnt; 599 }; 600 601 /** 602 * struct hdd_peer_stats - Peer stats at HDD level 603 * @rx_count: RX count 604 * @rx_bytes: RX bytes 605 * @fcs_count: FCS err count 606 */ 607 struct hdd_peer_stats { 608 uint32_t rx_count; 609 uint64_t rx_bytes; 610 uint32_t fcs_count; 611 }; 612 613 struct hdd_stats { 614 tCsrSummaryStatsInfo summary_stat; 615 tCsrGlobalClassAStatsInfo class_a_stat; 616 tCsrGlobalClassDStatsInfo class_d_stat; 617 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats; 618 struct hdd_tx_rx_stats tx_rx_stats; 619 struct hdd_arp_stats_s hdd_arp_stats; 620 struct hdd_dns_stats_s hdd_dns_stats; 621 struct hdd_tcp_stats_s hdd_tcp_stats; 622 struct hdd_icmpv4_stats_s hdd_icmpv4_stats; 623 struct hdd_peer_stats peer_stats; 624 #ifdef WLAN_FEATURE_11W 625 struct hdd_pmf_stats hdd_pmf_stats; 626 #endif 627 }; 628 629 /** 630 * struct hdd_roaming_info - HDD Internal Roaming Information 631 * @bssid: BSSID to which we are connected 632 * @peer_mac: Peer MAC address for IBSS connection 633 * @roam_id: Unique identifier for a roaming instance 634 * @roam_status: Current roam command status 635 * @defer_key_complete: Should key complete be deferred? 636 * 637 */ 638 struct hdd_roaming_info { 639 tSirMacAddr bssid; 640 tSirMacAddr peer_mac; 641 uint32_t roam_id; 642 eRoamCmdStatus roam_status; 643 bool defer_key_complete; 644 645 }; 646 647 #ifdef FEATURE_WLAN_WAPI 648 /* Define WAPI macros for Length, BKID count etc*/ 649 #define MAX_NUM_AKM_SUITES 16 650 651 /** WAPI AUTH mode definition */ 652 enum wapi_auth_mode { 653 WAPI_AUTH_MODE_OPEN = 0, 654 WAPI_AUTH_MODE_PSK = 1, 655 WAPI_AUTH_MODE_CERT 656 } __packed; 657 658 #define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0])) 659 #define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2])) 660 #define WAPI_PSK_AKM_SUITE 0x02721400 661 #define WAPI_CERT_AKM_SUITE 0x01721400 662 663 /** 664 * struct hdd_wapi_info - WAPI Information structure definition 665 * @wapi_mode: Is WAPI enabled on this adapter? 666 * @is_wapi_sta: Is the STA associated with WAPI? 667 * @wapi_auth_mode: WAPI authentication mode used by this adapter 668 */ 669 struct hdd_wapi_info { 670 bool wapi_mode; 671 bool is_wapi_sta; 672 enum wapi_auth_mode wapi_auth_mode; 673 }; 674 #endif /* FEATURE_WLAN_WAPI */ 675 676 struct hdd_beacon_data { 677 u8 *head; 678 u8 *tail; 679 u8 *proberesp_ies; 680 u8 *assocresp_ies; 681 int head_len; 682 int tail_len; 683 int proberesp_ies_len; 684 int assocresp_ies_len; 685 int dtim_period; 686 }; 687 688 /** 689 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params 690 * @freq: Channel frequency. 691 * @cb_mode: Channel bonding 692 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively. 693 * @phy_mode: PHY mode 694 */ 695 struct hdd_mon_set_ch_info { 696 uint32_t freq; 697 uint8_t cb_mode; 698 uint32_t channel_width; 699 eCsrPhyMode phy_mode; 700 }; 701 702 /** 703 * struct hdd_station_ctx -- STA-specific information 704 * @roam_profile: current roaming profile 705 * @security_ie: WPA or RSN IE used by the @roam_profile 706 * @assoc_additional_ie: association additional IE used by the @roam_profile 707 * @wpa_versions: bitmap of supported WPA versions 708 * @auth_key_mgmt: bitmap of supported auth key mgmt protocols 709 * @requested_bssid: Specific BSSID to which to connect 710 * @conn_info: current connection information 711 * @roam_info: current roaming information 712 * @ft_carrier_on: is carrier on 713 * @ibss_sta_generation: current ibss generation. Incremented whenever 714 * ibss New peer joins and departs the network 715 * @ibss_enc_key_installed: is the ibss wep/wpa-none encryptions key 716 * installed? 717 * @ibss_enc_key: current ibss wep/wpa-none encryption key (if 718 * @ibss_enc_key_installed is %true) 719 * @ibss_peer_info: information about the ibss peer 720 * @hdd_reassoc_scenario: is station in the middle of reassociation? 721 * @sta_debug_state: STA context debug variable 722 * @broadcast_sta_id: STA ID assigned for broadcast frames 723 * @ch_info: monitor mode channel information 724 * @ap_supports_immediate_power_save: Does the current AP allow our STA 725 * to immediately go into power save? 726 */ 727 struct hdd_station_ctx { 728 struct csr_roam_profile roam_profile; 729 uint8_t security_ie[WLAN_MAX_IE_LEN]; 730 tSirAddie assoc_additional_ie; 731 enum nl80211_wpa_versions wpa_versions; 732 enum hdd_auth_key_mgmt auth_key_mgmt; 733 struct qdf_mac_addr requested_bssid; 734 struct hdd_connection_info conn_info; 735 struct hdd_connection_info cache_conn_info; 736 struct hdd_roaming_info roam_info; 737 int ft_carrier_on; 738 int ibss_sta_generation; 739 bool ibss_enc_key_installed; 740 tCsrRoamSetKey ibss_enc_key; 741 tSirPeerInfoRspParams ibss_peer_info; 742 bool hdd_reassoc_scenario; 743 int sta_debug_state; 744 uint8_t broadcast_sta_id; 745 struct hdd_mon_set_ch_info ch_info; 746 bool ap_supports_immediate_power_save; 747 }; 748 749 /** 750 * enum bss_state - current state of the BSS 751 * @BSS_STOP: BSS is stopped 752 * @BSS_START: BSS is started 753 */ 754 enum bss_state { 755 BSS_STOP, 756 BSS_START, 757 }; 758 759 /** 760 * struct hdd_hostapd_state - hostapd-related state information 761 * @bss_state: Current state of the BSS 762 * @qdf_event: Event to synchronize actions between hostapd thread and 763 * internal callback threads 764 * @qdf_stop_bss_event: Event to synchronize Stop BSS. When Stop BSS 765 * is issued userspace thread can wait on this event. The event will 766 * be set when the Stop BSS processing in UMAC has completed. 767 * @qdf_sta_disassoc_event: Event to synchronize STA Disassociation. 768 * When a STA is disassociated userspace thread can wait on this 769 * event. The event will be set when the STA Disassociation 770 * processing in UMAC has completed. 771 * @qdf_status: Used to communicate state from other threads to the 772 * userspace thread. 773 */ 774 struct hdd_hostapd_state { 775 enum bss_state bss_state; 776 qdf_event_t qdf_event; 777 qdf_event_t qdf_stop_bss_event; 778 qdf_event_t qdf_sta_disassoc_event; 779 QDF_STATUS qdf_status; 780 }; 781 782 /** 783 * enum bss_stop_reason - reasons why a BSS is stopped. 784 * @BSS_STOP_REASON_INVALID: no reason specified explicitly. 785 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host 786 * driver is trying to switch AP role to a different channel 787 * to maintain SCC mode with the STA role on the same card. 788 * this usually happens when STA is connected to an external 789 * AP that runs on a different channel 790 * @BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN: BSS stopped due to 791 * vendor subcmd set sap config channel 792 */ 793 enum bss_stop_reason { 794 BSS_STOP_REASON_INVALID = 0, 795 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1, 796 BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN = 2, 797 }; 798 799 /** 800 * struct hdd_rate_info - rate_info in HDD 801 * @rate: tx/rx rate (kbps) 802 * @mode: 0->11abg legacy, 1->HT, 2->VHT (refer to sir_sme_phy_mode) 803 * @nss: number of streams 804 * @mcs: mcs index for HT/VHT mode 805 * @rate_flags: rate flags for last tx/rx 806 * 807 * rate info in HDD 808 */ 809 struct hdd_rate_info { 810 uint32_t rate; 811 uint8_t mode; 812 uint8_t nss; 813 uint8_t mcs; 814 uint8_t rate_flags; 815 }; 816 817 /** 818 * struct hdd_mic_info - mic error info in HDD 819 * @ta_mac_addr: transmitter mac address 820 * @multicast: Flag for multicast 821 * @key_id: Key ID 822 * @tsc: Sequence number 823 * @vdev_id: vdev id 824 * 825 */ 826 struct hdd_mic_error_info { 827 struct qdf_mac_addr ta_mac_addr; 828 bool multicast; 829 uint8_t key_id; 830 uint8_t tsc[SIR_CIPHER_SEQ_CTR_SIZE]; 831 uint16_t vdev_id; 832 }; 833 834 enum hdd_mic_work_status { 835 MIC_UNINITIALIZED, 836 MIC_INITIALIZED, 837 MIC_SCHEDULED, 838 MIC_DISABLED 839 }; 840 841 /** 842 * struct hdd_mic_work - mic work info in HDD 843 * @mic_error_work: mic error work 844 * @status: sattus of mic error work 845 * @info: Pointer to mic error information 846 * @lock: lock to synchronixe mic error work 847 * 848 */ 849 struct hdd_mic_work { 850 qdf_work_t work; 851 enum hdd_mic_work_status status; 852 struct hdd_mic_error_info *info; 853 qdf_spinlock_t lock; 854 }; 855 856 /** 857 * struct hdd_fw_txrx_stats - fw txrx status in HDD 858 * (refer to station_info struct in Kernel) 859 * @tx_packets: packets transmitted to this station 860 * @tx_bytes: bytes transmitted to this station 861 * @rx_packets: packets received from this station 862 * @rx_bytes: bytes received from this station 863 * @rx_retries: cumulative retry counts 864 * @tx_failed: number of failed transmissions 865 * @rssi: The signal strength (dbm) 866 * @tx_rate: last used tx rate info 867 * @rx_rate: last used rx rate info 868 * 869 * fw txrx status in HDD 870 */ 871 struct hdd_fw_txrx_stats { 872 uint32_t tx_packets; 873 uint64_t tx_bytes; 874 uint32_t rx_packets; 875 uint64_t rx_bytes; 876 uint32_t tx_retries; 877 uint32_t tx_failed; 878 int8_t rssi; 879 struct hdd_rate_info tx_rate; 880 struct hdd_rate_info rx_rate; 881 }; 882 883 /** 884 * struct dhcp_phase - Per Peer DHCP Phases 885 * @DHCP_PHASE_ACK: upon receiving DHCP_ACK/NAK message in REQUEST phase or 886 * DHCP_DELINE message in OFFER phase 887 * @DHCP_PHASE_DISCOVER: upon receiving DHCP_DISCOVER message in ACK phase 888 * @DHCP_PHASE_OFFER: upon receiving DHCP_OFFER message in DISCOVER phase 889 * @DHCP_PHASE_REQUEST: upon receiving DHCP_REQUEST message in OFFER phase or 890 * ACK phase (Renewal process) 891 */ 892 enum dhcp_phase { 893 DHCP_PHASE_ACK, 894 DHCP_PHASE_DISCOVER, 895 DHCP_PHASE_OFFER, 896 DHCP_PHASE_REQUEST 897 }; 898 899 /** 900 * struct dhcp_nego_status - Per Peer DHCP Negotiation Status 901 * @DHCP_NEGO_STOP: when the peer is in ACK phase or client disassociated 902 * @DHCP_NEGO_IN_PROGRESS: when the peer is in DISCOVER or REQUEST 903 * (Renewal process) phase 904 */ 905 enum dhcp_nego_status { 906 DHCP_NEGO_STOP, 907 DHCP_NEGO_IN_PROGRESS 908 }; 909 910 /** 911 * struct hdd_station_info - Per station structure kept in HDD for 912 * multiple station support for SoftAP 913 * @in_use: Is the station entry in use? 914 * @sta_id: Station ID reported back from HAL (through SAP). 915 * Broadcast uses station ID zero by default. 916 * @sta_type: Type of station i.e. p2p client or infrastructure station 917 * @sta_mac: MAC address of the station 918 * @peer_state: Current Station state so HDD knows how to deal with packet 919 * queue. Most recent states used to change TLSHIM STA state. 920 * @is_qos_enabled: Track QoS status of station 921 * @is_deauth_in_progress: The station entry for which Deauth is in progress 922 * @nss: Number of spatial streams supported 923 * @rate_flags: Rate Flags for this connection 924 * @ecsa_capable: Extended CSA capabilities 925 * @max_phy_rate: Calcuated maximum phy rate based on mode, nss, mcs etc. 926 * @tx_packets: Packets send to current station 927 * @tx_bytes: Bytes send to current station 928 * @rx_packets: Packets received from current station 929 * @rx_bytes: Bytes received from current station 930 * @last_tx_rx_ts: Last tx/rx timestamp with current station 931 * @assoc_ts: Current station association timestamp 932 * @tx_rate: Tx rate with current station reported from F/W 933 * @rx_rate: Rx rate with current station reported from F/W 934 * @ampdu: Ampdu enable or not of the station 935 * @sgi_enable: Short GI enable or not of the station 936 * @tx_stbc: Tx Space-time block coding enable/disable 937 * @rx_stbc: Rx Space-time block coding enable/disable 938 * @ch_width: Channel Width of the connection 939 * @mode: Mode of the connection 940 * @max_supp_idx: Max supported rate index of the station 941 * @max_ext_idx: Max extended supported rate index of the station 942 * @max_mcs_idx: Max supported mcs index of the station 943 * @rx_mcs_map: VHT Rx mcs map 944 * @tx_mcs_map: VHT Tx mcs map 945 * @freq : Frequency of the current station 946 * @dot11_mode: 802.11 Mode of the connection 947 * @ht_present: HT caps present or not in the current station 948 * @vht_present: VHT caps present or not in the current station 949 * @ht_caps: HT capabilities of current station 950 * @vht_caps: VHT capabilities of current station 951 * @reason_code: Disconnection reason code for current station 952 * @rssi: RSSI of the current station reported from F/W 953 * @capability: Capability information of current station 954 * @support_mode: Max supported mode of a station currently 955 * connected to sap 956 * @rx_retry_cnt: Number of rx retries received from current station 957 * Currently this feature is not supported from FW 958 * @rx_mc_bc_cnt: Multicast broadcast packet count received from 959 * current station 960 * MSB of rx_mc_bc_cnt indicates whether FW supports rx_mc_bc_cnt 961 * feature or not, if first bit is 1 it indicates that FW supports this 962 * feature, if it is 0 it indicates FW doesn't support this feature 963 */ 964 struct hdd_station_info { 965 bool in_use; 966 uint8_t sta_id; 967 eStationType sta_type; 968 struct qdf_mac_addr sta_mac; 969 enum ol_txrx_peer_state peer_state; 970 bool is_qos_enabled; 971 bool is_deauth_in_progress; 972 uint8_t nss; 973 uint32_t rate_flags; 974 uint8_t ecsa_capable; 975 uint32_t max_phy_rate; 976 uint32_t tx_packets; 977 uint64_t tx_bytes; 978 uint32_t rx_packets; 979 uint64_t rx_bytes; 980 qdf_time_t last_tx_rx_ts; 981 qdf_time_t assoc_ts; 982 qdf_time_t disassoc_ts; 983 uint32_t tx_rate; 984 uint32_t rx_rate; 985 bool ampdu; 986 bool sgi_enable; 987 bool tx_stbc; 988 bool rx_stbc; 989 tSirMacHTChannelWidth ch_width; 990 uint8_t mode; 991 uint8_t max_supp_idx; 992 uint8_t max_ext_idx; 993 uint8_t max_mcs_idx; 994 uint8_t rx_mcs_map; 995 uint8_t tx_mcs_map; 996 uint32_t freq; 997 uint8_t dot11_mode; 998 bool ht_present; 999 bool vht_present; 1000 struct ieee80211_ht_cap ht_caps; 1001 struct ieee80211_vht_cap vht_caps; 1002 uint32_t reason_code; 1003 int8_t rssi; 1004 enum dhcp_phase dhcp_phase; 1005 enum dhcp_nego_status dhcp_nego_status; 1006 uint16_t capability; 1007 uint8_t support_mode; 1008 uint32_t rx_retry_cnt; 1009 uint32_t rx_mc_bc_cnt; 1010 }; 1011 1012 /** 1013 * struct hdd_ap_ctx - SAP/P2PGO specific information 1014 * @hostapd_state: state control information 1015 * @dfs_cac_block_tx: Is data tramsmission blocked due to DFS CAC? 1016 * @ap_active: Are any stations active? 1017 * @disable_intrabss_fwd: Prevent forwarding between stations 1018 * @broadcast_sta_id: Station ID assigned after BSS starts 1019 * @privacy: The privacy bits of configuration 1020 * @encryption_type: The encryption being used 1021 * @group_key: Group Encryption Key 1022 * @wep_key: WEP key array 1023 * @wep_def_key_idx: WEP default key index 1024 * @sap_context: Pointer to context maintained by SAP (opaque to HDD) 1025 * @sap_config: SAP configuration 1026 * @operating_channel: channel upon which the SAP is operating 1027 * @beacon: Beacon information 1028 * @vendor_acs_timer: Timer for ACS 1029 * @vendor_acs_timer_initialized: Is @vendor_acs_timer initialized? 1030 * @bss_stop_reason: Reason why the BSS was stopped 1031 * @acs_in_progress: In progress acs flag for an adapter 1032 */ 1033 struct hdd_ap_ctx { 1034 struct hdd_hostapd_state hostapd_state; 1035 bool dfs_cac_block_tx; 1036 bool ap_active; 1037 bool disable_intrabss_fwd; 1038 uint8_t broadcast_sta_id; 1039 uint8_t privacy; 1040 eCsrEncryptionType encryption_type; 1041 tCsrRoamSetKey group_key; 1042 tCsrRoamSetKey wep_key[CSR_MAX_NUM_KEY]; 1043 uint8_t wep_def_key_idx; 1044 struct sap_context *sap_context; 1045 struct sap_config sap_config; 1046 uint8_t operating_channel; 1047 struct hdd_beacon_data *beacon; 1048 qdf_mc_timer_t vendor_acs_timer; 1049 bool vendor_acs_timer_initialized; 1050 enum bss_stop_reason bss_stop_reason; 1051 qdf_atomic_t acs_in_progress; 1052 }; 1053 1054 /** 1055 * struct hdd_scan_info - Per-adapter scan information 1056 * @scan_add_ie: Additional IE for scan 1057 * @default_scan_ies: Default scan IEs 1058 * @default_scan_ies_len: Length of @default_scan_ies 1059 * @scan_mode: Scan mode 1060 */ 1061 struct hdd_scan_info { 1062 tSirAddie scan_add_ie; 1063 uint8_t *default_scan_ies; 1064 uint16_t default_scan_ies_len; 1065 tSirScanType scan_mode; 1066 }; 1067 1068 #define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES 1069 1070 struct hdd_multicast_addr_list { 1071 uint8_t mc_cnt; 1072 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN]; 1073 }; 1074 1075 #define WLAN_HDD_MAX_HISTORY_ENTRY 25 1076 1077 /** 1078 * struct hdd_netif_queue_stats - netif queue operation statistics 1079 * @pause_count - pause counter 1080 * @unpause_count - unpause counter 1081 */ 1082 struct hdd_netif_queue_stats { 1083 u32 pause_count; 1084 u32 unpause_count; 1085 qdf_time_t total_pause_time; 1086 }; 1087 1088 /** 1089 * struct hdd_netif_queue_history - netif queue operation history 1090 * @time: timestamp 1091 * @netif_action: action type 1092 * @netif_reason: reason type 1093 * @pause_map: pause map 1094 * @tx_q_state: state of the netdev TX queues 1095 */ 1096 struct hdd_netif_queue_history { 1097 qdf_time_t time; 1098 uint16_t netif_action; 1099 uint16_t netif_reason; 1100 uint32_t pause_map; 1101 unsigned long tx_q_state[NUM_TX_QUEUES]; 1102 }; 1103 1104 /** 1105 * struct hdd_chan_change_params - channel related information 1106 * @chan_freq: operating channel frequency 1107 * @chan_params: channel parameters 1108 */ 1109 struct hdd_chan_change_params { 1110 uint32_t chan_freq; 1111 struct ch_params chan_params; 1112 }; 1113 1114 /** 1115 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm 1116 * @dfs: dfs context to prevent/allow runtime pm 1117 * @connect: connect context to prevent/allow runtime pm 1118 * 1119 * Runtime PM control for underlying activities 1120 */ 1121 struct hdd_runtime_pm_context { 1122 qdf_runtime_lock_t dfs; 1123 qdf_runtime_lock_t connect; 1124 }; 1125 1126 /* 1127 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices 1128 * belonging to this driver from net devices belonging to other devices. 1129 * Therefore, the magic number must be unique relative to the numbers for 1130 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined 1131 * (e.g. by compiler argument), then use that. If it's not already defined, 1132 * then use the first 4 characters of MULTI_IF_NAME to construct the magic 1133 * number. If MULTI_IF_NAME is not defined, then use a default magic number. 1134 */ 1135 #ifndef WLAN_HDD_ADAPTER_MAGIC 1136 #ifdef MULTI_IF_NAME 1137 #define WLAN_HDD_ADAPTER_MAGIC \ 1138 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \ 1139 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \ 1140 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \ 1141 (MULTI_IF_NAME[1] << 16) : \ 1142 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \ 1143 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3]))) 1144 #else 1145 #define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */ 1146 #endif 1147 #endif 1148 1149 /** 1150 * struct rcpi_info - rcpi info 1151 * @rcpi: computed value in dB 1152 * @mac_addr: peer mac addr for which rcpi is computed 1153 */ 1154 struct rcpi_info { 1155 int32_t rcpi; 1156 struct qdf_mac_addr mac_addr; 1157 }; 1158 1159 struct hdd_context; 1160 1161 /** 1162 * struct hdd_adapter - hdd vdev/net_device context 1163 * @vdev: object manager vdev context 1164 * @vdev_lock: lock to protect vdev context access 1165 * @vdev_id: Unique identifier assigned to the vdev 1166 * @event_flags: a bitmap of hdd_adapter_flags 1167 * @mic_work: mic work information 1168 * @gpio_tsf_sync_work: work to sync send TSF CAP WMI command 1169 * 1170 */ 1171 struct hdd_adapter { 1172 /* Magic cookie for adapter sanity verification. Note that this 1173 * needs to be at the beginning of the private data structure so 1174 * that it will exist at the beginning of dev->priv and hence 1175 * will always be in mapped memory 1176 */ 1177 uint32_t magic; 1178 1179 /* list node for membership in the adapter list */ 1180 qdf_list_node_t node; 1181 1182 struct hdd_context *hdd_ctx; 1183 struct wlan_objmgr_vdev *vdev; 1184 qdf_spinlock_t vdev_lock; 1185 uint8_t vdev_id; 1186 1187 struct cdp_vdev *txrx_vdev; 1188 1189 /** Handle to the network device */ 1190 struct net_device *dev; 1191 1192 enum QDF_OPMODE device_mode; 1193 1194 /** IPv4 notifier callback for handling ARP offload on change in IP */ 1195 struct work_struct ipv4_notifier_work; 1196 #ifdef WLAN_NS_OFFLOAD 1197 /** IPv6 notifier callback for handling NS offload on change in IP */ 1198 struct work_struct ipv6_notifier_work; 1199 #endif 1200 1201 /* TODO Move this to sta Ctx */ 1202 struct wireless_dev wdev; 1203 1204 /** ops checks if Opportunistic Power Save is Enable or Not 1205 * ctw stores CT Window value once we receive Opps command from 1206 * wpa_supplicant then using CT Window value we need to Enable 1207 * Opportunistic Power Save 1208 */ 1209 uint8_t ops; 1210 uint32_t ctw; 1211 1212 /** Current MAC Address for the adapter */ 1213 struct qdf_mac_addr mac_addr; 1214 1215 #ifdef WLAN_NUD_TRACKING 1216 struct hdd_nud_tracking_info nud_tracking; 1217 #endif 1218 1219 struct hdd_mic_work mic_work; 1220 bool disconnection_in_progress; 1221 qdf_mutex_t disconnection_status_lock; 1222 unsigned long event_flags; 1223 1224 /**Device TX/RX statistics*/ 1225 struct net_device_stats stats; 1226 /** HDD statistics*/ 1227 struct hdd_stats hdd_stats; 1228 1229 /* estimated link speed */ 1230 uint32_t estimated_linkspeed; 1231 1232 /* QDF event for session close */ 1233 qdf_event_t qdf_session_close_event; 1234 1235 /* QDF event for session open */ 1236 qdf_event_t qdf_session_open_event; 1237 1238 /* TODO: move these to sta ctx. These may not be used in AP */ 1239 /** completion variable for disconnect callback */ 1240 struct completion disconnect_comp_var; 1241 1242 struct completion roaming_comp_var; 1243 1244 /* completion variable for Linkup Event */ 1245 struct completion linkup_event_var; 1246 1247 /* completion variable for off channel remain on channel Event */ 1248 struct completion offchannel_tx_event; 1249 /* Completion variable for action frame */ 1250 struct completion tx_action_cnf_event; 1251 1252 struct completion sta_authorized_event; 1253 1254 struct completion ibss_peer_info_comp; 1255 1256 /* Track whether the linkup handling is needed */ 1257 bool is_link_up_service_needed; 1258 1259 /* WMM Status */ 1260 struct hdd_wmm_status hdd_wmm_status; 1261 1262 /** Multiple station supports */ 1263 /** Per-station structure */ 1264 spinlock_t sta_info_lock; /* To protect access to station Info */ 1265 struct hdd_station_info sta_info[WLAN_MAX_STA_COUNT]; 1266 struct hdd_station_info cache_sta_info[WLAN_MAX_STA_COUNT]; 1267 1268 1269 #ifdef FEATURE_WLAN_WAPI 1270 struct hdd_wapi_info wapi_info; 1271 #endif 1272 1273 int8_t rssi; 1274 int32_t rssi_on_disconnect; 1275 #ifdef WLAN_FEATURE_LPSS 1276 bool rssi_send; 1277 #endif 1278 1279 uint8_t snr; 1280 1281 struct work_struct sap_stop_bss_work; 1282 1283 union { 1284 struct hdd_station_ctx station; 1285 struct hdd_ap_ctx ap; 1286 } session; 1287 1288 qdf_atomic_t ch_switch_in_progress; 1289 1290 #ifdef WLAN_FEATURE_TSF 1291 /* tsf value received from firmware */ 1292 uint64_t cur_target_time; 1293 uint64_t cur_tsf_sync_soc_time; 1294 uint64_t last_tsf_sync_soc_time; 1295 uint64_t cur_target_global_tsf_time; 1296 uint64_t last_target_global_tsf_time; 1297 qdf_mc_timer_t host_capture_req_timer; 1298 #ifdef WLAN_FEATURE_TSF_PLUS 1299 /* spin lock for read/write timestamps */ 1300 qdf_spinlock_t host_target_sync_lock; 1301 qdf_mc_timer_t host_target_sync_timer; 1302 uint64_t cur_host_time; 1303 uint64_t last_host_time; 1304 uint64_t last_target_time; 1305 /* to store the count of continuous invalid tstamp-pair */ 1306 int continuous_error_count; 1307 /* to indicate whether tsf_sync has been initialized */ 1308 qdf_atomic_t tsf_sync_ready_flag; 1309 #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC 1310 qdf_work_t gpio_tsf_sync_work; 1311 #endif 1312 #endif /* WLAN_FEATURE_TSF_PLUS */ 1313 #endif 1314 1315 struct hdd_multicast_addr_list mc_addr_list; 1316 uint8_t addr_filter_pattern; 1317 1318 struct hdd_scan_info scan_info; 1319 1320 /* Flag to ensure PSB is configured through framework */ 1321 uint8_t psb_changed; 1322 /* UAPSD psb value configured through framework */ 1323 uint8_t configured_psb; 1324 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete 1325 * since CSR (PMAC Struct) Config is same for both AP 1326 */ 1327 struct delayed_work acs_pending_work; 1328 1329 struct work_struct scan_block_work; 1330 qdf_list_t blocked_scan_request_q; 1331 qdf_mutex_t blocked_scan_request_q_lock; 1332 1333 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH 1334 unsigned long prev_rx_packets; 1335 unsigned long prev_tx_packets; 1336 uint64_t prev_fwd_tx_packets; 1337 uint64_t prev_fwd_rx_packets; 1338 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/ 1339 1340 #if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \ 1341 defined(QCA_HL_NETDEV_FLOW_CONTROL) 1342 qdf_mc_timer_t tx_flow_control_timer; 1343 bool tx_flow_timer_initialized; 1344 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL || QCA_HL_NETDEV_FLOW_CONTROL */ 1345 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL 1346 unsigned int tx_flow_low_watermark; 1347 unsigned int tx_flow_hi_watermark_offset; 1348 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ 1349 1350 bool offloads_configured; 1351 1352 /* DSCP to UP QoS Mapping */ 1353 enum sme_qos_wmmuptype dscp_to_up_map[WLAN_HDD_MAX_DSCP + 1]; 1354 1355 #ifdef WLAN_FEATURE_LINK_LAYER_STATS 1356 bool is_link_layer_stats_set; 1357 #endif 1358 uint8_t link_status; 1359 1360 /* variable for temperature in Celsius */ 1361 int temperature; 1362 1363 #ifdef WLAN_FEATURE_DSRC 1364 /* MAC addresses used for OCB interfaces */ 1365 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA]; 1366 int ocb_mac_addr_count; 1367 #endif 1368 1369 /* BITMAP indicating pause reason */ 1370 uint32_t pause_map; 1371 spinlock_t pause_map_lock; 1372 qdf_time_t start_time; 1373 qdf_time_t last_time; 1374 qdf_time_t total_pause_time; 1375 qdf_time_t total_unpause_time; 1376 uint8_t history_index; 1377 struct hdd_netif_queue_history 1378 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY]; 1379 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX]; 1380 ol_txrx_tx_fp tx_fn; 1381 /* debugfs entry */ 1382 struct dentry *debugfs_phy; 1383 /* 1384 * The pre cac channel frequency is saved here and will be used when 1385 * the SAP's channel needs to be moved from the existing 2.4GHz channel. 1386 */ 1387 uint32_t pre_cac_freq; 1388 1389 /* 1390 * Indicate if HO fails during disconnect so that 1391 * disconnect is not initiated by HDD as its already 1392 * initiated by CSR 1393 */ 1394 bool roam_ho_fail; 1395 struct lfr_firmware_status lfr_fw_status; 1396 bool con_status; 1397 bool dad; 1398 uint8_t active_ac; 1399 uint32_t pkt_type_bitmap; 1400 uint32_t track_arp_ip; 1401 uint8_t dns_payload[256]; 1402 uint32_t track_dns_domain_len; 1403 uint32_t track_src_port; 1404 uint32_t track_dest_port; 1405 uint32_t track_dest_ipv4; 1406 uint32_t mon_chan_freq; 1407 uint32_t mon_bandwidth; 1408 1409 /* rcpi information */ 1410 struct rcpi_info rcpi; 1411 bool send_mode_change; 1412 #ifdef FEATURE_WLAN_APF 1413 struct hdd_apf_context apf_context; 1414 #endif /* FEATURE_WLAN_APF */ 1415 1416 #ifdef WLAN_DEBUGFS 1417 struct hdd_debugfs_file_info csr_file[HDD_DEBUGFS_FILE_ID_MAX]; 1418 #endif /* WLAN_DEBUGFS */ 1419 1420 #ifdef WLAN_FEATURE_MOTION_DETECTION 1421 bool motion_detection_mode; 1422 #endif /* WLAN_FEATURE_MOTION_DETECTION */ 1423 }; 1424 1425 #define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station) 1426 #define WLAN_HDD_GET_AP_CTX_PTR(adapter) (&(adapter)->session.ap) 1427 #define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx) 1428 #define WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter) \ 1429 (&(adapter)->session.ap.hostapd_state) 1430 #define WLAN_HDD_GET_SAP_CTX_PTR(adapter) ((adapter)->session.ap.sap_context) 1431 1432 #ifdef WLAN_FEATURE_NAN 1433 #define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled) 1434 #else 1435 /* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined 1436 * intentionally so that all references to these must be within NDP code. 1437 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled, 1438 * invoke NDP code to do all work. 1439 */ 1440 #define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false) 1441 #endif 1442 1443 /* Set mac address locally administered bit */ 1444 #define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD) 1445 1446 #define HDD_DEFAULT_MCC_P2P_QUOTA 70 1447 #define HDD_RESET_MCC_P2P_QUOTA 50 1448 1449 /* 1450 * struct hdd_priv_data - driver ioctl private data payload 1451 * @buf: pointer to command buffer (may be in userspace) 1452 * @used_len: length of the command/data currently in @buf 1453 * @total_len: total length of the @buf memory allocation 1454 */ 1455 struct hdd_priv_data { 1456 uint8_t *buf; 1457 int used_len; 1458 int total_len; 1459 }; 1460 1461 #define MAX_MOD_LOGLEVEL 10 1462 struct fw_log_info { 1463 uint8_t enable; 1464 uint8_t dl_type; 1465 uint8_t dl_report; 1466 uint8_t dl_loglevel; 1467 uint8_t index; 1468 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL]; 1469 1470 }; 1471 1472 /** 1473 * enum antenna_mode - number of TX/RX chains 1474 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder 1475 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1 1476 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2 1477 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode 1478 */ 1479 enum antenna_mode { 1480 HDD_ANTENNA_MODE_INVALID, 1481 HDD_ANTENNA_MODE_1X1, 1482 HDD_ANTENNA_MODE_2X2, 1483 HDD_ANTENNA_MODE_MAX 1484 }; 1485 1486 /** 1487 * enum smps_mode - SM power save mode 1488 * @HDD_SMPS_MODE_STATIC: Static power save 1489 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save 1490 * @HDD_SMPS_MODE_RESERVED: Reserved 1491 * @HDD_SMPS_MODE_DISABLED: Disable power save 1492 * @HDD_SMPS_MODE_MAX: Place holder for max mode 1493 */ 1494 enum smps_mode { 1495 HDD_SMPS_MODE_STATIC, 1496 HDD_SMPS_MODE_DYNAMIC, 1497 HDD_SMPS_MODE_RESERVED, 1498 HDD_SMPS_MODE_DISABLED, 1499 HDD_SMPS_MODE_MAX 1500 }; 1501 1502 #ifdef WLAN_FEATURE_OFFLOAD_PACKETS 1503 /** 1504 * struct hdd_offloaded_packets - request id to pattern id mapping 1505 * @request_id: request id 1506 * @pattern_id: pattern id 1507 * 1508 */ 1509 struct hdd_offloaded_packets { 1510 uint32_t request_id; 1511 uint8_t pattern_id; 1512 }; 1513 1514 /** 1515 * struct hdd_offloaded_packets_ctx - offloaded packets context 1516 * @op_table: request id to pattern id table 1517 * @op_lock: mutex lock 1518 */ 1519 struct hdd_offloaded_packets_ctx { 1520 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS]; 1521 struct mutex op_lock; 1522 }; 1523 #endif 1524 1525 /** 1526 * enum driver_status: Driver Modules status 1527 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized 1528 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened 1529 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed 1530 */ 1531 enum driver_modules_status { 1532 DRIVER_MODULES_UNINITIALIZED, 1533 DRIVER_MODULES_ENABLED, 1534 DRIVER_MODULES_CLOSED 1535 }; 1536 1537 /** 1538 * struct acs_dfs_policy - Define ACS policies 1539 * @acs_dfs_mode: Dfs mode enabled/disabled. 1540 * @acs_channel: pre defined channel to avoid ACS. 1541 */ 1542 struct acs_dfs_policy { 1543 enum dfs_mode acs_dfs_mode; 1544 uint8_t acs_channel; 1545 }; 1546 1547 /** 1548 * enum suspend_fail_reason: Reasons a WLAN suspend might fail 1549 * SUSPEND_FAIL_IPA: IPA in progress 1550 * SUSPEND_FAIL_RADAR: radar scan in progress 1551 * SUSPEND_FAIL_ROAM: roaming in progress 1552 * SUSPEND_FAIL_SCAN: scan in progress 1553 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware 1554 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end 1555 */ 1556 enum suspend_fail_reason { 1557 SUSPEND_FAIL_IPA, 1558 SUSPEND_FAIL_RADAR, 1559 SUSPEND_FAIL_ROAM, 1560 SUSPEND_FAIL_SCAN, 1561 SUSPEND_FAIL_INITIAL_WAKEUP, 1562 SUSPEND_FAIL_MAX_COUNT 1563 }; 1564 1565 /** 1566 * suspend_resume_stats - Collection of counters for suspend/resume events 1567 * @suspends: number of suspends completed 1568 * @resumes: number of resumes completed 1569 * @suspend_fail: counters for failed suspend reasons 1570 */ 1571 struct suspend_resume_stats { 1572 uint32_t suspends; 1573 uint32_t resumes; 1574 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT]; 1575 }; 1576 1577 /** 1578 * hdd_sta_smps_param - SMPS parameters to configure from hdd 1579 * HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH: RSSI threshold to enter Dynamic SMPS 1580 * mode from inactive mode 1581 * HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH: RSSI threshold to enter 1582 * Stalled-D-SMPS mode from D-SMPS mode or to enter D-SMPS mode from 1583 * Stalled-D-SMPS mode 1584 * HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH: RSSI threshold to disable SMPS modes 1585 * HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH: Upper threshold for beacon-RSSI. 1586 * Used to reduce RX chainmask. 1587 * HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH: Lower threshold for beacon-RSSI. 1588 * Used to increase RX chainmask. 1589 * HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE: Enable/Disable DTIM 1chRx feature 1590 */ 1591 enum hdd_sta_smps_param { 1592 HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH = 0, 1593 HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH = 1, 1594 HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH = 2, 1595 HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH = 3, 1596 HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH = 4, 1597 HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE = 5 1598 }; 1599 1600 /** 1601 * enum RX_OFFLOAD - Receive offload modes 1602 * @CFG_LRO_ENABLED: Large Rx offload 1603 * @CFG_GRO_ENABLED: Generic Rx Offload 1604 */ 1605 enum RX_OFFLOAD { 1606 CFG_LRO_ENABLED = 1, 1607 CFG_GRO_ENABLED, 1608 }; 1609 1610 /* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID, 1611 * 1 for WDS_STAID 1612 */ 1613 #define HDD_MAX_ADAPTERS (WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2) 1614 1615 #ifdef DISABLE_CHANNEL_LIST 1616 1617 /** 1618 * struct hdd_cache_channel_info - Structure of the channel info 1619 * which needs to be cached 1620 * @channel_num: channel number 1621 * @reg_status: Current regulatory status of the channel 1622 * Enable 1623 * Disable 1624 * DFS 1625 * Invalid 1626 * @wiphy_status: Current wiphy status 1627 */ 1628 struct hdd_cache_channel_info { 1629 uint32_t channel_num; 1630 enum channel_state reg_status; 1631 uint32_t wiphy_status; 1632 }; 1633 1634 /** 1635 * struct hdd_cache_channels - Structure of the channels to be cached 1636 * @num_channels: Number of channels to be cached 1637 * @channel_info: Structure of the channel info 1638 */ 1639 struct hdd_cache_channels { 1640 uint32_t num_channels; 1641 struct hdd_cache_channel_info *channel_info; 1642 }; 1643 #endif 1644 1645 /** 1646 * struct hdd_dynamic_mac - hdd structure to handle dynamic mac address changes 1647 * @dynamic_mac: Dynamicaly configured mac, this contains the mac on which 1648 * current interface is up 1649 * @is_provisioned_mac: is this mac from provisioned list 1650 * @bit_position: holds the bit mask position from where this mac is assigned, 1651 * if mac is assigned from provisioned this field contains the position from 1652 * provisioned_intf_addr_mask else contains the position from 1653 * derived_intf_addr_mask 1654 */ 1655 struct hdd_dynamic_mac { 1656 struct qdf_mac_addr dynamic_mac; 1657 bool is_provisioned_mac; 1658 uint8_t bit_position; 1659 }; 1660 1661 /** 1662 * hdd_fw_ver_info - FW version info structure 1663 * @major_spid: FW version - major spid. 1664 * @minor_spid: FW version - minor spid 1665 * @siid: FW version - siid 1666 * @sub_id: FW version - sub id 1667 * @rel_id: FW version - release id 1668 * @crmid: FW version - crmid 1669 */ 1670 1671 struct hdd_fw_ver_info { 1672 uint32_t major_spid; 1673 uint32_t minor_spid; 1674 uint32_t siid; 1675 uint32_t sub_id; 1676 uint32_t rel_id; 1677 uint32_t crmid; 1678 }; 1679 1680 /** 1681 * struct hdd_context - hdd shared driver and psoc/device context 1682 * @psoc: object manager psoc context 1683 * @pdev: object manager pdev context 1684 * @iftype_data_2g: Interface data for 2g band 1685 * @iftype_data_5g: Interface data for 5g band 1686 * @bus_bw_work: work for periodically computing DDR bus bandwidth requirements 1687 * @g_event_flags: a bitmap of hdd_driver_flags 1688 * @psoc_idle_timeout_work: delayed work for psoc idle shutdown 1689 * @dynamic_nss_chains_support: Per vdev dynamic nss chains update capability 1690 * @sar_cmd_params: SAR command params to be configured to the FW 1691 */ 1692 struct hdd_context { 1693 struct wlan_objmgr_psoc *psoc; 1694 struct wlan_objmgr_pdev *pdev; 1695 mac_handle_t mac_handle; 1696 struct wiphy *wiphy; 1697 qdf_spinlock_t hdd_adapter_lock; 1698 qdf_list_t hdd_adapters; /* List of adapters */ 1699 1700 /** Pointer for firmware image data */ 1701 const struct firmware *fw; 1702 1703 /** Pointer for configuration data */ 1704 const struct firmware *cfg; 1705 1706 /** Pointer to the parent device */ 1707 struct device *parent_dev; 1708 1709 /** Config values read from qcom_cfg.ini file */ 1710 struct hdd_config *config; 1711 1712 /* Pointer for wiphy 2G/5G band channels */ 1713 struct ieee80211_channel *channels_2ghz; 1714 struct ieee80211_channel *channels_5ghz; 1715 1716 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) 1717 struct ieee80211_sband_iftype_data *iftype_data_2g; 1718 struct ieee80211_sband_iftype_data *iftype_data_5g; 1719 #endif 1720 1721 /* Completion variable to indicate Mc Thread Suspended */ 1722 struct completion mc_sus_event_var; 1723 1724 bool is_scheduler_suspended; 1725 1726 #ifdef QCA_CONFIG_SMP 1727 bool is_ol_rx_thread_suspended; 1728 #endif 1729 1730 bool hdd_wlan_suspended; 1731 bool suspended; 1732 /* flag to start pktlog after SSR/PDR if previously enabled */ 1733 bool is_pktlog_enabled; 1734 1735 /* Lock to avoid race condition during start/stop bss */ 1736 struct mutex sap_lock; 1737 1738 #ifdef FEATURE_OEM_DATA_SUPPORT 1739 /* OEM App registered or not */ 1740 bool oem_app_registered; 1741 1742 /* OEM App Process ID */ 1743 int32_t oem_pid; 1744 #endif 1745 1746 /** Concurrency Parameters*/ 1747 uint32_t concurrency_mode; 1748 1749 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE]; 1750 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE]; 1751 1752 /** P2P Device MAC Address for the adapter */ 1753 struct qdf_mac_addr p2p_device_address; 1754 1755 qdf_wake_lock_t rx_wake_lock; 1756 qdf_wake_lock_t sap_wake_lock; 1757 1758 /* Flag keeps track of wiphy suspend/resume */ 1759 bool is_wiphy_suspended; 1760 1761 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH 1762 struct qdf_periodic_work bus_bw_work; 1763 int cur_vote_level; 1764 qdf_spinlock_t bus_bw_lock; 1765 int cur_rx_level; 1766 uint64_t prev_no_rx_offload_pkts; 1767 uint64_t prev_rx_offload_pkts; 1768 /* Count of non TSO packets in previous bus bw delta time */ 1769 uint64_t prev_no_tx_offload_pkts; 1770 /* Count of TSO packets in previous bus bw delta time */ 1771 uint64_t prev_tx_offload_pkts; 1772 int cur_tx_level; 1773 uint64_t prev_tx; 1774 qdf_atomic_t low_tput_gro_enable; 1775 uint32_t bus_low_vote_cnt; 1776 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/ 1777 1778 struct completion ready_to_suspend; 1779 /* defining the solution type */ 1780 uint32_t target_type; 1781 1782 /* defining the firmware version */ 1783 uint32_t target_fw_version; 1784 uint32_t target_fw_vers_ext; 1785 struct hdd_fw_ver_info fw_version_info; 1786 1787 /* defining the chip/rom version */ 1788 uint32_t target_hw_version; 1789 /* defining the chip/rom revision */ 1790 uint32_t target_hw_revision; 1791 /* chip/rom name */ 1792 char *target_hw_name; 1793 struct regulatory reg; 1794 #ifdef FEATURE_WLAN_CH_AVOID 1795 uint16_t unsafe_channel_count; 1796 uint16_t unsafe_channel_list[NUM_CHANNELS]; 1797 #endif /* FEATURE_WLAN_CH_AVOID */ 1798 1799 uint8_t max_intf_count; 1800 uint8_t current_intf_count; 1801 #ifdef WLAN_FEATURE_LPSS 1802 uint8_t lpss_support; 1803 #endif 1804 uint8_t ap_arpns_support; 1805 tSirScanType ioctl_scan_mode; 1806 1807 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH 1808 qdf_work_t sta_ap_intf_check_work; 1809 #endif 1810 1811 uint8_t dev_dfs_cac_status; 1812 1813 bool bt_coex_mode_set; 1814 #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE 1815 qdf_mc_timer_t skip_acs_scan_timer; 1816 uint8_t skip_acs_scan_status; 1817 uint32_t *last_acs_freq_list; 1818 uint8_t num_of_channels; 1819 qdf_spinlock_t acs_skip_lock; 1820 #endif 1821 1822 qdf_wake_lock_t sap_dfs_wakelock; 1823 atomic_t sap_dfs_ref_cnt; 1824 1825 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT 1826 bool is_extwow_app_type1_param_set; 1827 bool is_extwow_app_type2_param_set; 1828 #endif 1829 1830 /* Time since boot up to extscan start (in micro seconds) */ 1831 uint64_t ext_scan_start_since_boot; 1832 unsigned long g_event_flags; 1833 uint8_t miracast_value; 1834 1835 #ifdef WLAN_NS_OFFLOAD 1836 /* IPv6 notifier callback for handling NS offload on change in IP */ 1837 struct notifier_block ipv6_notifier; 1838 #endif 1839 bool ns_offload_enable; 1840 /* IPv4 notifier callback for handling ARP offload on change in IP */ 1841 struct notifier_block ipv4_notifier; 1842 1843 /* number of rf chains supported by target */ 1844 uint32_t num_rf_chains; 1845 /* Is htTxSTBC supported by target */ 1846 uint8_t ht_tx_stbc_supported; 1847 #ifdef WLAN_FEATURE_OFFLOAD_PACKETS 1848 struct hdd_offloaded_packets_ctx op_ctx; 1849 #endif 1850 bool mcc_mode; 1851 struct mutex memdump_lock; 1852 uint16_t driver_dump_size; 1853 uint8_t *driver_dump_mem; 1854 1855 bool connection_in_progress; 1856 qdf_spinlock_t connection_status_lock; 1857 1858 uint16_t hdd_txrx_hist_idx; 1859 struct hdd_tx_rx_histogram *hdd_txrx_hist; 1860 1861 /* 1862 * place to store FTM capab of target. This allows changing of FTM capab 1863 * at runtime and intersecting it with target capab before updating. 1864 */ 1865 uint32_t fine_time_meas_cap_target; 1866 uint32_t rx_high_ind_cnt; 1867 /* For Rx thread non GRO/LRO packet accounting */ 1868 uint64_t no_rx_offload_pkt_cnt; 1869 uint64_t no_tx_offload_pkt_cnt; 1870 /* Current number of TX X RX chains being used */ 1871 enum antenna_mode current_antenna_mode; 1872 1873 /* the radio index assigned by cnss_logger */ 1874 int radio_index; 1875 qdf_work_t sap_pre_cac_work; 1876 bool hbw_requested; 1877 enum RX_OFFLOAD ol_enable; 1878 #ifdef WLAN_FEATURE_NAN 1879 bool nan_datapath_enabled; 1880 #endif 1881 /* Present state of driver cds modules */ 1882 enum driver_modules_status driver_status; 1883 struct qdf_delayed_work psoc_idle_timeout_work; 1884 bool rps; 1885 bool dynamic_rps; 1886 bool enable_rxthread; 1887 /* support for DP RX threads */ 1888 bool enable_dp_rx_threads; 1889 bool napi_enable; 1890 struct acs_dfs_policy acs_policy; 1891 uint16_t wmi_max_len; 1892 struct suspend_resume_stats suspend_resume_stats; 1893 struct hdd_runtime_pm_context runtime_context; 1894 bool roaming_in_progress; 1895 struct scan_chan_info *chan_info; 1896 struct mutex chan_info_lock; 1897 /* bit map to set/reset TDLS by different sources */ 1898 unsigned long tdls_source_bitmap; 1899 bool tdls_umac_comp_active; 1900 bool tdls_nap_active; 1901 uint8_t beacon_probe_rsp_cnt_per_scan; 1902 uint8_t last_scan_reject_vdev_id; 1903 enum scan_reject_states last_scan_reject_reason; 1904 unsigned long last_scan_reject_timestamp; 1905 uint8_t scan_reject_cnt; 1906 bool dfs_cac_offload; 1907 bool reg_offload; 1908 bool rcpi_enabled; 1909 #ifdef FEATURE_WLAN_CH_AVOID 1910 struct ch_avoid_ind_type coex_avoid_freq_list; 1911 struct ch_avoid_ind_type dnbs_avoid_freq_list; 1912 /* Lock to control access to dnbs and coex avoid freq list */ 1913 struct mutex avoid_freq_lock; 1914 #endif 1915 #ifdef WLAN_FEATURE_TSF 1916 /* indicate whether tsf has been initialized */ 1917 qdf_atomic_t tsf_ready_flag; 1918 /* indicate whether it's now capturing tsf(updating tstamp-pair) */ 1919 qdf_atomic_t cap_tsf_flag; 1920 /* the context that is capturing tsf */ 1921 struct hdd_adapter *cap_tsf_context; 1922 #endif 1923 #ifdef WLAN_FEATURE_TSF_PTP 1924 struct ptp_clock_info ptp_cinfo; 1925 struct ptp_clock *ptp_clock; 1926 #endif 1927 uint8_t bt_a2dp_active:1; 1928 uint8_t bt_vo_active:1; 1929 enum band_info curr_band; 1930 bool imps_enabled; 1931 #ifdef WLAN_FEATURE_PACKET_FILTERING 1932 int user_configured_pkt_filter_rules; 1933 #endif 1934 bool is_fils_roaming_supported; 1935 QDF_STATUS (*receive_offload_cb)(struct hdd_adapter *, 1936 struct sk_buff *); 1937 qdf_atomic_t vendor_disable_lro_flag; 1938 1939 /* disable RX offload (GRO/LRO) in concurrency scenarios */ 1940 qdf_atomic_t disable_rx_ol_in_concurrency; 1941 /* disable RX offload (GRO/LRO) in low throughput scenarios */ 1942 qdf_atomic_t disable_rx_ol_in_low_tput; 1943 bool en_tcp_delack_no_lro; 1944 bool force_rsne_override; 1945 qdf_wake_lock_t monitor_mode_wakelock; 1946 bool lte_coex_ant_share; 1947 bool obss_scan_offload; 1948 int sscan_pid; 1949 uint32_t track_arp_ip; 1950 1951 /* defining the board related information */ 1952 uint32_t hw_bd_id; 1953 struct board_info hw_bd_info; 1954 #ifdef WLAN_SUPPORT_TWT 1955 enum twt_status twt_state; 1956 qdf_event_t twt_disable_comp_evt; 1957 #endif 1958 #ifdef FEATURE_WLAN_APF 1959 uint32_t apf_version; 1960 bool apf_enabled_v2; 1961 #endif 1962 1963 #ifdef DISABLE_CHANNEL_LIST 1964 struct hdd_cache_channels *original_channels; 1965 qdf_mutex_t cache_channel_lock; 1966 #endif 1967 enum sar_version sar_version; 1968 struct hdd_dynamic_mac dynamic_mac_list[QDF_MAX_CONCURRENCY_PERSONA]; 1969 bool dynamic_nss_chains_support; 1970 struct qdf_mac_addr hw_macaddr; 1971 struct qdf_mac_addr provisioned_mac_addr[QDF_MAX_CONCURRENCY_PERSONA]; 1972 struct qdf_mac_addr derived_mac_addr[QDF_MAX_CONCURRENCY_PERSONA]; 1973 uint32_t num_provisioned_addr; 1974 uint32_t num_derived_addr; 1975 unsigned long provisioned_intf_addr_mask; 1976 unsigned long derived_intf_addr_mask; 1977 1978 struct sar_limit_cmd_params *sar_cmd_params; 1979 1980 qdf_time_t runtime_resume_start_time_stamp; 1981 qdf_time_t runtime_suspend_done_time_stamp; 1982 #ifdef CLD_PM_QOS 1983 struct pm_qos_request pm_qos_req; 1984 #endif 1985 }; 1986 1987 /** 1988 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters 1989 * @channel_count: channel count 1990 * @channel_list: pointer to channel list 1991 * @pcl_count: pcl list count 1992 * @vendor_pcl_list: pointer to pcl list 1993 * @vendor_weight_list: pointer to pcl weight list 1994 */ 1995 struct hdd_vendor_acs_chan_params { 1996 uint32_t channel_count; 1997 uint8_t *channel_list; 1998 uint32_t pcl_count; 1999 uint8_t *vendor_pcl_list; 2000 uint8_t *vendor_weight_list; 2001 }; 2002 2003 /** 2004 * struct hdd_external_acs_timer_context - acs timer context 2005 * @reason: reason for acs trigger 2006 * @adapter: hdd adapter for acs 2007 */ 2008 struct hdd_external_acs_timer_context { 2009 int8_t reason; 2010 struct hdd_adapter *adapter; 2011 }; 2012 2013 /** 2014 * struct hdd_vendor_chan_info - vendor channel info 2015 * @band: channel operating band 2016 * @pri_ch: primary channel 2017 * @ht_sec_ch: secondary channel 2018 * @vht_seg0_center_ch: segment0 for vht 2019 * @vht_seg1_center_ch: vht segment 1 2020 * @chan_width: channel width 2021 */ 2022 struct hdd_vendor_chan_info { 2023 uint8_t band; 2024 uint8_t pri_ch; 2025 uint8_t ht_sec_ch; 2026 uint8_t vht_seg0_center_ch; 2027 uint8_t vht_seg1_center_ch; 2028 uint8_t chan_width; 2029 }; 2030 2031 /** 2032 * struct hdd_channel_info - standard channel info 2033 * @freq: Freq in Mhz 2034 * @flags: channel info flags 2035 * @flagext: extended channel info flags 2036 * @ieee_chan_number: channel number 2037 * @max_reg_power: max tx power according to regulatory 2038 * @max_radio_power: max radio power 2039 * @min_radio_power: min radio power 2040 * @reg_class_id: regulatory class 2041 * @max_antenna_gain: max antenna gain allowed on channel 2042 * @vht_center_freq_seg0: vht center freq segment 0 2043 * @vht_center_freq_seg1: vht center freq segment 1 2044 */ 2045 struct hdd_channel_info { 2046 u_int16_t freq; 2047 u_int32_t flags; 2048 u_int16_t flagext; 2049 u_int8_t ieee_chan_number; 2050 int8_t max_reg_power; 2051 int8_t max_radio_power; 2052 int8_t min_radio_power; 2053 u_int8_t reg_class_id; 2054 u_int8_t max_antenna_gain; 2055 u_int8_t vht_center_freq_seg0; 2056 u_int8_t vht_center_freq_seg1; 2057 }; 2058 2059 /* 2060 * Function declarations and documentation 2061 */ 2062 2063 int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter, 2064 uint32_t chan_number, 2065 enum phy_ch_width chan_bw); 2066 2067 QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx, 2068 struct hdd_adapter **out_adapter); 2069 2070 QDF_STATUS hdd_get_next_adapter(struct hdd_context *hdd_ctx, 2071 struct hdd_adapter *current_adapter, 2072 struct hdd_adapter **out_adapter); 2073 2074 QDF_STATUS hdd_remove_adapter(struct hdd_context *hdd_ctx, 2075 struct hdd_adapter *adapter); 2076 2077 QDF_STATUS hdd_remove_front_adapter(struct hdd_context *hdd_ctx, 2078 struct hdd_adapter **out_adapter); 2079 2080 QDF_STATUS hdd_add_adapter_back(struct hdd_context *hdd_ctx, 2081 struct hdd_adapter *adapter); 2082 2083 QDF_STATUS hdd_add_adapter_front(struct hdd_context *hdd_ctx, 2084 struct hdd_adapter *adapter); 2085 2086 /** 2087 * hdd_for_each_adapter - adapter iterator macro 2088 * @hdd_ctx: the global HDD context 2089 * @adapter: an hdd_adapter pointer to use as a cursor 2090 */ 2091 #define hdd_for_each_adapter(hdd_ctx, adapter) \ 2092 for (hdd_get_front_adapter(hdd_ctx, &adapter); \ 2093 adapter; \ 2094 hdd_get_next_adapter(hdd_ctx, adapter, &adapter)) 2095 2096 struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, 2097 uint8_t session_type, 2098 const char *name, tSirMacAddr mac_addr, 2099 unsigned char name_assign_type, 2100 bool rtnl_held); 2101 2102 /** 2103 * hdd_close_adapter() - remove and free @adapter from the adapter list 2104 * @hdd_ctx: The Hdd context containing the adapter list 2105 * @adapter: the adapter to remove and free 2106 * @rtnl_held: if the caller is already holding the RTNL lock 2107 * 2108 * Return: None 2109 */ 2110 void hdd_close_adapter(struct hdd_context *hdd_ctx, 2111 struct hdd_adapter *adapter, 2112 bool rtnl_held); 2113 2114 /** 2115 * hdd_close_all_adapters() - remove and free all adapters from the adapter list 2116 * @hdd_ctx: The Hdd context containing the adapter list 2117 * @rtnl_held: if the caller is already holding the RTNL lock 2118 * 2119 * Return: None 2120 */ 2121 void hdd_close_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held); 2122 2123 QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx); 2124 void hdd_deinit_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held); 2125 QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx); 2126 QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx); 2127 2128 /** 2129 * hdd_get_adapter_by_vdev() - Return adapter with the given vdev id 2130 * @hdd_ctx: hdd context. 2131 * @vdev_id: vdev id for the adapter to get. 2132 * 2133 * This function is used to get the adapter with provided vdev id 2134 * 2135 * Return: adapter pointer if found 2136 * 2137 */ 2138 struct hdd_adapter *hdd_get_adapter_by_vdev(struct hdd_context *hdd_ctx, 2139 uint32_t vdev_id); 2140 2141 struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx, 2142 tSirMacAddr mac_addr); 2143 2144 /** 2145 * hdd_get_adapter_home_channel() - return home channel of adapter 2146 * @adapter: hdd adapter of vdev 2147 * 2148 * This function returns operation channel of station/p2p-cli if 2149 * connected, returns opration channel of sap/p2p-go if started. 2150 * 2151 * Return: home channel if connected/started or invalid channel 0 2152 */ 2153 uint8_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter); 2154 2155 /* 2156 * hdd_get_adapter_by_rand_macaddr() - find Random mac adapter 2157 * @hdd_ctx: hdd context 2158 * @mac_addr: random mac addr 2159 * 2160 * Find the Adapter based on random mac addr. Adapter's vdev 2161 * have active random mac list. 2162 * 2163 * Return: adapter ptr or null 2164 */ 2165 struct hdd_adapter * 2166 hdd_get_adapter_by_rand_macaddr(struct hdd_context *hdd_ctx, 2167 tSirMacAddr mac_addr); 2168 2169 /** 2170 * hdd_is_vdev_in_conn_state() - Check whether the vdev is in 2171 * connected/started state. 2172 * @adapter: hdd adapter of the vdev 2173 * 2174 * This function will give whether the vdev in the adapter is in 2175 * connected/started state. 2176 * 2177 * Return: True/false 2178 */ 2179 bool hdd_is_vdev_in_conn_state(struct hdd_adapter *adapter); 2180 2181 int hdd_vdev_create(struct hdd_adapter *adapter, 2182 csr_roam_complete_cb callback, void *ctx); 2183 int hdd_vdev_destroy(struct hdd_adapter *adapter); 2184 int hdd_vdev_ready(struct hdd_adapter *adapter); 2185 2186 QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter); 2187 struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx, 2188 enum QDF_OPMODE mode); 2189 2190 /** 2191 * hdd_get_device_mode() - Get device mode 2192 * @vdev_id: vdev id 2193 * 2194 * Return: Device mode 2195 */ 2196 enum QDF_OPMODE hdd_get_device_mode(uint32_t vdev_id); 2197 2198 void hdd_deinit_adapter(struct hdd_context *hdd_ctx, 2199 struct hdd_adapter *adapter, 2200 bool rtnl_held); 2201 QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx, 2202 struct hdd_adapter *adapter); 2203 2204 void hdd_set_station_ops(struct net_device *dev); 2205 2206 /** 2207 * wlan_hdd_get_intf_addr() - Get address for the interface 2208 * @hdd_ctx: Pointer to hdd context 2209 * @interface_type: type of the interface for which address is queried 2210 * 2211 * This function is used to get mac address for every new interface 2212 * 2213 * Return: If addr is present then return pointer to MAC address 2214 * else NULL 2215 */ 2216 2217 uint8_t *wlan_hdd_get_intf_addr(struct hdd_context *hdd_ctx, 2218 enum QDF_OPMODE interface_type); 2219 void wlan_hdd_release_intf_addr(struct hdd_context *hdd_ctx, 2220 uint8_t *releaseAddr); 2221 uint8_t hdd_get_operating_channel(struct hdd_context *hdd_ctx, 2222 enum QDF_OPMODE mode); 2223 2224 void hdd_set_conparam(int32_t con_param); 2225 enum QDF_GLOBAL_MODE hdd_get_conparam(void); 2226 void wlan_hdd_reset_prob_rspies(struct hdd_adapter *adapter); 2227 void hdd_prevent_suspend(uint32_t reason); 2228 2229 /* 2230 * hdd_get_first_valid_adapter() - Get the first valid adapter from adapter list 2231 * 2232 * This function is used to fetch the first valid adapter from the adapter 2233 * list. If there is no valid adapter then it returns NULL 2234 * 2235 * @hdd_ctx: HDD context handler 2236 * 2237 * Return: NULL if no valid adapter found in the adapter list 2238 * 2239 */ 2240 struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx); 2241 2242 void hdd_allow_suspend(uint32_t reason); 2243 void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason); 2244 2245 #ifdef QCA_IBSS_SUPPORT 2246 /** 2247 * hdd_set_ibss_power_save_params() - update IBSS Power Save params to WMA. 2248 * @struct hdd_adapter Hdd adapter. 2249 * 2250 * This function sets the IBSS power save config parameters to WMA 2251 * which will send it to firmware if FW supports IBSS power save 2252 * before vdev start. 2253 * 2254 * Return: QDF_STATUS QDF_STATUS_SUCCESS on Success and QDF_STATUS_E_FAILURE 2255 * on failure. 2256 */ 2257 QDF_STATUS hdd_set_ibss_power_save_params(struct hdd_adapter *adapter); 2258 #else 2259 static inline QDF_STATUS 2260 hdd_set_ibss_power_save_params(struct hdd_adapter *adapter) 2261 { 2262 return QDF_STATUS_SUCCESS; 2263 } 2264 #endif 2265 2266 /** 2267 * wlan_hdd_validate_context() - check the HDD context 2268 * @hdd_ctx: Global HDD context pointer 2269 * 2270 * Return: 0 if the context is valid. Error code otherwise 2271 */ 2272 #define wlan_hdd_validate_context(hdd_ctx) \ 2273 __wlan_hdd_validate_context(hdd_ctx, __func__) 2274 2275 int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func); 2276 2277 /** 2278 * hdd_validate_adapter() - Validate the given adapter 2279 * @adapter: the adapter to validate 2280 * 2281 * This function validates the given adapter, and ensures that it is open. 2282 * 2283 * Return: Errno 2284 */ 2285 #define hdd_validate_adapter(adapter) \ 2286 __hdd_validate_adapter(adapter, __func__) 2287 2288 int __hdd_validate_adapter(struct hdd_adapter *adapter, const char *func); 2289 2290 /** 2291 * wlan_hdd_validate_vdev_id() - ensure the given vdev Id is valid 2292 * @vdev_id: the vdev Id to validate 2293 * 2294 * Return: Errno 2295 */ 2296 #define wlan_hdd_validate_vdev_id(vdev_id) \ 2297 __wlan_hdd_validate_vdev_id(vdev_id, __func__) 2298 2299 int __wlan_hdd_validate_vdev_id(uint8_t vdev_id, const char *func); 2300 2301 /** 2302 * hdd_is_valid_mac_address() - validate MAC address 2303 * @mac_addr: Pointer to the input MAC address 2304 * 2305 * This function validates whether the given MAC address is valid or not 2306 * Expected MAC address is of the format XX:XX:XX:XX:XX:XX 2307 * where X is the hexa decimal digit character and separated by ':' 2308 * This algorithm works even if MAC address is not separated by ':' 2309 * 2310 * This code checks given input string mac contains exactly 12 hexadecimal 2311 * digits and a separator colon : appears in the input string only after 2312 * an even number of hex digits. 2313 * 2314 * Return: true for valid and false for invalid 2315 */ 2316 bool hdd_is_valid_mac_address(const uint8_t *mac_addr); 2317 2318 bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx); 2319 2320 /** 2321 * wlan_hdd_validate_mac_address() - Function to validate mac address 2322 * @mac_addr: input mac address 2323 * 2324 * Return QDF_STATUS 2325 */ 2326 #define wlan_hdd_validate_mac_address(mac_addr) \ 2327 __wlan_hdd_validate_mac_address(mac_addr, __func__) 2328 2329 QDF_STATUS __wlan_hdd_validate_mac_address(struct qdf_mac_addr *mac_addr, 2330 const char *func); 2331 2332 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH 2333 /** 2334 * hdd_bus_bw_compute_prev_txrx_stats() - get tx and rx stats 2335 * @adapter: hdd adapter reference 2336 * 2337 * This function get the collected tx and rx stats before starting 2338 * the bus bandwidth timer. 2339 * 2340 * Return: None 2341 */ 2342 void hdd_bus_bw_compute_prev_txrx_stats(struct hdd_adapter *adapter); 2343 2344 /** 2345 * hdd_bus_bw_compute_reset_prev_txrx_stats() - reset previous tx and rx stats 2346 * @adapter: hdd adapter reference 2347 * 2348 * This function resets the adapter previous tx rx stats. 2349 * 2350 * Return: None 2351 */ 2352 void hdd_bus_bw_compute_reset_prev_txrx_stats(struct hdd_adapter *adapter); 2353 2354 /** 2355 * hdd_bus_bw_compute_timer_start() - start the bandwidth timer 2356 * @hdd_ctx: the global hdd context 2357 * 2358 * Return: None 2359 */ 2360 void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx); 2361 2362 /** 2363 * hdd_bus_bw_compute_timer_try_start() - try to start the bandwidth timer 2364 * @hdd_ctx: the global hdd context 2365 * 2366 * This function ensures there is at least one adapter in the associated state 2367 * before starting the bandwidth timer. 2368 * 2369 * Return: None 2370 */ 2371 void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx); 2372 2373 /** 2374 * hdd_bus_bw_compute_timer_stop() - stop the bandwidth timer 2375 * @hdd_ctx: the global hdd context 2376 * 2377 * Return: None 2378 */ 2379 void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx); 2380 2381 /** 2382 * hdd_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer 2383 * @hdd_ctx: the global hdd context 2384 * 2385 * This function ensures there are no adapters in the associated state before 2386 * stopping the bandwidth timer. 2387 * 2388 * Return: None 2389 */ 2390 void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx); 2391 2392 /** 2393 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures. 2394 * @hdd_ctx: HDD context 2395 * 2396 * Initialize bus bandwidth related data structures like spinlock and timer. 2397 * 2398 * Return: None. 2399 */ 2400 int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx); 2401 2402 /** 2403 * hdd_bus_bandwidth_deinit() - De-initialize bus bandwidth data structures. 2404 * @hdd_ctx: HDD context 2405 * 2406 * De-initialize bus bandwidth related data structures like timer. 2407 * 2408 * Return: None. 2409 */ 2410 void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx); 2411 2412 static inline enum pld_bus_width_type 2413 hdd_get_current_throughput_level(struct hdd_context *hdd_ctx) 2414 { 2415 return hdd_ctx->cur_vote_level; 2416 } 2417 2418 static inline bool 2419 hdd_is_low_tput_gro_enable(struct hdd_context *hdd_ctx) 2420 { 2421 return (qdf_atomic_read(&hdd_ctx->low_tput_gro_enable)) ? true : false; 2422 } 2423 2424 #define GET_CUR_RX_LVL(config) ((config)->cur_rx_level) 2425 #define GET_BW_COMPUTE_INTV(config) ((config)->bus_bw_compute_interval) 2426 #else 2427 2428 static inline 2429 void hdd_bus_bw_compute_prev_txrx_stats(struct hdd_adapter *adapter) 2430 { 2431 } 2432 2433 static inline 2434 void hdd_bus_bw_compute_reset_prev_txrx_stats(struct hdd_adapter *adapter) 2435 { 2436 } 2437 2438 static inline 2439 void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx) 2440 { 2441 } 2442 2443 static inline 2444 void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx) 2445 { 2446 } 2447 2448 static inline 2449 void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx) 2450 { 2451 } 2452 2453 static inline 2454 void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx) 2455 { 2456 } 2457 2458 static inline 2459 int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx) 2460 { 2461 return 0; 2462 } 2463 2464 static inline 2465 void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx) 2466 { 2467 } 2468 2469 static inline enum pld_bus_width_type 2470 hdd_get_current_throughput_level(struct hdd_context *hdd_ctx) 2471 { 2472 return PLD_BUS_WIDTH_NONE; 2473 } 2474 2475 static inline bool 2476 hdd_is_low_tput_gro_enable(struct hdd_context *hdd_ctx) 2477 { 2478 return false; 2479 } 2480 2481 #define GET_CUR_RX_LVL(config) 0 2482 #define GET_BW_COMPUTE_INTV(config) 0 2483 2484 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/ 2485 2486 int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask); 2487 2488 int hdd_init(void); 2489 void hdd_deinit(void); 2490 2491 /** 2492 * hdd_wlan_startup() - HDD init function 2493 * hdd_ctx: the HDD context corresponding to the psoc to startup 2494 * 2495 * Return: Errno 2496 */ 2497 int hdd_wlan_startup(struct hdd_context *hdd_ctx); 2498 2499 /** 2500 * hdd_wlan_exit() - HDD WLAN exit function 2501 * @hdd_ctx: pointer to the HDD Context 2502 * 2503 * Return: None 2504 */ 2505 void hdd_wlan_exit(struct hdd_context *hdd_ctx); 2506 2507 /** 2508 * hdd_psoc_create_vdevs() - create the default vdevs for a psoc 2509 * @hdd_ctx: the HDD context for the psoc to operate against 2510 * 2511 * Return: QDF_STATUS 2512 */ 2513 QDF_STATUS hdd_psoc_create_vdevs(struct hdd_context *hdd_ctx); 2514 2515 /* 2516 * hdd_context_create() - Allocate and inialize HDD context. 2517 * @dev: Device Pointer to the underlying device 2518 * 2519 * Allocate and initialize HDD context. HDD context is allocated as part of 2520 * wiphy allocation and then context is initialized. 2521 * 2522 * Return: HDD context on success and ERR_PTR on failure 2523 */ 2524 struct hdd_context *hdd_context_create(struct device *dev); 2525 2526 /** 2527 * hdd_context_destroy() - Destroy HDD context 2528 * @hdd_ctx: HDD context to be destroyed. 2529 * 2530 * Free config and HDD context as well as destroy all the resources. 2531 * 2532 * Return: None 2533 */ 2534 void hdd_context_destroy(struct hdd_context *hdd_ctx); 2535 2536 int hdd_wlan_notify_modem_power_state(int state); 2537 2538 void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len); 2539 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN 2540 void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable); 2541 #endif 2542 2543 struct hdd_adapter * 2544 hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter, 2545 bool check_start_bss); 2546 2547 bool hdd_is_5g_supported(struct hdd_context *hdd_ctx); 2548 2549 /** 2550 * hdd_is_2g_supported() - check if 2GHz channels are supported 2551 * @hdd_ctx: Pointer to the hdd context 2552 * 2553 * HDD function to know if 2GHz channels are supported 2554 * 2555 * Return: true if 2GHz channels are supported 2556 */ 2557 2558 bool hdd_is_2g_supported(struct hdd_context *hdd_ctx); 2559 2560 int wlan_hdd_scan_abort(struct hdd_adapter *adapter); 2561 2562 #ifdef WLAN_FEATURE_ROAM_OFFLOAD 2563 static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx) 2564 { 2565 bool is_roam_offload; 2566 2567 ucfg_mlme_get_roaming_offload(hdd_ctx->psoc, &is_roam_offload); 2568 2569 return is_roam_offload; 2570 } 2571 #else 2572 static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx) 2573 { 2574 return false; 2575 } 2576 #endif 2577 2578 #ifdef WLAN_FEATURE_HOST_ROAM 2579 static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx) 2580 { 2581 bool lfr_enabled; 2582 2583 ucfg_mlme_is_lfr_enabled(hdd_ctx->psoc, &lfr_enabled); 2584 2585 return lfr_enabled; 2586 } 2587 #else 2588 static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx) 2589 { 2590 return false; 2591 } 2592 #endif 2593 2594 static inline bool hdd_roaming_supported(struct hdd_context *hdd_ctx) 2595 { 2596 bool val; 2597 2598 val = hdd_driver_roaming_supported(hdd_ctx) || 2599 roaming_offload_enabled(hdd_ctx); 2600 2601 return val; 2602 } 2603 2604 #ifdef CFG80211_SCAN_RANDOM_MAC_ADDR 2605 static inline bool hdd_scan_random_mac_addr_supported(void) 2606 { 2607 return true; 2608 } 2609 #else 2610 static inline bool hdd_scan_random_mac_addr_supported(void) 2611 { 2612 return false; 2613 } 2614 #endif 2615 2616 /** 2617 * hdd_start_vendor_acs(): Start vendor ACS procedure 2618 * @adapter: pointer to SAP adapter struct 2619 * 2620 * This function sends the ACS config to the ACS daemon and 2621 * starts the vendor ACS timer to wait for the next command. 2622 * 2623 * Return: Status of vendor ACS procedure 2624 */ 2625 int hdd_start_vendor_acs(struct hdd_adapter *adapter); 2626 2627 /** 2628 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer 2629 * @context: timeout handler context 2630 * 2631 * Return: None 2632 */ 2633 void hdd_acs_response_timeout_handler(void *context); 2634 2635 /** 2636 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP 2637 * @adapter: pointer to SAP adapter struct 2638 * 2639 * This function starts the ACS procedure if there are no 2640 * constraints like MBSSID DFS restrictions. 2641 * 2642 * Return: Status of ACS Start procedure 2643 */ 2644 int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter); 2645 2646 /** 2647 * hdd_cfg80211_update_acs_config() - update acs config to application 2648 * @adapter: hdd adapter 2649 * @reason: channel change reason 2650 * 2651 * Return: 0 for success else error code 2652 */ 2653 int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter, 2654 uint8_t reason); 2655 2656 /** 2657 * hdd_update_acs_timer_reason() - update acs timer start reason 2658 * @adapter: hdd adapter 2659 * @reason: channel change reason 2660 * 2661 * Return: 0 for success 2662 */ 2663 int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason); 2664 2665 /** 2666 * hdd_switch_sap_channel() - Move SAP to the given channel 2667 * @adapter: AP adapter 2668 * @channel: Channel 2669 * @forced: Force to switch channel, ignore SCC/MCC check 2670 * 2671 * Moves the SAP interface by invoking the function which 2672 * executes the callback to perform channel switch using (E)CSA. 2673 * 2674 * Return: None 2675 */ 2676 void hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel, 2677 bool forced); 2678 2679 #if defined(FEATURE_WLAN_CH_AVOID) 2680 void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx); 2681 2682 void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt, 2683 struct unsafe_ch_list *unsafe_chan_list, 2684 struct ch_avoid_ind_type *avoid_freq_list); 2685 #else 2686 static inline 2687 void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx) 2688 { 2689 } 2690 2691 static inline 2692 void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt, 2693 struct unsafe_ch_list *unsafe_chan_list, 2694 struct ch_avoid_ind_type *avoid_freq_list) 2695 { 2696 } 2697 #endif 2698 2699 /** 2700 * hdd_free_mac_address_lists() - Free both the MAC address lists 2701 * @hdd_ctx: HDD context 2702 * 2703 * This API clears/memset provisioned address list and 2704 * derived address list 2705 * 2706 */ 2707 void hdd_free_mac_address_lists(struct hdd_context *hdd_ctx); 2708 2709 /** 2710 * hdd_update_macaddr() - update mac address 2711 * @hdd_ctx: hdd contxt 2712 * @hw_macaddr: mac address 2713 * @generate_mac_auto: Indicates whether the first address is 2714 * provisioned address or derived address. 2715 * 2716 * Mac address for multiple virtual interface is found as following 2717 * i) The mac address of the first interface is just the actual hw mac address. 2718 * ii) MSM 3 or 4 bits of byte5 of the actual mac address are used to 2719 * define the mac address for the remaining interfaces and locally 2720 * admistered bit is set. INTF_MACADDR_MASK is based on the number of 2721 * supported virtual interfaces, right now this is 0x07 (meaning 8 2722 * interface). 2723 * Byte[3] of second interface will be hw_macaddr[3](bit5..7) + 1, 2724 * for third interface it will be hw_macaddr[3](bit5..7) + 2, etc. 2725 * 2726 * Return: None 2727 */ 2728 void hdd_update_macaddr(struct hdd_context *hdd_ctx, 2729 struct qdf_mac_addr hw_macaddr, bool generate_mac_auto); 2730 2731 /** 2732 * hdd_store_nss_chains_cfg_in_vdev() - Store the per vdev ini cfg in vdev_obj 2733 * @adapter: Current HDD adapter passed from caller 2734 * 2735 * This function will store the per vdev nss params to the particular mlme 2736 * vdev obj. 2737 * 2738 * Return: None 2739 */ 2740 void 2741 hdd_store_nss_chains_cfg_in_vdev(struct hdd_adapter *adapter); 2742 2743 /** 2744 * wlan_hdd_disable_roaming() - disable roaming on all STAs except the input one 2745 * @cur_adapter: Current HDD adapter passed from caller 2746 * @mlme_operation_requestor: roam disable requestor 2747 * 2748 * This function loops through all adapters and disables roaming on each STA 2749 * mode adapter except the current adapter passed from the caller 2750 * 2751 * Return: None 2752 */ 2753 void wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter, 2754 uint32_t mlme_operation_requestor); 2755 2756 /** 2757 * wlan_hdd_enable_roaming() - enable roaming on all STAs except the input one 2758 * @cur_adapter: Current HDD adapter passed from caller 2759 * @mlme_operation_requestor: roam disable requestor 2760 * 2761 * This function loops through all adapters and enables roaming on each STA 2762 * mode adapter except the current adapter passed from the caller 2763 * 2764 * Return: None 2765 */ 2766 void wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter, 2767 uint32_t mlme_operation_requestor); 2768 2769 QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx); 2770 2771 QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx); 2772 2773 void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter); 2774 void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit); 2775 2776 #ifdef QCA_CONFIG_SMP 2777 int wlan_hdd_get_cpu(void); 2778 #else 2779 static inline int wlan_hdd_get_cpu(void) 2780 { 2781 return 0; 2782 } 2783 #endif 2784 2785 void wlan_hdd_sap_pre_cac_failure(void *data); 2786 void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx); 2787 2788 void wlan_hdd_txrx_pause_cb(uint8_t vdev_id, 2789 enum netif_action_type action, enum netif_reason_type reason); 2790 2791 #ifdef QCA_HL_NETDEV_FLOW_CONTROL 2792 void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter, 2793 enum netif_action_type action); 2794 #else 2795 static inline void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter, 2796 enum netif_action_type action) 2797 { 2798 } 2799 #endif /* QCA_HL_NETDEV_FLOW_CONTROL */ 2800 2801 int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value); 2802 void wlan_hdd_deinit_tx_rx_histogram(struct hdd_context *hdd_ctx); 2803 void wlan_hdd_display_tx_rx_histogram(struct hdd_context *hdd_ctx); 2804 void wlan_hdd_clear_tx_rx_histogram(struct hdd_context *hdd_ctx); 2805 2806 void 2807 wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx, 2808 enum qdf_stats_verbosity_level verb_lvl); 2809 void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx); 2810 const char *hdd_get_fwpath(void); 2811 void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind); 2812 2813 /** 2814 * hdd_get_adapter_by_iface_name() - Return adapter with given interface name 2815 * @hdd_ctx: hdd context. 2816 * @iface_name: interface name 2817 * 2818 * This function is used to get the adapter with given interface name 2819 * 2820 * Return: adapter pointer if found, NULL otherwise 2821 * 2822 */ 2823 struct hdd_adapter *hdd_get_adapter_by_iface_name(struct hdd_context *hdd_ctx, 2824 const char *iface_name); 2825 enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width); 2826 2827 /** 2828 * hdd_nl_to_qdf_iface_type() - map nl80211_iftype to QDF_OPMODE 2829 * @nl_type: the input NL80211 interface type to map 2830 * @out_qdf_type: the output, equivalent QDF operating mode 2831 * 2832 * Return: QDF_STATUS 2833 */ 2834 QDF_STATUS hdd_nl_to_qdf_iface_type(enum nl80211_iftype nl_type, 2835 enum QDF_OPMODE *out_qdf_type); 2836 2837 /** 2838 * wlan_hdd_find_opclass() - Find operating class for a channel 2839 * @mac_handle: global MAC handle 2840 * @channel: channel id 2841 * @bw_offset: bandwidth offset 2842 * 2843 * Function invokes sme api to find the operating class 2844 * 2845 * Return: operating class 2846 */ 2847 uint8_t wlan_hdd_find_opclass(mac_handle_t mac_handle, uint8_t channel, 2848 uint8_t bw_offset); 2849 2850 int hdd_update_config(struct hdd_context *hdd_ctx); 2851 2852 /** 2853 * hdd_update_components_config() - Initialize driver per module ini parameters 2854 * @hdd_ctx: HDD Context 2855 * 2856 * API is used to initialize components configuration parameters 2857 * Return: 0 for success, errno for failure 2858 */ 2859 int hdd_update_components_config(struct hdd_context *hdd_ctx); 2860 2861 QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter, 2862 struct net_device *dev, 2863 struct hdd_chan_change_params chan_change, 2864 bool legacy_phymode); 2865 int wlan_hdd_set_channel(struct wiphy *wiphy, 2866 struct net_device *dev, 2867 struct cfg80211_chan_def *chandef, 2868 enum nl80211_channel_type channel_type); 2869 int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, 2870 struct cfg80211_beacon_data *params, 2871 const u8 *ssid, size_t ssid_len, 2872 enum nl80211_hidden_ssid hidden_ssid, 2873 bool check_for_concurrency); 2874 2875 #if !defined(REMOVE_PKT_LOG) 2876 int hdd_process_pktlog_command(struct hdd_context *hdd_ctx, uint32_t set_value, 2877 int set_value2); 2878 int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable, 2879 uint8_t user_triggered, int size); 2880 2881 #else 2882 static inline 2883 int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable, 2884 uint8_t user_triggered, int size) 2885 { 2886 return 0; 2887 } 2888 2889 static inline 2890 int hdd_process_pktlog_command(struct hdd_context *hdd_ctx, 2891 uint32_t set_value, int set_value2) 2892 { 2893 return 0; 2894 } 2895 #endif /* REMOVE_PKT_LOG */ 2896 2897 #if defined(FEATURE_SG) && !defined(CONFIG_HL_SUPPORT) 2898 /** 2899 * hdd_set_sg_flags() - enable SG flag in the network device 2900 * @hdd_ctx: HDD context 2901 * @wlan_dev: network device structure 2902 * 2903 * This function enables the SG feature flag in the 2904 * given network device. 2905 * 2906 * Return: none 2907 */ 2908 static inline void hdd_set_sg_flags(struct hdd_context *hdd_ctx, 2909 struct net_device *wlan_dev) 2910 { 2911 hdd_debug("SG Enabled"); 2912 wlan_dev->features |= NETIF_F_SG; 2913 } 2914 #else 2915 static inline void hdd_set_sg_flags(struct hdd_context *hdd_ctx, 2916 struct net_device *wlan_dev){} 2917 #endif 2918 2919 #ifdef FEATURE_TSO 2920 /** 2921 * hdd_set_tso_flags() - enable TSO flags in the network device 2922 * @hdd_ctx: HDD context 2923 * @wlan_dev: network device structure 2924 * 2925 * This function enables the TSO related feature flags in the 2926 * given network device. 2927 * 2928 * Return: none 2929 */ 2930 static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx, 2931 struct net_device *wlan_dev) 2932 { 2933 if (cdp_cfg_get(cds_get_context(QDF_MODULE_ID_SOC), 2934 cfg_dp_tso_enable) && 2935 cdp_cfg_get(cds_get_context(QDF_MODULE_ID_SOC), 2936 cfg_dp_enable_ip_tcp_udp_checksum_offload)){ 2937 /* 2938 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is 2939 * enabled. 2940 */ 2941 hdd_debug("TSO Enabled"); 2942 wlan_dev->features |= 2943 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 2944 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG; 2945 } 2946 } 2947 #else 2948 static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx, 2949 struct net_device *wlan_dev) 2950 { 2951 hdd_set_sg_flags(hdd_ctx, wlan_dev); 2952 } 2953 #endif /* FEATURE_TSO */ 2954 2955 /** 2956 * wlan_hdd_get_host_log_nl_proto() - Get host log netlink protocol 2957 * @hdd_ctx: HDD context 2958 * 2959 * This function returns with host log netlink protocol settings 2960 * 2961 * Return: none 2962 */ 2963 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE 2964 static inline int wlan_hdd_get_host_log_nl_proto(struct hdd_context *hdd_ctx) 2965 { 2966 return hdd_ctx->config->host_log_custom_nl_proto; 2967 } 2968 #else 2969 static inline int wlan_hdd_get_host_log_nl_proto(struct hdd_context *hdd_ctx) 2970 { 2971 return NETLINK_USERSOCK; 2972 } 2973 #endif 2974 2975 #ifdef CONFIG_CNSS_LOGGER 2976 /** 2977 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case 2978 * @hdd_ctx: the hdd context pointer 2979 * 2980 * The nl_srv_init() will call to cnss_logger_device_register() and 2981 * expect to get a radio_index from cnss_logger module and assign to 2982 * hdd_ctx->radio_index, then to maintain the consistency to original 2983 * design, adding the radio_index check here, then return the error 2984 * code if radio_index is not assigned correctly, which means the nl_init 2985 * from cnss_logger is failed. 2986 * 2987 * Return: 0 if successfully, otherwise error code 2988 */ 2989 static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx) 2990 { 2991 int proto; 2992 2993 proto = wlan_hdd_get_host_log_nl_proto(hdd_ctx); 2994 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy, proto); 2995 2996 /* radio_index is assigned from 0, so only >=0 will be valid index */ 2997 if (hdd_ctx->radio_index >= 0) 2998 return 0; 2999 else 3000 return -EINVAL; 3001 } 3002 #else 3003 /** 3004 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case 3005 * @hdd_ctx: the hdd context pointer 3006 * 3007 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize 3008 * the netlink socket and return the success or not. 3009 * 3010 * Return: the return value from nl_srv_init() 3011 */ 3012 static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx) 3013 { 3014 int proto; 3015 3016 proto = wlan_hdd_get_host_log_nl_proto(hdd_ctx); 3017 return nl_srv_init(hdd_ctx->wiphy, proto); 3018 } 3019 #endif 3020 QDF_STATUS hdd_sme_open_session_callback(uint8_t vdev_id, 3021 QDF_STATUS qdf_status); 3022 QDF_STATUS hdd_sme_close_session_callback(uint8_t vdev_id); 3023 3024 int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, 3025 uint8_t channel, const handoff_src src); 3026 int hdd_register_cb(struct hdd_context *hdd_ctx); 3027 void hdd_deregister_cb(struct hdd_context *hdd_ctx); 3028 int hdd_start_station_adapter(struct hdd_adapter *adapter); 3029 int hdd_start_ap_adapter(struct hdd_adapter *adapter); 3030 int hdd_configure_cds(struct hdd_context *hdd_ctx); 3031 int hdd_set_fw_params(struct hdd_adapter *adapter); 3032 3033 /** 3034 * hdd_wlan_start_modules() - Single driver state machine for starting modules 3035 * @hdd_ctx: HDD context 3036 * @reinit: flag to indicate from SSR or normal path 3037 * 3038 * This function maintains the driver state machine it will be invoked from 3039 * startup, reinit and change interface. Depending on the driver state shall 3040 * perform the opening of the modules. 3041 * 3042 * Return: Errno 3043 */ 3044 int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit); 3045 3046 /** 3047 * hdd_wlan_stop_modules - Single driver state machine for stoping modules 3048 * @hdd_ctx: HDD context 3049 * @ftm_mode: ftm mode 3050 * 3051 * This function maintains the driver state machine it will be invoked from 3052 * exit, shutdown and con_mode change handler. Depending on the driver state 3053 * shall perform the stopping/closing of the modules. 3054 * 3055 * Return: Errno 3056 */ 3057 int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode); 3058 3059 /** 3060 * hdd_psoc_idle_timer_start() - start the idle psoc detection timer 3061 * @hdd_ctx: the hdd context for which the timer should be started 3062 * 3063 * Return: None 3064 */ 3065 void hdd_psoc_idle_timer_start(struct hdd_context *hdd_ctx); 3066 3067 /** 3068 * hdd_psoc_idle_timer_stop() - stop the idle psoc detection timer 3069 * @hdd_ctx: the hdd context for which the timer should be stopped 3070 * 3071 * Return: None 3072 */ 3073 void hdd_psoc_idle_timer_stop(struct hdd_context *hdd_ctx); 3074 3075 /** 3076 * hdd_trigger_psoc_idle_restart() - trigger restart of a previously shutdown 3077 * idle psoc, if needed 3078 * @hdd_ctx: the hdd context which should be restarted 3079 * 3080 * This API does nothing if the given psoc is already active. 3081 * 3082 * Return: Errno 3083 */ 3084 int hdd_trigger_psoc_idle_restart(struct hdd_context *hdd_ctx); 3085 3086 int hdd_start_adapter(struct hdd_adapter *adapter); 3087 void hdd_populate_random_mac_addr(struct hdd_context *hdd_ctx, uint32_t num); 3088 /** 3089 * hdd_is_interface_up()- Checkfor interface up before ssr 3090 * @hdd_ctx: HDD context 3091 * 3092 * check if there are any wlan interfaces before SSR accordingly start 3093 * the interface. 3094 * 3095 * Return: 0 if interface was opened else false 3096 */ 3097 bool hdd_is_interface_up(struct hdd_adapter *adapter); 3098 3099 void hdd_connect_result(struct net_device *dev, const u8 *bssid, 3100 struct csr_roam_info *roam_info, const u8 *req_ie, 3101 size_t req_ie_len, const u8 *resp_ie, 3102 size_t resp_ie_len, u16 status, gfp_t gfp, 3103 bool connect_timeout, 3104 tSirResultCodes timeout_reason); 3105 3106 #ifdef WLAN_FEATURE_FASTPATH 3107 void hdd_enable_fastpath(struct hdd_context *hdd_ctx, 3108 void *context); 3109 #else 3110 static inline void hdd_enable_fastpath(struct hdd_context *hdd_ctx, 3111 void *context) 3112 { 3113 } 3114 #endif 3115 void hdd_wlan_update_target_info(struct hdd_context *hdd_ctx, void *context); 3116 3117 enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode); 3118 void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx); 3119 /** 3120 * hdd_clone_local_unsafe_chan() - clone hdd ctx unsafe chan list 3121 * @hdd_ctx: hdd context pointer 3122 * @local_unsafe_list: copied unsafe chan list array 3123 * @local_unsafe_list_count: channel number in returned local_unsafe_list 3124 * 3125 * The function will allocate memory and make a copy the current unsafe 3126 * channels from hdd ctx. The caller need to free the local_unsafe_list 3127 * memory after use. 3128 * 3129 * Return: 0 if successfully clone unsafe chan list. 3130 */ 3131 int hdd_clone_local_unsafe_chan(struct hdd_context *hdd_ctx, 3132 uint16_t **local_unsafe_list, uint16_t *local_unsafe_list_count); 3133 3134 /** 3135 * hdd_local_unsafe_channel_updated() - check unsafe chan list same or not 3136 * @hdd_ctx: hdd context pointer 3137 * @local_unsafe_list: unsafe chan list to be compared with hdd_ctx's list 3138 * @local_unsafe_list_count: channel number in local_unsafe_list 3139 * 3140 * The function checked the input channel is same as current unsafe chan 3141 * list in hdd_ctx. 3142 * 3143 * Return: true if input channel list is same as the list in hdd_ctx 3144 */ 3145 bool hdd_local_unsafe_channel_updated(struct hdd_context *hdd_ctx, 3146 uint16_t *local_unsafe_list, uint16_t local_unsafe_list_count); 3147 3148 int hdd_enable_disable_ca_event(struct hdd_context *hddctx, 3149 uint8_t set_value); 3150 void wlan_hdd_undo_acs(struct hdd_adapter *adapter); 3151 3152 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)) 3153 static inline int 3154 hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value) 3155 { 3156 return nla_put_u64(skb, attrtype, value); 3157 } 3158 #else 3159 static inline int 3160 hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value) 3161 { 3162 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD); 3163 } 3164 #endif 3165 3166 /** 3167 * hdd_roam_profile() - Get adapter's roam profile 3168 * @adapter: The adapter being queried 3169 * 3170 * Given an adapter this function returns a pointer to its roam profile. 3171 * 3172 * NOTE WELL: Caller is responsible for ensuring this interface is only 3173 * invoked for STA-type interfaces 3174 * 3175 * Return: pointer to the adapter's roam profile 3176 */ 3177 static inline 3178 struct csr_roam_profile *hdd_roam_profile(struct hdd_adapter *adapter) 3179 { 3180 struct hdd_station_ctx *sta_ctx; 3181 3182 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); 3183 3184 return &sta_ctx->roam_profile; 3185 } 3186 3187 /** 3188 * hdd_security_ie() - Get adapter's security IE 3189 * @adapter: The adapter being queried 3190 * 3191 * Given an adapter this function returns a pointer to its security IE 3192 * buffer. Note that this buffer is maintained outside the roam 3193 * profile but, when in use, is referenced by a pointer within the 3194 * roam profile. 3195 * 3196 * NOTE WELL: Caller is responsible for ensuring this interface is only 3197 * invoked for STA-type interfaces 3198 * 3199 * Return: pointer to the adapter's roam profile security IE buffer 3200 */ 3201 static inline 3202 uint8_t *hdd_security_ie(struct hdd_adapter *adapter) 3203 { 3204 struct hdd_station_ctx *sta_ctx; 3205 3206 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); 3207 3208 return sta_ctx->security_ie; 3209 } 3210 3211 /** 3212 * hdd_assoc_additional_ie() - Get adapter's assoc additional IE 3213 * @adapter: The adapter being queried 3214 * 3215 * Given an adapter this function returns a pointer to its assoc 3216 * additional IE buffer. Note that this buffer is maintained outside 3217 * the roam profile but, when in use, is referenced by a pointer 3218 * within the roam profile. 3219 * 3220 * NOTE WELL: Caller is responsible for ensuring this interface is only 3221 * invoked for STA-type interfaces 3222 * 3223 * Return: pointer to the adapter's assoc additional IE buffer 3224 */ 3225 static inline 3226 tSirAddie *hdd_assoc_additional_ie(struct hdd_adapter *adapter) 3227 { 3228 struct hdd_station_ctx *sta_ctx; 3229 3230 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); 3231 3232 return &sta_ctx->assoc_additional_ie; 3233 } 3234 3235 /** 3236 * hdd_is_roaming_in_progress() - check if roaming is in progress 3237 * @hdd_ctx - Global HDD context 3238 * 3239 * Checks if roaming is in progress on any of the adapters 3240 * 3241 * Return: true if roaming is in progress else false 3242 */ 3243 bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx); 3244 void hdd_set_roaming_in_progress(bool value); 3245 3246 /** 3247 * hdd_is_connection_in_progress() - check if connection is in progress 3248 * @out_vdev_id: id of vdev where connection is occurring 3249 * @out_reason: scan reject reason 3250 * 3251 * Go through each adapter and check if connection is in progress. 3252 * Output parameters @out_vdev_id and @out_reason will only be written 3253 * when a connection is in progress. 3254 * 3255 * Return: true if connection is in progress else false 3256 */ 3257 bool hdd_is_connection_in_progress(uint8_t *out_vdev_id, 3258 enum scan_reject_states *out_reason); 3259 3260 void hdd_restart_sap(struct hdd_adapter *ap_adapter); 3261 void hdd_check_and_restart_sap_with_non_dfs_acs(void); 3262 bool hdd_set_connection_in_progress(bool value); 3263 3264 /** 3265 * wlan_hdd_init_chan_info() - initialize channel info variables 3266 * @hdd_ctx: hdd ctx 3267 * 3268 * This API initialize channel info variables 3269 * 3270 * Return: None 3271 */ 3272 void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx); 3273 3274 /** 3275 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables 3276 * @hdd_ctx: hdd ctx 3277 * 3278 * This API deinitialize channel info variables 3279 * 3280 * Return: None 3281 */ 3282 void wlan_hdd_deinit_chan_info(struct hdd_context *hdd_ctx); 3283 void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit); 3284 3285 /** 3286 * hdd_is_any_interface_open() - Check for interface up 3287 * @hdd_ctx: HDD context 3288 * 3289 * Return: true if any interface is open 3290 */ 3291 bool hdd_is_any_interface_open(struct hdd_context *hdd_ctx); 3292 3293 #ifdef WIFI_POS_CONVERGED 3294 /** 3295 * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos 3296 * function to send peer status to a registered application 3297 * @peer_mac: MAC address of peer 3298 * @peer_status: ePeerConnected or ePeerDisconnected 3299 * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0 3300 * @vdev_id: ID of the underlying vdev 3301 * @chan_info: operating channel information 3302 * @dev_mode: dev mode for which indication is sent 3303 * 3304 * Return: none 3305 */ 3306 static inline void hdd_send_peer_status_ind_to_app( 3307 struct qdf_mac_addr *peer_mac, 3308 uint8_t peer_status, 3309 uint8_t peer_timing_meas_cap, 3310 uint8_t vdev_id, 3311 struct oem_channel_info *chan_info, 3312 enum QDF_OPMODE dev_mode) 3313 { 3314 struct wifi_pos_ch_info ch_info; 3315 3316 if (!chan_info) { 3317 os_if_wifi_pos_send_peer_status(peer_mac, peer_status, 3318 peer_timing_meas_cap, vdev_id, 3319 NULL, dev_mode); 3320 return; 3321 } 3322 3323 ch_info.mhz = chan_info->mhz; 3324 ch_info.band_center_freq1 = chan_info->band_center_freq1; 3325 ch_info.band_center_freq2 = chan_info->band_center_freq2; 3326 ch_info.info = chan_info->info; 3327 ch_info.reg_info_1 = chan_info->reg_info_1; 3328 ch_info.reg_info_2 = chan_info->reg_info_2; 3329 ch_info.nss = chan_info->nss; 3330 ch_info.rate_flags = chan_info->rate_flags; 3331 ch_info.sec_ch_offset = chan_info->sec_ch_offset; 3332 ch_info.ch_width = chan_info->ch_width; 3333 os_if_wifi_pos_send_peer_status(peer_mac, peer_status, 3334 peer_timing_meas_cap, vdev_id, 3335 &ch_info, dev_mode); 3336 } 3337 #else 3338 static inline void hdd_send_peer_status_ind_to_app( 3339 struct qdf_mac_addr *peer_mac, 3340 uint8_t peer_status, 3341 uint8_t peer_timing_meas_cap, 3342 uint8_t vdev_id, 3343 struct oem_channel_info *chan_info, 3344 enum QDF_OPMODE dev_mode) 3345 { 3346 hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status, 3347 peer_timing_meas_cap, vdev_id, chan_info, dev_mode); 3348 } 3349 #endif /* WIFI_POS_CONVERGENCE */ 3350 3351 /** 3352 * wlan_hdd_send_p2p_quota()- Send P2P Quota value to FW 3353 * @adapter: Adapter data 3354 * @sval: P2P quota value 3355 * 3356 * Send P2P quota value to FW 3357 * 3358 * Return: 0 success else failure 3359 */ 3360 int wlan_hdd_send_p2p_quota(struct hdd_adapter *adapter, int sval); 3361 3362 /** 3363 * wlan_hdd_send_p2p_quota()- Send MCC latency to FW 3364 * @adapter: Adapter data 3365 * @sval: MCC latency value 3366 * 3367 * Send MCC latency value to FW 3368 * 3369 * Return: 0 success else failure 3370 */ 3371 int wlan_hdd_send_mcc_latency(struct hdd_adapter *adapter, int sval); 3372 3373 /** 3374 * wlan_hdd_get_adapter_from_vdev()- Get adapter from vdev id 3375 * and PSOC object data 3376 * @psoc: Psoc object data 3377 * @vdev_id: vdev id 3378 * 3379 * Get adapter from vdev id and PSOC object data 3380 * 3381 * Return: adapter pointer 3382 */ 3383 struct hdd_adapter *wlan_hdd_get_adapter_from_vdev(struct wlan_objmgr_psoc 3384 *psoc, uint8_t vdev_id); 3385 /** 3386 * hdd_unregister_notifiers()- unregister kernel notifiers 3387 * @hdd_ctx: Hdd Context 3388 * 3389 * Unregister netdev notifiers like Netdevice,IPv4 and IPv6. 3390 * 3391 */ 3392 void hdd_unregister_notifiers(struct hdd_context *hdd_ctx); 3393 3394 /** 3395 * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config 3396 * @hdd_ctx: HDD context 3397 * 3398 * This function sends the DBS scan selection config configuration to the 3399 * firmware via WMA 3400 * 3401 * Return: 0 - success, < 0 - failure 3402 */ 3403 int hdd_dbs_scan_selection_init(struct hdd_context *hdd_ctx); 3404 3405 /** 3406 * hdd_start_complete()- complete the start event 3407 * @ret: return value for complete event. 3408 * 3409 * complete the startup event and set the return in 3410 * global variable 3411 * 3412 * Return: void 3413 */ 3414 3415 void hdd_start_complete(int ret); 3416 3417 /** 3418 * hdd_chip_pwr_save_fail_detected_cb() - chip power save failure detected 3419 * callback 3420 * @hdd_handle: HDD handle 3421 * @data: chip power save failure detected data 3422 * 3423 * This function reads the chip power save failure detected data and fill in 3424 * the skb with NL attributes and send up the NL event. 3425 * This callback execute in atomic context and must not invoke any 3426 * blocking calls. 3427 * 3428 * Return: none 3429 */ 3430 3431 void hdd_chip_pwr_save_fail_detected_cb(hdd_handle_t hdd_handle, 3432 struct chip_pwr_save_fail_detected_params 3433 *data); 3434 3435 /** 3436 * hdd_update_ie_whitelist_attr() - Copy probe req ie whitelist attrs from cfg 3437 * @ie_whitelist: output parameter 3438 * @hdd_ctx: pointer to hdd context 3439 * 3440 * Return: None 3441 */ 3442 void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist, 3443 struct hdd_context *hdd_ctx); 3444 3445 /** 3446 * hdd_get_rssi_snr_by_bssid() - gets the rssi and snr by bssid from scan cache 3447 * @adapter: adapter handle 3448 * @bssid: bssid to look for in scan cache 3449 * @rssi: rssi value found 3450 * @snr: snr value found 3451 * 3452 * Return: QDF_STATUS 3453 */ 3454 int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid, 3455 int8_t *rssi, int8_t *snr); 3456 3457 /** 3458 * hdd_reset_limit_off_chan() - reset limit off-channel command parameters 3459 * @adapter - HDD adapter 3460 * 3461 * Return: 0 on success and non zero value on failure 3462 */ 3463 int hdd_reset_limit_off_chan(struct hdd_adapter *adapter); 3464 3465 #if defined(WLAN_FEATURE_FILS_SK) && \ 3466 (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \ 3467 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))) 3468 /** 3469 * hdd_clear_fils_connection_info: API to clear fils info from roam profile and 3470 * free allocated memory 3471 * @adapter: pointer to hdd adapter 3472 * 3473 * Return: None 3474 */ 3475 void hdd_clear_fils_connection_info(struct hdd_adapter *adapter); 3476 3477 /** 3478 * hdd_update_hlp_info() - Update HLP packet received in FILS (re)assoc rsp 3479 * @dev: net device 3480 * @roam_fils_params: Fils join rsp params 3481 * 3482 * This API is used to send the received HLP packet in Assoc rsp(FILS AKM) 3483 * to the network layer. 3484 * 3485 * Return: None 3486 */ 3487 void hdd_update_hlp_info(struct net_device *dev, 3488 struct csr_roam_info *roam_info); 3489 #else 3490 static inline void hdd_clear_fils_connection_info(struct hdd_adapter *adapter) 3491 { } 3492 static inline void hdd_update_hlp_info(struct net_device *dev, 3493 struct csr_roam_info *roam_info) 3494 {} 3495 #endif 3496 3497 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) 3498 static inline void hdd_dev_setup_destructor(struct net_device *dev) 3499 { 3500 dev->destructor = free_netdev; 3501 } 3502 #else 3503 static inline void hdd_dev_setup_destructor(struct net_device *dev) 3504 { 3505 dev->needs_free_netdev = true; 3506 } 3507 #endif /* KERNEL_VERSION(4, 12, 0) */ 3508 3509 /** 3510 * hdd_dp_trace_init() - initialize DP Trace by calling the QDF API 3511 * @config: hdd config 3512 * 3513 * Return: NONE 3514 */ 3515 #ifdef CONFIG_DP_TRACE 3516 void hdd_dp_trace_init(struct hdd_config *config); 3517 #else 3518 static inline 3519 void hdd_dp_trace_init(struct hdd_config *config) {} 3520 #endif 3521 3522 /** 3523 * hdd_set_rx_mode_rps() - Enable/disable RPS in SAP mode 3524 * @enable: Set true to enable RPS in SAP mode 3525 * 3526 * Callback function registered with datapath 3527 * 3528 * Return: none 3529 */ 3530 void hdd_set_rx_mode_rps(bool enable); 3531 3532 /** 3533 * hdd_limit_max_per_index_score() -check if per index score doesn't exceed 100% 3534 * (0x64). If it exceed make it 100% 3535 * 3536 * @per_index_score: per_index_score as input 3537 * 3538 * Return: per_index_score within the max limit 3539 */ 3540 uint32_t hdd_limit_max_per_index_score(uint32_t per_index_score); 3541 3542 /** 3543 * hdd_update_score_config - API to update candidate scoring related params 3544 * configuration parameters 3545 * @score_config: score config to update 3546 * @cfg: config params 3547 * 3548 * Return: QDF_STATUS 3549 */ 3550 QDF_STATUS hdd_update_score_config( 3551 struct scoring_config *score_config, struct hdd_context *hdd_ctx); 3552 3553 /** 3554 * hdd_get_stainfo() - get stainfo for the specified peer 3555 * @astainfo: array of the station info in which the sta info 3556 * corresponding to mac_addr needs to be searched 3557 * @mac_addr: mac address of requested peer 3558 * 3559 * This function find the stainfo for the peer with mac_addr 3560 * 3561 * Return: stainfo if found, NULL if not found 3562 */ 3563 struct hdd_station_info *hdd_get_stainfo(struct hdd_station_info *astainfo, 3564 struct qdf_mac_addr mac_addr); 3565 3566 /** 3567 * hdd_component_psoc_open() - Open the legacy components 3568 * @psoc: Pointer to psoc object 3569 * 3570 * This function opens the legacy components and initializes the 3571 * component's private objects. 3572 * 3573 * Return: QDF_STATUS 3574 */ 3575 QDF_STATUS hdd_component_psoc_open(struct wlan_objmgr_psoc *psoc); 3576 3577 /** 3578 * hdd_component_psoc_close() - Close the legacy components 3579 * @psoc: Pointer to psoc object 3580 * 3581 * This function closes the legacy components and resets the 3582 * component's private objects. 3583 * 3584 * Return: None 3585 */ 3586 void hdd_component_psoc_close(struct wlan_objmgr_psoc *psoc); 3587 3588 /** 3589 * hdd_component_psoc_enable() - Trigger psoc enable for CLD Components 3590 * 3591 * Return: None 3592 */ 3593 void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc); 3594 3595 /** 3596 * hdd_component_psoc_disable() - Trigger psoc disable for CLD Components 3597 * 3598 * Return: None 3599 */ 3600 void hdd_component_psoc_disable(struct wlan_objmgr_psoc *psoc); 3601 3602 /** 3603 * hdd_component_pdev_open() - Trigger pdev open for CLD Components 3604 * 3605 * Return: QDF_STATUS 3606 */ 3607 QDF_STATUS hdd_component_pdev_open(struct wlan_objmgr_pdev *pdev); 3608 3609 /** 3610 * hdd_component_pdev_close() - Trigger pdev close for CLD Components 3611 * 3612 * Return: None 3613 */ 3614 void hdd_component_pdev_close(struct wlan_objmgr_pdev *pdev); 3615 3616 #ifdef WLAN_FEATURE_MEMDUMP_ENABLE 3617 int hdd_driver_memdump_init(void); 3618 void hdd_driver_memdump_deinit(void); 3619 3620 /** 3621 * hdd_driver_mem_cleanup() - Frees memory allocated for 3622 * driver dump 3623 * 3624 * This function frees driver dump memory. 3625 * 3626 * Return: None 3627 */ 3628 void hdd_driver_mem_cleanup(void); 3629 3630 #else /* WLAN_FEATURE_MEMDUMP_ENABLE */ 3631 static inline int hdd_driver_memdump_init(void) 3632 { 3633 return 0; 3634 } 3635 static inline void hdd_driver_memdump_deinit(void) 3636 { 3637 } 3638 3639 static inline void hdd_driver_mem_cleanup(void) 3640 { 3641 } 3642 #endif /* WLAN_FEATURE_MEMDUMP_ENABLE */ 3643 /** 3644 * hdd_set_disconnect_status() - set adapter disconnection status 3645 * @hdd_adapter: Pointer to hdd adapter 3646 * @disconnecting: Disconnect status to set 3647 * 3648 * Return: None 3649 */ 3650 void hdd_set_disconnect_status(struct hdd_adapter *adapter, bool disconnecting); 3651 3652 #ifdef FEATURE_MONITOR_MODE_SUPPORT 3653 /** 3654 * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface. 3655 * @adapter: Handle to adapter 3656 * @chan: Monitor mode channel 3657 * @bandwidth: Capture channel bandwidth 3658 * 3659 * Return: 0 on success else error code. 3660 */ 3661 int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, 3662 uint32_t bandwidth); 3663 #else 3664 static inline 3665 int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, 3666 uint32_t bandwidth) 3667 { 3668 return 0; 3669 } 3670 #endif 3671 3672 /** 3673 * hdd_wlan_get_version() - Get version information 3674 * @hdd_ctx: Global HDD context 3675 * @version_len: length of the version buffer size 3676 * @version: the buffer to the version string 3677 * 3678 * This function is used to get Wlan Driver, Firmware, Hardware Version 3679 * & the Board related information. 3680 * 3681 * Return: the length of the version string 3682 */ 3683 uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx, 3684 const size_t version_len, uint8_t *version); 3685 /** 3686 * hdd_assemble_rate_code() - assemble rate code to be sent to FW 3687 * @preamble: rate preamble 3688 * @nss: number of streams 3689 * @rate: rate index 3690 * 3691 * Rate code assembling is different for targets which are 11ax capable. 3692 * Check for the target support and assemble the rate code accordingly. 3693 * 3694 * Return: assembled rate code 3695 */ 3696 int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate); 3697 3698 /** 3699 * hdd_set_11ax_rate() - set 11ax rate 3700 * @adapter: adapter being modified 3701 * @value: new 11ax rate code 3702 * @sap_config: pointer to SAP config to check HW mode 3703 * this will be NULL for call from STA persona 3704 * 3705 * Return: 0 on success, negative errno on failure 3706 */ 3707 int hdd_set_11ax_rate(struct hdd_adapter *adapter, int value, 3708 struct sap_config *sap_config); 3709 3710 /** 3711 * hdd_update_hw_sw_info() - API to update the HW/SW information 3712 * @hdd_ctx: Global HDD context 3713 * 3714 * API to update the HW and SW information in the driver 3715 * 3716 * Note: 3717 * All the version/revision information would only be retrieved after 3718 * firmware download 3719 * 3720 * Return: None 3721 */ 3722 void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx); 3723 3724 /** 3725 * hdd_get_nud_stats_cb() - callback api to update the stats received from FW 3726 * @data: pointer to hdd context. 3727 * @rsp: pointer to data received from FW. 3728 * @context: callback context 3729 * 3730 * This is called when wlan driver received response event for 3731 * get arp stats to firmware. 3732 * 3733 * Return: None 3734 */ 3735 void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp, void *context); 3736 3737 /** 3738 * hdd_context_get_mac_handle() - get mac handle from hdd context 3739 * @hdd_ctx: Global HDD context pointer 3740 * 3741 * Retrieves the global MAC handle from the HDD context 3742 * 3743 * Return: The global MAC handle (which may be NULL) 3744 */ 3745 static inline 3746 mac_handle_t hdd_context_get_mac_handle(struct hdd_context *hdd_ctx) 3747 { 3748 return hdd_ctx ? hdd_ctx->mac_handle : NULL; 3749 } 3750 3751 /** 3752 * hdd_adapter_get_mac_handle() - get mac handle from hdd adapter 3753 * @adapter: HDD adapter pointer 3754 * 3755 * Retrieves the global MAC handle given an HDD adapter 3756 * 3757 * Return: The global MAC handle (which may be NULL) 3758 */ 3759 static inline 3760 mac_handle_t hdd_adapter_get_mac_handle(struct hdd_adapter *adapter) 3761 { 3762 return adapter ? 3763 hdd_context_get_mac_handle(adapter->hdd_ctx) : NULL; 3764 } 3765 3766 /** 3767 * hdd_handle_to_context() - turn an HDD handle into an HDD context 3768 * @hdd_handle: HDD handle to be converted 3769 * 3770 * Return: HDD context referenced by @hdd_handle 3771 */ 3772 static inline 3773 struct hdd_context *hdd_handle_to_context(hdd_handle_t hdd_handle) 3774 { 3775 return (struct hdd_context *)hdd_handle; 3776 } 3777 3778 /** 3779 * wlan_hdd_free_cache_channels() - Free the cache channels list 3780 * @hdd_ctx: Pointer to HDD context 3781 * 3782 * Return: None 3783 */ 3784 void wlan_hdd_free_cache_channels(struct hdd_context *hdd_ctx); 3785 3786 /** 3787 * hdd_update_dynamic_mac() - Updates the dynamic MAC list 3788 * @hdd_ctx: Pointer to HDD context 3789 * @curr_mac_addr: Current interface mac address 3790 * @new_mac_addr: New mac address which needs to be updated 3791 * 3792 * This function updates newly configured MAC address to the 3793 * dynamic MAC address list corresponding to the current 3794 * adapter MAC address 3795 * 3796 * Return: None 3797 */ 3798 void hdd_update_dynamic_mac(struct hdd_context *hdd_ctx, 3799 struct qdf_mac_addr *curr_mac_addr, 3800 struct qdf_mac_addr *new_mac_addr); 3801 3802 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH 3803 /** 3804 * wlan_hdd_send_tcp_param_update_event() - Send vendor event to update 3805 * TCP parameter through Wi-Fi HAL 3806 * @hdd_ctx: Pointer to HDD context 3807 * @data: Parameters to update 3808 * @dir: Direction(tx/rx) to update 3809 * 3810 * Return: None 3811 */ 3812 void wlan_hdd_send_tcp_param_update_event(struct hdd_context *hdd_ctx, 3813 void *data, 3814 uint8_t dir); 3815 3816 /** 3817 * wlan_hdd_update_tcp_rx_param() - update TCP param in RX dir 3818 * @hdd_ctx: Pointer to HDD context 3819 * @data: Parameters to update 3820 * 3821 * Return: None 3822 */ 3823 void wlan_hdd_update_tcp_rx_param(struct hdd_context *hdd_ctx, void *data); 3824 3825 /** 3826 * wlan_hdd_update_tcp_tx_param() - update TCP param in TX dir 3827 * @hdd_ctx: Pointer to HDD context 3828 * @data: Parameters to update 3829 * 3830 * Return: None 3831 */ 3832 void wlan_hdd_update_tcp_tx_param(struct hdd_context *hdd_ctx, void *data); 3833 #else 3834 static inline 3835 void wlan_hdd_update_tcp_rx_param(struct hdd_context *hdd_ctx, void *data) 3836 { 3837 } 3838 3839 static inline 3840 void wlan_hdd_update_tcp_tx_param(struct hdd_context *hdd_ctx, void *data) 3841 { 3842 } 3843 3844 static inline 3845 void wlan_hdd_send_tcp_param_update_event(struct hdd_context *hdd_ctx, 3846 void *data, 3847 uint8_t dir) 3848 { 3849 } 3850 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/ 3851 3852 #ifdef WLAN_FEATURE_MOTION_DETECTION 3853 /** 3854 * hdd_md_host_evt_cb - Callback for Motion Detection Event 3855 * @ctx: HDD context 3856 * @sir_md_evt: motion detect event 3857 * 3858 * Callback for Motion Detection Event. Re-enables Motion 3859 * Detection again upon event 3860 * 3861 * Return: QDF_STATUS QDF_STATUS_SUCCESS on Success and 3862 * QDF_STATUS_E_FAILURE on failure 3863 */ 3864 QDF_STATUS hdd_md_host_evt_cb(void *ctx, struct sir_md_evt *event); 3865 #endif /* WLAN_FEATURE_MOTION_DETECTION */ 3866 3867 /** 3868 * hdd_hidden_ssid_enable_roaming() - enable roaming after hidden ssid rsp 3869 * @hdd_handle: Hdd handler 3870 * @vdev_id: Vdev Id 3871 * 3872 * This is a wrapper function to enable roaming after getting hidden 3873 * ssid rsp 3874 */ 3875 void hdd_hidden_ssid_enable_roaming(hdd_handle_t hdd_handle, uint8_t vdev_id); 3876 3877 /** 3878 * hdd_send_update_owe_info_event - Send update OWE info event 3879 * @adapter: Pointer to adapter 3880 * @sta_addr: MAC address of peer STA 3881 * @owe_ie: OWE IE 3882 * @owe_ie_len: Length of OWE IE 3883 * 3884 * Send update OWE info event to hostapd 3885 * 3886 * Return: none 3887 */ 3888 #ifdef CFG80211_EXTERNAL_DH_UPDATE_SUPPORT 3889 void hdd_send_update_owe_info_event(struct hdd_adapter *adapter, 3890 uint8_t sta_addr[], 3891 uint8_t *owe_ie, 3892 uint32_t owe_ie_len); 3893 #else 3894 static inline void hdd_send_update_owe_info_event(struct hdd_adapter *adapter, 3895 uint8_t sta_addr[], 3896 uint8_t *owe_ie, 3897 uint32_t owe_ie_len) 3898 { 3899 } 3900 #endif 3901 3902 /** 3903 * hdd_psoc_idle_shutdown - perform idle shutdown after interface inactivity 3904 * timeout 3905 * @device: pointer to struct device 3906 * 3907 * Return: 0 for success non-zero error code for failure 3908 */ 3909 int hdd_psoc_idle_shutdown(struct device *dev); 3910 3911 /** 3912 * hdd_psoc_idle_restart - perform idle restart after idle shutdown 3913 * @device: pointer to struct device 3914 * 3915 * Return: 0 for success non-zero error code for failure 3916 */ 3917 int hdd_psoc_idle_restart(struct device *dev); 3918 3919 #endif /* end #if !defined(WLAN_HDD_MAIN_H) */ 3920