Skip to content

Commit

Permalink
virtio_net: remove hdr size from buf calculation
Browse files Browse the repository at this point in the history
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 <kshankar@marvell.com>
Change-Id: I7bcfa7323d5d209234704388efff2c1be33d155b
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/133739
Tested-by: sa_ip-toolkits-Jenkins <sa_ip-toolkits-jenkins@marvell.com>
Reviewed-by: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
  • Loading branch information
ShivaShankarKommula authored and jerinjacobk committed Aug 22, 2024
1 parent 7cf39fa commit 75e1615
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/virtio_net/virtio_net_enq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 75e1615

Please sign in to comment.