wmi_unified_roam_tlv.c 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224
  1. /*
  2. * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: Implement API's specific to roaming component.
  20. */
  21. #include <wmi_unified_priv.h>
  22. #include <wmi_unified_roam_api.h>
  23. #ifdef FEATURE_LFR_SUBNET_DETECTION
  24. /**
  25. * send_set_gateway_params_cmd_tlv() - set gateway parameters
  26. * @wmi_handle: wmi handle
  27. * @req: gateway parameter update request structure
  28. *
  29. * This function reads the incoming @req and fill in the destination
  30. * WMI structure and sends down the gateway configs down to the firmware
  31. *
  32. * Return: QDF_STATUS
  33. */
  34. static QDF_STATUS send_set_gateway_params_cmd_tlv(wmi_unified_t wmi_handle,
  35. struct gateway_update_req_param *req)
  36. {
  37. wmi_roam_subnet_change_config_fixed_param *cmd;
  38. wmi_buf_t buf;
  39. QDF_STATUS ret;
  40. int len = sizeof(*cmd);
  41. buf = wmi_buf_alloc(wmi_handle, len);
  42. if (!buf) {
  43. return QDF_STATUS_E_NOMEM;
  44. }
  45. cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf);
  46. WMITLV_SET_HDR(&cmd->tlv_header,
  47. WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param,
  48. WMITLV_GET_STRUCT_TLVLEN(
  49. wmi_roam_subnet_change_config_fixed_param));
  50. cmd->vdev_id = req->session_id;
  51. qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr,
  52. QDF_IPV4_ADDR_SIZE);
  53. qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr,
  54. QDF_IPV6_ADDR_SIZE);
  55. WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes,
  56. &cmd->inet_gw_mac_addr);
  57. cmd->max_retries = req->max_retries;
  58. cmd->timeout = req->timeout;
  59. cmd->num_skip_subnet_change_detection_bssid_list = 0;
  60. cmd->flag = 0;
  61. if (req->ipv4_addr_type)
  62. WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag);
  63. if (req->ipv6_addr_type)
  64. WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag);
  65. wmi_mtrace(WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID, cmd->vdev_id, 0);
  66. ret = wmi_unified_cmd_send(wmi_handle, buf, len,
  67. WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID);
  68. if (QDF_IS_STATUS_ERROR(ret)) {
  69. WMI_LOGE("Failed to send gw config parameter to fw, ret: %d",
  70. ret);
  71. wmi_buf_free(buf);
  72. }
  73. return ret;
  74. }
  75. void wmi_lfr_subnet_detection_attach_tlv(struct wmi_unified *wmi_handle)
  76. {
  77. struct wmi_ops *ops = wmi_handle->ops;
  78. ops->send_set_gateway_params_cmd = send_set_gateway_params_cmd_tlv;
  79. }
  80. #endif /* FEATURE_LFR_SUBNET_DETECTION */
  81. #ifdef FEATURE_RSSI_MONITOR
  82. /**
  83. * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring
  84. * @wmi_handle: wmi handle
  85. * @req: rssi monitoring request structure
  86. *
  87. * This function reads the incoming @req and fill in the destination
  88. * WMI structure and send down the rssi monitoring configs down to the firmware
  89. *
  90. * Return: 0 on success; error number otherwise
  91. */
  92. static QDF_STATUS send_set_rssi_monitoring_cmd_tlv(wmi_unified_t wmi_handle,
  93. struct rssi_monitor_param *req)
  94. {
  95. wmi_rssi_breach_monitor_config_fixed_param *cmd;
  96. wmi_buf_t buf;
  97. QDF_STATUS ret;
  98. uint32_t len = sizeof(*cmd);
  99. buf = wmi_buf_alloc(wmi_handle, len);
  100. if (!buf) {
  101. return QDF_STATUS_E_NOMEM;
  102. }
  103. cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf);
  104. WMITLV_SET_HDR(&cmd->tlv_header,
  105. WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param,
  106. WMITLV_GET_STRUCT_TLVLEN(
  107. wmi_rssi_breach_monitor_config_fixed_param));
  108. cmd->vdev_id = req->session_id;
  109. cmd->request_id = req->request_id;
  110. cmd->lo_rssi_reenable_hysteresis = 0;
  111. cmd->hi_rssi_reenable_histeresis = 0;
  112. cmd->min_report_interval = 0;
  113. cmd->max_num_report = 1;
  114. if (req->control) {
  115. /* enable one threshold for each min/max */
  116. cmd->enabled_bitmap = 0x09;
  117. cmd->low_rssi_breach_threshold[0] = req->min_rssi;
  118. cmd->hi_rssi_breach_threshold[0] = req->max_rssi;
  119. } else {
  120. cmd->enabled_bitmap = 0;
  121. cmd->low_rssi_breach_threshold[0] = 0;
  122. cmd->hi_rssi_breach_threshold[0] = 0;
  123. }
  124. wmi_mtrace(WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID, cmd->vdev_id, 0);
  125. ret = wmi_unified_cmd_send(wmi_handle, buf, len,
  126. WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID);
  127. if (QDF_IS_STATUS_ERROR(ret)) {
  128. WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID");
  129. wmi_buf_free(buf);
  130. }
  131. WMI_LOGD("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW");
  132. return ret;
  133. }
  134. void wmi_rssi_monitor_attach_tlv(struct wmi_unified *wmi_handle)
  135. {
  136. struct wmi_ops *ops = wmi_handle->ops;
  137. ops->send_set_rssi_monitoring_cmd = send_set_rssi_monitoring_cmd_tlv;
  138. }
  139. #endif /* FEATURE_RSSI_MONITOR */
  140. /**
  141. * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload
  142. * rssi threashold
  143. * @wmi_handle: wmi handle
  144. * @roam_req: Roaming request buffer
  145. *
  146. * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware
  147. *
  148. * Return: QDF status
  149. */
  150. static QDF_STATUS send_roam_scan_offload_rssi_thresh_cmd_tlv(wmi_unified_t wmi_handle,
  151. struct roam_offload_scan_rssi_params *roam_req)
  152. {
  153. wmi_buf_t buf = NULL;
  154. QDF_STATUS status;
  155. int len;
  156. uint8_t *buf_ptr;
  157. wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp;
  158. wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL;
  159. wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL;
  160. wmi_roam_dense_thres_param *dense_thresholds = NULL;
  161. wmi_roam_bg_scan_roaming_param *bg_scan_params = NULL;
  162. len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param);
  163. len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/
  164. len += sizeof(wmi_roam_scan_extended_threshold_param);
  165. len += WMI_TLV_HDR_SIZE;
  166. len += sizeof(wmi_roam_earlystop_rssi_thres_param);
  167. len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/
  168. len += sizeof(wmi_roam_dense_thres_param);
  169. len += WMI_TLV_HDR_SIZE; /* TLV for BG Scan*/
  170. len += sizeof(wmi_roam_bg_scan_roaming_param);
  171. buf = wmi_buf_alloc(wmi_handle, len);
  172. if (!buf) {
  173. return QDF_STATUS_E_NOMEM;
  174. }
  175. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  176. rssi_threshold_fp =
  177. (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr;
  178. WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header,
  179. WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param,
  180. WMITLV_GET_STRUCT_TLVLEN
  181. (wmi_roam_scan_rssi_threshold_fixed_param));
  182. /* fill in threshold values */
  183. rssi_threshold_fp->vdev_id = roam_req->session_id;
  184. rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh;
  185. rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff;
  186. rssi_threshold_fp->hirssi_scan_max_count =
  187. roam_req->hi_rssi_scan_max_count;
  188. rssi_threshold_fp->hirssi_scan_delta =
  189. roam_req->hi_rssi_scan_rssi_delta;
  190. rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub;
  191. rssi_threshold_fp->rssi_thresh_offset_5g =
  192. roam_req->rssi_thresh_offset_5g;
  193. buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param);
  194. WMITLV_SET_HDR(buf_ptr,
  195. WMITLV_TAG_ARRAY_STRUC,
  196. sizeof(wmi_roam_scan_extended_threshold_param));
  197. buf_ptr += WMI_TLV_HDR_SIZE;
  198. ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr;
  199. ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g;
  200. if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT)
  201. ext_thresholds->boost_threshold_5g =
  202. roam_req->boost_threshold_5g;
  203. ext_thresholds->boost_algorithm_5g =
  204. WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR;
  205. ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g;
  206. ext_thresholds->penalty_algorithm_5g =
  207. WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR;
  208. ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g;
  209. ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g;
  210. ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g;
  211. ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold;
  212. WMITLV_SET_HDR(&ext_thresholds->tlv_header,
  213. WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param,
  214. WMITLV_GET_STRUCT_TLVLEN
  215. (wmi_roam_scan_extended_threshold_param));
  216. buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param);
  217. WMITLV_SET_HDR(buf_ptr,
  218. WMITLV_TAG_ARRAY_STRUC,
  219. sizeof(wmi_roam_earlystop_rssi_thres_param));
  220. buf_ptr += WMI_TLV_HDR_SIZE;
  221. early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr;
  222. early_stop_thresholds->roam_earlystop_thres_min =
  223. roam_req->roam_earlystop_thres_min;
  224. early_stop_thresholds->roam_earlystop_thres_max =
  225. roam_req->roam_earlystop_thres_max;
  226. WMITLV_SET_HDR(&early_stop_thresholds->tlv_header,
  227. WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param,
  228. WMITLV_GET_STRUCT_TLVLEN
  229. (wmi_roam_earlystop_rssi_thres_param));
  230. buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param);
  231. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  232. sizeof(wmi_roam_dense_thres_param));
  233. buf_ptr += WMI_TLV_HDR_SIZE;
  234. dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr;
  235. dense_thresholds->roam_dense_rssi_thres_offset =
  236. roam_req->dense_rssi_thresh_offset;
  237. dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt;
  238. dense_thresholds->roam_dense_traffic_thres =
  239. roam_req->traffic_threshold;
  240. dense_thresholds->roam_dense_status = roam_req->initial_dense_status;
  241. WMITLV_SET_HDR(&dense_thresholds->tlv_header,
  242. WMITLV_TAG_STRUC_wmi_roam_dense_thres_param,
  243. WMITLV_GET_STRUCT_TLVLEN(wmi_roam_dense_thres_param));
  244. buf_ptr += sizeof(wmi_roam_dense_thres_param);
  245. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  246. sizeof(wmi_roam_bg_scan_roaming_param));
  247. buf_ptr += WMI_TLV_HDR_SIZE;
  248. bg_scan_params = (wmi_roam_bg_scan_roaming_param *) buf_ptr;
  249. bg_scan_params->roam_bg_scan_bad_rssi_thresh =
  250. roam_req->bg_scan_bad_rssi_thresh;
  251. bg_scan_params->roam_bg_scan_client_bitmap =
  252. roam_req->bg_scan_client_bitmap;
  253. bg_scan_params->bad_rssi_thresh_offset_2g =
  254. roam_req->roam_bad_rssi_thresh_offset_2g;
  255. bg_scan_params->flags = roam_req->flags;
  256. WMITLV_SET_HDR(&bg_scan_params->tlv_header,
  257. WMITLV_TAG_STRUC_wmi_roam_bg_scan_roaming_param,
  258. WMITLV_GET_STRUCT_TLVLEN
  259. (wmi_roam_bg_scan_roaming_param));
  260. wmi_mtrace(WMI_ROAM_SCAN_RSSI_THRESHOLD, NO_SESSION, 0);
  261. status = wmi_unified_cmd_send(wmi_handle, buf,
  262. len, WMI_ROAM_SCAN_RSSI_THRESHOLD);
  263. if (QDF_IS_STATUS_ERROR(status)) {
  264. WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d",
  265. status);
  266. wmi_buf_free(buf);
  267. }
  268. return status;
  269. }
  270. static QDF_STATUS send_roam_mawc_params_cmd_tlv(wmi_unified_t wmi_handle,
  271. struct wmi_mawc_roam_params *params)
  272. {
  273. wmi_buf_t buf = NULL;
  274. QDF_STATUS status;
  275. int len;
  276. uint8_t *buf_ptr;
  277. wmi_roam_configure_mawc_cmd_fixed_param *wmi_roam_mawc_params;
  278. len = sizeof(*wmi_roam_mawc_params);
  279. buf = wmi_buf_alloc(wmi_handle, len);
  280. if (!buf) {
  281. return QDF_STATUS_E_NOMEM;
  282. }
  283. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  284. wmi_roam_mawc_params =
  285. (wmi_roam_configure_mawc_cmd_fixed_param *) buf_ptr;
  286. WMITLV_SET_HDR(&wmi_roam_mawc_params->tlv_header,
  287. WMITLV_TAG_STRUC_wmi_roam_configure_mawc_cmd_fixed_param,
  288. WMITLV_GET_STRUCT_TLVLEN
  289. (wmi_roam_configure_mawc_cmd_fixed_param));
  290. wmi_roam_mawc_params->vdev_id = params->vdev_id;
  291. if (params->enable)
  292. wmi_roam_mawc_params->enable = 1;
  293. else
  294. wmi_roam_mawc_params->enable = 0;
  295. wmi_roam_mawc_params->traffic_load_threshold =
  296. params->traffic_load_threshold;
  297. wmi_roam_mawc_params->best_ap_rssi_threshold =
  298. params->best_ap_rssi_threshold;
  299. wmi_roam_mawc_params->rssi_stationary_high_adjust =
  300. params->rssi_stationary_high_adjust;
  301. wmi_roam_mawc_params->rssi_stationary_low_adjust =
  302. params->rssi_stationary_low_adjust;
  303. WMI_LOGD(FL("MAWC roam en=%d, vdev=%d, tr=%d, ap=%d, high=%d, low=%d"),
  304. wmi_roam_mawc_params->enable, wmi_roam_mawc_params->vdev_id,
  305. wmi_roam_mawc_params->traffic_load_threshold,
  306. wmi_roam_mawc_params->best_ap_rssi_threshold,
  307. wmi_roam_mawc_params->rssi_stationary_high_adjust,
  308. wmi_roam_mawc_params->rssi_stationary_low_adjust);
  309. wmi_mtrace(WMI_ROAM_CONFIGURE_MAWC_CMDID, NO_SESSION, 0);
  310. status = wmi_unified_cmd_send(wmi_handle, buf,
  311. len, WMI_ROAM_CONFIGURE_MAWC_CMDID);
  312. if (QDF_IS_STATUS_ERROR(status)) {
  313. WMI_LOGE("WMI_ROAM_CONFIGURE_MAWC_CMDID failed, Error %d",
  314. status);
  315. wmi_buf_free(buf);
  316. return status;
  317. }
  318. return QDF_STATUS_SUCCESS;
  319. }
  320. /**
  321. * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming
  322. * @wmi_handle: wmi handle
  323. * @roam_req: Request which contains the filters
  324. *
  325. * There are filters such as whitelist, blacklist and preferred
  326. * list that need to be applied to the scan results to form the
  327. * probable candidates for roaming.
  328. *
  329. * Return: Return success upon successfully passing the
  330. * parameters to the firmware, otherwise failure.
  331. */
  332. static QDF_STATUS send_roam_scan_filter_cmd_tlv(wmi_unified_t wmi_handle,
  333. struct roam_scan_filter_params *roam_req)
  334. {
  335. wmi_buf_t buf = NULL;
  336. QDF_STATUS status;
  337. uint32_t i;
  338. uint32_t len, blist_len = 0;
  339. uint8_t *buf_ptr;
  340. wmi_roam_filter_fixed_param *roam_filter;
  341. uint8_t *bssid_src_ptr = NULL;
  342. wmi_mac_addr *bssid_dst_ptr = NULL;
  343. wmi_ssid *ssid_ptr = NULL;
  344. uint32_t *bssid_preferred_factor_ptr = NULL;
  345. wmi_roam_lca_disallow_config_tlv_param *blist_param;
  346. wmi_roam_rssi_rejection_oce_config_param *rssi_rej;
  347. len = sizeof(wmi_roam_filter_fixed_param);
  348. len += WMI_TLV_HDR_SIZE;
  349. if (roam_req->num_bssid_black_list)
  350. len += roam_req->num_bssid_black_list * sizeof(wmi_mac_addr);
  351. len += WMI_TLV_HDR_SIZE;
  352. if (roam_req->num_ssid_white_list)
  353. len += roam_req->num_ssid_white_list * sizeof(wmi_ssid);
  354. len += 2 * WMI_TLV_HDR_SIZE;
  355. if (roam_req->num_bssid_preferred_list) {
  356. len += roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr);
  357. len += roam_req->num_bssid_preferred_list * sizeof(uint32_t);
  358. }
  359. len += WMI_TLV_HDR_SIZE;
  360. if (roam_req->lca_disallow_config_present) {
  361. len += sizeof(*blist_param);
  362. blist_len = sizeof(*blist_param);
  363. }
  364. len += WMI_TLV_HDR_SIZE;
  365. if (roam_req->num_rssi_rejection_ap)
  366. len += roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej);
  367. buf = wmi_buf_alloc(wmi_handle, len);
  368. if (!buf) {
  369. return QDF_STATUS_E_NOMEM;
  370. }
  371. buf_ptr = (u_int8_t *) wmi_buf_data(buf);
  372. roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr;
  373. WMITLV_SET_HDR(&roam_filter->tlv_header,
  374. WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param,
  375. WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param));
  376. /* fill in fixed values */
  377. roam_filter->vdev_id = roam_req->session_id;
  378. roam_filter->flags = 0;
  379. roam_filter->op_bitmap = roam_req->op_bitmap;
  380. roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list;
  381. roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list;
  382. roam_filter->num_bssid_preferred_list =
  383. roam_req->num_bssid_preferred_list;
  384. roam_filter->num_rssi_rejection_ap =
  385. roam_req->num_rssi_rejection_ap;
  386. buf_ptr += sizeof(wmi_roam_filter_fixed_param);
  387. WMITLV_SET_HDR((buf_ptr),
  388. WMITLV_TAG_ARRAY_FIXED_STRUC,
  389. (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)));
  390. bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list;
  391. bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE);
  392. for (i = 0; i < roam_req->num_bssid_black_list; i++) {
  393. WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr);
  394. bssid_src_ptr += ATH_MAC_LEN;
  395. bssid_dst_ptr++;
  396. }
  397. buf_ptr += WMI_TLV_HDR_SIZE +
  398. (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr));
  399. WMITLV_SET_HDR((buf_ptr),
  400. WMITLV_TAG_ARRAY_FIXED_STRUC,
  401. (roam_req->num_ssid_white_list * sizeof(wmi_ssid)));
  402. ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE);
  403. for (i = 0; i < roam_req->num_ssid_white_list; i++) {
  404. qdf_mem_copy(&ssid_ptr->ssid,
  405. &roam_req->ssid_allowed_list[i].mac_ssid,
  406. roam_req->ssid_allowed_list[i].length);
  407. ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length;
  408. ssid_ptr++;
  409. }
  410. buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list *
  411. sizeof(wmi_ssid));
  412. WMITLV_SET_HDR((buf_ptr),
  413. WMITLV_TAG_ARRAY_FIXED_STRUC,
  414. (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)));
  415. bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored;
  416. bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE);
  417. for (i = 0; i < roam_req->num_bssid_preferred_list; i++) {
  418. WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr,
  419. (wmi_mac_addr *)bssid_dst_ptr);
  420. bssid_src_ptr += ATH_MAC_LEN;
  421. bssid_dst_ptr++;
  422. }
  423. buf_ptr += WMI_TLV_HDR_SIZE +
  424. (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr));
  425. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
  426. (roam_req->num_bssid_preferred_list * sizeof(uint32_t)));
  427. bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE);
  428. for (i = 0; i < roam_req->num_bssid_preferred_list; i++) {
  429. *bssid_preferred_factor_ptr =
  430. roam_req->bssid_favored_factor[i];
  431. bssid_preferred_factor_ptr++;
  432. }
  433. buf_ptr += WMI_TLV_HDR_SIZE +
  434. (roam_req->num_bssid_preferred_list * sizeof(uint32_t));
  435. WMITLV_SET_HDR(buf_ptr,
  436. WMITLV_TAG_ARRAY_STRUC, blist_len);
  437. buf_ptr += WMI_TLV_HDR_SIZE;
  438. if (roam_req->lca_disallow_config_present) {
  439. blist_param =
  440. (wmi_roam_lca_disallow_config_tlv_param *) buf_ptr;
  441. WMITLV_SET_HDR(&blist_param->tlv_header,
  442. WMITLV_TAG_STRUC_wmi_roam_lca_disallow_config_tlv_param,
  443. WMITLV_GET_STRUCT_TLVLEN(
  444. wmi_roam_lca_disallow_config_tlv_param));
  445. blist_param->disallow_duration = roam_req->disallow_duration;
  446. blist_param->rssi_channel_penalization =
  447. roam_req->rssi_channel_penalization;
  448. blist_param->num_disallowed_aps = roam_req->num_disallowed_aps;
  449. blist_param->disallow_lca_enable_source_bitmap =
  450. (WMI_ROAM_LCA_DISALLOW_SOURCE_PER |
  451. WMI_ROAM_LCA_DISALLOW_SOURCE_BACKGROUND);
  452. buf_ptr += (sizeof(wmi_roam_lca_disallow_config_tlv_param));
  453. }
  454. WMITLV_SET_HDR(buf_ptr,
  455. WMITLV_TAG_ARRAY_STRUC,
  456. (roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej)));
  457. buf_ptr += WMI_TLV_HDR_SIZE;
  458. for (i = 0; i < roam_req->num_rssi_rejection_ap; i++) {
  459. rssi_rej =
  460. (wmi_roam_rssi_rejection_oce_config_param *) buf_ptr;
  461. WMITLV_SET_HDR(&rssi_rej->tlv_header,
  462. WMITLV_TAG_STRUC_wmi_roam_rssi_rejection_oce_config_param,
  463. WMITLV_GET_STRUCT_TLVLEN(
  464. wmi_roam_rssi_rejection_oce_config_param));
  465. WMI_CHAR_ARRAY_TO_MAC_ADDR(
  466. roam_req->rssi_rejection_ap[i].bssid.bytes,
  467. &rssi_rej->bssid);
  468. rssi_rej->remaining_disallow_duration =
  469. roam_req->rssi_rejection_ap[i].remaining_duration;
  470. rssi_rej->requested_rssi =
  471. (int32_t)roam_req->rssi_rejection_ap[i].expected_rssi;
  472. buf_ptr +=
  473. (sizeof(wmi_roam_rssi_rejection_oce_config_param));
  474. }
  475. wmi_mtrace(WMI_ROAM_FILTER_CMDID, NO_SESSION, 0);
  476. status = wmi_unified_cmd_send(wmi_handle, buf,
  477. len, WMI_ROAM_FILTER_CMDID);
  478. if (QDF_IS_STATUS_ERROR(status)) {
  479. WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d",
  480. status);
  481. wmi_buf_free(buf);
  482. }
  483. return status;
  484. }
  485. #ifdef FEATURE_WLAN_ESE
  486. /**
  487. * send_plm_stop_cmd_tlv() - plm stop request
  488. * @wmi_handle: wmi handle
  489. * @plm: plm request parameters
  490. *
  491. * This function request FW to stop PLM.
  492. *
  493. * Return: CDF status
  494. */
  495. static QDF_STATUS send_plm_stop_cmd_tlv(wmi_unified_t wmi_handle,
  496. const struct plm_req_params *plm)
  497. {
  498. wmi_vdev_plmreq_stop_cmd_fixed_param *cmd;
  499. int32_t len;
  500. wmi_buf_t buf;
  501. uint8_t *buf_ptr;
  502. int ret;
  503. len = sizeof(*cmd);
  504. buf = wmi_buf_alloc(wmi_handle, len);
  505. if (!buf) {
  506. return QDF_STATUS_E_NOMEM;
  507. }
  508. cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf);
  509. buf_ptr = (uint8_t *) cmd;
  510. WMITLV_SET_HDR(&cmd->tlv_header,
  511. WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param,
  512. WMITLV_GET_STRUCT_TLVLEN
  513. (wmi_vdev_plmreq_stop_cmd_fixed_param));
  514. cmd->vdev_id = plm->session_id;
  515. cmd->meas_token = plm->meas_token;
  516. WMI_LOGD("vdev %d meas token %d", cmd->vdev_id, cmd->meas_token);
  517. wmi_mtrace(WMI_VDEV_PLMREQ_STOP_CMDID, cmd->vdev_id, 0);
  518. ret = wmi_unified_cmd_send(wmi_handle, buf, len,
  519. WMI_VDEV_PLMREQ_STOP_CMDID);
  520. if (ret) {
  521. WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__);
  522. wmi_buf_free(buf);
  523. return QDF_STATUS_E_FAILURE;
  524. }
  525. return QDF_STATUS_SUCCESS;
  526. }
  527. /**
  528. * send_plm_start_cmd_tlv() - plm start request
  529. * @wmi_handle: wmi handle
  530. * @plm: plm request parameters
  531. *
  532. * This function request FW to start PLM.
  533. *
  534. * Return: CDF status
  535. */
  536. static QDF_STATUS send_plm_start_cmd_tlv(wmi_unified_t wmi_handle,
  537. const struct plm_req_params *plm,
  538. uint32_t *gchannel_list)
  539. {
  540. wmi_vdev_plmreq_start_cmd_fixed_param *cmd;
  541. uint32_t *channel_list;
  542. int32_t len;
  543. wmi_buf_t buf;
  544. uint8_t *buf_ptr;
  545. uint8_t count;
  546. int ret;
  547. /* TLV place holder for channel_list */
  548. len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
  549. len += sizeof(uint32_t) * plm->plm_num_ch;
  550. buf = wmi_buf_alloc(wmi_handle, len);
  551. if (!buf) {
  552. return QDF_STATUS_E_NOMEM;
  553. }
  554. cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf);
  555. buf_ptr = (uint8_t *) cmd;
  556. WMITLV_SET_HDR(&cmd->tlv_header,
  557. WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param,
  558. WMITLV_GET_STRUCT_TLVLEN
  559. (wmi_vdev_plmreq_start_cmd_fixed_param));
  560. cmd->vdev_id = plm->session_id;
  561. cmd->meas_token = plm->meas_token;
  562. cmd->dialog_token = plm->diag_token;
  563. cmd->number_bursts = plm->num_bursts;
  564. cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int);
  565. cmd->off_duration = plm->meas_duration;
  566. cmd->burst_cycle = plm->burst_len;
  567. cmd->tx_power = plm->desired_tx_pwr;
  568. WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac);
  569. cmd->num_chans = plm->plm_num_ch;
  570. buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param);
  571. WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token);
  572. WMI_LOGD("dialog_token: %d", cmd->dialog_token);
  573. WMI_LOGD("number_bursts: %d", cmd->number_bursts);
  574. WMI_LOGD("burst_interval: %d", cmd->burst_interval);
  575. WMI_LOGD("off_duration: %d", cmd->off_duration);
  576. WMI_LOGD("burst_cycle: %d", cmd->burst_cycle);
  577. WMI_LOGD("tx_power: %d", cmd->tx_power);
  578. WMI_LOGD("Number of channels : %d", cmd->num_chans);
  579. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
  580. (cmd->num_chans * sizeof(uint32_t)));
  581. buf_ptr += WMI_TLV_HDR_SIZE;
  582. if (cmd->num_chans) {
  583. channel_list = (uint32_t *) buf_ptr;
  584. for (count = 0; count < cmd->num_chans; count++) {
  585. channel_list[count] = plm->plm_ch_list[count];
  586. if (channel_list[count] < WMI_NLO_FREQ_THRESH)
  587. channel_list[count] =
  588. gchannel_list[count];
  589. WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]);
  590. }
  591. buf_ptr += cmd->num_chans * sizeof(uint32_t);
  592. }
  593. wmi_mtrace(WMI_VDEV_PLMREQ_START_CMDID, cmd->vdev_id, 0);
  594. ret = wmi_unified_cmd_send(wmi_handle, buf, len,
  595. WMI_VDEV_PLMREQ_START_CMDID);
  596. if (ret) {
  597. WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__);
  598. wmi_buf_free(buf);
  599. return QDF_STATUS_E_FAILURE;
  600. }
  601. return QDF_STATUS_SUCCESS;
  602. }
  603. void wmi_ese_attach_tlv(wmi_unified_t wmi_handle)
  604. {
  605. struct wmi_ops *ops = wmi_handle->ops;
  606. ops->send_plm_stop_cmd = send_plm_stop_cmd_tlv;
  607. ops->send_plm_start_cmd = send_plm_start_cmd_tlv;
  608. }
  609. #endif /* FEATURE_WLAN_ESE */
  610. #ifdef WLAN_FEATURE_ROAM_OFFLOAD
  611. /* send_set_ric_req_cmd_tlv() - set ric request element
  612. * @wmi_handle: wmi handle
  613. * @msg: message
  614. * @is_add_ts: is addts required
  615. *
  616. * This function sets ric request element for 11r roaming.
  617. *
  618. * Return: CDF status
  619. */
  620. static QDF_STATUS send_set_ric_req_cmd_tlv(wmi_unified_t wmi_handle,
  621. void *msg, uint8_t is_add_ts)
  622. {
  623. wmi_ric_request_fixed_param *cmd;
  624. wmi_ric_tspec *tspec_param;
  625. wmi_buf_t buf;
  626. uint8_t *buf_ptr;
  627. struct mac_tspec_ie *ptspecIE = NULL;
  628. int32_t len = sizeof(wmi_ric_request_fixed_param) +
  629. WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec);
  630. buf = wmi_buf_alloc(wmi_handle, len);
  631. if (!buf) {
  632. return QDF_STATUS_E_NOMEM;
  633. }
  634. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  635. cmd = (wmi_ric_request_fixed_param *) buf_ptr;
  636. WMITLV_SET_HDR(&cmd->tlv_header,
  637. WMITLV_TAG_STRUC_wmi_ric_request_fixed_param,
  638. WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param));
  639. if (is_add_ts)
  640. cmd->vdev_id = ((struct add_ts_param *) msg)->sme_session_id;
  641. else
  642. cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId;
  643. cmd->num_ric_request = 1;
  644. cmd->is_add_ric = is_add_ts;
  645. buf_ptr += sizeof(wmi_ric_request_fixed_param);
  646. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec));
  647. buf_ptr += WMI_TLV_HDR_SIZE;
  648. tspec_param = (wmi_ric_tspec *) buf_ptr;
  649. WMITLV_SET_HDR(&tspec_param->tlv_header,
  650. WMITLV_TAG_STRUC_wmi_ric_tspec,
  651. WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec));
  652. if (is_add_ts)
  653. ptspecIE = &(((struct add_ts_param *) msg)->tspec);
  654. else
  655. ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec);
  656. if (ptspecIE) {
  657. /* Fill the tsinfo in the format expected by firmware */
  658. #ifndef ANI_LITTLE_BIT_ENDIAN
  659. qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1,
  660. ((uint8_t *) &ptspecIE->tsinfo) + 1, 2);
  661. #else
  662. qdf_mem_copy(((uint8_t *) &tspec_param->ts_info),
  663. ((uint8_t *) &ptspecIE->tsinfo) + 1, 2);
  664. #endif /* ANI_LITTLE_BIT_ENDIAN */
  665. tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz;
  666. tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz;
  667. tspec_param->min_service_interval = ptspecIE->minSvcInterval;
  668. tspec_param->max_service_interval = ptspecIE->maxSvcInterval;
  669. tspec_param->inactivity_interval = ptspecIE->inactInterval;
  670. tspec_param->suspension_interval = ptspecIE->suspendInterval;
  671. tspec_param->svc_start_time = ptspecIE->svcStartTime;
  672. tspec_param->min_data_rate = ptspecIE->minDataRate;
  673. tspec_param->mean_data_rate = ptspecIE->meanDataRate;
  674. tspec_param->peak_data_rate = ptspecIE->peakDataRate;
  675. tspec_param->max_burst_size = ptspecIE->maxBurstSz;
  676. tspec_param->delay_bound = ptspecIE->delayBound;
  677. tspec_param->min_phy_rate = ptspecIE->minPhyRate;
  678. tspec_param->surplus_bw_allowance = ptspecIE->surplusBw;
  679. tspec_param->medium_time = 0;
  680. }
  681. WMI_LOGI("%s: Set RIC Req is_add_ts:%d", __func__, is_add_ts);
  682. wmi_mtrace(WMI_ROAM_SET_RIC_REQUEST_CMDID, cmd->vdev_id, 0);
  683. if (wmi_unified_cmd_send(wmi_handle, buf, len,
  684. WMI_ROAM_SET_RIC_REQUEST_CMDID)) {
  685. WMI_LOGP("%s: Failed to send vdev Set RIC Req command",
  686. __func__);
  687. if (is_add_ts)
  688. ((struct add_ts_param *) msg)->status =
  689. QDF_STATUS_E_FAILURE;
  690. wmi_buf_free(buf);
  691. return QDF_STATUS_E_FAILURE;
  692. }
  693. return QDF_STATUS_SUCCESS;
  694. }
  695. /**
  696. * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw.
  697. * @wmi_handle: wmi handle
  698. * @vdev_id: vdev id
  699. *
  700. * This function sends roam synch complete event to fw.
  701. *
  702. * Return: CDF STATUS
  703. */
  704. static QDF_STATUS send_process_roam_synch_complete_cmd_tlv(wmi_unified_t wmi_handle,
  705. uint8_t vdev_id)
  706. {
  707. wmi_roam_synch_complete_fixed_param *cmd;
  708. wmi_buf_t wmi_buf;
  709. uint8_t *buf_ptr;
  710. uint16_t len;
  711. len = sizeof(wmi_roam_synch_complete_fixed_param);
  712. wmi_buf = wmi_buf_alloc(wmi_handle, len);
  713. if (!wmi_buf) {
  714. return QDF_STATUS_E_NOMEM;
  715. }
  716. cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf);
  717. buf_ptr = (uint8_t *) cmd;
  718. WMITLV_SET_HDR(&cmd->tlv_header,
  719. WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param,
  720. WMITLV_GET_STRUCT_TLVLEN
  721. (wmi_roam_synch_complete_fixed_param));
  722. cmd->vdev_id = vdev_id;
  723. wmi_mtrace(WMI_ROAM_SYNCH_COMPLETE, cmd->vdev_id, 0);
  724. if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len,
  725. WMI_ROAM_SYNCH_COMPLETE)) {
  726. WMI_LOGP("%s: failed to send roam synch confirmation",
  727. __func__);
  728. wmi_buf_free(wmi_buf);
  729. return QDF_STATUS_E_FAILURE;
  730. }
  731. return QDF_STATUS_SUCCESS;
  732. }
  733. /**
  734. * send_roam_invoke_cmd_tlv() - send roam invoke command to fw.
  735. * @wmi_handle: wma handle
  736. * @roaminvoke: roam invoke command
  737. *
  738. * Send roam invoke command to fw for fastreassoc.
  739. *
  740. * Return: CDF STATUS
  741. */
  742. static QDF_STATUS send_roam_invoke_cmd_tlv(wmi_unified_t wmi_handle,
  743. struct wmi_roam_invoke_cmd *roaminvoke,
  744. uint32_t ch_hz)
  745. {
  746. wmi_roam_invoke_cmd_fixed_param *cmd;
  747. wmi_buf_t wmi_buf;
  748. u_int8_t *buf_ptr;
  749. u_int16_t len, args_tlv_len;
  750. uint32_t *channel_list;
  751. wmi_mac_addr *bssid_list;
  752. wmi_tlv_buf_len_param *buf_len_tlv;
  753. /* Host sends only one channel and one bssid */
  754. args_tlv_len = (4 * WMI_TLV_HDR_SIZE) + sizeof(uint32_t) +
  755. sizeof(wmi_mac_addr) + sizeof(wmi_tlv_buf_len_param) +
  756. roundup(roaminvoke->frame_len, sizeof(uint32_t));
  757. len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len;
  758. wmi_buf = wmi_buf_alloc(wmi_handle, len);
  759. if (!wmi_buf) {
  760. return QDF_STATUS_E_NOMEM;
  761. }
  762. cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf);
  763. buf_ptr = (u_int8_t *) cmd;
  764. WMITLV_SET_HDR(&cmd->tlv_header,
  765. WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param,
  766. WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param));
  767. cmd->vdev_id = roaminvoke->vdev_id;
  768. cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_REPORT_FAILURE);
  769. if (roaminvoke->is_same_bssid)
  770. cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_NO_NULL_FRAME_TO_AP);
  771. WMI_LOGD(FL("is_same_bssid flag: %d"), roaminvoke->is_same_bssid);
  772. if (roaminvoke->frame_len) {
  773. cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_SKIP;
  774. /* packing 1 beacon/probe_rsp frame with WMI cmd */
  775. cmd->num_buf = 1;
  776. } else {
  777. cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_FIXED_CH;
  778. cmd->num_buf = 0;
  779. }
  780. cmd->roam_ap_sel_mode = 0;
  781. cmd->roam_delay = 0;
  782. cmd->num_chan = 1;
  783. cmd->num_bssid = 1;
  784. buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param);
  785. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
  786. (sizeof(u_int32_t)));
  787. channel_list = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE);
  788. *channel_list = ch_hz;
  789. buf_ptr += sizeof(uint32_t) + WMI_TLV_HDR_SIZE;
  790. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC,
  791. (sizeof(wmi_mac_addr)));
  792. bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE);
  793. WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list);
  794. /* move to next tlv i.e. bcn_prb_buf_list */
  795. buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_mac_addr);
  796. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC,
  797. sizeof(wmi_tlv_buf_len_param));
  798. buf_len_tlv = (wmi_tlv_buf_len_param *)(buf_ptr + WMI_TLV_HDR_SIZE);
  799. buf_len_tlv->buf_len = roaminvoke->frame_len;
  800. /* move to next tlv i.e. bcn_prb_frm */
  801. buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_tlv_buf_len_param);
  802. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
  803. roundup(roaminvoke->frame_len, sizeof(uint32_t)));
  804. /* copy frame after the header */
  805. qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE,
  806. roaminvoke->frame_buf,
  807. roaminvoke->frame_len);
  808. WMI_LOGD(FL("bcn/prb_rsp frame, length: %d"), roaminvoke->frame_len);
  809. QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
  810. buf_ptr + WMI_TLV_HDR_SIZE,
  811. roaminvoke->frame_len);
  812. WMI_LOGD(FL("flag:%d, MODE scn:%d, ap:%d, dly:%d, n_ch:%d, n_bssid:%d"),
  813. cmd->flags, cmd->roam_scan_mode,
  814. cmd->roam_ap_sel_mode, cmd->roam_delay,
  815. cmd->num_chan, cmd->num_bssid);
  816. WMI_LOGD(FL("BSSID: %pM, channel: %d"), roaminvoke->bssid, ch_hz);
  817. wmi_mtrace(WMI_ROAM_INVOKE_CMDID, cmd->vdev_id, 0);
  818. if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len,
  819. WMI_ROAM_INVOKE_CMDID)) {
  820. WMI_LOGP("%s: failed to send roam invoke command", __func__);
  821. wmi_buf_free(wmi_buf);
  822. return QDF_STATUS_E_FAILURE;
  823. }
  824. return QDF_STATUS_SUCCESS;
  825. }
  826. void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle)
  827. {
  828. struct wmi_ops *ops = wmi_handle->ops;
  829. ops->send_set_ric_req_cmd = send_set_ric_req_cmd_tlv;
  830. ops->send_process_roam_synch_complete_cmd =
  831. send_process_roam_synch_complete_cmd_tlv;
  832. ops->send_roam_invoke_cmd = send_roam_invoke_cmd_tlv;
  833. }
  834. #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
  835. #if defined(WLAN_FEATURE_FILS_SK) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
  836. /**
  837. * wmi_add_fils_tlv() - Add FILS TLV to roam scan offload command
  838. * @wmi_handle: wmi handle
  839. * @roam_req: Roam scan offload params
  840. * @buf_ptr: command buffer to send
  841. * @fils_tlv_len: fils tlv length
  842. *
  843. * Return: Updated buffer pointer
  844. */
  845. static uint8_t *wmi_add_fils_tlv(wmi_unified_t wmi_handle,
  846. struct roam_offload_scan_params *roam_req,
  847. uint8_t *buf_ptr, uint32_t fils_tlv_len)
  848. {
  849. wmi_roam_fils_offload_tlv_param *fils_tlv;
  850. wmi_erp_info *erp_info;
  851. struct roam_fils_params *roam_fils_params;
  852. if (!roam_req->add_fils_tlv)
  853. return buf_ptr;
  854. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  855. sizeof(*fils_tlv));
  856. buf_ptr += WMI_TLV_HDR_SIZE;
  857. fils_tlv = (wmi_roam_fils_offload_tlv_param *)buf_ptr;
  858. WMITLV_SET_HDR(&fils_tlv->tlv_header,
  859. WMITLV_TAG_STRUC_wmi_roam_fils_offload_tlv_param,
  860. WMITLV_GET_STRUCT_TLVLEN
  861. (wmi_roam_fils_offload_tlv_param));
  862. roam_fils_params = &roam_req->roam_fils_params;
  863. erp_info = (wmi_erp_info *)(&fils_tlv->vdev_erp_info);
  864. erp_info->username_length = roam_fils_params->username_length;
  865. qdf_mem_copy(erp_info->username, roam_fils_params->username,
  866. erp_info->username_length);
  867. erp_info->next_erp_seq_num = roam_fils_params->next_erp_seq_num;
  868. erp_info->rRk_length = roam_fils_params->rrk_length;
  869. qdf_mem_copy(erp_info->rRk, roam_fils_params->rrk,
  870. erp_info->rRk_length);
  871. erp_info->rIk_length = roam_fils_params->rik_length;
  872. qdf_mem_copy(erp_info->rIk, roam_fils_params->rik,
  873. erp_info->rIk_length);
  874. erp_info->realm_len = roam_fils_params->realm_len;
  875. qdf_mem_copy(erp_info->realm, roam_fils_params->realm,
  876. erp_info->realm_len);
  877. buf_ptr += sizeof(*fils_tlv);
  878. return buf_ptr;
  879. }
  880. #else
  881. static inline uint8_t *wmi_add_fils_tlv(wmi_unified_t wmi_handle,
  882. struct roam_offload_scan_params *roam_req,
  883. uint8_t *buf_ptr, uint32_t fils_tlv_len)
  884. {
  885. return buf_ptr;
  886. }
  887. #endif
  888. /**
  889. * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw
  890. * @wmi_handle: wmi handle
  891. * @scan_cmd_fp: start scan command ptr
  892. * @roam_req: roam request param
  893. *
  894. * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback
  895. * of WMI_ROAM_SCAN_MODE.
  896. *
  897. * Return: QDF status
  898. */
  899. static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle,
  900. wmi_start_scan_cmd_fixed_param *
  901. scan_cmd_fp,
  902. struct roam_offload_scan_params *roam_req)
  903. {
  904. wmi_buf_t buf = NULL;
  905. QDF_STATUS status;
  906. int len;
  907. uint8_t *buf_ptr;
  908. wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp;
  909. #ifdef WLAN_FEATURE_ROAM_OFFLOAD
  910. int auth_mode = roam_req->auth_mode;
  911. roam_offload_param *req_offload_params =
  912. &roam_req->roam_offload_params;
  913. wmi_roam_offload_tlv_param *roam_offload_params;
  914. wmi_roam_11i_offload_tlv_param *roam_offload_11i;
  915. wmi_roam_11r_offload_tlv_param *roam_offload_11r;
  916. wmi_roam_ese_offload_tlv_param *roam_offload_ese;
  917. wmi_tlv_buf_len_param *assoc_ies;
  918. uint32_t fils_tlv_len = 0;
  919. #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
  920. /* Need to create a buf with roam_scan command at
  921. * front and piggyback with scan command */
  922. len = sizeof(wmi_roam_scan_mode_fixed_param) +
  923. #ifdef WLAN_FEATURE_ROAM_OFFLOAD
  924. (2 * WMI_TLV_HDR_SIZE) +
  925. #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
  926. sizeof(wmi_start_scan_cmd_fixed_param);
  927. #ifdef WLAN_FEATURE_ROAM_OFFLOAD
  928. WMI_LOGD("auth_mode = %d", auth_mode);
  929. if (roam_req->is_roam_req_valid &&
  930. roam_req->roam_offload_enabled) {
  931. len += sizeof(wmi_roam_offload_tlv_param);
  932. len += WMI_TLV_HDR_SIZE;
  933. if ((auth_mode != WMI_AUTH_NONE) &&
  934. ((auth_mode != WMI_AUTH_OPEN) ||
  935. (auth_mode == WMI_AUTH_OPEN &&
  936. roam_req->mdid.mdie_present &&
  937. roam_req->is_11r_assoc) ||
  938. roam_req->is_ese_assoc)) {
  939. len += WMI_TLV_HDR_SIZE;
  940. if (roam_req->is_ese_assoc)
  941. len +=
  942. sizeof(wmi_roam_ese_offload_tlv_param);
  943. else if (auth_mode == WMI_AUTH_FT_RSNA ||
  944. auth_mode == WMI_AUTH_FT_RSNA_PSK ||
  945. (auth_mode == WMI_AUTH_OPEN &&
  946. roam_req->mdid.mdie_present &&
  947. roam_req->is_11r_assoc))
  948. len +=
  949. sizeof(wmi_roam_11r_offload_tlv_param);
  950. else
  951. len +=
  952. sizeof(wmi_roam_11i_offload_tlv_param);
  953. } else {
  954. len += WMI_TLV_HDR_SIZE;
  955. }
  956. len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE)
  957. + roundup(roam_req->assoc_ie_length,
  958. sizeof(uint32_t)));
  959. if (roam_req->add_fils_tlv) {
  960. fils_tlv_len = sizeof(
  961. wmi_roam_fils_offload_tlv_param);
  962. len += WMI_TLV_HDR_SIZE + fils_tlv_len;
  963. }
  964. } else {
  965. if (roam_req->is_roam_req_valid)
  966. WMI_LOGD("%s : roam offload = %d",
  967. __func__,
  968. roam_req->roam_offload_enabled);
  969. else
  970. WMI_LOGD("%s : roam_req is NULL", __func__);
  971. len += (4 * WMI_TLV_HDR_SIZE);
  972. }
  973. if (roam_req->is_roam_req_valid &&
  974. roam_req->roam_offload_enabled) {
  975. roam_req->mode = roam_req->mode |
  976. WMI_ROAM_SCAN_MODE_ROAMOFFLOAD;
  977. }
  978. #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
  979. if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE
  980. |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD))
  981. len = sizeof(wmi_roam_scan_mode_fixed_param);
  982. buf = wmi_buf_alloc(wmi_handle, len);
  983. if (!buf) {
  984. return QDF_STATUS_E_NOMEM;
  985. }
  986. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  987. roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr;
  988. WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header,
  989. WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param,
  990. WMITLV_GET_STRUCT_TLVLEN
  991. (wmi_roam_scan_mode_fixed_param));
  992. roam_scan_mode_fp->min_delay_roam_trigger_reason_bitmask =
  993. roam_req->roam_trigger_reason_bitmask;
  994. roam_scan_mode_fp->min_delay_btw_scans =
  995. WMI_SEC_TO_MSEC(roam_req->min_delay_btw_roam_scans);
  996. roam_scan_mode_fp->roam_scan_mode = roam_req->mode;
  997. roam_scan_mode_fp->vdev_id = roam_req->vdev_id;
  998. if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
  999. WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) {
  1000. roam_scan_mode_fp->flags |=
  1001. WMI_ROAM_SCAN_MODE_FLAG_REPORT_STATUS;
  1002. goto send_roam_scan_mode_cmd;
  1003. }
  1004. /* Fill in scan parameters suitable for roaming scan */
  1005. buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param);
  1006. qdf_mem_copy(buf_ptr, scan_cmd_fp,
  1007. sizeof(wmi_start_scan_cmd_fixed_param));
  1008. /* Ensure there is no additional IEs */
  1009. scan_cmd_fp->ie_len = 0;
  1010. WMITLV_SET_HDR(buf_ptr,
  1011. WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param,
  1012. WMITLV_GET_STRUCT_TLVLEN
  1013. (wmi_start_scan_cmd_fixed_param));
  1014. #ifdef WLAN_FEATURE_ROAM_OFFLOAD
  1015. buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param);
  1016. if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) {
  1017. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1018. sizeof(wmi_roam_offload_tlv_param));
  1019. buf_ptr += WMI_TLV_HDR_SIZE;
  1020. roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr;
  1021. WMITLV_SET_HDR(buf_ptr,
  1022. WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param,
  1023. WMITLV_GET_STRUCT_TLVLEN
  1024. (wmi_roam_offload_tlv_param));
  1025. roam_offload_params->prefer_5g = roam_req->prefer_5ghz;
  1026. roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap;
  1027. roam_offload_params->select_5g_margin =
  1028. roam_req->select_5ghz_margin;
  1029. roam_offload_params->handoff_delay_for_rx =
  1030. req_offload_params->ho_delay_for_rx;
  1031. roam_offload_params->max_mlme_sw_retries =
  1032. req_offload_params->roam_preauth_retry_count;
  1033. roam_offload_params->no_ack_timeout =
  1034. req_offload_params->roam_preauth_no_ack_timeout;
  1035. roam_offload_params->reassoc_failure_timeout =
  1036. roam_req->reassoc_failure_timeout;
  1037. /* Fill the capabilities */
  1038. roam_offload_params->capability =
  1039. req_offload_params->capability;
  1040. roam_offload_params->ht_caps_info =
  1041. req_offload_params->ht_caps_info;
  1042. roam_offload_params->ampdu_param =
  1043. req_offload_params->ampdu_param;
  1044. roam_offload_params->ht_ext_cap =
  1045. req_offload_params->ht_ext_cap;
  1046. roam_offload_params->ht_txbf = req_offload_params->ht_txbf;
  1047. roam_offload_params->asel_cap = req_offload_params->asel_cap;
  1048. roam_offload_params->qos_caps = req_offload_params->qos_caps;
  1049. roam_offload_params->qos_enabled =
  1050. req_offload_params->qos_enabled;
  1051. roam_offload_params->wmm_caps = req_offload_params->wmm_caps;
  1052. qdf_mem_copy((uint8_t *)roam_offload_params->mcsset,
  1053. (uint8_t *)req_offload_params->mcsset,
  1054. ROAM_OFFLOAD_NUM_MCS_SET);
  1055. buf_ptr += sizeof(wmi_roam_offload_tlv_param);
  1056. /* The TLV's are in the order of 11i, 11R, ESE. Hence,
  1057. * they are filled in the same order.Depending on the
  1058. * authentication type, the other mode TLV's are nullified
  1059. * and only headers are filled.*/
  1060. if ((auth_mode != WMI_AUTH_NONE) &&
  1061. ((auth_mode != WMI_AUTH_OPEN) ||
  1062. (auth_mode == WMI_AUTH_OPEN
  1063. && roam_req->mdid.mdie_present &&
  1064. roam_req->is_11r_assoc) ||
  1065. roam_req->is_ese_assoc)) {
  1066. if (roam_req->is_ese_assoc) {
  1067. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1068. WMITLV_GET_STRUCT_TLVLEN(0));
  1069. buf_ptr += WMI_TLV_HDR_SIZE;
  1070. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1071. WMITLV_GET_STRUCT_TLVLEN(0));
  1072. buf_ptr += WMI_TLV_HDR_SIZE;
  1073. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1074. sizeof(wmi_roam_ese_offload_tlv_param));
  1075. buf_ptr += WMI_TLV_HDR_SIZE;
  1076. roam_offload_ese =
  1077. (wmi_roam_ese_offload_tlv_param *) buf_ptr;
  1078. qdf_mem_copy(roam_offload_ese->krk,
  1079. roam_req->krk,
  1080. sizeof(roam_req->krk));
  1081. qdf_mem_copy(roam_offload_ese->btk,
  1082. roam_req->btk,
  1083. sizeof(roam_req->btk));
  1084. WMITLV_SET_HDR(&roam_offload_ese->tlv_header,
  1085. WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param,
  1086. WMITLV_GET_STRUCT_TLVLEN
  1087. (wmi_roam_ese_offload_tlv_param));
  1088. buf_ptr +=
  1089. sizeof(wmi_roam_ese_offload_tlv_param);
  1090. } else if (auth_mode == WMI_AUTH_FT_RSNA
  1091. || auth_mode == WMI_AUTH_FT_RSNA_PSK
  1092. || (auth_mode == WMI_AUTH_OPEN
  1093. && roam_req->mdid.mdie_present &&
  1094. roam_req->is_11r_assoc)) {
  1095. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1096. 0);
  1097. buf_ptr += WMI_TLV_HDR_SIZE;
  1098. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1099. sizeof(wmi_roam_11r_offload_tlv_param));
  1100. buf_ptr += WMI_TLV_HDR_SIZE;
  1101. roam_offload_11r =
  1102. (wmi_roam_11r_offload_tlv_param *) buf_ptr;
  1103. roam_offload_11r->r0kh_id_len =
  1104. roam_req->rokh_id_length;
  1105. qdf_mem_copy(roam_offload_11r->r0kh_id,
  1106. roam_req->rokh_id,
  1107. roam_offload_11r->r0kh_id_len);
  1108. qdf_mem_copy(roam_offload_11r->psk_msk,
  1109. roam_req->psk_pmk,
  1110. sizeof(roam_req->psk_pmk));
  1111. roam_offload_11r->psk_msk_len =
  1112. roam_req->pmk_len;
  1113. roam_offload_11r->mdie_present =
  1114. roam_req->mdid.mdie_present;
  1115. roam_offload_11r->mdid =
  1116. roam_req->mdid.mobility_domain;
  1117. if (auth_mode == WMI_AUTH_OPEN) {
  1118. /* If FT-Open ensure pmk length
  1119. and r0khid len are zero */
  1120. roam_offload_11r->r0kh_id_len = 0;
  1121. roam_offload_11r->psk_msk_len = 0;
  1122. }
  1123. WMITLV_SET_HDR(&roam_offload_11r->tlv_header,
  1124. WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param,
  1125. WMITLV_GET_STRUCT_TLVLEN
  1126. (wmi_roam_11r_offload_tlv_param));
  1127. buf_ptr +=
  1128. sizeof(wmi_roam_11r_offload_tlv_param);
  1129. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1130. WMITLV_GET_STRUCT_TLVLEN(0));
  1131. buf_ptr += WMI_TLV_HDR_SIZE;
  1132. WMI_LOGD("psk_msk_len = %d",
  1133. roam_offload_11r->psk_msk_len);
  1134. if (roam_offload_11r->psk_msk_len)
  1135. QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI,
  1136. QDF_TRACE_LEVEL_DEBUG,
  1137. roam_offload_11r->psk_msk,
  1138. roam_offload_11r->psk_msk_len);
  1139. } else {
  1140. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1141. sizeof(wmi_roam_11i_offload_tlv_param));
  1142. buf_ptr += WMI_TLV_HDR_SIZE;
  1143. roam_offload_11i =
  1144. (wmi_roam_11i_offload_tlv_param *) buf_ptr;
  1145. if (roam_req->roam_key_mgmt_offload_enabled &&
  1146. roam_req->fw_okc) {
  1147. WMI_SET_ROAM_OFFLOAD_OKC_ENABLED
  1148. (roam_offload_11i->flags);
  1149. WMI_LOGI("LFR3:OKC enabled");
  1150. } else {
  1151. WMI_SET_ROAM_OFFLOAD_OKC_DISABLED
  1152. (roam_offload_11i->flags);
  1153. WMI_LOGI("LFR3:OKC disabled");
  1154. }
  1155. if (roam_req->roam_key_mgmt_offload_enabled &&
  1156. roam_req->fw_pmksa_cache) {
  1157. WMI_SET_ROAM_OFFLOAD_PMK_CACHE_ENABLED
  1158. (roam_offload_11i->flags);
  1159. WMI_LOGI("LFR3:PMKSA caching enabled");
  1160. } else {
  1161. WMI_SET_ROAM_OFFLOAD_PMK_CACHE_DISABLED
  1162. (roam_offload_11i->flags);
  1163. WMI_LOGI("LFR3:PMKSA caching disabled");
  1164. }
  1165. qdf_mem_copy(roam_offload_11i->pmk,
  1166. roam_req->psk_pmk,
  1167. sizeof(roam_req->psk_pmk));
  1168. roam_offload_11i->pmk_len = roam_req->pmk_len;
  1169. WMITLV_SET_HDR(&roam_offload_11i->tlv_header,
  1170. WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param,
  1171. WMITLV_GET_STRUCT_TLVLEN
  1172. (wmi_roam_11i_offload_tlv_param));
  1173. buf_ptr +=
  1174. sizeof(wmi_roam_11i_offload_tlv_param);
  1175. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1176. 0);
  1177. buf_ptr += WMI_TLV_HDR_SIZE;
  1178. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1179. 0);
  1180. buf_ptr += WMI_TLV_HDR_SIZE;
  1181. WMI_LOGD("pmk_len = %d",
  1182. roam_offload_11i->pmk_len);
  1183. if (roam_offload_11i->pmk_len)
  1184. QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI,
  1185. QDF_TRACE_LEVEL_DEBUG,
  1186. roam_offload_11i->pmk,
  1187. roam_offload_11i->pmk_len);
  1188. }
  1189. } else {
  1190. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1191. WMITLV_GET_STRUCT_TLVLEN(0));
  1192. buf_ptr += WMI_TLV_HDR_SIZE;
  1193. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1194. WMITLV_GET_STRUCT_TLVLEN(0));
  1195. buf_ptr += WMI_TLV_HDR_SIZE;
  1196. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1197. WMITLV_GET_STRUCT_TLVLEN(0));
  1198. buf_ptr += WMI_TLV_HDR_SIZE;
  1199. }
  1200. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1201. sizeof(*assoc_ies));
  1202. buf_ptr += WMI_TLV_HDR_SIZE;
  1203. assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr;
  1204. WMITLV_SET_HDR(&assoc_ies->tlv_header,
  1205. WMITLV_TAG_STRUC_wmi_tlv_buf_len_param,
  1206. WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param));
  1207. assoc_ies->buf_len = roam_req->assoc_ie_length;
  1208. buf_ptr += sizeof(*assoc_ies);
  1209. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
  1210. roundup(assoc_ies->buf_len, sizeof(uint32_t)));
  1211. buf_ptr += WMI_TLV_HDR_SIZE;
  1212. if (assoc_ies->buf_len != 0) {
  1213. qdf_mem_copy(buf_ptr, roam_req->assoc_ie,
  1214. assoc_ies->buf_len);
  1215. }
  1216. buf_ptr += qdf_roundup(assoc_ies->buf_len, sizeof(uint32_t));
  1217. buf_ptr = wmi_add_fils_tlv(wmi_handle, roam_req,
  1218. buf_ptr, fils_tlv_len);
  1219. } else {
  1220. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1221. WMITLV_GET_STRUCT_TLVLEN(0));
  1222. buf_ptr += WMI_TLV_HDR_SIZE;
  1223. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1224. WMITLV_GET_STRUCT_TLVLEN(0));
  1225. buf_ptr += WMI_TLV_HDR_SIZE;
  1226. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1227. WMITLV_GET_STRUCT_TLVLEN(0));
  1228. buf_ptr += WMI_TLV_HDR_SIZE;
  1229. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1230. WMITLV_GET_STRUCT_TLVLEN(0));
  1231. buf_ptr += WMI_TLV_HDR_SIZE;
  1232. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1233. WMITLV_GET_STRUCT_TLVLEN(0));
  1234. buf_ptr += WMI_TLV_HDR_SIZE;
  1235. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
  1236. WMITLV_GET_STRUCT_TLVLEN(0));
  1237. }
  1238. #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
  1239. send_roam_scan_mode_cmd:
  1240. wmi_mtrace(WMI_ROAM_SCAN_MODE, NO_SESSION, 0);
  1241. status = wmi_unified_cmd_send(wmi_handle, buf,
  1242. len, WMI_ROAM_SCAN_MODE);
  1243. if (QDF_IS_STATUS_ERROR(status)) {
  1244. WMI_LOGE(
  1245. "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d",
  1246. status);
  1247. wmi_buf_free(buf);
  1248. }
  1249. return status;
  1250. }
  1251. /**
  1252. * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw
  1253. * @wmi_handle: wmi handle
  1254. * @ap_profile_p: ap profile
  1255. * @vdev_id: vdev id
  1256. *
  1257. * Send WMI_ROAM_AP_PROFILE to firmware
  1258. *
  1259. * Return: CDF status
  1260. */
  1261. static QDF_STATUS send_roam_scan_offload_ap_profile_cmd_tlv(wmi_unified_t wmi_handle,
  1262. struct ap_profile_params *ap_profile)
  1263. {
  1264. wmi_buf_t buf = NULL;
  1265. QDF_STATUS status;
  1266. int len;
  1267. uint8_t *buf_ptr;
  1268. wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp;
  1269. wmi_roam_cnd_scoring_param *score_param;
  1270. wmi_ap_profile *profile;
  1271. len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile);
  1272. len += sizeof(*score_param);
  1273. buf = wmi_buf_alloc(wmi_handle, len);
  1274. if (!buf) {
  1275. return QDF_STATUS_E_NOMEM;
  1276. }
  1277. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1278. roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr;
  1279. WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header,
  1280. WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param,
  1281. WMITLV_GET_STRUCT_TLVLEN
  1282. (wmi_roam_ap_profile_fixed_param));
  1283. /* fill in threshold values */
  1284. roam_ap_profile_fp->vdev_id = ap_profile->vdev_id;
  1285. roam_ap_profile_fp->id = 0;
  1286. buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param);
  1287. profile = (wmi_ap_profile *)buf_ptr;
  1288. WMITLV_SET_HDR(&profile->tlv_header,
  1289. WMITLV_TAG_STRUC_wmi_ap_profile,
  1290. WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile));
  1291. profile->flags = ap_profile->profile.flags;
  1292. profile->rssi_threshold = ap_profile->profile.rssi_threshold;
  1293. profile->ssid.ssid_len = ap_profile->profile.ssid.length;
  1294. qdf_mem_copy(profile->ssid.ssid, ap_profile->profile.ssid.mac_ssid,
  1295. profile->ssid.ssid_len);
  1296. profile->rsn_authmode = ap_profile->profile.rsn_authmode;
  1297. profile->rsn_ucastcipherset = ap_profile->profile.rsn_ucastcipherset;
  1298. profile->rsn_mcastcipherset = ap_profile->profile.rsn_mcastcipherset;
  1299. profile->rsn_mcastmgmtcipherset =
  1300. ap_profile->profile.rsn_mcastmgmtcipherset;
  1301. profile->rssi_abs_thresh = ap_profile->profile.rssi_abs_thresh;
  1302. WMI_LOGD("AP profile: flags %x rssi_threshold %d ssid:%.*s authmode %d uc cipher %d mc cipher %d mc mgmt cipher %d rssi abs thresh %d",
  1303. profile->flags, profile->rssi_threshold,
  1304. profile->ssid.ssid_len, ap_profile->profile.ssid.mac_ssid,
  1305. profile->rsn_authmode, profile->rsn_ucastcipherset,
  1306. profile->rsn_mcastcipherset, profile->rsn_mcastmgmtcipherset,
  1307. profile->rssi_abs_thresh);
  1308. buf_ptr += sizeof(wmi_ap_profile);
  1309. score_param = (wmi_roam_cnd_scoring_param *)buf_ptr;
  1310. WMITLV_SET_HDR(&score_param->tlv_header,
  1311. WMITLV_TAG_STRUC_wmi_roam_cnd_scoring_param,
  1312. WMITLV_GET_STRUCT_TLVLEN(wmi_roam_cnd_scoring_param));
  1313. score_param->disable_bitmap = ap_profile->param.disable_bitmap;
  1314. score_param->rssi_weightage_pcnt =
  1315. ap_profile->param.rssi_weightage;
  1316. score_param->ht_weightage_pcnt = ap_profile->param.ht_weightage;
  1317. score_param->vht_weightage_pcnt = ap_profile->param.vht_weightage;
  1318. score_param->he_weightage_pcnt = ap_profile->param.he_weightage;
  1319. score_param->bw_weightage_pcnt = ap_profile->param.bw_weightage;
  1320. score_param->band_weightage_pcnt = ap_profile->param.band_weightage;
  1321. score_param->nss_weightage_pcnt = ap_profile->param.nss_weightage;
  1322. score_param->esp_qbss_weightage_pcnt =
  1323. ap_profile->param.esp_qbss_weightage;
  1324. score_param->beamforming_weightage_pcnt =
  1325. ap_profile->param.beamforming_weightage;
  1326. score_param->pcl_weightage_pcnt = ap_profile->param.pcl_weightage;
  1327. score_param->oce_wan_weightage_pcnt =
  1328. ap_profile->param.oce_wan_weightage;
  1329. WMI_LOGD("Score params weightage: disable_bitmap %x rssi %d ht %d vht %d he %d BW %d band %d NSS %d ESP %d BF %d PCL %d OCE WAN %d",
  1330. score_param->disable_bitmap, score_param->rssi_weightage_pcnt,
  1331. score_param->ht_weightage_pcnt,
  1332. score_param->vht_weightage_pcnt,
  1333. score_param->he_weightage_pcnt, score_param->bw_weightage_pcnt,
  1334. score_param->band_weightage_pcnt,
  1335. score_param->nss_weightage_pcnt,
  1336. score_param->esp_qbss_weightage_pcnt,
  1337. score_param->beamforming_weightage_pcnt,
  1338. score_param->pcl_weightage_pcnt,
  1339. score_param->oce_wan_weightage_pcnt);
  1340. score_param->bw_scoring.score_pcnt = ap_profile->param.bw_index_score;
  1341. score_param->band_scoring.score_pcnt =
  1342. ap_profile->param.band_index_score;
  1343. score_param->nss_scoring.score_pcnt =
  1344. ap_profile->param.nss_index_score;
  1345. WMI_LOGD("Params index score bitmask: bw_index_score %x band_index_score %x nss_index_score %x",
  1346. score_param->bw_scoring.score_pcnt,
  1347. score_param->band_scoring.score_pcnt,
  1348. score_param->nss_scoring.score_pcnt);
  1349. score_param->rssi_scoring.best_rssi_threshold =
  1350. (-1) * ap_profile->param.rssi_scoring.best_rssi_threshold;
  1351. score_param->rssi_scoring.good_rssi_threshold =
  1352. (-1) * ap_profile->param.rssi_scoring.good_rssi_threshold;
  1353. score_param->rssi_scoring.bad_rssi_threshold =
  1354. (-1) * ap_profile->param.rssi_scoring.bad_rssi_threshold;
  1355. score_param->rssi_scoring.good_rssi_pcnt =
  1356. ap_profile->param.rssi_scoring.good_rssi_pcnt;
  1357. score_param->rssi_scoring.bad_rssi_pcnt =
  1358. ap_profile->param.rssi_scoring.bad_rssi_pcnt;
  1359. score_param->rssi_scoring.good_bucket_size =
  1360. ap_profile->param.rssi_scoring.good_bucket_size;
  1361. score_param->rssi_scoring.bad_bucket_size =
  1362. ap_profile->param.rssi_scoring.bad_bucket_size;
  1363. score_param->rssi_scoring.rssi_pref_5g_rssi_thresh =
  1364. (-1) * ap_profile->param.rssi_scoring.rssi_pref_5g_rssi_thresh;
  1365. WMI_LOGD("Rssi scoring threshold: best RSSI %d good RSSI %d bad RSSI %d prefer 5g threshold %d",
  1366. score_param->rssi_scoring.best_rssi_threshold,
  1367. score_param->rssi_scoring.good_rssi_threshold,
  1368. score_param->rssi_scoring.bad_rssi_threshold,
  1369. score_param->rssi_scoring.rssi_pref_5g_rssi_thresh);
  1370. WMI_LOGD("Good RSSI score for each slot %d bad RSSI score for each slot %d good bucket %d bad bucket %d",
  1371. score_param->rssi_scoring.good_rssi_pcnt,
  1372. score_param->rssi_scoring.bad_rssi_pcnt,
  1373. score_param->rssi_scoring.good_bucket_size,
  1374. score_param->rssi_scoring.bad_bucket_size);
  1375. score_param->esp_qbss_scoring.num_slot =
  1376. ap_profile->param.esp_qbss_scoring.num_slot;
  1377. score_param->esp_qbss_scoring.score_pcnt3_to_0 =
  1378. ap_profile->param.esp_qbss_scoring.score_pcnt3_to_0;
  1379. score_param->esp_qbss_scoring.score_pcnt7_to_4 =
  1380. ap_profile->param.esp_qbss_scoring.score_pcnt7_to_4;
  1381. score_param->esp_qbss_scoring.score_pcnt11_to_8 =
  1382. ap_profile->param.esp_qbss_scoring.score_pcnt11_to_8;
  1383. score_param->esp_qbss_scoring.score_pcnt15_to_12 =
  1384. ap_profile->param.esp_qbss_scoring.score_pcnt15_to_12;
  1385. WMI_LOGD("ESP QBSS index weight: slots %d weight 0to3 %x weight 4to7 %x weight 8to11 %x weight 12to15 %x",
  1386. score_param->esp_qbss_scoring.num_slot,
  1387. score_param->esp_qbss_scoring.score_pcnt3_to_0,
  1388. score_param->esp_qbss_scoring.score_pcnt7_to_4,
  1389. score_param->esp_qbss_scoring.score_pcnt11_to_8,
  1390. score_param->esp_qbss_scoring.score_pcnt15_to_12);
  1391. score_param->oce_wan_scoring.num_slot =
  1392. ap_profile->param.oce_wan_scoring.num_slot;
  1393. score_param->oce_wan_scoring.score_pcnt3_to_0 =
  1394. ap_profile->param.oce_wan_scoring.score_pcnt3_to_0;
  1395. score_param->oce_wan_scoring.score_pcnt7_to_4 =
  1396. ap_profile->param.oce_wan_scoring.score_pcnt7_to_4;
  1397. score_param->oce_wan_scoring.score_pcnt11_to_8 =
  1398. ap_profile->param.oce_wan_scoring.score_pcnt11_to_8;
  1399. score_param->oce_wan_scoring.score_pcnt15_to_12 =
  1400. ap_profile->param.oce_wan_scoring.score_pcnt15_to_12;
  1401. WMI_LOGD("OCE WAN index weight: slots %d weight 0to3 %x weight 4to7 %x weight 8to11 %x weight 12to15 %x",
  1402. score_param->oce_wan_scoring.num_slot,
  1403. score_param->oce_wan_scoring.score_pcnt3_to_0,
  1404. score_param->oce_wan_scoring.score_pcnt7_to_4,
  1405. score_param->oce_wan_scoring.score_pcnt11_to_8,
  1406. score_param->oce_wan_scoring.score_pcnt15_to_12);
  1407. wmi_mtrace(WMI_ROAM_AP_PROFILE, NO_SESSION, 0);
  1408. status = wmi_unified_cmd_send(wmi_handle, buf,
  1409. len, WMI_ROAM_AP_PROFILE);
  1410. if (QDF_IS_STATUS_ERROR(status)) {
  1411. WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_AP_PROFILE returned Error %d",
  1412. status);
  1413. wmi_buf_free(buf);
  1414. }
  1415. WMI_LOGD("WMI --> WMI_ROAM_AP_PROFILE and other parameters");
  1416. return status;
  1417. }
  1418. /**
  1419. * send_roam_scan_offload_cmd_tlv() - set roam offload command
  1420. * @wmi_handle: wmi handle
  1421. * @command: command
  1422. * @vdev_id: vdev id
  1423. *
  1424. * This function set roam offload command to fw.
  1425. *
  1426. * Return: CDF status
  1427. */
  1428. static QDF_STATUS send_roam_scan_offload_cmd_tlv(wmi_unified_t wmi_handle,
  1429. uint32_t command, uint32_t vdev_id)
  1430. {
  1431. QDF_STATUS status;
  1432. wmi_roam_scan_cmd_fixed_param *cmd_fp;
  1433. wmi_buf_t buf = NULL;
  1434. int len;
  1435. uint8_t *buf_ptr;
  1436. len = sizeof(wmi_roam_scan_cmd_fixed_param);
  1437. buf = wmi_buf_alloc(wmi_handle, len);
  1438. if (!buf) {
  1439. return QDF_STATUS_E_NOMEM;
  1440. }
  1441. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1442. cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr;
  1443. WMITLV_SET_HDR(&cmd_fp->tlv_header,
  1444. WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param,
  1445. WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param));
  1446. cmd_fp->vdev_id = vdev_id;
  1447. cmd_fp->command_arg = command;
  1448. wmi_mtrace(WMI_ROAM_SCAN_CMD, NO_SESSION, 0);
  1449. status = wmi_unified_cmd_send(wmi_handle, buf,
  1450. len, WMI_ROAM_SCAN_CMD);
  1451. if (QDF_IS_STATUS_ERROR(status)) {
  1452. WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_CMD returned Error %d",
  1453. status);
  1454. goto error;
  1455. }
  1456. WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__);
  1457. return QDF_STATUS_SUCCESS;
  1458. error:
  1459. wmi_buf_free(buf);
  1460. return status;
  1461. }
  1462. /**
  1463. * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period
  1464. * @wmi_handle: wmi handle
  1465. * @scan_period: scan period
  1466. * @scan_age: scan age
  1467. * @vdev_id: vdev id
  1468. *
  1469. * Send WMI_ROAM_SCAN_PERIOD parameters to fw.
  1470. *
  1471. * Return: CDF status
  1472. */
  1473. static QDF_STATUS send_roam_scan_offload_scan_period_cmd_tlv(wmi_unified_t wmi_handle,
  1474. uint32_t scan_period,
  1475. uint32_t scan_age,
  1476. uint32_t vdev_id)
  1477. {
  1478. QDF_STATUS status;
  1479. wmi_buf_t buf = NULL;
  1480. int len;
  1481. uint8_t *buf_ptr;
  1482. wmi_roam_scan_period_fixed_param *scan_period_fp;
  1483. /* Send scan period values */
  1484. len = sizeof(wmi_roam_scan_period_fixed_param);
  1485. buf = wmi_buf_alloc(wmi_handle, len);
  1486. if (!buf) {
  1487. return QDF_STATUS_E_NOMEM;
  1488. }
  1489. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1490. scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr;
  1491. WMITLV_SET_HDR(&scan_period_fp->tlv_header,
  1492. WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param,
  1493. WMITLV_GET_STRUCT_TLVLEN
  1494. (wmi_roam_scan_period_fixed_param));
  1495. /* fill in scan period values */
  1496. scan_period_fp->vdev_id = vdev_id;
  1497. scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */
  1498. scan_period_fp->roam_scan_age = scan_age;
  1499. wmi_mtrace(WMI_ROAM_SCAN_PERIOD, NO_SESSION, 0);
  1500. status = wmi_unified_cmd_send(wmi_handle, buf,
  1501. len, WMI_ROAM_SCAN_PERIOD);
  1502. if (QDF_IS_STATUS_ERROR(status)) {
  1503. WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_PERIOD returned Error %d",
  1504. status);
  1505. goto error;
  1506. }
  1507. WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_PERIOD roam_scan_period=%d, roam_scan_age=%d",
  1508. __func__, scan_period, scan_age);
  1509. return QDF_STATUS_SUCCESS;
  1510. error:
  1511. wmi_buf_free(buf);
  1512. return status;
  1513. }
  1514. /**
  1515. * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list
  1516. * @wmi_handle: wmi handle
  1517. * @chan_count: channel count
  1518. * @chan_list: channel list
  1519. * @list_type: list type
  1520. * @vdev_id: vdev id
  1521. *
  1522. * Set roam offload channel list.
  1523. *
  1524. * Return: CDF status
  1525. */
  1526. static QDF_STATUS send_roam_scan_offload_chan_list_cmd_tlv(wmi_unified_t wmi_handle,
  1527. uint8_t chan_count,
  1528. uint32_t *chan_list,
  1529. uint8_t list_type, uint32_t vdev_id)
  1530. {
  1531. wmi_buf_t buf = NULL;
  1532. QDF_STATUS status;
  1533. int len, list_tlv_len;
  1534. int i;
  1535. uint8_t *buf_ptr;
  1536. wmi_roam_chan_list_fixed_param *chan_list_fp;
  1537. uint32_t *roam_chan_list_array;
  1538. if (chan_count == 0) {
  1539. WMI_LOGD("%s : invalid number of channels %d", __func__,
  1540. chan_count);
  1541. return QDF_STATUS_E_EMPTY;
  1542. }
  1543. /* Channel list is a table of 2 TLV's */
  1544. list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(uint32_t);
  1545. len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len;
  1546. buf = wmi_buf_alloc(wmi_handle, len);
  1547. if (!buf) {
  1548. return QDF_STATUS_E_NOMEM;
  1549. }
  1550. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1551. chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr;
  1552. WMITLV_SET_HDR(&chan_list_fp->tlv_header,
  1553. WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param,
  1554. WMITLV_GET_STRUCT_TLVLEN
  1555. (wmi_roam_chan_list_fixed_param));
  1556. chan_list_fp->vdev_id = vdev_id;
  1557. chan_list_fp->num_chan = chan_count;
  1558. if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) {
  1559. /* external app is controlling channel list */
  1560. chan_list_fp->chan_list_type =
  1561. WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC;
  1562. } else {
  1563. /* umac supplied occupied channel list in LFR */
  1564. chan_list_fp->chan_list_type =
  1565. WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC;
  1566. }
  1567. buf_ptr += sizeof(wmi_roam_chan_list_fixed_param);
  1568. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
  1569. (chan_list_fp->num_chan * sizeof(uint32_t)));
  1570. roam_chan_list_array = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE);
  1571. WMI_LOGD("%s: %d channels = ", __func__, chan_list_fp->num_chan);
  1572. for (i = 0; ((i < chan_list_fp->num_chan) &&
  1573. (i < WMI_ROAM_MAX_CHANNELS)); i++) {
  1574. roam_chan_list_array[i] = chan_list[i];
  1575. WMI_LOGD("%d,", roam_chan_list_array[i]);
  1576. }
  1577. wmi_mtrace(WMI_ROAM_CHAN_LIST, NO_SESSION, 0);
  1578. status = wmi_unified_cmd_send(wmi_handle, buf,
  1579. len, WMI_ROAM_CHAN_LIST);
  1580. if (QDF_IS_STATUS_ERROR(status)) {
  1581. WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_CHAN_LIST returned Error %d",
  1582. status);
  1583. goto error;
  1584. }
  1585. WMI_LOGD("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__);
  1586. return QDF_STATUS_SUCCESS;
  1587. error:
  1588. wmi_buf_free(buf);
  1589. return status;
  1590. }
  1591. /**
  1592. * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th
  1593. * @wmi_handle: wmi handle
  1594. * @rssi_change_thresh: RSSI Change threshold
  1595. * @bcn_rssi_weight: beacon RSSI weight
  1596. * @vdev_id: vdev id
  1597. *
  1598. * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw.
  1599. *
  1600. * Return: CDF status
  1601. */
  1602. static QDF_STATUS send_roam_scan_offload_rssi_change_cmd_tlv(wmi_unified_t wmi_handle,
  1603. uint32_t vdev_id,
  1604. int32_t rssi_change_thresh,
  1605. uint32_t bcn_rssi_weight,
  1606. uint32_t hirssi_delay_btw_scans)
  1607. {
  1608. wmi_buf_t buf = NULL;
  1609. QDF_STATUS status;
  1610. int len;
  1611. uint8_t *buf_ptr;
  1612. wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp;
  1613. /* Send rssi change parameters */
  1614. len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param);
  1615. buf = wmi_buf_alloc(wmi_handle, len);
  1616. if (!buf) {
  1617. return QDF_STATUS_E_NOMEM;
  1618. }
  1619. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1620. rssi_change_fp =
  1621. (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr;
  1622. WMITLV_SET_HDR(&rssi_change_fp->tlv_header,
  1623. WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param,
  1624. WMITLV_GET_STRUCT_TLVLEN
  1625. (wmi_roam_scan_rssi_change_threshold_fixed_param));
  1626. /* fill in rssi change threshold (hysteresis) values */
  1627. rssi_change_fp->vdev_id = vdev_id;
  1628. rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh;
  1629. rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight;
  1630. rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans;
  1631. wmi_mtrace(WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, NO_SESSION, 0);
  1632. status = wmi_unified_cmd_send(wmi_handle, buf,
  1633. len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD);
  1634. if (QDF_IS_STATUS_ERROR(status)) {
  1635. WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD returned Error %d",
  1636. status);
  1637. goto error;
  1638. }
  1639. WMI_LOGD(FL("roam_scan_rssi_change_thresh=%d, bcn_rssi_weight=%d"),
  1640. rssi_change_thresh, bcn_rssi_weight);
  1641. WMI_LOGD(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans);
  1642. return QDF_STATUS_SUCCESS;
  1643. error:
  1644. wmi_buf_free(buf);
  1645. return status;
  1646. }
  1647. /**
  1648. * send_per_roam_config_cmd_tlv() - set per roaming config to FW
  1649. * @wmi_handle: wmi handle
  1650. * @req_buf: per roam config buffer
  1651. *
  1652. * Return: QDF status
  1653. */
  1654. static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle,
  1655. struct wmi_per_roam_config_req *req_buf)
  1656. {
  1657. wmi_buf_t buf = NULL;
  1658. QDF_STATUS status;
  1659. int len;
  1660. uint8_t *buf_ptr;
  1661. wmi_roam_per_config_fixed_param *wmi_per_config;
  1662. len = sizeof(wmi_roam_per_config_fixed_param);
  1663. buf = wmi_buf_alloc(wmi_handle, len);
  1664. if (!buf) {
  1665. return QDF_STATUS_E_NOMEM;
  1666. }
  1667. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1668. wmi_per_config =
  1669. (wmi_roam_per_config_fixed_param *) buf_ptr;
  1670. WMITLV_SET_HDR(&wmi_per_config->tlv_header,
  1671. WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param,
  1672. WMITLV_GET_STRUCT_TLVLEN
  1673. (wmi_roam_per_config_fixed_param));
  1674. /* fill in per roam config values */
  1675. wmi_per_config->vdev_id = req_buf->vdev_id;
  1676. wmi_per_config->enable = req_buf->per_config.enable;
  1677. wmi_per_config->high_rate_thresh =
  1678. (req_buf->per_config.tx_high_rate_thresh << 16) |
  1679. (req_buf->per_config.rx_high_rate_thresh & 0x0000ffff);
  1680. wmi_per_config->low_rate_thresh =
  1681. (req_buf->per_config.tx_low_rate_thresh << 16) |
  1682. (req_buf->per_config.rx_low_rate_thresh & 0x0000ffff);
  1683. wmi_per_config->pkt_err_rate_thresh_pct =
  1684. (req_buf->per_config.tx_rate_thresh_percnt << 16) |
  1685. (req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff);
  1686. wmi_per_config->per_rest_time = req_buf->per_config.per_rest_time;
  1687. wmi_per_config->pkt_err_rate_mon_time =
  1688. (req_buf->per_config.tx_per_mon_time << 16) |
  1689. (req_buf->per_config.rx_per_mon_time & 0x0000ffff);
  1690. wmi_per_config->min_candidate_rssi =
  1691. req_buf->per_config.min_candidate_rssi;
  1692. /* Send per roam config parameters */
  1693. wmi_mtrace(WMI_ROAM_PER_CONFIG_CMDID, NO_SESSION, 0);
  1694. status = wmi_unified_cmd_send(wmi_handle, buf,
  1695. len, WMI_ROAM_PER_CONFIG_CMDID);
  1696. if (QDF_IS_STATUS_ERROR(status)) {
  1697. WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d",
  1698. status);
  1699. wmi_buf_free(buf);
  1700. return status;
  1701. }
  1702. WMI_LOGD(FL("per roam enable=%d, vdev=%d"),
  1703. req_buf->per_config.enable, req_buf->vdev_id);
  1704. return QDF_STATUS_SUCCESS;
  1705. }
  1706. /**
  1707. * send_limit_off_chan_cmd_tlv() - send wmi cmd of limit off chan
  1708. * configuration params
  1709. * @wmi_handle: wmi handler
  1710. * @limit_off_chan_param: pointer to wmi_off_chan_param
  1711. *
  1712. * Return: 0 for success and non zero for failure
  1713. */
  1714. static
  1715. QDF_STATUS send_limit_off_chan_cmd_tlv(wmi_unified_t wmi_handle,
  1716. struct wmi_limit_off_chan_param *limit_off_chan_param)
  1717. {
  1718. wmi_vdev_limit_offchan_cmd_fixed_param *cmd;
  1719. wmi_buf_t buf;
  1720. uint32_t len = sizeof(*cmd);
  1721. int err;
  1722. buf = wmi_buf_alloc(wmi_handle, len);
  1723. if (!buf) {
  1724. return QDF_STATUS_E_NOMEM;
  1725. }
  1726. cmd = (wmi_vdev_limit_offchan_cmd_fixed_param *)wmi_buf_data(buf);
  1727. WMITLV_SET_HDR(&cmd->tlv_header,
  1728. WMITLV_TAG_STRUC_wmi_vdev_limit_offchan_cmd_fixed_param,
  1729. WMITLV_GET_STRUCT_TLVLEN(
  1730. wmi_vdev_limit_offchan_cmd_fixed_param));
  1731. cmd->vdev_id = limit_off_chan_param->vdev_id;
  1732. cmd->flags &= 0;
  1733. if (limit_off_chan_param->status)
  1734. cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_ENABLE;
  1735. if (limit_off_chan_param->skip_dfs_chans)
  1736. cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_SKIP_DFS;
  1737. cmd->max_offchan_time = limit_off_chan_param->max_offchan_time;
  1738. cmd->rest_time = limit_off_chan_param->rest_time;
  1739. WMI_LOGE("%s: vdev_id=%d, flags =%x, max_offchan_time=%d, rest_time=%d",
  1740. __func__, cmd->vdev_id, cmd->flags, cmd->max_offchan_time,
  1741. cmd->rest_time);
  1742. wmi_mtrace(WMI_VDEV_LIMIT_OFFCHAN_CMDID, cmd->vdev_id, 0);
  1743. err = wmi_unified_cmd_send(wmi_handle, buf,
  1744. len, WMI_VDEV_LIMIT_OFFCHAN_CMDID);
  1745. if (QDF_IS_STATUS_ERROR(err)) {
  1746. WMI_LOGE("Failed to send limit off chan cmd err=%d", err);
  1747. wmi_buf_free(buf);
  1748. return QDF_STATUS_E_FAILURE;
  1749. }
  1750. return QDF_STATUS_SUCCESS;
  1751. }
  1752. #ifdef WLAN_FEATURE_FILS_SK
  1753. static QDF_STATUS send_roam_scan_send_hlp_cmd_tlv(wmi_unified_t wmi_handle,
  1754. struct hlp_params *params)
  1755. {
  1756. uint32_t len;
  1757. uint8_t *buf_ptr;
  1758. wmi_buf_t buf = NULL;
  1759. wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param *hlp_params;
  1760. len = sizeof(wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param);
  1761. len += WMI_TLV_HDR_SIZE;
  1762. len += qdf_roundup(params->hlp_ie_len, sizeof(uint32_t));
  1763. buf = wmi_buf_alloc(wmi_handle, len);
  1764. if (!buf) {
  1765. return QDF_STATUS_E_NOMEM;
  1766. }
  1767. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1768. hlp_params = (wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param *) buf_ptr;
  1769. WMITLV_SET_HDR(&hlp_params->tlv_header,
  1770. WMITLV_TAG_STRUC_wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param,
  1771. WMITLV_GET_STRUCT_TLVLEN(
  1772. wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param));
  1773. hlp_params->vdev_id = params->vdev_id;
  1774. hlp_params->size = params->hlp_ie_len;
  1775. hlp_params->pkt_type = WMI_FILS_HLP_PKT_TYPE_DHCP_DISCOVER;
  1776. buf_ptr += sizeof(*hlp_params);
  1777. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
  1778. round_up(params->hlp_ie_len,
  1779. sizeof(uint32_t)));
  1780. buf_ptr += WMI_TLV_HDR_SIZE;
  1781. qdf_mem_copy(buf_ptr, params->hlp_ie, params->hlp_ie_len);
  1782. WMI_LOGD(FL("send FILS HLP pkt vdev %d len %d"),
  1783. hlp_params->vdev_id, hlp_params->size);
  1784. wmi_mtrace(WMI_PDEV_UPDATE_FILS_HLP_PKT_CMDID, NO_SESSION, 0);
  1785. if (wmi_unified_cmd_send(wmi_handle, buf, len,
  1786. WMI_PDEV_UPDATE_FILS_HLP_PKT_CMDID)) {
  1787. WMI_LOGE(FL("Failed to send FILS HLP pkt cmd"));
  1788. wmi_buf_free(buf);
  1789. return QDF_STATUS_E_FAILURE;
  1790. }
  1791. return QDF_STATUS_SUCCESS;
  1792. }
  1793. void wmi_fils_sk_attach_tlv(wmi_unified_t wmi_handle)
  1794. {
  1795. struct wmi_ops *ops = wmi_handle->ops;
  1796. ops->send_roam_scan_hlp_cmd = send_roam_scan_send_hlp_cmd_tlv;
  1797. }
  1798. #endif /* WLAN_FEATURE_FILS_SK */
  1799. /*
  1800. * send_btm_config_cmd_tlv() - Send wmi cmd for BTM config
  1801. * @wmi_handle: wmi handle
  1802. * @params: pointer to wmi_btm_config
  1803. *
  1804. * Return: QDF_STATUS
  1805. */
  1806. static QDF_STATUS send_btm_config_cmd_tlv(wmi_unified_t wmi_handle,
  1807. struct wmi_btm_config *params)
  1808. {
  1809. wmi_btm_config_fixed_param *cmd;
  1810. wmi_buf_t buf;
  1811. uint32_t len;
  1812. len = sizeof(*cmd);
  1813. buf = wmi_buf_alloc(wmi_handle, len);
  1814. if (!buf) {
  1815. return QDF_STATUS_E_NOMEM;
  1816. }
  1817. cmd = (wmi_btm_config_fixed_param *)wmi_buf_data(buf);
  1818. WMITLV_SET_HDR(&cmd->tlv_header,
  1819. WMITLV_TAG_STRUC_wmi_btm_config_fixed_param,
  1820. WMITLV_GET_STRUCT_TLVLEN(wmi_btm_config_fixed_param));
  1821. cmd->vdev_id = params->vdev_id;
  1822. cmd->flags = params->btm_offload_config;
  1823. cmd->max_attempt_cnt = params->btm_max_attempt_cnt;
  1824. cmd->solicited_timeout_ms = params->btm_solicited_timeout;
  1825. cmd->stick_time_seconds = params->btm_sticky_time;
  1826. wmi_mtrace(WMI_ROAM_BTM_CONFIG_CMDID, cmd->vdev_id, 0);
  1827. if (wmi_unified_cmd_send(wmi_handle, buf, len,
  1828. WMI_ROAM_BTM_CONFIG_CMDID)) {
  1829. WMI_LOGE("%s: failed to send WMI_ROAM_BTM_CONFIG_CMDID",
  1830. __func__);
  1831. wmi_buf_free(buf);
  1832. return QDF_STATUS_E_FAILURE;
  1833. }
  1834. return QDF_STATUS_SUCCESS;
  1835. }
  1836. /**
  1837. * send_offload_11k_cmd_tlv() - send wmi cmd with 11k offload params
  1838. * @wmi_handle: wmi handler
  1839. * @params: pointer to 11k offload params
  1840. *
  1841. * Return: 0 for success and non zero for failure
  1842. */
  1843. static QDF_STATUS send_offload_11k_cmd_tlv(wmi_unified_t wmi_handle,
  1844. struct wmi_11k_offload_params *params)
  1845. {
  1846. wmi_11k_offload_report_fixed_param *cmd;
  1847. wmi_buf_t buf;
  1848. QDF_STATUS status;
  1849. uint8_t *buf_ptr;
  1850. wmi_neighbor_report_11k_offload_tlv_param
  1851. *neighbor_report_offload_params;
  1852. wmi_neighbor_report_offload *neighbor_report_offload;
  1853. uint32_t len = sizeof(*cmd);
  1854. if (params->offload_11k_bitmask &
  1855. WMI_11K_OFFLOAD_BITMAP_NEIGHBOR_REPORT_REQ)
  1856. len += WMI_TLV_HDR_SIZE +
  1857. sizeof(wmi_neighbor_report_11k_offload_tlv_param);
  1858. buf = wmi_buf_alloc(wmi_handle, len);
  1859. if (!buf) {
  1860. return QDF_STATUS_E_NOMEM;
  1861. }
  1862. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1863. cmd = (wmi_11k_offload_report_fixed_param *) buf_ptr;
  1864. WMITLV_SET_HDR(&cmd->tlv_header,
  1865. WMITLV_TAG_STRUC_wmi_offload_11k_report_fixed_param,
  1866. WMITLV_GET_STRUCT_TLVLEN(
  1867. wmi_11k_offload_report_fixed_param));
  1868. cmd->vdev_id = params->vdev_id;
  1869. cmd->offload_11k = params->offload_11k_bitmask;
  1870. if (params->offload_11k_bitmask &
  1871. WMI_11K_OFFLOAD_BITMAP_NEIGHBOR_REPORT_REQ) {
  1872. buf_ptr += sizeof(wmi_11k_offload_report_fixed_param);
  1873. WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
  1874. sizeof(wmi_neighbor_report_11k_offload_tlv_param));
  1875. buf_ptr += WMI_TLV_HDR_SIZE;
  1876. neighbor_report_offload_params =
  1877. (wmi_neighbor_report_11k_offload_tlv_param *)buf_ptr;
  1878. WMITLV_SET_HDR(&neighbor_report_offload_params->tlv_header,
  1879. WMITLV_TAG_STRUC_wmi_neighbor_report_offload_tlv_param,
  1880. WMITLV_GET_STRUCT_TLVLEN(
  1881. wmi_neighbor_report_11k_offload_tlv_param));
  1882. neighbor_report_offload = &neighbor_report_offload_params->
  1883. neighbor_rep_ofld_params;
  1884. neighbor_report_offload->time_offset =
  1885. params->neighbor_report_params.time_offset;
  1886. neighbor_report_offload->low_rssi_offset =
  1887. params->neighbor_report_params.low_rssi_offset;
  1888. neighbor_report_offload->bmiss_count_trigger =
  1889. params->neighbor_report_params.bmiss_count_trigger;
  1890. neighbor_report_offload->per_threshold_offset =
  1891. params->neighbor_report_params.per_threshold_offset;
  1892. neighbor_report_offload->neighbor_report_cache_timeout =
  1893. params->neighbor_report_params.
  1894. neighbor_report_cache_timeout;
  1895. neighbor_report_offload->max_neighbor_report_req_cap =
  1896. params->neighbor_report_params.
  1897. max_neighbor_report_req_cap;
  1898. neighbor_report_offload->ssid.ssid_len =
  1899. params->neighbor_report_params.ssid.length;
  1900. qdf_mem_copy(neighbor_report_offload->ssid.ssid,
  1901. &params->neighbor_report_params.ssid.mac_ssid,
  1902. neighbor_report_offload->ssid.ssid_len);
  1903. }
  1904. wmi_mtrace(WMI_11K_OFFLOAD_REPORT_CMDID, cmd->vdev_id, 0);
  1905. status = wmi_unified_cmd_send(wmi_handle, buf, len,
  1906. WMI_11K_OFFLOAD_REPORT_CMDID);
  1907. if (status != QDF_STATUS_SUCCESS) {
  1908. WMI_LOGE("%s: failed to send 11k offload command %d",
  1909. __func__, status);
  1910. wmi_buf_free(buf);
  1911. }
  1912. return status;
  1913. }
  1914. /**
  1915. * send_invoke_neighbor_report_cmd_tlv() - send invoke 11k neighbor report
  1916. * command
  1917. * @wmi_handle: wmi handler
  1918. * @params: pointer to neighbor report invoke params
  1919. *
  1920. * Return: 0 for success and non zero for failure
  1921. */
  1922. static QDF_STATUS send_invoke_neighbor_report_cmd_tlv(wmi_unified_t wmi_handle,
  1923. struct wmi_invoke_neighbor_report_params *params)
  1924. {
  1925. wmi_11k_offload_invoke_neighbor_report_fixed_param *cmd;
  1926. wmi_buf_t buf;
  1927. QDF_STATUS status;
  1928. uint8_t *buf_ptr;
  1929. uint32_t len = sizeof(*cmd);
  1930. buf = wmi_buf_alloc(wmi_handle, len);
  1931. if (!buf) {
  1932. return QDF_STATUS_E_NOMEM;
  1933. }
  1934. buf_ptr = (uint8_t *) wmi_buf_data(buf);
  1935. cmd = (wmi_11k_offload_invoke_neighbor_report_fixed_param *) buf_ptr;
  1936. WMITLV_SET_HDR(&cmd->tlv_header,
  1937. WMITLV_TAG_STRUC_wmi_invoke_neighbor_report_fixed_param,
  1938. WMITLV_GET_STRUCT_TLVLEN(
  1939. wmi_11k_offload_invoke_neighbor_report_fixed_param));
  1940. cmd->vdev_id = params->vdev_id;
  1941. cmd->flags = params->send_resp_to_host;
  1942. cmd->ssid.ssid_len = params->ssid.length;
  1943. qdf_mem_copy(cmd->ssid.ssid,
  1944. &params->ssid.mac_ssid,
  1945. cmd->ssid.ssid_len);
  1946. wmi_mtrace(WMI_11K_INVOKE_NEIGHBOR_REPORT_CMDID, cmd->vdev_id, 0);
  1947. status = wmi_unified_cmd_send(wmi_handle, buf, len,
  1948. WMI_11K_INVOKE_NEIGHBOR_REPORT_CMDID);
  1949. if (status != QDF_STATUS_SUCCESS) {
  1950. WMI_LOGE("%s: failed to send invoke neighbor report command %d",
  1951. __func__, status);
  1952. wmi_buf_free(buf);
  1953. }
  1954. return status;
  1955. }
  1956. void wmi_roam_attach_tlv(wmi_unified_t wmi_handle)
  1957. {
  1958. struct wmi_ops *ops = wmi_handle->ops;
  1959. ops->send_roam_scan_offload_rssi_thresh_cmd =
  1960. send_roam_scan_offload_rssi_thresh_cmd_tlv;
  1961. ops->send_roam_mawc_params_cmd = send_roam_mawc_params_cmd_tlv;
  1962. ops->send_roam_scan_filter_cmd =
  1963. send_roam_scan_filter_cmd_tlv;
  1964. ops->send_roam_scan_offload_mode_cmd =
  1965. send_roam_scan_offload_mode_cmd_tlv;
  1966. ops->send_roam_scan_offload_ap_profile_cmd =
  1967. send_roam_scan_offload_ap_profile_cmd_tlv;
  1968. ops->send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv;
  1969. ops->send_roam_scan_offload_scan_period_cmd =
  1970. send_roam_scan_offload_scan_period_cmd_tlv;
  1971. ops->send_roam_scan_offload_chan_list_cmd =
  1972. send_roam_scan_offload_chan_list_cmd_tlv;
  1973. ops->send_roam_scan_offload_rssi_change_cmd =
  1974. send_roam_scan_offload_rssi_change_cmd_tlv;
  1975. ops->send_per_roam_config_cmd = send_per_roam_config_cmd_tlv;
  1976. ops->send_limit_off_chan_cmd = send_limit_off_chan_cmd_tlv;
  1977. ops->send_btm_config = send_btm_config_cmd_tlv;
  1978. ops->send_offload_11k_cmd = send_offload_11k_cmd_tlv;
  1979. ops->send_invoke_neighbor_report_cmd =
  1980. send_invoke_neighbor_report_cmd_tlv;
  1981. wmi_lfr_subnet_detection_attach_tlv(wmi_handle);
  1982. wmi_rssi_monitor_attach_tlv(wmi_handle);
  1983. wmi_ese_attach_tlv(wmi_handle);
  1984. wmi_roam_offload_attach_tlv(wmi_handle);
  1985. wmi_fils_sk_attach_tlv(wmi_handle);
  1986. }