All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio_net: Use BUG_ON instead of if condition followed by BUG
@ 2021-05-17 13:31 Xianting Tian
  2021-05-17 14:35   ` Andrew Lunn
  2021-05-17 18:43 ` virtio_net: BQL? Dave Taht
  0 siblings, 2 replies; 20+ messages in thread
From: Xianting Tian @ 2021-05-17 13:31 UTC (permalink / raw)
  To: mst, jasowang, davem, kuba; +Cc: virtualization, netdev, linux-kernel

BUG_ON() uses unlikely in if(), which can be optimized at compile time.

Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
---
  drivers/net/virtio_net.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index c921ebf3ae82..212d52204884 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1646,10 +1646,9 @@ static int xmit_skb(struct send_queue *sq, struct 
sk_buff *skb)
  	else
  		hdr = skb_vnet_hdr(skb);

-	if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
+	BUG_ON(virtio_net_hdr_from_skb(skb, &hdr->hdr,
  				    virtio_is_little_endian(vi->vdev), false,
-				    0))
-		BUG();
+				    0));

  	if (vi->mergeable_rx_bufs)
  		hdr->num_buffers = 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-05-24  9:10 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 13:31 [PATCH] virtio_net: Use BUG_ON instead of if condition followed by BUG Xianting Tian
2021-05-17 14:35 ` Andrew Lunn
2021-05-17 14:35   ` Andrew Lunn
2021-05-18  9:20   ` Xianting Tian
2021-05-17 18:43 ` virtio_net: BQL? Dave Taht
2021-05-17 20:23   ` Willem de Bruijn
2021-05-17 20:23     ` Willem de Bruijn
2021-05-17 21:48     ` Dave Taht
2021-05-17 23:00       ` [Bloat] " Stephen Hemminger
2021-05-17 23:32         ` Dave Taht
2021-05-18  2:48           ` Stephen Hemminger
2021-05-19 14:31         ` Eric Dumazet
2021-05-19 14:31           ` Eric Dumazet
2021-05-19 22:53           ` Jakub Kicinski
2021-05-24  2:53       ` Jason Wang
2021-05-24  2:53         ` Jason Wang
2021-05-24  9:10         ` Michael S. Tsirkin
2021-05-24  9:10           ` Michael S. Tsirkin
2021-05-19  8:35   ` Michael S. Tsirkin
2021-05-19  8:35     ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.