Skip to content

[Backport v4.0.99-ncs1-branch] nrf70: Fix zero copy #2761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2025
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
6 changes: 3 additions & 3 deletions drivers/wifi/nrf_wifi/src/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ int nrf_wifi_if_get_config_zep(const struct device *dev,
struct ethernet_config *config)
{
int ret = -1;
#ifdef CONFIG_NRF70_RAW_DATA_TX

struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL;
Expand Down Expand Up @@ -986,11 +986,12 @@ int nrf_wifi_if_get_config_zep(const struct device *dev,
}

memset(config, 0, sizeof(struct ethernet_config));

#ifdef CONFIG_NRF70_RAW_DATA_TX
if (type == ETHERNET_CONFIG_TYPE_TXINJECTION_MODE) {
config->txinjection_mode =
sys_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->txinjection_mode;
}
#endif
#ifdef CONFIG_NRF70_TCP_IP_CHECKSUM_OFFLOAD
if (type == ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT ||
type == ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT) {
Expand All @@ -1011,7 +1012,6 @@ int nrf_wifi_if_get_config_zep(const struct device *dev,
unlock:
k_mutex_unlock(&vif_ctx_zep->vif_lock);
out:
#endif
return ret;
}

Expand Down
7 changes: 3 additions & 4 deletions subsys/net/ip/net_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ static struct net_buf *pkt_alloc_buffer(struct net_pkt *pkt,

size = 0U;
} else {
size -= current->size;
size -= current->size - headroom;
}
} else {
if (current->size > size) {
Expand Down Expand Up @@ -1033,13 +1033,12 @@ static struct net_buf *pkt_alloc_buffer(struct net_pkt *pkt,

#if defined(CONFIG_NET_PKT_ALLOC_STATS)
uint32_t start_time = k_cycle_get_32();
size_t total_size = size;
size_t total_size = size + headroom;
#else
ARG_UNUSED(pkt);
#endif
ARG_UNUSED(headroom);

buf = net_buf_alloc_len(pool, size, timeout);
buf = net_buf_alloc_len(pool, size + headroom, timeout);

#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_FRAG_CHECK_IF_NOT_IN_USE(buf, buf->ref + 1);
Expand Down
4 changes: 4 additions & 0 deletions tests/net/vlan/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ tests:
net.vlan.header_reserved:
extra_configs:
- CONFIG_NET_L2_ETHERNET_RESERVE_HEADER=y
net.vlan.header_reserved.variable_size:
extra_configs:
- CONFIG_NET_L2_ETHERNET_RESERVE_HEADER=y
- CONFIG_NET_BUF_VARIABLE_DATA_SIZE=y