Skip to content

Commit b8d31f1

Browse files
krish2718danieldegrasse
authored andcommitted
modules: nrf_wifi: Implement new Raw TX APIs
The new raw TX handling relies on these APIs, so, implement them for Zephyr shim. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 7a3737b commit b8d31f1

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

modules/nrf_wifi/os/shim.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ struct nwb {
299299
void (*cleanup_cb)();
300300
unsigned char priority;
301301
bool chksum_done;
302+
#ifdef CONFIG_NRF70_RAW_DATA_TX
303+
void *raw_tx_hdr;
304+
#endif /* CONFIG_NRF70_RAW_DATA_TX */
302305
#ifdef CONFIG_NRF_WIFI_ZERO_COPY_TX
303306
struct net_pkt *pkt;
304307
#endif
@@ -424,6 +427,55 @@ static void zep_shim_nbuf_set_chksum_done(void *nbuf, unsigned char chksum_done)
424427
nwb->chksum_done = (bool)chksum_done;
425428
}
426429

430+
#ifdef CONFIG_NRF70_RAW_DATA_TX
431+
static void *zep_shim_nbuf_set_raw_tx_hdr(void *nbuf, unsigned short raw_hdr_len)
432+
{
433+
struct nwb *nwb = (struct nwb *)nbuf;
434+
435+
if (!nwb) {
436+
LOG_ERR("%s: Received network buffer is NULL", __func__);
437+
return NULL;
438+
}
439+
440+
nwb->raw_tx_hdr = zep_shim_nbuf_data_get(nwb);
441+
if (!nwb->raw_tx_hdr) {
442+
LOG_ERR("%s: Unable to set raw Tx header in network buffer", __func__);
443+
return NULL;
444+
}
445+
446+
zep_shim_nbuf_data_pull(nwb, raw_hdr_len);
447+
448+
return nwb->raw_tx_hdr;
449+
}
450+
451+
static void *zep_shim_nbuf_get_raw_tx_hdr(void *nbuf)
452+
{
453+
struct nwb *nwb = (struct nwb *)nbuf;
454+
455+
if (!nwb) {
456+
LOG_ERR("%s: Received network buffer is NULL", __func__);
457+
return NULL;
458+
}
459+
460+
return nwb->raw_tx_hdr;
461+
}
462+
463+
static bool zep_shim_nbuf_is_raw_tx(void *nbuf)
464+
{
465+
struct nwb *nwb = (struct nwb *)nbuf;
466+
467+
if (!nwb) {
468+
LOG_ERR("%s: Received network buffer is NULL", __func__);
469+
return false;
470+
}
471+
472+
return (nwb->raw_tx_hdr != NULL);
473+
}
474+
#endif /* CONFIG_NRF70_RAW_DATA_TX */
475+
476+
477+
478+
427479
#include <zephyr/net/ethernet.h>
428480
#include <zephyr/net/net_core.h>
429481

@@ -1216,6 +1268,11 @@ const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops = {
12161268
.nbuf_get_priority = zep_shim_nbuf_get_priority,
12171269
.nbuf_get_chksum_done = zep_shim_nbuf_get_chksum_done,
12181270
.nbuf_set_chksum_done = zep_shim_nbuf_set_chksum_done,
1271+
#ifdef CONFIG_NRF70_RAW_DATA_TX
1272+
.nbuf_set_raw_tx_hdr = zep_shim_nbuf_set_raw_tx_hdr,
1273+
.nbuf_get_raw_tx_hdr = zep_shim_nbuf_get_raw_tx_hdr,
1274+
.nbuf_is_raw_tx = zep_shim_nbuf_is_raw_tx,
1275+
#endif /* CONFIG_NRF70_RAW_DATA_TX */
12191276

12201277
.tasklet_alloc = zep_shim_work_alloc,
12211278
.tasklet_free = zep_shim_work_free,

0 commit comments

Comments
 (0)