hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/******************************************************************************
 *
 * Copyright(c) 2019 Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 *****************************************************************************/
#ifndef _PHL_MR_H_
#define _PHL_MR_H_
 
static inline int
phl_mr_get_chanctx_num(struct phl_info_t *phl_info, struct hw_band_ctl_t *band_ctrl)
{
   void *drv = phl_to_drvpriv(phl_info);
   int chanctx_num = 0;
 
   _os_spinlock(drv, &band_ctrl->chan_ctx_queue.lock, _bh, NULL);
   chanctx_num = band_ctrl->chan_ctx_queue.cnt;
   _os_spinunlock(drv, &band_ctrl->chan_ctx_queue.lock, _bh, NULL);
   return chanctx_num;
}
 
static inline u8
phl_mr_get_role_num(struct phl_info_t *phl_info,
               struct hw_band_ctl_t *band_ctrl)
{
   void *drv = phl_to_drvpriv(phl_info);
   u8 i;
   u8 role_num = 0;
 
   _os_spinlock(drv, &band_ctrl->lock, _bh, NULL);
   for (i = 0; i < MAX_WIFI_ROLE_NUMBER; i++) {
       if (band_ctrl->role_map & BIT(i)) {
           role_num++;
       }
   }
   _os_spinunlock(drv, &band_ctrl->lock, _bh, NULL);
 
   return role_num;
}
 
enum rtw_phl_status
phl_mr_sync_chandef(struct phl_info_t *phl_info, struct hw_band_ctl_t *band_ctrl,
           struct rtw_chan_ctx *chanctx, struct rtw_chan_def *chandef);
 
enum rtw_phl_status
phl_mr_chandef_chg(struct phl_info_t *phl,
                   struct rtw_wifi_role_t *wrole,
                   struct rtw_wifi_role_link_t *rlink,
                   struct rtw_chan_def *new_chan,
                   struct rtw_chan_def *chctx_result);
 
enum rtw_phl_status
phl_mr_chandef_upt(struct phl_info_t *phl_info,
       struct hw_band_ctl_t *band_ctrl, struct rtw_chan_ctx *chanctx);
 
int phl_mr_get_chandef_by_band(struct phl_info_t *phl_info,
                   enum phl_band_idx band_idx,
                   struct rtw_chan_def *chandef);
 
enum rtw_phl_status
phl_mr_get_chandef(struct phl_info_t *phl_info,
                   struct rtw_wifi_role_t *wifi_role,
                   struct rtw_wifi_role_link_t *rlink,
                   bool sync,
                   struct rtw_chan_def *chandef);
 
struct rtw_wifi_role_t *
phl_mr_get_role_by_bandidx(struct phl_info_t *phl_info, u8 band_idx);
 
enum rtw_phl_status
phl_mr_ctrl_init(struct phl_info_t *phl_info);
 
enum rtw_phl_status
phl_mr_ctrl_deinit(struct phl_info_t *phl_info);
 
enum rtw_phl_status
phl_mr_err_recovery(struct phl_info_t *phl, enum phl_msg_evt_id eid);
 
 
enum rtw_phl_status
phl_mr_info_upt(struct phl_info_t *phl_info, struct rtw_wifi_role_link_t *rlink);
 
enum rtw_phl_status
rtw_phl_mr_rx_filter_opt(void *phl, struct rtw_wifi_role_link_t *rlink);
 
enum rtw_phl_status
rtw_phl_mr_set_rxfltr_type_by_mode(void *phl, struct rtw_wifi_role_link_t *rlink,
                  enum rtw_rxfltr_type_mode mode);
 
/* Base value of tsf sync offset */
#define PHL_MR_TSF_SYNC_BASE_OFFSET 50
/* Positive and negative offset values for tsf sync */
#define PHL_MR_TSF_SYNC_OFFSET_RANGE 25
enum rtw_phl_status
phl_mr_tsf_sync(void *phl,
       struct rtw_wifi_role_t *wrole,
       struct rtw_wifi_role_link_t *rlink,
       enum role_state state);
 
void phl_mr_stop_all_beacon(struct phl_info_t *phl_info,
                            struct rtw_wifi_role_t *wrole,
                            u8 band_idx,
                            bool stop);
 
enum rtw_phl_status
phl_mr_offch_hdl(struct phl_info_t *phl_info,
                 struct rtw_wifi_role_t *wrole,
                 struct rtw_wifi_role_link_t *rlink,
                 bool off_ch,
                 void *obj_priv,
                 bool (*issue_null_data)(void *priv, u8 ridx, u8 lidx, bool ps)
);
 
enum rtw_phl_status phl_mr_watchdog(struct phl_info_t *phl_info);
 
u8 rtw_phl_mr_get_opch_list(void *phl, u8 hw_band,
                            struct rtw_chan_def *chdef_list, u8 list_size,
                            struct rtw_wifi_role_link_t *rlink[], u8 rlink_num);
 
void
phl_mr_check_ecsa(struct phl_info_t *phl_info,
                  enum phl_band_idx hw_band
);
 
struct rtw_wifi_role_link_t *
phl_mr_get_first_rlink_by_band(struct phl_info_t *phl,
               enum phl_band_idx band);
 
struct rtw_wifi_role_link_t *
phl_mr_get_rlink_stay_in_cur_chdef(struct phl_info_t *phl,
               enum phl_band_idx band);
 
 
void
phl_mr_check_ecsa_cancel(struct phl_info_t *phl_info,
                         struct rtw_wifi_role_t *wrole,
                         struct rtw_wifi_role_link_t *rlink);
#ifdef CONFIG_DBCC_SUPPORT
bool phl_mr_is_cckphy(struct phl_info_t *phl_info, u8 band_idx);
bool rtw_phl_mr_is_db(void *phl);
 
bool phl_mr_is_trigger_dbcc(struct phl_info_t *phl_info);
 
 
#ifdef CONFIG_DBCC_P2P_BG_LISTEN
enum rtw_phl_status
phl_cmd_dbcc_en_hdl(struct phl_info_t *phl_info, u8 *param);
 
enum rtw_phl_status
phl_cmd_dbcc_dis_hdl(struct phl_info_t *phl_info, u8 *param);
 
struct rtw_wifi_role_link_t *
phl_mr_get_first_rlink_by_band_ex(struct phl_info_t *phl,
               enum phl_band_idx band,
               bool linked);
#endif /*CONFIG_DBCC_P2P_BG_LISTEN*/
#endif
 
#ifdef DBG_PHL_MR
enum rtw_phl_status phl_mr_info_dbg(struct phl_info_t *phl_info);
 
void phl_mr_dump_cur_chandef(const char *caller, const int line, bool show_caller,
       struct phl_info_t *phl_info, struct rtw_wifi_role_t *wifi_role);
#define PHL_DUMP_CUR_CHANDEF(_phl_info, _wrole) \
   phl_mr_dump_cur_chandef(__FUNCTION__, __LINE__, false, _phl_info, _wrole);
#define PHL_DUMP_CUR_CHANDEF_EX(_phl_info, _wrole) \
   phl_mr_dump_cur_chandef(__FUNCTION__, __LINE__, true, _phl_info, _wrole);
 
void phl_mr_dump_chctx_info(const char *caller, const int line, bool show_caller,
   struct phl_info_t *phl_info, struct phl_queue *chan_ctx_queue, struct rtw_chan_ctx *chanctx);
#define PHL_DUMP_CHAN_CTX(_phl_info, _chctx_q, _chctx) \
       phl_mr_dump_chctx_info(__FUNCTION__, __LINE__, false, _phl_info, _chctx_q, _chctx);
#define PHL_DUMP_CHAN_CTX_EX(_phl_info, _chctx_q, _chctx) \
       phl_mr_dump_chctx_info(__FUNCTION__, __LINE__, true, _phl_info, _chctx_q, _chctx);
 
void phl_dump_cc_band_map(struct phl_info_t *phl_info, u16 cc_band_map);
void phl_mr_dump_band_info(const char *caller, const int line, bool show_caller,
   struct phl_info_t *phl_info, struct hw_band_ctl_t *band_ctrl);
#define PHL_DUMP_BAND_CTL(_phl_info, band_ctl) \
       phl_mr_dump_band_info(__FUNCTION__, __LINE__, false, _phl_info, band_ctl)
#define PHL_DUMP_BAND_CTL_EX(_phl_info, band_ctl) \
       phl_mr_dump_band_info(__FUNCTION__, __LINE__, true, _phl_info, band_ctl)
 
void phl_mr_dump_role_info(const char *caller, const int line, bool show_caller,
   struct phl_info_t *phl_info, struct rtw_wifi_role_t *wrole);
#define PHL_DUMP_ROLE(_phl_info, _wrole) \
       phl_mr_dump_role_info(__FUNCTION__, __LINE__, false, _phl_info, _wrole)
#define PHL_DUMP_ROLE_EX(_phl_info, _wrole) \
       phl_mr_dump_role_info(__FUNCTION__, __LINE__, true, _phl_info, _wrole)
 
void phl_mr_dump_rlink_info(const char *caller, const int line, bool show_caller,
   struct phl_info_t *phl_info, struct rtw_wifi_role_t *wrole,
   struct rtw_wifi_role_link_t *rlink);
 
#define PHL_DUMP_RLINK(_phl_info, _wrole, _rlink) \
       phl_mr_dump_rlink_info(__FUNCTION__, __LINE__, false, _phl_info, _wrole, _rlink)
 
void phl_mr_dump_info(const char *caller, const int line, bool show_caller,
   struct phl_info_t *phl_info);
#define PHL_DUMP_MR(_phl_info) phl_mr_dump_info(__FUNCTION__, __LINE__, false, _phl_info)
#define PHL_DUMP_MR_EX(_phl_info) phl_mr_dump_info(__FUNCTION__, __LINE__, true, _phl_info)
 
#else
#define phl_dump_cc_band_map(_phl_info, _map)
#define PHL_DUMP_CUR_CHANDEF(_phl_info, _wrole)
#define PHL_DUMP_CUR_CHANDEF_EX(_phl_info, _wrole)
#define PHL_DUMP_CHAN_CTX(_phl_info, _chctx_q, _chctx)
#define PHL_DUMP_CHAN_CTX_EX(_phl_info, _chctx_q, _chctx)
#define PHL_DUMP_BAND_CTL(_phl_info, band_ctl)
#define PHL_DUMP_BAND_CTL_EX(_phl_info, band_ctl)
#define PHL_DUMP_ROLE(_phl_info, _wrole)
#define PHL_DUMP_ROLE_EX(_phl_info, _wrole)
#define PHL_DUMP_RLINK(_phl_info, _wrole, _rlink)
#define PHL_DUMP_MR(_phl_info)
#define PHL_DUMP_MR_EX(_phl_info)
#endif
 
#endif  /*_PHL_MR_H_*/