mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
io_uring/zcrx: convert to use netmem_desc
Convert zcrx to struct netmem_desc, and use struct net_iov::desc to access its fields instead of struct net_iov inner union alises. zcrx only directly reads niov->pp, so with this patch it doesn't depend on the union anymore. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Byungchul Park <byungchul@sk.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
5bd38e18d5
commit
f0243d2b86
@@ -696,12 +696,12 @@ static void io_zcrx_return_niov(struct net_iov *niov)
|
||||
{
|
||||
netmem_ref netmem = net_iov_to_netmem(niov);
|
||||
|
||||
if (!niov->pp) {
|
||||
if (!niov->desc.pp) {
|
||||
/* copy fallback allocated niovs */
|
||||
io_zcrx_return_niov_freelist(niov);
|
||||
return;
|
||||
}
|
||||
page_pool_put_unrefed_netmem(niov->pp, netmem, -1, false);
|
||||
page_pool_put_unrefed_netmem(niov->desc.pp, netmem, -1, false);
|
||||
}
|
||||
|
||||
static void io_zcrx_scrub(struct io_zcrx_ifq *ifq)
|
||||
@@ -815,7 +815,7 @@ static void io_zcrx_ring_refill(struct page_pool *pp,
|
||||
if (!page_pool_unref_and_test(netmem))
|
||||
continue;
|
||||
|
||||
if (unlikely(niov->pp != pp)) {
|
||||
if (unlikely(niov->desc.pp != pp)) {
|
||||
io_zcrx_return_niov(niov);
|
||||
continue;
|
||||
}
|
||||
@@ -1082,13 +1082,15 @@ static int io_zcrx_recv_frag(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
|
||||
const skb_frag_t *frag, int off, int len)
|
||||
{
|
||||
struct net_iov *niov;
|
||||
struct page_pool *pp;
|
||||
|
||||
if (unlikely(!skb_frag_is_net_iov(frag)))
|
||||
return io_zcrx_copy_frag(req, ifq, frag, off, len);
|
||||
|
||||
niov = netmem_to_net_iov(frag->netmem);
|
||||
if (!niov->pp || niov->pp->mp_ops != &io_uring_pp_zc_ops ||
|
||||
io_pp_to_ifq(niov->pp) != ifq)
|
||||
pp = niov->desc.pp;
|
||||
|
||||
if (!pp || pp->mp_ops != &io_uring_pp_zc_ops || io_pp_to_ifq(pp) != ifq)
|
||||
return -EFAULT;
|
||||
|
||||
if (!io_zcrx_queue_cqe(req, niov, ifq, off + skb_frag_off(frag), len))
|
||||
|
||||
Reference in New Issue
Block a user