xsk: Return the whole xdp_desc from xsk_umem_consume_tx
Some drivers want to access the data transmitted in order to implement acceleration features of the NICs. It is also useful in AF_XDP TX flow. Change the xsk_umem_consume_tx API to return the whole xdp_desc, that contains the data pointer, length and DMA address, instead of only the latter two. Adapt the implementation of i40e and ixgbe to this change. Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com> Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Acked-by: Saeed Mahameed <saeedm@mellanox.com> Cc: Björn Töpel <bjorn.topel@intel.com> Cc: Magnus Karlsson <magnus.karlsson@intel.com> Acked-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:

committed by
Daniel Borkmann

parent
123e8da1d3
commit
4bce4e5cb6
@@ -172,22 +172,18 @@ void xsk_umem_consume_tx_done(struct xdp_umem *umem)
|
||||
}
|
||||
EXPORT_SYMBOL(xsk_umem_consume_tx_done);
|
||||
|
||||
bool xsk_umem_consume_tx(struct xdp_umem *umem, dma_addr_t *dma, u32 *len)
|
||||
bool xsk_umem_consume_tx(struct xdp_umem *umem, struct xdp_desc *desc)
|
||||
{
|
||||
struct xdp_desc desc;
|
||||
struct xdp_sock *xs;
|
||||
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(xs, &umem->xsk_list, list) {
|
||||
if (!xskq_peek_desc(xs->tx, &desc))
|
||||
if (!xskq_peek_desc(xs->tx, desc))
|
||||
continue;
|
||||
|
||||
if (xskq_produce_addr_lazy(umem->cq, desc.addr))
|
||||
if (xskq_produce_addr_lazy(umem->cq, desc->addr))
|
||||
goto out;
|
||||
|
||||
*dma = xdp_umem_get_dma(umem, desc.addr);
|
||||
*len = desc.len;
|
||||
|
||||
xskq_discard_desc(xs->tx);
|
||||
rcu_read_unlock();
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user