Skip to content

Commit 1e405c1

Browse files
Björn Töpelborkmann
authored andcommitted
xsk: do not remove umem from netdevice on fall-back to copy-mode
Commit c9b47cc ("xsk: fix bug when trying to use both copy and zero-copy on one queue id") stores the umem into the netdev._rx struct. However, the patch incorrectly removed the umem from the netdev._rx struct when user-space passed "best-effort" mode (i.e. select the fastest possible option available), and zero-copy mode was not available. This commit fixes that. Fixes: c9b47cc ("xsk: fix bug when trying to use both copy and zero-copy on one queue id") Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent e451eb5 commit 1e405c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/xdp/xdp_umem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev,
125125
return 0;
126126

127127
err_unreg_umem:
128-
xdp_clear_umem_at_qid(dev, queue_id);
129128
if (!force_zc)
130129
err = 0; /* fallback to copy mode */
130+
if (err)
131+
xdp_clear_umem_at_qid(dev, queue_id);
131132
out_rtnl_unlock:
132133
rtnl_unlock();
133134
return err;

0 commit comments

Comments
 (0)