Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion drivers/wifi/nrf_wifi/inc/fmac_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ struct nrf_wifi_vif_ctx_zep {
#ifdef CONFIG_NET_STATISTICS_ETHERNET
struct net_stats_eth eth_stats;
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX)
bool authorized;
#endif
#ifdef CONFIG_NRF70_STA_MODE
unsigned int assoc_freq;
enum nrf_wifi_fmac_if_carr_state if_carr_state;
Expand All @@ -72,7 +75,6 @@ struct nrf_wifi_vif_ctx_zep {
unsigned char twt_flow_in_progress_map;
struct wifi_ps_config *ps_info;
bool ps_config_info_evnt;
bool authorized;
bool cookie_resp_received;
#ifdef CONFIG_NRF70_DATA_TX
struct k_work nrf_wifi_net_iface_work;
Expand Down
2 changes: 2 additions & 0 deletions drivers/wifi/nrf_wifi/inc/wifi_mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define WIFI_MGMT_DATA_CTRL_FILTER_SETTING 0xE
#define WIFI_ALL_FILTER_SETTING 0xF

#ifdef CONFIG_NRF70_STA_MODE
struct twt_interval_float {
unsigned short mantissa;
unsigned char exponent;
Expand Down Expand Up @@ -54,6 +55,7 @@ int nrf_wifi_get_power_save_config(const struct device *dev,
void nrf_wifi_event_proc_get_power_save_info(void *vif_ctx,
struct nrf_wifi_umac_event_power_save_info *ps_info,
unsigned int event_len);
#endif /* CONFIG_NRF70_STA_MODE */

#ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES
int nrf_wifi_mode(const struct device *dev,
Expand Down
10 changes: 6 additions & 4 deletions drivers/wifi/nrf_wifi/src/fmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do
goto out;
}

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

Expand Down Expand Up @@ -739,10 +739,10 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
data_config.rate_protection_type = rate_protection_type;
callbk_fns.if_carr_state_chg_callbk_fn = nrf_wifi_if_carr_state_chg;
callbk_fns.rx_frm_callbk_fn = nrf_wifi_if_rx_frm;
#endif
#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX)
callbk_fns.sniffer_callbk_fn = nrf_wifi_if_sniffer_rx_frm;
#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */
#endif
rx_buf_pools[0].num_bufs = rx1_num_bufs;
rx_buf_pools[1].num_bufs = rx2_num_bufs;
rx_buf_pools[2].num_bufs = rx3_num_bufs;
Expand All @@ -756,6 +756,7 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
callbk_fns.scan_start_callbk_fn = nrf_wifi_event_proc_scan_start_zep;
callbk_fns.scan_done_callbk_fn = nrf_wifi_event_proc_scan_done_zep;
callbk_fns.reg_change_callbk_fn = reg_change_callbk_fn;
callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep;
#ifdef CONFIG_NET_L2_WIFI_MGMT
callbk_fns.disp_scan_res_callbk_fn = nrf_wifi_event_proc_disp_scan_res_zep;
#endif /* CONFIG_NET_L2_WIFI_MGMT */
Expand All @@ -769,7 +770,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
callbk_fns.twt_config_callbk_fn = nrf_wifi_event_proc_twt_setup_zep;
callbk_fns.twt_teardown_callbk_fn = nrf_wifi_event_proc_twt_teardown_zep;
callbk_fns.twt_sleep_callbk_fn = nrf_wifi_event_proc_twt_sleep_zep;
callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep;
callbk_fns.event_get_ps_info = nrf_wifi_event_proc_get_power_save_info;
callbk_fns.cookie_rsp_callbk_fn = nrf_wifi_event_proc_cookie_rsp;
callbk_fns.process_rssi_from_rx = nrf_wifi_process_rssi_from_rx;
Expand Down Expand Up @@ -858,10 +858,12 @@ static struct wifi_mgmt_ops nrf_wifi_mgmt_ops = {
.get_stats = nrf_wifi_stats_get,
.reset_stats = nrf_wifi_stats_reset,
#endif /* CONFIG_NET_STATISTICS_WIFI */
#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX)
.reg_domain = nrf_wifi_reg_domain,
#endif
#ifdef CONFIG_NRF70_STA_MODE
.set_power_save = nrf_wifi_set_power_save,
.set_twt = nrf_wifi_set_twt,
.reg_domain = nrf_wifi_reg_domain,
.get_power_save_config = nrf_wifi_get_power_save_config,
.set_rts_threshold = nrf_wifi_set_rts_threshold,
.get_rts_threshold = nrf_wifi_get_rts_threshold,
Expand Down
66 changes: 33 additions & 33 deletions drivers/wifi/nrf_wifi/src/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,39 +239,6 @@
}
}

#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX)
void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm,
struct raw_rx_pkt_header *raw_rx_hdr,
bool pkt_free)
{
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx;
struct net_if *iface = vif_ctx_zep->zep_net_if_ctx;
struct net_pkt *pkt;
struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
int ret;

sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);

pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header),
raw_rx_hdr,
pkt_free);
if (!pkt) {
LOG_DBG("Failed to allocate net_pkt");
return;
}

net_capture_pkt(iface, pkt);

ret = net_recv_data(iface, pkt);
if (ret < 0) {
LOG_DBG("RCV Packet dropped by NET stack: %d", ret);
net_pkt_unref(pkt);
}
}
#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */

void nrf_wifi_if_rx_frm(void *os_vif_ctx, void *frm)
{
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx;
Expand Down Expand Up @@ -341,6 +308,39 @@
}
#endif /* CONFIG_NRF70_DATA_TX */

#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX)
void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm,
struct raw_rx_pkt_header *raw_rx_hdr,
bool pkt_free)

Check notice on line 314 in drivers/wifi/nrf_wifi/src/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/src/net_if.c:314 -void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm, - struct raw_rx_pkt_header *raw_rx_hdr, +void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm, struct raw_rx_pkt_header *raw_rx_hdr,
{
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx;
struct net_if *iface = vif_ctx_zep->zep_net_if_ctx;
struct net_pkt *pkt;
struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
int ret;

sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);

pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header),
raw_rx_hdr,
pkt_free);

Check notice on line 328 in drivers/wifi/nrf_wifi/src/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrf_wifi/src/net_if.c:328 - pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header), - raw_rx_hdr, + pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header), raw_rx_hdr,
if (!pkt) {
LOG_DBG("Failed to allocate net_pkt");
return;
}

net_capture_pkt(iface, pkt);

ret = net_recv_data(iface, pkt);
if (ret < 0) {
LOG_DBG("RCV Packet dropped by NET stack: %d", ret);
net_pkt_unref(pkt);
}
}
#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */

enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev)
{
enum ethernet_hw_caps caps = (ETHERNET_LINK_10BASE |
Expand Down
2 changes: 2 additions & 0 deletions drivers/wifi/nrf_wifi/src/wifi_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);

extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep;

#ifdef CONFIG_NRF70_STA_MODE
int nrf_wifi_set_power_save(const struct device *dev,
struct wifi_ps_params *params)
{
Expand Down Expand Up @@ -748,6 +749,7 @@ void nrf_wifi_event_proc_twt_sleep_zep(void *vif_ctx,
out:
k_mutex_unlock(&vif_ctx_zep->vif_lock);
}
#endif /* CONFIG_NRF70_STA_MODE */

#ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES
int nrf_wifi_mode(const struct device *dev,
Expand Down
57 changes: 57 additions & 0 deletions modules/nrf_wifi/os/shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@
void (*cleanup_cb)();
unsigned char priority;
bool chksum_done;
#ifdef CONFIG_NRF70_RAW_DATA_TX
void *raw_tx_hdr;
#endif /* CONFIG_NRF70_RAW_DATA_TX */
#ifdef CONFIG_NRF_WIFI_ZERO_COPY_TX
struct net_pkt *pkt;
#endif
Expand Down Expand Up @@ -400,7 +403,56 @@
nwb->chksum_done = (bool)chksum_done;
}

#ifdef CONFIG_NRF70_RAW_DATA_TX
static void *zep_shim_nbuf_set_raw_tx_hdr(void *nbuf, unsigned short raw_hdr_len)
{
struct nwb *nwb = (struct nwb *)nbuf;

if (!nwb) {
LOG_ERR("%s: Received network buffer is NULL", __func__);
return NULL;
}

nwb->raw_tx_hdr = zep_shim_nbuf_data_get(nwb);
if (!nwb->raw_tx_hdr) {
LOG_ERR("%s: Unable to set raw Tx header in network buffer", __func__);
return NULL;
}

zep_shim_nbuf_data_pull(nwb, raw_hdr_len);

return nwb->raw_tx_hdr;
}

static void *zep_shim_nbuf_get_raw_tx_hdr(void *nbuf)
{
struct nwb *nwb = (struct nwb *)nbuf;

if (!nwb) {
LOG_ERR("%s: Received network buffer is NULL", __func__);
return NULL;
}

return nwb->raw_tx_hdr;
}

static bool zep_shim_nbuf_is_raw_tx(void *nbuf)
{
struct nwb *nwb = (struct nwb *)nbuf;

if (!nwb) {
LOG_ERR("%s: Received network buffer is NULL", __func__);
return false;
}

return (nwb->raw_tx_hdr != NULL);
}
#endif /* CONFIG_NRF70_RAW_DATA_TX */




#include <zephyr/net/ethernet.h>

Check notice on line 455 in modules/nrf_wifi/os/shim.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

modules/nrf_wifi/os/shim.c:455 - - -
#include <zephyr/net/net_core.h>

#ifdef CONFIG_NRF_WIFI_ZERO_COPY_TX
Expand Down Expand Up @@ -1192,6 +1244,11 @@
.nbuf_get_priority = zep_shim_nbuf_get_priority,
.nbuf_get_chksum_done = zep_shim_nbuf_get_chksum_done,
.nbuf_set_chksum_done = zep_shim_nbuf_set_chksum_done,
#ifdef CONFIG_NRF70_RAW_DATA_TX
.nbuf_set_raw_tx_hdr = zep_shim_nbuf_set_raw_tx_hdr,
.nbuf_get_raw_tx_hdr = zep_shim_nbuf_get_raw_tx_hdr,
.nbuf_is_raw_tx = zep_shim_nbuf_is_raw_tx,
#endif /* CONFIG_NRF70_RAW_DATA_TX */

.tasklet_alloc = zep_shim_work_alloc,
.tasklet_free = zep_shim_work_free,
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ manifest:
revision: 968d55ff22579080466bf2f482596dd6e35361c6
path: modules/bsim_hw_models/nrf_hw_models
- name: nrf_wifi
revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8
revision: 936b502c717ac413afea2b62f20f6bf7a84ffee0
path: modules/lib/nrf_wifi
- name: open-amp
revision: f7f4d083c7909a39d86e217376c69b416ec4faf3
Expand Down
Loading