Skip to content

Commit 366f234

Browse files
krish2718rlubos
authored andcommitted
[nrf fromtree] 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]> (cherry picked from commit b8d31f1)
1 parent d2d2587 commit 366f234

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
@@ -275,6 +275,9 @@ struct nwb {
275275
void (*cleanup_cb)();
276276
unsigned char priority;
277277
bool chksum_done;
278+
#ifdef CONFIG_NRF70_RAW_DATA_TX
279+
void *raw_tx_hdr;
280+
#endif /* CONFIG_NRF70_RAW_DATA_TX */
278281
#ifdef CONFIG_NRF_WIFI_ZERO_COPY_TX
279282
struct net_pkt *pkt;
280283
#endif
@@ -400,6 +403,55 @@ static void zep_shim_nbuf_set_chksum_done(void *nbuf, unsigned char chksum_done)
400403
nwb->chksum_done = (bool)chksum_done;
401404
}
402405

406+
#ifdef CONFIG_NRF70_RAW_DATA_TX
407+
static void *zep_shim_nbuf_set_raw_tx_hdr(void *nbuf, unsigned short raw_hdr_len)
408+
{
409+
struct nwb *nwb = (struct nwb *)nbuf;
410+
411+
if (!nwb) {
412+
LOG_ERR("%s: Received network buffer is NULL", __func__);
413+
return NULL;
414+
}
415+
416+
nwb->raw_tx_hdr = zep_shim_nbuf_data_get(nwb);
417+
if (!nwb->raw_tx_hdr) {
418+
LOG_ERR("%s: Unable to set raw Tx header in network buffer", __func__);
419+
return NULL;
420+
}
421+
422+
zep_shim_nbuf_data_pull(nwb, raw_hdr_len);
423+
424+
return nwb->raw_tx_hdr;
425+
}
426+
427+
static void *zep_shim_nbuf_get_raw_tx_hdr(void *nbuf)
428+
{
429+
struct nwb *nwb = (struct nwb *)nbuf;
430+
431+
if (!nwb) {
432+
LOG_ERR("%s: Received network buffer is NULL", __func__);
433+
return NULL;
434+
}
435+
436+
return nwb->raw_tx_hdr;
437+
}
438+
439+
static bool zep_shim_nbuf_is_raw_tx(void *nbuf)
440+
{
441+
struct nwb *nwb = (struct nwb *)nbuf;
442+
443+
if (!nwb) {
444+
LOG_ERR("%s: Received network buffer is NULL", __func__);
445+
return false;
446+
}
447+
448+
return (nwb->raw_tx_hdr != NULL);
449+
}
450+
#endif /* CONFIG_NRF70_RAW_DATA_TX */
451+
452+
453+
454+
403455
#include <zephyr/net/ethernet.h>
404456
#include <zephyr/net/net_core.h>
405457

@@ -1192,6 +1244,11 @@ const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops = {
11921244
.nbuf_get_priority = zep_shim_nbuf_get_priority,
11931245
.nbuf_get_chksum_done = zep_shim_nbuf_get_chksum_done,
11941246
.nbuf_set_chksum_done = zep_shim_nbuf_set_chksum_done,
1247+
#ifdef CONFIG_NRF70_RAW_DATA_TX
1248+
.nbuf_set_raw_tx_hdr = zep_shim_nbuf_set_raw_tx_hdr,
1249+
.nbuf_get_raw_tx_hdr = zep_shim_nbuf_get_raw_tx_hdr,
1250+
.nbuf_is_raw_tx = zep_shim_nbuf_is_raw_tx,
1251+
#endif /* CONFIG_NRF70_RAW_DATA_TX */
11951252

11961253
.tasklet_alloc = zep_shim_work_alloc,
11971254
.tasklet_free = zep_shim_work_free,

0 commit comments

Comments
 (0)