netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pktgen - handle NETDEV_TX_LOCKED
@ 2004-09-22 21:11 Stephen Hemminger
  2004-09-23 20:08 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2004-09-22 21:11 UTC (permalink / raw)
  To: Robert Olsson, David S. Miller; +Cc: netdev

Change pktgen to handle drivers that return TX_LOCKED better.
This isn't a real busy state so just spin.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

diff -Nru a/net/core/pktgen.c b/net/core/pktgen.c
--- a/net/core/pktgen.c	2004-09-22 14:13:45 -07:00
+++ b/net/core/pktgen.c	2004-09-22 14:13:45 -07:00
@@ -587,11 +587,12 @@
 
 static void inject(struct pktgen_info* info)
 {
-	struct net_device *odev = NULL;
+	struct net_device *odev;
 	struct sk_buff *skb = NULL;
 	__u64 total = 0;
 	__u64 idle = 0;
 	__u64 lcount = 0;
+	int ret;
 	int nr_frags = 0;
 	int last_ok = 1;	   /* Was last skb sent? 
 				    * Or a failed transmit of some sort?  This will keep
@@ -640,19 +641,23 @@
 
 			atomic_inc(&skb->users);
 
-			if (odev->hard_start_xmit(skb, odev)) {
-
+		retry:
+			ret = odev->hard_start_xmit(skb, odev);
+			if (likely(ret == NETDEV_TX_OK)) {
+				last_ok = 1;	
+				info->sofar++;
+				info->seq_num++;
+			} else if (ret == NETDEV_TX_LOCKED 
+				   && (odev->features & NETIF_F_LLTX)) {
+				cpu_relax();
+				goto retry;
+			} else {
 				atomic_dec(&skb->users);
 				if (net_ratelimit()) {
 				   printk(KERN_INFO "Hard xmit error\n");
 				}
 				info->errors++;
 				last_ok = 0;
-			}
-			else {
-			   last_ok = 1;	
-			   info->sofar++;
-			   info->seq_num++;
 			}
 		}
 		else {

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

end of thread, other threads:[~2004-09-23 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-22 21:11 [PATCH] pktgen - handle NETDEV_TX_LOCKED Stephen Hemminger
2004-09-23 20:08 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).