lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110518220125.GA26835@redhat.com>
Date:	Thu, 19 May 2011 01:01:25 +0300
From:	"Michael S. Tsirkin" <mst@...hat.com>
To:	rusty@...tcorp.com.au, habanero@...ux.vnet.ibm.com,
	Shirley Ma <mashirle@...ibm.com>,
	Krishna Kumar2 <krkumar2@...ibm.com>, kvm@...r.kernel.org,
	steved@...ibm.com, Tom Lendacky <tahm@...ux.vnet.ibm.com>,
	borntraeger@...ibm.com, avi@...hat.com
Cc:	Rusty Russell <rusty@...tcorp.com.au>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling

The patch  virtio_net: limit xmit polling
got the logic reversed: it polled while we had
capacity not while ring was empty.

Fix it up and clean up a bit by using a for loop.

Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
---

OK, turns out that patch was borken. Here's
a fix that survived stress test on my box.
Pushed on my branch, I'll send a rebased series
with Rusty's comments addressed ASAP.

 drivers/net/virtio_net.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9982bd7..c8cd22d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -514,12 +514,14 @@ static bool free_old_xmit_skbs(struct virtnet_info *vi, int capacity)
 	struct sk_buff *skb;
 	unsigned int len;
 	bool c;
+	int n;
+
 	/* We try to free up at least 2 skbs per one sent, so that we'll get
 	 * all of the memory back if they are used fast enough. */
-	int n = 2;
-
-	while ((c = virtqueue_get_capacity(vi->svq) >= capacity) && --n > 0 &&
-	       (skb = virtqueue_get_buf(vi->svq, &len)) != NULL) {
+	for (n = 0;
+	     ((c = virtqueue_get_capacity(vi->svq)) < capacity || n < 2) &&
+	     ((skb = virtqueue_get_buf(vi->svq, &len)));
+	     ++n) {
 		pr_debug("Sent skb %p\n", skb);
 		vi->dev->stats.tx_bytes += skb->len;
 		vi->dev->stats.tx_packets++;
-- 
1.7.5.53.gc233e
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ