Commit f47e8f61 authored by Bui Quang Minh's avatar Bui Quang Minh Committed by Jakub Kicinski
Browse files

virtio-net: xsk: rx: move the xdp->data adjustment to buf_to_xdp()



This commit does not do any functional changes. It moves xdp->data
adjustment for buffer other than first buffer to buf_to_xdp() helper so
that the xdp_buff adjustment does not scatter over different functions.

Signed-off-by: default avatarBui Quang Minh <minhquangbui99@gmail.com>
Link: https://patch.msgid.link/20250705075515.34260-1-minhquangbui99@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b4bb2ac0
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1179,7 +1179,14 @@ static struct xdp_buff *buf_to_xdp(struct virtnet_info *vi,
		return NULL;
	}

	if (first_buf) {
		xsk_buff_set_size(xdp, len);
	} else {
		xdp_prepare_buff(xdp, xdp->data_hard_start,
				 XDP_PACKET_HEADROOM - vi->hdr_len, len, 1);
		xdp->flags = 0;
	}

	xsk_buff_dma_sync_for_cpu(xdp);

	return xdp;
@@ -1304,7 +1311,7 @@ static int xsk_append_merge_buffer(struct virtnet_info *vi,
			goto err;
		}

		memcpy(buf, xdp->data - vi->hdr_len, len);
		memcpy(buf, xdp->data, len);

		xsk_buff_free(xdp);