Skip to content

Commit 0d4472a

Browse files
kapbhcfriedt
authored andcommitted
drivers: nrf_wifi: Remove station mode from monitor mode
Monitor mode doesn't require station mode. Disabling station mode require necessary changes to work monitor mode. Signed-off-by: Kapil Bhatt <[email protected]>
1 parent 99860e7 commit 0d4472a

File tree

5 files changed

+46
-38
lines changed

5 files changed

+46
-38
lines changed

drivers/wifi/nrf_wifi/inc/fmac_main.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ struct nrf_wifi_vif_ctx_zep {
6262
#ifdef CONFIG_NET_STATISTICS_ETHERNET
6363
struct net_stats_eth eth_stats;
6464
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
65+
#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX)
66+
bool authorized;
67+
#endif
6568
#ifdef CONFIG_NRF70_STA_MODE
6669
unsigned int assoc_freq;
6770
enum nrf_wifi_fmac_if_carr_state if_carr_state;
@@ -72,7 +75,6 @@ struct nrf_wifi_vif_ctx_zep {
7275
unsigned char twt_flow_in_progress_map;
7376
struct wifi_ps_config *ps_info;
7477
bool ps_config_info_evnt;
75-
bool authorized;
7678
bool cookie_resp_received;
7779
#ifdef CONFIG_NRF70_DATA_TX
7880
struct k_work nrf_wifi_net_iface_work;

drivers/wifi/nrf_wifi/inc/wifi_mgmt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define WIFI_MGMT_DATA_CTRL_FILTER_SETTING 0xE
2323
#define WIFI_ALL_FILTER_SETTING 0xF
2424

25+
#ifdef CONFIG_NRF70_STA_MODE
2526
struct twt_interval_float {
2627
unsigned short mantissa;
2728
unsigned char exponent;
@@ -54,6 +55,7 @@ int nrf_wifi_get_power_save_config(const struct device *dev,
5455
void nrf_wifi_event_proc_get_power_save_info(void *vif_ctx,
5556
struct nrf_wifi_umac_event_power_save_info *ps_info,
5657
unsigned int event_len);
58+
#endif /* CONFIG_NRF70_STA_MODE */
5759

5860
#ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES
5961
int nrf_wifi_mode(const struct device *dev,

drivers/wifi/nrf_wifi/src/fmac_main.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do
350350
goto out;
351351
}
352352

353-
#ifdef CONFIG_NRF70_SCAN_ONLY
353+
#if defined(CONFIG_NRF70_SCAN_ONLY) || defined(CONFIG_NRF70_RAW_DATA_RX)
354354
if (reg_domain->oper == WIFI_MGMT_SET) {
355355
memcpy(reg_domain_info.alpha2, reg_domain->country_code, WIFI_COUNTRY_CODE_LEN);
356356

@@ -739,10 +739,10 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
739739
data_config.rate_protection_type = rate_protection_type;
740740
callbk_fns.if_carr_state_chg_callbk_fn = nrf_wifi_if_carr_state_chg;
741741
callbk_fns.rx_frm_callbk_fn = nrf_wifi_if_rx_frm;
742+
#endif
742743
#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX)
743744
callbk_fns.sniffer_callbk_fn = nrf_wifi_if_sniffer_rx_frm;
744745
#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */
745-
#endif
746746
rx_buf_pools[0].num_bufs = rx1_num_bufs;
747747
rx_buf_pools[1].num_bufs = rx2_num_bufs;
748748
rx_buf_pools[2].num_bufs = rx3_num_bufs;
@@ -756,6 +756,7 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
756756
callbk_fns.scan_start_callbk_fn = nrf_wifi_event_proc_scan_start_zep;
757757
callbk_fns.scan_done_callbk_fn = nrf_wifi_event_proc_scan_done_zep;
758758
callbk_fns.reg_change_callbk_fn = reg_change_callbk_fn;
759+
callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep;
759760
#ifdef CONFIG_NET_L2_WIFI_MGMT
760761
callbk_fns.disp_scan_res_callbk_fn = nrf_wifi_event_proc_disp_scan_res_zep;
761762
#endif /* CONFIG_NET_L2_WIFI_MGMT */
@@ -769,7 +770,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
769770
callbk_fns.twt_config_callbk_fn = nrf_wifi_event_proc_twt_setup_zep;
770771
callbk_fns.twt_teardown_callbk_fn = nrf_wifi_event_proc_twt_teardown_zep;
771772
callbk_fns.twt_sleep_callbk_fn = nrf_wifi_event_proc_twt_sleep_zep;
772-
callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep;
773773
callbk_fns.event_get_ps_info = nrf_wifi_event_proc_get_power_save_info;
774774
callbk_fns.cookie_rsp_callbk_fn = nrf_wifi_event_proc_cookie_rsp;
775775
callbk_fns.process_rssi_from_rx = nrf_wifi_process_rssi_from_rx;
@@ -858,10 +858,12 @@ static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = {
858858
.get_stats = nrf_wifi_stats_get,
859859
.reset_stats = nrf_wifi_stats_reset,
860860
#endif /* CONFIG_NET_STATISTICS_WIFI */
861+
#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX)
862+
.reg_domain = nrf_wifi_reg_domain,
863+
#endif
861864
#ifdef CONFIG_NRF70_STA_MODE
862865
.set_power_save = nrf_wifi_set_power_save,
863866
.set_twt = nrf_wifi_set_twt,
864-
.reg_domain = nrf_wifi_reg_domain,
865867
.get_power_save_config = nrf_wifi_get_power_save_config,
866868
.set_rts_threshold = nrf_wifi_set_rts_threshold,
867869
.get_rts_threshold = nrf_wifi_get_rts_threshold,

drivers/wifi/nrf_wifi/src/net_if.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -256,39 +256,6 @@ static void nrf_wifi_net_iface_work_handler(struct k_work *work)
256256
}
257257
}
258258

259-
#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX)
260-
void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm,
261-
struct raw_rx_pkt_header *raw_rx_hdr,
262-
bool pkt_free)
263-
{
264-
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx;
265-
struct net_if *iface = vif_ctx_zep->zep_net_if_ctx;
266-
struct net_pkt *pkt;
267-
struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;
268-
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
269-
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
270-
int ret;
271-
272-
sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);
273-
274-
pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header),
275-
raw_rx_hdr,
276-
pkt_free);
277-
if (!pkt) {
278-
LOG_DBG("Failed to allocate net_pkt");
279-
return;
280-
}
281-
282-
net_capture_pkt(iface, pkt);
283-
284-
ret = net_recv_data(iface, pkt);
285-
if (ret < 0) {
286-
LOG_DBG("RCV Packet dropped by NET stack: %d", ret);
287-
net_pkt_unref(pkt);
288-
}
289-
}
290-
#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */
291-
292259
void nrf_wifi_if_rx_frm(void *os_vif_ctx, void *frm)
293260
{
294261
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx;
@@ -358,6 +325,39 @@ static bool is_eapol(struct net_pkt *pkt)
358325
}
359326
#endif /* CONFIG_NRF70_DATA_TX */
360327

328+
#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX)
329+
void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm,
330+
struct raw_rx_pkt_header *raw_rx_hdr,
331+
bool pkt_free)
332+
{
333+
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx;
334+
struct net_if *iface = vif_ctx_zep->zep_net_if_ctx;
335+
struct net_pkt *pkt;
336+
struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;
337+
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
338+
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
339+
int ret;
340+
341+
sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);
342+
343+
pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header),
344+
raw_rx_hdr,
345+
pkt_free);
346+
if (!pkt) {
347+
LOG_DBG("Failed to allocate net_pkt");
348+
return;
349+
}
350+
351+
net_capture_pkt(iface, pkt);
352+
353+
ret = net_recv_data(iface, pkt);
354+
if (ret < 0) {
355+
LOG_DBG("RCV Packet dropped by NET stack: %d", ret);
356+
net_pkt_unref(pkt);
357+
}
358+
}
359+
#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */
360+
361361
enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev)
362362
{
363363
enum ethernet_hw_caps caps = (ETHERNET_LINK_10BASE |

drivers/wifi/nrf_wifi/src/wifi_mgmt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);
2525

2626
extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep;
2727

28+
#ifdef CONFIG_NRF70_STA_MODE
2829
int nrf_wifi_set_power_save(const struct device *dev,
2930
struct wifi_ps_params *params)
3031
{
@@ -743,6 +744,7 @@ void nrf_wifi_event_proc_twt_sleep_zep(void *vif_ctx,
743744
out:
744745
k_mutex_unlock(&vif_ctx_zep->vif_lock);
745746
}
747+
#endif /* CONFIG_NRF70_STA_MODE */
746748

747749
#ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES
748750
int nrf_wifi_mode(const struct device *dev,

0 commit comments

Comments
 (0)