From 3e166ff7e4015e43aacf601a8d179e4c711fe1f5 Mon Sep 17 00:00:00 2001 From: Om Prakash Tripathi Date: Fri, 3 Nov 2017 16:11:11 +0530 Subject: [PATCH 1/9] qcacmn: Add support for wide band scan Add support for 40 MHz or wider channel bandwidth scan Change-Id: I72f3cf42e6dc957ef56842d0c333c62169cb6d68 CRs-Fixed: 2139415 --- dp/inc/cdp_txrx_stats_struct.h | 1 + os_if/linux/scan/src/wlan_cfg80211_scan.c | 4 +- umac/p2p/core/src/wlan_p2p_roc.c | 4 +- umac/scan/core/src/wlan_scan_main.h | 9 +- .../dispatcher/inc/wlan_scan_public_structs.h | 29 ++++-- umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h | 26 +++++- umac/scan/dispatcher/src/wlan_scan_ucfg_api.c | 90 ++++++++++++++++--- wmi/inc/wmi_unified_param.h | 1 + wmi/src/wmi_unified_non_tlv.c | 16 ++-- wmi/src/wmi_unified_tlv.c | 38 ++++++-- 10 files changed, 176 insertions(+), 42 deletions(-) diff --git a/dp/inc/cdp_txrx_stats_struct.h b/dp/inc/cdp_txrx_stats_struct.h index 9fd503520362..14688153e5f7 100644 --- a/dp/inc/cdp_txrx_stats_struct.h +++ b/dp/inc/cdp_txrx_stats_struct.h @@ -503,6 +503,7 @@ enum _ol_ath_param_t { OL_ATH_PARAM_CHAN_INFO = 359, OL_ATH_PARAM_ACS_RANK = 360, OL_ATH_PARAM_TXCHAINSOFT = 361, + OL_ATH_PARAM_WIDE_BAND_SCAN = 362, }; /* Enumeration of PDEV Configuration parameter */ diff --git a/os_if/linux/scan/src/wlan_cfg80211_scan.c b/os_if/linux/scan/src/wlan_cfg80211_scan.c index a9d0389c5f9a..82622f66132e 100644 --- a/os_if/linux/scan/src/wlan_cfg80211_scan.c +++ b/os_if/linux/scan/src/wlan_cfg80211_scan.c @@ -1271,7 +1271,7 @@ int wlan_cfg80211_scan(struct wlan_objmgr_pdev *pdev, } #endif len += snprintf(chl + len, 5, "%d ", channel); - req->scan_req.chan_list[num_chan] = + req->scan_req.chan_list.chan[num_chan].freq = wlan_chan_to_freq(channel); num_chan++; } @@ -1284,7 +1284,7 @@ int wlan_cfg80211_scan(struct wlan_objmgr_pdev *pdev, status = -EINVAL; goto end; } - req->scan_req.num_chan = num_chan; + req->scan_req.chan_list.num_chan = num_chan; /* P2P increase the scan priority */ if (is_p2p_scan) diff --git a/umac/p2p/core/src/wlan_p2p_roc.c b/umac/p2p/core/src/wlan_p2p_roc.c index 1fa37ee66885..ae71a7765124 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.c +++ b/umac/p2p/core/src/wlan_p2p_roc.c @@ -102,8 +102,8 @@ static QDF_STATUS p2p_scan_start(struct p2p_roc_context *roc_ctx) req->vdev = vdev; req->scan_req.scan_id = roc_ctx->scan_id; req->scan_req.scan_req_id = p2p_soc_obj->scan_req_id; - req->scan_req.num_chan = 1; - req->scan_req.chan_list[0] = wlan_chan_to_freq(roc_ctx->chan); + req->scan_req.chan_list.num_chan = 1; + req->scan_req.chan_list.chan[0].freq = wlan_chan_to_freq(roc_ctx->chan); req->scan_req.dwell_time_passive = roc_ctx->duration; req->scan_req.dwell_time_active = 0; req->scan_req.scan_priority = SCAN_PRIORITY_HIGH; diff --git a/umac/scan/core/src/wlan_scan_main.h b/umac/scan/core/src/wlan_scan_main.h index d4db5ec1156e..e12ee4c5cb43 100644 --- a/umac/scan/core/src/wlan_scan_main.h +++ b/umac/scan/core/src/wlan_scan_main.h @@ -167,10 +167,11 @@ struct scan_requester_info { /** * struct pdev_scan_info - defines per pdev scan info + * @wide_band_scan: wide band scan capability * @last_scan_time: time of last scan start on this pdev */ - struct pdev_scan_info { + bool wide_band_scan; qdf_time_t last_scan_time; }; @@ -261,6 +262,10 @@ struct pno_def_config { * @scan_f_add_spoofed_mac_in_probe: use random mac address for TA in probe * @scan_f_add_rand_seq_in_probe: use random sequence number in probe * @scan_f_en_ie_whitelist_in_probe: enable ie whitelist in probe + * @scan_f_forced: force scan even in presence of data traffic + * @scan_f_2ghz: scan 2.4 GHz channels + * @scan_f_5ghz: scan 5 GHz channels + * @scan_f_wide_band: scan in 40 MHz or higher bandwidth * @scan_flags: variable to read and set scan_f_* flags in one shot * can be used to dump all scan_f_* flags for debug * @scan_ev_started: notify scan started event @@ -337,7 +342,7 @@ struct scan_default_params { scan_f_forced:1, scan_f_2ghz:1, scan_f_5ghz:1, - scan_f_80mhz:1; + scan_f_wide_band:1; }; uint32_t scan_flags; }; diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h index 7d19c9aaa51b..079c233c2c38 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h +++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h @@ -555,6 +555,27 @@ struct probe_req_whitelist_attr { uint32_t voui[MAX_PROBE_REQ_OUIS]; }; +/** + * struct chan_info - channel information + * @freq: frequency to scan + * @phymode: phymode in which @frequency should be scanned + */ +struct chan_info { + uint32_t freq; + uint32_t phymode; +}; + +/** + * struct chan_list - list of frequencies to be scanned + * and their phymode + * @num_chan: number of channels to scan + * @chan: channel parameters used for this scan + */ +struct chan_list { + uint32_t num_chan; + struct chan_info chan[WLAN_SCAN_MAX_NUM_CHANNELS]; +}; + /** * struct scan_req_params - start scan request parameter * @scan_id: scan id @@ -610,11 +631,10 @@ struct probe_req_whitelist_attr { * @scan_f_forced: force scan even in presence of data traffic * @scan_f_2ghz: scan 2.4 GHz channels * @scan_f_5ghz: scan 5 GHz channels - * @scan_f_80mhz: scan in 80 MHz channel width mode + * @scan_f_wide_band: scan in 40 MHz or higher bandwidth * @scan_flags: variable to read and set scan_f_* flags in one shot * can be used to dump all scan_f_* flags for debug * @burst_duration: burst duration - * @num_chan: no of channel * @num_bssid: no of bssid * @num_ssids: no of ssid * @n_probes: no of probe @@ -688,17 +708,16 @@ struct scan_req_params { scan_f_forced:1, scan_f_2ghz:1, scan_f_5ghz:1, - scan_f_80mhz:1; + scan_f_wide_band:1; }; uint32_t scan_flags; }; enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode; uint32_t burst_duration; - uint32_t num_chan; uint32_t num_bssid; uint32_t num_ssids; uint32_t n_probes; - uint32_t chan_list[WLAN_SCAN_MAX_NUM_CHANNELS]; + struct chan_list chan_list; struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID]; struct qdf_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID]; struct scan_random_attr scan_random; diff --git a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h index d2758c05027e..507568a6b045 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h +++ b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h @@ -189,6 +189,25 @@ QDF_STATUS ucfg_scan_set_enable(struct wlan_objmgr_psoc *psoc, bool enable); */ bool ucfg_scan_get_enable(struct wlan_objmgr_psoc *psoc); +/** + * ucfg_scan_set_wide_band_scan() - Public API to disable/enable wide band scan + * @pdev: psoc on which scans need to be disabled + * @enable: enable wide band scan if @enable is true, disable otherwise + * + * Return: QDF_STATUS. + */ +QDF_STATUS ucfg_scan_set_wide_band_scan( + struct wlan_objmgr_pdev *pdev, bool enable); + +/** + * ucfg_scan_get_wide_band_scan() - Public API to check if + * wide band scan is enabled or disabled + * @pdev: psoc on which scans status need to be checked + * + * Return: true if enabled else false. + */ +bool ucfg_scan_get_wide_band_scan(struct wlan_objmgr_pdev *pdev); + /** * ucfg_scan_cancel() - Public API to stop a scan * @req: stop scan request params @@ -368,14 +387,15 @@ ucfg_scan_init_bssid_params(struct scan_start_request *scan_req, /** * ucfg_scan_init_chanlist_params() - initialize scan request channel list * @scan_req: scan request object - * @num_ssid: number of channels in channel list - * @bssid_list: channel list + * @num_chans: number of channels in channel list + * @chan_list: channel list + * @phymode: phymode in which scan shall be done * * Return: QDF_STATUS_SUCCESS for success or error code */ QDF_STATUS ucfg_scan_init_chanlist_params(struct scan_start_request *scan_req, - uint32_t num_chans, uint32_t *chan_list); + uint32_t num_chans, uint32_t *chan_list, uint32_t *phymode); /** * ucfg_scan_get_vdev_status() - API to check vdev scan status diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c index b352e2387ec2..c5ef8db84538 100644 --- a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "../../core/src/wlan_scan_main.h" #include "../../core/src/wlan_scan_manager.h" #include "../../core/src/wlan_scan_cache_db.h" @@ -391,7 +392,7 @@ ucfg_scan_update_dbs_scan_ctrl_ext_flag(struct scan_start_request *req) goto end; } - num_chan = req->scan_req.num_chan; + num_chan = req->scan_req.chan_list.num_chan; /* num_chan=0 means all channels */ if (!num_chan) @@ -402,8 +403,8 @@ ucfg_scan_update_dbs_scan_ctrl_ext_flag(struct scan_start_request *req) while (num_chan > 1) { if (!WLAN_REG_IS_SAME_BAND_CHANNELS( - req->scan_req.chan_list[0], - req->scan_req.chan_list[num_chan-1])) { + req->scan_req.chan_list.chan[0].freq, + req->scan_req.chan_list.chan[num_chan-1].freq)) { scan_dbs_policy = SCAN_DBS_POLICY_DEFAULT; break; } @@ -430,6 +431,7 @@ ucfg_scan_start(struct scan_start_request *req) struct scheduler_msg msg = {0}; QDF_STATUS status; struct wlan_scan_obj *scan_obj; + struct wlan_objmgr_pdev *pdev; if (!req || !req->vdev) { scm_err("vdev: %pK, req: %pK", req->vdev, req); @@ -438,7 +440,14 @@ ucfg_scan_start(struct scan_start_request *req) return QDF_STATUS_E_NULL_VALUE; } - scan_obj = wlan_pdev_get_scan_obj(wlan_vdev_get_pdev(req->vdev)); + pdev = wlan_vdev_get_pdev(req->vdev); + if (!pdev) { + scm_err("Failed to get pdev object"); + scm_scan_free_scan_request_mem(req); + return QDF_STATUS_E_NULL_VALUE; + } + + scan_obj = wlan_pdev_get_scan_obj(pdev); if (!scan_obj) { scm_err("Failed to get scan object"); scm_scan_free_scan_request_mem(req); @@ -450,9 +459,17 @@ ucfg_scan_start(struct scan_start_request *req) scm_scan_free_scan_request_mem(req); return QDF_STATUS_E_AGAIN; } - scm_info("reqid: %d, scanid: %d, vdevid: %d", + + scm_debug("reqid: %d, scanid: %d, vdevid: %d", req->scan_req.scan_req_id, req->scan_req.scan_id, req->scan_req.vdev_id); + + /* Overwrite scan parameters as required */ + if (!ucfg_scan_get_wide_band_scan(pdev)) { + scm_debug("wide_band_scan not supported, Scan 20 MHz"); + req->scan_req.scan_f_wide_band = false; + } + if (scan_obj->scan_def.usr_cfg_probe_rpt_time) { req->scan_req.repeat_probe_time = scan_obj->scan_def.usr_cfg_probe_rpt_time; @@ -521,6 +538,39 @@ bool ucfg_scan_get_enable(struct wlan_objmgr_psoc *psoc) return scan_obj->enable_scan; } +QDF_STATUS +ucfg_scan_set_wide_band_scan(struct wlan_objmgr_pdev *pdev, bool enable) +{ + uint8_t pdev_id; + struct wlan_scan_obj *scan_obj; + + if (!pdev) { + scm_warn("null vdev"); + return QDF_STATUS_E_NULL_VALUE; + } + pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); + scan_obj = wlan_pdev_get_scan_obj(pdev); + + scm_debug("set wide_band_scan to %d", enable); + scan_obj->pdev_info[pdev_id].wide_band_scan = enable; + + return QDF_STATUS_SUCCESS; +} + +bool ucfg_scan_get_wide_band_scan(struct wlan_objmgr_pdev *pdev) +{ + uint8_t pdev_id; + struct wlan_scan_obj *scan_obj; + + if (!pdev) { + scm_warn("null vdev"); + return QDF_STATUS_E_NULL_VALUE; + } + pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); + scan_obj = wlan_pdev_get_scan_obj(pdev); + + return scan_obj->pdev_info[pdev_id].wide_band_scan; +} QDF_STATUS ucfg_scan_cancel(struct scan_cancel_request *req) @@ -1078,20 +1128,20 @@ ucfg_scan_init_bssid_params(struct scan_start_request *req, QDF_STATUS ucfg_scan_init_chanlist_params(struct scan_start_request *req, - uint32_t num_chans, uint32_t *chan_list) + uint32_t num_chans, uint32_t *chan_list, uint32_t *phymode) { - - uint32_t max_chans = sizeof(req->scan_req.chan_list) / - sizeof(req->scan_req.chan_list[0]); + uint32_t idx; + uint32_t max_chans = sizeof(req->scan_req.chan_list.chan) / + sizeof(req->scan_req.chan_list.chan[0]); if (!req) { scm_err("null request"); return QDF_STATUS_E_NULL_VALUE; } if (!num_chans) { /* empty channel list provided */ - req->scan_req.num_chan = 0; - qdf_mem_zero(&req->scan_req.chan_list[0], + qdf_mem_zero(&req->scan_req.chan_list, sizeof(req->scan_req.chan_list)); + req->scan_req.chan_list.num_chan = 0; return QDF_STATUS_SUCCESS; } if (!chan_list) { @@ -1109,9 +1159,21 @@ ucfg_scan_init_chanlist_params(struct scan_start_request *req, if (max_chans > num_chans) max_chans = num_chans; - req->scan_req.num_chan = max_chans; - qdf_mem_copy(&req->scan_req.chan_list[0], chan_list, - req->scan_req.num_chan * sizeof(req->scan_req.chan_list[0])); + req->scan_req.chan_list.num_chan = max_chans; + for (idx = 0; idx < max_chans; idx++) { + req->scan_req.chan_list.chan[idx].freq = + (chan_list[idx] > WLAN_24_GHZ_BASE_FREQ) ? + chan_list[idx] : wlan_chan_to_freq(chan_list[idx]); + req->scan_req.chan_list.chan[idx].phymode = + (phymode ? phymode[idx] : 0); + } + + /* Enable wide band scan by default if phymode list is provided. + * This flag will be cleared in @ucfg_scan_start() if underlying + * phy doesn't support wide band scan. + */ + if (phymode) + req->scan_req.scan_f_wide_band = true; return QDF_STATUS_SUCCESS; } diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 54a4be99aec0..d2184bc57eb9 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5814,6 +5814,7 @@ typedef enum { wmi_service_chan_load_info, wmi_service_extended_nss_support, wmi_service_ack_timeout, + wmi_service_widebw_scan, wmi_services_max, } wmi_conv_service_ids; diff --git a/wmi/src/wmi_unified_non_tlv.c b/wmi/src/wmi_unified_non_tlv.c index 5db01d936e51..9d54af3344b8 100644 --- a/wmi/src/wmi_unified_non_tlv.c +++ b/wmi/src/wmi_unified_non_tlv.c @@ -1871,8 +1871,8 @@ static QDF_STATUS send_scan_start_cmd_non_tlv(wmi_unified_t wmi_handle, #ifdef TEST_CODE len += sizeof(wmi_chan_list) + 3 * sizeof(A_UINT32); #else - if (param->num_chan) { - len += sizeof(wmi_chan_list) + (param->num_chan - 1) + if (param->chan_list.num_chan) { + len += sizeof(wmi_chan_list) + (param->chan_list.num_chan - 1) * sizeof(A_UINT32); } #endif @@ -1994,13 +1994,14 @@ static QDF_STATUS send_scan_start_cmd_non_tlv(wmi_unified_t wmi_handle, tmp_ptr += (2 + chan_list->num_chan); /* increase by words */- #else #define FREQUENCY_THRESH 1000 - if (param->num_chan) { + if (param->chan_list.num_chan) { chan_list = (wmi_chan_list *) tmp_ptr; chan_list->tag = WMI_CHAN_LIST_TAG; - chan_list->num_chan = param->num_chan; - qdf_mem_copy(chan_list->channel_list, param->chan_list, - ((param->num_chan) * sizeof(uint32_t))); - tmp_ptr += (2 + param->num_chan); /* increase by words */ + chan_list->num_chan = param->chan_list.num_chan; + for (i = 0; i < param->chan_list.num_chan; ++i) + chan_list->channel_list[i] = + param->chan_list.chan[i].freq; + tmp_ptr += (2 + param->chan_list.num_chan); } #endif if (param->num_ssids) { @@ -8535,6 +8536,7 @@ static void populate_non_tlv_service(uint32_t *wmi_service) wmi_service[wmi_service_offchan_tx_wmi] = WMI_SERVICE_UNAVAILABLE; wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_UNAVAILABLE; wmi_service[wmi_service_ack_timeout] = WMI_SERVICE_UNAVAILABLE; + wmi_service[wmi_service_widebw_scan] = WMI_SERVICE_UNAVAILABLE; } /** diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 8d8c1fbad20d..18f4ee77daa1 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -2277,13 +2277,14 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, wmi_mac_addr *bssid; int len = sizeof(*cmd); uint8_t extraie_len_with_pad = 0; + uint8_t phymode_roundup = 0; struct probe_req_whitelist_attr *ie_whitelist = ¶ms->ie_whitelist; /* Length TLV placeholder for array of uint32_t */ len += WMI_TLV_HDR_SIZE; /* calculate the length of buffer required */ - if (params->num_chan) - len += params->num_chan * sizeof(uint32_t); + if (params->chan_list.num_chan) + len += params->chan_list.num_chan * sizeof(uint32_t); /* Length TLV placeholder for array of wmi_ssid structures */ len += WMI_TLV_HDR_SIZE; @@ -2306,6 +2307,13 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, if (ie_whitelist->num_vendor_oui) len += ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); + len += WMI_TLV_HDR_SIZE; /* Length of TLV for array of scan phymode */ + if (params->scan_f_wide_band) + phymode_roundup = + qdf_roundup(params->chan_list.num_chan * sizeof(uint8_t), + sizeof(uint32_t)); + len += phymode_roundup; + /* Allocate the memory */ wmi_buf = wmi_buf_alloc(wmi_handle, len); if (!wmi_buf) { @@ -2337,7 +2345,7 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, cmd->max_scan_time = params->max_scan_time; cmd->probe_delay = params->probe_delay; cmd->burst_duration = params->burst_duration; - cmd->num_chan = params->num_chan; + cmd->num_chan = params->chan_list.num_chan; cmd->num_bssid = params->num_bssid; cmd->num_ssids = params->num_ssids; cmd->ie_len = params->extraie.len; @@ -2359,13 +2367,15 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, buf_ptr += sizeof(*cmd); tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); - for (i = 0; i < params->num_chan; ++i) - tmp_ptr[i] = params->chan_list[i]; + for (i = 0; i < params->chan_list.num_chan; ++i) + tmp_ptr[i] = params->chan_list.chan[i].freq; WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, - (params->num_chan * sizeof(uint32_t))); - buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); + (params->chan_list.num_chan * sizeof(uint32_t))); + buf_ptr += WMI_TLV_HDR_SIZE + + (params->chan_list.num_chan * sizeof(uint32_t)); + if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { WMI_LOGE("Invalid value for numSsid"); goto error; @@ -2419,6 +2429,19 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); } + /* Add phy mode TLV if it's a wide band scan */ + if (params->scan_f_wide_band) { + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, phymode_roundup); + buf_ptr = (uint8_t *) (buf_ptr + WMI_TLV_HDR_SIZE); + for (i = 0; i < params->chan_list.num_chan; ++i) + buf_ptr[i] = + WMI_SCAN_CHAN_SET_MODE(params->chan_list.chan[i].phymode); + buf_ptr += phymode_roundup; + } else { + /* Add ZERO legth phy mode TLV */ + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, 0); + } + ret = wmi_unified_cmd_send( get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, len, WMI_START_SCAN_CMDID); @@ -20314,6 +20337,7 @@ static void populate_tlv_service(uint32_t *wmi_service) wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_CHAN_LOAD_INFO; wmi_service[wmi_service_extended_nss_support] = WMI_SERVICE_EXTENDED_NSS_SUPPORT; + wmi_service[wmi_service_widebw_scan] = WMI_SERVICE_SCAN_PHYMODE_SUPPORT; } /** From e98fadcd8c84671115e0e1e51170684795be9832 Mon Sep 17 00:00:00 2001 From: "Padma, Santhosh Kumar" Date: Fri, 6 Oct 2017 15:42:00 +0530 Subject: [PATCH 2/9] qcacmn: Add changes to handle WMI_ROAM_SYNCH_FRAME_EVENTID Firmware sends beacon/probe response, reassoc request and reassoc response using new event WMI_ROAM_SYNCH_FRAME_EVENTID when the data that it wants to send via WMI_ROAM_SYNCH_EVENTID exceeds max length 2k in firmware. Add common changes to handle WMI_ROAM_SYNCH_FRAME_EVENTID in such a scenario. Change-Id: I62755dfa3c2a4b0ff9ee48fd5f24cc2e300b374f CRs-Fixed: 2122432 --- wmi/inc/wmi_unified_param.h | 1 + wmi/src/wmi_unified_tlv.c | 1 + 2 files changed, 2 insertions(+) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index d2184bc57eb9..98bdc6a49829 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5335,6 +5335,7 @@ typedef enum { wmi_ba_rsp_ssn_event_id, wmi_aggr_state_trig_event_id, wmi_roam_synch_event_id, + wmi_roam_synch_frame_event_id, wmi_p2p_disc_event_id, wmi_p2p_noa_event_id, wmi_p2p_lo_stop_event_id, diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 18f4ee77daa1..9bbd48a17a94 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -19974,6 +19974,7 @@ static void populate_tlv_events_id(uint32_t *event_ids) event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; + event_ids[wmi_roam_synch_frame_event_id] = WMI_ROAM_SYNCH_FRAME_EVENTID; event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; From e858515daffec351a5468c5ef989048da7e85b6b Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Wed, 8 Nov 2017 13:03:53 +0530 Subject: [PATCH 3/9] qcacmn: Fix memleak issue in DFS component Problem: During wifi up/down, dfs_init_precac_list() is called to initialize the precac list without de-allocating the previously allocated memory. This leads to a memory leak. Solution: Deinit the allocated memory before initializing the precac list. Change-Id: I7eee38fbc3c50f37ac0c6670b5bfe4b5a1b2d9f6 CRs-Fixed: 2140042 --- umac/dfs/dispatcher/src/wlan_dfs_utils_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c index 1eb046d09c37..6d3cccfdd5c2 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c @@ -48,7 +48,7 @@ QDF_STATUS utils_dfs_reset(struct wlan_objmgr_pdev *pdev) dfs_reset(dfs); dfs_nol_update(dfs); - dfs_init_precac_list(dfs); + dfs_reset_precaclists(dfs); return QDF_STATUS_SUCCESS; } From f3b138c62519f3a150c6f4dcae96cd93369fdfb2 Mon Sep 17 00:00:00 2001 From: Arif Hussain Date: Fri, 3 Nov 2017 14:16:16 -0700 Subject: [PATCH 4/9] qcacmn: dfs: Replace instances of unadorned %p Replace instances of unadorned %p in dfs. Change-Id: I5a586d8e57fb0809bc1c7549ce78ac587bd0d142 CRs-Fixed: 2133316 --- umac/dfs/core/src/filtering/dfs_init.c | 4 ++-- umac/dfs/core/src/misc/dfs.c | 2 +- umac/dfs/core/src/misc/dfs_random_chan_sel.c | 4 ++-- umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c | 2 +- umac/dfs/dispatcher/src/wlan_dfs_utils_api.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/umac/dfs/core/src/filtering/dfs_init.c b/umac/dfs/core/src/filtering/dfs_init.c index 8146d7169bb5..323914857f1d 100644 --- a/umac/dfs/core/src/filtering/dfs_init.c +++ b/umac/dfs/core/src/filtering/dfs_init.c @@ -57,12 +57,12 @@ void dfs_reset_alldelaylines(struct wlan_dfs *dfs) pl = dfs->pulses; if (!pl) { - dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "pl==NULL, dfs=%p", dfs); + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "pl==NULL, dfs=%pK", dfs); return; } if (!(dfs->dfs_b5radars)) { - dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "pl==NULL, b5radars=%p", + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "pl==NULL, b5radars=%pK", dfs->dfs_b5radars); return; } diff --git a/umac/dfs/core/src/misc/dfs.c b/umac/dfs/core/src/misc/dfs.c index aacc8d95277f..19a6a5b0fdbd 100644 --- a/umac/dfs/core/src/misc/dfs.c +++ b/umac/dfs/core/src/misc/dfs.c @@ -686,7 +686,7 @@ int dfs_control(struct wlan_dfs *dfs, case DFS_SET_THRESH: if (insize < sizeof(struct dfs_ioctl_params) || !indata) { dfs_debug(dfs, WLAN_DEBUG_DFS1, - "insize = %d, expected = %zu bytes, indata = %p", + "insize = %d, expected = %zu bytes, indata = %pK", insize, sizeof(struct dfs_ioctl_params), indata); diff --git a/umac/dfs/core/src/misc/dfs_random_chan_sel.c b/umac/dfs/core/src/misc/dfs_random_chan_sel.c index 165ca35183dc..b11d557c1ddf 100644 --- a/umac/dfs/core/src/misc/dfs_random_chan_sel.c +++ b/umac/dfs/core/src/misc/dfs_random_chan_sel.c @@ -159,7 +159,7 @@ static uint8_t dfs_get_rand_from_lst(uint8_t *ch_lst, uint8_t num_ch) if (!num_ch || !ch_lst) { dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, - "invalid param ch_lst %p, num_ch = %d", + "invalid param ch_lst %pK, num_ch = %d", ch_lst, num_ch); return 0; } @@ -559,7 +559,7 @@ uint8_t dfs_prepare_random_channel(struct wlan_dfs *dfs, if (!ch_list || !ch_cnt) { dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, - "Invalid params %p, ch_cnt=%d", + "Invalid params %pK, ch_cnt=%d", ch_list, ch_cnt); return 0; } diff --git a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c index 1d9fe71c3221..e802819b2072 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c @@ -318,7 +318,7 @@ QDF_STATUS tgt_dfs_reg_ev_handler(struct wlan_objmgr_psoc *psoc, status = dfs_tx_ops->dfs_reg_ev_handler(pdev, dfs_offload); else dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, - "dfs_tx_ops=%p", dfs_tx_ops); + "dfs_tx_ops=%pK", dfs_tx_ops); wlan_objmgr_pdev_release_ref(pdev, WLAN_DFS_ID); diff --git a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c index 6d3cccfdd5c2..8c550c7a019c 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c @@ -686,7 +686,7 @@ void utils_dfs_init_nol(struct wlan_objmgr_pdev *pdev) psoc = wlan_pdev_get_psoc(pdev); if (!dfs || !psoc) { dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, - "dfs %p, psoc %p", dfs, psoc); + "dfs %pK, psoc %pK", dfs, psoc); return; } From fd134e45dd4882bc216709425370322f116cc646 Mon Sep 17 00:00:00 2001 From: Sathish Kumar Date: Wed, 8 Nov 2017 14:49:58 +0530 Subject: [PATCH 5/9] qcacmn: Add support for custom aggr size cmd and rate dropdown vdev param Add support for configuring aggregate size for A-MSDU and A-MPDU aggregations. Add support for rate dropdown vdev param to dropdown rates for SU, MU and MGMT packets. Change-Id: I033693e1c21c05d06acd7df36eac580be19fe20b CRs-Fixed: 2138655 Acked-by: Aditya Sathish --- wmi/inc/wmi_unified_api.h | 10 +++++ wmi/inc/wmi_unified_param.h | 32 ++++++++++++++++ wmi/inc/wmi_unified_priv.h | 2 + wmi/src/wmi_unified_api.c | 19 ++++++++++ wmi/src/wmi_unified_tlv.c | 74 +++++++++++++++++++++++++++++++++++++ 5 files changed, 137 insertions(+) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 43931867ebd8..5c8505d9cae6 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -1096,6 +1096,16 @@ QDF_STATUS wmi_unified_vdev_set_fwtest_param_cmd_send(void *wmi_hdl, QDF_STATUS wmi_unified_vdev_config_ratemask_cmd_send(void *wmi_hdl, struct config_ratemask_params *param); +/** + * wmi_unified_vdev_set_custom_aggr_size_cmd_send() - WMI set custom aggr + * size command + * @param wmi_hdl : handle to WMI. + * @param param : pointer to hold custom aggr size param + * + * @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_vdev_set_custom_aggr_size_cmd_send(void *wmi_hdl, + struct set_custom_aggr_size_params *param); QDF_STATUS wmi_unified_pdev_set_regdomain_cmd_send(void *wmi_hdl, struct pdev_set_regdomain_params *param); diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 98bdc6a49829..2bc6145ce021 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -3747,6 +3747,37 @@ struct set_fwtest_params { uint32_t value; }; +/** + * struct set_custom_aggr_size_params - custom aggr size params + * @vdev_id : vdev id + * @tx_aggr_size : TX aggr size + * @rx_aggr_size : RX aggr size + * @enable_bitmap: Bitmap for aggr size check + */ +struct set_custom_aggr_size_params { + uint32_t vdev_id; + uint32_t tx_aggr_size; + uint32_t rx_aggr_size; + uint32_t ac:2, + aggr_type:1, + tx_aggr_size_disable:1, + rx_aggr_size_disable:1, + tx_ac_enable:1, + reserved:26; +}; + +/** + * enum wmi_host_custom_aggr_type_t: custon aggregate type + * @WMI_HOST_CUSTOM_AGGR_TYPE_AMPDU: A-MPDU aggregation + * @WMI_HOST_CUSTOM_AGGR_TYPE_AMSDU: A-MSDU aggregation + * @WMI_HOST_CUSTOM_AGGR_TYPE_MAX: Max type + */ +enum wmi_host_custom_aggr_type_t { + WMI_HOST_CUSTOM_AGGR_TYPE_AMPDU = 0, + WMI_HOST_CUSTOM_AGGR_TYPE_AMSDU = 1, + WMI_HOST_CUSTOM_AGGR_TYPE_MAX, +}; + /** * struct config_ratemask_params - ratemask config parameters * @vdev_id: vdev id @@ -5668,6 +5699,7 @@ typedef enum { wmi_vdev_param_set_heop, wmi_vdev_param_disable_cabq, + wmi_vdev_param_rate_dropdown_bmap, wmi_vdev_param_max, } wmi_conv_vdev_param_id; diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 201e1cef021b..a1caad378536 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -895,6 +895,8 @@ QDF_STATUS (*send_vdev_set_fwtest_param_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_vdev_config_ratemask_cmd)(wmi_unified_t wmi_handle, struct config_ratemask_params *param); +QDF_STATUS (*send_vdev_set_custom_aggr_size_cmd)(wmi_unified_t wmi_handle, + struct set_custom_aggr_size_params *param); QDF_STATUS (*send_wow_wakeup_cmd)(wmi_unified_t wmi_handle); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 3ec510807d6d..9d751c041169 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -4115,6 +4115,25 @@ QDF_STATUS wmi_unified_vdev_config_ratemask_cmd_send(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +/** + * wmi_unified_vdev_set_custom_aggr_size_cmd_send() - WMI set custom aggr + * size function + * @param wmi_handle : handle to WMI + * @param param : pointer to hold custom aggr size param + * + * @return QDF_STATUS_SUCCESS on success and QDF_STATUS_R_FAILURE for failure + */ +QDF_STATUS wmi_unified_vdev_set_custom_aggr_size_cmd_send(void *wmi_hdl, + struct set_custom_aggr_size_params *param) +{ + wmi_unified_t wmi = (wmi_unified_t)wmi_hdl; + + if (wmi->ops->send_vdev_set_custom_aggr_size_cmd) + return wmi->ops->send_vdev_set_custom_aggr_size_cmd(wmi, param); + + return QDF_STATUS_E_FAILURE; +} + /** * wmi_unified_pdev_set_regdomain_params_cmd_send() - WMI set regdomain function * @param wmi_handle : handle to WMI. diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 9bbd48a17a94..c41b7db42594 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -10885,6 +10885,76 @@ static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +/** + * copy_custom_aggr_bitmap() - copies host side bitmap using FW APIs + * @param: param sent from the host side + * @cmd: param to be sent to the fw side + */ +static inline void copy_custom_aggr_bitmap( + struct set_custom_aggr_size_params *param, + wmi_vdev_set_custom_aggr_size_cmd_fixed_param *cmd) +{ + WMI_VDEV_CUSTOM_AGGR_AC_SET(cmd->enable_bitmap, + param->ac); + WMI_VDEV_CUSTOM_AGGR_TYPE_SET(cmd->enable_bitmap, + param->aggr_type); + WMI_VDEV_CUSTOM_TX_AGGR_SZ_DIS_SET(cmd->enable_bitmap, + param->tx_aggr_size_disable); + WMI_VDEV_CUSTOM_RX_AGGR_SZ_DIS_SET(cmd->enable_bitmap, + param->rx_aggr_size_disable); + WMI_VDEV_CUSTOM_TX_AC_EN_SET(cmd->enable_bitmap, + param->tx_ac_enable); +} + +/** + * send_vdev_set_custom_aggr_size_cmd_tlv() - custom aggr size param in fw + * @wmi_handle: wmi handle + * @param: pointer to hold custom aggr size params + * + * @return QDF_STATUS_SUCCESS on success and -ve on failure. + */ +static QDF_STATUS send_vdev_set_custom_aggr_size_cmd_tlv( + wmi_unified_t wmi_handle, + struct set_custom_aggr_size_params *param) +{ + wmi_vdev_set_custom_aggr_size_cmd_fixed_param *cmd; + wmi_buf_t buf; + int32_t len = sizeof(*cmd); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); + return QDF_STATUS_E_FAILURE; + } + cmd = (wmi_vdev_set_custom_aggr_size_cmd_fixed_param *) + wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_vdev_set_custom_aggr_size_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_vdev_set_custom_aggr_size_cmd_fixed_param)); + cmd->vdev_id = param->vdev_id; + cmd->tx_aggr_size = param->tx_aggr_size; + cmd->rx_aggr_size = param->rx_aggr_size; + copy_custom_aggr_bitmap(param, cmd); + + WMI_LOGD("Set custom aggr: vdev id=0x%X, tx aggr size=0x%X " + "rx_aggr_size=0x%X access category=0x%X, agg_type=0x%X " + "tx_aggr_size_disable=0x%X, rx_aggr_size_disable=0x%X " + "tx_ac_enable=0x%X\n", + param->vdev_id, param->tx_aggr_size, param->rx_aggr_size, + param->ac, param->aggr_type, param->tx_aggr_size_disable, + param->rx_aggr_size_disable, param->tx_ac_enable); + + if (wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_VDEV_SET_CUSTOM_AGGR_SIZE_CMDID)) { + WMI_LOGE("Seting custom aggregation size failed\n"); + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + /** * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw * @wmi_handle: wmi handle @@ -19756,6 +19826,8 @@ struct wmi_ops tlv_ops = { .send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv, .send_packet_power_info_get_cmd = send_packet_power_info_get_cmd_tlv, .send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv, + .send_vdev_set_custom_aggr_size_cmd = + send_vdev_set_custom_aggr_size_cmd_tlv, .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, .send_vdev_set_neighbour_rx_cmd = send_vdev_set_neighbour_rx_cmd_tlv, .send_smart_ant_set_tx_ant_cmd = send_smart_ant_set_tx_ant_cmd_tlv, @@ -20741,6 +20813,8 @@ static void populate_vdev_param_tlv(uint32_t *vdev_param) vdev_param[wmi_vdev_param_bw_nss_ratemask] = WMI_VDEV_PARAM_BW_NSS_RATEMASK; vdev_param[wmi_vdev_param_set_he_ltf] = WMI_VDEV_PARAM_HE_LTF; + vdev_param[wmi_vdev_param_rate_dropdown_bmap] = + WMI_VDEV_PARAM_RATE_DROPDOWN_BMAP; } #endif From f2e0ad8d0fba039ab5e246f592168b36dd2c76c0 Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Mon, 30 Oct 2017 18:19:45 +0530 Subject: [PATCH 6/9] qcacmn: Fix 4.9GHz channel list validation failure Problem: For JAPAN_48 country, channel list does not show frequency 4912, 4915, 4917 and 4920. This is because FW sends low limit 5g as 4912 which is a center frequency of 4.9GHz channel. In the current implementation, Host finds the low 5GHz edge frequency by subtracting 10 from channel center frequency. For example, channel center frequency is 4912 after subtracting 10 the low 5GHz edge frequency is 4910. Since 4910 is less than FW low limit 5GHz (4912), Host discards 4912 frequency from it's channel list. Solution: FW should send low limit 5GHz as 4910 to consider 4912 as low 5GHz edge frequency and Host should use min and max bandwidth from regulatory channel to calculate low 5GHz edge frequency. Change-Id: Ib712bd6ff091a385c7dc95832f9c771e34100211 CRs-Fixed: 2124135 --- umac/regulatory/core/src/reg_services.c | 118 +++++++++++++++++------- 1 file changed, 87 insertions(+), 31 deletions(-) diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index 13a1179f4738..f1eeedcc9ef6 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/umac/regulatory/core/src/reg_services.c @@ -2023,6 +2023,89 @@ reg_modify_chan_list_for_unsafe_ch(struct wlan_regulatory_pdev_priv_obj } } +/** + * reg_find_low_limit_chan_enum() - Find low limit 2G and 5G channel enums. + * @chan_list: Pointer to regulatory channel list. + * @low_freq: low limit frequency. + * @low_limit: pointer to output low limit enum. + * + * Return: None + */ +static void reg_find_low_limit_chan_enum(struct regulatory_channel *chan_list, + uint32_t low_freq, + uint32_t *low_limit) +{ + enum channel_enum chan_enum; + uint16_t min_bw; + uint16_t max_bw; + uint32_t center_freq; + + for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) { + min_bw = chan_list[chan_enum].min_bw; + max_bw = chan_list[chan_enum].max_bw; + center_freq = chan_list[chan_enum].center_freq; + + if ((center_freq - min_bw/2) >= low_freq) { + if ((center_freq - max_bw/2) < low_freq) { + max_bw = ((center_freq - low_freq) * 2); + if (max_bw < min_bw) + max_bw = min_bw; + chan_list[chan_enum].max_bw = max_bw; + } + *low_limit = chan_enum; + break; + } + } +} + +/** + * reg_find_high_limit_chan_enum() - Find high limit 2G and 5G channel enums. + * @chan_list: Pointer to regulatory channel list. + * @high_freq: high limit frequency. + * @high_limit: pointer to output high limit enum. + * + * Return: None + */ +static void reg_find_high_limit_chan_enum(struct regulatory_channel *chan_list, + uint32_t high_freq, + uint32_t *high_limit) +{ + enum channel_enum chan_enum; + uint16_t min_bw; + uint16_t max_bw; + uint32_t center_freq; + + for (chan_enum = NUM_CHANNELS - 1; chan_enum >= 0; chan_enum--) { + min_bw = chan_list[chan_enum].min_bw; + max_bw = chan_list[chan_enum].max_bw; + center_freq = chan_list[chan_enum].center_freq; + + if (center_freq + min_bw/2 <= high_freq) { + if ((center_freq + max_bw/2) > high_freq) { + max_bw = ((high_freq - center_freq) * 2); + if (max_bw < min_bw) + max_bw = min_bw; + chan_list[chan_enum].max_bw = max_bw; + } + *high_limit = chan_enum; + break; + } + if (chan_enum == 0) + break; + } +} + +/** + * reg_modify_chan_list_for_freq_range() - Modify channel list for the given low + * and high frequency range. + * @chan_list: Pointer to regulatory channel list. + * @low_freq_2g: Low frequency 2G. + * @high_freq_2g: High frequency 2G. + * @low_freq_5g: Low frequency 5G. + * @high_freq_5g: High frequency 5G. + * + * Return: None + */ static void reg_modify_chan_list_for_freq_range(struct regulatory_channel *chan_list, uint32_t low_freq_2g, @@ -2037,37 +2120,10 @@ reg_modify_chan_list_for_freq_range(struct regulatory_channel *chan_list, enum channel_enum chan_enum; bool chan_in_range; - for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) { - if ((chan_list[chan_enum].center_freq - 10) >= low_freq_2g) { - low_limit_2g = chan_enum; - break; - } - } - - for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) { - if ((chan_list[chan_enum].center_freq - 10) >= low_freq_5g) { - low_limit_5g = chan_enum; - break; - } - } - - for (chan_enum = NUM_CHANNELS - 1; chan_enum >= 0; chan_enum--) { - if (chan_list[chan_enum].center_freq + 10 <= high_freq_2g) { - high_limit_2g = chan_enum; - break; - } - if (chan_enum == 0) - break; - } - - for (chan_enum = NUM_CHANNELS - 1; chan_enum >= 0; chan_enum--) { - if (chan_list[chan_enum].center_freq + 10 <= high_freq_5g) { - high_limit_5g = chan_enum; - break; - } - if (chan_enum == 0) - break; - } + reg_find_low_limit_chan_enum(chan_list, low_freq_2g, &low_limit_2g); + reg_find_low_limit_chan_enum(chan_list, low_freq_5g, &low_limit_5g); + reg_find_high_limit_chan_enum(chan_list, high_freq_2g, &high_limit_2g); + reg_find_high_limit_chan_enum(chan_list, high_freq_5g, &high_limit_5g); for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) { chan_in_range = false; From d448fad508d437c3a7274a98e626846fda75863c Mon Sep 17 00:00:00 2001 From: Tiger Yu Date: Fri, 3 Nov 2017 17:21:43 +0800 Subject: [PATCH 7/9] qcacmn: Fix memory leak for SDIO RX path in the HIF layer qcacld-2.0 to qcacmn propagation There is a memory leak if fail to process the rx packet header in the HIF layer. Add sanity checking to free all resources if failure hit. Change-Id: Ifa443dcec0a31ae39356ac1ddf7cfe652d8968ce CRs-Fixed: 2137736 --- hif/src/sdio/hif_sdio_recv.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hif/src/sdio/hif_sdio_recv.c b/hif/src/sdio/hif_sdio_recv.c index 548352ad177e..ae617c90c0c3 100644 --- a/hif/src/sdio/hif_sdio_recv.c +++ b/hif/src/sdio/hif_sdio_recv.c @@ -1025,8 +1025,11 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev, hif_dev_process_recv_header(pdev, packet, look_aheads, &num_look_aheads); - if (QDF_IS_STATUS_ERROR(status)) + if (QDF_IS_STATUS_ERROR(status)) { + HTC_PACKET_ENQUEUE_TO_HEAD(&sync_completed_pkts_queue, + packet); break; + } netbuf = (qdf_nbuf_t) packet->pNetBufContext; /* set data length */ @@ -1044,8 +1047,13 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev, pipeid); } } - if (QDF_IS_STATUS_ERROR(status)) + + if (QDF_IS_STATUS_ERROR(status)) { + if (!HTC_QUEUE_EMPTY(&sync_completed_pkts_queue)) + hif_dev_free_recv_pkt_queue( + &sync_completed_pkts_queue); break; + } if (num_look_aheads == 0) { /* no more look aheads */ From fd269b5021a0715a18857effb2302316b535a32d Mon Sep 17 00:00:00 2001 From: Yun Park Date: Thu, 5 Oct 2017 14:41:32 -0700 Subject: [PATCH 8/9] qcacmn: Remove kernel includes from datapath To abstract kernel header inclusion, create a new QDF APIs for all IPA APIs and redirect all IPA API calls through QDF interfaces. Change-Id: I7bff975ad7cb32fc128320c124633594471e0a1f CRs-Fixed: 2098907 --- dp/inc/cdp_txrx_ipa.h | 7 +- dp/inc/cdp_txrx_ops.h | 7 +- dp/wifi3.0/dp_ipa.c | 184 +++---- dp/wifi3.0/dp_ipa.h | 4 +- dp/wifi3.0/dp_rx.c | 1 - dp/wifi3.0/dp_rx_mon_dest.c | 1 - dp/wifi3.0/dp_rx_mon_status.c | 1 - qdf/inc/qdf_ipa.h | 607 ++++++++++++++++++++++ qdf/inc/qdf_ipa_wdi3.h | 157 ++++++ qdf/linux/src/i_qdf_ipa.h | 903 +++++++++++++++++++++++++++++++++ qdf/linux/src/i_qdf_ipa_wdi3.h | 239 +++++++++ 11 files changed, 2014 insertions(+), 97 deletions(-) create mode 100644 qdf/inc/qdf_ipa.h create mode 100644 qdf/inc/qdf_ipa_wdi3.h create mode 100644 qdf/linux/src/i_qdf_ipa.h create mode 100644 qdf/linux/src/i_qdf_ipa_wdi3.h diff --git a/dp/inc/cdp_txrx_ipa.h b/dp/inc/cdp_txrx_ipa.h index 84a35d163c49..ab0d15afee55 100644 --- a/dp/inc/cdp_txrx_ipa.h +++ b/dp/inc/cdp_txrx_ipa.h @@ -32,8 +32,7 @@ #define _CDP_TXRX_IPA_H_ #ifdef IPA_OFFLOAD - -#include +#include #include #include "cdp_txrx_handle.h" @@ -419,8 +418,8 @@ cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint32_t tx_pipe_handle, */ static inline QDF_STATUS cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr, - enum ipa_client_type prod_client, - enum ipa_client_type cons_client, + qdf_ipa_client_type_t prod_client, + qdf_ipa_client_type_t cons_client, uint8_t session_id, bool is_ipv6_enabled) { if (!soc || !soc->ops || !soc->ops->ipa_ops) { diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index eb0e5bcd1d1f..70e8655e98fd 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -32,8 +32,9 @@ #include "cdp_txrx_handle.h" #include #include "wlan_objmgr_psoc_obj.h" + #ifdef IPA_OFFLOAD -#include +#include #endif /** @@ -828,8 +829,8 @@ struct cdp_ipa_ops { QDF_STATUS (*ipa_cleanup)(uint32_t tx_pipe_handle, uint32_t rx_pipe_handle); QDF_STATUS (*ipa_setup_iface)(char *ifname, uint8_t *mac_addr, - enum ipa_client_type prod_client, - enum ipa_client_type cons_client, + qdf_ipa_client_type_t prod_client, + qdf_ipa_client_type_t cons_client, uint8_t session_id, bool is_ipv6_enabled); QDF_STATUS (*ipa_cleanup_iface)(char *ifname, bool is_ipv6_enabled); QDF_STATUS (*ipa_enable_pipes)(struct cdp_pdev *pdev); diff --git a/dp/wifi3.0/dp_ipa.c b/dp/wifi3.0/dp_ipa.c index ca1e3f4c2f98..b8df37008748 100644 --- a/dp/wifi3.0/dp_ipa.c +++ b/dp/wifi3.0/dp_ipa.c @@ -16,7 +16,7 @@ #ifdef IPA_OFFLOAD -#include +#include #include #include #include @@ -605,10 +605,10 @@ QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb, struct dp_pdev *pdev = (struct dp_pdev *)ppdev; struct dp_soc *soc = pdev->soc; struct dp_ipa_resources *ipa_res = &pdev->ipa_resource; - struct ipa_wdi3_setup_info tx; - struct ipa_wdi3_setup_info rx; - struct ipa_wdi3_conn_in_params pipe_in; - struct ipa_wdi3_conn_out_params pipe_out; + qdf_ipa_wdi3_setup_info_t *tx; + qdf_ipa_wdi3_setup_info_t *rx; + qdf_ipa_wdi3_conn_in_params_t pipe_in; + qdf_ipa_wdi3_conn_out_params_t pipe_out; struct tcl_data_cmd *tcl_desc_ptr; uint8_t *desc_addr; uint32_t desc_size; @@ -616,8 +616,8 @@ QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb, qdf_mem_zero(&tx, sizeof(struct ipa_wdi3_setup_info)); qdf_mem_zero(&rx, sizeof(struct ipa_wdi3_setup_info)); - qdf_mem_zero(&pipe_in, sizeof(struct ipa_wdi3_conn_in_params)); - qdf_mem_zero(&pipe_out, sizeof(struct ipa_wdi3_conn_out_params)); + qdf_mem_zero(&pipe_in, sizeof(pipe_in)); + qdf_mem_zero(&pipe_out, sizeof(pipe_out)); /* TX PIPE */ /** @@ -626,30 +626,39 @@ QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb, * Event Ring: TCL ring * Event Ring Doorbell PA: TCL Head Pointer Address */ - tx.ipa_ep_cfg.nat.nat_en = IPA_BYPASS_NAT; - tx.ipa_ep_cfg.hdr.hdr_len = DP_IPA_UC_WLAN_TX_HDR_LEN; - tx.ipa_ep_cfg.hdr.hdr_ofst_pkt_size_valid = 0; - tx.ipa_ep_cfg.hdr.hdr_ofst_pkt_size = 0; - tx.ipa_ep_cfg.hdr.hdr_additional_const_len = 0; - tx.ipa_ep_cfg.mode.mode = IPA_BASIC; - tx.ipa_ep_cfg.hdr_ext.hdr_little_endian = true; - tx.client = IPA_CLIENT_WLAN1_CONS; - tx.transfer_ring_base_pa = ipa_res->tx_comp_ring_base_paddr; - tx.transfer_ring_size = ipa_res->tx_comp_ring_size; - tx.transfer_ring_doorbell_pa = /* WBM Tail Pointer Address */ + tx = &QDF_IPA_WDI3_CONN_IN_PARAMS_TX(&pipe_in); + QDF_IPA_WDI3_SETUP_INFO_NAT_EN(tx) = IPA_BYPASS_NAT; + QDF_IPA_WDI3_SETUP_INFO_HDR_LEN(tx) = DP_IPA_UC_WLAN_TX_HDR_LEN; + QDF_IPA_WDI3_SETUP_INFO_HDR_OFST_PKT_SIZE_VALID(tx) = 0; + QDF_IPA_WDI3_SETUP_INFO_HDR_OFST_PKT_SIZE(tx) = 0; + QDF_IPA_WDI3_SETUP_INFO_HDR_ADDITIONAL_CONST_LEN(tx) = 0; + QDF_IPA_WDI3_SETUP_INFO_MODE(tx) = IPA_BASIC; + QDF_IPA_WDI3_SETUP_INFO_HDR_LITTLE_ENDIAN(tx) = true; + QDF_IPA_WDI3_SETUP_INFO_CLIENT(tx) = IPA_CLIENT_WLAN1_CONS; + QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_BASE_PA(tx) = + ipa_res->tx_comp_ring_base_paddr; + QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_SIZE(tx) = + ipa_res->tx_comp_ring_size; + /* WBM Tail Pointer Address */ + QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(tx) = soc->ipa_uc_tx_rsc.ipa_wbm_tp_paddr; - tx.event_ring_base_pa = ipa_res->tx_ring_base_paddr; - tx.event_ring_size = ipa_res->tx_ring_size; - tx.event_ring_doorbell_pa = /* TCL Head Pointer Address */ + QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_BASE_PA(tx) = + ipa_res->tx_ring_base_paddr; + QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_SIZE(tx) = ipa_res->tx_ring_size; + /* TCL Head Pointer Address */ + QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_DOORBELL_PA(tx) = soc->ipa_uc_tx_rsc.ipa_tcl_hp_paddr; - tx.num_pkt_buffers = ipa_res->tx_num_alloc_buffer; - tx.pkt_offset = 0; + QDF_IPA_WDI3_SETUP_INFO_NUM_PKT_BUFFERS(tx) = + ipa_res->tx_num_alloc_buffer; + QDF_IPA_WDI3_SETUP_INFO_PKT_OFFSET(tx) = 0; /* Preprogram TCL descriptor */ - desc_addr = (uint8_t *)(tx.desc_format_template); + desc_addr = + (uint8_t *)QDF_IPA_WDI3_SETUP_INFO_DESC_FORMAT_TEMPLATE(tx); desc_size = sizeof(struct tcl_data_cmd); HAL_TX_DESC_SET_TLV_HDR(desc_addr, HAL_TX_TCL_DATA_TAG, desc_size); - tcl_desc_ptr = (struct tcl_data_cmd *)(tx.desc_format_template+1); + tcl_desc_ptr = (struct tcl_data_cmd *) + (QDF_IPA_WDI3_SETUP_INFO_DESC_FORMAT_TEMPLATE(tx) + 1); tcl_desc_ptr->buf_addr_info.return_buffer_manager = HAL_RX_BUF_RBM_SW2_BM; tcl_desc_ptr->addrx_en = 1; /* Address X search enable in ASE */ @@ -663,29 +672,28 @@ QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb, * Event Ring: FW ring * Event Ring Doorbell PA: FW Head Pointer Address */ - rx.ipa_ep_cfg.nat.nat_en = IPA_BYPASS_NAT; - rx.ipa_ep_cfg.hdr.hdr_len = DP_IPA_UC_WLAN_RX_HDR_LEN; - rx.ipa_ep_cfg.hdr.hdr_ofst_metadata_valid = 0; - rx.ipa_ep_cfg.hdr.hdr_metadata_reg_valid = 1; - rx.ipa_ep_cfg.mode.mode = IPA_BASIC; - rx.client = IPA_CLIENT_WLAN1_PROD; - rx.transfer_ring_base_pa = ipa_res->rx_rdy_ring_base_paddr; - rx.transfer_ring_size = ipa_res->rx_rdy_ring_size; - rx.transfer_ring_doorbell_pa = /* REO Tail Pointer Address */ + rx = &QDF_IPA_WDI3_CONN_IN_PARAMS_RX(&pipe_in); + QDF_IPA_WDI3_SETUP_INFO_NAT_EN(rx) = IPA_BYPASS_NAT; + QDF_IPA_WDI3_SETUP_INFO_HDR_LEN(rx) = DP_IPA_UC_WLAN_TX_HDR_LEN; + QDF_IPA_WDI3_SETUP_INFO_HDR_OFST_METADATA_VALID(rx) = 0; + QDF_IPA_WDI3_SETUP_INFO_HDR_METADATA_REG_VALID(rx) = 1; + QDF_IPA_WDI3_SETUP_INFO_MODE(rx) = IPA_BASIC; + QDF_IPA_WDI3_SETUP_INFO_CLIENT(rx) = IPA_CLIENT_WLAN1_PROD; + QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_BASE_PA(rx) = ipa_res->rx_rdy_ring_base_paddr; + QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_SIZE(rx) = ipa_res->rx_rdy_ring_size; + QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(rx) = /* REO Tail Pointer Address */ soc->ipa_uc_rx_rsc.ipa_reo_tp_paddr; - rx.event_ring_base_pa = ipa_res->rx_refill_ring_base_paddr; - rx.event_ring_size = ipa_res->rx_refill_ring_size; - rx.event_ring_doorbell_pa = /* FW Head Pointer Address */ + QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_BASE_PA(rx) = ipa_res->rx_refill_ring_base_paddr; + QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_SIZE(rx) = ipa_res->rx_refill_ring_size; + QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_DOORBELL_PA(rx) = /* FW Head Pointer Address */ soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_hp_paddr; - rx.pkt_offset = RX_PKT_TLVS_LEN + L3_HEADER_PADDING; + QDF_IPA_WDI3_SETUP_INFO_PKT_OFFSET(rx) = RX_PKT_TLVS_LEN + L3_HEADER_PADDING; - pipe_in.notify = ipa_w2i_cb; - pipe_in.priv = ipa_priv; - memcpy(&pipe_in.tx, &tx, sizeof(struct ipa_wdi3_setup_info)); - memcpy(&pipe_in.rx, &rx, sizeof(struct ipa_wdi3_setup_info)); + QDF_IPA_WDI3_CONN_IN_PARAMS_NOTIFY(&pipe_in) = ipa_w2i_cb; + QDF_IPA_WDI3_CONN_IN_PARAMS_PRIV(&pipe_in) = ipa_priv; /* Connect WDI IPA PIPE */ - ret = ipa_wdi3_conn_pipes(&pipe_in, &pipe_out); + ret = qdf_ipa_wdi3_conn_pipes(&pipe_in, &pipe_out); if (ret) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: ipa_wdi3_conn_pipes: IPA pipe setup failed: ret=%d", @@ -697,30 +705,33 @@ QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb, QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, "%s: Tx DB PA=0x%x, Rx DB PA=0x%x", __func__, - (unsigned int)pipe_out.tx_uc_db_pa, - (unsigned int)pipe_out.rx_uc_db_pa); + (unsigned int)QDF_IPA_WDI3_CONN_OUT_PARAMS_TX_UC_DB_PA(&pipe_out), + (unsigned int)QDF_IPA_WDI3_CONN_OUT_PARAMS_RX_UC_DB_PA(&pipe_out)); - ipa_res->tx_comp_doorbell_paddr = pipe_out.tx_uc_db_pa; - ipa_res->tx_comp_doorbell_vaddr = pipe_out.tx_uc_db_va; - ipa_res->rx_ready_doorbell_paddr = pipe_out.rx_uc_db_pa; + ipa_res->tx_comp_doorbell_paddr = + QDF_IPA_WDI3_CONN_OUT_PARAMS_TX_UC_DB_PA(&pipe_out); + ipa_res->tx_comp_doorbell_vaddr = + QDF_IPA_WDI3_CONN_OUT_PARAMS_TX_UC_DB_VA(&pipe_out); + ipa_res->rx_ready_doorbell_paddr = + QDF_IPA_WDI3_CONN_OUT_PARAMS_RX_UC_DB_PA(&pipe_out); QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, "%s: Tx: %s=%pK, %s=%d, %s=%pK, %s=%pK, %s=%d, %s=%pK, %s=%d, %s=%pK", __func__, "transfer_ring_base_pa", - (void *)pipe_in.tx.transfer_ring_base_pa, + (void *)QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_BASE_PA(tx), "transfer_ring_size", - pipe_in.tx.transfer_ring_size, + QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_SIZE(tx), "transfer_ring_doorbell_pa", - (void *)pipe_in.tx.transfer_ring_doorbell_pa, + (void *)QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(tx), "event_ring_base_pa", - (void *)pipe_in.tx.event_ring_base_pa, + (void *)QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_BASE_PA(tx), "event_ring_size", - pipe_in.tx.event_ring_size, + QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_SIZE(tx), "event_ring_doorbell_pa", - (void *)pipe_in.tx.event_ring_doorbell_pa, + (void *)QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_DOORBELL_PA(tx), "num_pkt_buffers", - pipe_in.tx.num_pkt_buffers, + QDF_IPA_WDI3_SETUP_INFO_NUM_PKT_BUFFERS(tx), "tx_comp_doorbell_paddr", (void *)ipa_res->tx_comp_doorbell_paddr); @@ -728,19 +739,19 @@ QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb, "%s: Rx: %s=%pK, %s=%d, %s=%pK, %s=%pK, %s=%d, %s=%pK, %s=%d, %s=%pK", __func__, "transfer_ring_base_pa", - (void *)pipe_in.rx.transfer_ring_base_pa, + (void *)QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_BASE_PA(rx), "transfer_ring_size", - pipe_in.rx.transfer_ring_size, + QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_SIZE(rx), "transfer_ring_doorbell_pa", - (void *)pipe_in.rx.transfer_ring_doorbell_pa, + (void *)QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(rx), "event_ring_base_pa", - (void *)pipe_in.rx.event_ring_base_pa, + (void *)QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_BASE_PA(rx), "event_ring_size", - pipe_in.rx.event_ring_size, + QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_SIZE(rx), "event_ring_doorbell_pa", - (void *)pipe_in.rx.event_ring_doorbell_pa, + (void *)QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_DOORBELL_PA(rx), "num_pkt_buffers", - pipe_in.rx.num_pkt_buffers, + QDF_IPA_WDI3_SETUP_INFO_NUM_PKT_BUFFERS(rx), "tx_comp_doorbell_paddr", (void *)ipa_res->rx_ready_doorbell_paddr); @@ -758,7 +769,7 @@ QDF_STATUS dp_ipa_cleanup(uint32_t tx_pipe_handle, uint32_t rx_pipe_handle) { int ret; - ret = ipa_wdi3_disconn_pipes(); + ret = qdf_ipa_wdi3_disconn_pipes(); if (ret) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: ipa_wdi3_disconn_pipes: IPA pipe cleanup failed: ret=%d", @@ -781,12 +792,12 @@ QDF_STATUS dp_ipa_cleanup(uint32_t tx_pipe_handle, uint32_t rx_pipe_handle) * Return: QDF_STATUS */ QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr, - enum ipa_client_type prod_client, - enum ipa_client_type cons_client, + qdf_ipa_client_type_t prod_client, + qdf_ipa_client_type_t cons_client, uint8_t session_id, bool is_ipv6_enabled) { - struct ipa_wdi3_reg_intf_in_params in; - struct ipa_wdi3_hdr_info hdr_info; + qdf_ipa_wdi3_reg_intf_in_params_t in; + qdf_ipa_wdi3_hdr_info_t hdr_info; struct dp_ipa_uc_tx_hdr uc_tx_hdr; int ret = -EINVAL; @@ -794,31 +805,34 @@ QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr, "%s: Add Partial hdr: %s, %pM", __func__, ifname, mac_addr); - qdf_mem_zero(&hdr_info, sizeof(struct ipa_wdi3_hdr_info)); + qdf_mem_zero(&hdr_info, sizeof(qdf_ipa_wdi3_hdr_info_t)); qdf_ether_addr_copy(uc_tx_hdr.eth.h_source, mac_addr); /* IPV4 header */ uc_tx_hdr.eth.h_proto = qdf_htons(ETH_P_IP); - hdr_info.hdr = (uint8_t *)&uc_tx_hdr; - hdr_info.hdr_len = DP_IPA_UC_WLAN_TX_HDR_LEN; - hdr_info.hdr_type = IPA_HDR_L2_ETHERNET_II; - hdr_info.dst_mac_addr_offset = DP_IPA_UC_WLAN_HDR_DES_MAC_OFFSET; + QDF_IPA_WDI3_HDR_INFO_HDR(&hdr_info) = (uint8_t *)&uc_tx_hdr; + QDF_IPA_WDI3_HDR_INFO_HDR_LEN(&hdr_info) = DP_IPA_UC_WLAN_TX_HDR_LEN; + QDF_IPA_WDI3_HDR_INFO_HDR_TYPE(&hdr_info) = IPA_HDR_L2_ETHERNET_II; + QDF_IPA_WDI3_HDR_INFO_DST_MAC_ADDR_OFFSET(&hdr_info) = + DP_IPA_UC_WLAN_HDR_DES_MAC_OFFSET; - in.netdev_name = ifname; - memcpy(&(in.hdr_info[0]), &hdr_info, sizeof(struct ipa_wdi3_hdr_info)); - in.is_meta_data_valid = 1; - in.meta_data = htonl(session_id << 16); - in.meta_data_mask = htonl(0x00FF0000); + QDF_IPA_WDI3_REG_INTF_IN_PARAMS_NETDEV_NAME(&in) = ifname; + memcpy(&(QDF_IPA_WDI3_REG_INTF_IN_PARAMS_HDR_INFO(&in)[0]), &hdr_info, + sizeof(qdf_ipa_wdi3_hdr_info_t)); + QDF_IPA_WDI3_REG_INTF_IN_PARAMS_IS_META_DATA_VALID(&in) = 1; + QDF_IPA_WDI3_REG_INTF_IN_PARAMS_META_DATA(&in) = + htonl(session_id << 16); + QDF_IPA_WDI3_REG_INTF_IN_PARAMS_META_DATA_MASK(&in) = htonl(0x00FF0000); /* IPV6 header */ if (is_ipv6_enabled) { uc_tx_hdr.eth.h_proto = qdf_htons(ETH_P_IPV6); - memcpy(&(in.hdr_info[1]), &hdr_info, - sizeof(struct ipa_wdi3_hdr_info)); + memcpy(&(QDF_IPA_WDI3_REG_INTF_IN_PARAMS_HDR_INFO(&in)[1]), + &hdr_info, sizeof(qdf_ipa_wdi3_hdr_info_t)); } - ret = ipa_wdi3_reg_intf(&in); + ret = qdf_ipa_wdi3_reg_intf(&in); if (ret) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: ipa_wdi3_reg_intf: register IPA interface falied: ret=%d", @@ -840,7 +854,7 @@ QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled) { int ret; - ret = ipa_wdi3_dereg_intf(ifname); + ret = qdf_ipa_wdi3_dereg_intf(ifname); if (ret) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: ipa_wdi3_dereg_intf: IPA pipe deregistration failed: ret=%d", @@ -861,7 +875,7 @@ QDF_STATUS dp_ipa_enable_pipes(struct cdp_pdev *ppdev) { QDF_STATUS result; - result = ipa_wdi3_enable_pipes(); + result = qdf_ipa_wdi3_enable_pipes(); if (result) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: Enable WDI PIPE fail, code %d", @@ -882,7 +896,7 @@ QDF_STATUS dp_ipa_disable_pipes(struct cdp_pdev *ppdev) { QDF_STATUS result; - result = ipa_wdi3_disable_pipes(); + result = qdf_ipa_wdi3_disable_pipes(); if (result) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: Disable WDI PIPE fail, code %d", @@ -902,13 +916,13 @@ QDF_STATUS dp_ipa_disable_pipes(struct cdp_pdev *ppdev) */ QDF_STATUS dp_ipa_set_perf_level(int client, uint32_t max_supported_bw_mbps) { - struct ipa_wdi3_perf_profile profile; + qdf_ipa_wdi3_perf_profile_t profile; QDF_STATUS result; profile.client = client; profile.max_supported_bw_mbps = max_supported_bw_mbps; - result = ipa_wdi3_set_perf_profile(&profile); + result = qdf_ipa_wdi3_set_perf_profile(&profile); if (result) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: ipa_wdi3_set_perf_profile fail, code %d", diff --git a/dp/wifi3.0/dp_ipa.h b/dp/wifi3.0/dp_ipa.h index f92dc922c2e9..f6c09c1c283d 100644 --- a/dp/wifi3.0/dp_ipa.h +++ b/dp/wifi3.0/dp_ipa.h @@ -65,8 +65,8 @@ int dp_ipa_add_header_info(char *ifname, uint8_t *mac_addr, uint8_t session_id, bool is_ipv6_enabled); int dp_ipa_register_interface(char *ifname, bool is_ipv6_enabled); QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr, - enum ipa_client_type prod_client, - enum ipa_client_type cons_client, + qdf_ipa_client_type_t prod_client, + qdf_ipa_client_type_t cons_client, uint8_t session_id, bool is_ipv6_enabled); QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled); QDF_STATUS dp_ipa_enable_pipes(struct cdp_pdev *pdev); diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index a4e7761e626e..9d992628bdd6 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -22,7 +22,6 @@ #include "hal_rx.h" #include "hal_api.h" #include "qdf_nbuf.h" -#include #ifdef MESH_MODE_SUPPORT #include "if_meta_hdr.h" #endif diff --git a/dp/wifi3.0/dp_rx_mon_dest.c b/dp/wifi3.0/dp_rx_mon_dest.c index 221b132ecd53..704e4bc3bd9e 100644 --- a/dp/wifi3.0/dp_rx_mon_dest.c +++ b/dp/wifi3.0/dp_rx_mon_dest.c @@ -24,7 +24,6 @@ #include "qdf_trace.h" #include "qdf_nbuf.h" #include "hal_api_mon.h" -#include "linux/ieee80211.h" #include "dp_rx_mon.h" #include "wlan_cfg.h" diff --git a/dp/wifi3.0/dp_rx_mon_status.c b/dp/wifi3.0/dp_rx_mon_status.c index 64d88daa4446..c109ebb8e55d 100644 --- a/dp/wifi3.0/dp_rx_mon_status.c +++ b/dp/wifi3.0/dp_rx_mon_status.c @@ -23,7 +23,6 @@ #include "qdf_trace.h" #include "qdf_nbuf.h" #include "hal_api_mon.h" -#include "linux/ieee80211.h" #include "dp_rx_mon.h" #include "dp_internal.h" #include "qdf_mem.h" /* qdf_mem_malloc,free */ diff --git a/qdf/inc/qdf_ipa.h b/qdf/inc/qdf_ipa.h new file mode 100644 index 000000000000..576582de988c --- /dev/null +++ b/qdf/inc/qdf_ipa.h @@ -0,0 +1,607 @@ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _QDF_IPA_H +#define _QDF_IPA_H + +#include + +/** + * qdf_ipa_wdi_meter_evt_type_t - type of event client callback is + * for AP+STA mode metering + * @IPA_GET_WDI_SAP_STATS: get IPA_stats betwen SAP and STA - + * use ipa_get_wdi_sap_stats structure + * @IPA_SET_WIFI_QUOTA: set quota limit on STA - + * use ipa_set_wifi_quota structure + */ +typedef __qdf_ipa_wdi_meter_evt_type_t qdf_ipa_wdi_meter_evt_type_t; + +typedef __qdf_ipa_get_wdi_sap_stats_t qdf_ipa_get_wdi_sap_stats_t; + +/** + * qdf_ipa_set_wifi_quota_t - structure used for + * IPA_SET_WIFI_QUOTA. + */ +typedef __qdf_ipa_set_wifi_quota_t qdf_ipa_set_wifi_quota_t; + +/** + * qdf_ipa_connect_params_t - low-level client connect input parameters. Either + * client allocates the data and desc FIFO and specifies that in data+desc OR + * specifies sizes and pipe_mem pref and IPA does the allocation. + */ +typedef __qdf_ipa_connect_params_t qdf_ipa_connect_params_t; + +/** + * qdf_ipa_tx_meta_t - meta-data for the TX packet + */ +typedef __qdf_ipa_tx_meta_t qdf_ipa_tx_meta_t; + +/** + * __qdf_ipa_sps_params_t - SPS related output parameters resulting from + */ +typedef __qdf_ipa_sps_params_t qdf_ipa_sps_params_t; + +/** + * qdf_ipa_tx_intf_t - interface tx properties + */ +typedef __qdf_ipa_tx_intf_t qdf_ipa_tx_intf_t; + +/** + * qdf_ipa_rx_intf_t - interface rx properties + */ +typedef __qdf_ipa_rx_intf_t qdf_ipa_rx_intf_t; + +/** + * qdf_ipa_ext_intf_t - interface ext properties + */ +typedef __qdf_ipa_ext_intf_t qdf_ipa_ext_intf_t; + +/** + * qdf_ipa_sys_connect_params_t - information needed to setup an IPA end-point + * in system-BAM mode + */ +typedef __qdf_ipa_sys_connect_params_t qdf_ipa_sys_connect_params_t; + +/** + * __qdf_pa_rm_event_t - IPA RM events + * + * Indicate the resource state change + */ +typedef __qdf_ipa_rm_event_t qdf_ipa_rm_event_t; + +/** + * struct qdf_ipa_rm_register_params_t - information needed to + * register IPA RM client with IPA RM + */ +typedef __qdf_ipa_rm_register_params_t qdf_ipa_rm_register_params_t; + +/** + * struct qdf_ipa_rm_create_params_t - information needed to initialize + * the resource + * + * IPA RM client is expected to perform non blocking operations only + * in request_resource and release_resource functions and + * release notification context as soon as possible. + */ +typedef __qdf_ipa_rm_create_params_t qdf_ipa_rm_create_params_t; + +/** + * qdf_ipa_rm_perf_profile_t - information regarding IPA RM client performance + * profile + */ +typedef __qdf_ipa_rm_perf_profile_t qdf_ipa_rm_perf_profile_t; + +/** + * qdf_ipa_tx_data_desc_t - information needed + * to send data packet to HW link: link to data descriptors + * priv: client specific private data + */ +typedef __qdf_ipa_tx_data_desc_t qdf_ipa_tx_data_desc_t; + +/** + * qdf_ipa_rx_data_t - information needed + * to send to wlan driver on receiving data from ipa hw + */ +typedef __qdf_ipa_rx_data_t qdf_ipa_rx_data_t; + +/** + * qdf_ipa_wdi_ul_params_t - WDI_RX configuration + */ +typedef __qdf_ipa_wdi_ul_params_t qdf_ipa_wdi_ul_params_t; + +/** + * qdf_ipa_wdi_ul_params_smmu_t - WDI_RX configuration (with WLAN SMMU) + */ +typedef __qdf_ipa_wdi_ul_params_smmu_t qdf_ipa_wdi_ul_params_smmu_t; + +/** + * qdf_ipa_wdi_dl_params_t - WDI_TX configuration + */ +typedef __qdf_ipa_wdi_dl_params_t qdf_ipa_wdi_dl_params_t; + +/** + * qdf_ipa_wdi_dl_params_smmu_t - WDI_TX configuration (with WLAN SMMU) + */ +typedef __qdf_ipa_wdi_dl_params_smmu_t qdf_ipa_wdi_dl_params_smmu_t; + +/** + * qdf_ipa_wdi_in_params_t - information provided by WDI client + */ +typedef __qdf_ipa_wdi_in_params_t qdf_ipa_wdi_in_params_t; + +/** + * qdf_ipa_wdi_out_params_t - information provided to WDI client + */ +typedef __qdf_ipa_wdi_out_params_t qdf_ipa_wdi_out_params_t; + +/** + * qdf_ipa_wdi_db_params_t - information provided to retrieve + * physical address of uC doorbell + */ +typedef __qdf_ipa_wdi_db_params_t qdf_ipa_wdi_db_params_t; + +/** + * qdf_ipa_wdi_uc_ready_params_t - uC ready CB parameters + */ +typedef void (*qdf_ipa_uc_ready_cb)(void *priv); +typedef __qdf_ipa_wdi_uc_ready_params_t qdf_ipa_wdi_uc_ready_params_t; + +/** + * qdf_ipa_wdi_buffer_info_t - address info of a WLAN allocated buffer + * + * IPA driver will create/release IOMMU mapping in IPA SMMU from iova->pa + */ +typedef __qdf_ipa_wdi_buffer_info_t qdf_ipa_wdi_buffer_info_t; + +/** + * qdf_ipa_gsi_ep_config_t - IPA GSI endpoint configurations + */ +typedef __qdf_ipa_gsi_ep_config_t qdf_ipa_gsi_ep_config_t; + +/** + * qdf_ipa_dp_evt_type_t - type of event client callback is + * invoked for on data path + * @IPA_RECEIVE: data is struct sk_buff + * @IPA_WRITE_DONE: data is struct sk_buff + */ +typedef __qdf_ipa_dp_evt_type_t qdf_ipa_dp_evt_type_t; + +typedef __qdf_ipa_hdr_add_t qdf_ipa_hdr_add_t; +typedef __qdf_ipa_hdr_del_t qdf_ipa_hdr_del_t; +typedef __qdf_ipa_ioc_add_hdr_t qdf_ipa_ioc_add_hdr_t; +typedef __qdf_ipa_ioc_del_hdr_t qdf_ipa_ioc_del_hdr_t; +typedef __qdf_ipa_ioc_get_hdr_t qdf_ipa_ioc_get_hdr_t; +typedef __qdf_ipa_ioc_copy_hdr_t qdf_ipa_ioc_copy_hdr_t; +typedef __qdf_ipa_ioc_add_hdr_proc_ctx_t qdf_ipa_ioc_add_hdr_proc_ctx_t; +typedef __qdf_ipa_ioc_del_hdr_proc_ctx_t qdf_ipa_ioc_del_hdr_proc_ctx_t; +typedef __qdf_ipa_msg_meta_t qdf_ipa_msg_meta_t; +typedef __qdf_ipa_client_type_t qdf_ipa_client_type_t; +typedef __qdf_ipa_hw_stats_wdi_info_data_t qdf_ipa_hw_stats_wdi_info_data_t; +typedef __qdf_ipa_rm_resource_name_t qdf_ipa_rm_resource_name_t; +typedef __qdf_ipa_wlan_event_t qdf_ipa_wlan_event_t; +typedef __qdf_ipa_wlan_msg_t qdf_ipa_wlan_msg_t; +typedef __qdf_ipa_wlan_msg_ex_t qdf_ipa_wlan_msg_ex_t; +typedef __qdf_ipa_ioc_tx_intf_prop_t qdf_ipa_ioc_tx_intf_prop_t; +typedef __qdf_ipa_ioc_rx_intf_prop_t qdf_ipa_ioc_rx_intf_prop_t; +typedef __qdf_ipa_wlan_hdr_attrib_val_t qdf_ipa_wlan_hdr_attrib_val_t; +typedef int (*qdf_ipa_msg_pull_fn)(void *buff, u32 len, u32 type); +typedef void (*qdf_ipa_ready_cb)(void *user_data); + +/* + * Connect / Disconnect + */ +static inline int qdf_ipa_connect(const __qdf_ipa_connect_params_t *in, + qdf_ipa_sps_params_t *sps, u32 *clnt_hdl) +{ + return __qdf_ipa_connect(in, sps, clnt_hdl); +} + +static inline int qdf_ipa_disconnect(u32 clnt_hdl) +{ + return __qdf_ipa_disconnect(clnt_hdl); +} + +/* + * Resume / Suspend + */ +static inline int qdf_ipa_reset_endpoint(u32 clnt_hdl) +{ + return __qdf_ipa_reset_endpoint(clnt_hdl); +} + +/* + * Remove ep delay + */ +static inline int qdf_ipa_clear_endpoint_delay(u32 clnt_hdl) +{ + return __qdf_ipa_clear_endpoint_delay(clnt_hdl); +} + +/* + * Header removal / addition + */ +static inline int qdf_ipa_add_hdr(qdf_ipa_ioc_add_hdr_t *hdrs) +{ + return __qdf_ipa_add_hdr(hdrs); +} + +static inline int qdf_ipa_del_hdr(qdf_ipa_ioc_del_hdr_t *hdls) +{ + return __qdf_ipa_del_hdr(hdls); +} + +static inline int qdf_ipa_commit_hdr(void) +{ + return __qdf_ipa_commit_hdr(); +} + +static inline int qdf_ipa_reset_hdr(void) +{ + return __qdf_ipa_reset_hdr(); +} + +static inline int qdf_ipa_get_hdr(qdf_ipa_ioc_get_hdr_t *lookup) +{ + return __qdf_ipa_get_hdr(lookup); +} + +static inline int qdf_ipa_put_hdr(u32 hdr_hdl) +{ + return __qdf_ipa_put_hdr(hdr_hdl); +} + +static inline int qdf_ipa_copy_hdr(qdf_ipa_ioc_copy_hdr_t *copy) +{ + return __qdf_ipa_copy_hdr(copy); +} + +/* + * Header Processing Context + */ +static inline int qdf_ipa_add_hdr_proc_ctx( + qdf_ipa_ioc_add_hdr_proc_ctx_t *proc_ctxs) +{ + return __qdf_ipa_add_hdr_proc_ctx(proc_ctxs); +} + +static inline int qdf_ipa_del_hdr_proc_ctx(qdf_ipa_ioc_del_hdr_proc_ctx_t *hdls) +{ + return __qdf_ipa_del_hdr_proc_ctx(hdls); +} + +/* + * Messaging + */ +static inline int qdf_ipa_send_msg(qdf_ipa_msg_meta_t *meta, void *buff, + ipa_msg_free_fn callback) +{ + return __qdf_ipa_send_msg(meta, buff, callback); +} + +static inline int qdf_ipa_register_pull_msg(qdf_ipa_msg_meta_t *meta, + qdf_ipa_msg_pull_fn callback) +{ + return __qdf_ipa_register_pull_msg(meta, callback); +} + +static inline int qdf_ipa_deregister_pull_msg(qdf_ipa_msg_meta_t *meta) +{ + return __qdf_ipa_deregister_pull_msg(meta); +} + +/* + * Interface + */ +static inline int qdf_ipa_register_intf(const char *name, + const qdf_ipa_tx_intf_t *tx, + const qdf_ipa_rx_intf_t *rx) +{ + return __qdf_ipa_register_intf(name, tx, rx); +} + +static inline int qdf_ipa_register_intf_ext(const char *name, + const qdf_ipa_tx_intf_t *tx, + const qdf_ipa_rx_intf_t *rx, + const qdf_ipa_ext_intf_t *ext) +{ + return __qdf_ipa_register_intf_ext(name, tx, rx, ext); +} + +static inline int qdf_ipa_deregister_intf(const char *name) +{ + return __qdf_ipa_deregister_intf(name); +} + +/* + * Data path + */ +static inline int qdf_ipa_tx_dp(qdf_ipa_client_type_t dst, struct sk_buff *skb, + qdf_ipa_tx_meta_t *metadata) +{ + return __qdf_ipa_tx_dp(dst, skb, metadata); +} + +/* + * To transfer multiple data packets + */ +static inline int qdf_ipa_tx_dp_mul( + qdf_ipa_client_type_t dst, + qdf_ipa_tx_data_desc_t *data_desc) +{ + return __qdf_ipa_tx_dp_mul(dst, data_desc); +} + +static inline void qdf_ipa_free_skb(qdf_ipa_rx_data_t *rx_in) +{ + return __qdf_ipa_free_skb(rx_in);; +} + +/* + * System pipes + */ +static inline u16 qdf_ipa_get_smem_restr_bytes(void) +{ + return __qdf_ipa_get_smem_restr_bytes(); +} + +static inline int qdf_ipa_setup_sys_pipe(qdf_ipa_sys_connect_params_t *sys_in, + u32 *clnt_hdl) +{ + return __qdf_ipa_setup_sys_pipe(sys_in, clnt_hdl); +} + +static inline int qdf_ipa_teardown_sys_pipe(u32 clnt_hdl) +{ + return __qdf_ipa_teardown_sys_pipe(clnt_hdl); +} + +static inline int qdf_ipa_connect_wdi_pipe(qdf_ipa_wdi_in_params_t *in, + qdf_ipa_wdi_out_params_t *out) +{ + return __qdf_ipa_connect_wdi_pipe(in, out); +} + +static inline int qdf_ipa_disconnect_wdi_pipe(u32 clnt_hdl) +{ + return __qdf_ipa_disconnect_wdi_pipe(clnt_hdl); +} + +static inline int qdf_ipa_enable_wdi_pipe(u32 clnt_hdl) +{ + return __qdf_ipa_enable_wdi_pipe(clnt_hdl); +} + +static inline int qdf_ipa_disable_wdi_pipe(u32 clnt_hdl) +{ + return __qdf_ipa_disable_wdi_pipe(clnt_hdl); +} + +static inline int qdf_ipa_resume_wdi_pipe(u32 clnt_hdl) +{ + return __qdf_ipa_resume_wdi_pipe(clnt_hdl); +} + +static inline int qdf_ipa_suspend_wdi_pipe(u32 clnt_hdl) +{ + return __qdf_ipa_suspend_wdi_pipe(clnt_hdl); +} + +static inline int qdf_ipa_uc_wdi_get_dbpa( + qdf_ipa_wdi_db_params_t *out) +{ + return __qdf_ipa_uc_wdi_get_dbpa(out); +} + +static inline int qdf_ipa_uc_reg_rdyCB( + qdf_ipa_wdi_uc_ready_params_t *param) +{ + return __qdf_ipa_uc_reg_rdyCB(param); +} + +static inline int qdf_ipa_uc_dereg_rdyCB(void) +{ + return __qdf_ipa_uc_dereg_rdyCB(); +} + + +/* + * Resource manager + */ +static inline int qdf_ipa_rm_create_resource( + qdf_ipa_rm_create_params_t *create_params) +{ + return __qdf_ipa_rm_create_resource(create_params); +} + +static inline int qdf_ipa_rm_delete_resource( + qdf_ipa_rm_resource_name_t resource_name) +{ + return __qdf_ipa_rm_delete_resource(resource_name); +} + +static inline int qdf_ipa_rm_register(qdf_ipa_rm_resource_name_t resource_name, + qdf_ipa_rm_register_params_t *reg_params) +{ + return __qdf_ipa_rm_register(resource_name, reg_params); +} + +static inline int qdf_ipa_rm_set_perf_profile( + qdf_ipa_rm_resource_name_t resource_name, + qdf_ipa_rm_perf_profile_t *profile) +{ + return __qdf_ipa_rm_set_perf_profile(resource_name, profile); +} + +static inline int qdf_ipa_rm_deregister(qdf_ipa_rm_resource_name_t resource_name, + qdf_ipa_rm_register_params_t *reg_params) +{ + return __qdf_ipa_rm_deregister(resource_name, reg_params); +} + +static inline int qdf_ipa_rm_add_dependency( + qdf_ipa_rm_resource_name_t resource_name, + qdf_ipa_rm_resource_name_t depends_on_name) +{ + return __qdf_ipa_rm_add_dependency(resource_name, depends_on_name); +} + +static inline int qdf_ipa_rm_add_dependency_sync( + qdf_ipa_rm_resource_name_t resource_name, + qdf_ipa_rm_resource_name_t depends_on_name) +{ + return __qdf_ipa_rm_add_dependency_sync(resource_name, depends_on_name); +} + +static inline int qdf_ipa_rm_delete_dependency( + qdf_ipa_rm_resource_name_t resource_name, + qdf_ipa_rm_resource_name_t depends_on_name) +{ + return __qdf_ipa_rm_delete_dependency(resource_name, depends_on_name); +} + +static inline int qdf_ipa_rm_request_resource( + qdf_ipa_rm_resource_name_t resource_name) +{ + return __qdf_ipa_rm_request_resource(resource_name); +} + +static inline int qdf_ipa_rm_release_resource( + qdf_ipa_rm_resource_name_t resource_name) +{ + return __qdf_ipa_rm_release_resource(resource_name); +} + +static inline int qdf_ipa_rm_notify_completion(qdf_ipa_rm_event_t event, + qdf_ipa_rm_resource_name_t resource_name) +{ + return __qdf_ipa_rm_notify_completion(event, resource_name); +} + +static inline int qdf_ipa_rm_inactivity_timer_init( + qdf_ipa_rm_resource_name_t resource_name, + unsigned long msecs) +{ + return __qdf_ipa_rm_inactivity_timer_init(resource_name, msecs); +} + +static inline int qdf_ipa_rm_inactivity_timer_destroy( + qdf_ipa_rm_resource_name_t resource_name) +{ + return __qdf_ipa_rm_inactivity_timer_destroy(resource_name); +} + +static inline int qdf_ipa_rm_inactivity_timer_request_resource( + qdf_ipa_rm_resource_name_t resource_name) +{ + return __qdf_ipa_rm_inactivity_timer_request_resource(resource_name); +} + +static inline int qdf_ipa_rm_inactivity_timer_release_resource( + qdf_ipa_rm_resource_name_t resource_name) +{ + return __qdf_ipa_rm_inactivity_timer_release_resource(resource_name); +} + +/* + * Miscellaneous + */ +static inline void qdf_ipa_bam_reg_dump(void) +{ + return __qdf_ipa_bam_reg_dump(); +} + +static inline int qdf_ipa_get_wdi_stats(qdf_ipa_hw_stats_wdi_info_data_t *stats) +{ + return __qdf_ipa_get_wdi_stats(stats); +} + +static inline int qdf_ipa_get_ep_mapping(qdf_ipa_client_type_t client) +{ + return __qdf_ipa_get_ep_mapping(client); +} + +static inline bool qdf_ipa_is_ready(void) +{ + return __qdf_ipa_is_ready(); +} + +static inline void qdf_ipa_proxy_clk_vote(void) +{ + return __qdf_ipa_proxy_clk_vote(); +} + +static inline void qdf_ipa_proxy_clk_unvote(void) +{ + return __qdf_ipa_proxy_clk_unvote(); +} + +static inline bool qdf_ipa_is_client_handle_valid(u32 clnt_hdl) +{ + return __qdf_ipa_is_client_handle_valid(clnt_hdl); +} + +static inline qdf_ipa_client_type_t qdf_ipa_get_client_mapping(int pipe_idx) +{ + return __qdf_ipa_get_client_mapping(pipe_idx); +} + +static inline qdf_ipa_rm_resource_name_t qdf_ipa_get_rm_resource_from_ep( + int pipe_idx) +{ + return __qdf_ipa_get_rm_resource_from_ep(pipe_idx); +} + +static inline bool qdf_ipa_get_modem_cfg_emb_pipe_flt(void) +{ + return __qdf_ipa_get_modem_cfg_emb_pipe_flt(); +} + +static inline int qdf_ipa_create_wdi_mapping(u32 num_buffers, + __qdf_ipa_wdi_buffer_info_t *info) +{ + return __qdf_ipa_create_wdi_mapping(num_buffers, info); +} + +static inline int qdf_ipa_release_wdi_mapping(u32 num_buffers, + qdf_ipa_wdi_buffer_info_t *info) +{ + return __qdf_ipa_release_wdi_mapping(num_buffers, info); +} + +static inline int qdf_ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size, + uint32_t agg_count) +{ + return __qdf_ipa_disable_apps_wan_cons_deaggr(agg_size, agg_count); +} + +static inline const qdf_ipa_gsi_ep_config_t *qdf_ipa_get_gsi_ep_info(qdf_ipa_client_type_t client) +{ + return __qdf_ipa_get_gsi_ep_info(client); +} + +static inline int qdf_ipa_stop_gsi_channel(u32 clnt_hdl) +{ + return __qdf_ipa_stop_gsi_channel(clnt_hdl); +} + +static inline int qdf_ipa_register_ipa_ready_cb( + void (*qdf_ipa_ready_cb)(void *user_data), + void *user_data) +{ + return __qdf_ipa_register_ipa_ready_cb(qdf_ipa_ready_cb, user_data); +} + +#endif /* _QDF_IPA_H */ diff --git a/qdf/inc/qdf_ipa_wdi3.h b/qdf/inc/qdf_ipa_wdi3.h new file mode 100644 index 000000000000..a6cc4a32460d --- /dev/null +++ b/qdf/inc/qdf_ipa_wdi3.h @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: qdf_ipa_wdi3.h + * This file provides OS abstraction for IPA WDI3 APIs. + */ + +#ifndef _QDF_IPA_WDI3_H +#define _QDF_IPA_WDI3_H + +#include + +/** + * qdf_ipa_wdi3_hdr_info_t - Header to install on IPA HW + */ +typedef __qdf_ipa_wdi3_hdr_info_t qdf_ipa_wdi3_hdr_info_t; + +/** + * qdf_ipa_wdi3_reg_intf_in_params_t - parameters for uC offload + * interface registration + */ +typedef __qdf_ipa_wdi3_reg_intf_in_params_t qdf_ipa_wdi3_reg_intf_in_params_t; + +/** + * qdf_ipa_wdi3_setup_info_t - WDI3 TX/Rx configuration + */ +typedef __qdf_ipa_wdi3_setup_info_t qdf_ipa_wdi3_setup_info_t; + +/** + * qdf_ipa_wdi3_conn_in_params_t - information provided by + * uC offload client + */ +typedef __qdf_ipa_wdi3_conn_in_params_t qdf_ipa_wdi3_conn_in_params_t; + +/** + * qdf_ipa_wdi3_conn_out_params_t - information provided + * to WLAN druver + */ +typedef __qdf_ipa_wdi3_conn_out_params_t qdf_ipa_wdi3_conn_out_params_t; + +/** + * qdf_ipa_wdi3_perf_profile_t - To set BandWidth profile + */ +typedef __qdf_ipa_wdi3_perf_profile_t qdf_ipa_wdi3_perf_profile_t; + +/** + * qdf_ipa_wdi3_reg_intf - Client should call this function to + * init WDI3 IPA offload data path + * + * Note: Should not be called from atomic context and only + * after checking IPA readiness using ipa_register_ipa_ready_cb() + * + * @Return 0 on success, negative on failure + */ +static inline int qdf_ipa_wdi3_reg_intf( + struct ipa_wdi3_reg_intf_in_params *in) +{ + return __qdf_ipa_wdi3_reg_intf(in); +} + +/** + * qdf_ipa_wdi3_dereg_intf - Client Driver should call this + * function to deregister before unload and after disconnect + * + * @Return 0 on success, negative on failure + */ +static inline int qdf_ipa_wdi3_dereg_intf(const char *netdev_name) +{ + return __qdf_ipa_wdi3_dereg_intf(netdev_name); +} + +/** + * qdf_ipa_wdi3_conn_pipes - Client should call this + * function to connect pipes + * + * @in: [in] input parameters from client + * @out: [out] output params to client + * + * Note: Should not be called from atomic context and only + * after checking IPA readiness using ipa_register_ipa_ready_cb() + * + * @Return 0 on success, negative on failure + */ +static inline int qdf_ipa_wdi3_conn_pipes(struct ipa_wdi3_conn_in_params *in, + struct ipa_wdi3_conn_out_params *out) +{ + return __qdf_ipa_wdi3_conn_pipes(in, out); +} + +/** + * qdf_ipa_wdi3_disconn_pipes() - Client should call this + * function to disconnect pipes + * + * Note: Should not be called from atomic context + * + * Returns: 0 on success, negative on failure + */ +static inline int qdf_ipa_wdi3_disconn_pipes(void) +{ + return __qdf_ipa_wdi3_disconn_pipes(); +} + +/** + * qdf_ipa_wdi3_enable_pipes() - Client should call this + * function to enable IPA offload data path + * + * Note: Should not be called from atomic context + * + * Returns: 0 on success, negative on failure + */ +static inline int qdf_ipa_wdi3_enable_pipes(void) +{ + return __qdf_ipa_wdi3_enable_pipes(); +} + +/** + * qdf_ipa_wdi3_disable_pipes() - Client should call this + * function to disable IPA offload data path + * + * Note: Should not be called from atomic context + * + * Returns: 0 on success, negative on failure + */ +static inline int qdf_ipa_wdi3_disable_pipes(void) +{ + return __qdf_ipa_wdi3_disable_pipes(); +} + +/** + * qdf_ipa_wdi3_set_perf_profile() - Client should call this function to + * set IPA clock bandwidth based on data rates + * + * @profile: [in] BandWidth profile to use + * + * Returns: 0 on success, negative on failure + */ +static inline int qdf_ipa_wdi3_set_perf_profile( + struct ipa_wdi3_perf_profile *profile) +{ + return __qdf_ipa_wdi3_set_perf_profile(profile); +} + +#endif diff --git a/qdf/linux/src/i_qdf_ipa.h b/qdf/linux/src/i_qdf_ipa.h new file mode 100644 index 000000000000..a1a71cc35968 --- /dev/null +++ b/qdf/linux/src/i_qdf_ipa.h @@ -0,0 +1,903 @@ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _I_QDF_IPA_H +#define _I_QDF_IPA_H + +#include + +/** + * __qdf_ipa_wdi_meter_evt_type_t - type of event client callback is + * for AP+STA mode metering + * @IPA_GET_WDI_SAP_STATS: get IPA_stats betwen SAP and STA - + * use ipa_get_wdi_sap_stats structure + * @IPA_SET_WIFI_QUOTA: set quota limit on STA - + * use ipa_set_wifi_quota structure + */ +typedef enum ipa_wdi_meter_evt_type __qdf_ipa_wdi_meter_evt_type_t; + +typedef struct ipa_get_wdi_sap_stats __qdf_ipa_get_wdi_sap_stats_t; + +#define QDF_IPA_GET_WDI_SAP_STATS_RESET_STATS(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->reset_stats) +#define QDF_IPA_GET_WDI_SAP_STATS_STATS_VALID(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->stats_valid) +#define QDF_IPA_GET_WDI_SAP_STATS_IPV4_TX_PACKETS(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv4_tx_packets) +#define QDF_IPA_GET_WDI_SAP_STATS_IPV4_TX_BYTES(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv4_tx_bytes) +#define QDF_IPA_GET_WDI_SAP_STATS_IPV4_RX_PACKETS(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv4_rx_packets) +#define QDF_IPA_GET_WDI_SAP_STATS_IPV4_RX_BYTES(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv4_rx_bytes) +#define QDF_IPA_GET_WDI_SAP_STATS_IPV6_TX_PACKETS(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv6_tx_packets) +#define QDF_IPA_GET_WDI_SAP_STATS_IPV6_TX_BYTES(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv6_tx_bytes) +#define QDF_IPA_GET_WDI_SAP_STATS_IPV6_RX_PACKETS(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv6_rx_packets) +#define QDF_IPA_GET_WDI_SAP_STATS_IPV6_RX_BYTES(wdi_sap_stats) \ + (((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv6_rx_bytes) + +/** + * __qdf_ipa_set_wifi_quota_t - structure used for + * IPA_SET_WIFI_QUOTA. + */ +typedef struct ipa_set_wifi_quota __qdf_ipa_set_wifi_quota_t; + +#define QDF_IPA_SET_WIFI_QUOTA_BYTES(ipa_set_quota) \ + (((struct ipa_set_wifi_quota *)(ipa_set_quota))->quota_bytes) +#define QDF_IPA_SET_WIFI_QUOTA_SET_QUOTA(ipa_set_quota) \ + (((struct ipa_set_wifi_quota *)(ipa_set_quota))->set_quota) +#define QDF_IPA_SET_WIFI_QUOTA_SET_VALID(ipa_set_quota) \ + (((struct ipa_set_wifi_quota *)(ipa_set_quota))->set_valid) + +/** + * __qdf_ipa_connect_params_t - low-level client connect input parameters. Either + * client allocates the data and desc FIFO and specifies that in data+desc OR + * specifies sizes and pipe_mem pref and IPA does the allocation. + */ +typedef struct ipa_connect_params __qdf_ipa_connect_params_t; + +/** + * __qdf_ipa_tx_meta_t - meta-data for the TX packet + */ +typedef struct ipa_tx_meta __qdf_ipa_tx_meta_t; + +/** + * __qdf_ipa_msg_free_fn_t - callback function + * + * Message callback registered by kernel client with IPA driver to + * free message payload after IPA driver processing is complete + */ +typedef void (*__qdf_ipa_msg_free_fn_t)(void *buff, u32 len, u32 type); + +/** + * __qdf_ipa_sps_params_t - SPS related output parameters resulting from + */ +typedef struct ipa_sps_params __qdf_ipa_sps_params_t; + +/** + * __qdf_ipa_tx_intf_t - interface tx properties + */ +typedef struct ipa_tx_intf __qdf_ipa_tx_intf_t; + +#define QDF_IPA_TX_INTF_PROP(tx_intf) \ + (((struct ipa_tx_intf *)(tx_intf))->prop) + +/** + * __qdf_ipa_rx_intf_t - interface rx properties + */ +typedef struct ipa_rx_intf __qdf_ipa_rx_intf_t; + +#define QDF_IPA_RX_INTF_PROP(rx_intf) \ + (((struct ipa_rx_intf *)(rx_intf))->prop) + +/** + * __qdf_ipa_ext_intf_t - interface ext properties + */ +typedef struct ipa_ext_intf __qdf_ipa_ext_intf_t; + +/** + * __qdf_ipa_sys_connect_params_t - information needed to setup an IPA end-point + * in system-BAM mode + */ +typedef struct ipa_sys_connect_params __qdf_ipa_sys_connect_params_t; + +#define QDF_IPA_SYS_PARAMS_NAT_EN(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.nat.nat_en) +#define QDF_IPA_SYS_PARAMS_HDR_LEN(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr.hdr_len) +#define QDF_IPA_SYS_PARAMS_HDR_ADDITIONAL_CONST_LEN(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr.hdr_additional_const_len) +#define QDF_IPA_SYS_PARAMS_HDR_OFST_PKT_SIZE_VALID(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr.hdr_ofst_pkt_size_valid) +#define QDF_IPA_SYS_PARAMS_HDR_OFST_PKT_SIZE(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr.hdr_ofst_pkt_size) +#define QDF_IPA_SYS_PARAMS_HDR_LITTLE_ENDIAN(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr_ext.hdr_little_endian) +#define QDF_IPA_SYS_PARAMS_MODE(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.mode.mode) +#define QDF_IPA_SYS_PARAMS_CLIENT(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->client) +#define QDF_IPA_SYS_PARAMS_DESC_FIFO_SZ(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->desc_fifo_sz) +#define QDF_IPA_SYS_PARAMS_PRIV(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->priv) +#define QDF_IPA_SYS_PARAMS_NOTIFY(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->notify) +#define QDF_IPA_SYS_PARAMS_SKIP_EP_CFG(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->skip_ep_cfg) +#define QDF_IPA_SYS_PARAMS_KEEP_IPA_AWAKE(ipa_sys_params) \ + (((struct ipa_sys_connect_params *)(ipa_sys_params))->keep_ipa_awake) + +/** + * __qdf_pa_rm_event_t - IPA RM events + * + * Indicate the resource state change + */ +typedef enum ipa_rm_event __qdf_ipa_rm_event_t; + +/** + * struct __qdf_ipa_rm_register_params_t - information needed to + * register IPA RM client with IPA RM + */ +typedef struct ipa_rm_register_params __qdf_ipa_rm_register_params_t; + +/** + * struct __qdf_ipa_rm_create_params_t - information needed to initialize + * the resource + * + * IPA RM client is expected to perform non blocking operations only + * in request_resource and release_resource functions and + * release notification context as soon as possible. + */ +typedef struct ipa_rm_create_params __qdf_ipa_rm_create_params_t; + +#define QDF_IPA_RM_CREATE_PARAMS_NAME(create_params) \ + (((struct ipa_rm_create_params *)(create_params))->name) +#define QDF_IPA_RM_CREATE_PARAMS_USER_DATA(create_params) \ + (((struct ipa_rm_create_params *)(create_params))->reg_params.user_data) +#define QDF_IPA_RM_CREATE_PARAMS_NOTIFY_CB(create_params) \ + (((struct ipa_rm_create_params *)(create_params))->reg_params.notify_cb) +#define QDF_IPA_RM_CREATE_PARAMS_REQUEST_RESOURCE(create_params) \ + (((struct ipa_rm_create_params *)(create_params))->request_resource) +#define QDF_IPA_RM_CREATE_PARAMS_RELEASE_RESOURCE(create_params) \ + (((struct ipa_rm_create_params *)(create_params))->release_resource) +#define QDF_IPA_RM_CREATE_PARAMS_FLOOR_VOLTAGE(create_params) \ + (((struct ipa_rm_create_params *)(create_params))->floor_voltage) + +/** + * __qdf_ipa_rm_perf_profile_t - information regarding IPA RM client performance + * profile + */ +typedef struct ipa_rm_perf_profile __qdf_ipa_rm_perf_profile_t; + +#define QDF_IPA_RM_PERF_PROFILE_MAX_SUPPORTED_BANDWIDTH_MBPS(profile) \ + (((struct ipa_rm_perf_profile *)(profile))->max_supported_bandwidth_mbps) + +/** + * __qdf_ipa_tx_data_desc_t - information needed + * to send data packet to HW link: link to data descriptors + * priv: client specific private data + */ +typedef struct ipa_tx_data_desc __qdf_ipa_tx_data_desc_t; + +/** + * __qdf_ipa_rx_data_t - information needed + * to send to wlan driver on receiving data from ipa hw + */ +typedef struct ipa_rx_data __qdf_ipa_rx_data_t; + +#define QDF_IPA_RX_DATA_SKB(desc) \ + (((struct ipa_rx_data *)(desc))->skb) +#define QDF_IPA_RX_DATA_SKB_LEN(desc) \ + (((struct ipa_rx_data *)(desc))->skb->len) +#define QDF_IPA_RX_DATA_DMA_ADDR(desc) \ + (((struct ipa_rx_data *)(desc))->dma_addr) + +/** + * __qdf_ipa_wdi_ul_params_t - WDI_RX configuration + */ +typedef struct ipa_wdi_ul_params __qdf_ipa_wdi_ul_params_t; + +/** + * __qdf_ipa_wdi_ul_params_smmu_t - WDI_RX configuration (with WLAN SMMU) + */ +typedef struct ipa_wdi_ul_params_smmu __qdf_ipa_wdi_ul_params_smmu_t; + +/** + * __qdf_ipa_wdi_dl_params_t - WDI_TX configuration + */ +typedef struct ipa_wdi_dl_params __qdf_ipa_wdi_dl_params_t; + +/** + * __qdf_ipa_wdi_dl_params_smmu_t - WDI_TX configuration (with WLAN SMMU) + */ +typedef struct ipa_wdi_dl_params_smmu __qdf_ipa_wdi_dl_params_smmu_t; + +/** + * __qdf_ipa_wdi_in_params_t - information provided by WDI client + */ +typedef struct ipa_wdi_in_params __qdf_ipa_wdi_in_params_t; + +#define QDF_IPA_PIPE_IN_NAT_EN(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.nat.nat_en) +#define QDF_IPA_PIPE_IN_HDR_LEN(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_len) +#define QDF_IPA_PIPE_IN_HDR_OFST_METADATA_VALID(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_ofst_metadata_valid) +#define QDF_IPA_PIPE_IN_HDR_METADATA_REG_VALID(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_metadata_reg_valid) +#define QDF_IPA_PIPE_IN_HDR_OFST_PKT_SIZE_VALID(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_ofst_pkt_size_valid) +#define QDF_IPA_PIPE_IN_HDR_OFST_PKT_SIZE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_ofst_pkt_size) +#define QDF_IPA_PIPE_IN_HDR_ADDITIONAL_CONST_LEN(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_additional_const_len) +#define QDF_IPA_PIPE_IN_MODE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.mode.mode) +#define QDF_IPA_PIPE_IN_CLIENT(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.client) +#define QDF_IPA_PIPE_IN_DESC_FIFO_SZ(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.desc_fifo_sz) +#define QDF_IPA_PIPE_IN_PRIV(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.priv) +#define QDF_IPA_PIPE_IN_HDR_LITTLE_ENDIAN(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr_ext.hdr_little_endian) +#define QDF_IPA_PIPE_IN_NOTIFY(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.notify) +#define QDF_IPA_PIPE_IN_KEEP_IPA_AWAKE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.keep_ipa_awake) +#define QDF_IPA_PIPE_IN_KEEP_IPA_AWAKE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->sys.keep_ipa_awake) +#define QDF_IPA_PIPE_IN_SMMU_ENABLED(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->smmu_enabled) +#ifdef FEATURE_METERING +#define QDF_IPA_PIPE_IN_WDI_NOTIFY(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->wdi_notify) +#endif +#define QDF_IPA_PIPE_IN_DL_SMMU_COMP_RING(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.comp_ring) +#define QDF_IPA_PIPE_IN_DL_SMMU_CE_RING(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.ce_ring) +#define QDF_IPA_PIPE_IN_DL_SMMU_COMP_RING_SIZE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.comp_ring_size) +#define QDF_IPA_PIPE_IN_DL_SMMU_CE_RING_SIZE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.ce_ring_size) +#define QDF_IPA_PIPE_IN_DL_SMMU_CE_DOOR_BELL_PA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.ce_door_bell_pa) +#define QDF_IPA_PIPE_IN_DL_SMMU_NUM_TX_BUFFERS(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.num_tx_buffers) +#define QDF_IPA_PIPE_IN_DL_COMP_RING_BASE_PA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl.comp_ring_base_pa) +#define QDF_IPA_PIPE_IN_DL_COMP_RING_SIZE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl.comp_ring_size) +#define QDF_IPA_PIPE_IN_DL_CE_RING_BASE_PA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl.ce_ring_base_pa) +#define QDF_IPA_PIPE_IN_DL_CE_RING_SIZE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl.ce_ring_size) +#define QDF_IPA_PIPE_IN_DL_CE_DOOR_BELL_PA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl.ce_door_bell_pa) +#define QDF_IPA_PIPE_IN_DL_NUM_TX_BUFFERS(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.dl.num_tx_buffers) + +#define QDF_IPA_PIPE_IN_UL_SMMU_RDY_RING(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_ring) +#define QDF_IPA_PIPE_IN_UL_SMMU_RDY_RING_SIZE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_ring_size) +#define QDF_IPA_PIPE_IN_UL_SMMU_RDY_RING_RP_PA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_ring_rp_pa) +#define QDF_IPA_PIPE_IN_UL_SMMU_RDY_RING_RP_VA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_ring_rp_va) +#define QDF_IPA_PIPE_IN_UL_SMMU_RDY_COMP_RING(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_comp_ring) +#define QDF_IPA_PIPE_IN_UL_SMMU_RDY_COMP_RING_SIZE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_comp_ring_size) +#define QDF_IPA_PIPE_IN_UL_SMMU_RDY_COMP_RING_WP_PA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_comp_ring_wp_pa) +#define QDF_IPA_PIPE_IN_UL_SMMU_RDY_COMP_RING_WP_VA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_comp_ring_wp_va) +#define QDF_IPA_PIPE_IN_UL_RDY_RING_BASE_PA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_ring_base_pa) +#define QDF_IPA_PIPE_IN_UL_RDY_RING_SIZE(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_ring_size) +#define QDF_IPA_PIPE_IN_UL_RDY_RING_RP_PA(pipe_in) \ + (((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_ring_rp_pa) + +/** + * __qdf_ipa_wdi_out_params_t - information provided to WDI client + */ +typedef struct ipa_wdi_out_params __qdf_ipa_wdi_out_params_t; + +#define QDF_IPA_PIPE_OUT_UC_DOOR_BELL_PA(pipe_out) \ + (((struct ipa_wdi_out_params *)(pipe_out))->uc_door_bell_pa) +#define QDF_IPA_PIPE_OUT_CLNT_HDL(pipe_out) \ + (((struct ipa_wdi_out_params *)(pipe_out))->clnt_hdl) + +/** + * __qdf_ipa_wdi_db_params_t - information provided to retrieve + * physical address of uC doorbell + */ +typedef struct ipa_wdi_db_params __qdf_ipa_wdi_db_params_t; + +/** + * __qdf_ipa_wdi_uc_ready_params_t - uC ready CB parameters + */ +typedef void (*__qdf_ipa_uc_ready_cb)(void *priv); +typedef struct ipa_wdi_uc_ready_params __qdf_ipa_wdi_uc_ready_params_t; + +#define QDF_IPA_UC_READY_PARAMS_IS_UC_READY(uc_ready_param) \ + (((struct ipa_wdi_uc_ready_params *)(uc_ready_param))->is_uC_ready) +#define QDF_IPA_UC_READY_PARAMS_PRIV(uc_ready_param) \ + (((struct ipa_wdi_uc_ready_params *)(uc_ready_param))->priv) +#define QDF_IPA_UC_READY_PARAMS_NOTIFY(uc_ready_param) \ + (((struct ipa_wdi_uc_ready_params *)(uc_ready_param))->notify) + +/** + * __qdf_ipa_wdi_buffer_info_t - address info of a WLAN allocated buffer + * + * IPA driver will create/release IOMMU mapping in IPA SMMU from iova->pa + */ +typedef struct ipa_wdi_buffer_info __qdf_ipa_wdi_buffer_info_t; + +/** + * __qdf_ipa_gsi_ep_config_t - IPA GSI endpoint configurations + */ +typedef struct ipa_gsi_ep_config __qdf_ipa_gsi_ep_config_t; + +/** + * __qdf_ipa_dp_evt_type_t - type of event client callback is + * invoked for on data path + * @IPA_RECEIVE: data is struct sk_buff + * @IPA_WRITE_DONE: data is struct sk_buff + */ +typedef enum ipa_dp_evt_type __qdf_ipa_dp_evt_type_t; + +typedef struct ipa_hdr_add __qdf_ipa_hdr_add_t; +typedef struct ipa_hdr_del __qdf_ipa_hdr_del_t; +typedef struct ipa_ioc_add_hdr __qdf_ipa_ioc_add_hdr_t; + +#define QDF_IPA_IOC_ADD_HDR_COMMIT(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->commit) +#define QDF_IPA_IOC_ADD_HDR_NUM_HDRS(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->num_hdrs) +#define QDF_IPA_IOC_ADD_HDR_NAME(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].name) +#define QDF_IPA_IOC_ADD_HDR_HDR(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].hdr) +#define QDF_IPA_IOC_ADD_HDR_HDR_LEN(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].hdr_len) +#define QDF_IPA_IOC_ADD_HDR_TYPE(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].type) +#define QDF_IPA_IOC_ADD_HDR_IS_PARTIAL(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].is_partial) +#define QDF_IPA_IOC_ADD_HDR_HDR_HDL(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].hdr_hdl) +#define QDF_IPA_IOC_ADD_HDR_STATUS(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].status) +#define QDF_IPA_IOC_ADD_HDR_IS_ETH2_OFST_VALID(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].is_eth2_ofst_valid) +#define QDF_IPA_IOC_ADD_HDR_ETH2_OFST(ipa_hdr) \ + (((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].eth2_ofst) + +typedef struct ipa_ioc_del_hdr __qdf_ipa_ioc_del_hdr_t; + +#define QDF_IPA_IOC_DEL_HDR_COMMIT(ipa_hdr) \ + (((struct ipa_ioc_del_hdr *)(ipa_hdr))->commit) +#define QDF_IPA_IOC_DEL_HDR_NUM_HDRS(ipa_hdr) \ + (((struct ipa_ioc_del_hdr *)(ipa_hdr))->num_hdls) +#define QDF_IPA_IOC_DEL_HDR_HDL(ipa_hdr) \ + (((struct ipa_ioc_del_hdr *)(ipa_hdr))->hdl[0].hdl) +#define QDF_IPA_IOC_DEL_HDR_STATUS(ipa_hdr) \ + (((struct ipa_ioc_del_hdr *)(ipa_hdr))->hdl[0].status) + +typedef struct ipa_ioc_get_hdr __qdf_ipa_ioc_get_hdr_t; + +#define QDF_IPA_IOC_GET_HDR_NAME(ipa_hdr) \ + (((struct ipa_ioc_get_hdr *)(ipa_hdr))->name) +#define QDF_IPA_IOC_GET_HDR_HDL(ipa_hdr) \ + (((struct ipa_ioc_get_hdr *)(ipa_hdr))->hdl) + +typedef struct ipa_ioc_copy_hdr __qdf_ipa_ioc_copy_hdr_t; +typedef struct ipa_ioc_add_hdr_proc_ctx __qdf_ipa_ioc_add_hdr_proc_ctx_t; +typedef struct ipa_ioc_del_hdr_proc_ctx __qdf_ipa_ioc_del_hdr_proc_ctx_t; +typedef struct ipa_msg_meta __qdf_ipa_msg_meta_t; + +#define QDF_IPA_MSG_META_MSG_TYPE(meta) \ + (((struct ipa_msg_meta *)(meta))->msg_type) +#define QDF_IPA_MSG_META_MSG_LEN(meta) \ + (((struct ipa_msg_meta *)(meta))->msg_len) + +typedef enum ipa_client_type __qdf_ipa_client_type_t; +typedef struct IpaHwStatsWDIInfoData_t __qdf_ipa_hw_stats_wdi_info_data_t; +typedef enum ipa_rm_resource_name __qdf_ipa_rm_resource_name_t; +typedef enum ipa_wlan_event __qdf_ipa_wlan_event_t; +typedef struct ipa_wlan_msg __qdf_ipa_wlan_msg_t; + +#define QDF_IPA_WLAN_MSG_NAME(ipa_msg) \ + (((struct ipa_wlan_msg *)(ipa_msg))->name) +#define QDF_IPA_WLAN_MSG_MAC_ADDR(ipa_msg) \ + (((struct ipa_wlan_msg *)(ipa_msg))->mac_addr) + +typedef struct ipa_wlan_msg_ex __qdf_ipa_wlan_msg_ex_t; + +#define QDF_IPA_WLAN_MSG_EX_NAME(ipa_msg) \ + (((struct ipa_wlan_msg_ex *)(ipa_msg))->name) +#define QDF_IPA_WLAN_MSG_EX_EXNUM_OF_ATTRIBS(ipa_msg) \ + (((struct ipa_wlan_msg_ex *)(ipa_msg))->num_of_attribs) +#define QDF_IPA_WLAN_MSG_EX_ATTRIB_TYPE(ipa_msg) \ + (((struct ipa_wlan_msg_ex *)(ipa_msg))->attribs.attrib_type) +#define QDF_IPA_WLAN_MSG_EX_OFFSET(ipa_msg) \ + (((struct ipa_wlan_msg_ex *)(ipa_msg))->attribs.offset) +#define QDF_IPA_WLAN_MSG_EX_MAC_ADDR(ipa_msg) \ + (((struct ipa_wlan_msg_ex *)(ipa_msg))->attribs.u.mac_addr) + +typedef struct ipa_ioc_tx_intf_prop __qdf_ipa_ioc_tx_intf_prop_t; + +#define QDF_IPA_IOC_TX_INTF_PROP_IP(tx_prop) \ + (((struct ipa_ioc_tx_intf_prop *)(tx_prop))->ip) +#define QDF_IPA_IOC_TX_INTF_PROP_ATTRIB_MASK(tx_prop) \ + (((struct ipa_ioc_tx_intf_prop *)(tx_prop))->attrib.attrib_mask) +#define QDF_IPA_IOC_TX_INTF_PROP_META_DATA(rx_prop) \ + (((struct ipa_ioc_tx_intf_prop *)(tx_prop))->attrib.meta_data) +#define QDF_IPA_IOC_TX_INTF_PROP_META_DATA_MASK(rx_prop) \ + (((struct ipa_ioc_tx_intf_prop *)(tx_prop))->attrib.meta_data_mask) +#define QDF_IPA_IOC_TX_INTF_PROP_DST_PIPE(tx_prop) \ + (((struct ipa_ioc_tx_intf_prop *)(tx_prop))->dst_pipe) +#define QDF_IPA_IOC_TX_INTF_PROP_ALT_DST_PIPE(tx_prop) \ + (((struct ipa_ioc_tx_intf_prop *)(tx_prop))->alt_dst_pipe) +#define QDF_IPA_IOC_TX_INTF_PROP_HDR_NAME(tx_prop) \ + (((struct ipa_ioc_tx_intf_prop *)(tx_prop))->hdr_name) +#define QDF_IPA_IOC_TX_INTF_PROP_HDR_L2_TYPE(tx_prop) \ + (((struct ipa_ioc_tx_intf_prop *)(tx_prop))->hdr_l2_type) + +typedef struct ipa_ioc_rx_intf_prop __qdf_ipa_ioc_rx_intf_prop_t; + +#define QDF_IPA_IOC_RX_INTF_PROP_IP(rx_prop) \ + (((struct ipa_ioc_rx_intf_prop *)(rx_prop))->ip) +#define QDF_IPA_IOC_RX_INTF_PROP_ATTRIB_MASK(rx_prop) \ + (((struct ipa_ioc_rx_intf_prop *)(rx_prop))->attrib.attrib_mask) +#define QDF_IPA_IOC_RX_INTF_PROP_META_DATA(rx_prop) \ + (((struct ipa_ioc_rx_intf_prop *)(rx_prop))->attrib.meta_data) +#define QDF_IPA_IOC_RX_INTF_PROP_META_DATA_MASK(rx_prop) \ + (((struct ipa_ioc_rx_intf_prop *)(rx_prop))->attrib.meta_data_mask) +#define QDF_IPA_IOC_RX_INTF_PROP_SRC_PIPE(rx_prop) \ + (((struct ipa_ioc_rx_intf_prop *)(rx_prop))->src_pipe) +#define QDF_IPA_IOC_RX_INTF_PROP_HDR_L2_TYPE(rx_prop) \ + (((struct ipa_ioc_rx_intf_prop *)(rx_prop))->hdr_l2_type) + +typedef struct ipa_wlan_hdr_attrib_val __qdf_ipa_wlan_hdr_attrib_val_t; + +/* + * Connect / Disconnect + */ +static inline int __qdf_ipa_connect(const struct ipa_connect_params *in, + __qdf_ipa_sps_params_t *sps, u32 *clnt_hdl) +{ + return ipa_connect(in, sps, clnt_hdl); +} + +static inline int __qdf_ipa_disconnect(u32 clnt_hdl) +{ + return ipa_disconnect(clnt_hdl); +} + +/* + * Resume / Suspend + */ +static inline int __qdf_ipa_reset_endpoint(u32 clnt_hdl) +{ + return ipa_reset_endpoint(clnt_hdl); +} + +/* + * Remove ep delay + */ +static inline int __qdf_ipa_clear_endpoint_delay(u32 clnt_hdl) +{ + return ipa_clear_endpoint_delay(clnt_hdl); +} + +/* + * Header removal / addition + */ +static inline int __qdf_ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs) +{ + return ipa_add_hdr(hdrs); +} + +static inline int __qdf_ipa_del_hdr(struct ipa_ioc_del_hdr *hdls) +{ + return ipa_del_hdr(hdls); +} + +static inline int __qdf_ipa_commit_hdr(void) +{ + return ipa_commit_hdr(); +} + +static inline int __qdf_ipa_reset_hdr(void) +{ + return ipa_reset_hdr(); +} + +static inline int __qdf_ipa_get_hdr(struct ipa_ioc_get_hdr *lookup) +{ + return ipa_get_hdr(lookup); +} + +static inline int __qdf_ipa_put_hdr(u32 hdr_hdl) +{ + return ipa_put_hdr(hdr_hdl); +} + +static inline int __qdf_ipa_copy_hdr(struct ipa_ioc_copy_hdr *copy) +{ + return ipa_copy_hdr(copy); +} + +/* + * Header Processing Context + */ +static inline int __qdf_ipa_add_hdr_proc_ctx( + struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs) +{ + return ipa_add_hdr_proc_ctx(proc_ctxs); +} + +static inline int __qdf_ipa_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) +{ + return ipa_del_hdr_proc_ctx(hdls); +} + +/* + * Messaging + */ +static inline int __qdf_ipa_send_msg(struct ipa_msg_meta *meta, void *buff, + ipa_msg_free_fn callback) +{ + return ipa_send_msg(meta, buff, callback); +} + +static inline int __qdf_ipa_register_pull_msg(struct ipa_msg_meta *meta, + ipa_msg_pull_fn callback) +{ + return ipa_register_pull_msg(meta, callback); +} + +static inline int __qdf_ipa_deregister_pull_msg(struct ipa_msg_meta *meta) +{ + return ipa_deregister_pull_msg(meta); +} + +/* + * Interface + */ +static inline int __qdf_ipa_register_intf(const char *name, + const struct ipa_tx_intf *tx, + const struct ipa_rx_intf *rx) +{ + return ipa_register_intf(name, tx, rx); +} + +static inline int __qdf_ipa_register_intf_ext(const char *name, + const struct ipa_tx_intf *tx, + const struct ipa_rx_intf *rx, + const struct ipa_ext_intf *ext) +{ + return ipa_register_intf_ext(name, tx, rx, ext); +} + +static inline int __qdf_ipa_deregister_intf(const char *name) +{ + return ipa_deregister_intf(name); +} + +/* + * Data path + */ +static inline int __qdf_ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb, + struct ipa_tx_meta *metadata) +{ + return ipa_tx_dp(dst, skb, metadata); +} + +/* + * To transfer multiple data packets + */ +static inline int __qdf_ipa_tx_dp_mul( + enum ipa_client_type dst, + struct ipa_tx_data_desc *data_desc) +{ + return ipa_tx_dp_mul(dst, data_desc); +} + +static inline void __qdf_ipa_free_skb(struct ipa_rx_data *rx_in) +{ + return ipa_free_skb(rx_in);; +} + +/* + * System pipes + */ +static inline u16 __qdf_ipa_get_smem_restr_bytes(void) +{ + return ipa_get_smem_restr_bytes(); +} + +static inline int __qdf_ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, + u32 *clnt_hdl) +{ + return ipa_setup_sys_pipe(sys_in, clnt_hdl); +} + +static inline int __qdf_ipa_teardown_sys_pipe(u32 clnt_hdl) +{ + return ipa_teardown_sys_pipe(clnt_hdl); +} + +static inline int __qdf_ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in, + struct ipa_wdi_out_params *out) +{ + return ipa_connect_wdi_pipe(in, out); +} + +static inline int __qdf_ipa_disconnect_wdi_pipe(u32 clnt_hdl) +{ + return ipa_disconnect_wdi_pipe(clnt_hdl); +} + +static inline int __qdf_ipa_enable_wdi_pipe(u32 clnt_hdl) +{ + return ipa_enable_wdi_pipe(clnt_hdl); +} + +static inline int __qdf_ipa_disable_wdi_pipe(u32 clnt_hdl) +{ + return ipa_disable_wdi_pipe(clnt_hdl); +} + +static inline int __qdf_ipa_resume_wdi_pipe(u32 clnt_hdl) +{ + return ipa_resume_wdi_pipe(clnt_hdl); +} + +static inline int __qdf_ipa_suspend_wdi_pipe(u32 clnt_hdl) +{ + return ipa_suspend_wdi_pipe(clnt_hdl); +} + +static inline int __qdf_ipa_uc_wdi_get_dbpa( + struct ipa_wdi_db_params *out) +{ + return ipa_uc_wdi_get_dbpa(out); +} + +static inline int __qdf_ipa_uc_reg_rdyCB( + struct ipa_wdi_uc_ready_params *param) +{ + return ipa_uc_reg_rdyCB(param); +} + +static inline int __qdf_ipa_uc_dereg_rdyCB(void) +{ + return ipa_uc_dereg_rdyCB(); +} + + +/* + * Resource manager + */ +static inline int __qdf_ipa_rm_create_resource( + struct ipa_rm_create_params *create_params) +{ + return ipa_rm_create_resource(create_params); +} + +static inline int __qdf_ipa_rm_delete_resource( + enum ipa_rm_resource_name resource_name) +{ + return ipa_rm_delete_resource(resource_name); +} + +static inline int __qdf_ipa_rm_register(enum ipa_rm_resource_name resource_name, + struct ipa_rm_register_params *reg_params) +{ + return ipa_rm_register(resource_name, reg_params); +} + +static inline int __qdf_ipa_rm_set_perf_profile( + enum ipa_rm_resource_name resource_name, + struct ipa_rm_perf_profile *profile) +{ + return ipa_rm_set_perf_profile(resource_name, profile); +} + +static inline int __qdf_ipa_rm_deregister(enum ipa_rm_resource_name resource_name, + struct ipa_rm_register_params *reg_params) +{ + return ipa_rm_deregister(resource_name, reg_params); +} + +static inline int __qdf_ipa_rm_add_dependency( + enum ipa_rm_resource_name resource_name, + enum ipa_rm_resource_name depends_on_name) +{ + return ipa_rm_add_dependency(resource_name, depends_on_name); +} + +static inline int __qdf_ipa_rm_add_dependency_sync( + enum ipa_rm_resource_name resource_name, + enum ipa_rm_resource_name depends_on_name) +{ + return ipa_rm_add_dependency_sync(resource_name, depends_on_name); +} + +static inline int __qdf_ipa_rm_delete_dependency( + enum ipa_rm_resource_name resource_name, + enum ipa_rm_resource_name depends_on_name) +{ + return ipa_rm_delete_dependency(resource_name, depends_on_name); +} + +static inline int __qdf_ipa_rm_request_resource( + enum ipa_rm_resource_name resource_name) +{ + return ipa_rm_request_resource(resource_name); +} + +static inline int __qdf_ipa_rm_release_resource( + enum ipa_rm_resource_name resource_name) +{ + return ipa_rm_release_resource(resource_name); +} + +static inline int __qdf_ipa_rm_notify_completion(enum ipa_rm_event event, + enum ipa_rm_resource_name resource_name) +{ + return ipa_rm_notify_completion(event, resource_name); +} + +static inline int __qdf_ipa_rm_inactivity_timer_init( + enum ipa_rm_resource_name resource_name, + unsigned long msecs) +{ + return ipa_rm_inactivity_timer_init(resource_name, msecs); +} + +static inline int __qdf_ipa_rm_inactivity_timer_destroy( + enum ipa_rm_resource_name resource_name) +{ + return ipa_rm_inactivity_timer_destroy(resource_name); +} + +static inline int __qdf_ipa_rm_inactivity_timer_request_resource( + enum ipa_rm_resource_name resource_name) +{ + return ipa_rm_inactivity_timer_request_resource(resource_name); +} + +static inline int __qdf_ipa_rm_inactivity_timer_release_resource( + enum ipa_rm_resource_name resource_name) +{ + return ipa_rm_inactivity_timer_release_resource(resource_name); +} + +/* + * Miscellaneous + */ +static inline void __qdf_ipa_bam_reg_dump(void) +{ + return ipa_bam_reg_dump(); +} + +static inline int __qdf_ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats) +{ + return ipa_get_wdi_stats(stats); +} + +static inline int __qdf_ipa_get_ep_mapping(enum ipa_client_type client) +{ + return ipa_get_ep_mapping(client); +} + +static inline bool __qdf_ipa_is_ready(void) +{ + return ipa_is_ready(); +} + +static inline void __qdf_ipa_proxy_clk_vote(void) +{ + return ipa_proxy_clk_vote(); +} + +static inline void __qdf_ipa_proxy_clk_unvote(void) +{ + return ipa_proxy_clk_unvote(); +} + +static inline bool __qdf_ipa_is_client_handle_valid(u32 clnt_hdl) +{ + return ipa_is_client_handle_valid(clnt_hdl); +} + +static inline enum ipa_client_type __qdf_ipa_get_client_mapping(int pipe_idx) +{ + return ipa_get_client_mapping(pipe_idx); +} + +static inline enum ipa_rm_resource_name __qdf_ipa_get_rm_resource_from_ep( + int pipe_idx) +{ + return ipa_get_rm_resource_from_ep(pipe_idx); +} + +static inline bool __qdf_ipa_get_modem_cfg_emb_pipe_flt(void) +{ + return ipa_get_modem_cfg_emb_pipe_flt(); +} + +static inline enum ipa_transport_type __qdf_ipa_get_transport_type(void) +{ + return ipa_get_transport_type(); +} + +static inline struct device *__qdf_ipa_get_dma_dev(void) +{ + return ipa_get_dma_dev(); +} + +static inline struct iommu_domain *__qdf_ipa_get_smmu_domain(void) +{ + return ipa_get_smmu_domain(); +} + +static inline int __qdf_ipa_create_wdi_mapping(u32 num_buffers, + __qdf_ipa_wdi_buffer_info_t *info) +{ + return ipa_create_wdi_mapping(num_buffers, info); +} + +static inline int __qdf_ipa_release_wdi_mapping(u32 num_buffers, + struct ipa_wdi_buffer_info *info) +{ + return ipa_release_wdi_mapping(num_buffers, info); +} + +static inline int __qdf_ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count) +{ + return ipa_disable_apps_wan_cons_deaggr(agg_size, agg_count); +} + +static inline const struct ipa_gsi_ep_config *__qdf_ipa_get_gsi_ep_info(enum ipa_client_type client) +{ + return ipa_get_gsi_ep_info(client); +} + +static inline int __qdf_ipa_stop_gsi_channel(u32 clnt_hdl) +{ + return ipa_stop_gsi_channel(clnt_hdl); +} + +static inline int __qdf_ipa_register_ipa_ready_cb( + void (*ipa_ready_cb)(void *user_data), + void *user_data) +{ + return ipa_register_ipa_ready_cb(ipa_ready_cb, user_data); +} + +#endif /* _I_QDF_IPA_H */ diff --git a/qdf/linux/src/i_qdf_ipa_wdi3.h b/qdf/linux/src/i_qdf_ipa_wdi3.h new file mode 100644 index 000000000000..a4c4068fdc3e --- /dev/null +++ b/qdf/linux/src/i_qdf_ipa_wdi3.h @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: i_qdf_ipa_wdi3.h + * This file provides OS dependent IPA WDI3 APIs. + */ + +#ifndef I_QDF_IPA_WDI3_H +#define I_QDF_IPA_WDI3_H + +#include /* QDF_STATUS */ +#include + +/** + * __qdf_ipa_wdi3_hdr_info_t - Header to install on IPA HW + */ +typedef struct ipa_wdi3_hdr_info __qdf_ipa_wdi3_hdr_info_t; + +#define QDF_IPA_WDI3_HDR_INFO_HDR(hdr_info) \ + (((struct ipa_wdi3_hdr_info *)(hdr_info))->hdr) +#define QDF_IPA_WDI3_HDR_INFO_HDR_LEN(hdr_info) \ + (((struct ipa_wdi3_hdr_info *)(hdr_info))->hdr_len) +#define QDF_IPA_WDI3_HDR_INFO_DST_MAC_ADDR_OFFSET(hdr_info) \ + (((struct ipa_wdi3_hdr_info *)(hdr_info))->dst_mac_addr_offset) +#define QDF_IPA_WDI3_HDR_INFO_HDR_TYPE(hdr_info) \ + (((struct ipa_wdi3_hdr_info *)(hdr_info))->hdr_type) + +/** + * __qdf_ipa_wdi3_reg_intf_in_params_t - parameters for uC offload + * interface registration + */ +typedef struct ipa_wdi3_reg_intf_in_params __qdf_ipa_wdi3_reg_intf_in_params_t; + +#define QDF_IPA_WDI3_REG_INTF_IN_PARAMS_NETDEV_NAME(in) \ + (((struct ipa_wdi3_reg_intf_in_params *)(in))->netdev_name) +#define QDF_IPA_WDI3_REG_INTF_IN_PARAMS_HDR_INFO(in) \ + (((struct ipa_wdi3_reg_intf_in_params *)(in))->hdr_info) +#define QDF_IPA_WDI3_REG_INTF_IN_PARAMS_IS_META_DATA_VALID(in) \ + (((struct ipa_wdi3_reg_intf_in_params *)(in))->is_meta_data_valid) +#define QDF_IPA_WDI3_REG_INTF_IN_PARAMS_META_DATA(in) \ + (((struct ipa_wdi3_reg_intf_in_params *)(in))->meta_data) +#define QDF_IPA_WDI3_REG_INTF_IN_PARAMS_META_DATA_MASK(in) \ + (((struct ipa_wdi3_reg_intf_in_params *)(in))->meta_data_mask) + +/** + * __qdf_ipa_wdi3_setup_info_t - WDI3 TX/Rx configuration + */ +typedef struct ipa_wdi3_setup_info __qdf_ipa_wdi3_setup_info_t; + +#define QDF_IPA_WDI3_SETUP_INFO_NAT_EN(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.nat.nat_en) +#define QDF_IPA_WDI3_SETUP_INFO_HDR_LEN(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.hdr.hdr_len) +#define QDF_IPA_WDI3_SETUP_INFO_HDR_OFST_METADATA_VALID(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.hdr.hdr_ofst_metadata_valid) +#define QDF_IPA_WDI3_SETUP_INFO_HDR_METADATA_REG_VALID(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.hdr.hdr_metadata_reg_valid) +#define QDF_IPA_WDI3_SETUP_INFO_HDR_OFST_PKT_SIZE_VALID(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.hdr.hdr_ofst_pkt_size_valid) +#define QDF_IPA_WDI3_SETUP_INFO_HDR_OFST_PKT_SIZE(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.hdr.hdr_ofst_pkt_size) +#define QDF_IPA_WDI3_SETUP_INFO_HDR_ADDITIONAL_CONST_LEN(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.hdr.hdr_additional_const_len) +#define QDF_IPA_WDI3_SETUP_INFO_MODE(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.mode.mode) +#define QDF_IPA_WDI3_SETUP_INFO_HDR_LITTLE_ENDIAN(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->ipa_ep_cfg.hdr_ext.hdr_little_endian) + +#define QDF_IPA_WDI3_SETUP_INFO_CLIENT(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->client) +#define QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_BASE_PA(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->transfer_ring_base_pa) +#define QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_SIZE(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->transfer_ring_size) +#define QDF_IPA_WDI3_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->transfer_ring_doorbell_pa) +#define QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_BASE_PA(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->event_ring_base_pa) +#define QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_SIZE(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->event_ring_size) +#define QDF_IPA_WDI3_SETUP_INFO_EVENT_RING_DOORBELL_PA(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->event_ring_doorbell_pa) +#define QDF_IPA_WDI3_SETUP_INFO_NUM_PKT_BUFFERS(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->num_pkt_buffers) +#define QDF_IPA_WDI3_SETUP_INFO_PKT_OFFSET(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->pkt_offset) +#define QDF_IPA_WDI3_SETUP_INFO_DESC_FORMAT_TEMPLATE(txrx) \ + (((struct ipa_wdi3_setup_info *)(txrx))->desc_format_template) + +/** + * __qdf_ipa_wdi3_conn_in_params_t - information provided by + * uC offload client + */ +typedef struct ipa_wdi3_conn_in_params __qdf_ipa_wdi3_conn_in_params_t; + +#define QDF_IPA_WDI3_CONN_IN_PARAMS_NOTIFY(pipe_in) \ + (((struct ipa_wdi3_conn_in_params *)(pipe_in))->notify) +#define QDF_IPA_WDI3_CONN_IN_PARAMS_PRIV(pipe_in) \ + (((struct ipa_wdi3_conn_in_params *)(pipe_in))->priv) +#define QDF_IPA_WDI3_CONN_IN_PARAMS_TX(pipe_in) \ + (((struct ipa_wdi3_conn_in_params *)(pipe_in))->tx) +#define QDF_IPA_WDI3_CONN_IN_PARAMS_RX(pipe_in) \ + (((struct ipa_wdi3_conn_in_params *)(pipe_in))->rx) + +/** + * __qdf_ipa_wdi3_conn_out_params_t - information provided + * to WLAN druver + */ +typedef struct ipa_wdi3_conn_out_params __qdf_ipa_wdi3_conn_out_params_t; + +#define QDF_IPA_WDI3_CONN_OUT_PARAMS_TX_UC_DB_PA(pipe_out) \ + (((struct ipa_wdi3_conn_out_params *)(pipe_out))->tx_uc_db_pa) +#define QDF_IPA_WDI3_CONN_OUT_PARAMS_TX_UC_DB_VA(pipe_out) \ + (((struct ipa_wdi3_conn_out_params *)(pipe_out))->tx_uc_db_va) +#define QDF_IPA_WDI3_CONN_OUT_PARAMS_RX_UC_DB_PA(pipe_out) \ + (((struct ipa_wdi3_conn_out_params *)(pipe_out))->rx_uc_db_pa) + +/** + * __qdf_ipa_wdi3_perf_profile_t - To set BandWidth profile + */ +typedef struct ipa_wdi3_perf_profile __qdf_ipa_wdi3_perf_profile_t; + +#define QDF_IPA_WDI3_PERF_PROFILE_CLIENT(profile) \ + (((struct ipa_wdi3_perf_profile *)(profile))->client) +#define QDF_IPA_WDI3_PERF_PROFILE_MAX_SUPPORTED_BW_MBPS(profile) \ + (((struct ipa_wdi3_perf_profile *)(profile))->max_supported_bw_mbps) + +/** + * __qdf_ipa_wdi3_reg_intf - Client should call this function to + * init WDI3 IPA offload data path + * + * Note: Should not be called from atomic context and only + * after checking IPA readiness using ipa_register_ipa_ready_cb() + * + * @Return 0 on success, negative on failure + */ +static inline int __qdf_ipa_wdi3_reg_intf( + struct ipa_wdi3_reg_intf_in_params *in) +{ + return ipa_wdi3_reg_intf(in); +} + +/** + * __qdf_ipa_wdi3_dereg_intf - Client Driver should call this + * function to deregister before unload and after disconnect + * + * @Return 0 on success, negative on failure + */ +static inline int __qdf_ipa_wdi3_dereg_intf(const char *netdev_name) +{ + return ipa_wdi3_dereg_intf(netdev_name); +} + +/** + * __qdf_ipa_wdi3_conn_pipes - Client should call this + * function to connect pipes + * + * @in: [in] input parameters from client + * @out: [out] output params to client + * + * Note: Should not be called from atomic context and only + * after checking IPA readiness using ipa_register_ipa_ready_cb() + * + * @Return 0 on success, negative on failure + */ +static inline int __qdf_ipa_wdi3_conn_pipes(struct ipa_wdi3_conn_in_params *in, + struct ipa_wdi3_conn_out_params *out) +{ + return ipa_wdi3_conn_pipes(in, out); +} + +/** + * __qdf_ipa_wdi3_disconn_pipes() - Client should call this + * function to disconnect pipes + * + * Note: Should not be called from atomic context + * + * Returns: 0 on success, negative on failure + */ +static inline int __qdf_ipa_wdi3_disconn_pipes(void) +{ + return ipa_wdi3_disconn_pipes(); +} + +/** + * __qdf_ipa_wdi3_enable_pipes() - Client should call this + * function to enable IPA offload data path + * + * Note: Should not be called from atomic context + * + * Returns: 0 on success, negative on failure + */ +static inline int __qdf_ipa_wdi3_enable_pipes(void) +{ + return ipa_wdi3_enable_pipes(); +} + +/** + * __qdf_ipa_wdi3_disable_pipes() - Client should call this + * function to disable IPA offload data path + * + * Note: Should not be called from atomic context + * + * Returns: 0 on success, negative on failure + */ +static inline int __qdf_ipa_wdi3_disable_pipes(void) +{ + return ipa_wdi3_disable_pipes(); +} + +/** + * __qdf_ipa_wdi3_set_perf_profile() - Client should call this function to + * set IPA clock bandwidth based on data rates + * + * @profile: [in] BandWidth profile to use + * + * Returns: 0 on success, negative on failure + */ +static inline int __qdf_ipa_wdi3_set_perf_profile( + struct ipa_wdi3_perf_profile *profile) +{ + return ipa_wdi3_set_perf_profile(profile); +} + +#endif From 3c11bdd460650cffc1289ff261ac426bde7ac097 Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Mon, 30 Oct 2017 18:13:55 +0530 Subject: [PATCH 9/9] qcacmn: ADD Vendor Command to enable/disable FILS Define new Vendor Command to enable/disable FILS. Change-Id: I4c1a95312a28b184c36854fc2639fb2b431ff99c CRs-Fixed: 2134802 --- os_if/linux/qca_vendor.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index 1323d5f97d38..fa0c4c4ecc54 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -3224,6 +3224,20 @@ enum qca_wlan_vendor_attr_config { /* 8-bit unsigned value to set the total beacon miss count */ QCA_WLAN_VENDOR_ATTR_CONFIG_TOTAL_BEACON_MISS_COUNT = 52, + /* + * Unsigned 32-bit value to configure the number of continuous + * Beacon Miss which shall be used by the firmware to penalize + * the RSSI for BTC. + */ + QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS_BTC = 53, + + /* + * 8-bit unsigned value to configure the driver and below layers to + * enable/disable all fils features. + * 0-enable, 1-disable + */ + QCA_WLAN_VENDOR_ATTR_CONFIG_DISABLE_FILS = 54, + /* keep last */ QCA_WLAN_VENDOR_ATTR_CONFIG_AFTER_LAST, QCA_WLAN_VENDOR_ATTR_CONFIG_MAX =