diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index 9108a0dab3b25..f94dc5a1e2142 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -363,7 +363,7 @@ enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev) int nrf_wifi_if_send(const struct device *dev, struct net_pkt *pkt) { - int ret = -1; + int ret = -EINVAL; #ifdef CONFIG_NRF70_DATA_TX struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; @@ -404,6 +404,7 @@ int nrf_wifi_if_send(const struct device *dev, if (nbuf == NULL) { LOG_ERR("%s: allocation failed", __func__); + ret = -ENOMEM; goto drop; } @@ -420,6 +421,7 @@ int nrf_wifi_if_send(const struct device *dev, #endif /* CONFIG_NRF70_RAW_DATA_TX */ if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) || (!vif_ctx_zep->authorized && !is_eapol(pkt))) { + ret = -EPERM; goto drop; } @@ -432,6 +434,8 @@ int nrf_wifi_if_send(const struct device *dev, if (ret == NRF_WIFI_STATUS_FAIL) { /* FMAC API takes care of freeing the nbuf */ host_stats->total_tx_drop_pkts++; + /* Could be many reasons, but likely no space in the queue */ + ret = -ENOBUFS; } goto unlock; drop: diff --git a/include/zephyr/net/net_l2.h b/include/zephyr/net/net_l2.h index a7aa8530ee293..4684706ba835d 100644 --- a/include/zephyr/net/net_l2.h +++ b/include/zephyr/net/net_l2.h @@ -66,7 +66,7 @@ struct net_l2 { * This function is used by net core to push a packet to lower layer * (interface's L2), which in turn might work on the packet relevantly. * (adding proper header etc...) - * Returns a negative error code, or the number of bytes sent otherwise. + * Returns a negative error code, or 0 if the packet was accepted. */ int (*send)(struct net_if *iface, struct net_pkt *pkt);