Parav Pandit
2023-Jan-13 22:36 UTC
[PATCH net-next 0/2] Small packet processing handling changes
Hi, These two changes improve the small packet handling. Patch summary: patch-1 fixes the length check by considering Ethernet 60B frame size patch-2 avoids code duplication by reuses existing buffer free helper Please review. Parav Pandit (2): virtio_net: Fix short frame length check virtio_net: Reuse buffer free function drivers/net/virtio_net.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) -- 2.26.2
Parav Pandit
2023-Jan-13 22:36 UTC
[PATCH net-next 1/2] virtio_net: Fix short frame length check
A smallest Ethernet frame defined by IEEE 802.3 is 60 bytes without any preemble and CRC. Current code only checks for minimal 14 bytes of Ethernet header length. Correct it to consider the minimum Ethernet frame length. Fixes: 296f96fcfc16 ("Net driver using virtio") Signed-off-by: Parav Pandit <parav at nvidia.com> --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7723b2a49d8e..d45e140b6852 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1248,7 +1248,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq, struct sk_buff *skb; struct virtio_net_hdr_mrg_rxbuf *hdr; - if (unlikely(len < vi->hdr_len + ETH_HLEN)) { + if (unlikely(len < vi->hdr_len + ETH_ZLEN)) { pr_debug("%s: short packet %i\n", dev->name, len); dev->stats.rx_length_errors++; if (vi->mergeable_rx_bufs) { -- 2.26.2
Parav Pandit
2023-Jan-13 22:36 UTC
[PATCH net-next 2/2] virtio_net: Reuse buffer free function
virtnet_rq_free_unused_buf() helper function to free the buffer already exists. Avoid code duplication by reusing existing function. Signed-off-by: Parav Pandit <parav at nvidia.com> --- drivers/net/virtio_net.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d45e140b6852..c1faaf11fbcd 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1251,13 +1251,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq, if (unlikely(len < vi->hdr_len + ETH_ZLEN)) { pr_debug("%s: short packet %i\n", dev->name, len); dev->stats.rx_length_errors++; - if (vi->mergeable_rx_bufs) { - put_page(virt_to_head_page(buf)); - } else if (vi->big_packets) { - give_pages(rq, buf); - } else { - put_page(virt_to_head_page(buf)); - } + virtnet_rq_free_unused_buf(rq->vq, buf); return; } -- 2.26.2
Parav Pandit
2023-Jan-14 17:46 UTC
[PATCH net-next 0/2] Small packet processing handling changes
Hi Jakub, Dave,> From: Parav Pandit <parav at nvidia.com> > Sent: Friday, January 13, 2023 5:36 PM > > Hi, > > These two changes improve the small packet handling. > > Patch summary: > patch-1 fixes the length check by considering Ethernet 60B frame size > patch-2 avoids code duplication by reuses existing buffer free helper > > Please review. > > Parav Pandit (2): > virtio_net: Fix short frame length check > virtio_net: Reuse buffer free function >Please drop this series. I will drop first patch as it was wrong. Will send 2nd patch as v2 which was reviewed.