Skip to content

Commit 001f34d

Browse files
krish2718nashif
authored andcommitted
drivers: nrf_wifi: Fix return codes for xmit
Return proper error codes for xmit instead of generic -1. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 3225b51 commit 001f34d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/wifi/nrf_wifi/src/net_if.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev)
363363
int nrf_wifi_if_send(const struct device *dev,
364364
struct net_pkt *pkt)
365365
{
366-
int ret = -1;
366+
int ret = -EINVAL;
367367
#ifdef CONFIG_NRF70_DATA_TX
368368
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
369369
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
@@ -404,6 +404,7 @@ int nrf_wifi_if_send(const struct device *dev,
404404

405405
if (nbuf == NULL) {
406406
LOG_ERR("%s: allocation failed", __func__);
407+
ret = -ENOMEM;
407408
goto drop;
408409
}
409410

@@ -420,6 +421,7 @@ int nrf_wifi_if_send(const struct device *dev,
420421
#endif /* CONFIG_NRF70_RAW_DATA_TX */
421422
if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) ||
422423
(!vif_ctx_zep->authorized && !is_eapol(pkt))) {
424+
ret = -EPERM;
423425
goto drop;
424426
}
425427

@@ -432,6 +434,8 @@ int nrf_wifi_if_send(const struct device *dev,
432434
if (ret == NRF_WIFI_STATUS_FAIL) {
433435
/* FMAC API takes care of freeing the nbuf */
434436
host_stats->total_tx_drop_pkts++;
437+
/* Could be many reasons, but likely no space in the queue */
438+
ret = -ENOBUFS;
435439
}
436440
goto unlock;
437441
drop:

0 commit comments

Comments
 (0)