old mode 100644new mode 100755.. | .. |
---|
23 | 23 | #include "rwnx_events.h" |
---|
24 | 24 | #include "rwnx_compat.h" |
---|
25 | 25 | #include "aicwf_txrxif.h" |
---|
| 26 | +#include "rwnx_msg_rx.h" |
---|
26 | 27 | |
---|
27 | 28 | static int rwnx_freq_to_idx(struct rwnx_hw *rwnx_hw, int freq) |
---|
28 | 29 | { |
---|
.. | .. |
---|
61 | 62 | struct rwnx_vif *rwnx_vif; |
---|
62 | 63 | int chan_idx = ((struct mm_channel_pre_switch_ind *)msg->param)->chan_index; |
---|
63 | 64 | |
---|
64 | | - RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
65 | | - |
---|
66 | 65 | REG_SW_SET_PROFILING_CHAN(rwnx_hw, SW_PROF_CHAN_CTXT_PSWTCH_BIT); |
---|
67 | 66 | |
---|
68 | 67 | #ifdef CONFIG_RWNX_FULLMAC |
---|
69 | 68 | list_for_each_entry(rwnx_vif, &rwnx_hw->vifs, list) { |
---|
70 | | - if (rwnx_vif->up && rwnx_vif->ch_index == chan_idx) { |
---|
71 | | - printk("rwnx_txq_vif_stop\r\n"); |
---|
72 | | - rwnx_txq_vif_stop(rwnx_vif, RWNX_TXQ_STOP_CHAN, rwnx_hw); |
---|
73 | | - } |
---|
| 69 | + if (rwnx_vif->up && rwnx_vif->ch_index == chan_idx) { |
---|
| 70 | + rwnx_txq_vif_stop(rwnx_vif, RWNX_TXQ_STOP_CHAN, rwnx_hw); |
---|
| 71 | + } |
---|
74 | 72 | } |
---|
75 | 73 | #endif /* CONFIG_RWNX_FULLMAC */ |
---|
76 | 74 | |
---|
.. | .. |
---|
88 | 86 | bool roc = ((struct mm_channel_switch_ind *)msg->param)->roc; |
---|
89 | 87 | bool roc_tdls = ((struct mm_channel_switch_ind *)msg->param)->roc_tdls; |
---|
90 | 88 | |
---|
91 | | - RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
92 | | - |
---|
93 | 89 | REG_SW_SET_PROFILING_CHAN(rwnx_hw, SW_PROF_CHAN_CTXT_SWTCH_BIT); |
---|
94 | 90 | |
---|
95 | 91 | #ifdef CONFIG_RWNX_FULLMAC |
---|
.. | .. |
---|
97 | 93 | u8 vif_index = ((struct mm_channel_switch_ind *)msg->param)->vif_index; |
---|
98 | 94 | list_for_each_entry(rwnx_vif, &rwnx_hw->vifs, list) { |
---|
99 | 95 | if (rwnx_vif->vif_index == vif_index) { |
---|
100 | | - rwnx_vif->roc_tdls = true; |
---|
101 | | - rwnx_txq_tdls_sta_start(rwnx_vif, RWNX_TXQ_STOP_CHAN, rwnx_hw); |
---|
| 96 | + rwnx_vif->roc_tdls = true; |
---|
| 97 | + rwnx_txq_tdls_sta_start(rwnx_vif, RWNX_TXQ_STOP_CHAN, rwnx_hw); |
---|
102 | 98 | } |
---|
103 | | - } |
---|
104 | | - } else if (!roc) { |
---|
105 | | - list_for_each_entry(rwnx_vif, &rwnx_hw->vifs, list) { |
---|
106 | | - if (rwnx_vif->up && rwnx_vif->ch_index == chan_idx) { |
---|
107 | | - rwnx_txq_vif_start(rwnx_vif, RWNX_TXQ_STOP_CHAN, rwnx_hw); |
---|
108 | 99 | } |
---|
109 | | - } |
---|
| 100 | + } else if (!roc) { |
---|
| 101 | + list_for_each_entry(rwnx_vif, &rwnx_hw->vifs, list) { |
---|
| 102 | + if (rwnx_vif->up && rwnx_vif->ch_index == chan_idx) { |
---|
| 103 | + rwnx_txq_vif_start(rwnx_vif, RWNX_TXQ_STOP_CHAN, rwnx_hw); |
---|
| 104 | + } |
---|
| 105 | + } |
---|
110 | 106 | } else { |
---|
111 | 107 | /* Retrieve the allocated RoC element */ |
---|
112 | 108 | struct rwnx_roc_elem *roc_elem = rwnx_hw->roc_elem; |
---|
.. | .. |
---|
116 | 112 | /* For debug purpose (use ftrace kernel option) */ |
---|
117 | 113 | //trace_switch_roc(rwnx_vif->vif_index); |
---|
118 | 114 | |
---|
119 | | - /* If mgmt_roc is true, remain on channel has been started by ourself */ |
---|
120 | | - if (!roc_elem->mgmt_roc) { |
---|
121 | | - /* Inform the host that we have switch on the indicated off-channel */ |
---|
122 | | - cfg80211_ready_on_channel(roc_elem->wdev, (u64)(rwnx_hw->roc_cookie_cnt), |
---|
| 115 | + if (roc_elem) { |
---|
| 116 | + /* If mgmt_roc is true, remain on channel has been started by ourself */ |
---|
| 117 | + if (!roc_elem->mgmt_roc) { |
---|
| 118 | + /* Inform the host that we have switch on the indicated off-channel */ |
---|
| 119 | + cfg80211_ready_on_channel(roc_elem->wdev, (u64)(rwnx_hw->roc_cookie_cnt), |
---|
123 | 120 | roc_elem->chan, roc_elem->duration, GFP_ATOMIC); |
---|
| 121 | + } |
---|
| 122 | + |
---|
| 123 | + /* Keep in mind that we have switched on the channel */ |
---|
| 124 | + roc_elem->on_chan = true; |
---|
| 125 | + } else { |
---|
| 126 | + printk("roc_elem == null\n"); |
---|
124 | 127 | } |
---|
125 | | - |
---|
126 | | - /* Keep in mind that we have switched on the channel */ |
---|
127 | | - roc_elem->on_chan = true; |
---|
128 | | - |
---|
129 | 128 | // Enable traffic on OFF channel queue |
---|
130 | 129 | rwnx_txq_offchan_start(rwnx_hw); |
---|
131 | 130 | } |
---|
.. | .. |
---|
210 | 209 | /* Retrieve the allocated RoC element */ |
---|
211 | 210 | struct rwnx_roc_elem *roc_elem = rwnx_hw->roc_elem; |
---|
212 | 211 | /* Get VIF on which RoC has been started */ |
---|
213 | | - struct rwnx_vif *rwnx_vif = container_of(roc_elem->wdev, struct rwnx_vif, wdev); |
---|
| 212 | + struct rwnx_vif *rwnx_vif; |
---|
214 | 213 | |
---|
215 | 214 | RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
216 | 215 | |
---|
217 | | - /* For debug purpose (use ftrace kernel option) */ |
---|
218 | | - trace_roc_exp(rwnx_vif->vif_index); |
---|
| 216 | + if (!roc_elem) |
---|
| 217 | + return 0; |
---|
219 | 218 | |
---|
| 219 | + rwnx_vif = container_of(roc_elem->wdev, struct rwnx_vif, wdev); |
---|
| 220 | + /* For debug purpose (use ftrace kernel option) */ |
---|
| 221 | +#ifdef CREATE_TRACE_POINTS |
---|
| 222 | + trace_roc_exp(rwnx_vif->vif_index); |
---|
| 223 | +#endif |
---|
220 | 224 | /* If mgmt_roc is true, remain on channel has been started by ourself */ |
---|
221 | 225 | /* If RoC has been cancelled before we switched on channel, do not call cfg80211 */ |
---|
222 | 226 | if (!roc_elem->mgmt_roc && roc_elem->on_chan) { |
---|
.. | .. |
---|
251 | 255 | int ps_state = ((struct mm_p2p_vif_ps_change_ind *)msg->param)->ps_state; |
---|
252 | 256 | struct rwnx_vif *vif_entry; |
---|
253 | 257 | |
---|
254 | | - RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
| 258 | + //RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
255 | 259 | |
---|
256 | 260 | #ifdef CONFIG_RWNX_FULLMAC |
---|
257 | 261 | vif_entry = rwnx_hw->vif_table[vif_idx]; |
---|
.. | .. |
---|
269 | 273 | if (ps_state == MM_PS_MODE_OFF) { |
---|
270 | 274 | // Start TX queues for provided VIF |
---|
271 | 275 | rwnx_txq_vif_start(vif_entry, RWNX_TXQ_STOP_VIF_PS, rwnx_hw); |
---|
| 276 | + tasklet_schedule(&rwnx_hw->task); |
---|
272 | 277 | } else { |
---|
273 | 278 | // Stop TX queues for provided VIF |
---|
274 | 279 | rwnx_txq_vif_stop(vif_entry, RWNX_TXQ_STOP_VIF_PS, rwnx_hw); |
---|
.. | .. |
---|
288 | 293 | int idx = rwnx_freq_to_idx(rwnx_hw, ind->freq); |
---|
289 | 294 | // Get the survey |
---|
290 | 295 | struct rwnx_survey_info *rwnx_survey; |
---|
291 | | - |
---|
292 | | - RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
293 | 296 | |
---|
294 | 297 | if (idx > ARRAY_SIZE(rwnx_hw->survey)) |
---|
295 | 298 | return 0; |
---|
.. | .. |
---|
359 | 362 | ind->num_packets, GFP_ATOMIC); |
---|
360 | 363 | } |
---|
361 | 364 | #endif /* CONFIG_RWNX_FULLMAC */ |
---|
| 365 | + |
---|
| 366 | + return 0; |
---|
| 367 | +} |
---|
| 368 | + |
---|
| 369 | +static inline int rwnx_apm_staloss_ind(struct rwnx_hw *rwnx_hw, |
---|
| 370 | + struct rwnx_cmd *cmd, |
---|
| 371 | + struct ipc_e2a_msg *msg) |
---|
| 372 | +{ |
---|
| 373 | + struct mm_apm_staloss_ind *ind = (struct mm_apm_staloss_ind *)msg->param; |
---|
| 374 | + |
---|
| 375 | + RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
| 376 | + |
---|
| 377 | + memcpy(rwnx_hw->sta_mac_addr, ind->mac_addr, 6); |
---|
| 378 | + rwnx_hw->apm_vif_idx = ind->vif_idx; |
---|
| 379 | + |
---|
| 380 | + queue_work(rwnx_hw->apmStaloss_wq, &rwnx_hw->apmStalossWork); |
---|
362 | 381 | |
---|
363 | 382 | return 0; |
---|
364 | 383 | } |
---|
.. | .. |
---|
473 | 492 | struct mm_ps_change_ind *ind = (struct mm_ps_change_ind *)msg->param; |
---|
474 | 493 | struct rwnx_sta *sta = &rwnx_hw->sta_table[ind->sta_idx]; |
---|
475 | 494 | |
---|
476 | | - RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
477 | | - |
---|
478 | 495 | if (ind->sta_idx >= (NX_REMOTE_STA_MAX + NX_VIRT_DEV_MAX)) { |
---|
479 | 496 | wiphy_err(rwnx_hw->wiphy, "Invalid sta index reported by fw %d\n", |
---|
480 | 497 | ind->sta_idx); |
---|
.. | .. |
---|
490 | 507 | } else if (rwnx_hw->adding_sta) { |
---|
491 | 508 | sta->ps.active = ind->ps_state ? true : false; |
---|
492 | 509 | } else { |
---|
493 | | - netdev_err(rwnx_hw->vif_table[sta->vif_idx]->ndev, |
---|
| 510 | + if (rwnx_hw->vif_table[sta->vif_idx]->ndev) |
---|
| 511 | + netdev_err(rwnx_hw->vif_table[sta->vif_idx]->ndev, |
---|
494 | 512 | "Ignore PS mode change on invalid sta\n"); |
---|
495 | 513 | } |
---|
496 | 514 | |
---|
.. | .. |
---|
555 | 573 | { |
---|
556 | 574 | RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
557 | 575 | |
---|
558 | | - scanning = 0; |
---|
559 | | - //rwnx_ipc_elem_var_deallocs(rwnx_hw, &rwnx_hw->scan_ie); |
---|
560 | 576 | if (rwnx_hw->scan_request) { |
---|
561 | 577 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) |
---|
562 | 578 | struct cfg80211_scan_info info = { |
---|
.. | .. |
---|
570 | 586 | } |
---|
571 | 587 | |
---|
572 | 588 | rwnx_hw->scan_request = NULL; |
---|
| 589 | + scanning = 0; |
---|
573 | 590 | |
---|
574 | 591 | return 0; |
---|
575 | 592 | } |
---|
.. | .. |
---|
587 | 604 | size_t ielen; |
---|
588 | 605 | u16 capability, beacon_interval; |
---|
589 | 606 | u16 len = ind->length; |
---|
590 | | - RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
591 | 607 | |
---|
592 | 608 | chan = ieee80211_get_channel(rwnx_hw->wiphy, ind->center_freq); |
---|
593 | 609 | |
---|
.. | .. |
---|
597 | 613 | ts = ktime_to_timespec(ktime_get_boottime()); |
---|
598 | 614 | tsf = (u64)ts.tv_sec * 1000000 + div_u64(ts.tv_nsec, 1000); |
---|
599 | 615 | mgmt->u.probe_resp.timestamp = ((u64)ts.tv.sec*1000000) + ts.tv.nsec/1000; |
---|
600 | | -#else |
---|
| 616 | +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) |
---|
601 | 617 | struct timespec ts; |
---|
602 | 618 | ts = ktime_to_timespec(ktime_get_boottime()); |
---|
| 619 | + tsf = (u64)ts.tv_sec * 1000000 + div_u64(ts.tv_nsec, 1000); |
---|
| 620 | + mgmt->u.probe_resp.timestamp = tsf; |
---|
| 621 | +#else |
---|
| 622 | + struct timespec64 ts; |
---|
| 623 | + ts = ktime_to_timespec64(ktime_get_boottime()); |
---|
603 | 624 | tsf = (u64)ts.tv_sec * 1000000 + div_u64(ts.tv_nsec, 1000); |
---|
604 | 625 | mgmt->u.probe_resp.timestamp = tsf; |
---|
605 | 626 | #endif |
---|
.. | .. |
---|
613 | 634 | CFG80211_BSS_FTYPE_UNKNOWN, |
---|
614 | 635 | #endif |
---|
615 | 636 | mgmt->bssid, tsf, capability, beacon_interval, |
---|
616 | | - ie, ielen, ind->rssi * 100, GFP_KERNEL); |
---|
| 637 | + ie, ielen, ind->rssi * 100, GFP_ATOMIC); |
---|
617 | 638 | } |
---|
618 | 639 | |
---|
619 | 640 | if (bss != NULL) |
---|
.. | .. |
---|
719 | 740 | memcpy(sta->ac_param, ind->ac_param, sizeof(sta->ac_param)); |
---|
720 | 741 | rwnx_txq_sta_init(rwnx_hw, sta, txq_status); |
---|
721 | 742 | rwnx_txq_tdls_vif_init(rwnx_vif); |
---|
722 | | - #if 0 |
---|
| 743 | +#ifdef CONFIG_DEBUG_FS |
---|
723 | 744 | rwnx_dbgfs_register_rc_stat(rwnx_hw, sta); |
---|
724 | | - #endif |
---|
| 745 | +#endif |
---|
725 | 746 | rwnx_mu_group_sta_init(sta, NULL); |
---|
726 | 747 | /* Look for TDLS Channel Switch Prohibited flag in the Extended Capability |
---|
727 | 748 | * Information Element*/ |
---|
.. | .. |
---|
730 | 751 | extcap = (void *)(extcap_ie); |
---|
731 | 752 | rwnx_vif->tdls_chsw_prohibited = extcap->ext_capab[4] & WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED; |
---|
732 | 753 | } |
---|
| 754 | + |
---|
| 755 | + if (rwnx_vif->wep_enabled) |
---|
| 756 | + rwnx_vif->wep_auth_err = false; |
---|
733 | 757 | |
---|
734 | 758 | #ifdef CONFIG_RWNX_BFMER |
---|
735 | 759 | /* If Beamformer feature is activated, check if features can be used |
---|
.. | .. |
---|
819 | 843 | { |
---|
820 | 844 | struct sm_disconnect_ind *ind = (struct sm_disconnect_ind *)msg->param; |
---|
821 | 845 | struct rwnx_vif *rwnx_vif = rwnx_hw->vif_table[ind->vif_idx]; |
---|
822 | | - struct net_device *dev = rwnx_vif->ndev; |
---|
| 846 | + struct net_device *dev; |
---|
823 | 847 | #ifdef AICWF_RX_REORDER |
---|
824 | 848 | struct reord_ctrl_info *reord_info, *tmp; |
---|
825 | 849 | u8 *macaddr; |
---|
.. | .. |
---|
828 | 852 | |
---|
829 | 853 | RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
830 | 854 | dhcped = 0; |
---|
| 855 | + |
---|
| 856 | + if (!rwnx_vif) |
---|
| 857 | + return 0; |
---|
| 858 | + dev = rwnx_vif->ndev; |
---|
831 | 859 | |
---|
832 | 860 | if (rwnx_vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) |
---|
833 | 861 | rwnx_hw->is_p2p_connected = 0; |
---|
.. | .. |
---|
856 | 884 | macaddr = rwnx_vif->ndev->dev_addr; |
---|
857 | 885 | printk("deinit:macaddr:%x,%x,%x,%x,%x,%x\r\n", macaddr[0], macaddr[1], macaddr[2], \ |
---|
858 | 886 | macaddr[3], macaddr[4], macaddr[5]); |
---|
859 | | - |
---|
860 | 887 | spin_lock_bh(&rx_priv->stas_reord_lock); |
---|
861 | 888 | list_for_each_entry_safe(reord_info, tmp, &rx_priv->stas_reord_list, list) { |
---|
862 | 889 | macaddr = rwnx_vif->ndev->dev_addr; |
---|
.. | .. |
---|
893 | 920 | struct sm_external_auth_required_ind *ind = |
---|
894 | 921 | (struct sm_external_auth_required_ind *)msg->param; |
---|
895 | 922 | struct rwnx_vif *rwnx_vif = rwnx_hw->vif_table[ind->vif_idx]; |
---|
896 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) |
---|
| 923 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) || defined(CONFIG_WPA3_FOR_OLD_KERNEL) |
---|
897 | 924 | struct net_device *dev = rwnx_vif->ndev; |
---|
898 | 925 | struct cfg80211_external_auth_params params; |
---|
899 | 926 | |
---|
.. | .. |
---|
989 | 1016 | } |
---|
990 | 1017 | |
---|
991 | 1018 | rwnx_txq_sta_init(rwnx_hw, rwnx_sta, txq_status); |
---|
| 1019 | +#ifdef CONFIG_DEBUG_FS |
---|
992 | 1020 | rwnx_dbgfs_register_rc_stat(rwnx_hw, rwnx_sta); |
---|
993 | | - |
---|
| 1021 | +#endif |
---|
994 | 1022 | #ifdef CONFIG_RWNX_BFMER |
---|
995 | 1023 | // TODO: update indication to contains vht capabilties |
---|
996 | 1024 | if (rwnx_hw->mod_params->bfmer) |
---|
.. | .. |
---|
1011 | 1039 | list_del_init(&rwnx_sta->list); |
---|
1012 | 1040 | |
---|
1013 | 1041 | rwnx_txq_sta_deinit(rwnx_hw, rwnx_sta); |
---|
| 1042 | +#ifdef CONFIG_DEBUG_FS |
---|
1014 | 1043 | rwnx_dbgfs_unregister_rc_stat(rwnx_hw, rwnx_sta); |
---|
| 1044 | +#endif |
---|
1015 | 1045 | } else { |
---|
1016 | 1046 | WARN_ON(0); |
---|
1017 | 1047 | } |
---|
.. | .. |
---|
1027 | 1057 | list_del_init(&rwnx_sta->list); |
---|
1028 | 1058 | |
---|
1029 | 1059 | rwnx_txq_sta_deinit(rwnx_hw, rwnx_sta); |
---|
| 1060 | +#ifdef CONFIG_DEBUG_FS |
---|
1030 | 1061 | rwnx_dbgfs_unregister_rc_stat(rwnx_hw, rwnx_sta); |
---|
| 1062 | +#endif |
---|
1031 | 1063 | } else { |
---|
1032 | 1064 | WARN_ON(0); |
---|
1033 | 1065 | } |
---|
.. | .. |
---|
1064 | 1096 | /* Check if element has been deleted */ |
---|
1065 | 1097 | if (ind->delete) { |
---|
1066 | 1098 | if (found) { |
---|
| 1099 | +#ifdef CREATE_TRACE_POINTS |
---|
1067 | 1100 | trace_mesh_delete_path(mesh_path); |
---|
| 1101 | +#endif |
---|
1068 | 1102 | /* Remove element from list */ |
---|
1069 | 1103 | list_del_init(&mesh_path->list); |
---|
1070 | 1104 | /* Free the element */ |
---|
.. | .. |
---|
1074 | 1108 | if (found) { |
---|
1075 | 1109 | // Update the Next Hop STA |
---|
1076 | 1110 | mesh_path->p_nhop_sta = &rwnx_hw->sta_table[ind->nhop_sta_idx]; |
---|
| 1111 | +#ifdef CREATE_TRACE_POINTS |
---|
1077 | 1112 | trace_mesh_update_path(mesh_path); |
---|
| 1113 | +#endif |
---|
1078 | 1114 | } else { |
---|
1079 | 1115 | // Allocate a Mesh Path structure |
---|
1080 | 1116 | mesh_path = (struct rwnx_mesh_path *)kmalloc(sizeof(struct rwnx_mesh_path), GFP_ATOMIC); |
---|
.. | .. |
---|
1088 | 1124 | |
---|
1089 | 1125 | // Insert the path in the list of path |
---|
1090 | 1126 | list_add_tail(&mesh_path->list, &rwnx_vif->ap.mpath_list); |
---|
1091 | | - |
---|
| 1127 | +#ifdef CREATE_TRACE_POINTS |
---|
1092 | 1128 | trace_mesh_create_path(mesh_path); |
---|
| 1129 | +#endif |
---|
1093 | 1130 | } |
---|
1094 | 1131 | } |
---|
1095 | 1132 | } |
---|
.. | .. |
---|
1164 | 1201 | { |
---|
1165 | 1202 | RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
1166 | 1203 | |
---|
1167 | | - rwnx_error_ind(rwnx_hw); |
---|
1168 | | - |
---|
1169 | 1204 | return 0; |
---|
1170 | 1205 | } |
---|
1171 | 1206 | |
---|
.. | .. |
---|
1185 | 1220 | [MSG_I(MM_P2P_NOA_UPD_IND)] = rwnx_rx_p2p_noa_upd_ind, |
---|
1186 | 1221 | [MSG_I(MM_RSSI_STATUS_IND)] = rwnx_rx_rssi_status_ind, |
---|
1187 | 1222 | [MSG_I(MM_PKTLOSS_IND)] = rwnx_rx_pktloss_notify_ind, |
---|
| 1223 | + [MSG_I(MM_APM_STALOSS_IND)] = rwnx_apm_staloss_ind, |
---|
1188 | 1224 | }; |
---|
1189 | 1225 | |
---|
1190 | 1226 | static msg_cb_fct scan_hdlrs[MSG_I(SCANU_MAX)] = { |
---|
.. | .. |
---|
1247 | 1283 | rwnx_hw->cmd_mgr->msgind(rwnx_hw->cmd_mgr, msg, |
---|
1248 | 1284 | msg_hdlrs[MSG_T(msg->id)][MSG_I(msg->id)]); |
---|
1249 | 1285 | } |
---|
| 1286 | + |
---|
| 1287 | +void rwnx_rx_handle_print(struct rwnx_hw *rwnx_hw, u8 *msg, u32 len) |
---|
| 1288 | +{ |
---|
| 1289 | + u8 *data_end = NULL; |
---|
| 1290 | + (void)data_end; |
---|
| 1291 | + |
---|
| 1292 | + if (!rwnx_hw || !rwnx_hw->fwlog_en) { |
---|
| 1293 | + pr_err("FWLOG-OVFL: %s", msg); |
---|
| 1294 | + return; |
---|
| 1295 | + } |
---|
| 1296 | + |
---|
| 1297 | + printk("FWLOG: %s", msg); |
---|
| 1298 | + |
---|
| 1299 | +#ifdef CONFIG_RWNX_DEBUGFS |
---|
| 1300 | + data_end = rwnx_hw->debugfs.fw_log.buf.dataend; |
---|
| 1301 | + |
---|
| 1302 | + if (!rwnx_hw->debugfs.fw_log.buf.data) |
---|
| 1303 | + return ; |
---|
| 1304 | + |
---|
| 1305 | + //printk("end=%lx, len=%d\n", (unsigned long)rwnx_hw->debugfs.fw_log.buf.end, len); |
---|
| 1306 | + |
---|
| 1307 | + spin_lock_bh(&rwnx_hw->debugfs.fw_log.lock); |
---|
| 1308 | + |
---|
| 1309 | + if (rwnx_hw->debugfs.fw_log.buf.end + len > data_end) { |
---|
| 1310 | + int rem = data_end - rwnx_hw->debugfs.fw_log.buf.end; |
---|
| 1311 | + memcpy(rwnx_hw->debugfs.fw_log.buf.end, msg, rem); |
---|
| 1312 | + memcpy(rwnx_hw->debugfs.fw_log.buf.data, &msg[rem], len - rem); |
---|
| 1313 | + rwnx_hw->debugfs.fw_log.buf.end = rwnx_hw->debugfs.fw_log.buf.data + (len - rem); |
---|
| 1314 | + } else { |
---|
| 1315 | + memcpy(rwnx_hw->debugfs.fw_log.buf.end, msg, len); |
---|
| 1316 | + rwnx_hw->debugfs.fw_log.buf.end += len; |
---|
| 1317 | + } |
---|
| 1318 | + |
---|
| 1319 | + rwnx_hw->debugfs.fw_log.buf.size += len; |
---|
| 1320 | + if (rwnx_hw->debugfs.fw_log.buf.size > FW_LOG_SIZE) |
---|
| 1321 | + rwnx_hw->debugfs.fw_log.buf.size = FW_LOG_SIZE; |
---|
| 1322 | + |
---|
| 1323 | + spin_unlock_bh(&rwnx_hw->debugfs.fw_log.lock); |
---|
| 1324 | +#endif |
---|
| 1325 | +} |
---|
| 1326 | + |
---|