From 75e1615ad952b1f73d30e7a839182d2e660bca3e Mon Sep 17 00:00:00 2001 From: Kommula Shiva Shankar Date: Mon, 19 Aug 2024 15:23:45 +0530 Subject: [PATCH] virtio_net: remove hdr size from buf calculation The number of virtio ring descriptors required for enqueueing is determined by the packet data size plus the virtio header size. The resulting descriptor count includes the virtio header size to be copied to the ring. If the difference between the source length (slen) and destination length (dlen) is less than the size of the virtio header, we will end up skipping the same amount of packet data during the DMA copy because of the enqueue count calculation. Therefore, removed virtio header size subtraction from the loop Signed-off-by: Kommula Shiva Shankar Change-Id: I7bcfa7323d5d209234704388efff2c1be33d155b Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/133739 Tested-by: sa_ip-toolkits-Jenkins Reviewed-by: Nithin Kumar Dabilpuram --- lib/virtio_net/virtio_net_enq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/virtio_net/virtio_net_enq.c b/lib/virtio_net/virtio_net_enq.c index f332173..dc36b45 100644 --- a/lib/virtio_net/virtio_net_enq.c +++ b/lib/virtio_net/virtio_net_enq.c @@ -68,7 +68,7 @@ process_mseg_pkts_enq(struct virtio_net_queue *q, struct dao_dma_vchan_state *me mbuf_arr[off] = mbuf; for (cnt = 0; cnt < nb_enq; cnt++) { d_flags = *DESC_PTR_OFF(sd_desc_base, off, 8); - buf_len = (d_flags & (RTE_BIT64(32) - 1)) - vhdr_sz; + buf_len = (d_flags & (RTE_BIT64(32) - 1)); if (flags & VIRTIO_NET_ENQ_OFFLOAD_NOFF) slen = slen ? slen : 1;