Skip to content

Commit

Permalink
net/i40e: fix buffer leak on Rx reconfiguration
Browse files Browse the repository at this point in the history
[ upstream commit 56dcaa41325a8a347ba52e5d89dce5e8dafa7f8c ]

When reconfiguring a single queue on a device, the mbuf initializer
value was not getting set, and remained at zero. This lead to mbuf leaks
as the refcount was incorrect (0), so on free it wrapped around to
UINT16_MAX. When setting up the mbuf initializer, also ensure that the
queue is explicitly marked as using a vector function by setting the
"rx_using_sse" flag.

Fixes: a3c83a2 ("net/i40e: enable runtime queue setup")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
bruce-richardson authored and bluca committed Oct 18, 2023
1 parent 19077f1 commit 56d2082
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/i40e/i40e_rxtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,12 @@ i40e_dev_rx_queue_setup_runtime(struct rte_eth_dev *dev,
if (use_def_burst_func)
ad->rx_bulk_alloc_allowed = false;
i40e_set_rx_function(dev);

if (ad->rx_vec_allowed && i40e_rxq_vec_setup(rxq)) {
PMD_DRV_LOG(ERR, "Failed vector rx setup.");
return -EINVAL;
}

return 0;
} else if (ad->rx_vec_allowed && !rte_is_power_of_2(rxq->nb_rx_desc)) {
PMD_DRV_LOG(ERR, "Vector mode is allowed, but descriptor"
Expand Down
1 change: 1 addition & 0 deletions drivers/net/i40e/i40e_rxtx_vec_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ i40e_rxq_vec_setup_default(struct i40e_rx_queue *rxq)
rte_compiler_barrier();
p = (uintptr_t)&mb_def.rearm_data;
rxq->mbuf_initializer = *(uint64_t *)p;
rxq->rx_using_sse = 1;
return 0;
}

Expand Down

0 comments on commit 56d2082

Please sign in to comment.